@hanzogui/logo 8.3.0 → 8.3.2
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/GuiLogo.js +12 -0
- package/dist/cjs/GuiLogo.js.map +1 -0
- package/dist/cjs/GuiLogoSvg.js +19 -0
- package/dist/cjs/GuiLogoSvg.js.map +1 -0
- package/dist/cjs/LogoIcon.js +14 -0
- package/dist/cjs/LogoIcon.js.map +1 -0
- package/dist/cjs/LogoWords.js +80 -0
- package/dist/cjs/LogoWords.js.map +1 -0
- package/dist/cjs/SeasonProvider.js +42 -0
- package/dist/cjs/SeasonProvider.js.map +1 -0
- package/dist/cjs/ThemeTint.js +18 -0
- package/dist/cjs/ThemeTint.js.map +1 -0
- package/dist/cjs/index.js +11 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/tints.js +102 -0
- package/dist/cjs/tints.js.map +1 -0
- package/dist/cjs/useTint.js +93 -0
- package/dist/cjs/useTint.js.map +1 -0
- package/dist/esm/GuiLogo.js +8 -0
- package/dist/esm/GuiLogo.js.map +1 -0
- package/dist/esm/GuiLogoSvg.js +15 -0
- package/dist/esm/GuiLogoSvg.js.map +1 -0
- package/dist/esm/LogoIcon.js +10 -0
- package/dist/esm/LogoIcon.js.map +1 -0
- package/dist/esm/LogoWords.js +76 -0
- package/dist/esm/LogoWords.js.map +1 -0
- package/dist/esm/SeasonProvider.js +39 -0
- package/dist/esm/SeasonProvider.js.map +1 -0
- package/dist/esm/ThemeTint.js +13 -0
- package/dist/esm/ThemeTint.js.map +1 -0
- package/dist/esm/index.js +8 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tints.js +93 -0
- package/dist/esm/tints.js.map +1 -0
- package/dist/esm/useTint.js +83 -0
- package/dist/esm/useTint.js.map +1 -0
- package/package.json +24 -25
- package/src/GuiLogo.tsx +2 -2
- package/src/LogoIcon.tsx +1 -1
- package/src/LogoWords.tsx +1 -1
- package/src/SeasonProvider.tsx +1 -1
- package/src/ThemeTint.tsx +1 -1
- package/src/index.tsx +7 -7
- package/src/useTint.tsx +1 -1
- package/types/GuiLogo.d.ts +7 -8
- package/types/GuiLogo.d.ts.map +1 -11
- package/types/GuiLogoSvg.d.ts +12 -13
- package/types/GuiLogoSvg.d.ts.map +1 -11
- package/types/LogoIcon.d.ts +4 -5
- package/types/LogoIcon.d.ts.map +1 -11
- package/types/LogoWords.d.ts +5 -6
- package/types/LogoWords.d.ts.map +1 -11
- package/types/SeasonProvider.d.ts +3 -4
- package/types/SeasonProvider.d.ts.map +1 -11
- package/types/ThemeTint.d.ts +5 -6
- package/types/ThemeTint.d.ts.map +1 -11
- package/types/index.d.ts +7 -8
- package/types/index.d.ts.map +1 -11
- package/types/tints.d.ts +17 -16
- package/types/tints.d.ts.map +1 -11
- package/types/useTint.d.ts +22 -23
- package/types/useTint.d.ts.map +1 -11
- package/dist/cjs/GuiLogo.cjs +0 -59
- package/dist/cjs/GuiLogo.native.js +0 -63
- package/dist/cjs/GuiLogo.native.js.map +0 -1
- package/dist/cjs/GuiLogoSvg.cjs +0 -42
- package/dist/cjs/GuiLogoSvg.native.js +0 -50
- package/dist/cjs/GuiLogoSvg.native.js.map +0 -1
- package/dist/cjs/LogoIcon.cjs +0 -51
- package/dist/cjs/LogoIcon.native.js +0 -55
- package/dist/cjs/LogoIcon.native.js.map +0 -1
- package/dist/cjs/LogoWords.cjs +0 -130
- package/dist/cjs/LogoWords.native.js +0 -139
- package/dist/cjs/LogoWords.native.js.map +0 -1
- package/dist/cjs/SeasonProvider.cjs +0 -46
- package/dist/cjs/SeasonProvider.native.js +0 -57
- package/dist/cjs/SeasonProvider.native.js.map +0 -1
- package/dist/cjs/ThemeTint.cjs +0 -57
- package/dist/cjs/ThemeTint.native.js +0 -62
- package/dist/cjs/ThemeTint.native.js.map +0 -1
- package/dist/cjs/index.cjs +0 -26
- package/dist/cjs/index.native.js +0 -29
- package/dist/cjs/index.native.js.map +0 -1
- package/dist/cjs/tints.cjs +0 -102
- package/dist/cjs/tints.native.js +0 -107
- package/dist/cjs/tints.native.js.map +0 -1
- package/dist/cjs/useTint.cjs +0 -116
- package/dist/cjs/useTint.native.js +0 -128
- package/dist/cjs/useTint.native.js.map +0 -1
- package/dist/esm/GuiLogo.mjs +0 -34
- package/dist/esm/GuiLogo.mjs.map +0 -1
- package/dist/esm/GuiLogo.native.js +0 -35
- package/dist/esm/GuiLogo.native.js.map +0 -1
- package/dist/esm/GuiLogoSvg.mjs +0 -17
- package/dist/esm/GuiLogoSvg.mjs.map +0 -1
- package/dist/esm/GuiLogoSvg.native.js +0 -22
- package/dist/esm/GuiLogoSvg.native.js.map +0 -1
- package/dist/esm/LogoIcon.mjs +0 -26
- package/dist/esm/LogoIcon.mjs.map +0 -1
- package/dist/esm/LogoIcon.native.js +0 -27
- package/dist/esm/LogoIcon.native.js.map +0 -1
- package/dist/esm/LogoWords.mjs +0 -94
- package/dist/esm/LogoWords.mjs.map +0 -1
- package/dist/esm/LogoWords.native.js +0 -100
- package/dist/esm/LogoWords.native.js.map +0 -1
- package/dist/esm/SeasonProvider.mjs +0 -21
- package/dist/esm/SeasonProvider.mjs.map +0 -1
- package/dist/esm/SeasonProvider.native.js +0 -29
- package/dist/esm/SeasonProvider.native.js.map +0 -1
- package/dist/esm/ThemeTint.mjs +0 -31
- package/dist/esm/ThemeTint.mjs.map +0 -1
- package/dist/esm/ThemeTint.native.js +0 -33
- package/dist/esm/ThemeTint.native.js.map +0 -1
- package/dist/esm/index.mjs +0 -8
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js +0 -8
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/tints.mjs +0 -62
- package/dist/esm/tints.mjs.map +0 -1
- package/dist/esm/tints.native.js +0 -64
- package/dist/esm/tints.native.js.map +0 -1
- package/dist/esm/useTint.mjs +0 -74
- package/dist/esm/useTint.mjs.map +0 -1
- package/dist/esm/useTint.native.js +0 -83
- package/dist/esm/useTint.native.js.map +0 -1
- package/icon/index.js +0 -1
- package/icon/index.native.js +0 -1
- package/icon.cjs +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GuiLogo = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const gui_1 = require("@hanzo/gui");
|
|
6
|
+
const LogoIcon_tsx_1 = require("./LogoIcon.js");
|
|
7
|
+
const LogoWords_tsx_1 = require("./LogoWords.js");
|
|
8
|
+
const GuiLogo = ({ showWords, downscale, animated, color, ref, ...props }) => {
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { render: "span", ref: ref, alignItems: "center", justifyContent: "center", gap: "$5", ...props, children: [(0, jsx_runtime_1.jsx)(LogoIcon_tsx_1.LogoIcon, { downscale: (downscale ?? 1) * (showWords ? 2 : 1.5), color: color }), showWords && ((0, jsx_runtime_1.jsx)(gui_1.YStack, { render: "span", marginBottom: -4, children: (0, jsx_runtime_1.jsx)(LogoWords_tsx_1.LogoWords, { animated: animated, downscale: downscale ?? 2 }) }))] }));
|
|
10
|
+
};
|
|
11
|
+
exports.GuiLogo = GuiLogo;
|
|
12
|
+
//# sourceMappingURL=GuiLogo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuiLogo.js","sourceRoot":"","sources":["../../src/GuiLogo.tsx"],"names":[],"mappings":";;;;AAEA,oCAA2C;AAC3C,gDAAyC;AACzC,kDAA2C;AAUpC,MAAM,OAAO,GAAG,CAAC,EACtB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACE,EAAe,EAAE;IAC3B,OAAO,CACL,wBAAC,YAAM,IACL,MAAM,EAAC,MAAM,EACb,GAAG,EAAE,GAAG,EACR,UAAU,EAAC,QAAQ,EACnB,cAAc,EAAC,QAAQ,EACvB,GAAG,EAAC,IAAI,KACJ,KAAK,aAET,uBAAC,uBAAQ,IAAC,SAAS,EAAE,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,GAAI,EAC9E,SAAS,IAAI,CACZ,uBAAC,YAAM,IAAC,MAAM,EAAC,MAAM,EAAC,YAAY,EAAE,CAAC,CAAC,YACpC,uBAAC,yBAAS,IAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,IAAI,CAAC,GAAI,GACrD,CACV,IACM,CACV,CAAA;AACH,CAAC,CAAA;AAzBY,QAAA,OAAO,GAAP,OAAO,CAyBnB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GuiIconSvg = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const logos_1 = require("@hanzo/logo/logos");
|
|
6
|
+
/**
|
|
7
|
+
* The Hanzo mark.
|
|
8
|
+
*
|
|
9
|
+
* This drew a duck — `<g id="duck">`, pixel art, `#ECD20A` — because the fork
|
|
10
|
+
* renamed the package and left the artwork. It was the mark in this site's
|
|
11
|
+
* header, footer, login, 404, every doc page and its favicon.
|
|
12
|
+
*
|
|
13
|
+
* The geometry comes from `@hanzo/logo`, never retyped: MARK_BLOCKS is the five
|
|
14
|
+
* body blocks of the block-H on its own 67 viewBox. `currentColor` by default so
|
|
15
|
+
* the mark themes with the text around it rather than pinning a brand hex.
|
|
16
|
+
*/
|
|
17
|
+
const GuiIconSvg = ({ color = 'currentColor', ...props }) => ((0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 67 67", width: "67px", height: "67px", ...props, children: logos_1.MARK_BLOCKS.map((d) => ((0, jsx_runtime_1.jsx)("path", { d: d, fill: color }, d))) }));
|
|
18
|
+
exports.GuiIconSvg = GuiIconSvg;
|
|
19
|
+
//# sourceMappingURL=GuiLogoSvg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuiLogoSvg.js","sourceRoot":"","sources":["../../src/GuiLogoSvg.tsx"],"names":[],"mappings":";;;;AACA,6CAA+C;AAM/C;;;;;;;;;;GAUG;AACI,MAAM,UAAU,GAAG,CAAC,EACzB,KAAK,GAAG,cAAc,EACtB,GAAG,KAAK,EACQ,EAAe,EAAE,CAAC,CAClC,gCAAK,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,KAAK,KAAK,YAC1D,mBAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACtB,iCAAc,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,IAApB,CAAC,CAAuB,CACpC,CAAC,GACE,CACP,CAAA;AATY,QAAA,UAAU,GAAV,UAAU,CAStB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogoIcon = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const gui_1 = require("@hanzo/gui");
|
|
6
|
+
const GuiLogoSvg_tsx_1 = require("./GuiLogoSvg.js");
|
|
7
|
+
const LogoIcon = ({ downscale = 2, color, }) => {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { render: "span", className: "unselectable", alignSelf: "center", marginVertical: -10, pressStyle: {
|
|
9
|
+
opacity: 0.7,
|
|
10
|
+
scaleX: -1,
|
|
11
|
+
}, children: (0, jsx_runtime_1.jsx)(GuiLogoSvg_tsx_1.GuiIconSvg, { className: "hanzogui-icon", width: 440 / 8 / downscale, height: 440 / 8 / downscale, color: color }) }));
|
|
12
|
+
};
|
|
13
|
+
exports.LogoIcon = LogoIcon;
|
|
14
|
+
//# sourceMappingURL=LogoIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogoIcon.js","sourceRoot":"","sources":["../../src/LogoIcon.tsx"],"names":[],"mappings":";;;;AAAA,oCAAmC;AACnC,oDAA6C;AAGtC,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,GAAG,CAAC,EACb,KAAK,GAIN,EAAe,EAAE;IAChB,OAAO,CACL,uBAAC,YAAM,IACL,MAAM,EAAC,MAAM,EACb,SAAS,EAAC,cAAc,EACxB,SAAS,EAAC,QAAQ,EAClB,cAAc,EAAE,CAAC,EAAE,EACnB,UAAU,EAAE;YACV,OAAO,EAAE,GAAG;YACZ,MAAM,EAAE,CAAC,CAAC;SACX,YAED,uBAAC,2BAAU,IACT,SAAS,EAAC,eAAe,EACzB,KAAK,EAAE,GAAG,GAAG,CAAC,GAAG,SAAS,EAC1B,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,SAAS,EAC3B,KAAK,EAAE,KAAK,GACZ,GACK,CACV,CAAA;AACH,CAAC,CAAA;AA1BY,QAAA,QAAQ,GAAR,QAAQ,CA0BpB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogoWords = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
const gui_1 = require("@hanzo/gui");
|
|
8
|
+
const wordmarks_1 = require("@hanzo/logo/wordmarks");
|
|
9
|
+
const useTint_tsx_1 = require("./useTint.js");
|
|
10
|
+
/**
|
|
11
|
+
* The wordmark.
|
|
12
|
+
*
|
|
13
|
+
* This drew T-A-M-A-G-U-I: seven pixel-art letter polygons on a 373x41 box,
|
|
14
|
+
* each tinted from a seven-colour table, with the hover strip split into seven
|
|
15
|
+
* sections and the dot stepped by a constant fitted to those letters. The fork
|
|
16
|
+
* renamed the package and kept the artwork, so the site's own name was another
|
|
17
|
+
* company's.
|
|
18
|
+
*
|
|
19
|
+
* It renders the outlined Hanzo wordmark from @hanzo/logo now — real paths cut
|
|
20
|
+
* from Zen, so it needs no font loaded and cannot drift from the wordmark every
|
|
21
|
+
* other Hanzo surface uses.
|
|
22
|
+
*
|
|
23
|
+
* The tint interaction stays, because it is a feature rather than a piece of
|
|
24
|
+
* the old wordmark — but it is no longer DIMENSIONED to seven letters. The
|
|
25
|
+
* strip divides by however many tints there are, and the dot rides the same
|
|
26
|
+
* fraction, so the two agree whatever that number becomes.
|
|
27
|
+
*/
|
|
28
|
+
const WORDMARK = wordmarks_1.WORDMARKS['Hanzo'];
|
|
29
|
+
const [WM_X, WM_Y, WM_W, WM_H] = WORDMARK.box;
|
|
30
|
+
exports.LogoWords = react_1.default.memo(({ downscale = 1, animated, ...props }) => {
|
|
31
|
+
const Tint = (0, useTint_tsx_1.useTint)();
|
|
32
|
+
const [hovered, setHovered] = react_1.default.useState(false);
|
|
33
|
+
const [mounted, setMounted] = react_1.default.useState('start');
|
|
34
|
+
const { tintIndex: index } = Tint;
|
|
35
|
+
const sections = Tint.tints.length;
|
|
36
|
+
(0, react_1.useEffect)(() => {
|
|
37
|
+
const idle = window.requestIdleCallback || setTimeout;
|
|
38
|
+
idle(() => {
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
setMounted('animate');
|
|
41
|
+
}, 50);
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
setMounted('done');
|
|
44
|
+
}, 1500);
|
|
45
|
+
});
|
|
46
|
+
}, []);
|
|
47
|
+
(0, react_1.useEffect)(() => {
|
|
48
|
+
const handleKeyDown = (event) => {
|
|
49
|
+
const i = Number.parseInt(event.key, 10) - 1; // Convert key to index (0-based)
|
|
50
|
+
if (!Number.isNaN(i) && i >= 0 && i < Tint.tints.length) {
|
|
51
|
+
Tint.setTintIndex(i);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
55
|
+
return () => {
|
|
56
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
57
|
+
};
|
|
58
|
+
}, [Tint]);
|
|
59
|
+
const [layout, setLayout] = (0, react_1.useState)();
|
|
60
|
+
// The mark is one ink; the tint shows through the dot rather than by
|
|
61
|
+
// recolouring letters, which is what the seven-colour table did.
|
|
62
|
+
const fill = hovered ? `var(--${Tint.tints[index]}9)` : 'var(--color12)';
|
|
63
|
+
const width = 373 * (1 / downscale) * 0.3333333;
|
|
64
|
+
const height = (width * WM_H) / WM_W;
|
|
65
|
+
// the dot sits over the section the current tint owns
|
|
66
|
+
const dotX = Math.round((width / sections) * (index + 0.5));
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), paddingVertical: "$2", "data-tauri-drag-region": true, marginVertical: "$-2", position: "relative", className: "logo-words", onLayout: (e) => {
|
|
68
|
+
setLayout(e.nativeEvent.layout);
|
|
69
|
+
},
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
onMouseMove: (e) => {
|
|
72
|
+
if (!layout)
|
|
73
|
+
return;
|
|
74
|
+
const x = e.clientX - layout.pageX;
|
|
75
|
+
const sectionWidth = layout.width / sections;
|
|
76
|
+
const section = Math.min(sections - 1, Math.max(0, Math.floor(x / sectionWidth)));
|
|
77
|
+
Tint.setTintIndex(section);
|
|
78
|
+
}, ...props, children: [animated && ((0, jsx_runtime_1.jsx)(gui_1.Circle, { transition: "medium", position: "absolute", top: 0, left: 0, y: mounted === 'start' ? -30 : -4, x: dotX, size: 4, backgroundColor: "$color12" })), (0, jsx_runtime_1.jsx)("svg", { "data-tauri-drag-region": true, role: "img", "aria-label": "Hanzo", width: width, height: height, viewBox: `${WM_X} ${-WM_Y - WM_H} ${WM_W} ${WM_H}`, children: (0, jsx_runtime_1.jsx)("g", { transform: "scale(1,-1)", children: (0, jsx_runtime_1.jsx)("path", { d: WORDMARK.d, fill: fill }) }) })] }));
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=LogoWords.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogoWords.js","sourceRoot":"","sources":["../../src/LogoWords.tsx"],"names":[],"mappings":";;;;;AACA,uDAAkD;AAElD,oCAA2C;AAC3C,qDAAiD;AACjD,8CAAuC;AAEvC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,QAAQ,GAAG,qBAAS,CAAC,OAAO,CAAC,CAAA;AACnC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAA;AAEhC,QAAA,SAAS,GASlB,eAAK,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACvD,MAAM,IAAI,GAAG,IAAA,qBAAO,GAAE,CAAA;IACtB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACnD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,eAAK,CAAC,QAAQ,CAA+B,OAAO,CAAC,CAAA;IAEnF,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;IACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAA;IAElC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,MAAM,CAAC,mBAAmB,IAAI,UAAU,CAAA;QACrD,IAAI,CAAC,GAAG,EAAE;YACR,UAAU,CAAC,GAAG,EAAE;gBACd,UAAU,CAAC,SAAS,CAAC,CAAA;YACvB,CAAC,EAAE,EAAE,CAAC,CAAA;YAEN,UAAU,CAAC,GAAG,EAAE;gBACd,UAAU,CAAC,MAAM,C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AClB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,YAElD,8BAAG,SAAS,EAAC,aAAa,YACxB,iCAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,GAAI,GACjC,GACA,IACC,CACV,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SeasonProvider = SeasonProvider;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const tints_tsx_1 = require("./tints.js");
|
|
7
|
+
// inline script that runs before hydration to set season class on html
|
|
8
|
+
// auto-detects season from current date
|
|
9
|
+
function getInlineScript() {
|
|
10
|
+
return `(function(){
|
|
11
|
+
var d = new Date();
|
|
12
|
+
var m = d.getMonth();
|
|
13
|
+
var day = d.getDate();
|
|
14
|
+
var season = 'hanzogui';
|
|
15
|
+
|
|
16
|
+
if (m === 11 && day >= 14) season = 'xmas';
|
|
17
|
+
else if (m === 9 && day >= 20) season = 'halloween';
|
|
18
|
+
else if (m === 2 && day >= 10 && day <= 17) season = 'stpatricks';
|
|
19
|
+
else if (m === 2 && day >= 30 || m === 3 && day <= 20) season = 'easter';
|
|
20
|
+
else if (m === 1 && day >= 7 && day <= 14) season = 'valentine';
|
|
21
|
+
else if (m === 0 && day >= 20 || m === 1 && day <= 12) season = 'lunar';
|
|
22
|
+
|
|
23
|
+
if (season !== 'hanzogui') {
|
|
24
|
+
document.documentElement.classList.add(season + '-season');
|
|
25
|
+
}
|
|
26
|
+
window.__GUI_SEASON__ = season;
|
|
27
|
+
})();`;
|
|
28
|
+
}
|
|
29
|
+
// syncs the tint family with the value computed by the inline script
|
|
30
|
+
function useSeasonSync() {
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
const computed = window.__GUI_SEASON__;
|
|
33
|
+
if (computed) {
|
|
34
|
+
(0, tints_tsx_1.setTintFamily)(computed);
|
|
35
|
+
}
|
|
36
|
+
}, []);
|
|
37
|
+
}
|
|
38
|
+
function SeasonProvider({ children, }) {
|
|
39
|
+
useSeasonSync();
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=SeasonProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeasonProvider.js","sourceRoot":"","sources":["../../src/SeasonProvider.tsx"],"names":[],"mappings":";;;;AACA,iCAAiC;AACjC,0CAA4D;AAE5D,uEAAuE;AACvE,wCAAwC;AACxC,SAAS,eAAe;IACtB,OAAO;;;;;;;;;;;;;;;;;MAiBH,CAAA;AACN,CAAC;AAED,qEAAqE;AACrE,SAAS,aAAa;IACpB,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAI,MAAc,CAAC,cAAwC,CAAA;QACzE,IAAI,QAAQ,EAAE,CAAC;YACb,IAAA,yBAAa,EAAC,QAAQ,CAAC,CAAA;QACzB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC;AAED,wBAA+B,EAC7B,QAAQ,GAGT;IACC,aAAa,EAAE,CAAA;IAEf,OAAO,CACL,2DAQG,QAAQ,GACR,CACJ,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThemeTintAlt = exports.ThemeTint = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const web_1 = require("@hanzogui/web");
|
|
6
|
+
const useTint_tsx_1 = require("./useTint.js");
|
|
7
|
+
const ThemeTint = ({ disable, children, ...rest }) => {
|
|
8
|
+
const curTint = (0, useTint_tsx_1.useTint)().tint;
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(web_1.Theme, { ...rest, name: disable ? null : curTint, children: children }));
|
|
10
|
+
};
|
|
11
|
+
exports.ThemeTint = ThemeTint;
|
|
12
|
+
const ThemeTintAlt = ({ children, disable, offset = 1, ...rest }) => {
|
|
13
|
+
const curTint = (0, useTint_tsx_1.useTint)(offset).tintAlt;
|
|
14
|
+
const name = disable ? null : curTint;
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(web_1.Theme, { name: name, ...rest, children: children }));
|
|
16
|
+
};
|
|
17
|
+
exports.ThemeTintAlt = ThemeTintAlt;
|
|
18
|
+
//# sourceMappingURL=ThemeTint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeTint.js","sourceRoot":"","sources":["../../src/ThemeTint.tsx"],"names":[],"mappings":";;;;AAAA,uCAAsD;AAEtD,8CAAuC;AAEhC,MAAM,SAAS,GAAG,CAAC,EACxB,OAAO,EACP,QAAQ,EACR,GAAG,IAAI,EAC4B,EAAe,EAAE;IACpD,MAAM,OAAO,GAAG,IAAA,qBAAO,GAAE,CAAC,IAAI,CAAA;IAE9B,OAAO,CACL,uBAAC,WAAK,OAAK,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,YAC5C,QAAQ,GACH,CACT,CAAA;AACH,CAAC,CAAA;AAZY,QAAA,SAAS,GAAT,SAAS,CAYrB;AAEM,MAAM,YAAY,GAAG,CAAC,EAC3B,QAAQ,EACR,OAAO,EACP,MAAM,GAAG,CAAC,EACV,GAAG,IAAI,EAC6C,EAAe,EAAE;IACrE,MAAM,OAAO,GAAG,IAAA,qBAAO,EAAC,MAAM,CAAC,CAAC,OAAO,CAAA;IACvC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAA;IACrC,OAAO,CACL,uBAAC,WAAK,IAAC,IAAI,EAAE,IAAI,KAAM,IAAI,YACxB,QAAQ,GACH,CACT,CAAA;AACH,CAAC,CAAA;AAbY,QAAA,YAAY,GAAZ,YAAY,CAaxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./GuiLogo.js"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./LogoWords.js"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./LogoIcon.js"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./tints.js"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./useTint.js"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./ThemeTint.js"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./SeasonProvider.js"), exports);
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,yDAA+B;AAC/B,wDAA8B;AAC9B,qDAA2B;AAC3B,uDAA6B;AAC7B,yDAA+B;AAC/B,8DAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commonjs" }
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onTintFamilyChange = exports.setNextTintFamily = void 0;
|
|
4
|
+
exports.getTints = getTints;
|
|
5
|
+
exports.useTints = useTints;
|
|
6
|
+
exports.setTintFamily = setTintFamily;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
9
|
+
const listeners = new Set();
|
|
10
|
+
// A seasonal ramp of tint stops. These used to be one entry per letter of the
|
|
11
|
+
// old seven-letter wordmark, with index 3 reserved as the neutral notch; the
|
|
12
|
+
// wordmark is Hanzo now and every reader indexes by `tints.length`, so the
|
|
13
|
+
// length is just how many stops the ramp has.
|
|
14
|
+
const familiesValues = {
|
|
15
|
+
hanzogui: ['yellow', 'yellow', 'yellow', 'gray', 'red', 'green', 'blue'],
|
|
16
|
+
xmas: ['red', 'green', 'red', 'green', 'red', 'green', 'red'],
|
|
17
|
+
easter: [
|
|
18
|
+
'yellow',
|
|
19
|
+
'yellow',
|
|
20
|
+
'yellow',
|
|
21
|
+
'yellow',
|
|
22
|
+
'yellow',
|
|
23
|
+
'yellow',
|
|
24
|
+
'yellow',
|
|
25
|
+
],
|
|
26
|
+
halloween: [
|
|
27
|
+
'yellow',
|
|
28
|
+
'gray',
|
|
29
|
+
'yellow',
|
|
30
|
+
'gray',
|
|
31
|
+
'yellow',
|
|
32
|
+
'gray',
|
|
33
|
+
'yellow',
|
|
34
|
+
],
|
|
35
|
+
valentine: ['red', 'red', 'red', 'red', 'red', 'red', 'red'],
|
|
36
|
+
lunar: ['yellow', 'red', 'red', 'red', 'red', 'red', 'yellow'],
|
|
37
|
+
stpatricks: [
|
|
38
|
+
'green',
|
|
39
|
+
'yellow',
|
|
40
|
+
'green',
|
|
41
|
+
'yellow',
|
|
42
|
+
'green',
|
|
43
|
+
'yellow',
|
|
44
|
+
'green',
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
const DEFAULT_FAMILY = 'hanzogui';
|
|
48
|
+
const familiesNames = Object.keys(familiesValues);
|
|
49
|
+
const families = familiesValues;
|
|
50
|
+
let fam = DEFAULT_FAMILY;
|
|
51
|
+
function getTints() {
|
|
52
|
+
return {
|
|
53
|
+
name: fam || DEFAULT_FAMILY,
|
|
54
|
+
tints: families[fam] || families.hanzogui,
|
|
55
|
+
families,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function useTints() {
|
|
59
|
+
const [val, setVal] = react_1.default.useState(getTints());
|
|
60
|
+
react_1.default.useEffect(() => {
|
|
61
|
+
return (0, exports.onTintFamilyChange)(() => {
|
|
62
|
+
react_1.default.startTransition(() => {
|
|
63
|
+
setVal(getTints());
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}, []);
|
|
67
|
+
return val;
|
|
68
|
+
}
|
|
69
|
+
function setTintFamily(next) {
|
|
70
|
+
if (!families[next])
|
|
71
|
+
throw `impossible`;
|
|
72
|
+
fam = next;
|
|
73
|
+
// update DOM class for CSS-based styling (e.g., rainbow gradients)
|
|
74
|
+
if (typeof document !== 'undefined') {
|
|
75
|
+
const root = document.documentElement.classList;
|
|
76
|
+
// remove all season classes
|
|
77
|
+
familiesNames.forEach((s) => {
|
|
78
|
+
if (s !== 'hanzogui') {
|
|
79
|
+
root.remove(`${s}-season`);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// add the new one if not hanzogui
|
|
83
|
+
if (next !== 'hanzogui') {
|
|
84
|
+
root.add(`${next}-season`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
react_1.default.startTransition(() => {
|
|
88
|
+
listeners.forEach((l) => l(next));
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const setNextTintFamily = () => {
|
|
92
|
+
setTintFamily(familiesNames[(familiesNames.indexOf(fam) + 1) % familiesNames.length]);
|
|
93
|
+
};
|
|
94
|
+
exports.setNextTintFamily = setNextTintFamily;
|
|
95
|
+
const onTintFamilyChange = (cb) => {
|
|
96
|
+
listeners.add(cb);
|
|
97
|
+
return () => {
|
|
98
|
+
listeners.delete(cb);
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
exports.onTintFamilyChange = onTintFamilyChange;
|
|
102
|
+
//# sourceMappingURL=tints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tints.js","sourceRoot":"","sources":["../../src/tints.tsx"],"names":[],"mappings":";;;;;;;AAAA,0DAA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AAE;IAC1C,aAAa,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;AACvF,CAAC,CAAA;AAFY,QAAA,iBAAiB,GAAjB,iBAAiB,CAE7B;AAEM,MAAM,kBAAkB,GAAG,CAAC,EAAiB,EAAE,EAAE;IACtD,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACjB,OAAO,GAAS,EAAE;QAChB,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACtB,CAAC,CAAA;AACH,CAAC,CAAA;AALY,QAAA,kBAAkB,GAAlB,kBAAkB,CAK9B"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTint = exports.InitialPathContext = exports.getDisableTintTheme = exports.setDisableTintTheme = exports.setTintIndex = exports.onTintChange = void 0;
|
|
4
|
+
exports.getDocsSection = getDocsSection;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
const gui_1 = require("@hanzo/gui");
|
|
8
|
+
const tints_tsx_1 = require("./tints.js");
|
|
9
|
+
let current = 3;
|
|
10
|
+
let disableTintTheme = false;
|
|
11
|
+
const listeners = new Set();
|
|
12
|
+
const disableListeners = new Set();
|
|
13
|
+
const onTintChange = (listener) => {
|
|
14
|
+
listeners.add(listener);
|
|
15
|
+
return () => {
|
|
16
|
+
listeners.delete(listener);
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.onTintChange = onTintChange;
|
|
20
|
+
const numTints = (0, tints_tsx_1.getTints)().tints.length;
|
|
21
|
+
const setTintIndex = (next) => {
|
|
22
|
+
const val = Math.max(0, next % numTints);
|
|
23
|
+
if (val === current)
|
|
24
|
+
return;
|
|
25
|
+
current = val;
|
|
26
|
+
listeners.forEach((x) => x(val));
|
|
27
|
+
};
|
|
28
|
+
exports.setTintIndex = setTintIndex;
|
|
29
|
+
// when true, useTint returns null for tint/tintAlt so ThemeTint doesn't apply sub-themes
|
|
30
|
+
const setDisableTintTheme = (disable) => {
|
|
31
|
+
if (disable === disableTintTheme)
|
|
32
|
+
return;
|
|
33
|
+
disableTintTheme = disable;
|
|
34
|
+
disableListeners.forEach((x) => x(disable));
|
|
35
|
+
};
|
|
36
|
+
exports.setDisableTintTheme = setDisableTintTheme;
|
|
37
|
+
const getDisableTintTheme = () => disableTintTheme;
|
|
38
|
+
exports.getDisableTintTheme = getDisableTintTheme;
|
|
39
|
+
function getDocsSection(pathname) {
|
|
40
|
+
return pathname === '/docs/intro/compiler-install' ||
|
|
41
|
+
pathname === '/docs/intro/benchmarks' ||
|
|
42
|
+
pathname === '/docs/intro/why-a-compiler'
|
|
43
|
+
? 'compiler'
|
|
44
|
+
: pathname.startsWith('/ui/')
|
|
45
|
+
? 'ui'
|
|
46
|
+
: pathname.startsWith('/docs/')
|
|
47
|
+
? 'core'
|
|
48
|
+
: null;
|
|
49
|
+
}
|
|
50
|
+
exports.InitialPathContext = (0, react_1.createContext)(3);
|
|
51
|
+
const useTint = (altOffset = -1) => {
|
|
52
|
+
const initial = (0, react_1.useContext)(exports.InitialPathContext);
|
|
53
|
+
const didHydrate = (0, gui_1.useDidFinishSSR)();
|
|
54
|
+
const [index, setIndex] = (0, react_1.useState)(didHydrate ? current : initial);
|
|
55
|
+
const [disabled, setDisabled] = (0, react_1.useState)(disableTintTheme);
|
|
56
|
+
const tintsContext = (0, tints_tsx_1.useTints)();
|
|
57
|
+
const { tints } = tintsContext;
|
|
58
|
+
const tintAltIndex = Math.abs((index + altOffset) % tints.length);
|
|
59
|
+
(0, react_1.useEffect)(() => {
|
|
60
|
+
return (0, exports.onTintChange)((cur) => {
|
|
61
|
+
setIndex(cur);
|
|
62
|
+
});
|
|
63
|
+
}, []);
|
|
64
|
+
(0, react_1.useEffect)(() => {
|
|
65
|
+
const cb = (val) => setDisabled(val);
|
|
66
|
+
disableListeners.add(cb);
|
|
67
|
+
return () => {
|
|
68
|
+
disableListeners.delete(cb);
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
// return null for tint when disabled or at the "none" position (index 3)
|
|
72
|
+
const tint = disabled || index === 3 ? null : tints[index];
|
|
73
|
+
const tintAlt = disabled || tintAltIndex === 3 ? null : tints[tintAltIndex];
|
|
74
|
+
return {
|
|
75
|
+
...tintsContext,
|
|
76
|
+
tints: tintsContext.tints,
|
|
77
|
+
tintIndex: index,
|
|
78
|
+
tintAltIndex,
|
|
79
|
+
tint: tint,
|
|
80
|
+
tintAlt: tintAlt,
|
|
81
|
+
setTintIndex: exports.setTintIndex,
|
|
82
|
+
setNextTintFamily: tints_tsx_1.setNextTintFamily,
|
|
83
|
+
setDisableTintTheme: exports.setDisableTintTheme,
|
|
84
|
+
disableTintTheme: disabled,
|
|
85
|
+
setNextTint: () => {
|
|
86
|
+
react_1.default.startTransition(() => {
|
|
87
|
+
(0, exports.setTintIndex)(index + 1);
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
exports.useTint = useTint;
|
|
93
|
+
//# sourceMappingURL=useTint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTint.js","sourceRoot":"","sources":["../../src/useTint.tsx"],"names":[],"mappings":";;;;;AAAA,uDAA6E;AAC7E,oCAA4D;AAC5D,0CAAmE;AAEnE,IAAI,OAAO,GAAG,CAAC,CAAA;AACf,IAAI,gBAAgB,GAAG,KAAK,CAAA;AAE5B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAY,CAAA;AACrC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAY,CAAA;AAErC,MAAM,YAAY,GAAG,CAAC,QAA+B,EAAE,EAAE;IAC9D,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACvB,O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AC7B,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,yEAAyE;IACzE,MAAM,IAAI,GAAG,QAAQ,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC1D,MAAM,OAAO,GAAG,QAAQ,IAAI,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IAE3E,OAAO;QACL,GAAG,YAAY;QACf,KAAK,EAAE,YAAY,CAAC,KAAoB;QACxC,SAAS,EAAE,KAAK;QAChB,YAAY;QACZ,IAAI,EAAE,IAAiB;QACvB,OAAO,EAAE,OAAoB;QAC7B,YAAY,EAAZ,QAAA,YAAY;QACZ,iBAAiB,EAAjB,6BAAiB;QACjB,mBAAmB,EAAnB,QAAA,mBAAmB;QACnB,gBAAgB,EAAE,QAAQ;QAC1B,WAAW,EAAE,GAAG,EAAE;YAChB,eAAK,CAAC,eAAe,CAAC,GAAG,EAAE;gBACzB,IAAA,QAAA,YAAY,EAAC,KAAK,GAAG,CAAC,CAAC,CAAA;YACzB,CAAC,CAAC,CAAA;QACJ,CAAC;KACO,CAAA;AACZ,CAAC,CAAA;AAlEY,QAAA,OAAO,GAAP,OAAO,CAkEnB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { XStack, YStack } from '@hanzo/gui';
|
|
3
|
+
import { LogoIcon } from './LogoIcon.js';
|
|
4
|
+
import { LogoWords } from './LogoWords.js';
|
|
5
|
+
export const GuiLogo = ({ showWords, downscale, animated, color, ref, ...props }) => {
|
|
6
|
+
return (_jsxs(XStack, { render: "span", ref: ref, alignItems: "center", justifyContent: "center", gap: "$5", ...props, children: [_jsx(LogoIcon, { downscale: (downscale ?? 1) * (showWords ? 2 : 1.5), color: color }), showWords && (_jsx(YStack, { render: "span", marginBottom: -4, children: _jsx(LogoWords, { animated: animated, downscale: downscale ?? 2 }) }))] }));
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=GuiLogo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuiLogo.js","sourceRoot":"","sources":["../../src/GuiLogo.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAgB,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAA;AAU3C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EACtB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACE,EAAe,EAAE;IAC3B,OAAO,CACL,MAAC,MAAM,IACL,MAAM,EAAC,MAAM,EACb,GAAG,EAAE,GAAG,EACR,UAAU,EAAC,QAAQ,EACnB,cAAc,EAAC,QAAQ,EACvB,GAAG,EAAC,IAAI,KACJ,KAAK,aAET,KAAC,QAAQ,IAAC,SAAS,EAAE,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,GAAI,EAC9E,SAAS,IAAI,CACZ,KAAC,MAAM,IAAC,MAAM,EAAC,MAAM,EAAC,YAAY,EAAE,CAAC,CAAC,YACpC,KAAC,SAAS,IAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,IAAI,CAAC,GAAI,GACrD,CACV,IACM,CACV,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MARK_BLOCKS } from '@hanzo/logo/logos';
|
|
3
|
+
/**
|
|
4
|
+
* The Hanzo mark.
|
|
5
|
+
*
|
|
6
|
+
* This drew a duck — `<g id="duck">`, pixel art, `#ECD20A` — because the fork
|
|
7
|
+
* renamed the package and left the artwork. It was the mark in this site's
|
|
8
|
+
* header, footer, login, 404, every doc page and its favicon.
|
|
9
|
+
*
|
|
10
|
+
* The geometry comes from `@hanzo/logo`, never retyped: MARK_BLOCKS is the five
|
|
11
|
+
* body blocks of the block-H on its own 67 viewBox. `currentColor` by default so
|
|
12
|
+
* the mark themes with the text around it rather than pinning a brand hex.
|
|
13
|
+
*/
|
|
14
|
+
export const GuiIconSvg = ({ color = 'currentColor', ...props }) => (_jsx("svg", { viewBox: "0 0 67 67", width: "67px", height: "67px", ...props, children: MARK_BLOCKS.map((d) => (_jsx("path", { d: d, fill: color }, d))) }));
|
|
15
|
+
//# sourceMappingURL=GuiLogoSvg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuiLogoSvg.js","sourceRoot":"","sources":["../../src/GuiLogoSvg.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAM/C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,KAAK,GAAG,cAAc,EACtB,GAAG,KAAK,EACQ,EAAe,EAAE,CAAC,CAClC,cAAK,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,KAAK,KAAK,YAC1D,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACtB,eAAc,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,IAApB,CAAC,CAAuB,CACpC,CAAC,GACE,CACP,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { YStack } from '@hanzo/gui';
|
|
3
|
+
import { GuiIconSvg } from './GuiLogoSvg.js';
|
|
4
|
+
export const LogoIcon = ({ downscale = 2, color, }) => {
|
|
5
|
+
return (_jsx(YStack, { render: "span", className: "unselectable", alignSelf: "center", marginVertical: -10, pressStyle: {
|
|
6
|
+
opacity: 0.7,
|
|
7
|
+
scaleX: -1,
|
|
8
|
+
}, children: _jsx(GuiIconSvg, { className: "hanzogui-icon", width: 440 / 8 / downscale, height: 440 / 8 / downscale, color: color }) }));
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=LogoIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogoIcon.js","sourceRoot":"","sources":["../../src/LogoIcon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAA;AAG7C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,GAAG,CAAC,EACb,KAAK,GAIN,EAAe,EAAE;IAChB,OAAO,CACL,KAAC,MAAM,IACL,MAAM,EAAC,MAAM,EACb,SAAS,EAAC,cAAc,EACxB,SAAS,EAAC,QAAQ,EAClB,cAAc,EAAE,CAAC,EAAE,EACnB,UAAU,EAAE;YACV,OAAO,EAAE,GAAG;YACZ,MAAM,EAAE,CAAC,CAAC;SACX,YAED,KAAC,UAAU,IACT,SAAS,EAAC,eAAe,EACzB,KAAK,EAAE,GAAG,GAAG,CAAC,GAAG,SAAS,EAC1B,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,SAAS,EAC3B,KAAK,EAAE,KAAK,GACZ,GACK,CACV,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { Circle, XStack } from '@hanzo/gui';
|
|
4
|
+
import { WORDMARKS } from '@hanzo/logo/wordmarks';
|
|
5
|
+
import { useTint } from './useTint.js';
|
|
6
|
+
/**
|
|
7
|
+
* The wordmark.
|
|
8
|
+
*
|
|
9
|
+
* This drew T-A-M-A-G-U-I: seven pixel-art letter polygons on a 373x41 box,
|
|
10
|
+
* each tinted from a seven-colour table, with the hover strip split into seven
|
|
11
|
+
* sections and the dot stepped by a constant fitted to those letters. The fork
|
|
12
|
+
* renamed the package and kept the artwork, so the site's own name was another
|
|
13
|
+
* company's.
|
|
14
|
+
*
|
|
15
|
+
* It renders the outlined Hanzo wordmark from @hanzo/logo now — real paths cut
|
|
16
|
+
* from Zen, so it needs no font loaded and cannot drift from the wordmark every
|
|
17
|
+
* other Hanzo surface uses.
|
|
18
|
+
*
|
|
19
|
+
* The tint interaction stays, because it is a feature rather than a piece of
|
|
20
|
+
* the old wordmark — but it is no longer DIMENSIONED to seven letters. The
|
|
21
|
+
* strip divides by however many tints there are, and the dot rides the same
|
|
22
|
+
* fraction, so the two agree whatever that number becomes.
|
|
23
|
+
*/
|
|
24
|
+
const WORDMARK = WORDMARKS['Hanzo'];
|
|
25
|
+
const [WM_X, WM_Y, WM_W, WM_H] = WORDMARK.box;
|
|
26
|
+
export const LogoWords = React.memo(({ downscale = 1, animated, ...props }) => {
|
|
27
|
+
const Tint = useTint();
|
|
28
|
+
const [hovered, setHovered] = React.useState(false);
|
|
29
|
+
const [mounted, setMounted] = React.useState('start');
|
|
30
|
+
const { tintIndex: index } = Tint;
|
|
31
|
+
const sections = Tint.tints.length;
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const idle = window.requestIdleCallback || setTimeout;
|
|
34
|
+
idle(() => {
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
setMounted('animate');
|
|
37
|
+
}, 50);
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
setMounted('done');
|
|
40
|
+
}, 1500);
|
|
41
|
+
});
|
|
42
|
+
}, []);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const handleKeyDown = (event) => {
|
|
45
|
+
const i = Number.parseInt(event.key, 10) - 1; // Convert key to index (0-based)
|
|
46
|
+
if (!Number.isNaN(i) && i >= 0 && i < Tint.tints.length) {
|
|
47
|
+
Tint.setTintIndex(i);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
51
|
+
return () => {
|
|
52
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
53
|
+
};
|
|
54
|
+
}, [Tint]);
|
|
55
|
+
const [layout, setLayout] = useState();
|
|
56
|
+
// The mark is one ink; the tint shows through the dot rather than by
|
|
57
|
+
// recolouring letters, which is what the seven-colour table did.
|
|
58
|
+
const fill = hovered ? `var(--${Tint.tints[index]}9)` : 'var(--color12)';
|
|
59
|
+
const width = 373 * (1 / downscale) * 0.3333333;
|
|
60
|
+
const height = (width * WM_H) / WM_W;
|
|
61
|
+
// the dot sits over the section the current tint owns
|
|
62
|
+
const dotX = Math.round((width / sections) * (index + 0.5));
|
|
63
|
+
return (_jsxs(XStack, { onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), paddingVertical: "$2", "data-tauri-drag-region": true, marginVertical: "$-2", position: "relative", className: "logo-words", onLayout: (e) => {
|
|
64
|
+
setLayout(e.nativeEvent.layout);
|
|
65
|
+
},
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
onMouseMove: (e) => {
|
|
68
|
+
if (!layout)
|
|
69
|
+
return;
|
|
70
|
+
const x = e.clientX - layout.pageX;
|
|
71
|
+
const sectionWidth = layout.width / sections;
|
|
72
|
+
const section = Math.min(sections - 1, Math.max(0, Math.floor(x / sectionWidth)));
|
|
73
|
+
Tint.setTintIndex(section);
|
|
74
|
+
}, ...props, children: [animated && (_jsx(Circle, { transition: "medium", position: "absolute", top: 0, left: 0, y: mounted === 'start' ? -30 : -4, x: dotX, size: 4, backgroundColor: "$color12" })), _jsx("svg", { "data-tauri-drag-region": true, role: "img", "aria-label": "Hanzo", width: width, height: height, viewBox: `${WM_X} ${-WM_Y - WM_H} ${WM_W} ${WM_H}`, children: _jsx("g", { transform: "scale(1,-1)", children: _jsx("path", { d: WORDMARK.d, fill: fill }) }) })] }));
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=LogoWords.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogoWords.js","sourceRoot":"","sources":["../../src/LogoWords.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAe,CAAA;AAEvC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;AACnC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAA;AAE7C,MAAM,CAAC,MAAM,SAAS,GASlB,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACvD,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IACtB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACnD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAA+B,OAAO,CAAC,CAAA;IAEnF,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;IACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAA;IAElC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,MAAM,CAAC,mBAAmB,IAAI,UAAU,CAAA;QACr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AAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EACjC,CAAC,EAAE,IAAI,EACP,IAAI,EAAE,CAAC,EACP,eAAe,EAAC,UAAU,GAC1B,CACH,EAED,8CAEE,IAAI,EAAC,KAAK,gBACC,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,YAElD,YAAG,SAAS,EAAC,aAAa,YACxB,eAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,GAAI,GACjC,GACA,IACC,CACV,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { setTintFamily } from './tints.js';
|
|
4
|
+
// inline script that runs before hydration to set season class on html
|
|
5
|
+
// auto-detects season from current date
|
|
6
|
+
function getInlineScript() {
|
|
7
|
+
return `(function(){
|
|
8
|
+
var d = new Date();
|
|
9
|
+
var m = d.getMonth();
|
|
10
|
+
var day = d.getDate();
|
|
11
|
+
var season = 'hanzogui';
|
|
12
|
+
|
|
13
|
+
if (m === 11 && day >= 14) season = 'xmas';
|
|
14
|
+
else if (m === 9 && day >= 20) season = 'halloween';
|
|
15
|
+
else if (m === 2 && day >= 10 && day <= 17) season = 'stpatricks';
|
|
16
|
+
else if (m === 2 && day >= 30 || m === 3 && day <= 20) season = 'easter';
|
|
17
|
+
else if (m === 1 && day >= 7 && day <= 14) season = 'valentine';
|
|
18
|
+
else if (m === 0 && day >= 20 || m === 1 && day <= 12) season = 'lunar';
|
|
19
|
+
|
|
20
|
+
if (season !== 'hanzogui') {
|
|
21
|
+
document.documentElement.classList.add(season + '-season');
|
|
22
|
+
}
|
|
23
|
+
window.__GUI_SEASON__ = season;
|
|
24
|
+
})();`;
|
|
25
|
+
}
|
|
26
|
+
// syncs the tint family with the value computed by the inline script
|
|
27
|
+
function useSeasonSync() {
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const computed = window.__GUI_SEASON__;
|
|
30
|
+
if (computed) {
|
|
31
|
+
setTintFamily(computed);
|
|
32
|
+
}
|
|
33
|
+
}, []);
|
|
34
|
+
}
|
|
35
|
+
export function SeasonProvider({ children, }) {
|
|
36
|
+
useSeasonSync();
|
|
37
|
+
return (_jsx(_Fragment, { children: children }));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=SeasonProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeasonProvider.js","sourceRoot":"","sources":["../../src/SeasonProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,aAAa,EAAmB,MAAM,YAAa,CAAA;AAE5D,uEAAuE;AACvE,wCAAwC;AACxC,SAAS,eAAe;IACtB,OAAO;;;;;;;;;;;;;;;;;MAiBH,CAAA;AACN,CAAC;AAED,qEAAqE;AACrE,SAAS,aAAa;IACpB,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAI,MAAc,CAAC,cAAwC,CAAA;QACzE,IAAI,QAAQ,EAAE,CAAC;YACb,aAAa,CAAC,QAAQ,CAAC,CAAA;QACzB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,EAC7B,QAAQ,GAGT;IACC,aAAa,EAAE,CAAA;IAEf,OAAO,CACL,4BAQG,QAAQ,GACR,CACJ,CAAA;AACH,CAAC"}
|