audiogram-beta/src/twind.js

80 lines
2.4 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",
{
"background": "linear-gradient(159deg, rgb(236, 236, 236) 0%, rgb(233, 233, 233) 36%, rgb(213, 213, 213) 36.1%, rgb(236, 236, 236) 100%)"
}
],
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
],
[ 'box-notch', "border-t(1 [#ffffff]) border-b(1 [#00000033]) flex items-center justify-end gap-1 p-2" ],
[ "box-buttons", "flex gap-1 items-center p-2 rounded-lg bg-gradient-to-b from-zinc-300 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);
};