Skip to content

Commit 4f99e8f

Browse files
committed
style: prettier
1 parent 876c466 commit 4f99e8f

54 files changed

Lines changed: 1448 additions & 477 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"js/ts.tsdk.path": "node_modules\\typescript\\lib"
3+
}

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,22 @@ const react = await m.import("react");
6262
const app = await m.import("./app.tsx");
6363

6464
// Import from an in-memory string
65-
const { x } = await m.importCode(document.location.href, `export const x: number = 1`);
65+
const { x } = await m.importCode(
66+
document.location.href,
67+
`export const x: number = 1`,
68+
);
6669

6770
// Events
6871
m.addEventListener("import", (e) => console.log("loading", e.detail.id));
69-
m.addEventListener("import:error", (e) => console.error("failed", e.detail.id, e.detail.error));
70-
m.addEventListener("transform", (e) => console.log("compiling", e.detail.sourceUrl));
71-
m.addEventListener("transform:error", (e) => console.error("compile error", e.detail.sourceUrl, e.detail.error));
72+
m.addEventListener("import:error", (e) =>
73+
console.error("failed", e.detail.id, e.detail.error),
74+
);
75+
m.addEventListener("transform", (e) =>
76+
console.log("compiling", e.detail.sourceUrl),
77+
);
78+
m.addEventListener("transform:error", (e) =>
79+
console.error("compile error", e.detail.sourceUrl, e.detail.error),
80+
);
7281
```
7382

7483
## Use with AI
@@ -88,7 +97,10 @@ npx skills add yieldray/module-tsx
8897
<script type="module" src="https://esm.sh/module-tsx"></script>
8998

9099
<!-- ESM (self-contained, no external dependencies) -->
91-
<script type="module" src="https://raw.esm.sh/module-tsx/dist/index.mjs"></script>
100+
<script
101+
type="module"
102+
src="https://raw.esm.sh/module-tsx/dist/index.mjs"
103+
></script>
92104

93105
<!-- UMD (exposes window.ModuleTSX) -->
94106
<script src="https://raw.esm.sh/module-tsx/dist/index.umd.js"></script>

docs/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
},
1212
"dependencies": {
1313
"@mdi/js": "^7.4.47",
14-
"react": "^19.2.4",
15-
"react-dom": "^19.2.4",
14+
"react": "^19.2.6",
15+
"react-dom": "^19.2.6",
1616
"soda-material": "^0.0.36"
1717
},
1818
"devDependencies": {
19-
"@types/node": "^24.12.0",
19+
"@types/node": "^24.12.3",
2020
"@types/react": "^19.2.14",
2121
"@types/react-dom": "^19.2.3",
2222
"@vitejs/plugin-react": "^6.0.1",
2323
"typescript": "~5.9.3",
24-
"vite": "^8.0.0"
24+
"vite": "^8.0.11"
2525
}
2626
}

docs/src/App.tsx

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,58 @@ export const NAV_SECTIONS: NavSection[] = [
3333
{
3434
title: "Introduction",
3535
items: [
36-
{ label: "Getting Started", hash: "#getting-started", icon: mdiRocketLaunch, component: GettingStarted },
37-
{ label: "Basic Usage", hash: "#basic-usage", icon: mdiFlash, component: BasicUsage },
36+
{
37+
label: "Getting Started",
38+
hash: "#getting-started",
39+
icon: mdiRocketLaunch,
40+
component: GettingStarted,
41+
},
42+
{
43+
label: "Basic Usage",
44+
hash: "#basic-usage",
45+
icon: mdiFlash,
46+
component: BasicUsage,
47+
},
3848
],
3949
},
4050
{
4151
title: "Features",
4252
items: [
43-
{ label: "TypeScript Support", hash: "#typescript", icon: mdiLanguageTypescript, component: TypeScriptSupport },
44-
{ label: "Loading Files", hash: "#loading-files", icon: mdiFileCode, component: LoadingFiles },
45-
{ label: "CSS & CSS Modules", hash: "#css-modules", icon: mdiPalette, component: CssModules },
53+
{
54+
label: "TypeScript Support",
55+
hash: "#typescript",
56+
icon: mdiLanguageTypescript,
57+
component: TypeScriptSupport,
58+
},
59+
{
60+
label: "Loading Files",
61+
hash: "#loading-files",
62+
icon: mdiFileCode,
63+
component: LoadingFiles,
64+
},
65+
{
66+
label: "CSS & CSS Modules",
67+
hash: "#css-modules",
68+
icon: mdiPalette,
69+
component: CssModules,
70+
},
4671
],
4772
},
4873
{
4974
title: "Reference",
5075
items: [
51-
{ label: "API Reference", hash: "#api-reference", icon: mdiApi, component: ApiReference },
52-
{ label: "Examples", hash: "#examples", icon: mdiPlayCircleOutline, component: Examples },
76+
{
77+
label: "API Reference",
78+
hash: "#api-reference",
79+
icon: mdiApi,
80+
component: ApiReference,
81+
},
82+
{
83+
label: "Examples",
84+
hash: "#examples",
85+
icon: mdiPlayCircleOutline,
86+
component: Examples,
87+
},
5388
],
5489
},
5590
];
@@ -68,11 +103,16 @@ export default function App() {
68103
}, []);
69104

70105
const allItems = NAV_SECTIONS.flatMap((s) => s.items);
71-
const activeItem = allItems.find((i) => i.hash === currentHash) ?? allItems[0];
106+
const activeItem =
107+
allItems.find((i) => i.hash === currentHash) ?? allItems[0];
72108
const PageComponent = activeItem.component;
73109

74110
return (
75-
<Layout navSections={NAV_SECTIONS} currentHash={currentHash} onNavigate={setCurrentHash}>
111+
<Layout
112+
navSections={NAV_SECTIONS}
113+
currentHash={currentHash}
114+
onNavigate={setCurrentHash}
115+
>
76116
<PageComponent />
77117
</Layout>
78118
);

docs/src/components/CodeBlock.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,21 @@ interface CodeBlockProps {
2222
filename?: string;
2323
}
2424

25-
export default function CodeBlock({ code, language = "tsx", filename }: CodeBlockProps) {
25+
export default function CodeBlock({
26+
code,
27+
language = "tsx",
28+
filename,
29+
}: CodeBlockProps) {
2630
const codeRef = useRef<HTMLElement>(null);
2731
const [copied, setCopied] = useState(false);
2832

2933
useEffect(() => {
3034
const el = codeRef.current;
3135
if (!el) return;
3236
el.textContent = code;
33-
highlightElement(el, LANG_MAP[language] ?? language, "multiline", { hideLineNumbers: true });
37+
highlightElement(el, LANG_MAP[language] ?? language, "multiline", {
38+
hideLineNumbers: true,
39+
});
3440
}, [code, language]);
3541

3642
const handleCopy = () => {
@@ -48,9 +54,17 @@ export default function CodeBlock({ code, language = "tsx", filename }: CodeBloc
4854
</div>
4955
)}
5056
<div className={`absolute ${filename ? "top-7" : "top-1"} right-1 z-10`}>
51-
<IconButton path={copied ? mdiCheck : mdiContentCopy} size={0.8} onClick={handleCopy} />
57+
<IconButton
58+
path={copied ? mdiCheck : mdiContentCopy}
59+
size={0.8}
60+
onClick={handleCopy}
61+
/>
5262
</div>
53-
<code ref={codeRef} className="block overflow-x-auto" style={{ scrollbarWidth: "thin" }} />
63+
<code
64+
ref={codeRef}
65+
className="block overflow-x-auto"
66+
style={{ scrollbarWidth: "thin" }}
67+
/>
5468
</div>
5569
);
5670
}

docs/src/components/Demo.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import React, { Component, type ReactNode } from "react";
22

3-
class ErrorBoundary extends Component<{ children: ReactNode }, { error: Error | null }> {
3+
class ErrorBoundary extends Component<
4+
{ children: ReactNode },
5+
{ error: Error | null }
6+
> {
47
state = { error: null };
58
static getDerivedStateFromError(error: Error) {
69
return { error };

docs/src/components/Icon.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { forwardRef } from "react";
22
import type { CSSProperties, SVGProps } from "react";
33

4-
export interface IconProps extends Omit<SVGProps<SVGSVGElement>, "path" | "color"> {
4+
export interface IconProps extends Omit<
5+
SVGProps<SVGSVGElement>,
6+
"path" | "color"
7+
> {
58
path: string;
69
size?: number | string | null;
710
color?: string | null;
@@ -16,7 +19,13 @@ const Icon = forwardRef<SVGSVGElement, IconProps>(
1619
computedStyle.height = dimension;
1720
}
1821
return (
19-
<svg ref={ref} viewBox="0 0 24 24" style={computedStyle} role="presentation" {...rest}>
22+
<svg
23+
ref={ref}
24+
viewBox="0 0 24 24"
25+
style={computedStyle}
26+
role="presentation"
27+
{...rest}
28+
>
2029
<path d={path} style={{ fill: color ?? "currentColor" }} />
2130
</svg>
2231
);

docs/src/components/Layout.tsx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import React, { useState } from "react";
2-
import { TopAppBar, IconButton, NavigationDrawer, NavigationDrawerItem, Divider } from "soda-material";
2+
import {
3+
TopAppBar,
4+
IconButton,
5+
NavigationDrawer,
6+
NavigationDrawerItem,
7+
Divider,
8+
} from "soda-material";
39
import { useWindowSizeType } from "soda-material/dist/hooks/use-media-query";
410
import { mdiMenu, mdiGithub } from "@mdi/js";
511
import Icon from "./Icon.tsx";
@@ -12,7 +18,12 @@ interface LayoutProps {
1218
children: React.ReactNode;
1319
}
1420

15-
export default function Layout({ navSections, currentHash, onNavigate, children }: LayoutProps) {
21+
export default function Layout({
22+
navSections,
23+
currentHash,
24+
onNavigate,
25+
children,
26+
}: LayoutProps) {
1627
const [drawerOpen, setDrawerOpen] = useState(false);
1728
const sizeType = useWindowSizeType();
1829
const isExpanded = sizeType === "expanded";
@@ -52,22 +63,25 @@ export default function Layout({ navSections, currentHash, onNavigate, children
5263
<TopAppBar
5364
leadingNavigationIcon={
5465
!isExpanded ? (
55-
<IconButton path={mdiMenu} onClick={() => setDrawerOpen((v) => !v)} />
66+
<IconButton
67+
path={mdiMenu}
68+
onClick={() => setDrawerOpen((v) => !v)}
69+
/>
5670
) : undefined
5771
}
5872
trailingIcon={
5973
<IconButton
6074
path={mdiGithub}
61-
onClick={() => window.open("https://github.com/YieldRay/module-tsx", "_blank")}
75+
onClick={() =>
76+
window.open("https://github.com/YieldRay/module-tsx", "_blank")
77+
}
6278
/>
6379
}
6480
>
6581
module-tsx
6682
</TopAppBar>
6783
<main className="sd-scrollbar flex-1 overflow-y-auto">
68-
<div className="max-w-3xl mx-auto px-6 pt-8 pb-16">
69-
{children}
70-
</div>
84+
<div className="max-w-3xl mx-auto px-6 pt-8 pb-16">{children}</div>
7185
</main>
7286
</div>
7387
</div>

docs/src/index.css

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,29 @@ body {
99
}
1010

1111
article {
12-
& h1, & h2, & h3, & h4 {
12+
& h1,
13+
& h2,
14+
& h3,
15+
& h4 {
1316
font-weight: 700;
1417
line-height: 1.25;
1518
margin-top: 1.5em;
1619
margin-bottom: 0.5em;
1720
}
1821

19-
& h1 { font-size: 2.25rem; margin-top: 0; }
20-
& h2 { font-size: 1.5rem; }
21-
& h3 { font-size: 1.25rem; }
22-
& h4 { font-size: 1rem; }
22+
& h1 {
23+
font-size: 2.25rem;
24+
margin-top: 0;
25+
}
26+
& h2 {
27+
font-size: 1.5rem;
28+
}
29+
& h3 {
30+
font-size: 1.25rem;
31+
}
32+
& h4 {
33+
font-size: 1rem;
34+
}
2335

2436
& p {
2537
margin-top: 0;
@@ -39,7 +51,8 @@ article {
3951
border-radius: 4px;
4052
}
4153

42-
& ul, & ol {
54+
& ul,
55+
& ol {
4356
padding-left: 1.5em;
4457
margin-bottom: 1em;
4558
}
@@ -55,16 +68,16 @@ article {
5568
padding: 0 !important;
5669
margin: 0 !important;
5770
font-family:
58-
"SF Mono", /* macOS/iOS */
59-
ui-monospace, /* Safari 13.1+ generic */
60-
"Cascadia Code", /* Windows 11 */
61-
"Cascadia Mono", /* Windows Terminal */
62-
Consolas, /* Windows */
63-
"Roboto Mono", /* Android / Chrome OS */
64-
"Liberation Mono",/* Linux (Red Hat / Fedora) */
65-
"DejaVu Sans Mono",/* Linux (Ubuntu / Debian) */
66-
Menlo, /* macOS (older) */
67-
monospace !important;
71+
"SF Mono",
72+
/* macOS/iOS */ ui-monospace,
73+
/* Safari 13.1+ generic */ "Cascadia Code",
74+
/* Windows 11 */ "Cascadia Mono",
75+
/* Windows Terminal */ Consolas,
76+
/* Windows */ "Roboto Mono",
77+
/* Android / Chrome OS */ "Liberation Mono",
78+
/* Linux (Red Hat / Fedora) */ "DejaVu Sans Mono",
79+
/* Linux (Ubuntu / Debian) */ Menlo,
80+
/* macOS (older) */ monospace !important;
6881

6982
& > div {
7083
padding: 1rem !important;

docs/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import { createRoot } from "react-dom/client";
33
import "soda-material/dist/style.css";
4-
import "@speed-highlight/core/dist/themes/default.css"
4+
import "@speed-highlight/core/dist/themes/default.css";
55
import "@tailwindcss/browser";
66
import "./index.css";
77
import App from "./App.tsx";

0 commit comments

Comments
 (0)