@mobile-reality/mdma-renderer-react 0.4.0 → 0.5.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/dist/components/MdmaDocument.d.ts +8 -1
- package/dist/components/MdmaDocument.d.ts.map +1 -1
- package/dist/components/MdmaDocument.js +34 -29
- package/dist/components/MdmaDocument.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/theme/MdmaThemeProvider.d.ts +109 -0
- package/dist/theme/MdmaThemeProvider.d.ts.map +1 -0
- package/dist/theme/MdmaThemeProvider.js +141 -0
- package/dist/theme/MdmaThemeProvider.js.map +1 -0
- package/package.json +3 -3
- package/styles.css +327 -121
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MdmaRoot } from '@mobile-reality/mdma-spec';
|
|
2
2
|
import type { DocumentStore } from '@mobile-reality/mdma-runtime';
|
|
3
3
|
import { type ComponentType } from 'react';
|
|
4
|
+
import { type MdmaThemeInput } from '../theme/MdmaThemeProvider.js';
|
|
4
5
|
import type { MdmaBlockRendererProps } from '../renderers/renderer-registry.js';
|
|
5
6
|
/**
|
|
6
7
|
* A component entry can be either:
|
|
@@ -37,7 +38,13 @@ export interface MdmaDocumentProps {
|
|
|
37
38
|
store: DocumentStore;
|
|
38
39
|
/** Rendering customizations (component renderers + element overrides). */
|
|
39
40
|
customizations?: MdmaRenderCustomizations;
|
|
41
|
+
/**
|
|
42
|
+
* Theme applied to the document root: `'light'` | `'dark'` | `'auto'`
|
|
43
|
+
* (follows the OS preference), or a full `MdmaTheme` for custom tokens.
|
|
44
|
+
* Omit to use the stylesheet's default (light) look.
|
|
45
|
+
*/
|
|
46
|
+
theme?: MdmaThemeInput;
|
|
40
47
|
className?: string;
|
|
41
48
|
}
|
|
42
|
-
export declare function MdmaDocument({ ast, store, customizations, className }: MdmaDocumentProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare function MdmaDocument({ ast, store, customizations, theme, className }: MdmaDocumentProps): import("react/jsx-runtime").JSX.Element;
|
|
43
50
|
//# sourceMappingURL=MdmaDocument.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MdmaDocument.d.ts","sourceRoot":"","sources":["../../src/components/MdmaDocument.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAA8B,MAAM,2BAA2B,CAAC;AAEtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"MdmaDocument.d.ts","sourceRoot":"","sources":["../../src/components/MdmaDocument.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAA8B,MAAM,2BAA2B,CAAC;AAEtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAA+B,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAMxE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB,aAAa,CAAC,sBAAsB,CAAC,GACrC;IACE,QAAQ,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEN,uEAAuE;AACvE,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,sGAAsG;IACtG,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;CACvE;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,QAAQ,CAAC;IACd,KAAK,EAAE,aAAa,CAAC;IACrB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAC1C;;;;OAIG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmGD,wBAAgB,YAAY,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,iBAAiB,2CAmF/F"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { MDMA_LANG_TAG } from '@mobile-reality/mdma-spec';
|
|
3
|
-
import { useRef, useMemo } from 'react';
|
|
3
|
+
import { useRef, useMemo, useContext } from 'react';
|
|
4
4
|
import { MdmaProvider } from '../context/MdmaProvider.js';
|
|
5
5
|
import { ElementOverridesProvider, } from '../context/ElementOverridesContext.js';
|
|
6
|
+
import { MdmaThemeContext, resolveThemeProps, } from '../theme/MdmaThemeProvider.js';
|
|
6
7
|
import { MdmaBlock } from './MdmaBlock.js';
|
|
7
8
|
import { MdmaBlockLoading } from './MdmaBlockLoading.js';
|
|
8
9
|
import { MdastRenderer } from './MdastRenderer.js';
|
|
@@ -96,42 +97,46 @@ function buildPartialThinkingBlock(yaml) {
|
|
|
96
97
|
},
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
|
-
export function MdmaDocument({ ast, store, customizations, className }) {
|
|
100
|
+
export function MdmaDocument({ ast, store, customizations, theme, className }) {
|
|
100
101
|
const { renderers, elementOverrides } = useMemo(() => splitComponents(customizations?.components), [customizations?.components]);
|
|
102
|
+
// Resolve our own `theme` prop, or inherit an ancestor `MdmaThemeProvider`'s
|
|
103
|
+
// theme when none is given (so a single provider can theme a whole app).
|
|
104
|
+
const inheritedTheme = useContext(MdmaThemeContext);
|
|
105
|
+
const themeProps = useMemo(() => (theme !== undefined ? resolveThemeProps(theme) : inheritedTheme), [theme, inheritedTheme]);
|
|
101
106
|
// Cache of successfully parsed blocks by component ID. Prevents flickering
|
|
102
107
|
// during streaming when a block alternates between parsed and pending states
|
|
103
108
|
// as incomplete YAML temporarily fails to validate.
|
|
104
109
|
const renderedBlocksRef = useRef(new Map());
|
|
105
|
-
return (_jsx(MdmaProvider, { store: store, dataSources: customizations?.dataSources, children: _jsx(ElementOverridesProvider, { value: elementOverrides, children: _jsx("div", { className: `mdma-document ${className ?? ''}`, children: ast.children.map((child, index) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
// Incomplete MDMA blocks (still streaming or failed validation)
|
|
112
|
-
if (isPendingMdmaBlock(child)) {
|
|
113
|
-
const pendingYaml = child.value;
|
|
114
|
-
const pendingId = extractIdFromYaml(pendingYaml);
|
|
115
|
-
// If this block was previously rendered, keep showing the rendered
|
|
116
|
-
// version instead of flickering back to the loading skeleton.
|
|
117
|
-
const cachedBlock = pendingId ? renderedBlocksRef.current.get(pendingId) : null;
|
|
118
|
-
if (cachedBlock) {
|
|
119
|
-
return (_jsx(MdmaBlock, { block: cachedBlock, renderers: renderers }, cachedBlock.component.id));
|
|
110
|
+
return (_jsx(MdmaProvider, { store: store, dataSources: customizations?.dataSources, children: _jsx(ElementOverridesProvider, { value: elementOverrides, children: _jsx(MdmaThemeContext.Provider, { value: themeProps, children: _jsx("div", { className: `mdma-document ${className ?? ''}`, "data-theme": themeProps.dataTheme, style: themeProps.style, children: ast.children.map((child, index) => {
|
|
111
|
+
if (isMdmaBlock(child)) {
|
|
112
|
+
// Cache this successfully parsed block
|
|
113
|
+
renderedBlocksRef.current.set(child.component.id, child);
|
|
114
|
+
return _jsx(MdmaBlock, { block: child, renderers: renderers }, child.component.id);
|
|
120
115
|
}
|
|
121
|
-
//
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
116
|
+
// Incomplete MDMA blocks (still streaming or failed validation)
|
|
117
|
+
if (isPendingMdmaBlock(child)) {
|
|
118
|
+
const pendingYaml = child.value;
|
|
119
|
+
const pendingId = extractIdFromYaml(pendingYaml);
|
|
120
|
+
// If this block was previously rendered, keep showing the rendered
|
|
121
|
+
// version instead of flickering back to the loading skeleton.
|
|
122
|
+
const cachedBlock = pendingId ? renderedBlocksRef.current.get(pendingId) : null;
|
|
123
|
+
if (cachedBlock) {
|
|
124
|
+
return (_jsx(MdmaBlock, { block: cachedBlock, renderers: renderers }, cachedBlock.component.id));
|
|
128
125
|
}
|
|
126
|
+
// Thinking blocks stream their content live instead of showing
|
|
127
|
+
// a loading skeleton — build a synthetic block from partial YAML.
|
|
128
|
+
const pendingType = extractTypeFromYaml(pendingYaml);
|
|
129
|
+
if (pendingType === 'thinking' && pendingYaml) {
|
|
130
|
+
const partialBlock = buildPartialThinkingBlock(pendingYaml);
|
|
131
|
+
if (partialBlock) {
|
|
132
|
+
return (_jsx(MdmaBlock, { block: partialBlock, renderers: renderers }, partialBlock.component.id));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return _jsx(MdmaBlockLoading, { node: child }, index);
|
|
129
136
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return (_jsx(MdastRenderer, { node: child }, index));
|
|
134
|
-
}) }) }) }));
|
|
137
|
+
// Render standard Markdown nodes (headings, paragraphs, lists, etc.)
|
|
138
|
+
return (_jsx(MdastRenderer, { node: child }, index));
|
|
139
|
+
}) }) }) }) }));
|
|
135
140
|
}
|
|
136
141
|
function isMdmaBlock(node) {
|
|
137
142
|
return (typeof node === 'object' &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MdmaDocument.js","sourceRoot":"","sources":["../../src/components/MdmaDocument.tsx"],"names":[],"mappings":";AACA,OA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Y,EAAE,CAAC;oCACjB,OAAO,CACL,KAAC,SAAS,IAER,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,SAAS,IAFf,YAAY,CAAC,SAAS,CAAC,EAAE,CAG9B,CACH,CAAC;gCACJ,CAAC;4BACH,CAAC;4BAED,OAAO,KAAC,gBAAgB,IAAa,IAAI,EAAE,KAA2B,IAAxC,KAAK,CAAuC,CAAC;wBAC7E,CAAC;wBACD,qEAAqE;wBACrE,OAAO,CACL,KAAC,aAAa,IAEZ,IAAI,EAAE,KAAoD,IADrD,KAAK,CAEV,CACH,CAAC;oBACJ,CAAC,CAAC,GACE,GACoB,GACH,GACd,CAChB,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,IAAa;IAChC,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,MAAM,IAAI,IAAI;QACb,IAAyB,CAAC,IAAI,KAAK,WAAW,CAChD,CAAC;AACJ,CAAC;AAED;gEACgE;AAChE,SAAS,kBAAkB,CAAC,IAAa;IACvC,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,MAAM,IAAI,IAAI;QACb,IAAyB,CAAC,IAAI,KAAK,MAAM;QAC1C,MAAM,IAAI,IAAI;QACb,IAAyB,CAAC,IAAI,KAAK,aAAa,CAClD,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { MdmaBlock, type MdmaBlockProps } from './components/MdmaBlock.js';
|
|
|
3
3
|
export { MdastRenderer, type MdastRendererProps } from './components/MdastRenderer.js';
|
|
4
4
|
export { MdmaBlockLoading, type MdmaBlockLoadingProps } from './components/MdmaBlockLoading.js';
|
|
5
5
|
export { MdmaProvider, useMdmaContext, type MdmaProviderProps, type DataSources, } from './context/MdmaProvider.js';
|
|
6
|
+
export { MdmaThemeProvider, useMdmaTheme, resolveThemeProps, themeToCssVars, lightTheme, darkTheme, type MdmaTheme, type MdmaThemeInput, type MdmaThemeProviderProps, type ResolvedThemeProps, } from './theme/MdmaThemeProvider.js';
|
|
6
7
|
export { ElementOverridesProvider, useElementOverride, type ElementOverrides, type ElementOverridesProviderProps, type FormInputElementProps, type FormSelectElementProps, type FormCheckboxElementProps, type FormTextareaElementProps, type FormFileElementProps, type FormSubmitElementProps, type FormSensitiveIndicatorElementProps, } from './context/ElementOverridesContext.js';
|
|
7
8
|
export { useDocumentStore, useDocumentState, useComponentState, useBinding, } from './hooks/use-document-store.js';
|
|
8
9
|
export { RendererRegistry, createRendererRegistry, defaultRenderers, type MdmaBlockRendererProps, } from './renderers/renderer-registry.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAChG,OAAO,EACL,YAAY,EACZ,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,WAAW,GACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,6BAA6B,EAClC,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,kCAAkC,GACxC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,gBAAgB,EACh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EACd,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,6BAA6B,EAClC,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,kCAAkC,GACxC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,sBAAsB,GAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { MdmaBlock } from './components/MdmaBlock.js';
|
|
|
3
3
|
export { MdastRenderer } from './components/MdastRenderer.js';
|
|
4
4
|
export { MdmaBlockLoading } from './components/MdmaBlockLoading.js';
|
|
5
5
|
export { MdmaProvider, useMdmaContext, } from './context/MdmaProvider.js';
|
|
6
|
+
export { MdmaThemeProvider, useMdmaTheme, resolveThemeProps, themeToCssVars, lightTheme, darkTheme, } from './theme/MdmaThemeProvider.js';
|
|
6
7
|
export { ElementOverridesProvider, useElementOverride, } from './context/ElementOverridesContext.js';
|
|
7
8
|
export { useDocumentStore, useDocumentState, useComponentState, useBinding, } from './hooks/use-document-store.js';
|
|
8
9
|
export { RendererRegistry, createRendererRegistry, defaultRenderers, } from './renderers/renderer-registry.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,GAIb,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAuB,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,aAAa,EAA2B,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAA8B,MAAM,kCAAkC,CAAC;AAChG,OAAO,EACL,YAAY,EACZ,cAAc,GAGf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,GAUnB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,GAEjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,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BAA+B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Design tokens for the web renderer. This is the typed mirror of the CSS
|
|
4
|
+
* custom properties in `styles.css`: the same token shape the React Native
|
|
5
|
+
* renderer exposes (`renderer-react-native`'s `MdmaTheme`), so a theme object
|
|
6
|
+
* is portable between the two renderers.
|
|
7
|
+
*
|
|
8
|
+
* You rarely need to read these tokens directly — the components are styled via
|
|
9
|
+
* `.mdma-*` classes that read the matching `--mdma-*` CSS variables. A custom
|
|
10
|
+
* theme just rewrites those variables (see {@link MdmaThemeProvider}).
|
|
11
|
+
*/
|
|
12
|
+
export interface MdmaTheme {
|
|
13
|
+
colors: {
|
|
14
|
+
background: string;
|
|
15
|
+
surface: string;
|
|
16
|
+
text: string;
|
|
17
|
+
textMuted: string;
|
|
18
|
+
border: string;
|
|
19
|
+
primary: string;
|
|
20
|
+
onPrimary: string;
|
|
21
|
+
secondary: string;
|
|
22
|
+
onSecondary: string;
|
|
23
|
+
danger: string;
|
|
24
|
+
onDanger: string;
|
|
25
|
+
/** Callout variant accents + soft backgrounds. */
|
|
26
|
+
info: string;
|
|
27
|
+
infoBg: string;
|
|
28
|
+
warning: string;
|
|
29
|
+
warningBg: string;
|
|
30
|
+
error: string;
|
|
31
|
+
errorBg: string;
|
|
32
|
+
success: string;
|
|
33
|
+
successBg: string;
|
|
34
|
+
};
|
|
35
|
+
spacing: {
|
|
36
|
+
xs: number;
|
|
37
|
+
sm: number;
|
|
38
|
+
md: number;
|
|
39
|
+
lg: number;
|
|
40
|
+
};
|
|
41
|
+
radius: {
|
|
42
|
+
sm: number;
|
|
43
|
+
md: number;
|
|
44
|
+
};
|
|
45
|
+
fontSize: {
|
|
46
|
+
small: number;
|
|
47
|
+
body: number;
|
|
48
|
+
label: number;
|
|
49
|
+
title: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** Built-in light palette — matches the default `--mdma-*` values in `styles.css`. */
|
|
53
|
+
export declare const lightTheme: MdmaTheme;
|
|
54
|
+
/** Built-in dark palette — matches the `[data-theme='dark']` block in `styles.css`. */
|
|
55
|
+
export declare const darkTheme: MdmaTheme;
|
|
56
|
+
/**
|
|
57
|
+
* What can be passed as a `theme`:
|
|
58
|
+
* - `'light'` / `'dark'` — the built-in palettes (applied via `data-theme`).
|
|
59
|
+
* - `'auto'` — follows the OS `prefers-color-scheme`.
|
|
60
|
+
* - a full {@link MdmaTheme} — custom tokens, written inline as CSS variables.
|
|
61
|
+
* - `undefined` — no theme; the stylesheet's default (light) tokens apply.
|
|
62
|
+
*/
|
|
63
|
+
export type MdmaThemeInput = MdmaTheme | 'light' | 'dark' | 'auto';
|
|
64
|
+
/**
|
|
65
|
+
* Nearest resolved theme. Holds the full {@link ResolvedThemeProps} (not just
|
|
66
|
+
* the tokens) so a descendant `MdmaDocument` with no `theme` prop of its own can
|
|
67
|
+
* inherit the ancestor's `data-theme` / inline variables and re-apply them to
|
|
68
|
+
* its own root. The default is the unthemed light look.
|
|
69
|
+
*/
|
|
70
|
+
declare const MdmaThemeContext: import("react").Context<ResolvedThemeProps>;
|
|
71
|
+
/** The resolved token object for the nearest theme (defaults to {@link lightTheme}). */
|
|
72
|
+
export declare function useMdmaTheme(): MdmaTheme;
|
|
73
|
+
export { MdmaThemeContext };
|
|
74
|
+
/**
|
|
75
|
+
* Convert an {@link MdmaTheme} into the inline CSS-variable style object the
|
|
76
|
+
* `.mdma-*` classes read. Numeric scales are emitted as `px`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function themeToCssVars(theme: MdmaTheme): CSSProperties;
|
|
79
|
+
export interface ResolvedThemeProps {
|
|
80
|
+
/** `data-theme` attribute value, when a built-in palette is selected. */
|
|
81
|
+
dataTheme?: 'light' | 'dark' | 'auto';
|
|
82
|
+
/** Inline CSS variables, when a custom theme object is provided. */
|
|
83
|
+
style?: CSSProperties;
|
|
84
|
+
/** The resolved token object exposed via {@link useMdmaTheme}. */
|
|
85
|
+
theme: MdmaTheme;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Resolve a {@link MdmaThemeInput} into the DOM props that apply it: a
|
|
89
|
+
* `data-theme` attribute for built-in palettes, or inline CSS variables for a
|
|
90
|
+
* custom theme. Shared by {@link MdmaThemeProvider} and `MdmaDocument`.
|
|
91
|
+
*/
|
|
92
|
+
export declare function resolveThemeProps(theme: MdmaThemeInput | undefined): ResolvedThemeProps;
|
|
93
|
+
export interface MdmaThemeProviderProps {
|
|
94
|
+
/** `'light'` | `'dark'` | `'auto'`, or a full {@link MdmaTheme}. */
|
|
95
|
+
theme?: MdmaThemeInput;
|
|
96
|
+
/** Extra class names for the wrapper element. */
|
|
97
|
+
className?: string;
|
|
98
|
+
/** Extra inline styles, merged after the theme's CSS variables. */
|
|
99
|
+
style?: CSSProperties;
|
|
100
|
+
children: ReactNode;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Standalone theme wrapper for rendering MDMA components *without* `MdmaDocument`
|
|
104
|
+
* (e.g. a lone `<MdmaBlock>`). Renders a `.mdma-theme-root` element carrying the
|
|
105
|
+
* theme so the `--mdma-*` variables cascade to everything inside. When you use
|
|
106
|
+
* `MdmaDocument`, pass `theme` to it directly instead — it themes its own root.
|
|
107
|
+
*/
|
|
108
|
+
export declare function MdmaThemeProvider({ theme, className, style, children }: MdmaThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
109
|
+
//# sourceMappingURL=MdmaThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MdmaThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/MdmaThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE/F;;;;;;;;;GASG;AAC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,CAAC;AAEnE;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,6CAA2D,CAAC;AAElF,wFAAwF;AACxF,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAM5B;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,aAAa,CAe9D;AAED,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACtC,oEAAoE;IACpE,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,kEAAkE;IAClE,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,GAAG,kBAAkB,CAiBvF;AAaD,MAAM,WAAW,sBAAsB;IACrC,oEAAoE;IACpE,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,sBAAsB,2CAW9F"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
3
|
+
/** Built-in light palette — matches the default `--mdma-*` values in `styles.css`. */
|
|
4
|
+
export const lightTheme = {
|
|
5
|
+
colors: {
|
|
6
|
+
background: '#ffffff',
|
|
7
|
+
surface: '#f8f9fa',
|
|
8
|
+
text: '#333333',
|
|
9
|
+
textMuted: '#666666',
|
|
10
|
+
border: '#e0e0e0',
|
|
11
|
+
primary: '#6c5ce7',
|
|
12
|
+
onPrimary: '#ffffff',
|
|
13
|
+
secondary: '#dfe6e9',
|
|
14
|
+
onSecondary: '#2d3436',
|
|
15
|
+
danger: '#e74c3c',
|
|
16
|
+
onDanger: '#ffffff',
|
|
17
|
+
info: '#3498db',
|
|
18
|
+
infoBg: '#ebf5fb',
|
|
19
|
+
warning: '#f39c12',
|
|
20
|
+
warningBg: '#fef9e7',
|
|
21
|
+
error: '#e74c3c',
|
|
22
|
+
errorBg: '#fdedec',
|
|
23
|
+
success: '#27ae60',
|
|
24
|
+
successBg: '#eafaf1',
|
|
25
|
+
},
|
|
26
|
+
spacing: { xs: 4, sm: 8, md: 12, lg: 16 },
|
|
27
|
+
radius: { sm: 6, md: 10 },
|
|
28
|
+
fontSize: { small: 13, body: 14, label: 15, title: 18 },
|
|
29
|
+
};
|
|
30
|
+
/** Built-in dark palette — matches the `[data-theme='dark']` block in `styles.css`. */
|
|
31
|
+
export const darkTheme = {
|
|
32
|
+
colors: {
|
|
33
|
+
background: '#151a26',
|
|
34
|
+
surface: '#1c2333',
|
|
35
|
+
text: '#e5e7eb',
|
|
36
|
+
textMuted: '#9ca3af',
|
|
37
|
+
border: '#2a3140',
|
|
38
|
+
primary: '#8b7ff0',
|
|
39
|
+
onPrimary: '#ffffff',
|
|
40
|
+
secondary: '#2a3140',
|
|
41
|
+
onSecondary: '#e5e7eb',
|
|
42
|
+
danger: '#ef4444',
|
|
43
|
+
onDanger: '#ffffff',
|
|
44
|
+
info: '#5dade2',
|
|
45
|
+
infoBg: '#16283a',
|
|
46
|
+
warning: '#f5b041',
|
|
47
|
+
warningBg: '#2a2412',
|
|
48
|
+
error: '#ef4444',
|
|
49
|
+
errorBg: '#2a1717',
|
|
50
|
+
success: '#2ecc71',
|
|
51
|
+
successBg: '#12251a',
|
|
52
|
+
},
|
|
53
|
+
spacing: { xs: 4, sm: 8, md: 12, lg: 16 },
|
|
54
|
+
radius: { sm: 6, md: 10 },
|
|
55
|
+
fontSize: { small: 13, body: 14, label: 15, title: 18 },
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Nearest resolved theme. Holds the full {@link ResolvedThemeProps} (not just
|
|
59
|
+
* the tokens) so a descendant `MdmaDocument` with no `theme` prop of its own can
|
|
60
|
+
* inherit the ancestor's `data-theme` / inline variables and re-apply them to
|
|
61
|
+
* its own root. The default is the unthemed light look.
|
|
62
|
+
*/
|
|
63
|
+
const MdmaThemeContext = createContext({ theme: lightTheme });
|
|
64
|
+
/** The resolved token object for the nearest theme (defaults to {@link lightTheme}). */
|
|
65
|
+
export function useMdmaTheme() {
|
|
66
|
+
return useContext(MdmaThemeContext).theme;
|
|
67
|
+
}
|
|
68
|
+
export { MdmaThemeContext };
|
|
69
|
+
function camelToKebab(key) {
|
|
70
|
+
return key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Convert an {@link MdmaTheme} into the inline CSS-variable style object the
|
|
74
|
+
* `.mdma-*` classes read. Numeric scales are emitted as `px`.
|
|
75
|
+
*/
|
|
76
|
+
export function themeToCssVars(theme) {
|
|
77
|
+
const vars = {};
|
|
78
|
+
for (const [key, value] of Object.entries(theme.colors)) {
|
|
79
|
+
vars[`--mdma-color-${camelToKebab(key)}`] = value;
|
|
80
|
+
}
|
|
81
|
+
for (const [key, value] of Object.entries(theme.spacing)) {
|
|
82
|
+
vars[`--mdma-spacing-${key}`] = `${value}px`;
|
|
83
|
+
}
|
|
84
|
+
for (const [key, value] of Object.entries(theme.radius)) {
|
|
85
|
+
vars[`--mdma-radius-${key}`] = `${value}px`;
|
|
86
|
+
}
|
|
87
|
+
for (const [key, value] of Object.entries(theme.fontSize)) {
|
|
88
|
+
vars[`--mdma-font-size-${camelToKebab(key)}`] = `${value}px`;
|
|
89
|
+
}
|
|
90
|
+
return vars;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Resolve a {@link MdmaThemeInput} into the DOM props that apply it: a
|
|
94
|
+
* `data-theme` attribute for built-in palettes, or inline CSS variables for a
|
|
95
|
+
* custom theme. Shared by {@link MdmaThemeProvider} and `MdmaDocument`.
|
|
96
|
+
*/
|
|
97
|
+
export function resolveThemeProps(theme) {
|
|
98
|
+
if (theme === undefined)
|
|
99
|
+
return { theme: lightTheme };
|
|
100
|
+
if (theme === 'light')
|
|
101
|
+
return { dataTheme: 'light', theme: lightTheme };
|
|
102
|
+
if (theme === 'dark')
|
|
103
|
+
return { dataTheme: 'dark', theme: darkTheme };
|
|
104
|
+
// `auto` follows the OS preference at the CSS layer; the resolved token
|
|
105
|
+
// object is a best-effort light default for any JS consumer of useMdmaTheme.
|
|
106
|
+
if (theme === 'auto')
|
|
107
|
+
return { dataTheme: 'auto', theme: lightTheme };
|
|
108
|
+
// A custom theme sets the public tokens inline, but the stylesheet also has
|
|
109
|
+
// internal derived vars (heading text, code backgrounds, …) that aren't on
|
|
110
|
+
// the public type. Pick the light/dark base by the theme's own background so
|
|
111
|
+
// those derived vars match — otherwise a custom *dark* theme would render,
|
|
112
|
+
// e.g., near-black heading text on a dark surface.
|
|
113
|
+
return {
|
|
114
|
+
dataTheme: isDarkTheme(theme) ? 'dark' : 'light',
|
|
115
|
+
style: themeToCssVars(theme),
|
|
116
|
+
theme,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/** Heuristic: is this theme's background dark? (relative luminance < 50%). */
|
|
120
|
+
function isDarkTheme(theme) {
|
|
121
|
+
const hex = theme.colors.background.replace('#', '');
|
|
122
|
+
if (hex.length < 6)
|
|
123
|
+
return false;
|
|
124
|
+
const r = Number.parseInt(hex.slice(0, 2), 16);
|
|
125
|
+
const g = Number.parseInt(hex.slice(2, 4), 16);
|
|
126
|
+
const b = Number.parseInt(hex.slice(4, 6), 16);
|
|
127
|
+
if (Number.isNaN(r + g + b))
|
|
128
|
+
return false;
|
|
129
|
+
return 0.299 * r + 0.587 * g + 0.114 * b < 128;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Standalone theme wrapper for rendering MDMA components *without* `MdmaDocument`
|
|
133
|
+
* (e.g. a lone `<MdmaBlock>`). Renders a `.mdma-theme-root` element carrying the
|
|
134
|
+
* theme so the `--mdma-*` variables cascade to everything inside. When you use
|
|
135
|
+
* `MdmaDocument`, pass `theme` to it directly instead — it themes its own root.
|
|
136
|
+
*/
|
|
137
|
+
export function MdmaThemeProvider({ theme, className, style, children }) {
|
|
138
|
+
const resolved = useMemo(() => resolveThemeProps(theme), [theme]);
|
|
139
|
+
return (_jsx("div", { className: `mdma-theme-root ${className ?? ''}`.trim(), "data-theme": resolved.dataTheme, style: { ...resolved.style, ...style }, children: _jsx(MdmaThemeContext.Provider, { value: resolved, children: children }) }));
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=MdmaThemeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MdmaThemeProvider.js","sourceRoot":"","sources":["../../src/theme/MdmaThemeProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAsC,MAAM,OAAO,CAAC;AAwC/F,sFAAsF;AACtF,MAAM,CAAC,MAAM,UAAU,GAAc;IACnC,MAAM,EAAE;QACN,UAAU,EAAE,SAAS;QACrB,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;QACpB,WAAW,EAAE,SAAS;QACtB,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,SAAS;QACpB,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,SAAS;KACrB;IACD,OA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C,CAAC,EAAE,EAAE,CAAC,CAAC;IAC/C,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC/C,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,OAAO,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC;AACjD,CAAC;AAYD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAA0B;IAC7F,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAClE,OAAO,CACL,cACE,SAAS,EAAE,mBAAmB,SAAS,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,gBAC1C,QAAQ,CAAC,SAAS,EAC9B,KAAK,EAAE,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,YAEtC,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,YAAG,QAAQ,GAA6B,GAC9E,CACP,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobile-reality/mdma-renderer-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"mdma",
|
|
6
6
|
"markdown",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"./styles.css": "./styles.css"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@mobile-reality/mdma-
|
|
24
|
-
"@mobile-reality/mdma-
|
|
23
|
+
"@mobile-reality/mdma-runtime": "0.3.1",
|
|
24
|
+
"@mobile-reality/mdma-spec": "0.3.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "^18.0.0 || ^19.0.0"
|
package/styles.css
CHANGED
|
@@ -1,7 +1,213 @@
|
|
|
1
|
+
/* ===== MDMA Theme Tokens =====
|
|
2
|
+
*
|
|
3
|
+
* Every color/radius/size below is driven by a CSS custom property so the look
|
|
4
|
+
* can be themed without touching component markup. The default values encode
|
|
5
|
+
* the built-in *light* theme, so importing this stylesheet with no theme set
|
|
6
|
+
* renders exactly as before — theming is opt-in.
|
|
7
|
+
*
|
|
8
|
+
* How the knobs are set:
|
|
9
|
+
* - No theme → these defaults apply (light).
|
|
10
|
+
* - theme="light|dark" → `data-theme` on the root swaps the palette (below).
|
|
11
|
+
* - theme="auto" → follows `prefers-color-scheme`.
|
|
12
|
+
* - a custom MdmaTheme → `MdmaThemeProvider` writes the public `--mdma-*`
|
|
13
|
+
* tokens inline on the root, overriding these.
|
|
14
|
+
*
|
|
15
|
+
* `--mdma-color-*` names ending without a `-text`/`-bg` suffix that also appear
|
|
16
|
+
* on the `MdmaTheme` TS type are the *public* tokens a custom theme can set.
|
|
17
|
+
* The rest are internal derivations that follow the light/dark palette.
|
|
18
|
+
*/
|
|
19
|
+
.mdma-document,
|
|
20
|
+
.mdma-theme-root {
|
|
21
|
+
/* Public palette (mirrors the MdmaTheme `colors` shape) */
|
|
22
|
+
--mdma-color-background: #ffffff;
|
|
23
|
+
--mdma-color-surface: #f8f9fa;
|
|
24
|
+
--mdma-color-text: #333333;
|
|
25
|
+
--mdma-color-text-muted: #666666;
|
|
26
|
+
--mdma-color-border: #e0e0e0;
|
|
27
|
+
--mdma-color-primary: #6c5ce7;
|
|
28
|
+
--mdma-color-on-primary: #ffffff;
|
|
29
|
+
--mdma-color-secondary: #dfe6e9;
|
|
30
|
+
--mdma-color-on-secondary: #2d3436;
|
|
31
|
+
--mdma-color-danger: #e74c3c;
|
|
32
|
+
--mdma-color-on-danger: #ffffff;
|
|
33
|
+
--mdma-color-info: #3498db;
|
|
34
|
+
--mdma-color-info-bg: #ebf5fb;
|
|
35
|
+
--mdma-color-warning: #f39c12;
|
|
36
|
+
--mdma-color-warning-bg: #fef9e7;
|
|
37
|
+
--mdma-color-error: #e74c3c;
|
|
38
|
+
--mdma-color-error-bg: #fdedec;
|
|
39
|
+
--mdma-color-success: #27ae60;
|
|
40
|
+
--mdma-color-success-bg: #eafaf1;
|
|
41
|
+
|
|
42
|
+
/* Internal derivations (follow the palette; not on the public TS type) */
|
|
43
|
+
--mdma-color-heading: #1a1a2e;
|
|
44
|
+
--mdma-color-text-subtle: #555555;
|
|
45
|
+
--mdma-color-border-subtle: #f0f0f0;
|
|
46
|
+
--mdma-color-primary-hover: color-mix(in srgb, var(--mdma-color-primary) 85%, #000000);
|
|
47
|
+
--mdma-color-secondary-hover: color-mix(in srgb, var(--mdma-color-secondary) 88%, #000000);
|
|
48
|
+
--mdma-color-danger-hover: color-mix(in srgb, var(--mdma-color-danger) 84%, #000000);
|
|
49
|
+
--mdma-color-input-bg: #fafafa;
|
|
50
|
+
--mdma-color-focus-ring: color-mix(in srgb, var(--mdma-color-primary) 22%, transparent);
|
|
51
|
+
--mdma-color-info-text: #1a5276;
|
|
52
|
+
--mdma-color-warning-text: #7d6608;
|
|
53
|
+
--mdma-color-error-text: #78281f;
|
|
54
|
+
--mdma-color-success-text: #1e8449;
|
|
55
|
+
--mdma-color-code-bg: #1e1e2e;
|
|
56
|
+
--mdma-color-code-text: #e0e0e0;
|
|
57
|
+
--mdma-color-inline-code-bg: #f0f0f5;
|
|
58
|
+
--mdma-color-inline-code-text: #c0392b;
|
|
59
|
+
--mdma-color-loading-bg: #ffffff;
|
|
60
|
+
--mdma-color-loading-border: #c4bfff;
|
|
61
|
+
--mdma-color-loading-accent: #6c63ff;
|
|
62
|
+
--mdma-color-loading-text: #8b82d4;
|
|
63
|
+
--mdma-color-table-header-bg: #f8f9fa;
|
|
64
|
+
--mdma-color-row-hover: #f8f9fa;
|
|
65
|
+
--mdma-color-blockquote-bg: #f8f8ff;
|
|
66
|
+
--mdma-color-chart-bg: rgba(255, 255, 255, 0.02);
|
|
67
|
+
--mdma-color-chart-border: rgba(108, 92, 231, 0.15);
|
|
68
|
+
--mdma-color-chart-label: #a29bfe;
|
|
69
|
+
--mdma-color-chart-axis: #636e72;
|
|
70
|
+
--mdma-color-chart-legend: #b2bec3;
|
|
71
|
+
--mdma-color-chart-tooltip-bg: #1a1a2e;
|
|
72
|
+
--mdma-color-unknown-bg: #fff3cd;
|
|
73
|
+
--mdma-color-unknown-border: #ffc107;
|
|
74
|
+
--mdma-color-unknown-text: #856404;
|
|
75
|
+
|
|
76
|
+
/* Radius / spacing / font-size scales (mirror the MdmaTheme numeric tokens) */
|
|
77
|
+
--mdma-radius-sm: 6px;
|
|
78
|
+
--mdma-radius-md: 10px;
|
|
79
|
+
--mdma-spacing-xs: 4px;
|
|
80
|
+
--mdma-spacing-sm: 8px;
|
|
81
|
+
--mdma-spacing-md: 12px;
|
|
82
|
+
--mdma-spacing-lg: 16px;
|
|
83
|
+
--mdma-font-size-small: 13px;
|
|
84
|
+
--mdma-font-size-body: 14px;
|
|
85
|
+
--mdma-font-size-label: 15px;
|
|
86
|
+
--mdma-font-size-title: 18px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* ===== Built-in dark palette ===== */
|
|
90
|
+
.mdma-document[data-theme="dark"],
|
|
91
|
+
.mdma-theme-root[data-theme="dark"] {
|
|
92
|
+
--mdma-color-background: #151a26;
|
|
93
|
+
--mdma-color-surface: #1c2333;
|
|
94
|
+
--mdma-color-text: #e5e7eb;
|
|
95
|
+
--mdma-color-text-muted: #9ca3af;
|
|
96
|
+
--mdma-color-border: #2a3140;
|
|
97
|
+
--mdma-color-primary: #8b7ff0;
|
|
98
|
+
--mdma-color-on-primary: #ffffff;
|
|
99
|
+
--mdma-color-secondary: #2a3140;
|
|
100
|
+
--mdma-color-on-secondary: #e5e7eb;
|
|
101
|
+
--mdma-color-danger: #ef4444;
|
|
102
|
+
--mdma-color-on-danger: #ffffff;
|
|
103
|
+
--mdma-color-info: #5dade2;
|
|
104
|
+
--mdma-color-info-bg: #16283a;
|
|
105
|
+
--mdma-color-warning: #f5b041;
|
|
106
|
+
--mdma-color-warning-bg: #2a2412;
|
|
107
|
+
--mdma-color-error: #ef4444;
|
|
108
|
+
--mdma-color-error-bg: #2a1717;
|
|
109
|
+
--mdma-color-success: #2ecc71;
|
|
110
|
+
--mdma-color-success-bg: #12251a;
|
|
111
|
+
|
|
112
|
+
--mdma-color-heading: #f3f4f6;
|
|
113
|
+
--mdma-color-text-subtle: #cbd0d8;
|
|
114
|
+
--mdma-color-border-subtle: #232a38;
|
|
115
|
+
--mdma-color-primary-hover: color-mix(in srgb, var(--mdma-color-primary) 80%, #ffffff);
|
|
116
|
+
--mdma-color-secondary-hover: color-mix(in srgb, var(--mdma-color-secondary) 78%, #ffffff);
|
|
117
|
+
--mdma-color-danger-hover: color-mix(in srgb, var(--mdma-color-danger) 80%, #ffffff);
|
|
118
|
+
--mdma-color-input-bg: #10141d;
|
|
119
|
+
--mdma-color-focus-ring: color-mix(in srgb, var(--mdma-color-primary) 35%, transparent);
|
|
120
|
+
--mdma-color-info-text: #aed6f1;
|
|
121
|
+
--mdma-color-warning-text: #f8c471;
|
|
122
|
+
--mdma-color-error-text: #f5b7b1;
|
|
123
|
+
--mdma-color-success-text: #a9dfbf;
|
|
124
|
+
--mdma-color-code-bg: #0d1017;
|
|
125
|
+
--mdma-color-code-text: #e0e0e0;
|
|
126
|
+
--mdma-color-inline-code-bg: #232a38;
|
|
127
|
+
--mdma-color-inline-code-text: #f19999;
|
|
128
|
+
--mdma-color-loading-bg: #1c2333;
|
|
129
|
+
--mdma-color-loading-border: #3a3466;
|
|
130
|
+
--mdma-color-loading-accent: #8b7ff0;
|
|
131
|
+
--mdma-color-loading-text: #a29bfe;
|
|
132
|
+
--mdma-color-table-header-bg: #1c2333;
|
|
133
|
+
--mdma-color-row-hover: #1c2333;
|
|
134
|
+
--mdma-color-blockquote-bg: #1c2333;
|
|
135
|
+
--mdma-color-chart-bg: rgba(255, 255, 255, 0.02);
|
|
136
|
+
--mdma-color-chart-border: rgba(162, 155, 254, 0.2);
|
|
137
|
+
--mdma-color-chart-label: #a29bfe;
|
|
138
|
+
--mdma-color-chart-axis: #9ca3af;
|
|
139
|
+
--mdma-color-chart-legend: #b2bec3;
|
|
140
|
+
--mdma-color-chart-tooltip-bg: #0d1017;
|
|
141
|
+
--mdma-color-unknown-bg: #2a2412;
|
|
142
|
+
--mdma-color-unknown-border: #b7950b;
|
|
143
|
+
--mdma-color-unknown-text: #f8c471;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* theme="auto" — same dark palette, gated on the OS preference. */
|
|
147
|
+
@media (prefers-color-scheme: dark) {
|
|
148
|
+
.mdma-document[data-theme="auto"],
|
|
149
|
+
.mdma-theme-root[data-theme="auto"] {
|
|
150
|
+
--mdma-color-background: #151a26;
|
|
151
|
+
--mdma-color-surface: #1c2333;
|
|
152
|
+
--mdma-color-text: #e5e7eb;
|
|
153
|
+
--mdma-color-text-muted: #9ca3af;
|
|
154
|
+
--mdma-color-border: #2a3140;
|
|
155
|
+
--mdma-color-primary: #8b7ff0;
|
|
156
|
+
--mdma-color-on-primary: #ffffff;
|
|
157
|
+
--mdma-color-secondary: #2a3140;
|
|
158
|
+
--mdma-color-on-secondary: #e5e7eb;
|
|
159
|
+
--mdma-color-danger: #ef4444;
|
|
160
|
+
--mdma-color-on-danger: #ffffff;
|
|
161
|
+
--mdma-color-info: #5dade2;
|
|
162
|
+
--mdma-color-info-bg: #16283a;
|
|
163
|
+
--mdma-color-warning: #f5b041;
|
|
164
|
+
--mdma-color-warning-bg: #2a2412;
|
|
165
|
+
--mdma-color-error: #ef4444;
|
|
166
|
+
--mdma-color-error-bg: #2a1717;
|
|
167
|
+
--mdma-color-success: #2ecc71;
|
|
168
|
+
--mdma-color-success-bg: #12251a;
|
|
169
|
+
|
|
170
|
+
--mdma-color-heading: #f3f4f6;
|
|
171
|
+
--mdma-color-text-subtle: #cbd0d8;
|
|
172
|
+
--mdma-color-border-subtle: #232a38;
|
|
173
|
+
--mdma-color-primary-hover: color-mix(in srgb, var(--mdma-color-primary) 80%, #ffffff);
|
|
174
|
+
--mdma-color-secondary-hover: color-mix(in srgb, var(--mdma-color-secondary) 78%, #ffffff);
|
|
175
|
+
--mdma-color-danger-hover: color-mix(in srgb, var(--mdma-color-danger) 80%, #ffffff);
|
|
176
|
+
--mdma-color-input-bg: #10141d;
|
|
177
|
+
--mdma-color-focus-ring: color-mix(in srgb, var(--mdma-color-primary) 35%, transparent);
|
|
178
|
+
--mdma-color-info-text: #aed6f1;
|
|
179
|
+
--mdma-color-warning-text: #f8c471;
|
|
180
|
+
--mdma-color-error-text: #f5b7b1;
|
|
181
|
+
--mdma-color-success-text: #a9dfbf;
|
|
182
|
+
--mdma-color-code-bg: #0d1017;
|
|
183
|
+
--mdma-color-code-text: #e0e0e0;
|
|
184
|
+
--mdma-color-inline-code-bg: #232a38;
|
|
185
|
+
--mdma-color-inline-code-text: #f19999;
|
|
186
|
+
--mdma-color-loading-bg: #1c2333;
|
|
187
|
+
--mdma-color-loading-border: #3a3466;
|
|
188
|
+
--mdma-color-loading-accent: #8b7ff0;
|
|
189
|
+
--mdma-color-loading-text: #a29bfe;
|
|
190
|
+
--mdma-color-table-header-bg: #1c2333;
|
|
191
|
+
--mdma-color-row-hover: #1c2333;
|
|
192
|
+
--mdma-color-blockquote-bg: #1c2333;
|
|
193
|
+
--mdma-color-chart-bg: rgba(255, 255, 255, 0.02);
|
|
194
|
+
--mdma-color-chart-border: rgba(162, 155, 254, 0.2);
|
|
195
|
+
--mdma-color-chart-label: #a29bfe;
|
|
196
|
+
--mdma-color-chart-axis: #9ca3af;
|
|
197
|
+
--mdma-color-chart-legend: #b2bec3;
|
|
198
|
+
--mdma-color-chart-tooltip-bg: #0d1017;
|
|
199
|
+
--mdma-color-unknown-bg: #2a2412;
|
|
200
|
+
--mdma-color-unknown-border: #b7950b;
|
|
201
|
+
--mdma-color-unknown-text: #f8c471;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
1
205
|
/* ===== MDMA Document ===== */
|
|
2
206
|
.mdma-document {
|
|
3
207
|
max-width: 720px;
|
|
4
208
|
margin: 0 auto;
|
|
209
|
+
color: var(--mdma-color-text);
|
|
210
|
+
font-size: var(--mdma-font-size-body);
|
|
5
211
|
}
|
|
6
212
|
|
|
7
213
|
/* ===== Entrance animation for all MDMA children ===== */
|
|
@@ -35,9 +241,9 @@
|
|
|
35
241
|
.mdma-block-loading {
|
|
36
242
|
position: relative;
|
|
37
243
|
overflow: hidden;
|
|
38
|
-
background:
|
|
39
|
-
border: 1px dashed
|
|
40
|
-
border-radius:
|
|
244
|
+
background: var(--mdma-color-loading-bg);
|
|
245
|
+
border: 1px dashed var(--mdma-color-loading-border);
|
|
246
|
+
border-radius: var(--mdma-radius-md);
|
|
41
247
|
padding: 28px 24px;
|
|
42
248
|
margin-bottom: 20px;
|
|
43
249
|
min-height: 80px;
|
|
@@ -75,7 +281,7 @@
|
|
|
75
281
|
display: flex;
|
|
76
282
|
align-items: center;
|
|
77
283
|
gap: 10px;
|
|
78
|
-
color:
|
|
284
|
+
color: var(--mdma-color-loading-text);
|
|
79
285
|
font-size: 13px;
|
|
80
286
|
}
|
|
81
287
|
|
|
@@ -83,7 +289,7 @@
|
|
|
83
289
|
width: 18px;
|
|
84
290
|
height: 18px;
|
|
85
291
|
border: 2px solid rgba(108, 99, 255, 0.2);
|
|
86
|
-
border-top-color:
|
|
292
|
+
border-top-color: var(--mdma-color-loading-accent);
|
|
87
293
|
border-radius: 50%;
|
|
88
294
|
animation: mdma-spin 0.8s linear infinite;
|
|
89
295
|
}
|
|
@@ -136,7 +342,7 @@
|
|
|
136
342
|
margin: 16px 0 8px;
|
|
137
343
|
font-weight: 600;
|
|
138
344
|
line-height: 1.3;
|
|
139
|
-
color:
|
|
345
|
+
color: var(--mdma-color-heading);
|
|
140
346
|
}
|
|
141
347
|
|
|
142
348
|
.mdma-markdown-content h1 {
|
|
@@ -178,9 +384,9 @@
|
|
|
178
384
|
.mdma-markdown-content blockquote {
|
|
179
385
|
margin: 0 0 10px;
|
|
180
386
|
padding: 8px 16px;
|
|
181
|
-
border-left: 3px solid
|
|
182
|
-
background:
|
|
183
|
-
color:
|
|
387
|
+
border-left: 3px solid var(--mdma-color-primary);
|
|
388
|
+
background: var(--mdma-color-blockquote-bg);
|
|
389
|
+
color: var(--mdma-color-text-subtle);
|
|
184
390
|
}
|
|
185
391
|
|
|
186
392
|
.mdma-markdown-content blockquote p:last-child {
|
|
@@ -190,9 +396,9 @@
|
|
|
190
396
|
.mdma-markdown-content pre.mdast-code-block {
|
|
191
397
|
margin: 0 0 10px;
|
|
192
398
|
padding: 12px 16px;
|
|
193
|
-
background:
|
|
194
|
-
color:
|
|
195
|
-
border-radius:
|
|
399
|
+
background: var(--mdma-color-code-bg);
|
|
400
|
+
color: var(--mdma-color-code-text);
|
|
401
|
+
border-radius: var(--mdma-radius-sm);
|
|
196
402
|
overflow-x: auto;
|
|
197
403
|
font-size: 13px;
|
|
198
404
|
line-height: 1.5;
|
|
@@ -206,21 +412,21 @@
|
|
|
206
412
|
}
|
|
207
413
|
|
|
208
414
|
.mdma-markdown-content code.mdast-inline-code {
|
|
209
|
-
background:
|
|
415
|
+
background: var(--mdma-color-inline-code-bg);
|
|
210
416
|
padding: 2px 6px;
|
|
211
417
|
border-radius: 3px;
|
|
212
418
|
font-size: 0.9em;
|
|
213
|
-
color:
|
|
419
|
+
color: var(--mdma-color-inline-code-text);
|
|
214
420
|
}
|
|
215
421
|
|
|
216
422
|
.mdma-markdown-content hr {
|
|
217
423
|
margin: 16px 0;
|
|
218
424
|
border: none;
|
|
219
|
-
border-top: 1px solid
|
|
425
|
+
border-top: 1px solid var(--mdma-color-border);
|
|
220
426
|
}
|
|
221
427
|
|
|
222
428
|
.mdma-markdown-content a {
|
|
223
|
-
color:
|
|
429
|
+
color: var(--mdma-color-primary);
|
|
224
430
|
text-decoration: none;
|
|
225
431
|
}
|
|
226
432
|
|
|
@@ -231,7 +437,7 @@
|
|
|
231
437
|
.mdma-markdown-content img {
|
|
232
438
|
max-width: 100%;
|
|
233
439
|
height: auto;
|
|
234
|
-
border-radius:
|
|
440
|
+
border-radius: var(--mdma-radius-sm);
|
|
235
441
|
}
|
|
236
442
|
|
|
237
443
|
.mdma-markdown-content table.mdast-table {
|
|
@@ -244,17 +450,17 @@
|
|
|
244
450
|
.mdma-markdown-content table.mdast-table th,
|
|
245
451
|
.mdma-markdown-content table.mdast-table td {
|
|
246
452
|
padding: 8px 12px;
|
|
247
|
-
border: 1px solid
|
|
453
|
+
border: 1px solid var(--mdma-color-border);
|
|
248
454
|
text-align: left;
|
|
249
455
|
}
|
|
250
456
|
|
|
251
457
|
.mdma-markdown-content table.mdast-table th {
|
|
252
|
-
background:
|
|
458
|
+
background: var(--mdma-color-table-header-bg);
|
|
253
459
|
font-weight: 600;
|
|
254
460
|
}
|
|
255
461
|
|
|
256
462
|
.mdma-markdown-content table.mdast-table tbody tr:hover {
|
|
257
|
-
background:
|
|
463
|
+
background: var(--mdma-color-row-hover);
|
|
258
464
|
}
|
|
259
465
|
|
|
260
466
|
.mdma-markdown-content strong {
|
|
@@ -267,35 +473,35 @@
|
|
|
267
473
|
|
|
268
474
|
.mdma-markdown-content del {
|
|
269
475
|
text-decoration: line-through;
|
|
270
|
-
color:
|
|
476
|
+
color: var(--mdma-color-text-muted);
|
|
271
477
|
}
|
|
272
478
|
|
|
273
479
|
/* ===== Form ===== */
|
|
274
480
|
.mdma-form {
|
|
275
|
-
background:
|
|
276
|
-
border: 1px solid
|
|
277
|
-
border-radius:
|
|
481
|
+
background: var(--mdma-color-background);
|
|
482
|
+
border: 1px solid var(--mdma-color-border);
|
|
483
|
+
border-radius: var(--mdma-radius-md);
|
|
278
484
|
padding: 24px;
|
|
279
485
|
margin-bottom: 20px;
|
|
280
486
|
}
|
|
281
487
|
|
|
282
488
|
.mdma-form-label {
|
|
283
|
-
font-size:
|
|
489
|
+
font-size: var(--mdma-font-size-title);
|
|
284
490
|
font-weight: 600;
|
|
285
491
|
margin-bottom: 16px;
|
|
286
|
-
color:
|
|
492
|
+
color: var(--mdma-color-heading);
|
|
287
493
|
}
|
|
288
494
|
|
|
289
495
|
.mdma-form-field {
|
|
290
|
-
margin-bottom:
|
|
496
|
+
margin-bottom: var(--mdma-spacing-lg);
|
|
291
497
|
}
|
|
292
498
|
|
|
293
499
|
.mdma-form-field label {
|
|
294
500
|
display: block;
|
|
295
501
|
font-size: 13px;
|
|
296
502
|
font-weight: 600;
|
|
297
|
-
color:
|
|
298
|
-
margin-bottom:
|
|
503
|
+
color: var(--mdma-color-text-subtle);
|
|
504
|
+
margin-bottom: var(--mdma-spacing-xs);
|
|
299
505
|
}
|
|
300
506
|
|
|
301
507
|
.mdma-form-field input[type="text"],
|
|
@@ -308,10 +514,10 @@
|
|
|
308
514
|
width: 100%;
|
|
309
515
|
padding: 8px 12px;
|
|
310
516
|
font-size: 14px;
|
|
311
|
-
border: 1px solid
|
|
312
|
-
border-radius:
|
|
313
|
-
background:
|
|
314
|
-
color:
|
|
517
|
+
border: 1px solid var(--mdma-color-border);
|
|
518
|
+
border-radius: var(--mdma-radius-sm);
|
|
519
|
+
background: var(--mdma-color-input-bg);
|
|
520
|
+
color: var(--mdma-color-text);
|
|
315
521
|
transition: border-color 0.15s, box-shadow 0.15s;
|
|
316
522
|
outline: none;
|
|
317
523
|
}
|
|
@@ -319,8 +525,8 @@
|
|
|
319
525
|
.mdma-form-field input:focus,
|
|
320
526
|
.mdma-form-field select:focus,
|
|
321
527
|
.mdma-form-field textarea:focus {
|
|
322
|
-
border-color:
|
|
323
|
-
box-shadow: 0 0 0 3px
|
|
528
|
+
border-color: var(--mdma-color-primary);
|
|
529
|
+
box-shadow: 0 0 0 3px var(--mdma-color-focus-ring);
|
|
324
530
|
}
|
|
325
531
|
|
|
326
532
|
.mdma-form-field textarea {
|
|
@@ -331,7 +537,7 @@
|
|
|
331
537
|
.mdma-form-field input[type="checkbox"] {
|
|
332
538
|
width: auto;
|
|
333
539
|
margin-right: 8px;
|
|
334
|
-
accent-color:
|
|
540
|
+
accent-color: var(--mdma-color-primary);
|
|
335
541
|
}
|
|
336
542
|
|
|
337
543
|
.mdma-form-submit {
|
|
@@ -339,16 +545,16 @@
|
|
|
339
545
|
padding: 8px 20px;
|
|
340
546
|
font-size: 14px;
|
|
341
547
|
font-weight: 600;
|
|
342
|
-
color:
|
|
343
|
-
background:
|
|
548
|
+
color: var(--mdma-color-on-primary);
|
|
549
|
+
background: var(--mdma-color-primary);
|
|
344
550
|
border: none;
|
|
345
|
-
border-radius:
|
|
551
|
+
border-radius: var(--mdma-radius-sm);
|
|
346
552
|
cursor: pointer;
|
|
347
553
|
transition: background 0.15s;
|
|
348
554
|
}
|
|
349
555
|
|
|
350
556
|
.mdma-form-submit:hover {
|
|
351
|
-
background:
|
|
557
|
+
background: var(--mdma-color-primary-hover);
|
|
352
558
|
}
|
|
353
559
|
|
|
354
560
|
/* ===== Button ===== */
|
|
@@ -358,7 +564,7 @@
|
|
|
358
564
|
font-size: 14px;
|
|
359
565
|
font-weight: 600;
|
|
360
566
|
border: none;
|
|
361
|
-
border-radius:
|
|
567
|
+
border-radius: var(--mdma-radius-sm);
|
|
362
568
|
cursor: pointer;
|
|
363
569
|
transition: background 0.15s, transform 0.1s;
|
|
364
570
|
margin-bottom: 20px;
|
|
@@ -369,46 +575,46 @@
|
|
|
369
575
|
}
|
|
370
576
|
|
|
371
577
|
.mdma-button--primary {
|
|
372
|
-
background:
|
|
373
|
-
color:
|
|
578
|
+
background: var(--mdma-color-primary);
|
|
579
|
+
color: var(--mdma-color-on-primary);
|
|
374
580
|
}
|
|
375
581
|
|
|
376
582
|
.mdma-button--primary:hover {
|
|
377
|
-
background:
|
|
583
|
+
background: var(--mdma-color-primary-hover);
|
|
378
584
|
}
|
|
379
585
|
|
|
380
586
|
.mdma-button--secondary {
|
|
381
|
-
background:
|
|
382
|
-
color:
|
|
587
|
+
background: var(--mdma-color-secondary);
|
|
588
|
+
color: var(--mdma-color-on-secondary);
|
|
383
589
|
}
|
|
384
590
|
|
|
385
591
|
.mdma-button--secondary:hover {
|
|
386
|
-
background:
|
|
592
|
+
background: var(--mdma-color-secondary-hover);
|
|
387
593
|
}
|
|
388
594
|
|
|
389
595
|
.mdma-button--danger {
|
|
390
|
-
background:
|
|
391
|
-
color:
|
|
596
|
+
background: var(--mdma-color-danger);
|
|
597
|
+
color: var(--mdma-color-on-danger);
|
|
392
598
|
}
|
|
393
599
|
|
|
394
600
|
.mdma-button--danger:hover {
|
|
395
|
-
background:
|
|
601
|
+
background: var(--mdma-color-danger-hover);
|
|
396
602
|
}
|
|
397
603
|
|
|
398
604
|
/* ===== Tasklist ===== */
|
|
399
605
|
.mdma-tasklist {
|
|
400
|
-
background:
|
|
401
|
-
border: 1px solid
|
|
402
|
-
border-radius:
|
|
606
|
+
background: var(--mdma-color-background);
|
|
607
|
+
border: 1px solid var(--mdma-color-border);
|
|
608
|
+
border-radius: var(--mdma-radius-md);
|
|
403
609
|
padding: 24px;
|
|
404
610
|
margin-bottom: 20px;
|
|
405
611
|
}
|
|
406
612
|
|
|
407
613
|
.mdma-tasklist-label {
|
|
408
|
-
font-size:
|
|
614
|
+
font-size: var(--mdma-font-size-title);
|
|
409
615
|
font-weight: 600;
|
|
410
616
|
margin-bottom: 12px;
|
|
411
|
-
color:
|
|
617
|
+
color: var(--mdma-color-heading);
|
|
412
618
|
}
|
|
413
619
|
|
|
414
620
|
.mdma-tasklist-items {
|
|
@@ -417,7 +623,7 @@
|
|
|
417
623
|
|
|
418
624
|
.mdma-tasklist-item {
|
|
419
625
|
padding: 8px 0;
|
|
420
|
-
border-bottom: 1px solid
|
|
626
|
+
border-bottom: 1px solid var(--mdma-color-border-subtle);
|
|
421
627
|
}
|
|
422
628
|
|
|
423
629
|
.mdma-tasklist-item:last-child {
|
|
@@ -430,35 +636,35 @@
|
|
|
430
636
|
gap: 8px;
|
|
431
637
|
cursor: pointer;
|
|
432
638
|
font-size: 14px;
|
|
433
|
-
color:
|
|
639
|
+
color: var(--mdma-color-text);
|
|
434
640
|
}
|
|
435
641
|
|
|
436
642
|
.mdma-tasklist-item input[type="checkbox"] {
|
|
437
|
-
accent-color:
|
|
643
|
+
accent-color: var(--mdma-color-primary);
|
|
438
644
|
width: 16px;
|
|
439
645
|
height: 16px;
|
|
440
646
|
}
|
|
441
647
|
|
|
442
648
|
.mdma-tasklist-item input[type="checkbox"]:checked + span {
|
|
443
649
|
text-decoration: line-through;
|
|
444
|
-
color:
|
|
650
|
+
color: var(--mdma-color-text-muted);
|
|
445
651
|
}
|
|
446
652
|
|
|
447
653
|
/* ===== Table ===== */
|
|
448
654
|
.mdma-table {
|
|
449
|
-
background:
|
|
450
|
-
border: 1px solid
|
|
451
|
-
border-radius:
|
|
655
|
+
background: var(--mdma-color-background);
|
|
656
|
+
border: 1px solid var(--mdma-color-border);
|
|
657
|
+
border-radius: var(--mdma-radius-md);
|
|
452
658
|
padding: 24px;
|
|
453
659
|
margin-bottom: 20px;
|
|
454
660
|
overflow-x: auto;
|
|
455
661
|
}
|
|
456
662
|
|
|
457
663
|
.mdma-table-label {
|
|
458
|
-
font-size:
|
|
664
|
+
font-size: var(--mdma-font-size-title);
|
|
459
665
|
font-weight: 600;
|
|
460
666
|
margin-bottom: 12px;
|
|
461
|
-
color:
|
|
667
|
+
color: var(--mdma-color-heading);
|
|
462
668
|
}
|
|
463
669
|
|
|
464
670
|
.mdma-table table {
|
|
@@ -473,32 +679,32 @@
|
|
|
473
679
|
font-weight: 600;
|
|
474
680
|
text-transform: uppercase;
|
|
475
681
|
letter-spacing: 0.5px;
|
|
476
|
-
color:
|
|
477
|
-
background:
|
|
478
|
-
border-bottom: 2px solid
|
|
682
|
+
color: var(--mdma-color-text-muted);
|
|
683
|
+
background: var(--mdma-color-table-header-bg);
|
|
684
|
+
border-bottom: 2px solid var(--mdma-color-border);
|
|
479
685
|
}
|
|
480
686
|
|
|
481
687
|
.mdma-table td {
|
|
482
688
|
padding: 10px 12px;
|
|
483
689
|
font-size: 14px;
|
|
484
|
-
border-bottom: 1px solid
|
|
485
|
-
color:
|
|
690
|
+
border-bottom: 1px solid var(--mdma-color-border-subtle);
|
|
691
|
+
color: var(--mdma-color-text);
|
|
486
692
|
}
|
|
487
693
|
|
|
488
694
|
.mdma-table tr:hover td {
|
|
489
|
-
background:
|
|
695
|
+
background: var(--mdma-color-row-hover);
|
|
490
696
|
}
|
|
491
697
|
|
|
492
698
|
.mdma-table-empty {
|
|
493
699
|
text-align: center;
|
|
494
700
|
padding: 20px;
|
|
495
|
-
color:
|
|
701
|
+
color: var(--mdma-color-text-muted);
|
|
496
702
|
font-style: italic;
|
|
497
703
|
}
|
|
498
704
|
|
|
499
705
|
/* ===== Callout ===== */
|
|
500
706
|
.mdma-callout {
|
|
501
|
-
border-radius:
|
|
707
|
+
border-radius: var(--mdma-radius-md);
|
|
502
708
|
padding: 16px 20px;
|
|
503
709
|
margin-bottom: 20px;
|
|
504
710
|
position: relative;
|
|
@@ -506,27 +712,27 @@
|
|
|
506
712
|
}
|
|
507
713
|
|
|
508
714
|
.mdma-callout--info {
|
|
509
|
-
background:
|
|
510
|
-
border-left-color:
|
|
511
|
-
color:
|
|
715
|
+
background: var(--mdma-color-info-bg);
|
|
716
|
+
border-left-color: var(--mdma-color-info);
|
|
717
|
+
color: var(--mdma-color-info-text);
|
|
512
718
|
}
|
|
513
719
|
|
|
514
720
|
.mdma-callout--warning {
|
|
515
|
-
background:
|
|
516
|
-
border-left-color:
|
|
517
|
-
color:
|
|
721
|
+
background: var(--mdma-color-warning-bg);
|
|
722
|
+
border-left-color: var(--mdma-color-warning);
|
|
723
|
+
color: var(--mdma-color-warning-text);
|
|
518
724
|
}
|
|
519
725
|
|
|
520
726
|
.mdma-callout--error {
|
|
521
|
-
background:
|
|
522
|
-
border-left-color:
|
|
523
|
-
color:
|
|
727
|
+
background: var(--mdma-color-error-bg);
|
|
728
|
+
border-left-color: var(--mdma-color-error);
|
|
729
|
+
color: var(--mdma-color-error-text);
|
|
524
730
|
}
|
|
525
731
|
|
|
526
732
|
.mdma-callout--success {
|
|
527
|
-
background:
|
|
528
|
-
border-left-color:
|
|
529
|
-
color:
|
|
733
|
+
background: var(--mdma-color-success-bg);
|
|
734
|
+
border-left-color: var(--mdma-color-success);
|
|
735
|
+
color: var(--mdma-color-success-text);
|
|
530
736
|
}
|
|
531
737
|
|
|
532
738
|
.mdma-callout-title {
|
|
@@ -559,43 +765,43 @@
|
|
|
559
765
|
|
|
560
766
|
/* ===== Approval Gate ===== */
|
|
561
767
|
.mdma-approval-gate {
|
|
562
|
-
background:
|
|
563
|
-
border: 2px solid
|
|
564
|
-
border-radius:
|
|
768
|
+
background: var(--mdma-color-background);
|
|
769
|
+
border: 2px solid var(--mdma-color-border);
|
|
770
|
+
border-radius: var(--mdma-radius-md);
|
|
565
771
|
padding: 24px;
|
|
566
772
|
margin-bottom: 20px;
|
|
567
773
|
}
|
|
568
774
|
|
|
569
775
|
.mdma-approval-gate--pending {
|
|
570
|
-
border-color:
|
|
776
|
+
border-color: var(--mdma-color-warning);
|
|
571
777
|
}
|
|
572
778
|
|
|
573
779
|
.mdma-approval-gate--approved {
|
|
574
|
-
border-color:
|
|
575
|
-
background:
|
|
780
|
+
border-color: var(--mdma-color-success);
|
|
781
|
+
background: var(--mdma-color-success-bg);
|
|
576
782
|
}
|
|
577
783
|
|
|
578
784
|
.mdma-approval-gate--denied {
|
|
579
|
-
border-color:
|
|
580
|
-
background:
|
|
785
|
+
border-color: var(--mdma-color-error);
|
|
786
|
+
background: var(--mdma-color-error-bg);
|
|
581
787
|
}
|
|
582
788
|
|
|
583
789
|
.mdma-approval-gate-title {
|
|
584
790
|
font-size: 16px;
|
|
585
791
|
font-weight: 600;
|
|
586
792
|
margin-bottom: 8px;
|
|
587
|
-
color:
|
|
793
|
+
color: var(--mdma-color-heading);
|
|
588
794
|
}
|
|
589
795
|
|
|
590
796
|
.mdma-approval-gate-description {
|
|
591
797
|
font-size: 14px;
|
|
592
|
-
color:
|
|
798
|
+
color: var(--mdma-color-text-subtle);
|
|
593
799
|
margin-bottom: 12px;
|
|
594
800
|
}
|
|
595
801
|
|
|
596
802
|
.mdma-approval-gate-status {
|
|
597
803
|
font-size: 13px;
|
|
598
|
-
color:
|
|
804
|
+
color: var(--mdma-color-text-muted);
|
|
599
805
|
margin-bottom: 16px;
|
|
600
806
|
}
|
|
601
807
|
|
|
@@ -605,13 +811,13 @@
|
|
|
605
811
|
}
|
|
606
812
|
|
|
607
813
|
.mdma-approval-gate--pending .mdma-approval-gate-status strong {
|
|
608
|
-
color:
|
|
814
|
+
color: var(--mdma-color-warning);
|
|
609
815
|
}
|
|
610
816
|
.mdma-approval-gate--approved .mdma-approval-gate-status strong {
|
|
611
|
-
color:
|
|
817
|
+
color: var(--mdma-color-success);
|
|
612
818
|
}
|
|
613
819
|
.mdma-approval-gate--denied .mdma-approval-gate-status strong {
|
|
614
|
-
color:
|
|
820
|
+
color: var(--mdma-color-error);
|
|
615
821
|
}
|
|
616
822
|
|
|
617
823
|
.mdma-approval-gate-actions {
|
|
@@ -625,8 +831,8 @@
|
|
|
625
831
|
align-items: center;
|
|
626
832
|
gap: 10px;
|
|
627
833
|
padding: 12px 16px;
|
|
628
|
-
background:
|
|
629
|
-
border: 1px solid
|
|
834
|
+
background: var(--mdma-color-background);
|
|
835
|
+
border: 1px solid var(--mdma-color-border);
|
|
630
836
|
border-radius: 8px;
|
|
631
837
|
margin-bottom: 20px;
|
|
632
838
|
font-size: 13px;
|
|
@@ -634,7 +840,7 @@
|
|
|
634
840
|
|
|
635
841
|
.mdma-webhook-label {
|
|
636
842
|
font-weight: 600;
|
|
637
|
-
color:
|
|
843
|
+
color: var(--mdma-color-text);
|
|
638
844
|
}
|
|
639
845
|
|
|
640
846
|
.mdma-webhook-status {
|
|
@@ -645,8 +851,8 @@
|
|
|
645
851
|
}
|
|
646
852
|
|
|
647
853
|
.mdma-webhook-status--idle {
|
|
648
|
-
background:
|
|
649
|
-
color:
|
|
854
|
+
background: var(--mdma-color-surface);
|
|
855
|
+
color: var(--mdma-color-text-muted);
|
|
650
856
|
}
|
|
651
857
|
.mdma-webhook-status--executing {
|
|
652
858
|
background: #ffeaa7;
|
|
@@ -664,17 +870,17 @@
|
|
|
664
870
|
/* ===== Unknown Component ===== */
|
|
665
871
|
.mdma-unknown-component {
|
|
666
872
|
padding: 12px 16px;
|
|
667
|
-
background:
|
|
668
|
-
border: 1px solid
|
|
873
|
+
background: var(--mdma-color-unknown-bg);
|
|
874
|
+
border: 1px solid var(--mdma-color-unknown-border);
|
|
669
875
|
border-radius: 8px;
|
|
670
|
-
color:
|
|
876
|
+
color: var(--mdma-color-unknown-text);
|
|
671
877
|
font-size: 13px;
|
|
672
878
|
margin-bottom: 20px;
|
|
673
879
|
}
|
|
674
880
|
|
|
675
881
|
.mdma-chart {
|
|
676
|
-
background:
|
|
677
|
-
border: 1px solid
|
|
882
|
+
background: var(--mdma-color-chart-bg);
|
|
883
|
+
border: 1px solid var(--mdma-color-chart-border);
|
|
678
884
|
border-radius: 14px;
|
|
679
885
|
padding: 18px;
|
|
680
886
|
margin-bottom: 20px;
|
|
@@ -684,7 +890,7 @@
|
|
|
684
890
|
.mdma-chart-label {
|
|
685
891
|
font-size: 14px;
|
|
686
892
|
font-weight: 700;
|
|
687
|
-
color:
|
|
893
|
+
color: var(--mdma-color-chart-label);
|
|
688
894
|
margin-bottom: 12px;
|
|
689
895
|
}
|
|
690
896
|
|
|
@@ -699,32 +905,32 @@
|
|
|
699
905
|
display: flex;
|
|
700
906
|
align-items: center;
|
|
701
907
|
justify-content: center;
|
|
702
|
-
color:
|
|
908
|
+
color: var(--mdma-color-text-muted);
|
|
703
909
|
font-size: 13px;
|
|
704
910
|
font-style: italic;
|
|
705
911
|
}
|
|
706
912
|
|
|
707
913
|
/* recharts overrides for MDMA theme */
|
|
708
914
|
.mdma-chart .recharts-text {
|
|
709
|
-
fill:
|
|
915
|
+
fill: var(--mdma-color-chart-axis);
|
|
710
916
|
}
|
|
711
917
|
|
|
712
918
|
.mdma-chart .recharts-legend-item-text {
|
|
713
|
-
color:
|
|
919
|
+
color: var(--mdma-color-chart-legend) !important;
|
|
714
920
|
font-size: 12px;
|
|
715
921
|
}
|
|
716
922
|
|
|
717
923
|
.mdma-chart .recharts-default-tooltip {
|
|
718
|
-
background:
|
|
924
|
+
background: var(--mdma-color-chart-tooltip-bg) !important;
|
|
719
925
|
border: 1px solid rgba(162, 155, 254, 0.3) !important;
|
|
720
926
|
border-radius: 8px !important;
|
|
721
927
|
}
|
|
722
928
|
/* ─── Thinking Component (basic) ─────────────────────────────────────────── */
|
|
723
929
|
|
|
724
930
|
.mdma-thinking {
|
|
725
|
-
background:
|
|
726
|
-
border: 1px solid
|
|
727
|
-
border-radius:
|
|
931
|
+
background: var(--mdma-color-background);
|
|
932
|
+
border: 1px solid var(--mdma-color-border);
|
|
933
|
+
border-radius: var(--mdma-radius-md);
|
|
728
934
|
margin: 16px 0;
|
|
729
935
|
overflow: hidden;
|
|
730
936
|
}
|
|
@@ -737,7 +943,7 @@
|
|
|
737
943
|
cursor: pointer;
|
|
738
944
|
font-size: 14px;
|
|
739
945
|
font-weight: 600;
|
|
740
|
-
color:
|
|
946
|
+
color: var(--mdma-color-text-subtle);
|
|
741
947
|
user-select: none;
|
|
742
948
|
list-style: none;
|
|
743
949
|
}
|
|
@@ -751,7 +957,7 @@
|
|
|
751
957
|
font-size: 10px;
|
|
752
958
|
margin-left: auto;
|
|
753
959
|
transition: transform 0.2s;
|
|
754
|
-
color:
|
|
960
|
+
color: var(--mdma-color-text-muted);
|
|
755
961
|
}
|
|
756
962
|
|
|
757
963
|
.mdma-thinking[open] .mdma-thinking-summary::after {
|
|
@@ -763,7 +969,7 @@
|
|
|
763
969
|
width: 8px;
|
|
764
970
|
height: 8px;
|
|
765
971
|
border-radius: 50%;
|
|
766
|
-
background:
|
|
972
|
+
background: var(--mdma-color-primary);
|
|
767
973
|
animation: mdma-thinking-pulse 1.5s ease-in-out infinite;
|
|
768
974
|
}
|
|
769
975
|
|
|
@@ -787,8 +993,8 @@
|
|
|
787
993
|
padding: 0 16px 16px;
|
|
788
994
|
font-size: 13px;
|
|
789
995
|
line-height: 1.6;
|
|
790
|
-
color:
|
|
996
|
+
color: var(--mdma-color-text-subtle);
|
|
791
997
|
white-space: pre-wrap;
|
|
792
|
-
border-top: 1px solid
|
|
998
|
+
border-top: 1px solid var(--mdma-color-border-subtle);
|
|
793
999
|
padding-top: 12px;
|
|
794
1000
|
}
|