webpack 5.110.2 → 5.111.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/README.md +5 -2
- package/lib/APIPlugin.js +23 -7
- package/lib/AutomaticPrefetchPlugin.js +1 -1
- package/lib/Cache.js +8 -3
- package/lib/CacheFacade.js +1 -1
- package/lib/ChunkGraph.js +20 -18
- package/lib/CircularModulesPlugin.js +157 -55
- package/lib/CleanPlugin.js +2 -2
- package/lib/Compilation.js +321 -303
- package/lib/Compiler.js +209 -46
- package/lib/ConcatenationScope.js +25 -35
- package/lib/ContextModule.js +17 -81
- package/lib/ContextModuleFactory.js +1 -1
- package/lib/CopyPlugin.js +1054 -0
- package/lib/DefinePlugin.js +24 -8
- package/lib/DotenvPlugin.js +41 -13
- package/lib/ExternalModule.js +41 -14
- package/lib/FileSystemInfo.js +17 -14
- package/lib/FlagDependencyExportsPlugin.js +45 -21
- package/lib/FlagDependencyUsagePlugin.js +8 -2
- package/lib/HotModuleReplacementPlugin.js +53 -7
- package/lib/JavascriptMetaInfoPlugin.js +5 -3
- package/lib/MainTemplate.js +5 -1
- package/lib/Module.js +16 -7
- package/lib/MultiCompiler.js +1 -1
- package/lib/MultiWatching.js +1 -1
- package/lib/NormalModule.js +58 -32
- package/lib/NormalModuleFactory.js +1 -1
- package/lib/RuntimeGlobals.js +21 -7
- package/lib/RuntimeModule.js +28 -12
- package/lib/RuntimePlugin.js +33 -3
- package/lib/RuntimeTemplate.js +794 -477
- package/lib/SourceMapDevToolPlugin.js +1 -1
- package/lib/Watching.js +9 -0
- package/lib/WebpackOptionsApply.js +84 -91
- package/lib/asset/AssetGenerator.js +25 -8
- package/lib/asset/AssetModule.js +3 -0
- package/lib/asset/WebManifestParser.js +7 -5
- package/lib/async-modules/AsyncModuleHelpers.js +10 -4
- package/lib/cache/AddBuildDependenciesPlugin.js +33 -4
- package/lib/cache/IdleFileCachePlugin.js +2 -2
- package/lib/cache/PackFileCacheStrategy.js +14 -1
- package/lib/config/browserslistTargetHandler.js +19 -0
- package/lib/config/defaults.js +110 -64
- package/lib/config/normalization.js +100 -20
- package/lib/config/target.js +10 -0
- package/lib/container/ContainerReferencePlugin.js +6 -0
- package/lib/container/RemoteRuntimeModule.js +9 -0
- package/lib/container/declaredRemotes.js +39 -0
- package/lib/css/CssGenerator.js +8 -0
- package/lib/css/CssInjectStyleRuntimeModule.js +9 -0
- package/lib/css/CssLoadingRuntimeModule.js +94 -36
- package/lib/css/CssModule.js +1 -1
- package/lib/css/CssModulesPlugin.js +7 -6
- package/lib/css/CssParser.js +144 -11
- package/lib/css/CssServerStylesRuntimeModule.js +9 -0
- package/lib/css/cssMinify.js +11 -3
- package/lib/css/data.js +2814 -678
- package/lib/css/syntax.js +4082 -248
- package/lib/debug/ProfilingPlugin.js +4 -0
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +6 -3
- package/lib/dependencies/AMDRuntimeModules.js +18 -0
- package/lib/dependencies/CommonJsExportRequireDependency.js +3 -1
- package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -13
- package/lib/dependencies/CommonJsImportsParserPlugin.js +1 -0
- package/lib/dependencies/CommonJsPlugin.js +19 -3
- package/lib/dependencies/CommonJsRequireDependency.js +32 -9
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +20 -7
- package/lib/dependencies/CssIcssExportDependency.js +7 -1
- package/lib/dependencies/HarmonyCompatibilityDependency.js +58 -4
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +8 -3
- package/lib/dependencies/HarmonyExportExpressionDependency.js +44 -29
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +171 -32
- package/lib/dependencies/HarmonyExportInitFragment.js +99 -19
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +18 -30
- package/lib/dependencies/HarmonyImportBareSideEffectDependency.js +59 -0
- package/lib/dependencies/HarmonyImportDependency.js +99 -41
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +20 -3
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +24 -1
- package/lib/dependencies/HarmonyModulesPlugin.js +20 -0
- package/lib/dependencies/HtmlEntryDependency.js +62 -2
- package/lib/dependencies/ImportContextDependency.js +43 -3
- package/lib/dependencies/ImportDependency.js +8 -29
- package/lib/dependencies/ImportMetaMainDependency.js +104 -0
- package/lib/dependencies/ImportMetaPlugin.js +59 -15
- package/lib/dependencies/ImportParserPlugin.js +24 -14
- package/lib/dependencies/RequireHeaderDependency.js +20 -21
- package/lib/dependencies/SystemRuntimeModule.js +9 -0
- package/lib/dependencies/WorkerDependency.js +1 -2
- package/lib/dependencies/WorkletDependency.js +1 -2
- package/lib/dependencies/importOptionsCheck.js +47 -0
- package/lib/dll/DelegatedModule.js +18 -1
- package/lib/dll/DllReferencePlugin.js +11 -8
- package/lib/dll/LibManifestPlugin.js +1 -1
- package/lib/errors/AnalyzableBailoutsWarning.js +41 -0
- package/lib/errors/DotenvFileError.js +29 -0
- package/lib/errors/DuplicateModulesWarning.js +12 -7
- package/lib/errors/EmptyCopyPatternWarning.js +26 -0
- package/lib/errors/ExternalStarReexportError.js +44 -0
- package/lib/errors/ImportedBindingAssignmentError.js +30 -0
- package/lib/errors/MissingSourceMapsWarning.js +36 -0
- package/lib/errors/ModuleParseError.js +2 -1
- package/lib/errors/UnusedAssetsWarning.js +36 -0
- package/lib/errors/UnusedFederationWarning.js +35 -0
- package/lib/errors/UnusedModulesWarning.js +38 -0
- package/lib/esm/ExportWebpackRequireRuntimeModule.js +9 -0
- package/lib/esm/ModuleChunkFormatPlugin.js +28 -3
- package/lib/esm/ModuleChunkLoadingPlugin.js +30 -11
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +92 -60
- package/lib/hmr/HotModuleReplacement.runtime.js +8 -2
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +9 -0
- package/lib/html/HtmlGenerator.js +11 -5
- package/lib/html/HtmlModulesPlugin.js +360 -84
- package/lib/html/HtmlParser.js +13 -6
- package/lib/html/builtinEmbeddedRenderer.js +107 -0
- package/lib/html/data.js +121 -7
- package/lib/html/htmlMinify.js +84 -113
- package/lib/html/syntax.js +1067 -569
- package/lib/ids/HashedModuleIdsPlugin.js +2 -1
- package/lib/index.js +3 -0
- package/lib/javascript/JavascriptModule.js +1 -0
- package/lib/javascript/JavascriptModulesPlugin.js +52 -22
- package/lib/javascript/JavascriptParser.js +1255 -728
- package/lib/javascript/StartupHelpers.js +27 -3
- package/lib/javascript/data.js +172 -0
- package/lib/javascript/grammar.js +5546 -0
- package/lib/javascript/parser.js +1494 -0
- package/lib/javascript/regexp.js +1762 -0
- package/lib/javascript/regexpData.js +51 -0
- package/lib/javascript/syntax.js +8696 -5225
- package/lib/library/ModuleLibraryPlugin.js +116 -5
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +22 -0
- package/lib/node/RequireChunkLoadingRuntimeModule.js +22 -0
- package/lib/optimize/ConcatenatedModule.js +133 -25
- package/lib/optimize/ConstExportsPlugin.js +50 -39
- package/lib/optimize/InlineExports.js +20 -123
- package/lib/optimize/MangleExportsPlugin.js +10 -0
- package/lib/optimize/ModuleConcatenationPlugin.js +24 -1
- package/lib/optimize/RealContentHashPlugin.js +68 -9
- package/lib/optimize/SideEffectsFlagPlugin.js +17 -9
- package/lib/performance/AnalyzableBailoutsPlugin.js +115 -0
- package/lib/performance/CacheEffectivenessPlugin.js +4 -3
- package/lib/performance/DuplicateModulesPlugin.js +57 -13
- package/lib/performance/EvalUsagePlugin.js +5 -2
- package/lib/performance/MissingSourceMapsPlugin.js +115 -0
- package/lib/performance/PureAnnotationsPlugin.js +6 -3
- package/lib/performance/TopLevelThisPlugin.js +5 -4
- package/lib/performance/UnusedAssetsPlugin.js +109 -0
- package/lib/performance/UnusedFederationPlugin.js +147 -0
- package/lib/performance/UnusedModulesPlugin.js +141 -0
- package/lib/performance/UnusedReexportsPlugin.js +1 -55
- package/lib/performance/isOnlyReexported.js +65 -0
- package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +25 -5
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +2 -0
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +9 -0
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +9 -0
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +9 -0
- package/lib/prefetch/ResourceHintPlugin.js +7 -3
- package/lib/prefetch/ResourceHintRuntimeModule.js +9 -0
- package/lib/prefetch/StartupAssetHintRuntimeModule.js +9 -0
- package/lib/rules/RuleSetCompiler.js +211 -4
- package/lib/runtime/AsyncModuleRuntimeModule.js +105 -67
- package/lib/runtime/AutoPublicPathRuntimeModule.js +9 -0
- package/lib/runtime/BaseUriRuntimeModule.js +9 -0
- package/lib/runtime/ChunkNameRuntimeModule.js +9 -0
- package/lib/runtime/EnsureChunkRuntimeModule.js +35 -16
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +9 -0
- package/lib/runtime/GetFullHashRuntimeModule.js +9 -0
- package/lib/runtime/GetMainFilenameRuntimeModule.js +9 -0
- package/lib/runtime/GetWorkletBootstrapRuntimeModule.js +9 -0
- package/lib/runtime/GlobalRuntimeModule.js +9 -0
- package/lib/runtime/HasOwnPropertyRuntimeModule.js +9 -0
- package/lib/runtime/HelperRuntimeModule.js +10 -0
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +338 -217
- package/lib/runtime/NonceRuntimeModule.js +9 -0
- package/lib/runtime/OnChunksLoadedRuntimeModule.js +67 -20
- package/lib/runtime/PublicPathRuntimeModule.js +9 -0
- package/lib/runtime/RuntimeIdRuntimeModule.js +9 -0
- package/lib/runtime/SpecNamespaceObjectRuntimeModule.js +90 -0
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +9 -0
- package/lib/runtime/StartupEntrypointRuntimeModule.js +9 -0
- package/lib/runtime/SystemContextRuntimeModule.js +9 -0
- package/lib/runtime/ToBinaryRuntimeModule.js +9 -0
- package/lib/schemes/HttpUriPlugin.js +22 -5
- package/lib/serialization/FileMiddleware.js +15 -2
- package/lib/serialization/ObjectMiddleware.js +138 -106
- package/lib/sharing/ConsumeSharedPlugin.js +12 -0
- package/lib/sharing/ConsumeSharedRuntimeModule.js +11 -0
- package/lib/sharing/ShareRuntimeModule.js +9 -0
- package/lib/sharing/declaredShared.js +47 -0
- package/lib/stats/DefaultStatsFactoryPlugin.js +3 -1
- package/lib/stats/DefaultStatsPrinterPlugin.js +3 -0
- package/lib/util/ArrayQueue.js +3 -3
- package/lib/util/SourceProcessor.js +76 -69
- package/lib/util/URLAbsoluteSpecifier.js +3 -1
- package/lib/util/async.js +292 -0
- package/lib/util/buildDiagnostics.js +69 -0
- package/lib/util/conventions.js +5 -1
- package/lib/util/fs.js +27 -1
- package/lib/util/handlerKeys.js +40 -0
- package/lib/util/identifier.js +20 -0
- package/lib/util/internalSerializables.js +6 -0
- package/lib/util/registerExternalSerializer.js +6 -45
- package/lib/wasm-async/AsyncWasmCompileRuntimeModule.js +9 -0
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +9 -0
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +9 -0
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +36 -0
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +19 -0
- package/package.json +22 -16
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +388 -76
- package/schemas/plugins/LoaderOptionsPlugin.check.js +1 -1
- package/schemas/plugins/ManifestPlugin.check.js +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
- package/schemas/plugins/asset/AssetGeneratorOptions.check.js +1 -1
- package/schemas/plugins/asset/AssetResourceGeneratorOptions.check.js +1 -1
- package/schemas/plugins/container/ContainerPlugin.check.js +1 -1
- package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
- package/schemas/plugins/debug/ProfilingPlugin.check.js +1 -1
- package/schemas/plugins/dll/DllReferencePlugin.check.js +1 -1
- package/schemas/plugins/ids/HashedModuleIdsPlugin.check.js +1 -1
- package/schemas/plugins/schemes/HttpUriPlugin.check.js +1 -1
- package/types.d.ts +1440 -331
- package/lib/dependencies/ExportBindingInitFragment.js +0 -191
- package/lib/errors/EntrypointOverlapWarning.js +0 -45
- package/lib/performance/EntrypointOverlapPlugin.js +0 -122
package/lib/css/data.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// GENERATED by tooling/generate-css-data.js — do not edit.
|
|
7
|
-
// Sources: mdn-data
|
|
7
|
+
// Sources: mdn-data, color-name and @mdn/browser-compat-data, at the versions yarn.lock pins.
|
|
8
8
|
|
|
9
9
|
"use strict";
|
|
10
10
|
|
|
11
11
|
/** @typedef {(sums: Map<string, number>[]) => [string, number[]] | null} MathArgumentReader */
|
|
12
|
-
/** @typedef {(values: number[], strategy: string, table: Map<number, number>
|
|
12
|
+
/** @typedef {(values: number[], strategy: string, table: Map<number, number>) => number | null} MathOperation */
|
|
13
13
|
|
|
14
14
|
// The arithmetic the math-function descriptors at the end of this file bind to.
|
|
15
15
|
// It knows nothing of CSS beyond the shape of an evaluated argument, and names
|
|
@@ -40,16 +40,36 @@ const exactMultiply = (a, k) => {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Add two doubles. Every sum a stylesheet can write is finite, and one that is
|
|
44
|
+
* not is no value to print.
|
|
45
|
+
* @param {number} a one term
|
|
46
|
+
* @param {number} b the other
|
|
47
|
+
* @returns {number | null} their sum, or `null`
|
|
48
|
+
*/
|
|
49
|
+
const foldAdd = (a, b) => {
|
|
50
|
+
const sum = a + b;
|
|
51
|
+
return Number.isFinite(sum) ? sum : null;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param {number} a the value
|
|
56
|
+
* @param {number} k the factor
|
|
57
|
+
* @returns {number | null} their product, or `null`
|
|
58
|
+
*/
|
|
59
|
+
const foldMultiply = (a, k) => {
|
|
60
|
+
const product = a * k;
|
|
61
|
+
return Number.isFinite(product) ? product : null;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
44
65
|
* @param {number} a the value
|
|
45
66
|
* @param {number} k the divisor
|
|
46
|
-
* @returns {number | null} their
|
|
67
|
+
* @returns {number | null} their quotient, or `null` where there is none
|
|
47
68
|
*/
|
|
48
|
-
const
|
|
69
|
+
const foldDivide = (a, k) => {
|
|
49
70
|
if (k === 0) return null;
|
|
50
71
|
const quotient = a / k;
|
|
51
|
-
|
|
52
|
-
return quotient * k === a ? quotient : null;
|
|
72
|
+
return Number.isFinite(quotient) ? quotient : null;
|
|
53
73
|
};
|
|
54
74
|
|
|
55
75
|
/**
|
|
@@ -81,45 +101,6 @@ const exactFloorDivide = (value, step) => {
|
|
|
81
101
|
return null;
|
|
82
102
|
};
|
|
83
103
|
|
|
84
|
-
/**
|
|
85
|
-
* The square root of a value, where it is one that can be written down. IEEE-754
|
|
86
|
-
* makes `Math.sqrt` correctly rounded, so squaring the result back is a complete
|
|
87
|
-
* test — and it fails for every irrational root, which is most of them.
|
|
88
|
-
* @param {number} value the radicand
|
|
89
|
-
* @returns {number | null} the root, or `null`
|
|
90
|
-
*/
|
|
91
|
-
const exactSquareRoot = (value) => {
|
|
92
|
-
if (!(value >= 0)) return null;
|
|
93
|
-
const root = Math.sqrt(value);
|
|
94
|
-
const back = exactMultiply(root, root);
|
|
95
|
-
return back === null || back !== value ? null : root;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// Beyond this an integer exponent is not worth multiplying out, and every result
|
|
99
|
-
// overflows a double for all but a base within an ulp of 1.
|
|
100
|
-
const POWER_LIMIT = 64;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* `base ** exponent` for a whole exponent, by multiplying out. Every step is
|
|
104
|
-
* checked, so the result is the one an engine computing in doubles gets — which
|
|
105
|
-
* `Math.pow` is not required to be for a general exponent.
|
|
106
|
-
* @param {number} base the base
|
|
107
|
-
* @param {number} exponent a whole exponent
|
|
108
|
-
* @returns {number | null} the power, or `null`
|
|
109
|
-
*/
|
|
110
|
-
const exactIntegerPower = (base, exponent) => {
|
|
111
|
-
if (!Number.isInteger(exponent) || Math.abs(exponent) > POWER_LIMIT) {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
let power = 1;
|
|
115
|
-
for (let n = Math.abs(exponent); n > 0; n--) {
|
|
116
|
-
const next = exactMultiply(power, base);
|
|
117
|
-
if (next === null) return null;
|
|
118
|
-
power = next;
|
|
119
|
-
}
|
|
120
|
-
return exponent < 0 ? exactDivide(1, power) : power;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
104
|
/**
|
|
124
105
|
* One evaluated argument list, read as a shared unit and its coefficients. A
|
|
125
106
|
* percentage is refused: its basis can be negative (a `background-position`
|
|
@@ -156,24 +137,22 @@ const readNumber = (sums) => {
|
|
|
156
137
|
};
|
|
157
138
|
|
|
158
139
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
140
|
+
* Read a trigonometric function's one argument as degrees. A bare number is
|
|
141
|
+
* radians (CSS Values 4 §10.6), and an angle is the unit it was written in;
|
|
142
|
+
* either way what the fold needs is the one measure the tables are keyed by.
|
|
162
143
|
* @param {Map<string, number>} quarterTurnAngle a quarter turn in each unit that spells one exactly
|
|
163
|
-
* @returns {
|
|
144
|
+
* @returns {MathArgumentReader} the reader
|
|
164
145
|
*/
|
|
165
|
-
const
|
|
146
|
+
const angleReader = (quarterTurnAngle) => (sums) => {
|
|
166
147
|
const shared = readSameUnit(sums);
|
|
167
148
|
if (shared === null) return null;
|
|
168
149
|
const [unit, [angle]] = shared;
|
|
169
|
-
|
|
150
|
+
// A radian is what a bare number is read as, and the one angle unit that
|
|
151
|
+
// spells no quarter turn exactly — so the table states none for it.
|
|
152
|
+
if (unit === "" || unit === "rad") return ["", [(angle * 180) / Math.PI]];
|
|
170
153
|
const quarter = quarterTurnAngle.get(unit);
|
|
171
154
|
if (quarter === undefined) return null;
|
|
172
|
-
|
|
173
|
-
// eighth, which is a power of two.
|
|
174
|
-
const eighths = exactDivide(angle, quarter / 2);
|
|
175
|
-
if (eighths === null || !Number.isInteger(eighths)) return null;
|
|
176
|
-
return ["", [((eighths % 8) + 8) % 8]];
|
|
155
|
+
return ["", [(angle * 90) / quarter]];
|
|
177
156
|
};
|
|
178
157
|
|
|
179
158
|
/**
|
|
@@ -213,18 +192,11 @@ const sign = ([value]) => Math.sign(value);
|
|
|
213
192
|
|
|
214
193
|
/**
|
|
215
194
|
* @param {number[]} values the coefficients
|
|
216
|
-
* @returns {number | null} the root of their
|
|
195
|
+
* @returns {number | null} the root of their squares, or `null`
|
|
217
196
|
*/
|
|
218
197
|
const hypotenuse = (values) => {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const square = exactMultiply(value, value);
|
|
222
|
-
if (square === null) return null;
|
|
223
|
-
const sum = exactAdd(total, square);
|
|
224
|
-
if (sum === null) return null;
|
|
225
|
-
total = sum;
|
|
226
|
-
}
|
|
227
|
-
return exactSquareRoot(total);
|
|
198
|
+
const total = Math.hypot(...values);
|
|
199
|
+
return Number.isFinite(total) ? total : null;
|
|
228
200
|
};
|
|
229
201
|
|
|
230
202
|
/**
|
|
@@ -300,49 +272,109 @@ const remainder = ([value, divisor]) => {
|
|
|
300
272
|
|
|
301
273
|
/**
|
|
302
274
|
* @param {number[]} values the one radicand
|
|
303
|
-
* @returns {number | null} its root, or `null`
|
|
275
|
+
* @returns {number | null} its root, or `null` where there is none
|
|
304
276
|
*/
|
|
305
|
-
const squareRoot = ([value]) =>
|
|
277
|
+
const squareRoot = ([value]) => (value >= 0 ? Math.sqrt(value) : null);
|
|
306
278
|
|
|
307
279
|
/**
|
|
308
280
|
* @param {number[]} values the base and the exponent
|
|
309
281
|
* @returns {number | null} the power, or `null`
|
|
310
282
|
*/
|
|
311
|
-
const power = ([base, exponent]) =>
|
|
283
|
+
const power = ([base, exponent]) => {
|
|
284
|
+
const raised = base ** exponent;
|
|
285
|
+
return Number.isFinite(raised) ? raised : null;
|
|
286
|
+
};
|
|
312
287
|
|
|
313
288
|
/**
|
|
314
|
-
* A logarithm is transcendental except where it lands on a whole power of its
|
|
315
|
-
* base, so the candidate is raised back and only an exact match is taken. The
|
|
316
|
-
* natural logarithm's base is not a double at all, which leaves only `log(1)`.
|
|
317
289
|
* @param {number[]} values the value and, optionally, the base
|
|
318
|
-
* @returns {number | null} the logarithm, or `null`
|
|
290
|
+
* @returns {number | null} the logarithm, or `null` where there is none
|
|
319
291
|
*/
|
|
320
292
|
const logarithm = ([value, base]) => {
|
|
321
|
-
if (
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
293
|
+
if (!(value > 0)) return null;
|
|
294
|
+
if (base === undefined) return Math.log(value);
|
|
295
|
+
// A base of one divides by zero and a negative one has no logarithm at all;
|
|
296
|
+
// both leave a quotient that is not a number.
|
|
297
|
+
const quotient = Math.log(value) / Math.log(base);
|
|
298
|
+
return Number.isFinite(quotient) ? quotient : null;
|
|
325
299
|
};
|
|
326
300
|
|
|
327
301
|
/**
|
|
328
|
-
* `e` is not a double, so every other power of it is a number this cannot write
|
|
329
|
-
* down and an engine's math library rounds its own way.
|
|
330
302
|
* @param {number[]} values the one exponent
|
|
331
|
-
* @returns {number | null}
|
|
303
|
+
* @returns {number | null} `e` raised to it, or `null`
|
|
304
|
+
*/
|
|
305
|
+
const exponential = ([value]) => {
|
|
306
|
+
const raised = Math.exp(value);
|
|
307
|
+
return Number.isFinite(raised) ? raised : null;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* The value a table gives at a whole number of eighth turns, where a real
|
|
312
|
+
* computation would answer an ulp away from it — `Math.sin(Math.PI)` is 1.2e-16
|
|
313
|
+
* rather than the zero the table states.
|
|
314
|
+
* @param {number} degrees the angle
|
|
315
|
+
* @param {Map<number, number>} table the function's eighth-turn table
|
|
316
|
+
* @returns {number | undefined} the stated value, or undefined
|
|
332
317
|
*/
|
|
333
|
-
const
|
|
318
|
+
const eighthTurn = (degrees, table) => {
|
|
319
|
+
const eighths = degrees / 45;
|
|
320
|
+
return Number.isInteger(eighths)
|
|
321
|
+
? table.get(((eighths % 8) + 8) % 8)
|
|
322
|
+
: undefined;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* An inverse trigonometric function answers with an angle, and an angle is the
|
|
327
|
+
* one thing the printer does not round — a `rotate()` runs it back through trig,
|
|
328
|
+
* where a truncated digit is a different matrix. So only the arguments the table
|
|
329
|
+
* states are taken: everywhere else the real answer carries digits that are
|
|
330
|
+
* noise (`asin(.5)` is 30.000000000000004 degrees) and no shorter than the call.
|
|
331
|
+
* @param {number[]} values the one argument
|
|
332
|
+
* @param {string} keyword unused
|
|
333
|
+
* @param {Map<number, number>} table the arguments the table states
|
|
334
|
+
* @returns {number | null} the angle in degrees, or `null`
|
|
335
|
+
*/
|
|
336
|
+
const statedAngle = ([value], keyword, table) => {
|
|
337
|
+
const stated = table.get(value);
|
|
338
|
+
return stated === undefined ? null : stated;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Tangent, which has an asymptote an odd quarter turn from zero: the table
|
|
343
|
+
* states no value there because there is none, and a double still answers with
|
|
344
|
+
* a very large one.
|
|
345
|
+
* @param {number[]} values the angle in degrees
|
|
346
|
+
* @param {string} keyword unused
|
|
347
|
+
* @param {Map<number, number>} table the eighth-turn table
|
|
348
|
+
* @returns {number | null} its tangent, or `null` at an asymptote
|
|
349
|
+
*/
|
|
350
|
+
const tangent = ([degrees], keyword, table) => {
|
|
351
|
+
const stated = eighthTurn(degrees, table);
|
|
352
|
+
if (stated !== undefined) return stated;
|
|
353
|
+
const quarters = degrees / 90;
|
|
354
|
+
if (Number.isInteger(quarters) && ((quarters % 2) + 2) % 2 === 1) return null;
|
|
355
|
+
return Math.tan((degrees * Math.PI) / 180);
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @param {number[]} values the angle in degrees
|
|
360
|
+
* @param {string} keyword unused
|
|
361
|
+
* @param {Map<number, number>} table the eighth-turn table
|
|
362
|
+
* @returns {number | null} its cosine
|
|
363
|
+
*/
|
|
364
|
+
const cosine = ([degrees], keyword, table) => {
|
|
365
|
+
const stated = eighthTurn(degrees, table);
|
|
366
|
+
return stated === undefined ? Math.cos((degrees * Math.PI) / 180) : stated;
|
|
367
|
+
};
|
|
334
368
|
|
|
335
369
|
/**
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* @param {number
|
|
339
|
-
* @
|
|
340
|
-
* @param {Map<number, number> | null} table the descriptor's table
|
|
341
|
-
* @returns {number | null} the answer, or `null`
|
|
370
|
+
* @param {number[]} values the angle in degrees
|
|
371
|
+
* @param {string} keyword unused
|
|
372
|
+
* @param {Map<number, number>} table the eighth-turn table
|
|
373
|
+
* @returns {number | null} its sine
|
|
342
374
|
*/
|
|
343
|
-
const
|
|
344
|
-
const
|
|
345
|
-
return
|
|
375
|
+
const sine = ([degrees], keyword, table) => {
|
|
376
|
+
const stated = eighthTurn(degrees, table);
|
|
377
|
+
return stated === undefined ? Math.sin((degrees * Math.PI) / 180) : stated;
|
|
346
378
|
};
|
|
347
379
|
|
|
348
380
|
/**
|
|
@@ -517,7 +549,78 @@ const UNSHARED_LONGHAND_KEYWORDS = new Map([
|
|
|
517
549
|
// appearing once, in grammar order. A merge emits every value, so the only
|
|
518
550
|
// question is whether each parses back into the longhand it was authored on.
|
|
519
551
|
// prettier-ignore
|
|
520
|
-
|
|
552
|
+
// The properties whose value ends in a family list, out of the grammars: the
|
|
553
|
+
// longhand and the shorthands that reference it.
|
|
554
|
+
const FAMILY_LIST_PROPERTIES = new Set(["font", "font-family"]);
|
|
555
|
+
|
|
556
|
+
const FAMILY_LONGHANDS = new Map([
|
|
557
|
+
[
|
|
558
|
+
"border-block-end",
|
|
559
|
+
[
|
|
560
|
+
"border-block-end-width",
|
|
561
|
+
"border-block-end-style",
|
|
562
|
+
"border-block-end-color"
|
|
563
|
+
]
|
|
564
|
+
],
|
|
565
|
+
[
|
|
566
|
+
"border-block-start",
|
|
567
|
+
[
|
|
568
|
+
"border-block-start-width",
|
|
569
|
+
"border-block-start-style",
|
|
570
|
+
"border-block-start-color"
|
|
571
|
+
]
|
|
572
|
+
],
|
|
573
|
+
[
|
|
574
|
+
"border-bottom",
|
|
575
|
+
["border-bottom-width", "border-bottom-style", "border-bottom-color"]
|
|
576
|
+
],
|
|
577
|
+
[
|
|
578
|
+
"border-inline-end",
|
|
579
|
+
[
|
|
580
|
+
"border-inline-end-width",
|
|
581
|
+
"border-inline-end-style",
|
|
582
|
+
"border-inline-end-color"
|
|
583
|
+
]
|
|
584
|
+
],
|
|
585
|
+
[
|
|
586
|
+
"border-inline-start",
|
|
587
|
+
[
|
|
588
|
+
"border-inline-start-width",
|
|
589
|
+
"border-inline-start-style",
|
|
590
|
+
"border-inline-start-color"
|
|
591
|
+
]
|
|
592
|
+
],
|
|
593
|
+
[
|
|
594
|
+
"border-left",
|
|
595
|
+
["border-left-width", "border-left-style", "border-left-color"]
|
|
596
|
+
],
|
|
597
|
+
[
|
|
598
|
+
"border-right",
|
|
599
|
+
["border-right-width", "border-right-style", "border-right-color"]
|
|
600
|
+
],
|
|
601
|
+
["border-top", ["border-top-width", "border-top-style", "border-top-color"]],
|
|
602
|
+
[
|
|
603
|
+
"column-rule",
|
|
604
|
+
["column-rule-width", "column-rule-style", "column-rule-color"]
|
|
605
|
+
],
|
|
606
|
+
["flex-flow", ["flex-direction", "flex-wrap"]],
|
|
607
|
+
[
|
|
608
|
+
"list-style",
|
|
609
|
+
["list-style-type", "list-style-position", "list-style-image"]
|
|
610
|
+
],
|
|
611
|
+
["outline", ["outline-width", "outline-style", "outline-color"]],
|
|
612
|
+
[
|
|
613
|
+
"text-decoration",
|
|
614
|
+
[
|
|
615
|
+
"text-decoration-line",
|
|
616
|
+
"text-decoration-style",
|
|
617
|
+
"text-decoration-color",
|
|
618
|
+
"text-decoration-thickness"
|
|
619
|
+
]
|
|
620
|
+
],
|
|
621
|
+
["text-emphasis", ["text-emphasis-style", "text-emphasis-color"]],
|
|
622
|
+
["text-wrap", ["text-wrap-mode", "text-wrap-style"]]
|
|
623
|
+
]);
|
|
521
624
|
|
|
522
625
|
// The properties whose comma-separated items take a `<custom-ident>`, where a
|
|
523
626
|
// vendor spelling is a name the engine parses rather than one it may drop — so a
|
|
@@ -552,6 +655,552 @@ const SLASH_LONGHANDS = new Map([
|
|
|
552
655
|
["grid-row", ["grid-row-start", "grid-row-end"]]
|
|
553
656
|
]);
|
|
554
657
|
|
|
658
|
+
// Every longhand each shorthand sets, so one block can be asked whether another
|
|
659
|
+
// could shadow it. Not every shorthand prefixes its longhands: `inset` sets `top`.
|
|
660
|
+
const SHORTHAND_LONGHANDS = new Map([
|
|
661
|
+
[
|
|
662
|
+
"-moz-outline-radius",
|
|
663
|
+
new Set([
|
|
664
|
+
"-moz-outline-radius-bottomleft",
|
|
665
|
+
"-moz-outline-radius-bottomright",
|
|
666
|
+
"-moz-outline-radius-topleft",
|
|
667
|
+
"-moz-outline-radius-topright"
|
|
668
|
+
])
|
|
669
|
+
],
|
|
670
|
+
[
|
|
671
|
+
"-ms-content-zoom-limit",
|
|
672
|
+
new Set(["-ms-content-zoom-limit-max", "-ms-content-zoom-limit-min"])
|
|
673
|
+
],
|
|
674
|
+
[
|
|
675
|
+
"-ms-content-zoom-snap",
|
|
676
|
+
new Set(["-ms-content-zoom-snap-points", "-ms-content-zoom-snap-type"])
|
|
677
|
+
],
|
|
678
|
+
[
|
|
679
|
+
"-ms-scroll-limit",
|
|
680
|
+
new Set([
|
|
681
|
+
"-ms-scroll-limit-x-max",
|
|
682
|
+
"-ms-scroll-limit-x-min",
|
|
683
|
+
"-ms-scroll-limit-y-max",
|
|
684
|
+
"-ms-scroll-limit-y-min"
|
|
685
|
+
])
|
|
686
|
+
],
|
|
687
|
+
[
|
|
688
|
+
"-ms-scroll-snap-x",
|
|
689
|
+
new Set(["-ms-scroll-snap-points-x", "-ms-scroll-snap-type"])
|
|
690
|
+
],
|
|
691
|
+
[
|
|
692
|
+
"-ms-scroll-snap-y",
|
|
693
|
+
new Set(["-ms-scroll-snap-points-y", "-ms-scroll-snap-type"])
|
|
694
|
+
],
|
|
695
|
+
[
|
|
696
|
+
"-webkit-border-after",
|
|
697
|
+
new Set([
|
|
698
|
+
"border-block-end-color",
|
|
699
|
+
"border-block-end-style",
|
|
700
|
+
"border-block-end-width"
|
|
701
|
+
])
|
|
702
|
+
],
|
|
703
|
+
[
|
|
704
|
+
"-webkit-border-before",
|
|
705
|
+
new Set([
|
|
706
|
+
"border-block-start-color",
|
|
707
|
+
"border-block-start-style",
|
|
708
|
+
"border-block-start-width"
|
|
709
|
+
])
|
|
710
|
+
],
|
|
711
|
+
[
|
|
712
|
+
"-webkit-border-end",
|
|
713
|
+
new Set([
|
|
714
|
+
"border-inline-end-color",
|
|
715
|
+
"border-inline-end-style",
|
|
716
|
+
"border-inline-end-width"
|
|
717
|
+
])
|
|
718
|
+
],
|
|
719
|
+
[
|
|
720
|
+
"-webkit-border-start",
|
|
721
|
+
new Set([
|
|
722
|
+
"border-inline-start-color",
|
|
723
|
+
"border-inline-start-style",
|
|
724
|
+
"border-inline-start-width"
|
|
725
|
+
])
|
|
726
|
+
],
|
|
727
|
+
[
|
|
728
|
+
"-webkit-mask",
|
|
729
|
+
new Set([
|
|
730
|
+
"-webkit-mask-attachment",
|
|
731
|
+
"-webkit-mask-clip",
|
|
732
|
+
"-webkit-mask-image",
|
|
733
|
+
"-webkit-mask-origin",
|
|
734
|
+
"-webkit-mask-position",
|
|
735
|
+
"-webkit-mask-repeat"
|
|
736
|
+
])
|
|
737
|
+
],
|
|
738
|
+
[
|
|
739
|
+
"-webkit-text-stroke",
|
|
740
|
+
new Set(["-webkit-text-stroke-color", "-webkit-text-stroke-width"])
|
|
741
|
+
],
|
|
742
|
+
[
|
|
743
|
+
"animation",
|
|
744
|
+
new Set([
|
|
745
|
+
"animation-delay",
|
|
746
|
+
"animation-direction",
|
|
747
|
+
"animation-duration",
|
|
748
|
+
"animation-fill-mode",
|
|
749
|
+
"animation-iteration-count",
|
|
750
|
+
"animation-name",
|
|
751
|
+
"animation-play-state",
|
|
752
|
+
"animation-timeline",
|
|
753
|
+
"animation-timing-function"
|
|
754
|
+
])
|
|
755
|
+
],
|
|
756
|
+
[
|
|
757
|
+
"animation-range",
|
|
758
|
+
new Set(["animation-range-end", "animation-range-start"])
|
|
759
|
+
],
|
|
760
|
+
[
|
|
761
|
+
"background",
|
|
762
|
+
new Set([
|
|
763
|
+
"background-attachment",
|
|
764
|
+
"background-clip",
|
|
765
|
+
"background-color",
|
|
766
|
+
"background-image",
|
|
767
|
+
"background-origin",
|
|
768
|
+
"background-position",
|
|
769
|
+
"background-position-x",
|
|
770
|
+
"background-position-y",
|
|
771
|
+
"background-repeat",
|
|
772
|
+
"background-size"
|
|
773
|
+
])
|
|
774
|
+
],
|
|
775
|
+
[
|
|
776
|
+
"background-position",
|
|
777
|
+
new Set(["background-position-x", "background-position-y"])
|
|
778
|
+
],
|
|
779
|
+
[
|
|
780
|
+
"border",
|
|
781
|
+
new Set([
|
|
782
|
+
"border-bottom-color",
|
|
783
|
+
"border-bottom-style",
|
|
784
|
+
"border-bottom-width",
|
|
785
|
+
"border-color",
|
|
786
|
+
"border-left-color",
|
|
787
|
+
"border-left-style",
|
|
788
|
+
"border-left-width",
|
|
789
|
+
"border-right-color",
|
|
790
|
+
"border-right-style",
|
|
791
|
+
"border-right-width",
|
|
792
|
+
"border-style",
|
|
793
|
+
"border-top-color",
|
|
794
|
+
"border-top-style",
|
|
795
|
+
"border-top-width",
|
|
796
|
+
"border-width"
|
|
797
|
+
])
|
|
798
|
+
],
|
|
799
|
+
[
|
|
800
|
+
"border-block",
|
|
801
|
+
new Set([
|
|
802
|
+
"border-block-color",
|
|
803
|
+
"border-block-end-color",
|
|
804
|
+
"border-block-end-style",
|
|
805
|
+
"border-block-end-width",
|
|
806
|
+
"border-block-start-color",
|
|
807
|
+
"border-block-start-style",
|
|
808
|
+
"border-block-start-width",
|
|
809
|
+
"border-block-style",
|
|
810
|
+
"border-block-width"
|
|
811
|
+
])
|
|
812
|
+
],
|
|
813
|
+
[
|
|
814
|
+
"border-block-color",
|
|
815
|
+
new Set(["border-block-end-color", "border-block-start-color"])
|
|
816
|
+
],
|
|
817
|
+
[
|
|
818
|
+
"border-block-end",
|
|
819
|
+
new Set([
|
|
820
|
+
"border-block-end-color",
|
|
821
|
+
"border-block-end-style",
|
|
822
|
+
"border-block-end-width"
|
|
823
|
+
])
|
|
824
|
+
],
|
|
825
|
+
[
|
|
826
|
+
"border-block-start",
|
|
827
|
+
new Set([
|
|
828
|
+
"border-block-start-color",
|
|
829
|
+
"border-block-start-style",
|
|
830
|
+
"border-block-start-width"
|
|
831
|
+
])
|
|
832
|
+
],
|
|
833
|
+
[
|
|
834
|
+
"border-block-style",
|
|
835
|
+
new Set(["border-block-end-style", "border-block-start-style"])
|
|
836
|
+
],
|
|
837
|
+
[
|
|
838
|
+
"border-block-width",
|
|
839
|
+
new Set(["border-block-end-width", "border-block-start-width"])
|
|
840
|
+
],
|
|
841
|
+
[
|
|
842
|
+
"border-bottom",
|
|
843
|
+
new Set([
|
|
844
|
+
"border-bottom-color",
|
|
845
|
+
"border-bottom-style",
|
|
846
|
+
"border-bottom-width"
|
|
847
|
+
])
|
|
848
|
+
],
|
|
849
|
+
[
|
|
850
|
+
"border-color",
|
|
851
|
+
new Set([
|
|
852
|
+
"border-bottom-color",
|
|
853
|
+
"border-left-color",
|
|
854
|
+
"border-right-color",
|
|
855
|
+
"border-top-color"
|
|
856
|
+
])
|
|
857
|
+
],
|
|
858
|
+
[
|
|
859
|
+
"border-image",
|
|
860
|
+
new Set([
|
|
861
|
+
"border-image-outset",
|
|
862
|
+
"border-image-repeat",
|
|
863
|
+
"border-image-slice",
|
|
864
|
+
"border-image-source",
|
|
865
|
+
"border-image-width"
|
|
866
|
+
])
|
|
867
|
+
],
|
|
868
|
+
[
|
|
869
|
+
"border-inline",
|
|
870
|
+
new Set([
|
|
871
|
+
"border-inline-color",
|
|
872
|
+
"border-inline-end-color",
|
|
873
|
+
"border-inline-end-style",
|
|
874
|
+
"border-inline-end-width",
|
|
875
|
+
"border-inline-start-color",
|
|
876
|
+
"border-inline-start-style",
|
|
877
|
+
"border-inline-start-width",
|
|
878
|
+
"border-inline-style",
|
|
879
|
+
"border-inline-width"
|
|
880
|
+
])
|
|
881
|
+
],
|
|
882
|
+
[
|
|
883
|
+
"border-inline-color",
|
|
884
|
+
new Set(["border-inline-end-color", "border-inline-start-color"])
|
|
885
|
+
],
|
|
886
|
+
[
|
|
887
|
+
"border-inline-end",
|
|
888
|
+
new Set([
|
|
889
|
+
"border-inline-end-color",
|
|
890
|
+
"border-inline-end-style",
|
|
891
|
+
"border-inline-end-width"
|
|
892
|
+
])
|
|
893
|
+
],
|
|
894
|
+
[
|
|
895
|
+
"border-inline-start",
|
|
896
|
+
new Set([
|
|
897
|
+
"border-inline-start-color",
|
|
898
|
+
"border-inline-start-style",
|
|
899
|
+
"border-inline-start-width"
|
|
900
|
+
])
|
|
901
|
+
],
|
|
902
|
+
[
|
|
903
|
+
"border-inline-style",
|
|
904
|
+
new Set(["border-inline-end-style", "border-inline-start-style"])
|
|
905
|
+
],
|
|
906
|
+
[
|
|
907
|
+
"border-inline-width",
|
|
908
|
+
new Set(["border-inline-end-width", "border-inline-start-width"])
|
|
909
|
+
],
|
|
910
|
+
[
|
|
911
|
+
"border-left",
|
|
912
|
+
new Set(["border-left-color", "border-left-style", "border-left-width"])
|
|
913
|
+
],
|
|
914
|
+
[
|
|
915
|
+
"border-radius",
|
|
916
|
+
new Set([
|
|
917
|
+
"border-bottom-left-radius",
|
|
918
|
+
"border-bottom-right-radius",
|
|
919
|
+
"border-top-left-radius",
|
|
920
|
+
"border-top-right-radius"
|
|
921
|
+
])
|
|
922
|
+
],
|
|
923
|
+
[
|
|
924
|
+
"border-right",
|
|
925
|
+
new Set(["border-right-color", "border-right-style", "border-right-width"])
|
|
926
|
+
],
|
|
927
|
+
[
|
|
928
|
+
"border-style",
|
|
929
|
+
new Set([
|
|
930
|
+
"border-bottom-style",
|
|
931
|
+
"border-left-style",
|
|
932
|
+
"border-right-style",
|
|
933
|
+
"border-top-style"
|
|
934
|
+
])
|
|
935
|
+
],
|
|
936
|
+
[
|
|
937
|
+
"border-top",
|
|
938
|
+
new Set(["border-top-color", "border-top-style", "border-top-width"])
|
|
939
|
+
],
|
|
940
|
+
[
|
|
941
|
+
"border-width",
|
|
942
|
+
new Set([
|
|
943
|
+
"border-bottom-width",
|
|
944
|
+
"border-left-width",
|
|
945
|
+
"border-right-width",
|
|
946
|
+
"border-top-width"
|
|
947
|
+
])
|
|
948
|
+
],
|
|
949
|
+
["caret", new Set(["caret-animation", "caret-color", "caret-shape"])],
|
|
950
|
+
[
|
|
951
|
+
"column-rule",
|
|
952
|
+
new Set(["column-rule-color", "column-rule-style", "column-rule-width"])
|
|
953
|
+
],
|
|
954
|
+
["columns", new Set(["column-count", "column-height", "column-width"])],
|
|
955
|
+
[
|
|
956
|
+
"contain-intrinsic-size",
|
|
957
|
+
new Set(["contain-intrinsic-height", "contain-intrinsic-width"])
|
|
958
|
+
],
|
|
959
|
+
["container", new Set(["container-name", "container-type"])],
|
|
960
|
+
[
|
|
961
|
+
"corner-block-end-shape",
|
|
962
|
+
new Set(["corner-end-end-shape", "corner-end-start-shape"])
|
|
963
|
+
],
|
|
964
|
+
[
|
|
965
|
+
"corner-block-start-shape",
|
|
966
|
+
new Set(["corner-start-end-shape", "corner-start-start-shape"])
|
|
967
|
+
],
|
|
968
|
+
[
|
|
969
|
+
"corner-bottom-shape",
|
|
970
|
+
new Set(["corner-bottom-left-shape", "corner-bottom-right-shape"])
|
|
971
|
+
],
|
|
972
|
+
[
|
|
973
|
+
"corner-inline-end-shape",
|
|
974
|
+
new Set(["corner-end-end-shape", "corner-start-end-shape"])
|
|
975
|
+
],
|
|
976
|
+
[
|
|
977
|
+
"corner-inline-start-shape",
|
|
978
|
+
new Set(["corner-start-end-shape", "corner-start-start-shape"])
|
|
979
|
+
],
|
|
980
|
+
[
|
|
981
|
+
"corner-left-shape",
|
|
982
|
+
new Set(["corner-bottom-left-shape", "corner-top-left-shape"])
|
|
983
|
+
],
|
|
984
|
+
[
|
|
985
|
+
"corner-right-shape",
|
|
986
|
+
new Set(["corner-bottom-right-shape", "corner-top-right-shape"])
|
|
987
|
+
],
|
|
988
|
+
[
|
|
989
|
+
"corner-shape",
|
|
990
|
+
new Set([
|
|
991
|
+
"corner-bottom-left-shape",
|
|
992
|
+
"corner-bottom-right-shape",
|
|
993
|
+
"corner-top-left-shape",
|
|
994
|
+
"corner-top-right-shape"
|
|
995
|
+
])
|
|
996
|
+
],
|
|
997
|
+
[
|
|
998
|
+
"corner-top-shape",
|
|
999
|
+
new Set(["corner-top-left-shape", "corner-top-right-shape"])
|
|
1000
|
+
],
|
|
1001
|
+
["flex", new Set(["flex-basis", "flex-grow", "flex-shrink"])],
|
|
1002
|
+
["flex-flow", new Set(["flex-direction", "flex-wrap"])],
|
|
1003
|
+
[
|
|
1004
|
+
"font",
|
|
1005
|
+
new Set([
|
|
1006
|
+
"font-family",
|
|
1007
|
+
"font-size",
|
|
1008
|
+
"font-stretch",
|
|
1009
|
+
"font-style",
|
|
1010
|
+
"font-variant",
|
|
1011
|
+
"font-weight",
|
|
1012
|
+
"line-height"
|
|
1013
|
+
])
|
|
1014
|
+
],
|
|
1015
|
+
["gap", new Set(["column-gap", "row-gap"])],
|
|
1016
|
+
[
|
|
1017
|
+
"grid",
|
|
1018
|
+
new Set([
|
|
1019
|
+
"column-gap",
|
|
1020
|
+
"grid-auto-columns",
|
|
1021
|
+
"grid-auto-flow",
|
|
1022
|
+
"grid-auto-rows",
|
|
1023
|
+
"grid-column-gap",
|
|
1024
|
+
"grid-row-gap",
|
|
1025
|
+
"grid-template-areas",
|
|
1026
|
+
"grid-template-columns",
|
|
1027
|
+
"grid-template-rows",
|
|
1028
|
+
"row-gap"
|
|
1029
|
+
])
|
|
1030
|
+
],
|
|
1031
|
+
[
|
|
1032
|
+
"grid-area",
|
|
1033
|
+
new Set([
|
|
1034
|
+
"grid-column-end",
|
|
1035
|
+
"grid-column-start",
|
|
1036
|
+
"grid-row-end",
|
|
1037
|
+
"grid-row-start"
|
|
1038
|
+
])
|
|
1039
|
+
],
|
|
1040
|
+
["grid-column", new Set(["grid-column-end", "grid-column-start"])],
|
|
1041
|
+
["grid-gap", new Set(["grid-column-gap", "grid-row-gap"])],
|
|
1042
|
+
["grid-row", new Set(["grid-row-end", "grid-row-start"])],
|
|
1043
|
+
[
|
|
1044
|
+
"grid-template",
|
|
1045
|
+
new Set([
|
|
1046
|
+
"grid-template-areas",
|
|
1047
|
+
"grid-template-columns",
|
|
1048
|
+
"grid-template-rows"
|
|
1049
|
+
])
|
|
1050
|
+
],
|
|
1051
|
+
["inset", new Set(["bottom", "left", "right", "top"])],
|
|
1052
|
+
["inset-block", new Set(["inset-block-end", "inset-block-start"])],
|
|
1053
|
+
["inset-inline", new Set(["inset-inline-end", "inset-inline-start"])],
|
|
1054
|
+
["interest-delay", new Set(["interest-delay-end", "interest-delay-start"])],
|
|
1055
|
+
[
|
|
1056
|
+
"list-style",
|
|
1057
|
+
new Set(["list-style-image", "list-style-position", "list-style-type"])
|
|
1058
|
+
],
|
|
1059
|
+
[
|
|
1060
|
+
"margin",
|
|
1061
|
+
new Set(["margin-bottom", "margin-left", "margin-right", "margin-top"])
|
|
1062
|
+
],
|
|
1063
|
+
["margin-block", new Set(["margin-block-end", "margin-block-start"])],
|
|
1064
|
+
["margin-inline", new Set(["margin-inline-end", "margin-inline-start"])],
|
|
1065
|
+
[
|
|
1066
|
+
"mask",
|
|
1067
|
+
new Set([
|
|
1068
|
+
"mask-clip",
|
|
1069
|
+
"mask-composite",
|
|
1070
|
+
"mask-image",
|
|
1071
|
+
"mask-mode",
|
|
1072
|
+
"mask-origin",
|
|
1073
|
+
"mask-position",
|
|
1074
|
+
"mask-repeat",
|
|
1075
|
+
"mask-size"
|
|
1076
|
+
])
|
|
1077
|
+
],
|
|
1078
|
+
[
|
|
1079
|
+
"mask-border",
|
|
1080
|
+
new Set([
|
|
1081
|
+
"mask-border-mode",
|
|
1082
|
+
"mask-border-outset",
|
|
1083
|
+
"mask-border-repeat",
|
|
1084
|
+
"mask-border-slice",
|
|
1085
|
+
"mask-border-source",
|
|
1086
|
+
"mask-border-width"
|
|
1087
|
+
])
|
|
1088
|
+
],
|
|
1089
|
+
[
|
|
1090
|
+
"offset",
|
|
1091
|
+
new Set([
|
|
1092
|
+
"offset-anchor",
|
|
1093
|
+
"offset-distance",
|
|
1094
|
+
"offset-path",
|
|
1095
|
+
"offset-position",
|
|
1096
|
+
"offset-rotate"
|
|
1097
|
+
])
|
|
1098
|
+
],
|
|
1099
|
+
["outline", new Set(["outline-color", "outline-style", "outline-width"])],
|
|
1100
|
+
["overflow", new Set(["overflow-x", "overflow-y"])],
|
|
1101
|
+
[
|
|
1102
|
+
"overscroll-behavior",
|
|
1103
|
+
new Set(["overscroll-behavior-x", "overscroll-behavior-y"])
|
|
1104
|
+
],
|
|
1105
|
+
[
|
|
1106
|
+
"padding",
|
|
1107
|
+
new Set(["padding-bottom", "padding-left", "padding-right", "padding-top"])
|
|
1108
|
+
],
|
|
1109
|
+
["padding-block", new Set(["padding-block-end", "padding-block-start"])],
|
|
1110
|
+
["padding-inline", new Set(["padding-inline-end", "padding-inline-start"])],
|
|
1111
|
+
["place-content", new Set(["align-content", "justify-content"])],
|
|
1112
|
+
["place-items", new Set(["align-items", "justify-items"])],
|
|
1113
|
+
["place-self", new Set(["align-self", "justify-self"])],
|
|
1114
|
+
["position-try", new Set(["position-try-fallbacks", "position-try-order"])],
|
|
1115
|
+
[
|
|
1116
|
+
"scroll-margin",
|
|
1117
|
+
new Set([
|
|
1118
|
+
"scroll-margin-bottom",
|
|
1119
|
+
"scroll-margin-left",
|
|
1120
|
+
"scroll-margin-right",
|
|
1121
|
+
"scroll-margin-top"
|
|
1122
|
+
])
|
|
1123
|
+
],
|
|
1124
|
+
[
|
|
1125
|
+
"scroll-margin-block",
|
|
1126
|
+
new Set(["scroll-margin-block-end", "scroll-margin-block-start"])
|
|
1127
|
+
],
|
|
1128
|
+
[
|
|
1129
|
+
"scroll-margin-inline",
|
|
1130
|
+
new Set(["scroll-margin-inline-end", "scroll-margin-inline-start"])
|
|
1131
|
+
],
|
|
1132
|
+
[
|
|
1133
|
+
"scroll-padding",
|
|
1134
|
+
new Set([
|
|
1135
|
+
"scroll-padding-bottom",
|
|
1136
|
+
"scroll-padding-left",
|
|
1137
|
+
"scroll-padding-right",
|
|
1138
|
+
"scroll-padding-top"
|
|
1139
|
+
])
|
|
1140
|
+
],
|
|
1141
|
+
[
|
|
1142
|
+
"scroll-padding-block",
|
|
1143
|
+
new Set(["scroll-padding-block-end", "scroll-padding-block-start"])
|
|
1144
|
+
],
|
|
1145
|
+
[
|
|
1146
|
+
"scroll-padding-inline",
|
|
1147
|
+
new Set(["scroll-padding-inline-end", "scroll-padding-inline-start"])
|
|
1148
|
+
],
|
|
1149
|
+
[
|
|
1150
|
+
"scroll-timeline",
|
|
1151
|
+
new Set(["scroll-timeline-axis", "scroll-timeline-name"])
|
|
1152
|
+
],
|
|
1153
|
+
[
|
|
1154
|
+
"text-decoration",
|
|
1155
|
+
new Set([
|
|
1156
|
+
"text-decoration-color",
|
|
1157
|
+
"text-decoration-line",
|
|
1158
|
+
"text-decoration-style",
|
|
1159
|
+
"text-decoration-thickness"
|
|
1160
|
+
])
|
|
1161
|
+
],
|
|
1162
|
+
["text-emphasis", new Set(["text-emphasis-color", "text-emphasis-style"])],
|
|
1163
|
+
["text-wrap", new Set(["text-wrap-mode", "text-wrap-style"])],
|
|
1164
|
+
[
|
|
1165
|
+
"timeline-trigger",
|
|
1166
|
+
new Set([
|
|
1167
|
+
"timeline-trigger-activation-range",
|
|
1168
|
+
"timeline-trigger-activation-range-end",
|
|
1169
|
+
"timeline-trigger-activation-range-start",
|
|
1170
|
+
"timeline-trigger-active-range",
|
|
1171
|
+
"timeline-trigger-active-range-end",
|
|
1172
|
+
"timeline-trigger-active-range-start",
|
|
1173
|
+
"timeline-trigger-name",
|
|
1174
|
+
"timeline-trigger-source"
|
|
1175
|
+
])
|
|
1176
|
+
],
|
|
1177
|
+
[
|
|
1178
|
+
"timeline-trigger-activation-range",
|
|
1179
|
+
new Set([
|
|
1180
|
+
"timeline-trigger-activation-range-end",
|
|
1181
|
+
"timeline-trigger-activation-range-start"
|
|
1182
|
+
])
|
|
1183
|
+
],
|
|
1184
|
+
[
|
|
1185
|
+
"timeline-trigger-active-range",
|
|
1186
|
+
new Set([
|
|
1187
|
+
"timeline-trigger-active-range-end",
|
|
1188
|
+
"timeline-trigger-active-range-start"
|
|
1189
|
+
])
|
|
1190
|
+
],
|
|
1191
|
+
[
|
|
1192
|
+
"transition",
|
|
1193
|
+
new Set([
|
|
1194
|
+
"transition-behavior",
|
|
1195
|
+
"transition-delay",
|
|
1196
|
+
"transition-duration",
|
|
1197
|
+
"transition-property",
|
|
1198
|
+
"transition-timing-function"
|
|
1199
|
+
])
|
|
1200
|
+
],
|
|
1201
|
+
["view-timeline", new Set(["view-timeline-axis", "view-timeline-name"])]
|
|
1202
|
+
]);
|
|
1203
|
+
|
|
555
1204
|
// Every longhand the three merge tables above can consume, so a block is asked
|
|
556
1205
|
// once whether it holds anything mergeable at all. Two of them have to be
|
|
557
1206
|
// present before any shorthand can be written, and almost no block holds one,
|
|
@@ -917,6 +1566,7 @@ const BOX_FAMILY_PREFIX = new Map([
|
|
|
917
1566
|
// hex color rather than a case-sensitive reference (`element(#id)`). Only direct
|
|
918
1567
|
// arguments: a gradient nested in `image-set()` is matched as the gradient.
|
|
919
1568
|
const COLOR_ARGUMENT_FUNCTIONS = new Set([
|
|
1569
|
+
"alpha",
|
|
920
1570
|
"color",
|
|
921
1571
|
"color-mix",
|
|
922
1572
|
"conic-gradient",
|
|
@@ -931,6 +1581,23 @@ const COLOR_ARGUMENT_FUNCTIONS = new Set([
|
|
|
931
1581
|
"repeating-radial-gradient"
|
|
932
1582
|
]);
|
|
933
1583
|
|
|
1584
|
+
// The functions that are a color rather than take one, out of `<color>`'s own
|
|
1585
|
+
// grammar — what says a call fills a slot a color fills.
|
|
1586
|
+
const COLOR_FUNCTIONS = new Set([
|
|
1587
|
+
"color",
|
|
1588
|
+
"color-mix",
|
|
1589
|
+
"hsl",
|
|
1590
|
+
"hsla",
|
|
1591
|
+
"hwb",
|
|
1592
|
+
"lab",
|
|
1593
|
+
"lch",
|
|
1594
|
+
"light-dark",
|
|
1595
|
+
"oklab",
|
|
1596
|
+
"oklch",
|
|
1597
|
+
"rgb",
|
|
1598
|
+
"rgba"
|
|
1599
|
+
]);
|
|
1600
|
+
|
|
934
1601
|
// Functions that substitute an arbitrary token sequence, so two identical
|
|
935
1602
|
// references need not be one repeated value: with `--x:1px 2px`,
|
|
936
1603
|
// `margin:var(--x) var(--x)` is four values, not two.
|
|
@@ -1324,9 +1991,12 @@ const DISPLAY_SHORT_FORMS = new Map([
|
|
|
1324
1991
|
["block flow-root", "flow-root"],
|
|
1325
1992
|
["block grid", "grid"],
|
|
1326
1993
|
["block table", "table"],
|
|
1994
|
+
["inline flex", "inline-flex"],
|
|
1327
1995
|
["inline flow", "inline"],
|
|
1328
1996
|
["inline flow-root", "inline-block"],
|
|
1997
|
+
["inline grid", "inline-grid"],
|
|
1329
1998
|
["inline ruby", "ruby"],
|
|
1999
|
+
["inline table", "inline-table"],
|
|
1330
2000
|
["run-in flow", "run-in"]
|
|
1331
2001
|
]);
|
|
1332
2002
|
|
|
@@ -1347,24 +2017,38 @@ const SHORTHAND_INITIAL_KEYWORDS = new Map([
|
|
|
1347
2017
|
new Map([
|
|
1348
2018
|
[
|
|
1349
2019
|
"ease",
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
2020
|
+
{
|
|
2021
|
+
spellings: new Set([
|
|
2022
|
+
"cubic-bezier()",
|
|
2023
|
+
"ease",
|
|
2024
|
+
"ease-in",
|
|
2025
|
+
"ease-in-out",
|
|
2026
|
+
"ease-out",
|
|
2027
|
+
"linear",
|
|
2028
|
+
"linear()",
|
|
2029
|
+
"step-end",
|
|
2030
|
+
"step-start",
|
|
2031
|
+
"steps()"
|
|
2032
|
+
]),
|
|
2033
|
+
classes: new Set()
|
|
2034
|
+
}
|
|
1362
2035
|
],
|
|
1363
2036
|
[
|
|
1364
2037
|
"normal",
|
|
1365
|
-
|
|
2038
|
+
{
|
|
2039
|
+
spellings: new Set([
|
|
2040
|
+
"alternate",
|
|
2041
|
+
"alternate-reverse",
|
|
2042
|
+
"normal",
|
|
2043
|
+
"reverse"
|
|
2044
|
+
]),
|
|
2045
|
+
classes: new Set()
|
|
2046
|
+
}
|
|
1366
2047
|
],
|
|
1367
|
-
[
|
|
2048
|
+
[
|
|
2049
|
+
"running",
|
|
2050
|
+
{ spellings: new Set(["paused", "running"]), classes: new Set() }
|
|
2051
|
+
]
|
|
1368
2052
|
])
|
|
1369
2053
|
],
|
|
1370
2054
|
[
|
|
@@ -1372,87 +2056,176 @@ const SHORTHAND_INITIAL_KEYWORDS = new Map([
|
|
|
1372
2056
|
new Map([
|
|
1373
2057
|
[
|
|
1374
2058
|
"none",
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
2059
|
+
{
|
|
2060
|
+
spellings: new Set([
|
|
2061
|
+
"color()",
|
|
2062
|
+
"color-mix()",
|
|
2063
|
+
"conic-gradient()",
|
|
2064
|
+
"cross-fade()",
|
|
2065
|
+
"element()",
|
|
2066
|
+
"hsl()",
|
|
2067
|
+
"hsla()",
|
|
2068
|
+
"hwb()",
|
|
2069
|
+
"image()",
|
|
2070
|
+
"image-set()",
|
|
2071
|
+
"lab()",
|
|
2072
|
+
"lch()",
|
|
2073
|
+
"light-dark()",
|
|
2074
|
+
"linear-gradient()",
|
|
2075
|
+
"none",
|
|
2076
|
+
"oklab()",
|
|
2077
|
+
"oklch()",
|
|
2078
|
+
"paint()",
|
|
2079
|
+
"radial-gradient()",
|
|
2080
|
+
"repeating-conic-gradient()",
|
|
2081
|
+
"repeating-linear-gradient()",
|
|
2082
|
+
"repeating-radial-gradient()",
|
|
2083
|
+
"rgb()",
|
|
2084
|
+
"rgba()",
|
|
2085
|
+
"src()",
|
|
2086
|
+
"type()",
|
|
2087
|
+
"url()"
|
|
2088
|
+
]),
|
|
2089
|
+
classes: new Set()
|
|
2090
|
+
}
|
|
1404
2091
|
],
|
|
1405
2092
|
[
|
|
1406
2093
|
"repeat",
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
2094
|
+
{
|
|
2095
|
+
spellings: new Set([
|
|
2096
|
+
"no-repeat",
|
|
2097
|
+
"repeat",
|
|
2098
|
+
"repeat-x",
|
|
2099
|
+
"repeat-y",
|
|
2100
|
+
"round",
|
|
2101
|
+
"space"
|
|
2102
|
+
]),
|
|
2103
|
+
classes: new Set()
|
|
2104
|
+
}
|
|
2105
|
+
],
|
|
2106
|
+
[
|
|
2107
|
+
"scroll",
|
|
2108
|
+
{ spellings: new Set(["fixed", "local", "scroll"]), classes: new Set() }
|
|
1415
2109
|
],
|
|
1416
|
-
[
|
|
2110
|
+
[
|
|
2111
|
+
"transparent",
|
|
2112
|
+
{
|
|
2113
|
+
spellings: new Set([
|
|
2114
|
+
"color()",
|
|
2115
|
+
"color-mix()",
|
|
2116
|
+
"hsl()",
|
|
2117
|
+
"hsla()",
|
|
2118
|
+
"hwb()",
|
|
2119
|
+
"lab()",
|
|
2120
|
+
"lch()",
|
|
2121
|
+
"light-dark()",
|
|
2122
|
+
"oklab()",
|
|
2123
|
+
"oklch()",
|
|
2124
|
+
"rgb()",
|
|
2125
|
+
"rgba()"
|
|
2126
|
+
]),
|
|
2127
|
+
classes: new Set(["color"])
|
|
2128
|
+
}
|
|
2129
|
+
]
|
|
1417
2130
|
])
|
|
1418
2131
|
],
|
|
1419
2132
|
[
|
|
1420
2133
|
"border",
|
|
1421
2134
|
new Map([
|
|
2135
|
+
[
|
|
2136
|
+
"currentcolor",
|
|
2137
|
+
{
|
|
2138
|
+
spellings: new Set([
|
|
2139
|
+
"color()",
|
|
2140
|
+
"color-mix()",
|
|
2141
|
+
"hsl()",
|
|
2142
|
+
"hsla()",
|
|
2143
|
+
"hwb()",
|
|
2144
|
+
"lab()",
|
|
2145
|
+
"lch()",
|
|
2146
|
+
"light-dark()",
|
|
2147
|
+
"oklab()",
|
|
2148
|
+
"oklch()",
|
|
2149
|
+
"rgb()",
|
|
2150
|
+
"rgba()"
|
|
2151
|
+
]),
|
|
2152
|
+
classes: new Set(["color"])
|
|
2153
|
+
}
|
|
2154
|
+
],
|
|
2155
|
+
[
|
|
2156
|
+
"medium",
|
|
2157
|
+
{
|
|
2158
|
+
spellings: new Set(["medium", "thick", "thin"]),
|
|
2159
|
+
classes: new Set(["length"])
|
|
2160
|
+
}
|
|
2161
|
+
],
|
|
1422
2162
|
[
|
|
1423
2163
|
"none",
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
2164
|
+
{
|
|
2165
|
+
spellings: new Set([
|
|
2166
|
+
"dashed",
|
|
2167
|
+
"dotted",
|
|
2168
|
+
"double",
|
|
2169
|
+
"groove",
|
|
2170
|
+
"hidden",
|
|
2171
|
+
"inset",
|
|
2172
|
+
"none",
|
|
2173
|
+
"outset",
|
|
2174
|
+
"ridge",
|
|
2175
|
+
"solid"
|
|
2176
|
+
]),
|
|
2177
|
+
classes: new Set()
|
|
2178
|
+
}
|
|
1436
2179
|
]
|
|
1437
2180
|
])
|
|
1438
2181
|
],
|
|
1439
2182
|
[
|
|
1440
2183
|
"border-bottom",
|
|
1441
2184
|
new Map([
|
|
2185
|
+
[
|
|
2186
|
+
"currentcolor",
|
|
2187
|
+
{
|
|
2188
|
+
spellings: new Set([
|
|
2189
|
+
"color()",
|
|
2190
|
+
"color-mix()",
|
|
2191
|
+
"hsl()",
|
|
2192
|
+
"hsla()",
|
|
2193
|
+
"hwb()",
|
|
2194
|
+
"lab()",
|
|
2195
|
+
"lch()",
|
|
2196
|
+
"light-dark()",
|
|
2197
|
+
"oklab()",
|
|
2198
|
+
"oklch()",
|
|
2199
|
+
"rgb()",
|
|
2200
|
+
"rgba()"
|
|
2201
|
+
]),
|
|
2202
|
+
classes: new Set(["color"])
|
|
2203
|
+
}
|
|
2204
|
+
],
|
|
2205
|
+
[
|
|
2206
|
+
"medium",
|
|
2207
|
+
{
|
|
2208
|
+
spellings: new Set(["medium", "thick", "thin"]),
|
|
2209
|
+
classes: new Set(["length"])
|
|
2210
|
+
}
|
|
2211
|
+
],
|
|
1442
2212
|
[
|
|
1443
2213
|
"none",
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
2214
|
+
{
|
|
2215
|
+
spellings: new Set([
|
|
2216
|
+
"dashed",
|
|
2217
|
+
"dotted",
|
|
2218
|
+
"double",
|
|
2219
|
+
"groove",
|
|
2220
|
+
"hidden",
|
|
2221
|
+
"inset",
|
|
2222
|
+
"none",
|
|
2223
|
+
"outset",
|
|
2224
|
+
"ridge",
|
|
2225
|
+
"solid"
|
|
2226
|
+
]),
|
|
2227
|
+
classes: new Set()
|
|
2228
|
+
}
|
|
1456
2229
|
]
|
|
1457
2230
|
])
|
|
1458
2231
|
],
|
|
@@ -1461,273 +2234,550 @@ const SHORTHAND_INITIAL_KEYWORDS = new Map([
|
|
|
1461
2234
|
new Map([
|
|
1462
2235
|
[
|
|
1463
2236
|
"none",
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
2237
|
+
{
|
|
2238
|
+
spellings: new Set([
|
|
2239
|
+
"color()",
|
|
2240
|
+
"color-mix()",
|
|
2241
|
+
"conic-gradient()",
|
|
2242
|
+
"cross-fade()",
|
|
2243
|
+
"element()",
|
|
2244
|
+
"hsl()",
|
|
2245
|
+
"hsla()",
|
|
2246
|
+
"hwb()",
|
|
2247
|
+
"image()",
|
|
2248
|
+
"image-set()",
|
|
2249
|
+
"lab()",
|
|
2250
|
+
"lch()",
|
|
2251
|
+
"light-dark()",
|
|
2252
|
+
"linear-gradient()",
|
|
2253
|
+
"none",
|
|
2254
|
+
"oklab()",
|
|
2255
|
+
"oklch()",
|
|
2256
|
+
"paint()",
|
|
2257
|
+
"radial-gradient()",
|
|
2258
|
+
"repeating-conic-gradient()",
|
|
2259
|
+
"repeating-linear-gradient()",
|
|
2260
|
+
"repeating-radial-gradient()",
|
|
2261
|
+
"rgb()",
|
|
2262
|
+
"rgba()",
|
|
2263
|
+
"src()",
|
|
2264
|
+
"type()",
|
|
2265
|
+
"url()"
|
|
2266
|
+
]),
|
|
2267
|
+
classes: new Set()
|
|
2268
|
+
}
|
|
1493
2269
|
],
|
|
1494
|
-
[
|
|
2270
|
+
[
|
|
2271
|
+
"stretch",
|
|
2272
|
+
{
|
|
2273
|
+
spellings: new Set(["repeat", "round", "space", "stretch"]),
|
|
2274
|
+
classes: new Set()
|
|
2275
|
+
}
|
|
2276
|
+
]
|
|
1495
2277
|
])
|
|
1496
2278
|
],
|
|
1497
2279
|
[
|
|
1498
2280
|
"border-left",
|
|
1499
2281
|
new Map([
|
|
2282
|
+
[
|
|
2283
|
+
"currentcolor",
|
|
2284
|
+
{
|
|
2285
|
+
spellings: new Set([
|
|
2286
|
+
"color()",
|
|
2287
|
+
"color-mix()",
|
|
2288
|
+
"hsl()",
|
|
2289
|
+
"hsla()",
|
|
2290
|
+
"hwb()",
|
|
2291
|
+
"lab()",
|
|
2292
|
+
"lch()",
|
|
2293
|
+
"light-dark()",
|
|
2294
|
+
"oklab()",
|
|
2295
|
+
"oklch()",
|
|
2296
|
+
"rgb()",
|
|
2297
|
+
"rgba()"
|
|
2298
|
+
]),
|
|
2299
|
+
classes: new Set(["color"])
|
|
2300
|
+
}
|
|
2301
|
+
],
|
|
2302
|
+
[
|
|
2303
|
+
"medium",
|
|
2304
|
+
{
|
|
2305
|
+
spellings: new Set(["medium", "thick", "thin"]),
|
|
2306
|
+
classes: new Set(["length"])
|
|
2307
|
+
}
|
|
2308
|
+
],
|
|
1500
2309
|
[
|
|
1501
2310
|
"none",
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
2311
|
+
{
|
|
2312
|
+
spellings: new Set([
|
|
2313
|
+
"dashed",
|
|
2314
|
+
"dotted",
|
|
2315
|
+
"double",
|
|
2316
|
+
"groove",
|
|
2317
|
+
"hidden",
|
|
2318
|
+
"inset",
|
|
2319
|
+
"none",
|
|
2320
|
+
"outset",
|
|
2321
|
+
"ridge",
|
|
2322
|
+
"solid"
|
|
2323
|
+
]),
|
|
2324
|
+
classes: new Set()
|
|
2325
|
+
}
|
|
1514
2326
|
]
|
|
1515
2327
|
])
|
|
1516
2328
|
],
|
|
1517
2329
|
[
|
|
1518
2330
|
"border-right",
|
|
1519
2331
|
new Map([
|
|
2332
|
+
[
|
|
2333
|
+
"currentcolor",
|
|
2334
|
+
{
|
|
2335
|
+
spellings: new Set([
|
|
2336
|
+
"color()",
|
|
2337
|
+
"color-mix()",
|
|
2338
|
+
"hsl()",
|
|
2339
|
+
"hsla()",
|
|
2340
|
+
"hwb()",
|
|
2341
|
+
"lab()",
|
|
2342
|
+
"lch()",
|
|
2343
|
+
"light-dark()",
|
|
2344
|
+
"oklab()",
|
|
2345
|
+
"oklch()",
|
|
2346
|
+
"rgb()",
|
|
2347
|
+
"rgba()"
|
|
2348
|
+
]),
|
|
2349
|
+
classes: new Set(["color"])
|
|
2350
|
+
}
|
|
2351
|
+
],
|
|
2352
|
+
[
|
|
2353
|
+
"medium",
|
|
2354
|
+
{
|
|
2355
|
+
spellings: new Set(["medium", "thick", "thin"]),
|
|
2356
|
+
classes: new Set(["length"])
|
|
2357
|
+
}
|
|
2358
|
+
],
|
|
1520
2359
|
[
|
|
1521
2360
|
"none",
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
2361
|
+
{
|
|
2362
|
+
spellings: new Set([
|
|
2363
|
+
"dashed",
|
|
2364
|
+
"dotted",
|
|
2365
|
+
"double",
|
|
2366
|
+
"groove",
|
|
2367
|
+
"hidden",
|
|
2368
|
+
"inset",
|
|
2369
|
+
"none",
|
|
2370
|
+
"outset",
|
|
2371
|
+
"ridge",
|
|
2372
|
+
"solid"
|
|
2373
|
+
]),
|
|
2374
|
+
classes: new Set()
|
|
2375
|
+
}
|
|
1534
2376
|
]
|
|
1535
2377
|
])
|
|
1536
2378
|
],
|
|
1537
2379
|
[
|
|
1538
2380
|
"border-top",
|
|
1539
2381
|
new Map([
|
|
2382
|
+
[
|
|
2383
|
+
"currentcolor",
|
|
2384
|
+
{
|
|
2385
|
+
spellings: new Set([
|
|
2386
|
+
"color()",
|
|
2387
|
+
"color-mix()",
|
|
2388
|
+
"hsl()",
|
|
2389
|
+
"hsla()",
|
|
2390
|
+
"hwb()",
|
|
2391
|
+
"lab()",
|
|
2392
|
+
"lch()",
|
|
2393
|
+
"light-dark()",
|
|
2394
|
+
"oklab()",
|
|
2395
|
+
"oklch()",
|
|
2396
|
+
"rgb()",
|
|
2397
|
+
"rgba()"
|
|
2398
|
+
]),
|
|
2399
|
+
classes: new Set(["color"])
|
|
2400
|
+
}
|
|
2401
|
+
],
|
|
2402
|
+
[
|
|
2403
|
+
"medium",
|
|
2404
|
+
{
|
|
2405
|
+
spellings: new Set(["medium", "thick", "thin"]),
|
|
2406
|
+
classes: new Set(["length"])
|
|
2407
|
+
}
|
|
2408
|
+
],
|
|
1540
2409
|
[
|
|
1541
2410
|
"none",
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
2411
|
+
{
|
|
2412
|
+
spellings: new Set([
|
|
2413
|
+
"dashed",
|
|
2414
|
+
"dotted",
|
|
2415
|
+
"double",
|
|
2416
|
+
"groove",
|
|
2417
|
+
"hidden",
|
|
2418
|
+
"inset",
|
|
2419
|
+
"none",
|
|
2420
|
+
"outset",
|
|
2421
|
+
"ridge",
|
|
2422
|
+
"solid"
|
|
2423
|
+
]),
|
|
2424
|
+
classes: new Set()
|
|
2425
|
+
}
|
|
1554
2426
|
]
|
|
1555
2427
|
])
|
|
1556
2428
|
],
|
|
1557
2429
|
[
|
|
1558
2430
|
"column-rule",
|
|
1559
2431
|
new Map([
|
|
2432
|
+
[
|
|
2433
|
+
"currentcolor",
|
|
2434
|
+
{
|
|
2435
|
+
spellings: new Set([
|
|
2436
|
+
"color()",
|
|
2437
|
+
"color-mix()",
|
|
2438
|
+
"hsl()",
|
|
2439
|
+
"hsla()",
|
|
2440
|
+
"hwb()",
|
|
2441
|
+
"lab()",
|
|
2442
|
+
"lch()",
|
|
2443
|
+
"light-dark()",
|
|
2444
|
+
"oklab()",
|
|
2445
|
+
"oklch()",
|
|
2446
|
+
"rgb()",
|
|
2447
|
+
"rgba()"
|
|
2448
|
+
]),
|
|
2449
|
+
classes: new Set(["color"])
|
|
2450
|
+
}
|
|
2451
|
+
],
|
|
2452
|
+
[
|
|
2453
|
+
"medium",
|
|
2454
|
+
{
|
|
2455
|
+
spellings: new Set(["medium", "thick", "thin"]),
|
|
2456
|
+
classes: new Set(["length"])
|
|
2457
|
+
}
|
|
2458
|
+
],
|
|
1560
2459
|
[
|
|
1561
2460
|
"none",
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
2461
|
+
{
|
|
2462
|
+
spellings: new Set([
|
|
2463
|
+
"dashed",
|
|
2464
|
+
"dotted",
|
|
2465
|
+
"double",
|
|
2466
|
+
"groove",
|
|
2467
|
+
"hidden",
|
|
2468
|
+
"inset",
|
|
2469
|
+
"none",
|
|
2470
|
+
"outset",
|
|
2471
|
+
"ridge",
|
|
2472
|
+
"solid"
|
|
2473
|
+
]),
|
|
2474
|
+
classes: new Set()
|
|
2475
|
+
}
|
|
1574
2476
|
]
|
|
1575
2477
|
])
|
|
1576
2478
|
],
|
|
1577
2479
|
[
|
|
1578
2480
|
"flex-flow",
|
|
1579
2481
|
new Map([
|
|
1580
|
-
[
|
|
1581
|
-
|
|
2482
|
+
[
|
|
2483
|
+
"nowrap",
|
|
2484
|
+
{
|
|
2485
|
+
spellings: new Set(["balance", "nowrap", "wrap", "wrap-reverse"]),
|
|
2486
|
+
classes: new Set()
|
|
2487
|
+
}
|
|
2488
|
+
],
|
|
2489
|
+
[
|
|
2490
|
+
"row",
|
|
2491
|
+
{
|
|
2492
|
+
spellings: new Set([
|
|
2493
|
+
"column",
|
|
2494
|
+
"column-reverse",
|
|
2495
|
+
"row",
|
|
2496
|
+
"row-reverse"
|
|
2497
|
+
]),
|
|
2498
|
+
classes: new Set()
|
|
2499
|
+
}
|
|
2500
|
+
]
|
|
2501
|
+
])
|
|
2502
|
+
],
|
|
2503
|
+
[
|
|
2504
|
+
"list-style",
|
|
2505
|
+
new Map([
|
|
2506
|
+
[
|
|
2507
|
+
"outside",
|
|
2508
|
+
{ spellings: new Set(["inside", "outside"]), classes: new Set() }
|
|
2509
|
+
]
|
|
1582
2510
|
])
|
|
1583
2511
|
],
|
|
1584
|
-
["list-style", new Map([["outside", new Set(["inside", "outside"])]])],
|
|
1585
2512
|
[
|
|
1586
2513
|
"mask",
|
|
1587
2514
|
new Map([
|
|
1588
|
-
[
|
|
1589
|
-
|
|
2515
|
+
[
|
|
2516
|
+
"add",
|
|
2517
|
+
{
|
|
2518
|
+
spellings: new Set(["add", "exclude", "intersect", "subtract"]),
|
|
2519
|
+
classes: new Set()
|
|
2520
|
+
}
|
|
2521
|
+
],
|
|
2522
|
+
[
|
|
2523
|
+
"match-source",
|
|
2524
|
+
{
|
|
2525
|
+
spellings: new Set(["alpha", "luminance", "match-source"]),
|
|
2526
|
+
classes: new Set()
|
|
2527
|
+
}
|
|
2528
|
+
],
|
|
1590
2529
|
[
|
|
1591
2530
|
"none",
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
2531
|
+
{
|
|
2532
|
+
spellings: new Set([
|
|
2533
|
+
"color()",
|
|
2534
|
+
"color-mix()",
|
|
2535
|
+
"conic-gradient()",
|
|
2536
|
+
"cross-fade()",
|
|
2537
|
+
"element()",
|
|
2538
|
+
"hsl()",
|
|
2539
|
+
"hsla()",
|
|
2540
|
+
"hwb()",
|
|
2541
|
+
"image()",
|
|
2542
|
+
"image-set()",
|
|
2543
|
+
"lab()",
|
|
2544
|
+
"lch()",
|
|
2545
|
+
"light-dark()",
|
|
2546
|
+
"linear-gradient()",
|
|
2547
|
+
"none",
|
|
2548
|
+
"oklab()",
|
|
2549
|
+
"oklch()",
|
|
2550
|
+
"paint()",
|
|
2551
|
+
"radial-gradient()",
|
|
2552
|
+
"repeating-conic-gradient()",
|
|
2553
|
+
"repeating-linear-gradient()",
|
|
2554
|
+
"repeating-radial-gradient()",
|
|
2555
|
+
"rgb()",
|
|
2556
|
+
"rgba()",
|
|
2557
|
+
"src()",
|
|
2558
|
+
"type()",
|
|
2559
|
+
"url()"
|
|
2560
|
+
]),
|
|
2561
|
+
classes: new Set()
|
|
2562
|
+
}
|
|
1621
2563
|
],
|
|
1622
2564
|
[
|
|
1623
2565
|
"repeat",
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
2566
|
+
{
|
|
2567
|
+
spellings: new Set([
|
|
2568
|
+
"no-repeat",
|
|
2569
|
+
"repeat",
|
|
2570
|
+
"repeat-x",
|
|
2571
|
+
"repeat-y",
|
|
2572
|
+
"round",
|
|
2573
|
+
"space"
|
|
2574
|
+
]),
|
|
2575
|
+
classes: new Set()
|
|
2576
|
+
}
|
|
1632
2577
|
]
|
|
1633
2578
|
])
|
|
1634
2579
|
],
|
|
1635
2580
|
[
|
|
1636
2581
|
"mask-border",
|
|
1637
2582
|
new Map([
|
|
1638
|
-
[
|
|
2583
|
+
[
|
|
2584
|
+
"alpha",
|
|
2585
|
+
{ spellings: new Set(["alpha", "luminance"]), classes: new Set() }
|
|
2586
|
+
],
|
|
2587
|
+
[
|
|
2588
|
+
"none",
|
|
2589
|
+
{
|
|
2590
|
+
spellings: new Set([
|
|
2591
|
+
"color()",
|
|
2592
|
+
"color-mix()",
|
|
2593
|
+
"conic-gradient()",
|
|
2594
|
+
"cross-fade()",
|
|
2595
|
+
"element()",
|
|
2596
|
+
"hsl()",
|
|
2597
|
+
"hsla()",
|
|
2598
|
+
"hwb()",
|
|
2599
|
+
"image()",
|
|
2600
|
+
"image-set()",
|
|
2601
|
+
"lab()",
|
|
2602
|
+
"lch()",
|
|
2603
|
+
"light-dark()",
|
|
2604
|
+
"linear-gradient()",
|
|
2605
|
+
"none",
|
|
2606
|
+
"oklab()",
|
|
2607
|
+
"oklch()",
|
|
2608
|
+
"paint()",
|
|
2609
|
+
"radial-gradient()",
|
|
2610
|
+
"repeating-conic-gradient()",
|
|
2611
|
+
"repeating-linear-gradient()",
|
|
2612
|
+
"repeating-radial-gradient()",
|
|
2613
|
+
"rgb()",
|
|
2614
|
+
"rgba()",
|
|
2615
|
+
"src()",
|
|
2616
|
+
"type()",
|
|
2617
|
+
"url()"
|
|
2618
|
+
]),
|
|
2619
|
+
classes: new Set()
|
|
2620
|
+
}
|
|
2621
|
+
],
|
|
2622
|
+
[
|
|
2623
|
+
"stretch",
|
|
2624
|
+
{
|
|
2625
|
+
spellings: new Set(["repeat", "round", "space", "stretch"]),
|
|
2626
|
+
classes: new Set()
|
|
2627
|
+
}
|
|
2628
|
+
]
|
|
2629
|
+
])
|
|
2630
|
+
],
|
|
2631
|
+
[
|
|
2632
|
+
"outline",
|
|
2633
|
+
new Map([
|
|
2634
|
+
[
|
|
2635
|
+
"medium",
|
|
2636
|
+
{
|
|
2637
|
+
spellings: new Set(["medium", "thick", "thin"]),
|
|
2638
|
+
classes: new Set(["length"])
|
|
2639
|
+
}
|
|
2640
|
+
],
|
|
1639
2641
|
[
|
|
1640
2642
|
"none",
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
"oklab()",
|
|
1658
|
-
"oklch()",
|
|
1659
|
-
"paint()",
|
|
1660
|
-
"radial-gradient()",
|
|
1661
|
-
"repeating-conic-gradient()",
|
|
1662
|
-
"repeating-linear-gradient()",
|
|
1663
|
-
"repeating-radial-gradient()",
|
|
1664
|
-
"rgb()",
|
|
1665
|
-
"rgba()",
|
|
1666
|
-
"src()",
|
|
1667
|
-
"type()",
|
|
1668
|
-
"url()"
|
|
1669
|
-
])
|
|
1670
|
-
],
|
|
1671
|
-
["stretch", new Set(["repeat", "round", "space", "stretch"])]
|
|
2643
|
+
{
|
|
2644
|
+
spellings: new Set([
|
|
2645
|
+
"auto",
|
|
2646
|
+
"dashed",
|
|
2647
|
+
"dotted",
|
|
2648
|
+
"double",
|
|
2649
|
+
"groove",
|
|
2650
|
+
"inset",
|
|
2651
|
+
"none",
|
|
2652
|
+
"outset",
|
|
2653
|
+
"ridge",
|
|
2654
|
+
"solid"
|
|
2655
|
+
]),
|
|
2656
|
+
classes: new Set()
|
|
2657
|
+
}
|
|
2658
|
+
]
|
|
1672
2659
|
])
|
|
1673
2660
|
],
|
|
1674
2661
|
[
|
|
1675
|
-
"
|
|
2662
|
+
"text-decoration",
|
|
1676
2663
|
new Map([
|
|
2664
|
+
[
|
|
2665
|
+
"currentcolor",
|
|
2666
|
+
{
|
|
2667
|
+
spellings: new Set([
|
|
2668
|
+
"color()",
|
|
2669
|
+
"color-mix()",
|
|
2670
|
+
"hsl()",
|
|
2671
|
+
"hsla()",
|
|
2672
|
+
"hwb()",
|
|
2673
|
+
"lab()",
|
|
2674
|
+
"lch()",
|
|
2675
|
+
"light-dark()",
|
|
2676
|
+
"oklab()",
|
|
2677
|
+
"oklch()",
|
|
2678
|
+
"rgb()",
|
|
2679
|
+
"rgba()"
|
|
2680
|
+
]),
|
|
2681
|
+
classes: new Set(["color"])
|
|
2682
|
+
}
|
|
2683
|
+
],
|
|
1677
2684
|
[
|
|
1678
2685
|
"none",
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
2686
|
+
{
|
|
2687
|
+
spellings: new Set([
|
|
2688
|
+
"blink",
|
|
2689
|
+
"grammar-error",
|
|
2690
|
+
"line-through",
|
|
2691
|
+
"none",
|
|
2692
|
+
"overline",
|
|
2693
|
+
"spelling-error",
|
|
2694
|
+
"underline"
|
|
2695
|
+
]),
|
|
2696
|
+
classes: new Set()
|
|
2697
|
+
}
|
|
2698
|
+
],
|
|
2699
|
+
[
|
|
2700
|
+
"solid",
|
|
2701
|
+
{
|
|
2702
|
+
spellings: new Set(["dashed", "dotted", "double", "solid", "wavy"]),
|
|
2703
|
+
classes: new Set()
|
|
2704
|
+
}
|
|
1691
2705
|
]
|
|
1692
2706
|
])
|
|
1693
2707
|
],
|
|
1694
2708
|
[
|
|
1695
|
-
"text-
|
|
2709
|
+
"text-emphasis",
|
|
1696
2710
|
new Map([
|
|
1697
2711
|
[
|
|
1698
|
-
"
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
2712
|
+
"currentcolor",
|
|
2713
|
+
{
|
|
2714
|
+
spellings: new Set([
|
|
2715
|
+
"color()",
|
|
2716
|
+
"color-mix()",
|
|
2717
|
+
"hsl()",
|
|
2718
|
+
"hsla()",
|
|
2719
|
+
"hwb()",
|
|
2720
|
+
"lab()",
|
|
2721
|
+
"lch()",
|
|
2722
|
+
"light-dark()",
|
|
2723
|
+
"oklab()",
|
|
2724
|
+
"oklch()",
|
|
2725
|
+
"rgb()",
|
|
2726
|
+
"rgba()"
|
|
2727
|
+
]),
|
|
2728
|
+
classes: new Set(["color"])
|
|
2729
|
+
}
|
|
1708
2730
|
],
|
|
1709
|
-
[
|
|
2731
|
+
[
|
|
2732
|
+
"none",
|
|
2733
|
+
{
|
|
2734
|
+
spellings: new Set([
|
|
2735
|
+
"circle",
|
|
2736
|
+
"dot",
|
|
2737
|
+
"double-circle",
|
|
2738
|
+
"filled",
|
|
2739
|
+
"none",
|
|
2740
|
+
"open",
|
|
2741
|
+
"sesame",
|
|
2742
|
+
"triangle"
|
|
2743
|
+
]),
|
|
2744
|
+
classes: new Set(["string"])
|
|
2745
|
+
}
|
|
2746
|
+
]
|
|
1710
2747
|
])
|
|
1711
2748
|
],
|
|
1712
2749
|
[
|
|
1713
2750
|
"transition",
|
|
1714
2751
|
new Map([
|
|
2752
|
+
[
|
|
2753
|
+
"all",
|
|
2754
|
+
{
|
|
2755
|
+
spellings: new Set(["all", "none"]),
|
|
2756
|
+
classes: new Set(["custom-ident"])
|
|
2757
|
+
}
|
|
2758
|
+
],
|
|
1715
2759
|
[
|
|
1716
2760
|
"ease",
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
2761
|
+
{
|
|
2762
|
+
spellings: new Set([
|
|
2763
|
+
"cubic-bezier()",
|
|
2764
|
+
"ease",
|
|
2765
|
+
"ease-in",
|
|
2766
|
+
"ease-in-out",
|
|
2767
|
+
"ease-out",
|
|
2768
|
+
"linear",
|
|
2769
|
+
"linear()",
|
|
2770
|
+
"step-end",
|
|
2771
|
+
"step-start",
|
|
2772
|
+
"steps()"
|
|
2773
|
+
]),
|
|
2774
|
+
classes: new Set()
|
|
2775
|
+
}
|
|
1729
2776
|
],
|
|
1730
|
-
[
|
|
2777
|
+
[
|
|
2778
|
+
"normal",
|
|
2779
|
+
{ spellings: new Set(["allow-discrete", "normal"]), classes: new Set() }
|
|
2780
|
+
]
|
|
1731
2781
|
])
|
|
1732
2782
|
]
|
|
1733
2783
|
]);
|
|
@@ -2492,137 +3542,1147 @@ const CUBIC_BEZIER_KEYWORDS = new Map([
|
|
|
2492
3542
|
["0.42,0,0.58,1", "ease-in-out"]
|
|
2493
3543
|
]);
|
|
2494
3544
|
|
|
2495
|
-
// The two `flex` values CSS Flexbox 7.1.1 gives a keyword spelling.
|
|
2496
|
-
const FLEX_KEYWORDS = new Map([
|
|
2497
|
-
["0 0 auto", "none"],
|
|
2498
|
-
["1 1 auto", "auto"]
|
|
2499
|
-
]);
|
|
3545
|
+
// The two `flex` values CSS Flexbox 7.1.1 gives a keyword spelling.
|
|
3546
|
+
const FLEX_KEYWORDS = new Map([
|
|
3547
|
+
["0 0 auto", "none"],
|
|
3548
|
+
["1 1 auto", "auto"]
|
|
3549
|
+
]);
|
|
3550
|
+
|
|
3551
|
+
// The `font-weight` keywords CSS Fonts 4 §2.2 defines as a number, which is what
|
|
3552
|
+
// `getComputedStyle().fontWeight` reports either way.
|
|
3553
|
+
const FONT_WEIGHT_NUMBERS = new Map([
|
|
3554
|
+
["normal", "400"],
|
|
3555
|
+
["bold", "700"]
|
|
3556
|
+
]);
|
|
3557
|
+
|
|
3558
|
+
// Selectors 4 §3.3: the pseudo-elements engines must also accept with one colon,
|
|
3559
|
+
// so their second colon carries nothing.
|
|
3560
|
+
const LEGACY_PSEUDO_ELEMENTS = new Set([
|
|
3561
|
+
"before",
|
|
3562
|
+
"after",
|
|
3563
|
+
"first-line",
|
|
3564
|
+
"first-letter"
|
|
3565
|
+
]);
|
|
3566
|
+
|
|
3567
|
+
// What may follow the `*` a compound selector implies: another simple selector
|
|
3568
|
+
// in the same compound. A separator between them would be a descendant
|
|
3569
|
+
// combinator instead, and `|` makes the `*` a namespace's, not a redundant one.
|
|
3570
|
+
const COMPOUND_CONTINUATIONS = new Set([":", ".", "#", "["]);
|
|
3571
|
+
|
|
3572
|
+
// The pseudo-classes selecting a featureless element, which matches no type or
|
|
3573
|
+
// universal selector — so an implied `*` before one is what makes the selector
|
|
3574
|
+
// match nothing, and dropping it would bring the rule to life.
|
|
3575
|
+
const FEATURELESS_PSEUDO_CLASSES = new Set(["host", "host-context"]);
|
|
3576
|
+
|
|
3577
|
+
// The properties whose zero length keeps its unit: those whose own grammar
|
|
3578
|
+
// offers a bare number beside the length, so the unit is what picks the
|
|
3579
|
+
// reading, and the two an engine reads its own way.
|
|
3580
|
+
const ZERO_UNIT_KEEPING_PROPERTIES = new Set([
|
|
3581
|
+
"border-image",
|
|
3582
|
+
"border-image-outset",
|
|
3583
|
+
"border-image-width",
|
|
3584
|
+
"columns",
|
|
3585
|
+
"flex",
|
|
3586
|
+
"flex-basis",
|
|
3587
|
+
"font",
|
|
3588
|
+
"line-height",
|
|
3589
|
+
"mask-border",
|
|
3590
|
+
"mask-border-outset",
|
|
3591
|
+
"mask-border-width",
|
|
3592
|
+
"overflow-clip-margin",
|
|
3593
|
+
"stroke-dasharray",
|
|
3594
|
+
"stroke-dashoffset",
|
|
3595
|
+
"stroke-width",
|
|
3596
|
+
"tab-size"
|
|
3597
|
+
]);
|
|
3598
|
+
|
|
3599
|
+
// The properties an engine takes no `calc()` in, so one stays as written
|
|
3600
|
+
// rather than folding to the value it equals.
|
|
3601
|
+
const CALC_REJECTING_PROPERTIES = new Set(["overflow-clip-margin"]);
|
|
3602
|
+
|
|
3603
|
+
// The range a `calc()` is clamped to where the literal outside it is invalid,
|
|
3604
|
+
// keyed by property: `[unit, min, max]`.
|
|
3605
|
+
/** @type {Map<string, [string, number, number]>} */
|
|
3606
|
+
const CLAMPED_VALUE_RANGES = new Map([["font-style", ["deg", -90, 90]]]);
|
|
3607
|
+
|
|
3608
|
+
// At-rules whose empty block is inert, so dropping it changes nothing.
|
|
3609
|
+
const DROPPABLE_WHEN_EMPTY_AT_RULES = new Set([
|
|
3610
|
+
"media",
|
|
3611
|
+
"supports",
|
|
3612
|
+
"container"
|
|
3613
|
+
]);
|
|
3614
|
+
|
|
3615
|
+
// At-rules whose block holds rules and whose prelude states a condition, so two
|
|
3616
|
+
// adjacent blocks with the same prelude are the one block they resolve to.
|
|
3617
|
+
const MERGEABLE_AT_RULES = new Set([
|
|
3618
|
+
"container",
|
|
3619
|
+
"document",
|
|
3620
|
+
"layer",
|
|
3621
|
+
"media",
|
|
3622
|
+
"scope",
|
|
3623
|
+
"starting-style",
|
|
3624
|
+
"supports"
|
|
3625
|
+
]);
|
|
3626
|
+
|
|
3627
|
+
// The math functions whose result steps with their arguments, so a value inside
|
|
3628
|
+
// one keeps the unit and the digits it was written with.
|
|
3629
|
+
const STEPPED_FUNCTIONS = new Set(["mod", "rem", "round"]);
|
|
3630
|
+
|
|
3631
|
+
// The units fixed against each other (CSS Values 4 §6.2, §8), as
|
|
3632
|
+
// `unit -> [group, how many of the group's base unit one is]`. Two units in the
|
|
3633
|
+
// same group convert into each other exactly when the ratio is binary-exact.
|
|
3634
|
+
/** @type {Map<string, [string, number]>} */
|
|
3635
|
+
const ABSOLUTE_UNIT_SCALE = new Map([
|
|
3636
|
+
["px", ["length", 381]],
|
|
3637
|
+
["pc", ["length", 6096]],
|
|
3638
|
+
["pt", ["length", 508]],
|
|
3639
|
+
["in", ["length", 36576]],
|
|
3640
|
+
["cm", ["length", 14400]],
|
|
3641
|
+
["mm", ["length", 1440]],
|
|
3642
|
+
["q", ["length", 360]],
|
|
3643
|
+
["ms", ["time", 1]],
|
|
3644
|
+
["s", ["time", 1000]]
|
|
3645
|
+
]);
|
|
3646
|
+
|
|
3647
|
+
// Each convertible group's reference unit, as `group -> [unit, scale]`. A sum
|
|
3648
|
+
// counted in the group's base unit divides by the scale to get back to a unit
|
|
3649
|
+
// that can be written down.
|
|
3650
|
+
/** @type {Map<string, [string, number]>} */
|
|
3651
|
+
const UNIT_GROUP_BASE = new Map([
|
|
3652
|
+
["length", ["px", 381]],
|
|
3653
|
+
["time", ["ms", 1]]
|
|
3654
|
+
]);
|
|
3655
|
+
|
|
3656
|
+
// The units a conversion may emit. Every one is CSS 2.1's, so rewriting into it
|
|
3657
|
+
// cannot outrun what an engine reading the stylesheet already parses.
|
|
3658
|
+
const UNIT_CONVERSION_TARGETS = new Set([
|
|
3659
|
+
"px",
|
|
3660
|
+
"pc",
|
|
3661
|
+
"pt",
|
|
3662
|
+
"in",
|
|
3663
|
+
"cm",
|
|
3664
|
+
"mm",
|
|
3665
|
+
"ms",
|
|
3666
|
+
"s"
|
|
3667
|
+
]);
|
|
3668
|
+
|
|
3669
|
+
// How each predefined color space is read back to sRGB: the matrix taking its
|
|
3670
|
+
// linear-light components to linear-light sRGB, and the function that reads one
|
|
3671
|
+
// stored component back to linear light. Both derived from the primaries,
|
|
3672
|
+
// white point and transfer function CSS Color 4 §10 states.
|
|
3673
|
+
/**
|
|
3674
|
+
* A component already stored linearly.
|
|
3675
|
+
* @param {number} c the stored component
|
|
3676
|
+
* @returns {number} the same component
|
|
3677
|
+
*/
|
|
3678
|
+
const linearTransfer = (c) => c;
|
|
3679
|
+
|
|
3680
|
+
/**
|
|
3681
|
+
* The sRGB transfer function, which Display P3 shares.
|
|
3682
|
+
* @param {number} c the stored component
|
|
3683
|
+
* @returns {number} the linear-light component
|
|
3684
|
+
*/
|
|
3685
|
+
const srgbTransfer = (c) => {
|
|
3686
|
+
const abs = Math.abs(c);
|
|
3687
|
+
const sign = c < 0 ? -1 : 1;
|
|
3688
|
+
return abs <= 0.04045 ? c / 12.92 : sign * ((abs + 0.055) / 1.055) ** 2.4;
|
|
3689
|
+
};
|
|
3690
|
+
|
|
3691
|
+
/**
|
|
3692
|
+
* Adobe RGB (1998)'s pure gamma of 563/256.
|
|
3693
|
+
* @param {number} c the stored component
|
|
3694
|
+
* @returns {number} the linear-light component
|
|
3695
|
+
*/
|
|
3696
|
+
const a98Transfer = (c) => {
|
|
3697
|
+
const sign = c < 0 ? -1 : 1;
|
|
3698
|
+
return sign * Math.abs(c) ** (563 / 256);
|
|
3699
|
+
};
|
|
3700
|
+
|
|
3701
|
+
/**
|
|
3702
|
+
* ProPhoto RGB's gamma of 1.8, with the linear segment below 16/512.
|
|
3703
|
+
* @param {number} c the stored component
|
|
3704
|
+
* @returns {number} the linear-light component
|
|
3705
|
+
*/
|
|
3706
|
+
const prophotoTransfer = (c) => {
|
|
3707
|
+
const abs = Math.abs(c);
|
|
3708
|
+
const sign = c < 0 ? -1 : 1;
|
|
3709
|
+
return abs <= 16 / 512 ? c / 16 : sign * abs ** 1.8;
|
|
3710
|
+
};
|
|
3711
|
+
|
|
3712
|
+
/**
|
|
3713
|
+
* Rec. 2020's transfer function, with the constants ITU-R BT.2020 states.
|
|
3714
|
+
* @param {number} c the stored component
|
|
3715
|
+
* @returns {number} the linear-light component
|
|
3716
|
+
*/
|
|
3717
|
+
const rec2020Transfer = (c) => {
|
|
3718
|
+
const alpha = 1.09929682680944;
|
|
3719
|
+
const beta = 0.018053968510807;
|
|
3720
|
+
const abs = Math.abs(c);
|
|
3721
|
+
const sign = c < 0 ? -1 : 1;
|
|
3722
|
+
return abs < beta * 4.5
|
|
3723
|
+
? c / 4.5
|
|
3724
|
+
: sign * ((abs + alpha - 1) / alpha) ** (1 / 0.45);
|
|
3725
|
+
};
|
|
3726
|
+
|
|
3727
|
+
// What a color read in one space passes through on its way to a byte: nothing at
|
|
3728
|
+
// all, the sRGB transfer, or a matrix as well. `lib/css/syntax.js` reads how far
|
|
3729
|
+
// its answer can sit from an engine's from this.
|
|
3730
|
+
const ENCODED_ALREADY = 0;
|
|
3731
|
+
const THROUGH_TRANSFER = 1;
|
|
3732
|
+
const THROUGH_MATRIX = 2;
|
|
3733
|
+
const ENGINE_TRANSFER_DIFFERS = 3;
|
|
3734
|
+
|
|
3735
|
+
/** @type {Map<string, { toSrgb: number[], transfer: (c: number) => number, conversion: number }>} */
|
|
3736
|
+
const PREDEFINED_COLOR_SPACES = new Map([
|
|
3737
|
+
[
|
|
3738
|
+
"srgb",
|
|
3739
|
+
{
|
|
3740
|
+
toSrgb: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
3741
|
+
transfer: srgbTransfer,
|
|
3742
|
+
conversion: 0
|
|
3743
|
+
}
|
|
3744
|
+
],
|
|
3745
|
+
[
|
|
3746
|
+
"srgb-linear",
|
|
3747
|
+
{
|
|
3748
|
+
toSrgb: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
3749
|
+
transfer: linearTransfer,
|
|
3750
|
+
conversion: 1
|
|
3751
|
+
}
|
|
3752
|
+
],
|
|
3753
|
+
[
|
|
3754
|
+
"display-p3",
|
|
3755
|
+
{
|
|
3756
|
+
toSrgb: [
|
|
3757
|
+
1.2249401762805596, -0.22494017628055984, 0, -0.04205695470968812,
|
|
3758
|
+
1.042056954709688, -2.0816681711721685e-17, -0.019637554590334425,
|
|
3759
|
+
-0.0786360455506318, 1.0982736001409665
|
|
3760
|
+
],
|
|
3761
|
+
transfer: srgbTransfer,
|
|
3762
|
+
conversion: 2
|
|
3763
|
+
}
|
|
3764
|
+
],
|
|
3765
|
+
[
|
|
3766
|
+
"a98-rgb",
|
|
3767
|
+
{
|
|
3768
|
+
toSrgb: [
|
|
3769
|
+
1.3983557439607786, -0.39835574396077855, 5.551115123125783e-17,
|
|
3770
|
+
-1.4072944198861848e-16, 1, -2.0816681711721685e-17,
|
|
3771
|
+
1.734723475976807e-17, -0.04292898929447317, 1.042928989294473
|
|
3772
|
+
],
|
|
3773
|
+
transfer: a98Transfer,
|
|
3774
|
+
conversion: 3
|
|
3775
|
+
}
|
|
3776
|
+
],
|
|
3777
|
+
[
|
|
3778
|
+
"prophoto-rgb",
|
|
3779
|
+
{
|
|
3780
|
+
toSrgb: [
|
|
3781
|
+
2.034380836302867, -0.7276360137172471, -0.3067448320015419,
|
|
3782
|
+
-0.228825697964331, 1.2317426727787788, -0.0029169277200310345,
|
|
3783
|
+
-0.008558858080647581, -0.15326675125999153, 1.161825549670178
|
|
3784
|
+
],
|
|
3785
|
+
transfer: prophotoTransfer,
|
|
3786
|
+
conversion: 3
|
|
3787
|
+
}
|
|
3788
|
+
],
|
|
3789
|
+
[
|
|
3790
|
+
"rec2020",
|
|
3791
|
+
{
|
|
3792
|
+
toSrgb: [
|
|
3793
|
+
1.6604910021084347, -0.5876411387885495, -0.07284986331988486,
|
|
3794
|
+
-0.12455047452159063, 1.1328998971259596, -0.008349422604369508,
|
|
3795
|
+
-0.018150763354905206, -0.10057889800800737, 1.1187296613629127
|
|
3796
|
+
],
|
|
3797
|
+
transfer: rec2020Transfer,
|
|
3798
|
+
conversion: 2
|
|
3799
|
+
}
|
|
3800
|
+
],
|
|
3801
|
+
[
|
|
3802
|
+
"xyz",
|
|
3803
|
+
{
|
|
3804
|
+
toSrgb: [
|
|
3805
|
+
3.2409699419045226, -1.537383177570094, -0.4986107602930034,
|
|
3806
|
+
-0.9692436362808796, 1.8759675015077202, 0.04155505740717559,
|
|
3807
|
+
0.05563007969699366, -0.20397695888897652, 1.0569715142428786
|
|
3808
|
+
],
|
|
3809
|
+
transfer: linearTransfer,
|
|
3810
|
+
conversion: 2
|
|
3811
|
+
}
|
|
3812
|
+
],
|
|
3813
|
+
[
|
|
3814
|
+
"xyz-d65",
|
|
3815
|
+
{
|
|
3816
|
+
toSrgb: [
|
|
3817
|
+
3.2409699419045226, -1.537383177570094, -0.4986107602930034,
|
|
3818
|
+
-0.9692436362808796, 1.8759675015077202, 0.04155505740717559,
|
|
3819
|
+
0.05563007969699366, -0.20397695888897652, 1.0569715142428786
|
|
3820
|
+
],
|
|
3821
|
+
transfer: linearTransfer,
|
|
3822
|
+
conversion: 2
|
|
3823
|
+
}
|
|
3824
|
+
],
|
|
3825
|
+
[
|
|
3826
|
+
"xyz-d50",
|
|
3827
|
+
{
|
|
3828
|
+
toSrgb: [
|
|
3829
|
+
3.1341359569958707, -1.6173863321612538, -0.4906619460083532,
|
|
3830
|
+
-0.978795502912089, 1.9162545672595237, 0.03344273116131948,
|
|
3831
|
+
0.07195537988411684, -0.22897682641583222, 1.4053860583241256
|
|
3832
|
+
],
|
|
3833
|
+
transfer: linearTransfer,
|
|
3834
|
+
conversion: 2
|
|
3835
|
+
}
|
|
3836
|
+
]
|
|
3837
|
+
]);
|
|
3838
|
+
|
|
3839
|
+
// Linear-light sRGB -> linear-light Display P3, the inverse of the matrix above
|
|
3840
|
+
// it: a color outside sRGB keeps its gamut in a `color(display-p3 …)` fallback
|
|
3841
|
+
// wherever the target reads one.
|
|
3842
|
+
const LINEAR_SRGB_TO_P3 = [
|
|
3843
|
+
0.8224619687143625, 0.17753803128563775, 3.3650564745655794e-18,
|
|
3844
|
+
0.0331941988509616, 0.9668058011490385, 1.8324840583423322e-17,
|
|
3845
|
+
0.017082630721120023, 0.07239744066396339, 0.9105199286149164
|
|
3846
|
+
];
|
|
3847
|
+
|
|
3848
|
+
// The interpolation spaces a `color-mix()` or a relative color is read in, each
|
|
3849
|
+
// as the pair taking linear-light sRGB to its components and back, and which
|
|
3850
|
+
// component is an angle (`-1` for none). Every one derived from the primaries,
|
|
3851
|
+
// matrices and definitions the generator states.
|
|
3852
|
+
/**
|
|
3853
|
+
* A 3x3 matrix, laid out row by row, times a column.
|
|
3854
|
+
* @param {number[]} m the matrix
|
|
3855
|
+
* @param {number[]} c the column
|
|
3856
|
+
* @returns {number[]} the product
|
|
3857
|
+
*/
|
|
3858
|
+
const applyModel = (m, c) =>
|
|
3859
|
+
[0, 3, 6].map((row) => m[row] * c[0] + m[row + 1] * c[1] + m[row + 2] * c[2]);
|
|
3860
|
+
|
|
3861
|
+
/**
|
|
3862
|
+
* @param {number} c a linear component
|
|
3863
|
+
* @returns {number} the same component
|
|
3864
|
+
*/
|
|
3865
|
+
const linearEncode = (c) => c;
|
|
3866
|
+
|
|
3867
|
+
/**
|
|
3868
|
+
* @param {number} c a linear component
|
|
3869
|
+
* @returns {number} the sRGB-encoded component
|
|
3870
|
+
*/
|
|
3871
|
+
const srgbEncode = (c) => {
|
|
3872
|
+
const abs = Math.abs(c);
|
|
3873
|
+
const sign = c < 0 ? -1 : 1;
|
|
3874
|
+
return abs > 0.0031308
|
|
3875
|
+
? sign * (1.055 * abs ** (1 / 2.4) - 0.055)
|
|
3876
|
+
: 12.92 * c;
|
|
3877
|
+
};
|
|
3878
|
+
|
|
3879
|
+
/**
|
|
3880
|
+
* @param {number} c a linear component
|
|
3881
|
+
* @returns {number} the Adobe RGB (1998) component
|
|
3882
|
+
*/
|
|
3883
|
+
const a98Encode = (c) => {
|
|
3884
|
+
const sign = c < 0 ? -1 : 1;
|
|
3885
|
+
return sign * Math.abs(c) ** (256 / 563);
|
|
3886
|
+
};
|
|
3887
|
+
|
|
3888
|
+
/**
|
|
3889
|
+
* @param {number} c a linear component
|
|
3890
|
+
* @returns {number} the ProPhoto RGB component
|
|
3891
|
+
*/
|
|
3892
|
+
const prophotoEncode = (c) => {
|
|
3893
|
+
const abs = Math.abs(c);
|
|
3894
|
+
const sign = c < 0 ? -1 : 1;
|
|
3895
|
+
return abs >= 1 / 512 ? sign * abs ** (1 / 1.8) : 16 * c;
|
|
3896
|
+
};
|
|
3897
|
+
|
|
3898
|
+
/**
|
|
3899
|
+
* @param {number} c a linear component
|
|
3900
|
+
* @returns {number} the Rec. 2020 component
|
|
3901
|
+
*/
|
|
3902
|
+
const rec2020Encode = (c) => {
|
|
3903
|
+
const alpha = 1.09929682680944;
|
|
3904
|
+
const beta = 0.018053968510807;
|
|
3905
|
+
const abs = Math.abs(c);
|
|
3906
|
+
const sign = c < 0 ? -1 : 1;
|
|
3907
|
+
return abs > beta ? sign * (alpha * abs ** 0.45 - (alpha - 1)) : 4.5 * c;
|
|
3908
|
+
};
|
|
3909
|
+
|
|
3910
|
+
// The D50 white point Lab is defined against (CSS Color 4 §12), as XYZ.
|
|
3911
|
+
const LAB_WHITE = [0.3457 / 0.3585, 1, (1 - 0.3457 - 0.3585) / 0.3585];
|
|
3912
|
+
const LAB_EPSILON = 216 / 24389;
|
|
3913
|
+
const LAB_KAPPA = 24389 / 27;
|
|
3914
|
+
|
|
3915
|
+
/**
|
|
3916
|
+
* Linear-light sRGB -> CIE Lab, through XYZ at Lab's own white point.
|
|
3917
|
+
* @param {number[]} c the linear-light components
|
|
3918
|
+
* @returns {number[]} `[L, a, b]`, L in 0..100
|
|
3919
|
+
*/
|
|
3920
|
+
const toLab = (c) => {
|
|
3921
|
+
const xyz = toXyzD50(c);
|
|
3922
|
+
const f = xyz.map((value, at) => {
|
|
3923
|
+
const t = value / LAB_WHITE[at];
|
|
3924
|
+
return t > LAB_EPSILON ? Math.cbrt(t) : (LAB_KAPPA * t + 16) / 116;
|
|
3925
|
+
});
|
|
3926
|
+
return [116 * f[1] - 16, 500 * (f[0] - f[1]), 200 * (f[1] - f[2])];
|
|
3927
|
+
};
|
|
3928
|
+
|
|
3929
|
+
/**
|
|
3930
|
+
* CIE Lab -> linear-light sRGB.
|
|
3931
|
+
* @param {number[]} c `[L, a, b]`
|
|
3932
|
+
* @returns {number[]} the linear-light components
|
|
3933
|
+
*/
|
|
3934
|
+
const fromLab = (c) => {
|
|
3935
|
+
const fy = (c[0] + 16) / 116;
|
|
3936
|
+
const fx = c[1] / 500 + fy;
|
|
3937
|
+
const fz = fy - c[2] / 200;
|
|
3938
|
+
return fromXyzD50([
|
|
3939
|
+
(fx ** 3 > LAB_EPSILON ? fx ** 3 : (116 * fx - 16) / LAB_KAPPA) *
|
|
3940
|
+
LAB_WHITE[0],
|
|
3941
|
+
(c[0] > LAB_KAPPA * LAB_EPSILON ? fy ** 3 : c[0] / LAB_KAPPA) *
|
|
3942
|
+
LAB_WHITE[1],
|
|
3943
|
+
(fz ** 3 > LAB_EPSILON ? fz ** 3 : (116 * fz - 16) / LAB_KAPPA) *
|
|
3944
|
+
LAB_WHITE[2]
|
|
3945
|
+
]);
|
|
3946
|
+
};
|
|
3947
|
+
|
|
3948
|
+
/**
|
|
3949
|
+
* Linear-light sRGB -> Oklab.
|
|
3950
|
+
* @param {number[]} c the linear-light components
|
|
3951
|
+
* @returns {number[]} `[L, a, b]`, L in 0..1
|
|
3952
|
+
*/
|
|
3953
|
+
const toOklab = (c) => applyModel(OKLAB_M, applyModel(LMS_M, c).map(Math.cbrt));
|
|
3954
|
+
|
|
3955
|
+
/**
|
|
3956
|
+
* Oklab -> linear-light sRGB.
|
|
3957
|
+
* @param {number[]} c `[L, a, b]`
|
|
3958
|
+
* @returns {number[]} the linear-light components
|
|
3959
|
+
*/
|
|
3960
|
+
const fromOklab = (c) =>
|
|
3961
|
+
applyModel(
|
|
3962
|
+
LMS_I,
|
|
3963
|
+
applyModel(OKLAB_I, c).map((value) => value ** 3)
|
|
3964
|
+
);
|
|
3965
|
+
|
|
3966
|
+
/**
|
|
3967
|
+
* A rectangular pair as chroma and hue, and back — the one relation `lch` has
|
|
3968
|
+
* to `lab` and `oklch` to `oklab`.
|
|
3969
|
+
* @param {number[]} c `[L, a, b]`
|
|
3970
|
+
* @returns {number[]} `[L, C, H]`, H in degrees
|
|
3971
|
+
*/
|
|
3972
|
+
const toPolar = (c) => {
|
|
3973
|
+
const chroma = Math.hypot(c[1], c[2]);
|
|
3974
|
+
let hue = (Math.atan2(c[2], c[1]) * 180) / Math.PI;
|
|
3975
|
+
if (hue < 0) hue += 360;
|
|
3976
|
+
return [c[0], chroma, chroma === 0 ? 0 : hue];
|
|
3977
|
+
};
|
|
3978
|
+
|
|
3979
|
+
/**
|
|
3980
|
+
* @param {number[]} c `[L, C, H]`, H in degrees
|
|
3981
|
+
* @returns {number[]} `[L, a, b]`
|
|
3982
|
+
*/
|
|
3983
|
+
const fromPolar = (c) => {
|
|
3984
|
+
const hue = (c[2] * Math.PI) / 180;
|
|
3985
|
+
return [c[0], c[1] * Math.cos(hue), c[1] * Math.sin(hue)];
|
|
3986
|
+
};
|
|
3987
|
+
|
|
3988
|
+
/**
|
|
3989
|
+
* @param {number[]} c the linear-light components
|
|
3990
|
+
* @returns {number[]} `[L, C, H]`
|
|
3991
|
+
*/
|
|
3992
|
+
const toLch = (c) => toPolar(toLab(c));
|
|
3993
|
+
|
|
3994
|
+
/**
|
|
3995
|
+
* @param {number[]} c `[L, C, H]`
|
|
3996
|
+
* @returns {number[]} the linear-light components
|
|
3997
|
+
*/
|
|
3998
|
+
const fromLch = (c) => fromLab(fromPolar(c));
|
|
2500
3999
|
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
]);
|
|
4000
|
+
/**
|
|
4001
|
+
* @param {number[]} c the linear-light components
|
|
4002
|
+
* @returns {number[]} `[L, C, H]`
|
|
4003
|
+
*/
|
|
4004
|
+
const toOklch = (c) => toPolar(toOklab(c));
|
|
2507
4005
|
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
"first-line",
|
|
2514
|
-
"first-letter"
|
|
2515
|
-
]);
|
|
4006
|
+
/**
|
|
4007
|
+
* @param {number[]} c `[L, C, H]`
|
|
4008
|
+
* @returns {number[]} the linear-light components
|
|
4009
|
+
*/
|
|
4010
|
+
const fromOklch = (c) => fromOklab(fromPolar(c));
|
|
2516
4011
|
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
4012
|
+
/**
|
|
4013
|
+
* Linear-light sRGB -> HSL (CSS Color 4 §7.1), through sRGB.
|
|
4014
|
+
* @param {number[]} c the linear-light components
|
|
4015
|
+
* @returns {number[]} `[H, S, L]`, H in degrees and the rest 0..1
|
|
4016
|
+
*/
|
|
4017
|
+
const toHsl = (c) => {
|
|
4018
|
+
const [r, g, b] = c.map(srgbEncode);
|
|
4019
|
+
const max = Math.max(r, g, b);
|
|
4020
|
+
const min = Math.min(r, g, b);
|
|
4021
|
+
const light = (min + max) / 2;
|
|
4022
|
+
const range = max - min;
|
|
4023
|
+
if (range === 0) return [0, 0, light];
|
|
4024
|
+
let hue;
|
|
4025
|
+
if (max === r) hue = ((g - b) / range) % 6;
|
|
4026
|
+
else if (max === g) hue = (b - r) / range + 2;
|
|
4027
|
+
else hue = (r - g) / range + 4;
|
|
4028
|
+
hue *= 60;
|
|
4029
|
+
if (hue < 0) hue += 360;
|
|
4030
|
+
return [hue, range / (1 - Math.abs(2 * light - 1)), light];
|
|
4031
|
+
};
|
|
2521
4032
|
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
4033
|
+
/**
|
|
4034
|
+
* HSL -> linear-light sRGB.
|
|
4035
|
+
* @param {number[]} c `[H, S, L]`
|
|
4036
|
+
* @returns {number[]} the linear-light components
|
|
4037
|
+
*/
|
|
4038
|
+
const fromHsl = (c) => {
|
|
4039
|
+
let hue = c[0] % 360;
|
|
4040
|
+
if (hue < 0) hue += 360;
|
|
4041
|
+
const amount = c[1] * Math.min(c[2], 1 - c[2]);
|
|
4042
|
+
return [0, 8, 4]
|
|
4043
|
+
.map((n) => {
|
|
4044
|
+
const k = (n + hue / 30) % 12;
|
|
4045
|
+
return c[2] - amount * Math.max(-1, Math.min(k - 3, 9 - k, 1));
|
|
4046
|
+
})
|
|
4047
|
+
.map(srgbTransfer);
|
|
4048
|
+
};
|
|
2526
4049
|
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
"mask-border-outset",
|
|
2541
|
-
"mask-border-width",
|
|
2542
|
-
"overflow-clip-margin",
|
|
2543
|
-
"stroke-dasharray",
|
|
2544
|
-
"stroke-dashoffset",
|
|
2545
|
-
"stroke-width",
|
|
2546
|
-
"tab-size"
|
|
2547
|
-
]);
|
|
4050
|
+
/**
|
|
4051
|
+
* Linear-light sRGB -> HWB (CSS Color 4 §7.2).
|
|
4052
|
+
* @param {number[]} c the linear-light components
|
|
4053
|
+
* @returns {number[]} `[H, W, B]`
|
|
4054
|
+
*/
|
|
4055
|
+
const toHwb = (c) => {
|
|
4056
|
+
const srgb = c.map(srgbEncode);
|
|
4057
|
+
return [
|
|
4058
|
+
toHsl(c)[0],
|
|
4059
|
+
Math.min(srgb[0], srgb[1], srgb[2]),
|
|
4060
|
+
1 - Math.max(srgb[0], srgb[1], srgb[2])
|
|
4061
|
+
];
|
|
4062
|
+
};
|
|
2548
4063
|
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
4064
|
+
/**
|
|
4065
|
+
* HWB -> linear-light sRGB.
|
|
4066
|
+
* @param {number[]} c `[H, W, B]`
|
|
4067
|
+
* @returns {number[]} the linear-light components
|
|
4068
|
+
*/
|
|
4069
|
+
const fromHwb = (c) => {
|
|
4070
|
+
if (c[1] + c[2] >= 1) {
|
|
4071
|
+
const gray = c[1] / (c[1] + c[2]);
|
|
4072
|
+
return [gray, gray, gray].map(srgbTransfer);
|
|
4073
|
+
}
|
|
4074
|
+
return fromHsl([c[0], 1, 0.5]).map((value) =>
|
|
4075
|
+
srgbTransfer(srgbEncode(value) * (1 - c[1] - c[2]) + c[1])
|
|
4076
|
+
);
|
|
4077
|
+
};
|
|
2552
4078
|
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
/** @type {
|
|
2556
|
-
const
|
|
4079
|
+
const SRGB_M = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
4080
|
+
const SRGB_I = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
4081
|
+
/** @type {(c: number[]) => number[]} */
|
|
4082
|
+
const toSrgb = (c) => applyModel(SRGB_M, c).map(srgbEncode);
|
|
4083
|
+
/** @type {(c: number[]) => number[]} */
|
|
4084
|
+
const fromSrgb = (c) => applyModel(SRGB_I, c.map(srgbTransfer));
|
|
4085
|
+
const SRGB_LINEAR_M = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
4086
|
+
const SRGB_LINEAR_I = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
4087
|
+
/** @type {(c: number[]) => number[]} */
|
|
4088
|
+
const toSrgbLinear = (c) => applyModel(SRGB_LINEAR_M, c).map(linearEncode);
|
|
4089
|
+
/** @type {(c: number[]) => number[]} */
|
|
4090
|
+
const fromSrgbLinear = (c) => applyModel(SRGB_LINEAR_I, c.map(linearTransfer));
|
|
4091
|
+
const DISPLAY_P3_M = [
|
|
4092
|
+
0.8224619687143625, 0.17753803128563775, 3.3650564745655794e-18,
|
|
4093
|
+
0.0331941988509616, 0.9668058011490385, 1.8324840583423322e-17,
|
|
4094
|
+
0.017082630721120023, 0.07239744066396339, 0.9105199286149164
|
|
4095
|
+
];
|
|
4096
|
+
const DISPLAY_P3_I = [
|
|
4097
|
+
1.2249401762805596, -0.22494017628055984, 0, -0.04205695470968812,
|
|
4098
|
+
1.042056954709688, -2.0816681711721685e-17, -0.019637554590334425,
|
|
4099
|
+
-0.0786360455506318, 1.0982736001409665
|
|
4100
|
+
];
|
|
4101
|
+
/** @type {(c: number[]) => number[]} */
|
|
4102
|
+
const toDisplayP3 = (c) => applyModel(DISPLAY_P3_M, c).map(srgbEncode);
|
|
4103
|
+
/** @type {(c: number[]) => number[]} */
|
|
4104
|
+
const fromDisplayP3 = (c) => applyModel(DISPLAY_P3_I, c.map(srgbTransfer));
|
|
4105
|
+
const A98_RGB_M = [
|
|
4106
|
+
0.7151256068556245, 0.2848743931443755, -3.237737802690131e-17,
|
|
4107
|
+
1.0063922760456419e-16, 1, 1.9959826532201272e-17, -7.752312519259058e-18,
|
|
4108
|
+
0.04116194845011838, 0.9588380515498818
|
|
4109
|
+
];
|
|
4110
|
+
const A98_RGB_I = [
|
|
4111
|
+
1.3983557439607786, -0.39835574396077855, 5.551115123125783e-17,
|
|
4112
|
+
-1.4072944198861848e-16, 1, -2.0816681711721685e-17, 1.734723475976807e-17,
|
|
4113
|
+
-0.04292898929447317, 1.042928989294473
|
|
4114
|
+
];
|
|
4115
|
+
/** @type {(c: number[]) => number[]} */
|
|
4116
|
+
const toA98Rgb = (c) => applyModel(A98_RGB_M, c).map(a98Encode);
|
|
4117
|
+
/** @type {(c: number[]) => number[]} */
|
|
4118
|
+
const fromA98Rgb = (c) => applyModel(A98_RGB_I, c.map(a98Transfer));
|
|
4119
|
+
const PROPHOTO_RGB_M = [
|
|
4120
|
+
0.5292769842583223, 0.3301545636252504, 0.14056844993940584,
|
|
4121
|
+
0.09836583745016964, 0.8734706333869527, 0.028163490634021324,
|
|
4122
|
+
0.016875355289046535, 0.1176594475769436, 0.8654652433945142
|
|
4123
|
+
];
|
|
4124
|
+
const PROPHOTO_RGB_I = [
|
|
4125
|
+
2.034380836302867, -0.7276360137172471, -0.3067448320015419,
|
|
4126
|
+
-0.228825697964331, 1.2317426727787788, -0.0029169277200310345,
|
|
4127
|
+
-0.008558858080647581, -0.15326675125999153, 1.161825549670178
|
|
4128
|
+
];
|
|
4129
|
+
/** @type {(c: number[]) => number[]} */
|
|
4130
|
+
const toProphotoRgb = (c) => applyModel(PROPHOTO_RGB_M, c).map(prophotoEncode);
|
|
4131
|
+
/** @type {(c: number[]) => number[]} */
|
|
4132
|
+
const fromProphotoRgb = (c) =>
|
|
4133
|
+
applyModel(PROPHOTO_RGB_I, c.map(prophotoTransfer));
|
|
4134
|
+
const REC2020_M = [
|
|
4135
|
+
0.6274038959346989, 0.32928303837788375, 0.04331306568741721,
|
|
4136
|
+
0.06909728935823205, 0.9195403950754593, 0.011362315566309202,
|
|
4137
|
+
0.016391438875150217, 0.08801330787722576, 0.8955952532476239
|
|
4138
|
+
];
|
|
4139
|
+
const REC2020_I = [
|
|
4140
|
+
1.6604910021084347, -0.5876411387885495, -0.07284986331988486,
|
|
4141
|
+
-0.12455047452159063, 1.1328998971259596, -0.008349422604369508,
|
|
4142
|
+
-0.018150763354905206, -0.10057889800800737, 1.1187296613629127
|
|
4143
|
+
];
|
|
4144
|
+
/** @type {(c: number[]) => number[]} */
|
|
4145
|
+
const toRec2020 = (c) => applyModel(REC2020_M, c).map(rec2020Encode);
|
|
4146
|
+
/** @type {(c: number[]) => number[]} */
|
|
4147
|
+
const fromRec2020 = (c) => applyModel(REC2020_I, c.map(rec2020Transfer));
|
|
4148
|
+
const XYZ_M = [
|
|
4149
|
+
0.41239079926595934, 0.357584339383878, 0.18048078840183424,
|
|
4150
|
+
0.21263900587151027, 0.7151686787677561, 0.07219231536073371,
|
|
4151
|
+
0.01933081871559181, 0.11919477979462595, 0.9505321522496607
|
|
4152
|
+
];
|
|
4153
|
+
const XYZ_I = [
|
|
4154
|
+
3.2409699419045226, -1.537383177570094, -0.4986107602930034,
|
|
4155
|
+
-0.9692436362808796, 1.8759675015077202, 0.04155505740717559,
|
|
4156
|
+
0.05563007969699366, -0.20397695888897652, 1.0569715142428786
|
|
4157
|
+
];
|
|
4158
|
+
const XYZ_D50_M = [
|
|
4159
|
+
0.436065749632219, 0.3851515490648008, 0.14307837223757391,
|
|
4160
|
+
0.22249316329879926, 0.7168869742512141, 0.06061983440080464,
|
|
4161
|
+
0.01392393331799153, 0.09708135172457436, 0.7140993556376494
|
|
4162
|
+
];
|
|
4163
|
+
const XYZ_D50_I = [
|
|
4164
|
+
3.1341359569958707, -1.6173863321612538, -0.4906619460083532,
|
|
4165
|
+
-0.978795502912089, 1.9162545672595237, 0.03344273116131948,
|
|
4166
|
+
0.07195537988411684, -0.22897682641583222, 1.4053860583241256
|
|
4167
|
+
];
|
|
4168
|
+
/** @type {(c: number[]) => number[]} */
|
|
4169
|
+
const toXyz = (c) => applyModel(XYZ_M, c);
|
|
4170
|
+
/** @type {(c: number[]) => number[]} */
|
|
4171
|
+
const fromXyz = (c) => applyModel(XYZ_I, c);
|
|
4172
|
+
/** @type {(c: number[]) => number[]} */
|
|
4173
|
+
const toXyzD50 = (c) => applyModel(XYZ_D50_M, c);
|
|
4174
|
+
/** @type {(c: number[]) => number[]} */
|
|
4175
|
+
const fromXyzD50 = (c) => applyModel(XYZ_D50_I, c);
|
|
4176
|
+
const LMS_M = [
|
|
4177
|
+
0.4122214708, 0.5363325363, 0.0514459929, 0.2119034982, 0.6806995451,
|
|
4178
|
+
0.1073969566, 0.0883024619, 0.2817188376, 0.6299787005
|
|
4179
|
+
];
|
|
4180
|
+
const LMS_I = [
|
|
4181
|
+
4.076741661347994, -3.3077115904081933, 0.23096992872942784,
|
|
4182
|
+
-1.268438004092176, 2.6097574006633715, -0.34131939631021946,
|
|
4183
|
+
-0.004196086541837046, -0.7034186144594494, 1.7076147009309446
|
|
4184
|
+
];
|
|
4185
|
+
const OKLAB_M = [
|
|
4186
|
+
0.2104542553, 0.793617785, -0.0040720468, 1.9779984951, -2.428592205,
|
|
4187
|
+
0.4505937099, 0.0259040371, 0.7827717662, -0.808675766
|
|
4188
|
+
];
|
|
4189
|
+
const OKLAB_I = [
|
|
4190
|
+
0.9999999984505199, 0.39633779217376786, 0.2158037580607588,
|
|
4191
|
+
1.0000000088817607, -0.10556134232365634, -0.0638541747717059,
|
|
4192
|
+
1.000000054672411, -0.08948418209496577, -1.291485537864092
|
|
4193
|
+
];
|
|
4194
|
+
/**
|
|
4195
|
+
* @param {number[]} c a color's components in Oklch
|
|
4196
|
+
* @returns {boolean} true where an engine may read the hue as missing
|
|
4197
|
+
*/
|
|
4198
|
+
const uncertainOklchHue = (c) => Math.abs(c[1]) < 0.03;
|
|
2557
4199
|
|
|
2558
|
-
//
|
|
2559
|
-
const
|
|
2560
|
-
"media",
|
|
2561
|
-
"supports",
|
|
2562
|
-
"container"
|
|
2563
|
-
]);
|
|
4200
|
+
// The space a hex and an `rgb()` state their components in.
|
|
4201
|
+
const SRGB_SPACE = "srgb";
|
|
2564
4202
|
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
4203
|
+
/** @typedef {{ to: (c: number[]) => number[], from: (c: number[]) => number[], hue: number, conversion: number, written: { open: string, scale: number[], percent: boolean[], feature: string }, uncertainHue: ((c: number[]) => boolean) | null }} ColorSpaceModel */
|
|
4204
|
+
|
|
4205
|
+
/** @type {Map<string, ColorSpaceModel>} */
|
|
4206
|
+
const COLOR_SPACE_MODEL = new Map([
|
|
4207
|
+
[
|
|
4208
|
+
"srgb",
|
|
4209
|
+
{
|
|
4210
|
+
to: toSrgb,
|
|
4211
|
+
from: fromSrgb,
|
|
4212
|
+
hue: -1,
|
|
4213
|
+
conversion: 0,
|
|
4214
|
+
written: {
|
|
4215
|
+
open: "color(srgb ",
|
|
4216
|
+
scale: [1, 1, 1],
|
|
4217
|
+
percent: [false, false, false],
|
|
4218
|
+
feature: "colorFunction"
|
|
4219
|
+
},
|
|
4220
|
+
uncertainHue: null
|
|
4221
|
+
}
|
|
4222
|
+
],
|
|
4223
|
+
[
|
|
4224
|
+
"srgb-linear",
|
|
4225
|
+
{
|
|
4226
|
+
to: toSrgbLinear,
|
|
4227
|
+
from: fromSrgbLinear,
|
|
4228
|
+
hue: -1,
|
|
4229
|
+
conversion: 1,
|
|
4230
|
+
written: {
|
|
4231
|
+
open: "color(srgb-linear ",
|
|
4232
|
+
scale: [1, 1, 1],
|
|
4233
|
+
percent: [false, false, false],
|
|
4234
|
+
feature: "colorFunction"
|
|
4235
|
+
},
|
|
4236
|
+
uncertainHue: null
|
|
4237
|
+
}
|
|
4238
|
+
],
|
|
4239
|
+
[
|
|
4240
|
+
"display-p3",
|
|
4241
|
+
{
|
|
4242
|
+
to: toDisplayP3,
|
|
4243
|
+
from: fromDisplayP3,
|
|
4244
|
+
hue: -1,
|
|
4245
|
+
conversion: 2,
|
|
4246
|
+
written: {
|
|
4247
|
+
open: "color(display-p3 ",
|
|
4248
|
+
scale: [1, 1, 1],
|
|
4249
|
+
percent: [false, false, false],
|
|
4250
|
+
feature: "colorFunction"
|
|
4251
|
+
},
|
|
4252
|
+
uncertainHue: null
|
|
4253
|
+
}
|
|
4254
|
+
],
|
|
4255
|
+
[
|
|
4256
|
+
"a98-rgb",
|
|
4257
|
+
{
|
|
4258
|
+
to: toA98Rgb,
|
|
4259
|
+
from: fromA98Rgb,
|
|
4260
|
+
hue: -1,
|
|
4261
|
+
conversion: 3,
|
|
4262
|
+
written: {
|
|
4263
|
+
open: "color(a98-rgb ",
|
|
4264
|
+
scale: [1, 1, 1],
|
|
4265
|
+
percent: [false, false, false],
|
|
4266
|
+
feature: "colorFunction"
|
|
4267
|
+
},
|
|
4268
|
+
uncertainHue: null
|
|
4269
|
+
}
|
|
4270
|
+
],
|
|
4271
|
+
[
|
|
4272
|
+
"prophoto-rgb",
|
|
4273
|
+
{
|
|
4274
|
+
to: toProphotoRgb,
|
|
4275
|
+
from: fromProphotoRgb,
|
|
4276
|
+
hue: -1,
|
|
4277
|
+
conversion: 3,
|
|
4278
|
+
written: {
|
|
4279
|
+
open: "color(prophoto-rgb ",
|
|
4280
|
+
scale: [1, 1, 1],
|
|
4281
|
+
percent: [false, false, false],
|
|
4282
|
+
feature: "colorFunction"
|
|
4283
|
+
},
|
|
4284
|
+
uncertainHue: null
|
|
4285
|
+
}
|
|
4286
|
+
],
|
|
4287
|
+
[
|
|
4288
|
+
"rec2020",
|
|
4289
|
+
{
|
|
4290
|
+
to: toRec2020,
|
|
4291
|
+
from: fromRec2020,
|
|
4292
|
+
hue: -1,
|
|
4293
|
+
conversion: 2,
|
|
4294
|
+
written: {
|
|
4295
|
+
open: "color(rec2020 ",
|
|
4296
|
+
scale: [1, 1, 1],
|
|
4297
|
+
percent: [false, false, false],
|
|
4298
|
+
feature: "colorFunction"
|
|
4299
|
+
},
|
|
4300
|
+
uncertainHue: null
|
|
4301
|
+
}
|
|
4302
|
+
],
|
|
4303
|
+
[
|
|
4304
|
+
"xyz",
|
|
4305
|
+
{
|
|
4306
|
+
to: toXyz,
|
|
4307
|
+
from: fromXyz,
|
|
4308
|
+
hue: -1,
|
|
4309
|
+
conversion: 2,
|
|
4310
|
+
written: {
|
|
4311
|
+
open: "color(xyz ",
|
|
4312
|
+
scale: [1, 1, 1],
|
|
4313
|
+
percent: [false, false, false],
|
|
4314
|
+
feature: "colorFunction"
|
|
4315
|
+
},
|
|
4316
|
+
uncertainHue: null
|
|
4317
|
+
}
|
|
4318
|
+
],
|
|
4319
|
+
[
|
|
4320
|
+
"xyz-d65",
|
|
4321
|
+
{
|
|
4322
|
+
to: toXyz,
|
|
4323
|
+
from: fromXyz,
|
|
4324
|
+
hue: -1,
|
|
4325
|
+
conversion: 2,
|
|
4326
|
+
written: {
|
|
4327
|
+
open: "color(xyz-d65 ",
|
|
4328
|
+
scale: [1, 1, 1],
|
|
4329
|
+
percent: [false, false, false],
|
|
4330
|
+
feature: "colorFunction"
|
|
4331
|
+
},
|
|
4332
|
+
uncertainHue: null
|
|
4333
|
+
}
|
|
4334
|
+
],
|
|
4335
|
+
[
|
|
4336
|
+
"xyz-d50",
|
|
4337
|
+
{
|
|
4338
|
+
to: toXyzD50,
|
|
4339
|
+
from: fromXyzD50,
|
|
4340
|
+
hue: -1,
|
|
4341
|
+
conversion: 2,
|
|
4342
|
+
written: {
|
|
4343
|
+
open: "color(xyz-d50 ",
|
|
4344
|
+
scale: [1, 1, 1],
|
|
4345
|
+
percent: [false, false, false],
|
|
4346
|
+
feature: "colorFunction"
|
|
4347
|
+
},
|
|
4348
|
+
uncertainHue: null
|
|
4349
|
+
}
|
|
4350
|
+
],
|
|
4351
|
+
[
|
|
4352
|
+
"lab",
|
|
4353
|
+
{
|
|
4354
|
+
to: toLab,
|
|
4355
|
+
from: fromLab,
|
|
4356
|
+
hue: -1,
|
|
4357
|
+
conversion: 2,
|
|
4358
|
+
written: {
|
|
4359
|
+
open: "lab(",
|
|
4360
|
+
scale: [1, 1, 1],
|
|
4361
|
+
percent: [false, false, false],
|
|
4362
|
+
feature: "labColors"
|
|
4363
|
+
},
|
|
4364
|
+
uncertainHue: null
|
|
4365
|
+
}
|
|
4366
|
+
],
|
|
4367
|
+
[
|
|
4368
|
+
"lch",
|
|
4369
|
+
{
|
|
4370
|
+
to: toLch,
|
|
4371
|
+
from: fromLch,
|
|
4372
|
+
hue: 2,
|
|
4373
|
+
conversion: 2,
|
|
4374
|
+
written: {
|
|
4375
|
+
open: "lch(",
|
|
4376
|
+
scale: [1, 1, 1],
|
|
4377
|
+
percent: [false, false, false],
|
|
4378
|
+
feature: "labColors"
|
|
4379
|
+
},
|
|
4380
|
+
uncertainHue: null
|
|
4381
|
+
}
|
|
4382
|
+
],
|
|
4383
|
+
[
|
|
4384
|
+
"oklab",
|
|
4385
|
+
{
|
|
4386
|
+
to: toOklab,
|
|
4387
|
+
from: fromOklab,
|
|
4388
|
+
hue: -1,
|
|
4389
|
+
conversion: 2,
|
|
4390
|
+
written: {
|
|
4391
|
+
open: "oklab(",
|
|
4392
|
+
scale: [1, 1, 1],
|
|
4393
|
+
percent: [false, false, false],
|
|
4394
|
+
feature: "oklabColors"
|
|
4395
|
+
},
|
|
4396
|
+
uncertainHue: null
|
|
4397
|
+
}
|
|
4398
|
+
],
|
|
4399
|
+
[
|
|
4400
|
+
"oklch",
|
|
4401
|
+
{
|
|
4402
|
+
to: toOklch,
|
|
4403
|
+
from: fromOklch,
|
|
4404
|
+
hue: 2,
|
|
4405
|
+
conversion: 2,
|
|
4406
|
+
written: {
|
|
4407
|
+
open: "oklch(",
|
|
4408
|
+
scale: [1, 1, 1],
|
|
4409
|
+
percent: [false, false, false],
|
|
4410
|
+
feature: "oklabColors"
|
|
4411
|
+
},
|
|
4412
|
+
uncertainHue: uncertainOklchHue
|
|
4413
|
+
}
|
|
4414
|
+
],
|
|
4415
|
+
[
|
|
4416
|
+
"hsl",
|
|
4417
|
+
{
|
|
4418
|
+
to: toHsl,
|
|
4419
|
+
from: fromHsl,
|
|
4420
|
+
hue: 0,
|
|
4421
|
+
conversion: 0,
|
|
4422
|
+
written: {
|
|
4423
|
+
open: "hsl(",
|
|
4424
|
+
scale: [1, 100, 100],
|
|
4425
|
+
percent: [false, true, true],
|
|
4426
|
+
feature: ""
|
|
4427
|
+
},
|
|
4428
|
+
uncertainHue: null
|
|
4429
|
+
}
|
|
4430
|
+
],
|
|
4431
|
+
[
|
|
4432
|
+
"hwb",
|
|
4433
|
+
{
|
|
4434
|
+
to: toHwb,
|
|
4435
|
+
from: fromHwb,
|
|
4436
|
+
hue: 0,
|
|
4437
|
+
conversion: 0,
|
|
4438
|
+
written: {
|
|
4439
|
+
open: "hwb(",
|
|
4440
|
+
scale: [1, 100, 100],
|
|
4441
|
+
percent: [false, true, true],
|
|
4442
|
+
feature: "hwbColors"
|
|
4443
|
+
},
|
|
4444
|
+
uncertainHue: null
|
|
4445
|
+
}
|
|
4446
|
+
]
|
|
2575
4447
|
]);
|
|
2576
4448
|
|
|
2577
|
-
// The
|
|
2578
|
-
//
|
|
2579
|
-
const
|
|
4449
|
+
// The named colors an engine may not read while reading the rest, so one says
|
|
4450
|
+
// nothing about what another takes. Every other name is as old as naming one.
|
|
4451
|
+
const LATER_COLOR_NAMES = new Set(["rebeccapurple", "transparent"]);
|
|
2580
4452
|
|
|
2581
|
-
//
|
|
2582
|
-
//
|
|
2583
|
-
//
|
|
2584
|
-
/** @type {Map<string,
|
|
2585
|
-
const
|
|
2586
|
-
["
|
|
2587
|
-
["
|
|
2588
|
-
["
|
|
2589
|
-
["
|
|
2590
|
-
["
|
|
2591
|
-
["
|
|
2592
|
-
["
|
|
2593
|
-
["
|
|
2594
|
-
["
|
|
4453
|
+
// Every named color as its packed `0xrrggbb` value — what a color a mix or a
|
|
4454
|
+
// relative reference names resolves through. The two tables above cut this one
|
|
4455
|
+
// down to the spellings worth rewriting; this one answers for every name.
|
|
4456
|
+
/** @type {Map<string, number>} */
|
|
4457
|
+
const COLOR_NAME_TO_RGB = new Map([
|
|
4458
|
+
["aliceblue", 15792383],
|
|
4459
|
+
["antiquewhite", 16444375],
|
|
4460
|
+
["aqua", 65535],
|
|
4461
|
+
["aquamarine", 8388564],
|
|
4462
|
+
["azure", 15794175],
|
|
4463
|
+
["beige", 16119260],
|
|
4464
|
+
["bisque", 16770244],
|
|
4465
|
+
["black", 0],
|
|
4466
|
+
["blanchedalmond", 16772045],
|
|
4467
|
+
["blue", 255],
|
|
4468
|
+
["blueviolet", 9055202],
|
|
4469
|
+
["brown", 10824234],
|
|
4470
|
+
["burlywood", 14596231],
|
|
4471
|
+
["cadetblue", 6266528],
|
|
4472
|
+
["chartreuse", 8388352],
|
|
4473
|
+
["chocolate", 13789470],
|
|
4474
|
+
["coral", 16744272],
|
|
4475
|
+
["cornflowerblue", 6591981],
|
|
4476
|
+
["cornsilk", 16775388],
|
|
4477
|
+
["crimson", 14423100],
|
|
4478
|
+
["cyan", 65535],
|
|
4479
|
+
["darkblue", 139],
|
|
4480
|
+
["darkcyan", 35723],
|
|
4481
|
+
["darkgoldenrod", 12092939],
|
|
4482
|
+
["darkgray", 11119017],
|
|
4483
|
+
["darkgreen", 25600],
|
|
4484
|
+
["darkgrey", 11119017],
|
|
4485
|
+
["darkkhaki", 12433259],
|
|
4486
|
+
["darkmagenta", 9109643],
|
|
4487
|
+
["darkolivegreen", 5597999],
|
|
4488
|
+
["darkorange", 16747520],
|
|
4489
|
+
["darkorchid", 10040012],
|
|
4490
|
+
["darkred", 9109504],
|
|
4491
|
+
["darksalmon", 15308410],
|
|
4492
|
+
["darkseagreen", 9419919],
|
|
4493
|
+
["darkslateblue", 4734347],
|
|
4494
|
+
["darkslategray", 3100495],
|
|
4495
|
+
["darkslategrey", 3100495],
|
|
4496
|
+
["darkturquoise", 52945],
|
|
4497
|
+
["darkviolet", 9699539],
|
|
4498
|
+
["deeppink", 16716947],
|
|
4499
|
+
["deepskyblue", 49151],
|
|
4500
|
+
["dimgray", 6908265],
|
|
4501
|
+
["dimgrey", 6908265],
|
|
4502
|
+
["dodgerblue", 2003199],
|
|
4503
|
+
["firebrick", 11674146],
|
|
4504
|
+
["floralwhite", 16775920],
|
|
4505
|
+
["forestgreen", 2263842],
|
|
4506
|
+
["fuchsia", 16711935],
|
|
4507
|
+
["gainsboro", 14474460],
|
|
4508
|
+
["ghostwhite", 16316671],
|
|
4509
|
+
["gold", 16766720],
|
|
4510
|
+
["goldenrod", 14329120],
|
|
4511
|
+
["gray", 8421504],
|
|
4512
|
+
["green", 32768],
|
|
4513
|
+
["greenyellow", 11403055],
|
|
4514
|
+
["grey", 8421504],
|
|
4515
|
+
["honeydew", 15794160],
|
|
4516
|
+
["hotpink", 16738740],
|
|
4517
|
+
["indianred", 13458524],
|
|
4518
|
+
["indigo", 4915330],
|
|
4519
|
+
["ivory", 16777200],
|
|
4520
|
+
["khaki", 15787660],
|
|
4521
|
+
["lavender", 15132410],
|
|
4522
|
+
["lavenderblush", 16773365],
|
|
4523
|
+
["lawngreen", 8190976],
|
|
4524
|
+
["lemonchiffon", 16775885],
|
|
4525
|
+
["lightblue", 11393254],
|
|
4526
|
+
["lightcoral", 15761536],
|
|
4527
|
+
["lightcyan", 14745599],
|
|
4528
|
+
["lightgoldenrodyellow", 16448210],
|
|
4529
|
+
["lightgray", 13882323],
|
|
4530
|
+
["lightgreen", 9498256],
|
|
4531
|
+
["lightgrey", 13882323],
|
|
4532
|
+
["lightpink", 16758465],
|
|
4533
|
+
["lightsalmon", 16752762],
|
|
4534
|
+
["lightseagreen", 2142890],
|
|
4535
|
+
["lightskyblue", 8900346],
|
|
4536
|
+
["lightslategray", 7833753],
|
|
4537
|
+
["lightslategrey", 7833753],
|
|
4538
|
+
["lightsteelblue", 11584734],
|
|
4539
|
+
["lightyellow", 16777184],
|
|
4540
|
+
["lime", 65280],
|
|
4541
|
+
["limegreen", 3329330],
|
|
4542
|
+
["linen", 16445670],
|
|
4543
|
+
["magenta", 16711935],
|
|
4544
|
+
["maroon", 8388608],
|
|
4545
|
+
["mediumaquamarine", 6737322],
|
|
4546
|
+
["mediumblue", 205],
|
|
4547
|
+
["mediumorchid", 12211667],
|
|
4548
|
+
["mediumpurple", 9662683],
|
|
4549
|
+
["mediumseagreen", 3978097],
|
|
4550
|
+
["mediumslateblue", 8087790],
|
|
4551
|
+
["mediumspringgreen", 64154],
|
|
4552
|
+
["mediumturquoise", 4772300],
|
|
4553
|
+
["mediumvioletred", 13047173],
|
|
4554
|
+
["midnightblue", 1644912],
|
|
4555
|
+
["mintcream", 16121850],
|
|
4556
|
+
["mistyrose", 16770273],
|
|
4557
|
+
["moccasin", 16770229],
|
|
4558
|
+
["navajowhite", 16768685],
|
|
4559
|
+
["navy", 128],
|
|
4560
|
+
["oldlace", 16643558],
|
|
4561
|
+
["olive", 8421376],
|
|
4562
|
+
["olivedrab", 7048739],
|
|
4563
|
+
["orange", 16753920],
|
|
4564
|
+
["orangered", 16729344],
|
|
4565
|
+
["orchid", 14315734],
|
|
4566
|
+
["palegoldenrod", 15657130],
|
|
4567
|
+
["palegreen", 10025880],
|
|
4568
|
+
["paleturquoise", 11529966],
|
|
4569
|
+
["palevioletred", 14381203],
|
|
4570
|
+
["papayawhip", 16773077],
|
|
4571
|
+
["peachpuff", 16767673],
|
|
4572
|
+
["peru", 13468991],
|
|
4573
|
+
["pink", 16761035],
|
|
4574
|
+
["plum", 14524637],
|
|
4575
|
+
["powderblue", 11591910],
|
|
4576
|
+
["purple", 8388736],
|
|
4577
|
+
["rebeccapurple", 6697881],
|
|
4578
|
+
["red", 16711680],
|
|
4579
|
+
["rosybrown", 12357519],
|
|
4580
|
+
["royalblue", 4286945],
|
|
4581
|
+
["saddlebrown", 9127187],
|
|
4582
|
+
["salmon", 16416882],
|
|
4583
|
+
["sandybrown", 16032864],
|
|
4584
|
+
["seagreen", 3050327],
|
|
4585
|
+
["seashell", 16774638],
|
|
4586
|
+
["sienna", 10506797],
|
|
4587
|
+
["silver", 12632256],
|
|
4588
|
+
["skyblue", 8900331],
|
|
4589
|
+
["slateblue", 6970061],
|
|
4590
|
+
["slategray", 7372944],
|
|
4591
|
+
["slategrey", 7372944],
|
|
4592
|
+
["snow", 16775930],
|
|
4593
|
+
["springgreen", 65407],
|
|
4594
|
+
["steelblue", 4620980],
|
|
4595
|
+
["tan", 13808780],
|
|
4596
|
+
["teal", 32896],
|
|
4597
|
+
["thistle", 14204888],
|
|
4598
|
+
["tomato", 16737095],
|
|
4599
|
+
["turquoise", 4251856],
|
|
4600
|
+
["violet", 15631086],
|
|
4601
|
+
["wheat", 16113331],
|
|
4602
|
+
["white", 16777215],
|
|
4603
|
+
["whitesmoke", 16119285],
|
|
4604
|
+
["yellow", 16776960],
|
|
4605
|
+
["yellowgreen", 10145074]
|
|
2595
4606
|
]);
|
|
2596
4607
|
|
|
2597
|
-
//
|
|
2598
|
-
//
|
|
2599
|
-
//
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
["
|
|
2603
|
-
["time", ["ms", 1]]
|
|
4608
|
+
// What a layered shorthand's position, size, origin and clip hold when nothing
|
|
4609
|
+
// writes them, as `[x, y, size, origin, clip]`. A layer holding its own is a
|
|
4610
|
+
// layer the shorthand says without them.
|
|
4611
|
+
const LAYER_INITIALS = new Map([
|
|
4612
|
+
["background", ["0%", "0%", "auto", "padding-box", "border-box"]],
|
|
4613
|
+
["mask", ["0%", "0%", "auto", "border-box", "border-box"]]
|
|
2604
4614
|
]);
|
|
2605
4615
|
|
|
2606
|
-
//
|
|
2607
|
-
//
|
|
2608
|
-
const
|
|
2609
|
-
"
|
|
2610
|
-
"
|
|
2611
|
-
"
|
|
2612
|
-
"
|
|
2613
|
-
"
|
|
2614
|
-
"
|
|
2615
|
-
"
|
|
2616
|
-
"
|
|
4616
|
+
// What each slot of a family shorthand holds when nothing writes it. A slot
|
|
4617
|
+
// holding its own initial says nothing beside the others.
|
|
4618
|
+
const FAMILY_SLOT_INITIALS = new Map([
|
|
4619
|
+
["border-block-end-color", "currentcolor"],
|
|
4620
|
+
["border-block-end-style", "none"],
|
|
4621
|
+
["border-block-end-width", "medium"],
|
|
4622
|
+
["border-block-start-color", "currentcolor"],
|
|
4623
|
+
["border-block-start-style", "none"],
|
|
4624
|
+
["border-block-start-width", "medium"],
|
|
4625
|
+
["border-bottom-color", "currentcolor"],
|
|
4626
|
+
["border-bottom-style", "none"],
|
|
4627
|
+
["border-bottom-width", "medium"],
|
|
4628
|
+
["border-inline-end-color", "currentcolor"],
|
|
4629
|
+
["border-inline-end-style", "none"],
|
|
4630
|
+
["border-inline-end-width", "medium"],
|
|
4631
|
+
["border-inline-start-color", "currentcolor"],
|
|
4632
|
+
["border-inline-start-style", "none"],
|
|
4633
|
+
["border-inline-start-width", "medium"],
|
|
4634
|
+
["border-left-color", "currentcolor"],
|
|
4635
|
+
["border-left-style", "none"],
|
|
4636
|
+
["border-left-width", "medium"],
|
|
4637
|
+
["border-right-color", "currentcolor"],
|
|
4638
|
+
["border-right-style", "none"],
|
|
4639
|
+
["border-right-width", "medium"],
|
|
4640
|
+
["border-top-color", "currentcolor"],
|
|
4641
|
+
["border-top-style", "none"],
|
|
4642
|
+
["border-top-width", "medium"],
|
|
4643
|
+
["column-rule-color", "currentcolor"],
|
|
4644
|
+
["column-rule-style", "none"],
|
|
4645
|
+
["column-rule-width", "medium"],
|
|
4646
|
+
["flex-direction", "row"],
|
|
4647
|
+
["flex-wrap", "nowrap"],
|
|
4648
|
+
["list-style-image", "none"],
|
|
4649
|
+
["list-style-position", "outside"],
|
|
4650
|
+
["list-style-type", "disc"],
|
|
4651
|
+
["outline-color", "auto"],
|
|
4652
|
+
["outline-style", "none"],
|
|
4653
|
+
["outline-width", "medium"],
|
|
4654
|
+
["text-decoration-color", "currentcolor"],
|
|
4655
|
+
["text-decoration-line", "none"],
|
|
4656
|
+
["text-decoration-style", "solid"],
|
|
4657
|
+
["text-decoration-thickness", "auto"],
|
|
4658
|
+
["text-emphasis-color", "currentcolor"],
|
|
4659
|
+
["text-emphasis-style", "none"],
|
|
4660
|
+
["text-wrap-mode", "wrap"],
|
|
4661
|
+
["text-wrap-style", "auto"]
|
|
2617
4662
|
]);
|
|
2618
4663
|
|
|
4664
|
+
// The font stack `system-ui` names, for a target that does not read the keyword.
|
|
4665
|
+
const SYSTEM_UI_STACK =
|
|
4666
|
+
"system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue";
|
|
4667
|
+
|
|
2619
4668
|
// The angle units. Excluded from rounding: `rotate()` runs its argument through
|
|
2620
4669
|
// trig, which turns a truncated digit into a different computed matrix.
|
|
2621
4670
|
const ANGLE_UNITS = new Set(["deg", "grad", "rad", "turn"]);
|
|
2622
4671
|
|
|
4672
|
+
// The constants a calculation may name (CSS Values 4 §10.7), as `name -> value`.
|
|
4673
|
+
// `infinity` and `NaN` are named with none: no printed number spells either, so
|
|
4674
|
+
// a calculation naming one is left as it stands.
|
|
4675
|
+
/** @type {Map<string, number | null>} */
|
|
4676
|
+
const CALC_CONSTANTS = new Map([
|
|
4677
|
+
["e", Math.E],
|
|
4678
|
+
["infinity", null],
|
|
4679
|
+
["nan", null],
|
|
4680
|
+
["pi", Math.PI]
|
|
4681
|
+
]);
|
|
4682
|
+
|
|
2623
4683
|
// A quarter turn in each unit that spells it exactly (CSS Values 4 §8.1), as
|
|
2624
|
-
// `unit -> the count`.
|
|
2625
|
-
//
|
|
4684
|
+
// `unit -> the count`. It is what a trig function's argument is read as degrees
|
|
4685
|
+
// through, and the eighths of it are where sine and cosine are rational.
|
|
2626
4686
|
/** @type {Map<string, number>} */
|
|
2627
4687
|
const QUARTER_TURN_ANGLE = new Map([
|
|
2628
4688
|
["deg", 90],
|
|
@@ -2683,83 +4743,106 @@ const ARC_TANGENT_DEGREES = new Map([
|
|
|
2683
4743
|
[1, 45]
|
|
2684
4744
|
]);
|
|
2685
4745
|
|
|
2686
|
-
// The reader that needs a table, built once here — `mathPrimitives` knows
|
|
2687
|
-
//
|
|
2688
|
-
const
|
|
4746
|
+
// The reader that needs a table, built once here — `mathPrimitives` knows how to
|
|
4747
|
+
// read an angle but not which units spell a quarter turn.
|
|
4748
|
+
const readAngle = angleReader(QUARTER_TURN_ANGLE);
|
|
4749
|
+
|
|
4750
|
+
// The table a function that looks nothing up is handed.
|
|
4751
|
+
/** @type {Map<number, number>} */
|
|
4752
|
+
const NO_TABLE = new Map();
|
|
2689
4753
|
|
|
2690
4754
|
// What folding each math function comes down to, as
|
|
2691
4755
|
// `name -> { read, apply, result, table }`: how its arguments are read, which
|
|
2692
4756
|
// arithmetic runs, and the unit the answer carries. `read` and `apply` are the
|
|
2693
4757
|
// functions themselves, so `lib/css/syntax.js` drives the fold while naming
|
|
2694
4758
|
// neither a math function nor an arithmetic of its own.
|
|
2695
|
-
/** @type {Map<string, { read: MathArgumentReader, apply: MathOperation, result: string, table: Map<number, number>
|
|
4759
|
+
/** @type {Map<string, { read: MathArgumentReader, apply: MathOperation, result: string, table: Map<number, number> }>} */
|
|
2696
4760
|
const MATH_FUNCTION_FOLD = new Map([
|
|
2697
|
-
[
|
|
4761
|
+
[
|
|
4762
|
+
"abs",
|
|
4763
|
+
{ read: readSameUnit, apply: absolute, result: "same", table: NO_TABLE }
|
|
4764
|
+
],
|
|
2698
4765
|
[
|
|
2699
4766
|
"acos",
|
|
2700
4767
|
{
|
|
2701
4768
|
read: readNumber,
|
|
2702
|
-
apply:
|
|
4769
|
+
apply: statedAngle,
|
|
2703
4770
|
result: "deg",
|
|
2704
4771
|
table: ARC_COSINE_DEGREES
|
|
2705
4772
|
}
|
|
2706
4773
|
],
|
|
2707
4774
|
[
|
|
2708
4775
|
"asin",
|
|
2709
|
-
{
|
|
4776
|
+
{
|
|
4777
|
+
read: readNumber,
|
|
4778
|
+
apply: statedAngle,
|
|
4779
|
+
result: "deg",
|
|
4780
|
+
table: ARC_SINE_DEGREES
|
|
4781
|
+
}
|
|
2710
4782
|
],
|
|
2711
4783
|
[
|
|
2712
4784
|
"atan",
|
|
2713
4785
|
{
|
|
2714
4786
|
read: readNumber,
|
|
2715
|
-
apply:
|
|
4787
|
+
apply: statedAngle,
|
|
2716
4788
|
result: "deg",
|
|
2717
4789
|
table: ARC_TANGENT_DEGREES
|
|
2718
4790
|
}
|
|
2719
4791
|
],
|
|
2720
4792
|
[
|
|
2721
4793
|
"atan2",
|
|
2722
|
-
{ read: readSameUnit, apply: arcTangent2, result: "deg", table:
|
|
4794
|
+
{ read: readSameUnit, apply: arcTangent2, result: "deg", table: NO_TABLE }
|
|
4795
|
+
],
|
|
4796
|
+
[
|
|
4797
|
+
"clamp",
|
|
4798
|
+
{ read: readSameUnit, apply: clamp, result: "same", table: NO_TABLE }
|
|
2723
4799
|
],
|
|
2724
|
-
["clamp", { read: readSameUnit, apply: clamp, result: "same", table: null }],
|
|
2725
4800
|
[
|
|
2726
4801
|
"cos",
|
|
2727
|
-
{
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
}
|
|
4802
|
+
{ read: readAngle, apply: cosine, result: "", table: EIGHTH_TURN_COSINE }
|
|
4803
|
+
],
|
|
4804
|
+
[
|
|
4805
|
+
"exp",
|
|
4806
|
+
{ read: readNumber, apply: exponential, result: "", table: NO_TABLE }
|
|
2733
4807
|
],
|
|
2734
|
-
["exp", { read: readNumber, apply: exponential, result: "", table: null }],
|
|
2735
4808
|
[
|
|
2736
4809
|
"hypot",
|
|
2737
|
-
{ read: readSameUnit, apply: hypotenuse, result: "same", table:
|
|
4810
|
+
{ read: readSameUnit, apply: hypotenuse, result: "same", table: NO_TABLE }
|
|
4811
|
+
],
|
|
4812
|
+
["log", { read: readNumber, apply: logarithm, result: "", table: NO_TABLE }],
|
|
4813
|
+
[
|
|
4814
|
+
"max",
|
|
4815
|
+
{ read: readSameUnit, apply: maximum, result: "same", table: NO_TABLE }
|
|
4816
|
+
],
|
|
4817
|
+
[
|
|
4818
|
+
"min",
|
|
4819
|
+
{ read: readSameUnit, apply: minimum, result: "same", table: NO_TABLE }
|
|
4820
|
+
],
|
|
4821
|
+
[
|
|
4822
|
+
"mod",
|
|
4823
|
+
{ read: readSameUnit, apply: modulus, result: "same", table: NO_TABLE }
|
|
2738
4824
|
],
|
|
2739
|
-
["
|
|
2740
|
-
["max", { read: readSameUnit, apply: maximum, result: "same", table: null }],
|
|
2741
|
-
["min", { read: readSameUnit, apply: minimum, result: "same", table: null }],
|
|
2742
|
-
["mod", { read: readSameUnit, apply: modulus, result: "same", table: null }],
|
|
2743
|
-
["pow", { read: readNumber, apply: power, result: "", table: null }],
|
|
4825
|
+
["pow", { read: readNumber, apply: power, result: "", table: NO_TABLE }],
|
|
2744
4826
|
[
|
|
2745
4827
|
"rem",
|
|
2746
|
-
{ read: readSameUnit, apply: remainder, result: "same", table:
|
|
4828
|
+
{ read: readSameUnit, apply: remainder, result: "same", table: NO_TABLE }
|
|
4829
|
+
],
|
|
4830
|
+
[
|
|
4831
|
+
"round",
|
|
4832
|
+
{ read: readSameUnit, apply: round, result: "same", table: NO_TABLE }
|
|
2747
4833
|
],
|
|
2748
|
-
["
|
|
2749
|
-
["sign", { read: readSameUnit, apply: sign, result: "", table: null }],
|
|
4834
|
+
["sign", { read: readSameUnit, apply: sign, result: "", table: NO_TABLE }],
|
|
2750
4835
|
[
|
|
2751
4836
|
"sin",
|
|
2752
|
-
{ read:
|
|
4837
|
+
{ read: readAngle, apply: sine, result: "", table: EIGHTH_TURN_SINE }
|
|
4838
|
+
],
|
|
4839
|
+
[
|
|
4840
|
+
"sqrt",
|
|
4841
|
+
{ read: readNumber, apply: squareRoot, result: "", table: NO_TABLE }
|
|
2753
4842
|
],
|
|
2754
|
-
["sqrt", { read: readNumber, apply: squareRoot, result: "", table: null }],
|
|
2755
4843
|
[
|
|
2756
4844
|
"tan",
|
|
2757
|
-
{
|
|
2758
|
-
read: readEighthTurn,
|
|
2759
|
-
apply: lookup,
|
|
2760
|
-
result: "",
|
|
2761
|
-
table: EIGHTH_TURN_TANGENT
|
|
2762
|
-
}
|
|
4845
|
+
{ read: readAngle, apply: tangent, result: "", table: EIGHTH_TURN_TANGENT }
|
|
2763
4846
|
]
|
|
2764
4847
|
]);
|
|
2765
4848
|
|
|
@@ -4525,80 +6608,99 @@ const SUPPORT_PROFILES = new Float64Array([
|
|
|
4525
6608
|
6200000, 4900000, 6200000, 6200000, 7900000, 4900000, 1e15, 1e15, 900003,
|
|
4526
6609
|
4700000, 4900000, 1000000, 800000, 7200000, 8300000, 7200000, 7200000,
|
|
4527
6610
|
7900000, 8300000, 1e15, 1e15, 1200002, 5100000, 6000000, 1200001, 1100000,
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
6611
|
+
11500000, 7900000, 11500000, 11500000, 11500000, 7000000, 1e15, 1e15, 1500000,
|
|
6612
|
+
7700000, 10100000, 1500000, 2300000, 5600000, 9200000, 5600000, 5600000,
|
|
6613
|
+
7900000, 9200000, 1e15, 1e15, 1100000, 4300000, 4300000, 1100000, 600000,
|
|
6614
|
+
8800000, 7900000, 8800000, 8800000, 8800000, 7800000, 1e15, 1e15, 1400000,
|
|
6615
|
+
6300000, 7400000, 1400000, 1500000, 1e15, 11400000, 1e15, 1e15, 1e15,
|
|
6616
|
+
11400000, 1e15, 1e15, 900000, 1e15, 1e15, 900000, 1e15, 8800000, 8400000,
|
|
6617
|
+
8800000, 8800000, 8800000, 8400000, 1e15, 1e15, 900000, 1e15, 7400000, 900000,
|
|
6618
|
+
1500000, 12000000, 4900000, 12000000, 12000000, 12000000, 4900000, 1e15, 1e15,
|
|
6619
|
+
1600004, 8000000, 10600000, 1600004, 2500000, 1e15, 1e15, 1e15, 1e15, 1e15,
|
|
6620
|
+
1e15, 1e15, 1e15, 1e15, 1e15, 1e15, 1e15, 1e15, 12000000, 11700000, 12000000,
|
|
6621
|
+
12000000, 12000000, 11700000, 1e15, 1e15, 1700002, 8000000, 10600000, 1700002,
|
|
6622
|
+
2500000, 5700000, 600000, 5700000, 5700000, 7900000, 600000, 1e15, 1e15,
|
|
6623
|
+
2600002, 4300000, 4400000, 2600002, 700000, 8700000, 7900000, 8700000,
|
|
6624
|
+
8700000, 8700000, 7000000, 1e15, 1e15, 2600002, 6200000, 7300000, 2600002,
|
|
6625
|
+
1400000, 11100000, 11300000, 11100000, 11100000, 11100000, 11300000, 1e15,
|
|
6626
|
+
1e15, 1500000, 7500000, 9700000, 1500000, 2200000, 11100000, 11300000,
|
|
6627
|
+
11100000, 11100000, 11100000, 11300000, 1e15, 1e15, 1600002, 7500000, 9700000,
|
|
6628
|
+
1600002, 2200000, 10100000, 9600000, 10100000, 10100000, 10100000, 9600000,
|
|
6629
|
+
1e15, 1e15, 1500000, 7000000, 8700000, 1500000, 1900000, 12300000, 12000000,
|
|
6630
|
+
12300000, 12300000, 12300000, 12000000, 1e15, 1e15, 1700005, 8200000,
|
|
6631
|
+
10900000, 1700005, 2700000, 11100000, 11300000, 11100000, 11100000, 11100000,
|
|
6632
|
+
11300000, 1e15, 1e15, 1500004, 7500000, 9700000, 1500004, 2200000, 8700000,
|
|
6633
|
+
6600000, 8700000, 8700000, 8700000, 6600000, 1e15, 1e15, 1400005, 6200000,
|
|
6634
|
+
7300000, 1400001, 1400000, 10400000, 10200000, 10400000, 10400000, 10400000,
|
|
6635
|
+
10200000, 1e15, 1e15, 1600004, 7100000, 9000000, 1600004, 2000000, 6800000,
|
|
6636
|
+
6100000, 6800000, 6800000, 7900000, 6100000, 1e15, 1e15, 1300004, 4800000,
|
|
6637
|
+
5500000, 1300001, 1000000, 5900000, 4500000, 5900000, 5900000, 7900000,
|
|
6638
|
+
4500000, 1e15, 1e15, 1100000, 4300000, 4600000, 1100000, 700000, 1800000,
|
|
6639
|
+
400000, 400004, 100000, 1200000, 100005, 900000, 900000, 300002, 1000001,
|
|
6640
|
+
700000, 400000, 100000, 3700000, 4700000, 3700000, 3700000, 7900000, 4700000,
|
|
6641
|
+
1e15, 1e15, 1500004, 2400000, 2400000, 1500004, 300000, 1800000, 400000,
|
|
6642
|
+
400004, 100000, 1200000, 100005, 900000, 900000, 300000, 1000001, 700000,
|
|
6643
|
+
400000, 100000, 13300000, 1e15, 13300000, 13300000, 13300000, 1e15, 1e15,
|
|
6644
|
+
1e15, 2700000, 8800000, 11800000, 2700000, 2900000, 2600000, 5500000, 400004,
|
|
6645
|
+
2600000, 7900000, 5500000, 1e15, 1e15, 700000, 1400000, 1500000, 700000,
|
|
6646
|
+
100005, 13100000, 14300000, 13100000, 13100000, 13100000, 14300000, 1e15,
|
|
6647
|
+
1e15, 1800004, 8700000, 11600000, 1800004, 2900000, 8900000, 8200000, 8900000,
|
|
6648
|
+
8900000, 8900000, 8200000, 1e15, 1e15, 1400005, 6300000, 7500000, 1400001,
|
|
6649
|
+
1500000, 1800000, 400000, 3700000, 100000, 1200000, 100000, 900000, 900000,
|
|
6650
|
+
100000, 1000001, 700000, 100000, 100000, 1800000, 400000, 400004, 100000,
|
|
6651
|
+
1200000, 100000, 900000, 900000, 100000, 1000001, 700000, 100000, 100000,
|
|
6652
|
+
12100000, 1e15, 12100000, 12100000, 12100000, 1e15, 1e15, 1e15, 1700004,
|
|
6653
|
+
8100000, 10700000, 1700004, 2500000, 10500000, 14900000, 10500000, 10500000,
|
|
6654
|
+
10500000, 14900000, 1e15, 1e15, 1700002, 7200000, 9100000, 1700002, 2000000,
|
|
6655
|
+
8600000, 6800000, 8600000, 8600000, 8600000, 6800000, 1e15, 1e15, 1100003,
|
|
6656
|
+
6100000, 7200000, 1100001, 1400000, 7300000, 7900000, 7300000, 7300000,
|
|
6657
|
+
7900000, 7200000, 1e15, 1e15, 1300004, 5200000, 6000000, 1300001, 1100000,
|
|
6658
|
+
13500000, 1e15, 13500000, 13500000, 13500000, 1e15, 1e15, 1e15, 2700000,
|
|
6659
|
+
8900000, 12000000, 2700000, 2900000, 5700000, 5100000, 5700000, 5700000,
|
|
6660
|
+
7900000, 5100000, 1e15, 1e15, 1000003, 4300000, 4400000, 1000001, 700000,
|
|
6661
|
+
1800000, 6200000, 3700000, 100000, 1200000, 6200000, 900000, 900000, 1e15,
|
|
6662
|
+
1400000, 900005, 100001, 100000, 5000000, 6300000, 5000000, 5000000, 7900000,
|
|
6663
|
+
6300000, 1e15, 1e15, 1000000, 3700000, 3700000, 1000000, 500000, 8900000,
|
|
6664
|
+
13100000, 8900000, 8900000, 8900000, 13100000, 1e15, 1e15, 1800002, 6300000,
|
|
6665
|
+
7500000, 1800002, 1500000, 10900000, 14400000, 10900000, 10900000, 10900000,
|
|
6666
|
+
14400000, 1e15, 1e15, 1800000, 7400000, 9500000, 1800000, 2100000, 1800000,
|
|
6667
|
+
400000, 400004, 100000, 1200000, 100000, 400000, 400000, 100000, 1000001,
|
|
6668
|
+
500000, 100000, 100000, 12500000, 14400000, 12500000, 12500000, 12500000,
|
|
6669
|
+
14400000, 1e15, 1e15, 1800000, 8300000, 11100000, 1800000, 2700000, 12500000,
|
|
6670
|
+
14700000, 12500000, 12500000, 12500000, 14700000, 1e15, 1e15, 1800002,
|
|
6671
|
+
8300000, 11100000, 1800002, 2700000, 6500000, 5000000, 6500000, 6500000,
|
|
6672
|
+
7900000, 5000000, 1e15, 1e15, 900000, 4700000, 5200000, 900000, 900000,
|
|
6673
|
+
11000000, 8600000, 11000000, 11000000, 11000000, 8600000, 1e15, 1e15, 1500000,
|
|
6674
|
+
7400000, 9600000, 1500000, 2100000, 15200000, 15000000, 15200000, 15200000,
|
|
6675
|
+
15200000, 15000000, 1e15, 1e15, 1500004, 1e15, 13600000, 1500004, 1e15,
|
|
4577
6676
|
1800000, 400000, 200000, 100000, 1200000, 100000, 900000, 900000, 200000,
|
|
4578
|
-
1000001,
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
900000, 900000, 200000, 1000001, 900005, 300001, 100000, 1800000,
|
|
4583
|
-
400004,
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
6677
|
+
1000001, 900000, 300001, 100000, 1800000, 400000, 3700000, 1000000, 7900000,
|
|
6678
|
+
400000, 1e15, 1e15, 500000, 1000001, 1000000, 500000, 100000, 5400000,
|
|
6679
|
+
6300000, 5400000, 5400000, 7900000, 6300000, 1e15, 1e15, 1000000, 4100000,
|
|
6680
|
+
4100000, 1000000, 600000, 1800000, 400000, 200000, 100000, 1200000, 100000,
|
|
6681
|
+
900000, 900000, 200000, 1000001, 900005, 300001, 100000, 1800000, 11600000,
|
|
6682
|
+
400004, 1800000, 1200000, 11600000, 800000, 800000, 600000, 1000001, 900002,
|
|
6683
|
+
600000, 100000, 1800000, 400000, 400004, 400000, 1200000, 300000, 700000,
|
|
6684
|
+
700000, 400000, 1000001, 900005, 300001, 100000, 1800000, 400000, 200000,
|
|
6685
|
+
100000, 1200000, 300005, 900000, 900000, 200000, 1000001, 900005, 300001,
|
|
6686
|
+
100000, 1800000, 400000, 400004, 100000, 1200000, 100000, 800000, 800000,
|
|
6687
|
+
100000, 1000001, 700000, 100000, 100000, 8600000, 8500000, 8600000, 8600000,
|
|
6688
|
+
8600000, 8500000, 1e15, 1e15, 1500004, 6100000, 7200000, 1500004, 1400000,
|
|
6689
|
+
6000000, 5200000, 6000000, 6000000, 7900000, 5200000, 1e15, 1e15, 1000003,
|
|
6690
|
+
4400000, 4700000, 1000001, 800000, 7100000, 6400000, 7100000, 7100000,
|
|
6691
|
+
1200000, 6400000, 1e15, 1e15, 1600004, 5000000, 5800000, 1600004, 1000000,
|
|
6692
|
+
2500000, 1e15, 400004, 2300000, 7900000, 1e15, 1e15, 1e15, 700000, 1400000,
|
|
6693
|
+
1500000, 700000, 100005, 10500000, 12100000, 10500000, 10500000, 10500000,
|
|
6694
|
+
12100000, 1e15, 1e15, 1500004, 7200000, 9100000, 1500004, 2000000, 1e15,
|
|
6695
|
+
13600000, 1e15, 1e15, 1e15, 13600000, 1e15, 1e15, 1e15, 1e15, 1e15, 1e15,
|
|
6696
|
+
1e15, 5400000, 1e15, 5400000, 5400000, 7900000, 1e15, 1e15, 1e15, 1e15,
|
|
6697
|
+
4100000, 4100000, 1e15, 600000, 1800000, 400000, 400004, 100000, 1200000,
|
|
6698
|
+
100000, 400000, 400000, 100000, 1000001, 400000, 200000, 100000, 1800000,
|
|
6699
|
+
1600000, 200002, 1000000, 1300000, 2900000, 1e15, 1e15, 500000, 1100000,
|
|
6700
|
+
1100000, 500001, 100000, 1800000, 400000, 400004, 100000, 1200000, 200000,
|
|
6701
|
+
1000000, 1000000, 100000, 1000001, 900000, 300000, 100000, 1800000, 400000,
|
|
6702
|
+
3700000, 1000000, 1200000, 400000, 1000000, 1000000, 500000, 1000001, 1000000,
|
|
6703
|
+
500000, 100000, 1800000, 400000, 400004, 100000, 1200000, 100000, 800000,
|
|
4602
6704
|
800000, 200000, 1000001, 800000, 300001, 100000, 1800000, 400000, 400004,
|
|
4603
6705
|
100000, 1200000, 100000, 900000, 900000, 200000, 1000001, 900005, 300001,
|
|
4604
6706
|
100000, 1800000, 1e15, 400004, 600000, 1200000, 1e15, 800000, 800000, 400002,
|
|
@@ -4635,10 +6737,27 @@ const SUPPORT_PROFILES = new Float64Array([
|
|
|
4635
6737
|
const SUPPORTED_FROM = new Map([
|
|
4636
6738
|
["colorHexAlpha", 0],
|
|
4637
6739
|
["gradientDoublePosition", 1],
|
|
4638
|
-
["
|
|
4639
|
-
["
|
|
4640
|
-
["
|
|
4641
|
-
["
|
|
6740
|
+
["displayTwoValues", 2],
|
|
6741
|
+
["systemUiFont", 3],
|
|
6742
|
+
["isSelector", 4],
|
|
6743
|
+
["langArgumentList", 5],
|
|
6744
|
+
["notSelectorList", 6],
|
|
6745
|
+
["whereSelector", 4],
|
|
6746
|
+
["dirSelector", 7],
|
|
6747
|
+
["customMedia", 8],
|
|
6748
|
+
["nesting", 9],
|
|
6749
|
+
["textDecorationColorStyle", 10],
|
|
6750
|
+
["textDecorationThickness", 11],
|
|
6751
|
+
["colorFunction", 12],
|
|
6752
|
+
["colorMix", 13],
|
|
6753
|
+
["hwbColors", 14],
|
|
6754
|
+
["lightDark", 15],
|
|
6755
|
+
["labColors", 12],
|
|
6756
|
+
["oklabColors", 16],
|
|
6757
|
+
["insetShorthand", 17],
|
|
6758
|
+
["mediaQueryRange", 18],
|
|
6759
|
+
["overflowTwoValues", 19],
|
|
6760
|
+
["placeShorthand", 20]
|
|
4642
6761
|
]);
|
|
4643
6762
|
|
|
4644
6763
|
// When each browser first read a pseudo-class or pseudo-element, by the spelling
|
|
@@ -4646,102 +6765,102 @@ const SUPPORTED_FROM = new Map([
|
|
|
4646
6765
|
// so it never joins a selector list.
|
|
4647
6766
|
/** @type {Map<string, number>} */
|
|
4648
6767
|
const SELECTOR_SUPPORTED_FROM = new Map([
|
|
4649
|
-
["::after",
|
|
4650
|
-
["::backdrop",
|
|
4651
|
-
["::before",
|
|
4652
|
-
["::checkmark",
|
|
4653
|
-
["::cue",
|
|
4654
|
-
["::cue",
|
|
4655
|
-
["::details-content",
|
|
4656
|
-
["::file-selector-button",
|
|
4657
|
-
["::first-letter",
|
|
4658
|
-
["::first-line",
|
|
4659
|
-
["::grammar-error",
|
|
4660
|
-
["::highlight",
|
|
4661
|
-
["::marker",
|
|
4662
|
-
["::part",
|
|
4663
|
-
["::picker",
|
|
4664
|
-
["::picker-icon",
|
|
4665
|
-
["::placeholder",
|
|
4666
|
-
["::selection",
|
|
4667
|
-
["::slotted",
|
|
4668
|
-
["::spelling-error",
|
|
4669
|
-
["::target-text",
|
|
4670
|
-
["::view-transition",
|
|
4671
|
-
["::view-transition-group",
|
|
4672
|
-
["::view-transition-image-pair",
|
|
4673
|
-
["::view-transition-new",
|
|
4674
|
-
["::view-transition-old",
|
|
4675
|
-
[":active",
|
|
4676
|
-
[":active-view-transition",
|
|
4677
|
-
[":active-view-transition-type",
|
|
4678
|
-
[":any-link",
|
|
4679
|
-
[":autofill",
|
|
4680
|
-
[":buffering",
|
|
4681
|
-
[":checked",
|
|
4682
|
-
[":default",
|
|
4683
|
-
[":defined",
|
|
4684
|
-
[":dir",
|
|
4685
|
-
[":disabled",
|
|
4686
|
-
[":empty",
|
|
4687
|
-
[":enabled",
|
|
4688
|
-
[":first",
|
|
4689
|
-
[":first-child",
|
|
4690
|
-
[":first-of-type",
|
|
4691
|
-
[":focus",
|
|
4692
|
-
[":focus-visible",
|
|
4693
|
-
[":focus-within",
|
|
4694
|
-
[":fullscreen",
|
|
4695
|
-
[":future",
|
|
4696
|
-
[":has",
|
|
4697
|
-
[":has-slotted",
|
|
4698
|
-
[":host",
|
|
4699
|
-
[":host",
|
|
4700
|
-
[":host-context",
|
|
4701
|
-
[":hover",
|
|
4702
|
-
[":in-range",
|
|
4703
|
-
[":indeterminate",
|
|
4704
|
-
[":invalid",
|
|
4705
|
-
[":is",
|
|
4706
|
-
[":lang",
|
|
4707
|
-
[":last-child",
|
|
4708
|
-
[":last-of-type",
|
|
4709
|
-
[":left",
|
|
4710
|
-
[":link",
|
|
4711
|
-
[":modal",
|
|
4712
|
-
[":muted",
|
|
4713
|
-
[":not",
|
|
4714
|
-
[":nth-child",
|
|
4715
|
-
[":nth-last-child",
|
|
4716
|
-
[":nth-last-of-type",
|
|
4717
|
-
[":nth-of-type",
|
|
4718
|
-
[":only-child",
|
|
4719
|
-
[":only-of-type",
|
|
4720
|
-
[":open",
|
|
4721
|
-
[":optional",
|
|
4722
|
-
[":out-of-range",
|
|
4723
|
-
[":past",
|
|
4724
|
-
[":paused",
|
|
4725
|
-
[":picture-in-picture",
|
|
4726
|
-
[":placeholder-shown",
|
|
4727
|
-
[":playing",
|
|
4728
|
-
[":popover-open",
|
|
4729
|
-
[":read-only",
|
|
4730
|
-
[":read-write",
|
|
4731
|
-
[":required",
|
|
4732
|
-
[":right",
|
|
4733
|
-
[":root",
|
|
4734
|
-
[":scope",
|
|
4735
|
-
[":seeking",
|
|
4736
|
-
[":stalled",
|
|
4737
|
-
[":state",
|
|
4738
|
-
[":target",
|
|
4739
|
-
[":user-invalid",
|
|
4740
|
-
[":user-valid",
|
|
4741
|
-
[":valid",
|
|
4742
|
-
[":visited",
|
|
4743
|
-
[":volume-locked",
|
|
4744
|
-
[":where",
|
|
6768
|
+
["::after", 21],
|
|
6769
|
+
["::backdrop", 22],
|
|
6770
|
+
["::before", 23],
|
|
6771
|
+
["::checkmark", 24],
|
|
6772
|
+
["::cue", 25],
|
|
6773
|
+
["::cue", 25],
|
|
6774
|
+
["::details-content", 26],
|
|
6775
|
+
["::file-selector-button", 27],
|
|
6776
|
+
["::first-letter", 28],
|
|
6777
|
+
["::first-line", 29],
|
|
6778
|
+
["::grammar-error", 30],
|
|
6779
|
+
["::highlight", 31],
|
|
6780
|
+
["::marker", 32],
|
|
6781
|
+
["::part", 33],
|
|
6782
|
+
["::picker", 34],
|
|
6783
|
+
["::picker-icon", 24],
|
|
6784
|
+
["::placeholder", 35],
|
|
6785
|
+
["::selection", 36],
|
|
6786
|
+
["::slotted", 37],
|
|
6787
|
+
["::spelling-error", 30],
|
|
6788
|
+
["::target-text", 38],
|
|
6789
|
+
["::view-transition", 39],
|
|
6790
|
+
["::view-transition-group", 39],
|
|
6791
|
+
["::view-transition-image-pair", 39],
|
|
6792
|
+
["::view-transition-new", 39],
|
|
6793
|
+
["::view-transition-old", 39],
|
|
6794
|
+
[":active", 40],
|
|
6795
|
+
[":active-view-transition", 41],
|
|
6796
|
+
[":active-view-transition-type", 42],
|
|
6797
|
+
[":any-link", 43],
|
|
6798
|
+
[":autofill", 44],
|
|
6799
|
+
[":buffering", 45],
|
|
6800
|
+
[":checked", 46],
|
|
6801
|
+
[":default", 47],
|
|
6802
|
+
[":defined", 48],
|
|
6803
|
+
[":dir", 7],
|
|
6804
|
+
[":disabled", 46],
|
|
6805
|
+
[":empty", 49],
|
|
6806
|
+
[":enabled", 46],
|
|
6807
|
+
[":first", 50],
|
|
6808
|
+
[":first-child", 51],
|
|
6809
|
+
[":first-of-type", 52],
|
|
6810
|
+
[":focus", 53],
|
|
6811
|
+
[":focus-visible", 54],
|
|
6812
|
+
[":focus-within", 55],
|
|
6813
|
+
[":fullscreen", 56],
|
|
6814
|
+
[":future", 57],
|
|
6815
|
+
[":has", 58],
|
|
6816
|
+
[":has-slotted", 59],
|
|
6817
|
+
[":host", 48],
|
|
6818
|
+
[":host", 48],
|
|
6819
|
+
[":host-context", 60],
|
|
6820
|
+
[":hover", 61],
|
|
6821
|
+
[":in-range", 62],
|
|
6822
|
+
[":indeterminate", 63],
|
|
6823
|
+
[":invalid", 64],
|
|
6824
|
+
[":is", 4],
|
|
6825
|
+
[":lang", 65],
|
|
6826
|
+
[":last-child", 66],
|
|
6827
|
+
[":last-of-type", 52],
|
|
6828
|
+
[":left", 67],
|
|
6829
|
+
[":link", 68],
|
|
6830
|
+
[":modal", 69],
|
|
6831
|
+
[":muted", 45],
|
|
6832
|
+
[":not", 49],
|
|
6833
|
+
[":nth-child", 70],
|
|
6834
|
+
[":nth-last-child", 71],
|
|
6835
|
+
[":nth-last-of-type", 72],
|
|
6836
|
+
[":nth-of-type", 52],
|
|
6837
|
+
[":only-child", 73],
|
|
6838
|
+
[":only-of-type", 52],
|
|
6839
|
+
[":open", 74],
|
|
6840
|
+
[":optional", 64],
|
|
6841
|
+
[":out-of-range", 62],
|
|
6842
|
+
[":past", 57],
|
|
6843
|
+
[":paused", 45],
|
|
6844
|
+
[":picture-in-picture", 75],
|
|
6845
|
+
[":placeholder-shown", 76],
|
|
6846
|
+
[":playing", 45],
|
|
6847
|
+
[":popover-open", 77],
|
|
6848
|
+
[":read-only", 78],
|
|
6849
|
+
[":read-write", 78],
|
|
6850
|
+
[":required", 79],
|
|
6851
|
+
[":right", 67],
|
|
6852
|
+
[":root", 80],
|
|
6853
|
+
[":scope", 81],
|
|
6854
|
+
[":seeking", 45],
|
|
6855
|
+
[":stalled", 45],
|
|
6856
|
+
[":state", 82],
|
|
6857
|
+
[":target", 83],
|
|
6858
|
+
[":user-invalid", 84],
|
|
6859
|
+
[":user-valid", 84],
|
|
6860
|
+
[":valid", 64],
|
|
6861
|
+
[":visited", 85],
|
|
6862
|
+
[":volume-locked", 45],
|
|
6863
|
+
[":where", 4]
|
|
4745
6864
|
]);
|
|
4746
6865
|
|
|
4747
6866
|
// The vendor spellings of a property's own keyword values, as `property ->
|
|
@@ -5241,13 +7360,17 @@ module.exports.AUTO_SECOND_VALUE_PROPERTIES = AUTO_SECOND_VALUE_PROPERTIES;
|
|
|
5241
7360
|
module.exports.BOX_FAMILY_PREFIX = BOX_FAMILY_PREFIX;
|
|
5242
7361
|
module.exports.BOX_LONGHANDS = BOX_LONGHANDS;
|
|
5243
7362
|
module.exports.BOX_SHORTHANDS = BOX_SHORTHANDS;
|
|
7363
|
+
module.exports.CALC_CONSTANTS = CALC_CONSTANTS;
|
|
5244
7364
|
module.exports.CALC_REJECTING_PROPERTIES = CALC_REJECTING_PROPERTIES;
|
|
5245
7365
|
module.exports.CANONICAL_NAMES = CANONICAL_NAMES;
|
|
5246
7366
|
module.exports.CLAMPED_VALUE_RANGES = CLAMPED_VALUE_RANGES;
|
|
5247
7367
|
module.exports.COLOR_ARGUMENT_FUNCTIONS = COLOR_ARGUMENT_FUNCTIONS;
|
|
7368
|
+
module.exports.COLOR_FUNCTIONS = COLOR_FUNCTIONS;
|
|
5248
7369
|
module.exports.COLOR_KEYWORDS = COLOR_KEYWORDS;
|
|
7370
|
+
module.exports.COLOR_NAME_TO_RGB = COLOR_NAME_TO_RGB;
|
|
5249
7371
|
module.exports.COLOR_NAME_TO_SHORTEST = COLOR_NAME_TO_SHORTEST;
|
|
5250
7372
|
module.exports.COLOR_ONLY_PROPERTIES = COLOR_ONLY_PROPERTIES;
|
|
7373
|
+
module.exports.COLOR_SPACE_MODEL = COLOR_SPACE_MODEL;
|
|
5251
7374
|
module.exports.COMPOUND_CONTINUATIONS = COMPOUND_CONTINUATIONS;
|
|
5252
7375
|
module.exports.CSS_MODULES_KEYWORDS = CSS_MODULES_KEYWORDS;
|
|
5253
7376
|
module.exports.CSS_MODULES_KEYWORD_OPTIONS = CSS_MODULES_KEYWORD_OPTIONS;
|
|
@@ -5261,8 +7384,12 @@ module.exports.EASING_KEYWORDS = EASING_KEYWORDS;
|
|
|
5261
7384
|
module.exports.EIGHTH_TURN_COSINE = EIGHTH_TURN_COSINE;
|
|
5262
7385
|
module.exports.EIGHTH_TURN_SINE = EIGHTH_TURN_SINE;
|
|
5263
7386
|
module.exports.EIGHTH_TURN_TANGENT = EIGHTH_TURN_TANGENT;
|
|
7387
|
+
module.exports.ENCODED_ALREADY = ENCODED_ALREADY;
|
|
7388
|
+
module.exports.ENGINE_TRANSFER_DIFFERS = ENGINE_TRANSFER_DIFFERS;
|
|
7389
|
+
module.exports.FAMILY_LIST_PROPERTIES = FAMILY_LIST_PROPERTIES;
|
|
5264
7390
|
module.exports.FAMILY_LONGHANDS = FAMILY_LONGHANDS;
|
|
5265
7391
|
module.exports.FAMILY_SLOT_CLASSES = FAMILY_SLOT_CLASSES;
|
|
7392
|
+
module.exports.FAMILY_SLOT_INITIALS = FAMILY_SLOT_INITIALS;
|
|
5266
7393
|
module.exports.FAMILY_SLOT_KEYWORDS = FAMILY_SLOT_KEYWORDS;
|
|
5267
7394
|
module.exports.FEATURELESS_PSEUDO_CLASSES = FEATURELESS_PSEUDO_CLASSES;
|
|
5268
7395
|
module.exports.FILTER_FUNCTION_OMITTED = FILTER_FUNCTION_OMITTED;
|
|
@@ -5275,9 +7402,12 @@ module.exports.GRADIENT_LAST_POSITIONS = GRADIENT_LAST_POSITIONS;
|
|
|
5275
7402
|
module.exports.INITIAL_VALUE_KEYWORDS = INITIAL_VALUE_KEYWORDS;
|
|
5276
7403
|
module.exports.INTEGER_PROPERTIES = INTEGER_PROPERTIES;
|
|
5277
7404
|
module.exports.KEYWORD_ONLY_PROPERTIES = KEYWORD_ONLY_PROPERTIES;
|
|
7405
|
+
module.exports.LATER_COLOR_NAMES = LATER_COLOR_NAMES;
|
|
7406
|
+
module.exports.LAYER_INITIALS = LAYER_INITIALS;
|
|
5278
7407
|
module.exports.LEGACY_PSEUDO_ELEMENTS = LEGACY_PSEUDO_ELEMENTS;
|
|
5279
7408
|
module.exports.LENGTH_ONLY_FUNCTIONS = LENGTH_ONLY_FUNCTIONS;
|
|
5280
7409
|
module.exports.LINEAR_GRADIENTS = LINEAR_GRADIENTS;
|
|
7410
|
+
module.exports.LINEAR_SRGB_TO_P3 = LINEAR_SRGB_TO_P3;
|
|
5281
7411
|
module.exports.MATH_FUNCTIONS = MATH_FUNCTIONS;
|
|
5282
7412
|
module.exports.MATH_FUNCTION_ARITY = MATH_FUNCTION_ARITY;
|
|
5283
7413
|
module.exports.MATH_FUNCTION_FOLD = MATH_FUNCTION_FOLD;
|
|
@@ -5297,6 +7427,7 @@ module.exports.PLACE_SHORTHANDS = PLACE_SHORTHANDS;
|
|
|
5297
7427
|
module.exports.POSITION_PROPERTIES = POSITION_PROPERTIES;
|
|
5298
7428
|
module.exports.POSITION_X_KEYWORDS = POSITION_X_KEYWORDS;
|
|
5299
7429
|
module.exports.POSITION_Y_KEYWORDS = POSITION_Y_KEYWORDS;
|
|
7430
|
+
module.exports.PREDEFINED_COLOR_SPACES = PREDEFINED_COLOR_SPACES;
|
|
5300
7431
|
module.exports.PREFIXED_AT_RULES = PREFIXED_AT_RULES;
|
|
5301
7432
|
module.exports.PREFIXED_PROPERTIES = PREFIXED_PROPERTIES;
|
|
5302
7433
|
module.exports.PREFIXED_SELECTORS = PREFIXED_SELECTORS;
|
|
@@ -5313,13 +7444,18 @@ module.exports.SELECTOR_FUNCTIONS = SELECTOR_FUNCTIONS;
|
|
|
5313
7444
|
module.exports.SELECTOR_SUPPORTED_FROM = SELECTOR_SUPPORTED_FROM;
|
|
5314
7445
|
module.exports.SHADOW_PROPERTIES = SHADOW_PROPERTIES;
|
|
5315
7446
|
module.exports.SHORTHAND_INITIAL_KEYWORDS = SHORTHAND_INITIAL_KEYWORDS;
|
|
7447
|
+
module.exports.SHORTHAND_LONGHANDS = SHORTHAND_LONGHANDS;
|
|
5316
7448
|
module.exports.SLASH_BOX_SHORTHANDS = SLASH_BOX_SHORTHANDS;
|
|
5317
7449
|
module.exports.SLASH_LONGHANDS = SLASH_LONGHANDS;
|
|
7450
|
+
module.exports.SRGB_SPACE = SRGB_SPACE;
|
|
5318
7451
|
module.exports.STEPPED_FUNCTIONS = STEPPED_FUNCTIONS;
|
|
5319
7452
|
module.exports.SUBSTITUTION_FUNCTIONS = SUBSTITUTION_FUNCTIONS;
|
|
5320
7453
|
module.exports.SUPPORTED_FROM = SUPPORTED_FROM;
|
|
5321
7454
|
module.exports.SUPPORT_BROWSERS = SUPPORT_BROWSERS;
|
|
5322
7455
|
module.exports.SUPPORT_PROFILES = SUPPORT_PROFILES;
|
|
7456
|
+
module.exports.SYSTEM_UI_STACK = SYSTEM_UI_STACK;
|
|
7457
|
+
module.exports.THROUGH_MATRIX = THROUGH_MATRIX;
|
|
7458
|
+
module.exports.THROUGH_TRANSFER = THROUGH_TRANSFER;
|
|
5323
7459
|
module.exports.TRANSITION_BEHAVIORS = TRANSITION_BEHAVIORS;
|
|
5324
7460
|
module.exports.UNIT_CONVERSION_TARGETS = UNIT_CONVERSION_TARGETS;
|
|
5325
7461
|
module.exports.UNIT_GROUP_BASE = UNIT_GROUP_BASE;
|
|
@@ -5327,8 +7463,8 @@ module.exports.UNSHARED_LONGHAND_KEYWORDS = UNSHARED_LONGHAND_KEYWORDS;
|
|
|
5327
7463
|
module.exports.X_AXIS_TRANSFORMS = X_AXIS_TRANSFORMS;
|
|
5328
7464
|
module.exports.ZERO_ANGLE_FUNCTIONS = ZERO_ANGLE_FUNCTIONS;
|
|
5329
7465
|
module.exports.ZERO_UNIT_KEEPING_PROPERTIES = ZERO_UNIT_KEEPING_PROPERTIES;
|
|
5330
|
-
// The
|
|
5331
|
-
//
|
|
5332
|
-
module.exports.
|
|
5333
|
-
module.exports.
|
|
5334
|
-
module.exports.
|
|
7466
|
+
// The arithmetic the printer's own evaluator needs. Sorted after the tables:
|
|
7467
|
+
// `import/order` orders exports by case, uppercase first.
|
|
7468
|
+
module.exports.foldAdd = foldAdd;
|
|
7469
|
+
module.exports.foldDivide = foldDivide;
|
|
7470
|
+
module.exports.foldMultiply = foldMultiply;
|