@mgdis/core-ui-helpers 1.2.2 → 1.3.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.
Files changed (149) hide show
  1. package/dist/angular/index.cjs +27 -0
  2. package/dist/angular/index.cjs.map +1 -0
  3. package/dist/angular/index.d.ts +21 -0
  4. package/dist/angular/index.js +25 -0
  5. package/dist/angular/index.js.map +1 -0
  6. package/dist/angular/index.umd.js +33 -0
  7. package/dist/angular/index.umd.js.map +1 -0
  8. package/dist/locale/index.cjs +190 -0
  9. package/dist/locale/index.cjs.map +1 -0
  10. package/dist/locale/index.d.ts +110 -0
  11. package/dist/locale/index.js +181 -0
  12. package/dist/locale/index.js.map +1 -0
  13. package/dist/locale/index.umd.js +196 -0
  14. package/dist/locale/index.umd.js.map +1 -0
  15. package/dist/playwright/index.cjs +137 -0
  16. package/dist/playwright/index.cjs.map +1 -0
  17. package/dist/playwright/index.d.ts +39 -0
  18. package/dist/playwright/index.js +133 -0
  19. package/dist/playwright/index.js.map +1 -0
  20. package/dist/playwright/index.umd.js +143 -0
  21. package/dist/playwright/index.umd.js.map +1 -0
  22. package/dist/stencil/index.cjs +363 -0
  23. package/dist/stencil/index.cjs.map +1 -0
  24. package/dist/stencil/index.d.ts +222 -0
  25. package/dist/stencil/index.js +357 -0
  26. package/dist/stencil/index.js.map +1 -0
  27. package/dist/stencil/index.umd.js +369 -0
  28. package/dist/stencil/index.umd.js.map +1 -0
  29. package/dist/storybook/index.cjs +2335 -0
  30. package/dist/storybook/index.cjs.map +1 -0
  31. package/dist/storybook/index.d.ts +85 -0
  32. package/dist/storybook/index.js +2329 -0
  33. package/dist/storybook/index.js.map +1 -0
  34. package/dist/storybook/index.umd.js +2341 -0
  35. package/dist/storybook/index.umd.js.map +1 -0
  36. package/dist/tests/index.cjs +315 -0
  37. package/dist/tests/index.cjs.map +1 -0
  38. package/dist/tests/index.d.ts +100 -0
  39. package/dist/tests/index.js +309 -0
  40. package/dist/tests/index.js.map +1 -0
  41. package/dist/tests/index.umd.js +321 -0
  42. package/dist/tests/index.umd.js.map +1 -0
  43. package/dist/utils/index.cjs +441 -0
  44. package/dist/utils/index.cjs.map +1 -0
  45. package/dist/utils/index.d.ts +265 -0
  46. package/dist/utils/index.js +417 -0
  47. package/dist/utils/index.js.map +1 -0
  48. package/dist/utils/index.umd.js +447 -0
  49. package/dist/utils/index.umd.js.map +1 -0
  50. package/dist/vue/index.cjs +1935 -0
  51. package/dist/vue/index.cjs.map +1 -0
  52. package/dist/vue/index.d.ts +35 -0
  53. package/dist/vue/index.js +1933 -0
  54. package/dist/vue/index.js.map +1 -0
  55. package/dist/vue/index.umd.js +1941 -0
  56. package/dist/vue/index.umd.js.map +1 -0
  57. package/package.json +4 -1
  58. package/CHANGELOG.md +0 -101
  59. package/json-doc.test.json +0 -264
  60. package/rollup.config.mjs +0 -61
  61. package/src/angular/index.spec.ts +0 -8
  62. package/src/angular/index.ts +0 -1
  63. package/src/angular/mg-angular-logger/index.ts +0 -1
  64. package/src/angular/mg-angular-logger/mg-angular-logger.conf.ts +0 -3
  65. package/src/angular/mg-angular-logger/mg-angular-logger.spec.ts +0 -40
  66. package/src/angular/mg-angular-logger/mg-angular-logger.ts +0 -24
  67. package/src/locale/index.spec.ts +0 -24
  68. package/src/locale/index.ts +0 -1
  69. package/src/locale/locale.spec.ts +0 -291
  70. package/src/locale/locale.ts +0 -201
  71. package/src/playwright/config/index.ts +0 -43
  72. package/src/playwright/index.spec.ts +0 -16
  73. package/src/playwright/index.ts +0 -4
  74. package/src/playwright/utils/__snapshots__/utils.spec.ts.snap +0 -48
  75. package/src/playwright/utils/index.ts +0 -1
  76. package/src/playwright/utils/utils.spec.ts +0 -50
  77. package/src/playwright/utils/utils.ts +0 -77
  78. package/src/stencil/ide/__snapshots__/cem.spec.ts.snap +0 -248
  79. package/src/stencil/ide/__snapshots__/ide.spec.ts.snap +0 -414
  80. package/src/stencil/ide/cem.spec.ts +0 -35
  81. package/src/stencil/ide/cem.ts +0 -96
  82. package/src/stencil/ide/ide.spec.ts +0 -29
  83. package/src/stencil/ide/ide.ts +0 -221
  84. package/src/stencil/ide/index.ts +0 -2
  85. package/src/stencil/index.spec.ts +0 -16
  86. package/src/stencil/index.ts +0 -2
  87. package/src/stencil/normalize-boolean-attributes/index.ts +0 -1
  88. package/src/stencil/normalize-boolean-attributes/normalize-boolean-attributes.spec.ts +0 -63
  89. package/src/stencil/normalize-boolean-attributes/normalize-boolean-attributes.ts +0 -40
  90. package/src/storybook/index.spec.ts +0 -19
  91. package/src/storybook/index.ts +0 -1
  92. package/src/storybook/stencil/__snapshots__/stencil.spec.ts.snap +0 -329
  93. package/src/storybook/stencil/index.ts +0 -1
  94. package/src/storybook/stencil/stencil-shim.d.ts +0 -1
  95. package/src/storybook/stencil/stencil.conf.ts +0 -4
  96. package/src/storybook/stencil/stencil.spec.ts +0 -170
  97. package/src/storybook/stencil/stencil.ts +0 -377
  98. package/src/tests/index.spec.ts +0 -20
  99. package/src/tests/index.ts +0 -1
  100. package/src/tests/unit/__snapshots__/unit.spec.ts.snap +0 -52
  101. package/src/tests/unit/index.ts +0 -1
  102. package/src/tests/unit/unit.conf.ts +0 -16
  103. package/src/tests/unit/unit.spec.ts +0 -206
  104. package/src/tests/unit/unit.ts +0 -333
  105. package/src/utils/attributes/class-list/class-list.spec.ts +0 -36
  106. package/src/utils/attributes/class-list/class-list.ts +0 -51
  107. package/src/utils/attributes/class-list/index.ts +0 -1
  108. package/src/utils/attributes/id/id.spec.ts +0 -54
  109. package/src/utils/attributes/id/id.ts +0 -47
  110. package/src/utils/attributes/id/index.ts +0 -1
  111. package/src/utils/attributes/index.ts +0 -3
  112. package/src/utils/attributes/to-kebab-case/index.ts +0 -1
  113. package/src/utils/attributes/to-kebab-case/to-kebab-case.spec.ts +0 -29
  114. package/src/utils/attributes/to-kebab-case/to-kebab-case.ts +0 -23
  115. package/src/utils/components/__snapshots__/components.spec.ts.snap +0 -313
  116. package/src/utils/components/components.conf.ts +0 -11
  117. package/src/utils/components/components.spec.ts +0 -192
  118. package/src/utils/components/components.ts +0 -152
  119. package/src/utils/components/index.ts +0 -2
  120. package/src/utils/date/date.spec.ts +0 -12
  121. package/src/utils/date/date.ts +0 -20
  122. package/src/utils/date/index.ts +0 -1
  123. package/src/utils/elements/elements.spec.ts +0 -17
  124. package/src/utils/elements/elements.ts +0 -18
  125. package/src/utils/elements/index.ts +0 -1
  126. package/src/utils/index.spec.ts +0 -84
  127. package/src/utils/index.ts +0 -8
  128. package/src/utils/number/index.ts +0 -1
  129. package/src/utils/number/number.spec.ts +0 -14
  130. package/src/utils/number/number.ts +0 -6
  131. package/src/utils/object/index.ts +0 -2
  132. package/src/utils/object/object.conf.ts +0 -4
  133. package/src/utils/object/object.spec.ts +0 -110
  134. package/src/utils/object/object.ts +0 -27
  135. package/src/utils/string/index.ts +0 -1
  136. package/src/utils/string/string.spec.ts +0 -54
  137. package/src/utils/string/string.ts +0 -39
  138. package/src/utils/windows/index.ts +0 -1
  139. package/src/utils/windows/windows.spec.ts +0 -69
  140. package/src/utils/windows/windows.ts +0 -50
  141. package/src/vue/index.spec.ts +0 -8
  142. package/src/vue/index.ts +0 -1
  143. package/src/vue/mg-model/index.ts +0 -1
  144. package/src/vue/mg-model/mg-model.conf.ts +0 -6
  145. package/src/vue/mg-model/mg-model.spec.ts +0 -50
  146. package/src/vue/mg-model/mg-model.ts +0 -55
  147. package/tsconfig.json +0 -17
  148. package/typedoc.json +0 -14
  149. package/vitest.config.mts +0 -13
