unplugin-docubook 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -0
  3. package/dist/adapters/next-DNQX7_ln.d.ts +24 -0
  4. package/dist/adapters/next-DNQX7_ln.d.ts.map +1 -0
  5. package/dist/adapters/next.js +38 -0
  6. package/dist/adapters/next.js.map +1 -0
  7. package/dist/adapters/react-C9Vk6aTD.d.ts +24 -0
  8. package/dist/adapters/react-C9Vk6aTD.d.ts.map +1 -0
  9. package/dist/adapters/react.js +39 -0
  10. package/dist/adapters/react.js.map +1 -0
  11. package/dist/adapters/svelte-C-dhzdmU.d.ts +19 -0
  12. package/dist/adapters/svelte-C-dhzdmU.d.ts.map +1 -0
  13. package/dist/adapters/svelte.js +43 -0
  14. package/dist/adapters/svelte.js.map +1 -0
  15. package/dist/adapters/vue-BWv1EZit.d.ts +22 -0
  16. package/dist/adapters/vue-BWv1EZit.d.ts.map +1 -0
  17. package/dist/adapters/vue.js +41 -0
  18. package/dist/adapters/vue.js.map +1 -0
  19. package/dist/astro-BcckVQ-2.d.ts +19 -0
  20. package/dist/astro-BcckVQ-2.d.ts.map +1 -0
  21. package/dist/astro.js +16 -0
  22. package/dist/astro.js.map +1 -0
  23. package/dist/bun-DYPhytPs.d.ts +7 -0
  24. package/dist/bun-DYPhytPs.d.ts.map +1 -0
  25. package/dist/bun.js +9 -0
  26. package/dist/bun.js.map +1 -0
  27. package/dist/components/index-LWFtIGRd.d.ts +265 -0
  28. package/dist/components/index-LWFtIGRd.d.ts.map +1 -0
  29. package/dist/components/index.js +566 -0
  30. package/dist/components/index.js.map +1 -0
  31. package/dist/context-BKx0jIwX.js +49 -0
  32. package/dist/context-BKx0jIwX.js.map +1 -0
  33. package/dist/esbuild-BD42nX0_.d.ts +8 -0
  34. package/dist/esbuild-BD42nX0_.d.ts.map +1 -0
  35. package/dist/esbuild.js +9 -0
  36. package/dist/esbuild.js.map +1 -0
  37. package/dist/farm-C3XYk4nf.d.ts +7 -0
  38. package/dist/farm-C3XYk4nf.d.ts.map +1 -0
  39. package/dist/farm.js +9 -0
  40. package/dist/farm.js.map +1 -0
  41. package/dist/framework/index-98dEoo0g.d.ts +11 -0
  42. package/dist/framework/index-98dEoo0g.d.ts.map +1 -0
  43. package/dist/framework/index.js +29 -0
  44. package/dist/framework/index.js.map +1 -0
  45. package/dist/index-2f48-Fxc.d.ts +10 -0
  46. package/dist/index-2f48-Fxc.d.ts.map +1 -0
  47. package/dist/index.js +3 -0
  48. package/dist/nuxt-BidHgMAG.d.ts +5 -0
  49. package/dist/nuxt-BidHgMAG.d.ts.map +1 -0
  50. package/dist/nuxt.js +21 -0
  51. package/dist/nuxt.js.map +1 -0
  52. package/dist/rolldown-CrcgSKP1.d.ts +8 -0
  53. package/dist/rolldown-CrcgSKP1.d.ts.map +1 -0
  54. package/dist/rolldown.js +9 -0
  55. package/dist/rolldown.js.map +1 -0
  56. package/dist/rollup-DDEc1C_K.d.ts +8 -0
  57. package/dist/rollup-DDEc1C_K.d.ts.map +1 -0
  58. package/dist/rollup.js +9 -0
  59. package/dist/rollup.js.map +1 -0
  60. package/dist/rspack-QbbymFlY.d.ts +7 -0
  61. package/dist/rspack-QbbymFlY.d.ts.map +1 -0
  62. package/dist/rspack.js +9 -0
  63. package/dist/rspack.js.map +1 -0
  64. package/dist/src-KZV_M01u.js +165 -0
  65. package/dist/src-KZV_M01u.js.map +1 -0
  66. package/dist/types-BQhWL5Qs.d.ts +34 -0
  67. package/dist/types-BQhWL5Qs.d.ts.map +1 -0
  68. package/dist/types-uxY1cMXO.d.ts +28 -0
  69. package/dist/types-uxY1cMXO.d.ts.map +1 -0
  70. package/dist/types.js +1 -0
  71. package/dist/vite-9CqZQPO-.d.ts +8 -0
  72. package/dist/vite-9CqZQPO-.d.ts.map +1 -0
  73. package/dist/vite.js +9 -0
  74. package/dist/vite.js.map +1 -0
  75. package/dist/webpack-CBuuXltg.d.ts +7 -0
  76. package/dist/webpack-CBuuXltg.d.ts.map +1 -0
  77. package/dist/webpack.js +9 -0
  78. package/dist/webpack.js.map +1 -0
  79. package/package.json +151 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DocuBook
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # 📚 DocuBook
2
+ The Universal Documentation Engine for any JavaScript Framework.
3
+
4
+ > Write with MDX — works with pretty much any JS framework: Vite, React, Vue, Svelte, you name it!
5
+
6
+ ## Features
7
+ - 🚀 **Framework Agnostic**: Works with React, Vue, Svelte, and Vite.
8
+ - 🛠️ **Unified Pipeline**: Built on top of Remark/Rehype and Unplugin.
9
+ - 📦 **Smart Components**: Use `<Accordion />`, `<Tabs />`, and `<Step />` directly in your Markdown without manual imports.
10
+ - ⚡ **Optimized**: Static-first approach for maximum performance.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npm i unplugin-docubook
16
+ ```
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region src/adapters/next.d.ts
5
+
6
+ /**
7
+ * Next.js adapter — wraps children with DocuBookProvider
8
+ * configured to use next/link and next/image.
9
+ *
10
+ * @example
11
+ * import { NextAdapter } from 'unplugin-docubook/adapters/next'
12
+ *
13
+ * export default function Layout({ children }) {
14
+ * return <NextAdapter>{children}</NextAdapter>
15
+ * }
16
+ */
17
+ declare function NextAdapter({
18
+ children
19
+ }: {
20
+ children: React.ReactNode;
21
+ }): react_jsx_runtime0.JSX.Element;
22
+ //#endregion
23
+ export { NextAdapter, NextAdapter as default };
24
+ //# sourceMappingURL=next-DNQX7_ln.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-DNQX7_ln.d.ts","names":[],"sources":["../../src/adapters/next.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAgBA;;;;;;;;iBAAgB,WAAA;;;YAAsC,KAAA,CAAM;IAAW,kBAAA,CAAA,GAAA,CAAA"}
@@ -0,0 +1,38 @@
1
+ 'use client';
2
+
3
+ import { t as DocuBookProvider } from "../context-BKx0jIwX.js";
4
+ import { createRequire } from "node:module";
5
+ import React from "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+
8
+ //#region \0rolldown/runtime.js
9
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
10
+
11
+ //#endregion
12
+ //#region src/adapters/next.tsx
13
+ /**
14
+ * Next.js adapter — wraps children with DocuBookProvider
15
+ * configured to use next/link and next/image.
16
+ *
17
+ * @example
18
+ * import { NextAdapter } from 'unplugin-docubook/adapters/next'
19
+ *
20
+ * export default function Layout({ children }) {
21
+ * return <NextAdapter>{children}</NextAdapter>
22
+ * }
23
+ */
24
+ function NextAdapter({ children }) {
25
+ const NextLink = __require("next/link").default;
26
+ const NextImage = __require("next/image").default;
27
+ return /* @__PURE__ */ jsx(DocuBookProvider, {
28
+ value: {
29
+ Link: NextLink,
30
+ Image: NextImage
31
+ },
32
+ children
33
+ });
34
+ }
35
+
36
+ //#endregion
37
+ export { NextAdapter, NextAdapter as default };
38
+ //# sourceMappingURL=next.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next.js","names":[],"sources":["../../src/adapters/next.tsx"],"sourcesContent":["'use client'\n\nimport React from 'react'\nimport { DocuBookProvider } from '../components/react/context'\n\n/**\n * Next.js adapter — wraps children with DocuBookProvider\n * configured to use next/link and next/image.\n *\n * @example\n * import { NextAdapter } from 'unplugin-docubook/adapters/next'\n *\n * export default function Layout({ children }) {\n * return <NextAdapter>{children}</NextAdapter>\n * }\n */\nexport function NextAdapter({ children }: { children: React.ReactNode }) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const NextLink = require('next/link').default\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const NextImage = require('next/image').default\n\n return (\n <DocuBookProvider value={{ Link: NextLink, Image: NextImage }}>\n {children}\n </DocuBookProvider>\n )\n}\n\nexport default NextAdapter\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAgB,YAAY,EAAE,YAA2C;CAErE,MAAM,qBAAmB,YAAY,CAAC;CAEtC,MAAM,sBAAoB,aAAa,CAAC;AAExC,QACI,oBAAC,kBAAD;EAAkB,OAAO;GAAE,MAAM;GAAU,OAAO;GAAW;EACxD;EACc"}
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region src/adapters/react.d.ts
5
+
6
+ /**
7
+ * Default React adapter — uses native HTML elements for Link/Image.
8
+ * Works with any React setup (Vite, CRA, Remix, etc).
9
+ *
10
+ * @example
11
+ * import { ReactAdapter } from 'unplugin-docubook/adapters/react'
12
+ *
13
+ * <ReactAdapter>
14
+ * <MDXContent />
15
+ * </ReactAdapter>
16
+ */
17
+ declare function ReactAdapter({
18
+ children
19
+ }: {
20
+ children: React.ReactNode;
21
+ }): react_jsx_runtime0.JSX.Element;
22
+ //#endregion
23
+ export { ReactAdapter, ReactAdapter as default };
24
+ //# sourceMappingURL=react-C9Vk6aTD.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-C9Vk6aTD.d.ts","names":[],"sources":["../../src/adapters/react.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAgBA;;;;;;;;iBAAgB,YAAA;;;YAAuC,KAAA,CAAM;IAAW,kBAAA,CAAA,GAAA,CAAA"}
@@ -0,0 +1,39 @@
1
+ 'use client';
2
+
3
+ import { t as DocuBookProvider } from "../context-BKx0jIwX.js";
4
+ import React from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/adapters/react.tsx
8
+ /**
9
+ * Default React adapter — uses native HTML elements for Link/Image.
10
+ * Works with any React setup (Vite, CRA, Remix, etc).
11
+ *
12
+ * @example
13
+ * import { ReactAdapter } from 'unplugin-docubook/adapters/react'
14
+ *
15
+ * <ReactAdapter>
16
+ * <MDXContent />
17
+ * </ReactAdapter>
18
+ */
19
+ function ReactAdapter({ children }) {
20
+ return /* @__PURE__ */ jsx(DocuBookProvider, {
21
+ value: {
22
+ Link: ({ href, children: c, ...props }) => /* @__PURE__ */ jsx("a", {
23
+ href,
24
+ ...props,
25
+ children: c
26
+ }),
27
+ Image: ({ src, alt, ...props }) => /* @__PURE__ */ jsx("img", {
28
+ src,
29
+ alt,
30
+ ...props
31
+ })
32
+ },
33
+ children
34
+ });
35
+ }
36
+
37
+ //#endregion
38
+ export { ReactAdapter, ReactAdapter as default };
39
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","names":[],"sources":["../../src/adapters/react.tsx"],"sourcesContent":["'use client'\n\nimport React from 'react'\nimport { DocuBookProvider } from '../components/react/context'\n\n/**\n * Default React adapter — uses native HTML elements for Link/Image.\n * Works with any React setup (Vite, CRA, Remix, etc).\n *\n * @example\n * import { ReactAdapter } from 'unplugin-docubook/adapters/react'\n *\n * <ReactAdapter>\n * <MDXContent />\n * </ReactAdapter>\n */\nexport function ReactAdapter({ children }: { children: React.ReactNode }) {\n return (\n <DocuBookProvider\n value={{\n Link: ({ href, children: c, ...props }) => (\n <a href={href} {...props}>\n {c}\n </a>\n ),\n Image: ({ src, alt, ...props }) => <img src={src} alt={alt} {...props} />,\n }}\n >\n {children}\n </DocuBookProvider>\n )\n}\n\nexport default ReactAdapter\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,SAAgB,aAAa,EAAE,YAA2C;AACtE,QACI,oBAAC,kBAAD;EACI,OAAO;GACH,OAAO,EAAE,MAAM,UAAU,GAAG,GAAG,YAC3B,oBAAC,KAAD;IAAS;IAAM,GAAI;cACd;IACD;GAER,QAAQ,EAAE,KAAK,KAAK,GAAG,YAAY,oBAAC,OAAD;IAAU;IAAU;IAAK,GAAI;IAAS;GAC5E;EAEA;EACc"}
@@ -0,0 +1,19 @@
1
+ import { a as FrameworkLinkProps, i as FrameworkImageProps } from "../types-BQhWL5Qs.js";
2
+ import { Readable } from "svelte/store";
3
+ import { SvelteComponent } from "svelte";
4
+
5
+ //#region src/adapters/svelte.d.ts
6
+ interface SvelteFrameworkConfig {
7
+ Link: new (props: FrameworkLinkProps) => SvelteComponent;
8
+ Image: new (props: FrameworkImageProps) => SvelteComponent;
9
+ }
10
+ declare function setDocuBook(config: Partial<SvelteFrameworkConfig>): void;
11
+ declare function getDocuBook(): SvelteFrameworkConfig;
12
+ declare function useDocuBook(): Readable<SvelteFrameworkConfig>;
13
+ declare function useLink(): SvelteFrameworkConfig['Link'];
14
+ declare function useImage(): SvelteFrameworkConfig['Image'];
15
+ //# sourceMappingURL=svelte.d.ts.map
16
+
17
+ //#endregion
18
+ export { SvelteFrameworkConfig, getDocuBook, setDocuBook, useDocuBook, useImage, useLink };
19
+ //# sourceMappingURL=svelte-C-dhzdmU.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svelte-C-dhzdmU.d.ts","names":[],"sources":["../../src/adapters/svelte.tsx"],"sourcesContent":[],"mappings":";;;;;UAIiB,qBAAA;oBACG,uBAAuB;EAD1B,KAAA,EAAA,KAAA,KAAA,EAEI,mBAFiB,EAAA,GAEO,eAFP;;AAClB,iBAmBJ,WAAA,CAnBI,MAAA,EAmBgB,OAnBhB,CAmBwB,qBAnBxB,CAAA,CAAA,EAAA,IAAA;AAAuB,iBAuB3B,WAAA,CAAA,CAvB2B,EAuBZ,qBAvBY;AACtB,iBA0BL,WAAA,CAAA,CA1BK,EA0BU,QA1BV,CA0BmB,qBA1BnB,CAAA;AAAwB,iBA8B7B,OAAA,CAAA,CA9B6B,EA8BlB,qBA9BkB,CAAA,MAAA,CAAA;AAAe,iBAkC5C,QAAA,CAAA,CAlC4C,EAkChC,qBAlCgC,CAAA,OAAA,CAAA;AAkB5D"}
@@ -0,0 +1,43 @@
1
+ import { get, writable } from "svelte/store";
2
+
3
+ //#region src/adapters/svelte.tsx
4
+ function createDefaultLink(props) {
5
+ return {
6
+ type: "a",
7
+ href: props.href
8
+ };
9
+ }
10
+ function createDefaultImage(props) {
11
+ return {
12
+ type: "img",
13
+ src: props.src,
14
+ alt: props.alt
15
+ };
16
+ }
17
+ const defaultConfig = {
18
+ Link: createDefaultLink,
19
+ Image: createDefaultImage
20
+ };
21
+ const docuBookStore = writable(defaultConfig);
22
+ function setDocuBook(config) {
23
+ docuBookStore.set({
24
+ ...defaultConfig,
25
+ ...config
26
+ });
27
+ }
28
+ function getDocuBook() {
29
+ return get(docuBookStore);
30
+ }
31
+ function useDocuBook() {
32
+ return docuBookStore;
33
+ }
34
+ function useLink() {
35
+ return get(docuBookStore).Link;
36
+ }
37
+ function useImage() {
38
+ return get(docuBookStore).Image;
39
+ }
40
+
41
+ //#endregion
42
+ export { getDocuBook, setDocuBook, useDocuBook, useImage, useLink };
43
+ //# sourceMappingURL=svelte.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svelte.js","names":[],"sources":["../../src/adapters/svelte.tsx"],"sourcesContent":["import { writable, get, type Readable } from 'svelte/store'\nimport type { FrameworkLinkProps, FrameworkImageProps } from '../framework/types'\nimport type { SvelteComponent } from 'svelte'\n\nexport interface SvelteFrameworkConfig {\n Link: new (props: FrameworkLinkProps) => SvelteComponent\n Image: new (props: FrameworkImageProps) => SvelteComponent\n}\n\nfunction createDefaultLink(props: FrameworkLinkProps) {\n return { type: 'a', href: props.href }\n}\n\nfunction createDefaultImage(props: FrameworkImageProps) {\n return { type: 'img', src: props.src, alt: props.alt }\n}\n\nconst defaultConfig: SvelteFrameworkConfig = {\n Link: createDefaultLink as never,\n Image: createDefaultImage as never,\n}\n\nconst docuBookStore = writable<SvelteFrameworkConfig>(defaultConfig)\n\nexport function setDocuBook(config: Partial<SvelteFrameworkConfig>) {\n docuBookStore.set({ ...defaultConfig, ...config })\n}\n\nexport function getDocuBook(): SvelteFrameworkConfig {\n return get(docuBookStore)\n}\n\nexport function useDocuBook(): Readable<SvelteFrameworkConfig> {\n return docuBookStore\n}\n\nexport function useLink(): SvelteFrameworkConfig['Link'] {\n return get(docuBookStore).Link\n}\n\nexport function useImage(): SvelteFrameworkConfig['Image'] {\n return get(docuBookStore).Image\n}\n"],"mappings":";;;AASA,SAAS,kBAAkB,OAA2B;AACpD,QAAO;EAAE,MAAM;EAAK,MAAM,MAAM;EAAM;;AAGxC,SAAS,mBAAmB,OAA4B;AACtD,QAAO;EAAE,MAAM;EAAO,KAAK,MAAM;EAAK,KAAK,MAAM;EAAK;;AAGxD,MAAM,gBAAuC;CAC3C,MAAM;CACN,OAAO;CACR;AAED,MAAM,gBAAgB,SAAgC,cAAc;AAEpE,SAAgB,YAAY,QAAwC;AAClE,eAAc,IAAI;EAAE,GAAG;EAAe,GAAG;EAAQ,CAAC;;AAGpD,SAAgB,cAAqC;AACnD,QAAO,IAAI,cAAc;;AAG3B,SAAgB,cAA+C;AAC7D,QAAO;;AAGT,SAAgB,UAAyC;AACvD,QAAO,IAAI,cAAc,CAAC;;AAG5B,SAAgB,WAA2C;AACzD,QAAO,IAAI,cAAc,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { a as FrameworkLinkProps, i as FrameworkImageProps } from "../types-BQhWL5Qs.js";
2
+ import { App, InjectionKey, VNode } from "vue";
3
+
4
+ //#region src/adapters/vue.d.ts
5
+ interface VueFrameworkConfig {
6
+ Link: (props: FrameworkLinkProps) => VNode;
7
+ Image: (props: FrameworkImageProps) => VNode;
8
+ }
9
+ declare const DocuBookKey: InjectionKey<VueFrameworkConfig>;
10
+ declare function useDocuBook(): VueFrameworkConfig;
11
+ declare function useLink(): (props: FrameworkLinkProps) => VNode;
12
+ declare function useImage(): (props: FrameworkImageProps) => VNode;
13
+ interface VueAdapterOptions {
14
+ Link?: VueFrameworkConfig['Link'];
15
+ Image?: VueFrameworkConfig['Image'];
16
+ }
17
+ declare function VueAdapter(options?: VueAdapterOptions): {
18
+ install(app: App): void;
19
+ };
20
+ //#endregion
21
+ export { DocuBookKey, VueAdapter, VueAdapter as default, VueAdapterOptions, VueFrameworkConfig, useDocuBook, useImage, useLink };
22
+ //# sourceMappingURL=vue-BWv1EZit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue-BWv1EZit.d.ts","names":[],"sources":["../../src/adapters/vue.tsx"],"sourcesContent":[],"mappings":";;;;UAGiB,kBAAA;gBACD,uBAAuB;EADtB,KAAA,EAAA,CAAA,KAAA,EAEA,mBAFkB,EAAA,GAEM,KAFN;;AACnB,cAIH,WAJG,EAIU,YAJV,CAIuB,kBAJvB,CAAA;AAAuB,iBAmBvB,WAAA,CAAA,CAnBuB,EAmBR,kBAnBQ;AACtB,iBAsBD,OAAA,CAAA,CAtBC,EAAA,CAAA,KAAA,EADD,kBACC,EAAA,GADsB,KACtB;AAAwB,iBA2BzB,QAAA,CAAA,CA3ByB,EAAA,CAAA,KAAA,EAAxB,mBAAwB,EAAA,GAAA,KAAA;AAAK,UAgC7B,iBAAA,CAhC6B;EAGjC,IAAA,CAAA,EA8BJ,kBA9BsE,CAAA,MAAA,CAAA;EAAA,KAAA,CAAA,EA+BrE,kBA/BqE,CAAA,OAAA,CAAA;;AAArD,iBAkCV,UAAA,CAlCU,OAAA,CAAA,EAkCU,iBAlCV,CAAA,EAAA;EAAY,OAAA,CAAA,GAAA,EAoCrB,GApCqB,CAAA,EAAA,IAAA;AAetC,CAAA"}
@@ -0,0 +1,41 @@
1
+ import { h, inject } from "vue";
2
+
3
+ //#region src/adapters/vue.tsx
4
+ const DocuBookKey = Symbol("docubook");
5
+ function createDefaultLink(props) {
6
+ return h("a", { href: props.href }, props.children);
7
+ }
8
+ function createDefaultImage(props) {
9
+ return h("img", {
10
+ src: props.src,
11
+ alt: props.alt
12
+ });
13
+ }
14
+ const defaultConfig = {
15
+ Link: createDefaultLink,
16
+ Image: createDefaultImage
17
+ };
18
+ function useDocuBook() {
19
+ return inject(DocuBookKey, defaultConfig);
20
+ }
21
+ function useLink() {
22
+ const { Link } = useDocuBook();
23
+ return Link;
24
+ }
25
+ function useImage() {
26
+ const { Image } = useDocuBook();
27
+ return Image;
28
+ }
29
+ function VueAdapter(options = {}) {
30
+ return { install(app) {
31
+ const config = {
32
+ Link: options.Link ?? createDefaultLink,
33
+ Image: options.Image ?? createDefaultImage
34
+ };
35
+ app.provide(DocuBookKey, config);
36
+ } };
37
+ }
38
+
39
+ //#endregion
40
+ export { DocuBookKey, VueAdapter, VueAdapter as default, useDocuBook, useImage, useLink };
41
+ //# sourceMappingURL=vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.js","names":[],"sources":["../../src/adapters/vue.tsx"],"sourcesContent":["import { inject, type InjectionKey, type App, h, type VNode } from 'vue'\nimport type { FrameworkLinkProps, FrameworkImageProps } from '../framework/types'\n\nexport interface VueFrameworkConfig {\n Link: (props: FrameworkLinkProps) => VNode\n Image: (props: FrameworkImageProps) => VNode\n}\n\nexport const DocuBookKey: InjectionKey<VueFrameworkConfig> = Symbol('docubook')\n\nfunction createDefaultLink(props: FrameworkLinkProps): VNode {\n return h('a', { href: props.href }, props.children)\n}\n\nfunction createDefaultImage(props: FrameworkImageProps): VNode {\n return h('img', { src: props.src, alt: props.alt })\n}\n\nconst defaultConfig: VueFrameworkConfig = {\n Link: createDefaultLink,\n Image: createDefaultImage,\n}\n\nexport function useDocuBook(): VueFrameworkConfig {\n return inject(DocuBookKey, defaultConfig)\n}\n\nexport function useLink() {\n const { Link } = useDocuBook()\n return Link\n}\n\nexport function useImage() {\n const { Image } = useDocuBook()\n return Image\n}\n\nexport interface VueAdapterOptions {\n Link?: VueFrameworkConfig['Link']\n Image?: VueFrameworkConfig['Image']\n}\n\nexport function VueAdapter(options: VueAdapterOptions = {}) {\n return {\n install(app: App) {\n const config: VueFrameworkConfig = {\n Link: options.Link ?? createDefaultLink,\n Image: options.Image ?? createDefaultImage,\n }\n app.provide(DocuBookKey, config)\n },\n }\n}\n\nexport default VueAdapter\n"],"mappings":";;;AAQA,MAAa,cAAgD,OAAO,WAAW;AAE/E,SAAS,kBAAkB,OAAkC;AAC3D,QAAO,EAAE,KAAK,EAAE,MAAM,MAAM,MAAM,EAAE,MAAM,SAAS;;AAGrD,SAAS,mBAAmB,OAAmC;AAC7D,QAAO,EAAE,OAAO;EAAE,KAAK,MAAM;EAAK,KAAK,MAAM;EAAK,CAAC;;AAGrD,MAAM,gBAAoC;CACxC,MAAM;CACN,OAAO;CACR;AAED,SAAgB,cAAkC;AAChD,QAAO,OAAO,aAAa,cAAc;;AAG3C,SAAgB,UAAU;CACxB,MAAM,EAAE,SAAS,aAAa;AAC9B,QAAO;;AAGT,SAAgB,WAAW;CACzB,MAAM,EAAE,UAAU,aAAa;AAC/B,QAAO;;AAQT,SAAgB,WAAW,UAA6B,EAAE,EAAE;AAC1D,QAAO,EACL,QAAQ,KAAU;EAChB,MAAM,SAA6B;GACjC,MAAM,QAAQ,QAAQ;GACtB,OAAO,QAAQ,SAAS;GACzB;AACD,MAAI,QAAQ,aAAa,OAAO;IAEnC"}
@@ -0,0 +1,19 @@
1
+ import { Options } from "./types-uxY1cMXO.js";
2
+
3
+ //#region src/astro.d.ts
4
+ interface AstroConfig {
5
+ config: {
6
+ vite: {
7
+ plugins: unknown[];
8
+ };
9
+ };
10
+ }
11
+ declare function export_default(options: Options): {
12
+ name: string;
13
+ hooks: {
14
+ 'astro:config:setup': (astro: AstroConfig) => Promise<void>;
15
+ };
16
+ };
17
+ //#endregion
18
+ export { export_default as default };
19
+ //# sourceMappingURL=astro-BcckVQ-2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro-BcckVQ-2.d.ts","names":[],"sources":["../src/astro.ts"],"sourcesContent":[],"mappings":";;;UAGU,WAAA;;IAAA,IAAA,EAAA;MAAW,OAAA,EAAA,OAAA,EAAA;IAAA,CAAA;;;AAYsC,iBAZtC,cAAA,CAYsC,OAAA,EAJzB,OAIyB,CAAA,EAAA;EAAA,IAAA,EAAA,MAAA;;kCAAX,gBAAW"}
package/dist/astro.js ADDED
@@ -0,0 +1,16 @@
1
+ import { t as unplugin } from "./src-KZV_M01u.js";
2
+
3
+ //#region src/astro.ts
4
+ function astro_default(options) {
5
+ return {
6
+ name: "unplugin-docubook",
7
+ hooks: { "astro:config:setup": async (astro) => {
8
+ astro.config.vite.plugins ||= [];
9
+ astro.config.vite.plugins.push(unplugin.vite(options));
10
+ } }
11
+ };
12
+ }
13
+
14
+ //#endregion
15
+ export { astro_default as default };
16
+ //# sourceMappingURL=astro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro.js","names":[],"sources":["../src/astro.ts"],"sourcesContent":["import type { Options } from './types'\nimport unplugin from '.'\n\ninterface AstroConfig {\n config: {\n vite: {\n plugins: unknown[]\n }\n }\n}\n\nexport default function (options: Options) {\n return {\n name: 'unplugin-docubook',\n hooks: {\n 'astro:config:setup': async (astro: AstroConfig) => {\n astro.config.vite.plugins ||= []\n astro.config.vite.plugins.push(unplugin.vite(options))\n },\n },\n }\n}\n"],"mappings":";;;AAWA,uBAAyB,SAAkB;AACvC,QAAO;EACH,MAAM;EACN,OAAO,EACH,sBAAsB,OAAO,UAAuB;AAChD,SAAM,OAAO,KAAK,YAAY,EAAE;AAChC,SAAM,OAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,QAAQ,CAAC;KAE7D;EACJ"}
@@ -0,0 +1,7 @@
1
+ import { Options } from "./types-uxY1cMXO.js";
2
+
3
+ //#region src/bun.d.ts
4
+ declare const _default: (options?: Options | undefined) => BunPlugin;
5
+ //#endregion
6
+ export { _default as default };
7
+ //# sourceMappingURL=bun-DYPhytPs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun-DYPhytPs.d.ts","names":[],"sources":["../src/bun.ts"],"sourcesContent":[],"mappings":""}
package/dist/bun.js ADDED
@@ -0,0 +1,9 @@
1
+ import { n as unpluginFactory } from "./src-KZV_M01u.js";
2
+ import { createBunPlugin } from "unplugin";
3
+
4
+ //#region src/bun.ts
5
+ var bun_default = createBunPlugin(unpluginFactory);
6
+
7
+ //#endregion
8
+ export { bun_default as default };
9
+ //# sourceMappingURL=bun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun.js","names":[],"sources":["../src/bun.ts"],"sourcesContent":["import { createBunPlugin } from 'unplugin'\nimport { unpluginFactory } from '.'\n\nexport default createBunPlugin(unpluginFactory)\n"],"mappings":";;;;AAGA,kBAAe,gBAAgB,gBAAgB"}