@mgdis/stencil-helpers 2.1.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.
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locale/index.ts"],"names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AAO,MAAM,YAAY,WAAY,MAAM,UAAU,MAAM,kBAAiB,MAAM,KAAO,MAC4D,CAAC;AAEtJ;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,WAAY,MAAM,UAAU,MAAM,kBAAiB,MAAM,KAAO,MAMzF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,UAAU,WACb,MAAM,UACN,MAAM,QACR,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,gBACzB,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,kBACrC,MAAM,KACpB,MAQF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,QAAkD,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,SAAU,MAAM,GAAG,SAAS,UAAU,MAAM,WAAW,IAAI,CAAC,qBAAqB,KAAG,MAC8B,CAAC;AAE1I;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,aACb,UAAU,iBAAiB,IAAI,GAAG,IAAI,GAAG,MAAM,eAChD,WAAW,KAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,UAAU,CAAA;CACT,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { VNode } from '@stencil/core';
2
2
  import { 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,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`
@@ -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,OAAO,gBAgCxH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,uBAAuB,4BAA6B,6BAA6B,KAAG,OAAO,cAgCvG,CAAC;AAEF,cAAM,eAAgB,SAAQ,KAAK;IACjC;;OAEG;IAEH,MAAM,EAAE,GAAG,CAAC;CACb;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,QAAO,OAAO,eAY9C,CAAC"}
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.1.0",
3
+ "version": "2.2.0",
4
4
  "license": "ISC",
5
5
  "author": "Nicolas Jouanno <jouanno-n@mgdis.fr>",
6
6
  "maintainers": [
@@ -21,18 +21,18 @@
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@stencil/core": "4.22.1"
24
+ "@stencil/core": "4.22.2"
25
25
  },
26
26
  "devDependencies": {
27
- "@types/node": "20.16.14",
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.26.10",
31
- "typedoc-plugin-markdown": "4.2.9",
32
- "vite": "5.4.10",
33
- "vite-plugin-dts": "3.9.1",
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
- "@core-ui/eslint-config-custom": "1.0.12",
35
+ "@core-ui/eslint-config-custom": "1.0.13",
36
36
  "@core-ui/prettier-config": "1.0.3",
37
37
  "@core-ui/tsconfig": "1.0.4",
38
38
  "@core-ui/typedoc-config": "1.0.1",