audiogram-beta/src/twind.js

86 lines
2.6 KiB
JavaScript
Raw Normal View History

2022-12-10 10:27:23 -05:00
import * as TW from "@twind/core@1.0.1";
import TWPreTail from "@twind/preset-tailwind@1.0.1";
import TWPreAuto from "@twind/preset-autoprefix@1.0.1";
2022-12-04 16:19:22 -05:00
/** @type {TW.TwindConfig} */
export const Configure = {
theme:
{
extend:
{
2022-12-10 11:57:45 -05:00
// @ts-ignore: typings for keyframes are missing in twind
2022-12-04 16:19:22 -05:00
keyframes:
{
flash:
{
'0%': { opacity: 1.0 },
'50%': { opacity: 0.3 },
'100%': { opacity: 0.0 }
},
pulse:
{
"0%": { opacity: 0.0 },
"10%": { opacity: 0.0 },
"12%": { opacity: 1.0 },
"22%": { opacity: 1.0 },
"42%": { opacity: 0.2 },
"100%": { opacity: 0.0 }
}
},
animation:
{
2022-12-10 23:36:48 -05:00
flash: "flash 1s both",
pulse: "pulse 3s ease-in-out 0s 1 both"
2022-12-04 16:19:22 -05:00
},
strokeWidth:
{
2022-12-06 23:37:39 -05:00
"bold": "4px"
2022-12-04 16:19:22 -05:00
}
}
},
rules:
[
[
"stroke-draw",
{
"vector-effect": "non-scaling-stroke",
"stroke-linecap": "square",
"fill": "none"
},
],
2022-12-11 22:57:07 -05:00
[
"bg-metal",
{
2022-12-12 08:36:56 -05:00
"background": "linear-gradient(159deg, rgb(228, 228, 228) 0%, rgb(243, 243, 243) 25%, rgb(236, 236, 236) 100%)"
2022-12-12 15:57:49 -05:00
},
],
[
"bg-earmark", "bg-gradient-to-b from-[#107c79] to-[#115e67]"
2022-12-11 22:57:07 -05:00
],
2022-12-04 16:19:22 -05:00
[
'shadow-glow-(.*)',
(match, context)=>
{
return { "box-shadow": `0px 0px 5px 2px ${context.theme().colors[match[1]]}` };
}
],
[
'shadow-sss',
{
2022-12-11 22:57:07 -05:00
"box-shadow": "rgb(0 0 0 / 50%) 0px -2px 3px inset, rgb(255 255 255 / 50%) 0px 10px 10px inset"
2022-12-04 16:19:22 -05:00
}
2022-12-11 22:57:07 -05:00
],
2022-12-12 08:26:56 -05:00
[
2022-12-12 08:36:56 -05:00
'text-shadow-lcd', {"text-shadow": "0px 2px 2px #00000055"}
2022-12-12 08:26:56 -05:00
],
2022-12-12 15:57:49 -05:00
[ 'box-notch', "border-t(1 [#ffffff]) border-r(1 [#ffffff]) border-b(1 [#00000033]) border-l(1 [#00000033]) flex items-center justify-end gap-1 p-2" ],
2022-12-11 23:33:22 -05:00
[ "box-buttons", "flex gap-1 items-center p-2 rounded-lg bg-gradient-to-b from-[#00000022] border-b(1 [#ffffff]) border-t(1 [#00000033])"]
2022-12-04 16:19:22 -05:00
],
presets: [TWPreTail(), TWPreAuto()]
};
/** @type {(elStyle:HTMLStyleElement, elDiv:HTMLDivElement)=>void} */
export const Init =(elStyle, elDiv)=>
{
TW.observe(TW.twind(Configure, TW.cssom(elStyle)), elDiv);
};