@epoch32/visage 0.0.0 → 1.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/dist/api/client.d.ts +5 -0
- package/dist/api/file-router.d.ts +29 -0
- package/dist/api/handler.d.ts +15 -0
- package/dist/api/index.d.ts +12 -0
- package/dist/{src/api → api}/index.js +87 -2
- package/dist/api/middleware.d.ts +11 -0
- package/dist/api/pragma.d.ts +21 -0
- package/dist/api/procedure.d.ts +66 -0
- package/dist/api/types.d.ts +181 -0
- package/dist/charts/Area.d.ts +18 -0
- package/dist/charts/Axis.d.ts +21 -0
- package/dist/charts/Bar.d.ts +10 -0
- package/dist/charts/CartesianGrid.d.ts +10 -0
- package/dist/charts/Chart.d.ts +16 -0
- package/dist/charts/Cursor.d.ts +8 -0
- package/dist/charts/Legend.d.ts +9 -0
- package/dist/charts/Line.d.ts +18 -0
- package/dist/charts/Pie.d.ts +12 -0
- package/dist/charts/Tooltip.d.ts +12 -0
- package/dist/charts/context.d.ts +20 -0
- package/dist/charts/index.d.ts +14 -0
- package/dist/{src/charts → charts}/index.js +87 -2
- package/dist/charts/path.d.ts +27 -0
- package/dist/charts/scale.d.ts +23 -0
- package/dist/charts/types.d.ts +43 -0
- package/dist/devtools/DomTab.d.ts +6 -0
- package/dist/devtools/GraphInspector.d.ts +11 -0
- package/dist/devtools/GraphTab.d.ts +10 -0
- package/dist/devtools/QueryTab.d.ts +10 -0
- package/dist/devtools/RpcTab.d.ts +10 -0
- package/dist/devtools/SignalsTab.d.ts +10 -0
- package/dist/devtools/component.d.ts +2 -0
- package/dist/devtools/highlighter.d.ts +2 -0
- package/dist/devtools/hub.d.ts +41 -0
- package/dist/devtools/index.d.ts +9 -0
- package/dist/{src/devtools → devtools}/index.js +87 -2
- package/dist/devtools/styles.d.ts +1 -0
- package/dist/devtools/types.d.ts +44 -0
- package/dist/dom/async.d.ts +41 -0
- package/dist/dom/control-flow.d.ts +53 -0
- package/dist/dom/index.d.ts +3 -0
- package/dist/{src/dom → dom}/index.js +87 -2
- package/dist/dom/lazy.d.ts +30 -0
- package/dist/dom/render.d.ts +23 -0
- package/dist/dom/resource.d.ts +34 -0
- package/dist/form/form.d.ts +41 -0
- package/dist/form/index.d.ts +2 -0
- package/dist/{src/form → form}/index.js +87 -2
- package/dist/form/schema.d.ts +96 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +3571 -1293
- package/dist/jsx-dev-runtime/index.d.ts +1 -0
- package/dist/jsx-runtime/index.d.ts +8 -0
- package/dist/{src/jsx-runtime → jsx-runtime}/index.js +87 -2
- package/dist/query/create-mutation.d.ts +3 -0
- package/dist/query/create-query.d.ts +4 -0
- package/dist/query/focus-manager.d.ts +14 -0
- package/dist/query/index.d.ts +9 -0
- package/dist/{src/query → query}/index.js +87 -2
- package/dist/query/mutation-cache.d.ts +24 -0
- package/dist/query/online-manager.d.ts +14 -0
- package/dist/query/query-cache.d.ts +69 -0
- package/dist/query/query-client.d.ts +46 -0
- package/dist/query/types.d.ts +131 -0
- package/dist/query/utils.d.ts +16 -0
- package/dist/router/index.d.ts +1 -0
- package/dist/{src/router → router}/index.js +87 -2
- package/dist/router/router.d.ts +91 -0
- package/dist/rpc/client.d.ts +2 -0
- package/dist/rpc/error.d.ts +16 -0
- package/dist/rpc/index.d.ts +7 -0
- package/dist/{src/rpc → rpc}/index.js +87 -2
- package/dist/rpc/procedure.d.ts +8 -0
- package/dist/rpc/router.d.ts +19 -0
- package/dist/rpc/server.d.ts +3 -0
- package/dist/rpc/types.d.ts +200 -0
- package/dist/server/hydrate.d.ts +5 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/{src/server → server}/index.js +87 -2
- package/dist/server/render-to-stream.d.ts +9 -0
- package/dist/server/render-to-string.d.ts +6 -0
- package/dist/signals/computed.d.ts +61 -0
- package/dist/signals/context.d.ts +44 -0
- package/dist/signals/effect.d.ts +56 -0
- package/dist/signals/index.d.ts +8 -0
- package/dist/{src/signals → signals}/index.js +87 -2
- package/dist/signals/scope.d.ts +61 -0
- package/dist/signals/signal.d.ts +40 -0
- package/dist/signals/store.d.ts +45 -0
- package/dist/signals/system.d.ts +56 -0
- package/dist/signals/types.d.ts +58 -0
- package/dist/style/component.d.ts +49 -0
- package/dist/style/create-style.d.ts +63 -0
- package/dist/style/cx.d.ts +18 -0
- package/dist/style/hash.d.ts +8 -0
- package/dist/style/index.d.ts +8 -0
- package/dist/{src/style → style}/index.js +87 -2
- package/dist/style/layout.d.ts +129 -0
- package/dist/style/manager.d.ts +31 -0
- package/dist/style/parser.d.ts +12 -0
- package/dist/style/scale.d.ts +82 -0
- package/dist/template/index.d.ts +1 -0
- package/dist/{src/template → template}/index.js +87 -2
- package/dist/template/template.d.ts +8 -0
- package/dist/ui/accordion.d.ts +81 -0
- package/dist/ui/command-dialog.d.ts +10 -0
- package/dist/ui/command.d.ts +103 -0
- package/dist/ui/data-table.d.ts +38 -0
- package/dist/ui/dialog.d.ts +102 -0
- package/dist/ui/dropdown-menu.d.ts +92 -0
- package/dist/ui/icon.d.ts +18 -0
- package/dist/ui/index.d.ts +14 -0
- package/dist/{src/ui → ui}/index.js +87 -2
- package/dist/ui/layout.d.ts +1 -0
- package/dist/ui/popover.d.ts +68 -0
- package/dist/ui/switch.d.ts +31 -0
- package/dist/ui/tabs.d.ts +71 -0
- package/dist/ui/toast.d.ts +91 -0
- package/dist/ui/tooltip.d.ts +64 -0
- package/dist/ui/utils.d.ts +21 -0
- package/dist/virtual/index.d.ts +2 -0
- package/dist/{src/virtual → virtual}/index.js +87 -2
- package/dist/virtual/virtual-list.d.ts +21 -0
- package/dist/virtual/virtualizer.d.ts +31 -0
- package/dist/vite/hmr.d.ts +7 -0
- package/dist/vite/index.d.ts +3 -0
- package/dist/vite/index.js +296 -15
- package/dist/vite/lucide.d.ts +27 -0
- package/dist/vite/plugin.d.ts +3 -0
- package/dist/vite/rpc-middleware.d.ts +5 -0
- package/dist/vite/types.d.ts +59 -0
- package/package.json +40 -40
- package/src/signals/index.ts +1 -0
- package/src/signals/signal.ts +110 -2
- package/src/signals/types.ts +9 -0
- package/src/vite/plugin.ts +4 -0
- package/dist/bundle.dev.js +0 -4875
- package/dist/src/index.js +0 -11826
- package/dist/src/vite/index.js +0 -984
package/dist/vite/index.js
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
+
// src/vite/lucide.ts
|
|
2
|
+
function parseNamedImports(importClause) {
|
|
3
|
+
return importClause.split(",").map((s) => s.trim()).filter(Boolean).map((item) => {
|
|
4
|
+
const parts = item.split(/\s+as\s+/).map((p) => p.trim());
|
|
5
|
+
const importedName = parts[0];
|
|
6
|
+
const localName = parts[1] ?? importedName;
|
|
7
|
+
return {
|
|
8
|
+
raw: item,
|
|
9
|
+
importedName,
|
|
10
|
+
localName
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function visageLucide(options = {}) {
|
|
15
|
+
const aliases = options.aliases ?? ["lucide-react"];
|
|
16
|
+
return {
|
|
17
|
+
name: "visage:lucide",
|
|
18
|
+
enforce: "pre",
|
|
19
|
+
config() {
|
|
20
|
+
return {
|
|
21
|
+
optimizeDeps: {
|
|
22
|
+
exclude: aliases
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
resolveId(id) {
|
|
27
|
+
if (aliases.includes(id)) {
|
|
28
|
+
return `\x00visage-lucide:${id}`;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
},
|
|
32
|
+
load(id) {
|
|
33
|
+
if (id.startsWith("\x00visage-lucide:")) {
|
|
34
|
+
return "export default {};";
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
},
|
|
38
|
+
transform(code, id) {
|
|
39
|
+
if (!id.match(/\.[jt]sx?$/) || id.includes("node_modules")) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
let transformed = code;
|
|
43
|
+
let hasMatches = false;
|
|
44
|
+
for (const alias of aliases) {
|
|
45
|
+
const regex = new RegExp(`import\\s*\\{([^}]+)\\}\\s*from\\s*['"]${alias}['"];?`, "g");
|
|
46
|
+
transformed = transformed.replace(regex, (_match, importClause) => {
|
|
47
|
+
const imports = parseNamedImports(importClause);
|
|
48
|
+
if (imports.length === 0)
|
|
49
|
+
return "";
|
|
50
|
+
hasMatches = true;
|
|
51
|
+
const lucideNamedImports = imports.map((imp) => `${imp.importedName} as __icon_node_${imp.importedName}`).join(", ");
|
|
52
|
+
const componentDeclarations = imports.map((imp) => {
|
|
53
|
+
return `const ${imp.localName} = /* @__PURE__ */ __visageCreateIcon("${imp.importedName}", __icon_node_${imp.importedName});`;
|
|
54
|
+
}).join(`
|
|
55
|
+
`);
|
|
56
|
+
return `import { createIcon as __visageCreateIcon } from "visage/ui";
|
|
57
|
+
import { ${lucideNamedImports} } from "lucide";
|
|
58
|
+
${componentDeclarations}`;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (!hasMatches) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
code: transformed,
|
|
66
|
+
map: null
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
1
71
|
// src/vite/hmr.ts
|
|
2
72
|
function transformHmr(code, id) {
|
|
3
73
|
if (!/\.[jt]sx$/.test(id) || id.includes("node_modules")) {
|
|
@@ -13,8 +83,8 @@ if (import.meta.hot) {
|
|
|
13
83
|
import.meta.hot.accept((newMod) => {
|
|
14
84
|
if (newMod) {
|
|
15
85
|
// Re-trigger reactive components without wiping signal stores
|
|
16
|
-
if (typeof window !== "undefined" &&
|
|
17
|
-
|
|
86
|
+
if (typeof window !== "undefined" && window.__VISAGE_DEVTOOLS__) {
|
|
87
|
+
window.__VISAGE_DEVTOOLS__.refresh?.();
|
|
18
88
|
}
|
|
19
89
|
}
|
|
20
90
|
});
|
|
@@ -22,7 +92,7 @@ if (import.meta.hot) {
|
|
|
22
92
|
`;
|
|
23
93
|
return {
|
|
24
94
|
code: `${code}
|
|
25
|
-
|
|
95
|
+
;${hmrFooter}`,
|
|
26
96
|
map: null
|
|
27
97
|
};
|
|
28
98
|
}
|
|
@@ -39,16 +109,46 @@ var ERROR_CODE_TO_STATUS = {
|
|
|
39
109
|
UNPROCESSABLE_CONTENT: 422,
|
|
40
110
|
INTERNAL_SERVER_ERROR: 500
|
|
41
111
|
};
|
|
112
|
+
var STATUS_TO_ERROR_CODE = {
|
|
113
|
+
400: "BAD_REQUEST",
|
|
114
|
+
401: "UNAUTHORIZED",
|
|
115
|
+
403: "FORBIDDEN",
|
|
116
|
+
404: "NOT_FOUND",
|
|
117
|
+
405: "METHOD_NOT_ALLOWED",
|
|
118
|
+
408: "TIMEOUT",
|
|
119
|
+
409: "CONFLICT",
|
|
120
|
+
422: "UNPROCESSABLE_CONTENT",
|
|
121
|
+
500: "INTERNAL_SERVER_ERROR"
|
|
122
|
+
};
|
|
123
|
+
|
|
42
124
|
class RPCError extends Error {
|
|
43
125
|
code;
|
|
44
126
|
status;
|
|
45
127
|
issues;
|
|
46
|
-
constructor(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
128
|
+
constructor(codeOrStatusOrOptions, message) {
|
|
129
|
+
if (typeof codeOrStatusOrOptions === "number") {
|
|
130
|
+
const code = STATUS_TO_ERROR_CODE[codeOrStatusOrOptions] || "INTERNAL_SERVER_ERROR";
|
|
131
|
+
super(message || code);
|
|
132
|
+
this.name = "RPCError";
|
|
133
|
+
this.code = code;
|
|
134
|
+
this.status = codeOrStatusOrOptions;
|
|
135
|
+
} else if (typeof codeOrStatusOrOptions === "string") {
|
|
136
|
+
super(message || codeOrStatusOrOptions);
|
|
137
|
+
this.name = "RPCError";
|
|
138
|
+
this.code = codeOrStatusOrOptions;
|
|
139
|
+
this.status = ERROR_CODE_TO_STATUS[codeOrStatusOrOptions] || 500;
|
|
140
|
+
} else {
|
|
141
|
+
super(codeOrStatusOrOptions.message ?? codeOrStatusOrOptions.code, {
|
|
142
|
+
cause: codeOrStatusOrOptions.cause
|
|
143
|
+
});
|
|
144
|
+
this.name = "RPCError";
|
|
145
|
+
this.code = codeOrStatusOrOptions.code;
|
|
146
|
+
this.status = ERROR_CODE_TO_STATUS[codeOrStatusOrOptions.code] ?? 500;
|
|
147
|
+
this.issues = codeOrStatusOrOptions.issues;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
get statusCode() {
|
|
151
|
+
return this.status;
|
|
52
152
|
}
|
|
53
153
|
}
|
|
54
154
|
|
|
@@ -71,6 +171,158 @@ class Schema {
|
|
|
71
171
|
}
|
|
72
172
|
};
|
|
73
173
|
}
|
|
174
|
+
|
|
175
|
+
class StringSchema extends Schema {
|
|
176
|
+
_min;
|
|
177
|
+
_max;
|
|
178
|
+
_emailMsg;
|
|
179
|
+
_regex;
|
|
180
|
+
_isOptional = false;
|
|
181
|
+
min(length, message) {
|
|
182
|
+
this._min = { val: length, msg: message };
|
|
183
|
+
return this;
|
|
184
|
+
}
|
|
185
|
+
max(length, message) {
|
|
186
|
+
this._max = { val: length, msg: message };
|
|
187
|
+
return this;
|
|
188
|
+
}
|
|
189
|
+
email(message) {
|
|
190
|
+
this._emailMsg = message ?? "Invalid email address";
|
|
191
|
+
return this;
|
|
192
|
+
}
|
|
193
|
+
regex(pattern, message) {
|
|
194
|
+
this._regex = { pattern, msg: message };
|
|
195
|
+
return this;
|
|
196
|
+
}
|
|
197
|
+
optional() {
|
|
198
|
+
this._isOptional = true;
|
|
199
|
+
return this;
|
|
200
|
+
}
|
|
201
|
+
validate(value, path = "") {
|
|
202
|
+
if (value === undefined || value === null || value === "") {
|
|
203
|
+
if (this._isOptional)
|
|
204
|
+
return { success: true, data: undefined };
|
|
205
|
+
return { success: false, issues: [{ path, message: "This field is required" }] };
|
|
206
|
+
}
|
|
207
|
+
if (typeof value !== "string") {
|
|
208
|
+
return { success: false, issues: [{ path, message: "Must be a string" }] };
|
|
209
|
+
}
|
|
210
|
+
if (this._min && value.length < this._min.val) {
|
|
211
|
+
return {
|
|
212
|
+
success: false,
|
|
213
|
+
issues: [{ path, message: this._min.msg ?? `Must be at least ${this._min.val} characters` }]
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
if (this._max && value.length > this._max.val) {
|
|
217
|
+
return {
|
|
218
|
+
success: false,
|
|
219
|
+
issues: [{ path, message: this._max.msg ?? `Must be at most ${this._max.val} characters` }]
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
if (this._emailMsg) {
|
|
223
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
224
|
+
if (!emailRegex.test(value)) {
|
|
225
|
+
return { success: false, issues: [{ path, message: this._emailMsg }] };
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (this._regex && !this._regex.pattern.test(value)) {
|
|
229
|
+
return {
|
|
230
|
+
success: false,
|
|
231
|
+
issues: [{ path, message: this._regex.msg ?? "Invalid format" }]
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
return { success: true, data: value };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
class NumberSchema extends Schema {
|
|
239
|
+
_min;
|
|
240
|
+
_max;
|
|
241
|
+
_integer;
|
|
242
|
+
_isOptional = false;
|
|
243
|
+
min(value, message) {
|
|
244
|
+
this._min = { val: value, msg: message };
|
|
245
|
+
return this;
|
|
246
|
+
}
|
|
247
|
+
max(value, message) {
|
|
248
|
+
this._max = { val: value, msg: message };
|
|
249
|
+
return this;
|
|
250
|
+
}
|
|
251
|
+
integer(message) {
|
|
252
|
+
this._integer = { msg: message };
|
|
253
|
+
return this;
|
|
254
|
+
}
|
|
255
|
+
optional() {
|
|
256
|
+
this._isOptional = true;
|
|
257
|
+
return this;
|
|
258
|
+
}
|
|
259
|
+
validate(value, path = "") {
|
|
260
|
+
if (value === undefined || value === null || value === "") {
|
|
261
|
+
if (this._isOptional)
|
|
262
|
+
return { success: true, data: undefined };
|
|
263
|
+
return { success: false, issues: [{ path, message: "This field is required" }] };
|
|
264
|
+
}
|
|
265
|
+
const num = Number(value);
|
|
266
|
+
if (Number.isNaN(num) || typeof value === "boolean") {
|
|
267
|
+
return { success: false, issues: [{ path, message: "Must be a valid number" }] };
|
|
268
|
+
}
|
|
269
|
+
if (this._integer && !Number.isInteger(num)) {
|
|
270
|
+
return {
|
|
271
|
+
success: false,
|
|
272
|
+
issues: [{ path, message: this._integer.msg ?? "Must be an integer" }]
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
if (this._min && num < this._min.val) {
|
|
276
|
+
return {
|
|
277
|
+
success: false,
|
|
278
|
+
issues: [{ path, message: this._min.msg ?? `Must be at least ${this._min.val}` }]
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
if (this._max && num > this._max.val) {
|
|
282
|
+
return {
|
|
283
|
+
success: false,
|
|
284
|
+
issues: [{ path, message: this._max.msg ?? `Must be at most ${this._max.val}` }]
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
return { success: true, data: num };
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
class BooleanSchema extends Schema {
|
|
292
|
+
validate(value, _path = "") {
|
|
293
|
+
return { success: true, data: Boolean(value) };
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
class ObjectSchema extends Schema {
|
|
298
|
+
shape;
|
|
299
|
+
constructor(shape) {
|
|
300
|
+
super();
|
|
301
|
+
this.shape = shape;
|
|
302
|
+
}
|
|
303
|
+
validate(value, basePath = "") {
|
|
304
|
+
if (typeof value !== "object" || value === null) {
|
|
305
|
+
return { success: false, issues: [{ path: basePath, message: "Must be an object" }] };
|
|
306
|
+
}
|
|
307
|
+
const issues = [];
|
|
308
|
+
const data = {};
|
|
309
|
+
for (const key in this.shape) {
|
|
310
|
+
const fieldSchema = this.shape[key];
|
|
311
|
+
const fieldVal = value[key];
|
|
312
|
+
const fieldPath = basePath ? `${basePath}.${key}` : key;
|
|
313
|
+
const res = validateWithSchema(fieldSchema, fieldVal, fieldPath);
|
|
314
|
+
if (res.success) {
|
|
315
|
+
data[key] = res.data;
|
|
316
|
+
} else if (res.issues) {
|
|
317
|
+
issues.push(...res.issues);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (issues.length > 0) {
|
|
321
|
+
return { success: false, issues };
|
|
322
|
+
}
|
|
323
|
+
return { success: true, data };
|
|
324
|
+
}
|
|
325
|
+
}
|
|
74
326
|
function validateWithSchema(schema, value, path = "") {
|
|
75
327
|
if (!schema)
|
|
76
328
|
return { success: true, data: value };
|
|
@@ -104,8 +356,23 @@ function validateWithSchema(schema, value, path = "") {
|
|
|
104
356
|
}
|
|
105
357
|
return { success: true, data: value };
|
|
106
358
|
}
|
|
359
|
+
var v = {
|
|
360
|
+
string: () => new StringSchema,
|
|
361
|
+
number: () => new NumberSchema,
|
|
362
|
+
boolean: () => new BooleanSchema,
|
|
363
|
+
object: (shape) => new ObjectSchema(shape)
|
|
364
|
+
};
|
|
107
365
|
|
|
108
366
|
// src/rpc/procedure.ts
|
|
367
|
+
function createProcedure(type, options, middlewares = []) {
|
|
368
|
+
return {
|
|
369
|
+
type,
|
|
370
|
+
inputSchema: options.input,
|
|
371
|
+
outputSchema: options.output,
|
|
372
|
+
middlewares: [...middlewares],
|
|
373
|
+
resolve: options.resolve
|
|
374
|
+
};
|
|
375
|
+
}
|
|
109
376
|
async function executeProcedure(procedure, opts) {
|
|
110
377
|
let input = opts.rawInput;
|
|
111
378
|
if (procedure.inputSchema) {
|
|
@@ -647,11 +914,18 @@ function visage(options = {}) {
|
|
|
647
914
|
return {
|
|
648
915
|
esbuild: {
|
|
649
916
|
jsx: "automatic",
|
|
650
|
-
jsxImportSource: "visage"
|
|
651
|
-
|
|
917
|
+
jsxImportSource: "visage"
|
|
918
|
+
},
|
|
919
|
+
oxc: {
|
|
920
|
+
jsx: {
|
|
921
|
+
runtime: "automatic",
|
|
922
|
+
importSource: "visage",
|
|
923
|
+
development: command === "serve"
|
|
924
|
+
}
|
|
652
925
|
},
|
|
653
926
|
optimizeDeps: {
|
|
654
|
-
|
|
927
|
+
exclude: [
|
|
928
|
+
"@epoch32/visage",
|
|
655
929
|
"visage",
|
|
656
930
|
"visage/signals",
|
|
657
931
|
"visage/dom",
|
|
@@ -661,11 +935,17 @@ function visage(options = {}) {
|
|
|
661
935
|
"visage/router",
|
|
662
936
|
"visage/form",
|
|
663
937
|
"visage/virtual",
|
|
664
|
-
"visage/devtools"
|
|
938
|
+
"visage/devtools",
|
|
939
|
+
"visage/api",
|
|
940
|
+
"visage/charts"
|
|
665
941
|
]
|
|
666
942
|
},
|
|
667
943
|
resolve: {
|
|
668
|
-
|
|
944
|
+
alias: [
|
|
945
|
+
{ find: /^visage\/(.*)/, replacement: "@epoch32/visage/$1" },
|
|
946
|
+
{ find: /^visage$/, replacement: "@epoch32/visage" }
|
|
947
|
+
],
|
|
948
|
+
dedupe: ["@epoch32/visage", "visage"]
|
|
669
949
|
}
|
|
670
950
|
};
|
|
671
951
|
}
|
|
@@ -703,5 +983,6 @@ function visage(options = {}) {
|
|
|
703
983
|
var plugin_default = visage;
|
|
704
984
|
export {
|
|
705
985
|
plugin_default as default,
|
|
706
|
-
visage
|
|
986
|
+
visage,
|
|
987
|
+
visageLucide
|
|
707
988
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { VisageVitePlugin } from "./types";
|
|
2
|
+
export interface VisageLucideOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Module aliases to intercept and translate.
|
|
5
|
+
* Defaults to `["lucide-react"]`.
|
|
6
|
+
*/
|
|
7
|
+
aliases?: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Official Visage Lucide Vite Plugin
|
|
11
|
+
*
|
|
12
|
+
* Statically transforms `import { Icon } from "lucide-react"` at build time into
|
|
13
|
+
* native, tree-shaken Visage SVG component instances using `createIcon` and `lucide`.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* ```ts
|
|
17
|
+
* // vite.config.ts
|
|
18
|
+
* import { defineConfig } from "vite";
|
|
19
|
+
* import visage, { visageLucide } from "visage/vite";
|
|
20
|
+
*
|
|
21
|
+
* export default defineConfig({
|
|
22
|
+
* plugins: [visage(), visageLucide()]
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function visageLucide(options?: VisageLucideOptions): VisageVitePlugin;
|
|
27
|
+
export default visageLucide;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { VisagePluginOptions } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Attach Visage RPC handler to Vite's Connect dev server middleware
|
|
4
|
+
*/
|
|
5
|
+
export declare function createViteRpcMiddleware(options: NonNullable<VisagePluginOptions["rpc"]>): (req: any, res: any, next: () => void) => Promise<void>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { createRouter } from "../rpc/router";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the Visage Vite Plugin
|
|
4
|
+
*/
|
|
5
|
+
export interface VisagePluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Automatically auto-inject Visage DevTools in development mode
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
|
+
devtools?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Enable Hot Module Replacement (HMR) with signal state preservation
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
hmr?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Extract static <Style> blocks into production CSS bundle
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
extractCss?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Enable Server-Side Rendering (SSR) pipeline
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
ssr?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Optional full-stack RPC router configuration for Vite dev server middleware
|
|
28
|
+
*/
|
|
29
|
+
rpc?: {
|
|
30
|
+
router: ReturnType<typeof createRouter<any>>;
|
|
31
|
+
endpoint?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Minimal interface representation of Vite Plugin to ensure zero hard runtime dependencies
|
|
36
|
+
*/
|
|
37
|
+
export interface VisageVitePlugin {
|
|
38
|
+
name: string;
|
|
39
|
+
enforce?: "pre" | "post";
|
|
40
|
+
apply?: "serve" | "build" | ((config: any, env: {
|
|
41
|
+
command: string;
|
|
42
|
+
mode: string;
|
|
43
|
+
}) => boolean);
|
|
44
|
+
config?: (config: any, env: any) => any;
|
|
45
|
+
configResolved?: (config: any) => void;
|
|
46
|
+
configureServer?: (server: any) => void | Promise<void>;
|
|
47
|
+
resolveId?: (source: string, importer?: string, options?: any) => Promise<string | null | undefined> | string | null | undefined;
|
|
48
|
+
load?: (id: string, options?: any) => Promise<string | null | undefined> | string | null | undefined;
|
|
49
|
+
transform?: (code: string, id: string, options?: {
|
|
50
|
+
ssr?: boolean;
|
|
51
|
+
}) => Promise<{
|
|
52
|
+
code: string;
|
|
53
|
+
map?: any;
|
|
54
|
+
} | null> | {
|
|
55
|
+
code: string;
|
|
56
|
+
map?: any;
|
|
57
|
+
} | null;
|
|
58
|
+
transformIndexHtml?: (html: string) => string | Promise<string>;
|
|
59
|
+
}
|
package/package.json
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epoch32/visage",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Lightning-fast, zero-VDOM, fine-grained reactive UI library with full TypeScript support",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./
|
|
7
|
-
"types": "./
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./
|
|
11
|
-
"import": "./
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"./signals": {
|
|
14
|
-
"types": "./
|
|
15
|
-
"import": "./
|
|
14
|
+
"types": "./dist/signals/index.d.ts",
|
|
15
|
+
"import": "./dist/signals/index.js"
|
|
16
16
|
},
|
|
17
17
|
"./dom": {
|
|
18
|
-
"types": "./
|
|
19
|
-
"import": "./
|
|
18
|
+
"types": "./dist/dom/index.d.ts",
|
|
19
|
+
"import": "./dist/dom/index.js"
|
|
20
20
|
},
|
|
21
21
|
"./router": {
|
|
22
|
-
"types": "./
|
|
23
|
-
"import": "./
|
|
22
|
+
"types": "./dist/router/index.d.ts",
|
|
23
|
+
"import": "./dist/router/index.js"
|
|
24
24
|
},
|
|
25
25
|
"./template": {
|
|
26
|
-
"types": "./
|
|
27
|
-
"import": "./
|
|
26
|
+
"types": "./dist/template/index.d.ts",
|
|
27
|
+
"import": "./dist/template/index.js"
|
|
28
28
|
},
|
|
29
29
|
"./server": {
|
|
30
|
-
"types": "./
|
|
31
|
-
"import": "./
|
|
30
|
+
"types": "./dist/server/index.d.ts",
|
|
31
|
+
"import": "./dist/server/index.js"
|
|
32
32
|
},
|
|
33
33
|
"./form": {
|
|
34
|
-
"types": "./
|
|
35
|
-
"import": "./
|
|
34
|
+
"types": "./dist/form/index.d.ts",
|
|
35
|
+
"import": "./dist/form/index.js"
|
|
36
36
|
},
|
|
37
37
|
"./virtual": {
|
|
38
|
-
"types": "./
|
|
39
|
-
"import": "./
|
|
38
|
+
"types": "./dist/virtual/index.d.ts",
|
|
39
|
+
"import": "./dist/virtual/index.js"
|
|
40
40
|
},
|
|
41
41
|
"./query": {
|
|
42
|
-
"types": "./
|
|
43
|
-
"import": "./
|
|
42
|
+
"types": "./dist/query/index.d.ts",
|
|
43
|
+
"import": "./dist/query/index.js"
|
|
44
44
|
},
|
|
45
45
|
"./rpc": {
|
|
46
|
-
"types": "./
|
|
47
|
-
"import": "./
|
|
46
|
+
"types": "./dist/rpc/index.d.ts",
|
|
47
|
+
"import": "./dist/rpc/index.js"
|
|
48
48
|
},
|
|
49
49
|
"./api": {
|
|
50
|
-
"types": "./
|
|
51
|
-
"import": "./
|
|
50
|
+
"types": "./dist/api/index.d.ts",
|
|
51
|
+
"import": "./dist/api/index.js"
|
|
52
52
|
},
|
|
53
53
|
"./style": {
|
|
54
|
-
"types": "./
|
|
55
|
-
"import": "./
|
|
54
|
+
"types": "./dist/style/index.d.ts",
|
|
55
|
+
"import": "./dist/style/index.js"
|
|
56
56
|
},
|
|
57
57
|
"./devtools": {
|
|
58
|
-
"types": "./
|
|
59
|
-
"import": "./
|
|
58
|
+
"types": "./dist/devtools/index.d.ts",
|
|
59
|
+
"import": "./dist/devtools/index.js"
|
|
60
60
|
},
|
|
61
61
|
"./vite": {
|
|
62
|
-
"types": "./
|
|
63
|
-
"import": "./
|
|
62
|
+
"types": "./dist/vite/index.d.ts",
|
|
63
|
+
"import": "./dist/vite/index.js"
|
|
64
64
|
},
|
|
65
65
|
"./ui": {
|
|
66
|
-
"types": "./
|
|
67
|
-
"import": "./
|
|
66
|
+
"types": "./dist/ui/index.d.ts",
|
|
67
|
+
"import": "./dist/ui/index.js"
|
|
68
68
|
},
|
|
69
69
|
"./charts": {
|
|
70
|
-
"types": "./
|
|
71
|
-
"import": "./
|
|
70
|
+
"types": "./dist/charts/index.d.ts",
|
|
71
|
+
"import": "./dist/charts/index.js"
|
|
72
72
|
},
|
|
73
73
|
"./jsx-runtime": {
|
|
74
|
-
"types": "./
|
|
75
|
-
"import": "./
|
|
74
|
+
"types": "./dist/jsx-runtime/index.d.ts",
|
|
75
|
+
"import": "./dist/jsx-runtime/index.js"
|
|
76
76
|
},
|
|
77
77
|
"./jsx-dev-runtime": {
|
|
78
|
-
"types": "./
|
|
79
|
-
"import": "./
|
|
78
|
+
"types": "./dist/jsx-runtime/index.d.ts",
|
|
79
|
+
"import": "./dist/jsx-runtime/index.js"
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"sideEffects": false,
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"package.json"
|
|
101
101
|
],
|
|
102
102
|
"scripts": {
|
|
103
|
-
"build": "bun build src/index.ts src/signals/index.ts src/dom/index.ts src/template/index.ts src/api/index.ts src/rpc/index.ts src/query/index.ts src/style/index.ts src/devtools/index.ts src/ui/index.ts src/virtual/index.ts src/form/index.ts src/server/index.ts src/router/index.ts src/vite/index.ts src/jsx-runtime/index.ts src/charts/index.ts --outdir dist/",
|
|
103
|
+
"build": "bun build src/index.ts src/signals/index.ts src/dom/index.ts src/template/index.ts src/api/index.ts src/rpc/index.ts src/query/index.ts src/style/index.ts src/devtools/index.ts src/ui/index.ts src/virtual/index.ts src/form/index.ts src/server/index.ts src/router/index.ts src/vite/index.ts src/jsx-runtime/index.ts src/charts/index.ts --root src --outdir dist/ && bun x tsc -p tsconfig.build.json",
|
|
104
104
|
"test": "bun test",
|
|
105
105
|
"test:watch": "bun test --watch",
|
|
106
106
|
"test:coverage": "bun test --coverage",
|