@n3e/styled 1.0.1 → 1.0.2
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 +6 -8
- package/package.json +1 -1
- package/react/cjs/index.d.ts +114 -115
- package/react/cjs/index.js +1 -2
- package/react/cjs/index.js.br +0 -0
- package/react/esm/index.d.ts +114 -115
- package/react/esm/index.js +1 -2
- package/react/esm/index.js.br +0 -0
- package/solid/cjs/index.d.ts +116 -115
- package/solid/cjs/index.js +0 -1
- package/solid/cjs/index.js.br +0 -0
- package/solid/esm/index.d.ts +116 -115
- package/solid/esm/index.js +0 -1
- package/solid/esm/index.js.br +0 -0
package/README.md
CHANGED
|
@@ -23,12 +23,10 @@ bun add @n3e/styled
|
|
|
23
23
|
```tsx
|
|
24
24
|
import styled from '@n3e/styled';
|
|
25
25
|
|
|
26
|
-
const accent = '#ff6995';
|
|
27
|
-
|
|
28
26
|
const Button = styled.button({
|
|
29
27
|
appearance: 'none',
|
|
30
|
-
backgroundColor:
|
|
31
|
-
border:
|
|
28
|
+
backgroundColor: '#ff6995',
|
|
29
|
+
border: '2px solid #ff6995',
|
|
32
30
|
borderRadius: '0.25rem',
|
|
33
31
|
margin: 0,
|
|
34
32
|
padding: '0 6px',
|
|
@@ -46,14 +44,14 @@ const Composition = () => (
|
|
|
46
44
|
|
|
47
45
|
SolidJS users need to import Styled from the the `solid` output folder:
|
|
48
46
|
|
|
49
|
-
```
|
|
50
|
-
|
|
47
|
+
```typescript
|
|
48
|
+
// as ES module
|
|
51
49
|
import styled from '@n3e/styled/solid/esm';
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
// as CommonJS module
|
|
54
52
|
import styled from '@n3e/styled/solid/cjs';
|
|
55
53
|
```
|
|
56
54
|
|
|
57
55
|
## Documentation
|
|
58
56
|
|
|
59
|
-
See https://www.styled.guide/
|
|
57
|
+
See https://www.styled.guide/
|
package/package.json
CHANGED
package/react/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
3
2
|
import * as CSS from 'csstype';
|
|
4
3
|
|
|
5
4
|
declare const PSEUDO_ELEMENTS: readonly ["after", "backdrop", "before", "cue", "cueRegion", "firstLetter", "firstLine", "fileSelectorButton", "marker", "placeholder", "selection"];
|
|
@@ -401,119 +400,119 @@ type ExtendableItem = CSSProperties | GenericComponent | StyledComponent;
|
|
|
401
400
|
* API for creating React styled component(s)
|
|
402
401
|
*/
|
|
403
402
|
declare const styled: {
|
|
404
|
-
generic: <P = UnknownProp>(arg?: CSSProperties
|
|
405
|
-
object: <
|
|
406
|
-
a: <
|
|
407
|
-
abbr: <
|
|
408
|
-
address: <
|
|
409
|
-
area: <
|
|
410
|
-
article: <
|
|
411
|
-
aside: <
|
|
412
|
-
audio: <
|
|
413
|
-
b: <
|
|
414
|
-
base: <
|
|
415
|
-
bdi: <
|
|
416
|
-
bdo: <
|
|
417
|
-
blockquote: <
|
|
418
|
-
body: <
|
|
419
|
-
br: <
|
|
420
|
-
button: <
|
|
421
|
-
canvas: <
|
|
422
|
-
caption: <
|
|
423
|
-
cite: <
|
|
424
|
-
code: <
|
|
425
|
-
col: <
|
|
426
|
-
colgroup: <
|
|
427
|
-
data: <
|
|
428
|
-
datalist: <
|
|
429
|
-
dd: <
|
|
430
|
-
del: <
|
|
431
|
-
details: <
|
|
432
|
-
dfn: <
|
|
433
|
-
dialog: <
|
|
434
|
-
div: <
|
|
435
|
-
dl: <
|
|
436
|
-
dt: <
|
|
437
|
-
em: <
|
|
438
|
-
embed: <
|
|
439
|
-
fieldset: <
|
|
440
|
-
figcaption: <
|
|
441
|
-
figure: <
|
|
442
|
-
footer: <
|
|
443
|
-
form: <
|
|
444
|
-
h1: <
|
|
445
|
-
h2: <
|
|
446
|
-
h3: <
|
|
447
|
-
h4: <
|
|
448
|
-
h5: <
|
|
449
|
-
h6: <
|
|
450
|
-
head: <
|
|
451
|
-
header: <
|
|
452
|
-
hgroup: <
|
|
453
|
-
hr: <
|
|
454
|
-
html: <
|
|
455
|
-
i: <
|
|
456
|
-
iframe: <
|
|
457
|
-
img: <
|
|
458
|
-
input: <
|
|
459
|
-
ins: <
|
|
460
|
-
kbd: <
|
|
461
|
-
label: <
|
|
462
|
-
legend: <
|
|
463
|
-
li: <
|
|
464
|
-
link: <
|
|
465
|
-
main: <
|
|
466
|
-
map: <
|
|
467
|
-
mark: <
|
|
468
|
-
math: <
|
|
469
|
-
menu: <
|
|
470
|
-
meta: <
|
|
471
|
-
meter: <
|
|
472
|
-
nav: <
|
|
473
|
-
noscript: <
|
|
474
|
-
ol: <
|
|
475
|
-
optgroup: <
|
|
476
|
-
option: <
|
|
477
|
-
output: <
|
|
478
|
-
p: <
|
|
479
|
-
picture: <
|
|
480
|
-
portal: <
|
|
481
|
-
pre: <
|
|
482
|
-
progress: <
|
|
483
|
-
q: <
|
|
484
|
-
rp: <
|
|
485
|
-
rt: <
|
|
486
|
-
ruby: <
|
|
487
|
-
s: <
|
|
488
|
-
samp: <
|
|
489
|
-
script: <
|
|
490
|
-
section: <
|
|
491
|
-
select: <
|
|
492
|
-
small: <
|
|
493
|
-
source: <
|
|
494
|
-
span: <
|
|
495
|
-
strong: <
|
|
496
|
-
style: <
|
|
497
|
-
sub: <
|
|
498
|
-
summary: <
|
|
499
|
-
sup: <
|
|
500
|
-
svg: <
|
|
501
|
-
table: <
|
|
502
|
-
tbody: <
|
|
503
|
-
td: <
|
|
504
|
-
textarea: <
|
|
505
|
-
tfoot: <
|
|
506
|
-
th: <
|
|
507
|
-
thead: <
|
|
508
|
-
time: <
|
|
509
|
-
title: <
|
|
510
|
-
tr: <
|
|
511
|
-
track: <
|
|
512
|
-
u: <
|
|
513
|
-
ul: <
|
|
514
|
-
var: <
|
|
515
|
-
video: <
|
|
516
|
-
wbr: <
|
|
403
|
+
generic: <P = UnknownProp>(arg?: CSSProperties) => GenericComponent<P>;
|
|
404
|
+
object: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
405
|
+
a: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
406
|
+
abbr: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
407
|
+
address: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
408
|
+
area: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
409
|
+
article: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
410
|
+
aside: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
411
|
+
audio: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
412
|
+
b: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
413
|
+
base: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
414
|
+
bdi: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
415
|
+
bdo: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
416
|
+
blockquote: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
417
|
+
body: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
418
|
+
br: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
419
|
+
button: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
420
|
+
canvas: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
421
|
+
caption: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
422
|
+
cite: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
423
|
+
code: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
424
|
+
col: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
425
|
+
colgroup: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
426
|
+
data: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
427
|
+
datalist: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
428
|
+
dd: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
429
|
+
del: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
430
|
+
details: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
431
|
+
dfn: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
432
|
+
dialog: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
433
|
+
div: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
434
|
+
dl: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
435
|
+
dt: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
436
|
+
em: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
437
|
+
embed: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
438
|
+
fieldset: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
439
|
+
figcaption: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
440
|
+
figure: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
441
|
+
footer: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
442
|
+
form: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
443
|
+
h1: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
444
|
+
h2: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
445
|
+
h3: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
446
|
+
h4: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
447
|
+
h5: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
448
|
+
h6: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
449
|
+
head: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
450
|
+
header: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
451
|
+
hgroup: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
452
|
+
hr: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
453
|
+
html: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
454
|
+
i: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
455
|
+
iframe: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
456
|
+
img: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
457
|
+
input: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
458
|
+
ins: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
459
|
+
kbd: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
460
|
+
label: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
461
|
+
legend: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
462
|
+
li: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
463
|
+
link: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
464
|
+
main: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
465
|
+
map: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
466
|
+
mark: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
467
|
+
math: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
468
|
+
menu: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
469
|
+
meta: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
470
|
+
meter: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
471
|
+
nav: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
472
|
+
noscript: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
473
|
+
ol: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
474
|
+
optgroup: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
475
|
+
option: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
476
|
+
output: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
477
|
+
p: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
478
|
+
picture: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
479
|
+
portal: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
480
|
+
pre: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
481
|
+
progress: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
482
|
+
q: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
483
|
+
rp: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
484
|
+
rt: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
485
|
+
ruby: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
486
|
+
s: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
487
|
+
samp: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
488
|
+
script: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
489
|
+
section: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
490
|
+
select: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
491
|
+
small: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
492
|
+
source: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
493
|
+
span: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
494
|
+
strong: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
495
|
+
style: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
496
|
+
sub: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
497
|
+
summary: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
498
|
+
sup: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
499
|
+
svg: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
500
|
+
table: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
501
|
+
tbody: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
502
|
+
td: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
503
|
+
textarea: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
504
|
+
tfoot: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
505
|
+
th: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
506
|
+
thead: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
507
|
+
time: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
508
|
+
title: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
509
|
+
tr: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
510
|
+
track: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
511
|
+
u: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
512
|
+
ul: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
513
|
+
var: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
514
|
+
video: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
515
|
+
wbr: <P = UnknownProp>(arg?: CSSProperties) => StyledComponent<P>;
|
|
517
516
|
};
|
|
518
517
|
|
|
519
518
|
declare const mq: (...mediaTypes: MediaTypes[]) => MediaQueryAPI;
|
package/react/cjs/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var e=require('react');const t='undefined'!=typeof window,r=e=>t=>typeof t===e,n=r('function'),s=r('number'),o=r('string'),a=r('object'),i=e=>t=>t===e,l=i(!0),c=i(!1),d=i(null),p=i(void 0),u=e=>a(e)&&!d(e)&&!Array.isArray(e),y=e=>o(e)||s(e),h=e=>d(e)||p(e),{stringify:m}=JSON,f=e=>(...t)=>`${e}-${(e=>(e=>{let t=-2128831035;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=16777619*t>>>0;return t})(m(e,((e,t)=>n(t)?`[Function ${e}]`:t))).toString(36))(t)}`,g=f('e'),b=f('s'),S=f('d'),v=f('c'),w=(e,t)=>{for(const r in t)Object.defineProperty(e,r,{value:t[r]});return e},$=(...e)=>e.join(''),C=e=>t=>$(t,e),T=e=>t=>$(e,t),j=T('.'),O=(e,t)=>{return t.split('||').flatMap((r=e,e=>r.map(C(e))));var r},R=e=>e.join('||'),x=e=>(...t)=>t.filter(Boolean).join(e),E=x(' '),k=e=>`(${e})`,_=(e,t)=>Object.entries(t).reduce(((t,[r,n])=>({...t,[r]:u(n)&&r in e?_(e[r],n):n})),{...e}),M=e=>e.trim().replace(/([A-Z])+/g,'-$1').toLowerCase(),N=(...e)=>t=>e.some((e=>t.startsWith(e))),A=e=>e.replace(/ {2}|\r\n|\n|\r/gm,'').trim(),L='@media',P=['print','screen'],W=['host','lang','is','not','where','nthChild','nthLastChild','nthLastOfType','nthOfType'],q='all',D='any',I='not',B='only',F='data-styled-sheet',H=(e,r)=>{const n=t?window:global,s=`__STYLED_${e}_REGISTER`;return s in n||Object.defineProperty(n,s,{value:Object.freeze(r())}),n[s]},G=e=>({add:(t,r)=>e.get(t)||e.set(t,{...r(),toString:()=>t}).get(t),get:t=>e.get(t),has:t=>e.has(t),__getDataStore:()=>new Map(e)}),Y=H('CACHE',(()=>G(new Map))),z=H('SHEET',(()=>{const e=new Map,t=([e,t])=>`<style ${F}="${e}">${t.css()}</style>`;return{...G(e),getStyles:()=>[...e].map(t).join('')}})),J=H('PROPS',(()=>({...G(new Map),names:new Set}))),{getStyles:U}=z,V=e=>t=>!h(e[t])&&!c(e[t]),Z=(e,t)=>{const r={[q]:e=>t.every(V(e)),[D]:e=>t.some(V(e)),[I]:e=>t.every((e=>t=>h(e[t]))(e)),[B]:e=>V(e)(t[0])};return t.forEach((e=>J.names.add(e))),{keys:t,predicate:r[e]}},K=e=>(...t)=>J.add(`props.${e}(${t})`,(()=>Z(e,t))).toString(),Q=i('content'),X=N('@container',L,'@supports'),ee=N(':','[',' ','>','~','+','.'),te=e=>()=>e,re=(e,t)=>{const r=Q(e)||s(t)?m:A;return`${M(e)}:${r(t)};`},ne=e=>(t,r)=>r.reduceRight(e,t),se=(e,t)=>`${t}{${e}}`,oe=ne(se),ae=ne(((e,t)=>({[t]:{...e}}))),ie=(e,t,r)=>n=>{const s=1===r.length?n[r[0]]:n,o=t(s);return u(o)?ae(o,e):{}},le=(...e)=>{const[t]=e,r=[e.map(j).join('')],s=(e,r,o,a)=>{const i=n(e),l=!J.has(o),c=J.get(o),[d,p]=(h=e,Object.entries(h).reduce((([e,t],[r,s])=>[y(s)?$(e,re(r,s)):e,u(s)||n(s)?{...t,[r]:s}:t]),['',{}]));var h;const m=X(o)?[...a,o]:a,f=ee(o)?O(r,o):r;return Object.entries(p).reduce(((e,[r,n])=>{if(!l)return e;const{computables:o,rules:a}=s(n,f,r,m);return{baseClassName:t,computables:[...e.computables,...o],rules:[...e.rules,...a]}}),{baseClassName:t,computables:l?[]:[{...c,identity:i?v:te(S(e)),yield:i?ie(a,e,c.keys):te(e)}],rules:l&&d?[oe(se(d,f.join()),m)]:[]})};return e=>s(e,r,'',[])},ce=(e,t=F)=>'undefined'==typeof document?void 0:document.querySelector(`style[${t}=${e}]`)||(e=>{const t=document.createElement(e),r={appendTo:e=>e.appendChild(t)&&r,withAttribute:(e,n)=>t.setAttribute(e,n)||r,unwrap:()=>t};return r})('style').withAttribute(t,e).appendTo(document.head).unwrap(),de=(e,t)=>(t.textContent||'').includes(e),pe=e=>t=>{if(!de(t,e)){const r=document.createTextNode(t);e.appendChild(r)}},ue=(e,t=e.sheet)=>r=>{try{if(t&&!de(r,e)){const e=t.cssRules.length;t.insertRule(r,e)}}catch(e){console.error(`DOMException: Failed to parse "${r}"`)}},ye=(e,r)=>n=>{const s=Y.has(e),{baseClassName:o,computables:a,globals:i=[],rules:c}=Y.add(e,r);if(!s){const r=()=>((e,r=ce(e))=>{const n=new Map,s=t&&l(window.__STYLED_SLOW_MODE)?pe:ue;return{inject:(e,t)=>{n.has(e)||(r&&t.forEach(s(r)),n.set(e,t))},css:()=>[...n.values()].flat().join('')}})(o);z.add(o,r).inject(e,[...c,...i])}return a.length?n(e):[]},he=e=>{const t=r=>Y.get(r).computables.reduce(((n,s)=>{if(!s.predicate(e))return n;const o=s.yield(e),a=s.identity(o),i=`${a} (${r})`;return[...n,a,...ye(i,(()=>le(Y.get(r).baseClassName,a)(o)))(t)]}),[]);return t},me={plainStyles:[],propTypes:{},hasRef:!1},fe=(e,t,r=me)=>(n={})=>{const s=g({name:e,...n}),o=(e,t)=>({...r,[e]:t}),a=a=>w(a,{propTypes:r.propTypes,styles:n,toString:()=>j(s),extend:(...s)=>{const[a,i]=(l=s,c=[n,r.propTypes],l.reduce((([e,t],r)=>{const n=r||{},s=n.styles||n,o=n.propTypes||{};return[_(e,s),{...t,...o}]}),c));var l,c;return fe(e,t,o('propTypes',i))(a)},withCSS:(...r)=>fe(e,t,o('plainStyles',r))(n),withProps:s=>{const a={...r.propTypes,...s};return fe(e,t,o('propTypes',a))(n)},withRef:()=>fe(e,t,o('hasRef',!0))(n)});return a(t?t({classIdentity:s,displayName:`styled.${e}`,styleRules:n,plainStyles:r.plainStyles,hasRef:r.hasRef}):t=>fe(e,w(ge(t),{propTypes:r.propTypes}),r)(n))},ge=t=>({classIdentity:r,displayName:s,styleRules:a,plainStyles:i,hasRef:l})=>{const c=((e,t)=>{const r=b(e),n=()=>({...le(r)(e),...t.length&&{globals:t.map(A)}});return e=>[r,...ye(r,n)(he(e))]})(a,i),d=({children:s,className:a='',...i},l)=>{const d=o(t)?((e,t=J.names)=>Object.entries(e).reduce(((e,[r,n])=>({...e,...!t.has(r)&&{[r]:n}})),{}))(i):i,p=(e=>!h(e)&&((e=>'current'in(e||{}))(e)||n(e)))(l)?{ref:l}:void 0,u=E(r,...c(i),a);return e.createElement(t,{...d,...p,className:u},s)};return d.displayName=s,l?e.forwardRef(d):d},be=['a','abbr','address','area','article','aside','audio','b','base','bdi','bdo','blockquote','body','br','button','canvas','caption','cite','code','col','colgroup','data','datalist','dd','del','details','dfn','dialog','div','dl','dt','em','embed','fieldset','figcaption','figure','footer','form','h1','h2','h3','h4','h5','h6','head','header','hgroup','hr','html','i','iframe','img','input','ins','kbd','label','legend','li','link','main','map','mark','math','menu','meta','meter','nav','noscript','object','ol','optgroup','option','output','p','picture','portal','pre','progress','q','rp','rt','ruby','s','samp','script','section','select','small','source','span','strong','style','sub','summary','sup','svg','table','tbody','td','textarea','tfoot','th','thead','time','title','tr','track','u','ul','var','video','wbr'].reduce(((e,t)=>({...e,[t]:fe(t,ge(t))})),{generic:fe('generic')}),Se=C('px'),ve=[...P,'anyPointer','colorGamut','displayMode','orientation','overflowBlock','pointer','prefersColorScheme','prefersContrast','scripting','update','anyHover','hover','forcedColors','grid','invertedColors','overflowInline','prefersReducedMotion',...((...e)=>t=>t.reduce(((t,r)=>{return[...t,...e.map(C((n=r,n.charAt(0).toUpperCase()+n.slice(1)))),r];var n}),[]))('min','max')(['height','width','aspectRatio','color','colorIndex','monochrome','resolution'])],we=x(' and '),$e=x(', '),Ce=e=>(...t)=>R(t.map(e)),Te={and:(...e)=>R(e.reduce(O,[''])),or:(...e)=>R(e)},je=e=>(t,r)=>[...t,...r].reduce(((t,n)=>{const s=$(e,M(n)),o=r.includes(n);return{...t,[n]:o?(...e)=>$(s,k(e)):s}}),{}),Oe=je('::')(['after','backdrop','before','cue','cueRegion','firstLetter','firstLine','fileSelectorButton','marker','placeholder','selection'],['part','slotted']),Re=je(':')(['active','anyLink','autofill','checked','default','defined','disabled','empty','enabled','first','firstChild','firstOfType','fullscreen','focus','focusVisible','focusWithin','hover','indeterminate','inRange','invalid','lastChild','lastOfType','left','link','modal','onlyChild','onlyOfType','optional','outOfRange','pictureInPicture','placeholderShown','paused','playing','readOnly','readWrite','required','right','root','scope','target','valid','visited'],W),xe=e=>`[${e}]`,Ee=e=>{const t=M(e),r=e=>r=>xe($(t,e,m(r)));return{equals:Ce(r('=')),contains:Ce(r('~=')),containsAny:Ce(r('*=')),startsWith:Ce(r('^=')),endsWith:Ce(r('$=')),toString:()=>xe(t)}},ke={...Te,...Oe,...Re,attribute:Ee,data:e=>Ee(`data-${e}`),selector:Ce(T(' ')),prop:K(B),props:{[q]:K(q),[D]:K(D),[I]:K(I)}};exports.ServerStyles=()=>e.createElement(e.Fragment,{},[...z.__getDataStore()].map((([t,r])=>e.createElement('style',{[F]:t,key:t},r.css())))),exports.default=be,exports.getStyles=U,exports.mq=(...e)=>{const t=new Set(e),r=new Set,n=(e,t)=>r.add(k([M(e),t].filter(y).join(':'))),s={...ve.reduce(((e,r)=>({...e,[r]:P.includes(r)?()=>t.add(r)&&s:e=>n(r,e)&&s})),{}),feature:(e,t)=>n(e,t)&&s,from:e=>s.minWidth(Se(e)),to:e=>s.maxWidth(Se(e)),toString:()=>E(L,we($e(...t),...r))};return s},exports.style=ke;
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var e=require('react');const t='undefined'!=typeof window,r=e=>t=>typeof t===e,n=r('function'),s=r('number'),o=r('string'),a=r('object'),i=e=>t=>t===e,l=i(!0),c=i(!1),d=i(null),p=i(void 0),u=e=>a(e)&&!d(e)&&!Array.isArray(e),y=e=>o(e)||s(e),h=e=>d(e)||p(e),{stringify:m}=JSON,f=e=>(...t)=>`${e}-${(e=>(e=>{let t=-2128831035;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=16777619*t>>>0;return t})(m(e,((e,t)=>n(t)?`[Function ${e}]`:t))).toString(36))(t)}`,g=f('e'),b=f('s'),S=f('d'),v=f('c'),w=(e,t)=>{for(const r in t)Object.defineProperty(e,r,{value:t[r]});return e},$=(...e)=>e.join(''),C=e=>t=>$(t,e),T=e=>t=>$(e,t),j=T('.'),O=(e,t)=>{return t.split('||').flatMap((r=e,e=>r.map(C(e))));var r},R=e=>e.join('||'),x=e=>(...t)=>t.filter(Boolean).join(e),E=x(' '),k=e=>`(${e})`,_=(e,t)=>Object.entries(t).reduce(((t,[r,n])=>({...t,[r]:u(n)&&r in e?_(e[r],n):n})),{...e}),M=e=>e.trim().replace(/([A-Z])+/g,'-$1').toLowerCase(),N=(...e)=>t=>e.some((e=>t.startsWith(e))),A=e=>e.replace(/ {2}|\r\n|\n|\r/gm,'').trim(),L='@media',P=['print','screen'],W=['host','lang','is','not','where','nthChild','nthLastChild','nthLastOfType','nthOfType'],q='all',D='any',I='not',B='only',F='data-styled-sheet',H=(e,r)=>{const n=t?window:global,s=`__STYLED_${e}_REGISTER`;return s in n||Object.defineProperty(n,s,{value:Object.freeze(r())}),n[s]},G=e=>({add:(t,r)=>e.get(t)||e.set(t,{...r(),toString:()=>t}).get(t),get:t=>e.get(t),has:t=>e.has(t),__getDataStore:()=>new Map(e)}),Y=H('CACHE',(()=>G(new Map))),z=H('SHEET',(()=>{const e=new Map,t=([e,t])=>`<style ${F}="${e}">${t.css()}</style>`;return{...G(e),getStyles:()=>[...e].map(t).join('')}})),J=H('PROPS',(()=>({...G(new Map),names:new Set}))),{getStyles:U}=z,V=e=>t=>!h(e[t])&&!c(e[t]),Z=(e,t)=>{const r={[q]:e=>t.every(V(e)),[D]:e=>t.some(V(e)),[I]:e=>t.every((e=>t=>h(e[t]))(e)),[B]:e=>V(e)(t[0])};return t.forEach((e=>J.names.add(e))),{keys:t,predicate:r[e]}},K=e=>(...t)=>J.add(`props.${e}(${t})`,(()=>Z(e,t))).toString(),Q=i('content'),X=N('@container',L,'@supports'),ee=N(':','[',' ','>','~','+','.'),te=e=>()=>e,re=(e,t)=>{const r=Q(e)||s(t)?m:A;return`${M(e)}:${r(t)};`},ne=e=>(t,r)=>r.reduceRight(e,t),se=(e,t)=>`${t}{${e}}`,oe=ne(se),ae=ne(((e,t)=>({[t]:{...e}}))),ie=(e,t,r)=>n=>{const s=1===r.length?n[r[0]]:n,o=t(s);return u(o)?ae(o,e):{}},le=(...e)=>{const[t]=e,r=[e.map(j).join('')],s=(e,r,o,a)=>{const i=n(e),l=!J.has(o),c=J.get(o),[d,p]=(h=e,Object.entries(h).reduce((([e,t],[r,s])=>[y(s)?$(e,re(r,s)):e,u(s)||n(s)?{...t,[r]:s}:t]),['',{}]));var h;const m=X(o)?[...a,o]:a,f=ee(o)?O(r,o):r;return Object.entries(p).reduce(((e,[r,n])=>{if(!l)return e;const{computables:o,rules:a}=s(n,f,r,m);return{baseClassName:t,computables:[...e.computables,...o],rules:[...e.rules,...a]}}),{baseClassName:t,computables:l?[]:[{...c,identity:i?v:te(S(e)),yield:i?ie(a,e,c.keys):te(e)}],rules:l&&d?[oe(se(d,f.join()),m)]:[]})};return e=>s(e,r,'',[])},ce=(e,t=F)=>'undefined'==typeof document?void 0:document.querySelector(`style[${t}=${e}]`)||(e=>{const t=document.createElement(e),r={appendTo:e=>e.appendChild(t)&&r,withAttribute:(e,n)=>t.setAttribute(e,n)||r,unwrap:()=>t};return r})('style').withAttribute(t,e).appendTo(document.head).unwrap(),de=(e,t)=>(t.textContent||'').includes(e),pe=e=>t=>{if(!de(t,e)){const r=document.createTextNode(t);e.appendChild(r)}},ue=(e,t=e.sheet)=>r=>{try{if(t&&!de(r,e)){const e=t.cssRules.length;t.insertRule(r,e)}}catch(e){console.error(`DOMException: Failed to parse "${r}"`)}},ye=(e,r)=>n=>{const s=Y.has(e),{baseClassName:o,computables:a,globals:i=[],rules:c}=Y.add(e,r);if(!s){const r=()=>((e,r=ce(e))=>{const n=new Map,s=t&&l(window.__STYLED_SLOW_MODE)?pe:ue;return{inject:(e,t)=>{n.has(e)||(r&&t.forEach(s(r)),n.set(e,t))},css:()=>[...n.values()].flat().join('')}})(o);z.add(o,r).inject(e,[...c,...i])}return a.length?n(e):[]},he=e=>{const t=r=>Y.get(r).computables.reduce(((n,s)=>{if(!s.predicate(e))return n;const o=s.yield(e),a=s.identity(o),i=`${a} (${r})`;return[...n,a,...ye(i,(()=>le(Y.get(r).baseClassName,a)(o)))(t)]}),[]);return t},me={plainStyles:[],propTypes:{},hasRef:!1},fe=(e,t,r=me)=>(n={})=>{const s=g({name:e,...n}),o=(e,t)=>({...r,[e]:t}),a=a=>w(a,{propTypes:r.propTypes,styles:n,toString:()=>j(s),extend:(...s)=>{const[a,i]=(l=s,c=[n,r.propTypes],l.reduce((([e,t],r)=>{const n=r||{},s=n.styles||n,o=n.propTypes||{};return[_(e,s),{...t,...o}]}),c));var l,c;return fe(e,t,o('propTypes',i))(a)},withCSS:(...r)=>fe(e,t,o('plainStyles',r))(n),withProps:s=>{const a={...r.propTypes,...s};return fe(e,t,o('propTypes',a))(n)},withRef:()=>fe(e,t,o('hasRef',!0))(n)});return a(t?t({classIdentity:s,displayName:`styled.${e}`,styleRules:n,plainStyles:r.plainStyles,hasRef:r.hasRef}):t=>fe(e,w(ge(t),{propTypes:r.propTypes}),r)(n))},ge=t=>({classIdentity:r,displayName:n,styleRules:s,plainStyles:a,hasRef:i})=>{const l=((e,t)=>{const r=b(e),n=()=>({...le(r)(e),...t.length&&{globals:t.map(A)}});return e=>[r,...ye(r,n)(he(e))]})(s,a),c=({children:n,className:s='',...a},c)=>{const d=o(t)?((e,t=J.names)=>Object.entries(e).reduce(((e,[r,n])=>({...e,...!t.has(r)&&{[r]:n}})),{}))(a):a,p=E(r,...l(a),s);return e.createElement(t,{...d,...i&&{ref:c},className:p},n)};return c.displayName=n,i?e.forwardRef(c):c},be=['a','abbr','address','area','article','aside','audio','b','base','bdi','bdo','blockquote','body','br','button','canvas','caption','cite','code','col','colgroup','data','datalist','dd','del','details','dfn','dialog','div','dl','dt','em','embed','fieldset','figcaption','figure','footer','form','h1','h2','h3','h4','h5','h6','head','header','hgroup','hr','html','i','iframe','img','input','ins','kbd','label','legend','li','link','main','map','mark','math','menu','meta','meter','nav','noscript','object','ol','optgroup','option','output','p','picture','portal','pre','progress','q','rp','rt','ruby','s','samp','script','section','select','small','source','span','strong','style','sub','summary','sup','svg','table','tbody','td','textarea','tfoot','th','thead','time','title','tr','track','u','ul','var','video','wbr'].reduce(((e,t)=>({...e,[t]:fe(t,ge(t))})),{generic:fe('generic')}),Se=C('px'),ve=[...P,'anyPointer','colorGamut','displayMode','orientation','overflowBlock','pointer','prefersColorScheme','prefersContrast','scripting','update','anyHover','hover','forcedColors','grid','invertedColors','overflowInline','prefersReducedMotion',...((...e)=>t=>t.reduce(((t,r)=>{return[...t,...e.map(C((n=r,n.charAt(0).toUpperCase()+n.slice(1)))),r];var n}),[]))('min','max')(['height','width','aspectRatio','color','colorIndex','monochrome','resolution'])],we=x(' and '),$e=x(', '),Ce=e=>(...t)=>R(t.map(e)),Te={and:(...e)=>R(e.reduce(O,[''])),or:(...e)=>R(e)},je=e=>(t,r)=>[...t,...r].reduce(((t,n)=>{const s=$(e,M(n)),o=r.includes(n);return{...t,[n]:o?(...e)=>$(s,k(e)):s}}),{}),Oe=je('::')(['after','backdrop','before','cue','cueRegion','firstLetter','firstLine','fileSelectorButton','marker','placeholder','selection'],['part','slotted']),Re=je(':')(['active','anyLink','autofill','checked','default','defined','disabled','empty','enabled','first','firstChild','firstOfType','fullscreen','focus','focusVisible','focusWithin','hover','indeterminate','inRange','invalid','lastChild','lastOfType','left','link','modal','onlyChild','onlyOfType','optional','outOfRange','pictureInPicture','placeholderShown','paused','playing','readOnly','readWrite','required','right','root','scope','target','valid','visited'],W),xe=e=>`[${e}]`,Ee=e=>{const t=M(e),r=e=>r=>xe($(t,e,m(r)));return{equals:Ce(r('=')),contains:Ce(r('~=')),containsAny:Ce(r('*=')),startsWith:Ce(r('^=')),endsWith:Ce(r('$=')),toString:()=>xe(t)}},ke={...Te,...Oe,...Re,attribute:Ee,data:e=>Ee(`data-${e}`),selector:Ce(T(' ')),prop:K(B),props:{[q]:K(q),[D]:K(D),[I]:K(I)}};exports.ServerStyles=()=>e.createElement(e.Fragment,{},[...z.__getDataStore()].map((([t,r])=>e.createElement('style',{[F]:t,key:t},r.css())))),exports.default=be,exports.getStyles=U,exports.mq=(...e)=>{const t=new Set(e),r=new Set,n=(e,t)=>r.add(k([M(e),t].filter(y).join(':'))),s={...ve.reduce(((e,r)=>({...e,[r]:P.includes(r)?()=>t.add(r)&&s:e=>n(r,e)&&s})),{}),feature:(e,t)=>n(e,t)&&s,from:e=>s.minWidth(Se(e)),to:e=>s.maxWidth(Se(e)),toString:()=>E(L,we($e(...t),...r))};return s},exports.style=ke;
|
package/react/cjs/index.js.br
CHANGED
|
Binary file
|