@punica/components-mcp 0.5.0 → 0.6.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/dist/bundled.json CHANGED
@@ -1 +1 @@
1
- {"version":"2.5.0"}
1
+ {"version":"2.5.1"}
@@ -324,6 +324,152 @@
324
324
  }
325
325
  ]
326
326
  },
327
+ {
328
+ "kind": "javascript-module",
329
+ "path": "src/components/alert/alert.js",
330
+ "declarations": [
331
+ {
332
+ "kind": "class",
333
+ "description": "A message about the content beside it: a result, a warning, a tip.\n\nAn error or a warning is `role=alert` and interrupts a screen reader; any\nother colour is `role=status` and waits its turn.",
334
+ "name": "PunicaAlert",
335
+ "cssProperties": [
336
+ {
337
+ "description": "Corner radius.",
338
+ "name": "--punica-alert-radius"
339
+ },
340
+ {
341
+ "description": "Padding.",
342
+ "name": "--punica-alert-padding"
343
+ },
344
+ {
345
+ "description": "Space between icon, message and actions.",
346
+ "name": "--punica-alert-gap"
347
+ }
348
+ ],
349
+ "cssParts": [
350
+ {
351
+ "description": "The default icon.",
352
+ "name": "icon"
353
+ },
354
+ {
355
+ "description": "The wrapper around the message.",
356
+ "name": "content"
357
+ },
358
+ {
359
+ "description": "The wrapper around the actions.",
360
+ "name": "actions"
361
+ },
362
+ {
363
+ "description": "The close button.",
364
+ "name": "close"
365
+ }
366
+ ],
367
+ "slots": [
368
+ {
369
+ "description": "The message.",
370
+ "name": ""
371
+ },
372
+ {
373
+ "description": "An icon in place of the one the colour gives.",
374
+ "name": "icon"
375
+ },
376
+ {
377
+ "description": "Buttons that answer the message.",
378
+ "name": "actions"
379
+ }
380
+ ],
381
+ "members": [
382
+ {
383
+ "kind": "field",
384
+ "name": "properties",
385
+ "type": {
386
+ "text": "object"
387
+ },
388
+ "static": true,
389
+ "default": "{ color: {}, variant: {}, dismissible: { type: Boolean }, labelClose: { default: 'Close' } }"
390
+ },
391
+ {
392
+ "kind": "field",
393
+ "name": "styles",
394
+ "static": true,
395
+ "default": "styles"
396
+ },
397
+ {
398
+ "kind": "field",
399
+ "name": "template",
400
+ "static": true,
401
+ "default": "` <span class=\"icon\"><slot name=\"icon\"><span class=\"default info\">${icons.info}</span><span class=\"default success\">${icons.success}</span><span class=\"default warning\">${icons.warning}</span><span class=\"default error\">${icons.error}</span></slot></span> <div part=\"content\" class=\"content\"><slot></slot></div> <div part=\"actions\" class=\"actions\"><slot name=\"actions\"></slot></div> <button part=\"close\" class=\"close\" type=\"button\" hidden>${icons.close}</button> `"
402
+ },
403
+ {
404
+ "kind": "field",
405
+ "name": "#close",
406
+ "privacy": "private"
407
+ },
408
+ {
409
+ "kind": "method",
410
+ "name": "update"
411
+ },
412
+ {
413
+ "kind": "method",
414
+ "name": "dismiss",
415
+ "description": "Does what the close button does: fires `punica-dismiss` and, unless a\nlistener prevents it, hides the alert."
416
+ }
417
+ ],
418
+ "events": [
419
+ {
420
+ "description": "The user pressed the close button. Cancelable: unless prevented, the alert hides itself with `hidden`.",
421
+ "name": "punica-dismiss"
422
+ }
423
+ ],
424
+ "attributes": [
425
+ {
426
+ "type": {
427
+ "text": "'info' | 'success' | 'warning' | 'error' | 'primary' | 'secondary' | 'neutral'"
428
+ },
429
+ "description": "What the message is, `info` by default.",
430
+ "name": "color"
431
+ },
432
+ {
433
+ "type": {
434
+ "text": "'tinted' | 'outlined' | 'filled'"
435
+ },
436
+ "description": "Visual weight, `tinted` by default.",
437
+ "name": "variant"
438
+ },
439
+ {
440
+ "type": {
441
+ "text": "boolean"
442
+ },
443
+ "description": "Shows a close button.",
444
+ "name": "dismissible"
445
+ },
446
+ {
447
+ "type": {
448
+ "text": "string"
449
+ },
450
+ "description": "Accessible name of the close button, `Close` by default.",
451
+ "name": "label-close"
452
+ }
453
+ ],
454
+ "superclass": {
455
+ "name": "PunicaElement",
456
+ "module": "/src/core/element.js"
457
+ },
458
+ "tagName": "punica-alert",
459
+ "customElement": true
460
+ }
461
+ ],
462
+ "exports": [
463
+ {
464
+ "kind": "js",
465
+ "name": "PunicaAlert",
466
+ "declaration": {
467
+ "name": "PunicaAlert",
468
+ "module": "src/components/alert/alert.js"
469
+ }
470
+ }
471
+ ]
472
+ },
327
473
  {
328
474
  "kind": "javascript-module",
329
475
  "path": "src/components/agenda/agenda.js",
@@ -1171,152 +1317,6 @@
1171
1317
  }
