@anker-in/headless-ui 1.0.9-temp-13 → 1.0.9-temp-14

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.
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var I=Object.create;var c=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var _=(t,e)=>{for(var r in e)c(t,r,{get:e[r],enumerable:!0})},y=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of j(e))!F.call(t,n)&&n!==r&&c(t,n,{get:()=>e[n],enumerable:!(s=U(e,n))||s.enumerable});return t};var q=(t,e,r)=>(r=t!=null?I(C(t)):{},y(e||!t||!t.__esModule?c(r,"default",{value:t,enumerable:!0}):r,t)),A=t=>y(c({},"__esModule",{value:!0}),t);var K={};_(K,{default:()=>J});module.exports=A(K);var i=require("react/jsx-runtime"),o=q(require("react")),m=require("gsap"),d=require("gsap/dist/SplitText"),g=require("gsap/dist/ScrollTrigger"),h=require("../../helpers/utils.js"),b=require("../../components/index.js"),v=require("../../shared/Styles.js"),R=require("../../shared/trackUrlRef.js"),S=require("react-intersection-observer");const B="link",G="title",k=o.default.forwardRef(({data:t,className:e})=>{const{title:r,theme:s,extension:n}=t,l=(0,o.useRef)(null),a=(0,o.useRef)(null),p=(0,o.useRef)(null),{ref:H,inView:w}=(0,S.useInView)();return(0,o.useEffect)(()=>{m.gsap.registerPlugin(d.SplitText,g.ScrollTrigger);function L(){if(!l.current)return;const N=l.current?.clientHeight||80;a.current=new d.SplitText(l.current,{type:"words",wordsClass:"word"});const u=a.current.words;m.gsap.set(u,{opacity:0}),p.current=g.ScrollTrigger.create({trigger:l.current,start:"bottom bottom-=4%",end:`bottom+=${N*1.5+60}px bottom-=4%`,scrub:!0,onUpdate:E=>{const M=E.progress,T=u.length,D=1/T,x=.5;u.forEach((P,V)=>{const $=V/T*(1-x),z=D*(1+x);let f=(M-$)/z;f=Math.max(0,Math.min(f,1)),m.gsap.set(P,{opacity:f})})}})}return w&&L(),()=>{a.current&&a.current.revert(),p.current&&p.current.kill()}},[w]),r&&(0,i.jsxs)("div",{className:"mb-6 flex items-end justify-between",ref:H,children:[(0,i.jsx)("div",{className:(0,h.cn)("space-y-4",e,{"aiui-dark":s==="dark"}),children:(0,i.jsx)(b.Heading,{ref:l,as:"h2",size:4,html:r})}),n?.textLink&&(0,i.jsx)("a",{className:(0,h.cn)({"aiui-dark":s==="dark"},"text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]"),href:(0,R.trackUrlRef)(n?.link,`${B}_${G}`),children:n?.textLink})]})});k.displayName="Title";var J=(0,v.withLayout)(k,{container:{desktopSpan:12,mobileSpan:12}});
1
+ "use strict";"use client";var _=Object.create;var a=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var J=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},k=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of A(e))!G.call(t,o)&&o!==n&&a(t,o,{get:()=>e[o],enumerable:!(s=q(e,o))||s.enumerable});return t};var K=(t,e,n)=>(n=t!=null?_(B(t)):{},k(e||!t||!t.__esModule?a(n,"default",{value:t,enumerable:!0}):n,t)),O=t=>k(a({},"__esModule",{value:!0}),t);var W={};J(W,{default:()=>Q});module.exports=O(W);var i=require("react/jsx-runtime"),r=K(require("react")),m=require("gsap"),T=require("gsap/dist/SplitText"),h=require("gsap/dist/ScrollTrigger"),w=require("../../helpers/utils.js"),E=require("../../components/index.js"),L=require("../../shared/Styles.js"),M=require("../../hooks/useExposure.js"),D=require("../../shared/trackUrlRef.js"),N=require("react-intersection-observer");const b="link",R="title",H=r.default.forwardRef(({data:t,className:e},n)=>{const{title:s,theme:o,extension:u}=t,p=(0,r.useRef)(null),l=(0,r.useRef)(null),c=(0,r.useRef)(null),f=(0,r.useRef)(null),{ref:S,inView:x}=(0,N.useInView)();return(0,r.useImperativeHandle)(n,()=>p.current),(0,M.useExposure)(p,{componentType:b,componentName:R,componentTitle:t?.title}),(0,r.useEffect)(()=>{m.gsap.registerPlugin(T.SplitText,h.ScrollTrigger);function I(){if(!l.current)return;const P=l.current?.clientHeight||80;c.current=new T.SplitText(l.current,{type:"words",wordsClass:"word"});const d=c.current.words;m.gsap.set(d,{opacity:0}),f.current=h.ScrollTrigger.create({trigger:l.current,start:"bottom bottom-=4%",end:`bottom+=${P*1.5+60}px bottom-=4%`,scrub:!0,onUpdate:V=>{const $=V.progress,v=d.length,z=1/v,y=.5;d.forEach((U,j)=>{const C=j/v*(1-y),F=z*(1+y);let g=($-C)/F;g=Math.max(0,Math.min(g,1)),m.gsap.set(U,{opacity:g})})}})}return x&&I(),()=>{c.current&&c.current.revert(),f.current&&f.current.kill()}},[x]),s&&(0,i.jsxs)("div",{className:"mb-6 flex items-end justify-between",ref:p,children:[(0,i.jsx)("div",{ref:S,className:(0,w.cn)("space-y-4",e,{"aiui-dark":o==="dark"}),children:(0,i.jsx)(E.Heading,{ref:l,as:"h2",size:4,html:s})}),u?.textLink&&(0,i.jsx)("a",{className:(0,w.cn)({"aiui-dark":o==="dark"},"text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]"),href:(0,D.trackUrlRef)(u?.link,`${b}_${R}`),children:u?.textLink})]})});H.displayName="Title";var Q=(0,L.withLayout)(H);
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/Title/index.tsx"],
4
- "sourcesContent": ["'use client'\nimport React, { useEffect, useRef } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { Heading } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className }) => {\n const { title, theme, extension } = data\n const titleRef = useRef<HTMLHeadingElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const { ref: inViewRef, inView } = useInView()\n\n useEffect(() => {\n gsap.registerPlugin(SplitText, ScrollTrigger)\n function gsapResize() {\n if (!titleRef.current) return\n const height = titleRef.current?.clientHeight || 80\n splitTextInstance.current = new SplitText(titleRef.current, {\n type: 'words',\n wordsClass: 'word',\n })\n const words = splitTextInstance.current.words\n gsap.set(words, { opacity: 0 })\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom-=4%',\n end: `bottom+=${height * 1.5 + 60}px bottom-=4%`,\n scrub: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n const total = words.length\n const interval = 1 / total\n const overlap = 0.5\n words.forEach((word: any, i: number) => {\n const start = (i / total) * (1 - overlap)\n const width = interval * (1 + overlap)\n let opacity = (progress - start) / width\n opacity = Math.max(0, Math.min(opacity, 1))\n gsap.set(word, { opacity })\n })\n },\n })\n }\n\n if (inView) {\n gsapResize()\n }\n\n return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n // ScrollTrigger.getAll().forEach((t: { kill: () => any }) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n title && (\n <div className=\"mb-6 flex items-end justify-between\" ref={inViewRef}>\n <div className={cn('space-y-4', className, { 'aiui-dark': theme === 'dark' })}>\n <Heading ref={titleRef} as=\"h2\" size={4} html={title} />\n </div>\n {extension?.textLink && (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]'\n )}\n href={trackUrlRef(extension?.link, `${componentType}_${componentName}`)}\n >\n {extension?.textLink}\n </a>\n )}\n </div>\n )\n )\n})\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title, {\n container: {\n desktopSpan: 12,\n mobileSpan: 12,\n },\n})\n"],
5
- "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAoEM,IAAAI,EAAA,6BAnENC,EAAyC,oBACzCC,EAAqB,gBACrBC,EAA0B,+BAC1BC,EAA8B,mCAC9BC,EAAmB,kCACnBC,EAAwB,qCACxBC,EAA2B,kCAE3BC,EAA4B,uCAC5BC,EAA0B,uCAE1B,MAAMC,EAAgB,OAChBC,EAAgB,QAEhBC,EAAQ,EAAAC,QAAM,WAAuC,CAAC,CAAE,KAAAC,EAAM,UAAAC,CAAU,IAAM,CAClF,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,UAAAC,CAAU,EAAIJ,EAC9BK,KAAW,UAA2B,IAAI,EAC1CC,KAAoB,UAAyB,IAAI,EACjDC,KAAmB,UAA6B,IAAI,EAEpD,CAAE,IAAKC,EAAW,OAAAC,CAAO,KAAI,aAAU,EAE7C,sBAAU,IAAM,CACd,OAAK,eAAe,YAAW,eAAa,EAC5C,SAASC,GAAa,CACpB,GAAI,CAACL,EAAS,QAAS,OACvB,MAAMM,EAASN,EAAS,SAAS,cAAgB,GACjDC,EAAkB,QAAU,IAAI,YAAUD,EAAS,QAAS,CAC1D,KAAM,QACN,WAAY,MACd,CAAC,EACD,MAAMO,EAAQN,EAAkB,QAAQ,MACxC,OAAK,IAAIM,EAAO,CAAE,QAAS,CAAE,CAAC,EAC9BL,EAAiB,QAAU,gBAAc,OAAO,CAC9C,QAASF,EAAS,QAClB,MAAO,oBACP,IAAK,WAAWM,EAAS,IAAM,EAAE,gBACjC,MAAO,GACP,SAAWE,GAAc,CACvB,MAAMC,EAAWD,EAAK,SAChBE,EAAQH,EAAM,OACdI,EAAW,EAAID,EACfE,EAAU,GAChBL,EAAM,QAAQ,CAACM,EAAWC,IAAc,CACtC,MAAMC,EAASD,EAAIJ,GAAU,EAAIE,GAC3BI,EAAQL,GAAY,EAAIC,GAC9B,IAAIK,GAAWR,EAAWM,GAASC,EACnCC,EAAU,KAAK,IAAI,EAAG,KAAK,IAAIA,EAAS,CAAC,CAAC,EAC1C,OAAK,IAAIJ,EAAM,CAAE,QAAAI,CAAQ,CAAC,CAC5B,CAAC,CACH,CACF,CAAC,CACH,CAEA,OAAIb,GACFC,EAAW,EAGN,IAAM,CACXJ,EAAkB,SAAWA,EAAkB,QAAQ,OAAO,EAE9DC,EAAiB,SAAWA,EAAiB,QAAQ,KAAK,CAC5D,CACF,EAAG,CAACE,CAAM,CAAC,EAGTP,MACE,QAAC,OAAI,UAAU,sCAAsC,IAAKM,EACxD,oBAAC,OAAI,aAAW,MAAG,YAAaP,EAAW,CAAE,YAAaE,IAAU,MAAO,CAAC,EAC1E,mBAAC,WAAQ,IAAKE,EAAU,GAAG,KAAK,KAAM,EAAG,KAAMH,EAAO,EACxD,EACCE,GAAW,aACV,OAAC,KACC,aAAW,MACT,CAAE,YAAaD,IAAU,MAAO,EAChC,oGACF,EACA,QAAM,eAAYC,GAAW,KAAM,GAAGR,CAAa,IAAIC,CAAa,EAAE,EAErE,SAAAO,GAAW,SACd,GAEJ,CAGN,CAAC,EAEDN,EAAM,YAAc,QAEpB,IAAOd,KAAQ,cAAWc,EAAO,CAC/B,UAAW,CACT,YAAa,GACb,WAAY,EACd,CACF,CAAC",
6
- "names": ["Title_exports", "__export", "Title_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_gsap", "import_SplitText", "import_ScrollTrigger", "import_utils", "import_components", "import_Styles", "import_trackUrlRef", "import_react_intersection_observer", "componentType", "componentName", "Title", "React", "data", "className", "title", "theme", "extension", "titleRef", "splitTextInstance", "scrollTriggerRef", "inViewRef", "inView", "gsapResize", "height", "words", "self", "progress", "total", "interval", "overlap", "word", "i", "start", "width", "opacity"]
4
+ "sourcesContent": ["'use client'\nimport React, { useEffect, useRef, useImperativeHandle } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { Heading } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className }, ref) => {\n const { title, theme, extension } = data\n const innerRef = useRef<HTMLDivElement>(null)\n const titleRef = useRef<HTMLHeadingElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\n\n useEffect(() => {\n gsap.registerPlugin(SplitText, ScrollTrigger)\n function gsapResize() {\n if (!titleRef.current) return\n const height = titleRef.current?.clientHeight || 80\n splitTextInstance.current = new SplitText(titleRef.current, {\n type: 'words',\n wordsClass: 'word',\n })\n const words = splitTextInstance.current.words\n gsap.set(words, { opacity: 0 })\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom-=4%',\n end: `bottom+=${height * 1.5 + 60}px bottom-=4%`,\n scrub: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n const total = words.length\n const interval = 1 / total\n const overlap = 0.5\n words.forEach((word: any, i: number) => {\n const start = (i / total) * (1 - overlap)\n const width = interval * (1 + overlap)\n let opacity = (progress - start) / width\n opacity = Math.max(0, Math.min(opacity, 1))\n gsap.set(word, { opacity })\n })\n },\n })\n }\n\n if (inView) {\n gsapResize()\n }\n\n return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n // ScrollTrigger.getAll().forEach((t: { kill: () => any }) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n title && (\n <div className=\"mb-6 flex items-end justify-between\" ref={innerRef}>\n <div ref={inViewRef} className={cn('space-y-4', className, { 'aiui-dark': theme === 'dark' })}>\n <Heading ref={titleRef} as=\"h2\" size={4} html={title} />\n </div>\n {extension?.textLink && (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]'\n )}\n href={trackUrlRef(extension?.link, `${componentType}_${componentName}`)}\n >\n {extension?.textLink}\n </a>\n )}\n </div>\n )\n )\n})\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
5
+ "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA8EM,IAAAI,EAAA,6BA7ENC,EAA8D,oBAC9DC,EAAqB,gBACrBC,EAA0B,+BAC1BC,EAA8B,mCAC9BC,EAAmB,kCACnBC,EAAwB,qCACxBC,EAA2B,kCAE3BC,EAA4B,sCAC5BC,EAA4B,uCAC5BC,EAA0B,uCAE1B,MAAMC,EAAgB,OAChBC,EAAgB,QAEhBC,EAAQ,EAAAC,QAAM,WAAuC,CAAC,CAAE,KAAAC,EAAM,UAAAC,CAAU,EAAGC,IAAQ,CACvF,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,UAAAC,CAAU,EAAIL,EAC9BM,KAAW,UAAuB,IAAI,EACtCC,KAAW,UAA2B,IAAI,EAC1CC,KAAoB,UAAyB,IAAI,EACjDC,KAAmB,UAA6B,IAAI,EAEpD,CAAE,IAAKC,EAAW,O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AO,CAAC,EAC1F,mBAAC,WAAQ,IAAKG,EAAU,GAAG,KAAK,KAAM,EAAG,KAAMJ,EAAO,EACxD,EACCE,GAAW,aACV,OAAC,KACC,aAAW,MACT,CAAE,YAAaD,IAAU,MAAO,EAChC,oGACF,EACA,QAAM,eAAYC,GAAW,KAAM,GAAGT,CAAa,IAAIC,CAAa,EAAE,EAErE,SAAAQ,GAAW,SACd,GAEJ,CAGN,CAAC,EAEDP,EAAM,YAAc,QAEpB,IAAOf,KAAQ,cAAWe,CAAK",
6
+ "names": ["Title_exports", "__export", "Title_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_gsap", "import_SplitText", "import_ScrollTrigger", "import_utils", "import_components", "import_Styles", "import_useExposure", "import_trackUrlRef", "import_react_intersection_observer", "componentType", "componentName", "Title", "React", "data", "className", "ref", "title", "theme", "extension", "innerRef", "titleRef", "splitTextInstance", "scrollTriggerRef", "inViewRef", "inView", "gsapResize", "height", "words", "self", "progress", "total", "interval", "overlap", "word", "i", "start", "width", "opacity"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as a,jsxs as j}from"react/jsx-runtime";import M,{useEffect as D,useRef as s}from"react";import{gsap as l}from"gsap";import{SplitText as d}from"gsap/dist/SplitText";import{ScrollTrigger as g}from"gsap/dist/ScrollTrigger";import{cn as h}from"../../helpers/utils.js";import{Heading as P}from"../../components/index.js";import{withLayout as V}from"../../shared/Styles.js";import{trackUrlRef as $}from"../../shared/trackUrlRef.js";import{useInView as z}from"react-intersection-observer";const I="link",U="title",w=M.forwardRef(({data:T,className:x})=>{const{title:c,theme:m,extension:r}=T,t=s(null),e=s(null),n=s(null),{ref:y,inView:p}=z();return D(()=>{l.registerPlugin(d,g);function k(){if(!t.current)return;const b=t.current?.clientHeight||80;e.current=new d(t.current,{type:"words",wordsClass:"word"});const o=e.current.words;l.set(o,{opacity:0}),n.current=g.create({trigger:t.current,start:"bottom bottom-=4%",end:`bottom+=${b*1.5+60}px bottom-=4%`,scrub:!0,onUpdate:v=>{const R=v.progress,u=o.length,S=1/u,f=.5;o.forEach((H,L)=>{const N=L/u*(1-f),E=S*(1+f);let i=(R-N)/E;i=Math.max(0,Math.min(i,1)),l.set(H,{opacity:i})})}})}return p&&k(),()=>{e.current&&e.current.revert(),n.current&&n.current.kill()}},[p]),c&&j("div",{className:"mb-6 flex items-end justify-between",ref:y,children:[a("div",{className:h("space-y-4",x,{"aiui-dark":m==="dark"}),children:a(P,{ref:t,as:"h2",size:4,html:c})}),r?.textLink&&a("a",{className:h({"aiui-dark":m==="dark"},"text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]"),href:$(r?.link,`${I}_${U}`),children:r?.textLink})]})});w.displayName="Title";var O=V(w,{container:{desktopSpan:12,mobileSpan:12}});export{O as default};
1
+ "use client";import{jsx as a,jsxs as q}from"react/jsx-runtime";import V,{useEffect as $,useRef as r,useImperativeHandle as z}from"react";import{gsap as c}from"gsap";import{SplitText as T}from"gsap/dist/SplitText";import{ScrollTrigger as h}from"gsap/dist/ScrollTrigger";import{cn as w}from"../../helpers/utils.js";import{Heading as U}from"../../components/index.js";import{withLayout as j}from"../../shared/Styles.js";import{useExposure as C}from"../../hooks/useExposure.js";import{trackUrlRef as F}from"../../shared/trackUrlRef.js";import{useInView as _}from"react-intersection-observer";const x="link",v="title",y=V.forwardRef(({data:m,className:k},b)=>{const{title:u,theme:p,extension:n}=m,o=r(null),t=r(null),e=r(null),i=r(null),{ref:R,inView:f}=_();return z(b,()=>o.current),C(o,{componentType:x,componentName:v,componentTitle:m?.title}),$(()=>{c.registerPlugin(T,h);function H(){if(!t.current)return;const E=t.current?.clientHeight||80;e.current=new T(t.current,{type:"words",wordsClass:"word"});const s=e.current.words;c.set(s,{opacity:0}),i.current=h.create({trigger:t.current,start:"bottom bottom-=4%",end:`bottom+=${E*1.5+60}px bottom-=4%`,scrub:!0,onUpdate:L=>{const M=L.progress,d=s.length,D=1/d,g=.5;s.forEach((N,S)=>{const I=S/d*(1-g),P=D*(1+g);let l=(M-I)/P;l=Math.max(0,Math.min(l,1)),c.set(N,{opacity:l})})}})}return f&&H(),()=>{e.current&&e.current.revert(),i.current&&i.current.kill()}},[f]),u&&q("div",{className:"mb-6 flex items-end justify-between",ref:o,children:[a("div",{ref:R,className:w("space-y-4",k,{"aiui-dark":p==="dark"}),children:a(U,{ref:t,as:"h2",size:4,html:u})}),n?.textLink&&a("a",{className:w({"aiui-dark":p==="dark"},"text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]"),href:F(n?.link,`${x}_${v}`),children:n?.textLink})]})});y.displayName="Title";var Z=j(y);export{Z as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/Title/index.tsx"],
4
- "sourcesContent": ["'use client'\nimport React, { useEffect, useRef } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { Heading } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className }) => {\n const { title, theme, extension } = data\n const titleRef = useRef<HTMLHeadingElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const { ref: inViewRef, inView } = useInView()\n\n useEffect(() => {\n gsap.registerPlugin(SplitText, ScrollTrigger)\n function gsapResize() {\n if (!titleRef.current) return\n const height = titleRef.current?.clientHeight || 80\n splitTextInstance.current = new SplitText(titleRef.current, {\n type: 'words',\n wordsClass: 'word',\n })\n const words = splitTextInstance.current.words\n gsap.set(words, { opacity: 0 })\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom-=4%',\n end: `bottom+=${height * 1.5 + 60}px bottom-=4%`,\n scrub: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n const total = words.length\n const interval = 1 / total\n const overlap = 0.5\n words.forEach((word: any, i: number) => {\n const start = (i / total) * (1 - overlap)\n const width = interval * (1 + overlap)\n let opacity = (progress - start) / width\n opacity = Math.max(0, Math.min(opacity, 1))\n gsap.set(word, { opacity })\n })\n },\n })\n }\n\n if (inView) {\n gsapResize()\n }\n\n return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n // ScrollTrigger.getAll().forEach((t: { kill: () => any }) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n title && (\n <div className=\"mb-6 flex items-end justify-between\" ref={inViewRef}>\n <div className={cn('space-y-4', className, { 'aiui-dark': theme === 'dark' })}>\n <Heading ref={titleRef} as=\"h2\" size={4} html={title} />\n </div>\n {extension?.textLink && (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]'\n )}\n href={trackUrlRef(extension?.link, `${componentType}_${componentName}`)}\n >\n {extension?.textLink}\n </a>\n )}\n </div>\n )\n )\n})\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title, {\n container: {\n desktopSpan: 12,\n mobileSpan: 12,\n },\n})\n"],
5
- "mappings": "aAoEM,OAEI,OAAAA,EAFJ,QAAAC,MAAA,oBAnEN,OAAOC,GAAS,aAAAC,EAAW,UAAAC,MAAc,QACzC,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,sBAC1B,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,MAAAC,MAAU,yBACnB,OAAS,WAAAC,MAAe,4BACxB,OAAS,cAAAC,MAAkB,yBAE3B,OAAS,eAAAC,MAA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AkB,SAAWA,EAAkB,QAAQ,OAAO,EAE9DC,EAAiB,SAAWA,EAAiB,QAAQ,KAAK,CAC5D,CACF,EAAG,CAACE,CAAM,CAAC,EAGTP,GACEjB,EAAC,OAAI,UAAU,sCAAsC,IAAKuB,EACxD,UAAAxB,EAAC,OAAI,UAAWQ,EAAG,YAAaS,EAAW,CAAE,YAAaE,IAAU,MAAO,CAAC,EAC1E,SAAAnB,EAACS,EAAA,CAAQ,IAAKY,EAAU,GAAG,KAAK,KAAM,EAAG,KAAMH,EAAO,EACxD,EACCE,GAAW,UACVpB,EAAC,KACC,UAAWQ,EACT,CAAE,YAAaW,IAAU,MAAO,EAChC,oGACF,EACA,KAAMR,EAAYS,GAAW,KAAM,GAAGP,CAAa,IAAIC,CAAa,EAAE,EAErE,SAAAM,GAAW,SACd,GAEJ,CAGN,CAAC,EAEDL,EAAM,YAAc,QAEpB,IAAOwB,EAAQ7B,EAAWK,EAAO,CAC/B,UAAW,CACT,YAAa,GACb,WAAY,EACd,CACF,CAAC",
6
- "names": ["jsx", "jsxs", "React", "useEffect", "useRef", "gsap", "SplitText", "ScrollTrigger", "cn", "Heading", "withLayout", "trackUrlRef", "useInView", "componentType", "componentName", "Title", "data", "className", "title", "theme", "extension", "titleRef", "splitTextInstance", "scrollTriggerRef", "inViewRef", "inView", "gsapResize", "height", "words", "self", "progress", "total", "interval", "overlap", "word", "i", "start", "width", "opacity", "Title_default"]
4
+ "sourcesContent": ["'use client'\nimport React, { useEffect, useRef, useImperativeHandle } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { Heading } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className }, ref) => {\n const { title, theme, extension } = data\n const innerRef = useRef<HTMLDivElement>(null)\n const titleRef = useRef<HTMLHeadingElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\n\n useEffect(() => {\n gsap.registerPlugin(SplitText, ScrollTrigger)\n function gsapResize() {\n if (!titleRef.current) return\n const height = titleRef.current?.clientHeight || 80\n splitTextInstance.current = new SplitText(titleRef.current, {\n type: 'words',\n wordsClass: 'word',\n })\n const words = splitTextInstance.current.words\n gsap.set(words, { opacity: 0 })\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom-=4%',\n end: `bottom+=${height * 1.5 + 60}px bottom-=4%`,\n scrub: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n const total = words.length\n const interval = 1 / total\n const overlap = 0.5\n words.forEach((word: any, i: number) => {\n const start = (i / total) * (1 - overlap)\n const width = interval * (1 + overlap)\n let opacity = (progress - start) / width\n opacity = Math.max(0, Math.min(opacity, 1))\n gsap.set(word, { opacity })\n })\n },\n })\n }\n\n if (inView) {\n gsapResize()\n }\n\n return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n // ScrollTrigger.getAll().forEach((t: { kill: () => any }) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n title && (\n <div className=\"mb-6 flex items-end justify-between\" ref={innerRef}>\n <div ref={inViewRef} className={cn('space-y-4', className, { 'aiui-dark': theme === 'dark' })}>\n <Heading ref={titleRef} as=\"h2\" size={4} html={title} />\n </div>\n {extension?.textLink && (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]'\n )}\n href={trackUrlRef(extension?.link, `${componentType}_${componentName}`)}\n >\n {extension?.textLink}\n </a>\n )}\n </div>\n )\n )\n})\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
5
+ "mappings": "aA8EM,OAEI,OAAAA,EAFJ,QAAAC,MAAA,oBA7EN,OAAOC,GAAS,aAAAC,EAAW,UAAAC,EAAQ,uBAAAC,MAA2B,QAC9D,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,sBAC1B,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,MAAAC,MAAU,yBACnB,OAAS,WAAAC,MAAe,4BACxB,OAAS,cAAAC,MAAkB,yBAE3B,OAAS,eAAAC,MAAmB,6BAC5B,OAAS,eAAAC,MAAmB,8BAC5B,OAAS,aAAAC,MAAiB,8BAE1B,MAAMC,EAAgB,OAChBC,EAAgB,QAEhBC,EAAQf,EAAM,WAAuC,CAAC,CAAE,KAAAgB,EAAM,UAAAC,CAAU,EAAGC,IAAQ,CACvF,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,UAAAC,CAAU,EAAIL,EAC9BM,EAAWpB,EAAuB,IAAI,EACtCqB,EAAWrB,EAA2B,IAAI,EAC1CsB,EAAoBtB,EAAyB,IAAI,EACjDuB,EAAmBvB,EAA6B,IAAI,EAEpD,CAAE,IAAKwB,EAAW,OAAAC,CAAO,EAAIf,EAAU,EAE7C,OAAAT,EAAoBe,EAAK,IAAMI,EAAS,OAAyB,EAEjEZ,EAAYY,EAAU,CACpB,cAAAT,EACA,cAAAC,EACA,eAAgBE,GAAM,KACxB,CAAC,EAEDf,EAAU,IAAM,CACdG,EAAK,eAAeC,EAAWC,CAAa,EAC5C,SAASsB,GAAa,CACpB,GAAI,CAACL,EAAS,QAAS,OACvB,MAAMM,EAASN,EAAS,SAAS,cAAgB,GACjDC,EAAkB,QAAU,IAAInB,EAAUkB,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EAEDN,EAAM,YAAc,QAEpB,IAAO0B,EAAQhC,EAAWM,CAAK",
6
+ "names": ["jsx", "jsxs", "React", "useEffect", "useRef", "useImperativeHandle", "gsap", "SplitText", "ScrollTrigger", "cn", "Heading", "withLayout", "useExposure", "trackUrlRef", "useInView", "componentType", "componentName", "Title", "data", "className", "ref", "title", "theme", "extension", "innerRef", "titleRef", "splitTextInstance", "scrollTriggerRef", "inViewRef", "inView", "gsapResize", "height", "words", "self", "progress", "total", "interval", "overlap", "word", "i", "start", "width", "opacity", "Title_default"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anker-in/headless-ui",
3
- "version": "1.0.9-temp-13",
3
+ "version": "1.0.9-temp-14",
4
4
  "type": "commonjs",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/cjs/index.d.ts",