@ibiz-template/vue3-components 0.7.27 → 0.7.28-alpha.1

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 (252) hide show
  1. package/dist/chart-4KHwhatb.js +1 -0
  2. package/dist/index-5ZDQNjel.js +4 -0
  3. package/dist/{index-0TO7mjm5.js → index-HNRMy1_g.js} +1 -1
  4. package/dist/{index-g6o3vQXo.js → index-xa8K5AHD.js} +1 -1
  5. package/dist/index.min.css +1 -1
  6. package/dist/index.system.min.js +1 -1
  7. package/dist/wang-editor-YqnK5uQU.js +1 -0
  8. package/dist/{xlsx-util-qdXxbg2A.js → xlsx-util-nDELbrGS.js} +1 -1
  9. package/es/common/action-toolbar/action-toolbar.mjs +4 -3
  10. package/es/common/custom-theme/custom-theme.mjs +3 -2
  11. package/es/common/data-import2/data-import2.mjs +2 -5
  12. package/es/common/emoji-select/components/categories/categories.mjs +2 -1
  13. package/es/common/extend-action-timeline/extend-action-timeline.mjs +3 -2
  14. package/es/common/grid-setting/grid-setting.mjs +2 -1
  15. package/es/common/index.mjs +2 -0
  16. package/es/common/pagination/pagination.mjs +2 -1
  17. package/es/common/quick-edit/quick-edit.css +1 -0
  18. package/es/common/quick-edit/quick-edit.d.ts +38 -0
  19. package/es/common/quick-edit/quick-edit.mjs +116 -0
  20. package/es/common/rawitem/rawitem.mjs +2 -1
  21. package/es/control/app-menu/app-menu.mjs +2 -2
  22. package/es/control/app-menu/custom-menu-design/custom-menu-design.mjs +2 -2
  23. package/es/control/app-menu-icon-view/app-menu-icon-view.mjs +3 -2
  24. package/es/control/calendar/calendar.mjs +2 -1
  25. package/es/control/calendar/components/calendar-daily/calendar-daily.mjs +2 -1
  26. package/es/control/calendar/components/calendar-week/calendar-week.mjs +2 -1
  27. package/es/control/calendar/components/custom-calendar/custom-calendar.mjs +3 -2
  28. package/es/control/chart/chart.mjs +8 -0
  29. package/es/control/context-menu/context-menu.mjs +4 -3
  30. package/es/control/dashboard/custom-dashboard-container/custom-dashboard-container.d.ts +0 -1
  31. package/es/control/dashboard/custom-dashboard-container/custom-dashboard-container.mjs +2 -1
  32. package/es/control/dashboard/dashboard-design/dashboard-design.mjs +5 -4
  33. package/es/control/dashboard/portlet/menu-portlet/app-menu-portlet/app-menu-portlet.mjs +3 -2
  34. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.mjs +2 -1
  35. package/es/control/drtab/drtab-control.util.mjs +1 -1
  36. package/es/control/drtab/drtab.mjs +2 -1
  37. package/es/control/form/form-detail/form-button/form-button.mjs +2 -1
  38. package/es/control/form/form-detail/form-item/form-item-container/form-item-container.mjs +3 -2
  39. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.mjs +2 -2
  40. package/es/control/form/form-detail/form-mdctrl/mdctrl-container/mdctrl-container.mjs +2 -1
  41. package/es/control/form/form-detail/form-mdctrl/mdctrl-container2/mdctrl-container2.mjs +2 -1
  42. package/es/control/grid/grid/grid-control.util.d.ts +0 -2
  43. package/es/control/grid/grid/grid-control.util.mjs +9 -72
  44. package/es/control/grid/grid/grid.css +1 -1
  45. package/es/control/grid/grid/grid.d.ts +0 -2
  46. package/es/control/grid/grid/grid.mjs +1 -7
  47. package/es/control/grid/grid/index.d.ts +0 -2
  48. package/es/control/grid/grid-column/grid-field-column/grid-field-column.mjs +3 -2
  49. package/es/control/grid/row-edit-popover/row-edit-popover.d.ts +1 -1
  50. package/es/control/kanban/kanban.mjs +2 -2
  51. package/es/control/list/list.mjs +2 -1
  52. package/es/control/report-panel/report-panel.mjs +5 -0
  53. package/es/control/search-bar/filter-tree/filter-tree.d.ts +1 -1
  54. package/es/control/search-bar/search-bar.mjs +3 -2
  55. package/es/control/search-bar/search-groups/search-groups.mjs +6 -6
  56. package/es/control/toolbar/export-excel/export-excel.mjs +3 -2
  57. package/es/control/toolbar/short-cut-button/short-cut-button.mjs +2 -4
  58. package/es/control/toolbar/toolbar.css +1 -1
  59. package/es/control/toolbar/toolbar.mjs +150 -13
  60. package/es/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.mjs +3 -2
  61. package/es/control/wizard-panel/wizard-panel.mjs +2 -1
  62. package/es/editor/array/ibiz-array/ibiz-array.d.ts +1 -0
  63. package/es/editor/array/ibiz-array/ibiz-array.mjs +12 -3
  64. package/es/editor/autocomplete/ibiz-autocomplete/ibiz-autocomplete.mjs +2 -1
  65. package/es/editor/data-picker/ibiz-mpicker/ibiz-mpicker.mjs +2 -1
  66. package/es/editor/data-picker/ibiz-picker/ibiz-picker.mjs +2 -1
  67. package/es/editor/data-picker/ibiz-picker-dropdown/ibiz-picker-dropdown.mjs +2 -1
  68. package/es/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.mjs +9 -4
  69. package/es/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.d.ts +1 -1
  70. package/es/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.mjs +2 -9
  71. package/es/editor/html/html-editor.controller.d.ts +88 -0
  72. package/es/editor/html/html-editor.controller.mjs +169 -6
  73. package/es/editor/html/wang-editor/component/emoji/emoji.css +1 -0
  74. package/es/editor/html/wang-editor/component/emoji/emoji.d.ts +17 -0
  75. package/es/editor/html/wang-editor/component/emoji/emoji.mjs +42 -0
  76. package/es/editor/html/wang-editor/component/index.d.ts +1 -0
  77. package/es/editor/html/wang-editor/component/index.mjs +3 -0
  78. package/es/editor/html/wang-editor/element/emoji.d.ts +7 -0
  79. package/es/editor/html/wang-editor/element/emoji.mjs +22 -0
  80. package/es/editor/html/wang-editor/element/index.d.ts +1 -0
  81. package/es/editor/html/wang-editor/element/index.mjs +3 -0
  82. package/es/editor/html/wang-editor/index.d.ts +4 -0
  83. package/es/editor/html/wang-editor/index.mjs +11 -0
  84. package/es/editor/html/wang-editor/module/ai-module.d.ts +67 -0
  85. package/es/editor/html/wang-editor/module/ai-module.mjs +76 -0
  86. package/es/editor/html/wang-editor/module/emoji-module.d.ts +7 -0
  87. package/es/editor/html/wang-editor/module/emoji-module.mjs +125 -0
  88. package/es/editor/html/wang-editor/module/index.d.ts +2 -0
  89. package/es/editor/html/wang-editor/module/index.mjs +4 -0
  90. package/es/editor/html/wang-editor/plugin/index.d.ts +1 -0
  91. package/es/editor/html/wang-editor/plugin/index.mjs +3 -0
  92. package/es/editor/html/wang-editor/plugin/plugin.d.ts +7 -0
  93. package/es/editor/html/wang-editor/plugin/plugin.mjs +23 -0
  94. package/es/editor/html/wang-editor/wang-editor.css +1 -1
  95. package/es/editor/html/wang-editor/wang-editor.mjs +7 -7
  96. package/es/editor/number-range/ibiz-number-range-picker/ibiz-number-range-picker.d.ts +1 -1
  97. package/es/editor/number-range/ibiz-number-range-picker/ibiz-number-range-picker.mjs +10 -3
  98. package/es/editor/span/span/span.mjs +2 -2
  99. package/es/editor/text-box/ibiz-input-number/ibiz-input-number.d.ts +1 -1
  100. package/es/editor/text-box/ibiz-input-number/ibiz-input-number.mjs +5 -2
  101. package/es/editor/text-box/input/input.d.ts +1 -0
  102. package/es/editor/text-box/input/input.mjs +17 -4
  103. package/es/editor/user/ibiz-searchcond-edit/ibiz-searchcond-edit.mjs +2 -1
  104. package/es/index.mjs +1 -0
  105. package/es/locale/en/index.d.ts +1 -0
  106. package/es/locale/en/index.mjs +2 -1
  107. package/es/locale/zh-CN/index.d.ts +1 -0
  108. package/es/locale/zh-CN/index.mjs +2 -1
  109. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/h.mjs +89 -0
  110. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/helpers/attachto.mjs +47 -0
  111. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/hooks.mjs +1 -0
  112. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/htmldomapi.mjs +115 -0
  113. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/index.mjs +18 -0
  114. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/init.mjs +376 -0
  115. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/is.mjs +9 -0
  116. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/jsx.mjs +64 -0
  117. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/attributes.mjs +59 -0
  118. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/class.mjs +28 -0
  119. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/dataset.mjs +42 -0
  120. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/eventlisteners.mjs +85 -0
  121. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/props.mjs +24 -0
  122. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/style.mjs +115 -0
  123. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/thunk.mjs +52 -0
  124. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/tovnode.mjs +62 -0
  125. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/vnode.mjs +6 -0
  126. package/es/panel-component/auth-captcha/auth-captcha.mjs +2 -1
  127. package/es/panel-component/panel-button/panel-button.mjs +2 -1
  128. package/es/panel-component/short-cut/short-cut.mjs +2 -2
  129. package/es/panel-component/user-action/user-action.mjs +2 -1
  130. package/es/panel-component/user-message/async-action/async-action/async-action.mjs +2 -1
  131. package/es/panel-component/user-message/internal-message/common/internal-message-container/internal-message-container.mjs +2 -1
  132. package/es/panel-component/user-message/internal-message/internal-message-html/internal-message-html.d.ts +1 -0
  133. package/es/panel-component/user-message/internal-message/internal-message-html/internal-message-html.mjs +10 -4
  134. package/es/panel-component/user-message/internal-message/internal-message-html/internal-message-html.provider.d.ts +1 -0
  135. package/es/panel-component/user-message/user-message.mjs +3 -2
  136. package/es/util/index.d.ts +1 -0
  137. package/es/util/index.mjs +1 -0
  138. package/es/util/notification-util/notification-util.mjs +3 -1
  139. package/es/util/wang-editor-util/wang-editor-util.d.ts +11 -0
  140. package/es/util/wang-editor-util/wang-editor-util.mjs +12 -0
  141. package/lib/common/action-toolbar/action-toolbar.cjs +4 -3
  142. package/lib/common/custom-theme/custom-theme.cjs +3 -2
  143. package/lib/common/data-import2/data-import2.cjs +1 -4
  144. package/lib/common/emoji-select/components/categories/categories.cjs +2 -1
  145. package/lib/common/extend-action-timeline/extend-action-timeline.cjs +3 -2
  146. package/lib/common/grid-setting/grid-setting.cjs +2 -1
  147. package/lib/common/index.cjs +2 -0
  148. package/lib/common/pagination/pagination.cjs +2 -1
  149. package/lib/common/quick-edit/quick-edit.cjs +118 -0
  150. package/lib/common/quick-edit/quick-edit.css +1 -0
  151. package/lib/common/rawitem/rawitem.cjs +2 -1
  152. package/lib/control/app-menu/app-menu.cjs +1 -1
  153. package/lib/control/app-menu/custom-menu-design/custom-menu-design.cjs +1 -1
  154. package/lib/control/app-menu-icon-view/app-menu-icon-view.cjs +3 -2
  155. package/lib/control/calendar/calendar.cjs +2 -1
  156. package/lib/control/calendar/components/calendar-daily/calendar-daily.cjs +2 -1
  157. package/lib/control/calendar/components/calendar-week/calendar-week.cjs +2 -1
  158. package/lib/control/calendar/components/custom-calendar/custom-calendar.cjs +3 -2
  159. package/lib/control/chart/chart.cjs +8 -0
  160. package/lib/control/context-menu/context-menu.cjs +4 -3
  161. package/lib/control/dashboard/custom-dashboard-container/custom-dashboard-container.cjs +2 -1
  162. package/lib/control/dashboard/dashboard-design/dashboard-design.cjs +5 -4
  163. package/lib/control/dashboard/portlet/menu-portlet/app-menu-portlet/app-menu-portlet.cjs +3 -2
  164. package/lib/control/dashboard/portlet/portlet-layout/portlet-layout.cjs +2 -1
  165. package/lib/control/drtab/drtab-control.util.cjs +1 -1
  166. package/lib/control/drtab/drtab.cjs +2 -1
  167. package/lib/control/form/form-detail/form-button/form-button.cjs +2 -1
  168. package/lib/control/form/form-detail/form-item/form-item-container/form-item-container.cjs +3 -2
  169. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.cjs +1 -1
  170. package/lib/control/form/form-detail/form-mdctrl/mdctrl-container/mdctrl-container.cjs +2 -1
  171. package/lib/control/form/form-detail/form-mdctrl/mdctrl-container2/mdctrl-container2.cjs +2 -1
  172. package/lib/control/grid/grid/grid-control.util.cjs +9 -72
  173. package/lib/control/grid/grid/grid.cjs +1 -7
  174. package/lib/control/grid/grid/grid.css +1 -1
  175. package/lib/control/grid/grid-column/grid-field-column/grid-field-column.cjs +3 -2
  176. package/lib/control/kanban/kanban.cjs +1 -1
  177. package/lib/control/list/list.cjs +2 -1
  178. package/lib/control/report-panel/report-panel.cjs +5 -0
  179. package/lib/control/search-bar/search-bar.cjs +3 -2
  180. package/lib/control/search-bar/search-groups/search-groups.cjs +5 -5
  181. package/lib/control/toolbar/export-excel/export-excel.cjs +3 -2
  182. package/lib/control/toolbar/short-cut-button/short-cut-button.cjs +2 -4
  183. package/lib/control/toolbar/toolbar.cjs +150 -13
  184. package/lib/control/toolbar/toolbar.css +1 -1
  185. package/lib/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.cjs +3 -2
  186. package/lib/control/wizard-panel/wizard-panel.cjs +2 -1
  187. package/lib/editor/array/ibiz-array/ibiz-array.cjs +12 -3
  188. package/lib/editor/autocomplete/ibiz-autocomplete/ibiz-autocomplete.cjs +2 -1
  189. package/lib/editor/data-picker/ibiz-mpicker/ibiz-mpicker.cjs +2 -1
  190. package/lib/editor/data-picker/ibiz-picker/ibiz-picker.cjs +2 -1
  191. package/lib/editor/data-picker/ibiz-picker-dropdown/ibiz-picker-dropdown.cjs +2 -1
  192. package/lib/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.cjs +9 -4
  193. package/lib/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.cjs +1 -8
  194. package/lib/editor/html/html-editor.controller.cjs +169 -6
  195. package/lib/editor/html/wang-editor/component/emoji/emoji.cjs +44 -0
  196. package/lib/editor/html/wang-editor/component/emoji/emoji.css +1 -0
  197. package/lib/editor/html/wang-editor/component/index.cjs +7 -0
  198. package/lib/editor/html/wang-editor/element/emoji.cjs +24 -0
  199. package/lib/editor/html/wang-editor/element/index.cjs +7 -0
  200. package/lib/editor/html/wang-editor/index.cjs +19 -0
  201. package/lib/editor/html/wang-editor/module/ai-module.cjs +78 -0
  202. package/lib/editor/html/wang-editor/module/emoji-module.cjs +127 -0
  203. package/lib/editor/html/wang-editor/module/index.cjs +9 -0
  204. package/lib/editor/html/wang-editor/plugin/index.cjs +7 -0
  205. package/lib/editor/html/wang-editor/plugin/plugin.cjs +25 -0
  206. package/lib/editor/html/wang-editor/wang-editor.cjs +7 -7
  207. package/lib/editor/html/wang-editor/wang-editor.css +1 -1
  208. package/lib/editor/number-range/ibiz-number-range-picker/ibiz-number-range-picker.cjs +10 -3
  209. package/lib/editor/span/span/span.cjs +1 -1
  210. package/lib/editor/text-box/ibiz-input-number/ibiz-input-number.cjs +5 -2
  211. package/lib/editor/text-box/input/input.cjs +16 -3
  212. package/lib/editor/user/ibiz-searchcond-edit/ibiz-searchcond-edit.cjs +2 -1
  213. package/lib/index.cjs +2 -0
  214. package/lib/locale/en/index.cjs +2 -1
  215. package/lib/locale/zh-CN/index.cjs +2 -1
  216. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/h.cjs +93 -0
  217. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/helpers/attachto.cjs +49 -0
  218. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/hooks.cjs +2 -0
  219. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/htmldomapi.cjs +117 -0
  220. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/index.cjs +42 -0
  221. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/init.cjs +378 -0
  222. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/is.cjs +12 -0
  223. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/jsx.cjs +67 -0
  224. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/attributes.cjs +61 -0
  225. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/class.cjs +30 -0
  226. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/dataset.cjs +44 -0
  227. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/eventlisteners.cjs +87 -0
  228. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/props.cjs +26 -0
  229. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/style.cjs +117 -0
  230. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/thunk.cjs +54 -0
  231. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/tovnode.cjs +64 -0
  232. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/vnode.cjs +8 -0
  233. package/lib/panel-component/auth-captcha/auth-captcha.cjs +2 -1
  234. package/lib/panel-component/panel-button/panel-button.cjs +2 -1
  235. package/lib/panel-component/short-cut/short-cut.cjs +1 -1
  236. package/lib/panel-component/user-action/user-action.cjs +2 -1
  237. package/lib/panel-component/user-message/async-action/async-action/async-action.cjs +2 -1
  238. package/lib/panel-component/user-message/internal-message/common/internal-message-container/internal-message-container.cjs +2 -1
  239. package/lib/panel-component/user-message/internal-message/internal-message-html/internal-message-html.cjs +9 -3
  240. package/lib/panel-component/user-message/user-message.cjs +3 -2
  241. package/lib/util/index.cjs +2 -0
  242. package/lib/util/notification-util/notification-util.cjs +3 -1
  243. package/lib/util/wang-editor-util/wang-editor-util.cjs +14 -0
  244. package/package.json +7 -6
  245. package/dist/chart-HuCq_rW2.js +0 -1
  246. package/dist/index-Dq21zXhV.js +0 -4
  247. package/dist/wang-editor-XpJH4SXt.js +0 -1
  248. package/es/editor/html/wang-editor/ai/ai-modules.d.ts +0 -10
  249. package/es/editor/html/wang-editor/ai/ai-modules.mjs +0 -32
  250. package/lib/editor/html/wang-editor/ai/ai-modules.cjs +0 -34
  251. /package/es/node_modules/.pnpm/{@ibiz-template_core@0.7.27_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1 → @ibiz-template_core@0.7.28-alpha.1_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1}/node_modules/@ibiz-template/core/out/utils/namespace/namespace.mjs +0 -0
  252. /package/lib/node_modules/.pnpm/{@ibiz-template_core@0.7.27_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1 → @ibiz-template_core@0.7.28-alpha.1_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1}/node_modules/@ibiz-template/core/out/utils/namespace/namespace.cjs +0 -0
