@udixio/theme 1.0.0-beta.4 → 1.0.0-beta.6

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.
Files changed (47) hide show
  1. package/dist/app.container.d.ts +5 -0
  2. package/dist/app.module.d.ts +2 -2
  3. package/dist/app.service.d.ts +4 -1
  4. package/dist/color/color-manager.service.d.ts +4 -2
  5. package/dist/color/color.module.d.ts +2 -2
  6. package/dist/color/color.service.d.ts +4 -2
  7. package/dist/color/entities/index.d.ts +1 -0
  8. package/dist/color/index.d.ts +6 -0
  9. package/dist/color/models/index.d.ts +1 -0
  10. package/dist/index.d.ts +5 -0
  11. package/dist/main.d.ts +1 -1
  12. package/dist/material-color-utilities/index.d.ts +1 -0
  13. package/dist/theme/entities/index.d.ts +2 -0
  14. package/dist/theme/index.d.ts +4 -0
  15. package/dist/theme/models/index.d.ts +1 -0
  16. package/dist/theme/services/index.d.ts +3 -0
  17. package/dist/theme/services/theme.service.d.ts +6 -3
  18. package/dist/theme/services/variant.service.d.ts +4 -2
  19. package/dist/theme/theme.module.d.ts +2 -2
  20. package/dist/theme.cjs.development.js +320 -567
  21. package/dist/theme.cjs.development.js.map +1 -1
  22. package/dist/theme.cjs.production.min.js +1 -1
  23. package/dist/theme.cjs.production.min.js.map +1 -1
  24. package/dist/theme.esm.js +303 -569
  25. package/dist/theme.esm.js.map +1 -1
  26. package/package.json +8 -13
  27. package/src/app.container.ts +38 -0
  28. package/src/app.module.ts +5 -8
  29. package/src/app.service.spec.ts +1 -1
  30. package/src/app.service.ts +12 -6
  31. package/src/color/color-manager.service.ts +4 -3
  32. package/src/color/color.module.ts +6 -8
  33. package/src/color/color.service.ts +8 -3
  34. package/src/color/entities/index.ts +1 -0
  35. package/src/color/index.ts +6 -0
  36. package/src/color/models/index.ts +1 -0
  37. package/src/index.ts +5 -0
  38. package/src/main.ts +3 -8
  39. package/src/material-color-utilities/index.ts +1 -0
  40. package/src/theme/entities/index.ts +2 -0
  41. package/src/theme/index.ts +4 -0
  42. package/src/theme/models/index.ts +1 -0
  43. package/src/theme/services/index.ts +3 -0
  44. package/src/theme/services/scheme.service.ts +0 -2
  45. package/src/theme/services/theme.service.ts +12 -6
  46. package/src/theme/services/variant.service.ts +4 -3
  47. package/src/theme/theme.module.ts +8 -9
@@ -2,373 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var core = require('@nestjs/core');
6
- var tslib = require('tslib');
7
- var common = require('@nestjs/common');
5
+ var awilix = require('awilix');
8
6
  var materialColorUtilities = require('@material/material-color-utilities');
9
7
  var mergeDeep = require('merge-deep');
10
8
 
