@plitzi/sdk-server 0.32.14 → 0.32.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.
- package/CHANGELOG.md +20 -0
- package/dist/adapters/jsonAdapters.js +2 -1
- package/dist/core/createServer.js +10 -2
- package/dist/core/http/stages/middlewares.js +3 -2
- package/dist/core/http/stages/pluginAssets.js +3 -2
- package/dist/core/http/stages/static.js +3 -2
- package/dist/core/requestParser.js +1 -1
- package/dist/core/server/{ssrServer.js → pageServer.js} +15 -6
- package/dist/core/services/registry.js +2 -2
- package/dist/helpers/cache/defaults.js +3 -3
- package/dist/index.js +1 -1
- package/dist/modules/mcp/catalogs/cssCatalog/border.js +30 -0
- package/dist/modules/mcp/catalogs/cssCatalog/box.js +31 -0
- package/dist/modules/mcp/catalogs/cssCatalog/helpers.js +185 -0
- package/dist/modules/mcp/catalogs/cssCatalog/index.js +131 -0
- package/dist/modules/mcp/catalogs/cssCatalog/layout.js +98 -0
- package/dist/modules/mcp/catalogs/cssCatalog/visual.js +144 -0
- package/dist/modules/mcp/catalogs/registry.js +1 -1
- package/dist/modules/mcp/helpers/guide.js +23 -13
- package/dist/modules/mcp/resources/core.js +5 -2
- package/dist/modules/mcp/resources/primer.js +2 -1
- package/dist/modules/mcp/resources/register.js +6 -3
- package/dist/modules/mcp/server.js +1 -1
- package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +3 -2
- package/dist/modules/mcp/tools/operations/style/shared.js +2 -2
- package/dist/modules/mcp/tools/operations/style/write.js +2 -2
- package/dist/modules/mcp/tools/shared/validator/audit.js +1 -4
- package/dist/modules/mcp/tools/shared/validator/css.js +3 -11
- package/dist/modules/mcp/tools/shared/validator/elements.js +4 -1
- package/dist/modules/mcp/tools/shared/validator/index.js +15 -15
- package/dist/modules/mcp/tools/shared/validator/interactions.js +1 -4
- package/dist/modules/oauth/authorize.js +2 -1
- package/dist/modules/oauth/metadata.js +8 -2
- package/dist/modules/oauth/records.js +11 -2
- package/dist/modules/oauth/register.js +15 -8
- package/dist/modules/oauth/respond.js +4 -4
- package/dist/modules/oauth/token.js +2 -2
- package/dist/modules/ssr/registerExternalPlugins.js +1 -1
- package/dist/plugins/manager.js +1 -1
- package/dist/src/core/createServer.d.ts +9 -1
- package/dist/src/core/server/pageServer.d.ts +10 -0
- package/dist/src/core/services/registry.d.ts +1 -1
- package/dist/src/modules/mcp/catalogs/cssCatalog/border.d.ts +4 -0
- package/dist/src/modules/mcp/catalogs/cssCatalog/box.d.ts +4 -0
- package/dist/src/modules/mcp/catalogs/cssCatalog/helpers.d.ts +34 -0
- package/dist/src/modules/mcp/catalogs/{cssCatalog.d.ts → cssCatalog/index.d.ts} +10 -5
- package/dist/src/modules/mcp/catalogs/cssCatalog/layout.d.ts +9 -0
- package/dist/src/modules/mcp/catalogs/cssCatalog/visual.d.ts +8 -0
- package/dist/src/modules/mcp/helpers/guide.d.ts +2 -2
- package/dist/src/modules/mcp/resources/index.d.ts +1 -1
- package/dist/src/modules/mcp/tests/apply.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/bindings.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/css.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/helpers.d.ts +13 -0
- package/dist/src/modules/mcp/tests/interactions.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/pages.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/reads.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/search.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/styles.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/tools.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/validation.test.d.ts +1 -0
- package/dist/src/modules/mcp/tools/screenshot.d.ts +1 -1
- package/dist/src/modules/oauth/metadata.d.ts +7 -1
- package/dist/src/modules/oauth/records.d.ts +6 -0
- package/package.json +9 -9
- package/dist/modules/mcp/catalogs/cssCatalog.js +0 -205
- package/dist/src/core/server/ssrServer.d.ts +0 -2
- /package/dist/src/modules/mcp/{mcp.test.d.ts → catalogs/cssCatalog/cssCatalog.test.d.ts} +0 -0
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import styleConstants from "@plitzi/sdk-shared/style/styleConstants";
|
|
2
|
-
//#region src/modules/mcp/catalogs/cssCatalog.ts
|
|
3
|
-
/** Every kebab-case CSS property Plitzi's style engine understands. Values written to a definition
|
|
4
|
-
* must use these exact keys — camelCase or unknown keys are rejected by the validator. */
|
|
5
|
-
var cssProperties = Array.from(new Set(Object.values(styleConstants))).sort();
|
|
6
|
-
var cssPropertySet = new Set(cssProperties);
|
|
7
|
-
var isCssProperty = (key) => cssPropertySet.has(key);
|
|
8
|
-
var toKebab = (key) => key.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
9
|
-
/** If a camelCase key maps to a known kebab-case property, return it — used to teach the agent the correct key. */
|
|
10
|
-
var suggestCssProperty = (key) => {
|
|
11
|
-
const kebab = toKebab(key);
|
|
12
|
-
return cssPropertySet.has(kebab) ? kebab : void 0;
|
|
13
|
-
};
|
|
14
|
-
var splitTokens = (value) => {
|
|
15
|
-
const tokens = [];
|
|
16
|
-
let depth = 0;
|
|
17
|
-
let current = "";
|
|
18
|
-
for (const ch of value.trim()) {
|
|
19
|
-
if (ch === "(") depth += 1;
|
|
20
|
-
else if (ch === ")") depth = Math.max(0, depth - 1);
|
|
21
|
-
if (/\s/.test(ch) && depth === 0) {
|
|
22
|
-
if (current) {
|
|
23
|
-
tokens.push(current);
|
|
24
|
-
current = "";
|
|
25
|
-
}
|
|
26
|
-
} else current += ch;
|
|
27
|
-
}
|
|
28
|
-
if (current) tokens.push(current);
|
|
29
|
-
return tokens;
|
|
30
|
-
};
|
|
31
|
-
var COMPOUND_SHORTHANDS = {
|
|
32
|
-
flex: [
|
|
33
|
-
"flex-grow",
|
|
34
|
-
"flex-shrink",
|
|
35
|
-
"flex-basis"
|
|
36
|
-
],
|
|
37
|
-
"flex-flow": ["flex-direction", "flex-wrap"],
|
|
38
|
-
background: [
|
|
39
|
-
"background-color",
|
|
40
|
-
"background-image",
|
|
41
|
-
"background-position",
|
|
42
|
-
"background-size",
|
|
43
|
-
"background-repeat"
|
|
44
|
-
],
|
|
45
|
-
font: [
|
|
46
|
-
"font-family",
|
|
47
|
-
"font-size",
|
|
48
|
-
"font-weight",
|
|
49
|
-
"line-height"
|
|
50
|
-
],
|
|
51
|
-
transition: [
|
|
52
|
-
"transition-property",
|
|
53
|
-
"transition-duration",
|
|
54
|
-
"transition-timing-function",
|
|
55
|
-
"transition-delay"
|
|
56
|
-
],
|
|
57
|
-
animation: [
|
|
58
|
-
"animation-name",
|
|
59
|
-
"animation-duration",
|
|
60
|
-
"animation-timing-function",
|
|
61
|
-
"animation-delay",
|
|
62
|
-
"animation-iteration-count"
|
|
63
|
-
],
|
|
64
|
-
grid: [
|
|
65
|
-
"grid-template-columns",
|
|
66
|
-
"grid-template-rows",
|
|
67
|
-
"grid-template-areas"
|
|
68
|
-
],
|
|
69
|
-
"grid-template": [
|
|
70
|
-
"grid-template-columns",
|
|
71
|
-
"grid-template-rows",
|
|
72
|
-
"grid-template-areas"
|
|
73
|
-
],
|
|
74
|
-
"grid-area": [
|
|
75
|
-
"grid-row-start",
|
|
76
|
-
"grid-column-start",
|
|
77
|
-
"grid-row-end",
|
|
78
|
-
"grid-column-end"
|
|
79
|
-
],
|
|
80
|
-
"place-content": ["align-content", "justify-content"],
|
|
81
|
-
"place-items": ["align-items", "justify-items"],
|
|
82
|
-
"place-self": ["align-self", "justify-self"],
|
|
83
|
-
"list-style": [
|
|
84
|
-
"list-style-type",
|
|
85
|
-
"list-style-position",
|
|
86
|
-
"list-style-image"
|
|
87
|
-
],
|
|
88
|
-
"text-decoration": [
|
|
89
|
-
"text-decoration-line",
|
|
90
|
-
"text-decoration-color",
|
|
91
|
-
"text-decoration-style"
|
|
92
|
-
],
|
|
93
|
-
outline: [
|
|
94
|
-
"outline-width",
|
|
95
|
-
"outline-style",
|
|
96
|
-
"outline-color"
|
|
97
|
-
],
|
|
98
|
-
columns: ["column-width", "column-count"],
|
|
99
|
-
overflow: ["overflow-x", "overflow-y"]
|
|
100
|
-
};
|
|
101
|
-
/** The atomic longhands to write instead of a compound shorthand, or undefined when the key is not a compound
|
|
102
|
-
* shorthand. `flex` layout in particular is NOT `display` + `flex-direction` (those are their own properties). */
|
|
103
|
-
var compoundLonghands = (key) => Object.hasOwn(COMPOUND_SHORTHANDS, key) ? COMPOUND_SHORTHANDS[key] : void 0;
|
|
104
|
-
var SIDES = [
|
|
105
|
-
"top",
|
|
106
|
-
"right",
|
|
107
|
-
"bottom",
|
|
108
|
-
"left"
|
|
109
|
-
];
|
|
110
|
-
var box4 = (tokens) => {
|
|
111
|
-
const [a, b = a, c = a, d = b] = tokens;
|
|
112
|
-
return [
|
|
113
|
-
a,
|
|
114
|
-
b,
|
|
115
|
-
c,
|
|
116
|
-
d
|
|
117
|
-
];
|
|
118
|
-
};
|
|
119
|
-
var radius4 = (tokens) => {
|
|
120
|
-
const [a, b = a, c = a, d = b] = tokens;
|
|
121
|
-
return [
|
|
122
|
-
a,
|
|
123
|
-
b,
|
|
124
|
-
c,
|
|
125
|
-
d
|
|
126
|
-
];
|
|
127
|
-
};
|
|
128
|
-
var BORDER_STYLES = /* @__PURE__ */ new Set([
|
|
129
|
-
"none",
|
|
130
|
-
"hidden",
|
|
131
|
-
"dotted",
|
|
132
|
-
"dashed",
|
|
133
|
-
"solid",
|
|
134
|
-
"double",
|
|
135
|
-
"groove",
|
|
136
|
-
"ridge",
|
|
137
|
-
"inset",
|
|
138
|
-
"outset"
|
|
139
|
-
]);
|
|
140
|
-
var BORDER_WIDTH_KEYWORDS = /* @__PURE__ */ new Set([
|
|
141
|
-
"thin",
|
|
142
|
-
"medium",
|
|
143
|
-
"thick"
|
|
144
|
-
]);
|
|
145
|
-
var LENGTH_RE = /^-?[\d.]+([a-z%]*)$/;
|
|
146
|
-
var classifyBorderToken = (token) => {
|
|
147
|
-
if (BORDER_STYLES.has(token)) return "style";
|
|
148
|
-
if (BORDER_WIDTH_KEYWORDS.has(token) || LENGTH_RE.test(token)) return "width";
|
|
149
|
-
return "color";
|
|
150
|
-
};
|
|
151
|
-
var expandBorder = (key, value, out) => {
|
|
152
|
-
const sides = key === "border" ? SIDES : [key.slice(7)];
|
|
153
|
-
for (const token of splitTokens(value)) {
|
|
154
|
-
const kind = classifyBorderToken(token);
|
|
155
|
-
for (const side of sides) out[`border-${side}-${kind}`] = token;
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
var BORDER_SIDE_KEYS = new Set(SIDES.map((s) => `border-${s}`));
|
|
159
|
-
var expandOne = (key, raw, out) => {
|
|
160
|
-
const value = String(raw);
|
|
161
|
-
if (key === "padding" || key === "margin" || key === "inset") {
|
|
162
|
-
const [t, r, b, l] = box4(splitTokens(value));
|
|
163
|
-
const prefix = key === "inset" ? "" : `${key}-`;
|
|
164
|
-
out[`${prefix}top`] = t;
|
|
165
|
-
out[`${prefix}right`] = r;
|
|
166
|
-
out[`${prefix}bottom`] = b;
|
|
167
|
-
out[`${prefix}left`] = l;
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
if (key === "border-radius" && !value.includes("/")) {
|
|
171
|
-
const [tl, tr, br, bl] = radius4(splitTokens(value));
|
|
172
|
-
const corners = [
|
|
173
|
-
["top-left", tl],
|
|
174
|
-
["top-right", tr],
|
|
175
|
-
["bottom-right", br],
|
|
176
|
-
["bottom-left", bl]
|
|
177
|
-
];
|
|
178
|
-
for (const [corner, v] of corners) out[`border-${corner}-radius`] = v;
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
if (key === "gap") {
|
|
182
|
-
const [row, col = row] = splitTokens(value);
|
|
183
|
-
out["row-gap"] = row;
|
|
184
|
-
out["column-gap"] = col;
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
|
-
if (key === "border" || BORDER_SIDE_KEYS.has(key)) {
|
|
188
|
-
expandBorder(key, value, out);
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
return false;
|
|
192
|
-
};
|
|
193
|
-
/** Expand supported CSS shorthands to their longhand keys. Explicit longhands in the same map win over any
|
|
194
|
-
* expansion (so `{ padding: 8, padding-left: 0 }` keeps padding-left: 0). Unrecognized keys pass through. */
|
|
195
|
-
var expandShorthand = (css) => {
|
|
196
|
-
const expanded = {};
|
|
197
|
-
const direct = {};
|
|
198
|
-
for (const [key, value] of Object.entries(css)) if (!expandOne(key, value, expanded)) direct[key] = value;
|
|
199
|
-
return {
|
|
200
|
-
...expanded,
|
|
201
|
-
...direct
|
|
202
|
-
};
|
|
203
|
-
};
|
|
204
|
-
//#endregion
|
|
205
|
-
export { COMPOUND_SHORTHANDS, compoundLonghands, cssProperties, expandShorthand, isCssProperty, suggestCssProperty };
|
|
File without changes
|