@linkdesk/plugin-sdk 0.1.14 → 0.1.16

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,97 +1,97 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://linkdesk.local/schemas/icon-theme.schema.json",
4
- "title": "LinkDesk 图标主题 mappings 数据契约",
5
- "description": "contributes.iconThemes 指向的 mappings JSON 文件契约——镜像引擎 normalizeIconThemeMappingssrc/pluginLoader/contributions/contributions.ts,E5.8#133 定案)。匹配表四段(files/extensions/folders/foldersExpanded)+ 顶层默认图标五键(file/folder/folderExpanded/rootFolder/rootFolderExpanded);条目双形态二选一:字体 glyphclass + 可选 color)或图像资产(imagePath,相对插件根)。可选顶层 font 段声明自定义图标字体。校验:npm @linkdesk/plugin-sdk validateIconThemeJson;repo check-theme-schema.mjscontributes.iconThemes 全扫)。",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "properties": {
9
- "$schema": {
10
- "type": "string",
11
- "description": "编辑器 IntelliSense 引用(可选)——npm 作者引 node_modules/@linkdesk/plugin-sdk/schemas/icon-theme.schema.json"
12
- },
13
- "files": {
14
- "$ref": "#/$defs/mappingTable",
15
- "description": "文件名图标条目(命中优先级最高,未命中走 extensions"
16
- },
17
- "extensions": {
18
- "$ref": "#/$defs/mappingTable",
19
- "description": "扩展名(含点,如 \".ts\"/\".jsx\")→ 图标条目"
20
- },
21
- "folders": {
22
- "$ref": "#/$defs/mappingTable",
23
- "description": "目录名图标条目(折叠态)"
24
- },
25
- "foldersExpanded": {
26
- "$ref": "#/$defs/mappingTable",
27
- "description": "目录名图标条目(展开态;缺省复用 folders"
28
- },
29
- "file": {
30
- "$ref": "#/$defs/iconMapping",
31
- "description": "默认文件图标——未命中 files/extensions 时使用(缺省 = 壳保底图标)"
32
- },
33
- "folder": {
34
- "$ref": "#/$defs/iconMapping",
35
- "description": "默认文件夹图标——未命中 folders 时使用(缺省 = 壳保底)"
36
- },
37
- "folderExpanded": {
38
- "$ref": "#/$defs/iconMapping",
39
- "description": "默认文件夹展开图标——未命中 foldersExpanded 时使用(缺省 = 壳保底)"
40
- },
41
- "rootFolder": {
42
- "$ref": "#/$defs/iconMapping",
43
- "description": "根文件夹图标(缺省 = 壳保底)"
44
- },
45
- "rootFolderExpanded": {
46
- "$ref": "#/$defs/iconMapping",
47
- "description": "根文件夹展开图标(缺省 = 壳保底)"
48
- },
49
- "font": {
50
- "$ref": "#/$defs/fontSpec",
51
- "description": "自定义图标字体(可选)——声明后壳生成 @font-faceglyph 类由作者提供"
52
- }
53
- },
54
- "$defs": {
55
- "mappingTable": {
56
- "type": "object",
57
- "description": "匹配表——名字(文件名/扩展名/目录名)→ 图标条目",
58
- "additionalProperties": { "$ref": "#/$defs/iconMapping" }
59
- },
60
- "iconMapping": {
61
- "title": "图标条目——双形态二选一",
62
- "type": "object",
63
- "anyOf": [
64
- {
65
- "title": "字体 glyph 形态",
66
- "description": "CSS 类名——codicon 保底 / 自定义图标字体(class 缺省 = 图标字体家族自带类)",
67
- "required": ["class"],
68
- "properties": {
69
- "class": { "type": "string", "description": "CSS 类名(如 \"codicon codicon-typescript\" \"myfont myfont-rust\"" },
70
- "color": { "type": "string", "description": "可选每图标颜色(seti 类彩色字体;普通单色字体不写)" }
71
- },
72
- "additionalProperties": false
73
- },
74
- {
75
- "title": "图像资产形态",
76
- "description": "图像资产——任意多色/拟物化/贴图",
77
- "required": ["imagePath"],
78
- "properties": {
79
- "imagePath": { "type": "string", "description": "图像资产相对插件根的路径(如 \"icons/js.svg\")——渲染时壳用 getPluginAssetPath 解析 linkdesk:// 绝对 URL(硬约束 12 同族),禁止写 /assets/... 绝对路径" }
80
- },
81
- "additionalProperties": false
82
- }
83
- ]
84
- },
85
- "fontSpec": {
86
- "type": "object",
87
- "description": "自定义图标字体元数据——path 相对插件根或绝对 URL;@font-face 由壳生成(池独立文档复刻),glyph CSS 作者自写",
88
- "required": ["path", "family"],
89
- "additionalProperties": false,
90
- "properties": {
91
- "path": { "type": "string", "description": "字体文件相对插件根路径(或 linkdesk:// / http(s):// / data: 绝对 URL" },
92
- "family": { "type": "string", "description": "作者 glyph CSS font-family 写的族名" },
93
- "glyphs": { "type": "string", "description": "glyph CSS 文件相对插件根路径(可选;缺省 = @font-face,无自定义 glyph 类)" }
94
- }
95
- }
96
- }
97
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://linkdesk.local/schemas/icon-theme.schema.json",
4
+ "title": "LinkDesk icon theme mappings data contract",
5
+ "description": "Contract for the mappings JSON file referenced by contributes.iconThemes mirrors the engine's normalizeIconThemeMappings (src/pluginLoader/contributions/contributions.ts). Four mapping tables (files/extensions/folders/foldersExpanded) plus five top-level default icon keys (file/folder/folderExpanded/rootFolder/rootFolderExpanded); each entry takes one of two forms: a font glyph (class + optional color) or an image asset (imagePath, relative to the plugin root). An optional top-level font section declares a custom icon font. Validation: @linkdesk/plugin-sdk validateIconThemeJson on the npm side, check-theme-schema.mjs on the repo side (it scans every contributes.iconThemes entry).",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string",
11
+ "description": "Editor IntelliSense reference (optional) — npm authors reference node_modules/@linkdesk/plugin-sdk/schemas/icon-theme.schema.json"
12
+ },
13
+ "files": {
14
+ "$ref": "#/$defs/mappingTable",
15
+ "description": "File name icon entry (highest match priority; on a miss, extensions is consulted)"
16
+ },
17
+ "extensions": {
18
+ "$ref": "#/$defs/mappingTable",
19
+ "description": "Extension (including the dot, e.g. \".ts\"/\".jsx\") → icon entry"
20
+ },
21
+ "folders": {
22
+ "$ref": "#/$defs/mappingTable",
23
+ "description": "Folder name icon entry (collapsed)"
24
+ },
25
+ "foldersExpanded": {
26
+ "$ref": "#/$defs/mappingTable",
27
+ "description": "Folder name icon entry (expanded; defaults to reusing folders)"
28
+ },
29
+ "file": {
30
+ "$ref": "#/$defs/iconMapping",
31
+ "description": "Default file icon — used when files/extensions miss (default: the shell's fallback icon)"
32
+ },
33
+ "folder": {
34
+ "$ref": "#/$defs/iconMapping",
35
+ "description": "Default folder icon — used when folders misses (default: the shell's fallback)"
36
+ },
37
+ "folderExpanded": {
38
+ "$ref": "#/$defs/iconMapping",
39
+ "description": "Default expanded folder icon — used when foldersExpanded misses (default: the shell's fallback)"
40
+ },
41
+ "rootFolder": {
42
+ "$ref": "#/$defs/iconMapping",
43
+ "description": "Root folder icon (default: the shell's fallback)"
44
+ },
45
+ "rootFolderExpanded": {
46
+ "$ref": "#/$defs/iconMapping",
47
+ "description": "Expanded root folder icon (default: the shell's fallback)"
48
+ },
49
+ "font": {
50
+ "$ref": "#/$defs/fontSpec",
51
+ "description": "Custom icon font (optional) — once declared, the shell generates @font-face and the author supplies the glyph classes"
52
+ }
53
+ },
54
+ "$defs": {
55
+ "mappingTable": {
56
+ "type": "object",
57
+ "description": "Mapping table — name (file name / extension / folder name) → icon entry",
58
+ "additionalProperties": { "$ref": "#/$defs/iconMapping" }
59
+ },
60
+ "iconMapping": {
61
+ "title": "Icon entry — pick one of two forms",
62
+ "type": "object",
63
+ "anyOf": [
64
+ {
65
+ "title": "Font glyph form",
66
+ "description": "CSS class name — codicon as the fallback, or a custom icon font (when class is omitted, the icon font family's own class is used)",
67
+ "required": ["class"],
68
+ "properties": {
69
+ "class": { "type": "string", "description": "CSS class name (e.g. \"codicon codicon-typescript\" or \"myfont myfont-rust\")" },
70
+ "color": { "type": "string", "description": "Optional per-icon color (for colorful seti-style fonts; omit for plain monochrome fonts)" }
71
+ },
72
+ "additionalProperties": false
73
+ },
74
+ {
75
+ "title": "Image asset form",
76
+ "description": "Image asset — any multicolor, skeuomorphic, or textured artwork",
77
+ "required": ["imagePath"],
78
+ "properties": {
79
+ "imagePath": { "type": "string", "description": "Path to the image asset relative to the plugin root (e.g. \"icons/js.svg\") at render time the shell resolves it to an absolute linkdesk:// URL via getPluginAssetPath; absolute /assets/... paths are forbidden" }
80
+ },
81
+ "additionalProperties": false
82
+ }
83
+ ]
84
+ },
85
+ "fontSpec": {
86
+ "type": "object",
87
+ "description": "Custom icon font metadata — path is relative to the plugin root or an absolute URL; the shell generates @font-face and the author writes the glyph class CSS",
88
+ "required": ["path", "family"],
89
+ "additionalProperties": false,
90
+ "properties": {
91
+ "path": { "type": "string", "description": "Font file path relative to the plugin root (or an absolute linkdesk:// / http(s):// / data: URL)" },
92
+ "family": { "type": "string", "description": "The family name the author writes in font-family in the glyph CSS" },
93
+ "glyphs": { "type": "string", "description": "Path to the glyph class CSS file relative to the plugin root (optional; default: @font-face only, no custom glyph classes)" }
94
+ }
95
+ }
96
+ }
97
+ }