Skip to content

Commit 7d32ddd

Browse files
committed
docs(changeset): Fix exports for styles
1 parent 800d705 commit 7d32ddd

12 files changed

Lines changed: 1952 additions & 48 deletions

File tree

.changeset/curvy-women-serve.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react18-loaders": patch
3+
---
4+
5+
Fix exports for styles
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Docs } from "@repo/shared";
2+
3+
export default function DocsPage() {
4+
return <Docs />
5+
}

lib/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@
9090
"types": "./dist/hooks/index.d.ts",
9191
"import": "./dist/hooks/index.mjs",
9292
"require": "./dist/hooks/index.js"
93-
}
93+
},
94+
"./index.css": "./dist/index.css",
95+
"./dist/index.css": "./dist/index.css",
96+
"./dist": "./dist/index.css",
97+
"./css": "./dist/index.css",
98+
"./styles": "./dist/index.css"
9499
},
95100
"scripts": {
96101
"build": "tsup && tsc -p tsconfig-build.json && gzip -c dist/index.js | wc -c",

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"prettier": "^3.5.3",
2828
"turbo": "^2.5.3",
2929
"typedoc": "^0.28.4",
30-
"typedoc-plugin-extras": "^4.0.0",
3130
"typedoc-plugin-mdn-links": "^5.0.2",
3231
"typedoc-plugin-missing-exports": "^4.0.0",
3332
"typedoc-plugin-rename-defaults": "^0.7.3"

packages/shared/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@
4040
"vitest": "^3.1.4"
4141
},
4242
"dependencies": {
43+
"@m2d/react-markdown": "^1.0.0",
4344
"@mayank1513/fork-me": "^2.1.3",
4445
"@repo/scripts": "workspace:*",
4546
"esbuild-raw-plugin": "^0.2.0",
47+
"mdast2docx": "^1.4.1",
4648
"nextjs-darkmode": "^1.0.10",
4749
"nextjs-themes": "^4.0.6",
4850
"r18gs": "^3.0.1",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.docs {
2+
/* create your container styles here */
3+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { HTMLProps, ReactNode, useRef } from "react";
2+
import styles from "./docs.module.scss";
3+
import readme from "../../../../../README.md?raw"
4+
import { Md } from "@m2d/react-markdown";
5+
import { toDocx } from "mdast2docx";
6+
import { AstArrayElement } from "@m2d/react-markdown/utils";
7+
8+
export interface DocsProps extends HTMLProps<HTMLDivElement> {
9+
children?: ReactNode;
10+
}
11+
12+
export const Docs = (props: DocsProps) => {
13+
const className = [props.className, styles["docs"]].filter(Boolean).join(" ");
14+
const astRef = useRef<AstArrayElement[]>([])
15+
return (
16+
<div {...props} className={className} data-testid="docs">
17+
<button onClick={() => {
18+
const mdAst = astRef.current[0].mdast;
19+
if (mdAst) {
20+
toDocx(mdAst).then(docxBlob => {
21+
// download docx blob
22+
const url = URL.createObjectURL(docxBlob as Blob);
23+
const a = document.createElement("a");
24+
a.href = url;
25+
a.download = "document.docx";
26+
document.body.appendChild(a);
27+
a.click();
28+
document.body.removeChild(a);
29+
URL.revokeObjectURL(url);
30+
}).catch(() => {
31+
alert("Something went wrong!")
32+
});
33+
} else {
34+
alert("Something went wrong!")
35+
}
36+
}}>Download as Docx</button>
37+
<Md astRef={astRef}>{readme}</Md>
38+
</div>
39+
);
40+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"use client";
2+
3+
// component exports
4+
export * from "./docs";

packages/shared/src/client/global-loader/global-loader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { LoaderContainer } from "react18-loaders";
2-
import { Bars1 } from "react18-loaders/dist/server/bars/bars1";
2+
import { Bars1 } from "react18-loaders/dist/server";
33

44
/**
55
* # GlobalLoader

packages/shared/src/client/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
// client component exports
10+
export * from "./docs";
1011
export * from "./demo";
1112
export * from "./header";
1213
export * from "./global-loader";

0 commit comments

Comments
 (0)