@ryan_nookpi/pi-extension-generative-ui 0.1.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/README.md +16 -0
- package/guidelines.ts +794 -0
- package/html-utils.ts +94 -0
- package/index.ts +524 -0
- package/package.json +33 -0
- package/svg-styles.ts +167 -0
package/svg-styles.ts
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Pre-built CSS classes for SVG diagrams.
|
|
2
|
+
// Reverse-engineered from the claude.ai artifact rendering system based on the
|
|
3
|
+
// design guidelines extracted in guidelines.ts. These classes are what the
|
|
4
|
+
// guidelines mean by "already loaded in SVG widget".
|
|
5
|
+
|
|
6
|
+
export const SVG_STYLES = `
|
|
7
|
+
:root {
|
|
8
|
+
--p: #e0e0e0;
|
|
9
|
+
--s: #a0a0a0;
|
|
10
|
+
--t: #707070;
|
|
11
|
+
--bg2: #2a2a2a;
|
|
12
|
+
--b: #404040;
|
|
13
|
+
--color-text-primary: #e0e0e0;
|
|
14
|
+
--color-text-secondary: #a0a0a0;
|
|
15
|
+
--color-text-tertiary: #707070;
|
|
16
|
+
--color-text-info: #85B7EB;
|
|
17
|
+
--color-text-danger: #F09595;
|
|
18
|
+
--color-text-success: #97C459;
|
|
19
|
+
--color-text-warning: #EF9F27;
|
|
20
|
+
--color-background-primary: #1a1a1a;
|
|
21
|
+
--color-background-secondary: #2a2a2a;
|
|
22
|
+
--color-background-tertiary: #111111;
|
|
23
|
+
--color-background-info: #0C447C;
|
|
24
|
+
--color-background-danger: #791F1F;
|
|
25
|
+
--color-background-success: #27500A;
|
|
26
|
+
--color-background-warning: #633806;
|
|
27
|
+
--color-border-primary: rgba(255,255,255,0.4);
|
|
28
|
+
--color-border-secondary: rgba(255,255,255,0.3);
|
|
29
|
+
--color-border-tertiary: rgba(255,255,255,0.15);
|
|
30
|
+
--color-border-info: #85B7EB;
|
|
31
|
+
--color-border-danger: #F09595;
|
|
32
|
+
--color-border-success: #97C459;
|
|
33
|
+
--color-border-warning: #EF9F27;
|
|
34
|
+
--font-sans: system-ui, -apple-system, sans-serif;
|
|
35
|
+
--font-serif: Georgia, serif;
|
|
36
|
+
--font-mono: ui-monospace, monospace;
|
|
37
|
+
--border-radius-md: 8px;
|
|
38
|
+
--border-radius-lg: 12px;
|
|
39
|
+
--border-radius-xl: 16px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Text classes */
|
|
43
|
+
svg .t { font-family: var(--font-sans); font-size: 14px; fill: var(--p); }
|
|
44
|
+
svg .ts { font-family: var(--font-sans); font-size: 12px; fill: var(--s); }
|
|
45
|
+
svg .th { font-family: var(--font-sans); font-size: 14px; font-weight: 500; fill: var(--p); }
|
|
46
|
+
|
|
47
|
+
/* Neutral box */
|
|
48
|
+
svg .box { fill: var(--bg2); stroke: var(--b); }
|
|
49
|
+
|
|
50
|
+
/* Clickable node */
|
|
51
|
+
svg .node { cursor: pointer; }
|
|
52
|
+
svg .node:hover { opacity: 0.8; }
|
|
53
|
+
|
|
54
|
+
/* Arrow connector */
|
|
55
|
+
svg .arr { stroke: var(--t); stroke-width: 1.5; fill: none; }
|
|
56
|
+
|
|
57
|
+
/* Leader line */
|
|
58
|
+
svg .leader { stroke: var(--t); stroke-width: 0.5; stroke-dasharray: 4 3; fill: none; }
|
|
59
|
+
|
|
60
|
+
/* ── Color ramp classes ──────────────────────────────────────────────────
|
|
61
|
+
Dark mode: 800 fill, 200 stroke, 100 title (.th/.t), 200 subtitle (.ts)
|
|
62
|
+
Applied via direct-child selectors (>) as documented in guidelines.
|
|
63
|
+
Also supports applying c-* directly on shape elements. */
|
|
64
|
+
|
|
65
|
+
/* Purple: 800=#3C3489, 200=#AFA9EC, 100=#CECBF6 */
|
|
66
|
+
svg .c-purple > rect, svg .c-purple > circle, svg .c-purple > ellipse { fill: #3C3489; stroke: #AFA9EC; }
|
|
67
|
+
svg .c-purple > .th, svg .c-purple > .t { fill: #CECBF6; }
|
|
68
|
+
svg .c-purple > .ts { fill: #AFA9EC; }
|
|
69
|
+
svg rect.c-purple, svg circle.c-purple, svg ellipse.c-purple { fill: #3C3489; stroke: #AFA9EC; }
|
|
70
|
+
|
|
71
|
+
/* Teal: 800=#085041, 200=#5DCAA5, 100=#9FE1CB */
|
|
72
|
+
svg .c-teal > rect, svg .c-teal > circle, svg .c-teal > ellipse { fill: #085041; stroke: #5DCAA5; }
|
|
73
|
+
svg .c-teal > .th, svg .c-teal > .t { fill: #9FE1CB; }
|
|
74
|
+
svg .c-teal > .ts { fill: #5DCAA5; }
|
|
75
|
+
svg rect.c-teal, svg circle.c-teal, svg ellipse.c-teal { fill: #085041; stroke: #5DCAA5; }
|
|
76
|
+
|
|
77
|
+
/* Coral: 800=#712B13, 200=#F0997B, 100=#F5C4B3 */
|
|
78
|
+
svg .c-coral > rect, svg .c-coral > circle, svg .c-coral > ellipse { fill: #712B13; stroke: #F0997B; }
|
|
79
|
+
svg .c-coral > .th, svg .c-coral > .t { fill: #F5C4B3; }
|
|
80
|
+
svg .c-coral > .ts { fill: #F0997B; }
|
|
81
|
+
svg rect.c-coral, svg circle.c-coral, svg ellipse.c-coral { fill: #712B13; stroke: #F0997B; }
|
|
82
|
+
|
|
83
|
+
/* Pink: 800=#72243E, 200=#ED93B1, 100=#F4C0D1 */
|
|
84
|
+
svg .c-pink > rect, svg .c-pink > circle, svg .c-pink > ellipse { fill: #72243E; stroke: #ED93B1; }
|
|
85
|
+
svg .c-pink > .th, svg .c-pink > .t { fill: #F4C0D1; }
|
|
86
|
+
svg .c-pink > .ts { fill: #ED93B1; }
|
|
87
|
+
svg rect.c-pink, svg circle.c-pink, svg ellipse.c-pink { fill: #72243E; stroke: #ED93B1; }
|
|
88
|
+
|
|
89
|
+
/* Gray: 800=#444441, 200=#B4B2A9, 100=#D3D1C7 */
|
|
90
|
+
svg .c-gray > rect, svg .c-gray > circle, svg .c-gray > ellipse { fill: #444441; stroke: #B4B2A9; }
|
|
91
|
+
svg .c-gray > .th, svg .c-gray > .t { fill: #D3D1C7; }
|
|
92
|
+
svg .c-gray > .ts { fill: #B4B2A9; }
|
|
93
|
+
svg rect.c-gray, svg circle.c-gray, svg ellipse.c-gray { fill: #444441; stroke: #B4B2A9; }
|
|
94
|
+
|
|
95
|
+
/* Blue: 800=#0C447C, 200=#85B7EB, 100=#B5D4F4 */
|
|
96
|
+
svg .c-blue > rect, svg .c-blue > circle, svg .c-blue > ellipse { fill: #0C447C; stroke: #85B7EB; }
|
|
97
|
+
svg .c-blue > .th, svg .c-blue > .t { fill: #B5D4F4; }
|
|
98
|
+
svg .c-blue > .ts { fill: #85B7EB; }
|
|
99
|
+
svg rect.c-blue, svg circle.c-blue, svg ellipse.c-blue { fill: #0C447C; stroke: #85B7EB; }
|
|
100
|
+
|
|
101
|
+
/* Green: 800=#27500A, 200=#97C459, 100=#C0DD97 */
|
|
102
|
+
svg .c-green > rect, svg .c-green > circle, svg .c-green > ellipse { fill: #27500A; stroke: #97C459; }
|
|
103
|
+
svg .c-green > .th, svg .c-green > .t { fill: #C0DD97; }
|
|
104
|
+
svg .c-green > .ts { fill: #97C459; }
|
|
105
|
+
svg rect.c-green, svg circle.c-green, svg ellipse.c-green { fill: #27500A; stroke: #97C459; }
|
|
106
|
+
|
|
107
|
+
/* Amber: 800=#633806, 200=#EF9F27, 100=#FAC775 */
|
|
108
|
+
svg .c-amber > rect, svg .c-amber > circle, svg .c-amber > ellipse { fill: #633806; stroke: #EF9F27; }
|
|
109
|
+
svg .c-amber > .th, svg .c-amber > .t { fill: #FAC775; }
|
|
110
|
+
svg .c-amber > .ts { fill: #EF9F27; }
|
|
111
|
+
svg rect.c-amber, svg circle.c-amber, svg ellipse.c-amber { fill: #633806; stroke: #EF9F27; }
|
|
112
|
+
|
|
113
|
+
/* Red: 800=#791F1F, 200=#F09595, 100=#F7C1C1 */
|
|
114
|
+
svg .c-red > rect, svg .c-red > circle, svg .c-red > ellipse { fill: #791F1F; stroke: #F09595; }
|
|
115
|
+
svg .c-red > .th, svg .c-red > .t { fill: #F7C1C1; }
|
|
116
|
+
svg .c-red > .ts { fill: #F09595; }
|
|
117
|
+
svg rect.c-red, svg circle.c-red, svg ellipse.c-red { fill: #791F1F; stroke: #F09595; }
|
|
118
|
+
|
|
119
|
+
/* Pre-styled form elements */
|
|
120
|
+
button {
|
|
121
|
+
background: transparent;
|
|
122
|
+
border: 0.5px solid var(--color-border-secondary);
|
|
123
|
+
border-radius: var(--border-radius-md);
|
|
124
|
+
color: var(--color-text-primary);
|
|
125
|
+
padding: 6px 14px;
|
|
126
|
+
font-size: 14px;
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
font-family: var(--font-sans);
|
|
129
|
+
}
|
|
130
|
+
button:hover { background: var(--color-background-secondary); }
|
|
131
|
+
button:active { transform: scale(0.98); }
|
|
132
|
+
|
|
133
|
+
input[type="range"] {
|
|
134
|
+
-webkit-appearance: none;
|
|
135
|
+
height: 4px;
|
|
136
|
+
background: var(--color-border-secondary);
|
|
137
|
+
border-radius: 2px;
|
|
138
|
+
outline: none;
|
|
139
|
+
}
|
|
140
|
+
input[type="range"]::-webkit-slider-thumb {
|
|
141
|
+
-webkit-appearance: none;
|
|
142
|
+
width: 18px;
|
|
143
|
+
height: 18px;
|
|
144
|
+
border-radius: 50%;
|
|
145
|
+
background: var(--color-text-primary);
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
input[type="text"], input[type="number"], textarea, select {
|
|
150
|
+
height: 36px;
|
|
151
|
+
background: var(--color-background-primary);
|
|
152
|
+
border: 0.5px solid var(--color-border-tertiary);
|
|
153
|
+
border-radius: var(--border-radius-md);
|
|
154
|
+
color: var(--color-text-primary);
|
|
155
|
+
padding: 0 10px;
|
|
156
|
+
font-size: 14px;
|
|
157
|
+
font-family: var(--font-sans);
|
|
158
|
+
outline: none;
|
|
159
|
+
}
|
|
160
|
+
input[type="text"]:hover, input[type="number"]:hover, textarea:hover, select:hover {
|
|
161
|
+
border-color: var(--color-border-secondary);
|
|
162
|
+
}
|
|
163
|
+
input[type="text"]:focus, input[type="number"]:focus, textarea:focus, select:focus {
|
|
164
|
+
border-color: var(--color-border-primary);
|
|
165
|
+
box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
|
|
166
|
+
}
|
|
167
|
+
`;
|