11
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
12
- try {
13
- var i = n[a](c),
14
- u = i.value;
15
- } catch (n) {
16
- return void e(n);
17
- }
18
- i.done ? t(u) : Promise.resolve(u).then(r, o);
19
- }
20
- function _asyncToGenerator(n) {
21
- return function () {
22
- var t = this,
23
- e = arguments;
24
- return new Promise(function (r, o) {
25
- var a = n.apply(t, e);
26
- function _next(n) {
27
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
28
- }
29
- function _throw(n) {
30
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
31
- }
32
- _next(void 0);
33
- });
34
- };
35
- }
36
- function _defineProperties(e, r) {
37
- for (var t = 0; t < r.length; t++) {
38
- var o = r[t];
39
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
40
- }
41
- }
42
- function _createClass(e, r, t) {
43
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
44
- writable: !1
45
- }), e;
46
- }
47
- function _extends() {
48
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
49
- for (var e = 1; e < arguments.length; e++) {
50
- var t = arguments[e];
51
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
52
- }
53
- return n;
54
- }, _extends.apply(null, arguments);
55
- }
56
- function _regeneratorRuntime() {
57
- _regeneratorRuntime = function () {
58
- return e;
59
- };
60
- var t,
61
- e = {},
62
- r = Object.prototype,
63
- n = r.hasOwnProperty,
64
- o = Object.defineProperty || function (t, e, r) {
65
- t[e] = r.value;
66
- },
67
- i = "function" == typeof Symbol ? Symbol : {},
68
- a = i.iterator || "@@iterator",
69
- c = i.asyncIterator || "@@asyncIterator",
70
- u = i.toStringTag || "@@toStringTag";
71
- function define(t, e, r) {
72
- return Object.defineProperty(t, e, {
73
- value: r,
74
- enumerable: !0,
75
- configurable: !0,
76
- writable: !0
77
- }), t[e];
78
- }
79
- try {
80
- define({}, "");
81
- } catch (t) {
82
- define = function (t, e, r) {
83
- return t[e] = r;
84
- };
85
- }
86
- function wrap(t, e, r, n) {
87
- var i = e && e.prototype instanceof Generator ? e : Generator,
88
- a = Object.create(i.prototype),
89
- c = new Context(n || []);
90
- return o(a, "_invoke", {
91
- value: makeInvokeMethod(t, r, c)
92
- }), a;
93
- }
94
- function tryCatch(t, e, r) {
95
- try {
96
- return {
97
- type: "normal",
98
- arg: t.call(e, r)
99
- };
100
- } catch (t) {
101
- return {
102
- type: "throw",
103
- arg: t
104
- };
105
- }
106
- }
107
- e.wrap = wrap;
108
- var h = "suspendedStart",
109
- l = "suspendedYield",
110
- f = "executing",
111
- s = "completed",
112
- y = {};
113
- function Generator() {}
114
- function GeneratorFunction() {}
115
- function GeneratorFunctionPrototype() {}
116
- var p = {};
117
- define(p, a, function () {
118
- return this;
119
- });
120
- var d = Object.getPrototypeOf,
121
- v = d && d(d(values([])));
122
- v && v !== r && n.call(v, a) && (p = v);
123
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
124
- function defineIteratorMethods(t) {
125
- ["next", "throw", "return"].forEach(function (e) {
126
- define(t, e, function (t) {
127
- return this._invoke(e, t);
128
- });
129
- });
130
- }
131
- function AsyncIterator(t, e) {
132
- function invoke(r, o, i, a) {
133
- var c = tryCatch(t[r], t, o);
134
- if ("throw" !== c.type) {
135
- var u = c.arg,
136
- h = u.value;
137
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
138
- invoke("next", t, i, a);
139
- }, function (t) {
140
- invoke("throw", t, i, a);
141
- }) : e.resolve(h).then(function (t) {
142
- u.value = t, i(u);
143
- }, function (t) {
144
- return invoke("throw", t, i, a);
145
- });
146
- }
147
- a(c.arg);
148
- }
149
- var r;
150
- o(this, "_invoke", {
151
- value: function (t, n) {
152
- function callInvokeWithMethodAndArg() {
153
- return new e(function (e, r) {
154
- invoke(t, n, e, r);
155
- });
156
- }
157
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
158
- }
159
- });
160
- }
161
- function makeInvokeMethod(e, r, n) {
162
- var o = h;
163
- return function (i, a) {
164
- if (o === f) throw Error("Generator is already running");
165
- if (o === s) {
166
- if ("throw" === i) throw a;
167
- return {
168
- value: t,
169
- done: !0
170
- };
171
- }
172
- for (n.method = i, n.arg = a;;) {
173
- var c = n.delegate;
174
- if (c) {
175
- var u = maybeInvokeDelegate(c, n);
176
- if (u) {
177
- if (u === y) continue;
178
- return u;
179
- }
180
- }
181
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
182
- if (o === h) throw o = s, n.arg;
183
- n.dispatchException(n.arg);
184
- } else "return" === n.method && n.abrupt("return", n.arg);
185
- o = f;
186
- var p = tryCatch(e, r, n);
187
- if ("normal" === p.type) {
188
- if (o = n.done ? s : l, p.arg === y) continue;
189
- return {
190
- value: p.arg,
191
- done: n.done
192
- };
193
- }
194
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
195
- }
196
- };
197
- }
198
- function maybeInvokeDelegate(e, r) {
199
- var n = r.method,
200
- o = e.iterator[n];
201
- 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;
202
- var i = tryCatch(o, e.iterator, r.arg);
203
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
204
- var a = i.arg;
205
- 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);
206
- }
207
- function pushTryEntry(t) {
208
- var e = {
209
- tryLoc: t[0]
210
- };
211
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
212
- }
213
- function resetTryEntry(t) {
214
- var e = t.completion || {};
215
- e.type = "normal", delete e.arg, t.completion = e;
216
- }
217
- function Context(t) {
218
- this.tryEntries = [{
219
- tryLoc: "root"
220
- }], t.forEach(pushTryEntry, this), this.reset(!0);
221
- }
222
- function values(e) {
223
- if (e || "" === e) {
224
- var r = e[a];
225
- if (r) return r.call(e);
226
- if ("function" == typeof e.next) return e;
227
- if (!isNaN(e.length)) {
228
- var o = -1,
229
- i = function next() {
230
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
231
- return next.value = t, next.done = !0, next;
232
- };
233
- return i.next = i;
234
- }
235
- }
236
- throw new TypeError(typeof e + " is not iterable");
237
- }
238
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
239
- value: GeneratorFunctionPrototype,
240
- configurable: !0
241
- }), o(GeneratorFunctionPrototype, "constructor", {
242
- value: GeneratorFunction,
243
- configurable: !0
244
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
245
- var e = "function" == typeof t && t.constructor;
246
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
247
- }, e.mark = function (t) {
248
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
249
- }, e.awrap = function (t) {
250
- return {
251
- __await: t
252
- };
253
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
254
- return this;
255
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
256
- void 0 === i && (i = Promise);
257
- var a = new AsyncIterator(wrap(t, r, n, o), i);
258
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
259
- return t.done ? t.value : a.next();
260
- });
261
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
262
- return this;
263
- }), define(g, "toString", function () {
264
- return "[object Generator]";
265
- }), e.keys = function (t) {
266
- var e = Object(t),
267
- r = [];
268
- for (var n in e) r.push(n);
269
- return r.reverse(), function next() {
270
- for (; r.length;) {
271
- var t = r.pop();
272
- if (t in e) return next.value = t, next.done = !1, next;
273
- }
274
- return next.done = !0, next;
275
- };
276
- }, e.values = values, Context.prototype = {
277
- constructor: Context,
278
- reset: function (e) {
279
- 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);
280
- },
281
- stop: function () {
282
- this.done = !0;
283
- var t = this.tryEntries[0].completion;
284
- if ("throw" === t.type) throw t.arg;
285
- return this.rval;
286
- },
287
- dispatchException: function (e) {
288
- if (this.done) throw e;
289
- var r = this;
290
- function handle(n, o) {
291
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
292
- }
293
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
294
- var i = this.tryEntries[o],
295
- a = i.completion;
296
- if ("root" === i.tryLoc) return handle("end");
297
- if (i.tryLoc <= this.prev) {
298
- var c = n.call(i, "catchLoc"),
299
- u = n.call(i, "finallyLoc");
300
- if (c && u) {
301
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
302
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
303
- } else if (c) {
304
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
305
- } else {
306
- if (!u) throw Error("try statement without catch or finally");
307
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
308
- }
309
- }
310
- }
311
- },
312
- abrupt: function (t, e) {
313
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
314
- var o = this.tryEntries[r];
315
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
316
- var i = o;
317
- break;
318
- }
319
- }
320
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
321
- var a = i ? i.completion : {};
322
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
323
- },
324
- complete: function (t, e) {
325
- if ("throw" === t.type) throw t.arg;
326
- 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;
327
- },
328
- finish: function (t) {
329
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
330
- var r = this.tryEntries[e];
331
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
332
- }
333
- },
334
- catch: function (t) {
335
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
336
- var r = this.tryEntries[e];
337
- if (r.tryLoc === t) {
338
- var n = r.completion;
339
- if ("throw" === n.type) {
340
- var o = n.arg;
341
- resetTryEntry(r);
342
- }
343
- return o;
344
- }
345
- }
346
- throw Error("illegal catch attempt");
347
- },
348
- delegateYield: function (e, r, n) {
349
- return this.delegate = {
350
- iterator: values(e),
351
- resultName: r,
352
- nextLoc: n
353
- }, "next" === this.method && (this.arg = t), y;
354
- }
355
- }, e;
356
- }
357
- function _toPrimitive(t, r) {
358
- if ("object" != typeof t || !t) return t;
359
- var e = t[Symbol.toPrimitive];
360
- if (void 0 !== e) {
361
- var i = e.call(t, r || "default");
362
- if ("object" != typeof i) return i;
363
- throw new TypeError("@@toPrimitive must return a primitive value.");
364
- }
365
- return ("string" === r ? String : Number)(t);
366
- }
367
- function _toPropertyKey(t) {
368
- var i = _toPrimitive(t, "string");
369
- return "symbol" == typeof i ? i : i + "";
370
- }
371
-
372
9
  /**
373
10
  * @license
374
11
  * Copyright 2023 Google LLC
@@ -435,67 +72,6 @@ var ContrastCurve = /*#__PURE__*/function () {
435
72
  return ContrastCurve;
436
73
  }();
