dash-core-components 4.5.3 → 4.5.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/dash_core_components/async-datepicker.js +1 -1
- package/dash_core_components/async-datepicker.js.map +1 -1
- package/dash_core_components/async-dropdown.js +1 -1
- package/dash_core_components/async-dropdown.js.map +1 -1
- package/dash_core_components/async-graph.js +1 -1
- package/dash_core_components/async-graph.js.map +1 -1
- package/dash_core_components/async-highlight.js +1 -1
- package/dash_core_components/async-highlight.js.map +1 -1
- package/dash_core_components/async-markdown.js +1 -2
- package/dash_core_components/async-markdown.js.map +1 -1
- package/dash_core_components/async-slider.js +1 -1
- package/dash_core_components/async-slider.js.map +1 -1
- package/dash_core_components/async-upload.js +1 -1
- package/dash_core_components/async-upload.js.map +1 -1
- package/dash_core_components/dash_core_components-shared.js +1 -1
- package/dash_core_components/dash_core_components-shared.js.map +1 -1
- package/dash_core_components/dash_core_components.js +1 -1
- package/dash_core_components/dash_core_components.js.map +1 -1
- package/dash_core_components/proptypes.js +1 -1
- package/lib/components/Clipboard.react.js +4 -3
- package/lib/components/ConfirmDialog.react.js +1 -1
- package/lib/components/ConfirmDialogProvider.react.js +1 -1
- package/lib/components/Download.react.js +1 -1
- package/lib/components/Geolocation.react.js +2 -2
- package/lib/components/Graph.react.js +3 -2
- package/lib/components/Input.tsx +2 -2
- package/lib/components/Interval.react.js +3 -2
- package/lib/components/Location.react.js +1 -1
- package/lib/components/Store.react.js +1 -1
- package/lib/components/Upload.react.js +5 -3
- package/lib/components/css/dropdown.css +2 -0
- package/lib/fragments/Graph.react.js +245 -30
- package/lib/fragments/Markdown.tsx +16 -2
- package/lib/fragments/Upload.react.js +4 -3
- package/lib/types.ts +1 -0
- package/lib/utils/LoadingElement.js +1 -1
- package/lib/utils/ResizeDetector.js +2 -2
- package/lib/utils/markdown/components/Code.tsx +2 -2
- package/lib/utils/markdown/components/types.ts +1 -2
- package/lib/utils/markdown/plugins/index.ts +8 -0
- package/lib/utils/markdown/plugins/rehypeBlockCode.ts +25 -0
- package/lib/utils/markdown/plugins/rehypeDashMath.ts +15 -2
- package/lib/utils/markdown/plugins/rehypeLinkTarget.ts +15 -0
- package/lib/utils/markdown/polyfills.ts +24 -0
- package/package.json +6 -6
|
@@ -24,8 +24,9 @@ function rewriteRawMath(value: string): string {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
// remark-math emits `<
|
|
28
|
-
// math-display">`; report which (if either)
|
|
27
|
+
// remark-math emits `<code class="language-math math-inline">` and
|
|
28
|
+
// `<pre><code class="language-math math-display">`; report which (if either)
|
|
29
|
+
// an element is.
|
|
29
30
|
function mathKind(node: Element): 'inline' | 'display' | null {
|
|
30
31
|
const className = node.properties?.className;
|
|
31
32
|
if (Array.isArray(className)) {
|
|
@@ -55,6 +56,18 @@ const rehypeDashMath: Plugin<[], Root> = () => tree => {
|
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
58
|
if (node.type === 'element') {
|
|
59
|
+
const [first] = node.children;
|
|
60
|
+
if (
|
|
61
|
+
node.tagName === 'pre' &&
|
|
62
|
+
node.children.length === 1 &&
|
|
63
|
+
first.type === 'element' &&
|
|
64
|
+
mathKind(first) === 'display'
|
|
65
|
+
) {
|
|
66
|
+
node.tagName = 'dashmathjax';
|
|
67
|
+
node.properties = {inline: 'false'};
|
|
68
|
+
node.children = first.children;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
58
71
|
const kind = mathKind(node);
|
|
59
72
|
if (kind) {
|
|
60
73
|
node.tagName = 'dashmathjax';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type {Plugin} from 'unified';
|
|
2
|
+
import type {Root} from 'hast';
|
|
3
|
+
import {visit} from 'unist-util-visit';
|
|
4
|
+
|
|
5
|
+
// Sets `target` on every link, including raw-HTML ones. Replaces the
|
|
6
|
+
// `linkTarget` option react-markdown dropped in v9.
|
|
7
|
+
const rehypeLinkTarget: Plugin<[string], Root> = target => tree => {
|
|
8
|
+
visit(tree, 'element', node => {
|
|
9
|
+
if (node.tagName === 'a') {
|
|
10
|
+
node.properties.target = target;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default rehypeLinkTarget;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// The react-markdown 10 stack calls these at render time. They need Safari 15.4
|
|
2
|
+
// / Chrome 93, newer than our browserslist floor, and babel does not polyfill
|
|
3
|
+
// builtins.
|
|
4
|
+
const ObjectWithHasOwn = Object as ObjectConstructor & {
|
|
5
|
+
hasOwn?: (obj: object, key: PropertyKey) => boolean;
|
|
6
|
+
};
|
|
7
|
+
if (!ObjectWithHasOwn.hasOwn) {
|
|
8
|
+
ObjectWithHasOwn.hasOwn = (obj, key) =>
|
|
9
|
+
Object.prototype.hasOwnProperty.call(obj, key);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (!('at' in Array.prototype)) {
|
|
13
|
+
// eslint-disable-next-line no-extend-native
|
|
14
|
+
Object.defineProperty(Array.prototype, 'at', {
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: function at<T>(this: T[], index: number) {
|
|
18
|
+
const i = Math.trunc(index) || 0;
|
|
19
|
+
return this[i < 0 ? this.length + i : i];
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dash-core-components",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.5",
|
|
4
4
|
"description": "Core component suite for Dash",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
"react-dropzone": "^4.1.2",
|
|
62
62
|
"react-fast-compare": "^3.2.2",
|
|
63
63
|
"react-input-autosize": "^3.0.0",
|
|
64
|
-
"react-markdown": "^
|
|
64
|
+
"react-markdown": "^10.1.0",
|
|
65
65
|
"react-window": "^1.8.11",
|
|
66
|
-
"rehype-raw": "^
|
|
67
|
-
"remark-
|
|
68
|
-
"remark-
|
|
66
|
+
"rehype-raw": "^7.0.0",
|
|
67
|
+
"remark-gfm": "^4.0.1",
|
|
68
|
+
"remark-math": "^6.0.0",
|
|
69
69
|
"uniqid": "^5.4.0",
|
|
70
|
-
"unist-util-visit": "^
|
|
70
|
+
"unist-util-visit": "^5.2.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@babel/cli": "^7.28.6",
|