@ai-react-markdown/core 1.1.0 → 1.2.5
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/LICENSE +21 -0
- package/README.md +19 -5
- package/dist/index.cjs +1746 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -2
- package/dist/index.d.ts +35 -2
- package/dist/index.js +1746 -9
- package/dist/index.js.map +1 -1
- package/dist/typography/all.css +6 -0
- package/dist/typography/all.css.map +1 -1
- package/dist/typography/default.css +6 -0
- package/dist/typography/default.css.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ComponentType, PropsWithChildren } from 'react';
|
|
2
|
+
import { ComponentType, PropsWithChildren, CSSProperties } from 'react';
|
|
3
3
|
import { Components } from 'react-markdown';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -82,6 +82,39 @@ interface AIMarkdownTypographyProps extends PropsWithChildren {
|
|
|
82
82
|
variant?: AIMarkdownVariant;
|
|
83
83
|
/** Active color scheme. */
|
|
84
84
|
colorScheme?: AIMarkdownColorScheme;
|
|
85
|
+
/**
|
|
86
|
+
* Inline styles injected by the core renderer. Custom Typography implementations
|
|
87
|
+
* **must** merge this object into their root element's `style` to ensure CSS
|
|
88
|
+
* custom properties set by the core are available to all descendant nodes.
|
|
89
|
+
*
|
|
90
|
+
* ### Currently injected variables
|
|
91
|
+
*
|
|
92
|
+
* | Variable | Value | Purpose |
|
|
93
|
+
* |-------------------------|----------------|----------------------------------------------------------|
|
|
94
|
+
* | `--aim-font-size-root` | `fontSize` prop | Absolute font-size anchor for the component instance. |
|
|
95
|
+
*
|
|
96
|
+
* #### Why `--aim-font-size-root`?
|
|
97
|
+
*
|
|
98
|
+
* Markdown content frequently nests elements that use relative `em` units
|
|
99
|
+
* (blockquotes, lists, code blocks). Each nesting level compounds the
|
|
100
|
+
* effective size — a `0.875em` code span inside a `1.125em` blockquote
|
|
101
|
+
* becomes `0.984375em` of the parent, not `0.875em` of the root.
|
|
102
|
+
*
|
|
103
|
+
* `--aim-font-size-root` provides the component-level root font-size as an
|
|
104
|
+
* absolute reference so that inner CSS rules can use
|
|
105
|
+
* `font-size: var(--aim-font-size-root)` to opt out of `em` compounding
|
|
106
|
+
* when a stable size is needed.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```tsx
|
|
110
|
+
* const MyTypography: AIMarkdownTypographyComponent = ({ children, fontSize, style }) => (
|
|
111
|
+
* <div className="my-typo" style={{ fontSize, ...style }}>
|
|
112
|
+
* {children}
|
|
113
|
+
* </div>
|
|
114
|
+
* );
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
style?: CSSProperties;
|
|
85
118
|
}
|
|
86
119
|
/** React component type for the typography wrapper. */
|
|
87
120
|
type AIMarkdownTypographyComponent = ComponentType<AIMarkdownTypographyProps>;
|
|
@@ -568,7 +601,7 @@ interface AIMarkdownProps<TConfig extends AIMarkdownRenderConfig = AIMarkdownRen
|
|
|
568
601
|
/**
|
|
569
602
|
* Base font size for the rendered output.
|
|
570
603
|
* Accepts a CSS length string (e.g. `'14px'`, `'0.875rem'`) or a number
|
|
571
|
-
* which is treated as pixels. Defaults to `'0.
|
|
604
|
+
* which is treated as pixels. Defaults to `'0.9375rem'`.
|
|
572
605
|
*/
|
|
573
606
|
fontSize?: number | string;
|
|
574
607
|
/** Raw markdown content to render. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ComponentType, PropsWithChildren } from 'react';
|
|
2
|
+
import { ComponentType, PropsWithChildren, CSSProperties } from 'react';
|
|
3
3
|
import { Components } from 'react-markdown';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -82,6 +82,39 @@ interface AIMarkdownTypographyProps extends PropsWithChildren {
|
|
|
82
82
|
variant?: AIMarkdownVariant;
|
|
83
83
|
/** Active color scheme. */
|
|
84
84
|
colorScheme?: AIMarkdownColorScheme;
|
|
85
|
+
/**
|
|
86
|
+
* Inline styles injected by the core renderer. Custom Typography implementations
|
|
87
|
+
* **must** merge this object into their root element's `style` to ensure CSS
|
|
88
|
+
* custom properties set by the core are available to all descendant nodes.
|
|
89
|
+
*
|
|
90
|
+
* ### Currently injected variables
|
|
91
|
+
*
|
|
92
|
+
* | Variable | Value | Purpose |
|
|
93
|
+
* |-------------------------|----------------|----------------------------------------------------------|
|
|
94
|
+
* | `--aim-font-size-root` | `fontSize` prop | Absolute font-size anchor for the component instance. |
|
|
95
|
+
*
|
|
96
|
+
* #### Why `--aim-font-size-root`?
|
|
97
|
+
*
|
|
98
|
+
* Markdown content frequently nests elements that use relative `em` units
|
|
99
|
+
* (blockquotes, lists, code blocks). Each nesting level compounds the
|
|
100
|
+
* effective size — a `0.875em` code span inside a `1.125em` blockquote
|
|
101
|
+
* becomes `0.984375em` of the parent, not `0.875em` of the root.
|
|
102
|
+
*
|
|
103
|
+
* `--aim-font-size-root` provides the component-level root font-size as an
|
|
104
|
+
* absolute reference so that inner CSS rules can use
|
|
105
|
+
* `font-size: var(--aim-font-size-root)` to opt out of `em` compounding
|
|
106
|
+
* when a stable size is needed.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```tsx
|
|
110
|
+
* const MyTypography: AIMarkdownTypographyComponent = ({ children, fontSize, style }) => (
|
|
111
|
+
* <div className="my-typo" style={{ fontSize, ...style }}>
|
|
112
|
+
* {children}
|
|
113
|
+
* </div>
|
|
114
|
+
* );
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
style?: CSSProperties;
|
|
85
118
|
}
|
|
86
119
|
/** React component type for the typography wrapper. */
|
|
87
120
|
type AIMarkdownTypographyComponent = ComponentType<AIMarkdownTypographyProps>;
|
|
@@ -568,7 +601,7 @@ interface AIMarkdownProps<TConfig extends AIMarkdownRenderConfig = AIMarkdownRen
|
|
|
568
601
|
/**
|
|
569
602
|
* Base font size for the rendered output.
|
|
570
603
|
* Accepts a CSS length string (e.g. `'14px'`, `'0.875rem'`) or a number
|
|
571
|
-
* which is treated as pixels. Defaults to `'0.
|
|
604
|
+
* which is treated as pixels. Defaults to `'0.9375rem'`.
|
|
572
605
|
*/
|
|
573
606
|
fontSize?: number | string;
|
|
574
607
|
/** Raw markdown content to render. */
|