@udixio/theme 1.0.0-beta.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/.eslintrc.mjs +22 -0
  2. package/CHANGELOG.md +174 -0
  3. package/README.md +6 -68
  4. package/dist/API.d.ts +14 -0
  5. package/dist/API.d.ts.map +1 -0
  6. package/dist/LICENSE +202 -0
  7. package/dist/adapter/adapter.abstract.d.ts +10 -0
  8. package/dist/adapter/adapter.abstract.d.ts.map +1 -0
  9. package/dist/adapter/config.interface.d.ts +14 -0
  10. package/dist/adapter/config.interface.d.ts.map +1 -0
  11. package/dist/adapter/define-config.d.ts +3 -0
  12. package/dist/adapter/define-config.d.ts.map +1 -0
  13. package/dist/adapter/file-adapter.mixin.d.ts +18 -0
  14. package/dist/adapter/file-adapter.mixin.d.ts.map +1 -0
  15. package/dist/adapter/index.d.ts +4 -0
  16. package/dist/adapter/index.d.ts.map +1 -0
  17. package/dist/adapters/index.d.ts +3 -0
  18. package/dist/adapters/index.d.ts.map +1 -0
  19. package/dist/adapters/node.adapter.d.ts +7 -0
  20. package/dist/adapters/node.adapter.d.ts.map +1 -0
  21. package/dist/adapters/vite.adapter.d.ts +3 -0
  22. package/dist/adapters/vite.adapter.d.ts.map +1 -0
  23. package/dist/app.container.d.ts +5 -5
  24. package/dist/app.container.d.ts.map +1 -0
  25. package/dist/app.module.d.ts +1 -0
  26. package/dist/app.module.d.ts.map +1 -0
  27. package/dist/bootstrap.d.ts +3 -0
  28. package/dist/bootstrap.d.ts.map +1 -0
  29. package/dist/color/color.api.d.ts +39 -0
  30. package/dist/color/color.api.d.ts.map +1 -0
  31. package/dist/color/color.manager.d.ts +24 -0
  32. package/dist/color/color.manager.d.ts.map +1 -0
  33. package/dist/color/color.module.d.ts +1 -0
  34. package/dist/color/color.module.d.ts.map +1 -0
  35. package/dist/color/color.utils.d.ts +8 -0
  36. package/dist/color/color.utils.d.ts.map +1 -0
  37. package/dist/color/configurable-color.d.ts +31 -0
  38. package/dist/color/configurable-color.d.ts.map +1 -0
  39. package/dist/color/default-color.d.ts +3 -0
  40. package/dist/color/default-color.d.ts.map +1 -0
  41. package/dist/color/index.d.ts +5 -4
  42. package/dist/color/index.d.ts.map +1 -0
  43. package/dist/index.cjs +3215 -0
  44. package/dist/index.d.ts +7 -4
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +3175 -7
  47. package/dist/material-color-utilities/contrastCurve.d.ts +1 -0
  48. package/dist/material-color-utilities/contrastCurve.d.ts.map +1 -0
  49. package/dist/material-color-utilities/dynamic_color.d.ts +89 -76
  50. package/dist/material-color-utilities/dynamic_color.d.ts.map +1 -0
  51. package/dist/material-color-utilities/hct_solver.d.ts +131 -0
  52. package/dist/material-color-utilities/hct_solver.d.ts.map +1 -0
  53. package/dist/material-color-utilities/htc.d.ts +77 -0
  54. package/dist/material-color-utilities/htc.d.ts.map +1 -0
  55. package/dist/material-color-utilities/index.d.ts +1 -0
  56. package/dist/material-color-utilities/index.d.ts.map +1 -0
  57. package/dist/material-color-utilities/toneDeltaPair.d.ts +19 -25
  58. package/dist/material-color-utilities/toneDeltaPair.d.ts.map +1 -0
  59. package/dist/plugin/index.d.ts +4 -0
  60. package/dist/plugin/index.d.ts.map +1 -0
  61. package/dist/plugin/plugin.abstract.d.ts +19 -5
  62. package/dist/plugin/plugin.abstract.d.ts.map +1 -0
  63. package/dist/plugin/plugin.api.d.ts +10 -0
  64. package/dist/plugin/plugin.api.d.ts.map +1 -0
  65. package/dist/plugin/plugin.module.d.ts +1 -0
  66. package/dist/plugin/plugin.module.d.ts.map +1 -0
  67. package/dist/plugins/font/font.plugin.d.ts +50 -0
  68. package/dist/plugins/font/font.plugin.d.ts.map +1 -0
  69. package/dist/plugins/font/index.d.ts +2 -0
  70. package/dist/plugins/font/index.d.ts.map +1 -0
  71. package/dist/plugins/index.d.ts +2 -0
  72. package/dist/plugins/index.d.ts.map +1 -0
  73. package/dist/theme/index.d.ts +7 -3
  74. package/dist/theme/index.d.ts.map +1 -0
  75. package/dist/theme/scheme.d.ts +20 -0
  76. package/dist/theme/scheme.d.ts.map +1 -0
  77. package/dist/theme/scheme.manager.d.ts +31 -0
  78. package/dist/theme/scheme.manager.d.ts.map +1 -0
  79. package/dist/theme/theme.api.d.ts +23 -0
  80. package/dist/theme/theme.api.d.ts.map +1 -0
  81. package/dist/theme/theme.module.d.ts +1 -0
  82. package/dist/theme/theme.module.d.ts.map +1 -0
  83. package/dist/theme/variant.d.ts +36 -0
  84. package/dist/theme/variant.d.ts.map +1 -0
  85. package/dist/theme/variant.manager.d.ts +14 -0
  86. package/dist/theme/variant.manager.d.ts.map +1 -0
  87. package/dist/theme/variants/expressive.variant.d.ts +3 -0
  88. package/dist/theme/variants/expressive.variant.d.ts.map +1 -0
  89. package/dist/theme/variants/index.d.ts +11 -0
  90. package/dist/theme/variants/index.d.ts.map +1 -0
  91. package/dist/theme/variants/neutral.variant.d.ts +3 -0
  92. package/dist/theme/variants/neutral.variant.d.ts.map +1 -0
  93. package/dist/theme/variants/tonal-spot.variant.d.ts +3 -0
  94. package/dist/theme/variants/tonal-spot.variant.d.ts.map +1 -0
  95. package/dist/theme/variants/vibrant.variant.d.ts +3 -0
  96. package/dist/theme/variants/vibrant.variant.d.ts.map +1 -0
  97. package/package.json +24 -86
  98. package/src/API.ts +23 -0
  99. package/src/adapter/adapter.abstract.ts +64 -0
  100. package/src/adapter/config.interface.ts +14 -0
  101. package/src/adapter/define-config.ts +11 -0
  102. package/src/adapter/file-adapter.mixin.ts +72 -0
  103. package/src/adapter/index.ts +3 -0
  104. package/src/adapters/index.ts +2 -0
  105. package/src/adapters/node.adapter.ts +49 -0
  106. package/src/adapters/vite.adapter.ts +79 -0
  107. package/src/app.container.ts +12 -36
  108. package/src/app.module.ts +2 -2
  109. package/src/bootstrap.ts +6 -0
  110. package/src/color/color.api.ts +75 -0
  111. package/src/color/color.manager.ts +213 -0
  112. package/src/color/color.module.ts +4 -4
  113. package/src/color/color.utils.ts +126 -0
  114. package/src/color/configurable-color.ts +67 -0
  115. package/src/color/default-color.ts +832 -0
  116. package/src/color/index.ts +4 -4
  117. package/src/index.test.ts +5 -0
  118. package/src/index.ts +6 -4
  119. package/src/material-color-utilities/dynamic_color.ts +286 -222
  120. package/src/material-color-utilities/hct_solver.ts +536 -0
  121. package/src/material-color-utilities/htc.ts +198 -0
  122. package/src/material-color-utilities/toneDeltaPair.ts +29 -11
  123. package/src/plugin/index.ts +3 -0
  124. package/src/plugin/plugin.abstract.ts +45 -4
  125. package/src/plugin/plugin.api.ts +51 -0
  126. package/src/plugin/plugin.module.ts +2 -2
  127. package/src/plugins/font/font.plugin.ts +203 -0
  128. package/src/plugins/font/index.ts +1 -0
  129. package/src/plugins/index.ts +1 -0
  130. package/src/theme/index.ts +6 -3
  131. package/src/theme/{services/scheme.service.ts → scheme.manager.ts} +39 -19
  132. package/src/theme/{entities/scheme.entity.ts → scheme.ts} +20 -4
  133. package/src/theme/{services/theme.service.ts → theme.api.ts} +23 -19
  134. package/src/theme/theme.module.ts +6 -4
  135. package/src/theme/variant.manager.ts +58 -0
  136. package/src/theme/variant.ts +53 -0
  137. package/src/theme/variants/expressive.variant.ts +81 -0
  138. package/src/theme/variants/index.ts +16 -0
  139. package/src/theme/variants/neutral.variant.ts +45 -0
  140. package/src/theme/variants/tonal-spot.variant.ts +35 -0
  141. package/src/theme/variants/vibrant.variant.ts +72 -0
  142. package/tsconfig.json +13 -0
  143. package/tsconfig.lib.json +33 -0
  144. package/tsconfig.spec.json +36 -0
  145. package/vite.config.ts +54 -0
  146. package/LICENSE +0 -21
  147. package/dist/app.service.d.ts +0 -13
  148. package/dist/color/color.interface.d.ts +0 -8
  149. package/dist/color/entities/color.entity.d.ts +0 -42
  150. package/dist/color/entities/index.d.ts +0 -1
  151. package/dist/color/models/default-color.model.d.ts +0 -3
  152. package/dist/color/models/index.d.ts +0 -1
  153. package/dist/color/services/color-manager.service.d.ts +0 -18
  154. package/dist/color/services/color.service.d.ts +0 -21
  155. package/dist/color/services/index.d.ts +0 -2
  156. package/dist/config/config.interface.d.ts +0 -14
  157. package/dist/config/config.module.d.ts +0 -2
  158. package/dist/config/config.service.d.ts +0 -12
  159. package/dist/config/index.d.ts +0 -2
  160. package/dist/main.d.ts +0 -3
  161. package/dist/plugin/plugin.service.d.ts +0 -9
  162. package/dist/theme/entities/index.d.ts +0 -2
  163. package/dist/theme/entities/scheme.entity.d.ts +0 -15
  164. package/dist/theme/entities/variant.entity.d.ts +0 -7
  165. package/dist/theme/models/index.d.ts +0 -1
  166. package/dist/theme/models/variant.model.d.ts +0 -8
  167. package/dist/theme/services/index.d.ts +0 -3
  168. package/dist/theme/services/scheme.service.d.ts +0 -17
  169. package/dist/theme/services/theme.service.d.ts +0 -22
  170. package/dist/theme/services/variant.service.d.ts +0 -13
  171. package/dist/theme.cjs.development.js +0 -1975
  172. package/dist/theme.cjs.development.js.map +0 -1
  173. package/dist/theme.cjs.production.min.js +0 -2
  174. package/dist/theme.cjs.production.min.js.map +0 -1
  175. package/dist/theme.esm.js +0 -1947
  176. package/dist/theme.esm.js.map +0 -1
  177. package/src/app.service.spec.ts +0 -15
  178. package/src/app.service.ts +0 -23
  179. package/src/color/color.interface.ts +0 -13
  180. package/src/color/entities/color.entity.ts +0 -71
  181. package/src/color/entities/index.ts +0 -1
  182. package/src/color/models/default-color.model.ts +0 -300
  183. package/src/color/models/index.ts +0 -1
  184. package/src/color/services/color-manager.service.ts +0 -191
  185. package/src/color/services/color.service.spec.ts +0 -28
  186. package/src/color/services/color.service.ts +0 -75
  187. package/src/color/services/index.ts +0 -2
  188. package/src/config/config.interface.ts +0 -15
  189. package/src/config/config.module.ts +0 -7
  190. package/src/config/config.service.ts +0 -68
  191. package/src/config/index.ts +0 -2
  192. package/src/main.ts +0 -14
  193. package/src/plugin/plugin.service.ts +0 -26
  194. package/src/theme/entities/index.ts +0 -2
  195. package/src/theme/entities/variant.entity.ts +0 -39
  196. package/src/theme/models/index.ts +0 -1
  197. package/src/theme/models/variant.model.ts +0 -63
  198. package/src/theme/services/index.ts +0 -3
  199. package/src/theme/services/variant.service.ts +0 -52
