@punica/components-mcp 0.6.0 → 0.7.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.1"}
1
+ {"version":"2.5.2"}
@@ -324,152 +324,6 @@
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
- },
473
327
  {
474
328
  "kind": "javascript-module",
475
329
  "path": "src/components/agenda/agenda.js",
@@ -1317,6 +1171,152 @@
1317
1171
  }
1318
1172
  ]
1319
1173
  },
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
@@ -251,7 +251,7 @@ function createKnowledge(manifest2) {
251
251
  for (const element of elements.values()) {
252
252
  const tagWords = element.tag.replace(/^punica-/, "").split("-");
253
253
  const text2 = element.description.toLowerCase();
254
- const api = [...element.attributes.map((a) => a.name), ...element.events.map((e) => e.name), ...element.slots.map((s) => s.name)].join(" ");
254
+ const api = [...element.attributes.map((a) => a.name), ...element.events.map((e) => e.name), ...element.slots.map((s) => s.name), ...element.functions.map((f) => f.name.toLowerCase())].join(" ");
255
255
  let score = 0;
256
256
  for (const { word, weight } of words) {
257
257
  let s = 0;
@@ -265,7 +265,7 @@ function createKnowledge(manifest2) {
265
265
  const typed = new Set(words.filter((w) => w.weight === 1).map((w) => w.word.replace(/s$/, "")));
266
266
  if (tagWords.every((t) => typed.has(t.replace(/s$/, "")))) score += 5 * tagWords.length;
267
267
  const part = /^(?:the |one |a |an )?[^.]*?\b(?:of|in|for|inside) (?:a|an|the) `punica-/i.test(firstSentence(element.description)) ? 4 : 0;
268
- scored.push({ tag: element.tag, description: firstSentence(element.description), score: score - part - tagWords.length * 0.1 });
268
+ scored.push({ tag: element.tag, description: firstSentence(element.description), functions: element.functions.map((f) => f.name), score: score - part - tagWords.length * 0.1 });
269
269
  }
270
270
  return scored.sort((a, b) => b.score - a.score).slice(0, limit);
271
271
  }
@@ -730,7 +730,8 @@ function createPunicaServer({ manifest: manifest2, guide: guide2, version: versi
730
730
  async ({ query, limit }) => {
731
731
  const results = knowledge.search(query, limit || 10);
732
732
  if (!results.length) return text(`Nothing matches "${query}". Elements: ${knowledge.tags.join(", ")}`);
733
- return text(results.map((r) => `${r.tag}: ${r.description}`).join("\n"));
733
+ const also = (r) => r.functions?.length ? ` Script: ${r.functions.map((name) => `\`${name}()\``).join(", ")} from '@punica/components'.` : "";
734
+ return text(results.map((r) => `${r.tag}: ${r.description}${also(r)}`).join("\n"));
734
735
  }
735
736
  );
736
737
  server2.registerTool(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punica/components-mcp",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "MCP server for @punica/components: find elements, read their API and examples, validate markup.",
5
5
  "keywords": [
6
6
  "mcp",