@styleframe/core 1.0.2 → 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/CHANGELOG.md +13 -0
- package/dist/styleframe.d.ts +10 -0
- package/dist/styleframe.js +321 -295
- package/dist/styleframe.umd.cjs +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @styleframe/core
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#50](https://github.com/styleframe-dev/styleframe/pull/50) [`0593c52`](https://github.com/styleframe-dev/styleframe/commit/0593c52798b8846d3c49762621baeb66354e0356) Thanks [@alexgrozav](https://github.com/alexgrozav)! - feat: add license check integration
|
|
8
|
+
|
|
9
|
+
## 1.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`6700e6f`](https://github.com/styleframe-dev/styleframe/commit/6700e6fa835183ac50808c05d44154c25e85e9e1)]:
|
|
14
|
+
- @styleframe/license@1.0.0
|
|
15
|
+
|
|
3
16
|
## 1.0.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/styleframe.d.ts
CHANGED
|
@@ -106,6 +106,15 @@ export declare type DeclarationsCallbackContext = {
|
|
|
106
106
|
|
|
107
107
|
export declare const deepClone: CloneFunction<any>;
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Generates a random ID string
|
|
111
|
+
*
|
|
112
|
+
* @param length - The length of the random ID to generate (default: 8)
|
|
113
|
+
* @param prefix - Optional prefix to prepend to the random ID
|
|
114
|
+
* @returns A random alphanumeric string with optional prefix
|
|
115
|
+
*/
|
|
116
|
+
export declare function generateRandomId(prefix?: string, length?: number): string;
|
|
117
|
+
|
|
109
118
|
export declare function getModifier(root: Root, name: string): ModifierFactory;
|
|
110
119
|
|
|
111
120
|
export declare function getUtility(root: Root, name: string): UtilityFactory;
|
|
@@ -212,6 +221,7 @@ export declare type Selector = {
|
|
|
212
221
|
};
|
|
213
222
|
|
|
214
223
|
export declare interface Styleframe {
|
|
224
|
+
id: string;
|
|
215
225
|
root: Root;
|
|
216
226
|
variable: ReturnType<typeof createVariableFunction>;
|
|
217
227
|
selector: ReturnType<typeof createSelectorFunction>;
|
package/dist/styleframe.js
CHANGED
|
@@ -1,388 +1,412 @@
|
|
|
1
|
-
function
|
|
2
|
-
return function(
|
|
1
|
+
function k(e, r) {
|
|
2
|
+
return function(t, ...i) {
|
|
3
3
|
return {
|
|
4
4
|
type: "css",
|
|
5
|
-
value:
|
|
5
|
+
value: t.reduce((o, u, c) => (o.push(u), c < i.length && o.push(i[c]), o), [])
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function M(e) {
|
|
10
10
|
return typeof e == "object" && e !== null;
|
|
11
11
|
}
|
|
12
|
-
function p(e,
|
|
13
|
-
return
|
|
12
|
+
function p(e, r) {
|
|
13
|
+
return M(e) && "type" in e && e.type === r;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function B(e) {
|
|
16
16
|
return p(e, "variable");
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function F(e) {
|
|
19
19
|
return p(e, "reference");
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Z(e) {
|
|
22
22
|
return p(e, "selector");
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function ee(e) {
|
|
25
25
|
return p(e, "at-rule");
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function te(e) {
|
|
28
28
|
return p(e, "utility");
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function ne(e) {
|
|
31
31
|
return p(e, "modifier");
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function T(e) {
|
|
34
34
|
return p(e, "css");
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function re(e) {
|
|
37
37
|
return p(e, "theme");
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function j(e) {
|
|
40
40
|
return p(e, "root");
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function _(e) {
|
|
43
43
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
45
|
+
function O(e) {
|
|
46
|
+
return _(e) || F(e) || T(e) || Array.isArray(e) && e.every(O);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
48
|
+
function C(e) {
|
|
49
|
+
return M(e) && "children" in e && "declarations" in e && "variables" in e;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return function(
|
|
53
|
-
const
|
|
51
|
+
function R(e, r) {
|
|
52
|
+
return function(t, i, s) {
|
|
53
|
+
const o = {
|
|
54
54
|
type: "at-rule",
|
|
55
|
-
identifier:
|
|
56
|
-
rule:
|
|
55
|
+
identifier: t,
|
|
56
|
+
rule: i,
|
|
57
57
|
declarations: {},
|
|
58
58
|
variables: [],
|
|
59
59
|
children: []
|
|
60
|
-
}, u = b(
|
|
61
|
-
return typeof s == "function" ?
|
|
60
|
+
}, u = b(o, r);
|
|
61
|
+
return typeof s == "function" ? o.declarations = s(u) ?? {} : s && (o.declarations = s), g(o.declarations, u), e.children.push(o), o;
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
return function(
|
|
67
|
-
return
|
|
64
|
+
function S(e, r) {
|
|
65
|
+
const n = R(e, r);
|
|
66
|
+
return function(i, s) {
|
|
67
|
+
return n("media", i, s);
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
const
|
|
72
|
-
return function(
|
|
73
|
-
return
|
|
70
|
+
function E(e, r) {
|
|
71
|
+
const n = R(e, r);
|
|
72
|
+
return function(i, s) {
|
|
73
|
+
return n("keyframes", i, s);
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
return function(
|
|
78
|
-
return
|
|
76
|
+
function P(e, r) {
|
|
77
|
+
return function(t, i) {
|
|
78
|
+
return B(t) ? {
|
|
79
79
|
type: "reference",
|
|
80
|
-
name:
|
|
81
|
-
fallback:
|
|
80
|
+
name: t.name,
|
|
81
|
+
fallback: i
|
|
82
82
|
} : {
|
|
83
83
|
type: "reference",
|
|
84
|
-
name:
|
|
85
|
-
fallback:
|
|
84
|
+
name: t,
|
|
85
|
+
fallback: i
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
return function(
|
|
89
|
+
function D(e, r) {
|
|
90
|
+
return function(t, i) {
|
|
91
91
|
const s = {
|
|
92
92
|
type: "selector",
|
|
93
|
-
query:
|
|
93
|
+
query: t,
|
|
94
94
|
declarations: {},
|
|
95
95
|
variables: [],
|
|
96
96
|
children: []
|
|
97
|
-
},
|
|
98
|
-
return typeof
|
|
97
|
+
}, o = b(s, r);
|
|
98
|
+
return typeof i == "function" ? s.declarations = i(o) ?? {} : C(i) ? (s.variables = i.variables, s.declarations = i.declarations, s.children = i.children) : s.declarations = i, g(s.declarations, o), e.children.push(s), s;
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
function
|
|
102
|
-
return function(
|
|
101
|
+
function H(e, r) {
|
|
102
|
+
return function(t, i, s = {
|
|
103
103
|
default: !1
|
|
104
104
|
}) {
|
|
105
|
-
const
|
|
106
|
-
(f) => f.name ===
|
|
105
|
+
const o = typeof t == "string" ? t : t.name, u = e.variables.find(
|
|
106
|
+
(f) => f.name === o
|
|
107
107
|
);
|
|
108
108
|
if (s.default && u)
|
|
109
109
|
return u;
|
|
110
110
|
if (u)
|
|
111
|
-
return u.value =
|
|
111
|
+
return u.value = i, u;
|
|
112
112
|
const c = {
|
|
113
113
|
type: "variable",
|
|
114
|
-
name:
|
|
115
|
-
value:
|
|
114
|
+
name: o,
|
|
115
|
+
value: i
|
|
116
116
|
};
|
|
117
117
|
return e.variables.push(c), c;
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
function b(e,
|
|
121
|
-
const
|
|
120
|
+
function b(e, r) {
|
|
121
|
+
const n = H(e), t = D(e, r), i = R(e, r), s = E(r, r), o = S(e, r), u = P(), c = k();
|
|
122
122
|
return {
|
|
123
|
-
variable:
|
|
124
|
-
selector:
|
|
123
|
+
variable: n,
|
|
124
|
+
selector: t,
|
|
125
125
|
keyframes: s,
|
|
126
|
-
atRule:
|
|
127
|
-
media:
|
|
126
|
+
atRule: i,
|
|
127
|
+
media: o,
|
|
128
128
|
ref: u,
|
|
129
129
|
css: c
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
function g(e,
|
|
133
|
-
for (const
|
|
134
|
-
if (
|
|
135
|
-
const
|
|
136
|
-
if (typeof
|
|
137
|
-
const
|
|
138
|
-
|
|
132
|
+
function g(e, r) {
|
|
133
|
+
for (const n in e)
|
|
134
|
+
if (n.startsWith("@")) {
|
|
135
|
+
const t = e[n];
|
|
136
|
+
if (typeof t == "object" && t !== null && !O(t)) {
|
|
137
|
+
const i = n.replace(/^@(\w+).*/, "$1"), s = n.replace(`@${i}`, "").trim();
|
|
138
|
+
r.atRule(i, s, t), delete e[n];
|
|
139
139
|
}
|
|
140
|
-
} else if (/^[.&:]/.test(
|
|
141
|
-
const
|
|
142
|
-
typeof
|
|
140
|
+
} else if (/^[.&:]/.test(n)) {
|
|
141
|
+
const t = e[n];
|
|
142
|
+
typeof t == "object" && (r.selector(n, t), delete e[n]);
|
|
143
143
|
}
|
|
144
144
|
return e;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function ie(e) {
|
|
147
147
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
148
148
|
}
|
|
149
149
|
function m(e) {
|
|
150
150
|
if (e instanceof Buffer)
|
|
151
151
|
return Buffer.from(e);
|
|
152
|
-
const
|
|
153
|
-
return new
|
|
152
|
+
const r = e.constructor;
|
|
153
|
+
return new r(
|
|
154
154
|
e.buffer.slice(0),
|
|
155
155
|
e.byteOffset,
|
|
156
156
|
e.byteLength / e.BYTES_PER_ELEMENT || 1
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function K(e) {
|
|
160
160
|
if (e = e || {}, e.circular)
|
|
161
|
-
return
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
161
|
+
return U(e);
|
|
162
|
+
const r = /* @__PURE__ */ new Map();
|
|
163
|
+
if (r.set(Date, (o) => new Date(o)), r.set(
|
|
164
164
|
Map,
|
|
165
|
-
(
|
|
166
|
-
),
|
|
165
|
+
(o, u) => new Map(t(Array.from(o), u))
|
|
166
|
+
), r.set(
|
|
167
167
|
Set,
|
|
168
|
-
(
|
|
168
|
+
(o, u) => new Set(t(Array.from(o), u))
|
|
169
169
|
), e.constructorHandlers)
|
|
170
|
-
for (const
|
|
171
|
-
|
|
172
|
-
let
|
|
173
|
-
return e.proto ? s :
|
|
174
|
-
function
|
|
175
|
-
const c = Object.keys(
|
|
170
|
+
for (const o of e.constructorHandlers)
|
|
171
|
+
r.set(o[0], o[1]);
|
|
172
|
+
let n;
|
|
173
|
+
return e.proto ? s : i;
|
|
174
|
+
function t(o, u) {
|
|
175
|
+
const c = Object.keys(o), f = Array.from({ length: c.length });
|
|
176
176
|
for (let a = 0; a < c.length; a++) {
|
|
177
|
-
const l = c[a], y =
|
|
178
|
-
typeof y != "object" || y === null ? f[l] = y : y.constructor !== Object && (
|
|
177
|
+
const l = c[a], y = o[l];
|
|
178
|
+
typeof y != "object" || y === null ? f[l] = y : y.constructor !== Object && (n = r.get(y.constructor)) ? f[l] = n(y, u) : ArrayBuffer.isView(y) ? f[l] = m(y) : f[l] = u(y);
|
|
179
179
|
}
|
|
180
180
|
return f;
|
|
181
181
|
}
|
|
182
|
-
function o
|
|
183
|
-
if (typeof
|
|
184
|
-
if (Array.isArray(
|
|
185
|
-
if (
|
|
186
|
-
return
|
|
182
|
+
function i(o) {
|
|
183
|
+
if (typeof o != "object" || o === null) return o;
|
|
184
|
+
if (Array.isArray(o)) return t(o, i);
|
|
185
|
+
if (o.constructor !== Object && (n = r.get(o.constructor)))
|
|
186
|
+
return n(o, i);
|
|
187
187
|
const u = {};
|
|
188
|
-
for (const c in
|
|
189
|
-
if (Object.hasOwnProperty.call(
|
|
190
|
-
const f =
|
|
191
|
-
typeof f != "object" || f === null ? u[c] = f : f.constructor !== Object && (
|
|
188
|
+
for (const c in o) {
|
|
189
|
+
if (Object.hasOwnProperty.call(o, c) === !1) continue;
|
|
190
|
+
const f = o[c];
|
|
191
|
+
typeof f != "object" || f === null ? u[c] = f : f.constructor !== Object && (n = r.get(f.constructor)) ? u[c] = n(f, i) : ArrayBuffer.isView(f) ? u[c] = m(f) : u[c] = i(f);
|
|
192
192
|
}
|
|
193
193
|
return u;
|
|
194
194
|
}
|
|
195
|
-
function s(
|
|
196
|
-
if (typeof
|
|
197
|
-
if (Array.isArray(
|
|
198
|
-
if (
|
|
199
|
-
return
|
|
195
|
+
function s(o) {
|
|
196
|
+
if (typeof o != "object" || o === null) return o;
|
|
197
|
+
if (Array.isArray(o)) return t(o, s);
|
|
198
|
+
if (o.constructor !== Object && (n = r.get(o.constructor)))
|
|
199
|
+
return n(o, s);
|
|
200
200
|
const u = {};
|
|
201
|
-
for (const c in
|
|
202
|
-
const f =
|
|
203
|
-
typeof f != "object" || f === null ? u[c] = f : f.constructor !== Object && (
|
|
201
|
+
for (const c in o) {
|
|
202
|
+
const f = o[c];
|
|
203
|
+
typeof f != "object" || f === null ? u[c] = f : f.constructor !== Object && (n = r.get(f.constructor)) ? u[c] = n(f, s) : ArrayBuffer.isView(f) ? u[c] = m(f) : u[c] = s(f);
|
|
204
204
|
}
|
|
205
205
|
return u;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
208
|
+
function U(e) {
|
|
209
|
+
const r = [], n = [], t = /* @__PURE__ */ new Map();
|
|
210
|
+
if (t.set(Date, (c) => new Date(c)), t.set(
|
|
211
211
|
Map,
|
|
212
212
|
(c, f) => new Map(s(Array.from(c), f))
|
|
213
|
-
),
|
|
213
|
+
), t.set(
|
|
214
214
|
Set,
|
|
215
215
|
(c, f) => new Set(s(Array.from(c), f))
|
|
216
216
|
), e.constructorHandlers)
|
|
217
217
|
for (const c of e.constructorHandlers)
|
|
218
|
-
|
|
219
|
-
let
|
|
220
|
-
return e.proto ? u :
|
|
218
|
+
t.set(c[0], c[1]);
|
|
219
|
+
let i;
|
|
220
|
+
return e.proto ? u : o;
|
|
221
221
|
function s(c, f) {
|
|
222
222
|
const a = Object.keys(c), l = Array.from({ length: a.length });
|
|
223
223
|
for (let y = 0; y < a.length; y++) {
|
|
224
224
|
const h = a[y], d = c[h];
|
|
225
225
|
if (typeof d != "object" || d === null)
|
|
226
226
|
l[h] = d;
|
|
227
|
-
else if (d.constructor !== Object && (
|
|
228
|
-
l[h] =
|
|
227
|
+
else if (d.constructor !== Object && (i = t.get(d.constructor)))
|
|
228
|
+
l[h] = i(d, f);
|
|
229
229
|
else if (ArrayBuffer.isView(d))
|
|
230
230
|
l[h] = m(d);
|
|
231
231
|
else {
|
|
232
|
-
const v =
|
|
233
|
-
v !== -1 ? l[h] =
|
|
232
|
+
const v = r.indexOf(d);
|
|
233
|
+
v !== -1 ? l[h] = n[v] : l[h] = f(d);
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
return l;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function o(c) {
|
|
239
239
|
if (typeof c != "object" || c === null) return c;
|
|
240
|
-
if (Array.isArray(c)) return s(c,
|
|
241
|
-
if (c.constructor !== Object && (
|
|
242
|
-
return
|
|
240
|
+
if (Array.isArray(c)) return s(c, o);
|
|
241
|
+
if (c.constructor !== Object && (i = t.get(c.constructor)))
|
|
242
|
+
return i(c, o);
|
|
243
243
|
const f = {};
|
|
244
|
-
|
|
244
|
+
r.push(c), n.push(f);
|
|
245
245
|
for (const a in c) {
|
|
246
246
|
if (Object.hasOwnProperty.call(c, a) === !1) continue;
|
|
247
247
|
const l = c[a];
|
|
248
248
|
if (typeof l != "object" || l === null)
|
|
249
249
|
f[a] = l;
|
|
250
|
-
else if (l.constructor !== Object && (
|
|
251
|
-
f[a] =
|
|
250
|
+
else if (l.constructor !== Object && (i = t.get(l.constructor)))
|
|
251
|
+
f[a] = i(l, o);
|
|
252
252
|
else if (ArrayBuffer.isView(l))
|
|
253
253
|
f[a] = m(l);
|
|
254
254
|
else {
|
|
255
|
-
const y =
|
|
256
|
-
y !== -1 ? f[a] =
|
|
255
|
+
const y = r.indexOf(l);
|
|
256
|
+
y !== -1 ? f[a] = n[y] : f[a] = o(l);
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
return
|
|
259
|
+
return r.pop(), n.pop(), f;
|
|
260
260
|
}
|
|
261
261
|
function u(c) {
|
|
262
262
|
if (typeof c != "object" || c === null) return c;
|
|
263
263
|
if (Array.isArray(c)) return s(c, u);
|
|
264
|
-
if (c.constructor !== Object && (
|
|
265
|
-
return
|
|
264
|
+
if (c.constructor !== Object && (i = t.get(c.constructor)))
|
|
265
|
+
return i(c, u);
|
|
266
266
|
const f = {};
|
|
267
|
-
|
|
267
|
+
r.push(c), n.push(f);
|
|
268
268
|
for (const a in c) {
|
|
269
269
|
const l = c[a];
|
|
270
270
|
if (typeof l != "object" || l === null)
|
|
271
271
|
f[a] = l;
|
|
272
|
-
else if (l.constructor !== Object && (
|
|
273
|
-
f[a] =
|
|
272
|
+
else if (l.constructor !== Object && (i = t.get(l.constructor)))
|
|
273
|
+
f[a] = i(l, u);
|
|
274
274
|
else if (ArrayBuffer.isView(l))
|
|
275
275
|
f[a] = m(l);
|
|
276
276
|
else {
|
|
277
|
-
const y =
|
|
278
|
-
y !== -1 ? f[a] =
|
|
277
|
+
const y = r.indexOf(l);
|
|
278
|
+
y !== -1 ? f[a] = n[y] : f[a] = u(l);
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
return
|
|
281
|
+
return r.pop(), n.pop(), f;
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
-
const
|
|
285
|
-
function
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
284
|
+
const A = K();
|
|
285
|
+
function $(e, r = 8) {
|
|
286
|
+
const n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
287
|
+
let t = "";
|
|
288
|
+
for (let i = 0; i < r; i++) {
|
|
289
|
+
const s = Math.floor(Math.random() * n.length);
|
|
290
|
+
t += n[s];
|
|
291
|
+
}
|
|
292
|
+
return e ? `${e}${t}` : t;
|
|
293
|
+
}
|
|
294
|
+
function oe(e, r) {
|
|
295
|
+
const n = e.variables.find((t) => t.name === r);
|
|
296
|
+
if (!n)
|
|
297
|
+
throw new Error(`Variable "${r}" not found`);
|
|
298
|
+
return n;
|
|
299
|
+
}
|
|
300
|
+
function ce(e, r) {
|
|
301
|
+
const n = e.utilities.find((t) => t.name === r);
|
|
302
|
+
if (!n)
|
|
303
|
+
throw new Error(`Utility "${r}" not found`);
|
|
304
|
+
return n;
|
|
305
|
+
}
|
|
306
|
+
function se(e, r) {
|
|
307
|
+
const n = e.modifiers.find(
|
|
308
|
+
(t) => t.key.includes(r)
|
|
300
309
|
);
|
|
301
|
-
if (!
|
|
302
|
-
throw new Error(`Modifier "${
|
|
303
|
-
return
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
+
if (!n)
|
|
311
|
+
throw new Error(`Modifier "${r}" not found`);
|
|
312
|
+
return n;
|
|
313
|
+
}
|
|
314
|
+
const V = "__licenseRequired";
|
|
315
|
+
function I(e) {
|
|
316
|
+
w(e) || Object.defineProperty(e, V, {
|
|
317
|
+
value: !0,
|
|
318
|
+
writable: !1,
|
|
319
|
+
configurable: !1,
|
|
320
|
+
enumerable: !0
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function w(e) {
|
|
324
|
+
return Object.prototype.hasOwnProperty.call(e, V);
|
|
325
|
+
}
|
|
326
|
+
function L(e, r) {
|
|
327
|
+
const n = [...e];
|
|
328
|
+
for (const t of r) {
|
|
329
|
+
const i = n.find(
|
|
330
|
+
(s) => s.name === t.name
|
|
310
331
|
);
|
|
311
|
-
|
|
332
|
+
i ? i.value = t.value : n.push(t);
|
|
312
333
|
}
|
|
313
|
-
return
|
|
334
|
+
return n;
|
|
314
335
|
}
|
|
315
|
-
function
|
|
316
|
-
const
|
|
317
|
-
for (const
|
|
318
|
-
const
|
|
319
|
-
(s) => s.name ===
|
|
336
|
+
function N(e, r) {
|
|
337
|
+
const n = [...e];
|
|
338
|
+
for (const t of r) {
|
|
339
|
+
const i = n.find(
|
|
340
|
+
(s) => s.name === t.name
|
|
320
341
|
);
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
x(
|
|
324
|
-
) :
|
|
342
|
+
i ? Object.assign(
|
|
343
|
+
i,
|
|
344
|
+
x(i, t)
|
|
345
|
+
) : n.push(t);
|
|
325
346
|
}
|
|
326
|
-
return
|
|
347
|
+
return n;
|
|
327
348
|
}
|
|
328
|
-
function x(e,
|
|
349
|
+
function x(e, r) {
|
|
329
350
|
return Object.keys(e).reduce(
|
|
330
|
-
(
|
|
331
|
-
t
|
|
332
|
-
)),
|
|
351
|
+
(n, t) => (t === "variables" ? n.variables = L(e.variables, r.variables) : t === "declarations" ? n.declarations = { ...e.declarations, ...r.declarations } : t === "themes" && j(n) && j(e) && j(r) ? n.themes = N(e.themes, r.themes) : Array.isArray(e[t]) && (n[t] = e[t].concat(
|
|
352
|
+
r[t]
|
|
353
|
+
)), n),
|
|
333
354
|
{
|
|
334
355
|
...e,
|
|
335
|
-
...
|
|
356
|
+
...r
|
|
336
357
|
}
|
|
337
358
|
);
|
|
338
359
|
}
|
|
339
|
-
function
|
|
340
|
-
return
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
360
|
+
function fe(e, ...r) {
|
|
361
|
+
return r.reduce((n, t) => {
|
|
362
|
+
const i = {
|
|
363
|
+
...n,
|
|
364
|
+
root: x(n.root, t.root)
|
|
365
|
+
};
|
|
366
|
+
return (w(n) || w(t)) && I(i), i;
|
|
367
|
+
}, e);
|
|
368
|
+
}
|
|
369
|
+
function q(e) {
|
|
370
|
+
const r = [];
|
|
371
|
+
function n(t, i) {
|
|
372
|
+
i.length > 0 && r.push([...i].sort());
|
|
373
|
+
for (let s = t; s < e.length; s++) {
|
|
374
|
+
const o = e[s];
|
|
375
|
+
if (o)
|
|
376
|
+
if (o.length === 1 && o[0])
|
|
377
|
+
n(s + 1, [...i, o[0]]);
|
|
354
378
|
else
|
|
355
|
-
for (const u of
|
|
356
|
-
|
|
379
|
+
for (const u of o)
|
|
380
|
+
n(s + 1, [...i, u]);
|
|
357
381
|
}
|
|
358
382
|
}
|
|
359
|
-
return
|
|
383
|
+
return n(0, []), r.sort((t, i) => t.length !== i.length ? t.length - i.length : t.join(",").localeCompare(i.join(",")));
|
|
360
384
|
}
|
|
361
|
-
function
|
|
362
|
-
const
|
|
385
|
+
function z(e, r, n) {
|
|
386
|
+
const t = {
|
|
363
387
|
...e,
|
|
364
|
-
modifiers: [...
|
|
365
|
-
},
|
|
366
|
-
for (const s of
|
|
388
|
+
modifiers: [...n.keys()]
|
|
389
|
+
}, i = b(t, r);
|
|
390
|
+
for (const s of n.values())
|
|
367
391
|
s.factory({
|
|
368
|
-
...
|
|
369
|
-
declarations:
|
|
370
|
-
variables:
|
|
371
|
-
children:
|
|
372
|
-
}), g(
|
|
373
|
-
return
|
|
374
|
-
}
|
|
375
|
-
function
|
|
376
|
-
return function(
|
|
392
|
+
...i,
|
|
393
|
+
declarations: A(t.declarations),
|
|
394
|
+
variables: A(t.variables),
|
|
395
|
+
children: A(t.children)
|
|
396
|
+
}), g(t.declarations, i);
|
|
397
|
+
return t;
|
|
398
|
+
}
|
|
399
|
+
function W(e, r) {
|
|
400
|
+
return function(t, i) {
|
|
377
401
|
const s = {
|
|
378
402
|
type: "modifier",
|
|
379
|
-
key: Array.isArray(
|
|
380
|
-
factory:
|
|
403
|
+
key: Array.isArray(t) ? t : [t],
|
|
404
|
+
factory: i
|
|
381
405
|
};
|
|
382
|
-
return
|
|
406
|
+
return r.modifiers.push(s), s;
|
|
383
407
|
};
|
|
384
408
|
}
|
|
385
|
-
function
|
|
409
|
+
function Y() {
|
|
386
410
|
return {
|
|
387
411
|
type: "root",
|
|
388
412
|
declarations: {},
|
|
@@ -394,31 +418,31 @@ function z() {
|
|
|
394
418
|
themes: []
|
|
395
419
|
};
|
|
396
420
|
}
|
|
397
|
-
function
|
|
398
|
-
const
|
|
399
|
-
return
|
|
400
|
-
const
|
|
421
|
+
function G(e, r, n) {
|
|
422
|
+
const t = r.map((s) => s.key);
|
|
423
|
+
return q(t).map((s) => {
|
|
424
|
+
const o = /* @__PURE__ */ new Map();
|
|
401
425
|
for (const u of s) {
|
|
402
|
-
const c =
|
|
426
|
+
const c = r.find(
|
|
403
427
|
(f) => f.key.includes(u)
|
|
404
428
|
);
|
|
405
|
-
c &&
|
|
429
|
+
c && o.set(u, c);
|
|
406
430
|
}
|
|
407
|
-
return
|
|
431
|
+
return z(e, n, o);
|
|
408
432
|
});
|
|
409
433
|
}
|
|
410
|
-
function
|
|
411
|
-
return function(
|
|
434
|
+
function J(e, r) {
|
|
435
|
+
return function(t, i) {
|
|
412
436
|
const s = {
|
|
413
437
|
type: "utility",
|
|
414
|
-
name:
|
|
415
|
-
factory:
|
|
438
|
+
name: t,
|
|
439
|
+
factory: i
|
|
416
440
|
};
|
|
417
|
-
return
|
|
418
|
-
for (const [c, f] of Object.entries(
|
|
441
|
+
return r.utilities.push(s), (o, u = []) => {
|
|
442
|
+
for (const [c, f] of Object.entries(o)) {
|
|
419
443
|
const a = {
|
|
420
444
|
type: "utility",
|
|
421
|
-
name:
|
|
445
|
+
name: t,
|
|
422
446
|
value: c,
|
|
423
447
|
declarations: {},
|
|
424
448
|
variables: [],
|
|
@@ -426,103 +450,105 @@ function W(e, t) {
|
|
|
426
450
|
modifiers: []
|
|
427
451
|
}, l = b(
|
|
428
452
|
a,
|
|
429
|
-
|
|
453
|
+
r
|
|
430
454
|
);
|
|
431
|
-
a.declarations =
|
|
455
|
+
a.declarations = i({
|
|
432
456
|
...l,
|
|
433
457
|
value: f
|
|
434
458
|
}) ?? {}, g(a.declarations, l), e.children.push(a), u.length > 0 && e.children.push(
|
|
435
|
-
...
|
|
459
|
+
...G(a, u, r)
|
|
436
460
|
);
|
|
437
461
|
}
|
|
438
462
|
};
|
|
439
463
|
};
|
|
440
464
|
}
|
|
441
|
-
function
|
|
442
|
-
return function(
|
|
443
|
-
const s =
|
|
465
|
+
function Q(e, r) {
|
|
466
|
+
return function(t, i) {
|
|
467
|
+
const s = r.themes.find((c) => c.name === t), o = s ?? {
|
|
444
468
|
type: "theme",
|
|
445
|
-
name:
|
|
469
|
+
name: t,
|
|
446
470
|
declarations: {},
|
|
447
471
|
variables: [],
|
|
448
472
|
children: []
|
|
449
473
|
};
|
|
450
|
-
s ||
|
|
451
|
-
const u = b(
|
|
452
|
-
return
|
|
474
|
+
s || r.themes.push(o);
|
|
475
|
+
const u = b(o, r);
|
|
476
|
+
return i && i(u), o;
|
|
453
477
|
};
|
|
454
478
|
}
|
|
455
|
-
function
|
|
456
|
-
return function(
|
|
479
|
+
function X(e, r) {
|
|
480
|
+
return function(t, i, s, o) {
|
|
457
481
|
const u = {
|
|
458
482
|
type: "recipe",
|
|
459
|
-
name:
|
|
460
|
-
defaults:
|
|
483
|
+
name: t,
|
|
484
|
+
defaults: i,
|
|
461
485
|
variants: s,
|
|
462
|
-
...
|
|
486
|
+
...o
|
|
463
487
|
};
|
|
464
|
-
return
|
|
488
|
+
return r.recipes.push(u), u;
|
|
465
489
|
};
|
|
466
490
|
}
|
|
467
|
-
function
|
|
468
|
-
const
|
|
491
|
+
function ue(e) {
|
|
492
|
+
const r = $("sf-"), n = Y(), t = { ...e }, i = J(n, n), s = W(n, n), o = X(n, n), u = Q(n, n), { variable: c, selector: f, atRule: a, keyframes: l, media: y, ref: h, css: d } = b(n, n);
|
|
469
493
|
return {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
494
|
+
id: r,
|
|
495
|
+
root: n,
|
|
496
|
+
variable: c,
|
|
497
|
+
selector: f,
|
|
498
|
+
utility: i,
|
|
499
|
+
modifier: s,
|
|
500
|
+
recipe: o,
|
|
501
|
+
theme: u,
|
|
502
|
+
atRule: a,
|
|
503
|
+
keyframes: l,
|
|
504
|
+
media: y,
|
|
505
|
+
ref: h,
|
|
506
|
+
css: d,
|
|
507
|
+
options: t
|
|
483
508
|
};
|
|
484
509
|
}
|
|
485
510
|
export {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
511
|
+
z as applyModifiers,
|
|
512
|
+
ie as capitalizeFirst,
|
|
513
|
+
q as combineKeys,
|
|
514
|
+
R as createAtRuleFunction,
|
|
515
|
+
k as createCssFunction,
|
|
491
516
|
b as createDeclarationsCallbackContext,
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
T as
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
Z as
|
|
517
|
+
E as createKeyframesFunction,
|
|
518
|
+
S as createMediaFunction,
|
|
519
|
+
G as createModifiedUtilityInstances,
|
|
520
|
+
W as createModifierFunction,
|
|
521
|
+
X as createRecipeFunction,
|
|
522
|
+
P as createRefFunction,
|
|
523
|
+
Y as createRoot,
|
|
524
|
+
D as createSelectorFunction,
|
|
525
|
+
Q as createThemeFunction,
|
|
526
|
+
J as createUtilityFunction,
|
|
527
|
+
H as createVariableFunction,
|
|
528
|
+
A as deepClone,
|
|
529
|
+
$ as generateRandomId,
|
|
530
|
+
se as getModifier,
|
|
531
|
+
ce as getUtility,
|
|
532
|
+
oe as getVariable,
|
|
533
|
+
ee as isAtRule,
|
|
534
|
+
T as isCSS,
|
|
535
|
+
C as isContainer,
|
|
536
|
+
ne as isModifier,
|
|
537
|
+
M as isObject,
|
|
538
|
+
_ as isPrimitiveTokenValue,
|
|
539
|
+
F as isRef,
|
|
540
|
+
j as isRoot,
|
|
541
|
+
Z as isSelector,
|
|
542
|
+
re as isTheme,
|
|
517
543
|
p as isToken,
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
544
|
+
O as isTokenValue,
|
|
545
|
+
te as isUtility,
|
|
546
|
+
B as isVariable,
|
|
547
|
+
fe as merge,
|
|
522
548
|
x as mergeContainers,
|
|
523
|
-
|
|
524
|
-
|
|
549
|
+
N as mergeThemesArray,
|
|
550
|
+
L as mergeVariablesArray,
|
|
525
551
|
g as parseDeclarationsBlock,
|
|
526
|
-
|
|
527
|
-
|
|
552
|
+
K as rfdc,
|
|
553
|
+
ue as styleframe
|
|
528
554
|
};
|
package/dist/styleframe.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(a,
|
|
1
|
+
(function(a,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(a=typeof globalThis<"u"?globalThis:a||self,p(a.styleframe={}))})(this,(function(a){"use strict";function p(e,r){return function(t,...i){return{type:"css",value:t.reduce((c,u,o)=>(c.push(u),o<i.length&&c.push(i[o]),c),[])}}}function M(e){return typeof e=="object"&&e!==null}function h(e,r){return M(e)&&"type"in e&&e.type===r}function v(e){return h(e,"variable")}function O(e){return h(e,"reference")}function Z(e){return h(e,"selector")}function x(e){return h(e,"at-rule")}function ee(e){return h(e,"utility")}function te(e){return h(e,"modifier")}function C(e){return h(e,"css")}function ne(e){return h(e,"theme")}function w(e){return h(e,"root")}function S(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null}function V(e){return S(e)||O(e)||C(e)||Array.isArray(e)&&e.every(V)}function B(e){return M(e)&&"children"in e&&"declarations"in e&&"variables"in e}function R(e,r){return function(t,i,s){const c={type:"at-rule",identifier:t,rule:i,declarations:{},variables:[],children:[]},u=g(c,r);return typeof s=="function"?c.declarations=s(u)??{}:s&&(c.declarations=s),j(c.declarations,u),e.children.push(c),c}}function _(e,r){const n=R(e,r);return function(i,s){return n("media",i,s)}}function P(e,r){const n=R(e,r);return function(i,s){return n("keyframes",i,s)}}function U(e,r){return function(t,i){return v(t)?{type:"reference",name:t.name,fallback:i}:{type:"reference",name:t,fallback:i}}}function D(e,r){return function(t,i){const s={type:"selector",query:t,declarations:{},variables:[],children:[]},c=g(s,r);return typeof i=="function"?s.declarations=i(c)??{}:B(i)?(s.variables=i.variables,s.declarations=i.declarations,s.children=i.children):s.declarations=i,j(s.declarations,c),e.children.push(s),s}}function E(e,r){return function(t,i,s={default:!1}){const c=typeof t=="string"?t:t.name,u=e.variables.find(f=>f.name===c);if(s.default&&u)return u;if(u)return u.value=i,u;const o={type:"variable",name:c,value:i};return e.variables.push(o),o}}function g(e,r){const n=E(e),t=D(e,r),i=R(e,r),s=P(r,r),c=_(e,r),u=U(),o=p();return{variable:n,selector:t,keyframes:s,atRule:i,media:c,ref:u,css:o}}function j(e,r){for(const n in e)if(n.startsWith("@")){const t=e[n];if(typeof t=="object"&&t!==null&&!V(t)){const i=n.replace(/^@(\w+).*/,"$1"),s=n.replace(`@${i}`,"").trim();r.atRule(i,s,t),delete e[n]}}else if(/^[.&:]/.test(n)){const t=e[n];typeof t=="object"&&(r.selector(n,t),delete e[n])}return e}function re(e){return e.charAt(0).toUpperCase()+e.slice(1)}function A(e){if(e instanceof Buffer)return Buffer.from(e);const r=e.constructor;return new r(e.buffer.slice(0),e.byteOffset,e.byteLength/e.BYTES_PER_ELEMENT||1)}function K(e){if(e=e||{},e.circular)return ie(e);const r=new Map;if(r.set(Date,c=>new Date(c)),r.set(Map,(c,u)=>new Map(t(Array.from(c),u))),r.set(Set,(c,u)=>new Set(t(Array.from(c),u))),e.constructorHandlers)for(const c of e.constructorHandlers)r.set(c[0],c[1]);let n;return e.proto?s:i;function t(c,u){const o=Object.keys(c),f=Array.from({length:o.length});for(let d=0;d<o.length;d++){const l=o[d],y=c[l];typeof y!="object"||y===null?f[l]=y:y.constructor!==Object&&(n=r.get(y.constructor))?f[l]=n(y,u):ArrayBuffer.isView(y)?f[l]=A(y):f[l]=u(y)}return f}function i(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return t(c,i);if(c.constructor!==Object&&(n=r.get(c.constructor)))return n(c,i);const u={};for(const o in c){if(Object.hasOwnProperty.call(c,o)===!1)continue;const f=c[o];typeof f!="object"||f===null?u[o]=f:f.constructor!==Object&&(n=r.get(f.constructor))?u[o]=n(f,i):ArrayBuffer.isView(f)?u[o]=A(f):u[o]=i(f)}return u}function s(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return t(c,s);if(c.constructor!==Object&&(n=r.get(c.constructor)))return n(c,s);const u={};for(const o in c){const f=c[o];typeof f!="object"||f===null?u[o]=f:f.constructor!==Object&&(n=r.get(f.constructor))?u[o]=n(f,s):ArrayBuffer.isView(f)?u[o]=A(f):u[o]=s(f)}return u}}function ie(e){const r=[],n=[],t=new Map;if(t.set(Date,o=>new Date(o)),t.set(Map,(o,f)=>new Map(s(Array.from(o),f))),t.set(Set,(o,f)=>new Set(s(Array.from(o),f))),e.constructorHandlers)for(const o of e.constructorHandlers)t.set(o[0],o[1]);let i;return e.proto?u:c;function s(o,f){const d=Object.keys(o),l=Array.from({length:d.length});for(let y=0;y<d.length;y++){const b=d[y],m=o[b];if(typeof m!="object"||m===null)l[b]=m;else if(m.constructor!==Object&&(i=t.get(m.constructor)))l[b]=i(m,f);else if(ArrayBuffer.isView(m))l[b]=A(m);else{const X=r.indexOf(m);X!==-1?l[b]=n[X]:l[b]=f(m)}}return l}function c(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return s(o,c);if(o.constructor!==Object&&(i=t.get(o.constructor)))return i(o,c);const f={};r.push(o),n.push(f);for(const d in o){if(Object.hasOwnProperty.call(o,d)===!1)continue;const l=o[d];if(typeof l!="object"||l===null)f[d]=l;else if(l.constructor!==Object&&(i=t.get(l.constructor)))f[d]=i(l,c);else if(ArrayBuffer.isView(l))f[d]=A(l);else{const y=r.indexOf(l);y!==-1?f[d]=n[y]:f[d]=c(l)}}return r.pop(),n.pop(),f}function u(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return s(o,u);if(o.constructor!==Object&&(i=t.get(o.constructor)))return i(o,u);const f={};r.push(o),n.push(f);for(const d in o){const l=o[d];if(typeof l!="object"||l===null)f[d]=l;else if(l.constructor!==Object&&(i=t.get(l.constructor)))f[d]=i(l,u);else if(ArrayBuffer.isView(l))f[d]=A(l);else{const y=r.indexOf(l);y!==-1?f[d]=n[y]:f[d]=u(l)}}return r.pop(),n.pop(),f}}const F=K();function H(e,r=8){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let t="";for(let i=0;i<r;i++){const s=Math.floor(Math.random()*n.length);t+=n[s]}return e?`${e}${t}`:t}function ce(e,r){const n=e.variables.find(t=>t.name===r);if(!n)throw new Error(`Variable "${r}" not found`);return n}function oe(e,r){const n=e.utilities.find(t=>t.name===r);if(!n)throw new Error(`Utility "${r}" not found`);return n}function se(e,r){const n=e.modifiers.find(t=>t.key.includes(r));if(!n)throw new Error(`Modifier "${r}" not found`);return n}const $="__licenseRequired";function fe(e){T(e)||Object.defineProperty(e,$,{value:!0,writable:!1,configurable:!1,enumerable:!0})}function T(e){return Object.prototype.hasOwnProperty.call(e,$)}function I(e,r){const n=[...e];for(const t of r){const i=n.find(s=>s.name===t.name);i?i.value=t.value:n.push(t)}return n}function z(e,r){const n=[...e];for(const t of r){const i=n.find(s=>s.name===t.name);i?Object.assign(i,k(i,t)):n.push(t)}return n}function k(e,r){return Object.keys(e).reduce((n,t)=>(t==="variables"?n.variables=I(e.variables,r.variables):t==="declarations"?n.declarations={...e.declarations,...r.declarations}:t==="themes"&&w(n)&&w(e)&&w(r)?n.themes=z(e.themes,r.themes):Array.isArray(e[t])&&(n[t]=e[t].concat(r[t])),n),{...e,...r})}function ue(e,...r){return r.reduce((n,t)=>{const i={...n,root:k(n.root,t.root)};return(T(n)||T(t))&&fe(i),i},e)}function L(e){const r=[];function n(t,i){i.length>0&&r.push([...i].sort());for(let s=t;s<e.length;s++){const c=e[s];if(c)if(c.length===1&&c[0])n(s+1,[...i,c[0]]);else for(const u of c)n(s+1,[...i,u])}}return n(0,[]),r.sort((t,i)=>t.length!==i.length?t.length-i.length:t.join(",").localeCompare(i.join(",")))}function N(e,r,n){const t={...e,modifiers:[...n.keys()]},i=g(t,r);for(const s of n.values())s.factory({...i,declarations:F(t.declarations),variables:F(t.variables),children:F(t.children)}),j(t.declarations,i);return t}function q(e,r){return function(t,i){const s={type:"modifier",key:Array.isArray(t)?t:[t],factory:i};return r.modifiers.push(s),s}}function W(){return{type:"root",declarations:{},utilities:[],modifiers:[],recipes:[],variables:[],children:[],themes:[]}}function Y(e,r,n){const t=r.map(s=>s.key);return L(t).map(s=>{const c=new Map;for(const u of s){const o=r.find(f=>f.key.includes(u));o&&c.set(u,o)}return N(e,n,c)})}function G(e,r){return function(t,i){const s={type:"utility",name:t,factory:i};return r.utilities.push(s),(c,u=[])=>{for(const[o,f]of Object.entries(c)){const d={type:"utility",name:t,value:o,declarations:{},variables:[],children:[],modifiers:[]},l=g(d,r);d.declarations=i({...l,value:f})??{},j(d.declarations,l),e.children.push(d),u.length>0&&e.children.push(...Y(d,u,r))}}}}function J(e,r){return function(t,i){const s=r.themes.find(o=>o.name===t),c=s??{type:"theme",name:t,declarations:{},variables:[],children:[]};s||r.themes.push(c);const u=g(c,r);return i&&i(u),c}}function Q(e,r){return function(t,i,s,c){const u={type:"recipe",name:t,defaults:i,variants:s,...c};return r.recipes.push(u),u}}function ae(e){const r=H("sf-"),n=W(),t={...e},i=G(n,n),s=q(n,n),c=Q(n,n),u=J(n,n),{variable:o,selector:f,atRule:d,keyframes:l,media:y,ref:b,css:m}=g(n,n);return{id:r,root:n,variable:o,selector:f,utility:i,modifier:s,recipe:c,theme:u,atRule:d,keyframes:l,media:y,ref:b,css:m,options:t}}a.applyModifiers=N,a.capitalizeFirst=re,a.combineKeys=L,a.createAtRuleFunction=R,a.createCssFunction=p,a.createDeclarationsCallbackContext=g,a.createKeyframesFunction=P,a.createMediaFunction=_,a.createModifiedUtilityInstances=Y,a.createModifierFunction=q,a.createRecipeFunction=Q,a.createRefFunction=U,a.createRoot=W,a.createSelectorFunction=D,a.createThemeFunction=J,a.createUtilityFunction=G,a.createVariableFunction=E,a.deepClone=F,a.generateRandomId=H,a.getModifier=se,a.getUtility=oe,a.getVariable=ce,a.isAtRule=x,a.isCSS=C,a.isContainer=B,a.isModifier=te,a.isObject=M,a.isPrimitiveTokenValue=S,a.isRef=O,a.isRoot=w,a.isSelector=Z,a.isTheme=ne,a.isToken=h,a.isTokenValue=V,a.isUtility=ee,a.isVariable=v,a.merge=ue,a.mergeContainers=k,a.mergeThemesArray=z,a.mergeVariablesArray=I,a.parseDeclarationsBlock=j,a.rfdc=K,a.styleframe=ae,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@styleframe/core",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/styleframe.d.ts",
|
|
6
6
|
"module": "./dist/styleframe.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"README.md"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@styleframe/license": "^1.1.0",
|
|
22
23
|
"csstype": "^3.1.3"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
@@ -27,8 +28,8 @@
|
|
|
27
28
|
"vite": "^7.0.6",
|
|
28
29
|
"vitest": "^3.2.4",
|
|
29
30
|
"vite-plugin-dts": "^4.5.4",
|
|
30
|
-
"@styleframe/config-vite": "^1.0
|
|
31
|
-
"@styleframe/config-typescript": "^1.0
|
|
31
|
+
"@styleframe/config-vite": "^1.1.0",
|
|
32
|
+
"@styleframe/config-typescript": "^1.1.0"
|
|
32
33
|
},
|
|
33
34
|
"homepage": "https://github.com/styleframe-dev/styleframe#readme",
|
|
34
35
|
"bugs": {
|