@@ -44,3 +44,4 @@ export declare class ContrastCurve {
44
44
  */
45
45
  get(contrastLevel: number): number;
46
46
  }
47
+ //# sourceMappingURL=contrastCurve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contrastCurve.d.ts","sourceRoot":"","sources":["../../src/material-color-utilities/contrastCurve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH;;;;;;GAMG;AACH,qBAAa,aAAa;IAUtB,QAAQ,CAAC,GAAG,EAAE,MAAM;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAZvB;;;;;;;OAOG;gBAEQ,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM;IAGvB;;;;;;OAMG;IACH,GAAG,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM;CAanC"}
@@ -1,55 +1,56 @@
1
- /**
2
- * @license
3
- * Copyright 2022 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import { Hct, TonalPalette } from '@material/material-color-utilities';
1
+ import { TonalPalette } from '@material/material-color-utilities';
18
2
  import { ContrastCurve } from './contrastCurve';
19
3
  import { ToneDeltaPair } from './toneDeltaPair';
20
- import { SchemeEntity } from '../theme/entities/scheme.entity';
4
+ import { Scheme } from '../theme/scheme';
5
+ import { Hct } from './htc';
21
6
  /**
22
7
  * @param name The name of the dynamic color. Defaults to empty.
23
- * @param palette Function that provides a TonalPalette given
24
- * SchemeEntity. A TonalPalette is defined by a hue and chroma, so this
25
- * replaces the need to specify hue/chroma. By providing a tonal palette, when
26
- * contrast adjustments are made, intended chroma can be preserved.
27
- * @param tone Function that provides a tone given SchemeEntity.
28
- * @param isBackground Whether this dynamic color is a background, with
29
- * some other color as the foreground. Defaults to false.
8
+ * @param palette Function that provides a TonalPalette given DynamicScheme. A
9
+ * TonalPalette is defined by a hue and chroma, so this replaces the need to
10
+ * specify hue/chroma. By providing a tonal palette, when contrast
11
+ * adjustments are made, intended chroma can be preserved.
12
+ * @param tone Function that provides a tone given DynamicScheme. When not
13
+ * provided, the tone is same as the background tone or 50, when no
14
+ * background is provided.
15
+ * @param chromaMultiplier A factor that multiplies the chroma for this color.
16
+ * Default to 1.
17
+ * @param isBackground Whether this dynamic color is a background, with some
18
+ * other color as the foreground. Defaults to false.
30
19
  * @param background The background of the dynamic color (as a function of a
31
- * `SchemeEntity`), if it exists.
20
+ * `DynamicScheme`), if it exists.
32
21
  * @param secondBackground A second background of the dynamic color (as a
33
- * function of a `SchemeEntity`), if it
34
- * exists.
22
+ * function of a `DynamicScheme`), if it exists.
35
23
  * @param contrastCurve A `ContrastCurve` object specifying how its contrast
36
- * against its background should behave in various contrast levels options.
24
+ * against its background should behave in various contrast levels options.
25
+ * Must used together with `background`. When not provided or resolved as
26
+ * undefined, the contrast curve is calculated based on other constraints.
37
27
  * @param toneDeltaPair A `ToneDeltaPair` object specifying a tone delta
38
- * constraint between two colors. One of them must be the color being
39
- * constructed.
28
+ * constraint between two colors. One of them must be the color being
29
+ * constructed. When not provided or resolved as undefined, the tone is
30
+ * calculated based on other constraints.
40
31
  */
