@mgdis/mg-components 5.21.0 → 5.22.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 (101) hide show
  1. package/dist/cjs/{components.utils-cd908d4e.js → components.utils-637c479d.js} +9 -5
  2. package/dist/cjs/components.utils-637c479d.js.map +1 -0
  3. package/dist/cjs/{index-8532b5e9.js → index-28bf9033.js} +25 -17
  4. package/dist/cjs/index-28bf9033.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/mg-action-more_34.cjs.entry.js +195 -146
  7. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
  8. package/dist/cjs/mg-components.cjs.js +3 -3
  9. package/dist/cjs/mg-components.cjs.js.map +1 -1
  10. package/dist/cjs/mg-item-more.cjs.entry.js +2 -2
  11. package/dist/collection/assets/icons/index.js +91 -90
  12. package/dist/collection/assets/icons/index.js.map +1 -1
  13. package/dist/collection/collection-manifest.json +1 -1
  14. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +3 -1
  15. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  16. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +32 -11
  17. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  18. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +9 -0
  19. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  20. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +56 -44
  21. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  22. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +6 -10
  23. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  24. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +6 -10
  25. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  26. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -10
  27. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  28. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +6 -10
  29. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  30. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +6 -10
  31. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  32. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +6 -10
  33. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  34. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +6 -10
  35. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  36. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +6 -10
  37. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  38. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
  39. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  40. package/dist/collection/components/molecules/mg-popover/mg-popover.js +27 -10
  41. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  42. package/dist/collection/locales/en/messages.json +4 -2
  43. package/dist/collection/locales/fr/messages.json +4 -2
  44. package/dist/collection/utils/behaviors.utils.spec.js +1 -1
  45. package/dist/collection/utils/behaviors.utils.spec.js.map +1 -1
  46. package/dist/collection/utils/components.utils.spec.js +1 -1
  47. package/dist/collection/utils/components.utils.spec.js.map +1 -1
  48. package/dist/components/index2.js +8 -4
  49. package/dist/components/index2.js.map +1 -1
  50. package/dist/components/mg-action-more.js.map +1 -1
  51. package/dist/components/mg-icon2.js +92 -90
  52. package/dist/components/mg-icon2.js.map +1 -1
  53. package/dist/components/mg-input-checkbox-paginated.js +1 -1
  54. package/dist/components/mg-input-checkbox-paginated2.js +25 -12
  55. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  56. package/dist/components/mg-input-checkbox.js +50 -34
  57. package/dist/components/mg-input-checkbox.js.map +1 -1
  58. package/dist/components/mg-popover2.js +27 -10
  59. package/dist/components/mg-popover2.js.map +1 -1
  60. package/dist/components/mg-tooltip2.js +3 -1
  61. package/dist/components/mg-tooltip2.js.map +1 -1
  62. package/dist/esm/{components.utils-0d67c31c.js → components.utils-f7c073a0.js} +9 -5
  63. package/dist/esm/components.utils-f7c073a0.js.map +1 -0
  64. package/dist/esm/{index-f34a3a2c.js → index-93dafb06.js} +25 -17
  65. package/dist/esm/index-93dafb06.js.map +1 -0
  66. package/dist/esm/loader.js +3 -3
  67. package/dist/esm/mg-action-more_34.entry.js +195 -146
  68. package/dist/esm/mg-action-more_34.entry.js.map +1 -1
  69. package/dist/esm/mg-components.js +4 -4
  70. package/dist/esm/mg-components.js.map +1 -1
  71. package/dist/esm/mg-item-more.entry.js +2 -2
  72. package/dist/mg-components/locales/en/messages.json +4 -2
  73. package/dist/mg-components/locales/fr/messages.json +4 -2
  74. package/dist/mg-components/mg-components.esm.js +1 -1
  75. package/dist/mg-components/mg-components.esm.js.map +1 -1
  76. package/dist/mg-components/p-457dd62a.entry.js +2 -0
  77. package/dist/mg-components/p-457dd62a.entry.js.map +1 -0
  78. package/dist/mg-components/{p-ce356bc0.entry.js → p-4fa40a8f.entry.js} +2 -2
  79. package/dist/mg-components/p-721c4571.js +2 -0
  80. package/dist/mg-components/{p-af42d17b.js.map → p-721c4571.js.map} +1 -1
  81. package/dist/mg-components/p-8155d0e2.js +3 -0
  82. package/dist/mg-components/p-8155d0e2.js.map +1 -0
  83. package/dist/types/assets/icons/index.d.ts +1 -0
  84. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +4 -4
  85. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +8 -0
  86. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +14 -12
  87. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +1 -1
  88. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +10 -0
  89. package/dist/types/components.d.ts +10 -2
  90. package/dist/types/locales/index.d.ts +4 -0
  91. package/package.json +6 -6
  92. package/dist/cjs/components.utils-cd908d4e.js.map +0 -1
  93. package/dist/cjs/index-8532b5e9.js.map +0 -1
  94. package/dist/esm/components.utils-0d67c31c.js.map +0 -1
  95. package/dist/esm/index-f34a3a2c.js.map +0 -1
  96. package/dist/mg-components/p-7444ff40.js +0 -3
  97. package/dist/mg-components/p-7444ff40.js.map +0 -1
  98. package/dist/mg-components/p-af42d17b.js +0 -2
  99. package/dist/mg-components/p-e591ba8f.entry.js +0 -2
  100. package/dist/mg-components/p-e591ba8f.entry.js.map +0 -1
  101. /package/dist/mg-components/{p-ce356bc0.entry.js.map → p-4fa40a8f.entry.js.map} +0 -0
