@udixio/theme 1.0.0-beta.3 → 1.0.0-beta.5
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/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/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.cjs.development.js +175 -92
- 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 +137 -64
- package/dist/theme.esm.js.map +1 -1
- package/package.json +7 -5
- 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/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/dist/theme.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NestFactory } from '@nestjs/core';
|
|
2
1
|
import { __decorate, __metadata } from 'tslib';
|
|
3
2
|
import { Injectable, Module } from '@nestjs/common';
|
|
4
|
-
import { lerp, Contrast, clampDouble, hexFromArgb, Hct, argbFromHex, DislikeAnalyzer, TonalPalette } from '@material/material-color-utilities';
|
|
3
|
+
import { lerp, Contrast, clampDouble, hexFromArgb, Hct, argbFromHex, DislikeAnalyzer, TonalPalette, sanitizeDegreesDouble } from '@material/material-color-utilities';
|
|
5
4
|
import mergeDeep from 'merge-deep';
|
|
5
|
+
import { NestFactory } from '@nestjs/core';
|
|
6
6
|
|
|
7
7
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
8
8
|
try {
|
|
@@ -431,67 +431,6 @@ var ContrastCurve = /*#__PURE__*/function () {
|
|
|
431
431
|
return ContrastCurve;
|
|
432
432
|
}();
|
|
433
433
|
|
|
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
434
|
/**
|
|
496
435
|
* @license
|
|
497
436
|
* Copyright 2022 Google LLC
|
|
@@ -828,6 +767,67 @@ var DynamicColor = /*#__PURE__*/function () {
|
|
|
828
767
|
return DynamicColor;
|
|
829
768
|
}();
|
|
830
769
|
|
|
770
|
+
/**
|
|
771
|
+
* @license
|
|
772
|
+
* Copyright 2023 Google LLC
|
|
773
|
+
*
|
|
774
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
775
|
+
* you may not use this file except in compliance with the License.
|
|
776
|
+
* You may obtain a copy of the License at
|
|
777
|
+
*
|
|
778
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
779
|
+
*
|
|
780
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
781
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
782
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
783
|
+
* See the License for the specific language governing permissions and
|
|
784
|
+
* limitations under the License.
|
|
785
|
+
*/
|
|
786
|
+
/**
|
|
787
|
+
* Documents a constraint between two DynamicColors, in which their tones must
|
|
788
|
+
* have a certain distance from each other.
|
|
789
|
+
*
|
|
790
|
+
* Prefer a DynamicColor with a background, this is for special cases when
|
|
791
|
+
* designers want tonal distance, literally contrast, between two colors that
|
|
792
|
+
* don't have a background / foreground relationship or a contrast guarantee.
|
|
793
|
+
*/
|
|
794
|
+
var ToneDeltaPair =
|
|
795
|
+
/**
|
|
796
|
+
* Documents a constraint in tone distance between two DynamicColors.
|
|
797
|
+
*
|
|
798
|
+
* The polarity is an adjective that describes "A", compared to "B".
|
|
799
|
+
*
|
|
800
|
+
* For instance, ToneDeltaPair(A, B, 15, 'darker', stayTogether) states that
|
|
801
|
+
* A's tone should be at least 15 darker than B's.
|
|
802
|
+
*
|
|
803
|
+
* 'nearer' and 'farther' describes closeness to the surface roles. For
|
|
804
|
+
* instance, ToneDeltaPair(A, B, 10, 'nearer', stayTogether) states that A
|
|
805
|
+
* should be 10 lighter than B in light mode, and 10 darker than B in dark
|
|
806
|
+
* mode.
|
|
807
|
+
*
|
|
808
|
+
* @param roleA The first role in a pair.
|
|
809
|
+
* @param roleB The second role in a pair.
|
|
810
|
+
* @param delta Required difference between tones. Absolute value, negative
|
|
811
|
+
* values have undefined behavior.
|
|
812
|
+
* @param polarity The relative relation between tones of roleA and roleB,
|
|
813
|
+
* as described above.
|
|
814
|
+
* @param stayTogether Whether these two roles should stay on the same side of
|
|
815
|
+
* the "awkward zone" (T50-59). This is necessary for certain cases where
|
|
816
|
+
* one role has two backgrounds.
|
|
817
|
+
*/
|
|
818
|
+
function ToneDeltaPair(roleA, roleB, delta, polarity, stayTogether) {
|
|
819
|
+
this.roleA = void 0;
|
|
820
|
+
this.roleB = void 0;
|
|
821
|
+
this.delta = void 0;
|
|
822
|
+
this.polarity = void 0;
|
|
823
|
+
this.stayTogether = void 0;
|
|
824
|
+
this.roleA = roleA;
|
|
825
|
+
this.roleB = roleB;
|
|
826
|
+
this.delta = delta;
|
|
827
|
+
this.polarity = polarity;
|
|
828
|
+
this.stayTogether = stayTogether;
|
|
829
|
+
};
|
|
830
|
+
|
|
831
831
|
var ColorEntity = /*#__PURE__*/function () {
|
|
832
832
|
function ColorEntity(option, schemeService, colorService) {
|
|
833
833
|
this.option = void 0;
|
|
@@ -1643,5 +1643,78 @@ function _main() {
|
|
|
1643
1643
|
return _main.apply(this, arguments);
|
|
1644
1644
|
}
|
|
1645
1645
|
|
|
1646
|
-
|
|
1646
|
+
var getRotatedHue = function getRotatedHue(sourceColor, hues, rotations) {
|
|
1647
|
+
var sourceHue = sourceColor.hue;
|
|
1648
|
+
if (hues.length !== rotations.length) {
|
|
1649
|
+
throw new Error("mismatch between hue length " + hues.length + " & rotations " + rotations.length);
|
|
1650
|
+
}
|
|
1651
|
+
if (rotations.length === 1) {
|
|
1652
|
+
return sanitizeDegreesDouble(sourceColor.hue + rotations[0]);
|
|
1653
|
+
}
|
|
1654
|
+
var size = hues.length;
|
|
1655
|
+
for (var i = 0; i <= size - 2; i++) {
|
|
1656
|
+
var thisHue = hues[i];
|
|
1657
|
+
var nextHue = hues[i + 1];
|
|
1658
|
+
if (thisHue < sourceHue && sourceHue < nextHue) {
|
|
1659
|
+
return sanitizeDegreesDouble(sourceHue + rotations[i]);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
// If this statement executes, something is wrong, there should have been a
|
|
1663
|
+
// rotation found using the arrays.
|
|
1664
|
+
return sourceHue;
|
|
1665
|
+
};
|
|
1666
|
+
var VariantEntity = function VariantEntity(palettes) {
|
|
1667
|
+
if (palettes === void 0) {
|
|
1668
|
+
palettes = {};
|
|
1669
|
+
}
|
|
1670
|
+
this.palettes = void 0;
|
|
1671
|
+
this.palettes = palettes;
|
|
1672
|
+
};
|
|
1673
|
+
|
|
1674
|
+
var _VariantModel;
|
|
1675
|
+
var VariantModel = function VariantModel() {};
|
|
1676
|
+
_VariantModel = VariantModel;
|
|
1677
|
+
VariantModel.tonalSpot = {
|
|
1678
|
+
palettes: {
|
|
1679
|
+
primary: function primary(sourceColorHct) {
|
|
1680
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 36.0);
|
|
1681
|
+
},
|
|
1682
|
+
secondary: function secondary(sourceColorHct) {
|
|
1683
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16.0);
|
|
1684
|
+
},
|
|
1685
|
+
tertiary: function tertiary(sourceColorHct) {
|
|
1686
|
+
return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue + 60.0), 24.0);
|
|
1687
|
+
},
|
|
1688
|
+
neutral: function neutral(sourceColorHct) {
|
|
1689
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 6.0);
|
|
1690
|
+
},
|
|
1691
|
+
neutralVariant: function neutralVariant(sourceColorHct) {
|
|
1692
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 8.0);
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
VariantModel.vibrant = {
|
|
1697
|
+
palettes: {
|
|
1698
|
+
primary: function primary(sourceColorHct) {
|
|
1699
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 200.0);
|
|
1700
|
+
},
|
|
1701
|
+
secondary: function secondary(sourceColorHct) {
|
|
1702
|
+
return TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, _VariantModel.hues, _VariantModel.secondaryRotations), 24.0);
|
|
1703
|
+
},
|
|
1704
|
+
tertiary: function tertiary(sourceColorHct) {
|
|
1705
|
+
return TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, _VariantModel.hues, _VariantModel.tertiaryRotations), 32.0);
|
|
1706
|
+
},
|
|
1707
|
+
neutral: function neutral(sourceColorHct) {
|
|
1708
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 6.0);
|
|
1709
|
+
},
|
|
1710
|
+
neutralVariant: function neutralVariant(sourceColorHct) {
|
|
1711
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 8.0);
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
};
|
|
1715
|
+
VariantModel.hues = [0.0, 41.0, 61.0, 101.0, 131.0, 181.0, 251.0, 301.0, 360.0];
|
|
1716
|
+
VariantModel.secondaryRotations = [18.0, 15.0, 10.0, 12.0, 15.0, 18.0, 15.0, 12.0, 12.0];
|
|
1717
|
+
VariantModel.tertiaryRotations = [35.0, 30.0, 20.0, 25.0, 30.0, 35.0, 30.0, 25.0, 25.0];
|
|
1718
|
+
|
|
1719
|
+
export { AppModule, AppService, ColorEntity, ColorManagerService, ColorModule, ColorService, ContrastCurve, DynamicColor, SchemeEntity, SchemeService, ThemeModule, ThemeService, ToneDeltaPair, VariantEntity, VariantModel, VariantService, defaultColors, getRotatedHue, highestSurface, main };
|
|
1647
1720
|
//# sourceMappingURL=theme.esm.js.map
|