@brightspace-ui/core 1.208.1 → 1.210.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.
package/README.md CHANGED
@@ -125,23 +125,23 @@ If you'd like to run the tests locally to help troubleshoot or develop new tests
125
125
 
126
126
  ```shell
127
127
  # Install dependencies locally
128
- npm install esm mocha puppeteer @brightspace-ui/visual-diff --no-save
128
+ npm install mocha puppeteer @brightspace-ui/visual-diff --no-save
129
129
 
130
130
  # run visual-diff tests
131
- npx mocha './**/*.visual-diff.js' -t 10000 --require esm
131
+ npx mocha './**/*.visual-diff.js' -t 10000
132
132
 
133
133
  # subset of visual-diff tests:
134
- npx mocha './**/*.visual-diff.js' -t 10000 --require esm -g some-pattern
134
+ npx mocha './**/*.visual-diff.js' -t 10000 -g some-pattern
135
135
 
136
136
  # update visual-diff goldens
137
- npx mocha './**/*.visual-diff.js' -t 10000 --require esm --golden
137
+ npx mocha './**/*.visual-diff.js' -t 10000 --golden
138
138
  ```
139
139
 
140
140
  ## Versioning & Releasing
141
141
 
142
142
  > TL;DR: Commits prefixed with `fix:` and `feat:` will trigger patch and minor releases when merged to `main`. Read on for more details...
143
143
 
