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