@@ -34,12 +34,14 @@ const input$1 = {
34
34
  selected: {
35
35
  title: "Selected",
36
36
  titlePlurial: "Selected",
37
- action: "Unselect all"
37
+ action: "Unselect all",
38
+ tooltip: "Unselect all current search results"
38
39
  },
39
40
  notSelected: {
40
41
  title: "Not selected",
41
42
  titlePlurial: "Not selected",
42
- action: "Select all"
43
+ action: "Select all",
44
+ tooltip: "Select all current search results"
43
45
  }
44
46
  }
45
47
  }
@@ -133,12 +135,14 @@ const input = {
133
135
  selected: {
134
136
  title: "Sélectionné",
135
137
  titlePlurial: "Sélectionnés",
136
- action: "Tout désélectionner"
138
+ action: "Tout désélectionner",
139
+ tooltip: "Désélectionne tous les résultats de la recherche en cours"
137
140
  },
138
141
  notSelected: {
139
142
  title: "Non sélectionné",
140
143
  titlePlurial: "Non sélectionnés",
141
- action: "Tout sélectionner"
144
+ action: "Tout sélectionner",
145
+ tooltip: "Sélectionne tous les résultats de la recherche en cours"
142
146
  }
143
147
  }
144
148
  }
@@ -440,4 +444,4 @@ exports.localeNumber = localeNumber;
440
444
  exports.nextTick = nextTick;
441
445
  exports.sizes = sizes;
442
446
 
