@brightspace-ui/core 3.38.1 → 3.38.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,13 +1,14 @@
1
1
  import '../colors/colors.js';
2
2
  import { codeStyles, createHtmlBlockRenderer as createCodeRenderer } from '../../helpers/prism.js';
3
- import { css, html, LitElement, nothing, unsafeCSS } from 'lit';
3
+ import { createRef, ref } from 'lit/directives/ref.js';
4
+ import { css, html, LitElement, unsafeCSS } from 'lit';
4
5
  import { classMap } from 'lit/directives/class-map.js';
5
6
  import { createHtmlBlockRenderer as createMathRenderer } from '../../helpers/mathjax.js';
6
7
  import { getFocusPseudoClass } from '../../helpers/focus.js';
8
+ import { LoadingCompleteMixin } from '../../mixins/loading-complete/loading-complete-mixin.js';
7
9
  import { renderEmbeds } from '../../helpers/embeds.js';
8
10
  import { requestInstance } from '../../mixins/provider/provider-mixin.js';
9
11
  import { tryGet } from '@brightspace-ui/lms-context-provider/client.js';
10
- import { until } from 'lit/directives/until.js';
11
12
 
12
13
  export const htmlBlockContentStyles = css`
13
14
  .d2l-html-block-rendered {
@@ -142,7 +143,7 @@ const getRenderers = async() => {
142
143
  /**
143
144
  * A component for displaying user-authored HTML.
144
145
  */
145
- class HtmlBlock extends LitElement {
146
+ class HtmlBlock extends LoadingCompleteMixin(LitElement) {
146
147
 
147
148
  static get properties() {
148
149
  return {
@@ -206,8 +207,7 @@ class HtmlBlock extends LitElement {
206
207
  this._initialContextResolve = undefined;
207
208
  this._initialContextPromise = new Promise(resolve => this._initialContextResolve = resolve);
208
209
 
209
- this._renderersProcessedResolve = undefined;
210
- this._renderersProcessedPromise = new Promise(resolve => this._renderersProcessedResolve = resolve);
210
+ this._renderContainerRef = createRef();
211
211
 
212
212
  const contextKeysPromise = getRenderers().then(renderers => renderers.reduce((keys, currentRenderer) => {
213
213
  if (currentRenderer.contextKeys) currentRenderer.contextKeys.forEach(key => keys.push(key));
@@ -216,10 +216,7 @@ class HtmlBlock extends LitElement {
216
216
 
217
217
  const contextValsPromise = contextKeysPromise.then(contextKeys => {
218
218
  return Promise.allSettled(contextKeys.map(key => {
219
- return tryGet(key, undefined, ctx => {
220
- this._context.set(key, ctx);
221
- this.updated(new Map([['_context']]));
222
- });
219
+ return tryGet(key, undefined, ctx => this._context.set(key, ctx));
223
220
  }));
224
221
  });
225
222
 
@@ -238,24 +235,18 @@ class HtmlBlock extends LitElement {
238
235
  };
239
236
 
240
237
  return html`
241
- <div class="${classMap(renderContainerClasses)}">
242
- ${!this.noDeferredRendering ? until(this._processEmbeds(), nothing) : nothing}
243
- </div>
238
+ <div class="${classMap(renderContainerClasses)}" ${ref(this._renderContainerRef)}></div>
244
239
  ${this.noDeferredRendering ? html`<slot @slotchange="${this._handleSlotChange}"></slot>` : ''}
