@brightspace-ui/core 2.18.3 → 2.18.6
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/components/switch/switch-visibility.js +4 -0
- package/custom-elements.json +6 -4
- package/helpers/README.md +2 -2
- package/helpers/mathjax.js +1 -1
- package/mixins/demo/localize-test.js +11 -13
- package/mixins/localize-mixin.js +5 -4
- package/mixins/localize-mixin.md +11 -0
- package/package.json +1 -1
|
@@ -8,6 +8,10 @@ import { SwitchMixin } from './switch-mixin.js';
|
|
|
8
8
|
*/
|
|
9
9
|
class VisibilitySwitch extends LocalizeCoreElement(SwitchMixin(LitElement)) {
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* The text that is displayed for the switch label.
|
|
13
|
+
* @default "Visibility"
|
|
14
|
+
*/
|
|
11
15
|
get text() {
|
|
12
16
|
return (this._text ? this._text : this.localize('components.switch.visibility'));
|
|
13
17
|
}
|
package/custom-elements.json
CHANGED
|
@@ -9354,8 +9354,9 @@
|
|
|
9354
9354
|
"attributes": [
|
|
9355
9355
|
{
|
|
9356
9356
|
"name": "text",
|
|
9357
|
-
"description": "
|
|
9358
|
-
"type": "string"
|
|
9357
|
+
"description": "The text that is displayed for the switch label.",
|
|
9358
|
+
"type": "string",
|
|
9359
|
+
"default": "\"\\\"Visibility\\\"\""
|
|
9359
9360
|
},
|
|
9360
9361
|
{
|
|
9361
9362
|
"name": "tooltip",
|
|
@@ -9393,8 +9394,9 @@
|
|
|
9393
9394
|
{
|
|
9394
9395
|
"name": "text",
|
|
9395
9396
|
"attribute": "text",
|
|
9396
|
-
"description": "
|
|
9397
|
-
"type": "string"
|
|
9397
|
+
"description": "The text that is displayed for the switch label.",
|
|
9398
|
+
"type": "string",
|
|
9399
|
+
"default": "\"\\\"Visibility\\\"\""
|
|
9398
9400
|
},
|
|
9399
9401
|
{
|
|
9400
9402
|
"name": "tooltip",
|
package/helpers/README.md
CHANGED
|
@@ -125,7 +125,7 @@ getComposedActiveElement()
|
|
|
125
125
|
// gets the first focusable descendant given a node, including those within the shadow DOM
|
|
126
126
|
getFirstFocusableDescendant(node, includeHidden, predicate)
|
|
127
127
|
|
|
128
|
-
// gets the last
|
|
128
|
+
// gets the last focusable descendant given a node, including those within the shadow DOM
|
|
129
129
|
getLastFocusableDescendant(node, includeHidden)
|
|
130
130
|
|
|
131
131
|
// gets the previous focusable node on the page given a node
|
|
@@ -134,7 +134,7 @@ getPreviousFocusable(node, includeHidden)
|
|
|
134
134
|
// gets the next focusable node on the page given a node
|
|
135
135
|
getNextFocusable(node, includeHidden)
|
|
136
136
|
|
|
137
|
-
// gets the ancestor of the given node
|
|
137
|
+
// gets the nearest focusable ancestor of the given node
|
|
138
138
|
getPreviousFocusableAncestor(node, includeHidden, includeTabbablesOnly)
|
|
139
139
|
|
|
140
140
|
// returns true/false whether the element is focusable
|
package/helpers/mathjax.js
CHANGED
|
@@ -74,7 +74,7 @@ export class HtmlBlockMathRenderer {
|
|
|
74
74
|
return elem;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
const inner = elem.innerHTML.
|
|
77
|
+
const inner = elem.innerHTML.replace(/<mspace linebreak="newline">/gi, `<mspace linebreak="newline" style="${lineBreakStyle}">`);
|
|
78
78
|
|
|
79
79
|
const temp = document.createElement('div');
|
|
80
80
|
temp.style.display = 'none';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { html, LitElement } from 'lit';
|
|
2
|
-
import {
|
|
2
|
+
import { LocalizeDynamicMixin } from '../../mixins/localize-dynamic-mixin.js';
|
|
3
3
|
|
|
4
|
-
class LocalizeTest extends
|
|
4
|
+
class LocalizeTest extends LocalizeDynamicMixin(LitElement) {
|
|
5
5
|
|
|
6
6
|
static get properties() {
|
|
7
7
|
return {
|
|
@@ -11,7 +11,7 @@ class LocalizeTest extends LocalizeMixin(LitElement) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
static
|
|
14
|
+
static get localizeConfig() {
|
|
15
15
|
const langResources = {
|
|
16
16
|
'ar': { 'hello': 'مرحبا {name}' },
|
|
17
17
|
'de': { 'hello': 'Hallo {name}' },
|
|
@@ -29,17 +29,15 @@ class LocalizeTest extends LocalizeMixin(LitElement) {
|
|
|
29
29
|
'zh-cn': { 'hello': '你好 {name}' },
|
|
30
30
|
'zh-tw': { 'hello': '你好 {name}' }
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
32
|
+
return {
|
|
33
|
+
importFunc: async lang => {
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
resolve(langResources[lang]);
|
|
37
|
+
}, 50);
|
|
38
|
+
});
|
|
39
39
|
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return null;
|
|
40
|
+
};
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
render() {
|
package/mixins/localize-mixin.js
CHANGED
|
@@ -163,12 +163,13 @@ export const LocalizeMixin = dedupeMixin(superclass => class extends superclass
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
static _getAllLocalizeResources(possibleLanguages, config = this.localizeConfig) {
|
|
166
|
-
let resourcesLoadedPromises;
|
|
166
|
+
let resourcesLoadedPromises = [];
|
|
167
167
|
const superCtor = Object.getPrototypeOf(this);
|
|
168
|
+
// get imported terms for each config, head up the chain to get them all
|
|
168
169
|
if ('_getAllLocalizeResources' in superCtor) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
resourcesLoadedPromises =
|
|
170
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
171
|
+
const superConfig = superCtor.hasOwnProperty('localizeConfig') && superCtor.localizeConfig.importFunc ? superCtor.localizeConfig : config;
|
|
172
|
+
resourcesLoadedPromises = superCtor._getAllLocalizeResources(possibleLanguages, superConfig);
|
|
172
173
|
}
|
|
173
174
|
// eslint-disable-next-line no-prototype-builtins
|
|
174
175
|
if (this.hasOwnProperty('getLocalizeResources') || this.hasOwnProperty('resources')) {
|
package/mixins/localize-mixin.md
CHANGED
|
@@ -103,6 +103,17 @@ static get localizeConfig() {
|
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
+
**Note:** If using `LocalizeCoreElement` or a mixin that utilizes `LocalizeCoreElement` as well as `LocalizeDynamicMixin` or a mixin that uses `LocalizeDynamicMixin`, `LocalizeDynamicMixin` **must** appear before `LocalizeCoreElement` in the chain. For example:
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
import { LocalizeCoreElement } from '@brightspace-ui/core/helpers/localize-core-element.js';
|
|
110
|
+
import { LocalizeDynamicMixin } from '@brightspace-ui/core/mixins/localize-dynamic-mixin.js';
|
|
111
|
+
|
|
112
|
+
class MyComponent extends LocalizeDynamicMixin(LocalizeCoreElement(LitElement)) {
|
|
113
|
+
...
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
106
117
|
## `localize()`
|
|
107
118
|
|
|
108
119
|
Once your localization resources are available, the `localize()` method is used to localize a piece of text in your `render()` method.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.6",
|
|
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",
|