@sebgroup/green-core 1.0.3 → 1.1.1
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/index.js
CHANGED
|
@@ -143,7 +143,7 @@ function watchMediaQuery(q) {
|
|
|
143
143
|
// libs/core/src/utils/helpers/custom-element-scoping.ts
|
|
144
144
|
import { html as litHtml } from "lit";
|
|
145
145
|
import { customElement } from "lit/decorators.js";
|
|
146
|
-
var VER_SUFFIX = "-
|
|
146
|
+
var VER_SUFFIX = "-2ca105";
|
|
147
147
|
var elementLookupTable = /* @__PURE__ */ new Map();
|
|
148
148
|
var gdsCustomElement = (tagName) => {
|
|
149
149
|
if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
|
package/localization.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './utils/localization';
|
|
1
|
+
export * from './utils/localization/localization';
|
package/localization.js
CHANGED
|
@@ -4,7 +4,7 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// libs/core/src/utils/localization.ts
|
|
7
|
+
// libs/core/src/utils/localization/localization.ts
|
|
8
8
|
import { configureLocalization } from "@lit/localize";
|
|
9
9
|
|
|
10
10
|
// libs/core/src/generated/locale-codes.ts
|
|
@@ -26,20 +26,32 @@ var templates = {
|
|
|
26
26
|
"sd898d99fd9c13de6": `S\xF6k i listan av val`
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
// libs/core/src/utils/localization.ts
|
|
29
|
+
// libs/core/src/utils/localization/localization.ts
|
|
30
30
|
var localizedTemplates = /* @__PURE__ */ new Map([["sv", sv_exports]]);
|
|
31
|
-
var {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
return Promise.reject(new Error(`Locale ${locale} not found`));
|
|
31
|
+
var gdsInitLocalization = ({ extraLocales, extraTemplates } = {
|
|
32
|
+
extraLocales: [],
|
|
33
|
+
extraTemplates: /* @__PURE__ */ new Map()
|
|
34
|
+
}) => {
|
|
35
|
+
const _targetLocales = [...targetLocales];
|
|
36
|
+
for (const [locale, template] of extraTemplates) {
|
|
37
|
+
localizedTemplates.set(locale, template);
|
|
40
38
|
}
|
|
41
|
-
|
|
39
|
+
for (const locale of extraLocales) {
|
|
40
|
+
_targetLocales.push(locale);
|
|
41
|
+
}
|
|
42
|
+
return configureLocalization({
|
|
43
|
+
sourceLocale,
|
|
44
|
+
targetLocales: _targetLocales,
|
|
45
|
+
loadLocale: async (locale) => {
|
|
46
|
+
const localModule = localizedTemplates.get(locale);
|
|
47
|
+
if (localModule) {
|
|
48
|
+
return localModule;
|
|
49
|
+
}
|
|
50
|
+
return Promise.reject(new Error(`Locale ${locale} not found`));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
};
|
|
42
54
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
55
|
+
gdsInitLocalization,
|
|
56
|
+
targetLocales
|
|
45
57
|
};
|
package/package.json
CHANGED
package/transitional-styles.js
CHANGED
|
@@ -5602,6 +5602,17 @@ input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner
|
|
|
5602
5602
|
clip-path: inset(1px 0 0 0);
|
|
5603
5603
|
}
|
|
5604
5604
|
|
|
5605
|
+
::slotted([slot=trigger]) {
|
|
5606
|
+
overflow: hidden;
|
|
5607
|
+
}
|
|
5608
|
+
|
|
5609
|
+
slot[name=trigger] > span {
|
|
5610
|
+
display: block;
|
|
5611
|
+
overflow: hidden;
|
|
5612
|
+
text-overflow: ellipsis;
|
|
5613
|
+
text-wrap: nowrap;
|
|
5614
|
+
}
|
|
5615
|
+
|
|
5605
5616
|
.form-info {
|
|
5606
5617
|
color: var(--text-primary-color);
|
|
5607
5618
|
display: block;
|
|
@@ -5797,7 +5808,7 @@ function register3() {
|
|
|
5797
5808
|
// libs/core/src/utils/helpers/custom-element-scoping.ts
|
|
5798
5809
|
import { html as litHtml } from "lit";
|
|
5799
5810
|
import { customElement } from "lit/decorators.js";
|
|
5800
|
-
var VER_SUFFIX = "-
|
|
5811
|
+
var VER_SUFFIX = "-2ca105";
|
|
5801
5812
|
var elementLookupTable = /* @__PURE__ */ new Map();
|
|
5802
5813
|
var templateCache = /* @__PURE__ */ new WeakMap();
|
|
5803
5814
|
function applyElementScoping(strings, ...values) {
|
|
@@ -71,9 +71,7 @@ export declare const VER_SUFFIX = "-gdsvsuffix";
|
|
|
71
71
|
* @category Decorator
|
|
72
72
|
* @param tagName The tag name of the custom element to define.
|
|
73
73
|
*/
|
|
74
|
-
export declare const gdsCustomElement: (tagName: string) => (
|
|
75
|
-
prototype: HTMLElement;
|
|
76
|
-
} | import("@lit/reactive-element/decorators/base").ClassDescriptor) => any;
|
|
74
|
+
export declare const gdsCustomElement: (tagName: string) => import("lit/decorators.js").CustomElementDecorator;
|
|
77
75
|
/**
|
|
78
76
|
* Template tag factory that creates a new template tag, which rewrites all custom element names from the
|
|
79
77
|
* lookup table to include the version suffix, and then passes the template on to the provided template tag.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { targetLocales } from '../../generated/locale-codes';
|
|
2
|
+
import * as templates_sv from '../../generated/locales/sv';
|
|
3
|
+
declare const localizedTemplates: Map<string, typeof templates_sv>;
|
|
4
|
+
declare type LocalizationConfig = {
|
|
5
|
+
extraLocales: string[];
|
|
6
|
+
extraTemplates: typeof localizedTemplates;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A list of available built-in locales
|
|
10
|
+
*/
|
|
11
|
+
export { targetLocales };
|
|
12
|
+
/**
|
|
13
|
+
* Initializes localization for Green Core. This is a wrapper around Lit's `configureLocalization`,
|
|
14
|
+
* which adds the ability to add extra locales and templates.
|
|
15
|
+
*
|
|
16
|
+
* @param extraLocales - Extra locales to add to the list of target locales
|
|
17
|
+
* @param extraTemplates - Extra templates to add to the list of localized templates
|
|
18
|
+
*/
|
|
19
|
+
export declare const gdsInitLocalization: ({ extraLocales, extraTemplates }?: LocalizationConfig) => {
|
|
20
|
+
getLocale: (() => string) & {
|
|
21
|
+
_LIT_LOCALIZE_GET_LOCALE_?: undefined;
|
|
22
|
+
};
|
|
23
|
+
setLocale: ((newLocale: string) => Promise<void>) & {
|
|
24
|
+
_LIT_LOCALIZE_SET_LOCALE_?: undefined;
|
|
25
|
+
};
|
|
26
|
+
};
|