41
- interface FromPaletteOptions {
32
+ export interface FromPaletteOptions {
42
33
  name?: string;
43
- palette: (scheme: SchemeEntity) => TonalPalette;
44
- tone: (scheme: SchemeEntity) => number;
34
+ palette: (scheme: Scheme) => TonalPalette;
35
+ tone?: (scheme: Scheme) => number;
36
+ chromaMultiplier?: (scheme: Scheme) => number;
45
37
  isBackground?: boolean;
46
- background?: (scheme: SchemeEntity) => DynamicColor;
47
- secondBackground?: (scheme: SchemeEntity) => DynamicColor;
48
- contrastCurve?: ContrastCurve;
49
- toneDeltaPair?: (scheme: SchemeEntity) => ToneDeltaPair;
38
+ background?: (scheme: Scheme) => DynamicColor | undefined;
39
+ secondBackground?: (scheme: Scheme) => DynamicColor | undefined;
40
+ contrastCurve?: (scheme: Scheme) => ContrastCurve | undefined;
41
+ toneDeltaPair?: (scheme: Scheme) => ToneDeltaPair | undefined;
50
42
  }
51
43
  /**
52
- * A color that adjusts itself based on UI state provided by SchemeEntity.
44
+ * Returns a new DynamicColor that is the same as the original color, but with
45
+ * the extended dynamic color's constraints for the given spec version.
46
+ *
47
+ * @param originlColor The original color.
48
+ * @param specVersion The spec version to extend.
49
+ * @param extendedColor The color with the values to extend.
50
+ */
51
+ export declare function extendSpecVersion(originlColor: DynamicColor, extendedColor: DynamicColor): DynamicColor;
52
+ /**
53
+ * A color that adjusts itself based on UI state provided by DynamicScheme.
53
54
  *
54
55
  * Colors without backgrounds do not change tone when contrast changes. Colors
55
56
  * with backgrounds become closer to their background as contrast lowers, and
@@ -61,13 +62,14 @@ interface FromPaletteOptions {
61
62
  */
62
63
  export declare class DynamicColor {
63
64
  readonly name: string;
64
- readonly palette: (scheme: SchemeEntity) => TonalPalette;
65
- readonly tone: (scheme: SchemeEntity) => number;
65
+ readonly palette: (scheme: Scheme) => TonalPalette;
66
+ readonly tone: (scheme: Scheme) => number;
66
67
  readonly isBackground: boolean;
67
- readonly background?: ((scheme: SchemeEntity) => DynamicColor) | undefined;
68
- readonly secondBackground?: ((scheme: SchemeEntity) => DynamicColor) | undefined;
69
- readonly contrastCurve?: ContrastCurve | undefined;
70
- readonly toneDeltaPair?: ((scheme: SchemeEntity) => ToneDeltaPair) | undefined;
68
+ readonly chromaMultiplier?: ((scheme: Scheme) => number) | undefined;
69
+ readonly background?: ((scheme: Scheme) => DynamicColor | undefined) | undefined;
70
+ readonly secondBackground?: ((scheme: Scheme) => DynamicColor | undefined) | undefined;
71
+ readonly contrastCurve?: ((scheme: Scheme) => ContrastCurve | undefined) | undefined;
72
+ readonly toneDeltaPair?: ((scheme: Scheme) => ToneDeltaPair | undefined) | undefined;
71
73
  private readonly hctCache;
72
74
  /**
73
75
  * The base constructor for DynamicColor.
@@ -83,34 +85,36 @@ export declare class DynamicColor {
83
85
  * always, in every case.
84
86
  *
85
87
  * @param name The name of the dynamic color. Defaults to empty.
86
- * @param palette Function that provides a TonalPalette given
87
- * SchemeEntity. A TonalPalette is defined by a hue and chroma, so this
88
- * replaces the need to specify hue/chroma. By providing a tonal palette, when
89
- * contrast adjustments are made, intended chroma can be preserved.
90
- * @param tone Function that provides a tone, given a SchemeEntity.
91
- * @param isBackground Whether this dynamic color is a background, with
92
- * some other color as the foreground. Defaults to false.
88
+ * @param palette Function that provides a TonalPalette given DynamicScheme. A
89
+ * TonalPalette is defined by a hue and chroma, so this replaces the need
90
+ * to specify hue/chroma. By providing a tonal palette, when contrast
91
+ * adjustments are made, intended chroma can be preserved.
92
+ * @param tone Function that provides a tone, given a DynamicScheme.
93
+ * @param isBackground Whether this dynamic color is a background, with some
94
+ * other color as the foreground. Defaults to false.
95
+ * @param chromaMultiplier A factor that multiplies the chroma for this color.
93
96
  * @param background The background of the dynamic color (as a function of a
94
- * `SchemeEntity`), if it exists.
97
+ * `DynamicScheme`), if it exists.
95
98
  * @param secondBackground A second background of the dynamic color (as a
96
- * function of a `SchemeEntity`), if it
97
- * exists.
99
+ * function of a `DynamicScheme`), if it exists.
98
100
  * @param contrastCurve A `ContrastCurve` object specifying how its contrast
99
- * against its background should behave in various contrast levels options.
101
+ * against its background should behave in various contrast levels
102
+ * options.
100
103
  * @param toneDeltaPair A `ToneDeltaPair` object specifying a tone delta
101
- * constraint between two colors. One of them must be the color being
102
- * constructed.
104
+ * constraint between two colors. One of them must be the color being
105
+ * constructed.
103
106
  */
104
- constructor(name: string, palette: (scheme: SchemeEntity) => TonalPalette, tone: (scheme: SchemeEntity) => number, isBackground: boolean, background?: ((scheme: SchemeEntity) => DynamicColor) | undefined, secondBackground?: ((scheme: SchemeEntity) => DynamicColor) | undefined, contrastCurve?: ContrastCurve | undefined, toneDeltaPair?: ((scheme: SchemeEntity) => ToneDeltaPair) | undefined);
107
+ constructor(name: string, palette: (scheme: Scheme) => TonalPalette, tone: (scheme: Scheme) => number, isBackground: boolean, chromaMultiplier?: ((scheme: Scheme) => number) | undefined, background?: ((scheme: Scheme) => DynamicColor | undefined) | undefined, secondBackground?: ((scheme: Scheme) => DynamicColor | undefined) | undefined, contrastCurve?: ((scheme: Scheme) => ContrastCurve | undefined) | undefined, toneDeltaPair?: ((scheme: Scheme) => ToneDeltaPair | undefined) | undefined);
105
108
  /**
106
109
  * Create a DynamicColor defined by a TonalPalette and HCT tone.
107
110
  *
108
- * @param args Functions with SchemeEntity as input. Must provide a palette
109
- * and tone. May provide a background DynamicColor and ToneDeltaConstraint.
111
+ * @param args Functions with DynamicScheme as input. Must provide a palette
112
+ * and tone. May provide a background DynamicColor and ToneDeltaPair.
110
113
  */
111
114
  static fromPalette(args: FromPaletteOptions): DynamicColor;
115
+ static getInitialToneFromBackground(background?: (scheme: Scheme) => DynamicColor | undefined): (scheme: Scheme) => number;
112
116
  /**
113
- * Given a background tone, find a foreground tone, while ensuring they reach
117
+ * Given a background tone, finds a foreground tone, while ensuring they reach
114
118
  * a contrast ratio that is as close to [ratio] as possible.
115
119
  *
116
120
  * @param bgTone Tone in HCT. Range is 0 to 100, undefined behavior when it
@@ -137,35 +141,44 @@ export declare class DynamicColor {
137
141
  */
138
142
  static toneAllowsLightForeground(tone: number): boolean;
139
143
  /**
140
- * Adjust a tone such that white has 4.5 contrast, if the tone is
144
+ * Adjusts a tone such that white has 4.5 contrast, if the tone is
141
145
  * reasonably close to supporting it.
142
146
  */
143
147
  static enableLightForeground(tone: number): number;
144
148
  /**
145
- * Return a ARGB integer (i.e. a hex code).
149
+ * Returns a deep copy of this DynamicColor.
150
+ */
151
+ clone(): DynamicColor;
152
+ /**
153
+ * Clears the cache of HCT values for this color. For testing or debugging
154
+ * purposes.
155
+ */
156
+ clearCache(): void;
157
+ /**
158
+ * Returns a ARGB integer (i.e. a hex code).
146
159
  *
147
160
  * @param scheme Defines the conditions of the user interface, for example,
148
- * whether or not it is dark mode or light mode, and what the desired
149
- * contrast level is.
161
+ * whether or not it is dark mode or light mode, and what the desired
162
+ * contrast level is.
150
163
  */
151
- getArgb(scheme: SchemeEntity): number;
164
+ getArgb(scheme: Scheme): number;
152
165
  /**
153
- * Return a color, expressed in the HCT color space, that this
166
+ * Returns a color, expressed in the HCT color space, that this
154
167
  * DynamicColor is under the conditions in scheme.
155
168
  *
156
169
  * @param scheme Defines the conditions of the user interface, for example,
157
- * whether or not it is dark mode or light mode, and what the desired
158
- * contrast level is.
170
+ * whether or not it is dark mode or light mode, and what the desired
171
+ * contrast level is.
159
172
  */
160
- getHct(scheme: SchemeEntity): Hct;
173
+ getHct(scheme: Scheme): Hct;
161
174
  /**
162
- * Return a tone, T in the HCT color space, that this DynamicColor is under
175
+ * Returns a tone, T in the HCT color space, that this DynamicColor is under
163
176
  * the conditions in scheme.
164
177
  *
165
178
  * @param scheme Defines the conditions of the user interface, for example,
166
- * whether or not it is dark mode or light mode, and what the desired
167
- * contrast level is.
179
+ * whether or not it is dark mode or light mode, and what the desired
180
+ * contrast level is.
168
181
  */
169
- getTone(scheme: SchemeEntity): number;
182
+ getTone(scheme: Scheme): number;
170
183
  }
171
- export {};
184
+ //# sourceMappingURL=dynamic_color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic_color.d.ts","sourceRoot":"","sources":["../../src/material-color-utilities/dynamic_color.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;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C,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,YAAY,GAAG,SAAS,GACxD,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM;IAO7B;;;;;;;;OAQG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAiC5D;;;;;;;;;;OAUG;IACH,MAAM,CAAC,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIxD;;;OAGG;IACH,MAAM,CAAC,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIvD;;;OAGG;IACH,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAUlD;;OAEG;IACH,KAAK,IAAI,YAAY;IAcrB;;;OAGG;IACH,UAAU;IAIV;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI/B;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;IAW3B;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAmKhC"}
@@ -0,0 +1,131 @@
1
+ import { Cam16 } from '@material/material-color-utilities';
2
+ /**
3
+ * A class that solves the HCT equation.
4
+ */
5
+ export declare class HctSolver {
6
+ static SCALED_DISCOUNT_FROM_LINRGB: number[][];
7
+ static LINRGB_FROM_SCALED_DISCOUNT: number[][];
8
+ static Y_FROM_LINRGB: number[];
9
+ static CRITICAL_PLANES: number[];
10
+ /**
11
+ * Finds an sRGB color with the given hue, chroma, and L*, if
12
+ * possible.
13
+ *
14
+ * @param hueDegrees The desired hue, in degrees.
15
+ * @param chroma The desired chroma.
16
+ * @param lstar The desired L*.
17
+ * @return A hexadecimal representing the sRGB color. The color
18
+ * has sufficiently close hue, chroma, and L* to the desired
19
+ * values, if possible; otherwise, the hue and L* will be
20
+ * sufficiently close, and chroma will be maximized.
21
+ */
22
+ static solveToInt(hueDegrees: number, chroma: number, lstar: number): number;
23
+ /**
24
+ * Finds an sRGB color with the given hue, chroma, and L*, if
25
+ * possible.
26
+ *
27
+ * @param hueDegrees The desired hue, in degrees.
28
+ * @param chroma The desired chroma.
29
+ * @param lstar The desired L*.
30
+ * @return An CAM16 object representing the sRGB color. The color
31
+ * has sufficiently close hue, chroma, and L* to the desired
32
+ * values, if possible; otherwise, the hue and L* will be
33
+ * sufficiently close, and chroma will be maximized.
34
+ */
35
+ static solveToCam(hueDegrees: number, chroma: number, lstar: number): Cam16;
36
+ /**
37
+ * Sanitizes a small enough angle in radians.
38
+ *
39
+ * @param angle An angle in radians; must not deviate too much
40
+ * from 0.
41
+ * @return A coterminal angle between 0 and 2pi.
42
+ */
43
+ private static sanitizeRadians;
44
+ /**
45
+ * Delinearizes an RGB component, returning a floating-point
46
+ * number.
47
+ *
48
+ * @param rgbComponent 0.0 <= rgb_component <= 100.0, represents
49
+ * linear R/G/B channel
50
+ * @return 0.0 <= output <= 255.0, color channel converted to
51
+ * regular RGB space
52
+ */
53
+ private static trueDelinearized;
54
+ private static chromaticAdaptation;
55
+ /**
56
+ * Returns the hue of a linear RGB color in CAM16.
57
+ *
58
+ * @param linrgb The linear RGB coordinates of a color.
59
+ * @return The hue of the color in CAM16, in radians.
60
+ */
61
+ private static hueOf;
62
+ private static areInCyclicOrder;
63
+ /**
64
+ * Solves the lerp equation.
65
+ *
66
+ * @param source The starting number.
67
+ * @param mid The number in the middle.
68
+ * @param target The ending number.
69
+ * @return A number t such that lerp(source, target, t) = mid.
70
+ */
71
+ private static intercept;
72
+ private static lerpPoint;
73
+ /**
74
+ * Intersects a segment with a plane.
75
+ *
76
+ * @param source The coordinates of point A.
77
+ * @param coordinate The R-, G-, or B-coordinate of the plane.
78
+ * @param target The coordinates of point B.
79
+ * @param axis The axis the plane is perpendicular with. (0: R, 1:
80
+ * G, 2: B)
81
+ * @return The intersection point of the segment AB with the plane
82
+ * R=coordinate, G=coordinate, or B=coordinate
83
+ */
84
+ private static setCoordinate;
85
+ private static isBounded;
86
+ /**
87
+ * Returns the nth possible vertex of the polygonal intersection.
88
+ *
89
+ * @param y The Y value of the plane.
90
+ * @param n The zero-based index of the point. 0 <= n <= 11.
91
+ * @return The nth possible vertex of the polygonal intersection
92
+ * of the y plane and the RGB cube, in linear RGB coordinates, if
93
+ * it exists. If this possible vertex lies outside of the cube,
94
+ * [-1.0, -1.0, -1.0] is returned.
95
+ */
96
+ private static nthVertex;
97
+ /**
98
+ * Finds the segment containing the desired color.
99
+ *
100
+ * @param y The Y value of the color.
101
+ * @param targetHue The hue of the color.
102
+ * @return A list of two sets of linear RGB coordinates, each
103
+ * corresponding to an endpoint of the segment containing the
104
+ * desired color.
105
+ */
106
+ private static bisectToSegment;
107
+ private static midpoint;
108
+ private static criticalPlaneBelow;
109
+ private static criticalPlaneAbove;
110
+ /**
111
+ * Finds a color with the given Y and hue on the boundary of the
112
+ * cube.
113
+ *
114
+ * @param y The Y value of the color.
115
+ * @param targetHue The hue of the color.
116
+ * @return The desired color, in linear RGB coordinates.
117
+ */
118
+ private static bisectToLimit;
119
+ private static inverseChromaticAdaptation;
120
+ /**
121
+ * Finds a color with the given hue, chroma, and Y.
122
+ *
123
+ * @param hueRadians The desired hue in radians.
124
+ * @param chroma The desired chroma.
125
+ * @param y The desired Y.
126
+ * @return The desired color as a hexadecimal integer, if found; 0
127
+ * otherwise.
128
+ */
129
+ private static findResultByJ;
130
+ }
131
+ //# sourceMappingURL=hct_solver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hct_solver.d.ts","sourceRoot":"","sources":["../../src/material-color-utilities/hct_solver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,OAAO,EAGL,KAAK,EAMN,MAAM,oCAAoC,CAAC;AAE5C;;GAEG;AACH,qBAAa,SAAS;IACpB,MAAM,CAAC,2BAA2B,aAIhC;IAEF,MAAM,CAAC,2BAA2B,aAIhC;IAEF,M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and tone. A color system that provides a perceptually
4
+ * accurate color measurement system that can also accurately render what colors
5
+ * will appear as in different lighting environments.
6
+ */
7
+ export declare class Hct {
8
+ private argb;
9
+ /**
10
+ * @param hue 0 <= hue < 360; invalid values are corrected.
11
+ * @param chroma 0 <= chroma < ?; Informally, colorfulness. The color
12
+ * returned may be lower than the requested chroma. Chroma has a different
13
+ * maximum for any given hue and tone.
14
+ * @param tone 0 <= tone <= 100; invalid values are corrected.
15
+ * @return HCT representation of a color in default viewing conditions.
16
+ */
17
+ internalHue: number;
18
+ internalChroma: number;
19
+ internalTone: number;
20
+ private constructor();
21
+ /**
22
+ * A number, in degrees, representing ex. red, orange, yellow, etc.
23
+ * Ranges from 0 <= hue < 360.
24
+ */
25
+ get hue(): number;
26
+ /**
27
+ * @param newHue 0 <= newHue < 360; invalid values are corrected.
28
+ * Chroma may decrease because chroma has a different maximum for any given
29
+ * hue and tone.
30
+ */
31
+ set hue(newHue: number);
32
+ get chroma(): number;
33
+ /**
34
+ * @param newChroma 0 <= newChroma < ?
35
+ * Chroma may decrease because chroma has a different maximum for any given
36
+ * hue and tone.
37
+ */
38
+ set chroma(newChroma: number);
39
+ /** Lightness. Ranges from 0 to 100. */
40
+ get tone(): number;
41
+ /**
42
+ * @param newTone 0 <= newTone <= 100; invalid valids are corrected.
43
+ * Chroma may decrease because chroma has a different maximum for any given
44
+ * hue and tone.
45
+ */
46
+ set tone(newTone: number);
47
+ static from(hue: number, chroma: number, tone: number): Hct;
48
+ /**
49
+ * @param argb ARGB representation of a color.
50
+ * @return HCT representation of a color in default viewing conditions
51
+ */
52
+ static fromInt(argb: number): Hct;
53
+ static isBlue(hue: number): boolean;
54
+ static isYellow(hue: number): boolean;
55
+ static isCyan(hue: number): boolean;
56
+ toInt(): number;
57
+ /** Sets a property of the Hct object. */
58
+ setValue(propertyName: string, value: number): void;
59
+ toString(): string;
60
+ /**
61
+ * Translates a color into different [ViewingConditions].
62
+ *
63
+ * Colors change appearance. They look different with lights on versus off,
64
+ * the same color, as in hex code, on white looks different when on black.
65
+ * This is called color relativity, most famously explicated by Josef Albers
66
+ * in Interaction of Color.
67
+ *
68
+ * In color science, color appearance models can account for this and
69
+ * calculate the appearance of a color in different settings. HCT is based on
70
+ * CAM16, a color appearance model, and uses it to make these calculations.
71
+ *
72
+ * See [ViewingConditions.make] for parameters affecting color appearance.
73
+ */
74
+ inViewingConditions(vc: ViewingConditions): Hct;
75
+ private setInternalState;
76
+ }
77
+ //# sourceMappingURL=htc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"htc.d.ts","sourceRoot":"","sources":["../../src/material-color-utilities/htc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAoC,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGzG;;;;GAIG;AACH,qBAAa,GAAG;IAcM,OAAO,CAAC,IAAI;IAbhC;;;;;;;OAOG;IAEH,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IAErB,OAAO;IAQP;;;OAGG;IACH,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED;;;;OAIG;IACH,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAIrB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;OAIG;IACH,IAAI,MAAM,CAAC,SAAS,EAAE,MAAM,EAI3B;IAED,uCAAuC;IACvC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;OAIG;IACH,IAAI,IAAI,CAAC,OAAO,EAAE,MAAM,EAIvB;IAED,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAIrD;;;OAGG;IACH,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM;IAI3B,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAInC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIrC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAInC,KAAK,IAAI,MAAM;IAIf,yCAAyC;IACzC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAI5C,QAAQ,IAAI,MAAM;IAMlB;;;;;;;;;;;;;OAaG;IACH,mBAAmB,CAAC,EAAE,EAAE,iBAAiB,GAAG,GAAG;IAwB/C,OAAO,CAAC,gBAAgB;CAOzB"}
@@ -1,3 +1,4 @@
1
1
  export * from './contrastCurve';
2
2
  export * from './dynamic_color';
3
3
  export * from './toneDeltaPair';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/material-color-utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
@@ -1,24 +1,14 @@
1
+ import { DynamicColor } from './dynamic_color';
1
2
  /**
2
- * @license
3
- * Copyright 2023 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
3
+ * Describes the different in tone between colors.
10
4
  *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
5
+ * nearer and farther are deprecated. Use DeltaConstraint instead.
16
6
  */
17
- import { DynamicColor } from './dynamic_color';
7
+ export type TonePolarity = 'darker' | 'lighter' | 'nearer' | 'farther' | 'relative_darker' | 'relative_lighter';
18
8
  /**
19
- * Describes the different in tone between colors.
9
+ * Describes how to fulfill a tone delta pair constraint.
20
10
  */
21
- export type TonePolarity = 'darker' | 'lighter' | 'nearer' | 'farther';
11
+ export type DeltaConstraint = 'exact' | 'nearer' | 'farther';
22
12
  /**
23
13
  * Documents a constraint between two DynamicColors, in which their tones must
24
14
  * have a certain distance from each other.
@@ -33,18 +23,20 @@ export declare class ToneDeltaPair {
33
23
  readonly delta: number;
34
24
  readonly polarity: TonePolarity;
35
25
  readonly stayTogether: boolean;
26
+ readonly constraint?: DeltaConstraint | undefined;
36
27
  /**
37
28
  * Documents a constraint in tone distance between two DynamicColors.
38
29
  *
39
30
  * The polarity is an adjective that describes "A", compared to "B".
40
31
  *
41
- * For instance, ToneDeltaPair(A, B, 15, 'darker', stayTogether) states that
42
- * A's tone should be at least 15 darker than B's.
32
+ * For instance, ToneDeltaPair(A, B, 15, 'darker', 'exact') states that
33
+ * A's tone should be exactly 15 darker than B's.
43
34
  *
44
- * 'nearer' and 'farther' describes closeness to the surface roles. For
45
- * instance, ToneDeltaPair(A, B, 10, 'nearer', stayTogether) states that A
46
- * should be 10 lighter than B in light mode, and 10 darker than B in dark
47
- * mode.
35
+ * 'relative_darker' and 'relative_lighter' describes the tone adjustment
36
+ * relative to the surface color trend (white in light mode; black in dark
37
+ * mode). For instance, ToneDeltaPair(A, B, 10, 'relative_lighter',
38
+ * 'farther') states that A should be at least 10 lighter than B in light
39
+ * mode, and at least 10 darker than B in dark mode.
48
40
  *
49
41
  * @param roleA The first role in a pair.
50
42
  * @param roleB The second role in a pair.
@@ -52,9 +44,11 @@ export declare class ToneDeltaPair {
52
44
  * values have undefined behavior.
53
45
  * @param polarity The relative relation between tones of roleA and roleB,
54
46
  * as described above.
55
- * @param stayTogether Whether these two roles should stay on the same side of
56
- * the "awkward zone" (T50-59). This is necessary for certain cases where
47
+ * @param constraint How to fulfill the tone delta pair constraint.
48
+ * @param stayTogether Whether these two roles should stay on the same side
49
+ * of the "awkward zone" (T50-59). This is necessary for certain cases where
57
50
  * one role has two backgrounds.
58
51
  */
59
- constructor(roleA: DynamicColor, roleB: DynamicColor, delta: number, polarity: TonePolarity, stayTogether: boolean);
52
+ constructor(roleA: DynamicColor, roleB: DynamicColor, delta: number, polarity: TonePolarity, stayTogether: boolean, constraint?: DeltaConstraint | undefined);
60
53
  }
