@mgdis/stencil-helpers 2.0.0 → 2.2.0
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/components/index.d.ts +14 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/ide/index.d.ts +0 -1
- package/dist/index.es.js +235 -218
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/locale/index.d.ts +30 -2
- package/dist/locale/index.d.ts.map +1 -1
- package/dist/storybook/index.d.ts +0 -1
- package/dist/storybook/index.d.ts.map +1 -1
- package/dist/tests/unit.d.ts +0 -1
- package/dist/tests/unit.d.ts.map +1 -1
- package/package.json +12 -12
package/dist/locale/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ObjectType } from '../types';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Gets the date pattern based on the specified locale.
|
|
5
4
|
* @param locale - the locale to refer to
|
|
@@ -44,6 +43,35 @@ export declare const localeCurrency: (number: number, locale: string, currency:
|
|
|
44
43
|
* ```
|
|
45
44
|
*/
|
|
46
45
|
export declare const localeNumber: (number: number, locale: string, decimalLength?: number) => string;
|
|
46
|
+
/**
|
|
47
|
+
* Format number as percentage based on locale
|
|
48
|
+
* @param number - number to format
|
|
49
|
+
* @param locale - locale to apply
|
|
50
|
+
* @param decimalLength - decimal length to apply
|
|
51
|
+
* @returns formatted percentage
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* localePercent(0.42, 'fr', 2) // '42,00 %'
|
|
55
|
+
* localePercent(0.42, 'en', 2) // '42.00%'
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare const localePercent: (number: number, locale: string, decimalLength?: number) => string;
|
|
59
|
+
/**
|
|
60
|
+
* Format number with standardized unit based on locale using Intl unit formatting
|
|
61
|
+
* @param number - number to format
|
|
62
|
+
* @param locale - locale to apply
|
|
63
|
+
* @param unit - standardized unit (e.g., 'kilometer', 'kilogram', 'celsius')
|
|
64
|
+
* @param unitDisplay - how to display the unit ('short', 'long', 'narrow')
|
|
65
|
+
* @param decimalLength - decimal length to apply
|
|
66
|
+
* @returns formatted number with localized unit
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* localeUnit(1234567890.12, 'fr', 'kilometer') // '1 234 567 890,12 km'
|
|
70
|
+
* localeUnit(23, 'fr', 'celsius') // '23 °C'
|
|
71
|
+
* localeUnit(10, 'fr', 'kilometer', 0, 'long') // '10 kilomètres'
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare const localeUnit: (number: number, locale: string, unit: Intl.NumberFormatOptions["unit"], unitDisplay?: Intl.NumberFormatOptions["unitDisplay"], decimalLength?: number) => string;
|
|
47
75
|
/**
|
|
48
76
|
* Date RegExp, usefull to test if string is a follow the date pattern
|
|
49
77
|
* @example
|
|
@@ -82,7 +110,7 @@ export declare const localeDate: (date: string | undefined, locale: string, conf
|
|
|
82
110
|
* export const initLocales = defineLocales(messages, defaultLocale);
|
|
83
111
|
* ```
|
|
84
112
|
*/
|
|
85
|
-
export declare const defineLocales: (messages: ObjectType, defaultLocale:
|
|
113
|
+
export declare const defineLocales: (messages: ObjectType, defaultLocale: "fr" | "en" | string) => (element: HTMLElement) => {
|
|
86
114
|
locale: string;
|
|
87
115
|
messages: ObjectType;
|
|
88
116
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,WAAY,MAAM,WAQlD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,SAAU,IAAI,KAAG,MAAM,GAAG,SAA6C,CAAC;
|
|
1
|
+
{"version":3,"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ArgsType } from './index.conf';
|
|
3
3
|
import { JsonDocs } from '@stencil/core/internal';
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Filter default argument on component argument to prevent them to be rendered
|
|
7
6
|
* @param args - all possible args with custom values
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storybook/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAmC,MAAM,wBAAwB,CAAC;AA6CnF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storybook/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAmC,MAAM,wBAAwB,CAAC;AA6CnF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,QAAQ,CAAC,kBAAkB,OAAO,CAAC,CAAC,CAAC,KAAG,CAgBnE,CAAC;AAEF;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,cAAc,YAAa,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,WAAW,QAAQ,KAAG,OAAO,GAAG,SAqBzF,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,2CAA4C,KAAK,KAAG,MAM5E,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,qBAAsB,MAAM,YAAY,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SAMjG,CAAC;AAEF,qBAAa,gBAAgB;;IAC3B;;OAEG;IACH,OAAO,EAAE,QAAQ,CAAC;gBAEN,OAAO,EAAE,QAAQ;IAmD7B;;;;OAIG;IACH,eAAe,YAAa,MAAM,QAkIhC;IAEF;;;;OAIG;IACH,2BAA2B,YAAa,MAAM,wBAG5C;CACH"}
|
package/dist/tests/unit.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SetupMutationObserverMockParams, setupResizeObserverMockParams } from './unit.conf';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Utility function that mocks the `MutationObserver` API. Recommended to execute inside `beforeEach`.
|
|
5
4
|
* @param mutationObserverMock - Parameter that is sent to the `Object.defineProperty`
|
package/dist/tests/unit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../src/tests/unit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAElG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,yCAA0C,+BAA+B,KAAG,
|
|
1
|
+
{"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../src/tests/unit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAElG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,yCAA0C,+BAA+B,KAAG,OAAO,gBAgCxH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,uBAAuB,4BAA6B,6BAA6B,KAAG,OAAO,cAgCvG,CAAC;AAEF,cAAM,eAAgB,SAAQ,KAAK;IACjC;;OAEG;IACH,MAAM,EAAE,GAAG,CAAC;CACb;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,QAAO,OAAO,eAY9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgdis/stencil-helpers",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"author": "Nicolas Jouanno <jouanno-n@mgdis.fr>",
|
|
6
6
|
"maintainers": [
|
|
@@ -21,22 +21,22 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@stencil/core": "4.
|
|
24
|
+
"@stencil/core": "4.22.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@types/node": "20.
|
|
27
|
+
"@types/node": "20.17.6",
|
|
28
28
|
"@vitest/coverage-istanbul": "1.6.0",
|
|
29
29
|
"@vitest/coverage-v8": "1.6.0",
|
|
30
|
-
"typedoc": "0.
|
|
31
|
-
"typedoc-plugin-markdown": "4.
|
|
32
|
-
"vite": "5.4.
|
|
33
|
-
"vite-plugin-dts": "3.
|
|
30
|
+
"typedoc": "0.26.11",
|
|
31
|
+
"typedoc-plugin-markdown": "4.2.10",
|
|
32
|
+
"vite": "5.4.11",
|
|
33
|
+
"vite-plugin-dts": "4.3.0",
|
|
34
34
|
"vitest": "1.6.0",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"vitest-config": "1.0.
|
|
35
|
+
"@core-ui/eslint-config-custom": "1.0.13",
|
|
36
|
+
"@core-ui/prettier-config": "1.0.3",
|
|
37
|
+
"@core-ui/tsconfig": "1.0.4",
|
|
38
|
+
"@core-ui/typedoc-config": "1.0.1",
|
|
39
|
+
"@core-ui/vitest-config": "1.0.1"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "vite build",
|