@animus-ui/properties 0.1.23 → 0.1.25

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 CHANGED
@@ -10,6 +10,27 @@ export declare const UNITLESS_PROPERTIES: Set<string>;
10
10
  * `-webkit-line-clamp` or `WebkitLineClamp`. */
11
11
  export declare function isUnitlessProperty(property: string): boolean;
12
12
  //#endregion
13
+ //#region src/zero-lengths.d.ts
14
+ /**
15
+ * The properties whose intended value is a length, as style keys: on a
16
+ * strict scale, zero (`0` or `'0'`) is admitted beside the scale's keys only
17
+ * on these, and elsewhere the scale wins. A property is listed when its
18
+ * syntax in mdn-data is built from lengths, length-percentages, line widths
19
+ * and percentages, with keywords and length functions: margins, paddings,
20
+ * gaps, insets, sizes, radii, border and outline widths, positions and
21
+ * offsets, among them SVG geometry and a stroke's width, whose numbers are
22
+ * user units. `fontSize` is listed too, and so are the vendor-prefixed
23
+ * spellings of listed properties. A property whose number is a multiplier or
24
+ * a count (`lineHeight`, `borderImageWidth`, `tabSize`), a shorthand that
25
+ * also takes colours or styles, and grid track sizing are not. The strict
26
+ * types read this table, as does the runtime resolver; the extractor reads
27
+ * it through `property_table.json`.
28
+ */
29
+ export declare const ZERO_LENGTH_PROPERTIES: readonly ['MozBorderEndWidth', 'MozColumnRuleWidth', 'MozColumnWidth', 'MozMarginEnd', 'MozMarginStart', 'MozOutlineRadius', 'MozOutlineRadiusBottomleft', 'MozOutlineRadiusBottomright', 'MozOutlineRadiusTopleft', 'MozOutlineRadiusTopright', 'MozPaddingEnd', 'MozPaddingStart', 'MozPerspective', 'MozTransformOrigin', 'WebkitBorderBeforeWidth', 'WebkitBorderBottomLeftRadius', 'WebkitBorderBottomRightRadius', 'WebkitBorderRadius', 'WebkitBorderTopLeftRadius', 'WebkitBorderTopRightRadius', 'WebkitColumnRuleWidth', 'WebkitColumnWidth', 'WebkitFlexBasis', 'WebkitLogicalHeight', 'WebkitLogicalWidth', 'WebkitMarginEnd', 'WebkitMarginStart', 'WebkitMaskPosition', 'WebkitMaskPositionX', 'WebkitMaskPositionY', 'WebkitMaskSize', 'WebkitMaxInlineSize', 'WebkitPaddingEnd', 'WebkitPaddingStart', 'WebkitPerspective', 'WebkitShapeMargin', 'WebkitTextStrokeWidth', 'WebkitTransformOrigin', 'animationRangeEnd', 'animationRangeStart', 'backgroundPosition', 'backgroundPositionX', 'backgroundPositionY', 'backgroundSize', 'baselineShift', 'blockSize', 'borderBlockEndWidth', 'borderBlockStartWidth', 'borderBlockWidth', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomWidth', 'borderEndEndRadius', 'borderEndStartRadius', 'borderInlineEndWidth', 'borderInlineStartWidth', 'borderInlineWidth', 'borderLeftWidth', 'borderRadius', 'borderRightWidth', 'borderSpacing', 'borderStartEndRadius', 'borderStartStartRadius', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderTopWidth', 'borderWidth', 'bottom', 'columnGap', 'columnRuleWidth', 'columnWidth', 'containIntrinsicBlockSize', 'containIntrinsicHeight', 'containIntrinsicInlineSize', 'containIntrinsicSize', 'containIntrinsicWidth', 'cx', 'cy', 'flexBasis', 'fontSize', 'gap', 'height', 'inlineSize', 'inset', 'insetBlock', 'insetBlockEnd', 'insetBlockStart', 'insetInline', 'insetInlineEnd', 'insetInlineStart', 'left', 'letterSpacing', 'lineHeightStep', 'margin', 'marginBlock', 'marginBlockEnd', 'marginBlockStart', 'marginBottom', 'marginInline', 'marginInlineEnd', 'marginInlineStart', 'marginLeft', 'marginRight', 'marginTop', 'maskPosition', 'maskSize', 'maxBlockSize', 'maxHeight', 'maxInlineSize', 'maxWidth', 'minBlockSize', 'minHeight', 'minInlineSize', 'minWidth', 'msHyphenateLimitZone', 'msScrollLimitXMax', 'msScrollLimitXMin', 'msScrollLimitYMax', 'msScrollLimitYMin', 'msTransformOrigin', 'msWrapMargin', 'objectPosition', 'offsetAnchor', 'offsetDistance', 'offsetPosition', 'outlineOffset', 'outlineWidth', 'overflowClipMargin', 'padding', 'paddingBlock', 'paddingBlockEnd', 'paddingBlockStart', 'paddingBottom', 'paddingInline', 'paddingInlineEnd', 'paddingInlineStart', 'paddingLeft', 'paddingRight', 'paddingTop', 'perspective', 'perspectiveOrigin', 'r', 'right', 'rowGap', 'rx', 'ry', 'scrollMargin', 'scrollMarginBlock', 'scrollMarginBlockEnd', 'scrollMarginBlockStart', 'scrollMarginBottom', 'scrollMarginInline', 'scrollMarginInlineEnd', 'scrollMarginInlineStart', 'scrollMarginLeft', 'scrollMarginRight', 'scrollMarginTop', 'scrollPadding', 'scrollPaddingBlock', 'scrollPaddingBlockEnd', 'scrollPaddingBlockStart', 'scrollPaddingBottom', 'scrollPaddingInline', 'scrollPaddingInlineEnd', 'scrollPaddingInlineStart', 'scrollPaddingLeft', 'scrollPaddingRight', 'scrollPaddingTop', 'shapeMargin', 'strokeDashoffset', 'strokeWidth', 'textDecorationThickness', 'textIndent', 'textUnderlineOffset', 'top', 'transformOrigin', 'translate', 'verticalAlign', 'viewTimelineInset', 'width', 'wordSpacing', 'x', 'y'];
30
+ type ZeroLengthProperty = (typeof ZERO_LENGTH_PROPERTIES)[number];
31
+ /** Whether a strict scale on `property` admits zero beside its keys. */
32
+ export declare function isZeroLengthProperty(property: string): boolean;
33
+ //#endregion
13
34
  //#region src/css-tokens.d.ts
