@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
|
@@ -285,7 +285,7 @@ const createID = (prefix = '', length = 10) => {
|
|
|
285
285
|
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
286
286
|
const charsLength = chars.length;
|
|
287
287
|
let ID = '';
|
|
288
|
-
let now = Date.now();
|
|
288
|
+
let now = Math.floor(globalThis.crypto.getRandomValues(new Uint32Array(1))[0] * Date.now());
|
|
289
289
|
while (length > 0) {
|
|
290
290
|
now += Math.pow(10, 6); // Add 1 millisecond to the timestamp
|
|
291
291
|
const index = now % charsLength;
|
|
@@ -422,4 +422,4 @@ const cleanString = (text) => typeof text === 'string' &&
|
|
|
422
422
|
|
|
423
423
|
export { ClassList as C, Direction as D, isValidString as a, isTagName as b, createID as c, cleanString as d, dateRegExp as e, localeCurrency as f, localeNumber as g, allItemsAreString as h, initLocales as i, focusableElements as j, getWindows as k, localeDate as l, sizes as s };
|
|
424
424
|
|
|
425
|
-
//# sourceMappingURL=components.utils-
|
|
425
|
+
//# sourceMappingURL=components.utils-6cf27db1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"components.utils-6cf27db1.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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,CAAC,WAAmB,EAAE,UAAoB,EAAE;;EAE1E,IAAI,WAAW,CAAC,IAAI,KAAK,WAAW,CAAC,GAAG,EAAE;;IAExC,IAAI;MACF,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":[],"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}
|
|
@@ -667,7 +667,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
667
667
|
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
668
668
|
// remove the old original location comment entirely
|
|
669
669
|
// later on the patch function will know what to do
|
|
670
|
-
// and move this to the correct spot
|
|
670
|
+
// and move this to the correct spot if need be
|
|
671
671
|
childNode['s-ol'].remove();
|
|
672
672
|
childNode['s-ol'] = undefined;
|
|
673
673
|
checkSlotRelocate = true;
|
|
@@ -1085,30 +1085,37 @@ const patch = (oldVNode, newVNode) => {
|
|
|
1085
1085
|
elm.data = text;
|
|
1086
1086
|
}
|
|
1087
1087
|
};
|
|
1088
|
+
/**
|
|
1089
|
+
* Adjust the `.hidden` property as-needed on any nodes in a DOM subtree which
|
|
1090
|
+
* are slot fallbacks nodes.
|
|
1091
|
+
*
|
|
1092
|
+
* A slot fallback node should be visible by default. Then, it should be
|
|
1093
|
+
* conditionally hidden if:
|
|
1094
|
+
*
|
|
1095
|
+
* - it has a sibling with a `slot` property set to its slot name or if
|
|
1096
|
+
* - it is a default fallback slot node, in which case we hide if it has any
|
|
1097
|
+
* content
|
|
1098
|
+
*
|
|
1099
|
+
* @param elm the element of interest
|
|
1100
|
+
*/
|
|
1088
1101
|
const updateFallbackSlotVisibility = (elm) => {
|
|
1089
|
-
// tslint:disable-next-line: prefer-const
|
|
1090
1102
|
const childNodes = elm.childNodes;
|
|
1091
|
-
|
|
1092
|
-
let i;
|
|
1093
|
-
let ilen;
|
|
1094
|
-
let j;
|
|
1095
|
-
let slotNameAttr;
|
|
1096
|
-
let nodeType;
|
|
1097
|
-
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
1098
|
-
childNode = childNodes[i];
|
|
1103
|
+
for (const childNode of childNodes) {
|
|
1099
1104
|
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1100
1105
|
if (childNode['s-sr']) {
|
|
1101
1106
|
// this is a slot fallback node
|
|
1102
1107
|
// get the slot name for this slot reference node
|
|
1103
|
-
|
|
1108
|
+
const slotName = childNode['s-sn'];
|
|
1104
1109
|
// by default always show a fallback slot node
|
|
1105
1110
|
// then hide it if there are other slots in the light dom
|
|
1106
1111
|
childNode.hidden = false;
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
+
// we need to check all of its sibling nodes in order to see if
|
|
1113
|
+
// `childNode` should be hidden
|
|
1114
|
+
for (const siblingNode of childNodes) {
|
|
1115
|
+
if (siblingNode['s-hn'] !== childNode['s-hn'] || slotName !== '') {
|
|
1116
|
+
// this sibling node is from a different component OR is a named
|
|
1117
|
+
// fallback slot node
|
|
1118
|
+
if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ && slotName === siblingNode.getAttribute('slot')) {
|
|
1112
1119
|
childNode.hidden = true;
|
|
1113
1120
|
break;
|
|
1114
1121
|
}
|
|
@@ -1117,8 +1124,8 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
1117
1124
|
// this is a default fallback slot node
|
|
1118
1125
|
// any element or text node (with content)
|
|
1119
1126
|
// should hide the default fallback slot node
|
|
1120
|
-
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1121
|
-
(nodeType === 3 /* NODE_TYPE.TextNode */ &&
|
|
1127
|
+
if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1128
|
+
(siblingNode.nodeType === 3 /* NODE_TYPE.TextNode */ && siblingNode.textContent.trim() !== '')) {
|
|
1122
1129
|
childNode.hidden = true;
|
|
1123
1130
|
break;
|
|
1124
1131
|
}
|
|
@@ -1130,42 +1137,55 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
1130
1137
|
}
|
|
1131
1138
|
}
|
|
1132
1139
|
};
|
|
1140
|
+
/**
|
|
1141
|
+
* Component-global information about nodes which are either currently being
|
|
1142
|
+
* relocated or will be shortly.
|
|
1143
|
+
*/
|
|
1133
1144
|
const relocateNodes = [];
|
|
1134
|
-
|
|
1145
|
+
/**
|
|
1146
|
+
* Mark the contents of a slot for relocation via adding references to them to
|
|
1147
|
+
* the {@link relocateNodes} data structure. The actual work of relocating them
|
|
1148
|
+
* will then be handled in {@link renderVdom}.
|
|
1149
|
+
*
|
|
1150
|
+
* @param elm a render node whose child nodes need to be relocated
|
|
1151
|
+
*/
|
|
1152
|
+
const markSlotContentForRelocation = (elm) => {
|
|
1135
1153
|
// tslint:disable-next-line: prefer-const
|
|
1136
|
-
let childNode;
|
|
1137
1154
|
let node;
|
|
1138
1155
|
let hostContentNodes;
|
|
1139
|
-
let slotNameAttr;
|
|
1140
|
-
let relocateNodeData;
|
|
1141
1156
|
let j;
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
for (; i < ilen; i++) {
|
|
1146
|
-
childNode = childNodes[i];
|
|
1157
|
+
for (const childNode of elm.childNodes) {
|
|
1158
|
+
// we need to find child nodes which are slot references so we can then try
|
|
1159
|
+
// to match them up with nodes that need to be relocated
|
|
1147
1160
|
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
1148
|
-
// first
|
|
1149
|
-
//
|
|
1161
|
+
// first get the content reference comment node ('s-cr'), then we get
|
|
1162
|
+
// its parent, which is where all the host content is now
|
|
1150
1163
|
hostContentNodes = node.parentNode.childNodes;
|
|
1151
|
-
|
|
1164
|
+
const slotName = childNode['s-sn'];
|
|
1165
|
+
// iterate through all the nodes under the location where the host was
|
|
1166
|
+
// originally rendered
|
|
1152
1167
|
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
1153
1168
|
node = hostContentNodes[j];
|
|
1169
|
+
// check that the node is not a content reference node or a node
|
|
1170
|
+
// reference and then check that the host name does not match that of
|
|
1171
|
+
// childNode
|
|
1154
1172
|
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
1155
|
-
//
|
|
1156
|
-
//
|
|
1157
|
-
//
|
|
1158
|
-
if (isNodeLocatedInSlot(node,
|
|
1173
|
+
// if `node` is located in the slot that `childNode` refers to (via the
|
|
1174
|
+
// `'s-sn'` property) then we need to relocate it from it's current spot
|
|
1175
|
+
// (under the host element parent) to the right slot location
|
|
1176
|
+
if (isNodeLocatedInSlot(node, slotName)) {
|
|
1159
1177
|
// it's possible we've already decided to relocate this node
|
|
1160
|
-
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1178
|
+
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1161
1179
|
// made some changes to slots
|
|
1162
1180
|
// let's make sure we also double check
|
|
1163
1181
|
// fallbacks are correctly hidden or shown
|
|
1164
1182
|
checkSlotFallbackVisibility = true;
|
|
1165
|
-
|
|
1183
|
+
// ensure that the slot-name attr is correct
|
|
1184
|
+
node['s-sn'] = node['s-sn'] || slotName;
|
|
1166
1185
|
if (relocateNodeData) {
|
|
1167
|
-
//
|
|
1168
|
-
//
|
|
1186
|
+
// we marked this node for relocation previously but didn't find
|
|
1187
|
+
// out the slot reference node to which it needs to be relocated
|
|
1188
|
+
// so write it down now!
|
|
1169
1189
|
relocateNodeData.$slotRefNode$ = childNode;
|
|
1170
1190
|
}
|
|
1171
1191
|
else {
|
|
@@ -1187,8 +1207,10 @@ const relocateSlotContent = (elm) => {
|
|
|
1187
1207
|
}
|
|
1188
1208
|
}
|
|
1189
1209
|
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
1190
|
-
//
|
|
1191
|
-
//
|
|
1210
|
+
// the node is not found within the slot (`childNode`) that we're
|
|
1211
|
+
// currently looking at, so we stick it into `relocateNodes` to
|
|
1212
|
+
// handle later. If we never find a home for this element then
|
|
1213
|
+
// we'll need to hide it
|
|
1192
1214
|
relocateNodes.push({
|
|
1193
1215
|
$nodeToRelocate$: node,
|
|
1194
1216
|
});
|
|
@@ -1196,30 +1218,41 @@ const relocateSlotContent = (elm) => {
|
|
|
1196
1218
|
}
|
|
1197
1219
|
}
|
|
1198
1220
|
}
|
|
1221
|
+
// if we're dealing with any type of element (capable of itself being a
|
|
1222
|
+
// slot reference or containing one) then we recur
|
|
1199
1223
|
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1200
|
-
|
|
1224
|
+
markSlotContentForRelocation(childNode);
|
|
1201
1225
|
}
|
|
1202
1226
|
}
|
|
1203
1227
|
};
|
|
1204
|
-
|
|
1228
|
+
/**
|
|
1229
|
+
* Check whether a node is located in a given named slot.
|
|
1230
|
+
*
|
|
1231
|
+
* @param nodeToRelocate the node of interest
|
|
1232
|
+
* @param slotName the slot name to check
|
|
1233
|
+
* @returns whether the node is located in the slot or not
|
|
1234
|
+
*/
|
|
1235
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
|
1205
1236
|
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1206
|
-
if (nodeToRelocate.getAttribute('slot') === null &&
|
|
1237
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotName === '') {
|
|
1238
|
+
// if the node doesn't have a slot attribute, and the slot we're checking
|
|
1239
|
+
// is not a named slot, then we assume the node should be within the slot
|
|
1207
1240
|
return true;
|
|
1208
1241
|
}
|
|
1209
|
-
if (nodeToRelocate.getAttribute('slot') ===
|
|
1242
|
+
if (nodeToRelocate.getAttribute('slot') === slotName) {
|
|
1210
1243
|
return true;
|
|
1211
1244
|
}
|
|
1212
1245
|
return false;
|
|
1213
1246
|
}
|
|
1214
|
-
if (nodeToRelocate['s-sn'] ===
|
|
1247
|
+
if (nodeToRelocate['s-sn'] === slotName) {
|
|
1215
1248
|
return true;
|
|
1216
1249
|
}
|
|
1217
|
-
return
|
|
1250
|
+
return slotName === '';
|
|
1218
1251
|
};
|
|
1219
1252
|
/**
|
|
1220
|
-
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1253
|
+
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
|
|
1254
|
+
* them with `null`. This signals that the DOM element corresponding to the VDom
|
|
1255
|
+
* node has been removed from the DOM.
|
|
1223
1256
|
*
|
|
1224
1257
|
* @param vNode a virtual DOM node
|
|
1225
1258
|
*/
|
|
@@ -1298,7 +1331,7 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
1298
1331
|
// the disconnectCallback from working
|
|
1299
1332
|
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1300
1333
|
if (checkSlotRelocate) {
|
|
1301
|
-
|
|
1334
|
+
markSlotContentForRelocation(rootVnode.$elm$);
|
|
1302
1335
|
let relocateData;
|
|
1303
1336
|
let nodeToRelocate;
|
|
1304
1337
|
let orgLocationNode;
|
|
@@ -1534,6 +1567,10 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1534
1567
|
*/
|
|
1535
1568
|
const callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
1536
1569
|
try {
|
|
1570
|
+
/**
|
|
1571
|
+
* minification optimization: `allRenderFn` is `true` if all components have a `render`
|
|
1572
|
+
* method, so we can call the method immediately. If not, check before calling it.
|
|
1573
|
+
*/
|
|
1537
1574
|
instance = instance.render && instance.render();
|
|
1538
1575
|
{
|
|
1539
1576
|
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
@@ -1616,6 +1653,16 @@ const appDidLoad = (who) => {
|
|
|
1616
1653
|
}
|
|
1617
1654
|
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
|
1618
1655
|
};
|
|
1656
|
+
/**
|
|
1657
|
+
* Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
|
|
1658
|
+
* e.g. custom element node. If a build figures out that e.g. no component
|
|
1659
|
+
* has a `componentDidLoad` method, the instance method gets removed from the
|
|
1660
|
+
* output bundle and this function returns `undefined`.
|
|
1661
|
+
* @param instance any object that may or may not contain methods
|
|
1662
|
+
* @param method method name
|
|
1663
|
+
* @param arg single arbitrary argument
|
|
1664
|
+
* @returns result of method call if it exists, otherwise `undefined`
|
|
1665
|
+
*/
|
|
1619
1666
|
const safeCall = (instance, method, arg) => {
|
|
1620
1667
|
if (instance && instance[method]) {
|
|
1621
1668
|
try {
|
|
@@ -1816,7 +1863,18 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1816
1863
|
}
|
|
1817
1864
|
return Cstr;
|
|
1818
1865
|
};
|
|
1819
|
-
|
|
1866
|
+
/**
|
|
1867
|
+
* Initialize a Stencil component given a reference to its host element, its
|
|
1868
|
+
* runtime bookkeeping data structure, runtime metadata about the component,
|
|
1869
|
+
* and (optionally) an HMR version ID.
|
|
1870
|
+
*
|
|
1871
|
+
* @param elm a host element
|
|
1872
|
+
* @param hostRef the element's runtime bookkeeping object
|
|
1873
|
+
* @param cmpMeta runtime metadata for the Stencil component
|
|
1874
|
+
* @param hmrVersionId an (optional) HMR version ID
|
|
1875
|
+
*/
|
|
1876
|
+
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
1877
|
+
let Cstr;
|
|
1820
1878
|
// initializeComponent
|
|
1821
1879
|
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1822
1880
|
// Let the runtime know that the component has been initialized
|
|
@@ -2137,13 +2195,40 @@ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !==
|
|
|
2137
2195
|
* @returns void
|
|
2138
2196
|
*/
|
|
2139
2197
|
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
2198
|
+
/**
|
|
2199
|
+
* A WeakMap mapping runtime component references to their corresponding host reference
|
|
2200
|
+
* instances.
|
|
2201
|
+
*/
|
|
2140
2202
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
2203
|
+
/**
|
|
2204
|
+
* Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
|
|
2205
|
+
*
|
|
2206
|
+
* @param ref the runtime ref of interest
|
|
2207
|
+
* @returns the Host reference (if found) or undefined
|
|
2208
|
+
*/
|
|
2141
2209
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
2210
|
+
/**
|
|
2211
|
+
* Register a lazy instance with the {@link hostRefs} object so it's
|
|
2212
|
+
* corresponding {@link d.HostRef} can be retrieved later.
|
|
2213
|
+
*
|
|
2214
|
+
* @param lazyInstance the lazy instance of interest
|
|
2215
|
+
* @param hostRef that instances `HostRef` object
|
|
2216
|
+
* @returns a reference to the host ref WeakMap
|
|
2217
|
+
*/
|
|
2142
2218
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
2143
|
-
|
|
2219
|
+
/**
|
|
2220
|
+
* Register a host element for a Stencil component, setting up various metadata
|
|
2221
|
+
* and callbacks based on {@link BUILD} flags as well as the component's runtime
|
|
2222
|
+
* metadata.
|
|
2223
|
+
*
|
|
2224
|
+
* @param hostElement the host element to register
|
|
2225
|
+
* @param cmpMeta runtime metadata for that component
|
|
2226
|
+
* @returns a reference to the host ref WeakMap
|
|
2227
|
+
*/
|
|
2228
|
+
const registerHost = (hostElement, cmpMeta) => {
|
|
2144
2229
|
const hostRef = {
|
|
2145
2230
|
$flags$: 0,
|
|
2146
|
-
$hostElement$:
|
|
2231
|
+
$hostElement$: hostElement,
|
|
2147
2232
|
$cmpMeta$: cmpMeta,
|
|
2148
2233
|
$instanceValues$: new Map(),
|
|
2149
2234
|
};
|
|
@@ -2152,11 +2237,11 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
2152
2237
|
}
|
|
2153
2238
|
{
|
|
2154
2239
|
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
2155
|
-
|
|
2156
|
-
|
|
2240
|
+
hostElement['s-p'] = [];
|
|
2241
|
+
hostElement['s-rc'] = [];
|
|
2157
2242
|
}
|
|
2158
|
-
addHostEventListeners(
|
|
2159
|
-
return hostRefs.set(
|
|
2243
|
+
addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
|
|
2244
|
+
return hostRefs.set(hostElement, hostRef);
|
|
2160
2245
|
};
|
|
2161
2246
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
2162
2247
|
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
@@ -2266,4 +2351,4 @@ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
|
2266
2351
|
|
|
2267
2352
|
export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
|
2268
2353
|
|
|
2269
|
-
//# sourceMappingURL=index-
|
|
2354
|
+
//# sourceMappingURL=index-0f833068.js.map
|