@salutejs/plasma-new-hope 0.265.0-canary.1759.13297025461.0 → 0.265.0-dev.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/engines/linaria.js +4 -2
- package/cjs/engines/linaria.js.map +1 -1
- package/cjs/engines/utils.js +22 -0
- package/cjs/engines/utils.js.map +1 -1
- package/emotion/cjs/engines/emotion.js +9 -3
- package/emotion/cjs/engines/utils.js +26 -1
- package/emotion/cjs/examples/plasma_b2c/components/TextArea/TextArea.config.js +13 -14
- package/emotion/cjs/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +1 -1
- package/emotion/cjs/examples/plasma_web/components/TextArea/TextArea.config.js +13 -14
- package/emotion/cjs/examples/plasma_web/components/TextArea/TextArea.stories.tsx +1 -2
- package/emotion/es/engines/emotion.js +10 -4
- package/emotion/es/engines/utils.js +25 -0
- package/emotion/es/examples/plasma_b2c/components/TextArea/TextArea.config.js +13 -14
- package/emotion/es/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +1 -1
- package/emotion/es/examples/plasma_web/components/TextArea/TextArea.config.js +13 -14
- package/emotion/es/examples/plasma_web/components/TextArea/TextArea.stories.tsx +1 -2
- package/es/engines/linaria.js +5 -3
- package/es/engines/linaria.js.map +1 -1
- package/es/engines/utils.js +23 -2
- package/es/engines/utils.js.map +1 -1
- package/package.json +5 -5
- package/styled-components/cjs/engines/styled-components.js +9 -3
- package/styled-components/cjs/engines/utils.js +26 -1
- package/styled-components/cjs/examples/plasma_b2c/components/TextArea/TextArea.config.js +1 -2
- package/styled-components/cjs/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +1 -1
- package/styled-components/cjs/examples/plasma_web/components/TextArea/TextArea.config.js +1 -2
- package/styled-components/cjs/examples/plasma_web/components/TextArea/TextArea.stories.tsx +1 -2
- package/styled-components/es/engines/styled-components.js +10 -4
- package/styled-components/es/engines/utils.js +25 -0
- package/styled-components/es/examples/plasma_b2c/components/TextArea/TextArea.config.js +1 -2
- package/styled-components/es/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +1 -1
- package/styled-components/es/examples/plasma_web/components/TextArea/TextArea.config.js +1 -2
- package/styled-components/es/examples/plasma_web/components/TextArea/TextArea.stories.tsx +1 -2
- package/types/engines/emotion.d.ts.map +1 -1
- package/types/engines/linaria.d.ts.map +1 -1
- package/types/engines/styled-components.d.ts.map +1 -1
- package/types/engines/types.d.ts +4 -0
- package/types/engines/types.d.ts.map +1 -1
- package/types/engines/utils.d.ts +2 -1
- package/types/engines/utils.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/TextArea/TextArea.config.d.ts +0 -1
- package/types/examples/plasma_b2c/components/TextArea/TextArea.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/TextArea/TextArea.d.ts +0 -1
- package/types/examples/plasma_b2c/components/TextArea/TextArea.d.ts.map +1 -1
- package/types/examples/plasma_web/components/TextArea/TextArea.config.d.ts +0 -1
- package/types/examples/plasma_web/components/TextArea/TextArea.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/TextArea/TextArea.d.ts +0 -1
- package/types/examples/plasma_web/components/TextArea/TextArea.d.ts.map +1 -1
package/cjs/engines/linaria.js
CHANGED
@@ -17,7 +17,8 @@ var _excluded = ["className"];
|
|
17
17
|
var _component = function _component(componentConfig) {
|
18
18
|
var tag = componentConfig.tag,
|
19
19
|
base = componentConfig.base,
|
20
|
-
name = componentConfig.name
|
20
|
+
name = componentConfig.name,
|
21
|
+
intersections = componentConfig.intersections;
|
21
22
|
var staticVariants = utils.getStaticVariants(componentConfig);
|
22
23
|
var dynamicVariants = utils.getDynamicVariants(componentConfig);
|
23
24
|
var Root = tag;
|
@@ -25,7 +26,8 @@ var _component = function _component(componentConfig) {
|
|
25
26
|
var className = props.className,
|
26
27
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
27
28
|
var variants = dynamicVariants(rest);
|
28
|
-
var
|
29
|
+
var intersectionStyles = utils.getIntersectionStyles(rest, intersections);
|
30
|
+
var cls = core.cx.apply(void 0, [className, base].concat(_rollupPluginBabelHelpers.toConsumableArray(staticVariants), _rollupPluginBabelHelpers.toConsumableArray(variants), _rollupPluginBabelHelpers.toConsumableArray(intersectionStyles)));
|
29
31
|
|
30
32
|
// styled-components do it inside
|
31
33
|
// filter props
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"linaria.js","sources":["../../src/engines/linaria.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { cx } from '@linaria/core';\n\n// TODO: #1008 Избавиться от импортов и переделать addFocus\nimport 'focus-visible';\nimport { getStaticVariants, getDynamicVariants } from './utils';\nimport type { ComponentConfig, HTMLAnyAttributes } from './types';\n\n/* eslint-disable no-underscore-dangle */\nexport const _component = (componentConfig: ComponentConfig) => {\n const { tag, base, name } = componentConfig;\n const staticVariants = getStaticVariants(componentConfig);\n const dynamicVariants = getDynamicVariants(componentConfig);\n const Root = tag as React.ElementType;\n\n const component = forwardRef<HTMLElement, HTMLAnyAttributes>((props, ref) => {\n const { className, ...rest } = props;\n const variants = dynamicVariants(rest);\n const cls = cx(className, base as string, ...(staticVariants as string[]), ...variants);\n\n // styled-components do it inside\n // filter props\n const baseProps: HTMLAnyAttributes = {};\n for (const key in rest) {\n if (!(key in componentConfig.variations)) {\n baseProps[key] = rest[key];\n }\n }\n\n baseProps.ref = ref;\n\n // styled-components do it inside\n // add props that should be attr( disabled for example)\n const htmlAttrs: HTMLAnyAttributes = {};\n for (const key in componentConfig.variations || {}) {\n if (key in rest) {\n const variant = componentConfig.variations[key];\n\n const { attrs } = variant;\n if (typeof attrs === 'boolean') {\n htmlAttrs[key] = rest[key];\n }\n }\n }\n\n return <Root className={cls} {...htmlAttrs} {...baseProps} />;\n });\n if (name) {\n component.displayName = name;\n }\n return component;\n};\n"],"names":["_component","componentConfig","tag","base","name","staticVariants","getStaticVariants","dynamicVariants","getDynamicVariants","Root","component","forwardRef","props","ref","className","rest","_objectWithoutProperties","_excluded","variants","cls","cx","apply","concat","_toConsumableArray","baseProps","key","variations","htmlAttrs","variant","attrs","React","createElement","_extends","displayName"],"mappings":";;;;;;;;;;;;;;;AAQA;IACaA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,eAAgC,EAAK;AAC5D,EAAA,IAAQC,GAAG,
|
1
|
+
{"version":3,"file":"linaria.js","sources":["../../src/engines/linaria.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { cx } from '@linaria/core';\n\n// TODO: #1008 Избавиться от импортов и переделать addFocus\nimport 'focus-visible';\nimport { getStaticVariants, getDynamicVariants, getIntersectionStyles } from './utils';\nimport type { ComponentConfig, HTMLAnyAttributes } from './types';\n\n/* eslint-disable no-underscore-dangle */\nexport const _component = (componentConfig: ComponentConfig) => {\n const { tag, base, name, intersections } = componentConfig;\n const staticVariants = getStaticVariants(componentConfig);\n const dynamicVariants = getDynamicVariants(componentConfig);\n\n const Root = tag as React.ElementType;\n\n const component = forwardRef<HTMLElement, HTMLAnyAttributes>((props, ref) => {\n const { className, ...rest } = props;\n const variants = dynamicVariants(rest);\n const intersectionStyles = getIntersectionStyles(rest, intersections);\n\n const cls = cx(className, base as string, ...(staticVariants as string[]), ...variants, ...intersectionStyles);\n\n // styled-components do it inside\n // filter props\n const baseProps: HTMLAnyAttributes = {};\n for (const key in rest) {\n if (!(key in componentConfig.variations)) {\n baseProps[key] = rest[key];\n }\n }\n\n baseProps.ref = ref;\n\n // styled-components do it inside\n // add props that should be attr( disabled for example)\n const htmlAttrs: HTMLAnyAttributes = {};\n for (const key in componentConfig.variations || {}) {\n if (key in rest) {\n const variant = componentConfig.variations[key];\n\n const { attrs } = variant;\n if (typeof attrs === 'boolean') {\n htmlAttrs[key] = rest[key];\n }\n }\n }\n\n return <Root className={cls} {...htmlAttrs} {...baseProps} />;\n });\n if (name) {\n component.displayName = name;\n }\n return component;\n};\n"],"names":["_component","componentConfig","tag","base","name","intersections","staticVariants","getStaticVariants","dynamicVariants","getDynamicVariants","Root","component","forwardRef","props","ref","className","rest","_objectWithoutProperties","_excluded","variants","intersectionStyles","getIntersectionStyles","cls","cx","apply","concat","_toConsumableArray","baseProps","key","variations","htmlAttrs","variant","attrs","React","createElement","_extends","displayName"],"mappings":";;;;;;;;;;;;;;;AAQA;IACaA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,eAAgC,EAAK;AAC5D,EAAA,IAAQC,GAAG,GAAgCD,eAAe,CAAlDC,GAAG;IAAEC,IAAI,GAA0BF,eAAe,CAA7CE,IAAI;IAAEC,IAAI,GAAoBH,eAAe,CAAvCG,IAAI;IAAEC,aAAa,GAAKJ,eAAe,CAAjCI,aAAa,CAAA;AACtC,EAAA,IAAMC,cAAc,GAAGC,uBAAiB,CAACN,eAAe,CAAC,CAAA;AACzD,EAAA,IAAMO,eAAe,GAAGC,wBAAkB,CAACR,eAAe,CAAC,CAAA;EAE3D,IAAMS,IAAI,GAAGR,GAAwB,CAAA;EAErC,IAAMS,SAAS,gBAAGC,gBAAU,CAAiC,UAACC,KAAK,EAAEC,GAAG,EAAK;AACzE,IAAA,IAAQC,SAAS,GAAcF,KAAK,CAA5BE,SAAS;AAAKC,MAAAA,IAAI,GAAAC,iDAAA,CAAKJ,KAAK,EAAAK,SAAA,CAAA,CAAA;AACpC,IAAA,IAAMC,QAAQ,GAAGX,eAAe,CAACQ,IAAI,CAAC,CAAA;AACtC,IAAA,IAAMI,kBAAkB,GAAGC,2BAAqB,CAACL,IAAI,EAAEX,aAAa,CAAC,CAAA;IAErE,IAAMiB,GAAG,GAAGC,OAAE,CAAAC,KAAA,CAACT,KAAAA,CAAAA,EAAAA,CAAAA,SAAS,EAAEZ,IAAI,CAAAsB,CAAAA,MAAA,CAAAC,2CAAA,CAAgBpB,cAAc,CAAA,EAAAoB,2CAAA,CAAkBP,QAAQ,CAAAO,EAAAA,2CAAA,CAAKN,kBAAkB,CAAC,CAAA,CAAA,CAAA;;AAE9G;AACA;IACA,IAAMO,SAA4B,GAAG,EAAE,CAAA;AACvC,IAAA,KAAK,IAAMC,GAAG,IAAIZ,IAAI,EAAE;AACpB,MAAA,IAAI,EAAEY,GAAG,IAAI3B,eAAe,CAAC4B,UAAU,CAAC,EAAE;AACtCF,QAAAA,SAAS,CAACC,GAAG,CAAC,GAAGZ,IAAI,CAACY,GAAG,CAAC,CAAA;AAC9B,OAAA;AACJ,KAAA;IAEAD,SAAS,CAACb,GAAG,GAAGA,GAAG,CAAA;;AAEnB;AACA;IACA,IAAMgB,SAA4B,GAAG,EAAE,CAAA;IACvC,KAAK,IAAMF,IAAG,IAAI3B,eAAe,CAAC4B,UAAU,IAAI,EAAE,EAAE;MAChD,IAAID,IAAG,IAAIZ,IAAI,EAAE;AACb,QAAA,IAAMe,OAAO,GAAG9B,eAAe,CAAC4B,UAAU,CAACD,IAAG,CAAC,CAAA;AAE/C,QAAA,IAAQI,KAAK,GAAKD,OAAO,CAAjBC,KAAK,CAAA;AACb,QAAA,IAAI,OAAOA,KAAK,KAAK,SAAS,EAAE;AAC5BF,UAAAA,SAAS,CAACF,IAAG,CAAC,GAAGZ,IAAI,CAACY,IAAG,CAAC,CAAA;AAC9B,SAAA;AACJ,OAAA;AACJ,KAAA;AAEA,IAAA,oBAAOK,sBAAA,CAAAC,aAAA,CAACxB,IAAI,EAAAyB,iCAAA,CAAA;AAACpB,MAAAA,SAAS,EAAEO,GAAAA;AAAI,KAAA,EAAKQ,SAAS,EAAMH,SAAS,CAAG,CAAC,CAAA;AACjE,GAAC,CAAC,CAAA;AACF,EAAA,IAAIvB,IAAI,EAAE;IACNO,SAAS,CAACyB,WAAW,GAAGhC,IAAI,CAAA;AAChC,GAAA;AACA,EAAA,OAAOO,SAAS,CAAA;AACpB;;;;"}
|
package/cjs/engines/utils.js
CHANGED
@@ -34,7 +34,29 @@ var getDynamicVariants = function getDynamicVariants(config) {
|
|
34
34
|
return res;
|
35
35
|
};
|
36
36
|
};
|
37
|
+
var getIntersectionStyles = function getIntersectionStyles(props, intersections) {
|
38
|
+
if (!intersections) {
|
39
|
+
return [];
|
40
|
+
}
|
41
|
+
return intersections.reduce(function (styles, item) {
|
42
|
+
var hasMatchStyle = Object.entries(item).filter(function (_ref) {
|
43
|
+
var _ref2 = _rollupPluginBabelHelpers.slicedToArray(_ref, 1),
|
44
|
+
key = _ref2[0];
|
45
|
+
return key !== 'style';
|
46
|
+
}).every(function (_ref3) {
|
47
|
+
var _ref4 = _rollupPluginBabelHelpers.slicedToArray(_ref3, 2),
|
48
|
+
key = _ref4[0],
|
49
|
+
value = _ref4[1];
|
50
|
+
return props[key] === value;
|
51
|
+
});
|
52
|
+
if (hasMatchStyle) {
|
53
|
+
styles.push(item.style);
|
54
|
+
}
|
55
|
+
return styles;
|
56
|
+
}, []);
|
57
|
+
};
|
37
58
|
|
38
59
|
exports.getDynamicVariants = getDynamicVariants;
|
60
|
+
exports.getIntersectionStyles = getIntersectionStyles;
|
39
61
|
exports.getStaticVariants = getStaticVariants;
|
40
62
|
//# sourceMappingURL=utils.js.map
|
package/cjs/engines/utils.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/engines/utils.ts"],"sourcesContent":["import type { ComponentConfig, HTMLAnyAttributes } from './types';\n\nexport const getStaticVariants = (config: ComponentConfig) => {\n if (!config.variations) {\n return [];\n }\n const res = [];\n const { variations } = config;\n\n // eslint-disable-next-line guard-for-in\n for (const key in variations) {\n const { css } = variations[key];\n css && res.push(css);\n }\n\n return res;\n};\n\nexport const getDynamicVariants = (config: ComponentConfig) => {\n return (props: HTMLAnyAttributes) => {\n const res = [];\n\n // eslint-disable-next-line guard-for-in\n for (const key in config.variations) {\n if (key in props) {\n const variant = config.variations[key];\n\n const css = variant[props[key]];\n // no css for { modifier: true }\n css && Array.isArray(css) ? res.push(...css) : res.push(css);\n }\n }\n\n return res;\n };\n};\n"],"names":["getStaticVariants","config","variations","res","key","css","push","getDynamicVariants","props","variant","Array","isArray","apply","_toConsumableArray"],"mappings":";;;;;;IAEaA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,MAAuB,EAAK;AAC1D,EAAA,IAAI,CAACA,MAAM,CAACC,UAAU,EAAE;AACpB,IAAA,OAAO,EAAE,CAAA;AACb,GAAA;EACA,IAAMC,GAAG,GAAG,EAAE,CAAA;AACd,EAAA,IAAQD,UAAU,GAAKD,MAAM,CAArBC,UAAU,CAAA;;AAElB;AACA,EAAA,KAAK,IAAME,GAAG,IAAIF,UAAU,EAAE;AAC1B,IAAA,IAAQG,GAAG,GAAKH,UAAU,CAACE,GAAG,CAAC,CAAvBC,GAAG,CAAA;AACXA,IAAAA,GAAG,IAAIF,GAAG,CAACG,IAAI,CAACD,GAAG,CAAC,CAAA;AACxB,GAAA;AAEA,EAAA,OAAOF,GAAG,CAAA;AACd,EAAC;IAEYI,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIN,MAAuB,EAAK;EAC3D,OAAO,UAACO,KAAwB,EAAK;IACjC,IAAML,GAAG,GAAG,EAAE,CAAA;;AAEd;AACA,IAAA,KAAK,IAAMC,GAAG,IAAIH,MAAM,CAACC,UAAU,EAAE;MACjC,IAAIE,GAAG,IAAII,KAAK,EAAE;AACd,QAAA,IAAMC,OAAO,GAAGR,MAAM,CAACC,UAAU,CAACE,GAAG,CAAC,CAAA;QAEtC,IAAMC,GAAG,GAAGI,OAAO,CAACD,KAAK,CAACJ,GAAG,CAAC,CAAC,CAAA;AAC/B;QACAC,GAAG,IAAIK,KAAK,CAACC,OAAO,CAACN,GAAG,CAAC,GAAGF,GAAG,CAACG,IAAI,CAAAM,KAAA,CAART,GAAG,EAAAU,2CAAA,CAASR,GAAG,CAAA,CAAC,GAAGF,GAAG,CAACG,IAAI,CAACD,GAAG,CAAC,CAAA;AAChE,OAAA;AACJ,KAAA;AAEA,IAAA,OAAOF,GAAG,CAAA;GACb,CAAA;AACL
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/engines/utils.ts"],"sourcesContent":["import type { ComponentConfig, HTMLAnyAttributes, Intersection } from './types';\n\nexport const getStaticVariants = (config: ComponentConfig) => {\n if (!config.variations) {\n return [];\n }\n const res = [];\n const { variations } = config;\n\n // eslint-disable-next-line guard-for-in\n for (const key in variations) {\n const { css } = variations[key];\n css && res.push(css);\n }\n\n return res;\n};\n\nexport const getDynamicVariants = (config: ComponentConfig) => {\n return (props: HTMLAnyAttributes) => {\n const res = [];\n\n // eslint-disable-next-line guard-for-in\n for (const key in config.variations) {\n if (key in props) {\n const variant = config.variations[key];\n\n const css = variant[props[key]];\n // no css for { modifier: true }\n css && Array.isArray(css) ? res.push(...css) : res.push(css);\n }\n }\n\n return res;\n };\n};\n\nexport const getIntersectionStyles = (props: Record<string, any>, intersections?: Intersection[]) => {\n if (!intersections) {\n return [];\n }\n\n return intersections.reduce((styles: string[], item) => {\n const hasMatchStyle = Object.entries(item)\n .filter(([key]) => key !== 'style')\n .every(([key, value]) => props[key] === value);\n\n if (hasMatchStyle) {\n styles.push(item.style);\n }\n\n return styles;\n }, []);\n};\n"],"names":["getStaticVariants","config","variations","res","key","css","push","getDynamicVariants","props","variant","Array","isArray","apply","_toConsumableArray","getIntersectionStyles","intersections","reduce","styles","item","hasMatchStyle","Object","entries","filter","_ref","_ref2","_slicedToArray","every","_ref3","_ref4","value","style"],"mappings":";;;;;;IAEaA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,MAAuB,EAAK;AAC1D,EAAA,IAAI,CAACA,MAAM,CAACC,UAAU,EAAE;AACpB,IAAA,OAAO,EAAE,CAAA;AACb,GAAA;EACA,IAAMC,GAAG,GAAG,EAAE,CAAA;AACd,EAAA,IAAQD,UAAU,GAAKD,MAAM,CAArBC,UAAU,CAAA;;AAElB;AACA,EAAA,KAAK,IAAME,GAAG,IAAIF,UAAU,EAAE;AAC1B,IAAA,IAAQG,GAAG,GAAKH,UAAU,CAACE,GAAG,CAAC,CAAvBC,GAAG,CAAA;AACXA,IAAAA,GAAG,IAAIF,GAAG,CAACG,IAAI,CAACD,GAAG,CAAC,CAAA;AACxB,GAAA;AAEA,EAAA,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C,KAAA,EAAA;AAAA,MAAA,IAAAC,KAAA,GAAAH,uCAAA,CAAAE,KAAA,EAAA,CAAA,CAAA;AAAEvB,QAAAA,GAAG,GAAAwB,KAAA,CAAA,CAAA,CAAA;AAAEC,QAAAA,KAAK,GAAAD,KAAA,CAAA,CAAA,CAAA,CAAA;AAAA,MAAA,OAAMpB,KAAK,CAACJ,GAAG,CAAC,KAAKyB,KAAK,CAAA;KAAC,CAAA,CAAA;AAElD,IAAA,IAAIV,aAAa,EAAE;AACfF,MAAAA,MAAM,CAACX,IAAI,CAACY,IAAI,CAACY,KAAK,CAAC,CAAA;AAC3B,KAAA;AAEA,IAAA,OAAOb,MAAM,CAAA;GAChB,EAAE,EAAE,CAAC,CAAA;AACV;;;;;;"}
|
@@ -31,12 +31,16 @@ var Root = /*#__PURE__*/(0, _base["default"])("div", {
|
|
31
31
|
}, ";", function (_ref3) {
|
32
32
|
var dynamicVariants = _ref3.dynamicVariants;
|
33
33
|
return dynamicVariants;
|
34
|
-
}, ";"
|
34
|
+
}, ";", function (_ref4) {
|
35
|
+
var intersectionStyles = _ref4.intersectionStyles;
|
36
|
+
return intersectionStyles;
|
37
|
+
}, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy1lbW90aW9uL2VuZ2luZXMvZW1vdGlvbi50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBY0UiLCJmaWxlIjoiLi4vLi4vLi4vc3JjLWVtb3Rpb24vZW5naW5lcy9lbW90aW9uLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCwgeyBmb3J3YXJkUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzLCBTZXJpYWxpemVkU3R5bGVzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm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yaWFudHMoY29tcG9uZW50Q29uZmlnKTtcbiAgICBjb25zdCBkeW5hbWljVmFyaWFudHMgPSBnZXREeW5hbWljVmFyaWFudHMoY29tcG9uZW50Q29uZmlnKTtcblxuICAgIC8vIFRPRE86IHNob3VsZCB3ZSB0eXBlIHRhZyBhcyBtb3JlIHRoZW4gc3RyaW5nID9cbiAgICBjb25zdCBSID0gUm9vdC53aXRoQ29tcG9uZW50KHRhZyBhcyBrZXlvZiBKU1guSW50cmluc2ljRWxlbWVudHMpO1xuXG4gICAgcmV0dXJuIGZvcndhcmRSZWY8SFRNTEVsZW1lbnQsIEhUTUxBbnlBdHRyaWJ1dGVzPigocHJvcHMsIHJlZikgPT4ge1xuICAgICAgICBjb25zdCBpbnRlcnNlY3Rpb25TdHlsZXMgPSBnZXRJbnRlcnNlY3Rpb25TdHlsZXMocHJvcHMsIGludGVyc2VjdGlvbnMpO1xuXG4gICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICA8UlxuICAgICAgICAgICAgICAgIGJhc2U9e2Jhc2V9XG4gICAgICAgICAgICAgICAgc3RhdGljVmFyaWFudHM9e3N0YXRpY1ZhcmlhbnRzfVxuICAgICAgICAgICAgICAgIGR5bmFtaWNWYXJpYW50cz17ZHluYW1pY1ZhcmlhbnRzfVxuICAgICAgICAgICAgICAgIGludGVyc2VjdGlvblN0eWxlcz17aW50ZXJzZWN0aW9uU3R5bGVzfVxuICAgICAgICAgICAgICAgIHsuLi5wcm9wc31cbiAgICAgICAgICAgICAgICByZWY9e3JlZn1cbiAgICAgICAgICAgIC8+XG4gICAgICAgICk7XG4gICAgfSk7XG59O1xuIl19 */"));
|
35
38
|
|
36
39
|
/* eslint-disable no-underscore-dangle */
|
37
40
|
var _component = exports._component = function _component(componentConfig) {
|
38
41
|
var tag = componentConfig.tag,
|
39
|
-
base = componentConfig.base
|
42
|
+
base = componentConfig.base,
|
43
|
+
intersections = componentConfig.intersections;
|
40
44
|
var staticVariants = (0, _utils.getStaticVariants)(componentConfig);
|
41
45
|
var dynamicVariants = (0, _utils.getDynamicVariants)(componentConfig);
|
42
46
|
|
@@ -46,10 +50,12 @@ var _component = exports._component = function _component(componentConfig) {
|
|
46
50
|
label: "plasma-new-hope__R"
|
47
51
|
});
|
48
52
|
return /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
53
|
+
var intersectionStyles = (0, _utils.getIntersectionStyles)(props, intersections);
|
49
54
|
return /*#__PURE__*/_react["default"].createElement(R, _extends({
|
50
55
|
base: base,
|
51
56
|
staticVariants: staticVariants,
|
52
|
-
dynamicVariants: dynamicVariants
|
57
|
+
dynamicVariants: dynamicVariants,
|
58
|
+
intersectionStyles: intersectionStyles
|
53
59
|
}, props, {
|
54
60
|
ref: ref
|
55
61
|
}));
|
@@ -3,7 +3,11 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.getStaticVariants = exports.getDynamicVariants = void 0;
|
6
|
+
exports.getStaticVariants = exports.getIntersectionStyles = exports.getDynamicVariants = void 0;
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
7
11
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
8
12
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
9
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
@@ -39,4 +43,25 @@ var getDynamicVariants = exports.getDynamicVariants = function getDynamicVariant
|
|
39
43
|
}
|
40
44
|
return res;
|
41
45
|
};
|
46
|
+
};
|
47
|
+
var getIntersectionStyles = exports.getIntersectionStyles = function getIntersectionStyles(props, intersections) {
|
48
|
+
if (!intersections) {
|
49
|
+
return [];
|
50
|
+
}
|
51
|
+
return intersections.reduce(function (styles, item) {
|
52
|
+
var hasMatchStyle = Object.entries(item).filter(function (_ref) {
|
53
|
+
var _ref2 = _slicedToArray(_ref, 1),
|
54
|
+
key = _ref2[0];
|
55
|
+
return key !== 'style';
|
56
|
+
}).every(function (_ref3) {
|
57
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
58
|
+
key = _ref4[0],
|
59
|
+
value = _ref4[1];
|
60
|
+
return props[key] === value;
|
61
|
+
});
|
62
|
+
if (hasMatchStyle) {
|
63
|
+
styles.push(item.style);
|
64
|
+
}
|
65
|
+
return styles;
|
66
|
+
}, []);
|
42
67
|
};
|