14
35
  /**
15
36
  * CSS tokens as CSS Syntax Level 3 reads them, with their source offsets.
@@ -156,5 +177,5 @@ type FoldedInitialValue =
156
177
  */
157
178
  export declare function foldInitialValue(syntax: string, initialValue: string): FoldedInitialValue | undefined;
158
179
  //#endregion
159
- export type { ComponentValue, CssToken, FoldedInitialValue, ImportantPriority, ImportantSpelling, VariableRead };
180
+ export type { ComponentValue, CssToken, FoldedInitialValue, ImportantPriority, ImportantSpelling, VariableRead, ZeroLengthProperty };
160
181
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/shorthands.ts","../src/unitless.ts","../src/css-tokens.ts","../src/registration-values.ts"],"mappings":";;;;qBAGa;;;qBCHA,qBAAmB;;;wBAgHhB,mBAAmB;;;;;;;;;;KCxGvB;UA0BK;EACf,MAAM;EACN;EACA;;;EAGA;;EAEA;;;;wBAiFc,aACd,aACA;EACG;EAAc;;;wBAOH,kBAAkB;;wBAyFlB,SAAS,cAAc;;;KA0E3B;EAEN;;EAEA,MAAM;;EAEN,OAAO;EACP,UAAU;EACV;EACA;;EAEA;EAAe,OAAO;EAAU;EAAe;;;;;;;wBAgBrC,gBAAgB,iBAAiB,aAAa;;wBAoC9C,UACd,iBAAiB,kBACjB,OAAO,OAAO;;;;UAWC;EACf;EACA;EACA;EACA;IAAY;IAAe;IAAe;;;;qBAI/B,UAAO,OAAW;;;;;;wBAQf,cACd,iBAAiB,mBAChB;;;KAiCS;UAEK;EACf,UAAU;;EAEV;;;;;;;;wBASc,kBAAkB,cAAc;;;;;;;;;;;;wBCtZhC,iBAAiB;;;wBA6BjB,iBAAiB;;UAWvB;EACR;EACA;;;KA+NU;;;;EAGN;EAAgB;;;;EAEhB;EAAkB;EAAc,MAAM;;;;EAEtC;EAAiB;;;;;EAGjB;;;;;;;;;;;;wBAYU,iBACd,gBACA,uBACC"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/shorthands.ts","../src/unitless.ts","../src/zero-lengths.ts","../src/css-tokens.ts","../src/registration-values.ts"],"mappings":";;;;qBAGa;;;qBCHA,qBAAmB;;;wBAgHhB,mBAAmB;;;;;;;;;;;;;;;;;;qBCjGtB;KA0LD,6BAA6B;;wBAKzB,qBAAqB;;;;;;;;;;KCtMzB;UA0BK;EACf,MAAM;EACN;EACA;;;EAGA;;EAEA;;;;wBAiFc,aACd,aACA;EACG;EAAc;;;wBAOH,kBAAkB;;wBAyFlB,SAAS,cAAc;;;KA0E3B;EAEN;;EAEA,MAAM;;EAEN,OAAO;EACP,UAAU;EACV;EACA;;EAEA;EAAe,OAAO;EAAU;EAAe;;;;;;;wBAgBrC,gBAAgB,iBAAiB,aAAa;;wBAoC9C,UACd,iBAAiB,kBACjB,OAAO,OAAO;;;;UAWC;EACf;EACA;EACA;EACA;IAAY;IAAe;IAAe;;;;qBAI/B,UAAO,OAAW;;;;;;wBAQf,cACd,iBAAiB,mBAChB;;;KAiCS;UAEK;EACf,UAAU;;EAEV;;;;;;;;wBASc,kBAAkB,cAAc;;;;;;;;;;;;wBCtZhC,iBAAiB;;;wBA6BjB,iBAAiB;;UAWvB;EACR;EACA;;;KA+NU;;;;EAGN;EAAgB;;;;EAEhB;EAAkB;EAAc,MAAM;;;;EAEtC;EAAiB;;;;;EAGjB;;;;;;;;;;;;wBAYU,iBACd,gBACA,uBACC"}
package/dist/index.js CHANGED
@@ -128,6 +128,213 @@ function isUnitlessProperty(property) {
128
128
  return UNITLESS_PROPERTY_SPELLINGS.has(property);
129
129
  }
