@elliemae/ds-system 3.0.0-next.6 → 3.0.0-next.60
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/cjs/arithmetic.js +20 -22
- package/dist/cjs/arithmetic.js.map +2 -2
- package/dist/cjs/constants.js +9 -16
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/ds-styled/index.js +22 -0
- package/dist/cjs/ds-styled/index.js.map +7 -0
- package/dist/cjs/ds-styled/styled.js +103 -0
- package/dist/cjs/ds-styled/styled.js.map +7 -0
- package/dist/cjs/ds-styled/types.js +20 -0
- package/dist/cjs/ds-styled/types.js.map +7 -0
- package/dist/cjs/ds-styled/utilities/height.js +32 -0
- package/dist/cjs/ds-styled/utilities/height.js.map +7 -0
- package/dist/cjs/ds-styled/utilities/helpers.js +66 -0
- package/dist/cjs/ds-styled/utilities/helpers.js.map +7 -0
- package/dist/cjs/ds-styled/utilities/index.js +26 -0
- package/dist/cjs/ds-styled/utilities/index.js.map +7 -0
- package/dist/cjs/ds-styled/utilities/magicCssTransform.js +58 -0
- package/dist/cjs/ds-styled/utilities/magicCssTransform.js.map +7 -0
- package/dist/cjs/ds-styled/utilities/resolvers.js +49 -0
- package/dist/cjs/ds-styled/utilities/resolvers.js.map +7 -0
- package/dist/cjs/ds-styled/utilities/width.js +32 -0
- package/dist/cjs/ds-styled/utilities/width.js.map +7 -0
- package/dist/cjs/globalStyles.js +11 -18
- package/dist/cjs/globalStyles.js.map +2 -2
- package/dist/cjs/index.js +18 -24
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/mobileUtilities.js +17 -26
- package/dist/cjs/mobileUtilities.js.map +2 -2
- package/dist/cjs/spaceUtilities.js +9 -16
- package/dist/cjs/spaceUtilities.js.map +1 -1
- package/dist/cjs/th.js +48 -29
- package/dist/cjs/th.js.map +2 -2
- package/dist/cjs/theme.js +9 -16
- package/dist/cjs/theme.js.map +1 -1
- package/dist/cjs/themeProviderHOC.js +16 -20
- package/dist/cjs/themeProviderHOC.js.map +2 -2
- package/dist/cjs/utils.js +37 -37
- package/dist/cjs/utils.js.map +2 -2
- package/dist/esm/arithmetic.js +11 -6
- package/dist/esm/arithmetic.js.map +2 -2
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/ds-styled/index.js +3 -0
- package/dist/esm/ds-styled/index.js.map +7 -0
- package/dist/esm/{styled/index.js → ds-styled/styled.js} +37 -23
- package/dist/esm/ds-styled/styled.js.map +7 -0
- package/dist/esm/ds-styled/types.js +2 -0
- package/dist/esm/{styled/index.d.js.map → ds-styled/types.js.map} +0 -0
- package/dist/esm/ds-styled/utilities/height.js +10 -0
- package/dist/esm/ds-styled/utilities/height.js.map +7 -0
- package/dist/esm/ds-styled/utilities/helpers.js +46 -0
- package/dist/esm/ds-styled/utilities/helpers.js.map +7 -0
- package/dist/esm/ds-styled/utilities/index.js +7 -0
- package/dist/esm/ds-styled/utilities/index.js.map +7 -0
- package/dist/esm/ds-styled/utilities/magicCssTransform.js +36 -0
- package/dist/esm/ds-styled/utilities/magicCssTransform.js.map +7 -0
- package/dist/esm/{styled/styleGetters.js → ds-styled/utilities/resolvers.js} +2 -2
- package/dist/esm/ds-styled/utilities/resolvers.js.map +7 -0
- package/dist/esm/ds-styled/utilities/width.js +10 -0
- package/dist/esm/ds-styled/utilities/width.js.map +7 -0
- package/dist/esm/globalStyles.js +1 -1
- package/dist/esm/globalStyles.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mobileUtilities.js +8 -10
- package/dist/esm/mobileUtilities.js.map +2 -2
- package/dist/esm/spaceUtilities.js.map +1 -1
- package/dist/esm/th.js +39 -13
- package/dist/esm/th.js.map +2 -2
- package/dist/esm/theme.js.map +1 -1
- package/dist/esm/themeProviderHOC.js +7 -4
- package/dist/esm/themeProviderHOC.js.map +2 -2
- package/dist/esm/utils.js +13 -6
- package/dist/esm/utils.js.map +2 -2
- package/package.json +13 -13
- package/dist/cjs/styled/index.d.js +0 -27
- package/dist/cjs/styled/index.d.js.map +0 -7
- package/dist/cjs/styled/index.js +0 -105
- package/dist/cjs/styled/index.js.map +0 -7
- package/dist/cjs/styled/styleGetters.js +0 -56
- package/dist/cjs/styled/styleGetters.js.map +0 -7
- package/dist/cjs/styled/types.js +0 -35
- package/dist/cjs/styled/types.js.map +0 -7
- package/dist/cjs/styled/utils.js +0 -47
- package/dist/cjs/styled/utils.js.map +0 -7
- package/dist/esm/styled/index.d.js +0 -2
- package/dist/esm/styled/index.js.map +0 -7
- package/dist/esm/styled/styleGetters.js.map +0 -7
- package/dist/esm/styled/types.js +0 -6
- package/dist/esm/styled/types.js.map +0 -7
- package/dist/esm/styled/utils.js +0 -18
- package/dist/esm/styled/utils.js.map +0 -7
package/dist/cjs/arithmetic.js
CHANGED
|
@@ -4,35 +4,34 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var __toESM = (
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
21
|
var arithmetic_exports = {};
|
|
29
22
|
__export(arithmetic_exports, {
|
|
30
23
|
getNumberAndUnit: () => getNumberAndUnit,
|
|
31
24
|
op: () => op
|
|
32
25
|
});
|
|
26
|
+
module.exports = __toCommonJS(arithmetic_exports);
|
|
33
27
|
var React = __toESM(require("react"));
|
|
34
28
|
function getNumberAndUnit(numberStrWithUnit) {
|
|
35
|
-
const
|
|
29
|
+
const matchResult = String(numberStrWithUnit).match(/[a-z]+|[(/^\-?\d*.\d+|\d+),?]+/gi);
|
|
30
|
+
let number = "0";
|
|
31
|
+
let unit = "px";
|
|
32
|
+
if (matchResult) {
|
|
33
|
+
[number, unit] = matchResult;
|
|
34
|
+
}
|
|
36
35
|
return { number, unit };
|
|
37
36
|
}
|
|
38
37
|
function op(operator, n1, n2) {
|
|
@@ -40,16 +39,15 @@ function op(operator, n1, n2) {
|
|
|
40
39
|
const { number: number2, unit: unit2 } = getNumberAndUnit(n2);
|
|
41
40
|
switch (operator) {
|
|
42
41
|
case "*":
|
|
43
|
-
return Number(number) * Number(number2)
|
|
42
|
+
return `${Number(number) * Number(number2)}${unit || unit2}`;
|
|
44
43
|
case "+":
|
|
45
|
-
return Number(number) + Number(number2)
|
|
44
|
+
return `${Number(number) + Number(number2)}${unit || unit2}`;
|
|
46
45
|
case "-":
|
|
47
|
-
return Number(number) - Number(number2)
|
|
46
|
+
return `${Number(number) - Number(number2)}${unit || unit2}`;
|
|
48
47
|
case "/":
|
|
49
|
-
return Number(number) / Number(number2)
|
|
48
|
+
return `${Number(number) / Number(number2)}${unit || unit2}`;
|
|
50
49
|
default:
|
|
51
|
-
return Number(number) + Number(number2)
|
|
50
|
+
return `${Number(number) + Number(number2)}${unit || unit2}`;
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
module.exports = __toCommonJS(arithmetic_exports);
|
|
55
53
|
//# sourceMappingURL=arithmetic.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/arithmetic.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export function getNumberAndUnit(
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export function getNumberAndUnit(numberStrWithUnit: string | number): { number: string; unit: string } {\n const matchResult = String(numberStrWithUnit).match(/[a-z]+|[(/^\\-?\\d*.\\d+|\\d+),?]+/gi);\n let number = '0';\n let unit = 'px';\n if (matchResult) {\n [number, unit] = matchResult;\n }\n\n return { number, unit };\n}\n\nexport function op(operator: string, n1: string, n2: string | number): string {\n const { number, unit } = getNumberAndUnit(n1);\n const { number: number2, unit: unit2 } = getNumberAndUnit(n2);\n switch (operator) {\n case '*':\n return `${Number(number) * Number(number2)}${unit || unit2}`;\n case '+':\n return `${Number(number) + Number(number2)}${unit || unit2}`;\n case '-':\n return `${Number(number) - Number(number2)}${unit || unit2}`;\n case '/':\n return `${Number(number) / Number(number2)}${unit || unit2}`;\n default:\n return `${Number(number) + Number(number2)}${unit || unit2}`;\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,0BAA0B,mBAAsE;AACrG,QAAM,cAAc,OAAO,iBAAiB,EAAE,MAAM,kCAAkC;AACtF,MAAI,SAAS;AACb,MAAI,OAAO;AACX,MAAI,aAAa;AACf,KAAC,QAAQ,IAAI,IAAI;AAAA,EACnB;AAEA,SAAO,EAAE,QAAQ,KAAK;AACxB;AAEO,YAAY,UAAkB,IAAY,IAA6B;AAC5E,QAAM,EAAE,QAAQ,SAAS,iBAAiB,EAAE;AAC5C,QAAM,EAAE,QAAQ,SAAS,MAAM,UAAU,iBAAiB,EAAE;AAC5D,UAAQ;AAAA,SACD;AACH,aAAO,GAAG,OAAO,MAAM,IAAI,OAAO,OAAO,IAAI,QAAQ;AAAA,SAClD;AACH,aAAO,GAAG,OAAO,MAAM,IAAI,OAAO,OAAO,IAAI,QAAQ;AAAA,SAClD;AACH,aAAO,GAAG,OAAO,MAAM,IAAI,OAAO,OAAO,IAAI,QAAQ;AAAA,SAClD;AACH,aAAO,GAAG,OAAO,MAAM,IAAI,OAAO,OAAO,IAAI,QAAQ;AAAA;AAErD,aAAO,GAAG,OAAO,MAAM,IAAI,OAAO,OAAO,IAAI,QAAQ;AAAA;AAE3D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/constants.js
CHANGED
|
@@ -4,33 +4,27 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var __toESM = (
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
21
|
var constants_exports = {};
|
|
29
22
|
__export(constants_exports, {
|
|
30
23
|
desktopBaseFont: () => desktopBaseFont,
|
|
31
24
|
mobileBaseFont: () => mobileBaseFont,
|
|
32
25
|
translateUnits: () => translateUnits
|
|
33
26
|
});
|
|
27
|
+
module.exports = __toCommonJS(constants_exports);
|
|
34
28
|
var React = __toESM(require("react"));
|
|
35
29
|
const desktopBaseFont = 13;
|
|
36
30
|
const mobileBaseFont = 16;
|
|
@@ -43,5 +37,4 @@ const translateUnits = {
|
|
|
43
37
|
"64px": "48px",
|
|
44
38
|
"72px": "64px"
|
|
45
39
|
};
|
|
46
|
-
module.exports = __toCommonJS(constants_exports);
|
|
47
40
|
//# sourceMappingURL=constants.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/constants.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["export const desktopBaseFont = 13;\n\nexport const mobileBaseFont = 16;\n\nexport const translateUnits = {\n '8px': '4px',\n '16px': '8px',\n '32px': '16px',\n '48px': '24px',\n '56px': '32px',\n '64px': '48px',\n '72px': '64px',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,kBAAkB;AAExB,MAAM,iBAAiB;AAEvB,MAAM,iBAAiB;AAAA,EAC5B,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AACV;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from))
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var ds_styled_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(ds_styled_exports);
|
|
20
|
+
var React = __toESM(require("react"));
|
|
21
|
+
__reExport(ds_styled_exports, require("./styled"), module.exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ds-styled/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export * from './styled';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAc,qBAAd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var styled_exports = {};
|
|
39
|
+
__export(styled_exports, {
|
|
40
|
+
createGlobalStyle: () => createGlobalStyle,
|
|
41
|
+
css: () => css,
|
|
42
|
+
styled: () => styled
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(styled_exports);
|
|
45
|
+
var React = __toESM(require("react"));
|
|
46
|
+
var import_styled_components = require("@xstyled/styled-components");
|
|
47
|
+
var import_system = require("@xstyled/system");
|
|
48
|
+
var import_utilities = require("./utilities");
|
|
49
|
+
const { css, styled: baseStyledComponent, createGlobalStyle } = (0, import_styled_components.createCss)((0, import_system.compose)(import_system.system, import_utilities.width, import_utilities.height));
|
|
50
|
+
const styledFunction = (tag, options = { name: null, slot: null }) => {
|
|
51
|
+
const { name: componentName, slot: componentSlot } = options;
|
|
52
|
+
const defaultStyledResolver = baseStyledComponent(tag);
|
|
53
|
+
const attributes = {
|
|
54
|
+
attrs: defaultStyledResolver.attrs,
|
|
55
|
+
withConfig: defaultStyledResolver.withConfig
|
|
56
|
+
};
|
|
57
|
+
const dimsumStyledResolver = (styleArg, ...expressions) => {
|
|
58
|
+
const [styleArgWithMagic, expressionsWithMagic] = (0, import_utilities.magicCssTransform)(styleArg, expressions);
|
|
59
|
+
const expressionsWithDefaultTheme = expressionsWithMagic ? expressionsWithMagic.map(import_utilities.stylesArgThemeCoercion) : [];
|
|
60
|
+
let transformedStyleArg = styleArgWithMagic;
|
|
61
|
+
if (componentName && componentSlot) {
|
|
62
|
+
expressionsWithDefaultTheme.push((props) => {
|
|
63
|
+
const theme = (0, import_utilities.coerceWithDefaultTheme)(props.theme);
|
|
64
|
+
const styleOverrides = (0, import_utilities.getStyleOverrides)(componentName, theme);
|
|
65
|
+
if (styleOverrides) {
|
|
66
|
+
return [styleOverrides[componentSlot]];
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (componentName && componentSlot === "root") {
|
|
72
|
+
expressionsWithDefaultTheme.push((props) => {
|
|
73
|
+
const theme = (0, import_utilities.coerceWithDefaultTheme)(props.theme);
|
|
74
|
+
return (0, import_utilities.variantsResolver)(props, (0, import_utilities.getVariantStyles)(componentName, theme), theme, componentName);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressionsWithMagic.length;
|
|
78
|
+
if (Array.isArray(styleArgWithMagic) && numOfCustomFnsApplied > 0) {
|
|
79
|
+
const placeholders = new Array(numOfCustomFnsApplied).fill("");
|
|
80
|
+
transformedStyleArg = Object.assign([...styleArgWithMagic, ...placeholders], {
|
|
81
|
+
raw: [...styleArgWithMagic.raw, ...placeholders]
|
|
82
|
+
});
|
|
83
|
+
} else if (typeof styleArgWithMagic === "function") {
|
|
84
|
+
transformedStyleArg = (props) => styleArgWithMagic(__spreadProps(__spreadValues({}, props), { theme: (0, import_utilities.coerceWithDefaultTheme)(props.theme) }));
|
|
85
|
+
}
|
|
86
|
+
const displayName = componentName !== null && componentSlot !== null ? `${componentName}-${componentSlot}` : null;
|
|
87
|
+
const classNameObject = displayName !== null ? { className: displayName } : {};
|
|
88
|
+
const defaultStyledResolverWithClassName = defaultStyledResolver.attrs(classNameObject);
|
|
89
|
+
const Component = defaultStyledResolverWithClassName(transformedStyleArg, ...expressionsWithDefaultTheme);
|
|
90
|
+
if (displayName !== null) {
|
|
91
|
+
Component.displayName = displayName;
|
|
92
|
+
}
|
|
93
|
+
return Component;
|
|
94
|
+
};
|
|
95
|
+
return Object.assign(dimsumStyledResolver, attributes);
|
|
96
|
+
};
|
|
97
|
+
const styledObject = Object.keys(baseStyledComponent).reduce((obj, key) => {
|
|
98
|
+
const castedKey = key;
|
|
99
|
+
obj[castedKey] = styledFunction(castedKey);
|
|
100
|
+
return obj;
|
|
101
|
+
}, {});
|
|
102
|
+
const styled = Object.assign(styledFunction, styledObject);
|
|
103
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ds-styled/styled.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/unbound-method */\n/* eslint-disable complexity */\nimport { createCss } from '@xstyled/styled-components';\nimport { system, compose } from '@xstyled/system';\nimport { StyledComponentInnerComponent, StyledComponentPropsWithRef } from 'styled-components';\nimport { DSStyledFunction, DSStyledFunctionInternal, DSStyledObject, PropsWithTheme } from './types';\nimport {\n coerceWithDefaultTheme,\n getStyleOverrides,\n magicCssTransform,\n getVariantStyles,\n height,\n stylesArgThemeCoercion,\n variantsResolver,\n width,\n} from './utilities';\n\nconst { css, styled: baseStyledComponent, createGlobalStyle } = createCss(compose(system, width, height));\n\n// @ts-ignore\nconst styledFunction: DSStyledFunction = (tag, options = { name: null, slot: null }) => {\n const { name: componentName, slot: componentSlot } = options;\n\n const defaultStyledResolver = baseStyledComponent(tag);\n\n const attributes = {\n attrs: defaultStyledResolver.attrs,\n withConfig: defaultStyledResolver.withConfig,\n };\n\n // @ts-ignore\n const dimsumStyledResolver: DSStyledFunctionInternal = (styleArg, ...expressions) => {\n /**\n * Here we apply a CSS transformation to support MAGIC styled components\n */\n\n const [styleArgWithMagic, expressionsWithMagic] = magicCssTransform(styleArg, expressions);\n\n /*\n * These are the internal expression written in dimsum\n * We just coerce with the default theme in case users\n * forget to add the ThemeProvider\n */\n const expressionsWithDefaultTheme = expressionsWithMagic ? expressionsWithMagic.map(stylesArgThemeCoercion) : [];\n\n let transformedStyleArg = styleArgWithMagic;\n\n /*\n * Here we get the style overrides from the user\n */\n if (componentName && componentSlot) {\n expressionsWithDefaultTheme.push((props: PropsWithTheme) => {\n const theme = coerceWithDefaultTheme(props.theme);\n const styleOverrides = getStyleOverrides(componentName, theme);\n if (styleOverrides) {\n return [styleOverrides[componentSlot]];\n }\n return null;\n });\n }\n\n /*\n * Here we get the variant overrides from the user (only for the root)\n */\n if (componentName && componentSlot === 'root') {\n expressionsWithDefaultTheme.push((props: PropsWithTheme) => {\n const theme = coerceWithDefaultTheme(props.theme);\n return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);\n });\n }\n\n const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressionsWithMagic.length;\n\n if (Array.isArray(styleArgWithMagic) && numOfCustomFnsApplied > 0) {\n // Here we are adding placeholders for all the new functions that we are gonna call\n const placeholders = new Array(numOfCustomFnsApplied).fill('') as string[];\n transformedStyleArg = Object.assign([...styleArgWithMagic, ...placeholders], {\n raw: [...(styleArgWithMagic as TemplateStringsArray).raw, ...placeholders],\n });\n } else if (typeof styleArgWithMagic === 'function') {\n // Here we just coerce with the default theme\n transformedStyleArg = (props: PropsWithTheme) =>\n styleArgWithMagic({ ...props, theme: coerceWithDefaultTheme(props.theme) });\n }\n\n const displayName = componentName !== null && componentSlot !== null ? `${componentName}-${componentSlot}` : null;\n\n const classNameObject = displayName !== null ? { className: displayName } : {};\n\n const defaultStyledResolverWithClassName = defaultStyledResolver.attrs(\n classNameObject as unknown as Partial<StyledComponentPropsWithRef<StyledComponentInnerComponent<any>>>,\n );\n\n const Component = defaultStyledResolverWithClassName(transformedStyleArg, ...expressionsWithDefaultTheme);\n\n if (displayName !== null) {\n Component.displayName = displayName;\n }\n\n return Component;\n };\n\n return Object.assign(dimsumStyledResolver, attributes);\n};\n\n// Here we create an object with the IntrinsicElements keys pointing to the styledFunction\nconst styledObject = Object.keys(baseStyledComponent).reduce((obj, key) => {\n const castedKey = key as keyof JSX.IntrinsicElements;\n obj[castedKey] = styledFunction(castedKey);\n return obj;\n}, {} as DSStyledObject);\n\nexport const styled = Object.assign(styledFunction, styledObject);\nexport { css, createGlobalStyle };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADMvB,+BAA0B;AAC1B,oBAAgC;AAGhC,uBASO;AAEP,MAAM,EAAE,KAAK,QAAQ,qBAAqB,sBAAsB,wCAAU,2BAAQ,sBAAQ,wBAAO,uBAAM,CAAC;AAGxG,MAAM,iBAAmC,CAAC,KAAK,UAAU,EAAE,MAAM,MAAM,MAAM,KAAK,MAAM;AACtF,QAAM,EAAE,MAAM,eAAe,MAAM,kBAAkB;AAErD,QAAM,wBAAwB,oBAAoB,GAAG;AAErD,QAAM,aAAa;AAAA,IACjB,OAAO,sBAAsB;AAAA,IAC7B,YAAY,sBAAsB;AAAA,EACpC;AAGA,QAAM,uBAAiD,CAAC,aAAa,gBAAgB;AAKnF,UAAM,CAAC,mBAAmB,wBAAwB,wCAAkB,UAAU,WAAW;AAOzF,UAAM,8BAA8B,uBAAuB,qBAAqB,IAAI,uCAAsB,IAAI,CAAC;AAE/G,QAAI,sBAAsB;AAK1B,QAAI,iBAAiB,eAAe;AAClC,kCAA4B,KAAK,CAAC,UAA0B;AAC1D,cAAM,QAAQ,6CAAuB,MAAM,KAAK;AAChD,cAAM,iBAAiB,wCAAkB,eAAe,KAAK;AAC7D,YAAI,gBAAgB;AAClB,iBAAO,CAAC,eAAe,cAAc;AAAA,QACvC;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAKA,QAAI,iBAAiB,kBAAkB,QAAQ;AAC7C,kCAA4B,KAAK,CAAC,UAA0B;AAC1D,cAAM,QAAQ,6CAAuB,MAAM,KAAK;AAChD,eAAO,uCAAiB,OAAO,uCAAiB,eAAe,KAAK,GAAG,OAAO,aAAa;AAAA,MAC7F,CAAC;AAAA,IACH;AAEA,UAAM,wBAAwB,4BAA4B,SAAS,qBAAqB;AAExF,QAAI,MAAM,QAAQ,iBAAiB,KAAK,wBAAwB,GAAG;AAEjE,YAAM,eAAe,IAAI,MAAM,qBAAqB,EAAE,KAAK,EAAE;AAC7D,4BAAsB,OAAO,OAAO,CAAC,GAAG,mBAAmB,GAAG,YAAY,GAAG;AAAA,QAC3E,KAAK,CAAC,GAAI,kBAA2C,KAAK,GAAG,YAAY;AAAA,MAC3E,CAAC;AAAA,IACH,WAAW,OAAO,sBAAsB,YAAY;AAElD,4BAAsB,CAAC,UACrB,kBAAkB,iCAAK,QAAL,EAAY,OAAO,6CAAuB,MAAM,KAAK,EAAE,EAAC;AAAA,IAC9E;AAEA,UAAM,cAAc,kBAAkB,QAAQ,kBAAkB,OAAO,GAAG,iBAAiB,kBAAkB;AAE7G,UAAM,kBAAkB,gBAAgB,OAAO,EAAE,WAAW,YAAY,IAAI,CAAC;AAE7E,UAAM,qCAAqC,sBAAsB,MAC/D,eACF;AAEA,UAAM,YAAY,mCAAmC,qBAAqB,GAAG,2BAA2B;AAExG,QAAI,gBAAgB,MAAM;AACxB,gBAAU,cAAc;AAAA,IAC1B;AAEA,WAAO;AAAA,EACT;AAEA,SAAO,OAAO,OAAO,sBAAsB,UAAU;AACvD;AAGA,MAAM,eAAe,OAAO,KAAK,mBAAmB,EAAE,OAAO,CAAC,KAAK,QAAQ;AACzE,QAAM,YAAY;AAClB,MAAI,aAAa,eAAe,SAAS;AACzC,SAAO;AACT,GAAG,CAAC,CAAmB;AAEhB,MAAM,SAAS,OAAO,OAAO,gBAAgB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from))
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
16
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
|
19
|
+
var React = __toESM(require("react"));
|
|
20
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ds-styled/types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n AnyStyledComponent,\n StyledComponentInnerAttrs,\n StyledComponentInnerComponent,\n StyledComponentInnerOtherProps,\n CSSObject,\n StyledComponent,\n StyledComponentPropsWithRef,\n ThemedStyledProps,\n Interpolation,\n InterpolationFunction,\n StyledConfig,\n} from 'styled-components';\nimport type { Theme as PuiTheme } from '@elliemae/pui-theme';\n\nexport interface Theme extends PuiTheme {\n components?: {\n [componentName: string]: {\n styleOverrides?: CSSObject;\n variants?: { props: Record<string, { toString: () => string }>; style: CSSObject }[];\n };\n };\n}\n\ntype Attrs<P, A extends Partial<P>, T> = ((props: ThemedStyledProps<P, T>) => A) | A;\n\ninterface DSStyledConfig {\n name: string | null;\n slot: string | null;\n}\n\ntype ThemedStyledFunctionBase<\n C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,\n T extends object,\n O extends object = Record<string, unknown>,\n A extends keyof any = never,\n> = <U extends object>(\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>,\n ...rest: Array<Interpolation<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>>\n) => StyledComponent<C, T, O & U, A>;\n\ninterface ThemedStyledFunction<\n C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,\n T extends object,\n O extends object = Record<string, unknown>,\n A extends keyof any = never,\n> extends ThemedStyledFunctionBase<C, T, O, A> {\n // Fun thing: 'attrs' can also provide a polymorphic 'as' prop\n // My head already hurts enough so maybe later...\n attrs<\n U,\n NewA extends Partial<StyledComponentPropsWithRef<C> & U> & {\n [others: string]: any;\n } = any,\n >(\n attrs: Attrs<StyledComponentPropsWithRef<C> & U, NewA, T>,\n ): ThemedStyledFunction<C, T, O & NewA, A | keyof NewA>;\n\n withConfig: <Props extends O = O>(\n config: StyledConfig<StyledComponentPropsWithRef<C> & Props>,\n ) => ThemedStyledFunction<C, T, Props, A>;\n}\n\nexport type DSStyledFunction = <C extends AnyStyledComponent | keyof JSX.IntrinsicElements | React.ComponentType<any>>(\n tag: C,\n options?: DSStyledConfig,\n) => ThemedStyledFunction<\n C extends AnyStyledComponent ? StyledComponentInnerComponent<C> : C,\n Theme,\n C extends AnyStyledComponent ? StyledComponentInnerOtherProps<C> : unknown,\n C extends AnyStyledComponent ? StyledComponentInnerAttrs<C> : never\n>;\n\nexport type DSStyledObject = {\n [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunction<keyof JSX.IntrinsicElements, Theme>;\n};\n\nexport type DSStyledFunctionInternal = (\n ...args: Parameters<ReturnType<DSStyledFunction>>\n) => ReturnType<ReturnType<DSStyledFunction>>;\n\nexport type PropsWithTheme = { theme?: Theme } & Record<string, unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var height_exports = {};
|
|
22
|
+
__export(height_exports, {
|
|
23
|
+
height: () => height
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(height_exports);
|
|
26
|
+
var React = __toESM(require("react"));
|
|
27
|
+
var import_system = require("@xstyled/system");
|
|
28
|
+
const height = (0, import_system.style)({
|
|
29
|
+
prop: ["height", "h"],
|
|
30
|
+
css: "height"
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=height.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/ds-styled/utilities/height.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { style } from '@xstyled/system';\n\nexport const height = style({\n prop: ['height', 'h'],\n css: 'height',\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,oBAAsB;AAEf,MAAM,SAAS,yBAAM;AAAA,EAC1B,MAAM,CAAC,UAAU,GAAG;AAAA,EACpB,KAAK;AACP,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var helpers_exports = {};
|
|
39
|
+
__export(helpers_exports, {
|
|
40
|
+
coerceWithDefaultTheme: () => coerceWithDefaultTheme,
|
|
41
|
+
isEmpty: () => isEmpty,
|
|
42
|
+
propsToClassKey: () => propsToClassKey,
|
|
43
|
+
stylesArgThemeCoercion: () => stylesArgThemeCoercion
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(helpers_exports);
|
|
46
|
+
var React = __toESM(require("react"));
|
|
47
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
48
|
+
var import_theme = require("../../theme");
|
|
49
|
+
const systemTheme = import_theme.theme;
|
|
50
|
+
const isEmpty = (string) => string.length === 0;
|
|
51
|
+
const coerceWithDefaultTheme = (themeInput) => themeInput ?? systemTheme;
|
|
52
|
+
const stylesArgThemeCoercion = (stylesArg) => {
|
|
53
|
+
if (typeof stylesArg === "function") {
|
|
54
|
+
return (props) => stylesArg(__spreadProps(__spreadValues({}, props), {
|
|
55
|
+
theme: coerceWithDefaultTheme(props.theme)
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
return stylesArg;
|
|
59
|
+
};
|
|
60
|
+
const propsToClassKey = (props) => Object.keys(props).sort().reduce((classKey, key) => {
|
|
61
|
+
if (key === "color") {
|
|
62
|
+
return classKey + (isEmpty(String(classKey)) ? String(props[key]) : (0, import_ds_utilities.capitalize)(String(props[key])));
|
|
63
|
+
}
|
|
64
|
+
return `${classKey}${isEmpty(String(classKey)) ? key : (0, import_ds_utilities.capitalize)(key)}${(0, import_ds_utilities.capitalize)(props[key].toString())}`;
|
|
65
|
+
}, "");
|
|
66
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/ds-styled/utilities/helpers.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Interpolation } from 'styled-components';\nimport { capitalize } from '@elliemae/ds-utilities';\nimport type { PropsWithTheme, Theme } from '../types';\nimport { theme as defaultTheme } from '../../theme';\n\nconst systemTheme = defaultTheme;\n\nexport const isEmpty = (string: string): boolean => string.length === 0;\n\nexport const coerceWithDefaultTheme = (themeInput: Theme | undefined): Theme => themeInput ?? systemTheme;\n\nexport const stylesArgThemeCoercion = (stylesArg: Interpolation<any>): Interpolation<any> => {\n if (typeof stylesArg === 'function') {\n return (props: PropsWithTheme) =>\n stylesArg({\n ...props,\n theme: coerceWithDefaultTheme(props.theme),\n });\n }\n return stylesArg;\n};\n\nexport const propsToClassKey = (props: Record<string, { toString: () => string }>): string =>\n Object.keys(props)\n .sort()\n .reduce((classKey, key) => {\n if (key === 'color') {\n return classKey + (isEmpty(String(classKey)) ? String(props[key]) : capitalize(String(props[key])));\n }\n return `${classKey}${isEmpty(String(classKey)) ? key : capitalize(key)}${capitalize(props[key].toString())}`;\n }, '');\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,0BAA2B;AAE3B,mBAAsC;AAEtC,MAAM,cAAc;AAEb,MAAM,UAAU,CAAC,WAA4B,OAAO,WAAW;AAE/D,MAAM,yBAAyB,CAAC,eAAyC,cAAc;AAEvF,MAAM,yBAAyB,CAAC,cAAsD;AAC3F,MAAI,OAAO,cAAc,YAAY;AACnC,WAAO,CAAC,UACN,UAAU,iCACL,QADK;AAAA,MAER,OAAO,uBAAuB,MAAM,KAAK;AAAA,IAC3C,EAAC;AAAA,EACL;AACA,SAAO;AACT;AAEO,MAAM,kBAAkB,CAAC,UAC9B,OAAO,KAAK,KAAK,EACd,KAAK,EACL,OAAO,CAAC,UAAU,QAAQ;AACzB,MAAI,QAAQ,SAAS;AACnB,WAAO,WAAY,SAAQ,OAAO,QAAQ,CAAC,IAAI,OAAO,MAAM,IAAI,IAAI,oCAAW,OAAO,MAAM,IAAI,CAAC;AAAA,EACnG;AACA,SAAO,GAAG,WAAW,QAAQ,OAAO,QAAQ,CAAC,IAAI,MAAM,oCAAW,GAAG,IAAI,oCAAW,MAAM,KAAK,SAAS,CAAC;AAC3G,GAAG,EAAE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from))
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var utilities_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(utilities_exports);
|
|
20
|
+
var React = __toESM(require("react"));
|
|
21
|
+
__reExport(utilities_exports, require("./magicCssTransform"), module.exports);
|
|
22
|
+
__reExport(utilities_exports, require("./height"), module.exports);
|
|
23
|
+
__reExport(utilities_exports, require("./resolvers"), module.exports);
|
|
24
|
+
__reExport(utilities_exports, require("./helpers"), module.exports);
|
|
25
|
+
__reExport(utilities_exports, require("./width"), module.exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/ds-styled/utilities/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export * from './magicCssTransform';\nexport * from './height';\nexport * from './resolvers';\nexport * from './helpers';\nexport * from './width';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAc,gCAAd;AACA,8BAAc,qBADd;AAEA,8BAAc,wBAFd;AAGA,8BAAc,sBAHd;AAIA,8BAAc,oBAJd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var magicCssTransform_exports = {};
|
|
22
|
+
__export(magicCssTransform_exports, {
|
|
23
|
+
magicCssTransform: () => magicCssTransform
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(magicCssTransform_exports);
|
|
26
|
+
var React = __toESM(require("react"));
|
|
27
|
+
var import_th = require("../../th");
|
|
28
|
+
const COLOR_REGEX = /(neutral|brand|success|warning|danger)-(100|200|300|400|500|600|700|800|900|000|050|080)/g;
|
|
29
|
+
const magicfyCss = (rawValue) => {
|
|
30
|
+
let matches;
|
|
31
|
+
let lastIndex = 0;
|
|
32
|
+
const splittedValue = [];
|
|
33
|
+
const themeGetters = [];
|
|
34
|
+
while (matches = COLOR_REGEX.exec(rawValue)) {
|
|
35
|
+
const [match] = matches;
|
|
36
|
+
splittedValue.push(rawValue.slice(lastIndex, matches.index));
|
|
37
|
+
themeGetters.push(import_th.th.color(match, match));
|
|
38
|
+
lastIndex = matches.index + match.length;
|
|
39
|
+
}
|
|
40
|
+
splittedValue.push(rawValue.slice(lastIndex, rawValue.length));
|
|
41
|
+
return [splittedValue, themeGetters];
|
|
42
|
+
};
|
|
43
|
+
const magicCssTransform = (styleArg, expressions) => {
|
|
44
|
+
if (!Array.isArray(styleArg))
|
|
45
|
+
return [styleArg, expressions];
|
|
46
|
+
const magicStyleArg = [];
|
|
47
|
+
const magicExpressions = [];
|
|
48
|
+
const templateStringArray = styleArg;
|
|
49
|
+
templateStringArray.forEach((templateString, index) => {
|
|
50
|
+
const [splittedTemplateString, themeGetters] = magicfyCss(templateString);
|
|
51
|
+
magicStyleArg.push(...splittedTemplateString);
|
|
52
|
+
magicExpressions.push(...themeGetters);
|
|
53
|
+
if (index < expressions.length)
|
|
54
|
+
magicExpressions.push(expressions[index]);
|
|
55
|
+
});
|
|
56
|
+
return [Object.assign(magicStyleArg, { raw: [...magicStyleArg] }), magicExpressions];
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=magicCssTransform.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/ds-styled/utilities/magicCssTransform.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-cond-assign */\nimport { CSSObject, Interpolation, InterpolationFunction } from 'styled-components';\nimport { th } from '../../th';\n\ntype StyleArg = CSSObject | InterpolationFunction<any> | TemplateStringsArray;\ntype Expressions = Interpolation<any>[];\ntype MagicCssTransform = (styleArg: StyleArg, expressions: Expressions) => [StyleArg, Expressions];\n\n// This file is heavily inspired by https://github.com/gregberge/xstyled/blob/c0c92b459bb3a5de46d7854be3667861f816baa5/packages/core/src/transform.ts#L65\n// Please refer to that file to understand of the idea of the css transformer\n\nconst COLOR_REGEX = /(neutral|brand|success|warning|danger)-(100|200|300|400|500|600|700|800|900|000|050|080)/g;\n\nconst magicfyCss = (rawValue: string): [string[], Interpolation<any>[]] => {\n let matches;\n let lastIndex = 0;\n const splittedValue: string[] = [];\n const themeGetters = [];\n while ((matches = COLOR_REGEX.exec(rawValue))) {\n const [match] = matches;\n splittedValue.push(rawValue.slice(lastIndex, matches.index));\n\n themeGetters.push(th.color(match, match));\n\n lastIndex = matches.index + match.length;\n }\n splittedValue.push(rawValue.slice(lastIndex, rawValue.length));\n return [splittedValue, themeGetters];\n};\n\nexport const magicCssTransform: MagicCssTransform = (styleArg, expressions) => {\n if (!Array.isArray(styleArg)) return [styleArg, expressions];\n\n const magicStyleArg: string[] = [];\n const magicExpressions: Expressions = [];\n\n const templateStringArray = styleArg as TemplateStringsArray;\n\n templateStringArray.forEach((templateString, index) => {\n const [splittedTemplateString, themeGetters] = magicfyCss(templateString);\n magicStyleArg.push(...splittedTemplateString);\n magicExpressions.push(...themeGetters);\n if (index < expressions.length) magicExpressions.push(expressions[index]);\n });\n\n return [Object.assign(magicStyleArg, { raw: [...magicStyleArg] }), magicExpressions];\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,gBAAmB;AASnB,MAAM,cAAc;AAEpB,MAAM,aAAa,CAAC,aAAuD;AACzE,MAAI;AACJ,MAAI,YAAY;AAChB,QAAM,gBAA0B,CAAC;AACjC,QAAM,eAAe,CAAC;AACtB,SAAQ,UAAU,YAAY,KAAK,QAAQ,GAAI;AAC7C,UAAM,CAAC,SAAS;AAChB,kBAAc,KAAK,SAAS,MAAM,WAAW,QAAQ,KAAK,CAAC;AAE3D,iBAAa,KAAK,aAAG,MAAM,OAAO,KAAK,CAAC;AAExC,gBAAY,QAAQ,QAAQ,MAAM;AAAA,EACpC;AACA,gBAAc,KAAK,SAAS,MAAM,WAAW,SAAS,MAAM,CAAC;AAC7D,SAAO,CAAC,eAAe,YAAY;AACrC;AAEO,MAAM,oBAAuC,CAAC,UAAU,gBAAgB;AAC7E,MAAI,CAAC,MAAM,QAAQ,QAAQ;AAAG,WAAO,CAAC,UAAU,WAAW;AAE3D,QAAM,gBAA0B,CAAC;AACjC,QAAM,mBAAgC,CAAC;AAEvC,QAAM,sBAAsB;AAE5B,sBAAoB,QAAQ,CAAC,gBAAgB,UAAU;AACrD,UAAM,CAAC,wBAAwB,gBAAgB,WAAW,cAAc;AACxE,kBAAc,KAAK,GAAG,sBAAsB;AAC5C,qBAAiB,KAAK,GAAG,YAAY;AACrC,QAAI,QAAQ,YAAY;AAAQ,uBAAiB,KAAK,YAAY,MAAM;AAAA,EAC1E,CAAC;AAED,SAAO,CAAC,OAAO,OAAO,eAAe,EAAE,KAAK,CAAC,GAAG,aAAa,EAAE,CAAC,GAAG,gBAAgB;AACrF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var resolvers_exports = {};
|
|
22
|
+
__export(resolvers_exports, {
|
|
23
|
+
getStyleOverrides: () => getStyleOverrides,
|
|
24
|
+
getVariantStyles: () => getVariantStyles,
|
|
25
|
+
variantsResolver: () => variantsResolver
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(resolvers_exports);
|
|
28
|
+
var React = __toESM(require("react"));
|
|
29
|
+
var import_helpers = require("./helpers");
|
|
30
|
+
const getStyleOverrides = (name, theme) => theme.components?.[name]?.styleOverrides || null;
|
|
31
|
+
const getVariantStyles = (name, theme) => {
|
|
32
|
+
const variants = theme.components?.[name]?.variants || [];
|
|
33
|
+
return variants.reduce((styles, definition) => {
|
|
34
|
+
const key = (0, import_helpers.propsToClassKey)(definition.props);
|
|
35
|
+
styles[key] = definition.style;
|
|
36
|
+
return styles;
|
|
37
|
+
}, {});
|
|
38
|
+
};
|
|
39
|
+
const variantsResolver = (props, styles, theme, name) => {
|
|
40
|
+
const themeVariants = theme?.components?.[name]?.variants || [];
|
|
41
|
+
return themeVariants.reduce((variantsStyles, themeVariant) => {
|
|
42
|
+
const isMatch = Object.keys(themeVariant.props).every((key) => props[key] === themeVariant.props[key]);
|
|
43
|
+
if (isMatch) {
|
|
44
|
+
variantsStyles.push(styles[(0, import_helpers.propsToClassKey)(themeVariant.props)]);
|
|
45
|
+
}
|
|
46
|
+
return variantsStyles;
|
|
47
|
+
}, []);
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=resolvers.js.map
|