@mochi-css/vanilla 5.0.0 → 6.0.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/config/index.d.mts +14 -8
- package/dist/config/index.d.ts +14 -8
- package/dist/config/index.js +42 -34
- package/dist/config/index.mjs +39 -24
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{src-CJmAtVxm.mjs → src-CNKPUUrl.mjs} +12 -23
- package/dist/{src-CGK_rB-l.js → src-CzESvndd.js} +15 -37
- package/package.json +8 -7
package/dist/config/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { OnDiagnostic
|
|
2
|
-
import {
|
|
1
|
+
import { OnDiagnostic } from "@mochi-css/core";
|
|
2
|
+
import { StyleExtractor, StyleGenerator } from "@mochi-css/plugins";
|
|
3
|
+
import { Config } from "@mochi-css/config";
|
|
3
4
|
import * as SWC from "@swc/core";
|
|
4
5
|
import { CallExpression, Expression } from "@swc/core";
|
|
5
6
|
|
|
@@ -8,7 +9,8 @@ declare class VanillaCssExtractor implements StyleExtractor {
|
|
|
8
9
|
private readonly extractor;
|
|
9
10
|
readonly importPath: string;
|
|
10
11
|
readonly symbolName: string;
|
|
11
|
-
|
|
12
|
+
private readonly mock;
|
|
13
|
+
constructor(importPath: string, symbolName: string, extractor: (call: CallExpression) => Expression[], mock: (...args: unknown[]) => unknown);
|
|
12
14
|
extractStaticArgs(call: CallExpression): Expression[];
|
|
13
15
|
startGeneration(onDiagnostic?: OnDiagnostic): StyleGenerator;
|
|
14
16
|
}
|
|
@@ -33,11 +35,13 @@ declare class VanillaGlobalCssExtractor implements StyleExtractor {
|
|
|
33
35
|
declare const mochiGlobalCssFunctionExtractor: VanillaGlobalCssExtractor;
|
|
34
36
|
//#endregion
|
|
35
37
|
//#region src/config/VanillaCssGenerator.d.ts
|
|
36
|
-
declare class VanillaCssGenerator
|
|
38
|
+
declare class VanillaCssGenerator extends StyleGenerator {
|
|
37
39
|
private readonly onDiagnostic?;
|
|
38
40
|
private readonly collectedStyles;
|
|
39
41
|
private generatedMochiCss;
|
|
40
|
-
|
|
42
|
+
private readonly mock;
|
|
43
|
+
constructor(mock: (...args: unknown[]) => unknown, onDiagnostic?: OnDiagnostic | undefined);
|
|
44
|
+
mockFunction(...args: unknown[]): unknown;
|
|
41
45
|
collectArgs(source: string, args: unknown[]): void;
|
|
42
46
|
generateStyles(): Promise<{
|
|
43
47
|
files: Record<string, string>;
|
|
@@ -49,10 +53,11 @@ declare class VanillaCssGenerator implements StyleGenerator {
|
|
|
49
53
|
}
|
|
50
54
|
//#endregion
|
|
51
55
|
//#region src/config/VanillaKeyframesGenerator.d.ts
|
|
52
|
-
declare class VanillaKeyframesGenerator
|
|
56
|
+
declare class VanillaKeyframesGenerator extends StyleGenerator {
|
|
53
57
|
private readonly onDiagnostic?;
|
|
54
58
|
private readonly collectedStyles;
|
|
55
59
|
constructor(onDiagnostic?: OnDiagnostic | undefined);
|
|
60
|
+
mockFunction(...args: unknown[]): unknown;
|
|
56
61
|
collectArgs(source: string, args: unknown[]): void;
|
|
57
62
|
generateStyles(): Promise<{
|
|
58
63
|
files: Record<string, string>;
|
|
@@ -60,10 +65,11 @@ declare class VanillaKeyframesGenerator implements StyleGenerator {
|
|
|
60
65
|
}
|
|
61
66
|
//#endregion
|
|
62
67
|
//#region src/config/VanillaGlobalCssGenerator.d.ts
|
|
63
|
-
declare class VanillaGlobalCssGenerator
|
|
68
|
+
declare class VanillaGlobalCssGenerator extends StyleGenerator {
|
|
64
69
|
private readonly onDiagnostic?;
|
|
65
70
|
private readonly collectedStyles;
|
|
66
71
|
constructor(onDiagnostic?: OnDiagnostic | undefined);
|
|
72
|
+
mockFunction(...args: unknown[]): unknown;
|
|
67
73
|
collectArgs(source: string, args: unknown[]): void;
|
|
68
74
|
generateStyles(): Promise<{
|
|
69
75
|
global: string;
|
|
@@ -75,4 +81,4 @@ declare function defineConfig(config: Partial<Config> & {
|
|
|
75
81
|
extractors?: StyleExtractor[];
|
|
76
82
|
}): Partial<Config>;
|
|
77
83
|
//#endregion
|
|
78
|
-
export { VanillaCssExtractor, VanillaCssGenerator, VanillaGlobalCssExtractor, VanillaGlobalCssGenerator, VanillaKeyframesExtractor, VanillaKeyframesGenerator, defineConfig, mochiCssFunctionExtractor, mochiGlobalCssFunctionExtractor, mochiKeyframesFunctionExtractor
|
|
84
|
+
export { VanillaCssExtractor, VanillaCssGenerator, VanillaGlobalCssExtractor, VanillaGlobalCssGenerator, VanillaKeyframesExtractor, VanillaKeyframesGenerator, defineConfig, mochiCssFunctionExtractor, mochiGlobalCssFunctionExtractor, mochiKeyframesFunctionExtractor };
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Config
|
|
1
|
+
import { StyleExtractor, StyleGenerator } from "@mochi-css/plugins";
|
|
2
|
+
import { Config } from "@mochi-css/config";
|
|
3
|
+
import { OnDiagnostic } from "@mochi-css/core";
|
|
3
4
|
import * as SWC from "@swc/core";
|
|
4
5
|
import { CallExpression, Expression } from "@swc/core";
|
|
5
6
|
|
|
@@ -8,7 +9,8 @@ declare class VanillaCssExtractor implements StyleExtractor {
|
|
|
8
9
|
private readonly extractor;
|
|
9
10
|
readonly importPath: string;
|
|
10
11
|
readonly symbolName: string;
|
|
11
|
-
|
|
12
|
+
private readonly mock;
|
|
13
|
+
constructor(importPath: string, symbolName: string, extractor: (call: CallExpression) => Expression[], mock: (...args: unknown[]) => unknown);
|
|
12
14
|
extractStaticArgs(call: CallExpression): Expression[];
|
|
13
15
|
startGeneration(onDiagnostic?: OnDiagnostic): StyleGenerator;
|
|
14
16
|
}
|
|
@@ -33,11 +35,13 @@ declare class VanillaGlobalCssExtractor implements StyleExtractor {
|
|
|
33
35
|
declare const mochiGlobalCssFunctionExtractor: VanillaGlobalCssExtractor;
|
|
34
36
|
//#endregion
|
|
35
37
|
//#region src/config/VanillaCssGenerator.d.ts
|
|
36
|
-
declare class VanillaCssGenerator
|
|
38
|
+
declare class VanillaCssGenerator extends StyleGenerator {
|
|
37
39
|
private readonly onDiagnostic?;
|
|
38
40
|
private readonly collectedStyles;
|
|
39
41
|
private generatedMochiCss;
|
|
40
|
-
|
|
42
|
+
private readonly mock;
|
|
43
|
+
constructor(mock: (...args: unknown[]) => unknown, onDiagnostic?: OnDiagnostic | undefined);
|
|
44
|
+
mockFunction(...args: unknown[]): unknown;
|
|
41
45
|
collectArgs(source: string, args: unknown[]): void;
|
|
42
46
|
generateStyles(): Promise<{
|
|
43
47
|
files: Record<string, string>;
|
|
@@ -49,10 +53,11 @@ declare class VanillaCssGenerator implements StyleGenerator {
|
|
|
49
53
|
}
|
|
50
54
|
//#endregion
|
|
51
55
|
//#region src/config/VanillaKeyframesGenerator.d.ts
|
|
52
|
-
declare class VanillaKeyframesGenerator
|
|
56
|
+
declare class VanillaKeyframesGenerator extends StyleGenerator {
|
|
53
57
|
private readonly onDiagnostic?;
|
|
54
58
|
private readonly collectedStyles;
|
|
55
59
|
constructor(onDiagnostic?: OnDiagnostic | undefined);
|
|
60
|
+
mockFunction(...args: unknown[]): unknown;
|
|
56
61
|
collectArgs(source: string, args: unknown[]): void;
|
|
57
62
|
generateStyles(): Promise<{
|
|
58
63
|
files: Record<string, string>;
|
|
@@ -60,10 +65,11 @@ declare class VanillaKeyframesGenerator implements StyleGenerator {
|
|
|
60
65
|
}
|
|
61
66
|
//#endregion
|
|
62
67
|
//#region src/config/VanillaGlobalCssGenerator.d.ts
|
|
63
|
-
declare class VanillaGlobalCssGenerator
|
|
68
|
+
declare class VanillaGlobalCssGenerator extends StyleGenerator {
|
|
64
69
|
private readonly onDiagnostic?;
|
|
65
70
|
private readonly collectedStyles;
|
|
66
71
|
constructor(onDiagnostic?: OnDiagnostic | undefined);
|
|
72
|
+
mockFunction(...args: unknown[]): unknown;
|
|
67
73
|
collectArgs(source: string, args: unknown[]): void;
|
|
68
74
|
generateStyles(): Promise<{
|
|
69
75
|
global: string;
|
|
@@ -75,4 +81,4 @@ declare function defineConfig(config: Partial<Config> & {
|
|
|
75
81
|
extractors?: StyleExtractor[];
|
|
76
82
|
}): Partial<Config>;
|
|
77
83
|
//#endregion
|
|
78
|
-
export { VanillaCssExtractor, VanillaCssGenerator, VanillaGlobalCssExtractor, VanillaGlobalCssGenerator, VanillaKeyframesExtractor, VanillaKeyframesGenerator, defineConfig, mochiCssFunctionExtractor, mochiGlobalCssFunctionExtractor, mochiKeyframesFunctionExtractor
|
|
84
|
+
export { VanillaCssExtractor, VanillaCssGenerator, VanillaGlobalCssExtractor, VanillaGlobalCssGenerator, VanillaKeyframesExtractor, VanillaKeyframesGenerator, defineConfig, mochiCssFunctionExtractor, mochiGlobalCssFunctionExtractor, mochiKeyframesFunctionExtractor };
|
package/dist/config/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
const require_src = require('../src-
|
|
1
|
+
const require_src = require('../src-CzESvndd.js');
|
|
2
|
+
let __mochi_css_core = require("@mochi-css/core");
|
|
3
|
+
__mochi_css_core = require_src.__toESM(__mochi_css_core);
|
|
2
4
|
let __mochi_css_plugins = require("@mochi-css/plugins");
|
|
3
5
|
__mochi_css_plugins = require_src.__toESM(__mochi_css_plugins);
|
|
4
|
-
let __mochi_css_builder = require("@mochi-css/builder");
|
|
5
|
-
__mochi_css_builder = require_src.__toESM(__mochi_css_builder);
|
|
6
|
-
let __mochi_css_config = require("@mochi-css/config");
|
|
7
|
-
__mochi_css_config = require_src.__toESM(__mochi_css_config);
|
|
8
6
|
|
|
9
7
|
//#region src/config/VanillaCssGenerator.ts
|
|
10
8
|
const emptySpan = {
|
|
@@ -60,11 +58,17 @@ function mochiCssNode(instance) {
|
|
|
60
58
|
]
|
|
61
59
|
};
|
|
62
60
|
}
|
|
63
|
-
var VanillaCssGenerator = class {
|
|
61
|
+
var VanillaCssGenerator = class extends __mochi_css_plugins.StyleGenerator {
|
|
64
62
|
collectedStyles = [];
|
|
65
63
|
generatedMochiCss = [];
|
|
66
|
-
|
|
64
|
+
mock;
|
|
65
|
+
constructor(mock, onDiagnostic) {
|
|
66
|
+
super();
|
|
67
67
|
this.onDiagnostic = onDiagnostic;
|
|
68
|
+
this.mock = mock;
|
|
69
|
+
}
|
|
70
|
+
mockFunction(...args) {
|
|
71
|
+
return this.mock(...args);
|
|
68
72
|
}
|
|
69
73
|
collectArgs(source, args) {
|
|
70
74
|
const validArgs = [];
|
|
@@ -96,18 +100,18 @@ var VanillaCssGenerator = class {
|
|
|
96
100
|
this.generatedMochiCss = [];
|
|
97
101
|
const filesCss = /* @__PURE__ */ new Map();
|
|
98
102
|
for (const { source, args, stableId } of this.collectedStyles) {
|
|
99
|
-
let css = filesCss.get(source);
|
|
100
|
-
if (!css) {
|
|
101
|
-
css = /* @__PURE__ */ new Set();
|
|
102
|
-
filesCss.set(source, css);
|
|
103
|
+
let css$1 = filesCss.get(source);
|
|
104
|
+
if (!css$1) {
|
|
105
|
+
css$1 = /* @__PURE__ */ new Set();
|
|
106
|
+
filesCss.set(source, css$1);
|
|
103
107
|
}
|
|
104
108
|
const mochiInstances = [];
|
|
105
109
|
for (const style of args) try {
|
|
106
110
|
const cssObj = new require_src.CSSObject(style, stableId);
|
|
107
|
-
css.add(cssObj.asCssString());
|
|
111
|
+
css$1.add(cssObj.asCssString());
|
|
108
112
|
mochiInstances.push(require_src.MochiCSS.from(cssObj));
|
|
109
113
|
} catch (err) {
|
|
110
|
-
const message = (0,
|
|
114
|
+
const message = (0, __mochi_css_core.getErrorMessage)(err);
|
|
111
115
|
this.onDiagnostic?.({
|
|
112
116
|
code: "MOCHI_STYLE_GENERATION",
|
|
113
117
|
message: `Failed to generate CSS: ${message}`,
|
|
@@ -121,7 +125,7 @@ var VanillaCssGenerator = class {
|
|
|
121
125
|
});
|
|
122
126
|
}
|
|
123
127
|
const files = {};
|
|
124
|
-
for (const [source, css] of filesCss) files[source] = [...css.values()].sort().join("\n\n");
|
|
128
|
+
for (const [source, css$1] of filesCss) files[source] = [...css$1.values()].sort().join("\n\n");
|
|
125
129
|
return { files };
|
|
126
130
|
}
|
|
127
131
|
getArgReplacements() {
|
|
@@ -137,27 +141,33 @@ var VanillaCssGenerator = class {
|
|
|
137
141
|
var VanillaCssExtractor = class {
|
|
138
142
|
importPath;
|
|
139
143
|
symbolName;
|
|
140
|
-
|
|
144
|
+
mock;
|
|
145
|
+
constructor(importPath, symbolName, extractor, mock) {
|
|
141
146
|
this.extractor = extractor;
|
|
142
147
|
this.importPath = importPath;
|
|
143
148
|
this.symbolName = symbolName;
|
|
149
|
+
this.mock = mock;
|
|
144
150
|
}
|
|
145
151
|
extractStaticArgs(call) {
|
|
146
152
|
return this.extractor(call);
|
|
147
153
|
}
|
|
148
154
|
startGeneration(onDiagnostic) {
|
|
149
|
-
return new VanillaCssGenerator(onDiagnostic);
|
|
155
|
+
return new VanillaCssGenerator(this.mock, onDiagnostic);
|
|
150
156
|
}
|
|
151
157
|
};
|
|
152
|
-
const mochiCssFunctionExtractor = new VanillaCssExtractor("@mochi-css/vanilla", "css", (call) => call.arguments.map((a) => a.expression));
|
|
158
|
+
const mochiCssFunctionExtractor = new VanillaCssExtractor("@mochi-css/vanilla", "css", (call) => call.arguments.map((a) => a.expression), require_src.css);
|
|
153
159
|
|
|
154
160
|
//#endregion
|
|
155
161
|
//#region src/config/VanillaKeyframesGenerator.ts
|
|
156
|
-
var VanillaKeyframesGenerator = class {
|
|
162
|
+
var VanillaKeyframesGenerator = class extends __mochi_css_plugins.StyleGenerator {
|
|
157
163
|
collectedStyles = [];
|
|
158
164
|
constructor(onDiagnostic) {
|
|
165
|
+
super();
|
|
159
166
|
this.onDiagnostic = onDiagnostic;
|
|
160
167
|
}
|
|
168
|
+
mockFunction(...args) {
|
|
169
|
+
return require_src.keyframes(...args);
|
|
170
|
+
}
|
|
161
171
|
collectArgs(source, args) {
|
|
162
172
|
if (args.length === 0 || args[0] == null || typeof args[0] !== "object") {
|
|
163
173
|
this.onDiagnostic?.({
|
|
@@ -176,16 +186,16 @@ var VanillaKeyframesGenerator = class {
|
|
|
176
186
|
async generateStyles() {
|
|
177
187
|
const filesCss = /* @__PURE__ */ new Map();
|
|
178
188
|
for (const { source, stops } of this.collectedStyles) {
|
|
179
|
-
let css = filesCss.get(source);
|
|
180
|
-
if (!css) {
|
|
181
|
-
css = /* @__PURE__ */ new Set();
|
|
182
|
-
filesCss.set(source, css);
|
|
189
|
+
let css$1 = filesCss.get(source);
|
|
190
|
+
if (!css$1) {
|
|
191
|
+
css$1 = /* @__PURE__ */ new Set();
|
|
192
|
+
filesCss.set(source, css$1);
|
|
183
193
|
}
|
|
184
194
|
try {
|
|
185
195
|
const obj = new require_src.KeyframesObject(stops);
|
|
186
|
-
css.add(obj.asCssString());
|
|
196
|
+
css$1.add(obj.asCssString());
|
|
187
197
|
} catch (err) {
|
|
188
|
-
const message = (0,
|
|
198
|
+
const message = (0, __mochi_css_core.getErrorMessage)(err);
|
|
189
199
|
this.onDiagnostic?.({
|
|
190
200
|
code: "MOCHI_STYLE_GENERATION",
|
|
191
201
|
message: `Failed to generate keyframes CSS: ${message}`,
|
|
@@ -195,7 +205,7 @@ var VanillaKeyframesGenerator = class {
|
|
|
195
205
|
}
|
|
196
206
|
}
|
|
197
207
|
const files = {};
|
|
198
|
-
for (const [source, css] of filesCss) files[source] = [...css.values()].sort().join("\n\n");
|
|
208
|
+
for (const [source, css$1] of filesCss) files[source] = [...css$1.values()].sort().join("\n\n");
|
|
199
209
|
return { files };
|
|
200
210
|
}
|
|
201
211
|
};
|
|
@@ -216,11 +226,15 @@ const mochiKeyframesFunctionExtractor = new VanillaKeyframesExtractor();
|
|
|
216
226
|
|
|
217
227
|
//#endregion
|
|
218
228
|
//#region src/config/VanillaGlobalCssGenerator.ts
|
|
219
|
-
var VanillaGlobalCssGenerator = class {
|
|
229
|
+
var VanillaGlobalCssGenerator = class extends __mochi_css_plugins.StyleGenerator {
|
|
220
230
|
collectedStyles = [];
|
|
221
231
|
constructor(onDiagnostic) {
|
|
232
|
+
super();
|
|
222
233
|
this.onDiagnostic = onDiagnostic;
|
|
223
234
|
}
|
|
235
|
+
mockFunction(...args) {
|
|
236
|
+
return /* @__PURE__ */ require_src.globalCss(...args);
|
|
237
|
+
}
|
|
224
238
|
collectArgs(source, args) {
|
|
225
239
|
if (args.length === 0 || args[0] == null || typeof args[0] !== "object") {
|
|
226
240
|
this.onDiagnostic?.({
|
|
@@ -242,7 +256,7 @@ var VanillaGlobalCssGenerator = class {
|
|
|
242
256
|
const obj = new require_src.GlobalCssObject(styles);
|
|
243
257
|
allCss.add(obj.asCssString());
|
|
244
258
|
} catch (err) {
|
|
245
|
-
const message = (0,
|
|
259
|
+
const message = (0, __mochi_css_core.getErrorMessage)(err);
|
|
246
260
|
this.onDiagnostic?.({
|
|
247
261
|
code: "MOCHI_STYLE_GENERATION",
|
|
248
262
|
message: `Failed to generate global CSS: ${message}`,
|
|
@@ -293,10 +307,4 @@ exports.VanillaKeyframesGenerator = VanillaKeyframesGenerator;
|
|
|
293
307
|
exports.defineConfig = defineConfig;
|
|
294
308
|
exports.mochiCssFunctionExtractor = mochiCssFunctionExtractor;
|
|
295
309
|
exports.mochiGlobalCssFunctionExtractor = mochiGlobalCssFunctionExtractor;
|
|
296
|
-
exports.mochiKeyframesFunctionExtractor = mochiKeyframesFunctionExtractor;
|
|
297
|
-
Object.defineProperty(exports, 'styledIdPlugin', {
|
|
298
|
-
enumerable: true,
|
|
299
|
-
get: function () {
|
|
300
|
-
return __mochi_css_config.styledIdPlugin;
|
|
301
|
-
}
|
|
302
|
-
});
|
|
310
|
+
exports.mochiKeyframesFunctionExtractor = mochiKeyframesFunctionExtractor;
|
package/dist/config/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { a as GlobalCssObject, c as KeyframesObject, d as isMochiCSS, f as mergeMochiCss, l as MochiCSS, p as CSSObject } from "../src-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { styledIdPlugin } from "@mochi-css/config";
|
|
1
|
+
import { a as GlobalCssObject, c as KeyframesObject, d as isMochiCSS, f as mergeMochiCss, i as globalCss, l as MochiCSS, p as CSSObject, s as keyframes, u as css } from "../src-CNKPUUrl.mjs";
|
|
2
|
+
import { getErrorMessage } from "@mochi-css/core";
|
|
3
|
+
import { StyleGenerator, createExtractorsPlugin } from "@mochi-css/plugins";
|
|
5
4
|
|
|
6
5
|
//#region src/config/VanillaCssGenerator.ts
|
|
7
6
|
const emptySpan = {
|
|
@@ -57,11 +56,17 @@ function mochiCssNode(instance) {
|
|
|
57
56
|
]
|
|
58
57
|
};
|
|
59
58
|
}
|
|
60
|
-
var VanillaCssGenerator = class {
|
|
59
|
+
var VanillaCssGenerator = class extends StyleGenerator {
|
|
61
60
|
collectedStyles = [];
|
|
62
61
|
generatedMochiCss = [];
|
|
63
|
-
|
|
62
|
+
mock;
|
|
63
|
+
constructor(mock, onDiagnostic) {
|
|
64
|
+
super();
|
|
64
65
|
this.onDiagnostic = onDiagnostic;
|
|
66
|
+
this.mock = mock;
|
|
67
|
+
}
|
|
68
|
+
mockFunction(...args) {
|
|
69
|
+
return this.mock(...args);
|
|
65
70
|
}
|
|
66
71
|
collectArgs(source, args) {
|
|
67
72
|
const validArgs = [];
|
|
@@ -93,15 +98,15 @@ var VanillaCssGenerator = class {
|
|
|
93
98
|
this.generatedMochiCss = [];
|
|
94
99
|
const filesCss = /* @__PURE__ */ new Map();
|
|
95
100
|
for (const { source, args, stableId } of this.collectedStyles) {
|
|
96
|
-
let css = filesCss.get(source);
|
|
97
|
-
if (!css) {
|
|
98
|
-
css = /* @__PURE__ */ new Set();
|
|
99
|
-
filesCss.set(source, css);
|
|
101
|
+
let css$1 = filesCss.get(source);
|
|
102
|
+
if (!css$1) {
|
|
103
|
+
css$1 = /* @__PURE__ */ new Set();
|
|
104
|
+
filesCss.set(source, css$1);
|
|
100
105
|
}
|
|
101
106
|
const mochiInstances = [];
|
|
102
107
|
for (const style of args) try {
|
|
103
108
|
const cssObj = new CSSObject(style, stableId);
|
|
104
|
-
css.add(cssObj.asCssString());
|
|
109
|
+
css$1.add(cssObj.asCssString());
|
|
105
110
|
mochiInstances.push(MochiCSS.from(cssObj));
|
|
106
111
|
} catch (err) {
|
|
107
112
|
const message = getErrorMessage(err);
|
|
@@ -118,7 +123,7 @@ var VanillaCssGenerator = class {
|
|
|
118
123
|
});
|
|
119
124
|
}
|
|
120
125
|
const files = {};
|
|
121
|
-
for (const [source, css] of filesCss) files[source] = [...css.values()].sort().join("\n\n");
|
|
126
|
+
for (const [source, css$1] of filesCss) files[source] = [...css$1.values()].sort().join("\n\n");
|
|
122
127
|
return { files };
|
|
123
128
|
}
|
|
124
129
|
getArgReplacements() {
|
|
@@ -134,27 +139,33 @@ var VanillaCssGenerator = class {
|
|
|
134
139
|
var VanillaCssExtractor = class {
|
|
135
140
|
importPath;
|
|
136
141
|
symbolName;
|
|
137
|
-
|
|
142
|
+
mock;
|
|
143
|
+
constructor(importPath, symbolName, extractor, mock) {
|
|
138
144
|
this.extractor = extractor;
|
|
139
145
|
this.importPath = importPath;
|
|
140
146
|
this.symbolName = symbolName;
|
|
147
|
+
this.mock = mock;
|
|
141
148
|
}
|
|
142
149
|
extractStaticArgs(call) {
|
|
143
150
|
return this.extractor(call);
|
|
144
151
|
}
|
|
145
152
|
startGeneration(onDiagnostic) {
|
|
146
|
-
return new VanillaCssGenerator(onDiagnostic);
|
|
153
|
+
return new VanillaCssGenerator(this.mock, onDiagnostic);
|
|
147
154
|
}
|
|
148
155
|
};
|
|
149
|
-
const mochiCssFunctionExtractor = new VanillaCssExtractor("@mochi-css/vanilla", "css", (call) => call.arguments.map((a) => a.expression));
|
|
156
|
+
const mochiCssFunctionExtractor = new VanillaCssExtractor("@mochi-css/vanilla", "css", (call) => call.arguments.map((a) => a.expression), css);
|
|
150
157
|
|
|
151
158
|
//#endregion
|
|
152
159
|
//#region src/config/VanillaKeyframesGenerator.ts
|
|
153
|
-
var VanillaKeyframesGenerator = class {
|
|
160
|
+
var VanillaKeyframesGenerator = class extends StyleGenerator {
|
|
154
161
|
collectedStyles = [];
|
|
155
162
|
constructor(onDiagnostic) {
|
|
163
|
+
super();
|
|
156
164
|
this.onDiagnostic = onDiagnostic;
|
|
157
165
|
}
|
|
166
|
+
mockFunction(...args) {
|
|
167
|
+
return keyframes(...args);
|
|
168
|
+
}
|
|
158
169
|
collectArgs(source, args) {
|
|
159
170
|
if (args.length === 0 || args[0] == null || typeof args[0] !== "object") {
|
|
160
171
|
this.onDiagnostic?.({
|
|
@@ -173,14 +184,14 @@ var VanillaKeyframesGenerator = class {
|
|
|
173
184
|
async generateStyles() {
|
|
174
185
|
const filesCss = /* @__PURE__ */ new Map();
|
|
175
186
|
for (const { source, stops } of this.collectedStyles) {
|
|
176
|
-
let css = filesCss.get(source);
|
|
177
|
-
if (!css) {
|
|
178
|
-
css = /* @__PURE__ */ new Set();
|
|
179
|
-
filesCss.set(source, css);
|
|
187
|
+
let css$1 = filesCss.get(source);
|
|
188
|
+
if (!css$1) {
|
|
189
|
+
css$1 = /* @__PURE__ */ new Set();
|
|
190
|
+
filesCss.set(source, css$1);
|
|
180
191
|
}
|
|
181
192
|
try {
|
|
182
193
|
const obj = new KeyframesObject(stops);
|
|
183
|
-
css.add(obj.asCssString());
|
|
194
|
+
css$1.add(obj.asCssString());
|
|
184
195
|
} catch (err) {
|
|
185
196
|
const message = getErrorMessage(err);
|
|
186
197
|
this.onDiagnostic?.({
|
|
@@ -192,7 +203,7 @@ var VanillaKeyframesGenerator = class {
|
|
|
192
203
|
}
|
|
193
204
|
}
|
|
194
205
|
const files = {};
|
|
195
|
-
for (const [source, css] of filesCss) files[source] = [...css.values()].sort().join("\n\n");
|
|
206
|
+
for (const [source, css$1] of filesCss) files[source] = [...css$1.values()].sort().join("\n\n");
|
|
196
207
|
return { files };
|
|
197
208
|
}
|
|
198
209
|
};
|
|
@@ -213,11 +224,15 @@ const mochiKeyframesFunctionExtractor = new VanillaKeyframesExtractor();
|
|
|
213
224
|
|
|
214
225
|
//#endregion
|
|
215
226
|
//#region src/config/VanillaGlobalCssGenerator.ts
|
|
216
|
-
var VanillaGlobalCssGenerator = class {
|
|
227
|
+
var VanillaGlobalCssGenerator = class extends StyleGenerator {
|
|
217
228
|
collectedStyles = [];
|
|
218
229
|
constructor(onDiagnostic) {
|
|
230
|
+
super();
|
|
219
231
|
this.onDiagnostic = onDiagnostic;
|
|
220
232
|
}
|
|
233
|
+
mockFunction(...args) {
|
|
234
|
+
return /* @__PURE__ */ globalCss(...args);
|
|
235
|
+
}
|
|
221
236
|
collectArgs(source, args) {
|
|
222
237
|
if (args.length === 0 || args[0] == null || typeof args[0] !== "object") {
|
|
223
238
|
this.onDiagnostic?.({
|
|
@@ -281,4 +296,4 @@ function defineConfig(config) {
|
|
|
281
296
|
}
|
|
282
297
|
|
|
283
298
|
//#endregion
|
|
284
|
-
export { VanillaCssExtractor, VanillaCssGenerator, VanillaGlobalCssExtractor, VanillaGlobalCssGenerator, VanillaKeyframesExtractor, VanillaKeyframesGenerator, defineConfig, mochiCssFunctionExtractor, mochiGlobalCssFunctionExtractor, mochiKeyframesFunctionExtractor
|
|
299
|
+
export { VanillaCssExtractor, VanillaCssGenerator, VanillaGlobalCssExtractor, VanillaGlobalCssGenerator, VanillaKeyframesExtractor, VanillaKeyframesGenerator, defineConfig, mochiCssFunctionExtractor, mochiGlobalCssFunctionExtractor, mochiKeyframesFunctionExtractor };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ObsoleteProperties, Properties, PropertiesHyphen } from "csstype";
|
|
2
|
-
import { numberToBase62, shortHash } from "@mochi-css/core";
|
|
3
2
|
|
|
4
3
|
//#region src/values/index.d.ts
|
|
5
4
|
type CssVar = `--${string}`;
|
|
@@ -815,4 +814,4 @@ interface SupportsHelper {
|
|
|
815
814
|
/** Helper for constructing `@supports` at-rule keys. */
|
|
816
815
|
declare const supports: SupportsHelper;
|
|
817
816
|
//#endregion
|
|
818
|
-
export { AllVariants, type AtRuleKey, CSSObject, CompoundVariant, CssLike, CssLikeObject, CssObjectBlock, CssObjectSubBlock, CssVar, CssVarVal, DefaultVariants, GlobalCssObject, GlobalCssProperties, type GlobalCssStyles, type KeyframeStops, KeyframesObject, MergeCSSVariants, MochiCSS, MochiCSSProps, MochiKeyframes, MochiSelector, RefineVariantType, RefineVariants, type StyleProps, Token, VariantProps, camelToKebab, container, createToken, css, cssFromProps, globalCss, isAtRuleKey, isMochiCSS, kebabToCamel, keyframes, media, mergeMochiCss,
|
|
817
|
+
export { AllVariants, type AtRuleKey, CSSObject, CompoundVariant, CssLike, CssLikeObject, CssObjectBlock, CssObjectSubBlock, CssVar, CssVarVal, DefaultVariants, GlobalCssObject, GlobalCssProperties, type GlobalCssStyles, type KeyframeStops, KeyframesObject, MergeCSSVariants, MochiCSS, MochiCSSProps, MochiKeyframes, MochiSelector, RefineVariantType, RefineVariants, type StyleProps, Token, VariantProps, camelToKebab, container, createToken, css, cssFromProps, globalCss, isAtRuleKey, isMochiCSS, kebabToCamel, keyframes, media, mergeMochiCss, supports };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ObsoleteProperties, Properties, PropertiesHyphen } from "csstype";
|
|
2
|
-
import { numberToBase62, shortHash } from "@mochi-css/core";
|
|
3
2
|
|
|
4
3
|
//#region src/values/index.d.ts
|
|
5
4
|
type CssVar = `--${string}`;
|
|
@@ -815,4 +814,4 @@ interface SupportsHelper {
|
|
|
815
814
|
/** Helper for constructing `@supports` at-rule keys. */
|
|
816
815
|
declare const supports: SupportsHelper;
|
|
817
816
|
//#endregion
|
|
818
|
-
export { AllVariants, type AtRuleKey, CSSObject, CompoundVariant, CssLike, CssLikeObject, CssObjectBlock, CssObjectSubBlock, CssVar, CssVarVal, DefaultVariants, GlobalCssObject, GlobalCssProperties, type GlobalCssStyles, type KeyframeStops, KeyframesObject, MergeCSSVariants, MochiCSS, MochiCSSProps, MochiKeyframes, MochiSelector, RefineVariantType, RefineVariants, type StyleProps, Token, VariantProps, camelToKebab, container, createToken, css, cssFromProps, globalCss, isAtRuleKey, isMochiCSS, kebabToCamel, keyframes, media, mergeMochiCss,
|
|
817
|
+
export { AllVariants, type AtRuleKey, CSSObject, CompoundVariant, CssLike, CssLikeObject, CssObjectBlock, CssObjectSubBlock, CssVar, CssVarVal, DefaultVariants, GlobalCssObject, GlobalCssProperties, type GlobalCssStyles, type KeyframeStops, KeyframesObject, MergeCSSVariants, MochiCSS, MochiCSSProps, MochiKeyframes, MochiSelector, RefineVariantType, RefineVariants, type StyleProps, Token, VariantProps, camelToKebab, container, createToken, css, cssFromProps, globalCss, isAtRuleKey, isMochiCSS, kebabToCamel, keyframes, media, mergeMochiCss, supports };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_src = require('./src-
|
|
1
|
+
const require_src = require('./src-CzESvndd.js');
|
|
2
2
|
|
|
3
3
|
exports.CSSObject = require_src.CSSObject;
|
|
4
4
|
exports.CssObjectBlock = require_src.CssObjectBlock;
|
|
@@ -21,6 +21,4 @@ exports.kebabToCamel = require_src.kebabToCamel;
|
|
|
21
21
|
exports.keyframes = require_src.keyframes;
|
|
22
22
|
exports.media = require_src.media;
|
|
23
23
|
exports.mergeMochiCss = require_src.mergeMochiCss;
|
|
24
|
-
exports.numberToBase62 = require_src.numberToBase62;
|
|
25
|
-
exports.shortHash = require_src.shortHash;
|
|
26
24
|
exports.supports = require_src.supports;
|