@mgdis/mg-components 5.19.2 → 5.19.3
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/cjs/{components.utils-dc9c8a53.js → components.utils-69435877.js} +2 -2
- package/dist/cjs/components.utils-69435877.js.map +1 -0
- package/dist/cjs/{index-c042e24b.js → index-60dd0c56.js} +143 -58
- package/dist/cjs/index-60dd0c56.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_34.cjs.entry.js +306 -238
- package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-components.cjs.js.map +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +2 -2
- package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
- package/dist/collection/assets/icons/index.js +190 -182
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/atoms/mg-button/mg-button.js +15 -0
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +1 -1
- package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +1 -1
- package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +54 -4
- package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +1 -1
- package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js +2 -2
- package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +8 -0
- package/dist/collection/components/molecules/inputs/MgInput.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +13 -12
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +4 -10
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +9 -2
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +11 -4
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +9 -2
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +7 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +9 -2
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js +0 -4
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +9 -2
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +2 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +9 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +2 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js +2 -2
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js +8 -0
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js +8 -0
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +1 -9
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +44 -29
- package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +1 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
- package/dist/collection/utils/behaviors.utils.js.map +1 -1
- package/dist/collection/utils/components.utils.js +1 -1
- package/dist/collection/utils/components.utils.js.map +1 -1
- package/dist/collection/utils/components.utils.spec.js +5 -0
- package/dist/collection/utils/components.utils.spec.js.map +1 -1
- package/dist/components/MgInput.js +9 -1
- package/dist/components/MgInput.js.map +1 -1
- package/dist/components/components.utils.js +1 -1
- package/dist/components/components.utils.js.map +1 -1
- package/dist/components/mg-action-more.js +1 -1
- package/dist/components/mg-action-more.js.map +1 -1
- package/dist/components/mg-button2.js +15 -0
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-form.js +1 -9
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-icon2.js +198 -182
- package/dist/components/mg-icon2.js.map +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js +2 -2
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +13 -12
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +9 -3
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +11 -5
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +9 -3
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +8 -3
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-select2.js +9 -3
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +9 -3
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +9 -3
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-item-more.js.map +1 -1
- package/dist/components/mg-menu-item2.js +2 -2
- package/dist/components/mg-menu-item2.js.map +1 -1
- package/dist/components/mg-message.js +1 -1
- package/dist/components/mg-message.js.map +1 -1
- package/dist/components/mg-popover-content2.js +1 -1
- package/dist/components/mg-popover-content2.js.map +1 -1
- package/dist/components/popper.js +6 -12
- package/dist/components/popper.js.map +1 -1
- package/dist/esm/{components.utils-0f76010d.js → components.utils-6cf27db1.js} +2 -2
- package/dist/esm/components.utils-6cf27db1.js.map +1 -0
- package/dist/esm/{index-ce01e63b.js → index-0f833068.js} +143 -58
- package/dist/esm/index-0f833068.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_34.entry.js +306 -238
- package/dist/esm/mg-action-more_34.entry.js.map +1 -1
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-components.js.map +1 -1
- package/dist/esm/mg-item-more.entry.js +2 -2
- package/dist/esm/mg-item-more.entry.js.map +1 -1
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/p-10ed4425.entry.js +2 -0
- package/dist/mg-components/p-10ed4425.entry.js.map +1 -0
- package/dist/mg-components/{p-c9e2c669.js → p-36a51c5e.js} +2 -2
- package/dist/mg-components/p-36a51c5e.js.map +1 -0
- package/dist/mg-components/{p-01ebc95a.entry.js → p-91feda5a.entry.js} +2 -2
- package/dist/mg-components/p-91feda5a.entry.js.map +1 -0
- package/dist/mg-components/p-9b12021b.js +3 -0
- package/dist/mg-components/p-9b12021b.js.map +1 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +4 -0
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +7 -0
- package/dist/types/components/molecules/inputs/MgInput.d.ts +2 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +1 -6
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +1 -0
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +1 -1
- package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +1 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +0 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +35 -35
- package/dist/cjs/components.utils-dc9c8a53.js.map +0 -1
- package/dist/cjs/index-c042e24b.js.map +0 -1
- package/dist/esm/components.utils-0f76010d.js.map +0 -1
- package/dist/esm/index-ce01e63b.js.map +0 -1
- package/dist/mg-components/p-01ebc95a.entry.js.map +0 -1
- package/dist/mg-components/p-1aa89acf.js +0 -3
- package/dist/mg-components/p-1aa89acf.js.map +0 -1
- package/dist/mg-components/p-71a5a848.entry.js +0 -2
- package/dist/mg-components/p-71a5a848.entry.js.map +0 -1
- package/dist/mg-components/p-c9e2c669.js.map +0 -1
|
@@ -287,7 +287,7 @@ const createID = (prefix = '', length = 10) => {
|
|
|
287
287
|
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
288
288
|
const charsLength = chars.length;
|
|
289
289
|
let ID = '';
|
|
290
|
-
let now = Date.now();
|
|
290
|
+
let now = Math.floor(globalThis.crypto.getRandomValues(new Uint32Array(1))[0] * Date.now());
|
|
291
291
|
while (length > 0) {
|
|
292
292
|
now += Math.pow(10, 6); // Add 1 millisecond to the timestamp
|
|
293
293
|
const index = now % charsLength;
|
|
@@ -437,4 +437,4 @@ exports.localeDate = localeDate;
|
|
|
437
437
|
exports.localeNumber = localeNumber;
|
|
438
438
|
exports.sizes = sizes;
|
|
439
439
|
|
|
440
|
-
//# sourceMappingURL=components.utils-
|
|
440
|
+
//# sourceMappingURL=components.utils-69435877.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"components.utils-69435877.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;MAOa,cAAc,GAAG,CAAC,MAAc,EAAE,MAAc,EAAE,QAAgB;EAC7E,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACvF,EAAE;AAEF;;;;;;MAMa,YAAY,GAAG,CAAC,MAAc,EAAE,MAAc;EACzD,OAAO,IAAI,IAAI,C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F,MAAM,YAAY,GAAW,WAAW,CAAC,MAAM,CAAC;MAChD,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;MAC3B,OAAO,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;KAChD;IAAC,OAAO,GAAG,EAAE;MACZ,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;MACvD,OAAO,OAAO,CAAC;KAChB;GACF;EACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;;AAMA,MAAM,eAAe,GAAG,CAAC,WAAmB,EAAE,UAAoB,EAAE;EAClE,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;IACjC,KAAK,MAAM,WAAW,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;MACxD,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;MAC1B,eAAe,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;KACvC;GACF;EACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;MAKa,aAAa,GAAG,CAAC,KAAc,KAAc,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG;AAE3G;;;;;MAKa,WAAW,GAAG,CAAC,IAAY,KACtC,OAAO,IAAI,KAAK,QAAQ;EACxB,IAAI;KACD,iBAAiB,EAAE;KACnB,SAAS,CAAC,KAAK,CAAC;KAChB,UAAU,CAAC,kBAAkB,EAAE,EAAE;;;;;;;;;;;;;;;;;","names":["Direction"],"sources":["src/utils/locale.utils.ts","src/locales/index.ts","src/components/molecules/menu/mg-menu/mg-menu.conf.ts","src/utils/components.utils.ts"],"sourcesContent":["/**\n * Format number to the locale currency\n * @param number - number to format\n * @param locale - locale to apply\n * @param currency - currency to apply\n * @returns formatted currency\n */\nexport const localeCurrency = (number: number, locale: string, currency: string): string => {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);\n};\n\n/**\n * Format number to locale\n * @param number - number to format\n * @param locale - locale to apply\n * @returns formatted number\n */\nexport const localeNumber = (number: number, locale: string): string => {\n return new Intl.NumberFormat(locale).format(number);\n};\n\n/**\n * Date RegExp\n */\nexport const dateRegExp = /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\n\n/**\n * Locale date format\n * @param date - date to format\n * @param locale - locale to apply\n * @returns formatted date\n */\nexport const localeDate = (date: string, locale: string): string => {\n if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {\n return '';\n }\n return new Intl.DateTimeFormat(locale).format(new Date(date));\n};\n\n/**\n * Get locale and messages\n * We load the defined locale but for now we only support the first subtag for messages\n * @param element - element we need to get the language\n * @param messages - messages to use\n * @param defaultLocale - default messages locale\n * @returns messages object\n */\nexport const getLocaleMessages = (element: HTMLElement, messages: unknown, defaultLocale: string): { locale: string; messages: Record<string, unknown> } => {\n // Get local\n const closestLangAttribute: HTMLElement = element.closest('[lang]');\n const closestLang: string[] = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute?.lang);\n const locale = closestLang.length > 0 ? closestLang[0] : navigator.language || defaultLocale;\n // Only keep first subtag\n const localeSubtag = locale.split('-').shift();\n // Return\n return {\n locale,\n messages: messages[localeSubtag] || messages[defaultLocale],\n };\n};\n","import en from './en/messages.json';\nimport fr from './fr/messages.json';\nimport { getLocaleMessages } from '../utils/locale.utils';\n\nconst defaultLocale = 'en';\nconst messages = { en, fr };\n\n/**\n * Get Intl object\n * @param element - element we need to get the language\n * @returns messages object\n */\nexport const initLocales = (element: HTMLElement): { locale: string; messages: Record<string, unknown> } => getLocaleMessages(element, messages, defaultLocale);\n","import { MgItemMore } from '../../mg-item-more/mg-item-more';\n\n/**\n * Menu direction type\n */\nexport enum Direction {\n VERTICAL = 'vertical',\n HORIZONTAL = 'horizontal',\n}\n\n/**\n * ItemMore prop type\n */\nexport type ItemMoreType = Pick<MgItemMore, 'icon' | 'slotlabel' | 'size'>;\n\n/**\n * List of all possibles sizes\n */\nexport const sizes = ['regular', 'medium', 'large'] as const;\n\n/**\n * item Size from sizes\n */\nexport type MenuSizeType = (typeof sizes)[number];\n","/**\n * Create random ID\n * @param prefix - add prefix to created ID\n * @param length - ID length\n * @returns ID\n */\nexport const createID = (prefix = '', length = 10): string => {\n const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';\n const charsLength = chars.length;\n\n let ID = '';\n let now = Math.floor(globalThis.crypto.getRandomValues(new Uint32Array(1))[0] * Date.now());\n while (length > 0) {\n now += Math.pow(10, 6); // Add 1 millisecond to the timestamp\n const index = now % charsLength;\n ID += chars.charAt(index);\n length--;\n }\n return (prefix !== '' ? `${prefix}-` : '') + ID;\n};\n\n/**\n * Class to manage component classlist\n * Set() are not working when imported in project\n */\nexport class ClassList {\n /**\n * Available classes\n */\n classes: string[];\n\n constructor(classlist: string[] = []) {\n this.classes = classlist;\n }\n\n /**\n * Add class\n * @param className - class name to add\n */\n add = (className: string): void => {\n if (!this.has(className)) {\n this.classes.push(className);\n }\n };\n\n /**\n * Delete class\n * @param className - class name to delete\n */\n delete = (className: string): void => {\n const index = this.classes.indexOf(className);\n if (index > -1) {\n this.classes.splice(index, 1);\n }\n };\n\n /**\n * Check if class exist in list\n * @param className - class name to check\n * @returns class name is in the list\n */\n has = (className: string): boolean => {\n return this.classes.includes(className);\n };\n\n /**\n * Join classes seperated by spaces\n * @returns joined values\n */\n join = (): string => {\n return this.classes.join(' ');\n };\n}\n\n/**\n * Check if all items are string\n * @param items - items to check\n * @returns all items are string\n */\nexport const allItemsAreString = (items: unknown): items is string[] => Array.isArray(items) && items.every(item => typeof item === 'string');\n\n/**\n * Check if element is a heading\n * @param element - slotted element\n * @param tagNames - allowed tag names list\n * @returns element is a heading\n */\nexport const isTagName = (element: Element, tagNames: string[]): boolean => {\n return tagNames.includes(element?.tagName.toLowerCase());\n};\n\n/**\n * Focusable elements query selector\n */\nexport const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]), [identifier]';\n\n/**\n * Get windows\n * @param localWindow - the window we are lookink for other windows\n * @returns The list of windows found\n */\nexport const getWindows = (localWindow: Window): Window[] => {\n const parentWindows = getParentWindows(localWindow);\n const childWindows = getChildWindows(localWindow);\n return [localWindow, ...parentWindows, ...childWindows];\n};\n\n/**\n * Get parent windows\n * @param localWindow - the window we are lookink for parents\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nexport const getParentWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n // Check if is in iframe\n if (localWindow.self !== localWindow.top) {\n // Check if we have permission to access parent\n try {\n const parentWindow: Window = localWindow.parent;\n windows.push(parentWindow);\n return getParentWindows(parentWindow, windows);\n } catch (err) {\n console.error('Different hosts between iframes:', err);\n return windows;\n }\n }\n return windows;\n};\n\n/**\n * Get child windows\n * @param localWindow - the window we are lookink for children\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nconst getChildWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n if (localWindow.frames.length > 0) {\n for (const childWindow of Array.from(localWindow.frames)) {\n windows.push(childWindow);\n getChildWindows(childWindow, windows);\n }\n }\n return windows;\n};\n\n/**\n * Validate string\n * @param value - value to check\n * @returns if string is valid\n */\nexport const isValidString = (value: unknown): boolean => typeof value === 'string' && value.trim() !== '';\n\n/**\n * Clean string caraters\n * @param text - text to cliean\n * @returns cleanded string\n */\nexport const cleanString = (text: string): string =>\n typeof text === 'string' &&\n text\n .toLocaleLowerCase()\n .normalize('NFD')\n .replaceAll(/[\\u0300-\\u036f]/g, '');\n"],"version":3}
|
|
@@ -689,7 +689,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
689
689
|
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
690
690
|
// remove the old original location comment entirely
|
|
691
691
|
// later on the patch function will know what to do
|
|
692
|
-
// and move this to the correct spot
|
|
692
|
+
// and move this to the correct spot if need be
|
|
693
693
|
childNode['s-ol'].remove();
|
|
694
694
|
childNode['s-ol'] = undefined;
|
|
695
695
|
checkSlotRelocate = true;
|
|
@@ -1107,30 +1107,37 @@ const patch = (oldVNode, newVNode) => {
|
|
|
1107
1107
|
elm.data = text;
|
|
1108
1108
|
}
|
|
1109
1109
|
};
|
|
1110
|
+
/**
|
|
1111
|
+
* Adjust the `.hidden` property as-needed on any nodes in a DOM subtree which
|
|
1112
|
+
* are slot fallbacks nodes.
|
|
1113
|
+
*
|
|
1114
|
+
* A slot fallback node should be visible by default. Then, it should be
|
|
1115
|
+
* conditionally hidden if:
|
|
1116
|
+
*
|
|
1117
|
+
* - it has a sibling with a `slot` property set to its slot name or if
|
|
1118
|
+
* - it is a default fallback slot node, in which case we hide if it has any
|
|
1119
|
+
* content
|
|
1120
|
+
*
|
|
1121
|
+
* @param elm the element of interest
|
|
1122
|
+
*/
|
|
1110
1123
|
const updateFallbackSlotVisibility = (elm) => {
|
|
1111
|
-
// tslint:disable-next-line: prefer-const
|
|
1112
1124
|
const childNodes = elm.childNodes;
|
|
1113
|
-
|
|
1114
|
-
let i;
|
|
1115
|
-
let ilen;
|
|
1116
|
-
let j;
|
|
1117
|
-
let slotNameAttr;
|
|
1118
|
-
let nodeType;
|
|
1119
|
-
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
1120
|
-
childNode = childNodes[i];
|
|
1125
|
+
for (const childNode of childNodes) {
|
|
1121
1126
|
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1122
1127
|
if (childNode['s-sr']) {
|
|
1123
1128
|
// this is a slot fallback node
|
|
1124
1129
|
// get the slot name for this slot reference node
|
|
1125
|
-
|
|
1130
|
+
const slotName = childNode['s-sn'];
|
|
1126
1131
|
// by default always show a fallback slot node
|
|
1127
1132
|
// then hide it if there are other slots in the light dom
|
|
1128
1133
|
childNode.hidden = false;
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
+
// we need to check all of its sibling nodes in order to see if
|
|
1135
|
+
// `childNode` should be hidden
|
|
1136
|
+
for (const siblingNode of childNodes) {
|
|
1137
|
+
if (siblingNode['s-hn'] !== childNode['s-hn'] || slotName !== '') {
|
|
1138
|
+
// this sibling node is from a different component OR is a named
|
|
1139
|
+
// fallback slot node
|
|
1140
|
+
if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ && slotName === siblingNode.getAttribute('slot')) {
|
|
1134
1141
|
childNode.hidden = true;
|
|
1135
1142
|
break;
|
|
1136
1143
|
}
|
|
@@ -1139,8 +1146,8 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
1139
1146
|
// this is a default fallback slot node
|
|
1140
1147
|
// any element or text node (with content)
|
|
1141
1148
|
// should hide the default fallback slot node
|
|
1142
|
-
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1143
|
-
(nodeType === 3 /* NODE_TYPE.TextNode */ &&
|
|
1149
|
+
if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1150
|
+
(siblingNode.nodeType === 3 /* NODE_TYPE.TextNode */ && siblingNode.textContent.trim() !== '')) {
|
|
1144
1151
|
childNode.hidden = true;
|
|
1145
1152
|
break;
|
|
1146
1153
|
}
|
|
@@ -1152,42 +1159,55 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
1152
1159
|
}
|
|
1153
1160
|
}
|
|
1154
1161
|
};
|
|
1162
|
+
/**
|
|
1163
|
+
* Component-global information about nodes which are either currently being
|
|
1164
|
+
* relocated or will be shortly.
|
|
1165
|
+
*/
|
|
1155
1166
|
const relocateNodes = [];
|
|
1156
|
-
|
|
1167
|
+
/**
|
|
1168
|
+
* Mark the contents of a slot for relocation via adding references to them to
|
|
1169
|
+
* the {@link relocateNodes} data structure. The actual work of relocating them
|
|
1170
|
+
* will then be handled in {@link renderVdom}.
|
|
1171
|
+
*
|
|
1172
|
+
* @param elm a render node whose child nodes need to be relocated
|
|
1173
|
+
*/
|
|
1174
|
+
const markSlotContentForRelocation = (elm) => {
|
|
1157
1175
|
// tslint:disable-next-line: prefer-const
|
|
1158
|
-
let childNode;
|
|
1159
1176
|
let node;
|
|
1160
1177
|
let hostContentNodes;
|
|
1161
|
-
let slotNameAttr;
|
|
1162
|
-
let relocateNodeData;
|
|
1163
1178
|
let j;
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
for (; i < ilen; i++) {
|
|
1168
|
-
childNode = childNodes[i];
|
|
1179
|
+
for (const childNode of elm.childNodes) {
|
|
1180
|
+
// we need to find child nodes which are slot references so we can then try
|
|
1181
|
+
// to match them up with nodes that need to be relocated
|
|
1169
1182
|
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
1170
|
-
// first
|
|
1171
|
-
//
|
|
1183
|
+
// first get the content reference comment node ('s-cr'), then we get
|
|
1184
|
+
// its parent, which is where all the host content is now
|
|
1172
1185
|
hostContentNodes = node.parentNode.childNodes;
|
|
1173
|
-
|
|
1186
|
+
const slotName = childNode['s-sn'];
|
|
1187
|
+
// iterate through all the nodes under the location where the host was
|
|
1188
|
+
// originally rendered
|
|
1174
1189
|
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
1175
1190
|
node = hostContentNodes[j];
|
|
1191
|
+
// check that the node is not a content reference node or a node
|
|
1192
|
+
// reference and then check that the host name does not match that of
|
|
1193
|
+
// childNode
|
|
1176
1194
|
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
1177
|
-
//
|
|
1178
|
-
//
|
|
1179
|
-
//
|
|
1180
|
-
if (isNodeLocatedInSlot(node,
|
|
1195
|
+
// if `node` is located in the slot that `childNode` refers to (via the
|
|
1196
|
+
// `'s-sn'` property) then we need to relocate it from it's current spot
|
|
1197
|
+
// (under the host element parent) to the right slot location
|
|
1198
|
+
if (isNodeLocatedInSlot(node, slotName)) {
|
|
1181
1199
|
// it's possible we've already decided to relocate this node
|
|
1182
|
-
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1200
|
+
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1183
1201
|
// made some changes to slots
|
|
1184
1202
|
// let's make sure we also double check
|
|
1185
1203
|
// fallbacks are correctly hidden or shown
|
|
1186
1204
|
checkSlotFallbackVisibility = true;
|
|
1187
|
-
|
|
1205
|
+
// ensure that the slot-name attr is correct
|
|
1206
|
+
node['s-sn'] = node['s-sn'] || slotName;
|
|
1188
1207
|
if (relocateNodeData) {
|
|
1189
|
-
//
|
|
1190
|
-
//
|
|
1208
|
+
// we marked this node for relocation previously but didn't find
|
|
1209
|
+
// out the slot reference node to which it needs to be relocated
|
|
1210
|
+
// so write it down now!
|
|
1191
1211
|
relocateNodeData.$slotRefNode$ = childNode;
|
|
1192
1212
|
}
|
|
1193
1213
|
else {
|
|
@@ -1209,8 +1229,10 @@ const relocateSlotContent = (elm) => {
|
|
|
1209
1229
|
}
|
|
1210
1230
|
}
|
|
1211
1231
|
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
1212
|
-
//
|
|
1213
|
-
//
|
|
1232
|
+
// the node is not found within the slot (`childNode`) that we're
|
|
1233
|
+
// currently looking at, so we stick it into `relocateNodes` to
|
|
1234
|
+
// handle later. If we never find a home for this element then
|
|
1235
|
+
// we'll need to hide it
|
|
1214
1236
|
relocateNodes.push({
|
|
1215
1237
|
$nodeToRelocate$: node,
|
|
1216
1238
|
});
|
|
@@ -1218,30 +1240,41 @@ const relocateSlotContent = (elm) => {
|
|
|
1218
1240
|
}
|
|
1219
1241
|
}
|
|
1220
1242
|
}
|
|
1243
|
+
// if we're dealing with any type of element (capable of itself being a
|
|
1244
|
+
// slot reference or containing one) then we recur
|
|
1221
1245
|
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1222
|
-
|
|
1246
|
+
markSlotContentForRelocation(childNode);
|
|
1223
1247
|
}
|
|
1224
1248
|
}
|
|
1225
1249
|
};
|
|
1226
|
-
|
|
1250
|
+
/**
|
|
1251
|
+
* Check whether a node is located in a given named slot.
|
|
1252
|
+
*
|
|
1253
|
+
* @param nodeToRelocate the node of interest
|
|
1254
|
+
* @param slotName the slot name to check
|
|
1255
|
+
* @returns whether the node is located in the slot or not
|
|
1256
|
+
*/
|
|
1257
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
|
1227
1258
|
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1228
|
-
if (nodeToRelocate.getAttribute('slot') === null &&
|
|
1259
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotName === '') {
|
|
1260
|
+
// if the node doesn't have a slot attribute, and the slot we're checking
|
|
1261
|
+
// is not a named slot, then we assume the node should be within the slot
|
|
1229
1262
|
return true;
|
|
1230
1263
|
}
|
|
1231
|
-
if (nodeToRelocate.getAttribute('slot') ===
|
|
1264
|
+
if (nodeToRelocate.getAttribute('slot') === slotName) {
|
|
1232
1265
|
return true;
|
|
1233
1266
|
}
|
|
1234
1267
|
return false;
|
|
1235
1268
|
}
|
|
1236
|
-
if (nodeToRelocate['s-sn'] ===
|
|
1269
|
+
if (nodeToRelocate['s-sn'] === slotName) {
|
|
1237
1270
|
return true;
|
|
1238
1271
|
}
|
|
1239
|
-
return
|
|
1272
|
+
return slotName === '';
|
|
1240
1273
|
};
|
|
1241
1274
|
/**
|
|
1242
|
-
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
|
|
1243
|
-
*
|
|
1244
|
-
*
|
|
1275
|
+
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
|
|
1276
|
+
* them with `null`. This signals that the DOM element corresponding to the VDom
|
|
1277
|
+
* node has been removed from the DOM.
|
|
1245
1278
|
*
|
|
1246
1279
|
* @param vNode a virtual DOM node
|
|
1247
1280
|
*/
|
|
@@ -1320,7 +1353,7 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
1320
1353
|
// the disconnectCallback from working
|
|
1321
1354
|
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1322
1355
|
if (checkSlotRelocate) {
|
|
1323
|
-
|
|
1356
|
+
markSlotContentForRelocation(rootVnode.$elm$);
|
|
1324
1357
|
let relocateData;
|
|
1325
1358
|
let nodeToRelocate;
|
|
1326
1359
|
let orgLocationNode;
|
|
@@ -1556,6 +1589,10 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1556
1589
|
*/
|
|
1557
1590
|
const callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
1558
1591
|
try {
|
|
1592
|
+
/**
|
|
1593
|
+
* minification optimization: `allRenderFn` is `true` if all components have a `render`
|
|
1594
|
+
* method, so we can call the method immediately. If not, check before calling it.
|
|
1595
|
+
*/
|
|
1559
1596
|
instance = instance.render && instance.render();
|
|
1560
1597
|
{
|
|
1561
1598
|
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
@@ -1638,6 +1675,16 @@ const appDidLoad = (who) => {
|
|
|
1638
1675
|
}
|
|
1639
1676
|
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
|
1640
1677
|
};
|
|
1678
|
+
/**
|
|
1679
|
+
* Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
|
|
1680
|
+
* e.g. custom element node. If a build figures out that e.g. no component
|
|
1681
|
+
* has a `componentDidLoad` method, the instance method gets removed from the
|
|
1682
|
+
* output bundle and this function returns `undefined`.
|
|
1683
|
+
* @param instance any object that may or may not contain methods
|
|
1684
|
+
* @param method method name
|
|
1685
|
+
* @param arg single arbitrary argument
|
|
1686
|
+
* @returns result of method call if it exists, otherwise `undefined`
|
|
1687
|
+
*/
|
|
1641
1688
|
const safeCall = (instance, method, arg) => {
|
|
1642
1689
|
if (instance && instance[method]) {
|
|
1643
1690
|
try {
|
|
@@ -1838,7 +1885,18 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1838
1885
|
}
|
|
1839
1886
|
return Cstr;
|
|
1840
1887
|
};
|
|
1841
|
-
|
|
1888
|
+
/**
|
|
1889
|
+
* Initialize a Stencil component given a reference to its host element, its
|
|
1890
|
+
* runtime bookkeeping data structure, runtime metadata about the component,
|
|
1891
|
+
* and (optionally) an HMR version ID.
|
|
1892
|
+
*
|
|
1893
|
+
* @param elm a host element
|
|
1894
|
+
* @param hostRef the element's runtime bookkeeping object
|
|
1895
|
+
* @param cmpMeta runtime metadata for the Stencil component
|
|
1896
|
+
* @param hmrVersionId an (optional) HMR version ID
|
|
1897
|
+
*/
|
|
1898
|
+
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
1899
|
+
let Cstr;
|
|
1842
1900
|
// initializeComponent
|
|
1843
1901
|
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1844
1902
|
// Let the runtime know that the component has been initialized
|
|
@@ -2159,13 +2217,40 @@ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !==
|
|
|
2159
2217
|
* @returns void
|
|
2160
2218
|
*/
|
|
2161
2219
|
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
2220
|
+
/**
|
|
2221
|
+
* A WeakMap mapping runtime component references to their corresponding host reference
|
|
2222
|
+
* instances.
|
|
2223
|
+
*/
|
|
2162
2224
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
2225
|
+
/**
|
|
2226
|
+
* Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
|
|
2227
|
+
*
|
|
2228
|
+
* @param ref the runtime ref of interest
|
|
2229
|
+
* @returns the Host reference (if found) or undefined
|
|
2230
|
+
*/
|
|
2163
2231
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
2232
|
+
/**
|
|
2233
|
+
* Register a lazy instance with the {@link hostRefs} object so it's
|
|
2234
|
+
* corresponding {@link d.HostRef} can be retrieved later.
|
|
2235
|
+
*
|
|
2236
|
+
* @param lazyInstance the lazy instance of interest
|
|
2237
|
+
* @param hostRef that instances `HostRef` object
|
|
2238
|
+
* @returns a reference to the host ref WeakMap
|
|
2239
|
+
*/
|
|
2164
2240
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
2165
|
-
|
|
2241
|
+
/**
|
|
2242
|
+
* Register a host element for a Stencil component, setting up various metadata
|
|
2243
|
+
* and callbacks based on {@link BUILD} flags as well as the component's runtime
|
|
2244
|
+
* metadata.
|
|
2245
|
+
*
|
|
2246
|
+
* @param hostElement the host element to register
|
|
2247
|
+
* @param cmpMeta runtime metadata for that component
|
|
2248
|
+
* @returns a reference to the host ref WeakMap
|
|
2249
|
+
*/
|
|
2250
|
+
const registerHost = (hostElement, cmpMeta) => {
|
|
2166
2251
|
const hostRef = {
|
|
2167
2252
|
$flags$: 0,
|
|
2168
|
-
$hostElement$:
|
|
2253
|
+
$hostElement$: hostElement,
|
|
2169
2254
|
$cmpMeta$: cmpMeta,
|
|
2170
2255
|
$instanceValues$: new Map(),
|
|
2171
2256
|
};
|
|
@@ -2174,11 +2259,11 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
2174
2259
|
}
|
|
2175
2260
|
{
|
|
2176
2261
|
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
2177
|
-
|
|
2178
|
-
|
|
2262
|
+
hostElement['s-p'] = [];
|
|
2263
|
+
hostElement['s-rc'] = [];
|
|
2179
2264
|
}
|
|
2180
|
-
addHostEventListeners(
|
|
2181
|
-
return hostRefs.set(
|
|
2265
|
+
addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
|
|
2266
|
+
return hostRefs.set(hostElement, hostRef);
|
|
2182
2267
|
};
|
|
2183
2268
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
2184
2269
|
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
@@ -2295,4 +2380,4 @@ exports.promiseResolve = promiseResolve;
|
|
|
2295
2380
|
exports.registerInstance = registerInstance;
|
|
2296
2381
|
exports.setNonce = setNonce;
|
|
2297
2382
|
|
|
2298
|
-
//# sourceMappingURL=index-
|
|
2383
|
+
//# sourceMappingURL=index-60dd0c56.js.map
|