@slimr/styled 1.0.40
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 +163 -0
- package/package.json +55 -0
- package/src/index.cjs +35 -0
- package/src/index.cjs.map +1 -0
- package/src/index.d.ts +56 -0
- package/src/index.js +35 -0
- package/src/index.js.map +1 -0
- package/src/index.ts +223 -0
- package/src/withHtmlTags.cjs +35 -0
- package/src/withHtmlTags.cjs.map +1 -0
- package/src/withHtmlTags.d.ts +190 -0
- package/src/withHtmlTags.js +35 -0
- package/src/withHtmlTags.js.map +1 -0
- package/src/withHtmlTags.ts +197 -0
- package/tsconfig.json +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# @slimr/styled
|
|
2
|
+
|
|
3
|
+
A tiny (2kb) React css-in-js library inspired by chakra-ui, emotion, and styled-components libs
|
|
4
|
+
|
|
5
|
+
Demos: See `./packages/demo` or [CodeSandbox](https://codesandbox.io/s/64r9px?file=/src/App.tsx)
|
|
6
|
+
|
|
7
|
+
Sister libs:
|
|
8
|
+
|
|
9
|
+
- [@slimr/css](https://www.npmjs.com/package/@slimr/css)
|
|
10
|
+
|
|
11
|
+
Pros:
|
|
12
|
+
|
|
13
|
+
- Much less bundle size and runtime sluggishness
|
|
14
|
+
- Less is more: less bugs, no breaking changes
|
|
15
|
+
- Supports declaring css and styled components inside of Components for better code colocating and NO MORE NEED TO PASS ARGS!
|
|
16
|
+
- Styled shortcuts like styled.div when imported from `@slimr/styled/withHtmlTags`. Note: To get types you'll need tsconfig:moduleResolution >= `Node16`
|
|
17
|
+
- Zx/Css shorthand props like [chakra-ui](https://chakra-ui.com/docs/styled-system/style-props):
|
|
18
|
+
- Pass shorthand props or zx props to styled components. This lib will create css classes if complex, passthrough as styles otherwise.
|
|
19
|
+
- `m` --> `margin`
|
|
20
|
+
- `mx` --> `margin-left` and right
|
|
21
|
+
- `py` --> `padding-top` and bottom
|
|
22
|
+
- More [here](https://github.com/bdombro/slimr/blob/65bf012086760b7e481a4064f3be8aea6a098b91/packages/css/src/index.ts#L73)!
|
|
23
|
+
- CSS Breakpoints shorthand like [chakra-ui](https://chakra-ui.com/docs/styled-system/responsive-styles):
|
|
24
|
+
|
|
25
|
+
```css
|
|
26
|
+
margin: [auto, null, inherit];
|
|
27
|
+
/* Translates to */
|
|
28
|
+
margin: auto;
|
|
29
|
+
@media (min-width: 48em) {
|
|
30
|
+
margin: inherit;
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- Breakpoints are `[30em, 48em, 62em, 80em, 96em]`
|
|
35
|
+
|
|
36
|
+
Cons:
|
|
37
|
+
|
|
38
|
+
- No SSR support
|
|
39
|
+
|
|
40
|
+
## Setup/Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm i @slimr/styled
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
Preview below. For full code, see demos
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
// Create primitive components if you like
|
|
52
|
+
const Box = styled.div`
|
|
53
|
+
pos: relative;
|
|
54
|
+
`
|
|
55
|
+
|
|
56
|
+
interface ButtonProps extends Omit<HtmlTagProps['button'], 'id'> {
|
|
57
|
+
id: HtmlTagProps['button']['id'] // make required
|
|
58
|
+
}
|
|
59
|
+
function Button(props: ButtonProps) {
|
|
60
|
+
return (
|
|
61
|
+
<button
|
|
62
|
+
{...props}
|
|
63
|
+
onClick={(e) => {
|
|
64
|
+
console.log(`Button ${props.id} clicked`)
|
|
65
|
+
props.onClick?.(e)
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
const ButtonP = styled(Button)`
|
|
71
|
+
bg: red;
|
|
72
|
+
c: white;
|
|
73
|
+
w: [100%, null, inherit];
|
|
74
|
+
`
|
|
75
|
+
|
|
76
|
+
export function App() {
|
|
77
|
+
const on = useOscillator()
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Box
|
|
81
|
+
// enjoy chakra-ui like shorthand syntax
|
|
82
|
+
bg={['lightblue', null, 'lightred']}
|
|
83
|
+
>
|
|
84
|
+
<ButtonP
|
|
85
|
+
// use css if you'd like, which gets converted into a css class and attached to this element
|
|
86
|
+
css={`
|
|
87
|
+
--font-weight: [bold, null, initial];
|
|
88
|
+
`}
|
|
89
|
+
id="my-button"
|
|
90
|
+
// kinda like style but accepts shorthand syntax
|
|
91
|
+
_zx={{
|
|
92
|
+
textTransform: on ? 'uppercase' : 'inherit',
|
|
93
|
+
}}
|
|
94
|
+
// Any attr with '_' prefix will be passed to zx
|
|
95
|
+
_fontWeight="var(--font-weight)"
|
|
96
|
+
// like _zx, but applies only on :hover
|
|
97
|
+
_hover={{ bg: 'lightblue' }}
|
|
98
|
+
// like _zx, but applies only on :active
|
|
99
|
+
_active={{ bg: 'lightblue' }}
|
|
100
|
+
// like _zx, but applies only when browser prefers dark modes
|
|
101
|
+
_dark={{ bg: 'lightblue' }}
|
|
102
|
+
>
|
|
103
|
+
Click me!
|
|
104
|
+
</ButtonP>
|
|
105
|
+
</Box>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Comparisons
|
|
111
|
+
|
|
112
|
+
#### [Chakra-UI](https://chakra-ui.com/)
|
|
113
|
+
|
|
114
|
+
- A popular css-in-js lib that inspired this lib
|
|
115
|
+
|
|
116
|
+
Pros
|
|
117
|
+
|
|
118
|
+
- More mature, SSR support
|
|
119
|
+
- Premade components
|
|
120
|
+
|
|
121
|
+
Cons
|
|
122
|
+
|
|
123
|
+
- Is crazy large bundle impact (80+kb)
|
|
124
|
+
|
|
125
|
+
#### [Styled-Components](https://github.com/styled-components/styled-components)
|
|
126
|
+
|
|
127
|
+
- A popular css-in-js lib that inspired this lib
|
|
128
|
+
|
|
129
|
+
Pros
|
|
130
|
+
|
|
131
|
+
- More mature, SSR support
|
|
132
|
+
|
|
133
|
+
Cons
|
|
134
|
+
|
|
135
|
+
- Is massive (~12kb), plus has dependency on emotion (~11kb)
|
|
136
|
+
- Does not support zx prop or css shorthand props
|
|
137
|
+
|
|
138
|
+
#### [Emotion](https://emotion.sh/docs/introduction)
|
|
139
|
+
|
|
140
|
+
- A popular css-in-js lib similar to styled-components
|
|
141
|
+
|
|
142
|
+
Pros
|
|
143
|
+
|
|
144
|
+
- More mature, SSR support
|
|
145
|
+
|
|
146
|
+
Cons
|
|
147
|
+
|
|
148
|
+
- Is large (>10kb)
|
|
149
|
+
- Many features require addons, which make bundle even larger
|
|
150
|
+
- Does not support zx prop or css shorthand props
|
|
151
|
+
|
|
152
|
+
#### [Goober](https://github.com/cristianbote/goober)
|
|
153
|
+
|
|
154
|
+
- another tiny 1kb styled-components like css-in-js
|
|
155
|
+
|
|
156
|
+
Pros:
|
|
157
|
+
|
|
158
|
+
- More mature, SSR support
|
|
159
|
+
|
|
160
|
+
Cons:
|
|
161
|
+
|
|
162
|
+
- Many features require addons, which in sum may make the bundle larger than slimr
|
|
163
|
+
- Does not support zx prop or css shorthand props
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@slimr/styled",
|
|
3
|
+
"version": "1.0.40",
|
|
4
|
+
"author": "Brian Dombrowski",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"private": false,
|
|
7
|
+
"keywords": [
|
|
8
|
+
"chakra",
|
|
9
|
+
"chakra-ui",
|
|
10
|
+
"emotion",
|
|
11
|
+
"styled-components",
|
|
12
|
+
"preact",
|
|
13
|
+
"react"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/bdombro/slimr.git"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./src/index.cjs",
|
|
21
|
+
"module": "./src/index.js",
|
|
22
|
+
"types": "./src/index.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": "./src/index.js",
|
|
26
|
+
"require": "./src/index.cjs",
|
|
27
|
+
"types": "./src/index.ts"
|
|
28
|
+
},
|
|
29
|
+
"./withHtmlTags": {
|
|
30
|
+
"import": "./src/withHtmlTags.js",
|
|
31
|
+
"require": "./src/withHtmlTags.cjs",
|
|
32
|
+
"types": "./src/withHtmlTags.ts"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"src",
|
|
37
|
+
"README.md",
|
|
38
|
+
"tsconfig.json"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "npm run clean && tsup",
|
|
42
|
+
"clean": "find -E ./src -regex '.*(\\.js|\\.cjs|\\.d\\.ts|\\.map)' -delete",
|
|
43
|
+
"prepack": "npm run build && npm version patch",
|
|
44
|
+
"postpublish": "npm run clean"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@types/react": "^18",
|
|
48
|
+
"@types/react-dom": "^18",
|
|
49
|
+
"react": "^18",
|
|
50
|
+
"react-dom": "^18"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@slimr/css": "^1.0.36"
|
|
54
|
+
}
|
|
55
|
+
}
|
package/src/index.cjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";var A=Object.create;var d=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var w=(r,e)=>{for(var t in e)d(r,t,{get:e[t],enumerable:!0})},Z=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of M(e))!L.call(r,a)&&a!==t&&d(r,a,{get:()=>e[a],enumerable:!(s=j(e,a))||s.enumerable});return r},o=(r,e,t)=>(Z(r,e,"default"),t&&Z(t,e,"default")),z=(r,e,t)=>(t=r!=null?A(N(r)):{},Z(e||!r||!r.__esModule?d(t,"default",{value:r,enumerable:!0}):t,r)),O=r=>Z(d({},"__esModule",{value:!0}),r);var i={};w(i,{css:()=>l.default,default:()=>b});module.exports=O(i);var m=require("react"),l=z(require("@slimr/css"),1);o(i,require("@slimr/css"),module.exports);function F(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function R(r){return r.replace(/-./g,e=>e[1].toUpperCase())}function W(r){return Object.entries(r).reduce((e,[t,s])=>(t==="mx"?(e.marginLeft=s,e.marginRight=s):t==="my"?(e.marginTop=s,e.marginBottom=s):t==="px"?(e.paddingLeft=s,e.paddingRight=s):t==="py"?(e.paddingTop=s,e.paddingBottom=s):t in l.shorthandPropsMap?e[R(l.shorthandPropsMap[t])]=s:e[t]=s,e),{})}function x(r){return Object.entries(r).map(([e,t])=>t?(e=F(e),typeof t=="number"&&(t=t+"px"),Array.isArray(t)&&(t="["+t.map(s=>typeof s=="number"?s+"px":s).join(",")+"]"),e+":"+t+";"):"").join(`
|
|
2
|
+
`)}function b(r){return(...e)=>{let t=(0,l.default)(...e),s=(0,m.forwardRef)((a,$)=>{let{_active:k,_css:p,_dark:c,_focus:y,_focusVisible:h,_focusWithin:_,_hover:g,_target:C,_visited:S,_zx:u={},...P}=a;Object.entries(a).forEach(([f,T])=>{f.startsWith("_")&&(u[f.slice(1)]=T,delete P[f])});let n="";return k&&(n+=`
|
|
3
|
+
&:active {
|
|
4
|
+
${x(k)}
|
|
5
|
+
}
|
|
6
|
+
`),c&&(n+=`
|
|
7
|
+
@media (prefers-color-scheme: dark) {
|
|
8
|
+
${x(c)}
|
|
9
|
+
}
|
|
10
|
+
`),y&&(n+=`
|
|
11
|
+
&:focus {
|
|
12
|
+
${x(y)}
|
|
13
|
+
}
|
|
14
|
+
`),h&&(n+=`
|
|
15
|
+
&:focus-visible {
|
|
16
|
+
${x(h)}
|
|
17
|
+
}
|
|
18
|
+
`),_&&(n+=`
|
|
19
|
+
&:focus-within {
|
|
20
|
+
${x(_)}
|
|
21
|
+
}
|
|
22
|
+
`),g&&(n+=`
|
|
23
|
+
&:hover {
|
|
24
|
+
${x(g)}
|
|
25
|
+
}
|
|
26
|
+
`),C&&(n+=`
|
|
27
|
+
&:target {
|
|
28
|
+
${x(C)}
|
|
29
|
+
}
|
|
30
|
+
`),S&&(n+=`
|
|
31
|
+
&:visited {
|
|
32
|
+
${x(S)}
|
|
33
|
+
}
|
|
34
|
+
`),Object.values(u).some(f=>Array.isArray(f))||n?n=x(u)+n:(u=W(u),P.style={...P.style,...u}),(0,m.createElement)(r,{ref:$,...P,className:(0,l.classJoin)(t,p?p.includes(":")?(0,l.default)(p):p:void 0,n?(0,l.default)(n):void 0,a.className)})});return s.toString=()=>"."+t,s}}0&&(module.exports={css});
|
|
35
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["import { createElement, CSSProperties, FC, forwardRef, HTMLAttributes } from 'react'\nimport css, { classJoin, ShorthandProps, shorthandProps, shorthandPropsMap, TemplateStringProps } from '@slimr/css'\n\nexport { css }\nexport * from '@slimr/css'\n\n/** A type that represents all the css properties + shorthand props */\nexport interface ZxProps extends CSSProperties, ShorthandProps {}\ntype ZxP = ZxProps\n\ntype Zx = {\n [k in keyof ZxP]:\n | ZxP[k]\n | [ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n}\n\ntype _Props = {\n [k in keyof Zx as `_${k}`]?: Zx[k]\n}\n\nexport interface SCProps extends _Props {\n /** Like zx prop, but applies only on :active */\n _active?: Zx\n className?: string\n /** A string of css or classname to be added to the component */\n _css?: string\n /** Like zx prop, but applies only when user prefers dark theme */\n _dark?: Zx\n /** Like zx prop, but applies only on :focus */\n _focus?: Zx\n /** Like zx prop, but applies only on :focus-visible */\n _focusVisible?: Zx\n /** Like zx prop, but applies only on :focus-within */\n _focusWithin?: Zx\n /** Like zx prop, but applies only on :hover */\n _hover?: Zx\n style?: CSSProperties\n /** Like zx prop, but applies only on :target */\n _target?: Zx\n /** Like zx prop, but applies only on :visited */\n _visited?: Zx\n /**\n * Like style prop, but enhanced with features like chakra\n * - Array values are converted to media query breakpoints\n * - Numbers are converted to px\n * - Shorthand props are supported\n */\n _zx?: Zx\n}\n\n/** Styled Component: Like FunctionalComponent but adds SCProps */\nexport type SC<T extends { className?: HTMLAttributes<any>['className'] }> = FC<T & SCProps>\n\nfunction toKebabCase(str: string) {\n return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()\n}\n\nfunction toCamelCase(str: string) {\n return str.replace(/-./g, (x) => x[1].toUpperCase())\n}\n\nfunction expandShorthandProps(zx: Zx) {\n return Object.entries(zx).reduce((acc, [k, v]) => {\n if (k === 'mx') {\n acc.marginLeft = v\n acc.marginRight = v\n } else if (k === 'my') {\n acc.marginTop = v\n acc.marginBottom = v\n } else if (k === 'px') {\n acc.paddingLeft = v\n acc.paddingRight = v\n } else if (k === 'py') {\n acc.paddingTop = v\n acc.paddingBottom = v\n } else if (k in shorthandPropsMap) {\n acc[toCamelCase(shorthandPropsMap[k as keyof typeof shorthandPropsMap])] = v\n } else {\n acc[k] = v\n }\n return acc\n }, {} as any)\n}\n\nfunction zxToCss(zx: Zx): string {\n return Object.entries(zx)\n .map(([k, v]) => {\n if (!v) return ''\n k = toKebabCase(k)\n if (typeof v === 'number') v = v + 'px'\n if (Array.isArray(v)) {\n // @ts-ignore\n v = '[' + v.map((v) => (typeof v === 'number' ? v + 'px' : v)).join(',') + ']'\n }\n return k + ':' + v + ';'\n })\n .join('\\n')\n}\n\n/**\n * A lightweight alternative to styled-components\n * @param function - a functional component to be styled; must accept a className prop\n * @returns a function that accepts a template string of css returns a decorated functional component\n */\nexport default function styled<C extends FC<any>>(Component: C) {\n return (...cssProps: TemplateStringProps) => {\n const className = css(...cssProps)\n /**\n * A functional component that accepts Styled Props\n */\n const CStyled = forwardRef((props: SCProps, ref) => {\n let {\n _active,\n _css,\n _dark,\n _focus,\n _focusVisible,\n _focusWithin,\n _hover,\n _target,\n _visited,\n _zx = {},\n ...rest\n } = props\n\n // Pluck out $ prefixed props\n Object.entries(props).forEach(([k, v]) => {\n if (k.startsWith('_')) {\n // @ts-ignore\n _zx[k.slice(1)] = v\n // @ts-ignore\n delete rest[k]\n }\n })\n\n let cssStr = ''\n\n if (_active) {\n cssStr += `\n &:active {\n ${zxToCss(_active)}\n }\n `\n }\n if (_dark) {\n cssStr += `\n @media (prefers-color-scheme: dark) {\n ${zxToCss(_dark)}\n }\n `\n }\n if (_focus) {\n cssStr += `\n &:focus {\n ${zxToCss(_focus)}\n }\n `\n }\n if (_focusVisible) {\n cssStr += `\n &:focus-visible {\n ${zxToCss(_focusVisible)}\n }\n `\n }\n if (_focusWithin) {\n cssStr += `\n &:focus-within {\n ${zxToCss(_focusWithin)}\n }\n `\n }\n if (_hover) {\n cssStr += `\n &:hover {\n ${zxToCss(_hover)}\n }\n `\n }\n if (_target) {\n cssStr += `\n &:target {\n ${zxToCss(_target)}\n }\n `\n }\n if (_visited) {\n cssStr += `\n &:visited {\n ${zxToCss(_visited)}\n }\n `\n }\n\n const hasMediaQuery = Object.values(_zx).some((v) => Array.isArray(v))\n // If has media query styles, use css class. Otherwise favor inline styles\n if (hasMediaQuery || cssStr) {\n cssStr = zxToCss(_zx) + cssStr\n } else {\n _zx = expandShorthandProps(_zx)\n rest.style = { ...rest.style, ..._zx } as CSSProperties\n }\n\n return createElement(Component, {\n ref,\n ...rest,\n className: classJoin(\n className,\n _css ? (_css.includes(':') ? css(_css) : _css) : undefined,\n cssStr ? css(cssStr) : undefined,\n props.className\n ),\n })\n })\n CStyled.toString = () => '.' + className\n return CStyled as unknown as SC<Parameters<C>[0]>\n }\n}\n"],"mappings":"wmBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,QAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA6E,iBAC7EC,EAAuG,2BAGvGC,EAAAP,EAAc,sBAJd,gBA0DA,SAASQ,EAAYC,EAAa,CAChC,OAAOA,EAAI,QAAQ,kBAAmB,OAAO,EAAE,YAAY,CAC7D,CAEA,SAASC,EAAYD,EAAa,CAChC,OAAOA,EAAI,QAAQ,MAAQE,GAAMA,EAAE,GAAG,YAAY,CAAC,CACrD,CAEA,SAASC,EAAqBC,EAAQ,CACpC,OAAO,OAAO,QAAQA,CAAE,EAAE,OAAO,CAACC,EAAK,CAACC,EAAGC,CAAC,KACtCD,IAAM,MACRD,EAAI,WAAaE,EACjBF,EAAI,YAAcE,GACTD,IAAM,MACfD,EAAI,UAAYE,EAChBF,EAAI,aAAeE,GACVD,IAAM,MACfD,EAAI,YAAcE,EAClBF,EAAI,aAAeE,GACVD,IAAM,MACfD,EAAI,WAAaE,EACjBF,EAAI,cAAgBE,GACXD,KAAK,oBACdD,EAAIJ,EAAY,oBAAkBK,EAAoC,GAAKC,EAE3EF,EAAIC,GAAKC,EAEJF,GACN,CAAC,CAAQ,CACd,CAEA,SAASG,EAAQJ,EAAgB,CAC/B,OAAO,OAAO,QAAQA,CAAE,EACrB,IAAI,CAAC,CAACE,EAAGC,CAAC,IACJA,GACLD,EAAIP,EAAYO,CAAC,EACb,OAAOC,GAAM,WAAUA,EAAIA,EAAI,MAC/B,MAAM,QAAQA,CAAC,IAEjBA,EAAI,IAAMA,EAAE,IAAKA,GAAO,OAAOA,GAAM,SAAWA,EAAI,KAAOA,CAAE,EAAE,KAAK,GAAG,EAAI,KAEtED,EAAI,IAAMC,EAAI,KAPN,EAQhB,EACA,KAAK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AK,MAAO,GAAGD,CAAI,MAGhC,iBAAchB,EAAW,CAC9B,IAAAM,EACA,GAAGW,EACH,aAAW,aACTf,EACAM,EAAQA,EAAK,SAAS,GAAG,KAAI,EAAAL,SAAIK,CAAI,EAAIA,EAAQ,OACjDU,KAAS,EAAAf,SAAIe,CAAM,EAAI,OACvBb,EAAM,SACR,CACF,CAAC,CACH,CAAC,EACD,OAAAD,EAAQ,SAAW,IAAM,IAAMF,EACxBE,CACT,CACF","names":["src_exports","__export","css","styled","__toCommonJS","import_react","import_css","__reExport","toKebabCase","str","toCamelCase","x","expandShorthandProps","zx","acc","k","v","zxToCss","styled","Component","cssProps","className","css","CStyled","props","ref","_active","_css","_dark","_focus","_focusVisible","_focusWithin","_hover","_target","_visited","_zx","rest","cssStr"]}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CSSProperties, HTMLAttributes, FC } from 'react';
|
|
2
|
+
import { ShorthandProps } from '@slimr/css';
|
|
3
|
+
export * from '@slimr/css';
|
|
4
|
+
export { default as css } from '@slimr/css';
|
|
5
|
+
|
|
6
|
+
/** A type that represents all the css properties + shorthand props */
|
|
7
|
+
interface ZxProps extends CSSProperties, ShorthandProps {
|
|
8
|
+
}
|
|
9
|
+
type ZxP = ZxProps;
|
|
10
|
+
type Zx = {
|
|
11
|
+
[k in keyof ZxP]: ZxP[k] | [ZxP[k] | null, ZxP[k]] | [ZxP[k] | null, ZxP[k] | null, ZxP[k]] | [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]] | [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]] | [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]] | [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]];
|
|
12
|
+
};
|
|
13
|
+
type _Props = {
|
|
14
|
+
[k in keyof Zx as `_${k}`]?: Zx[k];
|
|
15
|
+
};
|
|
16
|
+
interface SCProps extends _Props {
|
|
17
|
+
/** Like zx prop, but applies only on :active */
|
|
18
|
+
_active?: Zx;
|
|
19
|
+
className?: string;
|
|
20
|
+
/** A string of css or classname to be added to the component */
|
|
21
|
+
_css?: string;
|
|
22
|
+
/** Like zx prop, but applies only when user prefers dark theme */
|
|
23
|
+
_dark?: Zx;
|
|
24
|
+
/** Like zx prop, but applies only on :focus */
|
|
25
|
+
_focus?: Zx;
|
|
26
|
+
/** Like zx prop, but applies only on :focus-visible */
|
|
27
|
+
_focusVisible?: Zx;
|
|
28
|
+
/** Like zx prop, but applies only on :focus-within */
|
|
29
|
+
_focusWithin?: Zx;
|
|
30
|
+
/** Like zx prop, but applies only on :hover */
|
|
31
|
+
_hover?: Zx;
|
|
32
|
+
style?: CSSProperties;
|
|
33
|
+
/** Like zx prop, but applies only on :target */
|
|
34
|
+
_target?: Zx;
|
|
35
|
+
/** Like zx prop, but applies only on :visited */
|
|
36
|
+
_visited?: Zx;
|
|
37
|
+
/**
|
|
38
|
+
* Like style prop, but enhanced with features like chakra
|
|
39
|
+
* - Array values are converted to media query breakpoints
|
|
40
|
+
* - Numbers are converted to px
|
|
41
|
+
* - Shorthand props are supported
|
|
42
|
+
*/
|
|
43
|
+
_zx?: Zx;
|
|
44
|
+
}
|
|
45
|
+
/** Styled Component: Like FunctionalComponent but adds SCProps */
|
|
46
|
+
type SC<T extends {
|
|
47
|
+
className?: HTMLAttributes<any>['className'];
|
|
48
|
+
}> = FC<T & SCProps>;
|
|
49
|
+
/**
|
|
50
|
+
* A lightweight alternative to styled-components
|
|
51
|
+
* @param function - a functional component to be styled; must accept a className prop
|
|
52
|
+
* @returns a function that accepts a template string of css returns a decorated functional component
|
|
53
|
+
*/
|
|
54
|
+
declare function styled<C extends FC<any>>(Component: C): (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<Parameters<C>[0]>;
|
|
55
|
+
|
|
56
|
+
export { SC, SCProps, ZxProps, styled as default };
|
package/src/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import{createElement as C,forwardRef as S}from"react";import f,{classJoin as b,shorthandPropsMap as h}from"@slimr/css";export*from"@slimr/css";function $(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function T(n){return n.replace(/-./g,e=>e[1].toUpperCase())}function A(n){return Object.entries(n).reduce((e,[t,r])=>(t==="mx"?(e.marginLeft=r,e.marginRight=r):t==="my"?(e.marginTop=r,e.marginBottom=r):t==="px"?(e.paddingLeft=r,e.paddingRight=r):t==="py"?(e.paddingTop=r,e.paddingBottom=r):t in h?e[T(h[t])]=r:e[t]=r,e),{})}function i(n){return Object.entries(n).map(([e,t])=>t?(e=$(e),typeof t=="number"&&(t=t+"px"),Array.isArray(t)&&(t="["+t.map(r=>typeof r=="number"?r+"px":r).join(",")+"]"),e+":"+t+";"):"").join(`
|
|
2
|
+
`)}function j(n){return(...e)=>{let t=f(...e),r=S((u,_)=>{let{_active:p,_css:a,_dark:P,_focus:Z,_focusVisible:d,_focusWithin:m,_hover:k,_target:c,_visited:y,_zx:o={},...x}=u;Object.entries(u).forEach(([l,g])=>{l.startsWith("_")&&(o[l.slice(1)]=g,delete x[l])});let s="";return p&&(s+=`
|
|
3
|
+
&:active {
|
|
4
|
+
${i(p)}
|
|
5
|
+
}
|
|
6
|
+
`),P&&(s+=`
|
|
7
|
+
@media (prefers-color-scheme: dark) {
|
|
8
|
+
${i(P)}
|
|
9
|
+
}
|
|
10
|
+
`),Z&&(s+=`
|
|
11
|
+
&:focus {
|
|
12
|
+
${i(Z)}
|
|
13
|
+
}
|
|
14
|
+
`),d&&(s+=`
|
|
15
|
+
&:focus-visible {
|
|
16
|
+
${i(d)}
|
|
17
|
+
}
|
|
18
|
+
`),m&&(s+=`
|
|
19
|
+
&:focus-within {
|
|
20
|
+
${i(m)}
|
|
21
|
+
}
|
|
22
|
+
`),k&&(s+=`
|
|
23
|
+
&:hover {
|
|
24
|
+
${i(k)}
|
|
25
|
+
}
|
|
26
|
+
`),c&&(s+=`
|
|
27
|
+
&:target {
|
|
28
|
+
${i(c)}
|
|
29
|
+
}
|
|
30
|
+
`),y&&(s+=`
|
|
31
|
+
&:visited {
|
|
32
|
+
${i(y)}
|
|
33
|
+
}
|
|
34
|
+
`),Object.values(o).some(l=>Array.isArray(l))||s?s=i(o)+s:(o=A(o),x.style={...x.style,...o}),C(n,{ref:_,...x,className:b(t,a?a.includes(":")?f(a):a:void 0,s?f(s):void 0,u.className)})});return r.toString=()=>"."+t,r}}export{f as css,j as default};
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["import { createElement, CSSProperties, FC, forwardRef, HTMLAttributes } from 'react'\nimport css, { classJoin, ShorthandProps, shorthandProps, shorthandPropsMap, TemplateStringProps } from '@slimr/css'\n\nexport { css }\nexport * from '@slimr/css'\n\n/** A type that represents all the css properties + shorthand props */\nexport interface ZxProps extends CSSProperties, ShorthandProps {}\ntype ZxP = ZxProps\n\ntype Zx = {\n [k in keyof ZxP]:\n | ZxP[k]\n | [ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n}\n\ntype _Props = {\n [k in keyof Zx as `_${k}`]?: Zx[k]\n}\n\nexport interface SCProps extends _Props {\n /** Like zx prop, but applies only on :active */\n _active?: Zx\n className?: string\n /** A string of css or classname to be added to the component */\n _css?: string\n /** Like zx prop, but applies only when user prefers dark theme */\n _dark?: Zx\n /** Like zx prop, but applies only on :focus */\n _focus?: Zx\n /** Like zx prop, but applies only on :focus-visible */\n _focusVisible?: Zx\n /** Like zx prop, but applies only on :focus-within */\n _focusWithin?: Zx\n /** Like zx prop, but applies only on :hover */\n _hover?: Zx\n style?: CSSProperties\n /** Like zx prop, but applies only on :target */\n _target?: Zx\n /** Like zx prop, but applies only on :visited */\n _visited?: Zx\n /**\n * Like style prop, but enhanced with features like chakra\n * - Array values are converted to media query breakpoints\n * - Numbers are converted to px\n * - Shorthand props are supported\n */\n _zx?: Zx\n}\n\n/** Styled Component: Like FunctionalComponent but adds SCProps */\nexport type SC<T extends { className?: HTMLAttributes<any>['className'] }> = FC<T & SCProps>\n\nfunction toKebabCase(str: string) {\n return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()\n}\n\nfunction toCamelCase(str: string) {\n return str.replace(/-./g, (x) => x[1].toUpperCase())\n}\n\nfunction expandShorthandProps(zx: Zx) {\n return Object.entries(zx).reduce((acc, [k, v]) => {\n if (k === 'mx') {\n acc.marginLeft = v\n acc.marginRight = v\n } else if (k === 'my') {\n acc.marginTop = v\n acc.marginBottom = v\n } else if (k === 'px') {\n acc.paddingLeft = v\n acc.paddingRight = v\n } else if (k === 'py') {\n acc.paddingTop = v\n acc.paddingBottom = v\n } else if (k in shorthandPropsMap) {\n acc[toCamelCase(shorthandPropsMap[k as keyof typeof shorthandPropsMap])] = v\n } else {\n acc[k] = v\n }\n return acc\n }, {} as any)\n}\n\nfunction zxToCss(zx: Zx): string {\n return Object.entries(zx)\n .map(([k, v]) => {\n if (!v) return ''\n k = toKebabCase(k)\n if (typeof v === 'number') v = v + 'px'\n if (Array.isArray(v)) {\n // @ts-ignore\n v = '[' + v.map((v) => (typeof v === 'number' ? v + 'px' : v)).join(',') + ']'\n }\n return k + ':' + v + ';'\n })\n .join('\\n')\n}\n\n/**\n * A lightweight alternative to styled-components\n * @param function - a functional component to be styled; must accept a className prop\n * @returns a function that accepts a template string of css returns a decorated functional component\n */\nexport default function styled<C extends FC<any>>(Component: C) {\n return (...cssProps: TemplateStringProps) => {\n const className = css(...cssProps)\n /**\n * A functional component that accepts Styled Props\n */\n const CStyled = forwardRef((props: SCProps, ref) => {\n let {\n _active,\n _css,\n _dark,\n _focus,\n _focusVisible,\n _focusWithin,\n _hover,\n _target,\n _visited,\n _zx = {},\n ...rest\n } = props\n\n // Pluck out $ prefixed props\n Object.entries(props).forEach(([k, v]) => {\n if (k.startsWith('_')) {\n // @ts-ignore\n _zx[k.slice(1)] = v\n // @ts-ignore\n delete rest[k]\n }\n })\n\n let cssStr = ''\n\n if (_active) {\n cssStr += `\n &:active {\n ${zxToCss(_active)}\n }\n `\n }\n if (_dark) {\n cssStr += `\n @media (prefers-color-scheme: dark) {\n ${zxToCss(_dark)}\n }\n `\n }\n if (_focus) {\n cssStr += `\n &:focus {\n ${zxToCss(_focus)}\n }\n `\n }\n if (_focusVisible) {\n cssStr += `\n &:focus-visible {\n ${zxToCss(_focusVisible)}\n }\n `\n }\n if (_focusWithin) {\n cssStr += `\n &:focus-within {\n ${zxToCss(_focusWithin)}\n }\n `\n }\n if (_hover) {\n cssStr += `\n &:hover {\n ${zxToCss(_hover)}\n }\n `\n }\n if (_target) {\n cssStr += `\n &:target {\n ${zxToCss(_target)}\n }\n `\n }\n if (_visited) {\n cssStr += `\n &:visited {\n ${zxToCss(_visited)}\n }\n `\n }\n\n const hasMediaQuery = Object.values(_zx).some((v) => Array.isArray(v))\n // If has media query styles, use css class. Otherwise favor inline styles\n if (hasMediaQuery || cssStr) {\n cssStr = zxToCss(_zx) + cssStr\n } else {\n _zx = expandShorthandProps(_zx)\n rest.style = { ...rest.style, ..._zx } as CSSProperties\n }\n\n return createElement(Component, {\n ref,\n ...rest,\n className: classJoin(\n className,\n _css ? (_css.includes(':') ? css(_css) : _css) : undefined,\n cssStr ? css(cssStr) : undefined,\n props.className\n ),\n })\n })\n CStyled.toString = () => '.' + className\n return CStyled as unknown as SC<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A,EAAQ,OACjDU,EAAShB,EAAIgB,CAAM,EAAI,OACvBb,EAAM,SACR,CACF,CAAC,CACH,CAAC,EACD,OAAAF,EAAQ,SAAW,IAAM,IAAMF,EACxBE,CACT,CACF","names":["createElement","forwardRef","css","classJoin","shorthandPropsMap","toKebabCase","str","toCamelCase","x","expandShorthandProps","zx","acc","k","v","shorthandPropsMap","zxToCss","styled","Component","cssProps","className","css","CStyled","forwardRef","props","ref","_active","_css","_dark","_focus","_focusVisible","_focusWithin","_hover","_target","_visited","_zx","rest","cssStr","createElement","classJoin"]}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { createElement, CSSProperties, FC, forwardRef, HTMLAttributes } from 'react'
|
|
2
|
+
import css, { classJoin, ShorthandProps, shorthandProps, shorthandPropsMap, TemplateStringProps } from '@slimr/css'
|
|
3
|
+
|
|
4
|
+
export { css }
|
|
5
|
+
export * from '@slimr/css'
|
|
6
|
+
|
|
7
|
+
/** A type that represents all the css properties + shorthand props */
|
|
8
|
+
export interface ZxProps extends CSSProperties, ShorthandProps {}
|
|
9
|
+
type ZxP = ZxProps
|
|
10
|
+
|
|
11
|
+
type Zx = {
|
|
12
|
+
[k in keyof ZxP]:
|
|
13
|
+
| ZxP[k]
|
|
14
|
+
| [ZxP[k] | null, ZxP[k]]
|
|
15
|
+
| [ZxP[k] | null, ZxP[k] | null, ZxP[k]]
|
|
16
|
+
| [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]
|
|
17
|
+
| [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]
|
|
18
|
+
| [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]
|
|
19
|
+
| [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type _Props = {
|
|
23
|
+
[k in keyof Zx as `_${k}`]?: Zx[k]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SCProps extends _Props {
|
|
27
|
+
/** Like zx prop, but applies only on :active */
|
|
28
|
+
_active?: Zx
|
|
29
|
+
className?: string
|
|
30
|
+
/** A string of css or classname to be added to the component */
|
|
31
|
+
_css?: string
|
|
32
|
+
/** Like zx prop, but applies only when user prefers dark theme */
|
|
33
|
+
_dark?: Zx
|
|
34
|
+
/** Like zx prop, but applies only on :focus */
|
|
35
|
+
_focus?: Zx
|
|
36
|
+
/** Like zx prop, but applies only on :focus-visible */
|
|
37
|
+
_focusVisible?: Zx
|
|
38
|
+
/** Like zx prop, but applies only on :focus-within */
|
|
39
|
+
_focusWithin?: Zx
|
|
40
|
+
/** Like zx prop, but applies only on :hover */
|
|
41
|
+
_hover?: Zx
|
|
42
|
+
style?: CSSProperties
|
|
43
|
+
/** Like zx prop, but applies only on :target */
|
|
44
|
+
_target?: Zx
|
|
45
|
+
/** Like zx prop, but applies only on :visited */
|
|
46
|
+
_visited?: Zx
|
|
47
|
+
/**
|
|
48
|
+
* Like style prop, but enhanced with features like chakra
|
|
49
|
+
* - Array values are converted to media query breakpoints
|
|
50
|
+
* - Numbers are converted to px
|
|
51
|
+
* - Shorthand props are supported
|
|
52
|
+
*/
|
|
53
|
+
_zx?: Zx
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Styled Component: Like FunctionalComponent but adds SCProps */
|
|
57
|
+
export type SC<T extends { className?: HTMLAttributes<any>['className'] }> = FC<T & SCProps>
|
|
58
|
+
|
|
59
|
+
function toKebabCase(str: string) {
|
|
60
|
+
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function toCamelCase(str: string) {
|
|
64
|
+
return str.replace(/-./g, (x) => x[1].toUpperCase())
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function expandShorthandProps(zx: Zx) {
|
|
68
|
+
return Object.entries(zx).reduce((acc, [k, v]) => {
|
|
69
|
+
if (k === 'mx') {
|
|
70
|
+
acc.marginLeft = v
|
|
71
|
+
acc.marginRight = v
|
|
72
|
+
} else if (k === 'my') {
|
|
73
|
+
acc.marginTop = v
|
|
74
|
+
acc.marginBottom = v
|
|
75
|
+
} else if (k === 'px') {
|
|
76
|
+
acc.paddingLeft = v
|
|
77
|
+
acc.paddingRight = v
|
|
78
|
+
} else if (k === 'py') {
|
|
79
|
+
acc.paddingTop = v
|
|
80
|
+
acc.paddingBottom = v
|
|
81
|
+
} else if (k in shorthandPropsMap) {
|
|
82
|
+
acc[toCamelCase(shorthandPropsMap[k as keyof typeof shorthandPropsMap])] = v
|
|
83
|
+
} else {
|
|
84
|
+
acc[k] = v
|
|
85
|
+
}
|
|
86
|
+
return acc
|
|
87
|
+
}, {} as any)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function zxToCss(zx: Zx): string {
|
|
91
|
+
return Object.entries(zx)
|
|
92
|
+
.map(([k, v]) => {
|
|
93
|
+
if (!v) return ''
|
|
94
|
+
k = toKebabCase(k)
|
|
95
|
+
if (typeof v === 'number') v = v + 'px'
|
|
96
|
+
if (Array.isArray(v)) {
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
v = '[' + v.map((v) => (typeof v === 'number' ? v + 'px' : v)).join(',') + ']'
|
|
99
|
+
}
|
|
100
|
+
return k + ':' + v + ';'
|
|
101
|
+
})
|
|
102
|
+
.join('\n')
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A lightweight alternative to styled-components
|
|
107
|
+
* @param function - a functional component to be styled; must accept a className prop
|
|
108
|
+
* @returns a function that accepts a template string of css returns a decorated functional component
|
|
109
|
+
*/
|
|
110
|
+
export default function styled<C extends FC<any>>(Component: C) {
|
|
111
|
+
return (...cssProps: TemplateStringProps) => {
|
|
112
|
+
const className = css(...cssProps)
|
|
113
|
+
/**
|
|
114
|
+
* A functional component that accepts Styled Props
|
|
115
|
+
*/
|
|
116
|
+
const CStyled = forwardRef((props: SCProps, ref) => {
|
|
117
|
+
let {
|
|
118
|
+
_active,
|
|
119
|
+
_css,
|
|
120
|
+
_dark,
|
|
121
|
+
_focus,
|
|
122
|
+
_focusVisible,
|
|
123
|
+
_focusWithin,
|
|
124
|
+
_hover,
|
|
125
|
+
_target,
|
|
126
|
+
_visited,
|
|
127
|
+
_zx = {},
|
|
128
|
+
...rest
|
|
129
|
+
} = props
|
|
130
|
+
|
|
131
|
+
// Pluck out $ prefixed props
|
|
132
|
+
Object.entries(props).forEach(([k, v]) => {
|
|
133
|
+
if (k.startsWith('_')) {
|
|
134
|
+
// @ts-ignore
|
|
135
|
+
_zx[k.slice(1)] = v
|
|
136
|
+
// @ts-ignore
|
|
137
|
+
delete rest[k]
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
let cssStr = ''
|
|
142
|
+
|
|
143
|
+
if (_active) {
|
|
144
|
+
cssStr += `
|
|
145
|
+
&:active {
|
|
146
|
+
${zxToCss(_active)}
|
|
147
|
+
}
|
|
148
|
+
`
|
|
149
|
+
}
|
|
150
|
+
if (_dark) {
|
|
151
|
+
cssStr += `
|
|
152
|
+
@media (prefers-color-scheme: dark) {
|
|
153
|
+
${zxToCss(_dark)}
|
|
154
|
+
}
|
|
155
|
+
`
|
|
156
|
+
}
|
|
157
|
+
if (_focus) {
|
|
158
|
+
cssStr += `
|
|
159
|
+
&:focus {
|
|
160
|
+
${zxToCss(_focus)}
|
|
161
|
+
}
|
|
162
|
+
`
|
|
163
|
+
}
|
|
164
|
+
if (_focusVisible) {
|
|
165
|
+
cssStr += `
|
|
166
|
+
&:focus-visible {
|
|
167
|
+
${zxToCss(_focusVisible)}
|
|
168
|
+
}
|
|
169
|
+
`
|
|
170
|
+
}
|
|
171
|
+
if (_focusWithin) {
|
|
172
|
+
cssStr += `
|
|
173
|
+
&:focus-within {
|
|
174
|
+
${zxToCss(_focusWithin)}
|
|
175
|
+
}
|
|
176
|
+
`
|
|
177
|
+
}
|
|
178
|
+
if (_hover) {
|
|
179
|
+
cssStr += `
|
|
180
|
+
&:hover {
|
|
181
|
+
${zxToCss(_hover)}
|
|
182
|
+
}
|
|
183
|
+
`
|
|
184
|
+
}
|
|
185
|
+
if (_target) {
|
|
186
|
+
cssStr += `
|
|
187
|
+
&:target {
|
|
188
|
+
${zxToCss(_target)}
|
|
189
|
+
}
|
|
190
|
+
`
|
|
191
|
+
}
|
|
192
|
+
if (_visited) {
|
|
193
|
+
cssStr += `
|
|
194
|
+
&:visited {
|
|
195
|
+
${zxToCss(_visited)}
|
|
196
|
+
}
|
|
197
|
+
`
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const hasMediaQuery = Object.values(_zx).some((v) => Array.isArray(v))
|
|
201
|
+
// If has media query styles, use css class. Otherwise favor inline styles
|
|
202
|
+
if (hasMediaQuery || cssStr) {
|
|
203
|
+
cssStr = zxToCss(_zx) + cssStr
|
|
204
|
+
} else {
|
|
205
|
+
_zx = expandShorthandProps(_zx)
|
|
206
|
+
rest.style = { ...rest.style, ..._zx } as CSSProperties
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return createElement(Component, {
|
|
210
|
+
ref,
|
|
211
|
+
...rest,
|
|
212
|
+
className: classJoin(
|
|
213
|
+
className,
|
|
214
|
+
_css ? (_css.includes(':') ? css(_css) : _css) : undefined,
|
|
215
|
+
cssStr ? css(cssStr) : undefined,
|
|
216
|
+
props.className
|
|
217
|
+
),
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
CStyled.toString = () => '.' + className
|
|
221
|
+
return CStyled as unknown as SC<Parameters<C>[0]>
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";var j=Object.create;var F=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var y=(s,e)=>{for(var t in e)F(s,t,{get:e[t],enumerable:!0})},d=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of q(e))!N.call(s,o)&&o!==t&&F(s,o,{get:()=>e[o],enumerable:!(n=A(e,o))||n.enumerable});return s},r=(s,e,t)=>(d(s,e,"default"),t&&d(t,e,"default")),w=(s,e,t)=>(t=s!=null?j(M(s)):{},d(e||!s||!s.__esModule?F(t,"default",{value:s,enumerable:!0}):t,s)),L=s=>d(F({},"__esModule",{value:!0}),s);var k={};y(k,{css:()=>T.default,default:()=>R});module.exports=L(k);var P={};y(P,{css:()=>T.default,default:()=>a});var H=require("react"),T=w(require("@slimr/css"),1);r(P,require("@slimr/css"));function O(s){return s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function z(s){return s.replace(/-./g,e=>e[1].toUpperCase())}function E(s){return Object.entries(s).reduce((e,[t,n])=>(t==="mx"?(e.marginLeft=n,e.marginRight=n):t==="my"?(e.marginTop=n,e.marginBottom=n):t==="px"?(e.paddingLeft=n,e.paddingRight=n):t==="py"?(e.paddingTop=n,e.paddingBottom=n):t in T.shorthandPropsMap?e[z(T.shorthandPropsMap[t])]=n:e[t]=n,e),{})}function i(s){return Object.entries(s).map(([e,t])=>t?(e=O(e),typeof t=="number"&&(t=t+"px"),Array.isArray(t)&&(t="["+t.map(n=>typeof n=="number"?n+"px":n).join(",")+"]"),e+":"+t+";"):"").join(`
|
|
2
|
+
`)}function a(s){return(...e)=>{let t=(0,T.default)(...e),n=(0,H.forwardRef)((o,_)=>{let{_active:m,_css:S,_dark:f,_focus:x,_focusVisible:c,_focusWithin:h,_hover:b,_target:g,_visited:Z,_zx:l={},...C}=o;Object.entries(o).forEach(([p,$])=>{p.startsWith("_")&&(l[p.slice(1)]=$,delete C[p])});let u="";return m&&(u+=`
|
|
3
|
+
&:active {
|
|
4
|
+
${i(m)}
|
|
5
|
+
}
|
|
6
|
+
`),f&&(u+=`
|
|
7
|
+
@media (prefers-color-scheme: dark) {
|
|
8
|
+
${i(f)}
|
|
9
|
+
}
|
|
10
|
+
`),x&&(u+=`
|
|
11
|
+
&:focus {
|
|
12
|
+
${i(x)}
|
|
13
|
+
}
|
|
14
|
+
`),c&&(u+=`
|
|
15
|
+
&:focus-visible {
|
|
16
|
+
${i(c)}
|
|
17
|
+
}
|
|
18
|
+
`),h&&(u+=`
|
|
19
|
+
&:focus-within {
|
|
20
|
+
${i(h)}
|
|
21
|
+
}
|
|
22
|
+
`),b&&(u+=`
|
|
23
|
+
&:hover {
|
|
24
|
+
${i(b)}
|
|
25
|
+
}
|
|
26
|
+
`),g&&(u+=`
|
|
27
|
+
&:target {
|
|
28
|
+
${i(g)}
|
|
29
|
+
}
|
|
30
|
+
`),Z&&(u+=`
|
|
31
|
+
&:visited {
|
|
32
|
+
${i(Z)}
|
|
33
|
+
}
|
|
34
|
+
`),Object.values(l).some(p=>Array.isArray(p))||u?u=i(l)+u:(l=E(l),C.style={...C.style,...l}),(0,H.createElement)(s,{ref:_,...C,className:(0,T.classJoin)(t,S?S.includes(":")?(0,T.default)(S):S:void 0,u?(0,T.default)(u):void 0,o.className)})});return n.toString=()=>"."+t,n}}r(k,P,module.exports);var R=Object.assign(a,{a:(...s)=>a("a")(...s),abbr:(...s)=>a("abbr")(...s),address:(...s)=>a("address")(...s),area:(...s)=>a("area")(...s),article:(...s)=>a("article")(...s),aside:(...s)=>a("aside")(...s),audio:(...s)=>a("audio")(...s),b:(...s)=>a("b")(...s),blockquote:(...s)=>a("blockquote")(...s),br:(...s)=>a("br")(...s),button:(...s)=>a("button")(...s),caption:(...s)=>a("caption")(...s),cite:(...s)=>a("cite")(...s),code:(...s)=>a("code")(...s),col:(...s)=>a("col")(...s),colgroup:(...s)=>a("colgroup")(...s),dd:(...s)=>a("dd")(...s),del:(...s)=>a("del")(...s),details:(...s)=>a("details")(...s),dfn:(...s)=>a("dfn")(...s),dialog:(...s)=>a("dialog")(...s),div:(...s)=>a("div")(...s),dl:(...s)=>a("dl")(...s),dt:(...s)=>a("dt")(...s),em:(...s)=>a("em")(...s),embed:(...s)=>a("embed")(...s),fieldset:(...s)=>a("fieldset")(...s),figcaption:(...s)=>a("figcaption")(...s),figure:(...s)=>a("figure")(...s),footer:(...s)=>a("footer")(...s),form:(...s)=>a("form")(...s),h1:(...s)=>a("h1")(...s),h2:(...s)=>a("h2")(...s),h3:(...s)=>a("h3")(...s),h4:(...s)=>a("h4")(...s),h5:(...s)=>a("h5")(...s),h6:(...s)=>a("h6")(...s),header:(...s)=>a("header")(...s),hgroup:(...s)=>a("hgroup")(...s),hr:(...s)=>a("hr")(...s),i:(...s)=>a("i")(...s),iframe:(...s)=>a("iframe")(...s),img:(...s)=>a("img")(...s),input:(...s)=>a("input")(...s),ins:(...s)=>a("ins")(...s),kbd:(...s)=>a("kbd")(...s),label:(...s)=>a("label")(...s),legend:(...s)=>a("legend")(...s),li:(...s)=>a("li")(...s),main:(...s)=>a("main")(...s),map:(...s)=>a("map")(...s),mark:(...s)=>a("mark")(...s),meter:(...s)=>a("meter")(...s),nav:(...s)=>a("nav")(...s),object:(...s)=>a("object")(...s),ol:(...s)=>a("ol")(...s),optgroup:(...s)=>a("optgroup")(...s),option:(...s)=>a("option")(...s),output:(...s)=>a("output")(...s),p:(...s)=>a("p")(...s),picture:(...s)=>a("picture")(...s),pre:(...s)=>a("pre")(...s),progress:(...s)=>a("progress")(...s),q:(...s)=>a("q")(...s),rp:(...s)=>a("rp")(...s),rt:(...s)=>a("rt")(...s),ruby:(...s)=>a("ruby")(...s),s:(...s)=>a("s")(...s),samp:(...s)=>a("samp")(...s),section:(...s)=>a("section")(...s),select:(...s)=>a("select")(...s),small:(...s)=>a("small")(...s),span:(...s)=>a("span")(...s),strong:(...s)=>a("strong")(...s),sub:(...s)=>a("sub")(...s),summary:(...s)=>a("summary")(...s),sup:(...s)=>a("sup")(...s),table:(...s)=>a("table")(...s),tbody:(...s)=>a("tbody")(...s),td:(...s)=>a("td")(...s),textarea:(...s)=>a("textarea")(...s),tfoot:(...s)=>a("tfoot")(...s),th:(...s)=>a("th")(...s),thead:(...s)=>a("thead")(...s),time:(...s)=>a("time")(...s),tr:(...s)=>a("tr")(...s),u:(...s)=>a("u")(...s),ul:(...s)=>a("ul")(...s),video:(...s)=>a("video")(...s)});0&&(module.exports={css});
|
|
35
|
+
//# sourceMappingURL=withHtmlTags.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["withHtmlTags.ts","index.ts"],"sourcesContent":["import { FC } from 'react'\nimport { TemplateStringProps } from '@slimr/css'\nimport styled from './index.js'\n\nexport * from './index.js'\n\n/** Shorthand type */\ntype unk = unknown\n/** Shorthand type */\ntype TSP = TemplateStringProps\n/** Shorthand type */\ntype HTP = JSX.IntrinsicElements\n\nexport default Object.assign(styled, {\n /** creates a 'a' component with css applied */\n a: (...p: TSP) => styled('a' as unk as FC<HTP['a']>)(...p),\n /** creates a 'abbr' component with css applied */\n abbr: (...p: TSP) => styled('abbr' as unk as FC<HTP['abbr']>)(...p),\n /** creates a 'address' component with css applied */\n address: (...p: TSP) => styled('address' as unk as FC<HTP['address']>)(...p),\n /** creates a 'area' component with css applied */\n area: (...p: TSP) => styled('area' as unk as FC<HTP['area']>)(...p),\n /** creates a 'article' component with css applied */\n article: (...p: TSP) => styled('article' as unk as FC<HTP['article']>)(...p),\n /** creates a 'aside' component with css applied */\n aside: (...p: TSP) => styled('aside' as unk as FC<HTP['aside']>)(...p),\n /** creates a 'audio' component with css applied */\n audio: (...p: TSP) => styled('audio' as unk as FC<HTP['audio']>)(...p),\n /** creates a 'b' component with css applied */\n b: (...p: TSP) => styled('b' as unk as FC<HTP['b']>)(...p),\n /** creates a 'big' component with css applied; Deprecated so left out */\n // big: (...p: TSP) => styled('big' as unk as FC<HTP['big']>)(...p),\n /** creates a 'blockquote' component with css applied */\n blockquote: (...p: TSP) => styled('blockquote' as unk as FC<HTP['blockquote']>)(...p),\n /** creates a 'body' component with css applied; omitted bc doesnt seem useful */\n // body: (...p: TSP) => styled('body' as unk as FC<HTP['body']>)(...p),\n /** creates a 'br' component with css applied; omitted bc doesnt seem useful */\n br: (...p: TSP) => styled('br' as unk as FC<HTP['br']>)(...p),\n /** creates a 'button' component with css applied */\n button: (...p: TSP) => styled('button' as unk as FC<HTP['button']>)(...p),\n /** creates a 'caption' component with css applied */\n caption: (...p: TSP) => styled('caption' as unk as FC<HTP['caption']>)(...p),\n /** creates a 'cite' component with css applied */\n cite: (...p: TSP) => styled('cite' as unk as FC<HTP['cite']>)(...p),\n /** creates a 'code' component with css applied */\n code: (...p: TSP) => styled('code' as unk as FC<HTP['code']>)(...p),\n /** creates a 'col' component with css applied */\n col: (...p: TSP) => styled('col' as unk as FC<HTP['col']>)(...p),\n /** creates a 'colgroup' component with css applied */\n colgroup: (...p: TSP) => styled('colgroup' as unk as FC<HTP['colgroup']>)(...p),\n /** creates a 'dd' component with css applied */\n dd: (...p: TSP) => styled('dd' as unk as FC<HTP['dd']>)(...p),\n /** creates a 'del' component with css applied */\n del: (...p: TSP) => styled('del' as unk as FC<HTP['del']>)(...p),\n /** creates a 'details' component with css applied */\n details: (...p: TSP) => styled('details' as unk as FC<HTP['details']>)(...p),\n /** creates a 'dfn' component with css applied */\n dfn: (...p: TSP) => styled('dfn' as unk as FC<HTP['dfn']>)(...p),\n /** creates a 'dialog' component with css applied */\n dialog: (...p: TSP) => styled('dialog' as unk as FC<HTP['dialog']>)(...p),\n /** creates a 'div' component with css applied */\n div: (...p: TSP) => styled('div' as unk as FC<HTP['div']>)(...p),\n /** creates a 'dl' component with css applied */\n dl: (...p: TSP) => styled('dl' as unk as FC<HTP['dl']>)(...p),\n /** creates a 'dt' component with css applied */\n dt: (...p: TSP) => styled('dt' as unk as FC<HTP['dt']>)(...p),\n /** creates a 'em' component with css applied */\n em: (...p: TSP) => styled('em' as unk as FC<HTP['em']>)(...p),\n /** creates a 'embed' component with css applied */\n embed: (...p: TSP) => styled('embed' as unk as FC<HTP['embed']>)(...p),\n /** creates a 'fieldset' component with css applied */\n fieldset: (...p: TSP) => styled('fieldset' as unk as FC<HTP['fieldset']>)(...p),\n /** creates a 'figcaption' component with css applied */\n figcaption: (...p: TSP) => styled('figcaption' as unk as FC<HTP['figcaption']>)(...p),\n /** creates a 'figure' component with css applied */\n figure: (...p: TSP) => styled('figure' as unk as FC<HTP['figure']>)(...p),\n /** creates a 'footer' component with css applied */\n footer: (...p: TSP) => styled('footer' as unk as FC<HTP['footer']>)(...p),\n /** creates a 'form' component with css applied */\n form: (...p: TSP) => styled('form' as unk as FC<HTP['form']>)(...p),\n /** creates a 'h1' component with css applied */\n h1: (...p: TSP) => styled('h1' as unk as FC<HTP['h1']>)(...p),\n /** creates a 'h2' component with css applied */\n h2: (...p: TSP) => styled('h2' as unk as FC<HTP['h2']>)(...p),\n /** creates a 'h3' component with css applied */\n h3: (...p: TSP) => styled('h3' as unk as FC<HTP['h3']>)(...p),\n /** creates a 'h4' component with css applied */\n h4: (...p: TSP) => styled('h4' as unk as FC<HTP['h4']>)(...p),\n /** creates a 'h5' component with css applied */\n h5: (...p: TSP) => styled('h5' as unk as FC<HTP['h5']>)(...p),\n /** creates a 'h6' component with css applied */\n h6: (...p: TSP) => styled('h6' as unk as FC<HTP['h6']>)(...p),\n /** creates a 'header' component with css applied */\n header: (...p: TSP) => styled('header' as unk as FC<HTP['header']>)(...p),\n /** creates a 'hgroup' component with css applied */\n hgroup: (...p: TSP) => styled('hgroup' as unk as FC<HTP['hgroup']>)(...p),\n /** creates a 'hr' component with css applied */\n hr: (...p: TSP) => styled('hr' as unk as FC<HTP['hr']>)(...p),\n /** creates a 'i' component with css applied */\n i: (...p: TSP) => styled('i' as unk as FC<HTP['i']>)(...p),\n /** creates a 'iframe' component with css applied */\n iframe: (...p: TSP) => styled('iframe' as unk as FC<HTP['iframe']>)(...p),\n /** creates a 'img' component with css applied */\n img: (...p: TSP) => styled('img' as unk as FC<HTP['img']>)(...p),\n /** creates a 'input' component with css applied */\n input: (...p: TSP) => styled('input' as unk as FC<HTP['input']>)(...p),\n /** creates a 'ins' component with css applied */\n ins: (...p: TSP) => styled('ins' as unk as FC<HTP['ins']>)(...p),\n /** creates a 'kbd' component with css applied */\n kbd: (...p: TSP) => styled('kbd' as unk as FC<HTP['kbd']>)(...p),\n /** creates a 'label' component with css applied */\n label: (...p: TSP) => styled('label' as unk as FC<HTP['label']>)(...p),\n /** creates a 'legend' component with css applied */\n legend: (...p: TSP) => styled('legend' as unk as FC<HTP['legend']>)(...p),\n /** creates a 'li' component with css applied */\n li: (...p: TSP) => styled('li' as unk as FC<HTP['li']>)(...p),\n /** creates a 'main' component with css applied */\n main: (...p: TSP) => styled('main' as unk as FC<HTP['main']>)(...p),\n /** creates a 'map' component with css applied */\n map: (...p: TSP) => styled('map' as unk as FC<HTP['map']>)(...p),\n /** creates a 'mark' component with css applied */\n mark: (...p: TSP) => styled('mark' as unk as FC<HTP['mark']>)(...p),\n /** creates a 'meter' component with css applied */\n meter: (...p: TSP) => styled('meter' as unk as FC<HTP['meter']>)(...p),\n /** creates a 'nav' component with css applied */\n nav: (...p: TSP) => styled('nav' as unk as FC<HTP['nav']>)(...p),\n /** creates a 'object' component with css applied */\n object: (...p: TSP) => styled('object' as unk as FC<HTP['object']>)(...p),\n /** creates a 'ol' component with css applied */\n ol: (...p: TSP) => styled('ol' as unk as FC<HTP['ol']>)(...p),\n /** creates a 'optgroup' component with css applied */\n optgroup: (...p: TSP) => styled('optgroup' as unk as FC<HTP['optgroup']>)(...p),\n /** creates a 'option' component with css applied */\n option: (...p: TSP) => styled('option' as unk as FC<HTP['option']>)(...p),\n /** creates a 'output' component with css applied */\n output: (...p: TSP) => styled('output' as unk as FC<HTP['output']>)(...p),\n /** creates a 'p' component with css applied */\n p: (...p: TSP) => styled('p' as unk as FC<HTP['p']>)(...p),\n /** creates a 'picture' component with css applied */\n picture: (...p: TSP) => styled('picture' as unk as FC<HTP['picture']>)(...p),\n /** creates a 'pre' component with css applied */\n pre: (...p: TSP) => styled('pre' as unk as FC<HTP['pre']>)(...p),\n /** creates a 'progress' component with css applied */\n progress: (...p: TSP) => styled('progress' as unk as FC<HTP['progress']>)(...p),\n /** creates a 'q' component with css applied */\n q: (...p: TSP) => styled('q' as unk as FC<HTP['q']>)(...p),\n /** creates a 'rp' component with css applied */\n rp: (...p: TSP) => styled('rp' as unk as FC<HTP['rp']>)(...p),\n /** creates a 'rt' component with css applied */\n rt: (...p: TSP) => styled('rt' as unk as FC<HTP['rt']>)(...p),\n /** creates a 'ruby' component with css applied */\n ruby: (...p: TSP) => styled('ruby' as unk as FC<HTP['ruby']>)(...p),\n /** creates a 's' component with css applied */\n s: (...p: TSP) => styled('s' as unk as FC<HTP['s']>)(...p),\n /** creates a 'samp' component with css applied */\n samp: (...p: TSP) => styled('samp' as unk as FC<HTP['samp']>)(...p),\n /** creates a 'section' component with css applied */\n section: (...p: TSP) => styled('section' as unk as FC<HTP['section']>)(...p),\n /** creates a 'select' component with css applied */\n select: (...p: TSP) => styled('select' as unk as FC<HTP['select']>)(...p),\n /** creates a 'small' component with css applied */\n small: (...p: TSP) => styled('small' as unk as FC<HTP['small']>)(...p),\n /** creates a 'span' component with css applied */\n span: (...p: TSP) => styled('span' as unk as FC<HTP['span']>)(...p),\n /** creates a 'strong' component with css applied */\n strong: (...p: TSP) => styled('strong' as unk as FC<HTP['strong']>)(...p),\n /** creates a 'sub' component with css applied */\n sub: (...p: TSP) => styled('sub' as unk as FC<HTP['sub']>)(...p),\n /** creates a 'summary' component with css applied */\n summary: (...p: TSP) => styled('summary' as unk as FC<HTP['summary']>)(...p),\n /** creates a 'sup' component with css applied */\n sup: (...p: TSP) => styled('sup' as unk as FC<HTP['sup']>)(...p),\n /** creates a 'table' component with css applied */\n table: (...p: TSP) => styled('table' as unk as FC<HTP['table']>)(...p),\n /** creates a 'tbody' component with css applied */\n tbody: (...p: TSP) => styled('tbody' as unk as FC<HTP['tbody']>)(...p),\n /** creates a 'td' component with css applied */\n td: (...p: TSP) => styled('td' as unk as FC<HTP['td']>)(...p),\n /** creates a 'textarea' component with css applied */\n textarea: (...p: TSP) => styled('textarea' as unk as FC<HTP['textarea']>)(...p),\n /** creates a 'tfoot' component with css applied */\n tfoot: (...p: TSP) => styled('tfoot' as unk as FC<HTP['tfoot']>)(...p),\n /** creates a 'th' component with css applied */\n th: (...p: TSP) => styled('th' as unk as FC<HTP['th']>)(...p),\n /** creates a 'thead' component with css applied */\n thead: (...p: TSP) => styled('thead' as unk as FC<HTP['thead']>)(...p),\n /** creates a 'time' component with css applied */\n time: (...p: TSP) => styled('time' as unk as FC<HTP['time']>)(...p),\n /** creates a 'tr' component with css applied */\n tr: (...p: TSP) => styled('tr' as unk as FC<HTP['tr']>)(...p),\n /** creates a 'u' component with css applied */\n u: (...p: TSP) => styled('u' as unk as FC<HTP['u']>)(...p),\n /** creates a 'ul' component with css applied */\n ul: (...p: TSP) => styled('ul' as unk as FC<HTP['ul']>)(...p),\n /** creates a 'video' component with css applied */\n video: (...p: TSP) => styled('video' as unk as FC<HTP['video']>)(...p),\n})\n","import { createElement, CSSProperties, FC, forwardRef, HTMLAttributes } from 'react'\nimport css, { classJoin, ShorthandProps, shorthandProps, shorthandPropsMap, TemplateStringProps } from '@slimr/css'\n\nexport { css }\nexport * from '@slimr/css'\n\n/** A type that represents all the css properties + shorthand props */\nexport interface ZxProps extends CSSProperties, ShorthandProps {}\ntype ZxP = ZxProps\n\ntype Zx = {\n [k in keyof ZxP]:\n | ZxP[k]\n | [ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n}\n\ntype _Props = {\n [k in keyof Zx as `_${k}`]?: Zx[k]\n}\n\nexport interface SCProps extends _Props {\n /** Like zx prop, but applies only on :active */\n _active?: Zx\n className?: string\n /** A string of css or classname to be added to the component */\n _css?: string\n /** Like zx prop, but applies only when user prefers dark theme */\n _dark?: Zx\n /** Like zx prop, but applies only on :focus */\n _focus?: Zx\n /** Like zx prop, but applies only on :focus-visible */\n _focusVisible?: Zx\n /** Like zx prop, but applies only on :focus-within */\n _focusWithin?: Zx\n /** Like zx prop, but applies only on :hover */\n _hover?: Zx\n style?: CSSProperties\n /** Like zx prop, but applies only on :target */\n _target?: Zx\n /** Like zx prop, but applies only on :visited */\n _visited?: Zx\n /**\n * Like style prop, but enhanced with features like chakra\n * - Array values are converted to media query breakpoints\n * - Numbers are converted to px\n * - Shorthand props are supported\n */\n _zx?: Zx\n}\n\n/** Styled Component: Like FunctionalComponent but adds SCProps */\nexport type SC<T extends { className?: HTMLAttributes<any>['className'] }> = FC<T & SCProps>\n\nfunction toKebabCase(str: string) {\n return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()\n}\n\nfunction toCamelCase(str: string) {\n return str.replace(/-./g, (x) => x[1].toUpperCase())\n}\n\nfunction expandShorthandProps(zx: Zx) {\n return Object.entries(zx).reduce((acc, [k, v]) => {\n if (k === 'mx') {\n acc.marginLeft = v\n acc.marginRight = v\n } else if (k === 'my') {\n acc.marginTop = v\n acc.marginBottom = v\n } else if (k === 'px') {\n acc.paddingLeft = v\n acc.paddingRight = v\n } else if (k === 'py') {\n acc.paddingTop = v\n acc.paddingBottom = v\n } else if (k in shorthandPropsMap) {\n acc[toCamelCase(shorthandPropsMap[k as keyof typeof shorthandPropsMap])] = v\n } else {\n acc[k] = v\n }\n return acc\n }, {} as any)\n}\n\nfunction zxToCss(zx: Zx): string {\n return Object.entries(zx)\n .map(([k, v]) => {\n if (!v) return ''\n k = toKebabCase(k)\n if (typeof v === 'number') v = v + 'px'\n if (Array.isArray(v)) {\n // @ts-ignore\n v = '[' + v.map((v) => (typeof v === 'number' ? v + 'px' : v)).join(',') + ']'\n }\n return k + ':' + v + ';'\n })\n .join('\\n')\n}\n\n/**\n * A lightweight alternative to styled-components\n * @param function - a functional component to be styled; must accept a className prop\n * @returns a function that accepts a template string of css returns a decorated functional component\n */\nexport default function styled<C extends FC<any>>(Component: C) {\n return (...cssProps: TemplateStringProps) => {\n const className = css(...cssProps)\n /**\n * A functional component that accepts Styled Props\n */\n const CStyled = forwardRef((props: SCProps, ref) => {\n let {\n _active,\n _css,\n _dark,\n _focus,\n _focusVisible,\n _focusWithin,\n _hover,\n _target,\n _visited,\n _zx = {},\n ...rest\n } = props\n\n // Pluck out $ prefixed props\n Object.entries(props).forEach(([k, v]) => {\n if (k.startsWith('_')) {\n // @ts-ignore\n _zx[k.slice(1)] = v\n // @ts-ignore\n delete rest[k]\n }\n })\n\n let cssStr = ''\n\n if (_active) {\n cssStr += `\n &:active {\n ${zxToCss(_active)}\n }\n `\n }\n if (_dark) {\n cssStr += `\n @media (prefers-color-scheme: dark) {\n ${zxToCss(_dark)}\n }\n `\n }\n if (_focus) {\n cssStr += `\n &:focus {\n ${zxToCss(_focus)}\n }\n `\n }\n if (_focusVisible) {\n cssStr += `\n &:focus-visible {\n ${zxToCss(_focusVisible)}\n }\n `\n }\n if (_focusWithin) {\n cssStr += `\n &:focus-within {\n ${zxToCss(_focusWithin)}\n }\n `\n }\n if (_hover) {\n cssStr += `\n &:hover {\n ${zxToCss(_hover)}\n }\n `\n }\n if (_target) {\n cssStr += `\n &:target {\n ${zxToCss(_target)}\n }\n `\n }\n if (_visited) {\n cssStr += `\n &:visited {\n ${zxToCss(_visited)}\n }\n `\n }\n\n const hasMediaQuery = Object.values(_zx).some((v) => Array.isArray(v))\n // If has media query styles, use css class. Otherwise favor inline styles\n if (hasMediaQuery || cssStr) {\n cssStr = zxToCss(_zx) + cssStr\n } else {\n _zx = expandShorthandProps(_zx)\n rest.style = { ...rest.style, ..._zx } as CSSProperties\n }\n\n return createElement(Component, {\n ref,\n ...rest,\n className: classJoin(\n className,\n _css ? (_css.includes(':') ? css(_css) : _css) : undefined,\n cssStr ? css(cssStr) : undefined,\n props.className\n ),\n })\n })\n CStyled.toString = () => '.' + className\n return CStyled as unknown as SC<Parameters<C>[0]>\n }\n}\n"],"mappings":"wmBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,QAAA,YAAAC,IAAA,eAAAC,EAAAJ,GCAA,IAAAK,EAAA,GAAAC,EAAAD,EAAA,WAAAE,QAAA,YAAAC,IAAA,IAAAC,EAA6E,iBAC7EC,EAAuG,2BAGvGC,EAAAN,EAAc,uBAsDd,SAASO,EAAYC,EAAa,CAChC,OAAOA,EAAI,QAAQ,kBAAmB,OAAO,EAAE,YAAY,CAC7D,CAEA,SAASC,EAAYD,EAAa,CAChC,OAAOA,EAAI,QAAQ,MAAQE,GAAMA,EAAE,GAAG,YAAY,CAAC,CACrD,CAEA,SAASC,EAAqBC,EAAQ,CACpC,OAAO,OAAO,QAAQA,CAAE,EAAE,OAAO,CAACC,EAAK,CAACC,EAAGC,CAAC,KACtCD,IAAM,MACRD,EAAI,WAAaE,EACjBF,EAAI,YAAcE,GACTD,IAAM,MACfD,EAAI,UAAYE,EAChBF,EAAI,aAAeE,GACVD,IAAM,MACfD,EAAI,YAAcE,EAClBF,EAAI,aAAeE,GACVD,IAAM,MACfD,EAAI,WAAaE,EACjBF,EAAI,cAAgBE,GACXD,KAAK,oBACdD,EAAIJ,EAAY,oBAAkBK,EAAoC,GAAKC,EAE3EF,EAAIC,GAAKC,EAEJF,GACN,CAAC,CAAQ,CACd,CAEA,SAASG,EAAQJ,EAAgB,CAC/B,OAAO,OAAO,QAAQA,CAAE,EACrB,IAAI,CAAC,CAACE,EAAGC,CAAC,IACJA,GACLD,EAAIP,EAAYO,CAAC,EACb,OAAOC,GAAM,WAAUA,EAAIA,EAAI,MAC/B,MAAM,QAAQA,CAAC,IAEjBA,EAAI,IAAM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AAC,EAExE,IAAK,IAAIA,IAAWD,EAAO,KAA8B,EAAE,GAAGC,CAAC,EAE/D,QAAS,IAAIA,IAAWD,EAAO,SAAsC,EAAE,GAAGC,CAAC,EAE3E,IAAK,IAAIA,IAAWD,EAAO,KAA8B,EAAE,GAAGC,CAAC,EAE/D,MAAO,IAAIA,IAAWD,EAAO,OAAkC,EAAE,GAAGC,CAAC,EAErE,MAAO,IAAIA,IAAWD,EAAO,OAAkC,EAAE,GAAGC,CAAC,EAErE,GAAI,IAAIA,IAAWD,EAAO,IAA4B,EAAE,GAAGC,CAAC,EAE5D,SAAU,IAAIA,IAAWD,EAAO,UAAwC,EAAE,GAAGC,CAAC,EAE9E,MAAO,IAAIA,IAAWD,EAAO,OAAkC,EAAE,GAAGC,CAAC,EAErE,GAAI,IAAIA,IAAWD,EAAO,IAA4B,EAAE,GAAGC,CAAC,EAE5D,MAAO,IAAIA,IAAWD,EAAO,OAAkC,EAAE,GAAGC,CAAC,EAErE,KAAM,IAAIA,IAAWD,EAAO,MAAgC,EAAE,GAAGC,CAAC,EAElE,GAAI,IAAIA,IAAWD,EAAO,IAA4B,EAAE,GAAGC,CAAC,EAE5D,EAAG,IAAIA,IAAWD,EAAO,GAA0B,EAAE,GAAGC,CAAC,EAEzD,GAAI,IAAIA,IAAWD,EAAO,IAA4B,EAAE,GAAGC,CAAC,EAE5D,MAAO,IAAIA,IAAWD,EAAO,OAAkC,EAAE,GAAGC,CAAC,CACvE,CAAC","names":["withHtmlTags_exports","__export","css","withHtmlTags_default","__toCommonJS","src_exports","__export","css","styled","import_react","import_css","__reExport","toKebabCase","str","toCamelCase","x","expandShorthandProps","zx","acc","k","v","zxToCss","styled","Component","cssProps","className","css","CStyled","props","ref","_active","_css","_dark","_focus","_focusVisible","_focusWithin","_hover","_target","_visited","_zx","rest","cssStr","__reExport","withHtmlTags_exports","src_exports","withHtmlTags_default","styled","p"]}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import styled, { SC } from './index.js';
|
|
2
|
+
export { SCProps, ZxProps } from './index.js';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
export * from '@slimr/css';
|
|
5
|
+
export { default as css } from '@slimr/css';
|
|
6
|
+
|
|
7
|
+
declare const _default: typeof styled & {
|
|
8
|
+
/** creates a 'a' component with css applied */
|
|
9
|
+
a: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>>;
|
|
10
|
+
/** creates a 'abbr' component with css applied */
|
|
11
|
+
abbr: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
12
|
+
/** creates a 'address' component with css applied */
|
|
13
|
+
address: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
14
|
+
/** creates a 'area' component with css applied */
|
|
15
|
+
area: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>>;
|
|
16
|
+
/** creates a 'article' component with css applied */
|
|
17
|
+
article: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
18
|
+
/** creates a 'aside' component with css applied */
|
|
19
|
+
aside: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
20
|
+
/** creates a 'audio' component with css applied */
|
|
21
|
+
audio: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>>;
|
|
22
|
+
/** creates a 'b' component with css applied */
|
|
23
|
+
b: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
24
|
+
/** creates a 'big' component with css applied; Deprecated so left out */
|
|
25
|
+
/** creates a 'blockquote' component with css applied */
|
|
26
|
+
blockquote: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
27
|
+
/** creates a 'body' component with css applied; omitted bc doesnt seem useful */
|
|
28
|
+
/** creates a 'br' component with css applied; omitted bc doesnt seem useful */
|
|
29
|
+
br: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLBRElement>, HTMLBRElement>>;
|
|
30
|
+
/** creates a 'button' component with css applied */
|
|
31
|
+
button: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
32
|
+
/** creates a 'caption' component with css applied */
|
|
33
|
+
caption: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
34
|
+
/** creates a 'cite' component with css applied */
|
|
35
|
+
cite: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
36
|
+
/** creates a 'code' component with css applied */
|
|
37
|
+
code: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
38
|
+
/** creates a 'col' component with css applied */
|
|
39
|
+
col: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
40
|
+
/** creates a 'colgroup' component with css applied */
|
|
41
|
+
colgroup: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
42
|
+
/** creates a 'dd' component with css applied */
|
|
43
|
+
dd: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
44
|
+
/** creates a 'del' component with css applied */
|
|
45
|
+
del: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.DelHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
46
|
+
/** creates a 'details' component with css applied */
|
|
47
|
+
details: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>>;
|
|
48
|
+
/** creates a 'dfn' component with css applied */
|
|
49
|
+
dfn: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
50
|
+
/** creates a 'dialog' component with css applied */
|
|
51
|
+
dialog: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>>;
|
|
52
|
+
/** creates a 'div' component with css applied */
|
|
53
|
+
div: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
54
|
+
/** creates a 'dl' component with css applied */
|
|
55
|
+
dl: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDListElement>, HTMLDListElement>>;
|
|
56
|
+
/** creates a 'dt' component with css applied */
|
|
57
|
+
dt: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
58
|
+
/** creates a 'em' component with css applied */
|
|
59
|
+
em: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
60
|
+
/** creates a 'embed' component with css applied */
|
|
61
|
+
embed: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>>;
|
|
62
|
+
/** creates a 'fieldset' component with css applied */
|
|
63
|
+
fieldset: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>>;
|
|
64
|
+
/** creates a 'figcaption' component with css applied */
|
|
65
|
+
figcaption: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
66
|
+
/** creates a 'figure' component with css applied */
|
|
67
|
+
figure: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
68
|
+
/** creates a 'footer' component with css applied */
|
|
69
|
+
footer: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
70
|
+
/** creates a 'form' component with css applied */
|
|
71
|
+
form: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>>;
|
|
72
|
+
/** creates a 'h1' component with css applied */
|
|
73
|
+
h1: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
74
|
+
/** creates a 'h2' component with css applied */
|
|
75
|
+
h2: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
76
|
+
/** creates a 'h3' component with css applied */
|
|
77
|
+
h3: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
78
|
+
/** creates a 'h4' component with css applied */
|
|
79
|
+
h4: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
80
|
+
/** creates a 'h5' component with css applied */
|
|
81
|
+
h5: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
82
|
+
/** creates a 'h6' component with css applied */
|
|
83
|
+
h6: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
84
|
+
/** creates a 'header' component with css applied */
|
|
85
|
+
header: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
86
|
+
/** creates a 'hgroup' component with css applied */
|
|
87
|
+
hgroup: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
88
|
+
/** creates a 'hr' component with css applied */
|
|
89
|
+
hr: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
90
|
+
/** creates a 'i' component with css applied */
|
|
91
|
+
i: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
92
|
+
/** creates a 'iframe' component with css applied */
|
|
93
|
+
iframe: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>>;
|
|
94
|
+
/** creates a 'img' component with css applied */
|
|
95
|
+
img: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>;
|
|
96
|
+
/** creates a 'input' component with css applied */
|
|
97
|
+
input: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>>;
|
|
98
|
+
/** creates a 'ins' component with css applied */
|
|
99
|
+
ins: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.InsHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
100
|
+
/** creates a 'kbd' component with css applied */
|
|
101
|
+
kbd: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
102
|
+
/** creates a 'label' component with css applied */
|
|
103
|
+
label: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>>;
|
|
104
|
+
/** creates a 'legend' component with css applied */
|
|
105
|
+
legend: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>>;
|
|
106
|
+
/** creates a 'li' component with css applied */
|
|
107
|
+
li: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>>;
|
|
108
|
+
/** creates a 'main' component with css applied */
|
|
109
|
+
main: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
110
|
+
/** creates a 'map' component with css applied */
|
|
111
|
+
map: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>>;
|
|
112
|
+
/** creates a 'mark' component with css applied */
|
|
113
|
+
mark: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
114
|
+
/** creates a 'meter' component with css applied */
|
|
115
|
+
meter: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>>;
|
|
116
|
+
/** creates a 'nav' component with css applied */
|
|
117
|
+
nav: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
118
|
+
/** creates a 'object' component with css applied */
|
|
119
|
+
object: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>>;
|
|
120
|
+
/** creates a 'ol' component with css applied */
|
|
121
|
+
ol: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>>;
|
|
122
|
+
/** creates a 'optgroup' component with css applied */
|
|
123
|
+
optgroup: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>>;
|
|
124
|
+
/** creates a 'option' component with css applied */
|
|
125
|
+
option: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>>;
|
|
126
|
+
/** creates a 'output' component with css applied */
|
|
127
|
+
output: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
128
|
+
/** creates a 'p' component with css applied */
|
|
129
|
+
p: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>>;
|
|
130
|
+
/** creates a 'picture' component with css applied */
|
|
131
|
+
picture: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
132
|
+
/** creates a 'pre' component with css applied */
|
|
133
|
+
pre: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLPreElement>, HTMLPreElement>>;
|
|
134
|
+
/** creates a 'progress' component with css applied */
|
|
135
|
+
progress: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>>;
|
|
136
|
+
/** creates a 'q' component with css applied */
|
|
137
|
+
q: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
138
|
+
/** creates a 'rp' component with css applied */
|
|
139
|
+
rp: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
140
|
+
/** creates a 'rt' component with css applied */
|
|
141
|
+
rt: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
142
|
+
/** creates a 'ruby' component with css applied */
|
|
143
|
+
ruby: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
144
|
+
/** creates a 's' component with css applied */
|
|
145
|
+
s: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
146
|
+
/** creates a 'samp' component with css applied */
|
|
147
|
+
samp: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
148
|
+
/** creates a 'section' component with css applied */
|
|
149
|
+
section: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
150
|
+
/** creates a 'select' component with css applied */
|
|
151
|
+
select: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>>;
|
|
152
|
+
/** creates a 'small' component with css applied */
|
|
153
|
+
small: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
154
|
+
/** creates a 'span' component with css applied */
|
|
155
|
+
span: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
156
|
+
/** creates a 'strong' component with css applied */
|
|
157
|
+
strong: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
158
|
+
/** creates a 'sub' component with css applied */
|
|
159
|
+
sub: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
160
|
+
/** creates a 'summary' component with css applied */
|
|
161
|
+
summary: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
162
|
+
/** creates a 'sup' component with css applied */
|
|
163
|
+
sup: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
164
|
+
/** creates a 'table' component with css applied */
|
|
165
|
+
table: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>>;
|
|
166
|
+
/** creates a 'tbody' component with css applied */
|
|
167
|
+
tbody: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
168
|
+
/** creates a 'td' component with css applied */
|
|
169
|
+
td: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>>;
|
|
170
|
+
/** creates a 'textarea' component with css applied */
|
|
171
|
+
textarea: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>>;
|
|
172
|
+
/** creates a 'tfoot' component with css applied */
|
|
173
|
+
tfoot: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
174
|
+
/** creates a 'th' component with css applied */
|
|
175
|
+
th: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
176
|
+
/** creates a 'thead' component with css applied */
|
|
177
|
+
thead: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
178
|
+
/** creates a 'time' component with css applied */
|
|
179
|
+
time: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>>;
|
|
180
|
+
/** creates a 'tr' component with css applied */
|
|
181
|
+
tr: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
182
|
+
/** creates a 'u' component with css applied */
|
|
183
|
+
u: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
184
|
+
/** creates a 'ul' component with css applied */
|
|
185
|
+
ul: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLUListElement>, HTMLUListElement>>;
|
|
186
|
+
/** creates a 'video' component with css applied */
|
|
187
|
+
video: (strings: string | TemplateStringsArray, ...placeHolders: string[]) => SC<react.DetailedHTMLProps<react.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>>;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export { SC, _default as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var g=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var Z=(s,e)=>{for(var t in e)g(s,t,{get:e[t],enumerable:!0})},b=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let T of A(e))!q.call(s,T)&&T!==t&&g(s,T,{get:()=>e[T],enumerable:!(n=j(e,T))||n.enumerable});return s},r=(s,e,t)=>(b(s,e,"default"),t&&b(t,e,"default"));var l={};Z(l,{css:()=>p,default:()=>E});var P={};Z(P,{css:()=>p,default:()=>a});r(P,X);import{createElement as M,forwardRef as N}from"react";import p,{classJoin as w,shorthandPropsMap as y}from"@slimr/css";import*as X from"@slimr/css";function L(s){return s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function O(s){return s.replace(/-./g,e=>e[1].toUpperCase())}function z(s){return Object.entries(s).reduce((e,[t,n])=>(t==="mx"?(e.marginLeft=n,e.marginRight=n):t==="my"?(e.marginTop=n,e.marginBottom=n):t==="px"?(e.paddingLeft=n,e.paddingRight=n):t==="py"?(e.paddingTop=n,e.paddingBottom=n):t in y?e[O(y[t])]=n:e[t]=n,e),{})}function o(s){return Object.entries(s).map(([e,t])=>t?(e=L(e),typeof t=="number"&&(t=t+"px"),Array.isArray(t)&&(t="["+t.map(n=>typeof n=="number"?n+"px":n).join(",")+"]"),e+":"+t+";"):"").join(`
|
|
2
|
+
`)}function a(s){return(...e)=>{let t=p(...e),n=N((T,_)=>{let{_active:d,_css:S,_dark:F,_focus:H,_focusVisible:m,_focusWithin:f,_hover:x,_target:c,_visited:h,_zx:i={},...C}=T;Object.entries(T).forEach(([k,$])=>{k.startsWith("_")&&(i[k.slice(1)]=$,delete C[k])});let u="";return d&&(u+=`
|
|
3
|
+
&:active {
|
|
4
|
+
${o(d)}
|
|
5
|
+
}
|
|
6
|
+
`),F&&(u+=`
|
|
7
|
+
@media (prefers-color-scheme: dark) {
|
|
8
|
+
${o(F)}
|
|
9
|
+
}
|
|
10
|
+
`),H&&(u+=`
|
|
11
|
+
&:focus {
|
|
12
|
+
${o(H)}
|
|
13
|
+
}
|
|
14
|
+
`),m&&(u+=`
|
|
15
|
+
&:focus-visible {
|
|
16
|
+
${o(m)}
|
|
17
|
+
}
|
|
18
|
+
`),f&&(u+=`
|
|
19
|
+
&:focus-within {
|
|
20
|
+
${o(f)}
|
|
21
|
+
}
|
|
22
|
+
`),x&&(u+=`
|
|
23
|
+
&:hover {
|
|
24
|
+
${o(x)}
|
|
25
|
+
}
|
|
26
|
+
`),c&&(u+=`
|
|
27
|
+
&:target {
|
|
28
|
+
${o(c)}
|
|
29
|
+
}
|
|
30
|
+
`),h&&(u+=`
|
|
31
|
+
&:visited {
|
|
32
|
+
${o(h)}
|
|
33
|
+
}
|
|
34
|
+
`),Object.values(i).some(k=>Array.isArray(k))||u?u=o(i)+u:(i=z(i),C.style={...C.style,...i}),M(s,{ref:_,...C,className:w(t,S?S.includes(":")?p(S):S:void 0,u?p(u):void 0,T.className)})});return n.toString=()=>"."+t,n}}r(l,P);var E=Object.assign(a,{a:(...s)=>a("a")(...s),abbr:(...s)=>a("abbr")(...s),address:(...s)=>a("address")(...s),area:(...s)=>a("area")(...s),article:(...s)=>a("article")(...s),aside:(...s)=>a("aside")(...s),audio:(...s)=>a("audio")(...s),b:(...s)=>a("b")(...s),blockquote:(...s)=>a("blockquote")(...s),br:(...s)=>a("br")(...s),button:(...s)=>a("button")(...s),caption:(...s)=>a("caption")(...s),cite:(...s)=>a("cite")(...s),code:(...s)=>a("code")(...s),col:(...s)=>a("col")(...s),colgroup:(...s)=>a("colgroup")(...s),dd:(...s)=>a("dd")(...s),del:(...s)=>a("del")(...s),details:(...s)=>a("details")(...s),dfn:(...s)=>a("dfn")(...s),dialog:(...s)=>a("dialog")(...s),div:(...s)=>a("div")(...s),dl:(...s)=>a("dl")(...s),dt:(...s)=>a("dt")(...s),em:(...s)=>a("em")(...s),embed:(...s)=>a("embed")(...s),fieldset:(...s)=>a("fieldset")(...s),figcaption:(...s)=>a("figcaption")(...s),figure:(...s)=>a("figure")(...s),footer:(...s)=>a("footer")(...s),form:(...s)=>a("form")(...s),h1:(...s)=>a("h1")(...s),h2:(...s)=>a("h2")(...s),h3:(...s)=>a("h3")(...s),h4:(...s)=>a("h4")(...s),h5:(...s)=>a("h5")(...s),h6:(...s)=>a("h6")(...s),header:(...s)=>a("header")(...s),hgroup:(...s)=>a("hgroup")(...s),hr:(...s)=>a("hr")(...s),i:(...s)=>a("i")(...s),iframe:(...s)=>a("iframe")(...s),img:(...s)=>a("img")(...s),input:(...s)=>a("input")(...s),ins:(...s)=>a("ins")(...s),kbd:(...s)=>a("kbd")(...s),label:(...s)=>a("label")(...s),legend:(...s)=>a("legend")(...s),li:(...s)=>a("li")(...s),main:(...s)=>a("main")(...s),map:(...s)=>a("map")(...s),mark:(...s)=>a("mark")(...s),meter:(...s)=>a("meter")(...s),nav:(...s)=>a("nav")(...s),object:(...s)=>a("object")(...s),ol:(...s)=>a("ol")(...s),optgroup:(...s)=>a("optgroup")(...s),option:(...s)=>a("option")(...s),output:(...s)=>a("output")(...s),p:(...s)=>a("p")(...s),picture:(...s)=>a("picture")(...s),pre:(...s)=>a("pre")(...s),progress:(...s)=>a("progress")(...s),q:(...s)=>a("q")(...s),rp:(...s)=>a("rp")(...s),rt:(...s)=>a("rt")(...s),ruby:(...s)=>a("ruby")(...s),s:(...s)=>a("s")(...s),samp:(...s)=>a("samp")(...s),section:(...s)=>a("section")(...s),select:(...s)=>a("select")(...s),small:(...s)=>a("small")(...s),span:(...s)=>a("span")(...s),strong:(...s)=>a("strong")(...s),sub:(...s)=>a("sub")(...s),summary:(...s)=>a("summary")(...s),sup:(...s)=>a("sup")(...s),table:(...s)=>a("table")(...s),tbody:(...s)=>a("tbody")(...s),td:(...s)=>a("td")(...s),textarea:(...s)=>a("textarea")(...s),tfoot:(...s)=>a("tfoot")(...s),th:(...s)=>a("th")(...s),thead:(...s)=>a("thead")(...s),time:(...s)=>a("time")(...s),tr:(...s)=>a("tr")(...s),u:(...s)=>a("u")(...s),ul:(...s)=>a("ul")(...s),video:(...s)=>a("video")(...s)});export{p as css,E as default};
|
|
35
|
+
//# sourceMappingURL=withHtmlTags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["withHtmlTags.ts","index.ts"],"sourcesContent":["import { FC } from 'react'\nimport { TemplateStringProps } from '@slimr/css'\nimport styled from './index.js'\n\nexport * from './index.js'\n\n/** Shorthand type */\ntype unk = unknown\n/** Shorthand type */\ntype TSP = TemplateStringProps\n/** Shorthand type */\ntype HTP = JSX.IntrinsicElements\n\nexport default Object.assign(styled, {\n /** creates a 'a' component with css applied */\n a: (...p: TSP) => styled('a' as unk as FC<HTP['a']>)(...p),\n /** creates a 'abbr' component with css applied */\n abbr: (...p: TSP) => styled('abbr' as unk as FC<HTP['abbr']>)(...p),\n /** creates a 'address' component with css applied */\n address: (...p: TSP) => styled('address' as unk as FC<HTP['address']>)(...p),\n /** creates a 'area' component with css applied */\n area: (...p: TSP) => styled('area' as unk as FC<HTP['area']>)(...p),\n /** creates a 'article' component with css applied */\n article: (...p: TSP) => styled('article' as unk as FC<HTP['article']>)(...p),\n /** creates a 'aside' component with css applied */\n aside: (...p: TSP) => styled('aside' as unk as FC<HTP['aside']>)(...p),\n /** creates a 'audio' component with css applied */\n audio: (...p: TSP) => styled('audio' as unk as FC<HTP['audio']>)(...p),\n /** creates a 'b' component with css applied */\n b: (...p: TSP) => styled('b' as unk as FC<HTP['b']>)(...p),\n /** creates a 'big' component with css applied; Deprecated so left out */\n // big: (...p: TSP) => styled('big' as unk as FC<HTP['big']>)(...p),\n /** creates a 'blockquote' component with css applied */\n blockquote: (...p: TSP) => styled('blockquote' as unk as FC<HTP['blockquote']>)(...p),\n /** creates a 'body' component with css applied; omitted bc doesnt seem useful */\n // body: (...p: TSP) => styled('body' as unk as FC<HTP['body']>)(...p),\n /** creates a 'br' component with css applied; omitted bc doesnt seem useful */\n br: (...p: TSP) => styled('br' as unk as FC<HTP['br']>)(...p),\n /** creates a 'button' component with css applied */\n button: (...p: TSP) => styled('button' as unk as FC<HTP['button']>)(...p),\n /** creates a 'caption' component with css applied */\n caption: (...p: TSP) => styled('caption' as unk as FC<HTP['caption']>)(...p),\n /** creates a 'cite' component with css applied */\n cite: (...p: TSP) => styled('cite' as unk as FC<HTP['cite']>)(...p),\n /** creates a 'code' component with css applied */\n code: (...p: TSP) => styled('code' as unk as FC<HTP['code']>)(...p),\n /** creates a 'col' component with css applied */\n col: (...p: TSP) => styled('col' as unk as FC<HTP['col']>)(...p),\n /** creates a 'colgroup' component with css applied */\n colgroup: (...p: TSP) => styled('colgroup' as unk as FC<HTP['colgroup']>)(...p),\n /** creates a 'dd' component with css applied */\n dd: (...p: TSP) => styled('dd' as unk as FC<HTP['dd']>)(...p),\n /** creates a 'del' component with css applied */\n del: (...p: TSP) => styled('del' as unk as FC<HTP['del']>)(...p),\n /** creates a 'details' component with css applied */\n details: (...p: TSP) => styled('details' as unk as FC<HTP['details']>)(...p),\n /** creates a 'dfn' component with css applied */\n dfn: (...p: TSP) => styled('dfn' as unk as FC<HTP['dfn']>)(...p),\n /** creates a 'dialog' component with css applied */\n dialog: (...p: TSP) => styled('dialog' as unk as FC<HTP['dialog']>)(...p),\n /** creates a 'div' component with css applied */\n div: (...p: TSP) => styled('div' as unk as FC<HTP['div']>)(...p),\n /** creates a 'dl' component with css applied */\n dl: (...p: TSP) => styled('dl' as unk as FC<HTP['dl']>)(...p),\n /** creates a 'dt' component with css applied */\n dt: (...p: TSP) => styled('dt' as unk as FC<HTP['dt']>)(...p),\n /** creates a 'em' component with css applied */\n em: (...p: TSP) => styled('em' as unk as FC<HTP['em']>)(...p),\n /** creates a 'embed' component with css applied */\n embed: (...p: TSP) => styled('embed' as unk as FC<HTP['embed']>)(...p),\n /** creates a 'fieldset' component with css applied */\n fieldset: (...p: TSP) => styled('fieldset' as unk as FC<HTP['fieldset']>)(...p),\n /** creates a 'figcaption' component with css applied */\n figcaption: (...p: TSP) => styled('figcaption' as unk as FC<HTP['figcaption']>)(...p),\n /** creates a 'figure' component with css applied */\n figure: (...p: TSP) => styled('figure' as unk as FC<HTP['figure']>)(...p),\n /** creates a 'footer' component with css applied */\n footer: (...p: TSP) => styled('footer' as unk as FC<HTP['footer']>)(...p),\n /** creates a 'form' component with css applied */\n form: (...p: TSP) => styled('form' as unk as FC<HTP['form']>)(...p),\n /** creates a 'h1' component with css applied */\n h1: (...p: TSP) => styled('h1' as unk as FC<HTP['h1']>)(...p),\n /** creates a 'h2' component with css applied */\n h2: (...p: TSP) => styled('h2' as unk as FC<HTP['h2']>)(...p),\n /** creates a 'h3' component with css applied */\n h3: (...p: TSP) => styled('h3' as unk as FC<HTP['h3']>)(...p),\n /** creates a 'h4' component with css applied */\n h4: (...p: TSP) => styled('h4' as unk as FC<HTP['h4']>)(...p),\n /** creates a 'h5' component with css applied */\n h5: (...p: TSP) => styled('h5' as unk as FC<HTP['h5']>)(...p),\n /** creates a 'h6' component with css applied */\n h6: (...p: TSP) => styled('h6' as unk as FC<HTP['h6']>)(...p),\n /** creates a 'header' component with css applied */\n header: (...p: TSP) => styled('header' as unk as FC<HTP['header']>)(...p),\n /** creates a 'hgroup' component with css applied */\n hgroup: (...p: TSP) => styled('hgroup' as unk as FC<HTP['hgroup']>)(...p),\n /** creates a 'hr' component with css applied */\n hr: (...p: TSP) => styled('hr' as unk as FC<HTP['hr']>)(...p),\n /** creates a 'i' component with css applied */\n i: (...p: TSP) => styled('i' as unk as FC<HTP['i']>)(...p),\n /** creates a 'iframe' component with css applied */\n iframe: (...p: TSP) => styled('iframe' as unk as FC<HTP['iframe']>)(...p),\n /** creates a 'img' component with css applied */\n img: (...p: TSP) => styled('img' as unk as FC<HTP['img']>)(...p),\n /** creates a 'input' component with css applied */\n input: (...p: TSP) => styled('input' as unk as FC<HTP['input']>)(...p),\n /** creates a 'ins' component with css applied */\n ins: (...p: TSP) => styled('ins' as unk as FC<HTP['ins']>)(...p),\n /** creates a 'kbd' component with css applied */\n kbd: (...p: TSP) => styled('kbd' as unk as FC<HTP['kbd']>)(...p),\n /** creates a 'label' component with css applied */\n label: (...p: TSP) => styled('label' as unk as FC<HTP['label']>)(...p),\n /** creates a 'legend' component with css applied */\n legend: (...p: TSP) => styled('legend' as unk as FC<HTP['legend']>)(...p),\n /** creates a 'li' component with css applied */\n li: (...p: TSP) => styled('li' as unk as FC<HTP['li']>)(...p),\n /** creates a 'main' component with css applied */\n main: (...p: TSP) => styled('main' as unk as FC<HTP['main']>)(...p),\n /** creates a 'map' component with css applied */\n map: (...p: TSP) => styled('map' as unk as FC<HTP['map']>)(...p),\n /** creates a 'mark' component with css applied */\n mark: (...p: TSP) => styled('mark' as unk as FC<HTP['mark']>)(...p),\n /** creates a 'meter' component with css applied */\n meter: (...p: TSP) => styled('meter' as unk as FC<HTP['meter']>)(...p),\n /** creates a 'nav' component with css applied */\n nav: (...p: TSP) => styled('nav' as unk as FC<HTP['nav']>)(...p),\n /** creates a 'object' component with css applied */\n object: (...p: TSP) => styled('object' as unk as FC<HTP['object']>)(...p),\n /** creates a 'ol' component with css applied */\n ol: (...p: TSP) => styled('ol' as unk as FC<HTP['ol']>)(...p),\n /** creates a 'optgroup' component with css applied */\n optgroup: (...p: TSP) => styled('optgroup' as unk as FC<HTP['optgroup']>)(...p),\n /** creates a 'option' component with css applied */\n option: (...p: TSP) => styled('option' as unk as FC<HTP['option']>)(...p),\n /** creates a 'output' component with css applied */\n output: (...p: TSP) => styled('output' as unk as FC<HTP['output']>)(...p),\n /** creates a 'p' component with css applied */\n p: (...p: TSP) => styled('p' as unk as FC<HTP['p']>)(...p),\n /** creates a 'picture' component with css applied */\n picture: (...p: TSP) => styled('picture' as unk as FC<HTP['picture']>)(...p),\n /** creates a 'pre' component with css applied */\n pre: (...p: TSP) => styled('pre' as unk as FC<HTP['pre']>)(...p),\n /** creates a 'progress' component with css applied */\n progress: (...p: TSP) => styled('progress' as unk as FC<HTP['progress']>)(...p),\n /** creates a 'q' component with css applied */\n q: (...p: TSP) => styled('q' as unk as FC<HTP['q']>)(...p),\n /** creates a 'rp' component with css applied */\n rp: (...p: TSP) => styled('rp' as unk as FC<HTP['rp']>)(...p),\n /** creates a 'rt' component with css applied */\n rt: (...p: TSP) => styled('rt' as unk as FC<HTP['rt']>)(...p),\n /** creates a 'ruby' component with css applied */\n ruby: (...p: TSP) => styled('ruby' as unk as FC<HTP['ruby']>)(...p),\n /** creates a 's' component with css applied */\n s: (...p: TSP) => styled('s' as unk as FC<HTP['s']>)(...p),\n /** creates a 'samp' component with css applied */\n samp: (...p: TSP) => styled('samp' as unk as FC<HTP['samp']>)(...p),\n /** creates a 'section' component with css applied */\n section: (...p: TSP) => styled('section' as unk as FC<HTP['section']>)(...p),\n /** creates a 'select' component with css applied */\n select: (...p: TSP) => styled('select' as unk as FC<HTP['select']>)(...p),\n /** creates a 'small' component with css applied */\n small: (...p: TSP) => styled('small' as unk as FC<HTP['small']>)(...p),\n /** creates a 'span' component with css applied */\n span: (...p: TSP) => styled('span' as unk as FC<HTP['span']>)(...p),\n /** creates a 'strong' component with css applied */\n strong: (...p: TSP) => styled('strong' as unk as FC<HTP['strong']>)(...p),\n /** creates a 'sub' component with css applied */\n sub: (...p: TSP) => styled('sub' as unk as FC<HTP['sub']>)(...p),\n /** creates a 'summary' component with css applied */\n summary: (...p: TSP) => styled('summary' as unk as FC<HTP['summary']>)(...p),\n /** creates a 'sup' component with css applied */\n sup: (...p: TSP) => styled('sup' as unk as FC<HTP['sup']>)(...p),\n /** creates a 'table' component with css applied */\n table: (...p: TSP) => styled('table' as unk as FC<HTP['table']>)(...p),\n /** creates a 'tbody' component with css applied */\n tbody: (...p: TSP) => styled('tbody' as unk as FC<HTP['tbody']>)(...p),\n /** creates a 'td' component with css applied */\n td: (...p: TSP) => styled('td' as unk as FC<HTP['td']>)(...p),\n /** creates a 'textarea' component with css applied */\n textarea: (...p: TSP) => styled('textarea' as unk as FC<HTP['textarea']>)(...p),\n /** creates a 'tfoot' component with css applied */\n tfoot: (...p: TSP) => styled('tfoot' as unk as FC<HTP['tfoot']>)(...p),\n /** creates a 'th' component with css applied */\n th: (...p: TSP) => styled('th' as unk as FC<HTP['th']>)(...p),\n /** creates a 'thead' component with css applied */\n thead: (...p: TSP) => styled('thead' as unk as FC<HTP['thead']>)(...p),\n /** creates a 'time' component with css applied */\n time: (...p: TSP) => styled('time' as unk as FC<HTP['time']>)(...p),\n /** creates a 'tr' component with css applied */\n tr: (...p: TSP) => styled('tr' as unk as FC<HTP['tr']>)(...p),\n /** creates a 'u' component with css applied */\n u: (...p: TSP) => styled('u' as unk as FC<HTP['u']>)(...p),\n /** creates a 'ul' component with css applied */\n ul: (...p: TSP) => styled('ul' as unk as FC<HTP['ul']>)(...p),\n /** creates a 'video' component with css applied */\n video: (...p: TSP) => styled('video' as unk as FC<HTP['video']>)(...p),\n})\n","import { createElement, CSSProperties, FC, forwardRef, HTMLAttributes } from 'react'\nimport css, { classJoin, ShorthandProps, shorthandProps, shorthandPropsMap, TemplateStringProps } from '@slimr/css'\n\nexport { css }\nexport * from '@slimr/css'\n\n/** A type that represents all the css properties + shorthand props */\nexport interface ZxProps extends CSSProperties, ShorthandProps {}\ntype ZxP = ZxProps\n\ntype Zx = {\n [k in keyof ZxP]:\n | ZxP[k]\n | [ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n | [ZxP[k], ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k] | null, ZxP[k]]\n}\n\ntype _Props = {\n [k in keyof Zx as `_${k}`]?: Zx[k]\n}\n\nexport interface SCProps extends _Props {\n /** Like zx prop, but applies only on :active */\n _active?: Zx\n className?: string\n /** A string of css or classname to be added to the component */\n _css?: string\n /** Like zx prop, but applies only when user prefers dark theme */\n _dark?: Zx\n /** Like zx prop, but applies only on :focus */\n _focus?: Zx\n /** Like zx prop, but applies only on :focus-visible */\n _focusVisible?: Zx\n /** Like zx prop, but applies only on :focus-within */\n _focusWithin?: Zx\n /** Like zx prop, but applies only on :hover */\n _hover?: Zx\n style?: CSSProperties\n /** Like zx prop, but applies only on :target */\n _target?: Zx\n /** Like zx prop, but applies only on :visited */\n _visited?: Zx\n /**\n * Like style prop, but enhanced with features like chakra\n * - Array values are converted to media query breakpoints\n * - Numbers are converted to px\n * - Shorthand props are supported\n */\n _zx?: Zx\n}\n\n/** Styled Component: Like FunctionalComponent but adds SCProps */\nexport type SC<T extends { className?: HTMLAttributes<any>['className'] }> = FC<T & SCProps>\n\nfunction toKebabCase(str: string) {\n return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()\n}\n\nfunction toCamelCase(str: string) {\n return str.replace(/-./g, (x) => x[1].toUpperCase())\n}\n\nfunction expandShorthandProps(zx: Zx) {\n return Object.entries(zx).reduce((acc, [k, v]) => {\n if (k === 'mx') {\n acc.marginLeft = v\n acc.marginRight = v\n } else if (k === 'my') {\n acc.marginTop = v\n acc.marginBottom = v\n } else if (k === 'px') {\n acc.paddingLeft = v\n acc.paddingRight = v\n } else if (k === 'py') {\n acc.paddingTop = v\n acc.paddingBottom = v\n } else if (k in shorthandPropsMap) {\n acc[toCamelCase(shorthandPropsMap[k as keyof typeof shorthandPropsMap])] = v\n } else {\n acc[k] = v\n }\n return acc\n }, {} as any)\n}\n\nfunction zxToCss(zx: Zx): string {\n return Object.entries(zx)\n .map(([k, v]) => {\n if (!v) return ''\n k = toKebabCase(k)\n if (typeof v === 'number') v = v + 'px'\n if (Array.isArray(v)) {\n // @ts-ignore\n v = '[' + v.map((v) => (typeof v === 'number' ? v + 'px' : v)).join(',') + ']'\n }\n return k + ':' + v + ';'\n })\n .join('\\n')\n}\n\n/**\n * A lightweight alternative to styled-components\n * @param function - a functional component to be styled; must accept a className prop\n * @returns a function that accepts a template string of css returns a decorated functional component\n */\nexport default function styled<C extends FC<any>>(Component: C) {\n return (...cssProps: TemplateStringProps) => {\n const className = css(...cssProps)\n /**\n * A functional component that accepts Styled Props\n */\n const CStyled = forwardRef((props: SCProps, ref) => {\n let {\n _active,\n _css,\n _dark,\n _focus,\n _focusVisible,\n _focusWithin,\n _hover,\n _target,\n _visited,\n _zx = {},\n ...rest\n } = props\n\n // Pluck out $ prefixed props\n Object.entries(props).forEach(([k, v]) => {\n if (k.startsWith('_')) {\n // @ts-ignore\n _zx[k.slice(1)] = v\n // @ts-ignore\n delete rest[k]\n }\n })\n\n let cssStr = ''\n\n if (_active) {\n cssStr += `\n &:active {\n ${zxToCss(_active)}\n }\n `\n }\n if (_dark) {\n cssStr += `\n @media (prefers-color-scheme: dark) {\n ${zxToCss(_dark)}\n }\n `\n }\n if (_focus) {\n cssStr += `\n &:focus {\n ${zxToCss(_focus)}\n }\n `\n }\n if (_focusVisible) {\n cssStr += `\n &:focus-visible {\n ${zxToCss(_focusVisible)}\n }\n `\n }\n if (_focusWithin) {\n cssStr += `\n &:focus-within {\n ${zxToCss(_focusWithin)}\n }\n `\n }\n if (_hover) {\n cssStr += `\n &:hover {\n ${zxToCss(_hover)}\n }\n `\n }\n if (_target) {\n cssStr += `\n &:target {\n ${zxToCss(_target)}\n }\n `\n }\n if (_visited) {\n cssStr += `\n &:visited {\n ${zxToCss(_visited)}\n }\n `\n }\n\n const hasMediaQuery = Object.values(_zx).some((v) => Array.isArray(v))\n // If has media query styles, use css class. Otherwise favor inline styles\n if (hasMediaQuery || cssStr) {\n cssStr = zxToCss(_zx) + cssStr\n } else {\n _zx = expandShorthandProps(_zx)\n rest.style = { ...rest.style, ..._zx } as CSSProperties\n }\n\n return createElement(Component, {\n ref,\n ...rest,\n className: classJoin(\n className,\n _css ? (_css.includes(':') ? css(_css) : _css) : undefined,\n cssStr ? css(cssStr) : undefined,\n props.className\n ),\n })\n })\n CStyled.toString = () => '.' + className\n return CStyled as unknown as SC<Parameters<C>[0]>\n }\n}\n"],"mappings":"kaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,SAAAE,EAAA,YAAAC,ICAA,IAAAC,EAAA,GAAAC,EAAAD,EAAA,SAAAE,EAAA,YAAAC,IAIAC,EAAAJ,EAAAK,GAJA,OAAS,iBAAAC,EAAkC,cAAAC,MAAkC,QAC7E,OAAOL,GAAO,aAAAM,EAA2C,qBAAAC,MAA8C,aAGvG,UAAAJ,MAAc,aAsDd,SAASK,EAAYC,EAAa,CAChC,OAAOA,EAAI,QAAQ,kBAAmB,OAAO,EAAE,YAAY,C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B,EAAE,GAAGC,CAAC,EAE5D,MAAO,IAAIA,IAAWD,EAAO,OAAkC,EAAE,GAAGC,CAAC,EAErE,KAAM,IAAIA,IAAWD,EAAO,MAAgC,EAAE,GAAGC,CAAC,EAElE,GAAI,IAAIA,IAAWD,EAAO,IAA4B,EAAE,GAAGC,CAAC,EAE5D,EAAG,IAAIA,IAAWD,EAAO,GAA0B,EAAE,GAAGC,CAAC,EAEzD,GAAI,IAAIA,IAAWD,EAAO,IAA4B,EAAE,GAAGC,CAAC,EAE5D,MAAO,IAAIA,IAAWD,EAAO,OAAkC,EAAE,GAAGC,CAAC,CACvE,CAAC","names":["withHtmlTags_exports","__export","css","withHtmlTags_default","src_exports","__export","css","styled","__reExport","css_star","createElement","forwardRef","classJoin","shorthandPropsMap","toKebabCase","str","toCamelCase","x","expandShorthandProps","zx","acc","k","v","shorthandPropsMap","zxToCss","styled","Component","cssProps","className","css","CStyled","forwardRef","props","ref","_active","_css","_dark","_focus","_focusVisible","_focusWithin","_hover","_target","_visited","_zx","rest","cssStr","createElement","classJoin","__reExport","withHtmlTags_exports","src_exports","withHtmlTags_default","styled","p"]}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { FC } from 'react'
|
|
2
|
+
import { TemplateStringProps } from '@slimr/css'
|
|
3
|
+
import styled from './index.js'
|
|
4
|
+
|
|
5
|
+
export * from './index.js'
|
|
6
|
+
|
|
7
|
+
/** Shorthand type */
|
|
8
|
+
type unk = unknown
|
|
9
|
+
/** Shorthand type */
|
|
10
|
+
type TSP = TemplateStringProps
|
|
11
|
+
/** Shorthand type */
|
|
12
|
+
type HTP = JSX.IntrinsicElements
|
|
13
|
+
|
|
14
|
+
export default Object.assign(styled, {
|
|
15
|
+
/** creates a 'a' component with css applied */
|
|
16
|
+
a: (...p: TSP) => styled('a' as unk as FC<HTP['a']>)(...p),
|
|
17
|
+
/** creates a 'abbr' component with css applied */
|
|
18
|
+
abbr: (...p: TSP) => styled('abbr' as unk as FC<HTP['abbr']>)(...p),
|
|
19
|
+
/** creates a 'address' component with css applied */
|
|
20
|
+
address: (...p: TSP) => styled('address' as unk as FC<HTP['address']>)(...p),
|
|
21
|
+
/** creates a 'area' component with css applied */
|
|
22
|
+
area: (...p: TSP) => styled('area' as unk as FC<HTP['area']>)(...p),
|
|
23
|
+
/** creates a 'article' component with css applied */
|
|
24
|
+
article: (...p: TSP) => styled('article' as unk as FC<HTP['article']>)(...p),
|
|
25
|
+
/** creates a 'aside' component with css applied */
|
|
26
|
+
aside: (...p: TSP) => styled('aside' as unk as FC<HTP['aside']>)(...p),
|
|
27
|
+
/** creates a 'audio' component with css applied */
|
|
28
|
+
audio: (...p: TSP) => styled('audio' as unk as FC<HTP['audio']>)(...p),
|
|
29
|
+
/** creates a 'b' component with css applied */
|
|
30
|
+
b: (...p: TSP) => styled('b' as unk as FC<HTP['b']>)(...p),
|
|
31
|
+
/** creates a 'big' component with css applied; Deprecated so left out */
|
|
32
|
+
// big: (...p: TSP) => styled('big' as unk as FC<HTP['big']>)(...p),
|
|
33
|
+
/** creates a 'blockquote' component with css applied */
|
|
34
|
+
blockquote: (...p: TSP) => styled('blockquote' as unk as FC<HTP['blockquote']>)(...p),
|
|
35
|
+
/** creates a 'body' component with css applied; omitted bc doesnt seem useful */
|
|
36
|
+
// body: (...p: TSP) => styled('body' as unk as FC<HTP['body']>)(...p),
|
|
37
|
+
/** creates a 'br' component with css applied; omitted bc doesnt seem useful */
|
|
38
|
+
br: (...p: TSP) => styled('br' as unk as FC<HTP['br']>)(...p),
|
|
39
|
+
/** creates a 'button' component with css applied */
|
|
40
|
+
button: (...p: TSP) => styled('button' as unk as FC<HTP['button']>)(...p),
|
|
41
|
+
/** creates a 'caption' component with css applied */
|
|
42
|
+
caption: (...p: TSP) => styled('caption' as unk as FC<HTP['caption']>)(...p),
|
|
43
|
+
/** creates a 'cite' component with css applied */
|
|
44
|
+
cite: (...p: TSP) => styled('cite' as unk as FC<HTP['cite']>)(...p),
|
|
45
|
+
/** creates a 'code' component with css applied */
|
|
46
|
+
code: (...p: TSP) => styled('code' as unk as FC<HTP['code']>)(...p),
|
|
47
|
+
/** creates a 'col' component with css applied */
|
|
48
|
+
col: (...p: TSP) => styled('col' as unk as FC<HTP['col']>)(...p),
|
|
49
|
+
/** creates a 'colgroup' component with css applied */
|
|
50
|
+
colgroup: (...p: TSP) => styled('colgroup' as unk as FC<HTP['colgroup']>)(...p),
|
|
51
|
+
/** creates a 'dd' component with css applied */
|
|
52
|
+
dd: (...p: TSP) => styled('dd' as unk as FC<HTP['dd']>)(...p),
|
|
53
|
+
/** creates a 'del' component with css applied */
|
|
54
|
+
del: (...p: TSP) => styled('del' as unk as FC<HTP['del']>)(...p),
|
|
55
|
+
/** creates a 'details' component with css applied */
|
|
56
|
+
details: (...p: TSP) => styled('details' as unk as FC<HTP['details']>)(...p),
|
|
57
|
+
/** creates a 'dfn' component with css applied */
|
|
58
|
+
dfn: (...p: TSP) => styled('dfn' as unk as FC<HTP['dfn']>)(...p),
|
|
59
|
+
/** creates a 'dialog' component with css applied */
|
|
60
|
+
dialog: (...p: TSP) => styled('dialog' as unk as FC<HTP['dialog']>)(...p),
|
|
61
|
+
/** creates a 'div' component with css applied */
|
|
62
|
+
div: (...p: TSP) => styled('div' as unk as FC<HTP['div']>)(...p),
|
|
63
|
+
/** creates a 'dl' component with css applied */
|
|
64
|
+
dl: (...p: TSP) => styled('dl' as unk as FC<HTP['dl']>)(...p),
|
|
65
|
+
/** creates a 'dt' component with css applied */
|
|
66
|
+
dt: (...p: TSP) => styled('dt' as unk as FC<HTP['dt']>)(...p),
|
|
67
|
+
/** creates a 'em' component with css applied */
|
|
68
|
+
em: (...p: TSP) => styled('em' as unk as FC<HTP['em']>)(...p),
|
|
69
|
+
/** creates a 'embed' component with css applied */
|
|
70
|
+
embed: (...p: TSP) => styled('embed' as unk as FC<HTP['embed']>)(...p),
|
|
71
|
+
/** creates a 'fieldset' component with css applied */
|
|
72
|
+
fieldset: (...p: TSP) => styled('fieldset' as unk as FC<HTP['fieldset']>)(...p),
|
|
73
|
+
/** creates a 'figcaption' component with css applied */
|
|
74
|
+
figcaption: (...p: TSP) => styled('figcaption' as unk as FC<HTP['figcaption']>)(...p),
|
|
75
|
+
/** creates a 'figure' component with css applied */
|
|
76
|
+
figure: (...p: TSP) => styled('figure' as unk as FC<HTP['figure']>)(...p),
|
|
77
|
+
/** creates a 'footer' component with css applied */
|
|
78
|
+
footer: (...p: TSP) => styled('footer' as unk as FC<HTP['footer']>)(...p),
|
|
79
|
+
/** creates a 'form' component with css applied */
|
|
80
|
+
form: (...p: TSP) => styled('form' as unk as FC<HTP['form']>)(...p),
|
|
81
|
+
/** creates a 'h1' component with css applied */
|
|
82
|
+
h1: (...p: TSP) => styled('h1' as unk as FC<HTP['h1']>)(...p),
|
|
83
|
+
/** creates a 'h2' component with css applied */
|
|
84
|
+
h2: (...p: TSP) => styled('h2' as unk as FC<HTP['h2']>)(...p),
|
|
85
|
+
/** creates a 'h3' component with css applied */
|
|
86
|
+
h3: (...p: TSP) => styled('h3' as unk as FC<HTP['h3']>)(...p),
|
|
87
|
+
/** creates a 'h4' component with css applied */
|
|
88
|
+
h4: (...p: TSP) => styled('h4' as unk as FC<HTP['h4']>)(...p),
|
|
89
|
+
/** creates a 'h5' component with css applied */
|
|
90
|
+
h5: (...p: TSP) => styled('h5' as unk as FC<HTP['h5']>)(...p),
|
|
91
|
+
/** creates a 'h6' component with css applied */
|
|
92
|
+
h6: (...p: TSP) => styled('h6' as unk as FC<HTP['h6']>)(...p),
|
|
93
|
+
/** creates a 'header' component with css applied */
|
|
94
|
+
header: (...p: TSP) => styled('header' as unk as FC<HTP['header']>)(...p),
|
|
95
|
+
/** creates a 'hgroup' component with css applied */
|
|
96
|
+
hgroup: (...p: TSP) => styled('hgroup' as unk as FC<HTP['hgroup']>)(...p),
|
|
97
|
+
/** creates a 'hr' component with css applied */
|
|
98
|
+
hr: (...p: TSP) => styled('hr' as unk as FC<HTP['hr']>)(...p),
|
|
99
|
+
/** creates a 'i' component with css applied */
|
|
100
|
+
i: (...p: TSP) => styled('i' as unk as FC<HTP['i']>)(...p),
|
|
101
|
+
/** creates a 'iframe' component with css applied */
|
|
102
|
+
iframe: (...p: TSP) => styled('iframe' as unk as FC<HTP['iframe']>)(...p),
|
|
103
|
+
/** creates a 'img' component with css applied */
|
|
104
|
+
img: (...p: TSP) => styled('img' as unk as FC<HTP['img']>)(...p),
|
|
105
|
+
/** creates a 'input' component with css applied */
|
|
106
|
+
input: (...p: TSP) => styled('input' as unk as FC<HTP['input']>)(...p),
|
|
107
|
+
/** creates a 'ins' component with css applied */
|
|
108
|
+
ins: (...p: TSP) => styled('ins' as unk as FC<HTP['ins']>)(...p),
|
|
109
|
+
/** creates a 'kbd' component with css applied */
|
|
110
|
+
kbd: (...p: TSP) => styled('kbd' as unk as FC<HTP['kbd']>)(...p),
|
|
111
|
+
/** creates a 'label' component with css applied */
|
|
112
|
+
label: (...p: TSP) => styled('label' as unk as FC<HTP['label']>)(...p),
|
|
113
|
+
/** creates a 'legend' component with css applied */
|
|
114
|
+
legend: (...p: TSP) => styled('legend' as unk as FC<HTP['legend']>)(...p),
|
|
115
|
+
/** creates a 'li' component with css applied */
|
|
116
|
+
li: (...p: TSP) => styled('li' as unk as FC<HTP['li']>)(...p),
|
|
117
|
+
/** creates a 'main' component with css applied */
|
|
118
|
+
main: (...p: TSP) => styled('main' as unk as FC<HTP['main']>)(...p),
|
|
119
|
+
/** creates a 'map' component with css applied */
|
|
120
|
+
map: (...p: TSP) => styled('map' as unk as FC<HTP['map']>)(...p),
|
|
121
|
+
/** creates a 'mark' component with css applied */
|
|
122
|
+
mark: (...p: TSP) => styled('mark' as unk as FC<HTP['mark']>)(...p),
|
|
123
|
+
/** creates a 'meter' component with css applied */
|
|
124
|
+
meter: (...p: TSP) => styled('meter' as unk as FC<HTP['meter']>)(...p),
|
|
125
|
+
/** creates a 'nav' component with css applied */
|
|
126
|
+
nav: (...p: TSP) => styled('nav' as unk as FC<HTP['nav']>)(...p),
|
|
127
|
+
/** creates a 'object' component with css applied */
|
|
128
|
+
object: (...p: TSP) => styled('object' as unk as FC<HTP['object']>)(...p),
|
|
129
|
+
/** creates a 'ol' component with css applied */
|
|
130
|
+
ol: (...p: TSP) => styled('ol' as unk as FC<HTP['ol']>)(...p),
|
|
131
|
+
/** creates a 'optgroup' component with css applied */
|
|
132
|
+
optgroup: (...p: TSP) => styled('optgroup' as unk as FC<HTP['optgroup']>)(...p),
|
|
133
|
+
/** creates a 'option' component with css applied */
|
|
134
|
+
option: (...p: TSP) => styled('option' as unk as FC<HTP['option']>)(...p),
|
|
135
|
+
/** creates a 'output' component with css applied */
|
|
136
|
+
output: (...p: TSP) => styled('output' as unk as FC<HTP['output']>)(...p),
|
|
137
|
+
/** creates a 'p' component with css applied */
|
|
138
|
+
p: (...p: TSP) => styled('p' as unk as FC<HTP['p']>)(...p),
|
|
139
|
+
/** creates a 'picture' component with css applied */
|
|
140
|
+
picture: (...p: TSP) => styled('picture' as unk as FC<HTP['picture']>)(...p),
|
|
141
|
+
/** creates a 'pre' component with css applied */
|
|
142
|
+
pre: (...p: TSP) => styled('pre' as unk as FC<HTP['pre']>)(...p),
|
|
143
|
+
/** creates a 'progress' component with css applied */
|
|
144
|
+
progress: (...p: TSP) => styled('progress' as unk as FC<HTP['progress']>)(...p),
|
|
145
|
+
/** creates a 'q' component with css applied */
|
|
146
|
+
q: (...p: TSP) => styled('q' as unk as FC<HTP['q']>)(...p),
|
|
147
|
+
/** creates a 'rp' component with css applied */
|
|
148
|
+
rp: (...p: TSP) => styled('rp' as unk as FC<HTP['rp']>)(...p),
|
|
149
|
+
/** creates a 'rt' component with css applied */
|
|
150
|
+
rt: (...p: TSP) => styled('rt' as unk as FC<HTP['rt']>)(...p),
|
|
151
|
+
/** creates a 'ruby' component with css applied */
|
|
152
|
+
ruby: (...p: TSP) => styled('ruby' as unk as FC<HTP['ruby']>)(...p),
|
|
153
|
+
/** creates a 's' component with css applied */
|
|
154
|
+
s: (...p: TSP) => styled('s' as unk as FC<HTP['s']>)(...p),
|
|
155
|
+
/** creates a 'samp' component with css applied */
|
|
156
|
+
samp: (...p: TSP) => styled('samp' as unk as FC<HTP['samp']>)(...p),
|
|
157
|
+
/** creates a 'section' component with css applied */
|
|
158
|
+
section: (...p: TSP) => styled('section' as unk as FC<HTP['section']>)(...p),
|
|
159
|
+
/** creates a 'select' component with css applied */
|
|
160
|
+
select: (...p: TSP) => styled('select' as unk as FC<HTP['select']>)(...p),
|
|
161
|
+
/** creates a 'small' component with css applied */
|
|
162
|
+
small: (...p: TSP) => styled('small' as unk as FC<HTP['small']>)(...p),
|
|
163
|
+
/** creates a 'span' component with css applied */
|
|
164
|
+
span: (...p: TSP) => styled('span' as unk as FC<HTP['span']>)(...p),
|
|
165
|
+
/** creates a 'strong' component with css applied */
|
|
166
|
+
strong: (...p: TSP) => styled('strong' as unk as FC<HTP['strong']>)(...p),
|
|
167
|
+
/** creates a 'sub' component with css applied */
|
|
168
|
+
sub: (...p: TSP) => styled('sub' as unk as FC<HTP['sub']>)(...p),
|
|
169
|
+
/** creates a 'summary' component with css applied */
|
|
170
|
+
summary: (...p: TSP) => styled('summary' as unk as FC<HTP['summary']>)(...p),
|
|
171
|
+
/** creates a 'sup' component with css applied */
|
|
172
|
+
sup: (...p: TSP) => styled('sup' as unk as FC<HTP['sup']>)(...p),
|
|
173
|
+
/** creates a 'table' component with css applied */
|
|
174
|
+
table: (...p: TSP) => styled('table' as unk as FC<HTP['table']>)(...p),
|
|
175
|
+
/** creates a 'tbody' component with css applied */
|
|
176
|
+
tbody: (...p: TSP) => styled('tbody' as unk as FC<HTP['tbody']>)(...p),
|
|
177
|
+
/** creates a 'td' component with css applied */
|
|
178
|
+
td: (...p: TSP) => styled('td' as unk as FC<HTP['td']>)(...p),
|
|
179
|
+
/** creates a 'textarea' component with css applied */
|
|
180
|
+
textarea: (...p: TSP) => styled('textarea' as unk as FC<HTP['textarea']>)(...p),
|
|
181
|
+
/** creates a 'tfoot' component with css applied */
|
|
182
|
+
tfoot: (...p: TSP) => styled('tfoot' as unk as FC<HTP['tfoot']>)(...p),
|
|
183
|
+
/** creates a 'th' component with css applied */
|
|
184
|
+
th: (...p: TSP) => styled('th' as unk as FC<HTP['th']>)(...p),
|
|
185
|
+
/** creates a 'thead' component with css applied */
|
|
186
|
+
thead: (...p: TSP) => styled('thead' as unk as FC<HTP['thead']>)(...p),
|
|
187
|
+
/** creates a 'time' component with css applied */
|
|
188
|
+
time: (...p: TSP) => styled('time' as unk as FC<HTP['time']>)(...p),
|
|
189
|
+
/** creates a 'tr' component with css applied */
|
|
190
|
+
tr: (...p: TSP) => styled('tr' as unk as FC<HTP['tr']>)(...p),
|
|
191
|
+
/** creates a 'u' component with css applied */
|
|
192
|
+
u: (...p: TSP) => styled('u' as unk as FC<HTP['u']>)(...p),
|
|
193
|
+
/** creates a 'ul' component with css applied */
|
|
194
|
+
ul: (...p: TSP) => styled('ul' as unk as FC<HTP['ul']>)(...p),
|
|
195
|
+
/** creates a 'video' component with css applied */
|
|
196
|
+
video: (...p: TSP) => styled('video' as unk as FC<HTP['video']>)(...p),
|
|
197
|
+
})
|
package/tsconfig.json
ADDED