@semcore/core 16.6.0 → 16.6.1
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/lib/core-types/Component.d.ts +79 -33
- package/lib/core-types/Component.js +46 -14
- package/lib/core-types/Component.js.map +1 -1
- package/lib/core-types/Component.mjs +7 -11
- package/lib/core-types/Component.mjs.map +1 -1
- package/lib/core-types/symbols.mjs +9 -9
- package/lib/coreFactory.d.ts +23 -6
- package/lib/coreFactory.js +22 -53
- package/lib/coreFactory.js.map +1 -1
- package/lib/coreFactory.mjs +35 -54
- package/lib/coreFactory.mjs.map +1 -1
- package/lib/enhancement/Children.mjs +1 -1
- package/lib/enhancement/bindHandler.d.ts +5 -0
- package/lib/enhancement/bindHandler.js +53 -0
- package/lib/enhancement/bindHandler.js.map +1 -0
- package/lib/enhancement/bindHandler.mjs +48 -0
- package/lib/enhancement/bindHandler.mjs.map +1 -0
- package/lib/enhancement/hoistProps.d.ts +10 -0
- package/lib/enhancement/hoistProps.js +95 -0
- package/lib/enhancement/hoistProps.js.map +1 -0
- package/lib/enhancement/hoistProps.mjs +78 -0
- package/lib/enhancement/hoistProps.mjs.map +1 -0
- package/lib/enhancement/staticChildren.mjs +3 -3
- package/lib/enhancement/style.mjs +2 -2
- package/lib/esm/core-types/Component.mjs +7 -11
- package/lib/esm/core-types/symbols.mjs +9 -9
- package/lib/esm/coreFactory.mjs +35 -54
- package/lib/esm/enhancement/Children.mjs +1 -1
- package/lib/esm/enhancement/bindHandler.mjs +48 -0
- package/lib/esm/enhancement/hoistProps.mjs +78 -0
- package/lib/esm/enhancement/staticChildren.mjs +3 -3
- package/lib/esm/enhancement/style.mjs +2 -2
- package/lib/esm/styled/sstyled.mjs +1 -1
- package/lib/esm/utils/createHoc.mjs +42 -0
- package/lib/esm/utils/enhances/WithI18n.mjs +46 -1
- package/lib/esm/utils/getDisplayName.mjs +6 -0
- package/lib/esm/utils/ref.mjs +14 -0
- package/lib/index.d.ts +3 -3
- package/lib/index.js.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/styled/index.d.ts +5 -1
- package/lib/styled/index.js.map +1 -1
- package/lib/styled/index.mjs.map +1 -1
- package/lib/styled/sstyled.mjs +1 -1
- package/lib/utils/ScreenReaderOnly.d.ts +8 -0
- package/lib/utils/ScreenReaderOnly.js +30 -0
- package/lib/utils/ScreenReaderOnly.js.map +1 -0
- package/lib/utils/ScreenReaderOnly.mjs +24 -0
- package/lib/utils/ScreenReaderOnly.mjs.map +1 -0
- package/lib/utils/createHoc.d.ts +3 -0
- package/lib/utils/createHoc.js +52 -0
- package/lib/utils/createHoc.js.map +1 -0
- package/lib/utils/createHoc.mjs +42 -0
- package/lib/utils/createHoc.mjs.map +1 -0
- package/lib/utils/enhances/WithAutoFocus.d.ts +14 -0
- package/lib/utils/enhances/WithAutoFocus.js +72 -0
- package/lib/utils/enhances/WithAutoFocus.js.map +1 -0
- package/lib/utils/enhances/WithAutoFocus.mjs +66 -0
- package/lib/utils/enhances/WithAutoFocus.mjs.map +1 -0
- package/lib/utils/enhances/WithCSS.d.ts +30 -2
- package/lib/utils/enhances/WithCSS.js +57 -4
- package/lib/utils/enhances/WithCSS.js.map +1 -1
- package/lib/utils/enhances/WithCSS.mjs +53 -2
- package/lib/utils/enhances/WithCSS.mjs.map +1 -1
- package/lib/utils/enhances/WithI18n.d.ts +30 -1
- package/lib/utils/enhances/WithI18n.js +57 -1
- package/lib/utils/enhances/WithI18n.js.map +1 -1
- package/lib/utils/enhances/WithI18n.mjs +46 -1
- package/lib/utils/enhances/WithI18n.mjs.map +1 -1
- package/lib/utils/enhances/WithKeyboardFocus.d.ts +46 -0
- package/lib/utils/enhances/WithKeyboardFocus.js +94 -0
- package/lib/utils/enhances/WithKeyboardFocus.js.map +1 -0
- package/lib/utils/enhances/WithKeyboardFocus.mjs +88 -0
- package/lib/utils/enhances/WithKeyboardFocus.mjs.map +1 -0
- package/lib/utils/enhances/WithRef.d.ts +3 -0
- package/lib/utils/enhances/WithRef.js +25 -0
- package/lib/utils/enhances/WithRef.js.map +1 -0
- package/lib/utils/enhances/WithRef.mjs +18 -0
- package/lib/utils/enhances/WithRef.mjs.map +1 -0
- package/lib/utils/enhances/animatedSizeEnhance.d.ts +4 -0
- package/lib/utils/enhances/animatedSizeEnhance.js +2 -0
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.mjs +3 -0
- package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -1
- package/lib/utils/enhances/autoFocusEnhance.d.ts +10 -0
- package/lib/utils/enhances/autoFocusEnhance.js +45 -0
- package/lib/utils/enhances/autoFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/autoFocusEnhance.mjs +38 -0
- package/lib/utils/enhances/autoFocusEnhance.mjs.map +1 -0
- package/lib/utils/enhances/i18nEnhance.d.ts +4 -0
- package/lib/utils/enhances/i18nEnhance.js +2 -0
- package/lib/utils/enhances/i18nEnhance.js.map +1 -1
- package/lib/utils/enhances/i18nEnhance.mjs.map +1 -1
- package/lib/utils/enhances/keyboardFocusEnhance.d.ts +27 -0
- package/lib/utils/enhances/keyboardFocusEnhance.js +63 -0
- package/lib/utils/enhances/keyboardFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/keyboardFocusEnhance.mjs +57 -0
- package/lib/utils/enhances/keyboardFocusEnhance.mjs.map +1 -0
- package/lib/utils/eventEmitter.d.ts +6 -10
- package/lib/utils/eventEmitter.js +27 -55
- package/lib/utils/eventEmitter.js.map +1 -1
- package/lib/utils/eventEmitter.mjs +27 -55
- package/lib/utils/eventEmitter.mjs.map +1 -1
- package/lib/utils/getDisplayName.mjs +5 -3
- package/lib/utils/if.d.ts +11 -0
- package/lib/utils/if.js +15 -0
- package/lib/utils/if.js.map +1 -0
- package/lib/utils/if.mjs +9 -0
- package/lib/utils/if.mjs.map +1 -0
- package/lib/utils/injectStyle.js +1 -1
- package/lib/utils/injectStyle.mjs +1 -1
- package/lib/utils/ref.d.ts +3 -1
- package/lib/utils/ref.js +14 -0
- package/lib/utils/ref.js.map +1 -1
- package/lib/utils/ref.mjs +14 -0
- package/lib/utils/ref.mjs.map +1 -1
- package/lib/utils/uniqueID.d.ts +4 -0
- package/lib/utils/uniqueID.js +3 -1
- package/lib/utils/uniqueID.js.map +1 -1
- package/lib/utils/uniqueID.mjs +4 -1
- package/lib/utils/uniqueID.mjs.map +1 -1
- package/lib/utils/use/useColorResolver.js +1 -1
- package/lib/utils/use/useColorResolver.js.map +1 -1
- package/lib/utils/use/useColorResolver.mjs +1 -1
- package/lib/utils/use/useColorResolver.mjs.map +1 -1
- package/lib/utils/use/useCss.d.ts +4 -0
- package/lib/utils/use/useCss.js +19 -0
- package/lib/utils/use/useCss.js.map +1 -0
- package/lib/utils/use/useCss.mjs +12 -0
- package/lib/utils/use/useCss.mjs.map +1 -0
- package/lib/utils/use/useEnhancedEffect.d.ts +1 -1
- package/lib/utils/zIndexStacking.d.ts +1 -3
- package/lib/utils/zIndexStacking.js.map +1 -1
- package/lib/utils/zIndexStacking.mjs.map +1 -1
- package/package.json +1 -1
- package/lib/decorators/propsObserver.d.ts +0 -11
- package/lib/decorators/propsObserver.js +0 -77
- package/lib/decorators/propsObserver.js.map +0 -1
- package/lib/decorators/propsObserver.mjs +0 -70
- package/lib/decorators/propsObserver.mjs.map +0 -1
- package/lib/decorators/reactive.d.ts +0 -11
- package/lib/decorators/reactive.js +0 -51
- package/lib/decorators/reactive.js.map +0 -1
- package/lib/decorators/reactive.mjs +0 -45
- package/lib/decorators/reactive.mjs.map +0 -1
- package/lib/utils/indentStyles.d.ts +0 -3
- package/lib/utils/indentStyles.js +0 -45
- package/lib/utils/indentStyles.js.map +0 -1
- package/lib/utils/indentStyles.mjs +0 -36
- package/lib/utils/indentStyles.mjs.map +0 -1
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
var isPrimitiveValue = function isPrimitiveValue(value) {
|
|
2
|
-
return value !== Object(value);
|
|
3
|
-
};
|
|
4
|
-
function reactive(watchedFieldsOrCb, cb) {
|
|
5
|
-
return function (_, ctx) {
|
|
6
|
-
var addInitializer = ctx.addInitializer,
|
|
7
|
-
name = ctx.name;
|
|
8
|
-
addInitializer(function () {
|
|
9
|
-
var thisRoot = this;
|
|
10
|
-
var isPrimitive = isPrimitiveValue(this[name]);
|
|
11
|
-
var callback = typeof watchedFieldsOrCb === 'function' ? watchedFieldsOrCb : cb;
|
|
12
|
-
var fields = Array.isArray(watchedFieldsOrCb) ? watchedFieldsOrCb : null;
|
|
13
|
-
if (isPrimitive) {
|
|
14
|
-
var value = this[name];
|
|
15
|
-
Object.defineProperty(this, name, {
|
|
16
|
-
get: function get() {
|
|
17
|
-
return value;
|
|
18
|
-
},
|
|
19
|
-
set: function set(newValue) {
|
|
20
|
-
var oldValue = value;
|
|
21
|
-
value = newValue;
|
|
22
|
-
if (oldValue !== newValue) {
|
|
23
|
-
callback.call(thisRoot, name, newValue);
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true
|
|
28
|
-
});
|
|
29
|
-
} else {
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
this[name] = new Proxy(this[name], {
|
|
32
|
-
set: function set(target, p, newValue) {
|
|
33
|
-
target[p] = newValue;
|
|
34
|
-
if ((fields === null || fields === void 0 ? void 0 : fields.length) === 0 || fields !== null && fields !== void 0 && fields.includes(p)) {
|
|
35
|
-
callback.call(thisRoot, p, newValue);
|
|
36
|
-
}
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export default reactive;
|
|
45
|
-
//# sourceMappingURL=reactive.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactive.mjs","names":["isPrimitiveValue","value","Object","reactive","watchedFieldsOrCb","cb","_","ctx","addInitializer","name","thisRoot","isPrimitive","callback","fields","Array","isArray","defineProperty","get","set","newValue","oldValue","call","enumerable","configurable","Proxy","target","p","length","includes"],"sources":["../../src/decorators/reactive.ts"],"sourcesContent":["type Primitive = string | number | boolean | symbol | bigint | null | undefined;\ntype IsReadonly<This, Property extends keyof This> =\n (<F>() => F extends { [P in Property]: This[Property] } ? 1 : 2) extends\n (<F>() => F extends { -readonly [P in Property]: This[Property] } ? 1 : 2)\n ? false\n : true;\ntype Callback<This> = (this: This, field: string | symbol, newValue: unknown) => void;\ntype ReturnType<\n This,\n Property extends keyof This = keyof This,\n> = IsReadonly<This, Property> extends true\n ? (_: undefined, ctx: ClassFieldDecoratorContext<This, This[Property]>) => void\n : This[Property] extends Primitive\n ? (_: undefined, ctx: ClassFieldDecoratorContext<This, This[Property]>) => void\n : never;\n\nconst isPrimitiveValue = (value: unknown) => value !== Object(value);\n\nfunction reactive<\n This,\n Property extends keyof This,\n Value = This[Property],\n>(cb: Value extends Primitive ? Callback<This> : never): ReturnType<This>;\nfunction reactive<\n This,\n Property extends keyof This,\n Value = This[Property],\n>(watchedFields: Value extends Primitive ? never : Array<keyof Value>, cb: Callback<This>): ReturnType<This>;\n\nfunction reactive<\n This,\n Property extends keyof This,\n>(watchedFieldsOrCb: Array<keyof This[Property]> | Callback<This>, cb?: Callback<This>) {\n return function (_: undefined, ctx: ClassFieldDecoratorContext<This, This[Property]>) {\n const { addInitializer, name } = ctx;\n\n addInitializer(function (this: This) {\n const thisRoot = this;\n\n const isPrimitive = isPrimitiveValue(this[name as Property]);\n\n const callback = typeof watchedFieldsOrCb === 'function' ? watchedFieldsOrCb : cb!;\n const fields = Array.isArray(watchedFieldsOrCb) ? watchedFieldsOrCb : null;\n\n if (isPrimitive) {\n let value = this[name as Property];\n\n Object.defineProperty(this, name, {\n get() {\n return value;\n },\n set(newValue) {\n const oldValue = value;\n\n value = newValue;\n\n if (oldValue !== newValue) {\n callback.call(thisRoot, name, newValue);\n }\n },\n enumerable: true,\n configurable: true,\n });\n } else {\n // @ts-ignore\n this[name] = new Proxy(this[name], {\n set(target, p, newValue) {\n target[p] = newValue;\n\n if (fields?.length === 0 || fields?.includes(p as keyof This[Property])) {\n callback.call(thisRoot, p, newValue);\n }\n\n return true;\n },\n });\n }\n });\n };\n}\n\nexport default reactive;\n"],"mappings":"AAgBA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,KAAc;EAAA,OAAKA,KAAK,KAAKC,MAAM,CAACD,KAAK,CAAC;AAAA;AAapE,SAASE,QAAQA,CAGfC,iBAA+D,EAAEC,EAAmB,EAAE;EACtF,OAAO,UAAUC,CAAY,EAAEC,GAAqD,EAAE;IACpF,IAAQC,cAAc,GAAWD,GAAG,CAA5BC,cAAc;MAAEC,IAAI,GAAKF,GAAG,CAAZE,IAAI;IAE5BD,cAAc,CAAC,YAAsB;MACnC,IAAME,QAAQ,GAAG,IAAI;MAErB,IAAMC,WAAW,GAAGX,gBAAgB,CAAC,IAAI,CAACS,IAAI,CAAa,CAAC;MAE5D,IAAMG,QAAQ,GAAG,OAAOR,iBAAiB,KAAK,UAAU,GAAGA,iBAAiB,GAAGC,EAAG;MAClF,IAAMQ,MAAM,GAAGC,KAAK,CAACC,OAAO,CAACX,iBAAiB,CAAC,GAAGA,iBAAiB,GAAG,IAAI;MAE1E,IAAIO,WAAW,EAAE;QACf,IAAIV,KAAK,GAAG,IAAI,CAACQ,IAAI,CAAa;QAElCP,MAAM,CAACc,cAAc,CAAC,IAAI,EAAEP,IAAI,EAAE;UAChCQ,GAAG,WAAHA,GAAGA,CAAA,EAAG;YACJ,OAAOhB,KAAK;UACd,CAAC;UACDiB,GAAG,WAAHA,GAAGA,CAACC,QAAQ,EAAE;YACZ,IAAMC,QAAQ,GAAGnB,KAAK;YAEtBA,KAAK,GAAGkB,QAAQ;YAEhB,IAAIC,QAAQ,KAAKD,QAAQ,EAAE;cACzBP,QAAQ,CAACS,IAAI,CAACX,QAAQ,EAAED,IAAI,EAAEU,QAAQ,CAAC;YACzC;UACF,CAAC;UACDG,UAAU,EAAE,IAAI;UAChBC,YAAY,EAAE;QAChB,CAAC,CAAC;MACJ,CAAC,MAAM;QACL;QACA,IAAI,CAACd,IAAI,CAAC,GAAG,IAAIe,KAAK,CAAC,IAAI,CAACf,IAAI,CAAC,EAAE;UACjCS,GAAG,WAAHA,GAAGA,CAACO,MAAM,EAAEC,CAAC,EAAEP,QAAQ,EAAE;YACvBM,MAAM,CAACC,CAAC,CAAC,GAAGP,QAAQ;YAEpB,IAAI,CAAAN,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEc,MAAM,MAAK,CAAC,IAAId,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEe,QAAQ,CAACF,CAAyB,CAAC,EAAE;cACvEd,QAAQ,CAACS,IAAI,CAACX,QAAQ,EAAEgB,CAAC,EAAEP,QAAQ,CAAC;YACtC;YAEA,OAAO,IAAI;UACb;QACF,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;EACJ,CAAC;AACH;AAEA,eAAehB,QAAQ","ignoreList":[]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare function removeUndefinedKeys<T extends {}>(obj: T): any;
|
|
2
|
-
export declare function getSize(size: string | number | undefined): string | undefined;
|
|
3
|
-
export declare function getAutoOrScaleIndent(indent: number | string | undefined, scaleIndent: number): string | number | undefined;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.getAutoOrScaleIndent = getAutoOrScaleIndent;
|
|
8
|
-
exports.getSize = getSize;
|
|
9
|
-
exports.removeUndefinedKeys = removeUndefinedKeys;
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
function removeUndefinedKeys(obj) {
|
|
12
|
-
return Object.entries(obj).reduce(function (acc, _ref) {
|
|
13
|
-
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
14
|
-
key = _ref2[0],
|
|
15
|
-
value = _ref2[1];
|
|
16
|
-
if (value !== undefined) {
|
|
17
|
-
acc[key] = value;
|
|
18
|
-
}
|
|
19
|
-
return acc;
|
|
20
|
-
}, {});
|
|
21
|
-
}
|
|
22
|
-
function getSize(size) {
|
|
23
|
-
if (typeof size !== 'number') {
|
|
24
|
-
return size;
|
|
25
|
-
}
|
|
26
|
-
if (size < 1) {
|
|
27
|
-
return "".concat(100 * size, "%");
|
|
28
|
-
}
|
|
29
|
-
if (size >= 1) {
|
|
30
|
-
return "".concat(size, "px");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function getAutoOrScaleIndent(indent, scaleIndent) {
|
|
34
|
-
if (typeof indent === 'string') {
|
|
35
|
-
return indent;
|
|
36
|
-
}
|
|
37
|
-
if (typeof indent === 'number' && indent > -1 && indent < 1) {
|
|
38
|
-
return "".concat(100 * indent, "%");
|
|
39
|
-
}
|
|
40
|
-
if (typeof indent === 'number' && (indent >= 1 || indent <= -1)) {
|
|
41
|
-
return "".concat(indent * scaleIndent, "px");
|
|
42
|
-
}
|
|
43
|
-
return indent;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=indentStyles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indentStyles.js","names":["removeUndefinedKeys","obj","Object","entries","reduce","acc","_ref","_ref2","_slicedToArray2","key","value","undefined","getSize","size","concat","getAutoOrScaleIndent","indent","scaleIndent"],"sources":["../../src/utils/indentStyles.tsx"],"sourcesContent":["export function removeUndefinedKeys<T extends {}>(obj: T) {\n return Object.entries(obj).reduce((acc: any, [key, value]) => {\n if (value !== undefined) {\n acc[key] = value;\n }\n return acc;\n }, {});\n}\n\nexport function getSize(size: string | number | undefined): string | undefined {\n if (typeof size !== 'number') {\n return size;\n }\n if (size < 1) {\n return `${100 * size}%`;\n }\n if (size >= 1) {\n return `${size}px`;\n }\n}\n\nexport function getAutoOrScaleIndent(indent: number | string | undefined, scaleIndent: number) {\n if (typeof indent === 'string') {\n return indent;\n }\n if (typeof indent === 'number' && indent > -1 && indent < 1) {\n return `${100 * indent}%`;\n }\n if (typeof indent === 'number' && (indent >= 1 || indent <= -1)) {\n return `${indent * scaleIndent}px`;\n }\n return indent;\n}\n"],"mappings":";;;;;;;;;;AAAO,SAASA,mBAAmBA,CAAeC,GAAM,EAAE;EACxD,OAAOC,MAAM,CAACC,OAAO,CAACF,GAAG,CAAC,CAACG,MAAM,CAAC,UAACC,GAAQ,EAAAC,IAAA,EAAmB;IAAA,IAAAC,KAAA,OAAAC,eAAA,aAAAF,IAAA;MAAhBG,GAAG,GAAAF,KAAA;MAAEG,KAAK,GAAAH,KAAA;IACtD,IAAIG,KAAK,KAAKC,SAAS,EAAE;MACvBN,GAAG,CAACI,GAAG,CAAC,GAAGC,KAAK;IAClB;IACA,OAAOL,GAAG;EACZ,CAAC,EAAE,CAAC,CAAC,CAAC;AACR;AAEO,SAASO,OAAOA,CAACC,IAAiC,EAAsB;EAC7E,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI;EACb;EACA,IAAIA,IAAI,GAAG,CAAC,EAAE;IACZ,UAAAC,MAAA,CAAU,GAAG,GAAGD,IAAI;EACtB;EACA,IAAIA,IAAI,IAAI,CAAC,EAAE;IACb,UAAAC,MAAA,CAAUD,IAAI;EAChB;AACF;AAEO,SAASE,oBAAoBA,CAACC,MAAmC,EAAEC,WAAmB,EAAE;EAC7F,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAOA,MAAM;EACf;EACA,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,GAAG,CAAC,CAAC,IAAIA,MAAM,GAAG,CAAC,EAAE;IAC3D,UAAAF,MAAA,CAAU,GAAG,GAAGE,MAAM;EACxB;EACA,IAAI,OAAOA,MAAM,KAAK,QAAQ,KAAKA,MAAM,IAAI,CAAC,IAAIA,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE;IAC/D,UAAAF,MAAA,CAAUE,MAAM,GAAGC,WAAW;EAChC;EACA,OAAOD,MAAM;AACf","ignoreList":[]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
export function removeUndefinedKeys(obj) {
|
|
3
|
-
return Object.entries(obj).reduce(function (acc, _ref) {
|
|
4
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
5
|
-
key = _ref2[0],
|
|
6
|
-
value = _ref2[1];
|
|
7
|
-
if (value !== undefined) {
|
|
8
|
-
acc[key] = value;
|
|
9
|
-
}
|
|
10
|
-
return acc;
|
|
11
|
-
}, {});
|
|
12
|
-
}
|
|
13
|
-
export function getSize(size) {
|
|
14
|
-
if (typeof size !== 'number') {
|
|
15
|
-
return size;
|
|
16
|
-
}
|
|
17
|
-
if (size < 1) {
|
|
18
|
-
return "".concat(100 * size, "%");
|
|
19
|
-
}
|
|
20
|
-
if (size >= 1) {
|
|
21
|
-
return "".concat(size, "px");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export function getAutoOrScaleIndent(indent, scaleIndent) {
|
|
25
|
-
if (typeof indent === 'string') {
|
|
26
|
-
return indent;
|
|
27
|
-
}
|
|
28
|
-
if (typeof indent === 'number' && indent > -1 && indent < 1) {
|
|
29
|
-
return "".concat(100 * indent, "%");
|
|
30
|
-
}
|
|
31
|
-
if (typeof indent === 'number' && (indent >= 1 || indent <= -1)) {
|
|
32
|
-
return "".concat(indent * scaleIndent, "px");
|
|
33
|
-
}
|
|
34
|
-
return indent;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=indentStyles.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indentStyles.mjs","names":["removeUndefinedKeys","obj","Object","entries","reduce","acc","_ref","_ref2","_slicedToArray","key","value","undefined","getSize","size","concat","getAutoOrScaleIndent","indent","scaleIndent"],"sources":["../../src/utils/indentStyles.tsx"],"sourcesContent":["export function removeUndefinedKeys<T extends {}>(obj: T) {\n return Object.entries(obj).reduce((acc: any, [key, value]) => {\n if (value !== undefined) {\n acc[key] = value;\n }\n return acc;\n }, {});\n}\n\nexport function getSize(size: string | number | undefined): string | undefined {\n if (typeof size !== 'number') {\n return size;\n }\n if (size < 1) {\n return `${100 * size}%`;\n }\n if (size >= 1) {\n return `${size}px`;\n }\n}\n\nexport function getAutoOrScaleIndent(indent: number | string | undefined, scaleIndent: number) {\n if (typeof indent === 'string') {\n return indent;\n }\n if (typeof indent === 'number' && indent > -1 && indent < 1) {\n return `${100 * indent}%`;\n }\n if (typeof indent === 'number' && (indent >= 1 || indent <= -1)) {\n return `${indent * scaleIndent}px`;\n }\n return indent;\n}\n"],"mappings":";AAAA,OAAO,SAASA,mBAAmBA,CAAeC,GAAM,EAAE;EACxD,OAAOC,MAAM,CAACC,OAAO,CAACF,GAAG,CAAC,CAACG,MAAM,CAAC,UAACC,GAAQ,EAAAC,IAAA,EAAmB;IAAA,IAAAC,KAAA,GAAAC,cAAA,CAAAF,IAAA;MAAhBG,GAAG,GAAAF,KAAA;MAAEG,KAAK,GAAAH,KAAA;IACtD,IAAIG,KAAK,KAAKC,SAAS,EAAE;MACvBN,GAAG,CAACI,GAAG,CAAC,GAAGC,KAAK;IAClB;IACA,OAAOL,GAAG;EACZ,CAAC,EAAE,CAAC,CAAC,CAAC;AACR;AAEA,OAAO,SAASO,OAAOA,CAACC,IAAiC,EAAsB;EAC7E,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI;EACb;EACA,IAAIA,IAAI,GAAG,CAAC,EAAE;IACZ,UAAAC,MAAA,CAAU,GAAG,GAAGD,IAAI;EACtB;EACA,IAAIA,IAAI,IAAI,CAAC,EAAE;IACb,UAAAC,MAAA,CAAUD,IAAI;EAChB;AACF;AAEA,OAAO,SAASE,oBAAoBA,CAACC,MAAmC,EAAEC,WAAmB,EAAE;EAC7F,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAOA,MAAM;EACf;EACA,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,GAAG,CAAC,CAAC,IAAIA,MAAM,GAAG,CAAC,EAAE;IAC3D,UAAAF,MAAA,CAAU,GAAG,GAAGE,MAAM;EACxB;EACA,IAAI,OAAOA,MAAM,KAAK,QAAQ,KAAKA,MAAM,IAAI,CAAC,IAAIA,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE;IAC/D,UAAAF,MAAA,CAAUE,MAAM,GAAGC,WAAW;EAChC;EACA,OAAOD,MAAM;AACf","ignoreList":[]}
|