@animus-ui/properties 0.1.4 → 0.1.5
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -1
- package/dist/unitless.d.ts +7 -0
- package/dist/unitless.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -88,5 +88,27 @@ const UNITLESS_PROPERTIES = new Set([
|
|
|
88
88
|
"z-index",
|
|
89
89
|
"zoom"
|
|
90
90
|
]);
|
|
91
|
+
/**
|
|
92
|
+
* Both spellings of every unitless property, precomputed at module load.
|
|
93
|
+
*
|
|
94
|
+
* Callers arrive from two directions — CSS declaration text (kebab-case) and
|
|
95
|
+
* prop configs (camelCase) — and the lookup sits on the runtime's dynamic-prop
|
|
96
|
+
* hot path, so the conversion happens once here rather than per call.
|
|
97
|
+
* Single-word entries convert to themselves and collapse into one member.
|
|
98
|
+
*/
|
|
99
|
+
const UNITLESS_PROPERTY_SPELLINGS = /* @__PURE__ */ new Set();
|
|
100
|
+
for (const property of UNITLESS_PROPERTIES) {
|
|
101
|
+
UNITLESS_PROPERTY_SPELLINGS.add(property);
|
|
102
|
+
UNITLESS_PROPERTY_SPELLINGS.add(property.replace(/-([a-z])/g, (_, char) => char.toUpperCase()));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Whether bare numeric values on this CSS property render without a unit.
|
|
106
|
+
* Accepts either spelling (`line-height` or `lineHeight`) — the single home
|
|
107
|
+
* for the unitless decision, so no caller has to pair a case conversion with
|
|
108
|
+
* a set lookup of its own.
|
|
109
|
+
*/
|
|
110
|
+
function isUnitlessProperty(property) {
|
|
111
|
+
return UNITLESS_PROPERTY_SPELLINGS.has(property);
|
|
112
|
+
}
|
|
91
113
|
//#endregion
|
|
92
|
-
export { SHORTHAND_PROPERTIES, UNITLESS_PROPERTIES };
|
|
114
|
+
export { SHORTHAND_PROPERTIES, UNITLESS_PROPERTIES, isUnitlessProperty };
|
package/dist/unitless.d.ts
CHANGED
|
@@ -7,4 +7,11 @@
|
|
|
7
7
|
* See shorthands.ts for camelCase convention rationale.
|
|
8
8
|
*/
|
|
9
9
|
export declare const UNITLESS_PROPERTIES: Set<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Whether bare numeric values on this CSS property render without a unit.
|
|
12
|
+
* Accepts either spelling (`line-height` or `lineHeight`) — the single home
|
|
13
|
+
* for the unitless decision, so no caller has to pair a case conversion with
|
|
14
|
+
* a set lookup of its own.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isUnitlessProperty(property: string): boolean;
|
|
10
17
|
//# sourceMappingURL=unitless.d.ts.map
|
package/dist/unitless.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unitless.d.ts","sourceRoot":"","sources":["../src/unitless.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,aAkD9B,CAAC"}
|
|
1
|
+
{"version":3,"file":"unitless.d.ts","sourceRoot":"","sources":["../src/unitless.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,aAkD9B,CAAC;AAkBH;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE5D"}
|