@stylix/core 3.1.3 → 4.0.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.
Files changed (88) hide show
  1. package/dist/index.js +853 -28
  2. package/dist/index.js.map +1 -1
  3. package/dist/module.mjs +828 -0
  4. package/dist/module.mjs.map +1 -0
  5. package/dist/types.d.ts +159 -26
  6. package/dist/types.d.ts.map +1 -0
  7. package/package.json +19 -31
  8. package/dist/Stylix.d.ts +0 -3
  9. package/dist/Stylix.js +0 -66
  10. package/dist/Stylix.js.map +0 -1
  11. package/dist/StylixProvider.d.ts +0 -52
  12. package/dist/StylixProvider.js +0 -143
  13. package/dist/StylixProvider.js.map +0 -1
  14. package/dist/applyRules.d.ts +0 -5
  15. package/dist/applyRules.js +0 -31
  16. package/dist/applyRules.js.map +0 -1
  17. package/dist/classifyProps.d.ts +0 -7
  18. package/dist/classifyProps.js +0 -35
  19. package/dist/classifyProps.js.map +0 -1
  20. package/dist/css-props.json +0 -413
  21. package/dist/html-tags.json +0 -119
  22. package/dist/index.d.ts +0 -8
  23. package/dist/plugins/cleanStyles.d.ts +0 -5
  24. package/dist/plugins/cleanStyles.js +0 -28
  25. package/dist/plugins/cleanStyles.js.map +0 -1
  26. package/dist/plugins/customProps.d.ts +0 -2
  27. package/dist/plugins/customProps.js +0 -61
  28. package/dist/plugins/customProps.js.map +0 -1
  29. package/dist/plugins/defaultUnits.d.ts +0 -7
  30. package/dist/plugins/defaultUnits.js +0 -41
  31. package/dist/plugins/defaultUnits.js.map +0 -1
  32. package/dist/plugins/flattenNestedStyles.d.ts +0 -5
  33. package/dist/plugins/flattenNestedStyles.js +0 -47
  34. package/dist/plugins/flattenNestedStyles.js.map +0 -1
  35. package/dist/plugins/index.d.ts +0 -30
  36. package/dist/plugins/index.js +0 -44
  37. package/dist/plugins/index.js.map +0 -1
  38. package/dist/plugins/mediaArrays.d.ts +0 -5
  39. package/dist/plugins/mediaArrays.js +0 -56
  40. package/dist/plugins/mediaArrays.js.map +0 -1
  41. package/dist/plugins/merge$css.d.ts +0 -6
  42. package/dist/plugins/merge$css.js +0 -45
  43. package/dist/plugins/merge$css.js.map +0 -1
  44. package/dist/plugins/propCasing.d.ts +0 -5
  45. package/dist/plugins/propCasing.js +0 -21
  46. package/dist/plugins/propCasing.js.map +0 -1
  47. package/dist/plugins/replace$$class.d.ts +0 -5
  48. package/dist/plugins/replace$$class.js +0 -20
  49. package/dist/plugins/replace$$class.js.map +0 -1
  50. package/dist/plugins/themeFunctions.d.ts +0 -5
  51. package/dist/plugins/themeFunctions.js +0 -20
  52. package/dist/plugins/themeFunctions.js.map +0 -1
  53. package/dist/styleCollector.d.ts +0 -8
  54. package/dist/styleCollector.js +0 -40
  55. package/dist/styleCollector.js.map +0 -1
  56. package/dist/stylesToRuleArray.d.ts +0 -5
  57. package/dist/stylesToRuleArray.js +0 -41
  58. package/dist/stylesToRuleArray.js.map +0 -1
  59. package/dist/types.js +0 -3
  60. package/dist/types.js.map +0 -1
  61. package/dist/useStyles.d.ts +0 -16
  62. package/dist/useStyles.js +0 -115
  63. package/dist/useStyles.js.map +0 -1
  64. package/dist/util/cloneDeep.d.ts +0 -4
  65. package/dist/util/cloneDeep.js +0 -28
  66. package/dist/util/cloneDeep.js.map +0 -1
  67. package/dist/util/flatten.d.ts +0 -4
  68. package/dist/util/flatten.js +0 -19
  69. package/dist/util/flatten.js.map +0 -1
  70. package/dist/util/hashString.d.ts +0 -4
  71. package/dist/util/hashString.js +0 -15
  72. package/dist/util/hashString.js.map +0 -1
  73. package/dist/util/isPlainObject.d.ts +0 -4
  74. package/dist/util/isPlainObject.js +0 -11
  75. package/dist/util/isPlainObject.js.map +0 -1
  76. package/dist/util/mapObjectRecursive.d.ts +0 -8
  77. package/dist/util/mapObjectRecursive.js +0 -37
  78. package/dist/util/mapObjectRecursive.js.map +0 -1
  79. package/dist/util/merge.d.ts +0 -5
  80. package/dist/util/merge.js +0 -31
  81. package/dist/util/merge.js.map +0 -1
  82. package/dist/util/useIsoLayoutEffect.d.ts +0 -2
  83. package/dist/util/useIsoLayoutEffect.js +0 -8
  84. package/dist/util/useIsoLayoutEffect.js.map +0 -1
  85. package/dist/util/walkRecursive.d.ts +0 -8
  86. package/dist/util/walkRecursive.js +0 -26
  87. package/dist/util/walkRecursive.js.map +0 -1
  88. package/exports.mjs +0 -8
