feat: Enable tailwind theme variables in twindv1 Options (#1776)
This commit is contained in:
@@ -1,11 +1,18 @@
|
|||||||
import { JSX, options as preactOptions, VNode } from "preact";
|
import { JSX, options as preactOptions, VNode } from "preact";
|
||||||
import { setup as twSetup, Sheet, tw, TwindConfig } from "../twindv1_deps.ts";
|
import {
|
||||||
|
BaseTheme,
|
||||||
|
setup as twSetup,
|
||||||
|
Sheet,
|
||||||
|
tw,
|
||||||
|
TwindConfig,
|
||||||
|
} from "$fresh/plugins/twindv1_deps.ts";
|
||||||
|
|
||||||
type PreactOptions = typeof preactOptions & { __b?: (vnode: VNode) => void };
|
type PreactOptions = typeof preactOptions & { __b?: (vnode: VNode) => void };
|
||||||
|
|
||||||
export const STYLE_ELEMENT_ID = "__FRSH_TWIND";
|
export const STYLE_ELEMENT_ID = "__FRSH_TWIND";
|
||||||
|
|
||||||
export interface Options extends TwindConfig {
|
export interface Options<Theme extends BaseTheme = BaseTheme>
|
||||||
|
extends TwindConfig<Theme> {
|
||||||
/** The import.meta.url of the module defining these options. */
|
/** The import.meta.url of the module defining these options. */
|
||||||
selfURL: string;
|
selfURL: string;
|
||||||
}
|
}
|
||||||
@@ -19,7 +26,10 @@ declare module "preact" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setup({ selfURL: _selfURL, ...config }: Options, sheet: Sheet) {
|
export function setup<Theme extends BaseTheme = BaseTheme>(
|
||||||
|
{ selfURL: _selfURL, ...config }: Options<Theme>,
|
||||||
|
sheet: Sheet,
|
||||||
|
) {
|
||||||
twSetup(config, sheet);
|
twSetup(config, sheet);
|
||||||
|
|
||||||
// Hook into options._diff which is called whenever a new comparison
|
// Hook into options._diff which is called whenever a new comparison
|
||||||
|
|||||||
Reference in New Issue
Block a user