Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.2.1 #5

Merged
merged 9 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,25 @@ Below is an example of a simple Hwy page. You'll notice it looks a lot like Remi
```tsx
// src/pages/user/$user_id.page.tsx

import type { DataFunctionArgs, PageProps } from 'hwy'
import { UserProfile, getUser } from './somewhere.js'
import type { DataFunctionArgs, PageProps } from "hwy";
import { UserProfile, getUser } from "./somewhere.js";

export async function loader({ params }: DataFunctionArgs) {
return await getUser(params.user_id)
return await getUser(params.user_id);
}

export default async function ({ loaderData }: PageProps<typeof loader>) {
return <UserProfile user={loaderData} />
return <UserProfile user={loaderData} />;
}
```

Or, if you prefer to fetch inside your components:

```tsx
export default async function ({ params }: PageProps) {
const user = await getUser(params.user_id)
const user = await getUser(params.user_id);

return <UserProfile user={user} />
return <UserProfile user={user} />;
}
```

Expand Down
220 changes: 110 additions & 110 deletions docs/package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
"dev": "hwy-dev-serve"
},
"dependencies": {
"@hono/node-server": "^1.1.1",
"@hono/node-server": "^1.2.0",
"highlight.js": "^11.8.0",
"hono": "^3.6.3",
"hwy": "^0.1.3"
"hono": "^3.7.1",
"hwy": "^0.2.1"
},
"devDependencies": {
"@hwy-js/dev": "^0.1.3",
"@types/node": "^20.5.9",
"@hwy-js/dev": "^0.2.1",
"@types/node": "^20.6.3",
"@types/nprogress": "^0.2.0",
"cross-env": "^7.0.3",
"esbuild": "^0.19.2",
"htmx.org": "^1.9.5",
"esbuild": "^0.19.3",
"htmx.org": "^1.9.6",
"nodemon": "^3.0.1",
"nprogress": "^0.2.0",
"tailwindcss": "^3.3.3",
Expand Down
12 changes: 6 additions & 6 deletions docs/src/client.entry.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const __window = window as any
const __window = window as any;

import htmx from 'htmx.org'
__window.htmx = htmx
import htmx from "htmx.org";
__window.htmx = htmx;

import NProgress from 'nprogress'
__window.NProgress = NProgress
import NProgress from "nprogress";
__window.NProgress = NProgress;

// @ts-ignore
import('htmx.org/dist/ext/head-support.js')
import("htmx.org/dist/ext/head-support.js");
8 changes: 5 additions & 3 deletions docs/src/components/anchor-heading.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
function AnchorHeading({ content }: { content: string }) {
const slugified = encodeURIComponent(content.toLowerCase().replace(/ /g, '-'))
const slugified = encodeURIComponent(
content.toLowerCase().replace(/ /g, "-")
);

return (
<div class="flex gap-3 text-xl font-bold pt-4" id={slugified}>
Expand All @@ -11,7 +13,7 @@ function AnchorHeading({ content }: { content: string }) {
</a>
{content}
</div>
)
);
}

export { AnchorHeading }
export { AnchorHeading };
4 changes: 2 additions & 2 deletions docs/src/components/bold-italic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function Boldtalic({ children }: { children: string }) {
<b>
<i>{children}</i>
</b>
)
);
}

export { Boldtalic }
export { Boldtalic };
18 changes: 9 additions & 9 deletions docs/src/components/code-block.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import hljs from 'highlight.js/lib/core'
import typescript from 'highlight.js/lib/languages/typescript'
import bash from 'highlight.js/lib/languages/bash'
import json from 'highlight.js/lib/languages/json'
import hljs from "highlight.js/lib/core";
import typescript from "highlight.js/lib/languages/typescript";
import bash from "highlight.js/lib/languages/bash";
import json from "highlight.js/lib/languages/json";

const lang_map = { typescript, bash, json }
type Language = keyof typeof lang_map
const lang_map = { typescript, bash, json };
type Language = keyof typeof lang_map;

function CodeBlock({ language, code }: { language: Language; code: string }) {
hljs.registerLanguage(language, lang_map[language])
hljs.registerLanguage(language, lang_map[language]);

return (
<pre class="overflow-x-auto rounded-2xl bg-slate-800 border-4 border-solid border-[#7777] py-4 px-5 max-w-full flex gap-5 text-white">
Expand All @@ -19,7 +19,7 @@ function CodeBlock({ language, code }: { language: Language; code: string }) {
/>
<div />
</pre>
)
);
}

