@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.
- package/dist/index.js +853 -28
- package/dist/index.js.map +1 -1
- package/dist/module.mjs +828 -0
- package/dist/module.mjs.map +1 -0
- package/dist/types.d.ts +159 -26
- package/dist/types.d.ts.map +1 -0
- package/package.json +19 -31
- package/dist/Stylix.d.ts +0 -3
- package/dist/Stylix.js +0 -66
- package/dist/Stylix.js.map +0 -1
- package/dist/StylixProvider.d.ts +0 -52
- package/dist/StylixProvider.js +0 -143
- package/dist/StylixProvider.js.map +0 -1
- package/dist/applyRules.d.ts +0 -5
- package/dist/applyRules.js +0 -31
- package/dist/applyRules.js.map +0 -1
- package/dist/classifyProps.d.ts +0 -7
- package/dist/classifyProps.js +0 -35
- package/dist/classifyProps.js.map +0 -1
- package/dist/css-props.json +0 -413
- package/dist/html-tags.json +0 -119
- package/dist/index.d.ts +0 -8
- package/dist/plugins/cleanStyles.d.ts +0 -5
- package/dist/plugins/cleanStyles.js +0 -28
- package/dist/plugins/cleanStyles.js.map +0 -1
- package/dist/plugins/customProps.d.ts +0 -2
- package/dist/plugins/customProps.js +0 -61
- package/dist/plugins/customProps.js.map +0 -1
- package/dist/plugins/defaultUnits.d.ts +0 -7
- package/dist/plugins/defaultUnits.js +0 -41
- package/dist/plugins/defaultUnits.js.map +0 -1
- package/dist/plugins/flattenNestedStyles.d.ts +0 -5
- package/dist/plugins/flattenNestedStyles.js +0 -47
- package/dist/plugins/flattenNestedStyles.js.map +0 -1
- package/dist/plugins/index.d.ts +0 -30
- package/dist/plugins/index.js +0 -44
- package/dist/plugins/index.js.map +0 -1
- package/dist/plugins/mediaArrays.d.ts +0 -5
- package/dist/plugins/mediaArrays.js +0 -56
- package/dist/plugins/mediaArrays.js.map +0 -1
- package/dist/plugins/merge$css.d.ts +0 -6
- package/dist/plugins/merge$css.js +0 -45
- package/dist/plugins/merge$css.js.map +0 -1
- package/dist/plugins/propCasing.d.ts +0 -5
- package/dist/plugins/propCasing.js +0 -21
- package/dist/plugins/propCasing.js.map +0 -1
- package/dist/plugins/replace$$class.d.ts +0 -5
- package/dist/plugins/replace$$class.js +0 -20
- package/dist/plugins/replace$$class.js.map +0 -1
- package/dist/plugins/themeFunctions.d.ts +0 -5
- package/dist/plugins/themeFunctions.js +0 -20
- package/dist/plugins/themeFunctions.js.map +0 -1
- package/dist/styleCollector.d.ts +0 -8
- package/dist/styleCollector.js +0 -40
- package/dist/styleCollector.js.map +0 -1
- package/dist/stylesToRuleArray.d.ts +0 -5
- package/dist/stylesToRuleArray.js +0 -41
- package/dist/stylesToRuleArray.js.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/useStyles.d.ts +0 -16
- package/dist/useStyles.js +0 -115
- package/dist/useStyles.js.map +0 -1
- package/dist/util/cloneDeep.d.ts +0 -4
- package/dist/util/cloneDeep.js +0 -28
- package/dist/util/cloneDeep.js.map +0 -1
- package/dist/util/flatten.d.ts +0 -4
- package/dist/util/flatten.js +0 -19
- package/dist/util/flatten.js.map +0 -1
- package/dist/util/hashString.d.ts +0 -4
- package/dist/util/hashString.js +0 -15
- package/dist/util/hashString.js.map +0 -1
- package/dist/util/isPlainObject.d.ts +0 -4
- package/dist/util/isPlainObject.js +0 -11
- package/dist/util/isPlainObject.js.map +0 -1
- package/dist/util/mapObjectRecursive.d.ts +0 -8
- package/dist/util/mapObjectRecursive.js +0 -37
- package/dist/util/mapObjectRecursive.js.map +0 -1
- package/dist/util/merge.d.ts +0 -5
- package/dist/util/merge.js +0 -31
- package/dist/util/merge.js.map +0 -1
- package/dist/util/useIsoLayoutEffect.d.ts +0 -2
- package/dist/util/useIsoLayoutEffect.js +0 -8
- package/dist/util/useIsoLayoutEffect.js.map +0 -1
- package/dist/util/walkRecursive.d.ts +0 -8
- package/dist/util/walkRecursive.js +0 -26
- package/dist/util/walkRecursive.js.map +0 -1
- package/exports.mjs +0 -8
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.themeFunctions = void 0;
|
|
4
|
-
const mapObjectRecursive_1 = require("../util/mapObjectRecursive");
|
|
5
|
-
/**
|
|
6
|
-
* Evaluates functions in style objects, providing the theme and media from the current Stylix context.
|
|
7
|
-
*/
|
|
8
|
-
exports.themeFunctions = {
|
|
9
|
-
name: 'themeFunctions',
|
|
10
|
-
type: 'preprocessStyles',
|
|
11
|
-
plugin(ctx, styles) {
|
|
12
|
-
return (0, mapObjectRecursive_1.mapObjectRecursive)(styles, themeFunctionsMap, { ctx });
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
function themeFunctionsMap(key, value, object, context) {
|
|
16
|
-
if (typeof value === 'function') {
|
|
17
|
-
return { [key]: value(context.ctx.theme, context.ctx) };
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=themeFunctions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"themeFunctions.js","sourceRoot":"","sources":["../../src/plugins/themeFunctions.ts"],"names":[],"mappings":";;;AAAA,mEAAgE;AAGhE;;GAEG;AACU,QAAA,cAAc,GAAiB;IAC1C,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE,kBAAkB;IACxB,MAAM,CAAC,GAAgC,EAAE,MAAW;QAClD,OAAO,IAAA,uCAAkB,EAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAChE,CAAC;CACF,CAAC;AAEF,SAAS,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO;IACpD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;QAC/B,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;KACzD;AACH,CAAC"}
|
package/dist/styleCollector.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface StyleCollector {
|
|
3
|
-
collect: (element: React.ReactElement) => React.ReactElement;
|
|
4
|
-
render: React.FC<React.ComponentProps<'style'>>;
|
|
5
|
-
styles: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare const styleCollectorContext: React.Context<string[]>;
|
|
8
|
-
export declare function createStyleCollector(): StyleCollector;
|
package/dist/styleCollector.js
DELETED
|
@@ -1,40 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.createStyleCollector = exports.styleCollectorContext = void 0;
|
|
27
|
-
const react_1 = __importStar(require("react"));
|
|
28
|
-
exports.styleCollectorContext = (0, react_1.createContext)(null);
|
|
29
|
-
function createStyleCollector() {
|
|
30
|
-
const styles = [];
|
|
31
|
-
const collector = {
|
|
32
|
-
collect: (element) => (react_1.default.createElement(exports.styleCollectorContext.Provider, { value: styles }, element)),
|
|
33
|
-
render: (props) => (react_1.default.createElement("style", Object.assign({ type: "text/css", key: props.id || 'stylix' }, props, { dangerouslySetInnerHTML: { __html: collector.styles.join(' ') } }))),
|
|
34
|
-
styles,
|
|
35
|
-
};
|
|
36
|
-
collector.render.displayName = 'StylixStyleCollectorRenderer';
|
|
37
|
-
return collector;
|
|
38
|
-
}
|
|
39
|
-
exports.createStyleCollector = createStyleCollector;
|
|
40
|
-
//# sourceMappingURL=styleCollector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styleCollector.js","sourceRoot":"","sources":["../src/styleCollector.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA6C;AAQhC,QAAA,qBAAqB,GAAG,IAAA,qBAAa,EAAW,IAAI,CAAC,CAAC;AAEnE,SAAgB,oBAAoB;IAClC,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,MAAM,SAAS,GAAmB;QAChC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CACpB,8BAAC,6BAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,IAAG,OAAO,CAAkC,CAC1F;QACD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CACjB,uDACE,IAAI,EAAC,UAAU,EACf,GAAG,EAAE,KAAK,CAAC,EAAE,IAAI,QAAQ,IACrB,KAAK,IACT,uBAAuB,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAC/D,CACH;QACD,MAAM;KACP,CAAC;IACF,SAAS,CAAC,MAAM,CAAC,WAAW,GAAG,8BAA8B,CAAC;IAC9D,OAAO,SAAS,CAAC;AACnB,CAAC;AAlBD,oDAkBC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const plugins_1 = require("./plugins");
|
|
4
|
-
const isPlainObject_1 = require("./util/isPlainObject");
|
|
5
|
-
/**
|
|
6
|
-
* Converts a Stylix CSS object to an array of rules, suitable for passing to StyleSheet#insertRule.
|
|
7
|
-
*/
|
|
8
|
-
function stylesToRuleArray(styles, hash, context) {
|
|
9
|
-
try {
|
|
10
|
-
const processedStyles = (0, plugins_1.applyPlugins)('processStyles', styles, hash, context);
|
|
11
|
-
// serialize to css rules array
|
|
12
|
-
const serialize = function serialize(selector, styles) {
|
|
13
|
-
const lines = [];
|
|
14
|
-
for (const key in styles) {
|
|
15
|
-
const value = styles[key];
|
|
16
|
-
if ((0, isPlainObject_1.isPlainObject)(value))
|
|
17
|
-
lines.push(serialize(key, value));
|
|
18
|
-
else
|
|
19
|
-
lines.push(` ${key}: ${value};`);
|
|
20
|
-
}
|
|
21
|
-
return `${selector} {\n${lines.join('\n')} }`;
|
|
22
|
-
};
|
|
23
|
-
const result = [];
|
|
24
|
-
for (const key in processedStyles) {
|
|
25
|
-
const value = processedStyles[key];
|
|
26
|
-
result.push(serialize(key, value));
|
|
27
|
-
}
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
if (e.name && e.reason) {
|
|
32
|
-
console.error(`${e.name}: ${e.reason}\n`, e.source.replace('\n', ' ').substr(Math.max(0, e.column - 20), 100) + '\n', ' '.repeat(20) + '^');
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
console.error(e);
|
|
36
|
-
}
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.default = stylesToRuleArray;
|
|
41
|
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,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,MAAM,IAAI,EAC1B,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,IAAI,EAC1E,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,CACrB,CAAC;SACH;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClB;QACD,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AArCD,oCAqCC"}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/dist/useStyles.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Accepts a Stylix CSS object and returns a unique className based on the styles' hash.
|
|
3
|
-
* The styles are registered with the Stylix context and will be applied to the document.
|
|
4
|
-
* If `global` is false, provided styles will be nested within the generated classname.
|
|
5
|
-
* Returns the className hash if enabled, or an empty string.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useStyles(styles: any, options?: {
|
|
8
|
-
global?: boolean;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
}): string;
|
|
11
|
-
export declare function useKeyframes(keyframes: any, options?: {
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
}): string;
|
|
14
|
-
export declare function useGlobalStyles(styles: any, options?: {
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
}): string;
|
package/dist/useStyles.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useGlobalStyles = exports.useKeyframes = exports.useStyles = void 0;
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const applyRules_1 = __importDefault(require("./applyRules"));
|
|
9
|
-
const plugins_1 = require("./plugins");
|
|
10
|
-
const stylesToRuleArray_1 = __importDefault(require("./stylesToRuleArray"));
|
|
11
|
-
const StylixProvider_1 = require("./StylixProvider");
|
|
12
|
-
const hashString_1 = require("./util/hashString");
|
|
13
|
-
const useIsoLayoutEffect_1 = __importDefault(require("./util/useIsoLayoutEffect"));
|
|
14
|
-
function cleanup(ctx) {
|
|
15
|
-
if (typeof ctx.cleanupRequest !== 'undefined')
|
|
16
|
-
return;
|
|
17
|
-
ctx.cleanupRequest = setTimeout(() => {
|
|
18
|
-
let deleted = false;
|
|
19
|
-
for (const i in ctx.rules) {
|
|
20
|
-
const rule = ctx.rules[i];
|
|
21
|
-
if (!rule.refs) {
|
|
22
|
-
delete ctx.rules[rule.hash];
|
|
23
|
-
deleted = true;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
deleted && (0, applyRules_1.default)(ctx);
|
|
27
|
-
delete ctx.cleanupRequest;
|
|
28
|
-
}, 100);
|
|
29
|
-
}
|
|
30
|
-
function compare(a, b) {
|
|
31
|
-
if (a === b)
|
|
32
|
-
return true;
|
|
33
|
-
if (typeof a !== typeof b)
|
|
34
|
-
return false;
|
|
35
|
-
if (typeof a === 'object') {
|
|
36
|
-
if (Array.isArray(a) && Array.isArray(b) && a.length !== b.length)
|
|
37
|
-
return false;
|
|
38
|
-
else if (Object.keys(a).length !== Object.keys(b).length)
|
|
39
|
-
return false;
|
|
40
|
-
for (const key in b) {
|
|
41
|
-
if (!compare(a[key], b[key]))
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return a === b;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Accepts a Stylix CSS object and returns a unique className based on the styles' hash.
|
|
49
|
-
* The styles are registered with the Stylix context and will be applied to the document.
|
|
50
|
-
* If `global` is false, provided styles will be nested within the generated classname.
|
|
51
|
-
* Returns the className hash if enabled, or an empty string.
|
|
52
|
-
*/
|
|
53
|
-
function useStyles(styles, options = { global: false, disabled: false }) {
|
|
54
|
-
const stylixCtx = (0, StylixProvider_1.useStylixContext)();
|
|
55
|
-
const prevRef = (0, react_1.useRef)({ styles: {}, hash: '' });
|
|
56
|
-
const changed = !compare(styles, prevRef.current.styles);
|
|
57
|
-
prevRef.current.styles = styles;
|
|
58
|
-
if (changed) {
|
|
59
|
-
// Preprocess styles with plugins
|
|
60
|
-
if (!options.disabled && styles)
|
|
61
|
-
styles = (0, plugins_1.applyPlugins)('preprocessStyles', styles, null, stylixCtx);
|
|
62
|
-
// Serialize value and generate hash
|
|
63
|
-
const json = !options.disabled && styles && JSON.stringify(styles);
|
|
64
|
-
prevRef.current.hash =
|
|
65
|
-
json && json !== '{}' && json !== '[]'
|
|
66
|
-
? (0, hashString_1.hashString)(JSON.stringify(stylixCtx.media || []) + json)
|
|
67
|
-
: '';
|
|
68
|
-
}
|
|
69
|
-
const { hash } = prevRef.current;
|
|
70
|
-
if (hash && changed && !stylixCtx.rules[hash]) {
|
|
71
|
-
// If not global styles, wrap original styles with classname
|
|
72
|
-
if (!options.global)
|
|
73
|
-
styles = { ['.' + hash]: styles };
|
|
74
|
-
stylixCtx.rules[hash] = {
|
|
75
|
-
hash,
|
|
76
|
-
rules: (0, stylesToRuleArray_1.default)(styles, hash, stylixCtx),
|
|
77
|
-
refs: 1,
|
|
78
|
-
};
|
|
79
|
-
stylixCtx.requestApply = true;
|
|
80
|
-
}
|
|
81
|
-
// Apply styles if requested.
|
|
82
|
-
// This runs on every render. We utilize useLayoutEffect so that it runs *after* all the other
|
|
83
|
-
// renders have completed. stylixCtx.requestApply guards against multiple runs. This reduces the number of calls
|
|
84
|
-
// to applyRules(), but prevents styles potentially being added to the DOM after other components force the
|
|
85
|
-
// browser to compute styles.
|
|
86
|
-
(0, useIsoLayoutEffect_1.default)(() => {
|
|
87
|
-
if (!stylixCtx.requestApply)
|
|
88
|
-
return;
|
|
89
|
-
stylixCtx.requestApply = false;
|
|
90
|
-
(0, applyRules_1.default)(stylixCtx);
|
|
91
|
-
}, undefined, true);
|
|
92
|
-
// When hash changes, add/remove ref count
|
|
93
|
-
(0, useIsoLayoutEffect_1.default)(() => {
|
|
94
|
-
if (!hash || !changed)
|
|
95
|
-
return;
|
|
96
|
-
if (stylixCtx.rules[hash]) {
|
|
97
|
-
stylixCtx.rules[hash].refs++;
|
|
98
|
-
}
|
|
99
|
-
return () => {
|
|
100
|
-
stylixCtx.rules[hash].refs--;
|
|
101
|
-
cleanup(stylixCtx);
|
|
102
|
-
};
|
|
103
|
-
}, [hash], false);
|
|
104
|
-
return hash;
|
|
105
|
-
}
|
|
106
|
-
exports.useStyles = useStyles;
|
|
107
|
-
function useKeyframes(keyframes, options = { disabled: false }) {
|
|
108
|
-
return useStyles({ '@keyframes $$class': keyframes }, Object.assign({ global: true }, options));
|
|
109
|
-
}
|
|
110
|
-
exports.useKeyframes = useKeyframes;
|
|
111
|
-
function useGlobalStyles(styles, options = { disabled: false }) {
|
|
112
|
-
return useStyles(styles, Object.assign(Object.assign({}, options), { global: true }));
|
|
113
|
-
}
|
|
114
|
-
exports.useGlobalStyles = useGlobalStyles;
|
|
115
|
-
//# sourceMappingURL=useStyles.js.map
|
package/dist/useStyles.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useStyles.js","sourceRoot":"","sources":["../src/useStyles.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA+B;AAE/B,8DAAsC;AACtC,uCAAyC;AACzC,4EAAoD;AACpD,qDAAmE;AACnE,kDAA+C;AAC/C,mFAA2D;AAE3D,SAAS,OAAO,CAAC,GAAkB;IACjC,IAAI,OAAO,GAAG,CAAC,cAAc,KAAK,WAAW;QAAE,OAAO;I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gB,eAAe,CAC7B,MAAW,EACX,UAAkC,EAAE,QAAQ,EAAE,KAAK,EAAE;IAErD,OAAO,SAAS,CAAC,MAAM,kCAAO,OAAO,KAAE,MAAM,EAAE,IAAI,IAAG,CAAC;AACzD,CAAC;AALD,0CAKC"}
|
package/dist/util/cloneDeep.d.ts
DELETED
package/dist/util/cloneDeep.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cloneDeep = void 0;
|
|
4
|
-
const isPlainObject_1 = require("./isPlainObject");
|
|
5
|
-
/**
|
|
6
|
-
* Deeply clones a value.
|
|
7
|
-
*/
|
|
8
|
-
function cloneDeep(value) {
|
|
9
|
-
if (!value || typeof value !== 'object')
|
|
10
|
-
return value;
|
|
11
|
-
if (Array.isArray(value)) {
|
|
12
|
-
const clone = [];
|
|
13
|
-
for (let index = 0; index < value.length; ++index) {
|
|
14
|
-
clone.push(cloneDeep(value[index]));
|
|
15
|
-
}
|
|
16
|
-
return clone;
|
|
17
|
-
}
|
|
18
|
-
if ((0, isPlainObject_1.isPlainObject)(value)) {
|
|
19
|
-
const clone = {};
|
|
20
|
-
for (const key in value) {
|
|
21
|
-
clone[key] = cloneDeep(value[key]);
|
|
22
|
-
}
|
|
23
|
-
return clone;
|
|
24
|
-
}
|
|
25
|
-
return value;
|
|
26
|
-
}
|
|
27
|
-
exports.cloneDeep = cloneDeep;
|
|
28
|
-
//# sourceMappingURL=cloneDeep.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cloneDeep.js","sourceRoot":"","sources":["../../src/util/cloneDeep.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAEhD;;GAEG;AACH,SAAgB,SAAS,CAAI,KAAQ;IACnC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,MAAM,KAAK,GAAQ,EAAE,CAAC;QACtB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE;YACjD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACrC;QACD,OAAO,KAAK,CAAC;KACd;IACD,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE;QACxB,MAAM,KAAK,GAAQ,EAAE,CAAC;QACtB,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;YACvB,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;SACpC;QACD,OAAO,KAAK,CAAC;KACd;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAjBD,8BAiBC"}
|
package/dist/util/flatten.d.ts
DELETED
package/dist/util/flatten.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flatten = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Flatten an array recursively.
|
|
6
|
-
*/
|
|
7
|
-
function flatten(array) {
|
|
8
|
-
const result = [];
|
|
9
|
-
_flatten(array, result);
|
|
10
|
-
return result;
|
|
11
|
-
}
|
|
12
|
-
exports.flatten = flatten;
|
|
13
|
-
function _flatten(array, result) {
|
|
14
|
-
for (let i = 0; i < array.length; i++) {
|
|
15
|
-
const value = array[i];
|
|
16
|
-
Array.isArray(value) ? _flatten(value, result) : result.push(value);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=flatten.js.map
|
package/dist/util/flatten.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flatten.js","sourceRoot":"","sources":["../../src/util/flatten.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,OAAO,CAAa,KAAgB;IAClD,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACxB,OAAO,MAAsB,CAAC;AAChC,CAAC;AAJD,0BAIC;AAED,SAAS,QAAQ,CAAC,KAAgB,EAAE,MAAiB;IACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACvB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAY,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC5E;AACH,CAAC"}
|
package/dist/util/hashString.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hashString = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Cheap string hashing, suitable for generating css class names
|
|
6
|
-
*/
|
|
7
|
-
function hashString(str) {
|
|
8
|
-
let hash = 5381;
|
|
9
|
-
let i = str.length;
|
|
10
|
-
while (i)
|
|
11
|
-
hash = (hash * 33) ^ str.charCodeAt(--i);
|
|
12
|
-
return 'stylix-' + (hash >>> 0).toString(36);
|
|
13
|
-
}
|
|
14
|
-
exports.hashString = hashString;
|
|
15
|
-
//# sourceMappingURL=hashString.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hashString.js","sourceRoot":"","sources":["../../src/util/hashString.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,UAAU,CAAC,GAAG;IAC5B,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IACnB,OAAO,CAAC;QAAE,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IACnD,OAAO,SAAS,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC/C,CAAC;AALD,gCAKC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPlainObject = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Indicates that an object is most likely just an object literal.
|
|
6
|
-
*/
|
|
7
|
-
function isPlainObject(obj) {
|
|
8
|
-
return typeof obj === 'object' && (obj === null || obj === void 0 ? void 0 : obj.__proto__) === Object.prototype;
|
|
9
|
-
}
|
|
10
|
-
exports.isPlainObject = isPlainObject;
|
|
11
|
-
//# sourceMappingURL=isPlainObject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isPlainObject.js","sourceRoot":"","sources":["../../src/util/isPlainObject.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,aAAa,CAAC,GAAQ;IACpC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,SAAS,MAAK,MAAM,CAAC,SAAS,CAAC;AACxE,CAAC;AAFD,sCAEC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Invokes `map` on each key/value pair in `object`. The key/value pair is deleted from the object and replaced by
|
|
3
|
-
* merging in the object returned from `map`. Recursively descends into all object and array values.
|
|
4
|
-
* The `map` function will receive the key, the value, the current object being mapped, and a context object.
|
|
5
|
-
* The context object is a plain object that you can modify as needed. The value will persist to subsequent calls to
|
|
6
|
-
* `map` on child properties of `value`.
|
|
7
|
-
*/
|
|
8
|
-
export declare function mapObjectRecursive(object: any, map: (key: string | number, value: any, object: any, context: any) => Record<string | number, any>, context?: any): {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapObjectRecursive = void 0;
|
|
4
|
-
const isPlainObject_1 = require("./isPlainObject");
|
|
5
|
-
/**
|
|
6
|
-
* Invokes `map` on each key/value pair in `object`. The key/value pair is deleted from the object and replaced by
|
|
7
|
-
* merging in the object returned from `map`. Recursively descends into all object and array values.
|
|
8
|
-
* The `map` function will receive the key, the value, the current object being mapped, and a context object.
|
|
9
|
-
* The context object is a plain object that you can modify as needed. The value will persist to subsequent calls to
|
|
10
|
-
* `map` on child properties of `value`.
|
|
11
|
-
*/
|
|
12
|
-
function mapObjectRecursive(object, map, context = {}) {
|
|
13
|
-
const clone = Array.isArray(object) ? [] : {};
|
|
14
|
-
for (const k of Object.keys(object)) {
|
|
15
|
-
let key = k;
|
|
16
|
-
const value = object[key];
|
|
17
|
-
if (Array.isArray(object))
|
|
18
|
-
key = +key;
|
|
19
|
-
const contextClone = Object.assign({}, context);
|
|
20
|
-
let result = map(key, value, object, contextClone);
|
|
21
|
-
if (typeof result !== 'undefined' && typeof result !== 'object' && !Array.isArray(result))
|
|
22
|
-
throw new Error('mapObjectRecursive: return value of map function must be undefined, object, or array!');
|
|
23
|
-
if (typeof result === 'undefined') {
|
|
24
|
-
result = { [key]: value };
|
|
25
|
-
}
|
|
26
|
-
for (const kk in result) {
|
|
27
|
-
let value = result[kk];
|
|
28
|
-
if ((0, isPlainObject_1.isPlainObject)(value) || Array.isArray(value))
|
|
29
|
-
value = mapObjectRecursive(value, map, contextClone);
|
|
30
|
-
if (typeof value !== 'undefined')
|
|
31
|
-
clone[kk] = value;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return clone;
|
|
35
|
-
}
|
|
36
|
-
exports.mapObjectRecursive = mapObjectRecursive;
|
|
37
|
-
//# sourceMappingURL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AK,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;YACvD,IAAI,OAAO,KAAK,KAAK,WAAW;gBAAE,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;SACrD;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAnCD,gDAmCC"}
|
package/dist/util/merge.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function merge<A>(a?: A): A;
|
|
2
|
-
export declare function merge<A, B>(a: A, b: B): A & B;
|
|
3
|
-
export declare function merge<A, B, C>(a: A, b: B, c: C): A & B & C;
|
|
4
|
-
export declare function merge<A, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D;
|
|
5
|
-
export declare function merge<A, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): A & B & C & D & E;
|
package/dist/util/merge.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.merge = void 0;
|
|
4
|
-
const isPlainObject_1 = require("./isPlainObject");
|
|
5
|
-
function merge(...items) {
|
|
6
|
-
items = items.filter((item) => typeof item !== 'undefined' && item !== null);
|
|
7
|
-
if (!(items === null || items === void 0 ? void 0 : items.length))
|
|
8
|
-
return undefined;
|
|
9
|
-
if (items.length === 1)
|
|
10
|
-
return items[0];
|
|
11
|
-
// If items are not all objects/arrays, return the last object/array if possible, otherwise last non-undefined value
|
|
12
|
-
if (!items.every((item) => Array.isArray(item) || (0, isPlainObject_1.isPlainObject)(item))) {
|
|
13
|
-
items.reverse();
|
|
14
|
-
return (items.find((item) => Array.isArray(item) || (0, isPlainObject_1.isPlainObject)(item)) ||
|
|
15
|
-
items.find((item) => typeof item !== 'undefined'));
|
|
16
|
-
}
|
|
17
|
-
const merged = Array.isArray(items[0]) ? [] : {};
|
|
18
|
-
for (const item of items) {
|
|
19
|
-
if (!Array.isArray(item) && !(0, isPlainObject_1.isPlainObject)(item))
|
|
20
|
-
return merged;
|
|
21
|
-
const keys = [...Object.keys(item), ...Object.getOwnPropertySymbols(item)];
|
|
22
|
-
for (const key of keys) {
|
|
23
|
-
const result = merge(merged[key], item[key]);
|
|
24
|
-
if (typeof result !== 'undefined')
|
|
25
|
-
merged[key] = result;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return merged;
|
|
29
|
-
}
|
|
30
|
-
exports.merge = merge;
|
|
31
|
-
//# sourceMappingURL=merge.js.map
|
package/dist/util/merge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/util/merge.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAQhD,SAAgB,KAAK,CAAC,GAAG,KAAwB;IAC/C,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC;IAC7E,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,CAAA;QAAE,OAAO,SAAS,CAAC;IAErC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAExC,oHAAoH;IACpH,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAA,6BAAa,EAAC,IAAI,CAAC,CAAC,EAAE;QACtE,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,OAAO,CACL,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAA,6BAAa,EAAC,IAAI,CAAC,CAAC;YAChE,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,WAAW,CAAC,CAClD,CAAC;KACH;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAA,6BAAa,EAAC,IAAI,CAAC;YAAE,OAAO,MAAM,CAAC;QAEhE,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3E,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC7C,IAAI,OAAO,MAAM,KAAK,WAAW;gBAAE,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;SACzD;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AA1BD,sBA0BC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const react_1 = require("react");
|
|
4
|
-
const useIsoLayoutEffect = typeof window !== 'undefined'
|
|
5
|
-
? (fn, deps, runOnSsr) => (0, react_1.useLayoutEffect)(fn, deps)
|
|
6
|
-
: (fn, deps, runOnSsr) => (runOnSsr ? fn() : null);
|
|
7
|
-
exports.default = useIsoLayoutEffect;
|
|
8
|
-
//# sourceMappingURL=useIsoLayoutEffect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIsoLayoutEffect.js","sourceRoot":"","sources":["../../src/util/useIsoLayoutEffect.ts"],"names":[],"mappings":";;AAAA,iCAAwC;AAExC,MAAM,kBAAkB,GACtB,OAAO,MAAM,KAAK,WAAW;IAC3B,CAAC,CAAC,CAAC,EAA6B,EAAE,IAAW,EAAE,QAAiB,EAAE,EAAE,CAAC,IAAA,uBAAe,EAAC,EAAE,EAAE,IAAI,CAAC;IAC9F,CAAC,CAAC,CAAC,EAAoB,EAAE,IAAW,EAAE,QAAiB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAEzF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Invokes a callback for each key/value pair in `object`, and continues recursively on each value that is an array or a
|
|
3
|
-
* plain object. Returns `object`.
|
|
4
|
-
* The `cb` function will receive the key, the value, the current object being mapped, and a context object.
|
|
5
|
-
* The context object is a plain object that you can modify as needed. The value will persist to subsequent calls to
|
|
6
|
-
* `map` on child properties of `value`.
|
|
7
|
-
*/
|
|
8
|
-
export declare function walkRecursive<T = any>(object: T, cb: (key: string, value: any, currentObject: any, context: any) => void, context?: any): T;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.walkRecursive = void 0;
|
|
4
|
-
const cloneDeep_1 = require("./cloneDeep");
|
|
5
|
-
const isPlainObject_1 = require("./isPlainObject");
|
|
6
|
-
/**
|
|
7
|
-
* Invokes a callback for each key/value pair in `object`, and continues recursively on each value that is an array or a
|
|
8
|
-
* plain object. Returns `object`.
|
|
9
|
-
* The `cb` function will receive the key, the value, the current object being mapped, and a context object.
|
|
10
|
-
* The context object is a plain object that you can modify as needed. The value will persist to subsequent calls to
|
|
11
|
-
* `map` on child properties of `value`.
|
|
12
|
-
*/
|
|
13
|
-
function walkRecursive(object, cb, context) {
|
|
14
|
-
const keys = Object.keys(object);
|
|
15
|
-
for (const key of keys) {
|
|
16
|
-
const value = object[key];
|
|
17
|
-
cb(key, value, object, context);
|
|
18
|
-
if (Array.isArray(value) || (0, isPlainObject_1.isPlainObject)(value)) {
|
|
19
|
-
const contextClone = (0, cloneDeep_1.cloneDeep)(context);
|
|
20
|
-
walkRecursive(value, cb, contextClone);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return object;
|
|
24
|
-
}
|
|
25
|
-
exports.walkRecursive = walkRecursive;
|
|
26
|
-
//# sourceMappingURL=walkRecursive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"walkRecursive.js","sourceRoot":"","sources":["../../src/util/walkRecursive.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,mDAAgD;AAEhD;;;;;;GAMG;AACH,SAAgB,aAAa,CAC3B,MAAS,EACT,EAAuE,EACvE,OAAa;IAEb,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE;YAChD,MAAM,YAAY,GAAG,IAAA,qBAAS,EAAC,OAAO,CAAC,CAAC;YACxC,aAAa,CAAC,KAAK,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC;SACxC;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAfD,sCAeC"}
|
package/exports.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { useStylixContext, useStylixTheme, StylixProvider, StylixTheme, } from './dist/StylixProvider';
|
|
2
|
-
export { useStyles, useKeyframes, useGlobalStyles } from './dist/useStyles';
|
|
3
|
-
export { defaultPlugins, customProps } from './dist/plugins';
|
|
4
|
-
export { mapObjectRecursive } from './dist/util/mapObjectRecursive';
|
|
5
|
-
export { walkRecursive } from './dist/util/walkRecursive';
|
|
6
|
-
export { createStyleCollector, styleCollectorContext } from './dist/styleCollector';
|
|
7
|
-
import $ from './dist/Stylix';
|
|
8
|
-
export default $.default;
|