meemup-library 1.1.79 → 1.1.81
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.
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import IProduct from "..//interfaces/IProduct";
|
|
2
|
+
import IPointOfSaleSetting from "../interfaces/IPointOfSaleSetting";
|
|
1
3
|
/**
|
|
2
4
|
* کلاس ColorController برای مدیریت رنگها و تولید رنگ متن بر اساس رنگ پس زمینه استفاده میشود.
|
|
3
5
|
*/
|
|
@@ -29,6 +31,10 @@ declare class ColorController {
|
|
|
29
31
|
* @returns رنگ متن متناظر (به صورت hex) که برای نمایش بر روی رنگ پس زمینه انتخاب شده است.
|
|
30
32
|
*/
|
|
31
33
|
generateContrastColorForBackground(background_color: string | null, default_text_color?: string): string;
|
|
34
|
+
generateColorForPosProductOrCategory(product: IProduct, setting: IPointOfSaleSetting, defaultBackgroundColor: any, defaultTextColor: any): {
|
|
35
|
+
backgroundColor: any;
|
|
36
|
+
textColor: any;
|
|
37
|
+
};
|
|
32
38
|
}
|
|
33
39
|
declare const _default: ColorController;
|
|
34
40
|
export default _default;
|
|
@@ -83,5 +83,14 @@ class ColorController {
|
|
|
83
83
|
// اگر هیچکدام از فرمتهای بالا نبود، رنگ سیاه را برگردانید
|
|
84
84
|
return default_text_color;
|
|
85
85
|
}
|
|
86
|
+
generateColorForPosProductOrCategory(product, setting, defaultBackgroundColor, defaultTextColor) {
|
|
87
|
+
let textColor = defaultTextColor;
|
|
88
|
+
let backgroundColor = defaultBackgroundColor;
|
|
89
|
+
if (setting.coloredTiles) {
|
|
90
|
+
textColor = this.generateContrastColorForBackground(product.color, defaultTextColor);
|
|
91
|
+
backgroundColor = textColor === defaultTextColor ? defaultBackgroundColor : product.color;
|
|
92
|
+
}
|
|
93
|
+
return { backgroundColor, textColor };
|
|
94
|
+
}
|
|
86
95
|
}
|
|
87
96
|
export default new ColorController();
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meemup-library",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.81",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "yarn remove:one && yarn remove:two && yarn build:esm && yarn build:cjs",
|
|
8
|
+
"build": "yarn remove:one && yarn remove:two && yarn build:esm && yarn build:cjs && yarn commit",
|
|
9
9
|
"build:esm": "tsc",
|
|
10
10
|
"build:cjs": "tsc --module commonjs --outDir src/dist",
|
|
11
11
|
"remove:one": "rimraf dist",
|
|
12
12
|
"remove:two": "rimraf ./src/dist",
|
|
13
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
+
"commit": "git add . && git commit -m \"version.$(jq -r .version package.json)\" && git push origin "
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
17
|
"/dist"
|
|
@@ -25,4 +26,4 @@
|
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"axios": "^1.6.7"
|
|
27
28
|
}
|
|
28
|
-
}
|
|
29
|
+
}
|