elit 2.0.1 → 3.0.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/README.md +275 -128
- package/dist/build.d.mts +10 -1
- package/dist/build.d.ts +10 -1
- package/dist/build.js +670 -1
- package/dist/build.mjs +641 -1
- package/dist/chokidar.d.mts +134 -0
- package/dist/chokidar.d.ts +134 -0
- package/dist/chokidar.js +240 -0
- package/dist/chokidar.mjs +221 -0
- package/dist/cli.js +2792 -495
- package/dist/dom.d.mts +10 -3
- package/dist/dom.d.ts +10 -3
- package/dist/dom.js +676 -1
- package/dist/dom.mjs +647 -1
- package/dist/el.d.mts +16 -36
- package/dist/el.d.ts +16 -36
- package/dist/el.js +789 -1
- package/dist/el.mjs +583 -1
- package/dist/fs.d.mts +255 -0
- package/dist/fs.d.ts +255 -0
- package/dist/fs.js +513 -0
- package/dist/fs.mjs +469 -0
- package/dist/hmr.js +112 -1
- package/dist/hmr.mjs +91 -1
- package/dist/http.d.mts +163 -0
- package/dist/http.d.ts +163 -0
- package/dist/http.js +632 -0
- package/dist/http.mjs +605 -0
- package/dist/https.d.mts +108 -0
- package/dist/https.d.ts +108 -0
- package/dist/https.js +907 -0
- package/dist/https.mjs +901 -0
- package/dist/index.d.mts +613 -33
- package/dist/index.d.ts +613 -33
- package/dist/index.js +2589 -1
- package/dist/index.mjs +2312 -1
- package/dist/mime-types.d.mts +48 -0
- package/dist/mime-types.d.ts +48 -0
- package/dist/mime-types.js +197 -0
- package/dist/mime-types.mjs +166 -0
- package/dist/path.d.mts +163 -0
- package/dist/path.d.ts +163 -0
- package/dist/path.js +350 -0
- package/dist/path.mjs +310 -0
- package/dist/router.d.mts +3 -1
- package/dist/router.d.ts +3 -1
- package/dist/router.js +830 -1
- package/dist/router.mjs +801 -1
- package/dist/runtime.d.mts +97 -0
- package/dist/runtime.d.ts +97 -0
- package/dist/runtime.js +43 -0
- package/dist/runtime.mjs +15 -0
- package/dist/server.d.mts +5 -1
- package/dist/server.d.ts +5 -1
- package/dist/server.js +3267 -1
- package/dist/server.mjs +3241 -1
- package/dist/state.d.mts +3 -1
- package/dist/state.d.ts +3 -1
- package/dist/state.js +1036 -1
- package/dist/state.mjs +992 -1
- package/dist/style.d.mts +47 -1
- package/dist/style.d.ts +47 -1
- package/dist/style.js +551 -1
- package/dist/style.mjs +483 -1
- package/dist/{types-DOAdFFJB.d.ts → types-C0nGi6MX.d.mts} +29 -13
- package/dist/{types-DOAdFFJB.d.mts → types-Du6kfwTm.d.ts} +29 -13
- package/dist/types.d.mts +452 -3
- package/dist/types.d.ts +452 -3
- package/dist/types.js +18 -1
- package/dist/ws.d.mts +195 -0
- package/dist/ws.d.ts +195 -0
- package/dist/ws.js +380 -0
- package/dist/ws.mjs +358 -0
- package/dist/wss.d.mts +108 -0
- package/dist/wss.d.ts +108 -0
- package/dist/wss.js +1306 -0
- package/dist/wss.mjs +1300 -0
- package/package.json +53 -6
- package/dist/client.d.mts +0 -9
- package/dist/client.d.ts +0 -9
- package/dist/client.js +0 -1
- package/dist/client.mjs +0 -1
package/dist/style.mjs
CHANGED
|
@@ -1 +1,483 @@
|
|
|
1
|
-
|
|
1
|
+
// src/style.ts
|
|
2
|
+
var CreateStyle = class {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.variables = [];
|
|
5
|
+
this.rules = [];
|
|
6
|
+
this.mediaRules = [];
|
|
7
|
+
this.keyframes = [];
|
|
8
|
+
this.fontFaces = [];
|
|
9
|
+
this.imports = [];
|
|
10
|
+
this.containerRules = [];
|
|
11
|
+
this.supportsRules = [];
|
|
12
|
+
this.layerRules = [];
|
|
13
|
+
this._layerOrder = [];
|
|
14
|
+
}
|
|
15
|
+
// CSS Variables
|
|
16
|
+
addVar(name, value) {
|
|
17
|
+
const cssVar = {
|
|
18
|
+
name: name.startsWith("--") ? name : `--${name}`,
|
|
19
|
+
value,
|
|
20
|
+
toString() {
|
|
21
|
+
return `var(${this.name})`;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
this.variables.push(cssVar);
|
|
25
|
+
return cssVar;
|
|
26
|
+
}
|
|
27
|
+
var(variable, fallback) {
|
|
28
|
+
const varName = typeof variable === "string" ? variable.startsWith("--") ? variable : `--${variable}` : variable.name;
|
|
29
|
+
return fallback ? `var(${varName}, ${fallback})` : `var(${varName})`;
|
|
30
|
+
}
|
|
31
|
+
// Basic Selectors
|
|
32
|
+
addTag(tag, styles2) {
|
|
33
|
+
const rule = { selector: tag, styles: styles2, type: "tag" };
|
|
34
|
+
this.rules.push(rule);
|
|
35
|
+
return rule;
|
|
36
|
+
}
|
|
37
|
+
addClass(name, styles2) {
|
|
38
|
+
const selector = name.startsWith(".") ? name : `.${name}`;
|
|
39
|
+
const rule = { selector, styles: styles2, type: "class" };
|
|
40
|
+
this.rules.push(rule);
|
|
41
|
+
return rule;
|
|
42
|
+
}
|
|
43
|
+
addId(name, styles2) {
|
|
44
|
+
const selector = name.startsWith("#") ? name : `#${name}`;
|
|
45
|
+
const rule = { selector, styles: styles2, type: "id" };
|
|
46
|
+
this.rules.push(rule);
|
|
47
|
+
return rule;
|
|
48
|
+
}
|
|
49
|
+
// Pseudo Selectors
|
|
50
|
+
addPseudoClass(pseudo, styles2, baseSelector) {
|
|
51
|
+
const pseudoClass = pseudo.startsWith(":") ? pseudo : `:${pseudo}`;
|
|
52
|
+
const selector = baseSelector ? `${baseSelector}${pseudoClass}` : pseudoClass;
|
|
53
|
+
const rule = { selector, styles: styles2, type: "pseudo-class" };
|
|
54
|
+
this.rules.push(rule);
|
|
55
|
+
return rule;
|
|
56
|
+
}
|
|
57
|
+
addPseudoElement(pseudo, styles2, baseSelector) {
|
|
58
|
+
const pseudoElement = pseudo.startsWith("::") ? pseudo : `::${pseudo}`;
|
|
59
|
+
const selector = baseSelector ? `${baseSelector}${pseudoElement}` : pseudoElement;
|
|
60
|
+
const rule = { selector, styles: styles2, type: "pseudo-element" };
|
|
61
|
+
this.rules.push(rule);
|
|
62
|
+
return rule;
|
|
63
|
+
}
|
|
64
|
+
// Attribute Selectors
|
|
65
|
+
addAttribute(attr, styles2, baseSelector) {
|
|
66
|
+
const attrSelector = attr.startsWith("[") ? attr : `[${attr}]`;
|
|
67
|
+
const selector = baseSelector ? `${baseSelector}${attrSelector}` : attrSelector;
|
|
68
|
+
const rule = { selector, styles: styles2, type: "attribute" };
|
|
69
|
+
this.rules.push(rule);
|
|
70
|
+
return rule;
|
|
71
|
+
}
|
|
72
|
+
attrEquals(attr, value, styles2, baseSelector) {
|
|
73
|
+
return this.addAttribute(`${attr}="${value}"`, styles2, baseSelector);
|
|
74
|
+
}
|
|
75
|
+
attrContainsWord(attr, value, styles2, baseSelector) {
|
|
76
|
+
return this.addAttribute(`${attr}~="${value}"`, styles2, baseSelector);
|
|
77
|
+
}
|
|
78
|
+
attrStartsWith(attr, value, styles2, baseSelector) {
|
|
79
|
+
return this.addAttribute(`${attr}^="${value}"`, styles2, baseSelector);
|
|
80
|
+
}
|
|
81
|
+
attrEndsWith(attr, value, styles2, baseSelector) {
|
|
82
|
+
return this.addAttribute(`${attr}$="${value}"`, styles2, baseSelector);
|
|
83
|
+
}
|
|
84
|
+
attrContains(attr, value, styles2, baseSelector) {
|
|
85
|
+
return this.addAttribute(`${attr}*="${value}"`, styles2, baseSelector);
|
|
86
|
+
}
|
|
87
|
+
// Combinator Selectors
|
|
88
|
+
descendant(ancestor, descendant2, styles2) {
|
|
89
|
+
return this.createAndAddRule(`${ancestor} ${descendant2}`, styles2);
|
|
90
|
+
}
|
|
91
|
+
child(parent, childSel, styles2) {
|
|
92
|
+
return this.createAndAddRule(`${parent} > ${childSel}`, styles2);
|
|
93
|
+
}
|
|
94
|
+
adjacentSibling(element, sibling, styles2) {
|
|
95
|
+
return this.createAndAddRule(`${element} + ${sibling}`, styles2);
|
|
96
|
+
}
|
|
97
|
+
generalSibling(element, sibling, styles2) {
|
|
98
|
+
return this.createAndAddRule(`${element} ~ ${sibling}`, styles2);
|
|
99
|
+
}
|
|
100
|
+
multiple(selectors, styles2) {
|
|
101
|
+
return this.createAndAddRule(selectors.join(", "), styles2);
|
|
102
|
+
}
|
|
103
|
+
// Nesting (BEM-style)
|
|
104
|
+
addName(name, styles2) {
|
|
105
|
+
const selector = name.startsWith("--") ? `&${name}` : `&--${name}`;
|
|
106
|
+
const rule = { selector, styles: styles2, type: "name" };
|
|
107
|
+
return rule;
|
|
108
|
+
}
|
|
109
|
+
nesting(parentRule, ...childRules) {
|
|
110
|
+
parentRule.nested = childRules;
|
|
111
|
+
return parentRule;
|
|
112
|
+
}
|
|
113
|
+
// @keyframes - Animations
|
|
114
|
+
keyframe(name, steps) {
|
|
115
|
+
const keyframeSteps = Object.entries(steps).map(([step, styles2]) => ({
|
|
116
|
+
step: step === "from" ? "from" : step === "to" ? "to" : `${step}%`,
|
|
117
|
+
styles: styles2
|
|
118
|
+
}));
|
|
119
|
+
const kf = { name, steps: keyframeSteps };
|
|
120
|
+
this.keyframes.push(kf);
|
|
121
|
+
return kf;
|
|
122
|
+
}
|
|
123
|
+
keyframeFromTo(name, from, to) {
|
|
124
|
+
return this.keyframe(name, { from, to });
|
|
125
|
+
}
|
|
126
|
+
// @font-face - Custom Fonts
|
|
127
|
+
fontFace(options) {
|
|
128
|
+
this.fontFaces.push(options);
|
|
129
|
+
return options;
|
|
130
|
+
}
|
|
131
|
+
// @import - Import Stylesheets
|
|
132
|
+
import(url, mediaQuery) {
|
|
133
|
+
const importRule = mediaQuery ? `@import url("${url}") ${mediaQuery};` : `@import url("${url}");`;
|
|
134
|
+
this.imports.push(importRule);
|
|
135
|
+
return importRule;
|
|
136
|
+
}
|
|
137
|
+
// @media - Media Queries
|
|
138
|
+
media(type, condition, rules) {
|
|
139
|
+
const mediaRule = { type, condition, rules: this.rulesToCSSRules(rules) };
|
|
140
|
+
this.mediaRules.push(mediaRule);
|
|
141
|
+
return mediaRule;
|
|
142
|
+
}
|
|
143
|
+
mediaScreen(condition, rules) {
|
|
144
|
+
return this.media("screen", condition, rules);
|
|
145
|
+
}
|
|
146
|
+
mediaPrint(rules) {
|
|
147
|
+
return this.media("print", "", rules);
|
|
148
|
+
}
|
|
149
|
+
mediaMinWidth(minWidth, rules) {
|
|
150
|
+
return this.media("screen", `min-width: ${minWidth}`, rules);
|
|
151
|
+
}
|
|
152
|
+
mediaMaxWidth(maxWidth, rules) {
|
|
153
|
+
return this.media("screen", `max-width: ${maxWidth}`, rules);
|
|
154
|
+
}
|
|
155
|
+
mediaDark(rules) {
|
|
156
|
+
const mediaRule = { type: "", condition: "prefers-color-scheme: dark", rules: this.rulesToCSSRules(rules) };
|
|
157
|
+
this.mediaRules.push(mediaRule);
|
|
158
|
+
return mediaRule;
|
|
159
|
+
}
|
|
160
|
+
mediaLight(rules) {
|
|
161
|
+
const mediaRule = { type: "", condition: "prefers-color-scheme: light", rules: this.rulesToCSSRules(rules) };
|
|
162
|
+
this.mediaRules.push(mediaRule);
|
|
163
|
+
return mediaRule;
|
|
164
|
+
}
|
|
165
|
+
mediaReducedMotion(rules) {
|
|
166
|
+
const mediaRule = { type: "", condition: "prefers-reduced-motion: reduce", rules: this.rulesToCSSRules(rules) };
|
|
167
|
+
this.mediaRules.push(mediaRule);
|
|
168
|
+
return mediaRule;
|
|
169
|
+
}
|
|
170
|
+
// @container - Container Queries
|
|
171
|
+
container(condition, rules, name) {
|
|
172
|
+
const containerRule = { name, condition, rules: this.rulesToCSSRules(rules) };
|
|
173
|
+
this.containerRules.push(containerRule);
|
|
174
|
+
return containerRule;
|
|
175
|
+
}
|
|
176
|
+
addContainer(name, styles2) {
|
|
177
|
+
const containerStyles = { ...styles2, containerName: name };
|
|
178
|
+
return this.addClass(name, containerStyles);
|
|
179
|
+
}
|
|
180
|
+
// @supports - Feature Queries
|
|
181
|
+
supports(condition, rules) {
|
|
182
|
+
const supportsRule = { condition, rules: this.rulesToCSSRules(rules) };
|
|
183
|
+
this.supportsRules.push(supportsRule);
|
|
184
|
+
return supportsRule;
|
|
185
|
+
}
|
|
186
|
+
// @layer - Cascade Layers
|
|
187
|
+
layerOrder(...layers) {
|
|
188
|
+
this._layerOrder = layers;
|
|
189
|
+
}
|
|
190
|
+
layer(name, rules) {
|
|
191
|
+
const layerRule = { name, rules: this.rulesToCSSRules(rules) };
|
|
192
|
+
this.layerRules.push(layerRule);
|
|
193
|
+
return layerRule;
|
|
194
|
+
}
|
|
195
|
+
// Custom Rules
|
|
196
|
+
add(rules) {
|
|
197
|
+
const cssRules = Object.entries(rules).map(([selector, styles2]) => {
|
|
198
|
+
const rule = { selector, styles: styles2, type: "custom" };
|
|
199
|
+
this.rules.push(rule);
|
|
200
|
+
return rule;
|
|
201
|
+
});
|
|
202
|
+
return cssRules;
|
|
203
|
+
}
|
|
204
|
+
important(value) {
|
|
205
|
+
return `${value} !important`;
|
|
206
|
+
}
|
|
207
|
+
// Utility Methods
|
|
208
|
+
toKebabCase(str) {
|
|
209
|
+
return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
210
|
+
}
|
|
211
|
+
// Helper: Create and add rule (eliminates duplication in combinator selectors)
|
|
212
|
+
createAndAddRule(selector, styles2, type = "custom") {
|
|
213
|
+
const rule = { selector, styles: styles2, type };
|
|
214
|
+
this.rules.push(rule);
|
|
215
|
+
return rule;
|
|
216
|
+
}
|
|
217
|
+
// Helper: Convert rules object to CSSRule array (eliminates duplication in media/container/supports/layer)
|
|
218
|
+
rulesToCSSRules(rules) {
|
|
219
|
+
return Object.entries(rules).map(([selector, styles2]) => ({
|
|
220
|
+
selector,
|
|
221
|
+
styles: styles2,
|
|
222
|
+
type: "custom"
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
// Helper: Render rules with indentation (eliminates duplication in render methods)
|
|
226
|
+
renderRulesWithIndent(rules, indent = " ") {
|
|
227
|
+
return rules.map((rule) => this.renderRule(rule, indent)).join("\n");
|
|
228
|
+
}
|
|
229
|
+
stylesToString(styles2, indent = " ") {
|
|
230
|
+
return Object.entries(styles2).map(([prop, value]) => {
|
|
231
|
+
const cssValue = typeof value === "object" && value !== null && "name" in value ? `var(${value.name})` : value;
|
|
232
|
+
return `${indent}${this.toKebabCase(prop)}: ${cssValue};`;
|
|
233
|
+
}).join("\n");
|
|
234
|
+
}
|
|
235
|
+
renderRule(rule, indent = "") {
|
|
236
|
+
let css = `${indent}${rule.selector} {
|
|
237
|
+
${this.stylesToString(rule.styles, indent + " ")}
|
|
238
|
+
`;
|
|
239
|
+
if (rule.nested && rule.nested.length > 0) {
|
|
240
|
+
for (const nestedRule of rule.nested) {
|
|
241
|
+
const nestedSelector = nestedRule.selector.startsWith("&") ? nestedRule.selector.replace(/&/g, rule.selector) : `${rule.selector} ${nestedRule.selector}`;
|
|
242
|
+
css += `
|
|
243
|
+
${indent}${nestedSelector} {
|
|
244
|
+
${this.stylesToString(nestedRule.styles, indent + " ")}
|
|
245
|
+
${indent}}
|
|
246
|
+
`;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
css += `${indent}}`;
|
|
250
|
+
return css;
|
|
251
|
+
}
|
|
252
|
+
renderMediaRule(media) {
|
|
253
|
+
const condition = media.type && media.condition ? `${media.type} and (${media.condition})` : media.type ? media.type : `(${media.condition})`;
|
|
254
|
+
return `@media ${condition} {
|
|
255
|
+
${this.renderRulesWithIndent(media.rules)}
|
|
256
|
+
}`;
|
|
257
|
+
}
|
|
258
|
+
renderKeyframes(kf) {
|
|
259
|
+
let css = `@keyframes ${kf.name} {
|
|
260
|
+
`;
|
|
261
|
+
for (const step of kf.steps) {
|
|
262
|
+
css += ` ${step.step} {
|
|
263
|
+
${this.stylesToString(step.styles, " ")}
|
|
264
|
+
}
|
|
265
|
+
`;
|
|
266
|
+
}
|
|
267
|
+
css += "}";
|
|
268
|
+
return css;
|
|
269
|
+
}
|
|
270
|
+
renderFontFace(ff) {
|
|
271
|
+
let css = "@font-face {\n";
|
|
272
|
+
css += ` font-family: "${ff.fontFamily}";
|
|
273
|
+
`;
|
|
274
|
+
css += ` src: ${ff.src};
|
|
275
|
+
`;
|
|
276
|
+
if (ff.fontWeight) css += ` font-weight: ${ff.fontWeight};
|
|
277
|
+
`;
|
|
278
|
+
if (ff.fontStyle) css += ` font-style: ${ff.fontStyle};
|
|
279
|
+
`;
|
|
280
|
+
if (ff.fontDisplay) css += ` font-display: ${ff.fontDisplay};
|
|
281
|
+
`;
|
|
282
|
+
if (ff.unicodeRange) css += ` unicode-range: ${ff.unicodeRange};
|
|
283
|
+
`;
|
|
284
|
+
css += "}";
|
|
285
|
+
return css;
|
|
286
|
+
}
|
|
287
|
+
renderContainerRule(container2) {
|
|
288
|
+
const nameStr = container2.name ? `${container2.name} ` : "";
|
|
289
|
+
return `@container ${nameStr}(${container2.condition}) {
|
|
290
|
+
${this.renderRulesWithIndent(container2.rules)}
|
|
291
|
+
}`;
|
|
292
|
+
}
|
|
293
|
+
renderSupportsRule(supports) {
|
|
294
|
+
return `@supports (${supports.condition}) {
|
|
295
|
+
${this.renderRulesWithIndent(supports.rules)}
|
|
296
|
+
}`;
|
|
297
|
+
}
|
|
298
|
+
renderLayerRule(layer2) {
|
|
299
|
+
return `@layer ${layer2.name} {
|
|
300
|
+
${this.renderRulesWithIndent(layer2.rules)}
|
|
301
|
+
}`;
|
|
302
|
+
}
|
|
303
|
+
// Render Output
|
|
304
|
+
render(...additionalRules) {
|
|
305
|
+
const parts = [];
|
|
306
|
+
if (this.imports.length > 0) {
|
|
307
|
+
parts.push(this.imports.join("\n"));
|
|
308
|
+
}
|
|
309
|
+
if (this._layerOrder.length > 0) {
|
|
310
|
+
parts.push(`@layer ${this._layerOrder.join(", ")};`);
|
|
311
|
+
}
|
|
312
|
+
if (this.variables.length > 0) {
|
|
313
|
+
const varDeclarations = this.variables.map((v) => ` ${v.name}: ${v.value};`).join("\n");
|
|
314
|
+
parts.push(`:root {
|
|
315
|
+
${varDeclarations}
|
|
316
|
+
}`);
|
|
317
|
+
}
|
|
318
|
+
for (const ff of this.fontFaces) {
|
|
319
|
+
parts.push(this.renderFontFace(ff));
|
|
320
|
+
}
|
|
321
|
+
for (const kf of this.keyframes) {
|
|
322
|
+
parts.push(this.renderKeyframes(kf));
|
|
323
|
+
}
|
|
324
|
+
const allRules = [...this.rules];
|
|
325
|
+
const allMediaRules = [...this.mediaRules];
|
|
326
|
+
const allKeyframes = [];
|
|
327
|
+
const allContainerRules = [...this.containerRules];
|
|
328
|
+
const allSupportsRules = [...this.supportsRules];
|
|
329
|
+
const allLayerRules = [...this.layerRules];
|
|
330
|
+
for (const item of additionalRules) {
|
|
331
|
+
if (!item) continue;
|
|
332
|
+
if (Array.isArray(item)) {
|
|
333
|
+
allRules.push(...item);
|
|
334
|
+
} else if ("condition" in item && "rules" in item && !("name" in item && "steps" in item)) {
|
|
335
|
+
if ("type" in item) {
|
|
336
|
+
allMediaRules.push(item);
|
|
337
|
+
} else if ("name" in item && typeof item.name === "string") {
|
|
338
|
+
allContainerRules.push(item);
|
|
339
|
+
} else {
|
|
340
|
+
allSupportsRules.push(item);
|
|
341
|
+
}
|
|
342
|
+
} else if ("name" in item && "steps" in item) {
|
|
343
|
+
allKeyframes.push(item);
|
|
344
|
+
} else if ("name" in item && "rules" in item) {
|
|
345
|
+
allLayerRules.push(item);
|
|
346
|
+
} else {
|
|
347
|
+
allRules.push(item);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
for (const kf of allKeyframes) {
|
|
351
|
+
parts.push(this.renderKeyframes(kf));
|
|
352
|
+
}
|
|
353
|
+
for (const layer2 of allLayerRules) {
|
|
354
|
+
parts.push(this.renderLayerRule(layer2));
|
|
355
|
+
}
|
|
356
|
+
for (const rule of allRules) {
|
|
357
|
+
parts.push(this.renderRule(rule));
|
|
358
|
+
}
|
|
359
|
+
for (const supports of allSupportsRules) {
|
|
360
|
+
parts.push(this.renderSupportsRule(supports));
|
|
361
|
+
}
|
|
362
|
+
for (const container2 of allContainerRules) {
|
|
363
|
+
parts.push(this.renderContainerRule(container2));
|
|
364
|
+
}
|
|
365
|
+
for (const media of allMediaRules) {
|
|
366
|
+
parts.push(this.renderMediaRule(media));
|
|
367
|
+
}
|
|
368
|
+
return parts.join("\n\n");
|
|
369
|
+
}
|
|
370
|
+
inject(styleId) {
|
|
371
|
+
const css = this.render();
|
|
372
|
+
const style = document.createElement("style");
|
|
373
|
+
if (styleId) style.id = styleId;
|
|
374
|
+
style.textContent = css;
|
|
375
|
+
document.head.appendChild(style);
|
|
376
|
+
return style;
|
|
377
|
+
}
|
|
378
|
+
clear() {
|
|
379
|
+
this.variables = [];
|
|
380
|
+
this.rules = [];
|
|
381
|
+
this.mediaRules = [];
|
|
382
|
+
this.keyframes = [];
|
|
383
|
+
this.fontFaces = [];
|
|
384
|
+
this.imports = [];
|
|
385
|
+
this.containerRules = [];
|
|
386
|
+
this.supportsRules = [];
|
|
387
|
+
this.layerRules = [];
|
|
388
|
+
this._layerOrder = [];
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
var styles = new CreateStyle();
|
|
392
|
+
var {
|
|
393
|
+
addVar,
|
|
394
|
+
var: getVar,
|
|
395
|
+
addTag,
|
|
396
|
+
addClass,
|
|
397
|
+
addId,
|
|
398
|
+
addPseudoClass,
|
|
399
|
+
addPseudoElement,
|
|
400
|
+
addAttribute,
|
|
401
|
+
attrEquals,
|
|
402
|
+
attrContainsWord,
|
|
403
|
+
attrStartsWith,
|
|
404
|
+
attrEndsWith,
|
|
405
|
+
attrContains,
|
|
406
|
+
descendant,
|
|
407
|
+
child: childStyle,
|
|
408
|
+
adjacentSibling,
|
|
409
|
+
generalSibling,
|
|
410
|
+
multiple: multipleStyle,
|
|
411
|
+
addName,
|
|
412
|
+
nesting,
|
|
413
|
+
keyframe,
|
|
414
|
+
keyframeFromTo,
|
|
415
|
+
fontFace,
|
|
416
|
+
import: importStyle,
|
|
417
|
+
media: mediaStyle,
|
|
418
|
+
mediaScreen,
|
|
419
|
+
mediaPrint,
|
|
420
|
+
mediaMinWidth,
|
|
421
|
+
mediaMaxWidth,
|
|
422
|
+
mediaDark,
|
|
423
|
+
mediaLight,
|
|
424
|
+
mediaReducedMotion,
|
|
425
|
+
container,
|
|
426
|
+
addContainer,
|
|
427
|
+
supports: supportsStyle,
|
|
428
|
+
layerOrder,
|
|
429
|
+
layer,
|
|
430
|
+
add: addStyle,
|
|
431
|
+
important,
|
|
432
|
+
render: renderStyle,
|
|
433
|
+
inject: injectStyle,
|
|
434
|
+
clear: clearStyle
|
|
435
|
+
} = styles;
|
|
436
|
+
var style_default = styles;
|
|
437
|
+
export {
|
|
438
|
+
CreateStyle,
|
|
439
|
+
addAttribute,
|
|
440
|
+
addClass,
|
|
441
|
+
addContainer,
|
|
442
|
+
addId,
|
|
443
|
+
addName,
|
|
444
|
+
addPseudoClass,
|
|
445
|
+
addPseudoElement,
|
|
446
|
+
addStyle,
|
|
447
|
+
addTag,
|
|
448
|
+
addVar,
|
|
449
|
+
adjacentSibling,
|
|
450
|
+
attrContains,
|
|
451
|
+
attrContainsWord,
|
|
452
|
+
attrEndsWith,
|
|
453
|
+
attrEquals,
|
|
454
|
+
attrStartsWith,
|
|
455
|
+
childStyle,
|
|
456
|
+
clearStyle,
|
|
457
|
+
container,
|
|
458
|
+
style_default as default,
|
|
459
|
+
descendant,
|
|
460
|
+
fontFace,
|
|
461
|
+
generalSibling,
|
|
462
|
+
getVar,
|
|
463
|
+
importStyle,
|
|
464
|
+
important,
|
|
465
|
+
injectStyle,
|
|
466
|
+
keyframe,
|
|
467
|
+
keyframeFromTo,
|
|
468
|
+
layer,
|
|
469
|
+
layerOrder,
|
|
470
|
+
mediaDark,
|
|
471
|
+
mediaLight,
|
|
472
|
+
mediaMaxWidth,
|
|
473
|
+
mediaMinWidth,
|
|
474
|
+
mediaPrint,
|
|
475
|
+
mediaReducedMotion,
|
|
476
|
+
mediaScreen,
|
|
477
|
+
mediaStyle,
|
|
478
|
+
multipleStyle,
|
|
479
|
+
nesting,
|
|
480
|
+
renderStyle,
|
|
481
|
+
styles,
|
|
482
|
+
supportsStyle
|
|
483
|
+
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { IncomingMessage, ServerResponse
|
|
2
|
-
import { WebSocket
|
|
1
|
+
import { IncomingMessage, ServerResponse } from './http.mjs';
|
|
2
|
+
import { WebSocket } from './ws.mjs';
|
|
3
|
+
import { Server } from 'http';
|
|
4
|
+
import { WebSocketServer } from 'ws';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Development server with HMR support
|
|
8
|
+
* Cross-runtime transpilation support
|
|
9
|
+
* - Node.js: uses esbuild
|
|
10
|
+
* - Bun: uses Bun.Transpiler
|
|
11
|
+
* - Deno: uses Deno.emit
|
|
6
12
|
*/
|
|
7
13
|
|
|
8
14
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD';
|
|
@@ -20,22 +26,22 @@ declare class ServerRouter {
|
|
|
20
26
|
private routes;
|
|
21
27
|
private middlewares;
|
|
22
28
|
use(middleware: Middleware): this;
|
|
23
|
-
get(path: string, handler: ServerRouteHandler)
|
|
24
|
-
post(path: string, handler: ServerRouteHandler)
|
|
25
|
-
put(path: string, handler: ServerRouteHandler)
|
|
26
|
-
delete(path: string, handler: ServerRouteHandler)
|
|
27
|
-
patch(path: string, handler: ServerRouteHandler)
|
|
28
|
-
options(path: string, handler: ServerRouteHandler)
|
|
29
|
+
get: (path: string, handler: ServerRouteHandler) => this;
|
|
30
|
+
post: (path: string, handler: ServerRouteHandler) => this;
|
|
31
|
+
put: (path: string, handler: ServerRouteHandler) => this;
|
|
32
|
+
delete: (path: string, handler: ServerRouteHandler) => this;
|
|
33
|
+
patch: (path: string, handler: ServerRouteHandler) => this;
|
|
34
|
+
options: (path: string, handler: ServerRouteHandler) => this;
|
|
29
35
|
private addRoute;
|
|
30
36
|
private pathToRegex;
|
|
31
37
|
private parseQuery;
|
|
32
38
|
private parseBody;
|
|
33
39
|
handle(req: IncomingMessage, res: ServerResponse): Promise<boolean>;
|
|
34
40
|
}
|
|
35
|
-
declare const json: (res: ServerResponse, data: any, status?: number) =>
|
|
36
|
-
declare const text: (res: ServerResponse, data: string, status?: number) =>
|
|
37
|
-
declare const html: (res: ServerResponse, data: string, status?: number) =>
|
|
38
|
-
declare const status: (res: ServerResponse, code: number, message?: string) =>
|
|
41
|
+
declare const json: (res: ServerResponse, data: any, status?: number) => ServerResponse;
|
|
42
|
+
declare const text: (res: ServerResponse, data: string, status?: number) => ServerResponse;
|
|
43
|
+
declare const html: (res: ServerResponse, data: string, status?: number) => ServerResponse;
|
|
44
|
+
declare const status: (res: ServerResponse, code: number, message?: string) => ServerResponse;
|
|
39
45
|
declare function cors(options?: {
|
|
40
46
|
origin?: string | string[];
|
|
41
47
|
methods?: string[];
|
|
@@ -165,6 +171,8 @@ interface ClientConfig {
|
|
|
165
171
|
root: string;
|
|
166
172
|
/** Base path for the client application (e.g., '/app1', '/app2') */
|
|
167
173
|
basePath: string;
|
|
174
|
+
/** Custom index file path (relative to root, e.g., './public/index.html') */
|
|
175
|
+
index?: string;
|
|
168
176
|
/** SSR render function - returns HTML VNode or string */
|
|
169
177
|
ssr?: () => Child | string;
|
|
170
178
|
/** Watch patterns for file changes */
|
|
@@ -179,6 +187,8 @@ interface ClientConfig {
|
|
|
179
187
|
api?: Router;
|
|
180
188
|
/** Custom middleware specific to this client */
|
|
181
189
|
middleware?: ((req: any, res: any, next: () => void) => void)[];
|
|
190
|
+
/** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
|
|
191
|
+
mode?: 'dev' | 'preview';
|
|
182
192
|
}
|
|
183
193
|
interface ProxyConfig {
|
|
184
194
|
/** Path prefix to match for proxying (e.g., '/api', '/graphql') */
|
|
@@ -211,6 +221,8 @@ interface DevServerOptions {
|
|
|
211
221
|
root?: string;
|
|
212
222
|
/** Base path for the client application (e.g., '/app1', '/app2') */
|
|
213
223
|
basePath?: string;
|
|
224
|
+
/** Custom index file path (relative to root, e.g., './public/index.html') */
|
|
225
|
+
index?: string;
|
|
214
226
|
/** Array of client configurations - allows multiple clients on same port */
|
|
215
227
|
clients?: ClientConfig[];
|
|
216
228
|
/** Enable HTTPS (default: false) */
|
|
@@ -233,6 +245,8 @@ interface DevServerOptions {
|
|
|
233
245
|
ssr?: () => Child | string;
|
|
234
246
|
/** Proxy configuration for API requests */
|
|
235
247
|
proxy?: ProxyConfig[];
|
|
248
|
+
/** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
|
|
249
|
+
mode?: 'dev' | 'preview';
|
|
236
250
|
}
|
|
237
251
|
interface DevServer {
|
|
238
252
|
/** HTTP server instance */
|
|
@@ -307,6 +321,8 @@ interface PreviewOptions {
|
|
|
307
321
|
root?: string;
|
|
308
322
|
/** Base path for the application (e.g., '/app') */
|
|
309
323
|
basePath?: string;
|
|
324
|
+
/** Custom index file path (relative to root, e.g., './public/index.html') */
|
|
325
|
+
index?: string;
|
|
310
326
|
/** Array of client configurations - allows multiple clients on same port */
|
|
311
327
|
clients?: ClientConfig[];
|
|
312
328
|
/** Enable HTTPS (default: false) */
|
|
@@ -327,4 +343,4 @@ interface PreviewOptions {
|
|
|
327
343
|
worker?: WorkerConfig[];
|
|
328
344
|
}
|
|
329
345
|
|
|
330
|
-
export {
|
|
346
|
+
export { security as A, type BuildOptions as B, type Children as C, type DevServerOptions as D, type ElementFactory as E, createProxyHandler as F, type StateChangeHandler as G, type HMRMessage as H, type SharedStateOptions as I, type JsonNode as J, SharedState as K, StateManager$1 as L, type Middleware as M, createDevServer as N, type Props as P, type RefCallback as R, type StateOptions as S, type VNode as V, type WorkerConfig as W, type Child as a, type State as b, type VirtualListController as c, type VNodeJson as d, type RefObject as e, type StateManager as f, type ClientConfig as g, type ProxyConfig as h, type DevServer as i, type BuildResult as j, type PreviewOptions as k, type HttpMethod as l, type ServerRouteContext as m, type ServerRouteHandler as n, ServerRouter as o, json as p, html as q, cors as r, status as s, text as t, logger as u, errorHandler as v, rateLimit as w, bodyLimit as x, cacheControl as y, compress as z };
|