@prop-styles/core
Advanced tools
Comparing version 0.0.2 to 0.0.3
/*! | ||
* zx-sml version 0.9.4 | ||
* Author: Capricorncd <capricorncd@qq.com> | ||
* Repository: [object Object] | ||
* Released on: 2024-04-14 23:53:59 (GMT+0900) | ||
* @zx-libs/utils version 0.0.1 | ||
* Author: Capricorncd<capricorncd@qq.com> | ||
* Homepage: https://github.com/capricorncd/zx-libs/libs/utils#readme | ||
* Released on: 2024-04-21 17:05:23 (GMT+0900) | ||
*/ | ||
@@ -7,0 +7,0 @@ function u(n) { |
(function(r,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(r=typeof globalThis<"u"?globalThis:r||self,f(r["prop-styles-core"]={}))})(this,function(r){"use strict";/*! | ||
* zx-sml version 0.9.4 | ||
* Author: Capricorncd <capricorncd@qq.com> | ||
* Repository: [object Object] | ||
* Released on: 2024-04-14 23:53:59 (GMT+0900) | ||
* @zx-libs/utils version 0.0.1 | ||
* Author: Capricorncd<capricorncd@qq.com> | ||
* Homepage: https://github.com/capricorncd/zx-libs/libs/utils#readme | ||
* Released on: 2024-04-21 17:05:23 (GMT+0900) | ||
*/function f(n){return typeof n=="string"?/^-?\d+(\.\d+)?$/.test(n):c(n)}function c(n){return Number.isFinite(n)}function g(n){return typeof n>"u"||n===null}function l(n,i="px"){if(f(n))return`${n}${i}`;if(n&&typeof n=="string"){const t=n.trim().replace(/\s{2,}/g," ");return/^(-?\d+(\.\d+)?([a-z]+|%)?\s*)+$/i.test(t)&&/(\d+\s|\s\d+$)/.test(t)?t.trim().split(" ").map(e=>l(e,i)).join(" "):t}return""}function a(n="",i="-"){return n.replace(/[A-Z]/g,(t,e)=>`${e>0?i:""}${t.toLowerCase()}`)}function p(n){return typeof n=="boolean"}const m=/^(#[a-f0-9]{3,8}|(rgba?|hsla?|hwb|lab|lch|oklab|oklch|hwb|lch|light-dark)\(.+\))$/i;function h(n){return typeof n!="string"?!1:m.test(n)}function o(n,i,t){return!i&&i!==0?null:[n,t??String(i)]}function u(n,i){return n.reduce((t,e)=>(t[e]=s=>i(e,s),t),{})}function b(n){return u(n,(i,t)=>o("display",t,a(i)))}function y(n){return u(n,(i,t)=>o(i,t,l(t)))}function S(n){return u(n,(i,t)=>[i,t])}const P=/^-?\d+(\.\d+)?[a-z]+$/i;function R(n){return typeof n=="string"&&P.test(n)}function k(n){return g(n)?null:f(n)||R(n)?["borderWidth",l(n)]:h(n)?["borderColor",n]:["border",String(n)]}function _(n,i,t){let e;for(const s of Object.keys(n))if(e=i[s],e){const d=e(n[s],n);if(d){const[L,$]=d;t[L]=$}}}const W=["width","minWidth","maxWidth","height","minHeight","maxHeight","padding","paddingTop","paddingBottom","paddingLeft","paddingRight","paddingInline","paddingBlock","margin","marginTop","marginBottom","marginLeft","marginRight","marginInline","marginBlock","gap","fontSize","lineHeight"],w=["background","color"],C={radius:n=>["borderRadius",l(n)],align:n=>["alignItems",n??""],justify:n=>["justifyContent",n??""],column:n=>n?["flexDirection","column"]:null,wrap:n=>n?["flexWrap",p(n)?"wrap":n]:null,breakWord:n=>n?["overflowWrap","break-word"]:null,bold:n=>n?["fontWeight","bold"]:null,thin:n=>n?["fontWeight","500"]:null,...b(["flex","grid","inline","inlineFlex","inlineBlock"]),scroll:n=>n?[`overflow${typeof n=="string"?n.toUpperCase():""}`,"auto"]:null,...y(W),...S(w),border:n=>k(n),fs:n=>o("fontSize",n,l(n)),bg:n=>o("background",n),fontWeight:n=>o("fontWeight",n),fw:n=>o("fontWeight",n)};function E(n,i){const t={...n.style},e={...C,...i};return _(n,e,t),t}r.createPropStyles=E,r.formatReturn=o,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}); |
@@ -76,4 +76,5 @@ /** | ||
) => PropMappingHandlerReturn | ||
export type PropMappingHandlerReturn = [key: string, val: string] | null | ||
export type PropMappings<T extends BaseProps> = { | ||
[key: keyof T]: PropMappingHandler<T> | ||
} |
{ | ||
"name": "@prop-styles/core", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "The library provides a static method createPropStyles to create Style objects.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.ts", |
@@ -228,2 +228,15 @@ # @prop-styles/core | ||
### PropMappingHandlerReturn | ||
[PropMappingHandler](#PropMappingHandler)'s returns | ||
<details> | ||
<summary>Source Code</summary> | ||
```ts | ||
type PropMappingHandlerReturn = [key: string, val: string] | null | ||
``` | ||
</details> | ||
### PropMappings | ||
@@ -230,0 +243,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16140
245
263