@tamagui/logo 1.124.6 → 1.124.8
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/cjs/LogoWords.cjs +14 -14
- package/dist/cjs/LogoWords.js +11 -14
- package/dist/cjs/LogoWords.js.map +1 -1
- package/dist/cjs/LogoWords.native.js +18 -28
- package/dist/cjs/LogoWords.native.js.map +2 -2
- package/dist/cjs/ThemeTint.cjs +54 -0
- package/dist/cjs/ThemeTint.js +38 -0
- package/dist/cjs/ThemeTint.js.map +6 -0
- package/dist/cjs/ThemeTint.native.js +42 -0
- package/dist/cjs/ThemeTint.native.js.map +6 -0
- package/dist/cjs/index.cjs +2 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +3 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/useTint.cjs +27 -56
- package/dist/cjs/useTint.js +1 -18
- package/dist/cjs/useTint.js.map +1 -1
- package/dist/cjs/useTint.native.js +1 -19
- package/dist/cjs/useTint.native.js.map +2 -2
- package/dist/esm/LogoWords.js +11 -14
- package/dist/esm/LogoWords.js.map +1 -1
- package/dist/esm/LogoWords.mjs +14 -14
- package/dist/esm/LogoWords.mjs.map +1 -1
- package/dist/esm/LogoWords.native.js +18 -28
- package/dist/esm/LogoWords.native.js.map +2 -2
- package/dist/esm/ThemeTint.js +24 -0
- package/dist/esm/ThemeTint.js.map +6 -0
- package/dist/esm/ThemeTint.mjs +30 -0
- package/dist/esm/ThemeTint.mjs.map +1 -0
- package/dist/esm/ThemeTint.native.js +23 -0
- package/dist/esm/ThemeTint.native.js.map +6 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +1 -0
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/useTint.js +0 -19
- package/dist/esm/useTint.js.map +1 -1
- package/dist/esm/useTint.mjs +26 -53
- package/dist/esm/useTint.mjs.map +1 -1
- package/dist/esm/useTint.native.js +0 -18
- package/dist/esm/useTint.native.js.map +2 -2
- package/package.json +4 -4
- package/src/LogoWords.tsx +18 -7
- package/src/ThemeTint.tsx +31 -0
- package/src/index.tsx +1 -0
- package/src/useTint.tsx +1 -34
- package/types/LogoWords.d.ts.map +1 -1
- package/types/ThemeTint.d.ts +9 -0
- package/types/ThemeTint.d.ts.map +11 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +2 -2
- package/types/useTint.d.ts +1 -7
- package/types/useTint.d.ts.map +2 -2
package/dist/esm/useTint.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { usePathname } from "one";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { Theme } from "tamagui";
|
|
4
3
|
import { getTints, setNextTintFamily, useTints } from "./tints.mjs";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
4
|
let current = 3;
|
|
7
5
|
const listeners = /* @__PURE__ */new Set(),
|
|
8
6
|
onTintChange = listener => (listeners.add(listener), () => {
|
|
@@ -17,56 +15,31 @@ function getDocsSection(pathname) {
|
|
|
17
15
|
return pathname === "/docs/intro/compiler-install" || pathname === "/docs/intro/benchmarks" || pathname === "/docs/intro/why-a-compiler" ? "compile" : pathname.startsWith("/ui/") ? "ui" : pathname.startsWith("/docs/") ? "core" : null;
|
|
18
16
|
}
|
|
19
17
|
const useTint = (altOffset = -1) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
ThemeTint = ({
|
|
47
|
-
disable,
|
|
48
|
-
children,
|
|
49
|
-
...rest
|
|
50
|
-
}) => {
|
|
51
|
-
const curTint = useTint().tint;
|
|
52
|
-
return /* @__PURE__ */jsx(Theme, {
|
|
53
|
-
...rest,
|
|
54
|
-
name: disable ? null : curTint,
|
|
55
|
-
children
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
ThemeTintAlt = ({
|
|
59
|
-
children,
|
|
60
|
-
disable,
|
|
61
|
-
offset = 1,
|
|
62
|
-
...rest
|
|
63
|
-
}) => {
|
|
64
|
-
const curTint = useTint(offset).tintAlt;
|
|
65
|
-
return /* @__PURE__ */jsx(Theme, {
|
|
66
|
-
name: disable ? null : curTint,
|
|
67
|
-
...rest,
|
|
68
|
-
children
|
|
69
|
-
});
|
|
18
|
+
const pathname = usePathname(),
|
|
19
|
+
section = getDocsSection(pathname);
|
|
20
|
+
let initial = current;
|
|
21
|
+
section && (initial = section === "compile" ? 5 : section === "core" ? 4 : 6);
|
|
22
|
+
const index = React.useSyncExternalStore(onTintChange, () => current, () => initial),
|
|
23
|
+
tintsContext = useTints(),
|
|
24
|
+
{
|
|
25
|
+
tints
|
|
26
|
+
} = tintsContext,
|
|
27
|
+
tintAltIndex = Math.abs((index + altOffset) % tints.length);
|
|
28
|
+
return {
|
|
29
|
+
...tintsContext,
|
|
30
|
+
tints: tintsContext.tints,
|
|
31
|
+
tintIndex: index,
|
|
32
|
+
tintAltIndex,
|
|
33
|
+
tint: tints[index],
|
|
34
|
+
tintAlt: tints[tintAltIndex],
|
|
35
|
+
setTintIndex,
|
|
36
|
+
setNextTintFamily,
|
|
37
|
+
setNextTint: () => {
|
|
38
|
+
React.startTransition(() => {
|
|
39
|
+
setTintIndex(index + 1);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
70
42
|
};
|
|
71
|
-
|
|
43
|
+
};
|
|
44
|
+
export { getDocsSection, onTintChange, setTintIndex, useTint };
|
|
72
45
|
//# sourceMappingURL=useTint.mjs.map
|
package/dist/esm/useTint.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["usePathname","React","
|
|
1
|
+
{"version":3,"names":["usePathname","React","getTints","setNextTintFamily","useTints","current","listeners","Set","onTintChange","listener","add","delete","numTints","tints","length","setTintIndex","next","val","forEach","x","getDocsSection","pathname","startsWith","useTint","altOffset","section","initial","index","useSyncExternalStore","tintsContext","tintAltIndex","Math","abs","tintIndex","tint","tintAlt","setNextTint","startTransition"],"sources":["../../src/useTint.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,WAAA,QAAmB;AAC5B,OAAOC,KAAA,MAAW;AAElB,SAASC,QAAA,EAAUC,iBAAA,EAAmBC,QAAA,QAAgB;AAEtD,IAAIC,OAAA,GAAU;AAEd,MAAMC,SAAA,GAAY,mBAAIC,GAAA,CAAc;EAEvBC,YAAA,GAAgBC,QAAA,KAC3BH,SAAA,CAAUI,GAAA,CAAID,QAAQ,GACf,MAAY;IACjBH,SAAA,CAAUK,MAAA,CAAOF,QAAQ;EAC3B;EAGIG,QAAA,GAAWV,QAAA,CAAS,EAAEW,KAAA,CAAMC,MAAA;EAErBC,YAAA,GAAgBC,IAAA,IAAuB;IAClD,MAAMC,GAAA,GAAMD,IAAA,GAAOJ,QAAA;IACfK,GAAA,KAAQZ,OAAA,KACZA,OAAA,GAAUY,GAAA,EACVX,SAAA,CAAUY,OAAA,CAASC,CAAA,IAAMA,CAAA,CAAEF,GAAG,CAAC;EACjC;AAEO,SAASG,eAAeC,QAAA,EAAoD;EACjF,OAAOA,QAAA,KAAa,kCAClBA,QAAA,KAAa,4BACbA,QAAA,KAAa,+BACX,YACAA,QAAA,CAASC,UAAA,CAAW,MAAM,IACxB,OACAD,QAAA,CAASC,UAAA,CAAW,QAAQ,IAC1B,SACA;AACV;AAEO,MAAMC,OAAA,GAAUA,CACrBC,SAAA,GAAY,OAmBT;EACH,MAAMH,QAAA,GAAWrB,WAAA,CAAY;IACvByB,OAAA,GAAUL,cAAA,CAAeC,QAAQ;EAEvC,IAAIK,OAAA,GAAUrB,OAAA;EACVoB,OAAA,KACFC,OAAA,GAAUD,OAAA,KAAY,YAAY,IAAIA,OAAA,KAAY,SAAS,IAAI;EAGjE,MAAME,KAAA,GAAQ1B,KAAA,CAAM2B,oBAAA,CAClBpB,YAAA,EACA,MAAMH,OAAA,EACN,MAAMqB,OACR;IACMG,YAAA,GAAezB,QAAA,CAAS;IACxB;MAAES;IAAM,IAAIgB,YAAA;IACZC,YAAA,GAAeC,IAAA,CAAKC,GAAA,EAAKL,KAAA,GAAQH,SAAA,IAAaX,KAAA,CAAMC,MAAM;EAEhE,OAAO;IACL,GAAGe,YAAA;IACHhB,KAAA,EAAOgB,YAAA,CAAahB,KAAA;IACpBoB,SAAA,EAAWN,KAAA;IACXG,YAAA;IACAI,IAAA,EAAMrB,KAAA,CAAMc,KAAK;IACjBQ,OAAA,EAAStB,KAAA,CAAMiB,YAAY;IAC3Bf,YAAA;IACAZ,iBAAA;IACAiC,WAAA,EAAaA,CAAA,KAAM;MACjBnC,KAAA,CAAMoC,eAAA,CAAgB,MAAM;QAC1BtB,YAAA,CAAaY,KAAA,GAAQ,CAAC;MACxB,CAAC;IACH;EACF;AACF","ignoreList":[]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { usePathname } from "one";
|
|
3
2
|
import React from "react";
|
|
4
|
-
import { Theme } from "tamagui";
|
|
5
3
|
import { getTints, setNextTintFamily, useTints } from "./tints";
|
|
6
4
|
var current = 3, listeners = /* @__PURE__ */ new Set(), onTintChange = function(listener) {
|
|
7
5
|
return listeners.add(listener), function() {
|
|
@@ -39,24 +37,8 @@ var useTint = function() {
|
|
|
39
37
|
});
|
|
40
38
|
}
|
|
41
39
|
};
|
|
42
|
-
}, ThemeTint = function(param) {
|
|
43
|
-
var { disable, children, ...rest } = param, curTint = useTint().tint;
|
|
44
|
-
return /* @__PURE__ */ _jsx(Theme, {
|
|
45
|
-
...rest,
|
|
46
|
-
name: disable ? null : curTint,
|
|
47
|
-
children
|
|
48
|
-
});
|
|
49
|
-
}, ThemeTintAlt = function(param) {
|
|
50
|
-
var { children, disable, offset = 1, ...rest } = param, curTint = useTint(offset).tintAlt, name = disable ? null : curTint;
|
|
51
|
-
return /* @__PURE__ */ _jsx(Theme, {
|
|
52
|
-
name,
|
|
53
|
-
...rest,
|
|
54
|
-
children
|
|
55
|
-
});
|
|
56
40
|
};
|
|
57
41
|
export {
|
|
58
|
-
ThemeTint,
|
|
59
|
-
ThemeTintAlt,
|
|
60
42
|
getDocsSection,
|
|
61
43
|
onTintChange,
|
|
62
44
|
setTintIndex,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/packages/logo/src/useTint.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["usePathname", "React", "
|
|
4
|
+
"mappings": "AAAA,SAASA,mBAAmB;AAC5B,OAAOC,WAAW;AAElB,SAASC,UAAUC,mBAAmBC,gBAAgB;AAEtD,IAAIC,UAAU,GAERC,YAAY,oBAAIC,IAAAA,GAETC,eAAe,SAACC,UAAAA;AAC3BH,mBAAUI,IAAID,QAAAA,GACP,WAAA;AACLH,cAAUK,OAAOF,QAAAA;EACnB;AACF,GAEMG,WAAWV,SAAAA,EAAWW,MAAMC,QAErBC,eAAe,SAACC,MAAAA;AAC3B,MAAMC,MAAMD,OAAOJ;AACnB,EAAIK,QAAQZ,YACZA,UAAUY,KACVX,UAAUY,QAAQ,SAACC,GAAAA;WAAMA,EAAEF,GAAAA;;AAC7B;AAEO,SAASG,eAAeC,UAAgB;AAC7C,SAAOA,aAAa,kCAClBA,aAAa,4BACbA,aAAa,+BACX,YACAA,SAASC,WAAW,MAAA,IAClB,OACAD,SAASC,WAAW,QAAA,IAClB,SACA;AACV;AAEO,IAAMC,UAAU,WAAA;MACrBC,YAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAY,IAoBNH,WAAWrB,YAAAA,GACXyB,UAAUL,eAAeC,QAAAA,GAE3BK,UAAUrB;AACd,EAAIoB,YACFC,UAAUD,YAAY,YAAY,IAAIA,YAAY,SAAS,IAAI;AAGjE,MAAME,QAAQ1B,MAAM2B,qBAClBpB,cACA,WAAA;WAAMH;KACN,WAAA;WAAMqB;MAEFG,eAAezB,SAAAA,GACf,EAAES,MAAK,IAAKgB,cACZC,eAAeC,KAAKC,KAAKL,QAAQH,aAAaX,MAAMC,MAAM;AAEhE,SAAO;IACL,GAAGe;IACHhB,OAAOgB,aAAahB;IACpBoB,WAAWN;IACXG;IACAI,MAAMrB,MAAMc,KAAAA;IACZQ,SAAStB,MAAMiB,YAAAA;IACff;IACAZ;IACAiC,aAAa,WAAA;AACXnC,YAAMoC,gBAAgB,WAAA;AACpBtB,qBAAaY,QAAQ,CAAA;MACvB,CAAA;IACF;EACF;AACF;",
|
|
5
|
+
"names": ["usePathname", "React", "getTints", "setNextTintFamily", "useTints", "current", "listeners", "Set", "onTintChange", "listener", "add", "delete", "numTints", "tints", "length", "setTintIndex", "next", "val", "forEach", "x", "getDocsSection", "pathname", "startsWith", "useTint", "altOffset", "section", "initial", "index", "useSyncExternalStore", "tintsContext", "tintAltIndex", "Math", "abs", "tintIndex", "tint", "tintAlt", "setNextTint", "startTransition"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/logo",
|
|
3
|
-
"version": "1.124.
|
|
3
|
+
"version": "1.124.8",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"clean:build": "tamagui-build clean:build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"one": "1.1.
|
|
48
|
-
"tamagui": "1.124.
|
|
47
|
+
"one": "1.1.440",
|
|
48
|
+
"tamagui": "1.124.8"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@tamagui/build": "1.124.
|
|
51
|
+
"@tamagui/build": "1.124.8",
|
|
52
52
|
"react": "*"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
package/src/LogoWords.tsx
CHANGED
|
@@ -69,6 +69,17 @@ export const LogoWords: React.MemoExoticComponent<
|
|
|
69
69
|
marginVertical="$-2"
|
|
70
70
|
position="relative"
|
|
71
71
|
className="logo-words"
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
onMouseMove={(e) => {
|
|
74
|
+
// Get mouse position relative to the element
|
|
75
|
+
const rect = e.currentTarget.getBoundingClientRect()
|
|
76
|
+
const x = e.clientX - rect.left
|
|
77
|
+
// Total width divided into 7 sections (one for each letter)
|
|
78
|
+
const sectionWidth = rect.width / 7
|
|
79
|
+
// Calculate which section we're in (0-6)
|
|
80
|
+
const section = Math.min(6, Math.floor(x / sectionWidth))
|
|
81
|
+
Tint.setTintIndex(section)
|
|
82
|
+
}}
|
|
72
83
|
{...props}
|
|
73
84
|
>
|
|
74
85
|
{animated && (
|
|
@@ -96,7 +107,7 @@ export const LogoWords: React.MemoExoticComponent<
|
|
|
96
107
|
shapeRendering="crispEdges"
|
|
97
108
|
fill={getColor(0)}
|
|
98
109
|
points="24.3870968 40.1612903 24.3870968 8.67741935 32.2580645 8.67741935 32.2580645 0.806451613 0.774193548 0.806451613 0.774193548 8.67741935 8.64516129 8.67741935 8.64516129 40.1612903"
|
|
99
|
-
onMouseEnter={() => Tint.setTintIndex(0)}
|
|
110
|
+
// onMouseEnter={() => Tint.setTintIndex(0)}
|
|
100
111
|
/>
|
|
101
112
|
|
|
102
113
|
<path
|
|
@@ -104,7 +115,7 @@ export const LogoWords: React.MemoExoticComponent<
|
|
|
104
115
|
fill={getColor(1)}
|
|
105
116
|
d="M87.3548387,0.806451613 L87.3548387,8.67741935 L95.2258065,8.67741935 L95.2258065,40.1612903 L79.483871,40.1612903 L79.483871,24.4193548 L71.6129032,24.4193548 L71.6129032,40.1612903 L55.8709677,40.1612903 L55.8709677,8.67741935 L63.7419355,8.67741935 L63.7419355,0.806451613 L87.3548387,0.806451613 Z M79.483871,8.67741935 L71.6129032,8.67741935 L71.6129032,16.5483871 L79.483871,16.5483871 L79.483871,8.67741935 Z"
|
|
106
117
|
fillRule="nonzero"
|
|
107
|
-
onMouseEnter={() => Tint.setTintIndex(1)}
|
|
118
|
+
// onMouseEnter={() => Tint.setTintIndex(1)}
|
|
108
119
|
/>
|
|
109
120
|
|
|
110
121
|
<polygon
|
|
@@ -112,14 +123,14 @@ export const LogoWords: React.MemoExoticComponent<
|
|
|
112
123
|
shapeRendering="crispEdges"
|
|
113
124
|
fill={getColor(2)}
|
|
114
125
|
points="130.645161 40.1612903 130.645161 22.4516129 138.516129 22.4516129 138.516129 40.1612903 154.258065 40.1612903 154.258065 0.806451613 142.451613 0.806451613 142.451613 8.67741935 126.709677 8.67741935 126.709677 0.806451613 114.903226 0.806451613 114.903226 40.1612903"
|
|
115
|
-
onMouseEnter={() => Tint.setTintIndex(2)}
|
|
126
|
+
// onMouseEnter={() => Tint.setTintIndex(2)}
|
|
116
127
|
/>
|
|
117
128
|
|
|
118
129
|
<path
|
|
119
130
|
fill={getColor(3)}
|
|
120
131
|
d="M205.419355,0.806451613 L205.419355,8.67741935 L213.290323,8.67741935 L213.290323,40.1612903 L197.548387,40.1612903 L197.548387,24.4193548 L189.677419,24.4193548 L189.677419,40.1612903 L173.935484,40.1612903 L173.935484,8.67741935 L181.806452,8.67741935 L181.806452,0.806451613 L205.419355,0.806451613 Z M197.548387,8.67741935 L189.677419,8.67741935 L189.677419,16.5483871 L197.548387,16.5483871 L197.548387,8.67741935 Z"
|
|
121
132
|
fillRule="nonzero"
|
|
122
|
-
onMouseEnter={() => Tint.setTintIndex(3)}
|
|
133
|
+
// onMouseEnter={() => Tint.setTintIndex(3)}
|
|
123
134
|
/>
|
|
124
135
|
|
|
125
136
|
<polygon
|
|
@@ -127,7 +138,7 @@ export const LogoWords: React.MemoExoticComponent<
|
|
|
127
138
|
shapeRendering="crispEdges"
|
|
128
139
|
fill={getColor(4)}
|
|
129
140
|
points="264.451613 40.1612903 264.451613 32.2903226 272.322581 32.2903226 272.322581 16.5483871 256.580645 16.5483871 256.580645 32.2903226 248.709677 32.2903226 248.709677 8.67741935 272.322581 8.67741935 272.322581 0.806451613 240.83871 0.806451613 240.83871 8.67741935 232.967742 8.67741935 232.967742 32.2903226 240.83871 32.2903226 240.83871 40.1612903"
|
|
130
|
-
onMouseEnter={() => Tint.setTintIndex(4)}
|
|
141
|
+
// onMouseEnter={() => Tint.setTintIndex(4)}
|
|
131
142
|
/>
|
|
132
143
|
|
|
133
144
|
<polygon
|
|
@@ -135,7 +146,7 @@ export const LogoWords: React.MemoExoticComponent<
|
|
|
135
146
|
shapeRendering="crispEdges"
|
|
136
147
|
fill={getColor(5)}
|
|
137
148
|
points="323.483871 40.1612903 323.483871 32.2903226 331.354839 32.2903226 331.354839 0.806451613 315.612903 0.806451613 315.612903 32.2903226 307.741935 32.2903226 307.741935 0.806451613 292 0.806451613 292 32.2903226 299.870968 32.2903226 299.870968 40.1612903"
|
|
138
|
-
onMouseEnter={() => Tint.setTintIndex(5)}
|
|
149
|
+
// onMouseEnter={() => Tint.setTintIndex(5)}
|
|
139
150
|
/>
|
|
140
151
|
|
|
141
152
|
<polygon
|
|
@@ -143,7 +154,7 @@ export const LogoWords: React.MemoExoticComponent<
|
|
|
143
154
|
shapeRendering="crispEdges"
|
|
144
155
|
fill={getColor(6)}
|
|
145
156
|
points="372.677419 40.1612903 372.677419 0.806451613 356.935484 0.806451613 356.935484 40.1612903"
|
|
146
|
-
onMouseEnter={() => Tint.setTintIndex(6)}
|
|
157
|
+
// onMouseEnter={() => Tint.setTintIndex(6)}
|
|
147
158
|
/>
|
|
148
159
|
</svg>
|
|
149
160
|
</XStack>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ThemeProps, Theme } from '@tamagui/web'
|
|
2
|
+
import type { JSX } from 'react/jsx-runtime'
|
|
3
|
+
import { useTint } from './useTint'
|
|
4
|
+
|
|
5
|
+
export const ThemeTint = ({
|
|
6
|
+
disable,
|
|
7
|
+
children,
|
|
8
|
+
...rest
|
|
9
|
+
}: ThemeProps & { disable?: boolean }): JSX.Element => {
|
|
10
|
+
const curTint = useTint().tint
|
|
11
|
+
return (
|
|
12
|
+
<Theme {...rest} name={disable ? null : curTint}>
|
|
13
|
+
{children}
|
|
14
|
+
</Theme>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const ThemeTintAlt = ({
|
|
19
|
+
children,
|
|
20
|
+
disable,
|
|
21
|
+
offset = 1,
|
|
22
|
+
...rest
|
|
23
|
+
}: ThemeProps & { disable?: boolean; offset?: number }): JSX.Element => {
|
|
24
|
+
const curTint = useTint(offset).tintAlt
|
|
25
|
+
const name = disable ? null : curTint
|
|
26
|
+
return (
|
|
27
|
+
<Theme name={name} {...rest}>
|
|
28
|
+
{children}
|
|
29
|
+
</Theme>
|
|
30
|
+
)
|
|
31
|
+
}
|
package/src/index.tsx
CHANGED
package/src/useTint.tsx
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { usePathname } from 'one'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import type {
|
|
4
|
-
import type { ThemeName, ThemeProps } from 'tamagui'
|
|
5
|
-
import { Theme } from 'tamagui'
|
|
3
|
+
import type { ThemeName } from 'tamagui'
|
|
6
4
|
import { getTints, setNextTintFamily, useTints } from './tints'
|
|
7
5
|
|
|
8
|
-
// no localstorage because its not important to remember and causes a flicker
|
|
9
|
-
// const tintVal = typeof localStorage !== 'undefined' ? localStorage.getItem('tint') : 0
|
|
10
|
-
// const tint = tintVal ? +tintVal 0
|
|
11
6
|
let current = 3
|
|
12
7
|
|
|
13
8
|
const listeners = new Set<Function>()
|
|
@@ -94,31 +89,3 @@ export const useTint = (
|
|
|
94
89
|
},
|
|
95
90
|
} as const
|
|
96
91
|
}
|
|
97
|
-
|
|
98
|
-
export const ThemeTint = ({
|
|
99
|
-
disable,
|
|
100
|
-
children,
|
|
101
|
-
...rest
|
|
102
|
-
}: ThemeProps & { disable?: boolean }): JSX.Element => {
|
|
103
|
-
const curTint = useTint().tint
|
|
104
|
-
return (
|
|
105
|
-
<Theme {...rest} name={disable ? null : curTint}>
|
|
106
|
-
{children}
|
|
107
|
-
</Theme>
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export const ThemeTintAlt = ({
|
|
112
|
-
children,
|
|
113
|
-
disable,
|
|
114
|
-
offset = 1,
|
|
115
|
-
...rest
|
|
116
|
-
}: ThemeProps & { disable?: boolean; offset?: number }): JSX.Element => {
|
|
117
|
-
const curTint = useTint(offset).tintAlt
|
|
118
|
-
const name = disable ? null : curTint
|
|
119
|
-
return (
|
|
120
|
-
<Theme name={name} {...rest}>
|
|
121
|
-
{children}
|
|
122
|
-
</Theme>
|
|
123
|
-
)
|
|
124
|
-
}
|
package/types/LogoWords.d.ts.map
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"src/LogoWords.tsx"
|
|
8
8
|
],
|
|
9
9
|
"sourcesContent": [
|
|
10
|
-
"import React from 'react'\nimport type { XStackProps } from 'tamagui'\nimport { Circle, XStack } from 'tamagui'\n\nimport { useTint } from './useTint'\n\nconst rgb = ['#ED0F0F', '#6BCF1A', '#6252F8']\n\nexport const LogoWords: React.MemoExoticComponent<\n ({\n downscale,\n animated,\n ...props\n }: XStackProps & {\n downscale?: number\n animated?: boolean\n }) => import('react/jsx-runtime').JSX.Element\n> = React.memo(({ downscale = 1, animated, ...props }) => {\n const Tint = useTint()\n const [hovered, setHovered] = React.useState(false)\n const [mounted, setMounted] = React.useState<'start' | 'animate' | 'done'>('start')\n\n const { tintIndex: index, tint } = Tint\n const hoveredTints = Tint.tints.map((x) => `${x}9`).map((t) => `var(--${t})`)\n\n const tints = [\n 'var(--accent1)',\n 'var(--accent1)',\n 'var(--accent1)',\n 'var(--accent1)',\n ...rgb,\n ]\n\n const circleTints = hovered\n ? Tint.tints.map((x) => `$${x}9`)\n : ['$accent1', '$accent1', '$accent1', '$accent1', ...rgb]\n\n React.useEffect(() => {\n const idle = window.requestIdleCallback || setTimeout\n idle(() => {\n setTimeout(() => {\n setMounted('animate')\n }, 50)\n\n setTimeout(() => {\n setMounted('done')\n }, 1500)\n })\n }, [])\n\n const getColor = (i: number) => {\n const isActive = mounted !== 'start' && i === index\n if (hovered) {\n return hoveredTints[i]\n }\n return tints[i]\n }\n\n const x = Math.round(\n index * 18.5 + (18 / 2) * (index / tints.length) + 3 + (index === 6 ? -3 : 0)\n )\n\n return (\n <XStack\n onHoverIn={() => setHovered(true)}\n onHoverOut={() => setHovered(false)}\n paddingVertical=\"$2\"\n data-tauri-drag-region\n marginVertical=\"$-2\"\n position=\"relative\"\n className=\"logo-words\"\n {...props}\n >\n {animated && (\n <Circle\n animation=\"quicker\"\n position=\"absolute\"\n top={0}\n left={0}\n y={mounted === 'start' ? -30 : -3}\n // the last i is less wide\n x={x}\n size={4}\n backgroundColor={circleTints[index]}\n />\n )}\n\n <svg\n data-tauri-drag-region\n width={373 * (1 / downscale) * 0.3333333}\n height={41 * (1 / downscale) * 0.3333333}\n viewBox=\"0 0 373 41\"\n >\n <polygon\n data-tauri-drag-region\n shapeRendering=\"crispEdges\"\n fill={getColor(0)}\n points=\"24.3870968 40.1612903 24.3870968 8.67741935 32.2580645 8.67741935 32.2580645 0.806451613 0.774193548 0.806451613 0.774193548 8.67741935 8.64516129 8.67741935 8.64516129 40.1612903\"\n onMouseEnter={() => Tint.setTintIndex(0)}\n />\n\n <path\n shapeRendering=\"crispEdges\"\n fill={getColor(1)}\n d=\"M87.3548387,0.806451613 L87.3548387,8.67741935 L95.2258065,8.67741935 L95.2258065,40.1612903 L79.483871,40.1612903 L79.483871,24.4193548 L71.6129032,24.4193548 L71.6129032,40.1612903 L55.8709677,40.1612903 L55.8709677,8.67741935 L63.7419355,8.67741935 L63.7419355,0.806451613 L87.3548387,0.806451613 Z M79.483871,8.67741935 L71.6129032,8.67741935 L71.6129032,16.5483871 L79.483871,16.5483871 L79.483871,8.67741935 Z\"\n fillRule=\"nonzero\"\n onMouseEnter={() => Tint.setTintIndex(1)}\n />\n\n <polygon\n data-tauri-drag-region\n shapeRendering=\"crispEdges\"\n fill={getColor(2)}\n points=\"130.645161 40.1612903 130.645161 22.4516129 138.516129 22.4516129 138.516129 40.1612903 154.258065 40.1612903 154.258065 0.806451613 142.451613 0.806451613 142.451613 8.67741935 126.709677 8.67741935 126.709677 0.806451613 114.903226 0.806451613 114.903226 40.1612903\"\n onMouseEnter={() => Tint.setTintIndex(2)}\n />\n\n <path\n fill={getColor(3)}\n d=\"M205.419355,0.806451613 L205.419355,8.67741935 L213.290323,8.67741935 L213.290323,40.1612903 L197.548387,40.1612903 L197.548387,24.4193548 L189.677419,24.4193548 L189.677419,40.1612903 L173.935484,40.1612903 L173.935484,8.67741935 L181.806452,8.67741935 L181.806452,0.806451613 L205.419355,0.806451613 Z M197.548387,8.67741935 L189.677419,8.67741935 L189.677419,16.5483871 L197.548387,16.5483871 L197.548387,8.67741935 Z\"\n fillRule=\"nonzero\"\n onMouseEnter={() => Tint.setTintIndex(3)}\n />\n\n <polygon\n data-tauri-drag-region\n shapeRendering=\"crispEdges\"\n fill={getColor(4)}\n points=\"264.451613 40.1612903 264.451613 32.2903226 272.322581 32.2903226 272.322581 16.5483871 256.580645 16.5483871 256.580645 32.2903226 248.709677 32.2903226 248.709677 8.67741935 272.322581 8.67741935 272.322581 0.806451613 240.83871 0.806451613 240.83871 8.67741935 232.967742 8.67741935 232.967742 32.2903226 240.83871 32.2903226 240.83871 40.1612903\"\n onMouseEnter={() => Tint.setTintIndex(4)}\n />\n\n <polygon\n data-tauri-drag-region\n shapeRendering=\"crispEdges\"\n fill={getColor(5)}\n points=\"323.483871 40.1612903 323.483871 32.2903226 331.354839 32.2903226 331.354839 0.806451613 315.612903 0.806451613 315.612903 32.2903226 307.741935 32.2903226 307.741935 0.806451613 292 0.806451613 292 32.2903226 299.870968 32.2903226 299.870968 40.1612903\"\n onMouseEnter={() => Tint.setTintIndex(5)}\n />\n\n <polygon\n data-tauri-drag-region\n shapeRendering=\"crispEdges\"\n fill={getColor(6)}\n points=\"372.677419 40.1612903 372.677419 0.806451613 356.935484 0.806451613 356.935484 40.1612903\"\n onMouseEnter={() => Tint.setTintIndex(6)}\n />\n </svg>\n </XStack>\n )\n})\n"
|
|
10
|
+
"import React from 'react'\nimport type { XStackProps } from 'tamagui'\nimport { Circle, XStack } from 'tamagui'\n\nimport { useTint } from './useTint'\n\nconst rgb = ['#ED0F0F', '#6BCF1A', '#6252F8']\n\nexport const LogoWords: React.MemoExoticComponent<\n ({\n downscale,\n animated,\n ...props\n }: XStackProps & {\n downscale?: number\n animated?: boolean\n }) => import('react/jsx-runtime').JSX.Element\n> = React.memo(({ downscale = 1, animated, ...props }) => {\n const Tint = useTint()\n const [hovered, setHovered] = React.useState(false)\n const [mounted, setMounted] = React.useState<'start' | 'animate' | 'done'>('start')\n\n const { tintIndex: index, tint } = Tint\n const hoveredTints = Tint.tints.map((x) => `${x}9`).map((t) => `var(--${t})`)\n\n const tints = [\n 'var(--accent1)',\n 'var(--accent1)',\n 'var(--accent1)',\n 'var(--accent1)',\n ...rgb,\n ]\n\n const circleTints = hovered\n ? Tint.tints.map((x) => `$${x}9`)\n : ['$accent1', '$accent1', '$accent1', '$accent1', ...rgb]\n\n React.useEffect(() => {\n const idle = window.requestIdleCallback || setTimeout\n idle(() => {\n setTimeout(() => {\n setMounted('animate')\n }, 50)\n\n setTimeout(() => {\n setMounted('done')\n }, 1500)\n })\n }, [])\n\n const getColor = (i: number) => {\n const isActive = mounted !== 'start' && i === index\n if (hovered) {\n return hoveredTints[i]\n }\n return tints[i]\n }\n\n const x = Math.round(\n index * 18.5 + (18 / 2) * (index / tints.length) + 3 + (index === 6 ? -3 : 0)\n )\n\n return (\n <XStack\n onHoverIn={() => setHovered(true)}\n onHoverOut={() => setHovered(false)}\n paddingVertical=\"$2\"\n data-tauri-drag-region\n marginVertical=\"$-2\"\n position=\"relative\"\n className=\"logo-words\"\n // @ts-ignore\n onMouseMove={(e) => {\n // Get mouse position relative to the element\n const rect = e.currentTarget.getBoundingClientRect()\n const x = e.clientX - rect.left\n // Total width divided into 7 sections (one for each letter)\n const sectionWidth = rect.width / 7\n // Calculate which section we're in (0-6)\n const section = Math.min(6, Math.floor(x / sectionWidth))\n Tint.setTintIndex(section)\n }}\n {...props}\n >\n {animated && (\n <Circle\n animation=\"quicker\"\n position=\"absolute\"\n top={0}\n left={0}\n y={mounted === 'start' ? -30 : -3}\n // the last i is less wide\n x={x}\n size={4}\n backgroundColor={circleTints[index]}\n />\n )}\n\n <svg\n data-tauri-drag-region\n width={373 * (1 / downscale) * 0.3333333}\n height={41 * (1 / downscale) * 0.3333333}\n viewBox=\"0 0 373 41\"\n >\n <polygon\n data-tauri-drag-region\n shapeRendering=\"crispEdges\"\n fill={getColor(0)}\n points=\"24.3870968 40.1612903 24.3870968 8.67741935 32.2580645 8.67741935 32.2580645 0.806451613 0.774193548 0.806451613 0.774193548 8.67741935 8.64516129 8.67741935 8.64516129 40.1612903\"\n // onMouseEnter={() => Tint.setTintIndex(0)}\n />\n\n <path\n shapeRendering=\"crispEdges\"\n fill={getColor(1)}\n d=\"M87.3548387,0.806451613 L87.3548387,8.67741935 L95.2258065,8.67741935 L95.2258065,40.1612903 L79.483871,40.1612903 L79.483871,24.4193548 L71.6129032,24.4193548 L71.6129032,40.1612903 L55.8709677,40.1612903 L55.8709677,8.67741935 L63.7419355,8.67741935 L63.7419355,0.806451613 L87.3548387,0.806451613 Z M79.483871,8.67741935 L71.6129032,8.67741935 L71.6129032,16.5483871 L79.483871,16.5483871 L79.483871,8.67741935 Z\"\n fillRule=\"nonzero\"\n // onMouseEnter={() => Tint.setTintIndex(1)}\n />\n\n <polygon\n data-tauri-drag-region\n shapeRendering=\"crispEdges\"\n fill={getColor(2)}\n points=\"130.645161 40.1612903 130.645161 22.4516129 138.516129 22.4516129 138.516129 40.1612903 154.258065 40.1612903 154.258065 0.806451613 142.451613 0.806451613 142.451613 8.67741935 126.709677 8.67741935 126.709677 0.806451613 114.903226 0.806451613 114.903226 40.1612903\"\n // onMouseEnter={() => Tint.setTintIndex(2)}\n />\n\n <path\n fill={getColor(3)}\n d=\"M205.419355,0.806451613 L205.419355,8.67741935 L213.290323,8.67741935 L213.290323,40.1612903 L197.548387,40.1612903 L197.548387,24.4193548 L189.677419,24.4193548 L189.677419,40.1612903 L173.935484,40.1612903 L173.935484,8.67741935 L181.806452,8.67741935 L181.806452,0.806451613 L205.419355,0.806451613 Z M197.548387,8.67741935 L189.677419,8.67741935 L189.677419,16.5483871 L197.548387,16.5483871 L197.548387,8.67741935 Z\"\n fillRule=\"nonzero\"\n // onMouseEnter={() => Tint.setTintIndex(3)}\n />\n\n <polygon\n data-tauri-drag-region\n shapeRendering=\"crispEdges\"\n fill={getColor(4)}\n points=\"264.451613 40.1612903 264.451613 32.2903226 272.322581 32.2903226 272.322581 16.5483871 256.580645 16.5483871 256.580645 32.2903226 248.709677 32.2903226 248.709677 8.67741935 272.322581 8.67741935 272.322581 0.806451613 240.83871 0.806451613 240.83871 8.67741935 232.967742 8.67741935 232.967742 32.2903226 240.83871 32.2903226 240.83871 40.1612903\"\n // onMouseEnter={() => Tint.setTintIndex(4)}\n />\n\n <polygon\n data-tauri-drag-region\n shapeRendering=\"crispEdges\"\n fill={getColor(5)}\n points=\"323.483871 40.1612903 323.483871 32.2903226 331.354839 32.2903226 331.354839 0.806451613 315.612903 0.806451613 315.612903 32.2903226 307.741935 32.2903226 307.741935 0.806451613 292 0.806451613 292 32.2903226 299.870968 32.2903226 299.870968 40.1612903\"\n // onMouseEnter={() => Tint.setTintIndex(5)}\n />\n\n <polygon\n data-tauri-drag-region\n shapeRendering=\"crispEdges\"\n fill={getColor(6)}\n points=\"372.677419 40.1612903 372.677419 0.806451613 356.935484 0.806451613 356.935484 40.1612903\"\n // onMouseEnter={() => Tint.setTintIndex(6)}\n />\n </svg>\n </XStack>\n )\n})\n"
|
|
11
11
|
],
|
|
12
12
|
"version": 3
|
|
13
13
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ThemeProps } from "@tamagui/web";
|
|
2
|
+
import type { JSX } from "react/jsx-runtime";
|
|
3
|
+
export declare const ThemeTint: ({ disable, children,...rest }: ThemeProps & { disable?: boolean }) => JSX.Element;
|
|
4
|
+
export declare const ThemeTintAlt: ({ children, disable, offset,...rest }: ThemeProps & {
|
|
5
|
+
disable?: boolean;
|
|
6
|
+
offset?: number;
|
|
7
|
+
}) => JSX.Element;
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=ThemeTint.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": "AAAA,cAAc,kBAAyB,cAAc;AACrD,cAAc,WAAW,mBAAmB;AAG5C,OAAO,cAAM,YAAa,EACxB,SACA,SACA,GAAG,MACgC,EAAlC,aAAa,EAAE,kBAAmB,MAAG,IAAI;AAS5C,OAAO,cAAM,eAAgB,EAC3B,UACA,SACA,OACA,GAAG,MACiD,EAAnD,aAAa;CAAE;CAAmB;AAAiB,MAAG,IAAI",
|
|
3
|
+
"names": [],
|
|
4
|
+
"sources": [
|
|
5
|
+
"src/ThemeTint.tsx"
|
|
6
|
+
],
|
|
7
|
+
"sourcesContent": [
|
|
8
|
+
"import { type ThemeProps, Theme } from '@tamagui/web'\nimport type { JSX } from 'react/jsx-runtime'\nimport { useTint } from './useTint'\n\nexport const ThemeTint = ({\n disable,\n children,\n ...rest\n}: ThemeProps & { disable?: boolean }): JSX.Element => {\n const curTint = useTint().tint\n return (\n <Theme {...rest} name={disable ? null : curTint}>\n {children}\n </Theme>\n )\n}\n\nexport const ThemeTintAlt = ({\n children,\n disable,\n offset = 1,\n ...rest\n}: ThemeProps & { disable?: boolean; offset?: number }): JSX.Element => {\n const curTint = useTint(offset).tintAlt\n const name = disable ? null : curTint\n return (\n <Theme name={name} {...rest}>\n {children}\n </Theme>\n )\n}\n"
|
|
9
|
+
],
|
|
10
|
+
"version": 3
|
|
11
|
+
}
|
package/types/index.d.ts
CHANGED
package/types/index.d.ts.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc",
|
|
2
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/index.tsx"
|
|
6
6
|
],
|
|
7
7
|
"sourcesContent": [
|
|
8
|
-
"export * from './TamaguiLogo'\nexport * from './LogoWords'\nexport * from './LogoIcon'\nexport * from './tints'\nexport * from './useTint'\n"
|
|
8
|
+
"export * from './TamaguiLogo'\nexport * from './LogoWords'\nexport * from './LogoIcon'\nexport * from './tints'\nexport * from './useTint'\nexport * from './ThemeTint'\n"
|
|
9
9
|
],
|
|
10
10
|
"version": 3
|
|
11
11
|
}
|
package/types/useTint.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ThemeName, ThemeProps } from "tamagui";
|
|
1
|
+
import type { ThemeName } from "tamagui";
|
|
3
2
|
export declare const onTintChange: (listener: (cur: number) => void) => () => void;
|
|
4
3
|
export declare const setTintIndex: (next: number) => void;
|
|
5
4
|
export declare function getDocsSection(pathname: string): "compile" | "ui" | "core" | null;
|
|
@@ -22,10 +21,5 @@ export declare const useTint: (altOffset?: number) => {
|
|
|
22
21
|
lunar: string[];
|
|
23
22
|
};
|
|
24
23
|
};
|
|
25
|
-
export declare const ThemeTint: ({ disable, children,...rest }: ThemeProps & { disable?: boolean }) => JSX.Element;
|
|
26
|
-
export declare const ThemeTintAlt: ({ children, disable, offset,...rest }: ThemeProps & {
|
|
27
|
-
disable?: boolean;
|
|
28
|
-
offset?: number;
|
|
29
|
-
}) => JSX.Element;
|
|
30
24
|
|
|
31
25
|
//# sourceMappingURL=useTint.d.ts.map
|
package/types/useTint.d.ts.map
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAEA,cAAc,
|
|
2
|
+
"mappings": "AAEA,cAAc,iBAAiB,SAAS;AAOxC,OAAO,cAAM,eAAgBA,WAAWC;AASxC,OAAO,cAAM,eAAgBC;AAO7B,OAAO,iBAAS,eAAeC,mBAAmB,YAAY,OAAO,SAAS;AAY9E,OAAO,cAAM,UACX,uBACC;CACD,OAAO;CACP;CACA;CACA,MAAM;CACN,SAAS;CACT,eAAeD;CACf;CACA;CACA;CACA,UAAU;EACR;EACA;EACA;EACA;EACA;EACA;CACD;AACF",
|
|
3
3
|
"names": [
|
|
4
4
|
"listener: (cur: number) => void",
|
|
5
5
|
"cur: number",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"src/useTint.tsx"
|
|
11
11
|
],
|
|
12
12
|
"sourcesContent": [
|
|
13
|
-
"import { usePathname } from 'one'\nimport React from 'react'\nimport type {
|
|
13
|
+
"import { usePathname } from 'one'\nimport React from 'react'\nimport type { ThemeName } from 'tamagui'\nimport { getTints, setNextTintFamily, useTints } from './tints'\n\nlet current = 3\n\nconst listeners = new Set<Function>()\n\nexport const onTintChange = (listener: (cur: number) => void) => {\n listeners.add(listener)\n return (): void => {\n listeners.delete(listener)\n }\n}\n\nconst numTints = getTints().tints.length\n\nexport const setTintIndex = (next: number): void => {\n const val = next % numTints\n if (val === current) return\n current = val\n listeners.forEach((x) => x(val))\n}\n\nexport function getDocsSection(pathname: string): 'compile' | 'ui' | 'core' | null {\n return pathname === '/docs/intro/compiler-install' ||\n pathname === '/docs/intro/benchmarks' ||\n pathname === '/docs/intro/why-a-compiler'\n ? 'compile'\n : pathname.startsWith('/ui/')\n ? 'ui'\n : pathname.startsWith('/docs/')\n ? 'core'\n : null\n}\n\nexport const useTint = (\n altOffset = -1\n): {\n tints: ThemeName[]\n tintIndex: number\n tintAltIndex: number\n tint: ThemeName\n tintAlt: ThemeName\n setTintIndex: (next: number) => void\n setNextTintFamily: () => void\n setNextTint: () => void\n name: string\n families: {\n tamagui: string[]\n xmas: string[]\n easter: string[]\n halloween: string[]\n valentine: string[]\n lunar: string[]\n }\n} => {\n const pathname = usePathname()\n const section = getDocsSection(pathname)\n\n let initial = current\n if (section) {\n initial = section === 'compile' ? 5 : section === 'core' ? 4 : 6\n }\n\n const index = React.useSyncExternalStore(\n onTintChange,\n () => current,\n () => initial\n )\n const tintsContext = useTints()\n const { tints } = tintsContext\n const tintAltIndex = Math.abs((index + altOffset) % tints.length)\n\n return {\n ...tintsContext,\n tints: tintsContext.tints as ThemeName[],\n tintIndex: index,\n tintAltIndex,\n tint: tints[index] as ThemeName,\n tintAlt: tints[tintAltIndex] as ThemeName,\n setTintIndex,\n setNextTintFamily,\n setNextTint: () => {\n React.startTransition(() => {\n setTintIndex(index + 1)\n })\n },\n } as const\n}\n"
|
|
14
14
|
],
|
|
15
15
|
"version": 3
|
|
16
16
|
}
|