@udixio/theme 1.0.0-beta.12 → 1.0.0-beta.13
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/config.service.d.ts +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/plugins/tailwind/main.d.ts +1 -1
- package/dist/theme.cjs.development.js +77 -460
- package/dist/theme.cjs.development.js.map +1 -1
- package/dist/theme.cjs.production.min.js +1 -1
- package/dist/theme.cjs.production.min.js.map +1 -1
- package/dist/theme.esm.js +77 -460
- package/dist/theme.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/config/config.service.ts +20 -5
- package/src/main.ts +2 -2
- package/src/plugins/tailwind/main.ts +2 -2
package/dist/theme.esm.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { asClass, createContainer, InjectionMode } from 'awilix';
|
|
2
2
|
import { lerp, Contrast, clampDouble, hexFromArgb, Hct, argbFromHex, TonalPalette, DislikeAnalyzer, sanitizeDegreesDouble } from '@material/material-color-utilities';
|
|
3
3
|
import { resolve } from 'path';
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
4
5
|
import plugin from 'tailwindcss/plugin';
|
|
5
6
|
|
|
6
7
|
var ColorService = /*#__PURE__*/function () {
|
|
@@ -63,31 +64,6 @@ function _arrayLikeToArray(r, a) {
|
|
|
63
64
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
64
65
|
return n;
|
|
65
66
|
}
|
|
66
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
67
|
-
try {
|
|
68
|
-
var i = n[a](c),
|
|
69
|
-
u = i.value;
|
|
70
|
-
} catch (n) {
|
|
71
|
-
return void e(n);
|
|
72
|
-
}
|
|
73
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
74
|
-
}
|
|
75
|
-
function _asyncToGenerator(n) {
|
|
76
|
-
return function () {
|
|
77
|
-
var t = this,
|
|
78
|
-
e = arguments;
|
|
79
|
-
return new Promise(function (r, o) {
|
|
80
|
-
var a = n.apply(t, e);
|
|
81
|
-
function _next(n) {
|
|
82
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
83
|
-
}
|
|
84
|
-
function _throw(n) {
|
|
85
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
86
|
-
}
|
|
87
|
-
_next(void 0);
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
67
|
function _defineProperties(e, r) {
|
|
92
68
|
for (var t = 0; t < r.length; t++) {
|
|
93
69
|
var o = r[t];
|
|
@@ -128,307 +104,6 @@ function _extends() {
|
|
|
128
104
|
function _inheritsLoose(t, o) {
|
|
129
105
|
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
130
106
|
}
|
|
131
|
-
function _regeneratorRuntime() {
|
|
132
|
-
_regeneratorRuntime = function () {
|
|
133
|
-
return e;
|
|
134
|
-
};
|
|
135
|
-
var t,
|
|
136
|
-
e = {},
|
|
137
|
-
r = Object.prototype,
|
|
138
|
-
n = r.hasOwnProperty,
|
|
139
|
-
o = Object.defineProperty || function (t, e, r) {
|
|
140
|
-
t[e] = r.value;
|
|
141
|
-
},
|
|
142
|
-
i = "function" == typeof Symbol ? Symbol : {},
|
|
143
|
-
a = i.iterator || "@@iterator",
|
|
144
|
-
c = i.asyncIterator || "@@asyncIterator",
|
|
145
|
-
u = i.toStringTag || "@@toStringTag";
|
|
146
|
-
function define(t, e, r) {
|
|
147
|
-
return Object.defineProperty(t, e, {
|
|
148
|
-
value: r,
|
|
149
|
-
enumerable: !0,
|
|
150
|
-
configurable: !0,
|
|
151
|
-
writable: !0
|
|
152
|
-
}), t[e];
|
|
153
|
-
}
|
|
154
|
-
try {
|
|
155
|
-
define({}, "");
|
|
156
|
-
} catch (t) {
|
|
157
|
-
define = function (t, e, r) {
|
|
158
|
-
return t[e] = r;
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
function wrap(t, e, r, n) {
|
|
162
|
-
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
163
|
-
a = Object.create(i.prototype),
|
|
164
|
-
c = new Context(n || []);
|
|
165
|
-
return o(a, "_invoke", {
|
|
166
|
-
value: makeInvokeMethod(t, r, c)
|
|
167
|
-
}), a;
|
|
168
|
-
}
|
|
169
|
-
function tryCatch(t, e, r) {
|
|
170
|
-
try {
|
|
171
|
-
return {
|
|
172
|
-
type: "normal",
|
|
173
|
-
arg: t.call(e, r)
|
|
174
|
-
};
|
|
175
|
-
} catch (t) {
|
|
176
|
-
return {
|
|
177
|
-
type: "throw",
|
|
178
|
-
arg: t
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
e.wrap = wrap;
|
|
183
|
-
var h = "suspendedStart",
|
|
184
|
-
l = "suspendedYield",
|
|
185
|
-
f = "executing",
|
|
186
|
-
s = "completed",
|
|
187
|
-
y = {};
|
|
188
|
-
function Generator() {}
|
|
189
|
-
function GeneratorFunction() {}
|
|
190
|
-
function GeneratorFunctionPrototype() {}
|
|
191
|
-
var p = {};
|
|
192
|
-
define(p, a, function () {
|
|
193
|
-
return this;
|
|
194
|
-
});
|
|
195
|
-
var d = Object.getPrototypeOf,
|
|
196
|
-
v = d && d(d(values([])));
|
|
197
|
-
v && v !== r && n.call(v, a) && (p = v);
|
|
198
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
199
|
-
function defineIteratorMethods(t) {
|
|
200
|
-
["next", "throw", "return"].forEach(function (e) {
|
|
201
|
-
define(t, e, function (t) {
|
|
202
|
-
return this._invoke(e, t);
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
function AsyncIterator(t, e) {
|
|
207
|
-
function invoke(r, o, i, a) {
|
|
208
|
-
var c = tryCatch(t[r], t, o);
|
|
209
|
-
if ("throw" !== c.type) {
|
|
210
|
-
var u = c.arg,
|
|
211
|
-
h = u.value;
|
|
212
|
-
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
213
|
-
invoke("next", t, i, a);
|
|
214
|
-
}, function (t) {
|
|
215
|
-
invoke("throw", t, i, a);
|
|
216
|
-
}) : e.resolve(h).then(function (t) {
|
|
217
|
-
u.value = t, i(u);
|
|
218
|
-
}, function (t) {
|
|
219
|
-
return invoke("throw", t, i, a);
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
a(c.arg);
|
|
223
|
-
}
|
|
224
|
-
var r;
|
|
225
|
-
o(this, "_invoke", {
|
|
226
|
-
value: function (t, n) {
|
|
227
|
-
function callInvokeWithMethodAndArg() {
|
|
228
|
-
return new e(function (e, r) {
|
|
229
|
-
invoke(t, n, e, r);
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
function makeInvokeMethod(e, r, n) {
|
|
237
|
-
var o = h;
|
|
238
|
-
return function (i, a) {
|
|
239
|
-
if (o === f) throw Error("Generator is already running");
|
|
240
|
-
if (o === s) {
|
|
241
|
-
if ("throw" === i) throw a;
|
|
242
|
-
return {
|
|
243
|
-
value: t,
|
|
244
|
-
done: !0
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
for (n.method = i, n.arg = a;;) {
|
|
248
|
-
var c = n.delegate;
|
|
249
|
-
if (c) {
|
|
250
|
-
var u = maybeInvokeDelegate(c, n);
|
|
251
|
-
if (u) {
|
|
252
|
-
if (u === y) continue;
|
|
253
|
-
return u;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
257
|
-
if (o === h) throw o = s, n.arg;
|
|
258
|
-
n.dispatchException(n.arg);
|
|
259
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
260
|
-
o = f;
|
|
261
|
-
var p = tryCatch(e, r, n);
|
|
262
|
-
if ("normal" === p.type) {
|
|
263
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
264
|
-
return {
|
|
265
|
-
value: p.arg,
|
|
266
|
-
done: n.done
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
function maybeInvokeDelegate(e, r) {
|
|
274
|
-
var n = r.method,
|
|
275
|
-
o = e.iterator[n];
|
|
276
|
-
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
277
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
278
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
279
|
-
var a = i.arg;
|
|
280
|
-
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
281
|
-
}
|
|
282
|
-
function pushTryEntry(t) {
|
|
283
|
-
var e = {
|
|
284
|
-
tryLoc: t[0]
|
|
285
|
-
};
|
|
286
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
287
|
-
}
|
|
288
|
-
function resetTryEntry(t) {
|
|
289
|
-
var e = t.completion || {};
|
|
290
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
291
|
-
}
|
|
292
|
-
function Context(t) {
|
|
293
|
-
this.tryEntries = [{
|
|
294
|
-
tryLoc: "root"
|
|
295
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
296
|
-
}
|
|
297
|
-
function values(e) {
|
|
298
|
-
if (e || "" === e) {
|
|
299
|
-
var r = e[a];
|
|
300
|
-
if (r) return r.call(e);
|
|
301
|
-
if ("function" == typeof e.next) return e;
|
|
302
|
-
if (!isNaN(e.length)) {
|
|
303
|
-
var o = -1,
|
|
304
|
-
i = function next() {
|
|
305
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
306
|
-
return next.value = t, next.done = !0, next;
|
|
307
|
-
};
|
|
308
|
-
return i.next = i;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
312
|
-
}
|
|
313
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
314
|
-
value: GeneratorFunctionPrototype,
|
|
315
|
-
configurable: !0
|
|
316
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
317
|
-
value: GeneratorFunction,
|
|
318
|
-
configurable: !0
|
|
319
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
320
|
-
var e = "function" == typeof t && t.constructor;
|
|
321
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
322
|
-
}, e.mark = function (t) {
|
|
323
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
324
|
-
}, e.awrap = function (t) {
|
|
325
|
-
return {
|
|
326
|
-
__await: t
|
|
327
|
-
};
|
|
328
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
329
|
-
return this;
|
|
330
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
331
|
-
void 0 === i && (i = Promise);
|
|
332
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
333
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
334
|
-
return t.done ? t.value : a.next();
|
|
335
|
-
});
|
|
336
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
337
|
-
return this;
|
|
338
|
-
}), define(g, "toString", function () {
|
|
339
|
-
return "[object Generator]";
|
|
340
|
-
}), e.keys = function (t) {
|
|
341
|
-
var e = Object(t),
|
|
342
|
-
r = [];
|
|
343
|
-
for (var n in e) r.push(n);
|
|
344
|
-
return r.reverse(), function next() {
|
|
345
|
-
for (; r.length;) {
|
|
346
|
-
var t = r.pop();
|
|
347
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
348
|
-
}
|
|
349
|
-
return next.done = !0, next;
|
|
350
|
-
};
|
|
351
|
-
}, e.values = values, Context.prototype = {
|
|
352
|
-
constructor: Context,
|
|
353
|
-
reset: function (e) {
|
|
354
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
355
|
-
},
|
|
356
|
-
stop: function () {
|
|
357
|
-
this.done = !0;
|
|
358
|
-
var t = this.tryEntries[0].completion;
|
|
359
|
-
if ("throw" === t.type) throw t.arg;
|
|
360
|
-
return this.rval;
|
|
361
|
-
},
|
|
362
|
-
dispatchException: function (e) {
|
|
363
|
-
if (this.done) throw e;
|
|
364
|
-
var r = this;
|
|
365
|
-
function handle(n, o) {
|
|
366
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
367
|
-
}
|
|
368
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
369
|
-
var i = this.tryEntries[o],
|
|
370
|
-
a = i.completion;
|
|
371
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
372
|
-
if (i.tryLoc <= this.prev) {
|
|
373
|
-
var c = n.call(i, "catchLoc"),
|
|
374
|
-
u = n.call(i, "finallyLoc");
|
|
375
|
-
if (c && u) {
|
|
376
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
377
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
378
|
-
} else if (c) {
|
|
379
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
380
|
-
} else {
|
|
381
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
382
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
},
|
|
387
|
-
abrupt: function (t, e) {
|
|
388
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
389
|
-
var o = this.tryEntries[r];
|
|
390
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
391
|
-
var i = o;
|
|
392
|
-
break;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
396
|
-
var a = i ? i.completion : {};
|
|
397
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
398
|
-
},
|
|
399
|
-
complete: function (t, e) {
|
|
400
|
-
if ("throw" === t.type) throw t.arg;
|
|
401
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
402
|
-
},
|
|
403
|
-
finish: function (t) {
|
|
404
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
405
|
-
var r = this.tryEntries[e];
|
|
406
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
407
|
-
}
|
|
408
|
-
},
|
|
409
|
-
catch: function (t) {
|
|
410
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
411
|
-
var r = this.tryEntries[e];
|
|
412
|
-
if (r.tryLoc === t) {
|
|
413
|
-
var n = r.completion;
|
|
414
|
-
if ("throw" === n.type) {
|
|
415
|
-
var o = n.arg;
|
|
416
|
-
resetTryEntry(r);
|
|
417
|
-
}
|
|
418
|
-
return o;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
throw Error("illegal catch attempt");
|
|
422
|
-
},
|
|
423
|
-
delegateYield: function (e, r, n) {
|
|
424
|
-
return this.delegate = {
|
|
425
|
-
iterator: values(e),
|
|
426
|
-
resultName: r,
|
|
427
|
-
nextLoc: n
|
|
428
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
429
|
-
}
|
|
430
|
-
}, e;
|
|
431
|
-
}
|
|
432
107
|
function _setPrototypeOf(t, e) {
|
|
433
108
|
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
434
109
|
return t.__proto__ = e, t;
|
|
@@ -1824,93 +1499,72 @@ var ConfigService = /*#__PURE__*/function () {
|
|
|
1824
1499
|
this.appService = appService;
|
|
1825
1500
|
}
|
|
1826
1501
|
var _proto = ConfigService.prototype;
|
|
1827
|
-
_proto.loadConfig =
|
|
1828
|
-
var
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
Object.entries(palettes).forEach(function (_ref2) {
|
|
1858
|
-
var key = _ref2[0],
|
|
1859
|
-
value = _ref2[1];
|
|
1860
|
-
return themeService.addCustomPalette(key, value);
|
|
1861
|
-
});
|
|
1862
|
-
}
|
|
1863
|
-
if (useDefaultColors) {
|
|
1864
|
-
colorService.addColors(defaultColors);
|
|
1865
|
-
}
|
|
1866
|
-
if (colors) {
|
|
1867
|
-
colorService.addColors(colors);
|
|
1868
|
-
}
|
|
1869
|
-
if (plugins) {
|
|
1870
|
-
plugins.forEach(function (plugin) {
|
|
1871
|
-
if (Array.isArray(plugin)) {
|
|
1872
|
-
pluginService.addPlugin(plugin[0], plugin[1]);
|
|
1873
|
-
} else {
|
|
1874
|
-
pluginService.addPlugin(plugin, {});
|
|
1875
|
-
}
|
|
1876
|
-
});
|
|
1877
|
-
pluginService.loadPlugins(this.appService);
|
|
1878
|
-
}
|
|
1879
|
-
case 21:
|
|
1880
|
-
case "end":
|
|
1881
|
-
return _context.stop();
|
|
1882
|
-
}
|
|
1883
|
-
}, _callee, this);
|
|
1884
|
-
}));
|
|
1885
|
-
function loadConfig() {
|
|
1886
|
-
return _loadConfig.apply(this, arguments);
|
|
1502
|
+
_proto.loadConfig = function loadConfig() {
|
|
1503
|
+
var _this$appService = this.appService,
|
|
1504
|
+
themeService = _this$appService.themeService,
|
|
1505
|
+
colorService = _this$appService.colorService,
|
|
1506
|
+
pluginService = _this$appService.pluginService;
|
|
1507
|
+
var _this$getConfig = this.getConfig(),
|
|
1508
|
+
sourceColor = _this$getConfig.sourceColor,
|
|
1509
|
+
_this$getConfig$contr = _this$getConfig.contrastLevel,
|
|
1510
|
+
contrastLevel = _this$getConfig$contr === void 0 ? 0 : _this$getConfig$contr,
|
|
1511
|
+
_this$getConfig$isDar = _this$getConfig.isDark,
|
|
1512
|
+
isDark = _this$getConfig$isDar === void 0 ? false : _this$getConfig$isDar,
|
|
1513
|
+
_this$getConfig$varia = _this$getConfig.variant,
|
|
1514
|
+
variant = _this$getConfig$varia === void 0 ? VariantModel.tonalSpot : _this$getConfig$varia,
|
|
1515
|
+
palettes = _this$getConfig.palettes,
|
|
1516
|
+
colors = _this$getConfig.colors,
|
|
1517
|
+
_this$getConfig$useDe = _this$getConfig.useDefaultColors,
|
|
1518
|
+
useDefaultColors = _this$getConfig$useDe === void 0 ? true : _this$getConfig$useDe,
|
|
1519
|
+
plugins = _this$getConfig.plugins;
|
|
1520
|
+
themeService.create({
|
|
1521
|
+
contrastLevel: contrastLevel,
|
|
1522
|
+
isDark: isDark,
|
|
1523
|
+
sourceColorHex: sourceColor,
|
|
1524
|
+
variant: variant
|
|
1525
|
+
});
|
|
1526
|
+
if (palettes) {
|
|
1527
|
+
Object.entries(palettes).forEach(function (_ref2) {
|
|
1528
|
+
var key = _ref2[0],
|
|
1529
|
+
value = _ref2[1];
|
|
1530
|
+
return themeService.addCustomPalette(key, value);
|
|
1531
|
+
});
|
|
1887
1532
|
}
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
configImport = _context2.sent;
|
|
1901
|
-
config = configImport["default"];
|
|
1902
|
-
return _context2.abrupt("return", config);
|
|
1903
|
-
case 6:
|
|
1904
|
-
case "end":
|
|
1905
|
-
return _context2.stop();
|
|
1533
|
+
if (useDefaultColors) {
|
|
1534
|
+
colorService.addColors(defaultColors);
|
|
1535
|
+
}
|
|
1536
|
+
if (colors) {
|
|
1537
|
+
colorService.addColors(colors);
|
|
1538
|
+
}
|
|
1539
|
+
if (plugins) {
|
|
1540
|
+
plugins.forEach(function (plugin) {
|
|
1541
|
+
if (Array.isArray(plugin)) {
|
|
1542
|
+
pluginService.addPlugin(plugin[0], plugin[1]);
|
|
1543
|
+
} else {
|
|
1544
|
+
pluginService.addPlugin(plugin, {});
|
|
1906
1545
|
}
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1546
|
+
});
|
|
1547
|
+
pluginService.loadPlugins(this.appService);
|
|
1548
|
+
}
|
|
1549
|
+
};
|
|
1550
|
+
_proto.getConfig = function getConfig() {
|
|
1551
|
+
var base = resolve(this.configPath);
|
|
1552
|
+
var extensions = ['.js', '.ts', '.jms', '.jcs'];
|
|
1553
|
+
var configImport = null;
|
|
1554
|
+
for (var _i = 0, _extensions = extensions; _i < _extensions.length; _i++) {
|
|
1555
|
+
var ext = _extensions[_i];
|
|
1556
|
+
var path = base + ext;
|
|
1557
|
+
if (existsSync(path)) {
|
|
1558
|
+
configImport = require(path);
|
|
1559
|
+
break;
|
|
1560
|
+
}
|
|
1911
1561
|
}
|
|
1912
|
-
|
|
1913
|
-
|
|
1562
|
+
if (!configImport) {
|
|
1563
|
+
throw new Error('Configuration file not found');
|
|
1564
|
+
}
|
|
1565
|
+
var config = configImport["default"];
|
|
1566
|
+
return config;
|
|
1567
|
+
};
|
|
1914
1568
|
return ConfigService;
|
|
1915
1569
|
}();
|
|
1916
1570
|
|
|
@@ -1965,28 +1619,11 @@ importContainer(AppContainer, [ConfigModule, AppModule, PluginModule, ColorModul
|
|
|
1965
1619
|
function bootstrap() {
|
|
1966
1620
|
return AppContainer.resolve('appService');
|
|
1967
1621
|
}
|
|
1968
|
-
function bootstrapFromConfig(
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
var configService;
|
|
1974
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1975
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1976
|
-
case 0:
|
|
1977
|
-
configService = AppContainer.resolve('configService');
|
|
1978
|
-
if (path) configService.configPath = path;
|
|
1979
|
-
_context.next = 4;
|
|
1980
|
-
return configService.loadConfig();
|
|
1981
|
-
case 4:
|
|
1982
|
-
return _context.abrupt("return", AppContainer.resolve('appService'));
|
|
1983
|
-
case 5:
|
|
1984
|
-
case "end":
|
|
1985
|
-
return _context.stop();
|
|
1986
|
-
}
|
|
1987
|
-
}, _callee);
|
|
1988
|
-
}));
|
|
1989
|
-
return _bootstrapFromConfig.apply(this, arguments);
|
|
1622
|
+
function bootstrapFromConfig(path) {
|
|
1623
|
+
var configService = AppContainer.resolve('configService');
|
|
1624
|
+
if (path) configService.configPath = path;
|
|
1625
|
+
configService.loadConfig();
|
|
1626
|
+
return AppContainer.resolve('appService');
|
|
1990
1627
|
}
|
|
1991
1628
|
|
|
1992
1629
|
var PluginAbstract = function PluginAbstract() {};
|
|
@@ -2124,34 +1761,14 @@ var TailwindPlugin = /*#__PURE__*/function (_PluginAbstract) {
|
|
|
2124
1761
|
return TailwindPlugin;
|
|
2125
1762
|
}(PluginAbstract);
|
|
2126
1763
|
|
|
2127
|
-
var createTheme =
|
|
2128
|
-
var
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
case 2:
|
|
2136
|
-
app = _context.sent;
|
|
2137
|
-
plugin = app.pluginService.getPlugin(TailwindPlugin);
|
|
2138
|
-
if (plugin) {
|
|
2139
|
-
_context.next = 6;
|
|
2140
|
-
break;
|
|
2141
|
-
}
|
|
2142
|
-
throw new Error('Tailwind plugin not found');
|
|
2143
|
-
case 6:
|
|
2144
|
-
return _context.abrupt("return", plugin.getTheme());
|
|
2145
|
-
case 7:
|
|
2146
|
-
case "end":
|
|
2147
|
-
return _context.stop();
|
|
2148
|
-
}
|
|
2149
|
-
}, _callee);
|
|
2150
|
-
}));
|
|
2151
|
-
return function createTheme() {
|
|
2152
|
-
return _ref.apply(this, arguments);
|
|
2153
|
-
};
|
|
2154
|
-
}();
|
|
1764
|
+
var createTheme = function createTheme() {
|
|
1765
|
+
var app = bootstrapFromConfig();
|
|
1766
|
+
var plugin = app.pluginService.getPlugin(TailwindPlugin);
|
|
1767
|
+
if (!plugin) {
|
|
1768
|
+
throw new Error('Tailwind plugin not found');
|
|
1769
|
+
}
|
|
1770
|
+
return plugin.getTheme();
|
|
1771
|
+
};
|
|
2155
1772
|
|
|
2156
1773
|
export { AppContainer, AppModule, AppService, ColorEntity, ColorManagerService, ColorModule, ColorService, ConfigModule, ConfigService, ContrastCurve, DynamicColor, PluginAbstract, PluginModule, PluginService, SchemeEntity, SchemeService, TailwindPlugin, ThemeModule, ThemeService, ToneDeltaPair, VariantEntity, VariantModel, VariantService, bootstrap, bootstrapFromConfig, createTheme, defaultColors, defineConfig, getRotatedHue, highestSurface, importContainer, state, themer };
|
|
2157
1774
|
//# sourceMappingURL=theme.esm.js.map
|