443
- //# sourceMappingURL=components.utils-cd908d4e.js.map
447
+ //# sourceMappingURL=components.utils-637c479d.js.map
@@ -0,0 +1 @@
1
+ {"file":"components.utils-637c479d.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;MAOa,cAAc,GAAG,CAAC,MAAc,EAAE,MAAc,EAAE,QAAgB;IAC7E,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;IACzD,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACtD,EAAE;AAEF;;;MAGa,UAAU,GAAG,gDAAgD;AAE1E;;;;;;MAMa,UAAU,GAAG,CAAC,IAAY,EAAE,MAAc;IACrD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACrE,OAAO,EAAE,CAAC;KACX;IACD,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,C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AC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC1B,eAAe,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;SACvC;KACF;IACD,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;IACxB,IAAI;SACD,iBAAiB,EAAE;SACnB,SAAS,CAAC,KAAK,CAAC;SAChB,UAAU,CAAC,kBAAkB,EAAE,EAAE,EAAE;AAExC;;;;;MAKa,QAAQ,GAAG,OAAO,QAAoB,KAAoB,QAAQ;;;;;;;;;;;;;;;;;;","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 randomBytes = new Uint8Array(length);\n\n crypto.getRandomValues(randomBytes);\n\n const hexString = Array.from(randomBytes)\n .map(byte => byte.toString(16).padStart(2, '0'))\n .join('')\n .slice(0, length);\n\n return prefix !== '' ? `${prefix}-${hexString}` : hexString;\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\n/**\n * Use to process code next tick in the event loop\n * @param callback - code to excute on next tick\n * @returns differed code excution\n */\nexport const nextTick = async (callback: () => void): Promise<void> => callback();\n"],"version":3}
@@ -880,8 +880,9 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
880
880
  * @param oldCh the old children of the parent node
881
881
  * @param newVNode the new VNode which will replace the parent
882
882
  * @param newCh the new children of the parent node
883
+ * @param isInitialRender whether or not this is the first render of the vdom
883
884
  */
884
- const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
885
+ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
885
886
  let oldStartIdx = 0;
886
887
  let newStartIdx = 0;
887
888
  let idxInOld = 0;
@@ -908,24 +909,24 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
908
909
  else if (newEndVnode == null) {
909
910
  newEndVnode = newCh[--newEndIdx];
910
911
  }
911
- else if (isSameVnode(oldStartVnode, newStartVnode)) {
912
+ else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
912
913
  // if the start nodes are the same then we should patch the new VNode
913
914
  // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
914
915
  // indices to reflect that. We don't need to move any DOM Nodes around
915
916
  // since things are matched up in order.
916
- patch(oldStartVnode, newStartVnode);
917
+ patch(oldStartVnode, newStartVnode, isInitialRender);
917
918
  oldStartVnode = oldCh[++oldStartIdx];
918
919
  newStartVnode = newCh[++newStartIdx];
919
920
  }
920
- else if (isSameVnode(oldEndVnode, newEndVnode)) {
921
+ else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
921
922
  // likewise, if the end nodes are the same we patch new onto old and
922
923
  // decrement our end indices, and also likewise in this case we don't
923
924
  // need to move any DOM Nodes.
924
- patch(oldEndVnode, newEndVnode);
925
+ patch(oldEndVnode, newEndVnode, isInitialRender);
925
926
  oldEndVnode = oldCh[--oldEndIdx];
926
927
  newEndVnode = newCh[--newEndIdx];
927
928
  }
928
- else if (isSameVnode(oldStartVnode, newEndVnode)) {
929
+ else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
929
930
  // case: "Vnode moved right"
930
931
  //
931
932
  // We've found that the last node in our window on the new children is
@@ -943,7 +944,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
943
944
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
944
945
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
945
946
  }
946
- patch(oldStartVnode, newEndVnode);
947
+ patch(oldStartVnode, newEndVnode, isInitialRender);
947
948
  // We need to move the element for `oldStartVnode` into a position which
948
949
  // will be appropriate for `newEndVnode`. For this we can use
949
950
  // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
@@ -965,7 +966,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
965
966
  oldStartVnode = oldCh[++oldStartIdx];
966
967
  newEndVnode = newCh[--newEndIdx];
967
968
  }
968
- else if (isSameVnode(oldEndVnode, newStartVnode)) {
969
+ else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
969
970
  // case: "Vnode moved left"
970
971
  //
971
972
  // We've found that the first node in our window on the new children is
@@ -984,7 +985,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
984
985
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
985
986
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
986
987
  }
987
- patch(oldEndVnode, newStartVnode);
988
+ patch(oldEndVnode, newStartVnode, isInitialRender);
988
989
  // We've already checked above if `oldStartVnode` and `newStartVnode` are
