@spectrum-web-components/reactive-controllers 1.12.0-next.20260223103045 → 1.12.0-testing.20260223092154
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/reactive-controllers",
|
|
3
|
-
"version": "1.12.0-
|
|
3
|
+
"version": "1.12.0-testing.20260223092154",
|
|
4
4
|
"description": "ReactiveControllers for powering common UI patterns",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Adobe",
|
|
@@ -78,8 +78,7 @@
|
|
|
78
78
|
],
|
|
79
79
|
"types": "./src/index.d.ts",
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@spectrum-web-components/
|
|
82
|
-
"@spectrum-web-components/progress-circle": "1.12.0-next.20260223103045",
|
|
81
|
+
"@spectrum-web-components/progress-circle": "1.12.0-testing.20260223092154",
|
|
83
82
|
"colorjs.io": "0.5.2",
|
|
84
83
|
"lit": "^2.5.0 || ^3.1.3"
|
|
85
84
|
},
|
|
@@ -9,8 +9,14 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
import type { ReactiveController, ReactiveElement } from 'lit';
|
|
13
|
+
export declare const languageResolverUpdatedSymbol: unique symbol;
|
|
14
|
+
export declare class LanguageResolutionController implements ReactiveController {
|
|
15
|
+
private host;
|
|
16
|
+
language: string;
|
|
17
|
+
private unsubscribe?;
|
|
18
|
+
constructor(host: ReactiveElement);
|
|
19
|
+
hostConnected(): void;
|
|
20
|
+
hostDisconnected(): void;
|
|
21
|
+
private resolveLanguage;
|
|
22
|
+
}
|
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export const languageResolverUpdatedSymbol = Symbol(
|
|
3
|
+
"language resolver updated"
|
|
4
|
+
);
|
|
5
|
+
export class LanguageResolutionController {
|
|
6
|
+
constructor(host) {
|
|
7
|
+
this.language = document.documentElement.lang || navigator.language || "en-US";
|
|
8
|
+
this.host = host;
|
|
9
|
+
this.host.addController(this);
|
|
10
|
+
}
|
|
11
|
+
hostConnected() {
|
|
12
|
+
this.resolveLanguage();
|
|
13
|
+
}
|
|
14
|
+
hostDisconnected() {
|
|
15
|
+
var _a;
|
|
16
|
+
(_a = this.unsubscribe) == null ? void 0 : _a.call(this);
|
|
17
|
+
}
|
|
18
|
+
resolveLanguage() {
|
|
19
|
+
try {
|
|
20
|
+
Intl.DateTimeFormat.supportedLocalesOf([this.language]);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
this.language = "en-US";
|
|
23
|
+
}
|
|
24
|
+
const queryThemeEvent = new CustomEvent(
|
|
25
|
+
"sp-language-context",
|
|
26
|
+
{
|
|
27
|
+
bubbles: true,
|
|
28
|
+
composed: true,
|
|
29
|
+
detail: {
|
|
30
|
+
callback: (lang, unsubscribe) => {
|
|
31
|
+
const previous = this.language;
|
|
32
|
+
this.language = lang;
|
|
33
|
+
this.unsubscribe = unsubscribe;
|
|
34
|
+
this.host.requestUpdate(languageResolverUpdatedSymbol, previous);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
cancelable: true
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
this.host.dispatchEvent(queryThemeEvent);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
6
43
|
//# sourceMappingURL=LanguageResolution.dev.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["LanguageResolution.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { ReactiveController, ReactiveElement } from 'lit';\n\nimport { ProvideLang } from '@spectrum-web-components/theme';\n\nexport const languageResolverUpdatedSymbol = Symbol(\n 'language resolver updated'\n);\n\nexport class LanguageResolutionController implements ReactiveController {\n private host: ReactiveElement;\n language = document.documentElement.lang || navigator.language || 'en-US';\n private unsubscribe?: () => void;\n\n constructor(host: ReactiveElement) {\n this.host = host;\n this.host.addController(this);\n }\n\n public hostConnected(): void {\n this.resolveLanguage();\n }\n\n public hostDisconnected(): void {\n this.unsubscribe?.();\n }\n\n private resolveLanguage(): void {\n try {\n Intl.DateTimeFormat.supportedLocalesOf([this.language]);\n } catch {\n this.language = 'en-US';\n }\n const queryThemeEvent = new CustomEvent<ProvideLang>(\n 'sp-language-context',\n {\n bubbles: true,\n composed: true,\n detail: {\n callback: (lang: string, unsubscribe: () => void) => {\n const previous = this.language;\n this.language = lang;\n this.unsubscribe = unsubscribe;\n this.host.requestUpdate(languageResolverUpdatedSymbol, previous);\n },\n },\n cancelable: true,\n }\n );\n this.host.dispatchEvent(queryThemeEvent);\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAgBO,aAAM,gCAAgC;AAAA,EAC3C;AACF;AAEO,aAAM,6BAA2D;AAAA,EAKtE,YAAY,MAAuB;AAHnC,oBAAW,SAAS,gBAAgB,QAAQ,UAAU,YAAY;AAIhE,SAAK,OAAO;AACZ,SAAK,KAAK,cAAc,IAAI;AAAA,EAC9B;AAAA,EAEO,gBAAsB;AAC3B,SAAK,gBAAgB;AAAA,EACvB;AAAA,EAEO,mBAAyB;AAlClC;AAmCI,eAAK,gBAAL;AAAA,EACF;AAAA,EAEQ,kBAAwB;AAC9B,QAAI;AACF,WAAK,eAAe,mBAAmB,CAAC,KAAK,QAAQ,CAAC;AAAA,IACxD,SAAQ;AACN,WAAK,WAAW;AAAA,IAClB;AACA,UAAM,kBAAkB,IAAI;AAAA,MAC1B;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,QACV,QAAQ;AAAA,UACN,UAAU,CAAC,MAAc,gBAA4B;AACnD,kBAAM,WAAW,KAAK;AACtB,iBAAK,WAAW;AAChB,iBAAK,cAAc;AACnB,iBAAK,KAAK,cAAc,+BAA+B,QAAQ;AAAA,UACjE;AAAA,QACF;AAAA,QACA,YAAY;AAAA,MACd;AAAA,IACF;AACA,SAAK,KAAK,cAAc,eAAe;AAAA,EACzC;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";export{
|
|
1
|
+
"use strict";export const languageResolverUpdatedSymbol=Symbol("language resolver updated");export class LanguageResolutionController{constructor(e){this.language=document.documentElement.lang||navigator.language||"en-US";this.host=e,this.host.addController(this)}hostConnected(){this.resolveLanguage()}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}resolveLanguage(){try{Intl.DateTimeFormat.supportedLocalesOf([this.language])}catch(t){this.language="en-US"}const e=new CustomEvent("sp-language-context",{bubbles:!0,composed:!0,detail:{callback:(t,o)=>{const a=this.language;this.language=t,this.unsubscribe=o,this.host.requestUpdate(languageResolverUpdatedSymbol,a)}},cancelable:!0});this.host.dispatchEvent(e)}}
|
|
2
2
|
//# sourceMappingURL=LanguageResolution.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["LanguageResolution.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { ReactiveController, ReactiveElement } from 'lit';\n\nimport { ProvideLang } from '@spectrum-web-components/theme';\n\nexport const languageResolverUpdatedSymbol = Symbol(\n 'language resolver updated'\n);\n\nexport class LanguageResolutionController implements ReactiveController {\n private host: ReactiveElement;\n language = document.documentElement.lang || navigator.language || 'en-US';\n private unsubscribe?: () => void;\n\n constructor(host: ReactiveElement) {\n this.host = host;\n this.host.addController(this);\n }\n\n public hostConnected(): void {\n this.resolveLanguage();\n }\n\n public hostDisconnected(): void {\n this.unsubscribe?.();\n }\n\n private resolveLanguage(): void {\n try {\n Intl.DateTimeFormat.supportedLocalesOf([this.language]);\n } catch {\n this.language = 'en-US';\n }\n const queryThemeEvent = new CustomEvent<ProvideLang>(\n 'sp-language-context',\n {\n bubbles: true,\n composed: true,\n detail: {\n callback: (lang: string, unsubscribe: () => void) => {\n const previous = this.language;\n this.language = lang;\n this.unsubscribe = unsubscribe;\n this.host.requestUpdate(languageResolverUpdatedSymbol, previous);\n },\n },\n cancelable: true,\n }\n );\n this.host.dispatchEvent(queryThemeEvent);\n }\n}\n"],
|
|
5
|
+
"mappings": "aAgBO,aAAM,8BAAgC,OAC3C,2BACF,EAEO,aAAM,4BAA2D,CAKtE,YAAYA,EAAuB,CAHnC,cAAW,SAAS,gBAAgB,MAAQ,UAAU,UAAY,QAIhE,KAAK,KAAOA,EACZ,KAAK,KAAK,cAAc,IAAI,CAC9B,CAEO,eAAsB,CAC3B,KAAK,gBAAgB,CACvB,CAEO,kBAAyB,CAlClC,IAAAC,GAmCIA,EAAA,KAAK,cAAL,MAAAA,EAAA,UACF,CAEQ,iBAAwB,CAC9B,GAAI,CACF,KAAK,eAAe,mBAAmB,CAAC,KAAK,QAAQ,CAAC,CACxD,OAAQC,EAAA,CACN,KAAK,SAAW,OAClB,CACA,MAAMC,EAAkB,IAAI,YAC1B,sBACA,CACE,QAAS,GACT,SAAU,GACV,OAAQ,CACN,SAAU,CAACC,EAAcC,IAA4B,CACnD,MAAMC,EAAW,KAAK,SACtB,KAAK,SAAWF,EAChB,KAAK,YAAcC,EACnB,KAAK,KAAK,cAAc,8BAA+BC,CAAQ,CACjE,CACF,EACA,WAAY,EACd,CACF,EACA,KAAK,KAAK,cAAcH,CAAe,CACzC,CACF",
|
|
6
|
+
"names": ["host", "_a", "e", "queryThemeEvent", "lang", "unsubscribe", "previous"]
|
|
7
7
|
}
|