export { CodeBlock }
export { CodeBlock };
18 changes: 9 additions & 9 deletions docs/src/components/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ChildrenPermissive } from '../types.js'
import { ChildrenPermissive } from "../types.js";

function DialogModal({
open_button_inner,
dialog_inner,
wrapper_class,
open_button_class,
}: {
open_button_inner: ChildrenPermissive
dialog_inner: ChildrenPermissive
wrapper_class?: string
open_button_class?: string
open_button_inner: ChildrenPermissive;
dialog_inner: ChildrenPermissive;
wrapper_class?: string;
open_button_class?: string;
}) {
return (
<div hx-boost="false" class={wrapper_class}>
Expand All @@ -24,14 +24,14 @@ function DialogModal({
onclick="event.target==this && this.close()"
style={{
padding: 0,
border: 'none',
background: 'transparent',
border: "none",
background: "transparent",
}}
>
<form method="dialog">{dialog_inner}</form>
</dialog>
</div>
)
);
}

export { DialogModal }
export { DialogModal };
8 changes: 4 additions & 4 deletions docs/src/components/fallback-error-boundary.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ErrorBoundaryProps } from 'hwy'
import { Paragraph } from './paragraph.js'
import type { ErrorBoundaryProps } from "hwy";
import { Paragraph } from "./paragraph.js";

function FallbackErrorBoundary(props: ErrorBoundaryProps) {
return (
Expand All @@ -10,7 +10,7 @@ function FallbackErrorBoundary(props: ErrorBoundaryProps) {
happened.
</Paragraph>
</div>
)
);
}

export { FallbackErrorBoundary }
export { FallbackErrorBoundary };
18 changes: 9 additions & 9 deletions docs/src/components/inline-code.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { cx } from '../utils/utils.js'
import { cx } from "../utils/utils.js";

function InlineCode({
children,
high_contrast,
...rest
}: {
children: string
high_contrast?: boolean
} & JSX.IntrinsicElements['code']) {
children: string;
high_contrast?: boolean;
} & JSX.IntrinsicElements["code"]) {
return (
<code
{...rest}
class={cx(
'py-[2px] px-1 whitespace-nowrap',
"py-[2px] px-1 whitespace-nowrap",
high_contrast
? 'bg-black text-white dark:bg-white dark:text-black'
: 'bg-[#7772] dark:bg-[#7773] rounded',
? "bg-black text-white dark:bg-white dark:text-black"
: "bg-[#7772] dark:bg-[#7773] rounded",
rest.class
)}
>
{children}
</code>
)
);
}

export { InlineCode }
export { InlineCode };
4 changes: 2 additions & 2 deletions docs/src/components/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Nav() {
</a>
</div>
</nav>
)
);
}

export { Nav }
export { Nav };
12 changes: 6 additions & 6 deletions docs/src/components/paragraph.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ChildrenPermissive } from '../types.js'
import { cx } from '../utils/utils.js'
import { ChildrenPermissive } from "../types.js";
import { cx } from "../utils/utils.js";

function Paragraph({
children,
...rest
}: { children: ChildrenPermissive } & JSX.IntrinsicElements['p']) {
}: { children: ChildrenPermissive } & JSX.IntrinsicElements["p"]) {
return (
<p {...rest} class={cx('leading-7', rest.class)}>
<p {...rest} class={cx("leading-7", rest.class)}>
{children}
</p>
)
);
}

export { Paragraph }
export { Paragraph };
18 changes: 9 additions & 9 deletions docs/src/components/unordered-list.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { ChildrenPermissive } from '../types.js'
import { cx } from '../utils/utils.js'
import { ChildrenPermissive } from "../types.js";
import { cx } from "../utils/utils.js";

function UnorderedList({
children,
...rest
}: { children: ChildrenPermissive } & JSX.IntrinsicElements['ul']) {
}: { children: ChildrenPermissive } & JSX.IntrinsicElements["ul"]) {
return (
<ul {...rest} class={cx('space-y-6', rest.class)}>
<ul {...rest} class={cx("space-y-6", rest.class)}>
{children}
</ul>
)
);
}

function ListItem({
children,
...rest
}: { children: ChildrenPermissive } & JSX.IntrinsicElements['li']) {
}: { children: ChildrenPermissive } & JSX.IntrinsicElements["li"]) {
return (
<li {...rest} class={cx('list-disc ml-6 pl-1 leading-7', rest.class)}>
<li {...rest} class={cx("list-disc ml-6 pl-1 leading-7", rest.class)}>
{children}
</li>
)
);
}

export { UnorderedList, ListItem }
export { UnorderedList, ListItem };
Loading