989
990
  // the same node, so since we're here we know that they are not. Thus we
990
991
  // can move the element for `oldEndVnode` _before_ the element for
@@ -1021,7 +1022,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
1021
1022
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
1022
1023
  }
1023
1024
  else {
1024
- patch(elmToMove, newStartVnode);
1025
+ patch(elmToMove, newStartVnode, isInitialRender);
1025
1026
  // invalidate the matching old node so that we won't try to update it
1026
1027
  // again later on
1027
1028
  oldCh[idxInOld] = undefined;
@@ -1072,19 +1073,25 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
1072
1073
  *
1073
1074
  * @param leftVNode the first VNode to check
1074
1075
  * @param rightVNode the second VNode to check
1076
+ * @param isInitialRender whether or not this is the first render of the vdom
1075
1077
  * @returns whether they're equal or not
1076
1078
  */
1077
- const isSameVnode = (leftVNode, rightVNode) => {
1079
+ const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1078
1080
  // compare if two vnode to see if they're "technically" the same
1079
1081
  // need to have the same element tag, and same key to be the same
1080
1082
  if (leftVNode.$tag$ === rightVNode.$tag$) {
1081
1083
  if (leftVNode.$tag$ === 'slot') {
1082
1084
  return leftVNode.$name$ === rightVNode.$name$;
1083
1085
  }
1084
- // this will be set if components in the build have `key` attrs set on them
1085
- {
1086
+ // this will be set if JSX tags in the build have `key` attrs set on them
1087
+ // we only want to check this if we're not on the first render since on
1088
+ // first render `leftVNode.$key$` will always be `null`, so we can be led
1089
+ // astray and, for instance, accidentally delete a DOM node that we want to
1090
+ // keep around.
1091
+ if (!isInitialRender) {
1086
1092
  return leftVNode.$key$ === rightVNode.$key$;
1087
1093
  }
1094
+ return true;
1088
1095
  }
1089
1096
  return false;
1090
1097
  };
@@ -1103,8 +1110,9 @@ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).paren
1103
1110
  *
1104
1111
  * @param oldVNode an old VNode whose DOM element and children we want to update
1105
1112
  * @param newVNode a new VNode representing an updated version of the old one
1113
+ * @param isInitialRender whether or not this is the first render of the vdom
1106
1114
  */
1107
- const patch = (oldVNode, newVNode) => {
1115
+ const patch = (oldVNode, newVNode, isInitialRender = false) => {
1108
1116
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
1109
1117
  const oldChildren = oldVNode.$children$;
1110
1118
  const newChildren = newVNode.$children$;
@@ -1125,7 +1133,7 @@ const patch = (oldVNode, newVNode) => {
1125
1133
  if (oldChildren !== null && newChildren !== null) {
1126
1134
  // looks like there's child vnodes for both the old and new vnodes
1127
1135
  // so we need to call `updateChildren` to reconcile them
1128
- updateChildren(elm, oldChildren, newVNode, newChildren);
1136
+ updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
1129
1137
  }
1130
1138
  else if (newChildren !== null) {
1131
1139
  // no old child vnodes, but there are new child vnodes to add
@@ -1405,7 +1413,7 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1405
1413
  checkSlotFallbackVisibility = false;
1406
1414
  }
1407
1415
  // synchronous patch
1408
- patch(oldVNode, rootVnode);
1416
+ patch(oldVNode, rootVnode, isInitialLoad);
1409
1417
  {
1410
1418
  // while we're moving nodes around existing nodes, temporarily disable
1411
1419
  // the disconnectCallback from working
@@ -2478,4 +2486,4 @@ exports.promiseResolve = promiseResolve;
2478
2486
  exports.registerInstance = registerInstance;
2479
2487
  exports.setNonce = setNonce;
2480
2488
 
2481
- //# sourceMappingURL=index-8532b5e9.js.map
2489
+ //# sourceMappingURL=index-28bf9033.js.map