245
240
  `;
246
241
  }
247
242
 
248
243
  async updated(changedProperties) {
249
244
  super.updated(changedProperties);
250
- if ((changedProperties.has('embeds') || changedProperties.has('_context')) && this.html !== undefined && this.html !== null && !this.noDeferredRendering) {
245
+ if (this.html !== undefined && this.html !== null && !this.noDeferredRendering) {
251
246
  await this._updateRenderContainer();
252
247
  }
253
248
  }
254
249
 
255
- async getLoadingComplete() {
256
- return this._renderersProcessedPromise;
257
- }
258
-
259
250
  async _handleSlotChange(e) {
260
251
  if (!e.target || !this.shadowRoot || !this.noDeferredRendering) return;
261
252
  await this._renderInline(e.target);
@@ -264,7 +255,6 @@ class HtmlBlock extends LitElement {
264
255
  async _processEmbeds() {
265
256
  const htmlFragment = document.createRange().createContextualFragment(this.html);
266
257
  await renderEmbeds(htmlFragment);
267
- this.updated(new Map([['embeds']]));
268
258
  return htmlFragment;
269
259
  }
270
260
 
@@ -289,7 +279,7 @@ class HtmlBlock extends LitElement {
289
279
  loadingCompletePromises.push(renderer.getLoadingComplete());
290
280
  }
291
281
  }
292
- Promise.all(loadingCompletePromises).then(() => this._renderersProcessedResolve());
282
+ Promise.all(loadingCompletePromises).then(this.resolveLoadingComplete);
293
283
  }
294
284
 
295
285
  async _renderInline(slot) {
@@ -300,15 +290,17 @@ class HtmlBlock extends LitElement {
300
290
  .find(node => (node.nodeType === Node.ELEMENT_NODE && node.tagName === 'DIV'));
301
291
 
302
292
  if (!noDeferredRenderingContainer) {
303
- this._renderersProcessedResolve();
293
+ this.resolveLoadingComplete();
304
294
  return;
305
295
  }
306
296
  await this._processRenderers(noDeferredRenderingContainer);
307
297
  }
308
298
 
309
299
  async _updateRenderContainer() {
310
- const renderContainer = this.shadowRoot.querySelector('.d2l-html-block-rendered');
311
- await this._processRenderers(renderContainer);
300
+ if (!this._renderContainerRef.value) return;
301
+ this._renderContainerRef.value.innerHTML = '';
302
+ this._renderContainerRef.value.append(await this._processEmbeds());
303
+ await this._processRenderers(this._renderContainerRef.value);
312
304
  }
313
305
 
314
306
  _validateHtml() {
@@ -4729,6 +4729,14 @@
4729
4729
  "description": "Whether to disable deferred rendering of the user-authored HTML. Do *not* set this\nunless your HTML relies on script executions that may break upon stamping.",
4730
4730
  "type": "Boolean",
4731
4731
  "default": "false"
4732
+ },
4733
+ {
4734
+ "name": "loadingComplete",
4735
+ "type": "Promise<any>"
4736
+ },
4737
+ {
4738
+ "name": "resolveLoadingComplete",
4739
+ "type": "() => void"
4732
4740
  }
4733
4741
  ]
4734
4742
  },
package/lang/ar.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "عنوان URL غير صالح",
45
45
  "components.form-element.valueMissing": "{label} مطلوبة.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {تم العثور على {count} خطأ في المعلومات التي أرسلتها} other {تم العثور على {count} من الأخطاء في المعلومات التي أرسلتها}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "تبديل تفاصيل الخطأ",
48
48
  "components.input-color.backgroundColor": "لون الخلفية",
49
49
  "components.input-color.foregroundColor": "لون المقدمة",
50
50
  "components.input-color.none": "لا شيء",
package/lang/cy.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "Nid yw'r URL yn ddilys.",
45
45
  "components.form-element.valueMissing": "Mae angen {label}.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {Canfuwyd {count} gwall yn y wybodaeth a gyflwynoch} other {Canfuwyd {count} gwall yn y wybodaeth a gyflwynoch}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "Toglo manylion gwall",
48
48
  "components.input-color.backgroundColor": "Lliw Cefndir",
49
49
  "components.input-color.foregroundColor": "Lliw Blaendir",
50
50
  "components.input-color.none": "Dim",
package/lang/da.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL-adresse er ikke gyldig",
45
45
  "components.form-element.valueMissing": "{label} er påkrævet.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {Der blev fundet {count} fejl i de oplysninger, du indsendte} other {Der blev fundet {count} fejl i de oplysninger, du indsendte}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "Slå fejloplysninger til/fra",
48
48
  "components.input-color.backgroundColor": "Baggrundsfarve",
49
49
  "components.input-color.foregroundColor": "Forgrundsfarve",
50
50
  "components.input-color.none": "Ingen",
package/lang/de.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL ist ungültig",
45
45
  "components.form-element.valueMissing": "{label} ist erforderlich.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {Die von Ihnen übermittelten Informationen enthalten {count} Fehler} other {Die von Ihnen übermittelten Informationen enthalten {count} Fehler}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "Fehlerdetails ein-/ausschalten",
48
48
  "components.input-color.backgroundColor": "Hintergrundfarbe",
49
49
  "components.input-color.foregroundColor": "Vordergrundfarbe",
50
50
  "components.input-color.none": "Keine",
package/lang/es-es.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "La dirección URL no es válida",
45
45
  "components.form-element.valueMissing": "{label} es obligatorio.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {Se ha encontrado {count} error en la información que ha enviado} other {Se han encontrado {count} errores en la información que ha enviado}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "Alternar detalles del error",
48
48
  "components.input-color.backgroundColor": "Color de fondo",
49
49
  "components.input-color.foregroundColor": "Color del primer plano",
50
50
  "components.input-color.none": "Ninguno",
package/lang/es.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "La dirección URL no es válida",
45
45
  "components.form-element.valueMissing": "{label} es obligatoria.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {Se encontró {count} error en la información que envió} other {Se encontraron {count} errores en la información que envió}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "Activar o desactivar la presentación de detalles de los errores",
48
48
  "components.input-color.backgroundColor": "Color de fondo",
49
49
  "components.input-color.foregroundColor": "Color del primer plano",
50
50
  "components.input-color.none": "Ninguno",
package/lang/fr-fr.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL non valide",
45
45
  "components.form-element.valueMissing": "{label} est obligatoire.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {{count} erreur trouvée dans les informations soumises} other {{count} erreurs trouvées dans les informations soumises}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "Afficher/Masquer les détails de l’erreur",
48
48
  "components.input-color.backgroundColor": "Couleur de l’arrière-plan",
49
49
  "components.input-color.foregroundColor": "Couleur de l’avant-plan",
50
50
  "components.input-color.none": "Aucune",
package/lang/fr.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "L'URL n'est pas valide",
45
45
  "components.form-element.valueMissing": "{label} est requis.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {Il y avait {count} erreur trouvée dans les informations que vous avez soumises} other {Il y avait {count} erreurs trouvées dans les informations que vous avez soumises}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "Afficher les détails de l'erreur",
48
48
  "components.input-color.backgroundColor": "Couleur d’arrière-plan",
49
49
  "components.input-color.foregroundColor": "Couleur de l'avant-plan",
50
50
  "components.input-color.none": "Aucun",
package/lang/hi.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL मान्य नहीं है",
45
45
  "components.form-element.valueMissing": "{label} आवश्यक है।",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {आपके द्वारा सबमिट की गई जानकारी में {count} त्रुटियाँ पाई गईं} other {आपके द्वारा सबमिट की गई जानकारी में {count} त्रुटियाँ पाई गईं}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "त्रुटि विवरण टॉगल करें",
48
48
  "components.input-color.backgroundColor": "पृष्ठभूमि का रंग",
49
49
  "components.input-color.foregroundColor": "अग्रभूमि का रंग",
50
50
  "components.input-color.none": "कोई नहीं",
package/lang/ja.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL が有効ではありません",
45
45
  "components.form-element.valueMissing": "{label} は必須です。",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, other {送信した情報に {count} 件のエラーが見つかりました}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "エラーの詳細を切り替え",
48
48
  "components.input-color.backgroundColor": "背景色",
49
49
  "components.input-color.foregroundColor": "前景色",
50
50
  "components.input-color.none": "なし",
package/lang/ko.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL이 유효하지 않습니다",
45
45
  "components.form-element.valueMissing": "{label}이(가) 필요합니다.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, other {제출한 정보에서 {count}개의 오류가 발견되었습니다}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "오류 세부 정보 전환",
48
48
  "components.input-color.backgroundColor": "배경 색상",
49
49
  "components.input-color.foregroundColor": "전경 색상",
50
50
  "components.input-color.none": "없음",
package/lang/nl.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL is niet geldig",
45
45
  "components.form-element.valueMissing": "{label} is vereist.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {Er is {count} fout gevonden in de informatie die u hebt ingediend} other {Er zijn {count} fouten gevonden in de informatie die u hebt ingediend}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "Foutdetails in-/uitschakelen",
48
48
  "components.input-color.backgroundColor": "Achtergrondkleur",
49
49
  "components.input-color.foregroundColor": "Voorgrondkleur",
50
50
  "components.input-color.none": "Geen",
package/lang/pt.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL inválido",
45
45
  "components.form-element.valueMissing": "{label} é obrigatório.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {{count} erro foi encontrado nas informações enviadas} other {{count} erros foram encontrados nas informações enviadas}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "Alternar detalhes do erro",
48
48
  "components.input-color.backgroundColor": "Cor do Plano de fundo",
49
49
  "components.input-color.foregroundColor": "Cor do Primeiro plano",
50
50
  "components.input-color.none": "Nenhum",
package/lang/sv.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL är inte giltigt",
45
45
  "components.form-element.valueMissing": "{label} krävs.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {Det finns {count} fel i informationen som du skickade} other {Det finns {count} fel i informationen som du skickade}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "Växla felinformation",
48
48
  "components.input-color.backgroundColor": "Bakgrundsfärg",
49
49
  "components.input-color.foregroundColor": "Förgrundsfärg",
50
50
  "components.input-color.none": "Inga",
package/lang/tr.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL geçerli değil",
45
45
  "components.form-element.valueMissing": "{label} zorunludur.",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, one {Gönderdiğiniz bilgilerde {count} hata bulundu} other {Gönderdiğiniz bilgilerde {count} hata bulundu}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "Hata ayrıntılarını değiştir",
48
48
  "components.input-color.backgroundColor": "Arka Plan Rengi",
49
49
  "components.input-color.foregroundColor": "Ön Plan Rengi",
50
50
  "components.input-color.none": "Yok",
package/lang/zh-cn.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL 无效",
45
45
  "components.form-element.valueMissing": "{label} 为必填项。",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, other {在您提交的信息中发现 {count} 个错误}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "切换错误详细信息",
48
48
  "components.input-color.backgroundColor": "背景颜色",
49
49
  "components.input-color.foregroundColor": "前景颜色",
50
50
  "components.input-color.none": "无",
package/lang/zh-tw.js CHANGED
@@ -44,7 +44,7 @@ export default {
44
44
  "components.form-element.input.url.typeMismatch": "URL 無效",
45
45
  "components.form-element.valueMissing": "{label} 為必填。",
46
46
  "components.form-error-summary.errorSummary": "{count, plural, other {您提交的資訊中發現 {count} 個錯誤}}",
47
- "components.form-error-summary.text": "Toggle error details",
47
+ "components.form-error-summary.text": "切換錯誤詳細資料",
48
48
  "components.input-color.backgroundColor": "背景顏色",
49
49
  "components.input-color.foregroundColor": "前景顏色",
50
50
  "components.input-color.none": "無",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.38.1",
3
+ "version": "3.38.3",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",