130
130
  //#endregion
131
+ //#region src/zero-lengths.ts
132
+ /**
133
+ * The properties whose intended value is a length, as style keys: on a
134
+ * strict scale, zero (`0` or `'0'`) is admitted beside the scale's keys only
135
+ * on these, and elsewhere the scale wins. A property is listed when its
136
+ * syntax in mdn-data is built from lengths, length-percentages, line widths
137
+ * and percentages, with keywords and length functions: margins, paddings,
138
+ * gaps, insets, sizes, radii, border and outline widths, positions and
139
+ * offsets, among them SVG geometry and a stroke's width, whose numbers are
140
+ * user units. `fontSize` is listed too, and so are the vendor-prefixed
141
+ * spellings of listed properties. A property whose number is a multiplier or
142
+ * a count (`lineHeight`, `borderImageWidth`, `tabSize`), a shorthand that
143
+ * also takes colours or styles, and grid track sizing are not. The strict
144
+ * types read this table, as does the runtime resolver; the extractor reads
145
+ * it through `property_table.json`.
146
+ */
147
+ const ZERO_LENGTH_PROPERTIES = [
148
+ "MozBorderEndWidth",
149
+ "MozColumnRuleWidth",
150
+ "MozColumnWidth",
151
+ "MozMarginEnd",
152
+ "MozMarginStart",
153
+ "MozOutlineRadius",
154
+ "MozOutlineRadiusBottomleft",
155
+ "MozOutlineRadiusBottomright",
156
+ "MozOutlineRadiusTopleft",
157
+ "MozOutlineRadiusTopright",
158
+ "MozPaddingEnd",
159
+ "MozPaddingStart",
160
+ "MozPerspective",
161
+ "MozTransformOrigin",
162
+ "WebkitBorderBeforeWidth",
163
+ "WebkitBorderBottomLeftRadius",
164
+ "WebkitBorderBottomRightRadius",
165
+ "WebkitBorderRadius",
166
+ "WebkitBorderTopLeftRadius",
167
+ "WebkitBorderTopRightRadius",
168
+ "WebkitColumnRuleWidth",
169
+ "WebkitColumnWidth",
170
+ "WebkitFlexBasis",
171
+ "WebkitLogicalHeight",
172
+ "WebkitLogicalWidth",
173
+ "WebkitMarginEnd",
174
+ "WebkitMarginStart",
175
+ "WebkitMaskPosition",
176
+ "WebkitMaskPositionX",
177
+ "WebkitMaskPositionY",
178
+ "WebkitMaskSize",
179
+ "WebkitMaxInlineSize",
180
+ "WebkitPaddingEnd",
181
+ "WebkitPaddingStart",
182
+ "WebkitPerspective",
183
+ "WebkitShapeMargin",
184
+ "WebkitTextStrokeWidth",
185
+ "WebkitTransformOrigin",
186
+ "animationRangeEnd",
187
+ "animationRangeStart",
188
+ "backgroundPosition",
189
+ "backgroundPositionX",
190
+ "backgroundPositionY",
191
+ "backgroundSize",
192
+ "baselineShift",
193
+ "blockSize",
194
+ "borderBlockEndWidth",
195
+ "borderBlockStartWidth",
196
+ "borderBlockWidth",
197
+ "borderBottomLeftRadius",
198
+ "borderBottomRightRadius",
199
+ "borderBottomWidth",
200
+ "borderEndEndRadius",
201
+ "borderEndStartRadius",
202
+ "borderInlineEndWidth",
203
+ "borderInlineStartWidth",
204
+ "borderInlineWidth",
205
+ "borderLeftWidth",
206
+ "borderRadius",
207
+ "borderRightWidth",
208
+ "borderSpacing",
209
+ "borderStartEndRadius",
210
+ "borderStartStartRadius",
211
+ "borderTopLeftRadius",
212
+ "borderTopRightRadius",
213
+ "borderTopWidth",
214
+ "borderWidth",
215
+ "bottom",
216
+ "columnGap",
217
+ "columnRuleWidth",
218
+ "columnWidth",
219
+ "containIntrinsicBlockSize",
220
+ "containIntrinsicHeight",
221
+ "containIntrinsicInlineSize",
222
+ "containIntrinsicSize",
223
+ "containIntrinsicWidth",
224
+ "cx",
225
+ "cy",
226
+ "flexBasis",
227
+ "fontSize",
228
+ "gap",
229
+ "height",
230
+ "inlineSize",
231
+ "inset",
232
+ "insetBlock",
233
+ "insetBlockEnd",
234
+ "insetBlockStart",
235
+ "insetInline",
236
+ "insetInlineEnd",
237
+ "insetInlineStart",
238
+ "left",
239
+ "letterSpacing",
240
+ "lineHeightStep",
241
+ "margin",
242
+ "marginBlock",
243
+ "marginBlockEnd",
244
+ "marginBlockStart",
245
+ "marginBottom",
246
+ "marginInline",
247
+ "marginInlineEnd",
248
+ "marginInlineStart",
249
+ "marginLeft",
250
+ "marginRight",
251
+ "marginTop",
252
+ "maskPosition",
253
+ "maskSize",
254
+ "maxBlockSize",
255
+ "maxHeight",
256
+ "maxInlineSize",
257
+ "maxWidth",
258
+ "minBlockSize",
259
+ "minHeight",
260
+ "minInlineSize",
261
+ "minWidth",
262
+ "msHyphenateLimitZone",
263
+ "msScrollLimitXMax",
264
+ "msScrollLimitXMin",
265
+ "msScrollLimitYMax",
266
+ "msScrollLimitYMin",
267
+ "msTransformOrigin",
268
+ "msWrapMargin",
269
+ "objectPosition",
270
+ "offsetAnchor",
271
+ "offsetDistance",
272
+ "offsetPosition",
273
+ "outlineOffset",
274
+ "outlineWidth",
275
+ "overflowClipMargin",
276
+ "padding",
277
+ "paddingBlock",
278
+ "paddingBlockEnd",
279
+ "paddingBlockStart",
280
+ "paddingBottom",
281
+ "paddingInline",
282
+ "paddingInlineEnd",
283
+ "paddingInlineStart",
284
+ "paddingLeft",
285
+ "paddingRight",
286
+ "paddingTop",
287
+ "perspective",
288
+ "perspectiveOrigin",
289
+ "r",
290
+ "right",
291
+ "rowGap",
292
+ "rx",
293
+ "ry",
294
+ "scrollMargin",
295
+ "scrollMarginBlock",
296
+ "scrollMarginBlockEnd",
297
+ "scrollMarginBlockStart",
298
+ "scrollMarginBottom",
299
+ "scrollMarginInline",
300
+ "scrollMarginInlineEnd",
301
+ "scrollMarginInlineStart",
302
+ "scrollMarginLeft",
303
+ "scrollMarginRight",
304
+ "scrollMarginTop",
305
+ "scrollPadding",
306
+ "scrollPaddingBlock",
307
+ "scrollPaddingBlockEnd",
308
+ "scrollPaddingBlockStart",
309
+ "scrollPaddingBottom",
310
+ "scrollPaddingInline",
311
+ "scrollPaddingInlineEnd",
312
+ "scrollPaddingInlineStart",
313
+ "scrollPaddingLeft",
314
+ "scrollPaddingRight",
315
+ "scrollPaddingTop",
316
+ "shapeMargin",
317
+ "strokeDashoffset",
318
+ "strokeWidth",
319
+ "textDecorationThickness",
320
+ "textIndent",
321
+ "textUnderlineOffset",
322
+ "top",
323
+ "transformOrigin",
324
+ "translate",
325
+ "verticalAlign",
326
+ "viewTimelineInset",
327
+ "width",
328
+ "wordSpacing",
329
+ "x",
330
+ "y"
331
+ ];
332
+ const ZERO_LENGTHS = new Set(ZERO_LENGTH_PROPERTIES);
333
+ /** Whether a strict scale on `property` admits zero beside its keys. */
334
+ function isZeroLengthProperty(property) {
335
+ return ZERO_LENGTHS.has(property);
336
+ }
337
+ //#endregion
131
338
  //#region src/css-tokens.ts
132
339
  const at = (css, index) => index < css.length ? css.charCodeAt(index) : -1;
133
340
  const isNewline = (c) => c === 10 || c === 13 || c === 12;
@@ -760,4 +967,4 @@ function written(computed) {
760
967
  return `${Number(computed.value.toPrecision(12))}${CANONICAL_UNITS[computed.type]}`;
761
968
  }
762
969
  //#endregion
763
- export { SHORTHAND_PROPERTIES, UNITLESS_PROPERTIES, componentValues, decodedIdentifier, dependsOnContext, foldInitialValue, identifierAt, importantPriority, isSpace, isUnitlessProperty, someValue, substitutesValue, tokenize, variableReads };
970
+ export { SHORTHAND_PROPERTIES, UNITLESS_PROPERTIES, ZERO_LENGTH_PROPERTIES, componentValues, decodedIdentifier, dependsOnContext, foldInitialValue, identifierAt, importantPriority, isSpace, isUnitlessProperty, isZeroLengthProperty, someValue, substitutesValue, tokenize, variableReads };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/properties",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "CSS property classification data — unitless set, shorthand list, type re-exports",
5
5
  "keywords": [
6
6
  "animus",