css-calipers 0.15.0 → 1.1.0-beta.0
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/LICENSE.txt +1 -1
- package/README.md +70 -434
- package/dist/cjs/color/formats/display-p3/display-p3.js +25 -0
- package/dist/cjs/color/formats/escalate.js +41 -0
- package/dist/cjs/color/formats/hex/hex.js +28 -0
- package/dist/cjs/color/formats/hexAlpha/hexAlpha.js +25 -0
- package/dist/cjs/color/formats/hsl/hsl.js +23 -0
- package/dist/cjs/color/formats/hwb/hwb.js +24 -0
- package/dist/cjs/color/formats/index.js +36 -0
- package/dist/cjs/color/formats/internals.js +93 -0
- package/dist/cjs/color/formats/lab/lab.js +24 -0
- package/dist/cjs/color/formats/lch/lch.js +23 -0
- package/dist/cjs/color/formats/oklab/oklab.js +24 -0
- package/dist/cjs/color/formats/oklch/oklch.js +28 -0
- package/dist/cjs/color/formats/resolve.js +16 -0
- package/dist/cjs/color/formats/rgb/rgb.js +29 -0
- package/dist/cjs/color/formats/rgba/rgba.js +27 -0
- package/dist/cjs/color/formats/types.js +11 -0
- package/dist/cjs/color/index.js +619 -0
- package/dist/cjs/color/types.js +2 -0
- package/dist/cjs/core.js +11 -8
- package/dist/cjs/corpus.js +53 -0
- package/dist/cjs/css-values/cssValues.js +78 -0
- package/dist/cjs/css-values/index.js +36 -0
- package/dist/cjs/css-values/multi.js +290 -0
- package/dist/cjs/css-values/propertyMap.js +2 -0
- package/dist/cjs/css-values/spec.js +197 -0
- package/dist/cjs/default.js +17 -0
- package/dist/cjs/factory.js +1 -1
- package/dist/cjs/float.js +110 -0
- package/dist/cjs/index.js +29 -9
- package/dist/cjs/integer.js +114 -0
- package/dist/cjs/internal/createCoreApi.js +103 -38
- package/dist/cjs/internal/errors.js +13 -14
- package/dist/cjs/internal/toPlainDecimal.js +31 -0
- package/dist/cjs/measurements.js +41 -0
- package/dist/cjs/ratio.js +57 -22
- package/dist/cjs/scalar.js +9 -0
- package/dist/cjs/units/absolute.js +8 -8
- package/dist/cjs/units/angle.js +5 -5
- package/dist/cjs/units/container.js +7 -7
- package/dist/cjs/units/font-relative.js +13 -13
- package/dist/cjs/units/frequency.js +3 -3
- package/dist/cjs/units/grid.js +2 -2
- package/dist/cjs/units/index.js +9 -9
- package/dist/cjs/units/percent.js +4 -4
- package/dist/cjs/units/resolution.js +4 -4
- package/dist/cjs/units/time.js +3 -3
- package/dist/cjs/units/viewport-dynamic.js +7 -7
- package/dist/cjs/units/viewport-large.js +7 -7
- package/dist/cjs/units/viewport-small.js +7 -7
- package/dist/cjs/units/viewport.js +7 -7
- package/dist/esm/color/formats/display-p3/display-p3.d.ts +10 -0
- package/dist/esm/color/formats/display-p3/display-p3.d.ts.map +1 -0
- package/dist/esm/color/formats/display-p3/display-p3.js +22 -0
- package/dist/esm/color/formats/escalate.d.ts +10 -0
- package/dist/esm/color/formats/escalate.d.ts.map +1 -0
- package/dist/esm/color/formats/escalate.js +37 -0
- package/dist/esm/color/formats/hex/hex.d.ts +9 -0
- package/dist/esm/color/formats/hex/hex.d.ts.map +1 -0
- package/dist/esm/color/formats/hex/hex.js +25 -0
- package/dist/esm/color/formats/hexAlpha/hexAlpha.d.ts +9 -0
- package/dist/esm/color/formats/hexAlpha/hexAlpha.d.ts.map +1 -0
- package/dist/esm/color/formats/hexAlpha/hexAlpha.js +22 -0
- package/dist/esm/color/formats/hsl/hsl.d.ts +8 -0
- package/dist/esm/color/formats/hsl/hsl.d.ts.map +1 -0
- package/dist/esm/color/formats/hsl/hsl.js +20 -0
- package/dist/esm/color/formats/hwb/hwb.d.ts +9 -0
- package/dist/esm/color/formats/hwb/hwb.d.ts.map +1 -0
- package/dist/esm/color/formats/hwb/hwb.js +21 -0
- package/dist/esm/color/formats/index.d.ts +24 -0
- package/dist/esm/color/formats/index.d.ts.map +1 -0
- package/dist/esm/color/formats/index.js +32 -0
- package/dist/esm/color/formats/internals.d.ts +35 -0
- package/dist/esm/color/formats/internals.d.ts.map +1 -0
- package/dist/esm/color/formats/internals.js +78 -0
- package/dist/esm/color/formats/lab/lab.d.ts +9 -0
- package/dist/esm/color/formats/lab/lab.d.ts.map +1 -0
- package/dist/esm/color/formats/lab/lab.js +21 -0
- package/dist/esm/color/formats/lch/lch.d.ts +8 -0
- package/dist/esm/color/formats/lch/lch.d.ts.map +1 -0
- package/dist/esm/color/formats/lch/lch.js +20 -0
- package/dist/esm/color/formats/oklab/oklab.d.ts +9 -0
- package/dist/esm/color/formats/oklab/oklab.d.ts.map +1 -0
- package/dist/esm/color/formats/oklab/oklab.js +21 -0
- package/dist/esm/color/formats/oklch/oklch.d.ts +13 -0
- package/dist/esm/color/formats/oklch/oklch.d.ts.map +1 -0
- package/dist/esm/color/formats/oklch/oklch.js +25 -0
- package/dist/esm/color/formats/resolve.d.ts +15 -0
- package/dist/esm/color/formats/resolve.d.ts.map +1 -0
- package/dist/esm/color/formats/resolve.js +12 -0
- package/dist/esm/color/formats/rgb/rgb.d.ts +11 -0
- package/dist/esm/color/formats/rgb/rgb.d.ts.map +1 -0
- package/dist/esm/color/formats/rgb/rgb.js +26 -0
- package/dist/esm/color/formats/rgba/rgba.d.ts +9 -0
- package/dist/esm/color/formats/rgba/rgba.d.ts.map +1 -0
- package/dist/esm/color/formats/rgba/rgba.js +24 -0
- package/dist/esm/color/formats/types.d.ts +48 -0
- package/dist/esm/color/formats/types.d.ts.map +1 -0
- package/dist/esm/color/formats/types.js +7 -0
- package/dist/esm/color/index.d.ts +81 -0
- package/dist/esm/color/index.d.ts.map +1 -0
- package/dist/esm/color/index.js +609 -0
- package/dist/esm/color/types.d.ts +294 -0
- package/dist/esm/color/types.d.ts.map +1 -0
- package/dist/esm/color/types.js +1 -0
- package/dist/esm/core.d.ts +76 -270
- package/dist/esm/core.d.ts.map +1 -1
- package/dist/esm/core.js +5 -7
- package/dist/esm/corpus.d.ts +26 -0
- package/dist/esm/corpus.d.ts.map +1 -0
- package/dist/esm/corpus.js +37 -0
- package/dist/esm/css-values/cssValues.d.ts +60 -0
- package/dist/esm/css-values/cssValues.d.ts.map +1 -0
- package/dist/esm/css-values/cssValues.js +74 -0
- package/dist/esm/css-values/index.d.ts +6 -0
- package/dist/esm/css-values/index.d.ts.map +1 -0
- package/dist/esm/css-values/index.js +12 -0
- package/dist/esm/css-values/multi.d.ts +188 -0
- package/dist/esm/css-values/multi.d.ts.map +1 -0
- package/dist/esm/css-values/multi.js +281 -0
- package/dist/esm/css-values/propertyMap.d.ts +39 -0
- package/dist/esm/css-values/propertyMap.d.ts.map +1 -0
- package/dist/esm/css-values/propertyMap.js +1 -0
- package/dist/esm/css-values/spec.d.ts +36 -0
- package/dist/esm/css-values/spec.d.ts.map +1 -0
- package/dist/esm/css-values/spec.js +194 -0
- package/dist/esm/default.d.ts +267 -0
- package/dist/esm/default.d.ts.map +1 -0
- package/dist/esm/default.js +14 -0
- package/dist/esm/factory.d.ts +1 -1
- package/dist/esm/factory.d.ts.map +1 -1
- package/dist/esm/factory.js +3 -3
- package/dist/esm/float.d.ts +35 -0
- package/dist/esm/float.d.ts.map +1 -0
- package/dist/esm/float.js +104 -0
- package/dist/esm/index.d.ts +11 -9
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +19 -9
- package/dist/esm/integer.d.ts +36 -0
- package/dist/esm/integer.d.ts.map +1 -0
- package/dist/esm/integer.js +108 -0
- package/dist/esm/internal/buildMeasurementCreationError.tests.d.ts +1 -1
- package/dist/esm/internal/buildMeasurementCreationError.tests.d.ts.map +1 -1
- package/dist/esm/internal/createCoreApi.d.ts +9 -1
- package/dist/esm/internal/createCoreApi.d.ts.map +1 -1
- package/dist/esm/internal/createCoreApi.js +103 -38
- package/dist/esm/internal/createUnitsApi.d.ts +1 -1
- package/dist/esm/internal/createUnitsApi.d.ts.map +1 -1
- package/dist/esm/internal/errors.d.ts +3 -3
- package/dist/esm/internal/errors.d.ts.map +1 -1
- package/dist/esm/internal/errors.js +13 -14
- package/dist/esm/internal/toPlainDecimal.d.ts +2 -0
- package/dist/esm/internal/toPlainDecimal.d.ts.map +1 -0
- package/dist/esm/internal/toPlainDecimal.js +27 -0
- package/dist/esm/measurements.d.ts +16 -0
- package/dist/esm/measurements.d.ts.map +1 -0
- package/dist/esm/measurements.js +25 -0
- package/dist/esm/ratio.d.ts +14 -5
- package/dist/esm/ratio.d.ts.map +1 -1
- package/dist/esm/ratio.js +57 -22
- package/dist/esm/scalar.d.ts +14 -0
- package/dist/esm/scalar.d.ts.map +1 -0
- package/dist/esm/scalar.js +5 -0
- package/dist/esm/units/absolute.d.ts +1 -1
- package/dist/esm/units/absolute.d.ts.map +1 -1
- package/dist/esm/units/absolute.js +1 -1
- package/dist/esm/units/angle.d.ts +1 -1
- package/dist/esm/units/angle.d.ts.map +1 -1
- package/dist/esm/units/angle.js +1 -1
- package/dist/esm/units/container.d.ts +1 -1
- package/dist/esm/units/container.d.ts.map +1 -1
- package/dist/esm/units/container.js +1 -1
- package/dist/esm/units/font-relative.d.ts +1 -1
- package/dist/esm/units/font-relative.d.ts.map +1 -1
- package/dist/esm/units/font-relative.js +1 -1
- package/dist/esm/units/frequency.d.ts +1 -1
- package/dist/esm/units/frequency.d.ts.map +1 -1
- package/dist/esm/units/frequency.js +1 -1
- package/dist/esm/units/grid.d.ts +1 -1
- package/dist/esm/units/grid.d.ts.map +1 -1
- package/dist/esm/units/grid.js +1 -1
- package/dist/esm/units/index.d.ts +9 -9
- package/dist/esm/units/index.d.ts.map +1 -1
- package/dist/esm/units/index.js +9 -9
- package/dist/esm/units/percent.d.ts +1 -1
- package/dist/esm/units/percent.d.ts.map +1 -1
- package/dist/esm/units/percent.js +1 -1
- package/dist/esm/units/resolution.d.ts +1 -1
- package/dist/esm/units/resolution.d.ts.map +1 -1
- package/dist/esm/units/resolution.js +1 -1
- package/dist/esm/units/time.d.ts +1 -1
- package/dist/esm/units/time.d.ts.map +1 -1
- package/dist/esm/units/time.js +1 -1
- package/dist/esm/units/viewport-dynamic.d.ts +1 -1
- package/dist/esm/units/viewport-dynamic.d.ts.map +1 -1
- package/dist/esm/units/viewport-dynamic.js +1 -1
- package/dist/esm/units/viewport-large.d.ts +1 -1
- package/dist/esm/units/viewport-large.d.ts.map +1 -1
- package/dist/esm/units/viewport-large.js +1 -1
- package/dist/esm/units/viewport-small.d.ts +1 -1
- package/dist/esm/units/viewport-small.d.ts.map +1 -1
- package/dist/esm/units/viewport-small.js +1 -1
- package/dist/esm/units/viewport.d.ts +1 -1
- package/dist/esm/units/viewport.d.ts.map +1 -1
- package/dist/esm/units/viewport.js +1 -1
- package/package.json +55 -13
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.createCalipersBundle = exports.createCalipers = void 0;
|
|
18
|
+
// CORPUS: the css-calipers LAZY-DEFAULTS convenience entry, plus the master factory.
|
|
19
|
+
//
|
|
20
|
+
// - DEFAULT export: `createCalipersBundle`, the calipers MASTER factory. It mirrors the
|
|
21
|
+
// compendium's `publishCompendium`: one keyed config (a slot per sub-factory) that binds
|
|
22
|
+
// the whole calipers surface in one object. A bare `createCalipersBundle()` binds it all
|
|
23
|
+
// at defaults.
|
|
24
|
+
// - NAMED exports: the full default set (`m` / `r` / `i` / `f` / `color`, each a
|
|
25
|
+
// factory-at-defaults instance) plus the sub-factories (`createCalipers` / `createColor`),
|
|
26
|
+
// so a consumer who just wants the defaults never has to bind anything.
|
|
27
|
+
//
|
|
28
|
+
// This is the convenience layer ON TOP of the factory, never a replacement: configuration
|
|
29
|
+
// still goes through a factory. (Per-property value helpers are the books layer now, not
|
|
30
|
+
// calipers.) Unlike `./measurements`, this entry is NOT colour-free: it pulls in the colour
|
|
31
|
+
// value primitive (and `culori`) by design.
|
|
32
|
+
const color_1 = require("./color");
|
|
33
|
+
const factory_1 = require("./factory");
|
|
34
|
+
Object.defineProperty(exports, "createCalipers", { enumerable: true, get: function () { return factory_1.createCalipers; } });
|
|
35
|
+
__exportStar(require("./index"), exports);
|
|
36
|
+
/**
|
|
37
|
+
* The calipers MASTER factory: combine the two sub-factories (`createCalipers` for the
|
|
38
|
+
* measurement / scalar surface, `createColor` for the colour value) under one keyed config,
|
|
39
|
+
* returning every helper bound in one object. Mirrors `publishCompendium`. A bare
|
|
40
|
+
* `createCalipersBundle()` binds everything at defaults; this file DEFAULT-exports it, and
|
|
41
|
+
* the named re-exports above are the same helpers already bound at defaults.
|
|
42
|
+
*/
|
|
43
|
+
const createCalipersBundle = (config = {}) => {
|
|
44
|
+
var _a;
|
|
45
|
+
return ({
|
|
46
|
+
...(0, factory_1.createCalipers)(config.measurements),
|
|
47
|
+
// when no colour config is given, P is the default `readonly []` (no custom formats),
|
|
48
|
+
// so an empty formats list is the right default; the double cast satisfies the generic.
|
|
49
|
+
color: (0, color_1.createColor)((_a = config.color) !== null && _a !== void 0 ? _a : { formats: [] }),
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
exports.createCalipersBundle = createCalipersBundle;
|
|
53
|
+
exports.default = exports.createCalipersBundle;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCssValues = void 0;
|
|
4
|
+
const float_1 = require("../float");
|
|
5
|
+
const integer_1 = require("../integer");
|
|
6
|
+
const spec_1 = require("./spec");
|
|
7
|
+
const clampNumber = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
8
|
+
/**
|
|
9
|
+
* Build the value object for a number input, constraining it with the row's
|
|
10
|
+
* primitive (`i()` for `int`, `f()` for `float`). Under `'clamp'`, the number is
|
|
11
|
+
* first clamped into `[min, max]` (only when both bounds exist); otherwise the
|
|
12
|
+
* primitive throws on an out-of-range or non-integer value.
|
|
13
|
+
*/
|
|
14
|
+
const buildNumber = (row, value, policy) => {
|
|
15
|
+
let next = value;
|
|
16
|
+
if (policy === 'clamp' &&
|
|
17
|
+
row.min !== undefined &&
|
|
18
|
+
row.max !== undefined) {
|
|
19
|
+
next = clampNumber(value, row.min, row.max);
|
|
20
|
+
}
|
|
21
|
+
const bounds = { min: row.min, max: row.max, context: row.name };
|
|
22
|
+
const scalar = row.kind === 'int' ? (0, integer_1.i)(next, bounds) : (0, float_1.f)(next, bounds);
|
|
23
|
+
// Every `PropertyValueMap[CssProperty]` value type widens to include
|
|
24
|
+
// `(string & {})`, so the scalar's `string` render is directly assignable; no
|
|
25
|
+
// cast is needed (and one would be flagged as redundant).
|
|
26
|
+
return {
|
|
27
|
+
css: () => scalar.css(),
|
|
28
|
+
toString: () => scalar.css(),
|
|
29
|
+
value: () => scalar.value(),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/** Build the value object for a keyword input (passed through untouched). */
|
|
33
|
+
const buildKeyword = (keyword) => ({
|
|
34
|
+
css: () => keyword,
|
|
35
|
+
toString: () => keyword,
|
|
36
|
+
value: () => keyword,
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Generate a single property helper from a spec row. Number inputs are
|
|
40
|
+
* constrained via the row's scalar primitive; keyword inputs (members of the
|
|
41
|
+
* row's `keywords`) pass through.
|
|
42
|
+
*/
|
|
43
|
+
const makeHelper = (spec, defaultPolicy) => {
|
|
44
|
+
const keywords = new Set(spec.keywords);
|
|
45
|
+
return (value, opts) => {
|
|
46
|
+
var _a;
|
|
47
|
+
if (typeof value === 'string') {
|
|
48
|
+
if (!keywords.has(value)) {
|
|
49
|
+
throw new Error(`${spec.name}: '${value}' is not a valid keyword` +
|
|
50
|
+
` (expected one of: ${spec.keywords.join(', ') || 'none'})`);
|
|
51
|
+
}
|
|
52
|
+
return buildKeyword(value);
|
|
53
|
+
}
|
|
54
|
+
const policy = (_a = opts === null || opts === void 0 ? void 0 : opts.outOfRange) !== null && _a !== void 0 ? _a : defaultPolicy;
|
|
55
|
+
return buildNumber(spec, value, policy);
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Create a set of per-property CSS-value helpers, layered on the scalar
|
|
60
|
+
* primitives `i()` / `f()`. Each helper constrains its number against the
|
|
61
|
+
* property's bound and accepts that property's keyword companions, returning a
|
|
62
|
+
* `.css()`-renderable {@link CssValue} typed against csstype.
|
|
63
|
+
*
|
|
64
|
+
* `config.outOfRange` is the instance-wide default for out-of-range numbers
|
|
65
|
+
* (`'throw'`, the default, or `'clamp'`); a per-call `opts.outOfRange` overrides
|
|
66
|
+
* it. The package's bare `opacity` / `zIndex` / ... exports are this factory at
|
|
67
|
+
* its defaults.
|
|
68
|
+
*/
|
|
69
|
+
const createCssValues = (config = {}) => {
|
|
70
|
+
var _a;
|
|
71
|
+
const defaultPolicy = (_a = config.outOfRange) !== null && _a !== void 0 ? _a : 'throw';
|
|
72
|
+
const helpers = {};
|
|
73
|
+
for (const spec of spec_1.CSS_VALUE_SPEC) {
|
|
74
|
+
helpers[spec.name] = makeHelper(spec, defaultPolicy);
|
|
75
|
+
}
|
|
76
|
+
return helpers;
|
|
77
|
+
};
|
|
78
|
+
exports.createCssValues = createCssValues;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.zoom = exports.zIndex = exports.widows = exports.strokeOpacity = exports.strokeMiterlimit = exports.stopOpacity = exports.shapeImageThreshold = exports.orphans = exports.order = exports.opacity = exports.mathDepth = exports.lineHeight = exports.lineClamp = exports.fontWeight = exports.fontSizeAdjust = exports.floodOpacity = exports.flexShrink = exports.flexGrow = exports.fillOpacity = exports.columnCount = exports.animationIterationCount = exports.CSS_VALUE_SPEC = exports.tabSize = exports.strokeWidth = exports.strokeDashoffset = exports.strokeDasharray = exports.span = exports.scale = exports.maskBorderWidth = exports.maskBorderSlice = exports.maskBorderOutset = exports.gridRowStart = exports.gridRowEnd = exports.gridColumnStart = exports.gridColumnEnd = exports.counterSet = exports.counterReset = exports.counterIncrement = exports.borderImageWidth = exports.borderImageSlice = exports.borderImageOutset = exports.createCssValues = void 0;
|
|
4
|
+
// The per-property CSS-VALUE HELPER LAYER: typed helpers for single-value CSS
|
|
5
|
+
// properties (`opacity`, `zIndex`, ...), each a constrained scalar (built on the
|
|
6
|
+
// `i()` / `f()` primitives) plus that property's keyword companions, with
|
|
7
|
+
// `.css()` typed against csstype's `Property`. The bare helper exports are
|
|
8
|
+
// `createCssValues()` at its defaults (`outOfRange: 'throw'`).
|
|
9
|
+
const cssValues_1 = require("./cssValues");
|
|
10
|
+
var cssValues_2 = require("./cssValues");
|
|
11
|
+
Object.defineProperty(exports, "createCssValues", { enumerable: true, get: function () { return cssValues_2.createCssValues; } });
|
|
12
|
+
var multi_1 = require("./multi");
|
|
13
|
+
Object.defineProperty(exports, "borderImageOutset", { enumerable: true, get: function () { return multi_1.borderImageOutset; } });
|
|
14
|
+
Object.defineProperty(exports, "borderImageSlice", { enumerable: true, get: function () { return multi_1.borderImageSlice; } });
|
|
15
|
+
Object.defineProperty(exports, "borderImageWidth", { enumerable: true, get: function () { return multi_1.borderImageWidth; } });
|
|
16
|
+
Object.defineProperty(exports, "counterIncrement", { enumerable: true, get: function () { return multi_1.counterIncrement; } });
|
|
17
|
+
Object.defineProperty(exports, "counterReset", { enumerable: true, get: function () { return multi_1.counterReset; } });
|
|
18
|
+
Object.defineProperty(exports, "counterSet", { enumerable: true, get: function () { return multi_1.counterSet; } });
|
|
19
|
+
Object.defineProperty(exports, "gridColumnEnd", { enumerable: true, get: function () { return multi_1.gridColumnEnd; } });
|
|
20
|
+
Object.defineProperty(exports, "gridColumnStart", { enumerable: true, get: function () { return multi_1.gridColumnStart; } });
|
|
21
|
+
Object.defineProperty(exports, "gridRowEnd", { enumerable: true, get: function () { return multi_1.gridRowEnd; } });
|
|
22
|
+
Object.defineProperty(exports, "gridRowStart", { enumerable: true, get: function () { return multi_1.gridRowStart; } });
|
|
23
|
+
Object.defineProperty(exports, "maskBorderOutset", { enumerable: true, get: function () { return multi_1.maskBorderOutset; } });
|
|
24
|
+
Object.defineProperty(exports, "maskBorderSlice", { enumerable: true, get: function () { return multi_1.maskBorderSlice; } });
|
|
25
|
+
Object.defineProperty(exports, "maskBorderWidth", { enumerable: true, get: function () { return multi_1.maskBorderWidth; } });
|
|
26
|
+
Object.defineProperty(exports, "scale", { enumerable: true, get: function () { return multi_1.scale; } });
|
|
27
|
+
Object.defineProperty(exports, "span", { enumerable: true, get: function () { return multi_1.span; } });
|
|
28
|
+
Object.defineProperty(exports, "strokeDasharray", { enumerable: true, get: function () { return multi_1.strokeDasharray; } });
|
|
29
|
+
Object.defineProperty(exports, "strokeDashoffset", { enumerable: true, get: function () { return multi_1.strokeDashoffset; } });
|
|
30
|
+
Object.defineProperty(exports, "strokeWidth", { enumerable: true, get: function () { return multi_1.strokeWidth; } });
|
|
31
|
+
Object.defineProperty(exports, "tabSize", { enumerable: true, get: function () { return multi_1.tabSize; } });
|
|
32
|
+
var spec_1 = require("./spec");
|
|
33
|
+
Object.defineProperty(exports, "CSS_VALUE_SPEC", { enumerable: true, get: function () { return spec_1.CSS_VALUE_SPEC; } });
|
|
34
|
+
/** The default instance: the bare helpers below are bound to it. */
|
|
35
|
+
const defaults = (0, cssValues_1.createCssValues)();
|
|
36
|
+
exports.animationIterationCount = defaults.animationIterationCount, exports.columnCount = defaults.columnCount, exports.fillOpacity = defaults.fillOpacity, exports.flexGrow = defaults.flexGrow, exports.flexShrink = defaults.flexShrink, exports.floodOpacity = defaults.floodOpacity, exports.fontSizeAdjust = defaults.fontSizeAdjust, exports.fontWeight = defaults.fontWeight, exports.lineClamp = defaults.lineClamp, exports.lineHeight = defaults.lineHeight, exports.mathDepth = defaults.mathDepth, exports.opacity = defaults.opacity, exports.order = defaults.order, exports.orphans = defaults.orphans, exports.shapeImageThreshold = defaults.shapeImageThreshold, exports.stopOpacity = defaults.stopOpacity, exports.strokeMiterlimit = defaults.strokeMiterlimit, exports.strokeOpacity = defaults.strokeOpacity, exports.widows = defaults.widows, exports.zIndex = defaults.zIndex, exports.zoom = defaults.zoom;
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.strokeDashoffset = exports.strokeWidth = exports.maskBorderSlice = exports.borderImageSlice = exports.maskBorderOutset = exports.maskBorderWidth = exports.borderImageOutset = exports.borderImageWidth = exports.tabSize = exports.gridColumnEnd = exports.gridColumnStart = exports.gridRowEnd = exports.gridRowStart = exports.span = exports.counterSet = exports.counterIncrement = exports.counterReset = void 0;
|
|
4
|
+
exports.scale = scale;
|
|
5
|
+
exports.strokeDasharray = strokeDasharray;
|
|
6
|
+
const default_1 = require("../default");
|
|
7
|
+
const float_1 = require("../float");
|
|
8
|
+
const integer_1 = require("../integer");
|
|
9
|
+
/**
|
|
10
|
+
* Wrap a finished render string as a typed value object. Every
|
|
11
|
+
* `MultiPropertyValueMap[CssProperty]` widens to include `(string & {})`, so the
|
|
12
|
+
* rendered `string` is directly assignable; no cast is needed.
|
|
13
|
+
*/
|
|
14
|
+
const wrap = (rendered) => ({
|
|
15
|
+
css: () => rendered,
|
|
16
|
+
toString: () => rendered,
|
|
17
|
+
value: () => rendered,
|
|
18
|
+
});
|
|
19
|
+
const CUSTOM_IDENT = /^-?[_a-zA-Z][\w-]*$/;
|
|
20
|
+
const assertCustomIdent = (name, helper) => {
|
|
21
|
+
if (!CUSTOM_IDENT.test(name)) {
|
|
22
|
+
throw new Error(`${helper}: '${name}' is not a valid <custom-ident> ` +
|
|
23
|
+
`(letters, digits, '-', '_'; must not start with a digit)`);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Build a counter helper. Accepts the keyword `'none'`, or one or more
|
|
28
|
+
* `<custom-ident> <integer>?` entries. A bare ident uses `defaultValue`; a
|
|
29
|
+
* `[ident, n]` tuple hardens `n` through `i()` (any integer, negatives allowed).
|
|
30
|
+
*/
|
|
31
|
+
const makeCounterHelper = (helper, defaultValue) => (
|
|
32
|
+
// `'none'` is accepted as the standalone keyword; at the type level it is a
|
|
33
|
+
// `string`, indistinct from a `<custom-ident>`, so the union is just
|
|
34
|
+
// `CounterEntry`. The keyword is recognized (and guarded against being
|
|
35
|
+
// combined with entries) at runtime below.
|
|
36
|
+
first, ...rest) => {
|
|
37
|
+
if (first === 'none') {
|
|
38
|
+
if (rest.length > 0) {
|
|
39
|
+
throw new Error(`${helper}: 'none' cannot be combined with counter entries`);
|
|
40
|
+
}
|
|
41
|
+
return wrap('none');
|
|
42
|
+
}
|
|
43
|
+
const entries = [
|
|
44
|
+
first,
|
|
45
|
+
...rest,
|
|
46
|
+
];
|
|
47
|
+
const parts = entries.map((entry) => {
|
|
48
|
+
const [name, value,] = typeof entry === 'string'
|
|
49
|
+
? [
|
|
50
|
+
entry,
|
|
51
|
+
defaultValue,
|
|
52
|
+
]
|
|
53
|
+
: entry;
|
|
54
|
+
assertCustomIdent(name, helper);
|
|
55
|
+
const n = (0, integer_1.i)(value, { context: helper }).css();
|
|
56
|
+
return `${name} ${n}`;
|
|
57
|
+
});
|
|
58
|
+
return wrap(parts.join(' '));
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* `counter-reset`: `<custom-ident> <integer>?` pairs (omitted integer defaults
|
|
62
|
+
* to `0`) or `none`. `.css()` is `Property.CounterReset`.
|
|
63
|
+
*/
|
|
64
|
+
exports.counterReset = makeCounterHelper('counterReset', 0);
|
|
65
|
+
/**
|
|
66
|
+
* `counter-increment`: `<custom-ident> <integer>?` pairs (omitted integer
|
|
67
|
+
* defaults to `1`) or `none`. `.css()` is `Property.CounterIncrement`.
|
|
68
|
+
*/
|
|
69
|
+
exports.counterIncrement = makeCounterHelper('counterIncrement', 1);
|
|
70
|
+
/**
|
|
71
|
+
* `counter-set`: `<custom-ident> <integer>?` pairs (omitted integer defaults to
|
|
72
|
+
* `0`) or `none`. `.css()` is `Property.CounterSet`.
|
|
73
|
+
*/
|
|
74
|
+
exports.counterSet = makeCounterHelper('counterSet', 0);
|
|
75
|
+
/**
|
|
76
|
+
* Build a `span N` (optionally `span N name`) grid-line value. `count` is
|
|
77
|
+
* hardened to an integer `>= 1`. Pass the result to a grid-line helper:
|
|
78
|
+
* `gridColumnEnd(span(2))`.
|
|
79
|
+
*/
|
|
80
|
+
const span = (count, name) => ({
|
|
81
|
+
span: count,
|
|
82
|
+
name,
|
|
83
|
+
});
|
|
84
|
+
exports.span = span;
|
|
85
|
+
const makeGridLineHelper = (helper) => (line) => {
|
|
86
|
+
if (typeof line === 'number') {
|
|
87
|
+
if (line === 0) {
|
|
88
|
+
throw new Error(`${helper}: a grid line number must be nonzero (got 0)`);
|
|
89
|
+
}
|
|
90
|
+
return wrap((0, integer_1.i)(line, { context: helper }).css());
|
|
91
|
+
}
|
|
92
|
+
if (typeof line === 'string') {
|
|
93
|
+
if (line === 'span') {
|
|
94
|
+
throw new Error(`${helper}: use span(n) to build a 'span' value`);
|
|
95
|
+
}
|
|
96
|
+
if (line !== 'auto') {
|
|
97
|
+
assertCustomIdent(line, helper);
|
|
98
|
+
}
|
|
99
|
+
return wrap(line);
|
|
100
|
+
}
|
|
101
|
+
// SpanInput
|
|
102
|
+
const count = (0, integer_1.i)(line.span, {
|
|
103
|
+
min: 1,
|
|
104
|
+
context: `${helper} span`,
|
|
105
|
+
}).css();
|
|
106
|
+
if (line.name !== undefined) {
|
|
107
|
+
assertCustomIdent(line.name, helper);
|
|
108
|
+
return wrap(`span ${count} ${line.name}`);
|
|
109
|
+
}
|
|
110
|
+
return wrap(`span ${count}`);
|
|
111
|
+
};
|
|
112
|
+
/** `grid-row-start`. `.css()` is `Property.GridRowStart`. */
|
|
113
|
+
exports.gridRowStart = makeGridLineHelper('gridRowStart');
|
|
114
|
+
/** `grid-row-end`. `.css()` is `Property.GridRowEnd`. */
|
|
115
|
+
exports.gridRowEnd = makeGridLineHelper('gridRowEnd');
|
|
116
|
+
/** `grid-column-start`. `.css()` is `Property.GridColumnStart`. */
|
|
117
|
+
exports.gridColumnStart = makeGridLineHelper('gridColumnStart');
|
|
118
|
+
/** `grid-column-end`. `.css()` is `Property.GridColumnEnd`. */
|
|
119
|
+
exports.gridColumnEnd = makeGridLineHelper('gridColumnEnd');
|
|
120
|
+
function scale(first, y, z) {
|
|
121
|
+
if (first === 'none') {
|
|
122
|
+
return wrap('none');
|
|
123
|
+
}
|
|
124
|
+
const factors = [
|
|
125
|
+
first,
|
|
126
|
+
y,
|
|
127
|
+
z,
|
|
128
|
+
].filter((n) => n !== undefined);
|
|
129
|
+
const rendered = factors
|
|
130
|
+
.map((n) => (0, float_1.f)(n, { context: 'scale' }).css())
|
|
131
|
+
.join(' ');
|
|
132
|
+
return wrap(rendered);
|
|
133
|
+
}
|
|
134
|
+
// --- tab-size -------------------------------------------------------------
|
|
135
|
+
/**
|
|
136
|
+
* `tab-size`: a `<number>` `>= 0` (NOT restricted to an integer; `2.5` is
|
|
137
|
+
* valid) hardened through `f()`, or a length supplied as an `IMeasurement`. The
|
|
138
|
+
* percentage form is out of scope. `.css()` is `Property.TabSize`.
|
|
139
|
+
*/
|
|
140
|
+
const tabSize = (value) => {
|
|
141
|
+
if (typeof value === 'number') {
|
|
142
|
+
return wrap((0, float_1.f)(value, { min: 0, context: 'tabSize' }).css());
|
|
143
|
+
}
|
|
144
|
+
return wrap(value.css());
|
|
145
|
+
};
|
|
146
|
+
exports.tabSize = tabSize;
|
|
147
|
+
/**
|
|
148
|
+
* Render one number-or-length entry. A number is hardened through `f()` with the
|
|
149
|
+
* given bounds (so out-of-range / non-finite inputs throw); an `IMeasurement`
|
|
150
|
+
* renders through its `.css()`. Anything else throws with the helper name.
|
|
151
|
+
*/
|
|
152
|
+
const renderNumberOrLength = (entry, helper, min) => {
|
|
153
|
+
if (typeof entry === 'number') {
|
|
154
|
+
return (0, float_1.f)(entry, { min, context: helper }).css();
|
|
155
|
+
}
|
|
156
|
+
if ((0, default_1.isMeasurement)(entry)) {
|
|
157
|
+
return entry.css();
|
|
158
|
+
}
|
|
159
|
+
throw new Error(`${helper}: expected a <number> or an IMeasurement (got ${typeof entry})`);
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Build a 1-to-4-value helper whose entries are each a `<number>` (hardened
|
|
163
|
+
* with `min`) or an `IMeasurement`, with an optional per-entry keyword
|
|
164
|
+
* (`'auto'` for the *-width properties). Mirrors the box-edge `{1,4}` shape
|
|
165
|
+
* (`border-image-width`, `border-image-outset`, ...): supply one to four
|
|
166
|
+
* entries, rendered space-separated in order.
|
|
167
|
+
*/
|
|
168
|
+
const makeEdgeQuadHelper = (helper, min, keywords) => (first, ...rest) => {
|
|
169
|
+
const entries = [
|
|
170
|
+
first,
|
|
171
|
+
...rest,
|
|
172
|
+
];
|
|
173
|
+
if (entries.length > 4) {
|
|
174
|
+
throw new Error(`${helper}: expected 1 to 4 entries (got ${entries.length})`);
|
|
175
|
+
}
|
|
176
|
+
const keywordSet = new Set(keywords);
|
|
177
|
+
const parts = entries.map((entry) => {
|
|
178
|
+
if (typeof entry === 'string') {
|
|
179
|
+
if (!keywordSet.has(entry)) {
|
|
180
|
+
throw new Error(`${helper}: '${entry}' is not a valid keyword` +
|
|
181
|
+
` (expected one of: ${keywords.join(', ') || 'none'})`);
|
|
182
|
+
}
|
|
183
|
+
return entry;
|
|
184
|
+
}
|
|
185
|
+
return renderNumberOrLength(entry, helper, min);
|
|
186
|
+
});
|
|
187
|
+
return wrap(parts.join(' '));
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* `border-image-width`: one to four entries, each a non-negative `<number>`
|
|
191
|
+
* multiplier (hardened through `f({ min: 0 })`), an `IMeasurement` length, or
|
|
192
|
+
* the keyword `'auto'`. `.css()` is `Property.BorderImageWidth`.
|
|
193
|
+
*/
|
|
194
|
+
exports.borderImageWidth = makeEdgeQuadHelper('borderImageWidth', 0, [
|
|
195
|
+
'auto',
|
|
196
|
+
]);
|
|
197
|
+
/**
|
|
198
|
+
* `border-image-outset`: one to four entries, each a non-negative `<number>`
|
|
199
|
+
* (hardened through `f({ min: 0 })`) or an `IMeasurement` length. `.css()` is
|
|
200
|
+
* `Property.BorderImageOutset`.
|
|
201
|
+
*/
|
|
202
|
+
exports.borderImageOutset = makeEdgeQuadHelper('borderImageOutset', 0, []);
|
|
203
|
+
/**
|
|
204
|
+
* `mask-border-width`: like {@link borderImageWidth} (non-negative `<number>`,
|
|
205
|
+
* `IMeasurement`, or `'auto'`; one to four entries). `.css()` is
|
|
206
|
+
* `Property.MaskBorderWidth`.
|
|
207
|
+
*/
|
|
208
|
+
exports.maskBorderWidth = makeEdgeQuadHelper('maskBorderWidth', 0, [
|
|
209
|
+
'auto',
|
|
210
|
+
]);
|
|
211
|
+
/**
|
|
212
|
+
* `mask-border-outset`: like {@link borderImageOutset} (non-negative
|
|
213
|
+
* `<number>` or `IMeasurement`; one to four entries). `.css()` is
|
|
214
|
+
* `Property.MaskBorderOutset`.
|
|
215
|
+
*/
|
|
216
|
+
exports.maskBorderOutset = makeEdgeQuadHelper('maskBorderOutset', 0, []);
|
|
217
|
+
/**
|
|
218
|
+
* Build a `border-image-slice` / `mask-border-slice` helper: one to four
|
|
219
|
+
* non-negative `<number>` entries (hardened through `f({ min: 0 })`; the
|
|
220
|
+
* percentage form is out of scope), with an optional trailing `'fill'`
|
|
221
|
+
* keyword. The slice properties accept numbers (and percentages), not lengths,
|
|
222
|
+
* so an `IMeasurement` is rejected.
|
|
223
|
+
*/
|
|
224
|
+
const makeSliceHelper = (helper) => (first, ...rest) => {
|
|
225
|
+
const all = [
|
|
226
|
+
first,
|
|
227
|
+
...rest,
|
|
228
|
+
];
|
|
229
|
+
let fill = false;
|
|
230
|
+
if (all[all.length - 1] === 'fill') {
|
|
231
|
+
fill = true;
|
|
232
|
+
all.pop();
|
|
233
|
+
}
|
|
234
|
+
if (all.some((entry) => entry === 'fill')) {
|
|
235
|
+
throw new Error(`${helper}: 'fill' may only appear as the trailing keyword`);
|
|
236
|
+
}
|
|
237
|
+
if (all.length < 1 || all.length > 4) {
|
|
238
|
+
throw new Error(`${helper}: expected 1 to 4 numbers (got ${all.length})`);
|
|
239
|
+
}
|
|
240
|
+
const parts = all.map((entry) => {
|
|
241
|
+
if (typeof entry !== 'number') {
|
|
242
|
+
throw new Error(`${helper}: expected a <number> (got ${typeof entry})`);
|
|
243
|
+
}
|
|
244
|
+
return (0, float_1.f)(entry, { min: 0, context: helper }).css();
|
|
245
|
+
});
|
|
246
|
+
if (fill) {
|
|
247
|
+
parts.push('fill');
|
|
248
|
+
}
|
|
249
|
+
return wrap(parts.join(' '));
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* `border-image-slice`: one to four non-negative `<number>` entries, with an
|
|
253
|
+
* optional trailing `'fill'` keyword. The percentage form is out of scope.
|
|
254
|
+
* `.css()` is `Property.BorderImageSlice`.
|
|
255
|
+
*/
|
|
256
|
+
exports.borderImageSlice = makeSliceHelper('borderImageSlice');
|
|
257
|
+
/**
|
|
258
|
+
* `mask-border-slice`: like {@link borderImageSlice} (one to four non-negative
|
|
259
|
+
* `<number>` entries plus an optional trailing `'fill'`). `.css()` is
|
|
260
|
+
* `Property.MaskBorderSlice`.
|
|
261
|
+
*/
|
|
262
|
+
exports.maskBorderSlice = makeSliceHelper('maskBorderSlice');
|
|
263
|
+
/**
|
|
264
|
+
* `stroke-width`: a single non-negative `<number>` (SVG user units, hardened
|
|
265
|
+
* through `f({ min: 0 })`) or an `IMeasurement` length. The percentage form is
|
|
266
|
+
* out of scope. `.css()` is `Property.StrokeWidth`.
|
|
267
|
+
*/
|
|
268
|
+
const strokeWidth = (value) => wrap(renderNumberOrLength(value, 'strokeWidth', 0));
|
|
269
|
+
exports.strokeWidth = strokeWidth;
|
|
270
|
+
/**
|
|
271
|
+
* `stroke-dashoffset`: a single `<number>` (any value; SVG user units, hardened
|
|
272
|
+
* through `f()`) or an `IMeasurement` length. The percentage form is out of
|
|
273
|
+
* scope. `.css()` is `Property.StrokeDashoffset`.
|
|
274
|
+
*/
|
|
275
|
+
const strokeDashoffset = (value) => wrap(renderNumberOrLength(value, 'strokeDashoffset'));
|
|
276
|
+
exports.strokeDashoffset = strokeDashoffset;
|
|
277
|
+
function strokeDasharray(first, ...rest) {
|
|
278
|
+
if (first === 'none') {
|
|
279
|
+
if (rest.length > 0) {
|
|
280
|
+
throw new Error(`strokeDasharray: 'none' cannot be combined with entries`);
|
|
281
|
+
}
|
|
282
|
+
return wrap('none');
|
|
283
|
+
}
|
|
284
|
+
const entries = [
|
|
285
|
+
first,
|
|
286
|
+
...rest,
|
|
287
|
+
];
|
|
288
|
+
const parts = entries.map((entry) => renderNumberOrLength(entry, 'strokeDasharray', 0));
|
|
289
|
+
return wrap(parts.join(' '));
|
|
290
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CSS_VALUE_SPEC = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Helper that ties a row's `name`, `cssProperty`, and `keywords` together while
|
|
6
|
+
* inferring each as a literal. Authoring a row through `row(...)` keeps `name`
|
|
7
|
+
* and `keywords` as literals (so the helper map key and keyword param stay
|
|
8
|
+
* precise) without sprinkling `as const` on every entry.
|
|
9
|
+
*/
|
|
10
|
+
const row = (entry) => entry;
|
|
11
|
+
/**
|
|
12
|
+
* The css-value spec table: one row per single-value property. The factory in
|
|
13
|
+
* `./cssValues.ts` generates a typed helper from each row, so adding a property
|
|
14
|
+
* is a one-line table edit, not a hand-written function.
|
|
15
|
+
*
|
|
16
|
+
* Sourced from `docs/css-number-value-types.md`. Multi-value properties and
|
|
17
|
+
* those lacking a clean single-value mapping (e.g. `maxLines`, the counter
|
|
18
|
+
* trio, grid lines, `scale`, `tabSize`) are intentionally excluded.
|
|
19
|
+
*/
|
|
20
|
+
exports.CSS_VALUE_SPEC = [
|
|
21
|
+
// Opacity family: float, [0, 1], no keywords.
|
|
22
|
+
row({
|
|
23
|
+
name: 'opacity',
|
|
24
|
+
kind: 'float',
|
|
25
|
+
min: 0,
|
|
26
|
+
max: 1,
|
|
27
|
+
keywords: [],
|
|
28
|
+
cssProperty: 'Opacity',
|
|
29
|
+
}),
|
|
30
|
+
row({
|
|
31
|
+
name: 'fillOpacity',
|
|
32
|
+
kind: 'float',
|
|
33
|
+
min: 0,
|
|
34
|
+
max: 1,
|
|
35
|
+
keywords: [],
|
|
36
|
+
cssProperty: 'FillOpacity',
|
|
37
|
+
}),
|
|
38
|
+
row({
|
|
39
|
+
name: 'strokeOpacity',
|
|
40
|
+
kind: 'float',
|
|
41
|
+
min: 0,
|
|
42
|
+
max: 1,
|
|
43
|
+
keywords: [],
|
|
44
|
+
cssProperty: 'StrokeOpacity',
|
|
45
|
+
}),
|
|
46
|
+
row({
|
|
47
|
+
name: 'stopOpacity',
|
|
48
|
+
kind: 'float',
|
|
49
|
+
min: 0,
|
|
50
|
+
max: 1,
|
|
51
|
+
keywords: [],
|
|
52
|
+
cssProperty: 'StopOpacity',
|
|
53
|
+
}),
|
|
54
|
+
row({
|
|
55
|
+
name: 'floodOpacity',
|
|
56
|
+
kind: 'float',
|
|
57
|
+
min: 0,
|
|
58
|
+
max: 1,
|
|
59
|
+
keywords: [],
|
|
60
|
+
cssProperty: 'FloodOpacity',
|
|
61
|
+
}),
|
|
62
|
+
row({
|
|
63
|
+
name: 'shapeImageThreshold',
|
|
64
|
+
kind: 'float',
|
|
65
|
+
min: 0,
|
|
66
|
+
max: 1,
|
|
67
|
+
keywords: [],
|
|
68
|
+
cssProperty: 'ShapeImageThreshold',
|
|
69
|
+
}),
|
|
70
|
+
// Float, >= 0.
|
|
71
|
+
row({
|
|
72
|
+
name: 'lineHeight',
|
|
73
|
+
kind: 'float',
|
|
74
|
+
min: 0,
|
|
75
|
+
keywords: [
|
|
76
|
+
'normal',
|
|
77
|
+
],
|
|
78
|
+
cssProperty: 'LineHeight',
|
|
79
|
+
}),
|
|
80
|
+
row({
|
|
81
|
+
name: 'flexGrow',
|
|
82
|
+
kind: 'float',
|
|
83
|
+
min: 0,
|
|
84
|
+
keywords: [],
|
|
85
|
+
cssProperty: 'FlexGrow',
|
|
86
|
+
}),
|
|
87
|
+
row({
|
|
88
|
+
name: 'flexShrink',
|
|
89
|
+
kind: 'float',
|
|
90
|
+
min: 0,
|
|
91
|
+
keywords: [],
|
|
92
|
+
cssProperty: 'FlexShrink',
|
|
93
|
+
}),
|
|
94
|
+
row({
|
|
95
|
+
name: 'animationIterationCount',
|
|
96
|
+
kind: 'float',
|
|
97
|
+
min: 0,
|
|
98
|
+
keywords: [
|
|
99
|
+
'infinite',
|
|
100
|
+
],
|
|
101
|
+
cssProperty: 'AnimationIterationCount',
|
|
102
|
+
}),
|
|
103
|
+
row({
|
|
104
|
+
name: 'fontSizeAdjust',
|
|
105
|
+
kind: 'float',
|
|
106
|
+
min: 0,
|
|
107
|
+
keywords: [
|
|
108
|
+
'none',
|
|
109
|
+
'from-font',
|
|
110
|
+
],
|
|
111
|
+
cssProperty: 'FontSizeAdjust',
|
|
112
|
+
}),
|
|
113
|
+
row({
|
|
114
|
+
name: 'zoom',
|
|
115
|
+
kind: 'float',
|
|
116
|
+
min: 0,
|
|
117
|
+
keywords: [],
|
|
118
|
+
cssProperty: 'Zoom',
|
|
119
|
+
}),
|
|
120
|
+
// Float, specific range.
|
|
121
|
+
row({
|
|
122
|
+
name: 'fontWeight',
|
|
123
|
+
kind: 'float',
|
|
124
|
+
min: 1,
|
|
125
|
+
max: 1000,
|
|
126
|
+
keywords: [
|
|
127
|
+
'normal',
|
|
128
|
+
'bold',
|
|
129
|
+
'lighter',
|
|
130
|
+
'bolder',
|
|
131
|
+
],
|
|
132
|
+
cssProperty: 'FontWeight',
|
|
133
|
+
}),
|
|
134
|
+
row({
|
|
135
|
+
name: 'strokeMiterlimit',
|
|
136
|
+
kind: 'float',
|
|
137
|
+
min: 1,
|
|
138
|
+
keywords: [],
|
|
139
|
+
cssProperty: 'StrokeMiterlimit',
|
|
140
|
+
}),
|
|
141
|
+
// Integer, unbounded (negatives allowed).
|
|
142
|
+
row({
|
|
143
|
+
name: 'zIndex',
|
|
144
|
+
kind: 'int',
|
|
145
|
+
keywords: [
|
|
146
|
+
'auto',
|
|
147
|
+
],
|
|
148
|
+
cssProperty: 'ZIndex',
|
|
149
|
+
}),
|
|
150
|
+
row({
|
|
151
|
+
name: 'order',
|
|
152
|
+
kind: 'int',
|
|
153
|
+
keywords: [],
|
|
154
|
+
cssProperty: 'Order',
|
|
155
|
+
}),
|
|
156
|
+
row({
|
|
157
|
+
name: 'mathDepth',
|
|
158
|
+
kind: 'int',
|
|
159
|
+
keywords: [
|
|
160
|
+
'auto-add',
|
|
161
|
+
],
|
|
162
|
+
cssProperty: 'MathDepth',
|
|
163
|
+
}),
|
|
164
|
+
// Integer, min 1.
|
|
165
|
+
row({
|
|
166
|
+
name: 'columnCount',
|
|
167
|
+
kind: 'int',
|
|
168
|
+
min: 1,
|
|
169
|
+
keywords: [
|
|
170
|
+
'auto',
|
|
171
|
+
],
|
|
172
|
+
cssProperty: 'ColumnCount',
|
|
173
|
+
}),
|
|
174
|
+
row({
|
|
175
|
+
name: 'orphans',
|
|
176
|
+
kind: 'int',
|
|
177
|
+
min: 1,
|
|
178
|
+
keywords: [],
|
|
179
|
+
cssProperty: 'Orphans',
|
|
180
|
+
}),
|
|
181
|
+
row({
|
|
182
|
+
name: 'widows',
|
|
183
|
+
kind: 'int',
|
|
184
|
+
min: 1,
|
|
185
|
+
keywords: [],
|
|
186
|
+
cssProperty: 'Widows',
|
|
187
|
+
}),
|
|
188
|
+
row({
|
|
189
|
+
name: 'lineClamp',
|
|
190
|
+
kind: 'int',
|
|
191
|
+
min: 1,
|
|
192
|
+
keywords: [
|
|
193
|
+
'none',
|
|
194
|
+
],
|
|
195
|
+
cssProperty: 'WebkitLineClamp',
|
|
196
|
+
}),
|
|
197
|
+
];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setErrorConfig = exports.getErrorConfig = exports.inRange = exports.nonPositive = exports.nonNegative = exports.makeMeasurementRefinement = exports.assertCondition = exports.assertUnit = exports.hasCssMethod = exports.makeUnitAssert = exports.makeUnitGuard = exports.makeUnitHelperFromDefinition = exports.makeUnitHelper = exports.measurementUnitMetadata = exports.measurementMax = exports.measurementMin = exports.assertMatchingUnits = exports.isMeasurement = exports.m = void 0;
|
|
4
|
+
// THE DEFAULT INSTANCE. This module sits ABOVE both `core.ts` and `factory.ts`
|
|
5
|
+
// and is the single place where the package's bare, default-instance helpers are
|
|
6
|
+
// assembled. It calls the public factory `createCalipers()` at its defaults, so
|
|
7
|
+
// the bare `m` / refinements / unit-helper builders below are exactly the same
|
|
8
|
+
// construction path a consumer gets from `createCalipers()` with no config. The
|
|
9
|
+
// default can no longer drift from a custom instance, because there is one path.
|
|
10
|
+
//
|
|
11
|
+
// `factory.ts` depends only on the `internal/*` builders (which import nothing
|
|
12
|
+
// but TYPES from `core.ts`), so importing the factory here introduces no runtime
|
|
13
|
+
// import cycle: `default.ts -> factory.ts -> internal/* -> core.ts (types only)`.
|
|
14
|
+
// `core.ts` itself imports nothing from this module.
|
|
15
|
+
const factory_1 = require("./factory");
|
|
16
|
+
const defaultCalipers = (0, factory_1.createCalipers)();
|
|
17
|
+
exports.m = defaultCalipers.m, exports.isMeasurement = defaultCalipers.isMeasurement, exports.assertMatchingUnits = defaultCalipers.assertMatchingUnits, exports.measurementMin = defaultCalipers.measurementMin, exports.measurementMax = defaultCalipers.measurementMax, exports.measurementUnitMetadata = defaultCalipers.measurementUnitMetadata, exports.makeUnitHelper = defaultCalipers.makeUnitHelper, exports.makeUnitHelperFromDefinition = defaultCalipers.makeUnitHelperFromDefinition, exports.makeUnitGuard = defaultCalipers.makeUnitGuard, exports.makeUnitAssert = defaultCalipers.makeUnitAssert, exports.hasCssMethod = defaultCalipers.hasCssMethod, exports.assertUnit = defaultCalipers.assertUnit, exports.assertCondition = defaultCalipers.assertCondition, exports.makeMeasurementRefinement = defaultCalipers.makeMeasurementRefinement, exports.nonNegative = defaultCalipers.nonNegative, exports.nonPositive = defaultCalipers.nonPositive, exports.inRange = defaultCalipers.inRange, exports.getErrorConfig = defaultCalipers.getErrorConfig, exports.setErrorConfig = defaultCalipers.setErrorConfig;
|