@lism-css/mcp 0.10.4 → 0.12.0
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/README.ja.md +4 -2
- package/README.md +4 -2
- package/dist/data/docs-index.json +282 -64
- package/dist/data/guides/SKILL.md +113 -0
- package/dist/data/guides/base-styles.md +106 -0
- package/dist/data/guides/components-core.md +338 -0
- package/dist/data/guides/components-ui.md +351 -0
- package/dist/data/guides/css-rules.md +146 -0
- package/dist/data/guides/module-class.md +162 -0
- package/dist/data/guides/prop-responsive.md +54 -0
- package/dist/data/guides/property-class.md +400 -0
- package/dist/data/guides/set-class.md +190 -0
- package/dist/data/guides/tokens.md +210 -0
- package/dist/data/guides/utility-class.md +81 -0
- package/dist/data/meta.js +2 -2
- package/dist/index.js +4 -0
- package/dist/lib/load-data.js +2 -11
- package/dist/lib/load-markdown.d.ts +6 -0
- package/dist/lib/load-markdown.js +29 -0
- package/dist/lib/markdown-utils.d.ts +42 -0
- package/dist/lib/markdown-utils.js +158 -0
- package/dist/lib/schemas.d.ts +0 -242
- package/dist/lib/schemas.js +0 -64
- package/dist/lib/search.d.ts +2 -16
- package/dist/lib/search.js +9 -68
- package/dist/lib/types.d.ts +0 -64
- package/dist/tools/convert-css.js +96 -55
- package/dist/tools/get-component.js +60 -29
- package/dist/tools/get-guide.d.ts +2 -0
- package/dist/tools/get-guide.js +45 -0
- package/dist/tools/get-overview.js +26 -39
- package/dist/tools/get-props-system.js +45 -33
- package/dist/tools/get-tokens.js +9 -14
- package/dist/tools/search-docs.js +27 -9
- package/package.json +2 -2
- package/dist/data/components.json +0 -564
- package/dist/data/overview.json +0 -114
- package/dist/data/props-system.json +0 -1154
- package/dist/data/tokens.json +0 -152
package/dist/lib/schemas.d.ts
CHANGED
|
@@ -24,245 +24,3 @@ export declare const DocsEntrySchema: z.ZodObject<{
|
|
|
24
24
|
keywords: string[];
|
|
25
25
|
snippet: string;
|
|
26
26
|
}>;
|
|
27
|
-
export declare const ComponentInfoSchema: z.ZodObject<{
|
|
28
|
-
name: z.ZodString;
|
|
29
|
-
package: z.ZodEnum<["lism-css", "@lism-css/ui"]>;
|
|
30
|
-
category: z.ZodString;
|
|
31
|
-
description: z.ZodString;
|
|
32
|
-
aliases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
33
|
-
props: z.ZodArray<z.ZodObject<{
|
|
34
|
-
name: z.ZodString;
|
|
35
|
-
type: z.ZodString;
|
|
36
|
-
default: z.ZodOptional<z.ZodString>;
|
|
37
|
-
description: z.ZodString;
|
|
38
|
-
}, "strip", z.ZodTypeAny, {
|
|
39
|
-
description: string;
|
|
40
|
-
type: string;
|
|
41
|
-
name: string;
|
|
42
|
-
default?: string | undefined;
|
|
43
|
-
}, {
|
|
44
|
-
description: string;
|
|
45
|
-
type: string;
|
|
46
|
-
name: string;
|
|
47
|
-
default?: string | undefined;
|
|
48
|
-
}>, "many">;
|
|
49
|
-
usage: z.ZodString;
|
|
50
|
-
}, "strip", z.ZodTypeAny, {
|
|
51
|
-
description: string;
|
|
52
|
-
category: string;
|
|
53
|
-
name: string;
|
|
54
|
-
package: "lism-css" | "@lism-css/ui";
|
|
55
|
-
props: {
|
|
56
|
-
description: string;
|
|
57
|
-
type: string;
|
|
58
|
-
name: string;
|
|
59
|
-
default?: string | undefined;
|
|
60
|
-
}[];
|
|
61
|
-
usage: string;
|
|
62
|
-
aliases?: string[] | undefined;
|
|
63
|
-
}, {
|
|
64
|
-
description: string;
|
|
65
|
-
category: string;
|
|
66
|
-
name: string;
|
|
67
|
-
package: "lism-css" | "@lism-css/ui";
|
|
68
|
-
props: {
|
|
69
|
-
description: string;
|
|
70
|
-
type: string;
|
|
71
|
-
name: string;
|
|
72
|
-
default?: string | undefined;
|
|
73
|
-
}[];
|
|
74
|
-
usage: string;
|
|
75
|
-
aliases?: string[] | undefined;
|
|
76
|
-
}>;
|
|
77
|
-
export declare const TokenCategorySchema: z.ZodObject<{
|
|
78
|
-
category: z.ZodString;
|
|
79
|
-
description: z.ZodString;
|
|
80
|
-
tokens: z.ZodArray<z.ZodObject<{
|
|
81
|
-
name: z.ZodString;
|
|
82
|
-
value: z.ZodString;
|
|
83
|
-
description: z.ZodOptional<z.ZodString>;
|
|
84
|
-
}, "strip", z.ZodTypeAny, {
|
|
85
|
-
value: string;
|
|
86
|
-
name: string;
|
|
87
|
-
description?: string | undefined;
|
|
88
|
-
}, {
|
|
89
|
-
value: string;
|
|
90
|
-
name: string;
|
|
91
|
-
description?: string | undefined;
|
|
92
|
-
}>, "many">;
|
|
93
|
-
}, "strip", z.ZodTypeAny, {
|
|
94
|
-
description: string;
|
|
95
|
-
category: string;
|
|
96
|
-
tokens: {
|
|
97
|
-
value: string;
|
|
98
|
-
name: string;
|
|
99
|
-
description?: string | undefined;
|
|
100
|
-
}[];
|
|
101
|
-
}, {
|
|
102
|
-
description: string;
|
|
103
|
-
category: string;
|
|
104
|
-
tokens: {
|
|
105
|
-
value: string;
|
|
106
|
-
name: string;
|
|
107
|
-
description?: string | undefined;
|
|
108
|
-
}[];
|
|
109
|
-
}>;
|
|
110
|
-
export declare const PropsSystemDataSchema: z.ZodObject<{
|
|
111
|
-
description: z.ZodString;
|
|
112
|
-
classNaming: z.ZodOptional<z.ZodObject<{
|
|
113
|
-
propClass: z.ZodString;
|
|
114
|
-
propClassWithVariable: z.ZodString;
|
|
115
|
-
responsive: z.ZodString;
|
|
116
|
-
note: z.ZodString;
|
|
117
|
-
examples: z.ZodArray<z.ZodString, "many">;
|
|
118
|
-
}, "strip", z.ZodTypeAny, {
|
|
119
|
-
responsive: string;
|
|
120
|
-
propClass: string;
|
|
121
|
-
propClassWithVariable: string;
|
|
122
|
-
note: string;
|
|
123
|
-
examples: string[];
|
|
124
|
-
}, {
|
|
125
|
-
responsive: string;
|
|
126
|
-
propClass: string;
|
|
127
|
-
propClassWithVariable: string;
|
|
128
|
-
note: string;
|
|
129
|
-
examples: string[];
|
|
130
|
-
}>>;
|
|
131
|
-
categories: z.ZodArray<z.ZodObject<{
|
|
132
|
-
category: z.ZodString;
|
|
133
|
-
description: z.ZodString;
|
|
134
|
-
props: z.ZodArray<z.ZodObject<{
|
|
135
|
-
prop: z.ZodString;
|
|
136
|
-
cssProperty: z.ZodString;
|
|
137
|
-
type: z.ZodString;
|
|
138
|
-
responsive: z.ZodBoolean;
|
|
139
|
-
description: z.ZodString;
|
|
140
|
-
values: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
141
|
-
}, "strip", z.ZodTypeAny, {
|
|
142
|
-
description: string;
|
|
143
|
-
type: string;
|
|
144
|
-
prop: string;
|
|
145
|
-
cssProperty: string;
|
|
146
|
-
responsive: boolean;
|
|
147
|
-
values?: string[] | undefined;
|
|
148
|
-
}, {
|
|
149
|
-
description: string;
|
|
150
|
-
type: string;
|
|
151
|
-
prop: string;
|
|
152
|
-
cssProperty: string;
|
|
153
|
-
responsive: boolean;
|
|
154
|
-
values?: string[] | undefined;
|
|
155
|
-
}>, "many">;
|
|
156
|
-
}, "strip", z.ZodTypeAny, {
|
|
157
|
-
description: string;
|
|
158
|
-
category: string;
|
|
159
|
-
props: {
|
|
160
|
-
description: string;
|
|
161
|
-
type: string;
|
|
162
|
-
prop: string;
|
|
163
|
-
cssProperty: string;
|
|
164
|
-
responsive: boolean;
|
|
165
|
-
values?: string[] | undefined;
|
|
166
|
-
}[];
|
|
167
|
-
}, {
|
|
168
|
-
description: string;
|
|
169
|
-
category: string;
|
|
170
|
-
props: {
|
|
171
|
-
description: string;
|
|
172
|
-
type: string;
|
|
173
|
-
prop: string;
|
|
174
|
-
cssProperty: string;
|
|
175
|
-
responsive: boolean;
|
|
176
|
-
values?: string[] | undefined;
|
|
177
|
-
}[];
|
|
178
|
-
}>, "many">;
|
|
179
|
-
}, "strip", z.ZodTypeAny, {
|
|
180
|
-
description: string;
|
|
181
|
-
categories: {
|
|
182
|
-
description: string;
|
|
183
|
-
category: string;
|
|
184
|
-
props: {
|
|
185
|
-
description: string;
|
|
186
|
-
type: string;
|
|
187
|
-
prop: string;
|
|
188
|
-
cssProperty: string;
|
|
189
|
-
responsive: boolean;
|
|
190
|
-
values?: string[] | undefined;
|
|
191
|
-
}[];
|
|
192
|
-
}[];
|
|
193
|
-
classNaming?: {
|
|
194
|
-
responsive: string;
|
|
195
|
-
propClass: string;
|
|
196
|
-
propClassWithVariable: string;
|
|
197
|
-
note: string;
|
|
198
|
-
examples: string[];
|
|
199
|
-
} | undefined;
|
|
200
|
-
}, {
|
|
201
|
-
description: string;
|
|
202
|
-
categories: {
|
|
203
|
-
description: string;
|
|
204
|
-
category: string;
|
|
205
|
-
props: {
|
|
206
|
-
description: string;
|
|
207
|
-
type: string;
|
|
208
|
-
prop: string;
|
|
209
|
-
cssProperty: string;
|
|
210
|
-
responsive: boolean;
|
|
211
|
-
values?: string[] | undefined;
|
|
212
|
-
}[];
|
|
213
|
-
}[];
|
|
214
|
-
classNaming?: {
|
|
215
|
-
responsive: string;
|
|
216
|
-
propClass: string;
|
|
217
|
-
propClassWithVariable: string;
|
|
218
|
-
note: string;
|
|
219
|
-
examples: string[];
|
|
220
|
-
} | undefined;
|
|
221
|
-
}>;
|
|
222
|
-
export declare const OverviewDataSchema: z.ZodObject<{
|
|
223
|
-
description: z.ZodString;
|
|
224
|
-
architecture: z.ZodString;
|
|
225
|
-
packages: z.ZodArray<z.ZodObject<{
|
|
226
|
-
name: z.ZodString;
|
|
227
|
-
npmName: z.ZodString;
|
|
228
|
-
description: z.ZodString;
|
|
229
|
-
version: z.ZodString;
|
|
230
|
-
}, "strip", z.ZodTypeAny, {
|
|
231
|
-
description: string;
|
|
232
|
-
name: string;
|
|
233
|
-
npmName: string;
|
|
234
|
-
version: string;
|
|
235
|
-
}, {
|
|
236
|
-
description: string;
|
|
237
|
-
name: string;
|
|
238
|
-
npmName: string;
|
|
239
|
-
version: string;
|
|
240
|
-
}>, "many">;
|
|
241
|
-
breakpoints: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
242
|
-
installation: z.ZodString;
|
|
243
|
-
cssLayers: z.ZodString;
|
|
244
|
-
}, "strip", z.ZodTypeAny, {
|
|
245
|
-
description: string;
|
|
246
|
-
architecture: string;
|
|
247
|
-
packages: {
|
|
248
|
-
description: string;
|
|
249
|
-
name: string;
|
|
250
|
-
npmName: string;
|
|
251
|
-
version: string;
|
|
252
|
-
}[];
|
|
253
|
-
breakpoints: Record<string, string>;
|
|
254
|
-
installation: string;
|
|
255
|
-
cssLayers: string;
|
|
256
|
-
}, {
|
|
257
|
-
description: string;
|
|
258
|
-
architecture: string;
|
|
259
|
-
packages: {
|
|
260
|
-
description: string;
|
|
261
|
-
name: string;
|
|
262
|
-
npmName: string;
|
|
263
|
-
version: string;
|
|
264
|
-
}[];
|
|
265
|
-
breakpoints: Record<string, string>;
|
|
266
|
-
installation: string;
|
|
267
|
-
cssLayers: string;
|
|
268
|
-
}>;
|
package/dist/lib/schemas.js
CHANGED
|
@@ -8,67 +8,3 @@ export const DocsEntrySchema = z.object({
|
|
|
8
8
|
keywords: z.array(z.string()),
|
|
9
9
|
snippet: z.string(),
|
|
10
10
|
});
|
|
11
|
-
const ComponentPropSchema = z.object({
|
|
12
|
-
name: z.string(),
|
|
13
|
-
type: z.string(),
|
|
14
|
-
default: z.string().optional(),
|
|
15
|
-
description: z.string(),
|
|
16
|
-
});
|
|
17
|
-
export const ComponentInfoSchema = z.object({
|
|
18
|
-
name: z.string(),
|
|
19
|
-
package: z.enum(['lism-css', '@lism-css/ui']),
|
|
20
|
-
category: z.string(),
|
|
21
|
-
description: z.string(),
|
|
22
|
-
aliases: z.array(z.string()).optional(),
|
|
23
|
-
props: z.array(ComponentPropSchema),
|
|
24
|
-
usage: z.string(),
|
|
25
|
-
});
|
|
26
|
-
const TokenEntrySchema = z.object({
|
|
27
|
-
name: z.string(),
|
|
28
|
-
value: z.string(),
|
|
29
|
-
description: z.string().optional(),
|
|
30
|
-
});
|
|
31
|
-
export const TokenCategorySchema = z.object({
|
|
32
|
-
category: z.string(),
|
|
33
|
-
description: z.string(),
|
|
34
|
-
tokens: z.array(TokenEntrySchema),
|
|
35
|
-
});
|
|
36
|
-
const PropEntrySchema = z.object({
|
|
37
|
-
prop: z.string(),
|
|
38
|
-
cssProperty: z.string(),
|
|
39
|
-
type: z.string(),
|
|
40
|
-
responsive: z.boolean(),
|
|
41
|
-
description: z.string(),
|
|
42
|
-
values: z.array(z.string()).optional(),
|
|
43
|
-
});
|
|
44
|
-
const PropCategorySchema = z.object({
|
|
45
|
-
category: z.string(),
|
|
46
|
-
description: z.string(),
|
|
47
|
-
props: z.array(PropEntrySchema),
|
|
48
|
-
});
|
|
49
|
-
const ClassNamingSchema = z.object({
|
|
50
|
-
propClass: z.string(),
|
|
51
|
-
propClassWithVariable: z.string(),
|
|
52
|
-
responsive: z.string(),
|
|
53
|
-
note: z.string(),
|
|
54
|
-
examples: z.array(z.string()),
|
|
55
|
-
});
|
|
56
|
-
export const PropsSystemDataSchema = z.object({
|
|
57
|
-
description: z.string(),
|
|
58
|
-
classNaming: ClassNamingSchema.optional(),
|
|
59
|
-
categories: z.array(PropCategorySchema),
|
|
60
|
-
});
|
|
61
|
-
const PackageInfoSchema = z.object({
|
|
62
|
-
name: z.string(),
|
|
63
|
-
npmName: z.string(),
|
|
64
|
-
description: z.string(),
|
|
65
|
-
version: z.string(),
|
|
66
|
-
});
|
|
67
|
-
export const OverviewDataSchema = z.object({
|
|
68
|
-
description: z.string(),
|
|
69
|
-
architecture: z.string(),
|
|
70
|
-
packages: z.array(PackageInfoSchema),
|
|
71
|
-
breakpoints: z.record(z.string()),
|
|
72
|
-
installation: z.string(),
|
|
73
|
-
cssLayers: z.string(),
|
|
74
|
-
});
|
package/dist/lib/search.d.ts
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
import type { DocsEntry,
|
|
1
|
+
import type { DocsEntry, SearchResult } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* ComponentInfo に限らず { name, aliases? } を持つ任意の配列から生成できる。
|
|
5
|
-
*/
|
|
6
|
-
export declare function buildAliasMap(items: Array<{
|
|
7
|
-
name: string;
|
|
8
|
-
aliases?: string[];
|
|
9
|
-
}>): Map<string, string[]>;
|
|
10
|
-
/**
|
|
11
|
-
* CSSプロパティ名 → Lism prop名のマップを構築。
|
|
12
|
-
* 検索クエリにCSSプロパティ名が含まれていた場合に、対応するLism prop名で展開するために使用。
|
|
13
|
-
*/
|
|
14
|
-
export declare function buildCssPropertyMap(categories: PropCategory[]): Map<string, string[]>;
|
|
15
|
-
/**
|
|
16
|
-
* Prop Class 記法(例: "-g:5", ".-p:20", "-fz")から prop 名を抽出する。
|
|
3
|
+
* Property Class 記法(例: "-g:5", ".-p:20", "-fz")から prop 名を抽出する。
|
|
17
4
|
* get-props-system.ts からも利用される共通ユーティリティ。
|
|
18
5
|
*/
|
|
19
6
|
export declare function parsePropClassName(input: string): string | null;
|
|
20
7
|
export interface SearchDocsOptions {
|
|
21
8
|
category?: string;
|
|
22
9
|
limit?: number;
|
|
23
|
-
aliasMap?: Map<string, string[]>;
|
|
24
10
|
cssPropertyMap?: Map<string, string[]>;
|
|
25
11
|
}
|
|
26
12
|
export declare function searchDocs(entries: DocsEntry[], query: string, options?: SearchDocsOptions): SearchResult[];
|
package/dist/lib/search.js
CHANGED
|
@@ -4,48 +4,10 @@ function tokenize(text) {
|
|
|
4
4
|
.split(/[\s\-_./]+/)
|
|
5
5
|
.filter((t) => t.length > 0);
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* コンポーネント名 → aliases (lowercase) のマップを構築。
|
|
9
|
-
* ComponentInfo に限らず { name, aliases? } を持つ任意の配列から生成できる。
|
|
10
|
-
*/
|
|
11
|
-
export function buildAliasMap(items) {
|
|
12
|
-
const map = new Map();
|
|
13
|
-
for (const item of items) {
|
|
14
|
-
if (item.aliases && item.aliases.length > 0) {
|
|
15
|
-
map.set(item.name.toLowerCase(), item.aliases.map((a) => a.toLowerCase()));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return map;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* CSSプロパティ名 → Lism prop名のマップを構築。
|
|
22
|
-
* 検索クエリにCSSプロパティ名が含まれていた場合に、対応するLism prop名で展開するために使用。
|
|
23
|
-
*/
|
|
24
|
-
export function buildCssPropertyMap(categories) {
|
|
25
|
-
const map = new Map();
|
|
26
|
-
for (const cat of categories) {
|
|
27
|
-
for (const p of cat.props) {
|
|
28
|
-
// "(class: ...)" はスキップ
|
|
29
|
-
if (p.cssProperty.startsWith('(class:'))
|
|
30
|
-
continue;
|
|
31
|
-
// "--hl (CSS変数)" → "--hl"
|
|
32
|
-
const normalized = p.cssProperty
|
|
33
|
-
.replace(/\s*\(.*\)$/, '')
|
|
34
|
-
.trim()
|
|
35
|
-
.toLowerCase();
|
|
36
|
-
if (!normalized)
|
|
37
|
-
continue;
|
|
38
|
-
const existing = map.get(normalized) ?? [];
|
|
39
|
-
existing.push(p.prop.toLowerCase());
|
|
40
|
-
map.set(normalized, existing);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return map;
|
|
44
|
-
}
|
|
45
7
|
// ".-g:5" or "-g:5" → prop="g", value="5" / "-p" → prop="p"
|
|
46
8
|
const PROP_CLASS_RE = /^\.?-([a-z][a-z0-9-]*)(:.+)?$/i;
|
|
47
9
|
/**
|
|
48
|
-
*
|
|
10
|
+
* Property Class 記法(例: "-g:5", ".-p:20", "-fz")から prop 名を抽出する。
|
|
49
11
|
* get-props-system.ts からも利用される共通ユーティリティ。
|
|
50
12
|
*/
|
|
51
13
|
export function parsePropClassName(input) {
|
|
@@ -53,9 +15,9 @@ export function parsePropClassName(input) {
|
|
|
53
15
|
return m ? m[1].toLowerCase() : null;
|
|
54
16
|
}
|
|
55
17
|
/**
|
|
56
|
-
* 検索クエリをCSSプロパティ名や
|
|
18
|
+
* 検索クエリをCSSプロパティ名やProperty Class記法で展開する。
|
|
57
19
|
* 例: "font-size" → "font-size fz"
|
|
58
|
-
* 例: "-g:5" → "-g:5 g gap
|
|
20
|
+
* 例: "-g:5" → "-g:5 g gap property class"
|
|
59
21
|
*/
|
|
60
22
|
function expandQuery(query, cssPropertyMap) {
|
|
61
23
|
const additions = [];
|
|
@@ -63,7 +25,7 @@ function expandQuery(query, cssPropertyMap) {
|
|
|
63
25
|
const parsedProp = parsePropClassName(queryLower.trim());
|
|
64
26
|
if (cssPropertyMap) {
|
|
65
27
|
for (const [cssProp, lismProps] of cssPropertyMap) {
|
|
66
|
-
//
|
|
28
|
+
// Property Class 記法の逆引き(例: "-g:5" の "g" → "gap")
|
|
67
29
|
if (parsedProp && lismProps.includes(parsedProp)) {
|
|
68
30
|
additions.push(cssProp);
|
|
69
31
|
}
|
|
@@ -74,21 +36,11 @@ function expandQuery(query, cssPropertyMap) {
|
|
|
74
36
|
}
|
|
75
37
|
}
|
|
76
38
|
if (parsedProp) {
|
|
77
|
-
additions.push(parsedProp, '
|
|
39
|
+
additions.push(parsedProp, 'property class');
|
|
78
40
|
}
|
|
79
41
|
return additions.length > 0 ? `${query} ${additions.join(' ')}` : query;
|
|
80
42
|
}
|
|
81
|
-
|
|
82
|
-
function getEntryAliases(entry, aliasMap) {
|
|
83
|
-
const titleLower = entry.title.toLowerCase();
|
|
84
|
-
for (const [name, aliases] of aliasMap) {
|
|
85
|
-
if (titleLower.includes(name)) {
|
|
86
|
-
return aliases;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return [];
|
|
90
|
-
}
|
|
91
|
-
function scoreEntry(entry, queryTokens, aliasMap) {
|
|
43
|
+
function scoreEntry(entry, queryTokens) {
|
|
92
44
|
let score = 0;
|
|
93
45
|
const titleLower = entry.title.toLowerCase();
|
|
94
46
|
const descLower = entry.description.toLowerCase();
|
|
@@ -112,22 +64,11 @@ function scoreEntry(entry, queryTokens, aliasMap) {
|
|
|
112
64
|
if (snippetLower.includes(token))
|
|
113
65
|
score += 1;
|
|
114
66
|
}
|
|
115
|
-
// コンポーネントの aliases によるブースト
|
|
116
|
-
if (aliasMap) {
|
|
117
|
-
const aliases = getEntryAliases(entry, aliasMap);
|
|
118
|
-
if (aliases.length > 0) {
|
|
119
|
-
const aliasesStr = aliases.join(' ');
|
|
120
|
-
for (const token of queryTokens) {
|
|
121
|
-
if (aliasesStr.includes(token))
|
|
122
|
-
score += 5;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
67
|
return score;
|
|
127
68
|
}
|
|
128
69
|
export function searchDocs(entries, query, options) {
|
|
129
|
-
const { category, limit = 10,
|
|
130
|
-
// CSSプロパティ名・
|
|
70
|
+
const { category, limit = 10, cssPropertyMap } = options ?? {};
|
|
71
|
+
// CSSプロパティ名・Property Class記法をLism prop名に展開してからトークナイズ
|
|
131
72
|
const expandedQuery = expandQuery(query, cssPropertyMap);
|
|
132
73
|
const queryTokens = tokenize(expandedQuery);
|
|
133
74
|
if (queryTokens.length === 0)
|
|
@@ -138,7 +79,7 @@ export function searchDocs(entries, query, options) {
|
|
|
138
79
|
}
|
|
139
80
|
const scored = filtered
|
|
140
81
|
.map((entry) => {
|
|
141
|
-
const score = scoreEntry(entry, queryTokens
|
|
82
|
+
const score = scoreEntry(entry, queryTokens);
|
|
142
83
|
return { entry, score };
|
|
143
84
|
})
|
|
144
85
|
.filter(({ score }) => score > 0)
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -19,67 +19,3 @@ export interface DocsEntry {
|
|
|
19
19
|
keywords: string[];
|
|
20
20
|
snippet: string;
|
|
21
21
|
}
|
|
22
|
-
export interface ComponentInfo {
|
|
23
|
-
name: string;
|
|
24
|
-
package: 'lism-css' | '@lism-css/ui';
|
|
25
|
-
category: string;
|
|
26
|
-
description: string;
|
|
27
|
-
aliases?: string[];
|
|
28
|
-
props: ComponentProp[];
|
|
29
|
-
usage: string;
|
|
30
|
-
}
|
|
31
|
-
export interface ComponentProp {
|
|
32
|
-
name: string;
|
|
33
|
-
type: string;
|
|
34
|
-
default?: string;
|
|
35
|
-
description: string;
|
|
36
|
-
}
|
|
37
|
-
export interface TokenCategory {
|
|
38
|
-
category: string;
|
|
39
|
-
description: string;
|
|
40
|
-
tokens: TokenEntry[];
|
|
41
|
-
}
|
|
42
|
-
export interface TokenEntry {
|
|
43
|
-
name: string;
|
|
44
|
-
value: string;
|
|
45
|
-
description?: string;
|
|
46
|
-
}
|
|
47
|
-
export interface PropEntry {
|
|
48
|
-
prop: string;
|
|
49
|
-
cssProperty: string;
|
|
50
|
-
type: string;
|
|
51
|
-
responsive: boolean;
|
|
52
|
-
description: string;
|
|
53
|
-
values?: string[];
|
|
54
|
-
}
|
|
55
|
-
export interface ClassNaming {
|
|
56
|
-
propClass: string;
|
|
57
|
-
propClassWithVariable: string;
|
|
58
|
-
responsive: string;
|
|
59
|
-
note: string;
|
|
60
|
-
examples: string[];
|
|
61
|
-
}
|
|
62
|
-
export interface PropsSystemData {
|
|
63
|
-
description: string;
|
|
64
|
-
classNaming?: ClassNaming;
|
|
65
|
-
categories: PropCategory[];
|
|
66
|
-
}
|
|
67
|
-
export interface PropCategory {
|
|
68
|
-
category: string;
|
|
69
|
-
description: string;
|
|
70
|
-
props: PropEntry[];
|
|
71
|
-
}
|
|
72
|
-
export interface OverviewData {
|
|
73
|
-
description: string;
|
|
74
|
-
architecture: string;
|
|
75
|
-
packages: PackageInfo[];
|
|
76
|
-
breakpoints: Record<string, string>;
|
|
77
|
-
installation: string;
|
|
78
|
-
cssLayers: string;
|
|
79
|
-
}
|
|
80
|
-
export interface PackageInfo {
|
|
81
|
-
name: string;
|
|
82
|
-
npmName: string;
|
|
83
|
-
description: string;
|
|
84
|
-
version: string;
|
|
85
|
-
}
|