@@ -0,0 +1,196 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CoreUiHelpers = global.CoreUiHelpers || {}, global.CoreUiHelpers.locale = {})));
5
+ })(this, (function (exports) { 'use strict';
6
+
7
+ /**
8
+ * Date RegExp, usefull to test if string is a follow the date pattern
9
+ * @example
10
+ * ```ts
11
+ * dateRegExp.test('mystring') // false
12
+ * dateRegExp.test('2020-12-31') // true
13
+ * ```
14
+ */
15
+ const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
16
+
17
+ /**
18
+ * Gets the date pattern based on the specified locale.
19
+ * @param locale - the locale to refer to
20
+ * @returns date pattern
21
+ * @example
22
+ * ```ts
23
+ * localeDatePattern('fr') // 'dd/mm/yyyy'
24
+ * ```
25
+ */
26
+ const localeDatePattern = (locale) => {
27
+ const year = { value: '2023', pattern: 'yyyy' };
28
+ const month = { value: '12', pattern: 'mm' };
29
+ const day = { value: '24', pattern: 'dd' };
30
+ return localeDate([year.value, month.value, day.value].join('-'), locale, { timeZone: 'UTC' })
31
+ .replace(year.value, year.pattern)
32
+ .replace(month.value, month.pattern)
33
+ .replace(day.value, day.pattern);
34
+ };
35
+ /**
36
+ * Get locale and messages
37
+ * We load the defined locale but for now we only support the first subtag for messages
38
+ * @param element - element we need to get the language
39
+ * @param messages - messages to use
40
+ * @param defaultLocale - default messages locale
41
+ * @returns messages object
42
+ */
43
+ const localeMessages = (element, messages, defaultLocale) => {
44
+ // Get local
45
+ const closestLangAttribute = element.closest('[lang]');
46
+ const closestLang = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute?.lang);
47
+ const locale = closestLang.length > 0 && typeof closestLang[0] === 'string' ? closestLang[0] : navigator.language || defaultLocale;
48
+ // Only keep first subtag
49
+ const localeSubtag = locale.split('-').shift();
50
+ // If messages is empty, return a default object
51
+ if (Object.keys(messages).length === 0) {
52
+ return {
53
+ locale,
54
+ messages: { lang: defaultLocale },
55
+ };
56
+ }
57
+ // Return
58
+ return {
59
+ locale,
60
+ messages: (messages[localeSubtag] ?? messages[defaultLocale] ?? { lang: defaultLocale }),
61
+ };
62
+ };
63
+ /**
64
+ * Format number to the locale currency
65
+ * @param number - number to format
66
+ * @param locale - locale to apply
67
+ * @param currency - currency to apply
68
+ * @returns formatted currency
69
+ * @example
70
+ * ```ts
71
+ * localeCurrency(1234567890.12, 'fr', 'EUR') // '1 234 567 890,12\xa0€'
72
+ * ```
73
+ */
74
+ const localeCurrency = (number, locale, currency) => new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);
75
+ /**
76
+ * Format number to locale
77
+ * @param number - number to format
78
+ * @param locale - locale to apply
79
+ * @param decimalLength - decimal length to apply
80
+ * @returns formatted number
81
+ * @example
82
+ * ```ts
83
+ * localeNumber(1234567890.12, 'fr') // 1 234 567 890,12
84
+ * ```
85
+ */
86
+ const localeNumber = (number, locale, decimalLength = 0) => new Intl.NumberFormat(locale, { minimumFractionDigits: decimalLength }).format(Number(number));
87
+ /**
88
+ * Convert bytes number to locale string representation
89
+ * @param number - size in bytes
90
+ * @param locale - locale to apply
91
+ * @returns bytes in locale string format
92
+ */
93
+ const localeByte = (number, locale) => {
94
+ if (typeof number !== 'number' || Number.isNaN(number) || number < 0) {
95
+ throw new Error('localeByte - size must be a positive number.');
96
+ }
97
+ const base = 1024;
98
+ const units = ['byte', 'kilobyte', 'megabyte', 'gigabyte', 'terabyte'];
99
+ // find appropriate unit base on size and base power
100
+ const unitIndex = units.findIndex((_, key) => number < Math.pow(base, key + 1));
101
+ // convert number to string with unit
102
+ return Intl.NumberFormat(locale, {
103
+ minimumFractionDigits: 0,
104
+ maximumFractionDigits: 2,
105
+ unit: units[unitIndex],
106
+ unitDisplay: units[unitIndex] === 'byte' ? 'long' : 'short',
107
+ style: 'unit',
108
+ }).format(number / Math.pow(base, unitIndex));
109
+ };
110
+ /**
111
+ * Format number as percentage based on locale
112
+ * @param number - number to format
113
+ * @param locale - locale to apply
114
+ * @param decimalLength - decimal length to apply
115
+ * @returns formatted percentage
116
+ * @example
117
+ * ```ts
118
+ * localePercent(0.42, 'fr', 2) // '42,00 %'
119
+ * localePercent(0.42, 'en', 2) // '42.00%'
120
+ * ```
121
+ */
122
+ const localePercent = (number, locale, decimalLength = 0) => {
123
+ return new Intl.NumberFormat(locale, {
124
+ style: 'percent',
125
+ minimumFractionDigits: decimalLength,
126
+ maximumFractionDigits: decimalLength,
127
+ }).format(number);
128
+ };
129
+ /**
130
+ * Format number with standardized unit based on locale using Intl unit formatting
131
+ * @param number - number to format
132
+ * @param locale - locale to apply
133
+ * @param unit - standardized unit (e.g., 'kilometer', 'kilogram', 'celsius')
134
+ * @param unitDisplay - how to display the unit ('short', 'long', 'narrow')
135
+ * @param decimalLength - decimal length to apply
136
+ * @returns formatted number with localized unit
137
+ * @example
138
+ * ```ts
139
+ * localeUnit(1234567890.12, 'fr', 'kilometer') // '1 234 567 890,12 km'
140
+ * localeUnit(23, 'fr', 'celsius') // '23 °C'
141
+ * localeUnit(10, 'fr', 'kilometer', 0, 'long') // '10 kilomètres'
142
+ * ```
143
+ */
144
+ const localeUnit = (number, locale, unit, unitDisplay = 'short', decimalLength = 0) => {
145
+ return new Intl.NumberFormat(locale, {
146
+ style: 'unit',
147
+ unit,
148
+ unitDisplay,
149
+ minimumFractionDigits: decimalLength,
150
+ maximumFractionDigits: decimalLength,
151
+ }).format(number);
152
+ };
153
+ /**
154
+ * Locale date format
155
+ * @param date - date to format
156
+ * @param locale - locale to apply
157
+ * @param config - DateTimeFormatOptions object to apply
158
+ * @returns formatted date
159
+ * @example
160
+ * ```ts
161
+ * localeDate('2022-06-02', 'fr') // '02/06/2022'
162
+ * ```
163
+ */
164
+ const localeDate = (date, locale, config) => typeof date !== 'string' || date === '' || !dateRegExp.test(date)
165
+ ? ''
166
+ : new Intl.DateTimeFormat(locale, config).format(new Date(date));
167
+ /**
168
+ * Get Intl object
169
+ * @param messages - locales to render in object format. `ex: { en: { porp: "test" }, fr: { porp: "test" }}`.
170
+ * @param defaultLocale - fallback locale to render. `ex: 'en'`.
171
+ * @returns from the element passed in return function you will get the matching messages object
172
+ * @example
173
+ * ```ts
174
+ * import en from './en/messages.json';
175
+ * import fr from './fr/messages.json';
176
+ * import { defineLocales } from '@mgdis/core-ui-helpers/dist/utils';
177
+ *
178
+ * const defaultLocale = 'en';
179
+ * const messages = { en, fr };
180
+ *
181
+ * export const initLocales = defineLocales(messages, defaultLocale);
182
+ * ```
183
+ */
184
+ const defineLocales = (messages, defaultLocale) => (element) => localeMessages(element, messages, defaultLocale);
185
+
186
+ exports.defineLocales = defineLocales;
187
+ exports.localeByte = localeByte;
188
+ exports.localeCurrency = localeCurrency;
189
+ exports.localeDate = localeDate;
190
+ exports.localeDatePattern = localeDatePattern;
191
+ exports.localeNumber = localeNumber;
192
+ exports.localePercent = localePercent;
193
+ exports.localeUnit = localeUnit;
194
+
195
+ }));
196
+ //# sourceMappingURL=index.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.umd.js","sources":["../../src/utils/date/date.ts","../../src/locale/locale.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;;;;IAAA;;;;;;;IAOG;IACI,MAAM,UAAU,GAAG,+CAA+C;;ICLzE;;;;;;;;IAQG;AACI,UAAM,iBAAiB,GAAG,CAAC,MAAc,KAAI;QAClD,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;QAC/C,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5C,MAAM,GAAG,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1C,IAAA,OAAO,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;aAC1F,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO;aAChC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO;aAClC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE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,aAAa;IACrC,KAAA,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IACnB;IAEA;;;;;;;;;;;;;;IAcG;AACI,UAAM,UAAU,GAAG,CACxB,MAAc,EACd,MAAc,EACd,IAAsC,EACtC,WAAA,GAAuD,OAAO,EAC9D,aAAA,GAAwB,CAAC,KACf;IACV,IAAA,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;IACnC,QAAA,KAAK,EAAE,MAAM;YACb,IAAI;YACJ,WAAW;IACX,QAAA,qBAAqB,EAAE,aAAa;IACpC,QAAA,qBAAqB,EAAE,aAAa;IACrC,KAAA,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IACnB;IAEA;;;;;;;;;;IAUG;AACI,UAAM,UAAU,GAAG,CAAC,IAAwB,EAAE,MAAc,EAAE,MAAmC,KACtG,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI;IAC9D,MAAE;IACF,MAAE,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC;IAEnE;;;;;;;;;;;;;;;;IAgBG;AACI,UAAM,aAAa,GACxB,CAAC,QAAoB,EAAE,aAA0B,KACjD,CAAC,OAAoB,KACnB,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa;;;;;;;;;;;;;;;"}
@@ -0,0 +1,137 @@
1
+ 'use strict';
2
+
3
+ const config = {
4
+ testMatch: '*.e2e.ts',
5
+ snapshotPathTemplate: '{testFileDir}/__screenshots__/{arg}-{projectName}{ext}',
6
+ /* Maximum time one test can run for. */
7
+ timeout: 30 * 1000,
8
+ expect: {
9
+ /**
10
+ * Maximum time expect() should wait for the condition to be met.
11
+ * For example in `await expect(locator).toHaveText();`
12
+ */
13
+ timeout: 5000,
14
+ /**
15
+ * Exact per-pixel colour (`threshold: 0`) so sub-perceptual shifts aren't hidden by the
16
+ * default 0.2; `maxDiffPixels: 100` tolerates anti-aliasing jitter but not a real fill.
17
+ */
18
+ toHaveScreenshot: { threshold: 0, maxDiffPixels: 100 },
19
+ },
20
+ /* Run tests in files in parallel */
21
+ fullyParallel: true,
22
+ /* Fail the build on CI if you accidentally left test.only in the source code. */
23
+ forbidOnly: !!process.env.CI,
24
+ /* Retry on CI only */
25
+ retries: process.env.CI ? 2 : 0,
26
+ /* Stop on CI on first failure */
27
+ maxFailures: process.env.CI ? 1 : 0,
28
+ /* Opt out of parallel tests on CI. */
29
+ workers: process.env.CI ? 1 : undefined,
30
+ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
31
+ reporter: [
32
+ ['html', { open: 'never' }],
33
+ ['junit', { outputFile: 'results.xml' }],
34
+ ],
35
+ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
36
+ use: {
37
+ headless: true,
38
+ /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
39
+ actionTimeout: 0,
40
+ /* Base URL to use in actions like `await page.goto('/')`. */
41
+ // baseURL: 'http://localhost:3000',
42
+ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
43
+ trace: 'on-first-retry',
44
+ },
45
+ };
46
+
47
+ /**
48
+ * Check if a value is of object type.
49
+ * @param object - The value to validate.
50
+ * @returns `true` if the value is a valid object (non-null and not an array), otherwise `false`.
51
+ */
52
+ const isObject = (object) => typeof object === 'object' && !Array.isArray(object) && object !== null;
53
+
54
+ /**
55
+ * Typeguard function to check if all array items are strings.
56
+ * @param items - items to check
57
+ * @returns `true` if all items are strings
58
+ */
59
+ /**
60
+ * Validate string
61
+ * @param value - value to check
62
+ * @returns `true` if string is valid
63
+ */
64
+ const isValidString = (value) => typeof value === 'string' && value.trim() !== '';
65
+
66
+ /**
67
+ * Render attributes from props objects.
68
+ *
69
+ * Booleans follow the HTML spec for boolean attributes: `true` emits an empty-value attribute
70
+ * (presence implies `true`), `false` omits the attribute entirely. This matches the behaviour
71
+ * of the `normalizeBooleanAttributes` Stencil helper.
72
+ * @param args - argument to render as string. ex: `{status: 'visible'}`
73
+ * @returns formated inline attributed. ex: 'status="visible"'
74
+ * @example
75
+ * ```ts
76
+ * import { renderAttributes } from '@mgdis/core-ui-helpers/dist/playwright';
77
+ *
78
+ * const attributes = renderAttributes({ status: 'visible', color: 'red', disabled: true, readonly: false });
79
+ * console.log(attributes); // Output: 'status="visible" color="red" disabled=""'
80
+ * ```
81
+ */
82
+ const renderAttributes = (args) => (isObject(args) &&
83
+ Object.keys(args)
84
+ .filter((key) => ![null, undefined].includes(args[key]) &&
85
+ !['object', 'function'].includes(typeof args[key]) &&
86
+ args[key] !== false)
87
+ .map((key) => {
88
+ const attribute = key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
89
+ if (args[key] === true)
90
+ return `${attribute}=""`;
91
+ const value = typeof args[key] === 'number' || isValidString(args[key]) ? String(args[key]).replace(/"/g, "'") : '';
92
+ return `${attribute}="${value}"`;
93
+ })
94
+ .join(' ')) ||
95
+ '';
96
+ /**
97
+ * Render properties from props objects.
98
+ * Insert return value in <script></script> element
99
+ * @param args - argument to render as script. ex: `{status: 'visible'}`
100
+ * @param selector - querySelector get targetted element and bind properties on it
101
+ * @returns stringified properties script
102
+ * @example
103
+ * ```ts
104
+ * import { renderProperties } from '@mgdis/core-ui-helpers/dist/playwright';
105
+ *
106
+ * const propertiesScript = renderProperties({ status: 'visible', color: 'red' }, '.targetElement');
107
+ * console.log(propertiesScript);
108
+ * // Output: 'document.querySelector(".targetElement").status="visible"; document.querySelector(".targetElement").color="red";'
109
+ * ```
110
+ */
111
+ const renderProperties = (args, selector) => {
112
+ // has generated id selector starting with "#" create charcters (ex: '#0j3xzw4w7m') make test crashed sometime with "querySelector"
113
+ // we use "getElementById" document query
114
+ const query = selector.startsWith('#') ? 'getElementById' : 'querySelector';
115
+ if (query === 'getElementById')
116
+ selector = selector.replace('#', '');
117
+ return args !== null && typeof args === 'object' && Object.keys(args).length > 0
118
+ ? `
119
+ ${Object.keys(args)
120
+ .filter((key) => ['object', 'function'].includes(typeof args[key]))
121
+ .map((key) => {
122
+ const value = JSON.stringify(args[key], (_key, val) => typeof val === 'function' ? `<fn>${val}</fn>` : val);
123
+ return `document.${query}('${selector}').${key}=${value}`;
124
+ }) // stringify json AND keep function values
125
+ .join(';') // create string
126
+ .split('"<fn>') // remove fn start decorator
127
+ .join('')
128
+ .split('</fn>"')
129
+ .join('') // remove fn end decorator
130
+ };`
131
+ : '';
132
+ };
133
+
134
+ exports.playwrightBaseConfig = config;
135
+ exports.renderAttributes = renderAttributes;
136
+ exports.renderProperties = renderProperties;
137
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/playwright/config/index.ts","../../src/utils/object/object.ts","../../src/utils/string/string.ts","../../src/playwright/utils/utils.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;AAEA,MAAM,MAAM,GAAyB;AACnC,IAAA,SAAS,EAAE,UAAU;AACrB,IAAA,oBAAoB,EAAE,wDAAwD;;IAE9E,OAAO,EAAE,EAAE,GAAG,IAAI;AAClB,IAAA,MAAM,EAAE;AACN;;;AAGG;AACH,QAAA,OAAO,EAAE,IAAI;AACb;;;AAGG;QACH,gBAAgB,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE;AACvD,KAAA;;AAED,IAAA,aAAa,EAAE,IAAI;;AAEnB,IAAA,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;;AAE5B,IAAA,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC;;AAE/B,IAAA,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC;;AAEnC,IAAA,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,SAA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D,OAAO,CAAA,SAAA,EAAY,KAAK,CAAA,EAAA,EAAK,QAAQ,MAAM,GAAG,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE;QAC3D,CAAC,CAAC;AACD,aAAA,IAAI,CAAC,GAAG,CAAC;AACT,aAAA,KAAK,CAAC,OAAO,CAAC;aACd,IAAI,CAAC,EAAE;aACP,KAAK,CAAC,QAAQ;AACd,aAAA,IAAI,CAAC,EAAE,CAAC;SACb,CAAA;UACI,EAAE;AACR;;;;;;"}
@@ -0,0 +1,39 @@
1
+ import { PlaywrightTestConfig } from '@playwright/test';
2
+
3
+ declare const config: PlaywrightTestConfig;
4
+
5
+ /**
6
+ * Render attributes from props objects.
7
+ *
8
+ * Booleans follow the HTML spec for boolean attributes: `true` emits an empty-value attribute
9
+ * (presence implies `true`), `false` omits the attribute entirely. This matches the behaviour
10
+ * of the `normalizeBooleanAttributes` Stencil helper.
11
+ * @param args - argument to render as string. ex: `{status: 'visible'}`
12
+ * @returns formated inline attributed. ex: 'status="visible"'
13
+ * @example
14
+ * ```ts
15
+ * import { renderAttributes } from '@mgdis/core-ui-helpers/dist/playwright';
16
+ *
17
+ * const attributes = renderAttributes({ status: 'visible', color: 'red', disabled: true, readonly: false });
18
+ * console.log(attributes); // Output: 'status="visible" color="red" disabled=""'
19
+ * ```
20
+ */
21
+ declare const renderAttributes: (args: Record<string, unknown>) => string;
22
+ /**
23
+ * Render properties from props objects.
24
+ * Insert return value in <script></script> element
25
+ * @param args - argument to render as script. ex: `{status: 'visible'}`
26
+ * @param selector - querySelector get targetted element and bind properties on it
27
+ * @returns stringified properties script
28
+ * @example
29
+ * ```ts
30
+ * import { renderProperties } from '@mgdis/core-ui-helpers/dist/playwright';
31
+ *
32
+ * const propertiesScript = renderProperties({ status: 'visible', color: 'red' }, '.targetElement');
33
+ * console.log(propertiesScript);
34
+ * // Output: 'document.querySelector(".targetElement").status="visible"; document.querySelector(".targetElement").color="red";'
35
+ * ```
36
+ */
37
+ declare const renderProperties: (args: Record<string, unknown>, selector: string) => string;
38
+
39
+ export { config as playwrightBaseConfig, renderAttributes, renderProperties };
@@ -0,0 +1,133 @@
1
+ const config = {
2
+ testMatch: '*.e2e.ts',
3
+ snapshotPathTemplate: '{testFileDir}/__screenshots__/{arg}-{projectName}{ext}',
4
+ /* Maximum time one test can run for. */
5
+ timeout: 30 * 1000,
6
+ expect: {
7
+ /**
8
+ * Maximum time expect() should wait for the condition to be met.
9
+ * For example in `await expect(locator).toHaveText();`
10
+ */
11
+ timeout: 5000,
12
+ /**
13
+ * Exact per-pixel colour (`threshold: 0`) so sub-perceptual shifts aren't hidden by the
14
+ * default 0.2; `maxDiffPixels: 100` tolerates anti-aliasing jitter but not a real fill.
15
+ */
16
+ toHaveScreenshot: { threshold: 0, maxDiffPixels: 100 },
17
+ },
18
+ /* Run tests in files in parallel */
19
+ fullyParallel: true,
20
+ /* Fail the build on CI if you accidentally left test.only in the source code. */
21
+ forbidOnly: !!process.env.CI,
22
+ /* Retry on CI only */
23
+ retries: process.env.CI ? 2 : 0,
24
+ /* Stop on CI on first failure */
25
+ maxFailures: process.env.CI ? 1 : 0,
26
+ /* Opt out of parallel tests on CI. */
27
+ workers: process.env.CI ? 1 : undefined,
28
+ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
29
+ reporter: [
30
+ ['html', { open: 'never' }],
31
+ ['junit', { outputFile: 'results.xml' }],
32
+ ],
33
+ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
34
+ use: {
35
+ headless: true,
36
+ /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
37
+ actionTimeout: 0,
38
+ /* Base URL to use in actions like `await page.goto('/')`. */
39
+ // baseURL: 'http://localhost:3000',
40
+ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
41
+ trace: 'on-first-retry',
42
+ },
43
+ };
44
+
45
+ /**
46
+ * Check if a value is of object type.
47
+ * @param object - The value to validate.
48
+ * @returns `true` if the value is a valid object (non-null and not an array), otherwise `false`.
49
+ */
50
+ const isObject = (object) => typeof object === 'object' && !Array.isArray(object) && object !== null;
51
+
52
+ /**
53
+ * Typeguard function to check if all array items are strings.
54
+ * @param items - items to check
55
+ * @returns `true` if all items are strings
56
+ */
57
+ /**
58
+ * Validate string
59
+ * @param value - value to check
60
+ * @returns `true` if string is valid
61
+ */
62
+ const isValidString = (value) => typeof value === 'string' && value.trim() !== '';
63
+
64
+ /**
65
+ * Render attributes from props objects.
66
+ *
67
+ * Booleans follow the HTML spec for boolean attributes: `true` emits an empty-value attribute
68
+ * (presence implies `true`), `false` omits the attribute entirely. This matches the behaviour
69
+ * of the `normalizeBooleanAttributes` Stencil helper.
70
+ * @param args - argument to render as string. ex: `{status: 'visible'}`
71
+ * @returns formated inline attributed. ex: 'status="visible"'
72
+ * @example
73
+ * ```ts
74
+ * import { renderAttributes } from '@mgdis/core-ui-helpers/dist/playwright';
75
+ *
76
+ * const attributes = renderAttributes({ status: 'visible', color: 'red', disabled: true, readonly: false });
77
+ * console.log(attributes); // Output: 'status="visible" color="red" disabled=""'
78
+ * ```
79
+ */
80
+ const renderAttributes = (args) => (isObject(args) &&
81
+ Object.keys(args)
82
+ .filter((key) => ![null, undefined].includes(args[key]) &&
83
+ !['object', 'function'].includes(typeof args[key]) &&
84
+ args[key] !== false)
85
+ .map((key) => {
86
+ const attribute = key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
87
+ if (args[key] === true)
88
+ return `${attribute}=""`;
89
+ const value = typeof args[key] === 'number' || isValidString(args[key]) ? String(args[key]).replace(/"/g, "'") : '';
90
+ return `${attribute}="${value}"`;
91
+ })
92
+ .join(' ')) ||
93
+ '';
94
+ /**
95
+ * Render properties from props objects.
96
+ * Insert return value in <script></script> element
97
+ * @param args - argument to render as script. ex: `{status: 'visible'}`
98
+ * @param selector - querySelector get targetted element and bind properties on it
99
+ * @returns stringified properties script
100
+ * @example
101
+ * ```ts
102
+ * import { renderProperties } from '@mgdis/core-ui-helpers/dist/playwright';
103
+ *
104
+ * const propertiesScript = renderProperties({ status: 'visible', color: 'red' }, '.targetElement');
105
+ * console.log(propertiesScript);
106
+ * // Output: 'document.querySelector(".targetElement").status="visible"; document.querySelector(".targetElement").color="red";'
107
+ * ```
108
+ */
109
+ const renderProperties = (args, selector) => {
110
+ // has generated id selector starting with "#" create charcters (ex: '#0j3xzw4w7m') make test crashed sometime with "querySelector"
111
+ // we use "getElementById" document query
112
+ const query = selector.startsWith('#') ? 'getElementById' : 'querySelector';
113
+ if (query === 'getElementById')
114
+ selector = selector.replace('#', '');
115
+ return args !== null && typeof args === 'object' && Object.keys(args).length > 0
116
+ ? `
117
+ ${Object.keys(args)
118
+ .filter((key) => ['object', 'function'].includes(typeof args[key]))
119
+ .map((key) => {
120
+ const value = JSON.stringify(args[key], (_key, val) => typeof val === 'function' ? `<fn>${val}</fn>` : val);
121
+ return `document.${query}('${selector}').${key}=${value}`;
122
+ }) // stringify json AND keep function values
123
+ .join(';') // create string
124
+ .split('"<fn>') // remove fn start decorator
125
+ .join('')
126
+ .split('</fn>"')
127
+ .join('') // remove fn end decorator
128
+ };`
129
+ : '';
130
+ };
131
+
132
+ export { config as playwrightBaseConfig, renderAttributes, renderProperties };
133
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/playwright/config/index.ts","../../src/utils/object/object.ts","../../src/utils/string/string.ts","../../src/playwright/utils/utils.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAyB;AACnC,IAAA,SAAS,EAAE,UAAU;AACrB,IAAA,oBAAoB,EAAE,wDAAwD;;IAE9E,OAAO,EAAE,EAAE,GAAG,IAAI;AAClB,IAAA,MAAM,EAAE;AACN;;;AAGG;AACH,QAAA,OAAO,EAAE,IAAI;AACb;;;AAGG;QACH,gBAAgB,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE;AACvD,KAAA;;AAED,I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