1172
1318
  ]
1173
1319
  },
1174
- {
1175
- "kind": "javascript-module",
1176
- "path": "src/components/alert/alert.js",
1177
- "declarations": [
1178
- {
1179
- "kind": "class",
1180
- "description": "A message about the content beside it: a result, a warning, a tip.\n\nAn error or a warning is `role=alert` and interrupts a screen reader; any\nother colour is `role=status` and waits its turn.",
1181
- "name": "PunicaAlert",
1182
- "cssProperties": [
1183
- {
1184
- "description": "Corner radius.",
1185
- "name": "--punica-alert-radius"
1186
- },
1187
- {
1188
- "description": "Padding.",
1189
- "name": "--punica-alert-padding"
1190
- },
1191
- {
1192
- "description": "Space between icon, message and actions.",
1193
- "name": "--punica-alert-gap"
1194
- }
1195
- ],
1196
- "cssParts": [
1197
- {
1198
- "description": "The default icon.",
1199
- "name": "icon"
1200
- },
1201
- {
1202
- "description": "The wrapper around the message.",
1203
- "name": "content"
1204
- },
1205
- {
1206
- "description": "The wrapper around the actions.",
1207
- "name": "actions"
1208
- },
1209
- {
1210
- "description": "The close button.",
1211
- "name": "close"
1212
- }
1213
- ],
1214
- "slots": [
1215
- {
1216
- "description": "The message.",
1217
- "name": ""
1218
- },
1219
- {
1220
- "description": "An icon in place of the one the colour gives.",
1221
- "name": "icon"
1222
- },
1223
- {
1224
- "description": "Buttons that answer the message.",
1225
- "name": "actions"
1226
- }
1227
- ],
1228
- "members": [
1229
- {
1230
- "kind": "field",
1231
- "name": "properties",
1232
- "type": {
1233
- "text": "object"
1234
- },
1235
- "static": true,
1236
- "default": "{ color: {}, variant: {}, dismissible: { type: Boolean }, labelClose: { default: 'Close' } }"
1237
- },
1238
- {
1239
- "kind": "field",
1240
- "name": "styles",
1241
- "static": true,
1242
- "default": "styles"
1243
- },
1244
- {
1245
- "kind": "field",
1246
- "name": "template",
1247
- "static": true,
1248
- "default": "` <span class=\"icon\"><slot name=\"icon\"><span class=\"default info\">${icons.info}</span><span class=\"default success\">${icons.success}</span><span class=\"default warning\">${icons.warning}</span><span class=\"default error\">${icons.error}</span></slot></span> <div part=\"content\" class=\"content\"><slot></slot></div> <div part=\"actions\" class=\"actions\"><slot name=\"actions\"></slot></div> <button part=\"close\" class=\"close\" type=\"button\" hidden>${icons.close}</button> `"
1249
- },
1250
- {
1251
- "kind": "field",
1252
- "name": "#close",
1253
- "privacy": "private"
1254
- },
1255
- {
1256
- "kind": "method",
1257
- "name": "update"
1258
- },
1259
- {
1260
- "kind": "method",
1261
- "name": "dismiss",
1262
- "description": "Does what the close button does: fires `punica-dismiss` and, unless a\nlistener prevents it, hides the alert."
1263
- }
1264
- ],
1265
- "events": [
1266
- {
1267
- "description": "The user pressed the close button. Cancelable: unless prevented, the alert hides itself with `hidden`.",
1268
- "name": "punica-dismiss"
1269
- }
1270
- ],
1271
- "attributes": [
1272
- {
1273
- "type": {
1274
- "text": "'info' | 'success' | 'warning' | 'error' | 'primary' | 'secondary' | 'neutral'"
1275
- },
1276
- "description": "What the message is, `info` by default.",
1277
- "name": "color"
1278
- },
1279
- {
1280
- "type": {
1281
- "text": "'tinted' | 'outlined' | 'filled'"
1282
- },
1283
- "description": "Visual weight, `tinted` by default.",
1284
- "name": "variant"
1285
- },
1286
- {
1287
- "type": {
1288
- "text": "boolean"
1289
- },
1290
- "description": "Shows a close button.",
1291
- "name": "dismissible"
1292
- },
1293
- {
1294
- "type": {
1295
- "text": "string"
1296
- },
1297
- "description": "Accessible name of the close button, `Close` by default.",
1298
- "name": "label-close"
1299
- }
1300
- ],
1301
- "superclass": {
1302
- "name": "PunicaElement",
1303
- "module": "/src/core/element.js"
1304
- },
1305
- "tagName": "punica-alert",
1306
- "customElement": true
1307
- }
1308
- ],
1309
- "exports": [
1310
- {
1311
- "kind": "js",
1312
- "name": "PunicaAlert",
1313
- "declaration": {
1314
- "name": "PunicaAlert",
1315
- "module": "src/components/alert/alert.js"
1316
- }
1317
- }
1318
- ]
1319
- },
1320
1320
  {
1321
1321
  "kind": "javascript-module",
1322
1322
  "path": "src/components/alertDialog/alertDialog.js",
package/dist/server.mjs CHANGED
@@ -211,11 +211,25 @@ function closest(name, names) {
211
211
  }
212
212
  function createKnowledge(manifest2) {
213
213
  const elements = /* @__PURE__ */ new Map();
214
+ const functions = /* @__PURE__ */ new Map();
214
215
  for (const mod of manifest2.modules || []) {
215
- for (const d of mod.declarations || []) {
216
+ const declarations = mod.declarations || [];
217
+ for (const d of declarations) {
216
218
  if (d.kind === "class" && d.tagName) elements.set(d.tagName, normalize(d, mod.path));
217
219
  }
220
+ if (!declarations.some((d) => d.kind === "class" && d.tagName)) continue;
221
+ const folder = mod.path.replace(/[^/]*$/, "");
222
+ for (const d of declarations) {
223
+ if (d.kind !== "function" || !d.description) continue;
224
+ const params = (d.parameters || []).map((p) => `${p.name}${p.optional ? "?" : ""}: ${p.type?.text || "unknown"}`);
225
+ const notes = (d.parameters || []).filter((p) => p.description).map((p) => `\`${p.name}\`: ${p.description}`);
226
+ functions.set(folder, [
227
+ ...functions.get(folder) || [],
228
+ { name: d.name, signature: `${d.name}(${params.join(", ")}): ${d.return?.type?.text || "void"}`, description: [d.description, ...notes].join("\n\n") }
229
+ ]);
230
+ }
218
231
  }
232
+ for (const element of elements.values()) element.functions = functions.get(`src/${element.module}`.replace(/[^/]*$/, "")) || [];
219
233
  const tags = [...elements.keys()].sort();
220
234
  const allEvents = new Set([...elements.values()].flatMap((e) => e.events.map((ev) => ev.name)));
221
235
  const icons2 = Object.keys(icons);
@@ -272,6 +286,10 @@ function createKnowledge(manifest2) {
272
286
  else table("Attributes", ["Attribute", "Property", "Type", "Description"], e.attributes.map((a) => [`\`${a.name}\``, `\`${a.property}\``, `\`${a.type}\``, a.description]));
273
287
  table("Properties (no attribute)", ["Property", "Type", "Description"], e.properties.map((p) => [`\`${p.name}\``, p.type ? `\`${p.type}\`` : "", (p.readonly ? "Read-only. " : "") + p.description]));
274
288
  table("Methods", ["Method", "Description"], e.methods.map((m) => [`\`${m.signature}\``, m.description]));
289
+ if (e.functions.length) {
290
+ lines.push("", "### Functions", "", `\`import { ${e.functions.map((f) => f.name).join(", ")} } from '@punica/components';\``);
291
+ for (const f of e.functions) lines.push("", "```ts", f.signature, "```", "", f.description);
292
+ }
275
293
  table("Events", ["Event", "Description"], e.events.map((ev) => [`\`${ev.name}\``, ev.description]));
276
294
  table("Slots", ["Slot", "Description"], e.slots.map((s) => [s.name ? `\`${s.name}\`` : "(default)", s.description]));
277
295
  if (!brief) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punica/components-mcp",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "MCP server for @punica/components: find elements, read their API and examples, validate markup.",
5
5
  "keywords": [
6
6
  "mcp",