@pie-players/pie-players-shared 1.0.0-beta.4 → 1.0.0-beta.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/dist/i18n/messages/en-US.d.ts +11 -0
- package/dist/i18n/messages/en-US.js +11 -0
- package/dist/i18n/messages/nl-NL.d.ts +6 -0
- package/dist/i18n/messages/nl-NL.js +6 -0
- package/dist/i18n/provider.d.ts +5 -1
- package/dist/i18n/provider.js +8 -1
- package/dist/object/index.d.ts +4 -1
- package/dist/object/index.js +8 -1
- package/package.json +2 -2
|
@@ -161,6 +161,17 @@ declare const enUS: {
|
|
|
161
161
|
audio: string;
|
|
162
162
|
video: string;
|
|
163
163
|
};
|
|
164
|
+
/** `<pie-item-list>`. */
|
|
165
|
+
list: {
|
|
166
|
+
/** The row toggle, a disclosure button whose `aria-expanded` carries the state, so its label stays the same either way. */
|
|
167
|
+
expandA11y: string;
|
|
168
|
+
/** Names the block of an entry's search matches below its summary. */
|
|
169
|
+
highlights: string;
|
|
170
|
+
/** The row toggle's tooltip while the row is expanded: collapsing returns it to the summary. */
|
|
171
|
+
collapse: string;
|
|
172
|
+
/** Shown in an expanded row whose player failed to load; the summary keeps showing above it. */
|
|
173
|
+
playerError: string;
|
|
174
|
+
};
|
|
164
175
|
};
|
|
165
176
|
/** Toolbar and tool-shell chrome owned by the assessment toolkit. */
|
|
166
177
|
toolkit: {
|
|
@@ -161,6 +161,17 @@ const enUS = {
|
|
|
161
161
|
audio: "Audio",
|
|
162
162
|
video: "Video",
|
|
163
163
|
},
|
|
164
|
+
/** `<pie-item-list>`. */
|
|
165
|
+
list: {
|
|
166
|
+
/** The row toggle, a disclosure button whose `aria-expanded` carries the state, so its label stays the same either way. */
|
|
167
|
+
expandA11y: "Show the full item",
|
|
168
|
+
/** Names the block of an entry's search matches below its summary. */
|
|
169
|
+
highlights: "Search matches",
|
|
170
|
+
/** The row toggle's tooltip while the row is expanded: collapsing returns it to the summary. */
|
|
171
|
+
collapse: "Show the summary",
|
|
172
|
+
/** Shown in an expanded row whose player failed to load; the summary keeps showing above it. */
|
|
173
|
+
playerError: "The full item could not be loaded.",
|
|
174
|
+
},
|
|
164
175
|
},
|
|
165
176
|
/** Toolbar and tool-shell chrome owned by the assessment toolkit. */
|
|
166
177
|
toolkit: {
|
|
@@ -114,6 +114,12 @@ const nlNL = {
|
|
|
114
114
|
audio: "Audio",
|
|
115
115
|
video: "Video",
|
|
116
116
|
},
|
|
117
|
+
list: {
|
|
118
|
+
expandA11y: "Volledige vraag tonen",
|
|
119
|
+
highlights: "Zoektreffers",
|
|
120
|
+
collapse: "Samenvatting tonen",
|
|
121
|
+
playerError: "Het volledige item kon niet worden geladen.",
|
|
122
|
+
},
|
|
117
123
|
},
|
|
118
124
|
toolkit: {
|
|
119
125
|
toolsA11y: "Hulpmiddelen",
|
package/dist/i18n/provider.d.ts
CHANGED
|
@@ -57,6 +57,8 @@ export declare class SimpleI18n implements I18nServiceApi {
|
|
|
57
57
|
private catalogs;
|
|
58
58
|
private customMessages;
|
|
59
59
|
private loading;
|
|
60
|
+
/** Counts `setLocale` calls, so a slow load cannot overwrite a later request. */
|
|
61
|
+
private requests;
|
|
60
62
|
private readonly listeners;
|
|
61
63
|
private config;
|
|
62
64
|
constructor(config?: I18nConfig);
|
|
@@ -75,7 +77,9 @@ export declare class SimpleI18n implements I18nServiceApi {
|
|
|
75
77
|
* Resolves the request against the catalogs this provider can serve, loads
|
|
76
78
|
* the winner if it is not resident, then notifies subscribers — in that
|
|
77
79
|
* order, so a component's reactive read re-runs against a catalog that is
|
|
78
|
-
* already in place rather than against the previous locale.
|
|
80
|
+
* already in place rather than against the previous locale. The last call
|
|
81
|
+
* wins: a call whose load finishes after a later call's leaves the locale
|
|
82
|
+
* to that later call.
|
|
79
83
|
*/
|
|
80
84
|
setLocale(locale: LocaleCode): Promise<void>;
|
|
81
85
|
t(key: MessageKeyInput, values?: InterpolationValues): string;
|
package/dist/i18n/provider.js
CHANGED
|
@@ -114,6 +114,8 @@ export class SimpleI18n {
|
|
|
114
114
|
catalogs;
|
|
115
115
|
customMessages;
|
|
116
116
|
loading;
|
|
117
|
+
/** Counts `setLocale` calls, so a slow load cannot overwrite a later request. */
|
|
118
|
+
requests = 0;
|
|
117
119
|
listeners = new Set();
|
|
118
120
|
config;
|
|
119
121
|
constructor(config = {}) {
|
|
@@ -150,9 +152,12 @@ export class SimpleI18n {
|
|
|
150
152
|
* Resolves the request against the catalogs this provider can serve, loads
|
|
151
153
|
* the winner if it is not resident, then notifies subscribers — in that
|
|
152
154
|
* order, so a component's reactive read re-runs against a catalog that is
|
|
153
|
-
* already in place rather than against the previous locale.
|
|
155
|
+
* already in place rather than against the previous locale. The last call
|
|
156
|
+
* wins: a call whose load finishes after a later call's leaves the locale
|
|
157
|
+
* to that later call.
|
|
154
158
|
*/
|
|
155
159
|
async setLocale(locale) {
|
|
160
|
+
const request = ++this.requests;
|
|
156
161
|
const resolved = this.resolveLocaleTag(locale);
|
|
157
162
|
if (!resolved) {
|
|
158
163
|
// A locale we ship no catalog for is legitimate: the host may have
|
|
@@ -182,6 +187,8 @@ export class SimpleI18n {
|
|
|
182
187
|
}
|
|
183
188
|
}
|
|
184
189
|
}
|
|
190
|
+
if (request !== this.requests)
|
|
191
|
+
return;
|
|
185
192
|
this.locale = resolved;
|
|
186
193
|
this.notify();
|
|
187
194
|
}
|
package/dist/object/index.d.ts
CHANGED
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const mergeObjectsIgnoringNullUndefined: <T extends object>(...objects: T[]) => T;
|
|
8
8
|
/**
|
|
9
|
-
* Deep clone
|
|
9
|
+
* Deep clone of arrays and plain objects. Any other object — a `Date`, a bson
|
|
10
|
+
* `ObjectId`, a class instance — is carried over by reference: copying its own
|
|
11
|
+
* keys onto a plain object would drop its prototype, and with it the methods
|
|
12
|
+
* that identify and serialise it.
|
|
10
13
|
*/
|
|
11
14
|
export declare const cloneDeep: <T>(value: T) => T;
|
|
12
15
|
/**
|
package/dist/object/index.js
CHANGED
|
@@ -17,7 +17,10 @@ export const mergeObjectsIgnoringNullUndefined = (...objects) => {
|
|
|
17
17
|
}, {});
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* Deep clone
|
|
20
|
+
* Deep clone of arrays and plain objects. Any other object — a `Date`, a bson
|
|
21
|
+
* `ObjectId`, a class instance — is carried over by reference: copying its own
|
|
22
|
+
* keys onto a plain object would drop its prototype, and with it the methods
|
|
23
|
+
* that identify and serialise it.
|
|
21
24
|
*/
|
|
22
25
|
export const cloneDeep = (value) => {
|
|
23
26
|
if (value === null || typeof value !== "object") {
|
|
@@ -26,6 +29,10 @@ export const cloneDeep = (value) => {
|
|
|
26
29
|
if (Array.isArray(value)) {
|
|
27
30
|
return value.map(cloneDeep);
|
|
28
31
|
}
|
|
32
|
+
const prototype = Object.getPrototypeOf(value);
|
|
33
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
29
36
|
const copy = {};
|
|
30
37
|
for (const key in value) {
|
|
31
38
|
if (Object.hasOwn(value, key)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-players-shared",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared runtime + UI utilities for PIE players",
|
|
6
6
|
"license": "MIT",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"devDependencies": {
|
|
125
125
|
"@biomejs/biome": "^2.5.15",
|
|
126
126
|
"@happy-dom/global-registrator": "^20.14.5",
|
|
127
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.
|
|
127
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.7",
|
|
128
128
|
"@playwright/test": "^1.64.1",
|
|
129
129
|
"@types/semver": "^7.8.0",
|
|
130
130
|
"es-module-shims": "^2.8.4",
|