54
+ //# sourceMappingURL=toneDeltaPair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toneDeltaPair.d.ts","sourceRoot":"","sources":["../../src/material-color-utilities/toneDeltaPair.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,SAAS,GACT,iBAAiB,GACjB,kBAAkB,CAAC;AAEvB;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE7D;;;;;;;GAOG;AACH,qBAAa,aAAa;IA2BtB,QAAQ,CAAC,KAAK,EAAE,YAAY;IAC5B,QAAQ,CAAC,KAAK,EAAE,YAAY;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,QAAQ,EAAE,YAAY;IAC/B,QAAQ,CAAC,YAAY,EAAE,OAAO;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe;IA/BvC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;gBAEQ,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,OAAO,EACrB,UAAU,CAAC,EAAE,eAAe,YAAA;CAIxC"}
@@ -0,0 +1,4 @@
1
+ export * from './plugin.abstract';
2
+ export * from './plugin.module';
3
+ export * from './plugin.api';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -1,6 +1,20 @@
1
- import { AppService } from '../app.service';
2
- export declare abstract class PluginAbstract {
3
- protected appService: AppService;
4
- static dependencies: (new () => PluginAbstract)[];
5
- protected constructor(appService: AppService);
1
+ import { API } from '../API';
2
+ export type PluginConstructor<Plugin extends PluginImplAbstract<any>> = new (...args: any) => Plugin;
3
+ export declare abstract class PluginAbstract<Plugin extends PluginImplAbstract<Options>, Options extends object> {
4
+ abstract readonly dependencies: (new (...args: any) => PluginAbstract<any, any>)[];
5
+ abstract readonly name: string;
6
+ options: Options;
7
+ abstract readonly pluginClass: PluginConstructor<Plugin>;
8
+ protected pluginInstance: Plugin | undefined;
9
+ constructor(options: Options);
10
+ init(api: API): this;
11
+ getInstance(): Plugin;
6
12
  }
13
+ export declare abstract class PluginImplAbstract<Options extends object> {
14
+ protected api: API;
15
+ protected options: Options;
16
+ constructor(api: API, options: Options);
17
+ abstract onInit?(): void;
18
+ abstract onLoad?(): void;
19
+ }
20
+ //# sourceMappingURL=plugin.abstract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.abstract.d.ts","sourceRoot":"","sources":["../../src/plugin/plugin.abstract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,MAAM,MAAM,iBAAiB,CAAC,MAAM,SAAS,kBAAkB,CAAC,GAAG,CAAC,IAAI,KACtE,GAAG,IAAI,EAAE,GAAG,KACT,MAAM,CAAC;AAEZ,8BAAsB,cAAc,CAClC,MAAM,SAAS,kBAAkB,CAAC,OAAO,CAAC,EAC1C,OAAO,SAAS,MAAM;IAEtB,kBAAyB,YAAY,EAAE,CAAC,KACtC,GAAG,IAAI,EAAE,GAAG,KACT,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IACjC,kBAAyB,IAAI,EAAE,MAAM,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACxB,kBAAyB,WAAW,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAChE,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEjC,OAAO,EAAE,OAAO;IAIrB,IAAI,CAAC,GAAG,EAAE,GAAG;IAMb,WAAW,IAAI,MAAM;CAM7B;AAED,8BAAsB,kBAAkB,CAAC,OAAO,SAAS,MAAM;IAE3D,SAAS,CAAC,GAAG,EAAE,GAAG;IAClB,SAAS,CAAC,OAAO,EAAE,OAAO;gBADhB,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO;IAK5B,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI;IAExB,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI;CACzB"}
@@ -0,0 +1,10 @@
1
+ import { PluginAbstract } from './plugin.abstract';
2
+ import { API } from '../API';
3
+ export declare class PluginApi {
4
+ private plugins;
5
+ addPlugin(plugin: PluginAbstract<any, any>): void;
6
+ initPlugins(api: API): void;
7
+ loadPlugins(): void;
8
+ getPlugin<T extends PluginAbstract<any, any>>(plugin: new (...args: any) => T): T;
9
+ }
10
+ //# sourceMappingURL=plugin.api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.api.d.ts","sourceRoot":"","sources":["../../src/plugin/plugin.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAA+C;IAEvD,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC;IAI1C,WAAW,CAAC,GAAG,EAAE,GAAG;IA2BpB,WAAW;IAMX,SAAS,CAAC,CAAC,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EACjD,MAAM,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC,GAC9B,CAAC;CAKL"}
@@ -1,2 +1,3 @@
1
1
  import { Module } from '../app.container';
2
2
  export declare const PluginModule: Module;
3
+ //# sourceMappingURL=plugin.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.module.d.ts","sourceRoot":"","sources":["../../src/plugin/plugin.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,eAAO,MAAM,YAAY,EAAE,MAE1B,CAAC"}