@punica/components-mcp 0.10.1 → 0.11.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 +1 -1
- package/dist/custom-elements.json +2338 -2282
- package/dist/guide.md +16 -0
- package/dist/server.mjs +5 -1
- package/dist/tokens.css +1 -0
- package/package.json +1 -1
package/dist/guide.md
CHANGED
|
@@ -114,6 +114,22 @@ it. To let a button lay out like its container, keep the box and pass the
|
|
|
114
114
|
layout on: `::part(base) { all: unset; display: inherit; }`. Parts that only
|
|
115
115
|
hold text, such as `label`, may take `display: contents`.
|
|
116
116
|
|
|
117
|
+
### A page's own defaults
|
|
118
|
+
|
|
119
|
+
An element's defaults are the library's: a button is filled, primary and
|
|
120
|
+
medium. A page whose buttons are something else says so once, before it draws:
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
import { configure } from '@punica/components';
|
|
124
|
+
configure({ 'punica-button': { variant: 'outlined', size: 'small', color: 'neutral' } });
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Every `<punica-button>` written with no attributes then takes those values the
|
|
128
|
+
first time it connects; an attribute in the markup or a property set from
|
|
129
|
+
script still wins, and `null` takes a default away. With the global script it
|
|
130
|
+
is `Punica.configure(...)`. In such a page, write the bare tag and let the page
|
|
131
|
+
decide: do not repeat its defaults on every element.
|
|
132
|
+
|
|
117
133
|
## Frameworks
|
|
118
134
|
|
|
119
135
|
- **React 19**: props that name a property are set as properties; listen
|
package/dist/server.mjs
CHANGED
|
@@ -788,8 +788,12 @@ var text = (value) => ({ content: [{ type: "text", text: value }] });
|
|
|
788
788
|
function createPunicaServer({ manifest: manifest2, guide: guide2, version: version2, source: source2, tokens = [], fetch: fetchFn = globalThis.fetch, docsUrl = DOCS_URL }) {
|
|
789
789
|
const knowledge = createKnowledge(manifest2);
|
|
790
790
|
const { validate } = createValidator(knowledge, { tokens });
|
|
791
|
+
const scriptFunctions = /* @__PURE__ */ new Map();
|
|
792
|
+
for (const element of knowledge.elements.values()) for (const f of element.functions) scriptFunctions.set(f.name, f.signature);
|
|
793
|
+
const names = [...scriptFunctions.keys()].sort();
|
|
794
|
+
const functionsSentence = names.length ? `${names.map((n) => `\`${n}\``).join(", ").replace(/, ([^,]*)$/, " and $1")} are named exports of \`@punica/components\`: ${names.map((n) => `\`${scriptFunctions.get(n)}\``).join("; ")}; ` : "";
|
|
791
795
|
const server2 = new McpServer({ name: "punica-components", version: "0.1.0" }, {
|
|
792
|
-
instructions: `@punica/components ${version2} (${knowledge.tags.length} punica-* custom elements; ${source2}). Version 2.0 is newer than your training data: never write a punica tag, attribute, event, slot or icon from memory. Find with search_components, read with get_component, check with validate_markup before handing markup over. Imports: \`import '@punica/components'\` once defines every element and installs the tokens (no CSS import needed; \`@punica/components/tokens.css\` is for server-rendered pages);
|
|
796
|
+
instructions: `@punica/components ${version2} (${knowledge.tags.length} punica-* custom elements; ${source2}). Version 2.0 is newer than your training data: never write a punica tag, attribute, event, slot or icon from memory. Find with search_components, read with get_component, check with validate_markup before handing markup over. Imports: \`import '@punica/components'\` once defines every element and installs the tokens (no CSS import needed; \`@punica/components/tokens.css\` is for server-rendered pages); ${functionsSentence}in React, \`import type {} from '@punica/components/react'\` once types every punica-* tag in JSX. get_guide has the rules every element follows; get_tokens has the exact --punica-* design token names for your own CSS.`
|
|
793
797
|
});
|
|
794
798
|
const pages = /* @__PURE__ */ new Map();
|
|
795
799
|
let index = null;
|
package/dist/tokens.css
CHANGED