@backstage/core-components 0.11.0 → 0.11.1-next.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/CHANGELOG.md +10 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.esm.js +34 -17
- package/dist/index.esm.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @backstage/core-components
|
|
2
2
|
|
|
3
|
+
## 0.11.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b29c44d895: Adds code to generate ids for headers parsed through the MarkdownContent component.
|
|
8
|
+
- bf5e9030eb: Updated dependency `msw` to `^0.45.0`.
|
|
9
|
+
- c8bb0ff8ce: Minor cleanup of the public API surface to reduce the number of warnings
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/core-plugin-api@1.0.6-next.0
|
|
12
|
+
|
|
3
13
|
## 0.11.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1710,10 +1710,10 @@ declare const LegacySidebarContext: React__default.Context<SidebarContextType>;
|
|
|
1710
1710
|
*
|
|
1711
1711
|
* @public
|
|
1712
1712
|
*/
|
|
1713
|
-
declare
|
|
1713
|
+
declare function SidebarOpenStateProvider(props: {
|
|
1714
1714
|
children: ReactNode;
|
|
1715
1715
|
value: SidebarOpenState;
|
|
1716
|
-
})
|
|
1716
|
+
}): JSX.Element;
|
|
1717
1717
|
/**
|
|
1718
1718
|
* Hook to read and update the sidebar's open state, which controls whether or
|
|
1719
1719
|
* not the sidebar is open and full-width, or closed and only displaying icons.
|
|
@@ -1725,8 +1725,8 @@ declare const useSidebarOpenState: () => SidebarOpenState;
|
|
|
1725
1725
|
/**
|
|
1726
1726
|
* Type of `SidebarPinStateContext`
|
|
1727
1727
|
*
|
|
1728
|
-
* @public
|
|
1729
|
-
* Use `SidebarPinState` instead.
|
|
1728
|
+
* @public
|
|
1729
|
+
* @deprecated Use `SidebarPinState` instead.
|
|
1730
1730
|
*/
|
|
1731
1731
|
declare type SidebarPinStateContextType = {
|
|
1732
1732
|
isPinned: boolean;
|
|
@@ -1767,10 +1767,10 @@ declare const LegacySidebarPinStateContext: React__default.Context<SidebarPinSta
|
|
|
1767
1767
|
*
|
|
1768
1768
|
* @public
|
|
1769
1769
|
*/
|
|
1770
|
-
declare
|
|
1770
|
+
declare function SidebarPinStateProvider(props: {
|
|
1771
1771
|
children: ReactNode;
|
|
1772
1772
|
value: SidebarPinStateContextType;
|
|
1773
|
-
})
|
|
1773
|
+
}): JSX.Element;
|
|
1774
1774
|
/**
|
|
1775
1775
|
* Hook to read and update sidebar pin state, which controls whether or not the
|
|
1776
1776
|
* sidebar is pinned open.
|
package/dist/index.esm.js
CHANGED
|
@@ -1846,6 +1846,17 @@ const useStyles$B = makeStyles(
|
|
|
1846
1846
|
}),
|
|
1847
1847
|
{ name: "BackstageMarkdownContent" }
|
|
1848
1848
|
);
|
|
1849
|
+
const flatten = (text, child) => {
|
|
1850
|
+
if (!child)
|
|
1851
|
+
return text;
|
|
1852
|
+
return typeof child === "string" ? text + child : React.Children.toArray(child.props.children).reduce(flatten, text);
|
|
1853
|
+
};
|
|
1854
|
+
const headingRenderer = ({ level, children }) => {
|
|
1855
|
+
const childrenArray = React.Children.toArray(children);
|
|
1856
|
+
const text = childrenArray.reduce(flatten, "");
|
|
1857
|
+
const slug = text.toLocaleLowerCase("en-US").replace(/\W/g, "-");
|
|
1858
|
+
return React.createElement(`h${level}`, { id: slug }, children);
|
|
1859
|
+
};
|
|
1849
1860
|
const components = {
|
|
1850
1861
|
code: ({ inline, className, children, ...props }) => {
|
|
1851
1862
|
const text = String(children).replace(/\n+$/, "");
|
|
@@ -1857,7 +1868,13 @@ const components = {
|
|
|
1857
1868
|
className,
|
|
1858
1869
|
...props
|
|
1859
1870
|
}, children);
|
|
1860
|
-
}
|
|
1871
|
+
},
|
|
1872
|
+
h1: headingRenderer,
|
|
1873
|
+
h2: headingRenderer,
|
|
1874
|
+
h3: headingRenderer,
|
|
1875
|
+
h4: headingRenderer,
|
|
1876
|
+
h5: headingRenderer,
|
|
1877
|
+
h6: headingRenderer
|
|
1861
1878
|
};
|
|
1862
1879
|
function MarkdownContent(props) {
|
|
1863
1880
|
const {
|
|
@@ -3340,14 +3357,14 @@ const defaultSidebarPinStateContext = {
|
|
|
3340
3357
|
};
|
|
3341
3358
|
const LegacySidebarPinStateContext = createContext(defaultSidebarPinStateContext);
|
|
3342
3359
|
const VersionedSidebarPinStateContext = createVersionedContext("sidebar-pin-state-context");
|
|
3343
|
-
|
|
3344
|
-
children,
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
}
|
|
3360
|
+
function SidebarPinStateProvider(props) {
|
|
3361
|
+
const { children, value } = props;
|
|
3362
|
+
return /* @__PURE__ */ React.createElement(LegacySidebarPinStateContext.Provider, {
|
|
3363
|
+
value
|
|
3364
|
+
}, /* @__PURE__ */ React.createElement(VersionedSidebarPinStateContext.Provider, {
|
|
3365
|
+
value: createVersionedValueMap({ 1: value })
|
|
3366
|
+
}, children));
|
|
3367
|
+
}
|
|
3351
3368
|
const useSidebarPinState = () => {
|
|
3352
3369
|
const versionedPinStateContext = useContext(VersionedSidebarPinStateContext);
|
|
3353
3370
|
const legacyPinStateContext = useContext(LegacySidebarPinStateContext);
|
|
@@ -3442,14 +3459,14 @@ const LegacySidebarContext = createContext(
|
|
|
3442
3459
|
defaultSidebarOpenStateContext
|
|
3443
3460
|
);
|
|
3444
3461
|
const VersionedSidebarContext = createVersionedContext("sidebar-open-state-context");
|
|
3445
|
-
|
|
3446
|
-
children,
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
}
|
|
3462
|
+
function SidebarOpenStateProvider(props) {
|
|
3463
|
+
const { children, value } = props;
|
|
3464
|
+
return /* @__PURE__ */ React.createElement(LegacySidebarContext.Provider, {
|
|
3465
|
+
value
|
|
3466
|
+
}, /* @__PURE__ */ React.createElement(VersionedSidebarContext.Provider, {
|
|
3467
|
+
value: createVersionedValueMap({ 1: value })
|
|
3468
|
+
}, children));
|
|
3469
|
+
}
|
|
3453
3470
|
const useSidebarOpenState = () => {
|
|
3454
3471
|
const versionedOpenStateContext = useContext(VersionedSidebarContext);
|
|
3455
3472
|
const legacyOpenStateContext = useContext(LegacySidebarContext);
|