styled-components 6.4.0-prerelease.7 → 6.4.0-prerelease.8
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/README.md +4 -0
- package/dist/constructors/createGlobalStyle.d.ts +10 -0
- package/dist/constructors/css.d.ts +12 -0
- package/dist/constructors/keyframes.d.ts +11 -0
- package/dist/constructors/styled.d.ts +8 -0
- package/dist/hoc/withTheme.d.ts +1 -0
- package/dist/models/InlineStyle.d.ts +11 -0
- package/dist/models/ServerStyleSheet.d.ts +10 -0
- package/dist/models/StyleSheetManager.d.ts +1 -0
- package/dist/native/index.d.ts +18 -2
- package/dist/styled-components.browser.cjs.js +1 -1
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +1 -1
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +1 -1
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +1 -1
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +43 -1
- package/dist/styled-components.js.map +1 -1
- package/dist/styled-components.min.js +1 -1
- package/dist/styled-components.min.js.map +1 -1
- package/dist/utils/isStyledComponent.d.ts +1 -0
- package/native/dist/constructors/createGlobalStyle.d.ts +10 -0
- package/native/dist/constructors/css.d.ts +12 -0
- package/native/dist/constructors/keyframes.d.ts +11 -0
- package/native/dist/constructors/styled.d.ts +8 -0
- package/native/dist/dist/constructors/createGlobalStyle.d.ts +10 -0
- package/native/dist/dist/constructors/css.d.ts +12 -0
- package/native/dist/dist/constructors/keyframes.d.ts +11 -0
- package/native/dist/dist/constructors/styled.d.ts +8 -0
- package/native/dist/dist/hoc/withTheme.d.ts +1 -0
- package/native/dist/dist/models/InlineStyle.d.ts +11 -0
- package/native/dist/dist/models/ServerStyleSheet.d.ts +10 -0
- package/native/dist/dist/models/StyleSheetManager.d.ts +1 -0
- package/native/dist/dist/native/index.d.ts +18 -2
- package/native/dist/dist/utils/isStyledComponent.d.ts +1 -0
- package/native/dist/hoc/withTheme.d.ts +1 -0
- package/native/dist/models/InlineStyle.d.ts +11 -0
- package/native/dist/models/ServerStyleSheet.d.ts +10 -0
- package/native/dist/models/StyleSheetManager.d.ts +1 -0
- package/native/dist/native/index.d.ts +18 -2
- package/native/dist/styled-components.native.cjs.js +1 -1
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +1 -1
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/utils/isStyledComponent.d.ts +1 -0
- package/native/package.json +7 -2
- package/package.json +4 -5
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
'data-styled';
|
|
12
12
|
const SC_ATTR_ACTIVE = 'active';
|
|
13
13
|
const SC_ATTR_VERSION = 'data-styled-version';
|
|
14
|
-
const SC_VERSION = "6.4.0-prerelease.
|
|
14
|
+
const SC_VERSION = "6.4.0-prerelease.8";
|
|
15
15
|
const SPLITTER = '/*!sc*/\n';
|
|
16
16
|
const IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
17
17
|
function readSpeedyFlag(name) {
|
|
@@ -723,6 +723,7 @@
|
|
|
723
723
|
return isFunction(test) && !(test.prototype && test.prototype.isReactComponent);
|
|
724
724
|
}
|
|
725
725
|
|
|
726
|
+
/** Type guard that returns true if the target is a styled component. */
|
|
726
727
|
function isStyledComponent(target) {
|
|
727
728
|
return typeof target === 'object' && 'styledComponentId' in target;
|
|
728
729
|
}
|
|
@@ -1292,6 +1293,7 @@
|
|
|
1292
1293
|
function useStyleSheetContext() {
|
|
1293
1294
|
return React.useContext(StyleSheetContext);
|
|
1294
1295
|
}
|
|
1296
|
+
/** Configure style injection for descendant styled components (target element, stylis plugins, prop forwarding). */
|
|
1295
1297
|
function StyleSheetManager(props) {
|
|
1296
1298
|
// In RSC environments without context support, StyleSheetManager becomes a no-op
|
|
1297
1299
|
if (!React.useMemo) {
|
|
@@ -1482,6 +1484,16 @@
|
|
|
1482
1484
|
return addTag(flatten(interleave(styleStringArray, interpolations)));
|
|
1483
1485
|
}
|
|
1484
1486
|
|
|
1487
|
+
/**
|
|
1488
|
+
* Create a component that injects global CSS when mounted. Supports theming and dynamic props.
|
|
1489
|
+
*
|
|
1490
|
+
* ```tsx
|
|
1491
|
+
* const GlobalStyle = createGlobalStyle`
|
|
1492
|
+
* body { margin: 0; font-family: system-ui; }
|
|
1493
|
+
* `;
|
|
1494
|
+
* // Render <GlobalStyle /> at the root of your app
|
|
1495
|
+
* ```
|
|
1496
|
+
*/
|
|
1485
1497
|
function createGlobalStyle(strings, ...interpolations) {
|
|
1486
1498
|
const rules = css(strings, ...interpolations);
|
|
1487
1499
|
const styledComponentId = `sc-global-${generateComponentId(JSON.stringify(rules))}`;
|
|
@@ -1713,6 +1725,17 @@
|
|
|
1713
1725
|
}
|
|
1714
1726
|
_a = KEYFRAMES_SYMBOL;
|
|
1715
1727
|
|
|
1728
|
+
/**
|
|
1729
|
+
* Define a CSS `@keyframes` animation with an automatically scoped name.
|
|
1730
|
+
*
|
|
1731
|
+
* ```tsx
|
|
1732
|
+
* const rotate = keyframes`
|
|
1733
|
+
* from { transform: rotate(0deg); }
|
|
1734
|
+
* to { transform: rotate(360deg); }
|
|
1735
|
+
* `;
|
|
1736
|
+
* const Spinner = styled.div`animation: ${rotate} 1s linear infinite;`;
|
|
1737
|
+
* ```
|
|
1738
|
+
*/
|
|
1716
1739
|
function keyframes(strings, ...interpolations) {
|
|
1717
1740
|
/* Warning if you've used keyframes on React Native */
|
|
1718
1741
|
if (typeof navigator !== 'undefined' &&
|
|
@@ -1818,6 +1841,7 @@
|
|
|
1818
1841
|
return targetComponent;
|
|
1819
1842
|
}
|
|
1820
1843
|
|
|
1844
|
+
/** Higher-order component that injects the current theme as a prop. Prefer `useTheme` in function components. */
|
|
1821
1845
|
function withTheme(Component) {
|
|
1822
1846
|
const WithTheme = React.forwardRef((props, ref) => {
|
|
1823
1847
|
const theme = React.useContext(ThemeContext) ;
|
|
@@ -1831,6 +1855,16 @@
|
|
|
1831
1855
|
return hoistNonReactStatics(WithTheme, Component);
|
|
1832
1856
|
}
|
|
1833
1857
|
|
|
1858
|
+
/**
|
|
1859
|
+
* Collect styled-components CSS during server-side rendering.
|
|
1860
|
+
*
|
|
1861
|
+
* ```tsx
|
|
1862
|
+
* const sheet = new ServerStyleSheet();
|
|
1863
|
+
* const html = renderToString(sheet.collectStyles(<App />));
|
|
1864
|
+
* const styleTags = sheet.getStyleTags();
|
|
1865
|
+
* sheet.seal();
|
|
1866
|
+
* ```
|
|
1867
|
+
*/
|
|
1834
1868
|
class ServerStyleSheet {
|
|
1835
1869
|
constructor({ nonce } = {}) {
|
|
1836
1870
|
this._emitSheetCSS = () => {
|
|
@@ -2377,6 +2411,14 @@
|
|
|
2377
2411
|
return templateFunction;
|
|
2378
2412
|
}
|
|
2379
2413
|
|
|
2414
|
+
/**
|
|
2415
|
+
* Create a styled component from an HTML element or React component.
|
|
2416
|
+
*
|
|
2417
|
+
* ```tsx
|
|
2418
|
+
* const Button = styled.button`color: red;`;
|
|
2419
|
+
* const Link = styled(RouterLink)`text-decoration: none;`;
|
|
2420
|
+
* ```
|
|
2421
|
+
*/
|
|
2380
2422
|
const baseStyled = (tag) => constructWithOptions(createStyledComponent, tag);
|
|
2381
2423
|
const styled = baseStyled;
|
|
2382
2424
|
// Shorthands for all valid HTML Elements
|