@brillout/docpress 0.6.17 → 0.6.19

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.
@@ -19,28 +19,33 @@ import { assert } from '../utils/assert'
19
19
  import './Note.css'
20
20
  */
21
21
 
22
- function Warning({ children }: { children: React.ReactNode }) {
23
- return <NoteGeneric type="warning">{children}</NoteGeneric>
22
+ type Props = {
23
+ children: React.ReactNode
24
+ style: React.CSSProperties
25
+ }
26
+ function Warning(props: Props) {
27
+ return <NoteGeneric type="warning" {...props} />
24
28
  }
25
- function Advanced({ children }: { children: React.ReactNode }) {
26
- return <NoteGeneric type="advanced">{children}</NoteGeneric>
29
+ function Advanced(props: Props) {
30
+ return <NoteGeneric type="advanced" {...props} />
27
31
  }
28
- function Construction({ children }: { children: React.ReactNode }) {
29
- return <NoteGeneric type="construction">{children}</NoteGeneric>
32
+ function Construction(props: Props) {
33
+ return <NoteGeneric type="construction" {...props} />
30
34
  }
31
- function Contribution({ children }: { children: React.ReactNode }) {
32
- return <NoteGeneric type="contribution">{children}</NoteGeneric>
35
+ function Contribution(props: Props) {
36
+ return <NoteGeneric type="contribution" {...props} />
33
37
  }
34
- function Danger({ children }: { children: React.ReactNode }) {
35
- return <NoteGeneric type="danger">{children}</NoteGeneric>
38
+ function Danger(props: Props) {
39
+ return <NoteGeneric type="danger" {...props} />
36
40
  }
37
- function NoteWithoutIcon({ children }: { children: React.ReactNode }) {
38
- return <NoteGeneric icon={null}>{children}</NoteGeneric>
41
+ function NoteWithoutIcon(props: Props) {
42
+ return <NoteGeneric icon={null} {...props} />
39
43
  }
40
44
  type CustomIcon = JSX.Element | string
41
- function NoteWithCustomIcon({ icon, children }: { children: React.ReactNode; icon: CustomIcon }) {
45
+ function NoteWithCustomIcon(props: Props & { icon: CustomIcon }) {
46
+ const { icon } = props
42
47
  if (!icon) throw new Error(`<NoteWithCustomIcon icon={/*...*/}> property 'icon' is \`${icon}\` which is forbidden`)
43
- return <NoteGeneric icon={icon}>{children}</NoteGeneric>
48
+ return <NoteGeneric {...props} />
44
49
  }
45
50
 
46
51
  function NoteGeneric({
@@ -48,11 +53,11 @@ function NoteGeneric({
48
53
  icon,
49
54
  iconMargin,
50
55
  children,
51
- }: {
56
+ style,
57
+ }: Props & {
52
58
  icon?: null | CustomIcon
53
59
  iconMargin?: null | number
54
60
  type?: 'danger' | 'warning' | 'construction' | 'contribution' | 'advanced'
55
- children: React.ReactNode
56
61
  }) {
57
62
  assert(icon === null || icon || type, { icon, type })
58
63
  iconMargin ??= 2
@@ -88,7 +93,7 @@ function NoteGeneric({
88
93
  className = `${className} ${classColor}`
89
94
  }
90
95
  return (
91
- <blockquote className={className}>
96
+ <blockquote className={className} style={style}>
92
97
  <div style={{ marginBottom: 20 }} />
93
98
  <span style={{ fontFamily: 'emoji' }}>{icon}</span>
94
99
  <span style={{ width: iconMargin ?? undefined, display: 'inline-block' }}></span>{' '}
@@ -23,7 +23,7 @@ var config = {
23
23
  includeAssetsImportedByServer: true,
24
24
  }),
25
25
  ],
26
- optimizeDeps: { include: ['@mdx-js/react', 'react-dom'] },
26
+ optimizeDeps: { include: ['@brillout/docpress', 'react-dom'] },
27
27
  // @ts-ignore
28
28
  ssr: {
29
29
  noExternal: ['@brillout/docpress'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.6.17",
3
+ "version": "0.6.19",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "// Build vite.config.ts and +config.ts": "",
package/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference types="vite/client" />
2
2
 
3
3
  declare module '*.mdx' {
4
- const value: () => JSX.Element
4
+ const value: (props?: any) => JSX.Element
5
5
  export default value
6
6
  export const headings: { level: number; title: string; id: string }[]
7
7
  }
package/vite.config.ts CHANGED
@@ -26,7 +26,7 @@ const config: UserConfig = {
26
26
  includeAssetsImportedByServer: true,
27
27
  }),
28
28
  ],
29
- optimizeDeps: { include: ['@mdx-js/react', 'react-dom'] },
29
+ optimizeDeps: { include: ['@brillout/docpress', 'react-dom'] },
30
30
  // @ts-ignore
31
31
  ssr: {
32
32
  noExternal: ['@brillout/docpress'],