mirror of
https://github.com/zhigang1992/styled-components.git
synced 2026-01-12 22:52:39 +08:00
Merge branch 'master' into styled-by-readme
This commit is contained in:
@@ -129,6 +129,7 @@ We could use your help to get syntax highlighting support to other editors! If y
|
||||
- [Scalable React Boilerplate](https://github.com/RyanCCollins/scalable-react-boilerplate)
|
||||
- [Scalable React TypeScript Boilerplate](https://github.com/RyanCCollins/scalable-react-ts-boilerplate)
|
||||
- [Superstylin'](https://github.com/bntzio/gatsby-starter-superstylin): A Gatsby starter with styled-components 💅 ([demo](https://superstylin.netlify.com/))
|
||||
- [Generator create-redux-app](https://github.com/jonidelv/generator-create-redux-app): Add Redux, styled-components and other useful libraries and tools like auto-generate boilerplate code, on top of the most common React starter create-react-app.
|
||||
|
||||
### Websites
|
||||
- [PostCSS.parts](http://postcss.parts): A searchable catalog of PostCSS plugins
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.4.1",
|
||||
"babel-preset-env": "^1.4.0",
|
||||
"babel-preset-react": "^6.22.0",
|
||||
"bundlesize": "^0.5.5",
|
||||
"bundlesize": "^0.13.2",
|
||||
"chokidar": "^1.6.0",
|
||||
"danger": "^0.16.0",
|
||||
"enzyme": "^2.8.2",
|
||||
|
||||
@@ -42,6 +42,7 @@ const plugins = [
|
||||
},
|
||||
},
|
||||
flow(),
|
||||
json(),
|
||||
nodeResolve(),
|
||||
commonjs({
|
||||
ignoreGlobal: true,
|
||||
@@ -67,7 +68,6 @@ const plugins = [
|
||||
'transform-class-properties',
|
||||
].filter(Boolean),
|
||||
}),
|
||||
json(),
|
||||
]
|
||||
|
||||
if (prod) plugins.push(uglify(), visualizer({ filename: './bundle-stats.html' }))
|
||||
|
||||
21
typings/styled-components.d.ts
vendored
21
typings/styled-components.d.ts
vendored
@@ -1,8 +1,6 @@
|
||||
import * as React from "react";
|
||||
import { StatelessComponent, ComponentClass, PureComponent, ReactElement } from "react";
|
||||
|
||||
import { HTMLTags, SVGTags } from "./tags";
|
||||
|
||||
type Component<P> = ComponentClass<P> | StatelessComponent<P>;
|
||||
|
||||
export interface ThemeProps<T> {
|
||||
@@ -33,8 +31,7 @@ type Attrs<P, A extends Partial<P>, T> = {
|
||||
export interface StyledComponentClass<P, T, O = P> extends ComponentClass<ThemedOuterStyledProps<O, T>> {
|
||||
extend: ThemedStyledFunction<P, T, O>;
|
||||
|
||||
withComponent<K extends keyof HTMLTags>(tag: K): StyledComponentClass<React.HTMLProps<HTMLTags[K]>, T, O>;
|
||||
withComponent<K extends keyof SVGTags>(tag: K): StyledComponentClass<React.SVGAttributes<SVGTags[K]>, T, O>;
|
||||
withComponent<K extends keyof JSX.IntrinsicElements>(tag: K): StyledComponentClass<JSX.IntrinsicElements[K], T, O>;
|
||||
withComponent(element: ComponentClass<P>): StyledComponentClass<P, T, O>;
|
||||
}
|
||||
|
||||
@@ -46,22 +43,10 @@ export interface ThemedStyledFunction<P, T, O = P> {
|
||||
|
||||
export type StyledFunction<P> = ThemedStyledFunction<P, any>;
|
||||
|
||||
export type ThemedHtmlStyledFunction<E, T> = ThemedStyledFunction<React.HTMLProps<E>, T>;
|
||||
export type HtmlStyledFunction<E> = ThemedHtmlStyledFunction<E, any>;
|
||||
|
||||
export type ThemedSvgStyledFunction<E extends SVGElement, T> = ThemedStyledFunction<React.SVGAttributes<E>, T>;
|
||||
export type SvgStyledFunction<E extends SVGElement> = ThemedSvgStyledFunction<E, any>;
|
||||
|
||||
type ThemedStyledComponentFactoriesHTML<T> = {
|
||||
[K in keyof HTMLTags]: ThemedHtmlStyledFunction<HTMLTags[K], T>;
|
||||
type ThemedStyledComponentFactories<T> = {
|
||||
[K in keyof JSX.IntrinsicElements]: ThemedStyledFunction<JSX.IntrinsicElements[K], T>;
|
||||
};
|
||||
|
||||
type ThemedStyledComponentFactoriesSVG<T> = {
|
||||
[K in keyof SVGTags]: ThemedSvgStyledFunction<SVGTags[K], T>;
|
||||
};
|
||||
|
||||
type ThemedStyledComponentFactories<T> = ThemedStyledComponentFactoriesHTML<T> & ThemedStyledComponentFactoriesSVG<T>;
|
||||
|
||||
export interface ThemedBaseStyledInterface<T> extends ThemedStyledComponentFactories<T> {
|
||||
<P, O>(component: StyledComponentClass<P, T, O>): ThemedStyledFunction<P, T, O>;
|
||||
<P extends { theme: T; }>(component: React.ComponentClass<P>): ThemedStyledFunction<P, T, WithOptionalTheme<P, T>>;
|
||||
|
||||
137
typings/tags.d.ts
vendored
137
typings/tags.d.ts
vendored
@@ -1,137 +0,0 @@
|
||||
export interface HTMLTags {
|
||||
a: HTMLAnchorElement;
|
||||
abbr: HTMLElement;
|
||||
address: HTMLElement;
|
||||
area: HTMLAreaElement;
|
||||
article: HTMLElement;
|
||||
aside: HTMLElement;
|
||||
audio: HTMLAudioElement;
|
||||
b: HTMLElement;
|
||||
base: HTMLBaseElement;
|
||||
bdi: HTMLElement;
|
||||
bdo: HTMLElement;
|
||||
big: HTMLElement;
|
||||
blockquote: HTMLElement;
|
||||
body: HTMLBodyElement;
|
||||
br: HTMLBRElement;
|
||||
button: HTMLButtonElement;
|
||||
canvas: HTMLCanvasElement;
|
||||
caption: HTMLElement;
|
||||
cite: HTMLElement;
|
||||
code: HTMLElement;
|
||||
col: HTMLTableColElement;
|
||||
colgroup: HTMLTableColElement;
|
||||
data: HTMLElement;
|
||||
datalist: HTMLDataListElement;
|
||||
dd: HTMLElement;
|
||||
del: HTMLElement;
|
||||
details: HTMLElement;
|
||||
dfn: HTMLElement;
|
||||
dialog: HTMLElement;
|
||||
div: HTMLDivElement;
|
||||
dl: HTMLDListElement;
|
||||
dt: HTMLElement;
|
||||
em: HTMLElement;
|
||||
embed: HTMLEmbedElement;
|
||||
fieldset: HTMLFieldSetElement;
|
||||
figcaption: HTMLElement;
|
||||
figure: HTMLElement;
|
||||
footer: HTMLElement;
|
||||
form: HTMLFormElement;
|
||||
h1: HTMLHeadingElement;
|
||||
h2: HTMLHeadingElement;
|
||||
h3: HTMLHeadingElement;
|
||||
h4: HTMLHeadingElement;
|
||||
h5: HTMLHeadingElement;
|
||||
h6: HTMLHeadingElement;
|
||||
head: HTMLHeadElement;
|
||||
header: HTMLElement;
|
||||
hgroup: HTMLElement;
|
||||
hr: HTMLHRElement;
|
||||
html: HTMLHtmlElement;
|
||||
i: HTMLElement;
|
||||
iframe: HTMLIFrameElement;
|
||||
img: HTMLImageElement;
|
||||
input: HTMLInputElement;
|
||||
ins: HTMLModElement;
|
||||
kbd: HTMLElement;
|
||||
keygen: HTMLElement;
|
||||
label: HTMLLabelElement;
|
||||
legend: HTMLLegendElement;
|
||||
li: HTMLLIElement;
|
||||
link: HTMLLinkElement;
|
||||
main: HTMLElement;
|
||||
map: HTMLMapElement;
|
||||
mark: HTMLElement;
|
||||
menu: HTMLElement;
|
||||
menuitem: HTMLElement;
|
||||
meta: HTMLMetaElement;
|
||||
meter: HTMLElement;
|
||||
nav: HTMLElement;
|
||||
noscript: HTMLElement;
|
||||
object: HTMLObjectElement;
|
||||
ol: HTMLOListElement;
|
||||
optgroup: HTMLOptGroupElement;
|
||||
option: HTMLOptionElement;
|
||||
output: HTMLElement;
|
||||
p: HTMLParagraphElement;
|
||||
param: HTMLParamElement;
|
||||
picture: HTMLElement;
|
||||
pre: HTMLPreElement;
|
||||
progress: HTMLProgressElement;
|
||||
q: HTMLQuoteElement;
|
||||
rp: HTMLElement;
|
||||
rt: HTMLElement;
|
||||
ruby: HTMLElement;
|
||||
s: HTMLElement;
|
||||
samp: HTMLElement;
|
||||
script: HTMLElement;
|
||||
section: HTMLElement;
|
||||
select: HTMLSelectElement;
|
||||
small: HTMLElement;
|
||||
source: HTMLSourceElement;
|
||||
span: HTMLSpanElement;
|
||||
strong: HTMLElement;
|
||||
style: HTMLStyleElement;
|
||||
sub: HTMLElement;
|
||||
summary: HTMLElement;
|
||||
sup: HTMLElement;
|
||||
table: HTMLTableElement;
|
||||
tbody: HTMLTableSectionElement;
|
||||
td: HTMLTableDataCellElement;
|
||||
textarea: HTMLTextAreaElement;
|
||||
tfoot: HTMLTableSectionElement;
|
||||
th: HTMLTableHeaderCellElement;
|
||||
thead: HTMLTableSectionElement;
|
||||
time: HTMLElement;
|
||||
title: HTMLTitleElement;
|
||||
tr: HTMLTableRowElement;
|
||||
track: HTMLTrackElement;
|
||||
u: HTMLElement;
|
||||
ul: HTMLUListElement;
|
||||
"var": HTMLElement;
|
||||
video: HTMLVideoElement;
|
||||
wbr: HTMLElement;
|
||||
}
|
||||
|
||||
export interface SVGTags {
|
||||
circle: SVGCircleElement;
|
||||
clipPath: SVGClipPathElement;
|
||||
defs: SVGDefsElement;
|
||||
ellipse: SVGEllipseElement;
|
||||
g: SVGGElement;
|
||||
image: SVGImageElement;
|
||||
line: SVGLineElement;
|
||||
linearGradient: SVGLinearGradientElement;
|
||||
mask: SVGMaskElement;
|
||||
path: SVGPathElement;
|
||||
pattern: SVGPatternElement;
|
||||
polygon: SVGPolygonElement;
|
||||
polyline: SVGPolylineElement;
|
||||
radialGradient: SVGRadialGradientElement;
|
||||
rect: SVGRectElement;
|
||||
stop: SVGStopElement;
|
||||
svg: SVGSVGElement;
|
||||
text: SVGTextElement;
|
||||
tspan: SVGTSpanElement;
|
||||
}
|
||||
107
yarn.lock
107
yarn.lock
@@ -282,11 +282,12 @@ axios@0.15.3:
|
||||
dependencies:
|
||||
follow-redirects "1.0.0"
|
||||
|
||||
axios@0.16.1:
|
||||
version "0.16.1"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.16.1.tgz#c0b6d26600842384b8f509e57111f0d2df8223ca"
|
||||
axios@^0.16.1:
|
||||
version "0.16.2"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.16.2.tgz#ba4f92f17167dfbab40983785454b9ac149c3c6d"
|
||||
dependencies:
|
||||
follow-redirects "^1.2.3"
|
||||
is-buffer "^1.1.5"
|
||||
|
||||
babel-cli@^6.22.2:
|
||||
version "6.24.1"
|
||||
@@ -1259,17 +1260,19 @@ builtin-modules@^1.0.0, builtin-modules@^1.1.0, builtin-modules@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
|
||||
|
||||
bundlesize@^0.5.5:
|
||||
version "0.5.5"
|
||||
resolved "https://registry.yarnpkg.com/bundlesize/-/bundlesize-0.5.5.tgz#7fd2d34cf78aeb4fe250e01c6d71f027e3e01893"
|
||||
bundlesize@0.13.2:
|
||||
version "0.13.2"
|
||||
resolved "https://registry.yarnpkg.com/bundlesize/-/bundlesize-0.13.2.tgz#3a8aa61aa9f6d54f63321e2dfc7aa7716f91e73f"
|
||||
dependencies:
|
||||
axios "0.16.1"
|
||||
bytes "2.5.0"
|
||||
github-build "1.1.1"
|
||||
glob "7.1.2"
|
||||
gzip-size "3.0.0"
|
||||
prettycli "1.3.0"
|
||||
read-pkg-up "2.0.0"
|
||||
axios "^0.16.1"
|
||||
bytes "^2.5.0"
|
||||
ci-env "^1.4.0"
|
||||
commander "^2.11.0"
|
||||
github-build "^1.2.0"
|
||||
glob "^7.1.2"
|
||||
gzip-size "^3.0.0"
|
||||
prettycli "^1.3.0"
|
||||
read-pkg-up "^2.0.0"
|
||||
|
||||
bytes@2.1.0:
|
||||
version "2.1.0"
|
||||
@@ -1279,7 +1282,7 @@ bytes@2.4.0:
|
||||
version "2.4.0"
|
||||
resolved "https://registry.yarnpkg.com/bytes/-/bytes-2.4.0.tgz#7d97196f9d5baf7f6935e25985549edd2a6c2339"
|
||||
|
||||
bytes@2.5.0:
|
||||
bytes@^2.5.0:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/bytes/-/bytes-2.5.0.tgz#4c9423ea2d252c270c41b2bdefeff9bb6b62c06a"
|
||||
|
||||
@@ -1374,6 +1377,10 @@ chokidar@^1.4.3, chokidar@^1.6.0, chokidar@^1.6.1:
|
||||
optionalDependencies:
|
||||
fsevents "^1.0.0"
|
||||
|
||||
ci-env@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/ci-env/-/ci-env-1.4.0.tgz#7e4c4ed1d10cedce734293e04dde94fcdfe74d67"
|
||||
|
||||
ci-info@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534"
|
||||
@@ -1459,6 +1466,10 @@ combined-stream@^1.0.5, combined-stream@~1.0.5:
|
||||
dependencies:
|
||||
delayed-stream "~1.0.0"
|
||||
|
||||
commander@^2.11.0:
|
||||
version "2.11.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
|
||||
|
||||
commander@^2.8.1, commander@^2.9.0:
|
||||
version "2.9.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4"
|
||||
@@ -2773,9 +2784,9 @@ getpass@^0.1.1:
|
||||
dependencies:
|
||||
assert-plus "^1.0.0"
|
||||
|
||||
github-build@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/github-build/-/github-build-1.1.1.tgz#7a1fd4ed018dc8b4098f31701fd8e0f1b8a9e8cb"
|
||||
github-build@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/github-build/-/github-build-1.2.0.tgz#b0bdb705ae4088218577e863c1a301030211051f"
|
||||
dependencies:
|
||||
axios "0.15.3"
|
||||
|
||||
@@ -2792,17 +2803,6 @@ glob-parent@^2.0.0:
|
||||
dependencies:
|
||||
is-glob "^2.0.0"
|
||||
|
||||
glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1:
|
||||
version "7.1.2"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
|
||||
dependencies:
|
||||
fs.realpath "^1.0.0"
|
||||
inflight "^1.0.4"
|
||||
inherits "2"
|
||||
minimatch "^3.0.4"
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
glob@^5.0.15, glob@~5.0.0:
|
||||
version "5.0.15"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1"
|
||||
@@ -2813,7 +2813,7 @@ glob@^5.0.15, glob@~5.0.0:
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
glob@^7.0.0:
|
||||
glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1:
|
||||
version "7.1.1"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
|
||||
dependencies:
|
||||
@@ -2824,6 +2824,17 @@ glob@^7.0.0:
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
glob@^7.1.2:
|
||||
version "7.1.2"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
|
||||
dependencies:
|
||||
fs.realpath "^1.0.0"
|
||||
inflight "^1.0.4"
|
||||
inherits "2"
|
||||
minimatch "^3.0.4"
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
global@^4.3.0:
|
||||
version "4.3.2"
|
||||
resolved "https://registry.yarnpkg.com/global/-/global-4.3.2.tgz#e76989268a6c74c38908b1305b10fc0e394e9d0f"
|
||||
@@ -2924,7 +2935,7 @@ gulplog@^1.0.0:
|
||||
dependencies:
|
||||
glogg "^1.0.0"
|
||||
|
||||
gzip-size@3.0.0:
|
||||
gzip-size@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-3.0.0.tgz#546188e9bdc337f673772f81660464b389dce520"
|
||||
dependencies:
|
||||
@@ -3171,7 +3182,7 @@ is-binary-path@^1.0.0:
|
||||
dependencies:
|
||||
binary-extensions "^1.0.0"
|
||||
|
||||
is-buffer@^1.0.2:
|
||||
is-buffer@^1.0.2, is-buffer@^1.1.5:
|
||||
version "1.1.5"
|
||||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc"
|
||||
|
||||
@@ -4426,18 +4437,18 @@ min-document@^2.19.0:
|
||||
dependencies:
|
||||
dom-walk "^0.1.0"
|
||||
|
||||
"minimatch@2 || 3", minimatch@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3:
|
||||
"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
|
||||
dependencies:
|
||||
brace-expansion "^1.0.0"
|
||||
|
||||
minimatch@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist@0.0.8, minimist@~0.0.1:
|
||||
version "0.0.8"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
|
||||
@@ -5024,9 +5035,9 @@ pretty-format@^20.0.3:
|
||||
ansi-regex "^2.1.1"
|
||||
ansi-styles "^3.0.0"
|
||||
|
||||
prettycli@1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/prettycli/-/prettycli-1.3.0.tgz#1c6a05018064c4dfb6dd1332435fd6715e49b273"
|
||||
prettycli@^1.3.0:
|
||||
version "1.4.2"
|
||||
resolved "https://registry.yarnpkg.com/prettycli/-/prettycli-1.4.2.tgz#17a449967e2cfd20554e90594737ccf3dcbe74b2"
|
||||
dependencies:
|
||||
chalk "1.1.3"
|
||||
|
||||
@@ -5312,13 +5323,6 @@ read-all-stream@^3.0.0:
|
||||
pinkie-promise "^2.0.0"
|
||||
readable-stream "^2.0.0"
|
||||
|
||||
read-pkg-up@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be"
|
||||
dependencies:
|
||||
find-up "^2.0.0"
|
||||
read-pkg "^2.0.0"
|
||||
|
||||
read-pkg-up@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02"
|
||||
@@ -5326,6 +5330,13 @@ read-pkg-up@^1.0.1:
|
||||
find-up "^1.0.0"
|
||||
read-pkg "^1.0.0"
|
||||
|
||||
read-pkg-up@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be"
|
||||
dependencies:
|
||||
find-up "^2.0.0"
|
||||
read-pkg "^2.0.0"
|
||||
|
||||
read-pkg@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28"
|
||||
|
||||
Reference in New Issue
Block a user