@maggioli-design-system/mds-stepper-bar
Advanced tools
Comparing version 5.7.0 to 5.7.1
import Handlebars from "handlebars"; | ||
export class Locale { | ||
constructor(configData) { | ||
this.defaultLanguage = 'en'; | ||
this.rollbackLanguage = 'en'; | ||
this.lang = (element) => { | ||
const closestElement = element.closest('[lang]'); | ||
if (closestElement) { | ||
if (closestElement.lang) { | ||
this.language = closestElement.lang; | ||
this.closestElement = element.closest('[lang]'); | ||
if (this.closestElement) { | ||
if (this.closestElement.lang) { | ||
this.language = this.closestElement.lang; | ||
return; | ||
} | ||
} | ||
this.language = this.defaultLanguage; | ||
this.language = this.rollbackLanguage; | ||
}; | ||
this.pluralize = (tag, context) => { | ||
var _a; | ||
const languagePhrase = (_a = this.config[this.language][tag]) !== null && _a !== void 0 ? _a : this.config[this.defaultLanguage][tag]; | ||
const languagePhrase = this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag]; | ||
const phrases = []; | ||
@@ -42,7 +41,6 @@ if (Array.isArray(languagePhrase)) { | ||
this.get = (tag, context) => { | ||
var _a; | ||
if (context) { | ||
return this.pluralize(tag, context); | ||
} | ||
return (_a = this.config[this.language][tag]) !== null && _a !== void 0 ? _a : this.config[this.defaultLanguage][tag]; | ||
return this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag]; | ||
}; | ||
@@ -49,0 +47,0 @@ this.config = configData; |
{ | ||
"timestamp": "2024-09-05T13:49:31", | ||
"timestamp": "2024-09-13T08:55:06", | ||
"compiler": { | ||
@@ -4,0 +4,0 @@ "name": "@stencil/core", |
{ | ||
"timestamp": "2024-09-05T13:49:31", | ||
"timestamp": "2024-09-13T08:55:06", | ||
"compiler": { | ||
@@ -12,7 +12,7 @@ "name": "node", | ||
"entries": 1, | ||
"bundles": 90, | ||
"bundles": 91, | ||
"outputs": [ | ||
{ | ||
"name": "dist-collection", | ||
"files": 42, | ||
"files": 43, | ||
"generatedFiles": [ | ||
@@ -55,2 +55,3 @@ "./dist/collection/common/aria.js", | ||
"./dist/collection/type/input.js", | ||
"./dist/collection/type/language.js", | ||
"./dist/collection/type/loading.js", | ||
@@ -549,2 +550,3 @@ "./dist/collection/type/preference.js", | ||
"./src/type/input.ts": [], | ||
"./src/type/language.ts": [], | ||
"./src/type/loading.ts": [], | ||
@@ -551,0 +553,0 @@ "./src/type/preference.ts": [], |
type LocaleConfig = { | ||
el?: Record<string, string | string[]>; | ||
en: Record<string, string | string[]>; | ||
es?: Record<string, string | string[]>; | ||
it?: Record<string, string | string[]>; | ||
en?: Record<string, string | string[]>; | ||
gr?: Record<string, string | string[]>; | ||
}; | ||
export declare class Locale { | ||
defaultLanguage: string; | ||
rollbackLanguage: string; | ||
language: string; | ||
config: LocaleConfig; | ||
closestElement: HTMLElement; | ||
constructor(configData: LocaleConfig); | ||
@@ -11,0 +13,0 @@ lang: (element: HTMLElement) => void; |
@@ -1,2 +0,2 @@ | ||
export type UIPreferenceType = 'animation' | 'consumption' | 'contrast' | 'theme'; | ||
export type UIPreferenceType = 'animation' | 'consumption' | 'contrast' | 'theme' | 'language'; | ||
export type ConsumptionModeType = 'high' | 'medium' | 'low'; |
{ | ||
"timestamp": "2024-09-05T13:13:09", | ||
"timestamp": "2024-09-13T08:12:14", | ||
"compiler": { | ||
@@ -224,3 +224,3 @@ "name": "@stencil/core", | ||
"src/components/mds-dropdown/meta/types.ts::DropdownInteractionType": { | ||
"declaration": "export type DropdownInteractionType =\n | 'click'\n | 'mouseover'", | ||
"declaration": "export type DropdownInteractionType =\n | 'click'\n | 'none'\n | 'mouseover'", | ||
"docstring": "", | ||
@@ -439,2 +439,7 @@ "path": "src/components/mds-dropdown/meta/types.ts" | ||
}, | ||
"src/event-detail/preference.ts::MdsPrefChangeEventDetail": { | ||
"declaration": "export interface MdsPrefChangeEventDetail {\n preference: UIPreferenceType\n}", | ||
"docstring": "", | ||
"path": "src/event-detail/preference.ts" | ||
}, | ||
"src/type/preference.ts::ConsumptionModeType": { | ||
@@ -450,2 +455,12 @@ "declaration": "export type ConsumptionModeType =\n | 'high'\n | 'medium'\n | 'low'", | ||
}, | ||
"src/type/language.ts::LanguageType": { | ||
"declaration": "export type LanguageType =\n | 'auto'\n | `${Lowercase<string>}${Lowercase<string>}`\n | `${Lowercase<string>}${Lowercase<string>}${Lowercase<string>}`", | ||
"docstring": "", | ||
"path": "src/type/language.ts" | ||
}, | ||
"src/event-detail/language.ts::MdsPrefLanguageEventDetail": { | ||
"declaration": "export interface MdsPrefLanguageEventDetail {\n language?: LanguageType\n}", | ||
"docstring": "", | ||
"path": "src/event-detail/language.ts" | ||
}, | ||
"src/components/mds-pref-theme/meta/types.ts::ThemeModeType": { | ||
@@ -452,0 +467,0 @@ "declaration": "export type ThemeModeType =\n | 'light'\n | 'dark'\n | 'system'", |
{ | ||
"name": "@maggioli-design-system/mds-stepper-bar", | ||
"version": "5.7.0", | ||
"version": "5.7.1", | ||
"description": "mds-stepper-bar is a web-component from Magma Design System, built with StencilJS, TypeScript, Storybook. It's based on the web-component standard and it's designed to be agnostic from the JavaScirpt framework you are using.", | ||
@@ -26,5 +26,5 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"@maggioli-design-system/mds-progress": "2.10.0", | ||
"@maggioli-design-system/mds-stepper-bar-item": "5.6.6", | ||
"@maggioli-design-system/styles": "15.3.0", | ||
"@maggioli-design-system/mds-progress": "2.10.1", | ||
"@maggioli-design-system/mds-stepper-bar-item": "5.6.7", | ||
"@maggioli-design-system/styles": "15.3.1", | ||
"@stencil/core": "4.21.0" | ||
@@ -31,0 +31,0 @@ }, |
import Handlebars from 'handlebars' | ||
type LocaleConfig = { | ||
el?: Record<string, string | string[]> | ||
en: Record<string, string | string[]> | ||
es?: Record<string, string | string[]> | ||
it?: Record<string, string | string[]> | ||
en?: Record<string, string | string[]> | ||
gr?: Record<string, string | string[]> | ||
} | ||
export class Locale { | ||
defaultLanguage: string = 'en' | ||
rollbackLanguage: string = 'en' | ||
language: string | ||
config: LocaleConfig | ||
closestElement:HTMLElement | ||
@@ -19,6 +21,8 @@ constructor (configData: LocaleConfig) { | ||
lang = (element: HTMLElement): void => { | ||
const closestElement:HTMLElement = element.closest('[lang]') as HTMLElement | ||
if (closestElement) { | ||
if (closestElement.lang) { | ||
this.language = closestElement.lang | ||
this.closestElement = element.closest('[lang]') as HTMLElement | ||
if (this.closestElement) { | ||
if (this.closestElement.lang) { | ||
this.language = this.closestElement.lang | ||
return | ||
@@ -28,3 +32,3 @@ } | ||
this.language = this.defaultLanguage | ||
this.language = this.rollbackLanguage | ||
} | ||
@@ -34,3 +38,3 @@ | ||
const languagePhrase: string | string[] = this.config[this.language][tag] ?? this.config[this.defaultLanguage][tag] | ||
const languagePhrase: string | string[] = this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag] | ||
const phrases: string[] = [] | ||
@@ -67,4 +71,4 @@ | ||
} | ||
return this.config[this.language][tag] ?? this.config[this.defaultLanguage][tag] | ||
return this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag] | ||
} | ||
} |
@@ -6,2 +6,3 @@ export type UIPreferenceType = | ||
| 'theme' | ||
| 'language' | ||
@@ -8,0 +9,0 @@ export type ConsumptionModeType = |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
891594
205
12355
+ Added@maggioli-design-system/mds-badge@3.0.1(transitive)
+ Added@maggioli-design-system/mds-progress@2.10.1(transitive)
+ Added@maggioli-design-system/mds-stepper-bar-item@5.6.7(transitive)
+ Added@maggioli-design-system/mds-text@4.4.1(transitive)
+ Added@maggioli-design-system/styles@15.3.1(transitive)
- Removed@maggioli-design-system/mds-badge@3.0.0(transitive)
- Removed@maggioli-design-system/mds-progress@2.10.0(transitive)
- Removed@maggioli-design-system/mds-stepper-bar-item@5.6.6(transitive)
- Removed@maggioli-design-system/mds-text@4.4.0(transitive)
- Removed@maggioli-design-system/styles@15.3.0(transitive)