@asd14/vblocks 7.0.0 → 8.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.
package/types/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Types for the files `../defaults/webpack.config.js` teaches `import` to load.
2
+ * Types for the files that `../defaults/webpack.config.js` loads on `import`.
3
3
  *
4
4
  * @example
5
5
  * // tsconfig.json
@@ -7,9 +7,7 @@
7
7
  */
8
8
 
9
9
  declare module "*.module.css" {
10
- /**
11
- * Class names by their camelCase key, eg. `styles["myClass"]` for `.my-class`.
12
- */
10
+ /** Class names by their camelCase key, eg. `styles["myClass"]` for `.my-class`. */
13
11
  const classNames: { readonly [key: string]: string }
14
12
 
15
13
  export default classNames
@@ -17,72 +15,101 @@ declare module "*.module.css" {
17
15
 
18
16
  declare module "*.css" {}
19
17
 
20
- /**
21
- * The URL of the image, a `data:` URL when the build inlines it.
22
- */
23
18
  declare module "*.jpg" {
19
+ /** The URL of the image, a `data:` URL when the build inlines it. */
24
20
  const url: string
25
21
 
26
22
  export default url
27
23
  }
28
24
 
29
25
  declare module "*.gif" {
26
+ /** The URL of the image, a `data:` URL when the build inlines it. */
30
27
  const url: string
31
28
 
32
29
  export default url
33
30
  }
34
31
 
35
32
  declare module "*.png" {
33
+ /** The URL of the image, a `data:` URL when the build inlines it. */
36
34
  const url: string
37
35
 
38
36
  export default url
39
37
  }
40
38
 
41
39
  declare module "*.svg" {
40
+ /** The URL of the image, a `data:` URL when the build inlines it. */
42
41
  const url: string
43
42
 
44
43
  export default url
45
44
  }
46
45
 
47
- /**
48
- * The URL of the font, a `data:` URL in a single-file build.
49
- */
50
46
  declare module "*.woff" {
47
+ /** The URL of the font, a `data:` URL in a single-file build. */
51
48
  const url: string
52
49
 
53
50
  export default url
54
51
  }
55
52
 
56
53
  declare module "*.woff2" {
54
+ /** The URL of the font, a `data:` URL in a single-file build. */
57
55
  const url: string
58
56
 
59
57
  export default url
60
58
  }
61
59
 
62
60
  declare module "*.ttf" {
61
+ /** The URL of the font, a `data:` URL in a single-file build. */
63
62
  const url: string
64
63
 
65
64
  export default url
66
65
  }
67
66
 
68
67
  declare module "*.eot" {
68
+ /** The URL of the font, a `data:` URL in a single-file build. */
69
69
  const url: string
70
70
 
71
71
  export default url
72
72
  }
73
73
 
74
- /**
75
- * The MDX document as a React component. `components` replaces the element
76
- * MDX renders for a tag, eg. `{ h1: Title }`.
77
- *
78
- * @example
79
- * import Intro from "./intro.mdx"
80
- *
81
- * <Intro components={{ h1: Title }} />
82
- */
74
+ declare module "*.md" {
75
+ import type { ComponentType } from "react"
76
+
77
+ /**
78
+ * The Markdown document as a React component. VBlocks compiles `.md` with MDX,
79
+ * so it takes the same `components` as an `.mdx` import.
80
+ *
81
+ * The `code` component of `components` also receives the meta of a code block
82
+ * as props, eg. `file: "src/app.tsx"` for a block that opens with
83
+ * `tsx file="src/app.tsx"`.
84
+ *
85
+ * @example
86
+ * import Notes from "./notes.md"
87
+ *
88
+ * <Notes components={{ h1: Title }} />
89
+ */
90
+ const MDXContent: ComponentType<{
91
+ components?: Record<string, ComponentType<Record<string, unknown>>>
92
+ }>
93
+
94
+ export default MDXContent
95
+ }
96
+
83
97
  declare module "*.mdx" {
84
98
  import type { ComponentType } from "react"
85
99
 
100
+ /**
101
+ * The MDX document as a React component. `components` replaces the element
102
+ * MDX renders for a tag, eg. `{ h1: Title }`.
103
+ *
104
+ * The `code` component of `components` also receives the meta of a code block
105
+ * as props, eg. `file: "src/app.tsx"` for a block that opens with
106
+ * `tsx file="src/app.tsx"`.
107
+ *
108
+ * @example
109
+ * import Intro from "./intro.mdx"
110
+ *
111
+ * <Intro components={{ h1: Title }} />
112
+ */
86
113
  const MDXContent: ComponentType<{
87
114
  components?: Record<string, ComponentType<Record<string, unknown>>>
88
115
  }>
@@ -90,29 +117,29 @@ declare module "*.mdx" {
90
117
  export default MDXContent
91
118
  }
92
119
 
93
- /**
94
- * The text of the file, as Vite's `?raw` gives it. No loader changes it.
95
- *
96
- * @example
97
- * import { Variants } from "./variants.js"
98
- * import variantsSource from "./variants.tsx?raw"
99
- *
100
- * <Variants />
101
- * <pre>{variantsSource}</pre>
102
- */
103
120
  declare module "*?raw" {
121
+ /**
122
+ * The text of the file, as Vite's `?raw` gives it. No loader changes it.
123
+ *
124
+ * @example
125
+ * import { Variants } from "./variants.js"
126
+ * import variantsSource from "./variants.tsx?raw"
127
+ *
128
+ * <Variants />
129
+ * <pre>{variantsSource}</pre>
130
+ */
104
131
  const source: string
105
132
 
106
133
  export default source
107
134
  }
108
135
 
109
- /**
110
- * The `.env` variables Webpack writes into the bundle. The browser has no
111
- * other part of Node's `process`.
112
- *
113
- * @example
114
- * const apiUrl = process.env["API_URL"]
115
- */
116
136
  declare const process: {
137
+ /**
138
+ * The `.env` variables Webpack writes into the bundle. The browser has no
139
+ * other part of Node's `process`.
140
+ *
141
+ * @example
142
+ * const apiUrl = process.env["API_URL"]
143
+ */
117
144
  env: Record<string, string | undefined>
118
145
  }