144
- The [semantic-release GitHub Action](https://github.com/BrightspaceUI/actions/tree/master/semantic-release) is called from the `release.yml` GitHub Action workflow to handle version changes and releasing.
144
+ The [semantic-release GitHub Action](https://github.com/BrightspaceUI/actions/tree/main/semantic-release) is called from the `release.yml` GitHub Action workflow to handle version changes and releasing.
145
145
 
146
146
  ### Version Changes
147
147
 
@@ -4,21 +4,38 @@ Alerts communicate critical information relating to the state of the system and
4
4
  <!-- docs: demo autoSize:false align:start -->
5
5
  ```html
6
6
  <script type="module">
7
- import '@brightspace-ui/core/components/alert/alert-toast.js';
7
+ import '@brightspace-ui/core/components/alert/alert-toast.js';
8
+ import '@brightspace-ui/core/components/button/button.js';
9
+
10
+ var alert = document.querySelector('#alert');
11
+ var alertToast = document.querySelector('#alert-toast');
12
+ var button = document.querySelector('#open');
13
+
14
+ alert.addEventListener('d2l-alert-close', function() {
15
+ if (!alertToast.open) button.style.display = 'block';
16
+ });
17
+ alertToast.addEventListener('d2l-alert-toast-close', function() {
18
+ if (alert.hasAttribute('hidden')) button.style.display = 'block';
19
+ });
20
+
21
+ button.addEventListener('click', () => {
22
+ alert.removeAttribute('hidden');
23
+ alertToast.open = true;
24
+ button.style.display = 'none';
25
+ });
8
26
  </script>
9
- <!-- docs: start hidden content -->
10
27
  <style>
11
28
  d2l-alert-toast {
12
29
  margin-left: 0 !important;
13
30
  margin-right: 0 !important;
14
31
  }
15
32
  </style>
16
- <!-- docs: end hidden content -->
17
33
 
18
- <d2l-alert type="default" button-text="Undo" has-close-button>
34
+ <d2l-button id="open" style="align-self:center;display:none;">Show Alerts</d2l-button>
35
+ <d2l-alert id="alert" type="default" button-text="Undo" has-close-button>
19
36
  A message.
20
37
  </d2l-alert>
21
- <d2l-alert-toast type="success" open no-auto-close>
38
+ <d2l-alert-toast id="alert-toast" type="success" open no-auto-close>
22
39
  A message.
23
40
  </d2l-alert-toast>
24
41
  ```
@@ -7,13 +7,17 @@ Dialogs interrupt the user to complete a set of tasks, confirm an action, or off
7
7
  <script type="module">
8
8
  import '@brightspace-ui/core/components/button/button.js';
9
9
  import '@brightspace-ui/core/components/dialog/dialog.js';
10
- </script>
11
10
 
11
+ document.querySelector('#open-demo').addEventListener('click', () => {
12
+ document.querySelector('#dialog-demo').opened = true;
13
+ });
14
+ </script>
12
15
  <d2l-dialog id="dialog-demo" title-text="Dialog Title">
13
16
  <div>Some dialog content</div>
14
17
  <d2l-button slot="footer" primary data-dialog-action="done">Done</d2l-button>
15
18
  <d2l-button slot="footer" data-dialog-action>Cancel</d2l-button>
16
19
  </d2l-dialog>
20
+ <d2l-button id="open-demo">Show Dialog</d2l-button>
17
21
  ```
18
22
 
19
23
  ## General Dialog [d2l-dialog]
@@ -97,6 +97,11 @@ export const FormElementMixin = superclass => class extends LocalizeCoreElement(
97
97
  * @ignore
98
98
  */
99
99
  noValidate: { type: Boolean, attribute: 'novalidate' },
100
+ /**
101
+ * @ignore
102
+ * Perform validation immediately instead of waiting for the user to make changes.
103
+ */
104
+ validateOnInit: { type: Boolean, attribute: 'validate-on-init' },
100
105
  /**
101
106
  * @ignore
102
107
  */
@@ -125,6 +130,8 @@ export const FormElementMixin = superclass => class extends LocalizeCoreElement(
125
130
  /** @ignore */
126
131
  this.noValidate = false;
127
132
  /** @ignore */
133
+ this.validateOnInit = false;
134
+ /** @ignore */
128
135
  this.validationError = null;
129
136
  /** @ignore */
130
137
  this.childErrors = new Map();
@@ -171,6 +178,9 @@ export const FormElementMixin = superclass => class extends LocalizeCoreElement(
171
178
  this.dispatchEvent(new CustomEvent('invalid-change'));
172
179
  }
173
180
  }
181
+ if (this.validateOnInit && (changedProperties.has('noValidate') || changedProperties.has('validateOnInit'))) {
182
+ this.requestValidate(true);
183
+ }
174
184
  }
175
185
 
176
186
  async requestValidate(showNewErrors = true) {
@@ -210,6 +220,9 @@ export const FormElementMixin = superclass => class extends LocalizeCoreElement(
210
220
 
211
221
  validationCustomConnected(custom) {
212
222
  this._validationCustoms.add(custom);
223
+ if (this.validateOnInit) {
224
+ this.requestValidate(true);
225
+ }
213
226
  }
214
227
 
215
228
  validationCustomDisconnected(custom) {
@@ -42,7 +42,7 @@
42
42
 
43
43
  </script>
44
44
  <script>
45
- document.getElementsByTagName('html')[0].dataset.mathjaxContext = JSON.stringify({ renderLatex: window.location.search.indexOf('latex=true') !== -1 });
45
+ document.getElementsByTagName('html')[0].dataset.mathjaxContext = JSON.stringify({ outputScale: 1.1, renderLatex: window.location.search.indexOf('latex=true') !== -1 });
46
46
  </script>
47
47
  </head>
48
48
  <body unresolved>
@@ -245,8 +245,10 @@ class HtmlBlock extends LitElement {
245
245
  if (fragment) {
246
246
 
247
247
  let temp = document.createElement('div');
248
+ temp.style.display = 'none';
248
249
  temp.appendChild(fragment);
249
250
 
251
+ this._renderContainer.appendChild(temp);
250
252
  temp = await this._processRenderers(temp);
251
253
  this._renderContainer.innerHTML = temp.innerHTML;
252
254
 
@@ -32,9 +32,11 @@ export class HtmlBlockMathRenderer {
32
32
  await loadMathJax(mathJaxConfig);
33
33
 
34
34
  const temp = document.createElement('div');
35
+ temp.style.display = 'none';
35
36
  temp.attachShadow({ mode: 'open' });
36
37
  temp.shadowRoot.innerHTML = `<div><mjx-doc><mjx-head></mjx-head><mjx-body>${elem.innerHTML}</mjx-body></mjx-doc></div>`;
37
38
 
39
+ elem.appendChild(temp);
38
40
  window.MathJax.typesetShadow(temp.shadowRoot);
39
41
  return temp.shadowRoot.firstChild;
40
42
  }
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.208.1",
3
+ "version": "1.210.0",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
+ "type": "module",
5
6
  "repository": "https://github.com/BrightspaceUI/core.git",
6
7
  "publishConfig": {
7
8
  "access": "public"
@@ -48,7 +49,7 @@
48
49
  "@web/test-runner": "^0.13",
49
50
  "@web/test-runner-playwright": "^0.8.8",
50
51
  "axe-core": "^4",
51
- "chalk": "^4",
52
+ "chalk": "^5",
52
53
  "eslint": "^7",
53
54
  "eslint-config-brightspace": "^0.16",
54
55
  "eslint-plugin-html": "^6",