chore: update twind import map defaults in init.ts (#291)
This commit is contained in:
Vendored
+4
-2
@@ -2,8 +2,10 @@
|
|||||||
".": "THIS FILE EXISTS ONLY FOR VSCODE! IT IS NOT USED AT RUNTIME.",
|
".": "THIS FILE EXISTS ONLY FOR VSCODE! IT IS NOT USED AT RUNTIME.",
|
||||||
"imports": {
|
"imports": {
|
||||||
"$fresh/": "../",
|
"$fresh/": "../",
|
||||||
"$twind": "https://esm.sh/twind@0.16.16",
|
|
||||||
"$twind/": "https://esm.sh/twind@0.16.16/",
|
"@twind": "../www/utils/twind.ts",
|
||||||
|
"twind": "https://esm.sh/twind@0.16.16",
|
||||||
|
"twind/": "https://esm.sh/twind@0.16.16/",
|
||||||
|
|
||||||
"preact": "https://esm.sh/preact@10.8.1",
|
"preact": "https://esm.sh/preact@10.8.1",
|
||||||
"preact/": "https://esm.sh/preact@10.8.1/",
|
"preact/": "https://esm.sh/preact@10.8.1/",
|
||||||
|
|||||||
@@ -91,16 +91,16 @@ const importMap = {
|
|||||||
} as Record<string, string>,
|
} as Record<string, string>,
|
||||||
};
|
};
|
||||||
if (useTwind) {
|
if (useTwind) {
|
||||||
importMap.imports["$twind"] = "https://esm.sh/twind@0.16.17";
|
importMap.imports["@twind"] = "./utils/twind.ts";
|
||||||
importMap.imports["$twind/"] = "https://esm.sh/twind@0.16.17/";
|
importMap.imports["twind"] = "https://esm.sh/twind@0.16.17";
|
||||||
importMap.imports["twind"] = "./utils/twind.ts";
|
importMap.imports["twind/"] = "https://esm.sh/twind@0.16.17/";
|
||||||
}
|
}
|
||||||
const IMPORT_MAP_JSON = JSON.stringify(importMap, null, 2) + "\n";
|
const IMPORT_MAP_JSON = JSON.stringify(importMap, null, 2) + "\n";
|
||||||
await Deno.writeTextFile(join(directory, "import_map.json"), IMPORT_MAP_JSON);
|
await Deno.writeTextFile(join(directory, "import_map.json"), IMPORT_MAP_JSON);
|
||||||
|
|
||||||
let ROUTES_INDEX_TSX = `/** @jsx h */
|
let ROUTES_INDEX_TSX = `/** @jsx h */
|
||||||
import { h } from "preact";\n`;
|
import { h } from "preact";\n`;
|
||||||
if (useTwind) ROUTES_INDEX_TSX += `import { tw } from "twind";\n`;
|
if (useTwind) ROUTES_INDEX_TSX += `import { tw } from "@twind";\n`;
|
||||||
ROUTES_INDEX_TSX += `import Counter from "../islands/Counter.tsx";
|
ROUTES_INDEX_TSX += `import Counter from "../islands/Counter.tsx";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
@@ -129,7 +129,7 @@ let ISLANDS_COUNTER_TSX = `/** @jsx h */
|
|||||||
import { h } from "preact";
|
import { h } from "preact";
|
||||||
import { useState } from "preact/hooks";
|
import { useState } from "preact/hooks";
|
||||||
import { IS_BROWSER } from "$fresh/runtime.ts";
|
import { IS_BROWSER } from "$fresh/runtime.ts";
|
||||||
${useTwind ? 'import { tw } from "twind";\n' : ""}
|
${useTwind ? 'import { tw } from "@twind";\n' : ""}
|
||||||
interface CounterProps {
|
interface CounterProps {
|
||||||
start: number;
|
start: number;
|
||||||
}
|
}
|
||||||
@@ -222,8 +222,8 @@ await Deno.writeTextFile(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const UTILS_TWIND_TS = `import { IS_BROWSER } from "$fresh/runtime.ts";
|
const UTILS_TWIND_TS = `import { IS_BROWSER } from "$fresh/runtime.ts";
|
||||||
import { Configuration, setup } from "$twind";
|
import { Configuration, setup } from "twind";
|
||||||
export * from "$twind";
|
export * from "twind";
|
||||||
export const config: Configuration = {
|
export const config: Configuration = {
|
||||||
darkMode: "class",
|
darkMode: "class",
|
||||||
mode: "silent",
|
mode: "silent",
|
||||||
@@ -275,8 +275,8 @@ import manifest from "./fresh.gen.ts";
|
|||||||
|
|
||||||
if (useTwind) {
|
if (useTwind) {
|
||||||
MAIN_TS += `
|
MAIN_TS += `
|
||||||
import { virtualSheet } from "$twind/sheets";
|
import { config, setup } from "@twind";
|
||||||
import { config, setup } from "twind";
|
import { virtualSheet } from "twind/sheets";
|
||||||
|
|
||||||
const sheet = virtualSheet();
|
const sheet = virtualSheet();
|
||||||
sheet.reset();
|
sheet.reset();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** @jsx h */
|
/** @jsx h */
|
||||||
import { h } from "preact";
|
import { h } from "preact";
|
||||||
import { tw } from "../utils/twind.ts";
|
import { tw } from "@twind";
|
||||||
|
|
||||||
export function RoundedButton(props: h.JSX.HTMLAttributes<HTMLButtonElement>) {
|
export function RoundedButton(props: h.JSX.HTMLAttributes<HTMLButtonElement>) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** @jsx h */
|
/** @jsx h */
|
||||||
import { h } from "preact";
|
import { h } from "preact";
|
||||||
import { apply, tw } from "../utils/twind.ts";
|
import { apply, tw } from "@twind";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CATEGORIES,
|
CATEGORIES,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** @jsx h */
|
/** @jsx h */
|
||||||
import { h } from "preact";
|
import { h } from "preact";
|
||||||
import { tw } from "../utils/twind.ts";
|
import { tw } from "@twind";
|
||||||
|
|
||||||
const LINKS = [
|
const LINKS = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** @jsx h */
|
/** @jsx h */
|
||||||
import { h } from "preact";
|
import { h } from "preact";
|
||||||
import { tw } from "../utils/twind.ts";
|
import { tw } from "@twind";
|
||||||
|
|
||||||
export function IconMinus() {
|
export function IconMinus() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** @jsx h */
|
/** @jsx h */
|
||||||
import { h } from "preact";
|
import { h } from "preact";
|
||||||
import { tw } from "../utils/twind.ts";
|
import { tw } from "@twind";
|
||||||
|
|
||||||
export default function NavigationBar(props: { active: string }) {
|
export default function NavigationBar(props: { active: string }) {
|
||||||
const items = [
|
const items = [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** @jsx h */
|
/** @jsx h */
|
||||||
import { h } from "preact";
|
import { h } from "preact";
|
||||||
import { tw } from "../utils/twind.ts";
|
import { tw } from "@twind";
|
||||||
|
|
||||||
export default function WarningBanner() {
|
export default function WarningBanner() {
|
||||||
const warning = tw`bg-yellow-100 border(1 yellow-200) p-4 mb-4`;
|
const warning = tw`bg-yellow-100 border(1 yellow-200) p-4 mb-4`;
|
||||||
|
|||||||
+6
-2
@@ -1,11 +1,15 @@
|
|||||||
{
|
{
|
||||||
"imports": {
|
"imports": {
|
||||||
"$fresh/": "../",
|
"$fresh/": "../",
|
||||||
"$twind": "https://esm.sh/twind@0.16.16",
|
|
||||||
"$twind/": "https://esm.sh/twind@0.16.16/",
|
"@twind": "./utils/twind.ts",
|
||||||
|
"twind": "https://esm.sh/twind@0.16.16",
|
||||||
|
"twind/": "https://esm.sh/twind@0.16.16/",
|
||||||
|
|
||||||
"preact": "https://esm.sh/preact@10.8.1",
|
"preact": "https://esm.sh/preact@10.8.1",
|
||||||
"preact/": "https://esm.sh/preact@10.8.1/",
|
"preact/": "https://esm.sh/preact@10.8.1/",
|
||||||
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.0?deps=preact@10.8.1",
|
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.0?deps=preact@10.8.1",
|
||||||
|
|
||||||
"$semver/": "https://deno.land/x/semver@v1.4.0/"
|
"$semver/": "https://deno.land/x/semver@v1.4.0/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { h } from "preact";
|
import { h } from "preact";
|
||||||
import { useState } from "preact/hooks";
|
import { useState } from "preact/hooks";
|
||||||
import { IS_BROWSER } from "$fresh/runtime.ts";
|
import { IS_BROWSER } from "$fresh/runtime.ts";
|
||||||
import { tw } from "../utils/twind.ts";
|
import { tw } from "@twind";
|
||||||
import { RoundedButton } from "../components/Button.tsx";
|
import { RoundedButton } from "../components/Button.tsx";
|
||||||
import { IconMinus, IconPlus } from "../components/Icons.tsx";
|
import { IconMinus, IconPlus } from "../components/Icons.tsx";
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/** @jsxFrag Fragment */
|
/** @jsxFrag Fragment */
|
||||||
import { Fragment, h } from "preact";
|
import { Fragment, h } from "preact";
|
||||||
import { useEffect, useRef, useState } from "preact/hooks";
|
import { useEffect, useRef, useState } from "preact/hooks";
|
||||||
import { tw } from "../utils/twind.ts";
|
import { tw } from "@twind";
|
||||||
import { Spring, WaveTank } from "../components/WaveTank.ts";
|
import { Spring, WaveTank } from "../components/WaveTank.ts";
|
||||||
|
|
||||||
function easeInCirc(x: number) {
|
function easeInCirc(x: number) {
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
/// <reference lib="deno.unstable" />
|
/// <reference lib="deno.unstable" />
|
||||||
|
|
||||||
import { start } from "$fresh/server.ts";
|
import { start } from "$fresh/server.ts";
|
||||||
import { virtualSheet } from "$twind/sheets";
|
import { virtualSheet } from "twind/sheets";
|
||||||
import { setup, theme } from "./utils/twind.ts";
|
import { setup, theme } from "@twind";
|
||||||
|
|
||||||
import routes from "./fresh.gen.ts";
|
import routes from "./fresh.gen.ts";
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { Fragment, h } from "preact";
|
import { Fragment, h } from "preact";
|
||||||
import { Head } from "$fresh/runtime.ts";
|
import { Head } from "$fresh/runtime.ts";
|
||||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||||
import { apply, tw } from "../../utils/twind.ts";
|
import { apply, tw } from "@twind";
|
||||||
import { frontMatter, gfm } from "../../utils/markdown.ts";
|
import { frontMatter, gfm } from "../../utils/markdown.ts";
|
||||||
|
|
||||||
import DocsSidebar from "../../components/DocsSidebar.tsx";
|
import DocsSidebar from "../../components/DocsSidebar.tsx";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { ComponentChildren, Fragment, h } from "preact";
|
import { ComponentChildren, Fragment, h } from "preact";
|
||||||
import { asset, Head } from "$fresh/runtime.ts";
|
import { asset, Head } from "$fresh/runtime.ts";
|
||||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||||
import { tw } from "../utils/twind.ts";
|
import { tw } from "@twind";
|
||||||
import Counter from "../islands/Counter.tsx";
|
import Counter from "../islands/Counter.tsx";
|
||||||
import LemonDrop from "../islands/LemonDrop.tsx";
|
import LemonDrop from "../islands/LemonDrop.tsx";
|
||||||
import Footer from "../components/Footer.tsx";
|
import Footer from "../components/Footer.tsx";
|
||||||
|
|||||||
+6
-3
@@ -1,7 +1,9 @@
|
|||||||
|
export * from "twind";
|
||||||
|
|
||||||
import { IS_BROWSER } from "$fresh/runtime.ts";
|
import { IS_BROWSER } from "$fresh/runtime.ts";
|
||||||
import { apply, setup, tw } from "$twind";
|
import * as colors from "twind/colors";
|
||||||
import * as colors from "$twind/colors";
|
import { setup } from "twind";
|
||||||
export { apply, setup, tw };
|
|
||||||
export const theme = {
|
export const theme = {
|
||||||
colors: {
|
colors: {
|
||||||
blue: colors.blue,
|
blue: colors.blue,
|
||||||
@@ -13,6 +15,7 @@ export const theme = {
|
|||||||
transparent: "transparent",
|
transparent: "transparent",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (IS_BROWSER) {
|
if (IS_BROWSER) {
|
||||||
setup({ theme: { colors } });
|
setup({ theme: { colors } });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user