cmat 0.0.78 → 0.0.80
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/fesm2022/cmat-components-adapter.mjs +9 -46
- package/fesm2022/cmat-components-adapter.mjs.map +1 -1
- package/fesm2022/cmat-components-breadcrumb.mjs +104 -205
- package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/cmat-components-card.mjs +4 -8
- package/fesm2022/cmat-components-card.mjs.map +1 -1
- package/fesm2022/cmat-components-carousel.mjs +21 -21
- package/fesm2022/cmat-components-carousel.mjs.map +1 -1
- package/fesm2022/cmat-components-cascade.mjs +18 -24
- package/fesm2022/cmat-components-cascade.mjs.map +1 -1
- package/fesm2022/cmat-components-chip-input.mjs +21 -21
- package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
- package/fesm2022/cmat-components-code-editor.mjs +4 -22
- package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-custom-formly.mjs +181 -245
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-date-range.mjs +12 -184
- package/fesm2022/cmat-components-date-range.mjs.map +1 -1
- package/fesm2022/cmat-components-date-time-display.mjs +3 -15
- package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
- package/fesm2022/cmat-components-drawer.mjs +10 -100
- package/fesm2022/cmat-components-drawer.mjs.map +1 -1
- package/fesm2022/cmat-components-empty-state.mjs +4 -25
- package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
- package/fesm2022/cmat-components-file-preview.mjs +3 -21
- package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
- package/fesm2022/cmat-components-filter-toolbar.mjs +7 -50
- package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-form-actions.mjs +3 -9
- package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
- package/fesm2022/cmat-components-fullscreen.mjs +4 -4
- package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
- package/fesm2022/cmat-components-highlight.mjs +6 -32
- package/fesm2022/cmat-components-highlight.mjs.map +1 -1
- package/fesm2022/cmat-components-image-viewer.mjs +12 -24
- package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
- package/fesm2022/cmat-components-inline-loading.mjs +3 -12
- package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
- package/fesm2022/cmat-components-json-editor.mjs +11 -16
- package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-knob-input.mjs +24 -18
- package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
- package/fesm2022/cmat-components-masonry.mjs +8 -17
- package/fesm2022/cmat-components-masonry.mjs.map +1 -1
- package/fesm2022/cmat-components-material-color-picker.mjs +13 -34
- package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-material-datetimepicker.mjs +80 -436
- package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
- package/fesm2022/cmat-components-navigation.mjs +266 -816
- package/fesm2022/cmat-components-navigation.mjs.map +1 -1
- package/fesm2022/cmat-components-opt-input.mjs +7 -10
- package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
- package/fesm2022/cmat-components-org-chart.mjs +11 -11
- package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
- package/fesm2022/cmat-components-page-header.mjs +8 -19
- package/fesm2022/cmat-components-page-header.mjs.map +1 -1
- package/fesm2022/cmat-components-pagination.mjs +113 -108
- package/fesm2022/cmat-components-pagination.mjs.map +1 -1
- package/fesm2022/cmat-components-password-strength.mjs +13 -16
- package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
- package/fesm2022/cmat-components-popover.mjs +15 -151
- package/fesm2022/cmat-components-popover.mjs.map +1 -1
- package/fesm2022/cmat-components-progress-bar.mjs +16 -26
- package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
- package/fesm2022/cmat-components-qrcode.mjs +5 -11
- package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
- package/fesm2022/cmat-components-rating.mjs +14 -14
- package/fesm2022/cmat-components-rating.mjs.map +1 -1
- package/fesm2022/cmat-components-rich-text-editor.mjs +4 -25
- package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-select-search.mjs +51 -79
- package/fesm2022/cmat-components-select-search.mjs.map +1 -1
- package/fesm2022/cmat-components-select-table.mjs +204 -162
- package/fesm2022/cmat-components-select-table.mjs.map +1 -1
- package/fesm2022/cmat-components-select-tree.mjs +142 -97
- package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
- package/fesm2022/cmat-components-skeleton.mjs +4 -22
- package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
- package/fesm2022/cmat-components-speed-dial.mjs +14 -19
- package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
- package/fesm2022/cmat-components-status-tag.mjs +3 -18
- package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
- package/fesm2022/cmat-components-table-toolbar.mjs +3 -15
- package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-timeline.mjs +18 -21
- package/fesm2022/cmat-components-timeline.mjs.map +1 -1
- package/fesm2022/cmat-components-toast.mjs +20 -20
- package/fesm2022/cmat-components-toast.mjs.map +1 -1
- package/fesm2022/cmat-components-transfer-picker.mjs +159 -123
- package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-treetable.mjs +17 -19
- package/fesm2022/cmat-components-treetable.mjs.map +1 -1
- package/fesm2022/cmat-components-upload.mjs +35 -57
- package/fesm2022/cmat-components-upload.mjs.map +1 -1
- package/fesm2022/cmat-components-x6-angular-shape.mjs +0 -4
- package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +6 -27
- package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/cmat-directives-arrow-cursor.mjs +7 -9
- package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
- package/fesm2022/cmat-directives-autofocus.mjs +3 -3
- package/fesm2022/cmat-directives-data-exporter.mjs +24 -33
- package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
- package/fesm2022/cmat-directives-debounce.mjs +14 -17
- package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
- package/fesm2022/cmat-directives-digit-only.mjs +6 -23
- package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
- package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +4 -11
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
- package/fesm2022/cmat-lib-mock-api.mjs +6 -43
- package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
- package/fesm2022/cmat-pipes-bytes.mjs +3 -3
- package/fesm2022/cmat-pipes-date-format.mjs +3 -3
- package/fesm2022/cmat-pipes-find-by-key.mjs +3 -5
- package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
- package/fesm2022/cmat-pipes-group-by.mjs +3 -3
- package/fesm2022/cmat-pipes-keys.mjs +3 -3
- package/fesm2022/cmat-pipes-secure.mjs +8 -12
- package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
- package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
- package/fesm2022/cmat-services-alert.mjs +3 -3
- package/fesm2022/cmat-services-config.mjs +50 -26
- package/fesm2022/cmat-services-config.mjs.map +1 -1
- package/fesm2022/cmat-services-confirmation.mjs +9 -11
- package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
- package/fesm2022/cmat-services-data.mjs +56 -101
- package/fesm2022/cmat-services-data.mjs.map +1 -1
- package/fesm2022/cmat-services-export-as.mjs +4 -32
- package/fesm2022/cmat-services-export-as.mjs.map +1 -1
- package/fesm2022/cmat-services-loading.mjs +49 -40
- package/fesm2022/cmat-services-loading.mjs.map +1 -1
- package/fesm2022/cmat-services-local-storage.mjs +3 -3
- package/fesm2022/cmat-services-media-watcher.mjs +19 -25
- package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
- package/fesm2022/cmat-services-platform.mjs +3 -10
- package/fesm2022/cmat-services-platform.mjs.map +1 -1
- package/fesm2022/cmat-services-splash-screen.mjs +8 -13
- package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
- package/fesm2022/cmat-services-title.mjs +8 -12
- package/fesm2022/cmat-services-title.mjs.map +1 -1
- package/fesm2022/cmat-services-translation.mjs +3 -3
- package/fesm2022/cmat-services-utils.mjs +5 -27
- package/fesm2022/cmat-services-utils.mjs.map +1 -1
- package/fesm2022/cmat-validators.mjs +0 -8
- package/fesm2022/cmat-validators.mjs.map +1 -1
- package/fesm2022/cmat.mjs +3477 -3795
- package/fesm2022/cmat.mjs.map +1 -1
- package/package.json +1 -1
- package/tailwind/plugins/helpers.js +1 -10
- package/tailwind/plugins/scrollbar/index.js +0 -1
- package/tailwind/plugins/scrollbar/typedefs.js +1 -7
- package/tailwind/plugins/scrollbar/utilities.js +9 -58
- package/tailwind/plugins/scrollbar/variants.js +2 -17
- package/tailwind/plugins/theming.js +1 -57
- package/tailwind/utils/generate-contrasts.js +1 -12
- package/tailwind/utils/generate-palette.js +1 -32
- package/types/cmat-components-adapter.d.ts +0 -25
- package/types/cmat-components-breadcrumb.d.ts +25 -175
- package/types/cmat-components-carousel.d.ts +2 -20
- package/types/cmat-components-cascade.d.ts +4 -4
- package/types/cmat-components-chip-input.d.ts +4 -3
- package/types/cmat-components-code-editor.d.ts +0 -18
- package/types/cmat-components-custom-formly.d.ts +30 -37
- package/types/cmat-components-date-range.d.ts +1 -72
- package/types/cmat-components-date-time-display.d.ts +0 -15
- package/types/cmat-components-drawer.d.ts +2 -44
- package/types/cmat-components-empty-state.d.ts +0 -21
- package/types/cmat-components-file-preview.d.ts +0 -18
- package/types/cmat-components-filter-toolbar.d.ts +3 -43
- package/types/cmat-components-form-actions.d.ts +0 -6
- package/types/cmat-components-image-viewer.d.ts +5 -18
- package/types/cmat-components-inline-loading.d.ts +0 -9
- package/types/cmat-components-json-editor.d.ts +0 -1
- package/types/cmat-components-knob-input.d.ts +3 -3
- package/types/cmat-components-masonry.d.ts +1 -2
- package/types/cmat-components-material-color-picker.d.ts +1 -2
- package/types/cmat-components-material-datetimepicker.d.ts +6 -272
- package/types/cmat-components-navigation.d.ts +34 -171
- package/types/cmat-components-opt-input.d.ts +1 -1
- package/types/cmat-components-page-header.d.ts +2 -16
- package/types/cmat-components-pagination.d.ts +26 -27
- package/types/cmat-components-password-strength.d.ts +1 -2
- package/types/cmat-components-popover.d.ts +1 -110
- package/types/cmat-components-progress-bar.d.ts +9 -11
- package/types/cmat-components-rating.d.ts +6 -7
- package/types/cmat-components-rich-text-editor.d.ts +0 -21
- package/types/cmat-components-select-search.d.ts +4 -20
- package/types/cmat-components-select-table.d.ts +24 -12
- package/types/cmat-components-select-tree.d.ts +29 -29
- package/types/cmat-components-skeleton.d.ts +0 -18
- package/types/cmat-components-speed-dial.d.ts +1 -2
- package/types/cmat-components-status-tag.d.ts +0 -15
- package/types/cmat-components-table-toolbar.d.ts +0 -12
- package/types/cmat-components-timeline.d.ts +3 -4
- package/types/cmat-components-toast.d.ts +2 -2
- package/types/cmat-components-transfer-picker.d.ts +42 -36
- package/types/cmat-components-treetable.d.ts +3 -4
- package/types/cmat-components-upload.d.ts +12 -17
- package/types/cmat-components-x6-angular-shape.d.ts +0 -1
- package/types/cmat-directives-arrow-cursor.d.ts +1 -1
- package/types/cmat-directives-debounce.d.ts +3 -4
- package/types/cmat-pipes-secure.d.ts +3 -4
- package/types/cmat-services-config.d.ts +35 -13
- package/types/cmat-services-data.d.ts +13 -12
- package/types/cmat-services-export-as.d.ts +0 -22
- package/types/cmat-services-loading.d.ts +15 -10
- package/types/cmat-services-media-watcher.d.ts +10 -13
- package/types/cmat-services-splash-screen.d.ts +2 -4
- package/types/cmat-services-title.d.ts +3 -5
- package/types/cmat.d.ts +733 -1391
package/package.json
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Gets the underlying default import of a module.
|
|
3
|
-
*
|
|
4
|
-
* This is used to handle internal imoprts from Tailwind, since Tailwind Play
|
|
5
|
-
* handles these imports differently.
|
|
6
|
-
*
|
|
7
|
-
* @template T
|
|
8
|
-
* @param {T | { __esModule: unknown, default: T }} mod The module
|
|
9
|
-
* @returns {T} The bare export
|
|
10
|
-
*/
|
|
1
|
+
|
|
11
2
|
// eslint-disable-next-line no-underscore-dangle
|
|
12
3
|
const importDefault = mod => (mod && mod.__esModule ? mod.default : mod);
|
|
13
4
|
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
* @typedef {object} TailwindPlugin
|
|
3
|
-
* @property {Function} matchUtilities - Adds utilities to tailwind
|
|
4
|
-
* @property {Function} theme - Accesses tailwind's theme
|
|
5
|
-
* @property {Function} addVariant - Adds a variant to tailwind
|
|
6
|
-
* @property {Function} config - Accesses tailwind's configuration
|
|
7
|
-
*/
|
|
1
|
+
|
|
8
2
|
|
|
9
3
|
exports.unused = {};
|
|
@@ -2,19 +2,11 @@ const path = require('path');
|
|
|
2
2
|
const flattenColorPaletteImport = require('tailwindcss/lib/util/flattenColorPalette');
|
|
3
3
|
const typedefs = require(path.resolve(__dirname, ('./typedefs')));
|
|
4
4
|
const { importDefault } = require(path.resolve(__dirname, ('../helpers')));
|
|
5
|
-
|
|
6
|
-
// Tailwind Play will import these internal imports as ES6 imports, while most
|
|
7
|
-
// other workflows will import them as CommonJS imports.
|
|
8
5
|
const flattenColorPalette = importDefault(flattenColorPaletteImport);
|
|
9
6
|
|
|
10
7
|
const COMPONENTS = ['track', 'thumb', 'corner'];
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
* @param {Record<never, unknown>} properties - The properties to assign
|
|
14
|
-
* @param {boolean} preferPseudoElements - If true, only browsers that cannot
|
|
15
|
-
* use pseudoelements will specify scrollbar properties
|
|
16
|
-
* @returns {Record<string, unknown>} - The generated CSS rules
|
|
17
|
-
*/
|
|
9
|
+
|
|
18
10
|
const scrollbarProperties = (properties, preferPseudoElements) => {
|
|
19
11
|
if (preferPseudoElements) {
|
|
20
12
|
return {
|
|
@@ -25,13 +17,7 @@ const scrollbarProperties = (properties, preferPseudoElements) => {
|
|
|
25
17
|
return properties;
|
|
26
18
|
};
|
|
27
19
|
|
|
28
|
-
|
|
29
|
-
* Base resets to make the plugin's utilities work
|
|
30
|
-
*
|
|
31
|
-
* @param {typedefs.TailwindPlugin} tailwind - Tailwind's plugin object
|
|
32
|
-
* @param {'standard' | 'peseudoelements'} preferredStrategy - The preferred
|
|
33
|
-
* scrollbar styling strategy: standards track or pseudoelements
|
|
34
|
-
*/
|
|
20
|
+
|
|
35
21
|
const addBaseStyles = ({ addBase }, preferredStrategy) => {
|
|
36
22
|
addBase({
|
|
37
23
|
'*': scrollbarProperties({
|
|
@@ -41,12 +27,7 @@ const addBaseStyles = ({ addBase }, preferredStrategy) => {
|
|
|
41
27
|
});
|
|
42
28
|
};
|
|
43
29
|
|
|
44
|
-
|
|
45
|
-
* Generates utilties that tell an element what to do with
|
|
46
|
-
* --scrollbar-track and --scrollbar-thumb custom properties
|
|
47
|
-
*
|
|
48
|
-
* @returns {Record<string, unknown>} - The generated CSS
|
|
49
|
-
*/
|
|
30
|
+
|
|
50
31
|
const generateBaseUtilities = () => ({
|
|
51
32
|
...Object.fromEntries(COMPONENTS.map(component => {
|
|
52
33
|
const base = `&::-webkit-scrollbar-${component}`;
|
|
@@ -60,15 +41,7 @@ const generateBaseUtilities = () => ({
|
|
|
60
41
|
}).flat())
|
|
61
42
|
});
|
|
62
43
|
|
|
63
|
-
|
|
64
|
-
* Utilities for initializing a custom styled scrollbar, which implicitly set
|
|
65
|
-
* the scrollbar's size
|
|
66
|
-
*
|
|
67
|
-
* @param {object} options - Options
|
|
68
|
-
* @param {boolean} options.preferPseudoElements - If true, only browsers that
|
|
69
|
-
* cannot use pseudoelements will specify scrollbar-width
|
|
70
|
-
* @returns {Record<string, unknown>} - Base size utilities for scrollbars
|
|
71
|
-
*/
|
|
44
|
+
|
|
72
45
|
const generateScrollbarSizeUtilities = ({ preferPseudoElements }) => ({
|
|
73
46
|
'.scrollbar': {
|
|
74
47
|
...generateBaseUtilities(),
|
|
@@ -109,19 +82,10 @@ const generateScrollbarSizeUtilities = ({ preferPseudoElements }) => ({
|
|
|
109
82
|
}
|
|
110
83
|
});
|
|
111
84
|
|
|
112
|
-
|
|
113
|
-
* Converts a color value or function to a color value
|
|
114
|
-
*
|
|
115
|
-
* @param {string | Function} maybeFunction - The color value or function
|
|
116
|
-
* @returns {string} - The color value
|
|
117
|
-
*/
|
|
85
|
+
|
|
118
86
|
const toColorValue = maybeFunction => (typeof maybeFunction === 'function' ? maybeFunction({}) : maybeFunction);
|
|
119
87
|
|
|
120
|
-
|
|
121
|
-
* Adds scrollbar-COMPONENT-COLOR utilities for every scrollbar component.
|
|
122
|
-
*
|
|
123
|
-
* @param {typedefs.TailwindPlugin} tailwind - Tailwind's plugin object
|
|
124
|
-
*/
|
|
88
|
+
|
|
125
89
|
const addColorUtilities = ({ matchUtilities, theme }) => {
|
|
126
90
|
const themeColors = flattenColorPalette(theme('colors'));
|
|
127
91
|
const colors = Object.fromEntries(
|
|
@@ -143,12 +107,7 @@ const addColorUtilities = ({ matchUtilities, theme }) => {
|
|
|
143
107
|
});
|
|
144
108
|
};
|
|
145
109
|
|
|
146
|
-
|
|
147
|
-
* Adds scrollbar-COMPONENT-rounded-VALUE utilities for every scrollbar
|
|
148
|
-
* component.
|
|
149
|
-
*
|
|
150
|
-
* @param {typedefs.TailwindPlugin} tailwind - Tailwind's plugin object
|
|
151
|
-
*/
|
|
110
|
+
|
|
152
111
|
const addRoundedUtilities = ({ theme, matchUtilities }) => {
|
|
153
112
|
COMPONENTS.forEach(component => {
|
|
154
113
|
matchUtilities(
|
|
@@ -164,22 +123,14 @@ const addRoundedUtilities = ({ theme, matchUtilities }) => {
|
|
|
164
123
|
});
|
|
165
124
|
};
|
|
166
125
|
|
|
167
|
-
|
|
168
|
-
* @param {typedefs.TailwindPlugin} tailwind - Tailwind's plugin object
|
|
169
|
-
* @param {'standard' | 'peseudoelements'} preferredStrategy - The preferred
|
|
170
|
-
* scrollbar styling strategy: standards track or pseudoelements
|
|
171
|
-
*/
|
|
126
|
+
|
|
172
127
|
const addBaseSizeUtilities = ({ addUtilities }, preferredStrategy) => {
|
|
173
128
|
addUtilities(generateScrollbarSizeUtilities({
|
|
174
129
|
preferPseudoElements: preferredStrategy === 'pseudoelements'
|
|
175
130
|
}));
|
|
176
131
|
};
|
|
177
132
|
|
|
178
|
-
|
|
179
|
-
* Adds scrollbar-w-* and scrollbar-h-* utilities
|
|
180
|
-
*
|
|
181
|
-
* @param {typedefs.TailwindPlugin} tailwind - Tailwind's plugin object
|
|
182
|
-
*/
|
|
133
|
+
|
|
183
134
|
const addSizeUtilities = ({ matchUtilities, theme }) => {
|
|
184
135
|
['width', 'height'].forEach(dimension => {
|
|
185
136
|
matchUtilities({
|
|
@@ -1,20 +1,6 @@
|
|
|
1
|
-
/** @typedef {import('./typedefs').TailwindPlugin} TailwindPlugin */
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* states.
|
|
6
|
-
*
|
|
7
|
-
* Earlier iterations of this plugin hijacked the hover: and active: variants
|
|
8
|
-
* directly to create a cleaner syntax, but there are several issues with that
|
|
9
|
-
* approach:
|
|
10
|
-
* - It made the plugin prone to breaking other unrelated styles
|
|
11
|
-
* - It made logic like "make an element's scrollbar green when the
|
|
12
|
-
* _element_ is hovered impossible. (This is unusual, but should still
|
|
13
|
-
* be possible.)
|
|
14
|
-
* - It straight up does not work in Tailwind v4.
|
|
15
|
-
*
|
|
16
|
-
* @param {TailwindPlugin} tailwind - Tailwind's plugin object
|
|
17
|
-
*/
|
|
2
|
+
|
|
3
|
+
|
|
18
4
|
const addVariants = ({ addVariant }) => {
|
|
19
5
|
addVariant('scrollbar-hover', '&::-webkit-scrollbar-thumb:hover');
|
|
20
6
|
addVariant('scrollbar-track-hover', '&::-webkit-scrollbar-track:hover');
|
|
@@ -22,7 +8,6 @@ const addVariants = ({ addVariant }) => {
|
|
|
22
8
|
|
|
23
9
|
addVariant('scrollbar-active', '&::-webkit-scrollbar-thumb:active');
|
|
24
10
|
addVariant('scrollbar-track-active', '&::-webkit-scrollbar-track:active');
|
|
25
|
-
// Corners can't be active, so they don't get their own active variant.
|
|
26
11
|
};
|
|
27
12
|
|
|
28
13
|
module.exports = {
|
|
@@ -22,36 +22,20 @@ const normalizeTheme = (theme) => {
|
|
|
22
22
|
));
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
// -----------------------------------------------------------------------------------------------------
|
|
26
|
-
// @ cmat TailwindCSS Main Plugin
|
|
27
|
-
// -----------------------------------------------------------------------------------------------------
|
|
28
25
|
const theming = plugin.withOptions((options) => ({
|
|
29
26
|
addComponents,
|
|
30
27
|
theme
|
|
31
28
|
}) => {
|
|
32
|
-
/**
|
|
33
|
-
* Create user themes object by going through the provided themes and
|
|
34
|
-
* merging them with the provided "default" so, we can have a complete
|
|
35
|
-
* set of color palettes for each user theme.
|
|
36
|
-
*/
|
|
37
29
|
const userThemes = _.fromPairs(_.map(options.themes, (theme, themeName) => [
|
|
38
30
|
themeName,
|
|
39
31
|
_.defaults({}, theme, options.themes['default'])
|
|
40
32
|
]));
|
|
41
33
|
|
|
42
|
-
/**
|
|
43
|
-
* Normalize the themes and assign it to the themes object. This will
|
|
44
|
-
* be the final object that we create a SASS map from
|
|
45
|
-
*/
|
|
46
34
|
let themes = _.fromPairs(_.map(userThemes, (theme, themeName) => [
|
|
47
35
|
themeName,
|
|
48
36
|
normalizeTheme(theme)
|
|
49
37
|
]));
|
|
50
38
|
|
|
51
|
-
/**
|
|
52
|
-
* Go through the themes to generate the contrasts and filter the
|
|
53
|
-
* palettes to only have "primary", "accent" and "warn" objects.
|
|
54
|
-
*/
|
|
55
39
|
themes = _.fromPairs(_.map(themes, (theme, themeName) => [
|
|
56
40
|
themeName,
|
|
57
41
|
_.pick(
|
|
@@ -69,10 +53,6 @@ const theming = plugin.withOptions((options) => ({
|
|
|
69
53
|
)
|
|
70
54
|
]));
|
|
71
55
|
|
|
72
|
-
/**
|
|
73
|
-
* Go through the themes and attach appropriate class selectors so,
|
|
74
|
-
* we can use them to encapsulate each theme.
|
|
75
|
-
*/
|
|
76
56
|
themes = _.fromPairs(_.map(themes, (theme, themeName) => [
|
|
77
57
|
themeName,
|
|
78
58
|
{
|
|
@@ -81,13 +61,10 @@ const theming = plugin.withOptions((options) => ({
|
|
|
81
61
|
}
|
|
82
62
|
]));
|
|
83
63
|
|
|
84
|
-
/* Generate the SASS map using the themes object */
|
|
85
64
|
const sassMap = jsonToSassMap(JSON.stringify({ 'user-themes': themes }));
|
|
86
65
|
|
|
87
|
-
/* Get the file path */
|
|
88
66
|
const filename = path.resolve(__dirname, ('../../styles/user-themes.scss'));
|
|
89
67
|
|
|
90
|
-
/* Read the file and get its data */
|
|
91
68
|
let data;
|
|
92
69
|
try {
|
|
93
70
|
data = fs.readFileSync(filename, { encoding: 'utf8' });
|
|
@@ -96,7 +73,6 @@ const theming = plugin.withOptions((options) => ({
|
|
|
96
73
|
console.error(err);
|
|
97
74
|
}
|
|
98
75
|
|
|
99
|
-
/* Write the file if the map has been changed */
|
|
100
76
|
if (data !== sassMap) {
|
|
101
77
|
try {
|
|
102
78
|
fs.writeFileSync(filename, sassMap, { encoding: 'utf8' });
|
|
@@ -123,9 +99,6 @@ const theming = plugin.withOptions((options) => ({
|
|
|
123
99
|
]))
|
|
124
100
|
);
|
|
125
101
|
|
|
126
|
-
/**
|
|
127
|
-
* Generate scheme based css custom properties and utility classes
|
|
128
|
-
*/
|
|
129
102
|
const schemeCustomProps = _.map(['light', 'dark'], (colorScheme) => {
|
|
130
103
|
const isDark = colorScheme === 'dark';
|
|
131
104
|
const background = theme(`cmat.customProps.background.${colorScheme}`);
|
|
@@ -136,31 +109,8 @@ const theming = plugin.withOptions((options) => ({
|
|
|
136
109
|
return {
|
|
137
110
|
[(isDark ? darkSchemeSelectors : lightSchemeSelectors)]: {
|
|
138
111
|
|
|
139
|
-
/**
|
|
140
|
-
* If a custom property is not available, browsers will use
|
|
141
|
-
* the fallback value. In this case, we want to use '--is-dark'
|
|
142
|
-
* as the indicator of a dark theme so, we can use it like this:
|
|
143
|
-
* background-color: var(--is-dark, red);
|
|
144
|
-
*
|
|
145
|
-
* If we set '--is-dark' as "true" on dark themes, the above rule
|
|
146
|
-
* won't work because of the said "fallback value" logic. Therefore,
|
|
147
|
-
* we set the '--is-dark' to "false" on light themes and not set it
|
|
148
|
-
* at all on dark themes so that the fallback value can be used on
|
|
149
|
-
* dark themes.
|
|
150
|
-
*
|
|
151
|
-
* On light themes, since '--is-dark' exists, the above rule will be
|
|
152
|
-
* interpolated as:
|
|
153
|
-
* "background-color: false"
|
|
154
|
-
*
|
|
155
|
-
* On dark themes, since '--is-dark' doesn't exist, the fallback value
|
|
156
|
-
* will be used ('red' in this case) and the rule will be interpolated as:
|
|
157
|
-
* "background-color: red"
|
|
158
|
-
*
|
|
159
|
-
* It's easier to understand and remember like this.
|
|
160
|
-
*/
|
|
161
112
|
...(!isDark ? { '--is-dark': 'false' } : {}),
|
|
162
113
|
|
|
163
|
-
/* Generate custom properties from customProps */
|
|
164
114
|
..._.fromPairs(_.flatten(_.map(background, (value, key) => [[`--cmat-${key}`, value], [`--cmat-${key}-rgb`, chroma(value).rgb().join(',')]]))),
|
|
165
115
|
..._.fromPairs(_.flatten(_.map(foreground, (value, key) => [[`--cmat-${key}`, value], [`--cmat-${key}-rgb`, chroma(value).rgb().join(',')]])))
|
|
166
116
|
}
|
|
@@ -168,7 +118,6 @@ const theming = plugin.withOptions((options) => ({
|
|
|
168
118
|
});
|
|
169
119
|
|
|
170
120
|
const schemeUtilities = (() => {
|
|
171
|
-
/* Generate general styles & utilities */
|
|
172
121
|
return {};
|
|
173
122
|
})();
|
|
174
123
|
|
|
@@ -179,11 +128,6 @@ const theming = plugin.withOptions((options) => ({
|
|
|
179
128
|
return {
|
|
180
129
|
theme: {
|
|
181
130
|
extend: {
|
|
182
|
-
/**
|
|
183
|
-
* Add 'Primary', 'Accent' and 'Warn' palettes as colors so all color utilities
|
|
184
|
-
* are generated for them; "bg-primary", "text-on-primary", "bg-accent-600" etc.
|
|
185
|
-
* This will also allow using arbitrary values with them such as opacity and such.
|
|
186
|
-
*/
|
|
187
131
|
colors: _.fromPairs(_.flatten(_.map(_.keys(flattenColorPalette(normalizeTheme(options.themes.default))), (name) => [
|
|
188
132
|
[name, `rgba(var(--cmat-${name}-rgb), <alpha-value>)`],
|
|
189
133
|
[`on-${name}`, `rgba(var(--cmat-on-${name}-rgb), <alpha-value>)`]
|
|
@@ -236,4 +180,4 @@ const theming = plugin.withOptions((options) => ({
|
|
|
236
180
|
}
|
|
237
181
|
);
|
|
238
182
|
|
|
239
|
-
module.exports = theming;
|
|
183
|
+
module.exports = theming;
|
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
const chroma = require('chroma-js');
|
|
2
2
|
const _ = require('lodash');
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
* Generates contrasting counterparts of the given palette.
|
|
6
|
-
* The provided palette must be in the same format with
|
|
7
|
-
* default Tailwind color palettes.
|
|
8
|
-
*
|
|
9
|
-
* @param palette
|
|
10
|
-
* @private
|
|
11
|
-
*/
|
|
4
|
+
|
|
12
5
|
const generateContrasts = (palette) => {
|
|
13
6
|
const lightColor = '#FFFFFF';
|
|
14
7
|
let darkColor = '#FFFFFF';
|
|
15
|
-
|
|
16
|
-
// Iterate through the palette to find the darkest color
|
|
17
8
|
_.forEach(palette, ((color) => {
|
|
18
9
|
darkColor = chroma.contrast(color, '#FFFFFF') > chroma.contrast(darkColor, '#FFFFFF') ? color : darkColor;
|
|
19
10
|
}));
|
|
20
|
-
|
|
21
|
-
// Generate the contrasting colors
|
|
22
11
|
return _.fromPairs(_.map(palette, ((color, hue) => [
|
|
23
12
|
hue,
|
|
24
13
|
chroma.contrast(color, darkColor) > chroma.contrast(color, lightColor) ? darkColor : lightColor
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
const chroma = require('chroma-js');
|
|
2
2
|
const _ = require('lodash');
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
* Generates palettes from the provided configuration.
|
|
6
|
-
* Accepts a single color string or a Tailwind-like
|
|
7
|
-
* color object. If provided Tailwind-like color object,
|
|
8
|
-
* it must have a 500 hue level.
|
|
9
|
-
*
|
|
10
|
-
* @param config
|
|
11
|
-
*/
|
|
4
|
+
|
|
12
5
|
const generatePalette = (config) =>
|
|
13
6
|
{
|
|
14
|
-
// Prepare an empty palette
|
|
15
7
|
const palette = {
|
|
16
8
|
50 : null,
|
|
17
9
|
100: null,
|
|
@@ -24,37 +16,20 @@ const generatePalette = (config) =>
|
|
|
24
16
|
800: null,
|
|
25
17
|
900: null
|
|
26
18
|
};
|
|
27
|
-
|
|
28
|
-
// If a single color is provided,
|
|
29
|
-
// assign it to the 500
|
|
30
19
|
if ( _.isString(config) )
|
|
31
20
|
{
|
|
32
21
|
palette[500] = chroma.valid(config) ? config : null;
|
|
33
22
|
}
|
|
34
|
-
|
|
35
|
-
// If a partial palette is provided,
|
|
36
|
-
// assign the values
|
|
37
23
|
if ( _.isPlainObject(config) )
|
|
38
24
|
{
|
|
39
25
|
if ( !chroma.valid(config[500]) )
|
|
40
26
|
{
|
|
41
27
|
throw new Error('You must have a 500 hue in your palette configuration! Make sure the main color of your palette is marked as 500.');
|
|
42
28
|
}
|
|
43
|
-
|
|
44
|
-
// Remove everything that is not a hue/color entry
|
|
45
29
|
config = _.pick(config, Object.keys(palette));
|
|
46
|
-
|
|
47
|
-
// Merge the values
|
|
48
30
|
_.mergeWith(palette, config, (objValue, srcValue) => chroma.valid(srcValue) ? srcValue : null);
|
|
49
31
|
}
|
|
50
|
-
|
|
51
|
-
// Prepare the colors array
|
|
52
32
|
const colors = Object.values(palette).filter((color) => color);
|
|
53
|
-
|
|
54
|
-
// Generate a very dark and a very light versions of the
|
|
55
|
-
// default color to use them as the boundary colors rather
|
|
56
|
-
// than using pure white and pure black. This will stop
|
|
57
|
-
// in between colors' hue values to slipping into the grays.
|
|
58
33
|
colors.unshift(
|
|
59
34
|
chroma.scale(['white', palette[500]])
|
|
60
35
|
.domain([0, 1])
|
|
@@ -67,8 +42,6 @@ const generatePalette = (config) =>
|
|
|
67
42
|
.mode("lrgb")
|
|
68
43
|
.colors(10)[1]
|
|
69
44
|
);
|
|
70
|
-
|
|
71
|
-
// Prepare the domains array
|
|
72
45
|
const domain = [
|
|
73
46
|
0,
|
|
74
47
|
...Object.entries(palette)
|
|
@@ -76,13 +49,9 @@ const generatePalette = (config) =>
|
|
|
76
49
|
.map(([key]) => parseInt(key) / 1000),
|
|
77
50
|
1
|
|
78
51
|
];
|
|
79
|
-
|
|
80
|
-
// Generate the color scale
|
|
81
52
|
const scale = chroma.scale(colors)
|
|
82
53
|
.domain(domain)
|
|
83
54
|
.mode('lrgb');
|
|
84
|
-
|
|
85
|
-
// Build and return the final palette
|
|
86
55
|
return {
|
|
87
56
|
50 : scale(0.05).hex(),
|
|
88
57
|
100: scale(0.1).hex(),
|
|
@@ -87,12 +87,6 @@ declare class CNativeDatetimeAdapter extends DatetimeAdapter<Date> {
|
|
|
87
87
|
addCalendarMinutes(date: Date, minutes: number): Date;
|
|
88
88
|
toIso8601(date: Date): string;
|
|
89
89
|
private _getDateInNextMonth;
|
|
90
|
-
/**
|
|
91
|
-
* Pads a number to make it two digits.
|
|
92
|
-
*
|
|
93
|
-
* @param n The number to pad.
|
|
94
|
-
* @returns The padded number.
|
|
95
|
-
*/
|
|
96
90
|
private _2digit;
|
|
97
91
|
private _createDateWithOverflow;
|
|
98
92
|
static ɵfac: i0.ɵɵFactoryDeclaration<CNativeDatetimeAdapter, never>;
|
|
@@ -123,14 +117,8 @@ declare class DayjsDatetimeAdapter extends DatetimeAdapter<Dayjs> {
|
|
|
123
117
|
declare const CMAT_DAYJS_DATETIME_FORMATS: CmatDatetimeFormats;
|
|
124
118
|
|
|
125
119
|
interface DayJsDateAdapterOptions {
|
|
126
|
-
/**
|
|
127
|
-
* Turns the use of utc dates on or off.
|
|
128
|
-
* Changing this will change how Angular Material components like DatePicker output dates.
|
|
129
|
-
* {@default false}
|
|
130
|
-
*/
|
|
131
120
|
useUtc?: boolean;
|
|
132
121
|
}
|
|
133
|
-
/** InjectionToken for Dayjs date adapter to configure options. */
|
|
134
122
|
declare const CMAT_DAYJS_DATE_ADAPTER_OPTIONS: InjectionToken<DayJsDateAdapterOptions>;
|
|
135
123
|
declare function CMAT_DAYJS_DATE_ADAPTER_OPTIONS_FACTORY(): DayJsDateAdapterOptions;
|
|
136
124
|
declare class DayjsDateAdapter extends DateAdapter<Dayjs> {
|
|
@@ -158,19 +146,6 @@ declare class DayjsDateAdapter extends DateAdapter<Dayjs> {
|
|
|
158
146
|
addCalendarMonths(date: Dayjs, months: number): Dayjs;
|
|
159
147
|
addCalendarDays(date: Dayjs, days: number): Dayjs;
|
|
160
148
|
toIso8601(date: Dayjs): string;
|
|
161
|
-
/**
|
|
162
|
-
* Attempts to deserialize a value to a valid date object. This is different from parsing in that
|
|
163
|
-
* deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
|
|
164
|
-
* string). The default implementation does not allow any deserialization, it simply checks that
|
|
165
|
-
* the given value is already a valid date object or null. The `<mat-datepicker>` will call this
|
|
166
|
-
* method on all of it's `@Input()` properties that accept dates. It is therefore possible to
|
|
167
|
-
* support passing values from your backend directly to these properties by overriding this method
|
|
168
|
-
* to also deserialize the format used by your backend.
|
|
169
|
-
*
|
|
170
|
-
* @param value The value to be deserialized into a date object.
|
|
171
|
-
* @returns The deserialized date object, either a valid date, null if the value can be
|
|
172
|
-
* deserialized into a null date (e.g. the empty string), or an invalid date.
|
|
173
|
-
*/
|
|
174
149
|
deserialize(value: any): Dayjs | null;
|
|
175
150
|
isDateInstance(obj: any): boolean;
|
|
176
151
|
isValid(date: Dayjs): boolean;
|