@tamagui/logo 1.88.13 → 1.89.0-1706308641099

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ import { YStack } from "tamagui";
2
+ import { TamaguiIconSvg } from "./TamaguiLogoSvg.mjs";
3
+ import { jsx } from "react/jsx-runtime";
4
+ const LogoIcon = ({
5
+ downscale = 2
6
+ }) => /* @__PURE__ */jsx(YStack, {
7
+ tag: "span",
8
+ className: "unselectable",
9
+ alignSelf: "center",
10
+ marginVertical: -10,
11
+ pressStyle: {
12
+ opacity: 0.7,
13
+ scaleX: -1
14
+ },
15
+ children: /* @__PURE__ */jsx(TamaguiIconSvg, {
16
+ className: "tamagui-icon",
17
+ width: 450 / 8 / downscale,
18
+ height: 420 / 8 / downscale
19
+ })
20
+ });
21
+ export { LogoIcon };
@@ -0,0 +1,100 @@
1
+ import { memo, useEffect, useState } from "react";
2
+ import { Circle, XStack } from "tamagui";
3
+ import { useTint } from "./useTint.mjs";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ const LogoWords = memo(({
6
+ downscale = 1,
7
+ grayscale,
8
+ animated,
9
+ ...props
10
+ }) => {
11
+ const Tint = useTint(),
12
+ {
13
+ tintIndex: index,
14
+ tint
15
+ } = Tint,
16
+ tints = Tint.tints.map(t => `var(--${t}9)`),
17
+ [hovered, setHovered] = useState(!1),
18
+ [mounted, setMounted] = useState("start");
19
+ useEffect(() => {
20
+ (window.requestIdleCallback || setTimeout)(() => {
21
+ setTimeout(() => {
22
+ setMounted("animate");
23
+ }, 50), setTimeout(() => {
24
+ setMounted("done");
25
+ }, 1500);
26
+ });
27
+ }, []);
28
+ const getColor = i => {
29
+ const isActive = mounted !== "start" && i === index;
30
+ return grayscale ? hovered && isActive ? "var(--gray12)" : hovered ? "var(--gray11)" : "var(--gray10)" : mounted !== "done" || hovered ? isActive ? "var(--color)" : tints[index] : hovered && isActive ? "var(--color)" : tints[i];
31
+ },
32
+ x = Math.round(index * 18.5 + 18 / 2 * (index / tints.length) + 3 + (index === 6 ? -3 : 0));
33
+ return /* @__PURE__ */jsxs(XStack, {
34
+ onHoverIn: () => setHovered(!0),
35
+ onHoverOut: () => setHovered(!1),
36
+ paddingVertical: "$2",
37
+ "data-tauri-drag-region": !0,
38
+ marginVertical: "$-2",
39
+ position: "relative",
40
+ ...props,
41
+ children: [animated && /* @__PURE__ */jsx(Circle, {
42
+ animation: "quick",
43
+ position: "absolute",
44
+ top: 0,
45
+ left: 0,
46
+ y: mounted === "start" ? -30 : -3,
47
+ x,
48
+ size: 4,
49
+ backgroundColor: "$color9"
50
+ }), /* @__PURE__ */jsxs("svg", {
51
+ "data-tauri-drag-region": !0,
52
+ width: 373 * (1 / downscale) * 0.333333334,
53
+ height: 41 * (1 / downscale) * 0.333333334,
54
+ viewBox: "0 0 373 41",
55
+ children: [/* @__PURE__ */jsx("polygon", {
56
+ "data-tauri-drag-region": !0,
57
+ shapeRendering: "crispEdges",
58
+ fill: getColor(0),
59
+ 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",
60
+ onMouseEnter: () => Tint.setTintIndex(0)
61
+ }), /* @__PURE__ */jsx("path", {
62
+ shapeRendering: "crispEdges",
63
+ fill: getColor(1),
64
+ 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",
65
+ fillRule: "nonzero",
66
+ onMouseEnter: () => Tint.setTintIndex(1)
67
+ }), /* @__PURE__ */jsx("polygon", {
68
+ "data-tauri-drag-region": !0,
69
+ shapeRendering: "crispEdges",
70
+ fill: getColor(2),
71
+ 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",
72
+ onMouseEnter: () => Tint.setTintIndex(2)
73
+ }), /* @__PURE__ */jsx("path", {
74
+ fill: getColor(3),
75
+ 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",
76
+ fillRule: "nonzero",
77
+ onMouseEnter: () => Tint.setTintIndex(3)
78
+ }), /* @__PURE__ */jsx("polygon", {
79
+ "data-tauri-drag-region": !0,
80
+ shapeRendering: "crispEdges",
81
+ fill: getColor(4),
82
+ 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",
83
+ onMouseEnter: () => Tint.setTintIndex(4)
84
+ }), /* @__PURE__ */jsx("polygon", {
85
+ "data-tauri-drag-region": !0,
86
+ shapeRendering: "crispEdges",
87
+ fill: getColor(5),
88
+ 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",
89
+ onMouseEnter: () => Tint.setTintIndex(5)
90
+ }), /* @__PURE__ */jsx("polygon", {
91
+ "data-tauri-drag-region": !0,
92
+ shapeRendering: "crispEdges",
93
+ fill: getColor(6),
94
+ points: "372.677419 40.1612903 372.677419 0.806451613 356.935484 0.806451613 356.935484 40.1612903",
95
+ onMouseEnter: () => Tint.setTintIndex(6)
96
+ })]
97
+ })]
98
+ });
99
+ });
100
+ export { LogoWords };
@@ -0,0 +1,29 @@
1
+ import { forwardRef } from "react";
2
+ import { XStack, YStack } from "tamagui";
3
+ import { LogoIcon } from "./LogoIcon.mjs";
4
+ import { LogoWords } from "./LogoWords.mjs";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ const TamaguiLogo = forwardRef(({
7
+ showWords,
8
+ downscale,
9
+ animated,
10
+ ...props
11
+ }, ref) => /* @__PURE__ */jsxs(XStack, {
12
+ tag: "span",
13
+ ref,
14
+ alignItems: "center",
15
+ justifyContent: "center",
16
+ space: "$5",
17
+ ...props,
18
+ children: [/* @__PURE__ */jsx(LogoIcon, {
19
+ downscale: (downscale ?? 1) * (showWords ? 2 : 1.5)
20
+ }), showWords && /* @__PURE__ */jsx(YStack, {
21
+ tag: "span",
22
+ marginBottom: -4,
23
+ children: /* @__PURE__ */jsx(LogoWords, {
24
+ animated,
25
+ downscale: downscale ?? 2
26
+ })
27
+ })]
28
+ }));
29
+ export { TamaguiLogo };
@@ -0,0 +1,23 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ const TamaguiIconSvg = props => /* @__PURE__ */jsx("svg", {
3
+ width: 424,
4
+ height: 394,
5
+ viewBox: "0 0 424 394",
6
+ ...props,
7
+ children: /* @__PURE__ */jsxs("g", {
8
+ fill: "none",
9
+ fillRule: "evenodd",
10
+ children: [/* @__PURE__ */jsx("path", {
11
+ d: "M310.786 30v28.75H372.5l-.001 28.75H426.5v86.25h-54.001l.001 28.75h-61.714v115h-28.929V375h-202.5v-57.5H21.5v-230h57.857V30h231.429Z",
12
+ opacity: 0.267
13
+ }), /* @__PURE__ */jsxs("g", {
14
+ fill: "var(--color)",
15
+ children: [/* @__PURE__ */jsx("path", {
16
+ d: "M279.5 0h-20v20h20zM250.7 0h-20v20h20zM221.9 0h-20v20h20zM193.1 0h-20v20h20zM164.3 0h-20v20h20zM135.5 0h-20v20h20zM106.7 28.714h-20v20h20zM77.9 57.429h-20v20h20zM49.1 86.143h-20v20h20zM49.1 114.857h-20v20h20zM49.1 143.571h-20v20h20zM49.1 172.286h-20v20h20zM20.3 201H.3v20h20zM20.3 229.714H.3v20h20zM20.3 258.429H.3v20h20zM49.1 287.143h-20v20h20zM77.9 315.857h-20v20h20zM106.7 344.571h-20v20h20zM135.5 373.286h-20v20h20zM164.3 373.286h-20v20h20zM193.1 344.571h-20v20h20zM221.9 344.571h-20v20h20zM221.9 373.286h-20v20h20zM250.7 373.286h-20v20h20zM279.5 344.571h-20v20h20zM279.5 315.857h-20v20h20zM308.3 287.143h-20v20h20zM337.1 229.714h-20v20h20zM337.1 258.429h-20v20h20zM337.1 201h-20v20h20zM365.9 172.286h-20v20h20zM394.7 172.286h-20v20h20zM423.5 143.571h-20v20h20zM394.7 114.857h-20v20h20zM365.9 114.857h-20v20h20zM337.1 114.857h-20v20h20zM423.5 86.143h-20v20h20zM423.5 114.857h-20v20h20zM394.7 57.429h-20v20h20z"
17
+ }), /* @__PURE__ */jsx("path", {
18
+ d: "M394.7 57.429h-20v20h20zM365.9 57.429h-20v20h20zM308.3 28.714h-20v20h20zM279.5 57.429h-20v20h20zM193.1 86.143h-20v20h20zM193.1 201h-20v20h20zM193.1 229.714h-20v20h20zM164.3 258.429h-20v20h20zM135.5 229.714h-20v20h20zM135.5 201h-20v20h20zM337.1 57.429h-20v20h20z"
19
+ })]
20
+ })]
21
+ })
22
+ });
23
+ export { TamaguiIconSvg };
@@ -0,0 +1,5 @@
1
+ export * from "./TamaguiLogo.mjs";
2
+ export * from "./LogoWords.mjs";
3
+ export * from "./LogoIcon.mjs";
4
+ export * from "./tints.mjs";
5
+ export * from "./useTint.mjs";
@@ -0,0 +1,36 @@
1
+ import { useEffect, useState } from "react";
2
+ const listeners = /* @__PURE__ */new Set(),
3
+ familiesValues = {
4
+ tamagui: ["orange", "yellow", "green", "blue", "purple", "pink", "red"],
5
+ xmas: ["red", "green", "red", "green", "red", "green", "red"],
6
+ easter: ["yellow", "pink", "yellow", "pink", "yellow", "pink", "yellow"],
7
+ halloween: ["orange", "gray", "orange", "gray", "orange", "gray", "orange"]
8
+ },
9
+ DEFAULT_FAMILY = "tamagui",
10
+ familiesNames = Object.keys(familiesValues),
11
+ families = familiesValues;
12
+ let fam = DEFAULT_FAMILY;
13
+ function getTints() {
14
+ return {
15
+ name: fam || DEFAULT_FAMILY,
16
+ tints: families[fam] || families.tamagui,
17
+ families
18
+ };
19
+ }
20
+ function useTints() {
21
+ const [val, setVal] = useState(getTints());
22
+ return useEffect(() => onTintFamilyChange(() => {
23
+ setVal(getTints());
24
+ }), []), val;
25
+ }
26
+ function setTintFamily(next) {
27
+ if (!families[next]) throw "impossible";
28
+ fam = next, listeners.forEach(l => l(next));
29
+ }
30
+ const setNextTintFamily = () => {
31
+ setTintFamily(familiesNames[(familiesNames.indexOf(fam) + 1) % familiesNames.length]);
32
+ },
33
+ onTintFamilyChange = cb => (listeners.add(cb), () => {
34
+ listeners.delete(cb);
35
+ });
36
+ export { getTints, onTintFamilyChange, setNextTintFamily, setTintFamily, useTints };
@@ -0,0 +1,65 @@
1
+ import { startTransition, useSyncExternalStore } from "react";
2
+ import { Theme } from "tamagui";
3
+ import { getTints, setNextTintFamily, useTints } from "./tints.mjs";
4
+ import { jsx } from "react/jsx-runtime";
5
+ const initialTint = 3;
6
+ let current = initialTint;
7
+ const listeners = /* @__PURE__ */new Set(),
8
+ onTintChange = listener => (listeners.add(listener), () => {
9
+ listeners.delete(listener);
10
+ }),
11
+ numTints = getTints().tints.length,
12
+ setTintIndex = next => {
13
+ const val = next % numTints;
14
+ val !== current && (current = val, startTransition(() => {
15
+ listeners.forEach(x => x(val));
16
+ }));
17
+ },
18
+ useTint = () => {
19
+ const index = useSyncExternalStore(onTintChange, () => current, () => initialTint),
20
+ tintsContext = useTints(),
21
+ {
22
+ tints
23
+ } = tintsContext;
24
+ return {
25
+ ...tintsContext,
26
+ tints: tintsContext.tints,
27
+ tintIndex: index,
28
+ tint: tints[index],
29
+ setTintIndex,
30
+ setNextTintFamily,
31
+ setNextTint: () => {
32
+ setTintIndex(index + 1);
33
+ }
34
+ };
35
+ },
36
+ ThemeTint = ({
37
+ disable,
38
+ children,
39
+ ...rest
40
+ }) => {
41
+ const curTint = useTint().tint;
42
+ return /* @__PURE__ */jsx(Theme, {
43
+ ...rest,
44
+ name: disable ? null : curTint,
45
+ children
46
+ });
47
+ },
48
+ useTintAlt = (offset = 1) => {
49
+ const tint = useTint();
50
+ return tint.tints[Math.abs((tint.tintIndex + offset) % tint.tints.length)];
51
+ },
52
+ ThemeTintAlt = ({
53
+ children,
54
+ disable,
55
+ offset = 1,
56
+ ...rest
57
+ }) => {
58
+ const curTint = useTintAlt(offset);
59
+ return /* @__PURE__ */jsx(Theme, {
60
+ ...rest,
61
+ name: disable ? null : curTint,
62
+ children
63
+ });
64
+ };
65
+ export { ThemeTint, ThemeTintAlt, initialTint, onTintChange, setTintIndex, useTint, useTintAlt };
@@ -0,0 +1,21 @@
1
+ import { YStack } from "tamagui";
2
+ import { TamaguiIconSvg } from "./TamaguiLogoSvg.mjs";
3
+ import { jsx } from "react/jsx-runtime";
4
+ const LogoIcon = ({
5
+ downscale = 2
6
+ }) => /* @__PURE__ */jsx(YStack, {
7
+ tag: "span",
8
+ className: "unselectable",
9
+ alignSelf: "center",
10
+ marginVertical: -10,
11
+ pressStyle: {
12
+ opacity: 0.7,
13
+ scaleX: -1
14
+ },
15
+ children: /* @__PURE__ */jsx(TamaguiIconSvg, {
16
+ className: "tamagui-icon",
17
+ width: 450 / 8 / downscale,
18
+ height: 420 / 8 / downscale
19
+ })
20
+ });
21
+ export { LogoIcon };
@@ -0,0 +1,100 @@
1
+ import { memo, useEffect, useState } from "react";
2
+ import { Circle, XStack } from "tamagui";
3
+ import { useTint } from "./useTint.mjs";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ const LogoWords = memo(({
6
+ downscale = 1,
7
+ grayscale,
8
+ animated,
9
+ ...props
10
+ }) => {
11
+ const Tint = useTint(),
12
+ {
13
+ tintIndex: index,
14
+ tint
15
+ } = Tint,
16
+ tints = Tint.tints.map(t => `var(--${t}9)`),
17
+ [hovered, setHovered] = useState(!1),
18
+ [mounted, setMounted] = useState("start");
19
+ useEffect(() => {
20
+ (window.requestIdleCallback || setTimeout)(() => {
21
+ setTimeout(() => {
22
+ setMounted("animate");
23
+ }, 50), setTimeout(() => {
24
+ setMounted("done");
25
+ }, 1500);
26
+ });
27
+ }, []);
28
+ const getColor = i => {
29
+ const isActive = mounted !== "start" && i === index;
30
+ return grayscale ? hovered && isActive ? "var(--gray12)" : hovered ? "var(--gray11)" : "var(--gray10)" : mounted !== "done" || hovered ? isActive ? "var(--color)" : tints[index] : hovered && isActive ? "var(--color)" : tints[i];
31
+ },
32
+ x = Math.round(index * 18.5 + 18 / 2 * (index / tints.length) + 3 + (index === 6 ? -3 : 0));
33
+ return /* @__PURE__ */jsxs(XStack, {
34
+ onHoverIn: () => setHovered(!0),
35
+ onHoverOut: () => setHovered(!1),
36
+ paddingVertical: "$2",
37
+ "data-tauri-drag-region": !0,
38
+ marginVertical: "$-2",
39
+ position: "relative",
40
+ ...props,
41
+ children: [animated && /* @__PURE__ */jsx(Circle, {
42
+ animation: "quick",
43
+ position: "absolute",
44
+ top: 0,
45
+ left: 0,
46
+ y: mounted === "start" ? -30 : -3,
47
+ x,
48
+ size: 4,
49
+ backgroundColor: "$color9"
50
+ }), /* @__PURE__ */jsxs("svg", {
51
+ "data-tauri-drag-region": !0,
52
+ width: 373 * (1 / downscale) * 0.333333334,
53
+ height: 41 * (1 / downscale) * 0.333333334,
54
+ viewBox: "0 0 373 41",
55
+ children: [/* @__PURE__ */jsx("polygon", {
56
+ "data-tauri-drag-region": !0,
57
+ shapeRendering: "crispEdges",
58
+ fill: getColor(0),
59
+ 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",
60
+ onMouseEnter: () => Tint.setTintIndex(0)
61
+ }), /* @__PURE__ */jsx("path", {
62
+ shapeRendering: "crispEdges",
63
+ fill: getColor(1),
64
+ 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",
65
+ fillRule: "nonzero",
66
+ onMouseEnter: () => Tint.setTintIndex(1)
67
+ }), /* @__PURE__ */jsx("polygon", {
68
+ "data-tauri-drag-region": !0,
69
+ shapeRendering: "crispEdges",
70
+ fill: getColor(2),
71
+ 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",
72
+ onMouseEnter: () => Tint.setTintIndex(2)
73
+ }), /* @__PURE__ */jsx("path", {
74
+ fill: getColor(3),
75
+ 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",
76
+ fillRule: "nonzero",
77
+ onMouseEnter: () => Tint.setTintIndex(3)
78
+ }), /* @__PURE__ */jsx("polygon", {
79
+ "data-tauri-drag-region": !0,
80
+ shapeRendering: "crispEdges",
81
+ fill: getColor(4),
82
+ 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",
83
+ onMouseEnter: () => Tint.setTintIndex(4)
84
+ }), /* @__PURE__ */jsx("polygon", {
85
+ "data-tauri-drag-region": !0,
86
+ shapeRendering: "crispEdges",
87
+ fill: getColor(5),
88
+ 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",
89
+ onMouseEnter: () => Tint.setTintIndex(5)
90
+ }), /* @__PURE__ */jsx("polygon", {
91
+ "data-tauri-drag-region": !0,
92
+ shapeRendering: "crispEdges",
93
+ fill: getColor(6),
94
+ points: "372.677419 40.1612903 372.677419 0.806451613 356.935484 0.806451613 356.935484 40.1612903",
95
+ onMouseEnter: () => Tint.setTintIndex(6)
96
+ })]
97
+ })]
98
+ });
99
+ });
100
+ export { LogoWords };
@@ -0,0 +1,29 @@
1
+ import { forwardRef } from "react";
2
+ import { XStack, YStack } from "tamagui";
3
+ import { LogoIcon } from "./LogoIcon.mjs";
4
+ import { LogoWords } from "./LogoWords.mjs";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ const TamaguiLogo = forwardRef(({
7
+ showWords,
8
+ downscale,
9
+ animated,
10
+ ...props
11
+ }, ref) => /* @__PURE__ */jsxs(XStack, {
12
+ tag: "span",
13
+ ref,
14
+ alignItems: "center",
15
+ justifyContent: "center",
16
+ space: "$5",
17
+ ...props,
18
+ children: [/* @__PURE__ */jsx(LogoIcon, {
19
+ downscale: (downscale ?? 1) * (showWords ? 2 : 1.5)
20
+ }), showWords && /* @__PURE__ */jsx(YStack, {
21
+ tag: "span",
22
+ marginBottom: -4,
23
+ children: /* @__PURE__ */jsx(LogoWords, {
24
+ animated,
25
+ downscale: downscale ?? 2
26
+ })
27
+ })]
28
+ }));
29
+ export { TamaguiLogo };
@@ -0,0 +1,23 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ const TamaguiIconSvg = props => /* @__PURE__ */jsx("svg", {
3
+ width: 424,
4
+ height: 394,
5
+ viewBox: "0 0 424 394",
6
+ ...props,
7
+ children: /* @__PURE__ */jsxs("g", {
8
+ fill: "none",
9
+ fillRule: "evenodd",
10
+ children: [/* @__PURE__ */jsx("path", {
11
+ d: "M310.786 30v28.75H372.5l-.001 28.75H426.5v86.25h-54.001l.001 28.75h-61.714v115h-28.929V375h-202.5v-57.5H21.5v-230h57.857V30h231.429Z",
12
+ opacity: 0.267
13
+ }), /* @__PURE__ */jsxs("g", {
14
+ fill: "var(--color)",
15
+ children: [/* @__PURE__ */jsx("path", {
16
+ d: "M279.5 0h-20v20h20zM250.7 0h-20v20h20zM221.9 0h-20v20h20zM193.1 0h-20v20h20zM164.3 0h-20v20h20zM135.5 0h-20v20h20zM106.7 28.714h-20v20h20zM77.9 57.429h-20v20h20zM49.1 86.143h-20v20h20zM49.1 114.857h-20v20h20zM49.1 143.571h-20v20h20zM49.1 172.286h-20v20h20zM20.3 201H.3v20h20zM20.3 229.714H.3v20h20zM20.3 258.429H.3v20h20zM49.1 287.143h-20v20h20zM77.9 315.857h-20v20h20zM106.7 344.571h-20v20h20zM135.5 373.286h-20v20h20zM164.3 373.286h-20v20h20zM193.1 344.571h-20v20h20zM221.9 344.571h-20v20h20zM221.9 373.286h-20v20h20zM250.7 373.286h-20v20h20zM279.5 344.571h-20v20h20zM279.5 315.857h-20v20h20zM308.3 287.143h-20v20h20zM337.1 229.714h-20v20h20zM337.1 258.429h-20v20h20zM337.1 201h-20v20h20zM365.9 172.286h-20v20h20zM394.7 172.286h-20v20h20zM423.5 143.571h-20v20h20zM394.7 114.857h-20v20h20zM365.9 114.857h-20v20h20zM337.1 114.857h-20v20h20zM423.5 86.143h-20v20h20zM423.5 114.857h-20v20h20zM394.7 57.429h-20v20h20z"
17
+ }), /* @__PURE__ */jsx("path", {
18
+ d: "M394.7 57.429h-20v20h20zM365.9 57.429h-20v20h20zM308.3 28.714h-20v20h20zM279.5 57.429h-20v20h20zM193.1 86.143h-20v20h20zM193.1 201h-20v20h20zM193.1 229.714h-20v20h20zM164.3 258.429h-20v20h20zM135.5 229.714h-20v20h20zM135.5 201h-20v20h20zM337.1 57.429h-20v20h20z"
19
+ })]
20
+ })]
21
+ })
22
+ });
23
+ export { TamaguiIconSvg };
@@ -0,0 +1,5 @@
1
+ export * from "./TamaguiLogo.mjs";
2
+ export * from "./LogoWords.mjs";
3
+ export * from "./LogoIcon.mjs";
4
+ export * from "./tints.mjs";
5
+ export * from "./useTint.mjs";
@@ -0,0 +1,36 @@
1
+ import { useEffect, useState } from "react";
2
+ const listeners = /* @__PURE__ */new Set(),
3
+ familiesValues = {
4
+ tamagui: ["orange", "yellow", "green", "blue", "purple", "pink", "red"],
5
+ xmas: ["red", "green", "red", "green", "red", "green", "red"],
6
+ easter: ["yellow", "pink", "yellow", "pink", "yellow", "pink", "yellow"],
7
+ halloween: ["orange", "gray", "orange", "gray", "orange", "gray", "orange"]
8
+ },
9
+ DEFAULT_FAMILY = "tamagui",
10
+ familiesNames = Object.keys(familiesValues),
11
+ families = familiesValues;
12
+ let fam = DEFAULT_FAMILY;
13
+ function getTints() {
14
+ return {
15
+ name: fam || DEFAULT_FAMILY,
16
+ tints: families[fam] || families.tamagui,
17
+ families
18
+ };
19
+ }
20
+ function useTints() {
21
+ const [val, setVal] = useState(getTints());
22
+ return useEffect(() => onTintFamilyChange(() => {
23
+ setVal(getTints());
24
+ }), []), val;
25
+ }
26
+ function setTintFamily(next) {
27
+ if (!families[next]) throw "impossible";
28
+ fam = next, listeners.forEach(l => l(next));
29
+ }
30
+ const setNextTintFamily = () => {
31
+ setTintFamily(familiesNames[(familiesNames.indexOf(fam) + 1) % familiesNames.length]);
32
+ },
33
+ onTintFamilyChange = cb => (listeners.add(cb), () => {
34
+ listeners.delete(cb);
35
+ });
36
+ export { getTints, onTintFamilyChange, setNextTintFamily, setTintFamily, useTints };
@@ -0,0 +1,65 @@
1
+ import { startTransition, useSyncExternalStore } from "react";
2
+ import { Theme } from "tamagui";
3
+ import { getTints, setNextTintFamily, useTints } from "./tints.mjs";
4
+ import { jsx } from "react/jsx-runtime";
5
+ const initialTint = 3;
6
+ let current = initialTint;
7
+ const listeners = /* @__PURE__ */new Set(),
8
+ onTintChange = listener => (listeners.add(listener), () => {
9
+ listeners.delete(listener);
10
+ }),
11
+ numTints = getTints().tints.length,
12
+ setTintIndex = next => {
13
+ const val = next % numTints;
14
+ val !== current && (current = val, startTransition(() => {
15
+ listeners.forEach(x => x(val));
16
+ }));
17
+ },
18
+ useTint = () => {
19
+ const index = useSyncExternalStore(onTintChange, () => current, () => initialTint),
20
+ tintsContext = useTints(),
21
+ {
22
+ tints
23
+ } = tintsContext;
24
+ return {
25
+ ...tintsContext,
26
+ tints: tintsContext.tints,
27
+ tintIndex: index,
28
+ tint: tints[index],
29
+ setTintIndex,
30
+ setNextTintFamily,
31
+ setNextTint: () => {
32
+ setTintIndex(index + 1);
33
+ }
34
+ };
35
+ },
36
+ ThemeTint = ({
37
+ disable,
38
+ children,
39
+ ...rest
40
+ }) => {
41
+ const curTint = useTint().tint;
42
+ return /* @__PURE__ */jsx(Theme, {
43
+ ...rest,
44
+ name: disable ? null : curTint,
45
+ children
46
+ });
47
+ },
48
+ useTintAlt = (offset = 1) => {
49
+ const tint = useTint();
50
+ return tint.tints[Math.abs((tint.tintIndex + offset) % tint.tints.length)];
51
+ },
52
+ ThemeTintAlt = ({
53
+ children,
54
+ disable,
55
+ offset = 1,
56
+ ...rest
57
+ }) => {
58
+ const curTint = useTintAlt(offset);
59
+ return /* @__PURE__ */jsx(Theme, {
60
+ ...rest,
61
+ name: disable ? null : curTint,
62
+ children
63
+ });
64
+ };
65
+ export { ThemeTint, ThemeTintAlt, initialTint, onTintChange, setTintIndex, useTint, useTintAlt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/logo",
3
- "version": "1.88.13",
3
+ "version": "1.89.0-1706308641099",
4
4
  "sideEffects": false,
5
5
  "source": "src/index.ts",
6
6
  "types": "./types/index.d.ts",
@@ -24,10 +24,10 @@
24
24
  "react": "*"
25
25
  },
26
26
  "dependencies": {
27
- "tamagui": "1.88.13"
27
+ "tamagui": "1.89.0-1706308641099"
28
28
  },
29
29
  "devDependencies": {
30
- "@tamagui/build": "1.88.13",
30
+ "@tamagui/build": "1.89.0-1706308641099",
31
31
  "react": "^18.2.0"
32
32
  },
33
33
  "publishConfig": {