@plitzi/sdk-mcp 0.33.1 → 0.34.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.
Files changed (187) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.js +3 -2
  4. package/dist/modules/mcp/catalogs/index.d.ts +2 -7
  5. package/dist/modules/mcp/catalogs/index.js +4 -0
  6. package/dist/modules/mcp/catalogs/observed.d.ts +1 -1
  7. package/dist/modules/mcp/catalogs/observed.js +2 -5
  8. package/dist/modules/mcp/catalogs/pluginCatalog.d.ts +17 -0
  9. package/dist/modules/mcp/catalogs/pluginCatalog.js +91 -0
  10. package/dist/modules/mcp/catalogs/registry.js +2 -3
  11. package/dist/modules/mcp/helpers/agentPrompt.js +9 -9
  12. package/dist/modules/mcp/helpers/guide.d.ts +2 -2
  13. package/dist/modules/mcp/helpers/guide.js +117 -50
  14. package/dist/modules/mcp/helpers/interactions.d.ts +5 -1
  15. package/dist/modules/mcp/helpers/interactions.js +15 -6
  16. package/dist/modules/mcp/helpers/space.d.ts +45 -28
  17. package/dist/modules/mcp/helpers/space.js +87 -87
  18. package/dist/modules/mcp/helpers/uris.d.ts +9 -0
  19. package/dist/modules/mcp/helpers/uris.js +10 -1
  20. package/dist/modules/mcp/index.d.ts +2 -0
  21. package/dist/modules/mcp/localScreenshotClient.d.ts +51 -0
  22. package/dist/modules/mcp/localScreenshotClient.js +106 -0
  23. package/dist/modules/mcp/proxy/rewrite.js +15 -1
  24. package/dist/modules/mcp/resources/actions.d.ts +25 -0
  25. package/dist/modules/mcp/resources/actions.js +54 -0
  26. package/dist/modules/mcp/resources/canonical.d.ts +1 -1
  27. package/dist/modules/mcp/resources/canonical.js +1 -1
  28. package/dist/modules/mcp/resources/connectors.d.ts +1 -1
  29. package/dist/modules/mcp/resources/core.js +1 -1
  30. package/dist/modules/mcp/resources/index.d.ts +1 -0
  31. package/dist/modules/mcp/resources/primer.d.ts +8 -1
  32. package/dist/modules/mcp/resources/primer.js +139 -15
  33. package/dist/modules/mcp/resources/register.js +24 -4
  34. package/dist/modules/mcp/resources/renderGuide.js +66 -14
  35. package/dist/modules/mcp/resources/router.js +3 -1
  36. package/dist/modules/mcp/resources/schema.js +6 -5
  37. package/dist/modules/mcp/resources/style.d.ts +2 -1
  38. package/dist/modules/mcp/resources/style.js +10 -3
  39. package/dist/modules/mcp/screenshotClient.js +3 -2
  40. package/dist/modules/mcp/server.js +12 -6
  41. package/dist/modules/mcp/tests/agentRoundtrip.test.d.ts +1 -0
  42. package/dist/modules/mcp/tests/layouts.test.d.ts +1 -0
  43. package/dist/modules/mcp/tools/apply/dispatch.js +30 -1
  44. package/dist/modules/mcp/tools/apply/index.d.ts +149 -15
  45. package/dist/modules/mcp/tools/apply/index.js +12 -2
  46. package/dist/modules/mcp/tools/operations/actions/actions.test.d.ts +1 -0
  47. package/dist/modules/mcp/tools/operations/actions/deleteAction.d.ts +9 -0
  48. package/dist/modules/mcp/tools/operations/actions/deleteAction.js +20 -0
  49. package/dist/modules/mcp/tools/operations/actions/document.d.ts +69 -0
  50. package/dist/modules/mcp/tools/operations/actions/document.js +73 -0
  51. package/dist/modules/mcp/tools/operations/actions/index.d.ts +90 -0
  52. package/dist/modules/mcp/tools/operations/actions/index.js +12 -0
  53. package/dist/modules/mcp/tools/operations/actions/patchAction.d.ts +45 -0
  54. package/dist/modules/mcp/tools/operations/actions/patchAction.js +71 -0
  55. package/dist/modules/mcp/tools/operations/actions/upsertAction.d.ts +47 -0
  56. package/dist/modules/mcp/tools/operations/actions/upsertAction.js +83 -0
  57. package/dist/modules/mcp/tools/operations/connectors/index.d.ts +10 -10
  58. package/dist/modules/mcp/tools/operations/connectors/manifest.d.ts +5 -5
  59. package/dist/modules/mcp/tools/operations/connectors/patchConnector.d.ts +5 -5
  60. package/dist/modules/mcp/tools/operations/connectors/upsertConnector.d.ts +5 -5
  61. package/dist/modules/mcp/tools/operations/index.d.ts +415 -40
  62. package/dist/modules/mcp/tools/operations/index.js +11 -2
  63. package/dist/modules/mcp/tools/operations/schema/bindings/deleteBinding.js +2 -2
  64. package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.d.ts +1 -1
  65. package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.js +2 -2
  66. package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.d.ts +1 -1
  67. package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.js +4 -4
  68. package/dist/modules/mcp/tools/operations/schema/elements/deleteElement.js +5 -5
  69. package/dist/modules/mcp/tools/operations/schema/elements/moveElement.js +6 -6
  70. package/dist/modules/mcp/tools/operations/schema/elements/patchElement.d.ts +1 -1
  71. package/dist/modules/mcp/tools/operations/schema/elements/patchElement.js +11 -12
  72. package/dist/modules/mcp/tools/operations/schema/elements/repeatElement.js +1 -1
  73. package/dist/modules/mcp/tools/operations/schema/elements/upsertElement.js +4 -4
  74. package/dist/modules/mcp/tools/operations/schema/index.d.ts +2 -0
  75. package/dist/modules/mcp/tools/operations/schema/interactions/deleteInteraction.js +2 -2
  76. package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.d.ts +1 -1
  77. package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.js +2 -2
  78. package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.d.ts +1 -1
  79. package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +4 -4
  80. package/dist/modules/mcp/tools/operations/schema/operations.d.ts +28 -5
  81. package/dist/modules/mcp/tools/operations/schema/operations.js +4 -0
  82. package/dist/modules/mcp/tools/operations/schema/pages/deleteLayout.d.ts +9 -0
  83. package/dist/modules/mcp/tools/operations/schema/pages/deleteLayout.js +33 -0
  84. package/dist/modules/mcp/tools/operations/schema/pages/deletePage.js +1 -1
  85. package/dist/modules/mcp/tools/operations/schema/pages/upsertLayout.d.ts +22 -0
  86. package/dist/modules/mcp/tools/operations/schema/pages/upsertLayout.js +61 -0
  87. package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.d.ts +2 -0
  88. package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.js +53 -18
  89. package/dist/modules/mcp/tools/operations/schema/shared.d.ts +5 -1
  90. package/dist/modules/mcp/tools/operations/schema/shared.js +2 -2
  91. package/dist/modules/mcp/tools/operations/schema/translator.d.ts +2 -1
  92. package/dist/modules/mcp/tools/operations/schema/translator.js +21 -9
  93. package/dist/modules/mcp/tools/operations/schema/write.d.ts +9 -22
  94. package/dist/modules/mcp/tools/operations/schema/write.js +23 -43
  95. package/dist/modules/mcp/tools/operations/schemaIds.js +7 -1
  96. package/dist/modules/mcp/tools/operations/style/fonts/deleteFont.d.ts +9 -0
  97. package/dist/modules/mcp/tools/operations/style/fonts/deleteFont.js +21 -0
  98. package/dist/modules/mcp/tools/operations/style/fonts/fonts.test.d.ts +1 -0
  99. package/dist/modules/mcp/tools/operations/style/fonts/upsertFont.d.ts +35 -0
  100. package/dist/modules/mcp/tools/operations/style/fonts/upsertFont.js +66 -0
  101. package/dist/modules/mcp/tools/operations/style/index.d.ts +2 -0
  102. package/dist/modules/mcp/tools/operations/style/operations.d.ts +34 -0
  103. package/dist/modules/mcp/tools/operations/style/operations.js +5 -1
  104. package/dist/modules/mcp/tools/operations/style/translator.d.ts +13 -1
  105. package/dist/modules/mcp/tools/operations/style/translator.js +18 -1
  106. package/dist/modules/mcp/tools/operations/style/write.js +1 -1
  107. package/dist/modules/mcp/tools/preview.d.ts +58 -5
  108. package/dist/modules/mcp/tools/preview.js +1 -1
  109. package/dist/modules/mcp/tools/render.d.ts +61 -5
  110. package/dist/modules/mcp/tools/render.js +10 -3
  111. package/dist/modules/mcp/tools/screenshot.d.ts +151 -16
  112. package/dist/modules/mcp/tools/screenshot.js +22 -13
  113. package/dist/modules/mcp/tools/search.js +3 -3
  114. package/dist/modules/mcp/tools/shared/interactionReport.d.ts +7 -0
  115. package/dist/modules/mcp/tools/shared/interactionReport.js +48 -0
  116. package/dist/modules/mcp/tools/shared/validator/audit.js +4 -4
  117. package/dist/modules/mcp/tools/shared/validator/batch.d.ts +1 -0
  118. package/dist/modules/mcp/tools/shared/validator/batch.js +11 -2
  119. package/dist/modules/mcp/tools/shared/validator/bindings.js +6 -6
  120. package/dist/modules/mcp/tools/shared/validator/connectors.js +1 -1
  121. package/dist/modules/mcp/tools/shared/validator/context.d.ts +3 -0
  122. package/dist/modules/mcp/tools/shared/validator/css.js +1 -1
  123. package/dist/modules/mcp/tools/shared/validator/index.js +29 -9
  124. package/dist/modules/mcp/tools/shared/validator/interactions.js +41 -7
  125. package/dist/modules/mcp/tools/shared/validator/refs.js +4 -4
  126. package/dist/modules/mcp/tools/validate.d.ts +149 -15
  127. package/dist/modules/mcp/types/aiSchema.d.ts +33 -4
  128. package/dist/modules/mcp/types/previewTypes.d.ts +19 -0
  129. package/dist/modules/mcp/types/screenshotTypes.d.ts +1 -0
  130. package/dist/modules/mcp/types/toolTypes.d.ts +6 -1
  131. package/dist/pipeline.js +1 -1
  132. package/dist/preview/createPreview.d.ts +4 -2
  133. package/dist/preview/createPreview.js +16 -6
  134. package/dist/server.d.ts +3 -0
  135. package/dist/server.js +3 -1
  136. package/dist/stages/preview.js +20 -1
  137. package/dist/tests/httpRequest.d.ts +2 -0
  138. package/package.json +20 -16
  139. package/skills/plitzi-render/SKILL.md +84 -11
  140. package/dist/modules/mcp/catalogs/builtinCallbacks.d.ts +0 -19
  141. package/dist/modules/mcp/catalogs/builtinCallbacks.js +0 -139
  142. package/dist/modules/mcp/catalogs/builtinComponents.d.ts +0 -4
  143. package/dist/modules/mcp/catalogs/builtinComponents.js +0 -165
  144. package/dist/modules/mcp/catalogs/builtinElementCallbacks.d.ts +0 -17
  145. package/dist/modules/mcp/catalogs/builtinElementCallbacks.js +0 -50
  146. package/dist/modules/mcp/catalogs/builtinTransformers.d.ts +0 -28
  147. package/dist/modules/mcp/catalogs/builtinTransformers.js +0 -148
  148. package/dist/modules/mcp/catalogs/builtinUtilities.d.ts +0 -15
  149. package/dist/modules/mcp/catalogs/builtinUtilities.js +0 -90
  150. package/dist/modules/mcp/catalogs/cssCatalog/border.d.ts +0 -4
  151. package/dist/modules/mcp/catalogs/cssCatalog/border.js +0 -30
  152. package/dist/modules/mcp/catalogs/cssCatalog/box.d.ts +0 -4
  153. package/dist/modules/mcp/catalogs/cssCatalog/box.js +0 -31
  154. package/dist/modules/mcp/catalogs/cssCatalog/helpers.d.ts +0 -34
  155. package/dist/modules/mcp/catalogs/cssCatalog/helpers.js +0 -185
  156. package/dist/modules/mcp/catalogs/cssCatalog/index.d.ts +0 -18
  157. package/dist/modules/mcp/catalogs/cssCatalog/index.js +0 -131
  158. package/dist/modules/mcp/catalogs/cssCatalog/layout.d.ts +0 -9
  159. package/dist/modules/mcp/catalogs/cssCatalog/layout.js +0 -99
  160. package/dist/modules/mcp/catalogs/cssCatalog/visual.d.ts +0 -8
  161. package/dist/modules/mcp/catalogs/cssCatalog/visual.js +0 -147
  162. package/dist/modules/mcp/catalogs/paramSpec.d.ts +0 -39
  163. package/dist/modules/mcp/catalogs/paramSpec.js +0 -69
  164. package/dist/modules/oauth/authorize.d.ts +0 -7
  165. package/dist/modules/oauth/authorize.js +0 -177
  166. package/dist/modules/oauth/challenge.d.ts +0 -11
  167. package/dist/modules/oauth/challenge.js +0 -33
  168. package/dist/modules/oauth/consentPage.d.ts +0 -7
  169. package/dist/modules/oauth/consentPage.js +0 -118
  170. package/dist/modules/oauth/metadata.d.ts +0 -40
  171. package/dist/modules/oauth/metadata.js +0 -69
  172. package/dist/modules/oauth/params.d.ts +0 -5
  173. package/dist/modules/oauth/params.js +0 -5
  174. package/dist/modules/oauth/pkce.d.ts +0 -6
  175. package/dist/modules/oauth/pkce.js +0 -15
  176. package/dist/modules/oauth/records.d.ts +0 -71
  177. package/dist/modules/oauth/records.js +0 -46
  178. package/dist/modules/oauth/register.d.ts +0 -5
  179. package/dist/modules/oauth/register.js +0 -55
  180. package/dist/modules/oauth/respond.d.ts +0 -13
  181. package/dist/modules/oauth/respond.js +0 -44
  182. package/dist/modules/oauth/token.d.ts +0 -5
  183. package/dist/modules/oauth/token.js +0 -100
  184. package/dist/stages/oauth.d.ts +0 -19
  185. package/dist/stages/oauth.js +0 -114
  186. /package/dist/modules/mcp/catalogs/{builtinTransformers.test.d.ts → pluginCatalog.test.d.ts} +0 -0
  187. /package/dist/modules/mcp/{catalogs/cssCatalog/cssCatalog.test.d.ts → localScreenshotClient.test.d.ts} +0 -0
