π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
export function withPropertyFallbacks(css: string): string {
const defaults = [...css.matchAll(/@property\s+(--[\w-]+)\s*\{([^}]*)\}/g)].flatMap(([, name, body]) => {
const value = /initial-value:\s*([^;]+)/.exec(body ?? '')?.[1]?.trim();
return value === undefined ? [] : [`${name}: ${value}`];
});
if (defaults.length === 0) return css;
return `${css}\n@layer properties {\n :host, *, ::before, ::after, ::backdrop { ${defaults.join('; ')}; }\n}\n`;
}