@@ -1,143 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.StylixTheme = exports.StylixProvider = exports.useStylixTheme = exports.useStylixContext = void 0;
41
- const react_1 = __importStar(require("react"));
42
- const classifyProps_1 = require("./classifyProps");
43
- const css_props_json_1 = __importDefault(require("./css-props.json"));
44
- const plugins_1 = require("./plugins");
45
- const styleCollector_1 = require("./styleCollector");
46
- const flatten_1 = require("./util/flatten");
47
- const merge_1 = require("./util/merge");
48
- const useIsoLayoutEffect_1 = __importDefault(require("./util/useIsoLayoutEffect"));
49
- const IS_DEV_ENV = process.env.NODE_ENV !== 'production';
50
- const defaultStyleProps = {};
51
- for (const value of css_props_json_1.default) {
52
- defaultStyleProps[(0, classifyProps_1.simplifyStylePropName)(value)] = value;
53
- }
54
- function createStylixContext(userValues = {}) {
55
- var _a, _b;
56
- const ctx = {
57
- id: userValues.id || Math.round(Math.random() * 10000).toString(10),
58
- devMode: (_a = userValues.devMode) !== null && _a !== void 0 ? _a : IS_DEV_ENV,
59
- styleProps: defaultStyleProps,
60
- theme: userValues.theme || null,
61
- media: userValues.media || null,
62
- styleElement: userValues.styleElement,
63
- plugins: (0, flatten_1.flatten)(Object.values(plugins_1.defaultPlugins)),
64
- rules: {},
65
- cleanupRequest: undefined,
66
- };
67
- if (!ctx.styleElement && typeof document !== 'undefined') {
68
- ctx.styleElement = document.createElement('style');
69
- if (ctx.id)
70
- ctx.styleElement.id = 'stylix-' + ctx.id;
71
- ctx.styleElement.className = 'stylix';
72
- document.head.appendChild(ctx.styleElement);
73
- }
74
- if (ctx.styleElement)
75
- ctx.stylesheet = ctx.styleElement.sheet;
76
- if ((_b = userValues.plugins) === null || _b === void 0 ? void 0 : _b.length) {
77
- const flatPlugins = (0, flatten_1.flatten)(userValues.plugins);
78
- for (const i in flatPlugins) {
79
- const plugin = flatPlugins[i];
80
- let pluginIndex = -1;
81
- if (plugin.before && ctx.plugins.includes(plugin.before))
82
- pluginIndex = ctx.plugins.indexOf(plugin.before);
83
- if (plugin.after && ctx.plugins.includes(plugin.after))
84
- pluginIndex = ctx.plugins.indexOf(plugin.after) + 1;
85
- if ('atIndex' in plugin)
86
- pluginIndex = plugin.atIndex;
87
- if (pluginIndex === -1)
88
- ctx.plugins.push(plugin);
89
- else
90
- ctx.plugins.splice(pluginIndex, 0, plugin);
91
- }
92
- }
93
- (0, plugins_1.applyPlugins)('initialize', null, null, ctx);
94
- return ctx;
95
- }
96
- // The React context object
97
- const stylixContext = react_1.default.createContext(createStylixContext());
98
- // Convenience wrapper hook that returns the current Stylix context
99
- function useStylixContext() {
100
- return (0, react_1.useContext)(stylixContext);
101
- }
102
- exports.useStylixContext = useStylixContext;
103
- // Convenience wrapper hook that returns just the current Stylix theme
104
- function useStylixTheme() {
105
- return (0, react_1.useContext)(stylixContext).theme;
106
- }
107
- exports.useStylixTheme = useStylixTheme;
108
- function StylixProvider(_a) {
109
- var { id, devMode, plugins, styleElement, children } = _a, themeProps = __rest(_a, ["id", "devMode", "plugins", "styleElement", "children"]);
110
- const ctx = (0, react_1.useRef)();
111
- if (!ctx.current)
112
- ctx.current = createStylixContext({ id, devMode, plugins, styleElement });
113
- ctx.current.styleCollector = (0, react_1.useContext)(styleCollector_1.styleCollectorContext);
114
- return (react_1.default.createElement(stylixContext.Provider, { value: ctx.current },
115
- react_1.default.createElement(StylixTheme, Object.assign({}, themeProps), children)));
116
- }
117
- exports.StylixProvider = StylixProvider;
118
- function mergeContexts(contextA, contextB) {
119
- const obj = Object.assign({}, contextA);
120
- const themeB = contextB.theme;
121
- if (contextB) {
122
- for (const key in contextB) {
123
- const value = contextB[key];
124
- if (typeof value !== 'undefined')
125
- obj[key] = value;
126
- }
127
- }
128
- obj.theme = (0, merge_1.merge)(contextA.theme || {}, themeB);
129
- return obj;
130
- }
131
- function StylixTheme({ children, media, theme }) {
132
- const parentCtx = (0, react_1.useContext)(stylixContext);
133
- const [contextValue, setContextValue] = (0, react_1.useState)(() => mergeContexts(parentCtx, { media, theme }));
134
- // contextValue should only update (and cause re-renders) when relevant properties change.
135
- // `media` is treated as special because providing an array of strings is easier to do inline,
136
- // but we don't want to cause descendent re-renders if the values don't change.
137
- (0, useIsoLayoutEffect_1.default)(() => {
138
- setContextValue(mergeContexts(parentCtx, { media, theme }));
139
- }, [parentCtx, (media === null || media === void 0 ? void 0 : media.join('|')) || '', theme], false);
140
- return react_1.default.createElement(stylixContext.Provider, { value: contextValue }, children);
141
- }
142
- exports.StylixTheme = StylixTheme;
143
- //# sourceMappingURL=StylixProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StylixProvider.js","sourceRoot":"","sources":["../src/StylixProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA4D;AAE5D,mDAAwD;AACxD,sEAAwC;AACxC,uCAAuE;AACvE,qDAAyD;AACzD,4CAAyC;AACzC,wCAAqC;AACrC,mFAA2D;AAE3D,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;AAyDzD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,KAAK,MAAM,KAAK,IAAI,wBAAQ,EAAE;IAC5B,iBAAiB,CAAC,IAAA,qCAAqB,EAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC;CACzD;AAED,SAAS,mBAAmB,CAAC,aAAa,EAAkC;;IAC1E,MAAM,GAAG,GAAG;QACV,EAAE,EAAE,UAAU,CAAC,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnE,OAAO,EAAE,MAAA,UAAU,CAAC,OAAO,mCAAI,UAAU;QACzC,UAAU,EAAE,iBAAiB;QAC7B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,IAAI;QAC/B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,IAAI;QAC/B,YAAY,EAAE,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1C,KAAK,CACN,CAAC;IAEF,OAAO,8BAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,IAAG,QAAQ,CAA0B,CAAC;AAC1F,CAAC;AAnBD,kCAmBC"}
@@ -1,5 +0,0 @@
1
- import { StylixContext } from './StylixProvider';
2
- /**
3
- * Applies rules from given StylixContext to the <style> element.
4
- */
5
- export default function applyRules(ctx: StylixContext): void;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * Applies rules from given StylixContext to the <style> element.
5
- */
6
- function applyRules(ctx) {
7
- const flattenedRules = [];
8
- for (const key in ctx.rules) {
9
- const val = ctx.rules[key];
10
- flattenedRules.push(...val.rules);
11
- }
12
- if (ctx.styleCollector) {
13
- ctx.styleCollector.length = 0;
14
- ctx.styleCollector.push(...flattenedRules);
15
- return;
16
- }
17
- if (ctx.devMode) {
18
- ctx.styleElement.innerHTML = flattenedRules.join('\n');
19
- }
20
- else {
21
- const container = ctx.stylesheet;
22
- if (container.rules)
23
- while (container.rules.length) {
24
- container.deleteRule(0);
25
- }
26
- for (const i in flattenedRules)
27
- container.insertRule(flattenedRules[i], +i);
28
- }
29
- }
30
- exports.default = applyRules;
31
- //# sourceMappingURL=applyRules.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"applyRules.js","sourceRoot":"","sources":["../src/applyRules.ts"],"names":[],"mappings":";;AAEA;;GAEG;AACH,SAAwB,UAAU,CAAC,GAAkB;IACnD,MAAM,cAAc,GAAa,EAAE,CAAC;IAEpC,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE;QAC3B,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3B,cAAc,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;KACnC;IAED,IAAI,GAAG,CAAC,cAAc,EAAE;QACtB,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;QAC9B,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC;QAC3C,OAAO;KACR;IAED,IAAI,GAAG,CAAC,OAAO,EAAE;QACf,GAAG,CAAC,YAAY,CAAC,SAAS,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACxD;SAAM;QACL,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC;QACjC,IAAI,SAAS,CAAC,KAAK;YACjB,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE;gBAC7B,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;aACzB;QACH,KAAK,MAAM,CAAC,IAAI,cAAc;YAAE,SAAS,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC7E;AACH,CAAC;AAxBD,6BAwBC"}
@@ -1,7 +0,0 @@
1
- export declare function classifyProps(props: any, knownProps: Record<string, string>): [any, any];
2
- /**
3
- * Determines if `value` is a recognized CSS property (can be standard CSS or custom Stylix prop).
4
- */
5
- export declare function isStyleProp(value: string, knownProps: Record<string, string>): boolean;
6
- export declare function isValidJSXProp(value: string): boolean;
7
- export declare function simplifyStylePropName(value: string): string;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.simplifyStylePropName = exports.isValidJSXProp = exports.isStyleProp = exports.classifyProps = void 0;
4
- function classifyProps(props, knownProps) {
5
- const styles = {};
6
- const other = {};
7
- for (const key in props) {
8
- // If prop is not a valid JSX prop, it must be a CSS selector
9
- if (!isValidJSXProp(key) || isStyleProp(key, knownProps)) {
10
- styles[key] = props[key];
11
- }
12
- else {
13
- other[key] = props[key];
14
- }
15
- }
16
- return [styles, other];
17
- }
18
- exports.classifyProps = classifyProps;
19
- /**
20
- * Determines if `value` is a recognized CSS property (can be standard CSS or custom Stylix prop).
21
- */
22
- function isStyleProp(value, knownProps) {
23
- return isValidJSXProp(value) && simplifyStylePropName(value) in knownProps;
24
- }
25
- exports.isStyleProp = isStyleProp;
26
- function isValidJSXProp(value) {
27
- // Not an exact check, but mostly rules out complex css selectors
28
- return /^[a-z$][a-z0-9_-]*$/i.test(value);
29
- }
30
- exports.isValidJSXProp = isValidJSXProp;
31
- function simplifyStylePropName(value) {
32
- return value.toLowerCase().replace(/[^a-z]/gi, '');
33
- }
34
- exports.simplifyStylePropName = simplifyStylePropName;
35
- //# sourceMappingURL=classifyProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"classifyProps.js","sourceRoot":"","sources":["../src/classifyProps.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,CAAC,KAAU,EAAE,UAAkC;IAC1E,MAAM,MAAM,GAAG,EAAS,CAAC;IACzB,MAAM,KAAK,GAAG,EAAS,CAAC;IAExB,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;QACvB,6DAA6D;QAC7D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE;YACxD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;SAC1B;aAAM;YACL,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;SACzB;KACF;IAED,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACzB,CAAC;AAdD,sCAcC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,KAAa,EAAE,UAAkC;IAC3E,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,qBAAqB,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC;AAC7E,CAAC;AAFD,kCAEC;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,iEAAiE;IACjE,OAAO,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAHD,wCAGC;AAED,SAAgB,qBAAqB,CAAC,KAAa;IACjD,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACrD,CAAC;AAFD,sDAEC"}
@@ -1,413 +0,0 @@
1
- [
2
- "align-content",
3
- "align-items",
4
- "align-self",
5
- "align-tracks",
6
- "all",
7
- "animation",
8
- "animation-delay",
9
- "animation-direction",
10
- "animation-duration",
11
- "animation-fill-mode",
12
- "animation-iteration-count",
13
- "animation-name",
14
- "animation-play-state",
15
- "animation-timing-function",
16
- "appearance",
17
- "aspect-ratio",
18
- "azimuth",
19
- "backdrop-filter",
20
- "backface-visibility",
21
- "background",
22
- "background-attachment",
23
- "background-blend-mode",
24
- "background-clip",
25
- "background-color",
26
- "background-image",
27
- "background-origin",
28
- "background-position",
29
- "background-position-x",
30
- "background-position-y",
31
- "background-repeat",
32
- "background-size",
33
- "block-overflow",
34
- "block-size",
35
- "border",
36
- "border-block",
37
- "border-block-color",
38
- "border-block-style",
39
- "border-block-width",
40
- "border-block-end",
41
- "border-block-end-color",
42
- "border-block-end-style",
43
- "border-block-end-width",
44
- "border-block-start",
45
- "border-block-start-color",
46
- "border-block-start-style",
47
- "border-block-start-width",
48
- "border-bottom",
49
- "border-bottom-color",
50
- "border-bottom-left-radius",
51
- "border-bottom-right-radius",
52
- "border-bottom-style",
53
- "border-bottom-width",
54
- "border-collapse",
55
- "border-color",
56
- "border-end-end-radius",
57
- "border-end-start-radius",
58
- "border-image",
59
- "border-image-outset",
60
- "border-image-repeat",
61
- "border-image-slice",
62
- "border-image-source",
63
- "border-image-width",
64
- "border-inline",
65
- "border-inline-end",
66
- "border-inline-color",
67
- "border-inline-style",
68
- "border-inline-width",
69
- "border-inline-end-color",
70
- "border-inline-end-style",
71
- "border-inline-end-width",
72
- "border-inline-start",
73
- "border-inline-start-color",
74
- "border-inline-start-style",
75
- "border-inline-start-width",
76
- "border-left",
77
- "border-left-color",
78
- "border-left-style",
79
- "border-left-width",
80
- "border-radius",
81
- "border-right",
82
- "border-right-color",
83
- "border-right-style",
84
- "border-right-width",
85
- "border-spacing",
86
- "border-start-end-radius",
87
- "border-start-start-radius",
88
- "border-style",
89
- "border-top",
90
- "border-top-color",
91
- "border-top-left-radius",
92
- "border-top-right-radius",
93
- "border-top-style",
94
- "border-top-width",
95
- "border-width",
96
- "bottom",
97
- "box-align",
98
- "box-decoration-break",
99
- "box-direction",
100
- "box-flex",
101
- "box-flex-group",
102
- "box-lines",
103
- "box-ordinal-group",
104
- "box-orient",
105
- "box-pack",
106
- "box-shadow",
107
- "box-sizing",
108
- "break-after",
109
- "break-before",
110
- "break-inside",
111
- "caption-side",
112
- "caret-color",
113
- "clear",
114
- "clip",
115
- "clip-path",
116
- "color",
117
- "color-adjust",
118
- "color-scheme",
119
- "column-count",
120
- "column-fill",
121
- "column-gap",
122
- "column-rule",
123
- "column-rule-color",
124
- "column-rule-style",
125
- "column-rule-width",
126
- "column-span",
127
- "column-width",
128
- "columns",
129
- "contain",
130
- "content",
131
- "content-visibility",
132
- "counter-increment",
133
- "counter-reset",
134
- "counter-set",
135
- "cursor",
136
- "direction",
137
- "display",
138
- "empty-cells",
139
- "filter",
140
- "flex",
141
- "flex-basis",
142
- "flex-direction",
143
- "flex-flow",
144
- "flex-grow",
145
- "flex-shrink",
146
- "flex-wrap",
147
- "float",
148
- "font",
149
- "font-family",
150
- "font-feature-settings",
151
- "font-kerning",
152
- "font-language-override",
153
- "font-optical-sizing",
154
- "font-variation-settings",
155
- "font-size",
156
- "font-size-adjust",
157
- "font-smooth",
158
- "font-stretch",
159
- "font-style",
160
- "font-synthesis",
161
- "font-variant",
162
- "font-variant-alternates",
163
- "font-variant-caps",
164
- "font-variant-east-asian",
165
- "font-variant-ligatures",
166
- "font-variant-numeric",
167
- "font-variant-position",
168
- "font-weight",
169
- "forced-color-adjust",
170
- "gap",
171
- "grid",
172
- "grid-area",
173
- "grid-auto-columns",
174
- "grid-auto-flow",
175
- "grid-auto-rows",
176
- "grid-column",
177
- "grid-column-end",
178
- "grid-column-gap",
179
- "grid-column-start",
180
- "grid-gap",
181
- "grid-row",
182
- "grid-row-end",
183
- "grid-row-gap",
184
- "grid-row-start",
185
- "grid-template",
186
- "grid-template-areas",
187
- "grid-template-columns",
188
- "grid-template-rows",
189
- "hanging-punctuation",
190
- "height",
191
- "hyphens",
192
- "image-orientation",
193
- "image-rendering",
194
- "image-resolution",
195
- "ime-mode",
196
- "initial-letter",
197
- "initial-letter-align",
198
- "inline-size",
199
- "inset",
200
- "inset-block",
201
- "inset-block-end",
202
- "inset-block-start",
203
- "inset-inline",
204
- "inset-inline-end",
205
- "inset-inline-start",
206
- "isolation",
207
- "justify-content",
208
- "justify-items",
209
- "justify-self",
210
- "justify-tracks",
211
- "left",
212
- "letter-spacing",
213
- "line-break",
214
- "line-clamp",
215
- "line-height",
216
- "line-height-step",
217
- "list-style",
218
- "list-style-image",
219
- "list-style-position",
220
- "list-style-type",
221
- "margin",
222
- "margin-block",
223
- "margin-block-end",
224
- "margin-block-start",
225
- "margin-bottom",
226
- "margin-inline",
227
- "margin-inline-end",
228
- "margin-inline-start",
229
- "margin-left",
230
- "margin-right",
231
- "margin-top",
232
- "margin-trim",
233
- "mask",
234
- "mask-border",
235
- "mask-border-mode",
236
- "mask-border-outset",
237
- "mask-border-repeat",
238
- "mask-border-slice",
239
- "mask-border-source",
240
- "mask-border-width",
241
- "mask-clip",
242
- "mask-composite",
243
- "mask-image",
244
- "mask-mode",
245
- "mask-origin",
246
- "mask-position",
247
- "mask-repeat",
248
- "mask-size",
249
- "mask-type",
250
- "masonry-auto-flow",
251
- "math-style",
252
- "max-block-size",
253
- "max-height",
254
- "max-inline-size",
255
- "max-lines",
256
- "max-width",
257
- "min-block-size",
258
- "min-height",
259
- "min-inline-size",
260
- "min-width",
261
- "mix-blend-mode",
262
- "object-fit",
263
- "object-position",
264
- "offset",
265
- "offset-anchor",
266
- "offset-distance",
267
- "offset-path",
268
- "offset-position",
269
- "offset-rotate",
270
- "opacity",
271
- "order",
272
- "orphans",
273
- "outline",
274
- "outline-color",
275
- "outline-offset",
276
- "outline-style",
277
- "outline-width",
278
- "overflow",
279
- "overflow-anchor",
280
- "overflow-block",
281
- "overflow-clip-box",
282
- "overflow-clip-margin",
283
- "overflow-inline",
284
- "overflow-wrap",
285
- "overflow-x",
286
- "overflow-y",
287
- "overscroll-behavior",
288
- "overscroll-behavior-block",
289
- "overscroll-behavior-inline",
290
- "overscroll-behavior-x",
291
- "overscroll-behavior-y",
292
- "padding",
293
- "padding-block",
294
- "padding-block-end",
295
- "padding-block-start",
296
- "padding-bottom",
297
- "padding-inline",
298
- "padding-inline-end",
299
- "padding-inline-start",
300
- "padding-left",
301
- "padding-right",
302
- "padding-top",
303
- "page-break-after",
304
- "page-break-before",
305
- "page-break-inside",
306
- "paint-order",
307
- "perspective",
308
- "perspective-origin",
309
- "place-content",
310
- "place-items",
311
- "place-self",
312
- "pointer-events",
313
- "position",
314
- "quotes",
315
- "resize",
316
- "right",
317
- "rotate",
318
- "row-gap",
319
- "ruby-align",
320
- "ruby-merge",
321
- "ruby-position",
322
- "scale",
323
- "scrollbar-color",
324
- "scrollbar-gutter",
325
- "scrollbar-width",
326
- "scroll-behavior",
327
- "scroll-margin",
328
- "scroll-margin-block",
329
- "scroll-margin-block-start",
330
- "scroll-margin-block-end",
331
- "scroll-margin-bottom",
332
- "scroll-margin-inline",
333
- "scroll-margin-inline-start",
334
- "scroll-margin-inline-end",
335
- "scroll-margin-left",
336
- "scroll-margin-right",
337
- "scroll-margin-top",
338
- "scroll-padding",
339
- "scroll-padding-block",
340
- "scroll-padding-block-start",
341
- "scroll-padding-block-end",
342
- "scroll-padding-bottom",
343
- "scroll-padding-inline",
344
- "scroll-padding-inline-start",
345
- "scroll-padding-inline-end",
346
- "scroll-padding-left",
347
- "scroll-padding-right",
348
- "scroll-padding-top",
349
- "scroll-snap-align",
350
- "scroll-snap-coordinate",
351
- "scroll-snap-destination",
352
- "scroll-snap-points-x",
353
- "scroll-snap-points-y",
354
- "scroll-snap-stop",
355
- "scroll-snap-type",
356
- "scroll-snap-type-x",
357
- "scroll-snap-type-y",
358
- "shape-image-threshold",
359
- "shape-margin",
360
- "shape-outside",
361
- "tab-size",
362
- "table-layout",
363
- "text-align",
364
- "text-align-last",
365
- "text-combine-upright",
366
- "text-decoration",
367
- "text-decoration-color",
368
- "text-decoration-line",
369
- "text-decoration-skip",
370
- "text-decoration-skip-ink",
371
- "text-decoration-style",
372
- "text-decoration-thickness",
373
- "text-emphasis",
374
- "text-emphasis-color",
375
- "text-emphasis-position",
376
- "text-emphasis-style",
377
- "text-indent",
378
- "text-justify",
379
- "text-orientation",
380
- "text-overflow",
381
- "text-rendering",
382
- "text-shadow",
383
- "text-size-adjust",
384
- "text-transform",
385
- "text-underline-offset",
386
- "text-underline-position",
387
- "top",
388
- "touch-action",
389
- "transform",
390
- "transform-box",
391
- "transform-origin",
392
- "transform-style",
393
- "transition",
394
- "transition-delay",
395
- "transition-duration",
396
- "transition-property",
397
- "transition-timing-function",
398
- "translate",
399
- "unicode-bidi",
400
- "user-select",
401
- "vertical-align",
402
- "visibility",
403
- "white-space",
404
- "widows",
405
- "width",
406
- "will-change",
407
- "word-break",
408
- "word-spacing",
409
- "word-wrap",
410
- "writing-mode",
411
- "z-index",
412
- "zoom"
413
- ]