@caoguo/maplibre-ai 0.0.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.
@@ -0,0 +1,65 @@
1
+ /**
2
+ * 样式生成器 v2(PRD phase-3 §8)
3
+ *
4
+ * 功能点:
5
+ * - SG-1 色板提取:上传图片 → 提取主色调 → 生成配色方案
6
+ * - SG-2 风格模板:预置 6 套行业模板(管网/电网/水网/交通/算力/通信)
7
+ * - SG-3 品牌定制:输入品牌色 → 自动生成全套地图样式
8
+ * - SG-4 运营商主题:三大运营商预设主题 + 自定义
9
+ * - SG-5 昼夜切换:一键切换亮色/暗色模式
10
+ */
11
+ /** 行业风格模板类型(六张网) */
12
+ type IndustryStyle = 'pipeline' | 'grid' | 'water' | 'transport' | 'compute' | 'telecom';
13
+ /** 配色方案 */
14
+ interface ColorScheme {
15
+ /** 主色 */
16
+ primary: string;
17
+ /** 辅助色 */
18
+ secondary: string;
19
+ /** 强调色 */
20
+ accent: string;
21
+ /** 背景色 */
22
+ background: string;
23
+ /** 名称 */
24
+ name: string;
25
+ }
26
+ /** 生成的地图样式(简化 style.json 配色片段) */
27
+ interface GeneratedMapStyle {
28
+ scheme: ColorScheme;
29
+ /** 线要素配色 */
30
+ lineColor: string;
31
+ /** 点要素配色 */
32
+ pointColor: string;
33
+ /** 面要素配色 */
34
+ fillColor: string;
35
+ /** 底图背景 */
36
+ background: string;
37
+ /** 模式 */
38
+ mode: 'light' | 'dark';
39
+ }
40
+ declare const INDUSTRY_TEMPLATES: Record<IndustryStyle, ColorScheme>;
41
+ declare const CARRIER_STYLES: Record<string, ColorScheme>;
42
+ /**
43
+ * 从图片像素数据提取主色调。
44
+ * @param pixels RGBA 像素数组(每 4 个值一个像素)
45
+ * @returns 主色 hex(出现频率最高的量化色)
46
+ */
47
+ declare function extractDominantColor(pixels: Uint8ClampedArray): string;
48
+ /** 调整颜色亮度(用于生成辅助色) */
49
+ declare function adjustBrightness(hex: string, factor: number): string;
50
+ interface BrandStyleOptions {
51
+ /** 品牌主色(hex) */
52
+ brandColor: string;
53
+ /** 模式 */
54
+ mode?: 'light' | 'dark';
55
+ /** 名称 */
56
+ name?: string;
57
+ }
58
+ declare function generateBrandStyle(opts: BrandStyleOptions): GeneratedMapStyle;
59
+ /** 从行业模板生成样式 */
60
+ declare function generateIndustryStyle(industry: IndustryStyle, mode?: 'light' | 'dark'): GeneratedMapStyle;
61
+ /** 从运营商主题生成样式 */
62
+ declare function generateCarrierStyle(carrier: string, mode?: 'light' | 'dark'): GeneratedMapStyle;
63
+ declare function toggleMode(style: GeneratedMapStyle): GeneratedMapStyle;
64
+
65
+ export { type BrandStyleOptions, CARRIER_STYLES, type ColorScheme, type GeneratedMapStyle, INDUSTRY_TEMPLATES, type IndustryStyle, adjustBrightness, extractDominantColor, generateBrandStyle, generateCarrierStyle, generateIndustryStyle, toggleMode };
@@ -0,0 +1,65 @@
1
+ /**
2
+ * 样式生成器 v2(PRD phase-3 §8)
3
+ *
4
+ * 功能点:
5
+ * - SG-1 色板提取:上传图片 → 提取主色调 → 生成配色方案
6
+ * - SG-2 风格模板:预置 6 套行业模板(管网/电网/水网/交通/算力/通信)
7
+ * - SG-3 品牌定制:输入品牌色 → 自动生成全套地图样式
8
+ * - SG-4 运营商主题:三大运营商预设主题 + 自定义
9
+ * - SG-5 昼夜切换:一键切换亮色/暗色模式
10
+ */
11
+ /** 行业风格模板类型(六张网) */
12
+ type IndustryStyle = 'pipeline' | 'grid' | 'water' | 'transport' | 'compute' | 'telecom';
13
+ /** 配色方案 */
14
+ interface ColorScheme {
15
+ /** 主色 */
16
+ primary: string;
17
+ /** 辅助色 */
18
+ secondary: string;
19
+ /** 强调色 */
20
+ accent: string;
21
+ /** 背景色 */
22
+ background: string;
23
+ /** 名称 */
24
+ name: string;
25
+ }
26
+ /** 生成的地图样式(简化 style.json 配色片段) */
27
+ interface GeneratedMapStyle {
28
+ scheme: ColorScheme;
29
+ /** 线要素配色 */
30
+ lineColor: string;
31
+ /** 点要素配色 */
32
+ pointColor: string;
33
+ /** 面要素配色 */
34
+ fillColor: string;
35
+ /** 底图背景 */
36
+ background: string;
37
+ /** 模式 */
38
+ mode: 'light' | 'dark';
39
+ }
40
+ declare const INDUSTRY_TEMPLATES: Record<IndustryStyle, ColorScheme>;
41
+ declare const CARRIER_STYLES: Record<string, ColorScheme>;
42
+ /**
43
+ * 从图片像素数据提取主色调。
44
+ * @param pixels RGBA 像素数组(每 4 个值一个像素)
45
+ * @returns 主色 hex(出现频率最高的量化色)
46
+ */
47
+ declare function extractDominantColor(pixels: Uint8ClampedArray): string;
48
+ /** 调整颜色亮度(用于生成辅助色) */
49
+ declare function adjustBrightness(hex: string, factor: number): string;
50
+ interface BrandStyleOptions {
51
+ /** 品牌主色(hex) */
52
+ brandColor: string;
53
+ /** 模式 */
54
+ mode?: 'light' | 'dark';
55
+ /** 名称 */
56
+ name?: string;
57
+ }
58
+ declare function generateBrandStyle(opts: BrandStyleOptions): GeneratedMapStyle;
59
+ /** 从行业模板生成样式 */
60
+ declare function generateIndustryStyle(industry: IndustryStyle, mode?: 'light' | 'dark'): GeneratedMapStyle;
61
+ /** 从运营商主题生成样式 */
62
+ declare function generateCarrierStyle(carrier: string, mode?: 'light' | 'dark'): GeneratedMapStyle;
63
+ declare function toggleMode(style: GeneratedMapStyle): GeneratedMapStyle;
64
+
65
+ export { type BrandStyleOptions, CARRIER_STYLES, type ColorScheme, type GeneratedMapStyle, INDUSTRY_TEMPLATES, type IndustryStyle, adjustBrightness, extractDominantColor, generateBrandStyle, generateCarrierStyle, generateIndustryStyle, toggleMode };
@@ -0,0 +1,3 @@
1
+ export { CARRIER_STYLES, INDUSTRY_TEMPLATES, adjustBrightness, extractDominantColor, generateBrandStyle, generateCarrierStyle, generateIndustryStyle, toggleMode } from '../chunk-KNL3QRD2.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@caoguo/maplibre-ai",
3
+ "version": "0.0.1",
4
+ "description": "草果地图 AI 工具链 - AI Debug 诊断 + 样式生成器 v2",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./debug": {
16
+ "types": "./dist/debug/index.d.ts",
17
+ "import": "./dist/debug/index.js",
18
+ "require": "./dist/debug/index.cjs"
19
+ },
20
+ "./stylegen": {
21
+ "types": "./dist/stylegen/index.d.ts",
22
+ "import": "./dist/stylegen/index.js",
23
+ "require": "./dist/stylegen/index.cjs"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "dependencies": {
30
+ "@caoguo/theme": "0.0.1"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public",
34
+ "registry": "https://registry.npmjs.org/"
35
+ },
36
+ "devDependencies": {
37
+ "jsdom": "^25.0.1",
38
+ "tsup": "^8.3.5",
39
+ "typescript": "^5.6.3",
40
+ "vitest": "^2.1.8"
41
+ },
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest"
46
+ }
47
+ }