@tuya-sat/micro-utils 2.2.4 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -0
- package/dist/theme.d.ts +11 -0
- package/dist/theme.js +58 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -10,11 +10,25 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
13
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
20
|
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
16
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.theme = void 0;
|
|
17
30
|
__exportStar(require("./getLang"), exports);
|
|
18
31
|
__exportStar(require("./getFakeMenu"), exports);
|
|
19
32
|
__exportStar(require("./parseManifest"), exports);
|
|
20
33
|
__exportStar(require("./getPackage"), exports);
|
|
34
|
+
exports.theme = __importStar(require("./theme"));
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface StringObj {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
}
|
|
4
|
+
export declare function getLessVaribleFormLessFile(filePath: string): Promise<StringObj>;
|
|
5
|
+
export declare function getCustomLightVaribleFile(): Promise<StringObj>;
|
|
6
|
+
export declare function getCustomDarkVaribleFile(): Promise<StringObj>;
|
|
7
|
+
export declare function getAntdOverWriteFile(): {
|
|
8
|
+
light: StringObj;
|
|
9
|
+
dark: StringObj;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getAntdOverWriteFile = exports.getCustomDarkVaribleFile = exports.getCustomLightVaribleFile = exports.getLessVaribleFormLessFile = void 0;
|
|
16
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
|
+
const node_path_1 = require("node:path");
|
|
18
|
+
const customDarkVaribleFile = "src/styles/dark.less";
|
|
19
|
+
const customLightVaribleFile = "src/styles/light.less";
|
|
20
|
+
function splitLessToVarible(content) {
|
|
21
|
+
return content.split(";").reduce((prev, current) => {
|
|
22
|
+
let [key, value] = current.split(":").map((value) => value.trim());
|
|
23
|
+
prev[key] = value;
|
|
24
|
+
return prev;
|
|
25
|
+
}, {});
|
|
26
|
+
}
|
|
27
|
+
function getLessVaribleFormLessFile(filePath) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const exist = yield fs_extra_1.default.pathExists(filePath);
|
|
30
|
+
if (!exist) {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
let content = yield fs_extra_1.default.readFile(filePath, "utf-8");
|
|
34
|
+
return splitLessToVarible(content);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.getLessVaribleFormLessFile = getLessVaribleFormLessFile;
|
|
38
|
+
function getCustomLightVaribleFile() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return getLessVaribleFormLessFile(customLightVaribleFile);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.getCustomLightVaribleFile = getCustomLightVaribleFile;
|
|
44
|
+
function getCustomDarkVaribleFile() {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return getLessVaribleFormLessFile(customDarkVaribleFile);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exports.getCustomDarkVaribleFile = getCustomDarkVaribleFile;
|
|
50
|
+
function getAntdOverWriteFile() {
|
|
51
|
+
const filePath = "antd.less.overwrite.js";
|
|
52
|
+
const exist = fs_extra_1.default.pathExistsSync(filePath);
|
|
53
|
+
if (!exist) {
|
|
54
|
+
return { dark: {}, light: {} };
|
|
55
|
+
}
|
|
56
|
+
return require((0, node_path_1.resolve)(filePath));
|
|
57
|
+
}
|
|
58
|
+
exports.getAntdOverWriteFile = getAntdOverWriteFile;
|