437
74
 
438
- /**
439
- * @license
440
- * Copyright 2023 Google LLC
441
- *
442
- * Licensed under the Apache License, Version 2.0 (the "License");
443
- * you may not use this file except in compliance with the License.
444
- * You may obtain a copy of the License at
445
- *
446
- * http://www.apache.org/licenses/LICENSE-2.0
447
- *
448
- * Unless required by applicable law or agreed to in writing, software
449
- * distributed under the License is distributed on an "AS IS" BASIS,
450
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
451
- * See the License for the specific language governing permissions and
452
- * limitations under the License.
453
- */
454
- /**
455
- * Documents a constraint between two DynamicColors, in which their tones must
456
- * have a certain distance from each other.
457
- *
458
- * Prefer a DynamicColor with a background, this is for special cases when
459
- * designers want tonal distance, literally contrast, between two colors that
460
- * don't have a background / foreground relationship or a contrast guarantee.
461
- */
462
- var ToneDeltaPair =
463
- /**
464
- * Documents a constraint in tone distance between two DynamicColors.
465
- *
466
- * The polarity is an adjective that describes "A", compared to "B".
467
- *
468
- * For instance, ToneDeltaPair(A, B, 15, 'darker', stayTogether) states that
469
- * A's tone should be at least 15 darker than B's.
470
- *
471
- * 'nearer' and 'farther' describes closeness to the surface roles. For
472
- * instance, ToneDeltaPair(A, B, 10, 'nearer', stayTogether) states that A
473
- * should be 10 lighter than B in light mode, and 10 darker than B in dark
474
- * mode.
475
- *
476
- * @param roleA The first role in a pair.
477
- * @param roleB The second role in a pair.
478
- * @param delta Required difference between tones. Absolute value, negative
479
- * values have undefined behavior.
480
- * @param polarity The relative relation between tones of roleA and roleB,
481
- * as described above.
482
- * @param stayTogether Whether these two roles should stay on the same side of
483
- * the "awkward zone" (T50-59). This is necessary for certain cases where
484
- * one role has two backgrounds.
485
- */
486
- function ToneDeltaPair(roleA, roleB, delta, polarity, stayTogether) {
487
- this.roleA = void 0;
488
- this.roleB = void 0;
489
- this.delta = void 0;
490
- this.polarity = void 0;
491
- this.stayTogether = void 0;
492
- this.roleA = roleA;
493
- this.roleB = roleB;
494
- this.delta = delta;
495
- this.polarity = polarity;
496
- this.stayTogether = stayTogether;
497
- };
498
-
499
75
  /**
500
76
  * @license
501
77
  * Copyright 2022 Google LLC
@@ -832,6 +408,102 @@ var DynamicColor = /*#__PURE__*/function () {
832
408
  return DynamicColor;
833
409
  }();
