@asd14/vblocks 7.1.0 → 8.1.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,78 @@ 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 Markdown document as a React component. VBlocks compiles `.md` with MDX,
76
- * so it takes the same `components` as an `.mdx` import.
77
- *
78
- * @example
79
- * import Notes from "./notes.md"
80
- *
81
- * <Notes components={{ h1: Title }} />
82
- */
83
74
  declare module "*.md" {
84
75
  import type { ComponentType } from "react"
85
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
+ */
86
90
  const MDXContent: ComponentType<{
87
91
  components?: Record<string, ComponentType<Record<string, unknown>>>
88
92
  }>
@@ -90,18 +94,22 @@ declare module "*.md" {
90
94
  export default MDXContent
91
95
  }
92
96
 
93
- /**
94
- * The MDX document as a React component. `components` replaces the element
95
- * MDX renders for a tag, eg. `{ h1: Title }`.
96
- *
97
- * @example
98
- * import Intro from "./intro.mdx"
99
- *
100
- * <Intro components={{ h1: Title }} />
101
- */
102
97
  declare module "*.mdx" {
103
98
  import type { ComponentType } from "react"
104
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
+ */
105
113
  const MDXContent: ComponentType<{
106
114
  components?: Record<string, ComponentType<Record<string, unknown>>>
107
115
  }>
@@ -109,29 +117,29 @@ declare module "*.mdx" {
109
117
  export default MDXContent
110
118
  }
111
119
 
112
- /**
113
- * The text of the file, as Vite's `?raw` gives it. No loader changes it.
114
- *
115
- * @example
116
- * import { Variants } from "./variants.js"
117
- * import variantsSource from "./variants.tsx?raw"
118
- *
119
- * <Variants />
120
- * <pre>{variantsSource}</pre>
121
- */
122
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
+ */
123
131
  const source: string
124
132
 
125
133
  export default source
126
134
  }
127
135
 
128
- /**
129
- * The `.env` variables Webpack writes into the bundle. The browser has no
130
- * other part of Node's `process`.
131
- *
132
- * @example
133
- * const apiUrl = process.env["API_URL"]
134
- */
135
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
+ */
136
144
  env: Record<string, string | undefined>
137
145
  }