@muonic/muon 0.0.2-beta.22 → 0.0.2-beta.24
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.2-beta.24](https://github.com/centrica-engineering/muon/compare/v0.0.2-beta.23...v0.0.2-beta.24) (2023-07-04)
|
|
6
|
+
|
|
7
|
+
### [0.0.2-beta.23](https://github.com/centrica-engineering/muon/compare/v0.0.2-beta.22...v0.0.2-beta.23) (2023-07-04)
|
|
8
|
+
|
|
5
9
|
### [0.0.2-beta.22](https://github.com/centrica-engineering/muon/compare/v0.0.2-beta.21...v0.0.2-beta.22) (2023-06-15)
|
|
6
10
|
|
|
7
11
|
|
|
@@ -73,7 +73,7 @@ export class Form extends MuonElement {
|
|
|
73
73
|
!this._resetButton.loading
|
|
74
74
|
) {
|
|
75
75
|
this._nativeForm.reset();
|
|
76
|
-
Array.from(this.
|
|
76
|
+
Array.from(this._elements).forEach((element) => {
|
|
77
77
|
const componentElement = this._findInputElement(element);
|
|
78
78
|
if (componentElement !== element) {
|
|
79
79
|
componentElement.reset?.();
|
|
@@ -111,6 +111,10 @@ export class Form extends MuonElement {
|
|
|
111
111
|
return validity.isValid;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
get _elements() {
|
|
115
|
+
return this._nativeForm.elements;
|
|
116
|
+
}
|
|
117
|
+
|
|
114
118
|
get _nativeForm() {
|
|
115
119
|
return this.querySelector('form');
|
|
116
120
|
}
|
|
@@ -142,7 +146,7 @@ export class Form extends MuonElement {
|
|
|
142
146
|
validate() {
|
|
143
147
|
let isValid = true;
|
|
144
148
|
// @TODO: Check how this works with form associated
|
|
145
|
-
const validationStates = Array.from(this.
|
|
149
|
+
const validationStates = Array.from(this._elements).reduce((acc, element) => {
|
|
146
150
|
element = this._findInputElement(element);
|
|
147
151
|
const { name } = element;
|
|
148
152
|
const hasBeenSet = acc.filter((el) => el.name === name).length > 0;
|
package/muon-element/index.js
CHANGED
|
@@ -48,14 +48,17 @@ export const MuonElementMixin = (superClass) => class extends superClass {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const addStyles = (css, key = 0) => {
|
|
51
|
-
|
|
51
|
+
if (typeof css !== 'string' || !css) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
52
55
|
const nodeName = this.nodeName.toLowerCase();
|
|
53
56
|
const parentNode = this.getRootNode();
|
|
54
57
|
const parentNodeType = parentNode.nodeName;
|
|
55
58
|
const styleName = key > 0 ? `${nodeName}-styles-${key}` : `${nodeName}-styles`;
|
|
56
59
|
|
|
57
60
|
// First need to replace `light-dom` with the component name
|
|
58
|
-
|
|
61
|
+
css = css.replace(/light-dom/g, nodeName);
|
|
59
62
|
|
|
60
63
|
// How we add the styles depends on where it is being added, HTMLDocument or another ShadowDom.
|
|
61
64
|
// If the Document we don't want to add multiple times
|
|
@@ -66,10 +69,10 @@ export const MuonElementMixin = (superClass) => class extends superClass {
|
|
|
66
69
|
if (supportsAdoptingStyleSheets) {
|
|
67
70
|
const stylesheet = new CSSStyleSheet();
|
|
68
71
|
|
|
69
|
-
stylesheet.replaceSync(
|
|
72
|
+
stylesheet.replaceSync(css);
|
|
70
73
|
stylesAdded = [...parentNode.adoptedStyleSheets, stylesheet];
|
|
71
74
|
} else {
|
|
72
|
-
stylesAdded = [
|
|
75
|
+
stylesAdded = [css];
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
adoptStyles(parentNode, stylesAdded);
|
|
@@ -79,11 +82,13 @@ export const MuonElementMixin = (superClass) => class extends superClass {
|
|
|
79
82
|
|
|
80
83
|
if (!Array.from(checkSheets(styleSheets, styleName)).length > 0) {
|
|
81
84
|
const style = document.createElement('style');
|
|
82
|
-
style.innerHTML = String.raw`${
|
|
85
|
+
style.innerHTML = String.raw`${css}`;
|
|
83
86
|
style.title = styleName;
|
|
84
87
|
document.head.appendChild(style);
|
|
85
88
|
}
|
|
86
89
|
}
|
|
90
|
+
|
|
91
|
+
return;
|
|
87
92
|
};
|
|
88
93
|
|
|
89
94
|
if (Array.isArray(css)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muonic/muon",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"chokidar": "3.5.3",
|
|
35
35
|
"chroma-js": "2.4.2",
|
|
36
36
|
"command-line-args": "5.2.1",
|
|
37
|
+
"cssnano": "6.0.1",
|
|
37
38
|
"deepmerge": "4.3.1",
|
|
38
39
|
"glob": "10.2.2",
|
|
39
40
|
"glob-to-regexp": "0.4.1",
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
"postcss-import": "15.1.0",
|
|
47
48
|
"postcss-preset-env": "8.3.2",
|
|
48
49
|
"postcss-simple-vars": "7.0.1",
|
|
50
|
+
"rollup-plugin-import-css": "3.3.1",
|
|
49
51
|
"rollup-plugin-lit-css": "4.0.1",
|
|
50
52
|
"rollup-plugin-minify-html-literals": "1.2.6",
|
|
51
53
|
"rollup-plugin-styles": "4.0.0",
|
|
@@ -8,7 +8,9 @@ import postcssPreset from 'postcss-preset-env';
|
|
|
8
8
|
import postcssImport from 'postcss-import';
|
|
9
9
|
import postcssVariables from 'postcss-simple-vars';
|
|
10
10
|
import postcssExtendRule from 'postcss-extend-rule';
|
|
11
|
+
import cssnanoPlugin from 'cssnano';
|
|
11
12
|
import litcssPlugin from 'rollup-plugin-lit-css';
|
|
13
|
+
import cssPlugin from 'rollup-plugin-import-css';
|
|
12
14
|
import { cleanup, getConfig, getDestination, createTokens, sourceFilesAnalyzer, getAliasPaths } from './utils/index.mjs';
|
|
13
15
|
|
|
14
16
|
import path from 'path';
|
|
@@ -50,7 +52,17 @@ const postcssPlugins = [
|
|
|
50
52
|
}
|
|
51
53
|
}),
|
|
52
54
|
postcssExtendRule(),
|
|
53
|
-
autoprefixer({ grid: true })
|
|
55
|
+
autoprefixer({ grid: true }),
|
|
56
|
+
cssnanoPlugin({
|
|
57
|
+
preset: [
|
|
58
|
+
'default',
|
|
59
|
+
{
|
|
60
|
+
discardComments: {
|
|
61
|
+
removeAll: true
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
})
|
|
54
66
|
];
|
|
55
67
|
|
|
56
68
|
const createGlobalCSS = async () => {
|
|
@@ -108,6 +120,7 @@ const muonPlugin = () => {
|
|
|
108
120
|
const styles = fromRollup(stylesPlugin);
|
|
109
121
|
const replace = fromRollup(replacePlugin);
|
|
110
122
|
const litcss = fromRollup(litcssPlugin);
|
|
123
|
+
const css = fromRollup(cssPlugin);
|
|
111
124
|
const alias = fromRollup(aliasPlugin);
|
|
112
125
|
const muon = fromRollup(muonPlugin);
|
|
113
126
|
const buildTokens = fromRollup(buildTokensPlugin);
|
|
@@ -134,7 +147,8 @@ export const serverPlugins = [
|
|
|
134
147
|
alias(aliasConfig),
|
|
135
148
|
replace(replaceConfig),
|
|
136
149
|
styles(styleConfig),
|
|
137
|
-
litcss({ exclude: ['**/css/*.css', '**/dist/*.css', 'muon.min.css'] }),
|
|
150
|
+
litcss({ exclude: ['**/css/*.css', '**/dist/*.css', 'muon.min.css', '**/**/*.slotted.css'] }),
|
|
151
|
+
css({ include: '**/**/*.slotted.css' }),
|
|
138
152
|
muon()
|
|
139
153
|
];
|
|
140
154
|
|
|
@@ -143,6 +157,7 @@ export const rollupPlugins = [
|
|
|
143
157
|
aliasPlugin(aliasConfig),
|
|
144
158
|
replacePlugin(replaceConfig),
|
|
145
159
|
stylesPlugin(styleConfig),
|
|
146
|
-
litcssPlugin({ exclude: ['**/css/*.css', '**/dist/*.css', 'muon.min.css'] }),
|
|
160
|
+
litcssPlugin({ exclude: ['**/css/*.css', '**/dist/*.css', 'muon.min.css', '**/**/*.slotted.css'] }),
|
|
161
|
+
cssPlugin({ include: '**/**/*.slotted.css' }),
|
|
147
162
|
muonPlugin()
|
|
148
163
|
];
|
|
@@ -4,10 +4,7 @@ import { MuonElement, ScopedElementsMixin } from '@muonic/muon';
|
|
|
4
4
|
|
|
5
5
|
const MuonComponent = class extends MuonElement {
|
|
6
6
|
get slottedStyles() {
|
|
7
|
-
return {
|
|
8
|
-
_$cssResult$: true,
|
|
9
|
-
cssText: 'light-dom{color:red}'
|
|
10
|
-
};
|
|
7
|
+
return 'light-dom{color:red}';
|
|
11
8
|
}
|
|
12
9
|
|
|
13
10
|
get standardTemplate() {
|