@edv4h/usketch-plugin-shape-openui 0.1.1
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/LICENSE +21 -0
- package/dist/__tests__/plugin.test.d.ts +2 -0
- package/dist/__tests__/plugin.test.d.ts.map +1 -0
- package/dist/__tests__/plugin.test.js +98 -0
- package/dist/__tests__/plugin.test.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/library-registry.d.ts +4 -0
- package/dist/library-registry.d.ts.map +1 -0
- package/dist/library-registry.js +22 -0
- package/dist/library-registry.js.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +151 -0
- package/dist/plugin.js.map +1 -0
- package/dist/sanitize.d.ts +10 -0
- package/dist/sanitize.d.ts.map +1 -0
- package/dist/sanitize.js +27 -0
- package/dist/sanitize.js.map +1 -0
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EdV4H
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/plugin.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { openUIShapePlugin } from "../plugin.js";
|
|
3
|
+
function setupPlugin() {
|
|
4
|
+
let captured;
|
|
5
|
+
const shapes = {
|
|
6
|
+
register: vi.fn((_type, def) => {
|
|
7
|
+
captured = def;
|
|
8
|
+
}),
|
|
9
|
+
};
|
|
10
|
+
openUIShapePlugin.setup({ shapes });
|
|
11
|
+
if (!captured)
|
|
12
|
+
throw new Error("ShapeDefinition was not registered");
|
|
13
|
+
return captured;
|
|
14
|
+
}
|
|
15
|
+
describe("openUIShapePlugin", () => {
|
|
16
|
+
it("registers the `openui` shape", () => {
|
|
17
|
+
const shapes = { register: vi.fn() };
|
|
18
|
+
openUIShapePlugin.setup({ shapes });
|
|
19
|
+
expect(shapes.register).toHaveBeenCalledWith("openui", expect.any(Object));
|
|
20
|
+
});
|
|
21
|
+
it("createDefault produces a valid OpenUIShapeData with empty langSource", () => {
|
|
22
|
+
const def = setupPlugin();
|
|
23
|
+
const shape = def.createDefault({ id: "test-1", x: 10, y: 20 });
|
|
24
|
+
expect(shape).toMatchObject({
|
|
25
|
+
id: "test-1",
|
|
26
|
+
type: "openui",
|
|
27
|
+
x: 10,
|
|
28
|
+
y: 20,
|
|
29
|
+
width: 480,
|
|
30
|
+
height: 360,
|
|
31
|
+
langSource: "",
|
|
32
|
+
prompt: "",
|
|
33
|
+
model: "",
|
|
34
|
+
libraryId: "openui-default",
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
it("getBounds returns the shape rectangle", () => {
|
|
38
|
+
const def = setupPlugin();
|
|
39
|
+
const shape = def.createDefault({ id: "t", x: 5, y: 7 });
|
|
40
|
+
expect(def.getBounds(shape)).toEqual({ x: 5, y: 7, width: 480, height: 360 });
|
|
41
|
+
});
|
|
42
|
+
it("hitTest is true inside, false outside", () => {
|
|
43
|
+
const def = setupPlugin();
|
|
44
|
+
const shape = def.createDefault({ id: "t", x: 0, y: 0 });
|
|
45
|
+
expect(def.hitTest(shape, { x: 100, y: 100 })).toBe(true);
|
|
46
|
+
expect(def.hitTest(shape, { x: 1000, y: 1000 })).toBe(false);
|
|
47
|
+
});
|
|
48
|
+
it("resize clamps width/height to minSize", () => {
|
|
49
|
+
const def = setupPlugin();
|
|
50
|
+
const shape = def.createDefault({ id: "t", x: 0, y: 0 });
|
|
51
|
+
const resized = def.resize(shape, "se", { x: -10000, y: -10000 });
|
|
52
|
+
expect(resized.width).toBeGreaterThanOrEqual(160);
|
|
53
|
+
expect(resized.height).toBeGreaterThanOrEqual(100);
|
|
54
|
+
});
|
|
55
|
+
it("resize handles all eight directions", () => {
|
|
56
|
+
const def = setupPlugin();
|
|
57
|
+
const shape = def.createDefault({ id: "t", x: 0, y: 0 });
|
|
58
|
+
for (const handle of ["n", "s", "e", "w", "ne", "nw", "se", "sw"]) {
|
|
59
|
+
const r = def.resize(shape, handle, { x: 5, y: 5 });
|
|
60
|
+
expect(r.width).toBeGreaterThanOrEqual(160);
|
|
61
|
+
expect(r.height).toBeGreaterThanOrEqual(100);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
it("serializeForAi omits langSource body but keeps metadata", () => {
|
|
65
|
+
const def = setupPlugin();
|
|
66
|
+
const shape = {
|
|
67
|
+
...def.createDefault({ id: "t", x: 0, y: 0 }),
|
|
68
|
+
prompt: "a pricing card",
|
|
69
|
+
model: "gpt-4o",
|
|
70
|
+
langSource: "root = Stack()",
|
|
71
|
+
};
|
|
72
|
+
const out = def.serializeForAi?.(shape);
|
|
73
|
+
expect(out).toMatchObject({
|
|
74
|
+
prompt: "a pricing card",
|
|
75
|
+
model: "gpt-4o",
|
|
76
|
+
libraryId: "openui-default",
|
|
77
|
+
langLength: "root = Stack()".length,
|
|
78
|
+
});
|
|
79
|
+
expect(out).not.toHaveProperty("langSource");
|
|
80
|
+
});
|
|
81
|
+
it("debugFields surfaces the same metadata", () => {
|
|
82
|
+
const def = setupPlugin();
|
|
83
|
+
const shape = {
|
|
84
|
+
...def.createDefault({ id: "t", x: 0, y: 0 }),
|
|
85
|
+
prompt: "p",
|
|
86
|
+
model: "m",
|
|
87
|
+
langSource: "x",
|
|
88
|
+
};
|
|
89
|
+
const out = def.debugFields?.(shape);
|
|
90
|
+
expect(out).toMatchObject({
|
|
91
|
+
prompt: "p",
|
|
92
|
+
model: "m",
|
|
93
|
+
libraryId: "openui-default",
|
|
94
|
+
langLength: 1,
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=plugin.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.test.js","sourceRoot":"","sources":["../../src/__tests__/plugin.test.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAiBjD,SAAS,WAAW;IACnB,IAAI,QAAwC,CAAC;IAC7C,MAAM,MAAM,GAAG;QACd,QAAQ,EAAE,EAAE,CAAC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AAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library-registry.d.ts","sourceRoot":"","sources":["../src/library-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAkBrD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAE9D;AAED,wBAAgB,gBAAgB,IAAI,OAAO,GAAG,IAAI,CAEjD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module-scoped registry for the active OpenUI component library.
|
|
3
|
+
*
|
|
4
|
+
* The shape plugin needs a `Library` at render time to pass to `<Renderer>`,
|
|
5
|
+
* but the library is configured by the *tool* plugin (which knows what
|
|
6
|
+
* components the host wants to expose to the LLM). To avoid a circular
|
|
7
|
+
* dependency between the two plugins, the shape plugin exports
|
|
8
|
+
* `setOpenUILibrary` and the tool plugin calls it during `setup`.
|
|
9
|
+
*
|
|
10
|
+
* This pattern assumes the two plugins live in the same process (true for
|
|
11
|
+
* a single `createApp(...)` invocation). It does NOT support multiple
|
|
12
|
+
* `createApp` instances with different libraries — file a follow-up if that
|
|
13
|
+
* matters.
|
|
14
|
+
*/
|
|
15
|
+
let activeLibrary = null;
|
|
16
|
+
export function setOpenUILibrary(library) {
|
|
17
|
+
activeLibrary = library;
|
|
18
|
+
}
|
|
19
|
+
export function getOpenUILibrary() {
|
|
20
|
+
return activeLibrary;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=library-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library-registry.js","sourceRoot":"","sources":["../src/library-registry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,IAAI,aAAa,GAAmB,IAAI,CAAC;AAEzC,MAAM,UAAU,gBAAgB,CAAC,OAAuB;IACvD,aAAa,GAAG,OAAO,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC/B,OAAO,aAAa,CAAC;AACtB,CAAC"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":"AAAA,OAAO,EAON,KAAK,aAAa,EAElB,MAAM,uBAAuB,CAAC;AAmK/B,eAAO,MAAM,iBAAiB,EAAE,aAiB/B,CAAC"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_STYLE, withRotation, } from "@edv4h/usketch-shared";
|
|
3
|
+
import { Renderer } from "@openuidev/react-lang";
|
|
4
|
+
import { getOpenUILibrary } from "./library-registry.js";
|
|
5
|
+
function FallbackBox({ message }) {
|
|
6
|
+
return (_jsx("div", { style: {
|
|
7
|
+
width: "100%",
|
|
8
|
+
height: "100%",
|
|
9
|
+
display: "flex",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
padding: 16,
|
|
13
|
+
background: "#fafafa",
|
|
14
|
+
border: "1px dashed #d4d4d8",
|
|
15
|
+
borderRadius: 6,
|
|
16
|
+
color: "#71717a",
|
|
17
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
18
|
+
fontSize: 13,
|
|
19
|
+
textAlign: "center",
|
|
20
|
+
}, children: message }));
|
|
21
|
+
}
|
|
22
|
+
function render(shape) {
|
|
23
|
+
const data = shape;
|
|
24
|
+
const library = getOpenUILibrary();
|
|
25
|
+
if (!library) {
|
|
26
|
+
return (_jsx(FallbackBox, { message: "OpenUI library not configured \u2014 install usketch-plugin-tool-openui" }));
|
|
27
|
+
}
|
|
28
|
+
return (_jsx("div", { style: {
|
|
29
|
+
width: "100%",
|
|
30
|
+
height: "100%",
|
|
31
|
+
overflow: "auto",
|
|
32
|
+
border: `${data.style.strokeWidth}px solid ${data.style.stroke}`,
|
|
33
|
+
borderRadius: 6,
|
|
34
|
+
background: data.style.fill,
|
|
35
|
+
padding: 8,
|
|
36
|
+
boxSizing: "border-box",
|
|
37
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
38
|
+
// The widget is a static preview — disable pointer events and text
|
|
39
|
+
// selection so canvas drag/select/resize behave normally. (A future
|
|
40
|
+
// "focus mode" interaction is tracked as a follow-up; until then,
|
|
41
|
+
// clicking through to the underlying button/input is intentionally
|
|
42
|
+
// blocked to match shape-text / shape-image conventions.)
|
|
43
|
+
pointerEvents: "none",
|
|
44
|
+
userSelect: "none",
|
|
45
|
+
}, children: _jsx(Renderer, { response: data.langSource, library: library, isStreaming: false, onError: (err) => {
|
|
46
|
+
console.warn("[usketch-plugin-shape-openui] Renderer error:", err);
|
|
47
|
+
} }) }));
|
|
48
|
+
}
|
|
49
|
+
function getBounds(data) {
|
|
50
|
+
return { x: data.x, y: data.y, width: data.width, height: data.height };
|
|
51
|
+
}
|
|
52
|
+
function hitTest(data, point) {
|
|
53
|
+
return (point.x >= data.x &&
|
|
54
|
+
point.x <= data.x + data.width &&
|
|
55
|
+
point.y >= data.y &&
|
|
56
|
+
point.y <= data.y + data.height);
|
|
57
|
+
}
|
|
58
|
+
function resize(data, handle, delta) {
|
|
59
|
+
let { x, y, width, height } = data;
|
|
60
|
+
switch (handle) {
|
|
61
|
+
case "se":
|
|
62
|
+
width += delta.x;
|
|
63
|
+
height += delta.y;
|
|
64
|
+
break;
|
|
65
|
+
case "nw":
|
|
66
|
+
x += delta.x;
|
|
67
|
+
y += delta.y;
|
|
68
|
+
width -= delta.x;
|
|
69
|
+
height -= delta.y;
|
|
70
|
+
break;
|
|
71
|
+
case "ne":
|
|
72
|
+
y += delta.y;
|
|
73
|
+
width += delta.x;
|
|
74
|
+
height -= delta.y;
|
|
75
|
+
break;
|
|
76
|
+
case "sw":
|
|
77
|
+
x += delta.x;
|
|
78
|
+
width -= delta.x;
|
|
79
|
+
height += delta.y;
|
|
80
|
+
break;
|
|
81
|
+
case "e":
|
|
82
|
+
width += delta.x;
|
|
83
|
+
break;
|
|
84
|
+
case "w":
|
|
85
|
+
x += delta.x;
|
|
86
|
+
width -= delta.x;
|
|
87
|
+
break;
|
|
88
|
+
case "n":
|
|
89
|
+
y += delta.y;
|
|
90
|
+
height -= delta.y;
|
|
91
|
+
break;
|
|
92
|
+
case "s":
|
|
93
|
+
height += delta.y;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
return { ...data, x, y, width: Math.max(160, width), height: Math.max(100, height) };
|
|
97
|
+
}
|
|
98
|
+
function createDefault(params) {
|
|
99
|
+
return {
|
|
100
|
+
id: params.id,
|
|
101
|
+
type: "openui",
|
|
102
|
+
x: params.x,
|
|
103
|
+
y: params.y,
|
|
104
|
+
width: 480,
|
|
105
|
+
height: 360,
|
|
106
|
+
style: { ...DEFAULT_STYLE, fill: "#ffffff", stroke: "#e5e7eb", strokeWidth: 1 },
|
|
107
|
+
langSource: "",
|
|
108
|
+
prompt: "",
|
|
109
|
+
model: "",
|
|
110
|
+
libraryId: "openui-default",
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function serializeForAi(shape) {
|
|
114
|
+
const data = shape;
|
|
115
|
+
return {
|
|
116
|
+
prompt: data.prompt,
|
|
117
|
+
model: data.model,
|
|
118
|
+
libraryId: data.libraryId,
|
|
119
|
+
langLength: data.langSource.length,
|
|
120
|
+
// langSource body intentionally omitted: it is too large for AI prompts
|
|
121
|
+
// and re-feeding generated UI to other AI plugins risks self-referential
|
|
122
|
+
// loops.
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function debugFields(shape) {
|
|
126
|
+
const data = shape;
|
|
127
|
+
return {
|
|
128
|
+
prompt: data.prompt,
|
|
129
|
+
model: data.model,
|
|
130
|
+
libraryId: data.libraryId,
|
|
131
|
+
langLength: data.langSource.length,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
export const openUIShapePlugin = {
|
|
135
|
+
id: "usketch-plugin-shape-openui",
|
|
136
|
+
name: "OpenUI",
|
|
137
|
+
setup(ctx) {
|
|
138
|
+
ctx.shapes.register("openui", {
|
|
139
|
+
render,
|
|
140
|
+
getBounds,
|
|
141
|
+
hitTest: withRotation(hitTest),
|
|
142
|
+
resize,
|
|
143
|
+
createDefault,
|
|
144
|
+
renderTarget: "html",
|
|
145
|
+
minSize: { width: 160, height: 100 },
|
|
146
|
+
serializeForAi,
|
|
147
|
+
debugFields,
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEN,aAAa,EAMb,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,SAAS,WAAW,CAAC,EAAE,OAAO,EAAuB;IACpD,OAAO,CACN,cACC,KAAK,EAAE;YACN,KAAK,EAAE,MAAM;Y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CAAC;IACtC,OAAO;QACN,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;QAClC,wEAAwE;QACxE,yEAAyE;QACzE,SAAS;KACT,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAgB;IACpC,MAAM,IAAI,GAAG,KAAwB,CAAC;IACtC,OAAO;QACN,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;KAClC,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAkB;IAC/C,EAAE,EAAE,6BAA6B;IACjC,IAAI,EAAE,QAAQ;IAEd,KAAK,CAAC,GAAkB;QACvB,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAC7B,MAAM;YACN,SAAS;YACT,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC;YAC9B,MAAM;YACN,aAAa;YACb,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;YACpC,cAAc;YACd,WAAW;SACX,CAAC,CAAC;IACJ,CAAC;CACD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip markdown fences and common LLM artifacts that creep into OpenUI Lang
|
|
3
|
+
* output despite an explicit "no markdown" system prompt.
|
|
4
|
+
*
|
|
5
|
+
* The Renderer's parser is forgiving but rejects entire responses on a
|
|
6
|
+
* trailing ``` — easier to clean up at the dispatch boundary than trust the
|
|
7
|
+
* model to behave.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sanitizeLangSource(raw: string): string;
|
|
10
|
+
//# sourceMappingURL=sanitize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAiBtD"}
|
package/dist/sanitize.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip markdown fences and common LLM artifacts that creep into OpenUI Lang
|
|
3
|
+
* output despite an explicit "no markdown" system prompt.
|
|
4
|
+
*
|
|
5
|
+
* The Renderer's parser is forgiving but rejects entire responses on a
|
|
6
|
+
* trailing ``` — easier to clean up at the dispatch boundary than trust the
|
|
7
|
+
* model to behave.
|
|
8
|
+
*/
|
|
9
|
+
export function sanitizeLangSource(raw) {
|
|
10
|
+
let s = raw.trim();
|
|
11
|
+
// Leading opening fence: ```openui-lang / ```ts / ```
|
|
12
|
+
s = s.replace(/^```[a-zA-Z0-9_-]*\s*\n/, "");
|
|
13
|
+
// Trailing closing fence
|
|
14
|
+
s = s.replace(/\n```\s*$/, "");
|
|
15
|
+
// Some models add "Here is the UI:" or similar — strip a single leading
|
|
16
|
+
// line that does not start with an identifier=Component( pattern.
|
|
17
|
+
// Conservative: only strip if the first non-empty line clearly is prose.
|
|
18
|
+
const lines = s.split("\n");
|
|
19
|
+
if (lines.length > 1 && lines[0] && !/^[a-zA-Z_][\w$]*\s*=/.test(lines[0])) {
|
|
20
|
+
const trimmed = lines[0].trim();
|
|
21
|
+
if (trimmed.endsWith(":") || trimmed.endsWith(".") || trimmed.startsWith("//")) {
|
|
22
|
+
s = lines.slice(1).join("\n").trimStart();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return s.trim();
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=sanitize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC7C,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACnB,sDAAsD;IACtD,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;IAC7C,yBAAyB;IACzB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC/B,wEAAwE;IACxE,kEAAkE;IAClE,yEAAyE;IACzE,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAChF,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;QAC3C,CAAC;IACF,CAAC;IACD,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ShapeData } from "@edv4h/usketch-shared";
|
|
2
|
+
/**
|
|
3
|
+
* Intrinsic data for the `openui` shape — a Generative UI widget rendered
|
|
4
|
+
* via `@openuidev/react-lang`'s `Renderer` from a snippet of OpenUI Lang.
|
|
5
|
+
*
|
|
6
|
+
* The lang source is plain text (OpenUI Lang DSL). The Renderer validates it
|
|
7
|
+
* against the active library's Zod schemas at mount time, so invalid LLM
|
|
8
|
+
* output cannot inject arbitrary HTML or scripts.
|
|
9
|
+
*/
|
|
10
|
+
export interface OpenUIShapeData extends ShapeData {
|
|
11
|
+
/** Full OpenUI Lang DSL source for this widget. */
|
|
12
|
+
langSource: string;
|
|
13
|
+
/** Original user prompt that produced this widget. Useful for iterate / debug. */
|
|
14
|
+
prompt: string;
|
|
15
|
+
/** Model identifier that generated the response (e.g. `"gpt-4o"`). */
|
|
16
|
+
model: string;
|
|
17
|
+
/**
|
|
18
|
+
* Identifier of the library used to render this widget. Hosts that swap
|
|
19
|
+
* libraries between sessions can use this to warn or fall back when a
|
|
20
|
+
* persisted shape was generated against a different component set.
|
|
21
|
+
* Defaults to `"openui-default"`.
|
|
22
|
+
*/
|
|
23
|
+
libraryId: string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IACjD,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@edv4h/usketch-plugin-shape-openui",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Experimental OpenUI shape plugin: render Generative UI (OpenUI Lang) as a uSketch shape via @openuidev/react-lang's Renderer.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@openuidev/react-lang": "0.2.5",
|
|
17
|
+
"@edv4h/usketch-shared": "2.0.0"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@modelcontextprotocol/sdk": ">=1.0.0",
|
|
21
|
+
"react": ">=19",
|
|
22
|
+
"zod": "^4.0.0 || >=3.25.0 <4.0.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependenciesMeta": {
|
|
25
|
+
"@modelcontextprotocol/sdk": {
|
|
26
|
+
"optional": true
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/react": "19.2.14",
|
|
31
|
+
"typescript": "5.9.3",
|
|
32
|
+
"vitest": "3.2.4"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md"
|
|
40
|
+
],
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/EdV4H/usketch.git",
|
|
45
|
+
"directory": "plugins/usketch-plugin-shape-openui"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/EdV4H/usketch#readme",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/EdV4H/usketch/issues"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsc -p tsconfig.json",
|
|
53
|
+
"typecheck": "tsc --noEmit",
|
|
54
|
+
"test": "vitest run --passWithNoTests",
|
|
55
|
+
"clean": "rm -rf dist"
|
|
56
|
+
}
|
|
57
|
+
}
|