834
410
 
411
+ /**
412
+ * @license
413
+ * Copyright 2023 Google LLC
414
+ *
415
+ * Licensed under the Apache License, Version 2.0 (the "License");
416
+ * you may not use this file except in compliance with the License.
417
+ * You may obtain a copy of the License at
418
+ *
419
+ * http://www.apache.org/licenses/LICENSE-2.0
420
+ *
421
+ * Unless required by applicable law or agreed to in writing, software
422
+ * distributed under the License is distributed on an "AS IS" BASIS,
423
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
424
+ * See the License for the specific language governing permissions and
425
+ * limitations under the License.
426
+ */
427
+ /**
428
+ * Documents a constraint between two DynamicColors, in which their tones must
429
+ * have a certain distance from each other.
430
+ *
431
+ * Prefer a DynamicColor with a background, this is for special cases when
432
+ * designers want tonal distance, literally contrast, between two colors that
433
+ * don't have a background / foreground relationship or a contrast guarantee.
434
+ */
435
+ var ToneDeltaPair =
436
+ /**
437
+ * Documents a constraint in tone distance between two DynamicColors.
438
+ *
439
+ * The polarity is an adjective that describes "A", compared to "B".
440
+ *
441
+ * For instance, ToneDeltaPair(A, B, 15, 'darker', stayTogether) states that
442
+ * A's tone should be at least 15 darker than B's.
443
+ *
444
+ * 'nearer' and 'farther' describes closeness to the surface roles. For
445
+ * instance, ToneDeltaPair(A, B, 10, 'nearer', stayTogether) states that A
446
+ * should be 10 lighter than B in light mode, and 10 darker than B in dark
447
+ * mode.
448
+ *
449
+ * @param roleA The first role in a pair.
450
+ * @param roleB The second role in a pair.
451
+ * @param delta Required difference between tones. Absolute value, negative
452
+ * values have undefined behavior.
453
+ * @param polarity The relative relation between tones of roleA and roleB,
454
+ * as described above.
455
+ * @param stayTogether Whether these two roles should stay on the same side of
456
+ * the "awkward zone" (T50-59). This is necessary for certain cases where
457
+ * one role has two backgrounds.
458
+ */
459
+ function ToneDeltaPair(roleA, roleB, delta, polarity, stayTogether) {
460
+ this.roleA = void 0;
461
+ this.roleB = void 0;
462
+ this.delta = void 0;
463
+ this.polarity = void 0;
464
+ this.stayTogether = void 0;
465
+ this.roleA = roleA;
466
+ this.roleB = roleB;
467
+ this.delta = delta;
468
+ this.polarity = polarity;
469
+ this.stayTogether = stayTogether;
470
+ };
471
+
472
+ function _defineProperties(e, r) {
473
+ for (var t = 0; t < r.length; t++) {
474
+ var o = r[t];
475
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
476
+ }
477
+ }
478
+ function _createClass(e, r, t) {
479
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
480
+ writable: !1
481
+ }), e;
482
+ }
483
+ function _extends() {
484
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
485
+ for (var e = 1; e < arguments.length; e++) {
486
+ var t = arguments[e];
487
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
488
+ }
489
+ return n;
490
+ }, _extends.apply(null, arguments);
491
+ }
492
+ function _toPrimitive(t, r) {
493
+ if ("object" != typeof t || !t) return t;
494
+ var e = t[Symbol.toPrimitive];
495
+ if (void 0 !== e) {
496
+ var i = e.call(t, r || "default");
497
+ if ("object" != typeof i) return i;
498
+ throw new TypeError("@@toPrimitive must return a primitive value.");
499
+ }
500
+ return ("string" === r ? String : Number)(t);
501
+ }
502
+ function _toPropertyKey(t) {
503
+ var i = _toPrimitive(t, "string");
504
+ return "symbol" == typeof i ? i : i + "";
505
+ }
506
+
835
507
  var ColorEntity = /*#__PURE__*/function () {
836
508
  function ColorEntity(option, schemeService, colorService) {
837
509
  this.option = void 0;
@@ -867,85 +539,6 @@ var ColorEntity = /*#__PURE__*/function () {
867
539
  return ColorEntity;
868
540
  }();
869
541
 
870
- var SchemeEntity = /*#__PURE__*/function () {
871
- function SchemeEntity(options) {
872
- this.options = void 0;
873
- this.options = options;
874
- }
875
- var _proto = SchemeEntity.prototype;
876
- _proto.getPalette = function getPalette(key) {
877
- if (!this.options) {
878
- throw new Error('Scheme options is not set');
879
- }
880
- var palette = this.options.palettes.get(key);
881
- if (!palette) {
882
- throw new Error("Palette " + key + " not found");
883
- }
884
- return palette;
885
- };
886
- return _createClass(SchemeEntity, [{
887
- key: "contrastLevel",
888
- get: function get() {
889
- if (!this.options) {
890
- throw new Error('Scheme options is not set');
891
- }
892
- return this.options.contrastLevel;
893
- }
894
- }, {
895
- key: "isDark",
896
- get: function get() {
897
- if (!this.options) {
898
- throw new Error('Scheme options is not set');
899
- }
900
- return this.options.isDark;
901
- }
902
- }, {
903
- key: "sourceColorHct",
904
- get: function get() {
905
- if (!this.options) {
906
- throw new Error('Scheme options is not set');
907
- }
908
- return materialColorUtilities.Hct.fromInt(this.options.sourceColorArgb);
909
- }
910
- }]);
911
- }();
912
-
913
- var SchemeService = /*#__PURE__*/function () {
914
- function SchemeService() {
915
- this.schemeEntity = void 0;
916
- this.options = void 0;
917
- }
918
- var _proto = SchemeService.prototype;
919
- _proto.createOrUpdate = function createOrUpdate(options) {
920
- this.options = mergeDeep(options, this.options);
921
- var palettes = new Map();
922
- var sourceColorArgb = materialColorUtilities.argbFromHex(this.options.sourceColorHex);
923
- var sourceColorHct = materialColorUtilities.Hct.fromInt(sourceColorArgb);
924
- if (!this.options.palettes) {
925
- return;
926
- }
927
- for (var _i = 0, _Object$entries = Object.entries(this.options.palettes); _i < _Object$entries.length; _i++) {
928
- var _Object$entries$_i = _Object$entries[_i],
929
- key = _Object$entries$_i[0],
930
- paletteFunction = _Object$entries$_i[1];
931
- var palette = paletteFunction(sourceColorHct);
932
- palettes.set(key, palette);
933
- }
934
- this.schemeEntity = new SchemeEntity(_extends({}, this.options, {
935
- palettes: palettes,
936
- sourceColorArgb: sourceColorArgb
937
- }));
938
- };
939
- _proto.get = function get() {
940
- if (!this.schemeEntity) {
941
- throw new Error('Scheme is not created');
942
- }
943
- return this.schemeEntity;
944
- };
945
- return SchemeService;
946
- }();
947
- SchemeService = /*#__PURE__*/tslib.__decorate([/*#__PURE__*/common.Injectable()], SchemeService);
948
-
949
542
  function capitalizeFirstLetter(string) {
950
543
  return string.charAt(0).toUpperCase() + string.slice(1);
951
544
  }
@@ -953,9 +546,10 @@ var highestSurface = function highestSurface(s, colorManagerService) {
953
546
  return s.isDark ? colorManagerService.get('surfaceBright').getDynamicColor() : colorManagerService.get('surfaceDim').getDynamicColor();
954
547
  };
955
548
  var ColorManagerService = /*#__PURE__*/function () {
956
- function ColorManagerService(schemeService) {
957
- this.schemeService = void 0;
549
+ function ColorManagerService(_ref) {
550
+ var schemeService = _ref.schemeService;
958
551
  this.colorMap = new Map();
552
+ this.schemeService = void 0;
959
553
  this.schemeService = schemeService;
960
554
  }
961
555
  var _proto = ColorManagerService.prototype;
@@ -1141,7 +735,6 @@ var ColorManagerService = /*#__PURE__*/function () {
1141
735
  };
1142
736
  return ColorManagerService;
1143
737
  }();
1144
- ColorManagerService = /*#__PURE__*/tslib.__decorate([/*#__PURE__*/common.Injectable(), /*#__PURE__*/tslib.__metadata("design:paramtypes", [SchemeService])], ColorManagerService);
1145
738
 
1146
739
  function findDesiredChromaByTone(hue, chroma, tone, byDecreasingTone) {
1147
740
  var answer = tone;
@@ -1482,7 +1075,8 @@ var defaultColors = function defaultColors(colorManagerService) {
1482
1075
  };
1483
1076
 
1484
1077
  var ColorService = /*#__PURE__*/function () {
1485
- function ColorService(colorManagerService) {
1078
+ function ColorService(_ref) {
1079
+ var colorManagerService = _ref.colorManagerService;
1486
1080
  this.colorManagerService = void 0;
1487
1081
  this.colorManagerService = colorManagerService;
1488
1082
  }
@@ -1532,28 +1126,94 @@ var ColorService = /*#__PURE__*/function () {
1532
1126
  };
1533
1127
  return ColorService;
1534
1128
  }();
1535
- ColorService = /*#__PURE__*/tslib.__decorate([/*#__PURE__*/common.Injectable(), /*#__PURE__*/tslib.__metadata("design:paramtypes", [ColorManagerService])], ColorService);
1536
1129
 
1537
- var VariantService = /*#__PURE__*/function () {
1538
- function VariantService(schemeService) {
1539
- this.schemeService = void 0;
1540
- this.schemeService = schemeService;
1130
+ var ColorModule = {
1131
+ colorManagerService: /*#__PURE__*/awilix.asClass(ColorManagerService).singleton(),
1132
+ colorService: /*#__PURE__*/awilix.asClass(ColorService).singleton()
1133
+ };
1134
+
1135
+ var SchemeEntity = /*#__PURE__*/function () {
1136
+ function SchemeEntity(options) {
1137
+ this.options = void 0;
1138
+ this.options = options;
1541
1139
  }
1542
- var _proto = VariantService.prototype;
1543
- _proto.set = function set(variantEntity) {
1544
- if (!variantEntity.palettes.error) {
1545
- variantEntity.palettes.error = function () {
1546
- return materialColorUtilities.TonalPalette.fromHueAndChroma(25.0, 84.0);
1547
- };
1140
+ var _proto = SchemeEntity.prototype;
1141
+ _proto.getPalette = function getPalette(key) {
1142
+ if (!this.options) {
1143
+ throw new Error('Scheme options is not set');
1548
1144
  }
1549
- this.schemeService.createOrUpdate(variantEntity);
1145
+ var palette = this.options.palettes.get(key);
1146
+ if (!palette) {
1147
+ throw new Error("Palette " + key + " not found");
1148
+ }
1149
+ return palette;
1550
1150
  };
1551
- return VariantService;
1151
+ return _createClass(SchemeEntity, [{
1152
+ key: "contrastLevel",
1153
+ get: function get() {
1154
+ if (!this.options) {
1155
+ throw new Error('Scheme options is not set');
1156
+ }
1157
+ return this.options.contrastLevel;
1158
+ }
1159
+ }, {
1160
+ key: "isDark",
1161
+ get: function get() {
1162
+ if (!this.options) {
1163
+ throw new Error('Scheme options is not set');
1164
+ }
1165
+ return this.options.isDark;
1166
+ }
1167
+ }, {
1168
+ key: "sourceColorHct",
1169
+ get: function get() {
1170
+ if (!this.options) {
1171
+ throw new Error('Scheme options is not set');
1172
+ }
1173
+ return materialColorUtilities.Hct.fromInt(this.options.sourceColorArgb);
1174
+ }
1175
+ }]);
1176
+ }();
1177
+
1178
+ var SchemeService = /*#__PURE__*/function () {
1179
+ function SchemeService() {
1180
+ this.schemeEntity = void 0;
1181
+ this.options = void 0;
1182
+ }
1183
+ var _proto = SchemeService.prototype;
1184
+ _proto.createOrUpdate = function createOrUpdate(options) {
1185
+ this.options = mergeDeep(options, this.options);
1186
+ var palettes = new Map();
1187
+ var sourceColorArgb = materialColorUtilities.argbFromHex(this.options.sourceColorHex);
1188
+ var sourceColorHct = materialColorUtilities.Hct.fromInt(sourceColorArgb);
1189
+ if (!this.options.palettes) {
1190
+ return;
1191
+ }
1192
+ for (var _i = 0, _Object$entries = Object.entries(this.options.palettes); _i < _Object$entries.length; _i++) {
1193
+ var _Object$entries$_i = _Object$entries[_i],
1194
+ key = _Object$entries$_i[0],
1195
+ paletteFunction = _Object$entries$_i[1];
1196
+ var palette = paletteFunction(sourceColorHct);
1197
+ palettes.set(key, palette);
1198
+ }
1199
+ this.schemeEntity = new SchemeEntity(_extends({}, this.options, {
1200
+ palettes: palettes,
1201
+ sourceColorArgb: sourceColorArgb
1202
+ }));
1203
+ };
1204
+ _proto.get = function get() {
1205
+ if (!this.schemeEntity) {
1206
+ throw new Error('Scheme is not created');
1207
+ }
1208
+ return this.schemeEntity;
1209
+ };
1210
+ return SchemeService;
1552
1211
  }();
1553
- VariantService = /*#__PURE__*/tslib.__decorate([/*#__PURE__*/common.Injectable(), /*#__PURE__*/tslib.__metadata("design:paramtypes", [SchemeService])], VariantService);
1554
1212
 
1555
1213
  var ThemeService = /*#__PURE__*/function () {
1556
- function ThemeService(schemeService, variantService) {
1214
+ function ThemeService(_ref) {
1215
+ var schemeService = _ref.schemeService,
1216
+ variantService = _ref.variantService;
1557
1217
  this.schemeService = void 0;
1558
1218
  this.variantService = void 0;
1559
1219
  this.schemeService = schemeService;
@@ -1591,61 +1251,154 @@ var ThemeService = /*#__PURE__*/function () {
1591
1251
  };
1592
1252
  return ThemeService;
1593
1253
  }();
1594
- ThemeService = /*#__PURE__*/tslib.__decorate([/*#__PURE__*/common.Injectable(), /*#__PURE__*/tslib.__metadata("design:paramtypes", [SchemeService, VariantService])], ThemeService);
1595
1254
 
1596
- var AppService = function AppService(colorService, themeService) {
1255
+ var VariantService = /*#__PURE__*/function () {
1256
+ function VariantService(_ref) {
1257
+ var schemeService = _ref.schemeService;
1258
+ this.schemeService = void 0;
1259
+ this.schemeService = schemeService;
1260
+ }
1261
+ var _proto = VariantService.prototype;
1262
+ _proto.set = function set(variantEntity) {
1263
+ if (!variantEntity.palettes.error) {
1264
+ variantEntity.palettes.error = function () {
1265
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(25.0, 84.0);
1266
+ };
1267
+ }
1268
+ this.schemeService.createOrUpdate(variantEntity);
1269
+ };
1270
+ return VariantService;
1271
+ }();
1272
+
1273
+ var ThemeModule = {
1274
+ schemeService: /*#__PURE__*/awilix.asClass(SchemeService).singleton(),
1275
+ variantService: /*#__PURE__*/awilix.asClass(VariantService).singleton(),
1276
+ themeService: /*#__PURE__*/awilix.asClass(ThemeService).singleton()
1277
+ };
1278
+
1279
+ var AppService = function AppService(_ref) {
1280
+ var colorService = _ref.colorService,
1281
+ themeService = _ref.themeService;
1597
1282
  this.colorService = void 0;
1598
1283
  this.themeService = void 0;
1599
1284
  this.colorService = colorService;
1600
1285
  this.themeService = themeService;
1601
1286
  };
1602
- AppService = /*#__PURE__*/tslib.__decorate([/*#__PURE__*/common.Injectable(), /*#__PURE__*/tslib.__metadata("design:paramtypes", [ColorService, ThemeService])], AppService);
1603
-
1604
- var ThemeModule = function ThemeModule() {};
1605
- ThemeModule = /*#__PURE__*/tslib.__decorate([/*#__PURE__*/common.Module({
1606
- providers: [SchemeService, ThemeService, VariantService],
1607
- exports: [ThemeService, SchemeService]
1608
- })], ThemeModule);
1609
1287
 
1610
- var ColorModule = function ColorModule() {};
1611
- ColorModule = /*#__PURE__*/tslib.__decorate([/*#__PURE__*/common.Module({
1612
- imports: [ThemeModule],
1613
- providers: [ColorService, ColorManagerService],
1614
- exports: [ColorService]
1615
- })], ColorModule);
1288
+ var AppModule = {
1289
+ appService: /*#__PURE__*/awilix.asClass(AppService).singleton()
1290
+ };
1616
1291
 
1617
- var AppModule = function AppModule() {};
1618
- AppModule = /*#__PURE__*/tslib.__decorate([/*#__PURE__*/common.Module({
1619
- imports: [ColorModule, ThemeModule],
1620
- providers: [AppService]
1621
- })], AppModule);
1292
+ function importContainer(container, services) {
1293
+ services.forEach(function (service) {
1294
+ Object.entries(service).forEach(function (_ref) {
1295
+ var name = _ref[0],
1296
+ serviceClass = _ref[1];
1297
+ container.register(name, serviceClass);
1298
+ });
1299
+ });
1300
+ return container;
1301
+ }
1302
+ var AppContainer = /*#__PURE__*/awilix.createContainer({
1303
+ injectionMode: awilix.InjectionMode.PROXY
1304
+ });
1305
+ importContainer(AppContainer, [AppModule, ColorModule, ThemeModule]);
1622
1306
 
1623
1307
  function main() {
1624
- return _main.apply(this, arguments);
1625
- }
1626
- function _main() {
1627
- _main = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1628
- var app, appService, close;
1629
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1630
- while (1) switch (_context.prev = _context.next) {
1631
- case 0:
1632
- _context.next = 2;
1633
- return core.NestFactory.create(AppModule);
1634
- case 2:
1635
- app = _context.sent;
1636
- appService = app.get(AppService);
1637
- close = function close() {
1638
- return app.close();
1639
- };
1640
- return _context.abrupt("return", [appService, close]);
1641
- case 6:
1642
- case "end":
1643
- return _context.stop();
1644
- }
1645
- }, _callee);
1646
- }));
1647
- return _main.apply(this, arguments);
1308
+ return AppContainer.resolve('appService');
1648
1309
  }
1649
1310
 
1311
+ var getRotatedHue = function getRotatedHue(sourceColor, hues, rotations) {
1312
+ var sourceHue = sourceColor.hue;
1313
+ if (hues.length !== rotations.length) {
1314
+ throw new Error("mismatch between hue length " + hues.length + " & rotations " + rotations.length);
1315
+ }
1316
+ if (rotations.length === 1) {
1317
+ return materialColorUtilities.sanitizeDegreesDouble(sourceColor.hue + rotations[0]);
1318
+ }
1319
+ var size = hues.length;
1320
+ for (var i = 0; i <= size - 2; i++) {
1321
+ var thisHue = hues[i];
1322
+ var nextHue = hues[i + 1];
1323
+ if (thisHue < sourceHue && sourceHue < nextHue) {
1324
+ return materialColorUtilities.sanitizeDegreesDouble(sourceHue + rotations[i]);
1325
+ }
1326
+ }
1327
+ // If this statement executes, something is wrong, there should have been a
1328
+ // rotation found using the arrays.
1329
+ return sourceHue;
1330
+ };
1331
+ var VariantEntity = function VariantEntity(palettes) {
1332
+ if (palettes === void 0) {
1333
+ palettes = {};
1334
+ }
1335
+ this.palettes = void 0;
1336
+ this.palettes = palettes;
1337
+ };
1338
+
1339
+ var _VariantModel;
1340
+ var VariantModel = function VariantModel() {};
1341
+ _VariantModel = VariantModel;
1342
+ VariantModel.tonalSpot = {
1343
+ palettes: {
1344
+ primary: function primary(sourceColorHct) {
1345
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 36.0);
1346
+ },
1347
+ secondary: function secondary(sourceColorHct) {
1348
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16.0);
1349
+ },
1350
+ tertiary: function tertiary(sourceColorHct) {
1351
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(materialColorUtilities.sanitizeDegreesDouble(sourceColorHct.hue + 60.0), 24.0);
1352
+ },
1353
+ neutral: function neutral(sourceColorHct) {
1354
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 6.0);
1355
+ },
1356
+ neutralVariant: function neutralVariant(sourceColorHct) {
1357
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 8.0);
1358
+ }
1359
+ }
1360
+ };
1361
+ VariantModel.vibrant = {
1362
+ palettes: {
1363
+ primary: function primary(sourceColorHct) {
1364
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 200.0);
1365
+ },
1366
+ secondary: function secondary(sourceColorHct) {
1367
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, _VariantModel.hues, _VariantModel.secondaryRotations), 24.0);
1368
+ },
1369
+ tertiary: function tertiary(sourceColorHct) {
1370
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, _VariantModel.hues, _VariantModel.tertiaryRotations), 32.0);
1371
+ },
1372
+ neutral: function neutral(sourceColorHct) {
1373
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 6.0);
1374
+ },
1375
+ neutralVariant: function neutralVariant(sourceColorHct) {
1376
+ return materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 8.0);
1377
+ }
1378
+ }
1379
+ };
1380
+ VariantModel.hues = [0.0, 41.0, 61.0, 101.0, 131.0, 181.0, 251.0, 301.0, 360.0];
1381
+ VariantModel.secondaryRotations = [18.0, 15.0, 10.0, 12.0, 15.0, 18.0, 15.0, 12.0, 12.0];
1382
+ VariantModel.tertiaryRotations = [35.0, 30.0, 20.0, 25.0, 30.0, 35.0, 30.0, 25.0, 25.0];
1383
+
1384
+ exports.AppService = AppService;
1385
+ exports.ColorEntity = ColorEntity;
1386
+ exports.ColorManagerService = ColorManagerService;
1387
+ exports.ColorModule = ColorModule;
1388
+ exports.ColorService = ColorService;
1389
+ exports.ContrastCurve = ContrastCurve;
1390
+ exports.DynamicColor = DynamicColor;
1391
+ exports.SchemeEntity = SchemeEntity;
1392
+ exports.SchemeService = SchemeService;
1393
+ exports.ThemeModule = ThemeModule;
1394
+ exports.ThemeService = ThemeService;
1395
+ exports.ToneDeltaPair = ToneDeltaPair;
1396
+ exports.VariantEntity = VariantEntity;
1397
+ exports.VariantModel = VariantModel;
1398
+ exports.VariantService = VariantService;
1399
+ exports.defaultColors = defaultColors;
1400
+ exports.getRotatedHue = getRotatedHue;
1401
+ exports.highestSurface = highestSurface;
1402
+ exports.importContainer = importContainer;
1650
1403
  exports.main = main;
1651
1404
  //# sourceMappingURL=theme.cjs.development.js.map