@@ -1,131 +0,0 @@
1
- import { SIDES } from "./helpers.js";
2
- import { expandBorder, expandBorderGroup } from "./border.js";
3
- import { expandBorderRadius, expandBox, expandGap } from "./box.js";
4
- import { expandColumns, expandFlex, expandFlexFlow, expandGridArea, expandGridLine, expandGridTemplate, expandOverflow, expandPlacePair } from "./layout.js";
5
- import { expandAnimation, expandBackground, expandFont, expandListStyle, expandOutline, expandTextDecoration, expandTransition } from "./visual.js";
6
- import styleConstants from "@plitzi/sdk-shared/style/styleConstants";
7
- //#region src/modules/mcp/catalogs/cssCatalog/index.ts
8
- /** Every kebab-case CSS property Plitzi's style engine understands. Values written to a definition
9
- * must use these exact keys — camelCase or unknown keys are rejected by the validator. */
10
- var cssProperties = Array.from(new Set(Object.values(styleConstants))).sort();
11
- var cssPropertySet = new Set(cssProperties);
12
- var isCssProperty = (key) => cssPropertySet.has(key);
13
- var toKebab = (key) => key.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
14
- /** If a camelCase key maps to a known kebab-case property, return it — used to teach the agent the correct key. */
15
- var suggestCssProperty = (key) => {
16
- const kebab = toKebab(key);
17
- return cssPropertySet.has(kebab) ? kebab : void 0;
18
- };
19
- var EXPANDERS = /* @__PURE__ */ new Map([
20
- ["padding", expandBox],
21
- ["margin", expandBox],
22
- ["inset", expandBox],
23
- ["border-radius", (_key, value, out) => expandBorderRadius(value, out)],
24
- ["gap", (_key, value, out) => expandGap(value, out)],
25
- ["border-width", (key, value, out) => expandBorderGroup(key.slice(7), value, out)],
26
- ["border-color", (key, value, out) => expandBorderGroup(key.slice(7), value, out)],
27
- ["border-style", (key, value, out) => expandBorderGroup(key.slice(7), value, out)],
28
- ["border", expandBorder],
29
- ["overflow", (_key, value, out) => expandOverflow(value, out)],
30
- ["flex", (_key, value, out) => expandFlex(value, out)],
31
- ["flex-flow", (_key, value, out) => expandFlexFlow(value, out)],
32
- ["place-content", (_key, value, out) => expandPlacePair("place-content", value, out)],
33
- ["place-items", (_key, value, out) => expandPlacePair("place-items", value, out)],
34
- ["place-self", (_key, value, out) => expandPlacePair("place-self", value, out)],
35
- ["grid-row", (_key, value, out) => expandGridLine("grid-row", value, out)],
36
- ["grid-column", (_key, value, out) => expandGridLine("grid-column", value, out)],
37
- ["grid-area", (_key, value, out) => expandGridArea(value, out)],
38
- ["grid", (_key, value, out) => expandGridTemplate(value, out)],
39
- ["grid-template", (_key, value, out) => expandGridTemplate(value, out)],
40
- ["columns", (_key, value, out) => expandColumns(value, out)],
41
- ["outline", (_key, value, out) => expandOutline(value, out)],
42
- ["list-style", (_key, value, out) => expandListStyle(value, out)],
43
- ["text-decoration", (_key, value, out) => expandTextDecoration(value, out)],
44
- ["transition", (_key, value, out) => expandTransition(value, out)],
45
- ["animation", (_key, value, out) => expandAnimation(value, out)],
46
- ["background", (_key, value, out) => expandBackground(value, out)],
47
- ["font", (_key, value, out) => expandFont(value, out)]
48
- ]);
49
- for (const side of SIDES) EXPANDERS.set(`border-${side}`, expandBorder);
50
- /** Every shorthand the MCP accepts and atomizes — advertised to the agent so it knows it may write plain CSS. */
51
- var cssShorthands = Array.from(EXPANDERS.keys()).sort();
52
- var expandOne = (key, raw, out) => {
53
- const expand = EXPANDERS.get(key);
54
- if (!expand) return false;
55
- const value = String(raw).trim();
56
- if (value !== "") expand(key, value, out);
57
- return true;
58
- };
59
- /** Expand supported CSS shorthands to their longhand keys. Explicit longhands in the same map win over any
60
- * expansion (so `{ padding: 8, padding-left: 0 }` keeps padding-left: 0). Unrecognized keys pass through. */
61
- var expandShorthand = (css) => {
62
- const expanded = {};
63
- const direct = {};
64
- for (const [key, value] of Object.entries(css)) if (!expandOne(key, value, expanded)) direct[key] = value;
65
- return {
66
- ...expanded,
67
- ...direct
68
- };
69
- };
70
- var REMOVAL_PROBE = new Map(Object.entries({
71
- padding: "0",
72
- margin: "0",
73
- inset: "0",
74
- "border-radius": "0 0 0 0 / 0 0 0 0",
75
- gap: "0 0",
76
- "border-width": "0 0 0 0",
77
- "border-color": "red red red red",
78
- "border-style": "solid solid solid solid",
79
- border: "0 solid red",
80
- overflow: "visible visible",
81
- flex: "0 0 auto",
82
- "flex-flow": "row nowrap",
83
- "place-content": "start start",
84
- "place-items": "start start",
85
- "place-self": "start start",
86
- "grid-row": "auto / auto",
87
- "grid-column": "auto / auto",
88
- "grid-area": "auto / auto / auto / auto",
89
- grid: "\"a\" 0 / 0",
90
- "grid-template": "\"a\" 0 / 0",
91
- columns: "0 0",
92
- outline: "0 solid red",
93
- "list-style": "disc inside url(x)",
94
- "text-decoration": "underline solid red",
95
- transition: "all 0s ease 0s",
96
- animation: "a 0s ease 0s 1 normal forwards running",
97
- background: "red url(x) no-repeat scroll 0 0 / auto padding-box border-box",
98
- font: "italic small-caps bold 0px/0 a"
99
- }));
100
- for (const side of SIDES) REMOVAL_PROBE.set(`border-${side}`, "0 solid red");
101
- /** The longhand keys a shorthand controls — what a `null` patch value has to clear. */
102
- var shorthandLonghands = (key) => {
103
- const probe = REMOVAL_PROBE.get(key);
104
- if (probe === void 0) return;
105
- const out = {};
106
- expandOne(key, probe, out);
107
- return Object.keys(out);
108
- };
109
- /** Patch flavour of {@link expandShorthand}: a `null` value removes every longhand the key controls, so
110
- * `{ padding: null }` clears all four sides rather than a `padding` key that was never stored. */
111
- var expandShorthandPatch = (css) => {
112
- const expanded = {};
113
- const direct = {};
114
- for (const [key, value] of Object.entries(css)) {
115
- if (value === null) {
116
- const longhands = shorthandLonghands(key);
117
- if (longhands) for (const longhand of longhands) expanded[longhand] = null;
118
- else direct[key] = null;
119
- continue;
120
- }
121
- const props = {};
122
- if (expandOne(key, value, props)) Object.assign(expanded, props);
123
- else direct[key] = value;
124
- }
125
- return {
126
- ...expanded,
127
- ...direct
128
- };
129
- };
130
- //#endregion
131
- export { cssProperties, cssShorthands, expandShorthand, expandShorthandPatch, isCssProperty, shorthandLonghands, suggestCssProperty };
@@ -1,9 +0,0 @@
1
- import { CssProps } from '../../types';
2
- export declare const expandOverflow: (value: string, out: CssProps) => void;
3
- export declare const expandFlex: (value: string, out: CssProps) => void;
4
- export declare const expandFlexFlow: (value: string, out: CssProps) => void;
5
- export declare const expandPlacePair: (prefix: "place-content" | "place-items" | "place-self", value: string, out: CssProps) => void;
6
- export declare const expandGridLine: (key: "grid-row" | "grid-column", value: string, out: CssProps) => void;
7
- export declare const expandGridArea: (value: string, out: CssProps) => void;
8
- export declare const expandColumns: (value: string, out: CssProps) => void;
9
- export declare const expandGridTemplate: (value: string, out: CssProps) => void;
@@ -1,99 +0,0 @@
1
- import { FLEX_DIRECTIONS, FLEX_WRAPS, LENGTH_RE, NUMBER_RE, QUOTE_RE, splitOn, splitPair, splitTokens } from "./helpers.js";
2
- //#region src/modules/mcp/catalogs/cssCatalog/layout.ts
3
- var expandOverflow = (value, out) => {
4
- const [x, y = x] = splitTokens(value);
5
- out["overflow-x"] = x;
6
- out["overflow-y"] = y;
7
- };
8
- var FLEX_KEYWORDS = /* @__PURE__ */ new Map([
9
- ["none", [
10
- "0",
11
- "0",
12
- "auto"
13
- ]],
14
- ["auto", [
15
- "1",
16
- "1",
17
- "auto"
18
- ]],
19
- ["initial", [
20
- "0",
21
- "1",
22
- "auto"
23
- ]]
24
- ]);
25
- var writeFlex = (out, grow, shrink, basis) => {
26
- out["flex-grow"] = grow;
27
- out["flex-shrink"] = shrink;
28
- out["flex-basis"] = basis;
29
- };
30
- var expandFlex = (value, out) => {
31
- const tokens = splitTokens(value);
32
- if (tokens.length === 1) {
33
- const [only] = tokens;
34
- const keyword = FLEX_KEYWORDS.get(only);
35
- if (keyword) writeFlex(out, ...keyword);
36
- else if (NUMBER_RE.test(only)) writeFlex(out, only, "1", "0%");
37
- else writeFlex(out, "1", "1", only);
38
- return;
39
- }
40
- const [grow, second, third] = tokens;
41
- if (!NUMBER_RE.test(grow)) return;
42
- if (tokens.length === 2) {
43
- if (NUMBER_RE.test(second)) writeFlex(out, grow, second, "0%");
44
- else writeFlex(out, grow, "1", second);
45
- } else writeFlex(out, grow, second, third);
46
- };
47
- var expandFlexFlow = (value, out) => {
48
- for (const token of splitTokens(value)) if (FLEX_DIRECTIONS.has(token)) out["flex-direction"] = token;
49
- else if (FLEX_WRAPS.has(token)) out["flex-wrap"] = token;
50
- };
51
- var expandPlacePair = (prefix, value, out) => {
52
- const [align, justify = align] = splitTokens(value);
53
- const prop = prefix.slice(6);
54
- out[`align-${prop}`] = align;
55
- out[`justify-${prop}`] = justify;
56
- };
57
- var expandGridLine = (key, value, out) => {
58
- const axis = key.slice(5);
59
- const [start, end = "auto"] = splitOn(value, "/");
60
- out[`grid-${axis}-start`] = start;
61
- out[`grid-${axis}-end`] = end;
62
- };
63
- var expandGridArea = (value, out) => {
64
- const [rowStart, colStart = rowStart, rowEnd = colStart, colEnd = rowEnd] = splitOn(value, "/");
65
- out["grid-row-start"] = rowStart;
66
- out["grid-column-start"] = colStart;
67
- out["grid-row-end"] = rowEnd;
68
- out["grid-column-end"] = colEnd;
69
- };
70
- var expandColumns = (value, out) => {
71
- const tokens = splitTokens(value);
72
- if (tokens.length === 1) {
73
- const [only] = tokens;
74
- if (NUMBER_RE.test(only)) out["column-count"] = only;
75
- else out["column-width"] = only;
76
- } else if (tokens.length >= 2) {
77
- const [first, second] = tokens;
78
- const [width, count] = NUMBER_RE.test(first) ? [second, first] : [first, second];
79
- out["column-width"] = width;
80
- out["column-count"] = count;
81
- }
82
- };
83
- var isTrackList = (tokens) => tokens.some((token) => token === "none" || token === "auto" || token === "min-content" || token === "max-content" || token.startsWith("[") || token.startsWith("minmax(") || token.startsWith("repeat(") || token.startsWith("fit-content(") || LENGTH_RE.test(token) || /^-?[\d.]+fr$/.test(token));
84
- var expandGridTemplate = (value, out) => {
85
- const [first, second] = splitPair(value, "/");
86
- const rowTokens = splitTokens(first);
87
- const areas = rowTokens.filter((token) => QUOTE_RE.test(token));
88
- const sizes = rowTokens.filter((token) => !QUOTE_RE.test(token));
89
- if (second !== void 0) {
90
- if (second !== "") out["grid-template-columns"] = second;
91
- } else if (areas.length === 0) {
92
- if (isTrackList(rowTokens)) out["grid-template-columns"] = first;
93
- return;
94
- }
95
- if (areas.length > 0) out["grid-template-areas"] = areas.join(" ");
96
- if (sizes.length > 0) out["grid-template-rows"] = sizes.join(" ");
97
- };
98
- //#endregion
99
- export { expandColumns, expandFlex, expandFlexFlow, expandGridArea, expandGridLine, expandGridTemplate, expandOverflow, expandPlacePair };
@@ -1,8 +0,0 @@
1
- import { CssProps } from '../../types';
2
- export declare const expandOutline: (value: string, out: CssProps) => void;
3
- export declare const expandListStyle: (value: string, out: CssProps) => void;
4
- export declare const expandTextDecoration: (value: string, out: CssProps) => void;
5
- export declare const expandTransition: (value: string, out: CssProps) => void;
6
- export declare const expandAnimation: (value: string, out: CssProps) => void;
7
- export declare const expandBackground: (value: string, out: CssProps) => void;
8
- export declare const expandFont: (value: string, out: CssProps) => void;
@@ -1,147 +0,0 @@
1
- import { ANIMATION_DIRECTIONS, ANIMATION_FILL_MODES, ANIMATION_PLAY_STATES, FONT_STYLE_KEYWORDS, FONT_VARIANT_KEYWORDS, FONT_WEIGHT_KEYWORDS, LENGTH_RE, LIST_STYLE_POSITIONS, LIST_STYLE_TYPES, NUMBER_RE, TEXT_DECORATION_LINES, TEXT_DECORATION_STYLES, TIME_RE, isTimingFunction, splitOn, splitPair, splitTokens } from "./helpers.js";
2
- import { classifyBorderTokens } from "./border.js";
3
- //#region src/modules/mcp/catalogs/cssCatalog/visual.ts
4
- var expandLayers = (value, out, expandLayer) => {
5
- const layers = splitOn(value, ",");
6
- if (layers.length === 1) {
7
- expandLayer(layers[0], out);
8
- return;
9
- }
10
- const perLayer = layers.map((layer) => {
11
- const layerOut = {};
12
- expandLayer(layer, layerOut);
13
- return layerOut;
14
- });
15
- const keys = new Set(perLayer.flatMap((layer) => Object.keys(layer)));
16
- for (const key of keys) out[key] = perLayer.map((layer) => String(layer[key] ?? "initial")).join(", ");
17
- };
18
- var expandOutline = (value, out) => {
19
- for (const [kind, token] of Object.entries(classifyBorderTokens(value))) out[`outline-${kind}`] = token;
20
- };
21
- var expandListStyle = (value, out) => {
22
- for (const token of splitTokens(value)) if (token.startsWith("url(")) out["list-style-image"] = token;
23
- else if (LIST_STYLE_POSITIONS.has(token)) out["list-style-position"] = token;
24
- else if (LIST_STYLE_TYPES.has(token)) out["list-style-type"] = token;
25
- };
26
- var expandTextDecoration = (value, out) => {
27
- for (const token of splitTokens(value)) if (TEXT_DECORATION_LINES.has(token)) out["text-decoration-line"] = token;
28
- else if (TEXT_DECORATION_STYLES.has(token)) out["text-decoration-style"] = token;
29
- else out["text-decoration-color"] = token;
30
- };
31
- var expandTransitionLayer = (layer, out) => {
32
- let foundDuration = false;
33
- for (const token of splitTokens(layer)) if (isTimingFunction(token)) out["transition-timing-function"] = token;
34
- else if (TIME_RE.test(token) || NUMBER_RE.test(token)) {
35
- if (foundDuration) out["transition-delay"] = token;
36
- else {
37
- out["transition-duration"] = token;
38
- foundDuration = true;
39
- }
40
- } else if (!out["transition-property"]) out["transition-property"] = token;
41
- };
42
- var expandTransition = (value, out) => expandLayers(value, out, expandTransitionLayer);
43
- var expandAnimationLayer = (layer, out) => {
44
- let foundDuration = false;
45
- for (const token of splitTokens(layer)) if (isTimingFunction(token)) out["animation-timing-function"] = token;
46
- else if (TIME_RE.test(token)) {
47
- if (foundDuration) out["animation-delay"] = token;
48
- else {
49
- out["animation-duration"] = token;
50
- foundDuration = true;
51
- }
52
- } else if (token === "infinite" || NUMBER_RE.test(token)) out["animation-iteration-count"] = token;
53
- else if (ANIMATION_DIRECTIONS.has(token) && !out["animation-direction"]) out["animation-direction"] = token;
54
- else if (ANIMATION_FILL_MODES.has(token) && !out["animation-fill-mode"]) out["animation-fill-mode"] = token;
55
- else if (ANIMATION_PLAY_STATES.has(token) && !out["animation-play-state"]) out["animation-play-state"] = token;
56
- else if (!out["animation-name"]) out["animation-name"] = token;
57
- };
58
- var expandAnimation = (value, out) => expandLayers(value, out, expandAnimationLayer);
59
- var BACKGROUND_REPEATS = /* @__PURE__ */ new Set([
60
- "repeat",
61
- "no-repeat",
62
- "repeat-x",
63
- "repeat-y",
64
- "space",
65
- "round"
66
- ]);
67
- var BACKGROUND_ATTACHMENTS = /* @__PURE__ */ new Set([
68
- "scroll",
69
- "fixed",
70
- "local"
71
- ]);
72
- var BACKGROUND_BOXES = /* @__PURE__ */ new Set([
73
- "border-box",
74
- "padding-box",
75
- "content-box"
76
- ]);
77
- var BACKGROUND_POSITIONS = /* @__PURE__ */ new Set([
78
- "center",
79
- "top",
80
- "bottom",
81
- "left",
82
- "right"
83
- ]);
84
- var isImage = (token) => token.startsWith("url(") || token.includes("-gradient(");
85
- var isPosition = (token) => BACKGROUND_POSITIONS.has(token) || LENGTH_RE.test(token);
86
- var isSize = (token) => token === "cover" || token === "contain" || token === "auto" || LENGTH_RE.test(token);
87
- var expandBackgroundLayer = (layer, out) => {
88
- const [beforeSlash, afterSlash] = splitPair(layer, "/");
89
- const tokens = splitTokens(beforeSlash);
90
- if (afterSlash !== void 0) {
91
- let positionStart = tokens.length;
92
- while (positionStart > 0 && isPosition(tokens[positionStart - 1])) positionStart -= 1;
93
- const position = tokens.splice(positionStart, tokens.length - positionStart);
94
- if (position.length > 0) out["background-position"] = position.join(" ");
95
- const afterTokens = splitTokens(afterSlash);
96
- let sizeEnd = 0;
97
- while (sizeEnd < afterTokens.length && isSize(afterTokens[sizeEnd])) sizeEnd += 1;
98
- if (sizeEnd > 0) out["background-size"] = afterTokens.slice(0, sizeEnd).join(" ");
99
- tokens.push(...afterTokens.slice(sizeEnd));
100
- }
101
- const positions = [];
102
- for (const token of tokens) if (isImage(token)) out["background-image"] = token;
103
- else if (BACKGROUND_REPEATS.has(token)) out["background-repeat"] = token;
104
- else if (token === "cover" || token === "contain") out["background-size"] = token;
105
- else if (BACKGROUND_ATTACHMENTS.has(token)) out["background-attachment"] = token;
106
- else if (BACKGROUND_BOXES.has(token)) {
107
- if (out["background-origin"]) out["background-clip"] = token;
108
- else out["background-origin"] = token;
109
- } else if (isPosition(token)) positions.push(token);
110
- else if (!out["background-color"]) out["background-color"] = token;
111
- if (positions.length > 0) out["background-position"] = positions.join(" ");
112
- };
113
- var expandBackground = (value, out) => expandLayers(value, out, expandBackgroundLayer);
114
- var expandFont = (value, out) => {
115
- const [beforeSlash, afterSlash] = splitPair(value, "/");
116
- const tokens = splitTokens(beforeSlash);
117
- if (afterSlash !== void 0) {
118
- const [lineHeight, ...family] = splitTokens(afterSlash);
119
- out["line-height"] = lineHeight;
120
- if (family.length > 0) out["font-family"] = family.join(" ");
121
- }
122
- const family = [];
123
- let foundSize = false;
124
- for (const token of tokens) {
125
- if (foundSize) {
126
- family.push(token);
127
- continue;
128
- }
129
- if (token === "normal") {
130
- const slot = [
131
- "font-style",
132
- "font-variant",
133
- "font-weight"
134
- ].find((prop) => !out[prop]);
135
- if (slot) out[slot] = token;
136
- } else if (FONT_STYLE_KEYWORDS.has(token) && !out["font-style"]) out["font-style"] = token;
137
- else if (FONT_VARIANT_KEYWORDS.has(token) && !out["font-variant"]) out["font-variant"] = token;
138
- else if (FONT_WEIGHT_KEYWORDS.has(token) && !out["font-weight"]) out["font-weight"] = token;
139
- else if (LENGTH_RE.test(token)) {
140
- out["font-size"] = token;
141
- foundSize = true;
142
- }
143
- }
144
- if (family.length > 0) out["font-family"] = family.join(" ");
145
- };
146
- //#endregion
147
- export { expandAnimation, expandBackground, expandFont, expandListStyle, expandOutline, expandTextDecoration, expandTransition };
@@ -1,39 +0,0 @@
1
- export type BuiltinParamType = 'text' | 'textarea' | 'select' | 'boolean' | 'number' | 'scalar';
2
- export interface BuiltinParam {
3
- type: BuiltinParamType;
4
- description: string;
5
- default?: string | number | boolean;
6
- options?: string[];
7
- when?: (params: Record<string, unknown>) => boolean;
8
- required?: boolean;
9
- }
10
- export type ParamSpec = Record<string, BuiltinParam>;
11
- /** Declared params the agent supplied that end up HIDDEN because their own `when` guard is false against the
12
- * effective params — they are silently ignored (e.g. a global setState `value` with no `type`, or an
13
- * addNotification `autoDismissTimeout` with autoDismiss:false). Evaluated against the effective params so a param
14
- * the default fills in (e.g. category:"attribute") does not false-report a value as hidden. */
15
- export declare const hiddenParams: (provided: Record<string, unknown>, effective: Record<string, unknown>, spec: ParamSpec) => string[];
16
- /** Declared params marked `required` that the agent did NOT supply, and whose `when` guard holds against the
17
- * effective params (so they are actually in play). Evaluated against the effective params so a required param
18
- * gated by a companion (e.g. setState `value`, shown only once `category` is set) is not reported when its guard
19
- * is not met. */
20
- export declare const missingRequiredParams: (provided: Record<string, unknown>, effective: Record<string, unknown>, spec: ParamSpec) => string[];
21
- /** A param the agent supplied whose VALUE does not match its declared type — a boolean given as the string "true",
22
- * a number given as a string, a `select` value outside its options, a null placeholder left behind. `expected` is
23
- * the declared type, `got` the JS typeof (or "null"), and `options` the allowed values for a `select`. */
24
- export interface InvalidParam {
25
- key: string;
26
- expected: BuiltinParamType;
27
- got: string;
28
- options?: string[];
29
- }
30
- /** Declared params the agent supplied whose value is the WRONG type for the catalog — the check that catches a
31
- * malformed node the unknown/missing/hidden checks miss (a boolean stored as a string, a select value not in its
32
- * options, a leftover `null`). Only params actually in play are checked: undefined values (the param is absent) and
33
- * params hidden by their own `when` guard against the effective params are skipped, so this never fires on a param
34
- * that is not really used. Callers gate this to CLOSED (strict) catalogs, whose types we own authoritatively. */
35
- export declare const invalidParams: (provided: Record<string, unknown>, effective: Record<string, unknown>, spec: ParamSpec) => InvalidParam[];
36
- /** Reconcile supplied params to a catalog schema: drop unknown keys when the set is CLOSED (strict), then fill the
37
- * builder's defaults for any declared param the agent omitted whose `when` guard holds. Mirrors what the builder
38
- * stores, so the persisted node round-trips cleanly. */
39
- export declare const reconcileParams: (params: Record<string, unknown>, spec: ParamSpec, strict: boolean) => Record<string, unknown>;
@@ -1,69 +0,0 @@
1
- import { hasValidToken } from "@plitzi/sdk-shared/helpers/twigWrapper";
2
- //#region src/modules/mcp/catalogs/paramSpec.ts
3
- /** Declared params the agent supplied that end up HIDDEN because their own `when` guard is false against the
4
- * effective params — they are silently ignored (e.g. a global setState `value` with no `type`, or an
5
- * addNotification `autoDismissTimeout` with autoDismiss:false). Evaluated against the effective params so a param
6
- * the default fills in (e.g. category:"attribute") does not false-report a value as hidden. */
7
- var hiddenParams = (provided, effective, spec) => {
8
- const hidden = [];
9
- for (const [key, param] of Object.entries(spec)) if (param.when && provided[key] !== void 0 && !param.when(effective)) hidden.push(key);
10
- return hidden;
11
- };
12
- /** Declared params marked `required` that the agent did NOT supply, and whose `when` guard holds against the
13
- * effective params (so they are actually in play). Evaluated against the effective params so a required param
14
- * gated by a companion (e.g. setState `value`, shown only once `category` is set) is not reported when its guard
15
- * is not met. */
16
- var missingRequiredParams = (provided, effective, spec) => {
17
- const missing = [];
18
- for (const [key, param] of Object.entries(spec)) if (param.required && provided[key] === void 0 && (!param.when || param.when(effective))) missing.push(key);
19
- return missing;
20
- };
21
- var isNumeric = (value) => value.trim() !== "" && Number.isFinite(Number(value));
22
- var isBindingToken = (value) => typeof value === "string" && hasValidToken(value);
23
- var matchesType = (value, param) => {
24
- switch (param.type) {
25
- case "boolean": return typeof value === "boolean";
26
- case "number": return typeof value === "number" || typeof value === "string" && isNumeric(value);
27
- case "select": return typeof value === "string" && (!param.options || param.options.includes(value));
28
- case "scalar": return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
29
- case "text":
30
- case "textarea": return typeof value === "string";
31
- default: return true;
32
- }
33
- };
34
- /** Declared params the agent supplied whose value is the WRONG type for the catalog — the check that catches a
35
- * malformed node the unknown/missing/hidden checks miss (a boolean stored as a string, a select value not in its
36
- * options, a leftover `null`). Only params actually in play are checked: undefined values (the param is absent) and
37
- * params hidden by their own `when` guard against the effective params are skipped, so this never fires on a param
38
- * that is not really used. Callers gate this to CLOSED (strict) catalogs, whose types we own authoritatively. */
39
- var invalidParams = (provided, effective, spec) => {
40
- const invalid = [];
41
- for (const [key, param] of Object.entries(spec)) {
42
- const value = provided[key];
43
- if (value === void 0 || isBindingToken(value) || param.when && !param.when(effective)) continue;
44
- if (!matchesType(value, param)) invalid.push({
45
- key,
46
- expected: param.type,
47
- got: value === null ? "null" : typeof value,
48
- ...param.options ? { options: param.options } : {}
49
- });
50
- }
51
- return invalid;
52
- };
53
- /** Reconcile supplied params to a catalog schema: drop unknown keys when the set is CLOSED (strict), then fill the
54
- * builder's defaults for any declared param the agent omitted whose `when` guard holds. Mirrors what the builder
55
- * stores, so the persisted node round-trips cleanly. */
56
- var reconcileParams = (params, spec, strict) => {
57
- const next = {};
58
- for (const [key, value] of Object.entries(params)) {
59
- if (strict && !(key in spec)) continue;
60
- next[key] = value;
61
- }
62
- for (const [key, param] of Object.entries(spec)) {
63
- if (param.default === void 0 || next[key] !== void 0 || param.when && !param.when(next)) continue;
64
- next[key] = param.default;
65
- }
66
- return next;
67
- };
68
- //#endregion
69
- export { hiddenParams, invalidParams, missingRequiredParams, reconcileParams };
@@ -1,7 +0,0 @@
1
- import { OAuthParams } from './params';
2
- import { OAuthConfig, SSRResponseHelpers } from '@plitzi/sdk-shared';
3
- /** GET /authorize — the entry point a host opens in the user's browser. */
4
- export declare const handleAuthorizeStart: (config: OAuthConfig, res: SSRResponseHelpers, params: OAuthParams) => Promise<void>;
5
- /** POST /authorize — both steps of the form land here: the credentials submit, and the grant submit that carries
6
- * the `pending` id proving the credentials step already passed. */
7
- export declare const handleAuthorizeSubmit: (config: OAuthConfig, res: SSRResponseHelpers, params: OAuthParams) => Promise<void>;