@@ -0,0 +1,376 @@
1
+ import { vnode } from './vnode.mjs';
2
+ import { array, primitive } from './is.mjs';
3
+ import { htmlDomApi } from './htmldomapi.mjs';
4
+
5
+ function isUndef(s) {
6
+ return s === undefined;
7
+ }
8
+ function isDef(s) {
9
+ return s !== undefined;
10
+ }
11
+ const emptyNode = vnode("", {}, [], undefined, undefined);
12
+ function sameVnode(vnode1, vnode2) {
13
+ var _a, _b;
14
+ const isSameKey = vnode1.key === vnode2.key;
15
+ const isSameIs = ((_a = vnode1.data) === null || _a === void 0 ? void 0 : _a.is) === ((_b = vnode2.data) === null || _b === void 0 ? void 0 : _b.is);
16
+ const isSameSel = vnode1.sel === vnode2.sel;
17
+ const isSameTextOrFragment = !vnode1.sel && vnode1.sel === vnode2.sel
18
+ ? typeof vnode1.text === typeof vnode2.text
19
+ : true;
20
+ return isSameSel && isSameKey && isSameIs && isSameTextOrFragment;
21
+ }
22
+ /**
23
+ * @todo Remove this function when the document fragment is considered stable.
24
+ */
25
+ function documentFragmentIsNotSupported() {
26
+ throw new Error("The document fragment is not supported on this platform.");
27
+ }
28
+ function isElement(api, vnode) {
29
+ return api.isElement(vnode);
30
+ }
31
+ function isDocumentFragment(api, vnode) {
32
+ return api.isDocumentFragment(vnode);
33
+ }
34
+ function createKeyToOldIdx(children, beginIdx, endIdx) {
35
+ var _a;
36
+ const map = {};
37
+ for (let i = beginIdx; i <= endIdx; ++i) {
38
+ const key = (_a = children[i]) === null || _a === void 0 ? void 0 : _a.key;
39
+ if (key !== undefined) {
40
+ map[key] = i;
41
+ }
42
+ }
43
+ return map;
44
+ }
45
+ const hooks = [
46
+ "create",
47
+ "update",
48
+ "remove",
49
+ "destroy",
50
+ "pre",
51
+ "post",
52
+ ];
53
+ function init(modules, domApi, options) {
54
+ const cbs = {
55
+ create: [],
56
+ update: [],
57
+ remove: [],
58
+ destroy: [],
59
+ pre: [],
60
+ post: [],
61
+ };
62
+ const api = domApi !== undefined ? domApi : htmlDomApi;
63
+ for (const hook of hooks) {
64
+ for (const module of modules) {
65
+ const currentHook = module[hook];
66
+ if (currentHook !== undefined) {
67
+ cbs[hook].push(currentHook);
68
+ }
69
+ }
70
+ }
71
+ function emptyNodeAt(elm) {
72
+ const id = elm.id ? "#" + elm.id : "";
73
+ // elm.className doesn't return a string when elm is an SVG element inside a shadowRoot.
74
+ // https://stackoverflow.com/questions/29454340/detecting-classname-of-svganimatedstring
75
+ const classes = elm.getAttribute("class");
76
+ const c = classes ? "." + classes.split(" ").join(".") : "";
77
+ return vnode(api.tagName(elm).toLowerCase() + id + c, {}, [], undefined, elm);
78
+ }
79
+ function emptyDocumentFragmentAt(frag) {
80
+ return vnode(undefined, {}, [], undefined, frag);
81
+ }
82
+ function createRmCb(childElm, listeners) {
83
+ return function rmCb() {
84
+ if (--listeners === 0) {
85
+ const parent = api.parentNode(childElm);
86
+ api.removeChild(parent, childElm);
87
+ }
88
+ };
89
+ }
90
+ function createElm(vnode, insertedVnodeQueue) {
91
+ var _a, _b, _c, _d;
92
+ let i;
93
+ let data = vnode.data;
94
+ if (data !== undefined) {
95
+ const init = (_a = data.hook) === null || _a === void 0 ? void 0 : _a.init;
96
+ if (isDef(init)) {
97
+ init(vnode);
98
+ data = vnode.data;
99
+ }
100
+ }
101
+ const children = vnode.children;
102
+ const sel = vnode.sel;
103
+ if (sel === "!") {
104
+ if (isUndef(vnode.text)) {
105
+ vnode.text = "";
106
+ }
107
+ vnode.elm = api.createComment(vnode.text);
108
+ }
109
+ else if (sel !== undefined) {
110
+ // Parse selector
111
+ const hashIdx = sel.indexOf("#");
112
+ const dotIdx = sel.indexOf(".", hashIdx);
113
+ const hash = hashIdx > 0 ? hashIdx : sel.length;
114
+ const dot = dotIdx > 0 ? dotIdx : sel.length;
115
+ const tag = hashIdx !== -1 || dotIdx !== -1
116
+ ? sel.slice(0, Math.min(hash, dot))
117
+ : sel;
118
+ const elm = (vnode.elm =
119
+ isDef(data) && isDef((i = data.ns))
120
+ ? api.createElementNS(i, tag, data)
121
+ : api.createElement(tag, data));
122
+ if (hash < dot)
123
+ elm.setAttribute("id", sel.slice(hash + 1, dot));
124
+ if (dotIdx > 0)
125
+ elm.setAttribute("class", sel.slice(dot + 1).replace(/\./g, " "));
126
+ for (i = 0; i < cbs.create.length; ++i)
127
+ cbs.create[i](emptyNode, vnode);
128
+ if (array(children)) {
129
+ for (i = 0; i < children.length; ++i) {
130
+ const ch = children[i];
131
+ if (ch != null) {
132
+ api.appendChild(elm, createElm(ch, insertedVnodeQueue));
133
+ }
134
+ }
135
+ }
136
+ else if (primitive(vnode.text)) {
137
+ api.appendChild(elm, api.createTextNode(vnode.text));
138
+ }
139
+ const hook = vnode.data.hook;
140
+ if (isDef(hook)) {
141
+ (_b = hook.create) === null || _b === void 0 ? void 0 : _b.call(hook, emptyNode, vnode);
142
+ if (hook.insert) {
143
+ insertedVnodeQueue.push(vnode);
144
+ }
145
+ }
146
+ }
147
+ else if (((_c = options === null || options === void 0 ? void 0 : options.experimental) === null || _c === void 0 ? void 0 : _c.fragments) && vnode.children) {
148
+ vnode.elm = ((_d = api.createDocumentFragment) !== null && _d !== void 0 ? _d : documentFragmentIsNotSupported)();
149
+ for (i = 0; i < cbs.create.length; ++i)
150
+ cbs.create[i](emptyNode, vnode);
151
+ for (i = 0; i < vnode.children.length; ++i) {
152
+ const ch = vnode.children[i];
153
+ if (ch != null) {
154
+ api.appendChild(vnode.elm, createElm(ch, insertedVnodeQueue));
155
+ }
156
+ }
157
+ }
158
+ else {
159
+ vnode.elm = api.createTextNode(vnode.text);
160
+ }
161
+ return vnode.elm;
162
+ }
163
+ function addVnodes(parentElm, before, vnodes, startIdx, endIdx, insertedVnodeQueue) {
164
+ for (; startIdx <= endIdx; ++startIdx) {
165
+ const ch = vnodes[startIdx];
166
+ if (ch != null) {
167
+ api.insertBefore(parentElm, createElm(ch, insertedVnodeQueue), before);
168
+ }
169
+ }
170
+ }
171
+ function invokeDestroyHook(vnode) {
172
+ var _a, _b;
173
+ const data = vnode.data;
174
+ if (data !== undefined) {
175
+ (_b = (_a = data === null || data === void 0 ? void 0 : data.hook) === null || _a === void 0 ? void 0 : _a.destroy) === null || _b === void 0 ? void 0 : _b.call(_a, vnode);
176
+ for (let i = 0; i < cbs.destroy.length; ++i)
177
+ cbs.destroy[i](vnode);
178
+ if (vnode.children !== undefined) {
179
+ for (let j = 0; j < vnode.children.length; ++j) {
180
+ const child = vnode.children[j];
181
+ if (child != null && typeof child !== "string") {
182
+ invokeDestroyHook(child);
183
+ }
184
+ }
185
+ }
186
+ }
187
+ }
188
+ function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
189
+ var _a, _b;
190
+ for (; startIdx <= endIdx; ++startIdx) {
191
+ let listeners;
192
+ let rm;
193
+ const ch = vnodes[startIdx];
194
+ if (ch != null) {
195
+ if (isDef(ch.sel)) {
196
+ invokeDestroyHook(ch);
197
+ listeners = cbs.remove.length + 1;
198
+ rm = createRmCb(ch.elm, listeners);
199
+ for (let i = 0; i < cbs.remove.length; ++i)
200
+ cbs.remove[i](ch, rm);
201
+ const removeHook = (_b = (_a = ch === null || ch === void 0 ? void 0 : ch.data) === null || _a === void 0 ? void 0 : _a.hook) === null || _b === void 0 ? void 0 : _b.remove;
202
+ if (isDef(removeHook)) {
203
+ removeHook(ch, rm);
204
+ }
205
+ else {
206
+ rm();
207
+ }
208
+ }
209
+ else if (ch.children) {
210
+ // Fragment node
211
+ invokeDestroyHook(ch);
212
+ removeVnodes(parentElm, ch.children, 0, ch.children.length - 1);
213
+ }
214
+ else {
215
+ // Text node
216
+ api.removeChild(parentElm, ch.elm);
217
+ }
218
+ }
219
+ }
220
+ }
221
+ function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue) {
222
+ let oldStartIdx = 0;
223
+ let newStartIdx = 0;
224
+ let oldEndIdx = oldCh.length - 1;
225
+ let oldStartVnode = oldCh[0];
226
+ let oldEndVnode = oldCh[oldEndIdx];
227
+ let newEndIdx = newCh.length - 1;
228
+ let newStartVnode = newCh[0];
229
+ let newEndVnode = newCh[newEndIdx];
230
+ let oldKeyToIdx;
231
+ let idxInOld;
232
+ let elmToMove;
233
+ let before;
234
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
235
+ if (oldStartVnode == null) {
236
+ oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
237
+ }
238
+ else if (oldEndVnode == null) {
239
+ oldEndVnode = oldCh[--oldEndIdx];
240
+ }
241
+ else if (newStartVnode == null) {
242
+ newStartVnode = newCh[++newStartIdx];
243
+ }
244
+ else if (newEndVnode == null) {
245
+ newEndVnode = newCh[--newEndIdx];
246
+ }
247
+ else if (sameVnode(oldStartVnode, newStartVnode)) {
248
+ patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
249
+ oldStartVnode = oldCh[++oldStartIdx];
250
+ newStartVnode = newCh[++newStartIdx];
251
+ }
252
+ else if (sameVnode(oldEndVnode, newEndVnode)) {
253
+ patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
254
+ oldEndVnode = oldCh[--oldEndIdx];
255
+ newEndVnode = newCh[--newEndIdx];
256
+ }
257
+ else if (sameVnode(oldStartVnode, newEndVnode)) {
258
+ // Vnode moved right
259
+ patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
260
+ api.insertBefore(parentElm, oldStartVnode.elm, api.nextSibling(oldEndVnode.elm));
261
+ oldStartVnode = oldCh[++oldStartIdx];
262
+ newEndVnode = newCh[--newEndIdx];
263
+ }
264
+ else if (sameVnode(oldEndVnode, newStartVnode)) {
265
+ // Vnode moved left
266
+ patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
267
+ api.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
268
+ oldEndVnode = oldCh[--oldEndIdx];
269
+ newStartVnode = newCh[++newStartIdx];
270
+ }
271
+ else {
272
+ if (oldKeyToIdx === undefined) {
273
+ oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
274
+ }
275
+ idxInOld = oldKeyToIdx[newStartVnode.key];
276
+ if (isUndef(idxInOld)) {
277
+ // New element
278
+ api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
279
+ }
280
+ else {
281
+ elmToMove = oldCh[idxInOld];
282
+ if (elmToMove.sel !== newStartVnode.sel) {
283
+ api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
284
+ }
285
+ else {
286
+ patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
287
+ oldCh[idxInOld] = undefined;
288
+ api.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
289
+ }
290
+ }
291
+ newStartVnode = newCh[++newStartIdx];
292
+ }
293
+ }
294
+ if (newStartIdx <= newEndIdx) {
295
+ before = newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].elm;
296
+ addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
297
+ }
298
+ if (oldStartIdx <= oldEndIdx) {
299
+ removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
300
+ }
301
+ }
302
+ function patchVnode(oldVnode, vnode, insertedVnodeQueue) {
303
+ var _a, _b, _c, _d, _e, _f, _g, _h;
304
+ const hook = (_a = vnode.data) === null || _a === void 0 ? void 0 : _a.hook;
305
+ (_b = hook === null || hook === void 0 ? void 0 : hook.prepatch) === null || _b === void 0 ? void 0 : _b.call(hook, oldVnode, vnode);
306
+ const elm = (vnode.elm = oldVnode.elm);
307
+ if (oldVnode === vnode)
308
+ return;
309
+ if (vnode.data !== undefined ||
310
+ (isDef(vnode.text) && vnode.text !== oldVnode.text)) {
311
+ (_c = vnode.data) !== null && _c !== void 0 ? _c : (vnode.data = {});
312
+ (_d = oldVnode.data) !== null && _d !== void 0 ? _d : (oldVnode.data = {});
313
+ for (let i = 0; i < cbs.update.length; ++i)
314
+ cbs.update[i](oldVnode, vnode);
315
+ (_g = (_f = (_e = vnode.data) === null || _e === void 0 ? void 0 : _e.hook) === null || _f === void 0 ? void 0 : _f.update) === null || _g === void 0 ? void 0 : _g.call(_f, oldVnode, vnode);
316
+ }
317
+ const oldCh = oldVnode.children;
318
+ const ch = vnode.children;
319
+ if (isUndef(vnode.text)) {
320
+ if (isDef(oldCh) && isDef(ch)) {
321
+ if (oldCh !== ch)
322
+ updateChildren(elm, oldCh, ch, insertedVnodeQueue);
323
+ }
324
+ else if (isDef(ch)) {
325
+ if (isDef(oldVnode.text))
326
+ api.setTextContent(elm, "");
327
+ addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
328
+ }
329
+ else if (isDef(oldCh)) {
330
+ removeVnodes(elm, oldCh, 0, oldCh.length - 1);
331
+ }
332
+ else if (isDef(oldVnode.text)) {
333
+ api.setTextContent(elm, "");
334
+ }
335
+ }
336
+ else if (oldVnode.text !== vnode.text) {
337
+ if (isDef(oldCh)) {
338
+ removeVnodes(elm, oldCh, 0, oldCh.length - 1);
339
+ }
340
+ api.setTextContent(elm, vnode.text);
341
+ }
342
+ (_h = hook === null || hook === void 0 ? void 0 : hook.postpatch) === null || _h === void 0 ? void 0 : _h.call(hook, oldVnode, vnode);
343
+ }
344
+ return function patch(oldVnode, vnode) {
345
+ let i, elm, parent;
346
+ const insertedVnodeQueue = [];
347
+ for (i = 0; i < cbs.pre.length; ++i)
348
+ cbs.pre[i]();
349
+ if (isElement(api, oldVnode)) {
350
+ oldVnode = emptyNodeAt(oldVnode);
351
+ }
352
+ else if (isDocumentFragment(api, oldVnode)) {
353
+ oldVnode = emptyDocumentFragmentAt(oldVnode);
354
+ }
355
+ if (sameVnode(oldVnode, vnode)) {
356
+ patchVnode(oldVnode, vnode, insertedVnodeQueue);
357
+ }
358
+ else {
359
+ elm = oldVnode.elm;
360
+ parent = api.parentNode(elm);
361
+ createElm(vnode, insertedVnodeQueue);
362
+ if (parent !== null) {
363
+ api.insertBefore(parent, vnode.elm, api.nextSibling(elm));
364
+ removeVnodes(parent, [oldVnode], 0, 0);
365
+ }
366
+ }
367
+ for (i = 0; i < insertedVnodeQueue.length; ++i) {
368
+ insertedVnodeQueue[i].data.hook.insert(insertedVnodeQueue[i]);
369
+ }
370
+ for (i = 0; i < cbs.post.length; ++i)
371
+ cbs.post[i]();
372
+ return vnode;
373
+ };
374
+ }
375
+
376
+ export { init };
@@ -0,0 +1,9 @@
1
+ const array = Array.isArray;
2
+ function primitive(s) {
3
+ return (typeof s === "string" ||
4
+ typeof s === "number" ||
5
+ s instanceof String ||
6
+ s instanceof Number);
7
+ }
8
+
9
+ export { array, primitive };
@@ -0,0 +1,64 @@
1
+ import { vnode } from './vnode.mjs';
2
+ import { h } from './h.mjs';
3
+
4
+ /* eslint-disable @typescript-eslint/no-namespace, import/export */
5
+ function Fragment(data, ...children) {
6
+ const flatChildren = flattenAndFilter(children, []);
7
+ if (flatChildren.length === 1 &&
8
+ !flatChildren[0].sel &&
9
+ flatChildren[0].text) {
10
+ // only child is a simple text node, pass as text for a simpler vtree
11
+ return vnode(undefined, undefined, undefined, flatChildren[0].text, undefined);
12
+ }
13
+ else {
14
+ return vnode(undefined, data !== null && data !== void 0 ? data : {}, flatChildren, undefined, undefined);
15
+ }
16
+ }
17
+ function flattenAndFilter(children, flattened) {
18
+ for (const child of children) {
19
+ // filter out falsey children, except 0 since zero can be a valid value e.g inside a chart
20
+ if (child !== undefined &&
21
+ child !== null &&
22
+ child !== false &&
23
+ child !== "") {
24
+ if (Array.isArray(child)) {
25
+ flattenAndFilter(child, flattened);
26
+ }
27
+ else if (typeof child === "string" ||
28
+ typeof child === "number" ||
29
+ typeof child === "boolean") {
30
+ flattened.push(vnode(undefined, undefined, undefined, String(child), undefined));
31
+ }
32
+ else {
33
+ flattened.push(child);
34
+ }
35
+ }
36
+ }
37
+ return flattened;
38
+ }
39
+ /**
40
+ * jsx/tsx compatible factory function
41
+ * see: https://www.typescriptlang.org/docs/handbook/jsx.html#factory-functions
42
+ */
43
+ function jsx(tag, data, ...children) {
44
+ const flatChildren = flattenAndFilter(children, []);
45
+ if (typeof tag === "function") {
46
+ // tag is a function component
47
+ return tag(data, flatChildren);
48
+ }
49
+ else {
50
+ if (flatChildren.length === 1 &&
51
+ !flatChildren[0].sel &&
52
+ flatChildren[0].text) {
53
+ // only child is a simple text node, pass as text for a simpler vtree
54
+ return h(tag, data, flatChildren[0].text);
55
+ }
56
+ else {
57
+ return h(tag, data, flatChildren);
58
+ }
59
+ }
60
+ }
61
+ (function (jsx) {
62
+ })(jsx || (jsx = {}));
63
+
64
+ export { Fragment, jsx };
@@ -0,0 +1,59 @@
1
+ const xlinkNS = "http://www.w3.org/1999/xlink";
2
+ const xmlNS = "http://www.w3.org/XML/1998/namespace";
3
+ const colonChar = 58;
4
+ const xChar = 120;
5
+ function updateAttrs(oldVnode, vnode) {
6
+ let key;
7
+ const elm = vnode.elm;
8
+ let oldAttrs = oldVnode.data.attrs;
9
+ let attrs = vnode.data.attrs;
10
+ if (!oldAttrs && !attrs)
11
+ return;
12
+ if (oldAttrs === attrs)
13
+ return;
14
+ oldAttrs = oldAttrs || {};
15
+ attrs = attrs || {};
16
+ // update modified attributes, add new attributes
17
+ for (key in attrs) {
18
+ const cur = attrs[key];
19
+ const old = oldAttrs[key];
20
+ if (old !== cur) {
21
+ if (cur === true) {
22
+ elm.setAttribute(key, "");
23
+ }
24
+ else if (cur === false) {
25
+ elm.removeAttribute(key);
26
+ }
27
+ else {
28
+ if (key.charCodeAt(0) !== xChar) {
29
+ elm.setAttribute(key, cur);
30
+ }
31
+ else if (key.charCodeAt(3) === colonChar) {
32
+ // Assume xml namespace
33
+ elm.setAttributeNS(xmlNS, key, cur);
34
+ }
35
+ else if (key.charCodeAt(5) === colonChar) {
36
+ // Assume xlink namespace
37
+ elm.setAttributeNS(xlinkNS, key, cur);
38
+ }
39
+ else {
40
+ elm.setAttribute(key, cur);
41
+ }
42
+ }
43
+ }
44
+ }
45
+ // remove removed attributes
46
+ // use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)
47
+ // the other option is to remove all attributes with value == undefined
48
+ for (key in oldAttrs) {
49
+ if (!(key in attrs)) {
50
+ elm.removeAttribute(key);
51
+ }
52
+ }
53
+ }
54
+ const attributesModule = {
55
+ create: updateAttrs,
56
+ update: updateAttrs,
57
+ };
58
+
59
+ export { attributesModule };
@@ -0,0 +1,28 @@
1
+ function updateClass(oldVnode, vnode) {
2
+ let cur;
3
+ let name;
4
+ const elm = vnode.elm;
5
+ let oldClass = oldVnode.data.class;
6
+ let klass = vnode.data.class;
7
+ if (!oldClass && !klass)
8
+ return;
9
+ if (oldClass === klass)
10
+ return;
11
+ oldClass = oldClass || {};
12
+ klass = klass || {};
13
+ for (name in oldClass) {
14
+ if (oldClass[name] && !Object.prototype.hasOwnProperty.call(klass, name)) {
15
+ // was `true` and now not provided
16
+ elm.classList.remove(name);
17
+ }
18
+ }
19
+ for (name in klass) {
20
+ cur = klass[name];
21
+ if (cur !== oldClass[name]) {
22
+ elm.classList[cur ? "add" : "remove"](name);
23
+ }
24
+ }
25
+ }
26
+ const classModule = { create: updateClass, update: updateClass };
27
+
28
+ export { classModule };
@@ -0,0 +1,42 @@
1
+ const CAPS_REGEX = /[A-Z]/g;
2
+ function updateDataset(oldVnode, vnode) {
3
+ const elm = vnode.elm;
4
+ let oldDataset = oldVnode.data.dataset;
5
+ let dataset = vnode.data.dataset;
6
+ let key;
7
+ if (!oldDataset && !dataset)
8
+ return;
9
+ if (oldDataset === dataset)
10
+ return;
11
+ oldDataset = oldDataset || {};
12
+ dataset = dataset || {};
13
+ const d = elm.dataset;
14
+ for (key in oldDataset) {
15
+ if (!dataset[key]) {
16
+ if (d) {
17
+ if (key in d) {
18
+ delete d[key];
19
+ }
20
+ }
21
+ else {
22
+ elm.removeAttribute("data-" + key.replace(CAPS_REGEX, "-$&").toLowerCase());
23
+ }
24
+ }
25
+ }
26
+ for (key in dataset) {
27
+ if (oldDataset[key] !== dataset[key]) {
28
+ if (d) {
29
+ d[key] = dataset[key];
30
+ }
31
+ else {
32
+ elm.setAttribute("data-" + key.replace(CAPS_REGEX, "-$&").toLowerCase(), dataset[key]);
33
+ }
34
+ }
35
+ }
36
+ }
37
+ const datasetModule = {
38
+ create: updateDataset,
39
+ update: updateDataset,
40
+ };
41
+
42
+ export { datasetModule };
@@ -0,0 +1,85 @@
1
+ function invokeHandler(handler, vnode, event) {
2
+ if (typeof handler === "function") {
3
+ // call function handler
4
+ handler.call(vnode, event, vnode);
5
+ }
6
+ else if (typeof handler === "object") {
7
+ // call multiple handlers
8
+ for (let i = 0; i < handler.length; i++) {
9
+ invokeHandler(handler[i], vnode, event);
10
+ }
11
+ }
12
+ }
13
+ function handleEvent(event, vnode) {
14
+ const name = event.type;
15
+ const on = vnode.data.on;
16
+ // call event handler(s) if exists
17
+ if (on && on[name]) {
18
+ invokeHandler(on[name], vnode, event);
19
+ }
20
+ }
21
+ function createListener() {
22
+ return function handler(event) {
23
+ handleEvent(event, handler.vnode);
24
+ };
25
+ }
26
+ function updateEventListeners(oldVnode, vnode) {
27
+ const oldOn = oldVnode.data.on;
28
+ const oldListener = oldVnode.listener;
29
+ const oldElm = oldVnode.elm;
30
+ const on = vnode && vnode.data.on;
31
+ const elm = (vnode && vnode.elm);
32
+ let name;
33
+ // optimization for reused immutable handlers
34
+ if (oldOn === on) {
35
+ return;
36
+ }
37
+ // remove existing listeners which no longer used
38
+ if (oldOn && oldListener) {
39
+ // if element changed or deleted we remove all existing listeners unconditionally
40
+ if (!on) {
41
+ for (name in oldOn) {
42
+ // remove listener if element was changed or existing listeners removed
43
+ oldElm.removeEventListener(name, oldListener, false);
44
+ }
45
+ }
46
+ else {
47
+ for (name in oldOn) {
48
+ // remove listener if existing listener removed
49
+ if (!on[name]) {
50
+ oldElm.removeEventListener(name, oldListener, false);
51
+ }
52
+ }
53
+ }
54
+ }
55
+ // add new listeners which has not already attached
56
+ if (on) {
57
+ // reuse existing listener or create new
58
+ const listener = (vnode.listener =
59
+ oldVnode.listener || createListener());
60
+ // update vnode for listener
61
+ listener.vnode = vnode;
62
+ // if element changed or added we add all needed listeners unconditionally
63
+ if (!oldOn) {
64
+ for (name in on) {
65
+ // add listener if element was changed or new listeners added
66
+ elm.addEventListener(name, listener, false);
67
+ }
68
+ }
69
+ else {
70
+ for (name in on) {
71
+ // add listener if new listener added
72
+ if (!oldOn[name]) {
73
+ elm.addEventListener(name, listener, false);
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ const eventListenersModule = {
80
+ create: updateEventListeners,
81
+ update: updateEventListeners,
82
+ destroy: updateEventListeners,
83
+ };
84
+
85
+ export { eventListenersModule };
@@ -0,0 +1,24 @@
1
+ function updateProps(oldVnode, vnode) {
2
+ let key;
3
+ let cur;
4
+ let old;
5
+ const elm = vnode.elm;
6
+ let oldProps = oldVnode.data.props;
7
+ let props = vnode.data.props;
8
+ if (!oldProps && !props)
9
+ return;
10
+ if (oldProps === props)
11
+ return;
12
+ oldProps = oldProps || {};
13
+ props = props || {};
14
+ for (key in props) {
15
+ cur = props[key];
16
+ old = oldProps[key];
17
+ if (old !== cur && (key !== "value" || elm[key] !== cur)) {
18
+ elm[key] = cur;
19
+ }
20
+ }
21
+ }
22
+ const propsModule = { create: updateProps, update: updateProps };
23
+
24
+ export { propsModule };