bromcom-ui 2.7.37-rc.9 → 2.7.37
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/bromcom-ui/bromcom-ui.esm.js +1 -1
- package/dist/bromcom-ui/p-0122ae3d.js +6 -0
- package/dist/bromcom-ui/p-02f2445a.entry.js +5 -0
- package/dist/bromcom-ui/p-037531dd.entry.js +5 -0
- package/dist/bromcom-ui/{p-f1b09912.entry.js → p-08d242bf.entry.js} +1 -1
- package/dist/bromcom-ui/p-095d05df.entry.js +5 -0
- package/dist/bromcom-ui/p-0a46b931.entry.js +5 -0
- package/dist/bromcom-ui/{p-151d7bec.entry.js → p-0dff677e.entry.js} +1 -1
- package/dist/bromcom-ui/{p-b68fcefb.entry.js → p-0f69842c.entry.js} +1 -1
- package/dist/bromcom-ui/p-13077a28.entry.js +5 -0
- package/dist/bromcom-ui/p-15e43f94.entry.js +5 -0
- package/dist/bromcom-ui/p-168b8ca7.entry.js +5 -0
- package/dist/bromcom-ui/p-1978e4ae.entry.js +5 -0
- package/dist/bromcom-ui/p-1ae166db.entry.js +5 -0
- package/dist/bromcom-ui/p-1e2d1714.entry.js +5 -0
- package/dist/bromcom-ui/{p-2b332236.entry.js → p-20c45a95.entry.js} +1 -1
- package/dist/bromcom-ui/{p-34b815f5.entry.js → p-2a7f29b6.entry.js} +1 -1
- package/dist/bromcom-ui/p-2c31ab48.entry.js +5 -0
- package/dist/bromcom-ui/{p-44d68311.js → p-331ee3a4.js} +1 -1
- package/dist/bromcom-ui/p-33e2496d.entry.js +5 -0
- package/dist/bromcom-ui/p-341f55bf.entry.js +5 -0
- package/dist/bromcom-ui/{p-993c912d.entry.js → p-38b69e07.entry.js} +1 -1
- package/dist/bromcom-ui/p-3cebdafb.js +5 -0
- package/dist/bromcom-ui/p-3e557630.entry.js +5 -0
- package/dist/bromcom-ui/p-4220635e.entry.js +5 -0
- package/dist/bromcom-ui/{p-a0c10e3e.entry.js → p-425e15b7.entry.js} +1 -1
- package/dist/bromcom-ui/p-44991f28.js +5 -0
- package/dist/bromcom-ui/p-487f7b46.js +5 -0
- package/dist/bromcom-ui/p-4eb1b6e1.entry.js +5 -0
- package/dist/bromcom-ui/p-52b34297.entry.js +5 -0
- package/dist/bromcom-ui/{p-2444a19c.js → p-53a00d98.js} +1 -1
- package/dist/bromcom-ui/p-55b88051.entry.js +5 -0
- package/dist/bromcom-ui/p-581f703b.entry.js +5 -0
- package/dist/bromcom-ui/{p-b2693a0f.js → p-58761f87.js} +1 -1
- package/dist/bromcom-ui/p-5926788b.entry.js +5 -0
- package/dist/bromcom-ui/{p-f33f5581.entry.js → p-5b114d5a.entry.js} +1 -1
- package/dist/bromcom-ui/{p-591b3100.entry.js → p-5c20b83c.entry.js} +1 -1
- package/dist/bromcom-ui/p-5d8eb303.entry.js +5 -0
- package/dist/bromcom-ui/p-62ba8263.entry.js +5 -0
- package/dist/bromcom-ui/{p-8255f60a.entry.js → p-6720d135.entry.js} +1 -1
- package/dist/bromcom-ui/p-78963452.entry.js +5 -0
- package/dist/bromcom-ui/p-78cf8966.entry.js +5 -0
- package/dist/bromcom-ui/{p-78d48636.entry.js → p-7b5e88c5.entry.js} +1 -1
- package/dist/bromcom-ui/{p-0cd7e628.entry.js → p-7df747c7.entry.js} +1 -1
- package/dist/bromcom-ui/p-8430b547.entry.js +5 -0
- package/dist/bromcom-ui/p-894b0a04.entry.js +5 -0
- package/dist/bromcom-ui/p-8fa9378f.entry.js +5 -0
- package/dist/bromcom-ui/p-93e7539f.entry.js +5 -0
- package/dist/bromcom-ui/p-9512271e.entry.js +5 -0
- package/dist/bromcom-ui/p-95c5d04b.entry.js +5 -0
- package/dist/bromcom-ui/{p-cd0490e2.js → p-96287124.js} +1 -1
- package/dist/bromcom-ui/p-9729086c.entry.js +5 -0
- package/dist/bromcom-ui/p-99bed73b.entry.js +5 -0
- package/dist/bromcom-ui/p-9c2800b0.entry.js +5 -0
- package/dist/bromcom-ui/p-9c6de630.js +5 -0
- package/dist/bromcom-ui/{p-6f30d39e.entry.js → p-9d2fe304.entry.js} +1 -1
- package/dist/bromcom-ui/{p-3c60d68f.entry.js → p-a185570c.entry.js} +1 -1
- package/dist/bromcom-ui/p-a29b08eb.entry.js +5 -0
- package/dist/bromcom-ui/p-a2b5a278.entry.js +5 -0
- package/dist/bromcom-ui/p-a95d388e.js +5 -0
- package/dist/bromcom-ui/{p-b1e3b913.entry.js → p-ac9f1774.entry.js} +1 -1
- package/dist/bromcom-ui/{p-f9cb7ae4.js → p-acb048b5.js} +1 -1
- package/dist/bromcom-ui/p-ad4cf3f3.entry.js +5 -0
- package/dist/bromcom-ui/p-b1b377e8.entry.js +5 -0
- package/dist/bromcom-ui/p-b4c617f6.entry.js +5 -0
- package/dist/bromcom-ui/p-b639def6.js +5 -0
- package/dist/bromcom-ui/p-b924d9b8.entry.js +5 -0
- package/dist/bromcom-ui/p-ba65d1dc.entry.js +5 -0
- package/dist/bromcom-ui/p-c1c18de5.entry.js +5 -0
- package/dist/bromcom-ui/p-c573addc.entry.js +5 -0
- package/dist/bromcom-ui/p-c5c9e76f.entry.js +5 -0
- package/dist/bromcom-ui/p-d6a11d39.entry.js +5 -0
- package/dist/bromcom-ui/p-da458f63.entry.js +5 -0
- package/dist/bromcom-ui/p-da7603b0.entry.js +5 -0
- package/dist/bromcom-ui/p-e0cb6ac3.entry.js +5 -0
- package/dist/bromcom-ui/p-e48c96b5.entry.js +5 -0
- package/dist/bromcom-ui/p-e7b229fb.js +5 -0
- package/dist/bromcom-ui/p-e83e3eae.entry.js +5 -0
- package/dist/bromcom-ui/p-eb3aa16b.entry.js +5 -0
- package/dist/bromcom-ui/p-edec76e6.entry.js +5 -0
- package/dist/bromcom-ui/{p-d9fb53c9.entry.js → p-f5ae5381.entry.js} +1 -1
- package/dist/bromcom-ui/p-f6685330.entry.js +5 -0
- package/dist/bromcom-ui/p-fc1ef08f.entry.js +5 -0
- package/dist/bromcom-ui/p-ff742ab4.entry.js +5 -0
- package/dist/cjs/bcm-accordion.cjs.entry.js +3 -3
- package/dist/cjs/bcm-alert.cjs.entry.js +7 -8
- package/dist/cjs/bcm-attendance.cjs.entry.js +3 -7
- package/dist/cjs/bcm-autocomplete.cjs.entry.js +3 -2
- package/dist/cjs/bcm-avatar_2.cjs.entry.js +15 -6
- package/dist/cjs/bcm-box.cjs.entry.js +2 -2
- package/dist/cjs/bcm-breadcrumb.cjs.entry.js +4 -3
- package/dist/cjs/bcm-button-group.cjs.entry.js +5 -3
- package/dist/cjs/bcm-button_3.cjs.entry.js +14 -5
- package/dist/cjs/bcm-card.cjs.entry.js +7 -5
- package/dist/cjs/bcm-checkbox-group.cjs.entry.js +12 -6
- package/dist/cjs/bcm-checkbox-lite_9.cjs.entry.js +40 -17
- package/dist/cjs/bcm-checkbox_2.cjs.entry.js +11 -9
- package/dist/cjs/bcm-chip.cjs.entry.js +7 -3
- package/dist/cjs/bcm-collapse-group.cjs.entry.js +2 -2
- package/dist/cjs/bcm-collapse.cjs.entry.js +3 -3
- package/dist/cjs/bcm-colorpicker.cjs.entry.js +8 -9
- package/dist/cjs/bcm-date-picker.cjs.entry.js +10 -3
- package/dist/cjs/bcm-datetime-picker.cjs.entry.js +14 -11
- package/dist/cjs/bcm-default.cjs.entry.js +3 -3
- package/dist/cjs/bcm-drawer.cjs.entry.js +6 -9
- package/dist/cjs/bcm-dropdown.cjs.entry.js +13 -7
- package/dist/cjs/bcm-error-layout.cjs.entry.js +2 -2
- package/dist/cjs/bcm-expansion-panel.cjs.entry.js +4 -3
- package/dist/cjs/bcm-form-2.cjs.entry.js +5 -5
- package/dist/cjs/bcm-form-group.cjs.entry.js +3 -2
- package/dist/cjs/bcm-form.cjs.entry.js +3 -2
- package/dist/cjs/bcm-input.cjs.entry.js +29 -12
- package/dist/cjs/bcm-item.cjs.entry.js +4 -3
- package/dist/cjs/bcm-items.cjs.entry.js +3 -3
- package/dist/cjs/bcm-label_2.cjs.entry.js +12 -9
- package/dist/cjs/bcm-link.cjs.entry.js +5 -2
- package/dist/cjs/bcm-linked.cjs.entry.js +7 -5
- package/dist/cjs/bcm-list.cjs.entry.js +26 -23
- package/dist/cjs/bcm-menu.cjs.entry.js +8 -10
- package/dist/cjs/bcm-message.cjs.entry.js +2 -5
- package/dist/cjs/bcm-notification.cjs.entry.js +4 -2
- package/dist/cjs/bcm-old-input.cjs.entry.js +17 -4
- package/dist/cjs/bcm-old-tag_2.cjs.entry.js +4 -2
- package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +8 -3
- package/dist/cjs/bcm-popconfirm.cjs.entry.js +4 -3
- package/dist/cjs/bcm-popover.cjs.entry.js +5 -5
- package/dist/cjs/bcm-progress.cjs.entry.js +3 -3
- package/dist/cjs/bcm-radio-group.cjs.entry.js +14 -5
- package/dist/cjs/bcm-radio.cjs.entry.js +7 -6
- package/dist/cjs/bcm-range.cjs.entry.js +9 -3
- package/dist/cjs/bcm-result.cjs.entry.js +6 -2
- package/dist/cjs/bcm-search.cjs.entry.js +9 -13
- package/dist/cjs/bcm-select-group.cjs.entry.js +2 -1
- package/dist/cjs/bcm-select-option.cjs.entry.js +4 -1
- package/dist/cjs/bcm-select.cjs.entry.js +24 -13
- package/dist/cjs/bcm-skeleton.cjs.entry.js +3 -3
- package/dist/cjs/bcm-step.cjs.entry.js +10 -9
- package/dist/cjs/bcm-stepper.cjs.entry.js +5 -9
- package/dist/cjs/bcm-switch.cjs.entry.js +15 -5
- package/dist/cjs/bcm-tab-group.cjs.entry.js +4 -4
- package/dist/cjs/bcm-tab-pane.cjs.entry.js +2 -2
- package/dist/cjs/bcm-tab.cjs.entry.js +2 -5
- package/dist/cjs/bcm-table.cjs.entry.js +2 -2
- package/dist/cjs/bcm-tabs-content.cjs.entry.js +2 -2
- package/dist/cjs/bcm-tabs.cjs.entry.js +2 -8
- package/dist/cjs/bcm-tag.cjs.entry.js +7 -4
- package/dist/cjs/bcm-text.cjs.entry.js +5 -3
- package/dist/cjs/bcm-textarea.cjs.entry.js +16 -6
- package/dist/cjs/bcm-time-picker.cjs.entry.js +10 -3
- package/dist/cjs/bcm-timeline-item.cjs.entry.js +3 -5
- package/dist/cjs/bcm-timeline.cjs.entry.js +3 -5
- package/dist/cjs/bcm-treeview-group.cjs.entry.js +1 -1
- package/dist/cjs/bromcom-ui.cjs.js +2 -2
- package/dist/cjs/{caption-template-954d34bc.js → caption-template-95c791a2.js} +1 -1
- package/dist/cjs/{generate-73db206b.js → generate-e91273b0.js} +1 -1
- package/dist/cjs/{index-f8547ecd.js → index-1d2ce51d.js} +1 -1
- package/dist/cjs/{index-9d98aa56.js → index-1fda1524.js} +473 -275
- package/dist/cjs/{input-template-c8ceb3ff.js → input-template-8d591f62.js} +2 -2
- package/dist/cjs/{is-load-decorator-65755a67.js → is-load-decorator-77664890.js} +1 -1
- package/dist/cjs/{json-parse-decarator-4d8d8097.js → json-parse-decarator-f014cca6.js} +2 -2
- package/dist/cjs/{label-template-1ed6a569.js → label-template-38d5c382.js} +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{number-helper-2253d3ad.js → number-helper-54c0c852.js} +1 -1
- package/dist/cjs/old-bcm-popover-box.cjs.entry.js +10 -4
- package/dist/cjs/old-bcm-popover.cjs.entry.js +6 -7
- package/dist/cjs/{slot-template-2ff0d22a.js → slot-template-84d37599.js} +1 -1
- package/dist/cjs/{stepper-states-c4dbafba.js → stepper-states-b5763eec.js} +2 -2
- package/dist/cjs/{tooltip-helper-88c00766.js → tooltip-helper-932f081b.js} +3 -3
- package/dist/cjs/{validators-e5907199.js → validators-40884433.js} +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/atoms/avatar/avatar.js +197 -184
- package/dist/collection/components/atoms/badge/badge.js +174 -164
- package/dist/collection/components/atoms/box/box.js +8 -5
- package/dist/collection/components/atoms/button/button.js +392 -373
- package/dist/collection/components/atoms/chip/chip.js +143 -133
- package/dist/collection/components/atoms/divider/divider.js +61 -53
- package/dist/collection/components/atoms/icon/icon.js +57 -47
- package/dist/collection/components/atoms/label/label.js +192 -182
- package/dist/collection/components/atoms/link/link.js +138 -127
- package/dist/collection/components/atoms/tag/tag.js +286 -273
- package/dist/collection/components/atoms/typography/typography.js +8 -5
- package/dist/collection/components/molecules/accordion/accordion.js +72 -61
- package/dist/collection/components/molecules/alert/alert.js +218 -217
- package/dist/collection/components/molecules/breadcrumb/breadcrumb.js +110 -104
- package/dist/collection/components/molecules/breadcrumb/types.js +0 -4
- package/dist/collection/components/molecules/button-group/button-group.js +159 -144
- package/dist/collection/components/molecules/card/card.js +83 -73
- package/dist/collection/components/molecules/checkbox/checkbox-lite.js +175 -176
- package/dist/collection/components/molecules/checkbox/checkbox.js +536 -524
- package/dist/collection/components/molecules/checkbox/group.js +589 -571
- package/dist/collection/components/molecules/drawer/drawer.js +193 -189
- package/dist/collection/components/molecules/dropdown/dropdown.js +654 -639
- package/dist/collection/components/molecules/empty/empty.js +32 -26
- package/dist/collection/components/molecules/error-layout/error-layout.js +126 -111
- package/dist/collection/components/molecules/error-layout/types.js +0 -4
- package/dist/collection/components/molecules/expansion-panel/expansion-panel.js +212 -212
- package/dist/collection/components/molecules/input/input.js +891 -857
- package/dist/collection/components/molecules/item/item.js +95 -85
- package/dist/collection/components/molecules/items/items.js +46 -38
- package/dist/collection/components/molecules/linked/linked.js +250 -239
- package/dist/collection/components/molecules/menu/menu.js +426 -420
- package/dist/collection/components/molecules/message/message.js +149 -144
- package/dist/collection/components/molecules/modal/modal.js +261 -252
- package/dist/collection/components/molecules/notification/notification.js +167 -161
- package/dist/collection/components/molecules/popconfirm/popconfirm-box.js +299 -285
- package/dist/collection/components/molecules/popconfirm/popconfirm.js +293 -277
- package/dist/collection/components/molecules/popover/popover.js +190 -181
- package/dist/collection/components/molecules/progress/progress.js +255 -262
- package/dist/collection/components/molecules/radio/group.js +516 -494
- package/dist/collection/components/molecules/radio/radio.js +212 -207
- package/dist/collection/components/molecules/range/range.js +289 -285
- package/dist/collection/components/molecules/result/result.js +104 -97
- package/dist/collection/components/molecules/search/search.js +308 -295
- package/dist/collection/components/molecules/skeleton/skeleton.js +47 -52
- package/dist/collection/components/molecules/stepper/step.js +281 -271
- package/dist/collection/components/molecules/stepper/stepper.js +309 -300
- package/dist/collection/components/molecules/switch/switch.js +598 -583
- package/dist/collection/components/molecules/tab-group/tab-group.js +126 -120
- package/dist/collection/components/molecules/textarea/textarea.js +622 -597
- package/dist/collection/components/molecules/timeline/timeline-item.js +125 -120
- package/dist/collection/components/molecules/timeline/timeline.js +79 -71
- package/dist/collection/components/molecules/tooltip/tooltip.js +173 -164
- package/dist/collection/components/organism/autocomplete/autocomplete.js +260 -247
- package/dist/collection/components/organism/colorpicker/colorpicker.js +360 -368
- package/dist/collection/components/organism/date-picker/date-picker.js +626 -604
- package/dist/collection/components/organism/datetime-picker/datetime-picker.js +750 -775
- package/dist/collection/components/organism/form/form-group.js +108 -99
- package/dist/collection/components/organism/form/form.js +253 -238
- package/dist/collection/components/organism/form-2/form-2.js +164 -149
- package/dist/collection/components/organism/list/list.js +1133 -1128
- package/dist/collection/components/organism/time-picker/time-picker.js +502 -484
- package/dist/collection/components/other/attendance/attendance.js +60 -61
- package/dist/collection/components/other/data-table/table.js +40 -30
- package/dist/collection/components/other/default/default.js +40 -32
- package/dist/collection/components/other_deprecated/collapse/collapse.js +125 -119
- package/dist/collection/components/other_deprecated/collapse/group.js +90 -83
- package/dist/collection/components/other_deprecated/listbox/listbox-group.js +68 -68
- package/dist/collection/components/other_deprecated/listbox/listbox-item.js +500 -495
- package/dist/collection/components/other_deprecated/listbox/listbox.js +1067 -1071
- package/dist/collection/components/other_deprecated/old-input/old-input.js +786 -775
- package/dist/collection/components/other_deprecated/old-popover/old-popover-box.js +285 -267
- package/dist/collection/components/other_deprecated/old-popover/old-popover.js +214 -202
- package/dist/collection/components/other_deprecated/old-search/old-search.js +333 -314
- package/dist/collection/components/other_deprecated/old-tag/old-tag.js +247 -241
- package/dist/collection/components/other_deprecated/select/group.js +68 -67
- package/dist/collection/components/other_deprecated/select/option.js +120 -111
- package/dist/collection/components/other_deprecated/select/select-box.js +77 -71
- package/dist/collection/components/other_deprecated/select/select.js +1096 -1093
- package/dist/collection/components/other_deprecated/tabs/tab-pane.js +121 -111
- package/dist/collection/components/other_deprecated/tabs/tab.js +229 -226
- package/dist/collection/components/other_deprecated/tabs/tabs-content.js +108 -98
- package/dist/collection/components/other_deprecated/tabs/tabs.js +423 -411
- package/dist/collection/components/other_deprecated/text/text.js +125 -117
- package/dist/collection/components/other_deprecated/treeview/treeview-group.js +11 -7
- package/dist/collection/components/other_deprecated/treeview/treeview-item.js +651 -646
- package/dist/collection/components/other_deprecated/treeview/treeview.js +882 -874
- package/dist/collection/index.js +0 -4
- package/dist/collection/models/bcm-types.js +0 -4
- package/dist/collection/models/states/atoms/bcm-atoms-state.js +0 -4
- package/dist/collection/models/states/molecules/bcm-molecules-state.js +0 -4
- package/dist/collection/models/states/organisms/bcm-organisms-state.js +0 -4
- package/dist/collection/templates/button-template.js +1 -12
- package/dist/collection/templates/caption-template.js +3 -14
- package/dist/collection/templates/checkbox-template.js +1 -5
- package/dist/collection/templates/info-footer-template.js +1 -6
- package/dist/collection/templates/input-template.js +8 -29
- package/dist/collection/templates/label-template.js +1 -5
- package/dist/collection/templates/list-item-template.js +2 -9
- package/dist/collection/templates/list-template.js +1 -14
- package/dist/collection/templates/slot-template.js +1 -2
- package/dist/collection/templates/step-template.js +1 -5
- package/dist/collection/templates/tag-template.js +1 -10
- package/dist/collection/types/index.js +0 -4
- package/dist/components/avatar.js +5 -0
- package/dist/components/badge.js +4 -0
- package/dist/components/bcm-alert.js +3 -4
- package/dist/components/bcm-attendance.js +0 -4
- package/dist/components/bcm-autocomplete.js +1 -0
- package/dist/components/bcm-breadcrumb.js +1 -0
- package/dist/components/bcm-button-group.js +2 -0
- package/dist/components/bcm-card.js +3 -1
- package/dist/components/bcm-checkbox-group.js +6 -0
- package/dist/components/bcm-chip.js +4 -0
- package/dist/components/bcm-colorpicker.js +6 -7
- package/dist/components/bcm-date-picker.js +7 -0
- package/dist/components/bcm-drawer.js +1 -4
- package/dist/components/bcm-dropdown.js +9 -3
- package/dist/components/bcm-expansion-panel.js +1 -0
- package/dist/components/bcm-form-2.js +2 -2
- package/dist/components/bcm-form-group.js +1 -0
- package/dist/components/bcm-form.js +1 -0
- package/dist/components/bcm-input.js +22 -5
- package/dist/components/bcm-item.js +1 -0
- package/dist/components/bcm-linked.js +2 -0
- package/dist/components/bcm-list.js +15 -12
- package/dist/components/bcm-message.js +0 -3
- package/dist/components/bcm-modal.js +2 -0
- package/dist/components/bcm-notification.js +2 -0
- package/dist/components/bcm-popconfirm.js +1 -0
- package/dist/components/bcm-radio-group.js +9 -0
- package/dist/components/bcm-range.js +6 -0
- package/dist/components/bcm-result.js +4 -0
- package/dist/components/bcm-select-group.js +1 -0
- package/dist/components/bcm-select-option.js +3 -0
- package/dist/components/bcm-select.js +22 -11
- package/dist/components/bcm-stepper.js +0 -4
- package/dist/components/bcm-switch.js +11 -1
- package/dist/components/bcm-tab-group.js +1 -1
- package/dist/components/bcm-tab.js +0 -3
- package/dist/components/bcm-tabs.js +0 -6
- package/dist/components/bcm-tag.js +3 -0
- package/dist/components/bcm-textarea.js +11 -1
- package/dist/components/bcm-time-picker.js +7 -0
- package/dist/components/bcm-timeline-item.js +1 -3
- package/dist/components/bcm-timeline.js +1 -3
- package/dist/components/button.js +6 -0
- package/dist/components/checkbox.js +6 -4
- package/dist/components/datetime-picker.js +9 -6
- package/dist/components/empty.js +1 -0
- package/dist/components/generate.js +1 -1
- package/dist/components/icon.js +1 -0
- package/dist/components/label.js +4 -1
- package/dist/components/link.js +3 -0
- package/dist/components/listbox-group.js +1 -0
- package/dist/components/listbox-item.js +7 -0
- package/dist/components/listbox.js +16 -9
- package/dist/components/menu.js +2 -4
- package/dist/components/old-bcm-popover.js +3 -4
- package/dist/components/old-input.js +14 -1
- package/dist/components/old-popover-box.js +6 -0
- package/dist/components/old-tag.js +2 -0
- package/dist/components/popconfirm-box.js +5 -0
- package/dist/components/radio.js +3 -2
- package/dist/components/search.js +4 -8
- package/dist/components/step.js +5 -4
- package/dist/components/text.js +2 -0
- package/dist/components/treeview-item.js +5 -1
- package/dist/components/treeview.js +7 -4
- package/dist/esm/bcm-accordion.entry.js +3 -3
- package/dist/esm/bcm-alert.entry.js +7 -8
- package/dist/esm/bcm-attendance.entry.js +3 -7
- package/dist/esm/bcm-autocomplete.entry.js +3 -2
- package/dist/esm/bcm-avatar_2.entry.js +15 -6
- package/dist/esm/bcm-box.entry.js +2 -2
- package/dist/esm/bcm-breadcrumb.entry.js +4 -3
- package/dist/esm/bcm-button-group.entry.js +5 -3
- package/dist/esm/bcm-button_3.entry.js +14 -5
- package/dist/esm/bcm-card.entry.js +7 -5
- package/dist/esm/bcm-checkbox-group.entry.js +12 -6
- package/dist/esm/bcm-checkbox-lite_9.entry.js +40 -17
- package/dist/esm/bcm-checkbox_2.entry.js +11 -9
- package/dist/esm/bcm-chip.entry.js +7 -3
- package/dist/esm/bcm-collapse-group.entry.js +2 -2
- package/dist/esm/bcm-collapse.entry.js +3 -3
- package/dist/esm/bcm-colorpicker.entry.js +8 -9
- package/dist/esm/bcm-date-picker.entry.js +10 -3
- package/dist/esm/bcm-datetime-picker.entry.js +14 -11
- package/dist/esm/bcm-default.entry.js +3 -3
- package/dist/esm/bcm-drawer.entry.js +6 -9
- package/dist/esm/bcm-dropdown.entry.js +13 -7
- package/dist/esm/bcm-error-layout.entry.js +2 -2
- package/dist/esm/bcm-expansion-panel.entry.js +4 -3
- package/dist/esm/bcm-form-2.entry.js +5 -5
- package/dist/esm/bcm-form-group.entry.js +3 -2
- package/dist/esm/bcm-form.entry.js +3 -2
- package/dist/esm/bcm-input.entry.js +29 -12
- package/dist/esm/bcm-item.entry.js +4 -3
- package/dist/esm/bcm-items.entry.js +3 -3
- package/dist/esm/bcm-label_2.entry.js +12 -9
- package/dist/esm/bcm-link.entry.js +5 -2
- package/dist/esm/bcm-linked.entry.js +7 -5
- package/dist/esm/bcm-list.entry.js +26 -23
- package/dist/esm/bcm-menu.entry.js +8 -10
- package/dist/esm/bcm-message.entry.js +2 -5
- package/dist/esm/bcm-notification.entry.js +4 -2
- package/dist/esm/bcm-old-input.entry.js +17 -4
- package/dist/esm/bcm-old-tag_2.entry.js +4 -2
- package/dist/esm/bcm-popconfirm-box.entry.js +8 -3
- package/dist/esm/bcm-popconfirm.entry.js +4 -3
- package/dist/esm/bcm-popover.entry.js +5 -5
- package/dist/esm/bcm-progress.entry.js +3 -3
- package/dist/esm/bcm-radio-group.entry.js +14 -5
- package/dist/esm/bcm-radio.entry.js +7 -6
- package/dist/esm/bcm-range.entry.js +9 -3
- package/dist/esm/bcm-result.entry.js +6 -2
- package/dist/esm/bcm-search.entry.js +9 -13
- package/dist/esm/bcm-select-group.entry.js +2 -1
- package/dist/esm/bcm-select-option.entry.js +4 -1
- package/dist/esm/bcm-select.entry.js +24 -13
- package/dist/esm/bcm-skeleton.entry.js +3 -3
- package/dist/esm/bcm-step.entry.js +10 -9
- package/dist/esm/bcm-stepper.entry.js +5 -9
- package/dist/esm/bcm-switch.entry.js +15 -5
- package/dist/esm/bcm-tab-group.entry.js +4 -4
- package/dist/esm/bcm-tab-pane.entry.js +2 -2
- package/dist/esm/bcm-tab.entry.js +2 -5
- package/dist/esm/bcm-table.entry.js +2 -2
- package/dist/esm/bcm-tabs-content.entry.js +2 -2
- package/dist/esm/bcm-tabs.entry.js +2 -8
- package/dist/esm/bcm-tag.entry.js +7 -4
- package/dist/esm/bcm-text.entry.js +5 -3
- package/dist/esm/bcm-textarea.entry.js +16 -6
- package/dist/esm/bcm-time-picker.entry.js +10 -3
- package/dist/esm/bcm-timeline-item.entry.js +3 -5
- package/dist/esm/bcm-timeline.entry.js +3 -5
- package/dist/esm/bcm-treeview-group.entry.js +1 -1
- package/dist/esm/bromcom-ui.js +2 -2
- package/dist/esm/{caption-template-d54ee0c3.js → caption-template-e7d51661.js} +1 -1
- package/dist/esm/{generate-a7f3d168.js → generate-ba9e1f0b.js} +1 -1
- package/dist/esm/{index-2a3eeccc.js → index-58077b32.js} +473 -275
- package/dist/esm/{index-6e950253.js → index-6bdec00d.js} +1 -1
- package/dist/esm/{input-template-928c8d17.js → input-template-569671e3.js} +2 -2
- package/dist/esm/{is-load-decorator-b990575a.js → is-load-decorator-d57b8f9e.js} +1 -1
- package/dist/esm/{json-parse-decarator-58394179.js → json-parse-decarator-ae9a53d6.js} +2 -2
- package/dist/esm/{label-template-e3eebfbc.js → label-template-f352ef5b.js} +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{number-helper-f3b67bd2.js → number-helper-4313dc1c.js} +1 -1
- package/dist/esm/old-bcm-popover-box.entry.js +10 -4
- package/dist/esm/old-bcm-popover.entry.js +6 -7
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/{slot-template-877c4e01.js → slot-template-aee2ff75.js} +1 -1
- package/dist/esm/{stepper-states-e2489128.js → stepper-states-13781383.js} +2 -2
- package/dist/esm/{tooltip-helper-99202557.js → tooltip-helper-8c88ed15.js} +3 -3
- package/dist/esm/{validators-0f31a959.js → validators-66dd02d3.js} +1 -1
- package/dist/types/stencil-public-runtime.d.ts +20 -4
- package/loader/package.json +1 -0
- package/package.json +1 -1
- package/dist/bromcom-ui/p-0031ea84.entry.js +0 -5
- package/dist/bromcom-ui/p-00fb02e5.entry.js +0 -5
- package/dist/bromcom-ui/p-02892da0.entry.js +0 -5
- package/dist/bromcom-ui/p-046bc94c.entry.js +0 -5
- package/dist/bromcom-ui/p-0594c485.entry.js +0 -5
- package/dist/bromcom-ui/p-0ae411fe.entry.js +0 -5
- package/dist/bromcom-ui/p-0d37438e.entry.js +0 -5
- package/dist/bromcom-ui/p-10caf4ce.js +0 -6
- package/dist/bromcom-ui/p-12e845fb.entry.js +0 -5
- package/dist/bromcom-ui/p-1507f99a.entry.js +0 -5
- package/dist/bromcom-ui/p-1808adae.entry.js +0 -5
- package/dist/bromcom-ui/p-23de3629.entry.js +0 -5
- package/dist/bromcom-ui/p-2b91dab0.entry.js +0 -5
- package/dist/bromcom-ui/p-2cfa8d1a.js +0 -5
- package/dist/bromcom-ui/p-3057e85a.entry.js +0 -5
- package/dist/bromcom-ui/p-34c2069d.entry.js +0 -5
- package/dist/bromcom-ui/p-35be5c95.entry.js +0 -5
- package/dist/bromcom-ui/p-3b581c7d.entry.js +0 -5
- package/dist/bromcom-ui/p-3bcefb6e.entry.js +0 -5
- package/dist/bromcom-ui/p-3ee2e4fe.entry.js +0 -5
- package/dist/bromcom-ui/p-41cbecc7.entry.js +0 -5
- package/dist/bromcom-ui/p-42197730.entry.js +0 -5
- package/dist/bromcom-ui/p-4533663c.entry.js +0 -5
- package/dist/bromcom-ui/p-4be4c5bf.js +0 -5
- package/dist/bromcom-ui/p-4caf9f93.js +0 -5
- package/dist/bromcom-ui/p-4dbbb202.entry.js +0 -5
- package/dist/bromcom-ui/p-522c96a2.js +0 -5
- package/dist/bromcom-ui/p-5273d935.entry.js +0 -5
- package/dist/bromcom-ui/p-52ffb8e1.js +0 -5
- package/dist/bromcom-ui/p-5ad079a6.entry.js +0 -5
- package/dist/bromcom-ui/p-640244fa.entry.js +0 -5
- package/dist/bromcom-ui/p-6ad01d01.entry.js +0 -5
- package/dist/bromcom-ui/p-6c7eb43f.entry.js +0 -5
- package/dist/bromcom-ui/p-6e89ceb2.entry.js +0 -5
- package/dist/bromcom-ui/p-70b13097.entry.js +0 -5
- package/dist/bromcom-ui/p-721534bd.entry.js +0 -5
- package/dist/bromcom-ui/p-7385899c.js +0 -5
- package/dist/bromcom-ui/p-751c94dd.entry.js +0 -5
- package/dist/bromcom-ui/p-799a5570.entry.js +0 -5
- package/dist/bromcom-ui/p-7d76a273.entry.js +0 -5
- package/dist/bromcom-ui/p-7f065a45.entry.js +0 -5
- package/dist/bromcom-ui/p-8907162c.entry.js +0 -5
- package/dist/bromcom-ui/p-92fa0a00.entry.js +0 -5
- package/dist/bromcom-ui/p-99a2cb36.entry.js +0 -5
- package/dist/bromcom-ui/p-9e2b4b55.entry.js +0 -5
- package/dist/bromcom-ui/p-9efe118a.entry.js +0 -5
- package/dist/bromcom-ui/p-a0042349.entry.js +0 -5
- package/dist/bromcom-ui/p-a1c849e7.js +0 -5
- package/dist/bromcom-ui/p-a628aed8.entry.js +0 -5
- package/dist/bromcom-ui/p-a98aecdf.entry.js +0 -5
- package/dist/bromcom-ui/p-ae327774.js +0 -5
- package/dist/bromcom-ui/p-b088a98d.entry.js +0 -5
- package/dist/bromcom-ui/p-b4cbf3bd.entry.js +0 -5
- package/dist/bromcom-ui/p-b9983e4b.entry.js +0 -5
- package/dist/bromcom-ui/p-be39c24b.entry.js +0 -5
- package/dist/bromcom-ui/p-bf30bf7f.entry.js +0 -5
- package/dist/bromcom-ui/p-c0e8c481.entry.js +0 -5
- package/dist/bromcom-ui/p-dbb106a4.entry.js +0 -5
- package/dist/bromcom-ui/p-e467d49f.entry.js +0 -5
- package/dist/bromcom-ui/p-e50f0098.entry.js +0 -5
- package/dist/bromcom-ui/p-ebb01d57.entry.js +0 -5
- package/dist/bromcom-ui/p-f4936482.entry.js +0 -5
- package/dist/bromcom-ui/p-fa42b2de.entry.js +0 -5
- package/dist/cjs/property-decorators-cb2155ed.js +0 -33
- package/dist/components/property-decorators.js +0 -31
- package/dist/esm/property-decorators-f3f1e7de.js +0 -31
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
const NAMESPACE = 'bromcom-ui';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
|
9
|
+
* Simon Friis Vindum (@paldepind)
|
|
10
|
+
* Licensed under the MIT License
|
|
11
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
12
|
+
*
|
|
13
|
+
* Modified for Stencil's renderer and slot projection
|
|
14
|
+
*/
|
|
7
15
|
let scopeId;
|
|
8
16
|
let contentRef;
|
|
9
17
|
let hostTagName;
|
|
@@ -13,65 +21,10 @@ let checkSlotRelocate = false;
|
|
|
13
21
|
let isSvgMode = false;
|
|
14
22
|
let renderingRef = null;
|
|
15
23
|
let queuePending = false;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
$flags$: 0,
|
|
20
|
-
$resourcesUrl$: '',
|
|
21
|
-
jmp: (h) => h(),
|
|
22
|
-
raf: (h) => requestAnimationFrame(h),
|
|
23
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
24
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
25
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
26
|
-
};
|
|
27
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
|
28
|
-
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
29
|
-
try {
|
|
30
|
-
new CSSStyleSheet();
|
|
31
|
-
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
32
|
-
}
|
|
33
|
-
catch (e) { }
|
|
34
|
-
return false;
|
|
35
|
-
})()
|
|
36
|
-
;
|
|
37
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
38
|
-
if (listeners) {
|
|
39
|
-
listeners.map(([flags, name, method]) => {
|
|
40
|
-
const target = getHostListenerTarget(elm, flags) ;
|
|
41
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
42
|
-
const opts = hostListenerOpts(flags);
|
|
43
|
-
plt.ael(target, name, handler, opts);
|
|
44
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
49
|
-
try {
|
|
50
|
-
{
|
|
51
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
52
|
-
// instance is ready, let's call it's member method for this event
|
|
53
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
consoleError(e);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
65
|
-
if (flags & 4 /* TargetDocument */)
|
|
66
|
-
return doc;
|
|
67
|
-
if (flags & 8 /* TargetWindow */)
|
|
68
|
-
return win;
|
|
69
|
-
return elm;
|
|
24
|
+
const getAssetPath = (path) => {
|
|
25
|
+
const assetUrl = new URL(path, plt.$resourcesUrl$);
|
|
26
|
+
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
|
70
27
|
};
|
|
71
|
-
// prettier-ignore
|
|
72
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
73
|
-
const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
|
|
74
|
-
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
75
28
|
const createTime = (fnName, tagName = '') => {
|
|
76
29
|
{
|
|
77
30
|
return () => {
|
|
@@ -86,76 +39,8 @@ const uniqueTime = (key, measureText) => {
|
|
|
86
39
|
};
|
|
87
40
|
}
|
|
88
41
|
};
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
let style = styles.get(scopeId);
|
|
92
|
-
if (supportsConstructableStylesheets && allowCS) {
|
|
93
|
-
style = (style || new CSSStyleSheet());
|
|
94
|
-
if (typeof style === 'string') {
|
|
95
|
-
style = cssText;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
style.replaceSync(cssText);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
style = cssText;
|
|
103
|
-
}
|
|
104
|
-
styles.set(scopeId, style);
|
|
105
|
-
};
|
|
106
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
107
|
-
let scopeId = getScopeId(cmpMeta);
|
|
108
|
-
const style = styles.get(scopeId);
|
|
109
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
110
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
111
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
112
|
-
if (style) {
|
|
113
|
-
if (typeof style === 'string') {
|
|
114
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
115
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
116
|
-
let styleElm;
|
|
117
|
-
if (!appliedStyles) {
|
|
118
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
119
|
-
}
|
|
120
|
-
if (!appliedStyles.has(scopeId)) {
|
|
121
|
-
{
|
|
122
|
-
{
|
|
123
|
-
styleElm = doc.createElement('style');
|
|
124
|
-
styleElm.innerHTML = style;
|
|
125
|
-
}
|
|
126
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
127
|
-
}
|
|
128
|
-
if (appliedStyles) {
|
|
129
|
-
appliedStyles.add(scopeId);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
134
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return scopeId;
|
|
138
|
-
};
|
|
139
|
-
const attachStyles = (hostRef) => {
|
|
140
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
141
|
-
const elm = hostRef.$hostElement$;
|
|
142
|
-
const flags = cmpMeta.$flags$;
|
|
143
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
144
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
145
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
146
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
147
|
-
// or this browser doesn't support native shadow dom
|
|
148
|
-
// and this host element was NOT created with SSR
|
|
149
|
-
// let's pick out the inner content for slot projection
|
|
150
|
-
// create a node to represent where the original
|
|
151
|
-
// content was first placed, which is useful later on
|
|
152
|
-
// DOM WRITE!!
|
|
153
|
-
elm['s-sc'] = scopeId;
|
|
154
|
-
elm.classList.add(scopeId + '-h');
|
|
155
|
-
}
|
|
156
|
-
endAttachStyles();
|
|
157
|
-
};
|
|
158
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
42
|
+
const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
|
|
43
|
+
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
159
44
|
/**
|
|
160
45
|
* Default style mode id
|
|
161
46
|
*/
|
|
@@ -304,6 +189,149 @@ const convertToPrivate = (node) => {
|
|
|
304
189
|
vnode.$name$ = node.vname;
|
|
305
190
|
return vnode;
|
|
306
191
|
};
|
|
192
|
+
/**
|
|
193
|
+
* Parse a new property value for a given property type.
|
|
194
|
+
*
|
|
195
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
196
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
197
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
198
|
+
* 2. the type stored from `propType`.
|
|
199
|
+
*
|
|
200
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
201
|
+
*
|
|
202
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
203
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
204
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
205
|
+
* ```tsx
|
|
206
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* HTML prop values on the other hand, will always a string
|
|
210
|
+
*
|
|
211
|
+
* @param propValue the new value to coerce to some type
|
|
212
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
213
|
+
* @returns the parsed/coerced value
|
|
214
|
+
*/
|
|
215
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
216
|
+
// ensure this value is of the correct prop type
|
|
217
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
218
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
219
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
220
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
221
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
222
|
+
}
|
|
223
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
224
|
+
// force it to be a number
|
|
225
|
+
return parseFloat(propValue);
|
|
226
|
+
}
|
|
227
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
228
|
+
// could have been passed as a number or boolean
|
|
229
|
+
// but we still want it as a string
|
|
230
|
+
return String(propValue);
|
|
231
|
+
}
|
|
232
|
+
// redundant return here for better minification
|
|
233
|
+
return propValue;
|
|
234
|
+
}
|
|
235
|
+
// not sure exactly what type we want
|
|
236
|
+
// so no need to change to a different type
|
|
237
|
+
return propValue;
|
|
238
|
+
};
|
|
239
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
240
|
+
const createEvent = (ref, name, flags) => {
|
|
241
|
+
const elm = getElement(ref);
|
|
242
|
+
return {
|
|
243
|
+
emit: (detail) => {
|
|
244
|
+
return emitEvent(elm, name, {
|
|
245
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
246
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
247
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
248
|
+
detail,
|
|
249
|
+
});
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
255
|
+
* @param elm the target of the Event
|
|
256
|
+
* @param name the name to give the custom Event
|
|
257
|
+
* @param opts options for configuring a custom Event
|
|
258
|
+
* @returns the custom Event
|
|
259
|
+
*/
|
|
260
|
+
const emitEvent = (elm, name, opts) => {
|
|
261
|
+
const ev = plt.ce(name, opts);
|
|
262
|
+
elm.dispatchEvent(ev);
|
|
263
|
+
return ev;
|
|
264
|
+
};
|
|
265
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
266
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
267
|
+
let style = styles.get(scopeId);
|
|
268
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
269
|
+
style = (style || new CSSStyleSheet());
|
|
270
|
+
if (typeof style === 'string') {
|
|
271
|
+
style = cssText;
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
style.replaceSync(cssText);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
style = cssText;
|
|
279
|
+
}
|
|
280
|
+
styles.set(scopeId, style);
|
|
281
|
+
};
|
|
282
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
283
|
+
let scopeId = getScopeId(cmpMeta);
|
|
284
|
+
const style = styles.get(scopeId);
|
|
285
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
286
|
+
// so the fallback is to always use the document for the root node in those cases
|
|
287
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
288
|
+
if (style) {
|
|
289
|
+
if (typeof style === 'string') {
|
|
290
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
291
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
292
|
+
let styleElm;
|
|
293
|
+
if (!appliedStyles) {
|
|
294
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
295
|
+
}
|
|
296
|
+
if (!appliedStyles.has(scopeId)) {
|
|
297
|
+
{
|
|
298
|
+
{
|
|
299
|
+
styleElm = doc.createElement('style');
|
|
300
|
+
styleElm.innerHTML = style;
|
|
301
|
+
}
|
|
302
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
303
|
+
}
|
|
304
|
+
if (appliedStyles) {
|
|
305
|
+
appliedStyles.add(scopeId);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
310
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return scopeId;
|
|
314
|
+
};
|
|
315
|
+
const attachStyles = (hostRef) => {
|
|
316
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
317
|
+
const elm = hostRef.$hostElement$;
|
|
318
|
+
const flags = cmpMeta.$flags$;
|
|
319
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
320
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
321
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
322
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
323
|
+
// or this browser doesn't support native shadow dom
|
|
324
|
+
// and this host element was NOT created with SSR
|
|
325
|
+
// let's pick out the inner content for slot projection
|
|
326
|
+
// create a node to represent where the original
|
|
327
|
+
// content was first placed, which is useful later on
|
|
328
|
+
// DOM WRITE!!
|
|
329
|
+
elm['s-sc'] = scopeId;
|
|
330
|
+
elm.classList.add(scopeId + '-h');
|
|
331
|
+
}
|
|
332
|
+
endAttachStyles();
|
|
333
|
+
};
|
|
334
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
307
335
|
/**
|
|
308
336
|
* Production setAccessor() function based on Preact by
|
|
309
337
|
* Jason Miller (@developit)
|
|
@@ -440,7 +468,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
440
468
|
}
|
|
441
469
|
}
|
|
442
470
|
}
|
|
443
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
471
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
444
472
|
newValue = newValue === true ? '' : newValue;
|
|
445
473
|
if (xlink) {
|
|
446
474
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
@@ -458,7 +486,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
458
486
|
// if the element passed in is a shadow root, which is a document fragment
|
|
459
487
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
460
488
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
461
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
489
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
462
490
|
? newVnode.$elm$.host
|
|
463
491
|
: newVnode.$elm$;
|
|
464
492
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -476,6 +504,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
476
504
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
477
505
|
}
|
|
478
506
|
};
|
|
507
|
+
/**
|
|
508
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
509
|
+
*
|
|
510
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
511
|
+
* @param newParentVNode the parent VNode from the current render
|
|
512
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
513
|
+
* children, for which we will create a new DOM node
|
|
514
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
515
|
+
* @returns the newly created node
|
|
516
|
+
*/
|
|
479
517
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
480
518
|
// tslint:disable-next-line: prefer-const
|
|
481
519
|
const newVNode = newParentVNode.$children$[childIndex];
|
|
@@ -493,16 +531,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
493
531
|
}
|
|
494
532
|
newVNode.$flags$ |= newVNode.$children$
|
|
495
533
|
? // slot element has fallback content
|
|
496
|
-
2 /* isSlotFallback */
|
|
534
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
497
535
|
: // slot element does not have fallback content
|
|
498
|
-
1 /* isSlotReference */;
|
|
536
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
499
537
|
}
|
|
500
538
|
}
|
|
501
539
|
if (newVNode.$text$ !== null) {
|
|
502
540
|
// create text node
|
|
503
541
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
504
542
|
}
|
|
505
|
-
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
543
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
506
544
|
// create a slot reference node
|
|
507
545
|
elm = newVNode.$elm$ =
|
|
508
546
|
doc.createTextNode('');
|
|
@@ -512,7 +550,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
512
550
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
513
551
|
}
|
|
514
552
|
// create element
|
|
515
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
|
|
553
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
516
554
|
? 'slot-fb'
|
|
517
555
|
: newVNode.$tag$)
|
|
518
556
|
);
|
|
@@ -552,7 +590,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
552
590
|
}
|
|
553
591
|
{
|
|
554
592
|
elm['s-hn'] = hostTagName;
|
|
555
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
593
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
556
594
|
// remember the content reference comment
|
|
557
595
|
elm['s-sr'] = true;
|
|
558
596
|
// remember the content reference comment
|
|
@@ -571,7 +609,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
571
609
|
return elm;
|
|
572
610
|
};
|
|
573
611
|
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
574
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
612
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
575
613
|
const oldSlotChildNodes = parentElm.childNodes;
|
|
576
614
|
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
577
615
|
const childNode = oldSlotChildNodes[i];
|
|
@@ -592,7 +630,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
592
630
|
putBackInOriginalLocation(childNode, recursive);
|
|
593
631
|
}
|
|
594
632
|
}
|
|
595
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
633
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
596
634
|
};
|
|
597
635
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
598
636
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
@@ -634,6 +672,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
634
672
|
}
|
|
635
673
|
}
|
|
636
674
|
};
|
|
675
|
+
/**
|
|
676
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
677
|
+
* traversing the two collections of children, identifying nodes that are
|
|
678
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
679
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
680
|
+
*
|
|
681
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
682
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
683
|
+
* 'windows' by storing start and end indices and references to the
|
|
684
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
685
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
686
|
+
* no children left to update by doing the following:
|
|
687
|
+
*
|
|
688
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
689
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
690
|
+
* only with a window bounded by the highlighted elements:
|
|
691
|
+
*
|
|
692
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
693
|
+
* ^^^^^^ ^^^^^^
|
|
694
|
+
*
|
|
695
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
696
|
+
* across the windows. This will basically detect elements which haven't
|
|
697
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
698
|
+
* VNode elements (represented as HTML):
|
|
699
|
+
*
|
|
700
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
701
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
702
|
+
*
|
|
703
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
704
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
705
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
706
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
707
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
708
|
+
*
|
|
709
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
710
|
+
* window corresponds to the element at the end of the other window. This is
|
|
711
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
712
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
713
|
+
* children nodes themselves have not changed but merely moved in the
|
|
714
|
+
* following example:
|
|
715
|
+
*
|
|
716
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
717
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
718
|
+
*
|
|
719
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
720
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
721
|
+
* DOM.
|
|
722
|
+
*
|
|
723
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
724
|
+
* nodes in the old children which have the same key as the first element in
|
|
725
|
+
* our window on the new children. If we find such a node we handle calling
|
|
726
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
727
|
+
* what we find.
|
|
728
|
+
*
|
|
729
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
730
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
731
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
732
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
733
|
+
* children has collapsed we still have more nodes on the new children that
|
|
734
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
735
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
736
|
+
* sure the corresponding DOM nodes are removed.
|
|
737
|
+
*
|
|
738
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
739
|
+
* @param oldCh the old children of the parent node
|
|
740
|
+
* @param newVNode the new VNode which will replace the parent
|
|
741
|
+
* @param newCh the new children of the parent node
|
|
742
|
+
*/
|
|
637
743
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
638
744
|
let oldStartIdx = 0;
|
|
639
745
|
let newStartIdx = 0;
|
|
@@ -649,7 +755,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
649
755
|
let elmToMove;
|
|
650
756
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
651
757
|
if (oldStartVnode == null) {
|
|
652
|
-
//
|
|
758
|
+
// VNode might have been moved left
|
|
653
759
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
654
760
|
}
|
|
655
761
|
else if (oldEndVnode == null) {
|
|
@@ -662,37 +768,100 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
662
768
|
newEndVnode = newCh[--newEndIdx];
|
|
663
769
|
}
|
|
664
770
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
771
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
772
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
773
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
774
|
+
// since things are matched up in order.
|
|
665
775
|
patch(oldStartVnode, newStartVnode);
|
|
666
776
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
667
777
|
newStartVnode = newCh[++newStartIdx];
|
|
668
778
|
}
|
|
669
779
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
780
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
781
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
782
|
+
// need to move any DOM Nodes.
|
|
670
783
|
patch(oldEndVnode, newEndVnode);
|
|
671
784
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
672
785
|
newEndVnode = newCh[--newEndIdx];
|
|
673
786
|
}
|
|
674
787
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
675
|
-
// Vnode moved right
|
|
788
|
+
// case: "Vnode moved right"
|
|
789
|
+
//
|
|
790
|
+
// We've found that the last node in our window on the new children is
|
|
791
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
792
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
793
|
+
// nodes:
|
|
794
|
+
//
|
|
795
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
796
|
+
// ^^^^^^^^^^^
|
|
797
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
798
|
+
// ^^^^^^^^^^^^^
|
|
799
|
+
//
|
|
800
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
801
|
+
// and move the DOM element for `oldStartVnode`.
|
|
676
802
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
677
803
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
678
804
|
}
|
|
679
805
|
patch(oldStartVnode, newEndVnode);
|
|
806
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
807
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
808
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
809
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
810
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
811
|
+
//
|
|
812
|
+
// <old-start-node />
|
|
813
|
+
// <some-intervening-node />
|
|
814
|
+
// <old-end-node />
|
|
815
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
816
|
+
// <next-sibling />
|
|
817
|
+
//
|
|
818
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
819
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
820
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
821
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
822
|
+
// append it to the children of the parent element.
|
|
680
823
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
681
824
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
682
825
|
newEndVnode = newCh[--newEndIdx];
|
|
683
826
|
}
|
|
684
827
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
685
|
-
// Vnode moved left
|
|
828
|
+
// case: "Vnode moved left"
|
|
829
|
+
//
|
|
830
|
+
// We've found that the first node in our window on the new children is
|
|
831
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
832
|
+
// Visually, this is the layout of these two nodes:
|
|
833
|
+
//
|
|
834
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
835
|
+
// ^^^^^^^^^^^^^
|
|
836
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
837
|
+
// ^^^^^^^^^^^
|
|
838
|
+
//
|
|
839
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
840
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
841
|
+
// children etc) but we also need to move the DOM node to which
|
|
842
|
+
// `oldEndVnode` corresponds.
|
|
686
843
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
687
844
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
688
845
|
}
|
|
689
846
|
patch(oldEndVnode, newStartVnode);
|
|
847
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
848
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
849
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
850
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
851
|
+
// future.
|
|
690
852
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
691
853
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
692
854
|
newStartVnode = newCh[++newStartIdx];
|
|
693
855
|
}
|
|
694
856
|
else {
|
|
695
|
-
//
|
|
857
|
+
// Here we do some checks to match up old and new nodes based on the
|
|
858
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
|
859
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
|
860
|
+
// component.
|
|
861
|
+
//
|
|
862
|
+
// First we check to see if there are any nodes in the array of old
|
|
863
|
+
// children which have the same key as the first node in the new
|
|
864
|
+
// children.
|
|
696
865
|
idxInOld = -1;
|
|
697
866
|
{
|
|
698
867
|
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
@@ -703,23 +872,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
703
872
|
}
|
|
704
873
|
}
|
|
705
874
|
if (idxInOld >= 0) {
|
|
875
|
+
// We found a node in the old children which matches up with the first
|
|
876
|
+
// node in the new children! So let's deal with that
|
|
706
877
|
elmToMove = oldCh[idxInOld];
|
|
707
878
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
879
|
+
// the tag doesn't match so we'll need a new DOM element
|
|
708
880
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
|
|
709
881
|
}
|
|
710
882
|
else {
|
|
711
883
|
patch(elmToMove, newStartVnode);
|
|
884
|
+
// invalidate the matching old node so that we won't try to update it
|
|
885
|
+
// again later on
|
|
712
886
|
oldCh[idxInOld] = undefined;
|
|
713
887
|
node = elmToMove.$elm$;
|
|
714
888
|
}
|
|
715
889
|
newStartVnode = newCh[++newStartIdx];
|
|
716
890
|
}
|
|
717
891
|
else {
|
|
718
|
-
//
|
|
892
|
+
// We either didn't find an element in the old children that matches
|
|
893
|
+
// the key of the first new child OR the build is not using `key`
|
|
894
|
+
// attributes at all. In either case we need to create a new element
|
|
895
|
+
// for the new node.
|
|
719
896
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
720
897
|
newStartVnode = newCh[++newStartIdx];
|
|
721
898
|
}
|
|
722
899
|
if (node) {
|
|
900
|
+
// if we created a new node then handle inserting it to the DOM
|
|
723
901
|
{
|
|
724
902
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
725
903
|
}
|
|
@@ -727,21 +905,43 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
727
905
|
}
|
|
728
906
|
}
|
|
729
907
|
if (oldStartIdx > oldEndIdx) {
|
|
908
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
730
909
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
731
910
|
}
|
|
732
911
|
else if (newStartIdx > newEndIdx) {
|
|
912
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
913
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
914
|
+
// relevant DOM nodes)
|
|
733
915
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
734
916
|
}
|
|
735
917
|
};
|
|
736
|
-
|
|
918
|
+
/**
|
|
919
|
+
* Compare two VNodes to determine if they are the same
|
|
920
|
+
*
|
|
921
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
922
|
+
* information set on the two VNodes and can be misleading under certain
|
|
923
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
924
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
925
|
+
* checking that they have the same tag.
|
|
926
|
+
*
|
|
927
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
928
|
+
* changing order within a `children` array or something along those lines then
|
|
929
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
930
|
+
*
|
|
931
|
+
* @param leftVNode the first VNode to check
|
|
932
|
+
* @param rightVNode the second VNode to check
|
|
933
|
+
* @returns whether they're equal or not
|
|
934
|
+
*/
|
|
935
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
737
936
|
// compare if two vnode to see if they're "technically" the same
|
|
738
937
|
// need to have the same element tag, and same key to be the same
|
|
739
|
-
if (
|
|
740
|
-
if (
|
|
741
|
-
return
|
|
938
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
939
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
940
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
742
941
|
}
|
|
942
|
+
// this will be set if components in the build have `key` attrs set on them
|
|
743
943
|
{
|
|
744
|
-
return
|
|
944
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
|
745
945
|
}
|
|
746
946
|
}
|
|
747
947
|
return false;
|
|
@@ -754,6 +954,14 @@ const referenceNode = (node) => {
|
|
|
754
954
|
return (node && node['s-ol']) || node;
|
|
755
955
|
};
|
|
756
956
|
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
957
|
+
/**
|
|
958
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
959
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
960
|
+
* children of the two nodes (if any).
|
|
961
|
+
*
|
|
962
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
963
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
964
|
+
*/
|
|
757
965
|
const patch = (oldVNode, newVNode) => {
|
|
758
966
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
759
967
|
const oldChildren = oldVNode.$children$;
|
|
@@ -767,7 +975,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
767
975
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
768
976
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
769
977
|
}
|
|
770
|
-
// element node
|
|
771
978
|
{
|
|
772
979
|
if (tag === 'slot')
|
|
773
980
|
;
|
|
@@ -780,6 +987,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
780
987
|
}
|
|
781
988
|
if (oldChildren !== null && newChildren !== null) {
|
|
782
989
|
// looks like there's child vnodes for both the old and new vnodes
|
|
990
|
+
// so we need to call `updateChildren` to reconcile them
|
|
783
991
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
784
992
|
}
|
|
785
993
|
else if (newChildren !== null) {
|
|
@@ -820,7 +1028,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
820
1028
|
let nodeType;
|
|
821
1029
|
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
822
1030
|
childNode = childNodes[i];
|
|
823
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1031
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
824
1032
|
if (childNode['s-sr']) {
|
|
825
1033
|
// this is a slot fallback node
|
|
826
1034
|
// get the slot name for this slot reference node
|
|
@@ -832,7 +1040,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
832
1040
|
nodeType = childNodes[j].nodeType;
|
|
833
1041
|
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
834
1042
|
// this sibling node is from a different component OR is a named fallback slot node
|
|
835
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
1043
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
836
1044
|
childNode.hidden = true;
|
|
837
1045
|
break;
|
|
838
1046
|
}
|
|
@@ -841,8 +1049,8 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
841
1049
|
// this is a default fallback slot node
|
|
842
1050
|
// any element or text node (with content)
|
|
843
1051
|
// should hide the default fallback slot node
|
|
844
|
-
if (nodeType === 1 /* ElementNode */ ||
|
|
845
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
1052
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1053
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
846
1054
|
childNode.hidden = true;
|
|
847
1055
|
break;
|
|
848
1056
|
}
|
|
@@ -920,13 +1128,13 @@ const relocateSlotContent = (elm) => {
|
|
|
920
1128
|
}
|
|
921
1129
|
}
|
|
922
1130
|
}
|
|
923
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1131
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
924
1132
|
relocateSlotContent(childNode);
|
|
925
1133
|
}
|
|
926
1134
|
}
|
|
927
1135
|
};
|
|
928
1136
|
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
929
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1137
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
930
1138
|
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
931
1139
|
return true;
|
|
932
1140
|
}
|
|
@@ -957,7 +1165,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
957
1165
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
958
1166
|
}
|
|
959
1167
|
rootVnode.$tag$ = null;
|
|
960
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
1168
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
961
1169
|
hostRef.$vnode$ = rootVnode;
|
|
962
1170
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
963
1171
|
{
|
|
@@ -965,7 +1173,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
965
1173
|
}
|
|
966
1174
|
{
|
|
967
1175
|
contentRef = hostElm['s-cr'];
|
|
968
|
-
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
1176
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
969
1177
|
// always reset
|
|
970
1178
|
checkSlotFallbackVisibility = false;
|
|
971
1179
|
}
|
|
@@ -974,7 +1182,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
974
1182
|
{
|
|
975
1183
|
// while we're moving nodes around existing nodes, temporarily disable
|
|
976
1184
|
// the disconnectCallback from working
|
|
977
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1185
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
978
1186
|
if (checkSlotRelocate) {
|
|
979
1187
|
relocateSlotContent(rootVnode.$elm$);
|
|
980
1188
|
let relocateData;
|
|
@@ -1032,7 +1240,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1032
1240
|
}
|
|
1033
1241
|
else {
|
|
1034
1242
|
// this node doesn't have a slot home to go to, so let's hide it
|
|
1035
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1243
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1036
1244
|
nodeToRelocate.hidden = true;
|
|
1037
1245
|
}
|
|
1038
1246
|
}
|
|
@@ -1043,37 +1251,11 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1043
1251
|
}
|
|
1044
1252
|
// done moving nodes around
|
|
1045
1253
|
// allow the disconnect callback to work again
|
|
1046
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1254
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1047
1255
|
// always reset
|
|
1048
1256
|
relocateNodes.length = 0;
|
|
1049
1257
|
}
|
|
1050
1258
|
};
|
|
1051
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
1052
|
-
const createEvent = (ref, name, flags) => {
|
|
1053
|
-
const elm = getElement(ref);
|
|
1054
|
-
return {
|
|
1055
|
-
emit: (detail) => {
|
|
1056
|
-
return emitEvent(elm, name, {
|
|
1057
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
1058
|
-
composed: !!(flags & 2 /* Composed */),
|
|
1059
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
1060
|
-
detail,
|
|
1061
|
-
});
|
|
1062
|
-
},
|
|
1063
|
-
};
|
|
1064
|
-
};
|
|
1065
|
-
/**
|
|
1066
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
|
1067
|
-
* @param elm the target of the Event
|
|
1068
|
-
* @param name the name to give the custom Event
|
|
1069
|
-
* @param opts options for configuring a custom Event
|
|
1070
|
-
* @returns the custom Event
|
|
1071
|
-
*/
|
|
1072
|
-
const emitEvent = (elm, name, opts) => {
|
|
1073
|
-
const ev = plt.ce(name, opts);
|
|
1074
|
-
elm.dispatchEvent(ev);
|
|
1075
|
-
return ev;
|
|
1076
|
-
};
|
|
1077
1259
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1078
1260
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1079
1261
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
@@ -1081,10 +1263,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
1081
1263
|
};
|
|
1082
1264
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1083
1265
|
{
|
|
1084
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1266
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1085
1267
|
}
|
|
1086
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
1087
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1268
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1269
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
1088
1270
|
return;
|
|
1089
1271
|
}
|
|
1090
1272
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -1100,7 +1282,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1100
1282
|
let promise;
|
|
1101
1283
|
if (isInitialLoad) {
|
|
1102
1284
|
{
|
|
1103
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
1285
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
1104
1286
|
if (hostRef.$queuedListeners$) {
|
|
1105
1287
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1106
1288
|
hostRef.$queuedListeners$ = null;
|
|
@@ -1151,7 +1333,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1151
1333
|
}
|
|
1152
1334
|
else {
|
|
1153
1335
|
Promise.all(childrenPromises).then(postUpdate);
|
|
1154
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
1336
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
1155
1337
|
childrenPromises.length = 0;
|
|
1156
1338
|
}
|
|
1157
1339
|
}
|
|
@@ -1161,10 +1343,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
1161
1343
|
renderingRef = instance;
|
|
1162
1344
|
instance = instance.render() ;
|
|
1163
1345
|
{
|
|
1164
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1346
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1165
1347
|
}
|
|
1166
1348
|
{
|
|
1167
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1349
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
1168
1350
|
}
|
|
1169
1351
|
{
|
|
1170
1352
|
{
|
|
@@ -1193,8 +1375,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1193
1375
|
{
|
|
1194
1376
|
safeCall(instance, 'componentDidRender');
|
|
1195
1377
|
}
|
|
1196
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1197
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1378
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1379
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
1198
1380
|
{
|
|
1199
1381
|
// DOM WRITE!
|
|
1200
1382
|
addHydratedFlag(elm);
|
|
@@ -1226,10 +1408,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1226
1408
|
hostRef.$onRenderResolve$();
|
|
1227
1409
|
hostRef.$onRenderResolve$ = undefined;
|
|
1228
1410
|
}
|
|
1229
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
1411
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
1230
1412
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
1231
1413
|
}
|
|
1232
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
1414
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
1233
1415
|
}
|
|
1234
1416
|
// ( •_•)
|
|
1235
1417
|
// ( •_•)>⌐■-■
|
|
@@ -1240,7 +1422,7 @@ const forceUpdate = (ref) => {
|
|
|
1240
1422
|
const hostRef = getHostRef(ref);
|
|
1241
1423
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1242
1424
|
if (isConnected &&
|
|
1243
|
-
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1425
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1244
1426
|
scheduleUpdate(hostRef, false);
|
|
1245
1427
|
}
|
|
1246
1428
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -1271,53 +1453,6 @@ const then = (promise, thenFn) => {
|
|
|
1271
1453
|
};
|
|
1272
1454
|
const addHydratedFlag = (elm) => elm.setAttribute('hydrated', '')
|
|
1273
1455
|
;
|
|
1274
|
-
/**
|
|
1275
|
-
* Parse a new property value for a given property type.
|
|
1276
|
-
*
|
|
1277
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
1278
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
1279
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
|
1280
|
-
* 2. the type stored from `propType`.
|
|
1281
|
-
*
|
|
1282
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
1283
|
-
*
|
|
1284
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
1285
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
1286
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
1287
|
-
* ```tsx
|
|
1288
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
1289
|
-
* ```
|
|
1290
|
-
*
|
|
1291
|
-
* HTML prop values on the other hand, will always a string
|
|
1292
|
-
*
|
|
1293
|
-
* @param propValue the new value to coerce to some type
|
|
1294
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
1295
|
-
* @returns the parsed/coerced value
|
|
1296
|
-
*/
|
|
1297
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
1298
|
-
// ensure this value is of the correct prop type
|
|
1299
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
1300
|
-
if (propType & 4 /* Boolean */) {
|
|
1301
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
1302
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1303
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1304
|
-
}
|
|
1305
|
-
if (propType & 2 /* Number */) {
|
|
1306
|
-
// force it to be a number
|
|
1307
|
-
return parseFloat(propValue);
|
|
1308
|
-
}
|
|
1309
|
-
if (propType & 1 /* String */) {
|
|
1310
|
-
// could have been passed as a number or boolean
|
|
1311
|
-
// but we still want it as a string
|
|
1312
|
-
return String(propValue);
|
|
1313
|
-
}
|
|
1314
|
-
// redundant return here for better minification
|
|
1315
|
-
return propValue;
|
|
1316
|
-
}
|
|
1317
|
-
// not sure exactly what type we want
|
|
1318
|
-
// so no need to change to a different type
|
|
1319
|
-
return propValue;
|
|
1320
|
-
};
|
|
1321
1456
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1322
1457
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1323
1458
|
// check our new property value against our internal value
|
|
@@ -1330,13 +1465,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1330
1465
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1331
1466
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1332
1467
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1333
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1468
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1334
1469
|
// gadzooks! the property's value has changed!!
|
|
1335
1470
|
// set our new value!
|
|
1336
1471
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1337
1472
|
if (instance) {
|
|
1338
1473
|
// get an array of method names of watch functions to call
|
|
1339
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1474
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
1340
1475
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1341
1476
|
if (watchMethods) {
|
|
1342
1477
|
// this instance is watching for when this property changed
|
|
@@ -1351,7 +1486,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1351
1486
|
});
|
|
1352
1487
|
}
|
|
1353
1488
|
}
|
|
1354
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1489
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1355
1490
|
if (instance.componentShouldUpdate) {
|
|
1356
1491
|
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
1357
1492
|
return;
|
|
@@ -1366,6 +1501,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1366
1501
|
}
|
|
1367
1502
|
}
|
|
1368
1503
|
};
|
|
1504
|
+
/**
|
|
1505
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
|
1506
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
1507
|
+
* decorators, callbacks for when attributes change, and so on.
|
|
1508
|
+
*
|
|
1509
|
+
* @param Cstr the constructor for a component that we need to process
|
|
1510
|
+
* @param cmpMeta metadata collected previously about the component
|
|
1511
|
+
* @param flags a number used to store a series of bit flags
|
|
1512
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
|
1513
|
+
*/
|
|
1369
1514
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1370
1515
|
if (cmpMeta.$members$) {
|
|
1371
1516
|
if (Cstr.watchers) {
|
|
@@ -1375,8 +1520,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1375
1520
|
const members = Object.entries(cmpMeta.$members$);
|
|
1376
1521
|
const prototype = Cstr.prototype;
|
|
1377
1522
|
members.map(([memberName, [memberFlags]]) => {
|
|
1378
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
1379
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1523
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1524
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1380
1525
|
// proxyComponent - prop
|
|
1381
1526
|
Object.defineProperty(prototype, memberName, {
|
|
1382
1527
|
get() {
|
|
@@ -1391,8 +1536,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1391
1536
|
enumerable: true,
|
|
1392
1537
|
});
|
|
1393
1538
|
}
|
|
1394
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
|
1395
|
-
memberFlags & 64 /* Method */) {
|
|
1539
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1540
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
1396
1541
|
// proxyComponent - method
|
|
1397
1542
|
Object.defineProperty(prototype, memberName, {
|
|
1398
1543
|
value(...args) {
|
|
@@ -1402,7 +1547,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1402
1547
|
});
|
|
1403
1548
|
}
|
|
1404
1549
|
});
|
|
1405
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
1550
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
1406
1551
|
const attrNameToPropName = new Map();
|
|
1407
1552
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1408
1553
|
plt.jmp(() => {
|
|
@@ -1458,11 +1603,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1458
1603
|
// create an array of attributes to observe
|
|
1459
1604
|
// and also create a map of html attribute name to js property name
|
|
1460
1605
|
Cstr.observedAttributes = members
|
|
1461
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1606
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
1462
1607
|
.map(([propName, m]) => {
|
|
1463
1608
|
const attrName = m[1] || propName;
|
|
1464
1609
|
attrNameToPropName.set(attrName, propName);
|
|
1465
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
1610
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
1466
1611
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1467
1612
|
}
|
|
1468
1613
|
return attrName;
|
|
@@ -1473,10 +1618,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1473
1618
|
};
|
|
1474
1619
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1475
1620
|
// initializeComponent
|
|
1476
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1621
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1477
1622
|
{
|
|
1478
1623
|
// we haven't initialized this element yet
|
|
1479
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1624
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1480
1625
|
// lazy loaded components
|
|
1481
1626
|
// request the component's implementation to be
|
|
1482
1627
|
// wired up with the host element
|
|
@@ -1494,7 +1639,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1494
1639
|
{
|
|
1495
1640
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1496
1641
|
}
|
|
1497
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1642
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
1498
1643
|
Cstr.isProxied = true;
|
|
1499
1644
|
}
|
|
1500
1645
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -1502,7 +1647,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1502
1647
|
// but let's keep track of when we start and stop
|
|
1503
1648
|
// so that the getters/setters don't incorrectly step on data
|
|
1504
1649
|
{
|
|
1505
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1650
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1506
1651
|
}
|
|
1507
1652
|
// construct the lazy-loaded component implementation
|
|
1508
1653
|
// passing the hostRef is very important during
|
|
@@ -1515,10 +1660,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1515
1660
|
consoleError(e);
|
|
1516
1661
|
}
|
|
1517
1662
|
{
|
|
1518
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1663
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1519
1664
|
}
|
|
1520
1665
|
{
|
|
1521
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1666
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1522
1667
|
}
|
|
1523
1668
|
endNewInstance();
|
|
1524
1669
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
@@ -1529,7 +1674,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1529
1674
|
const scopeId = getScopeId(cmpMeta);
|
|
1530
1675
|
if (!styles.has(scopeId)) {
|
|
1531
1676
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1532
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1677
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1533
1678
|
endRegisterStyles();
|
|
1534
1679
|
}
|
|
1535
1680
|
}
|
|
@@ -1556,19 +1701,19 @@ const fireConnectedCallback = (instance) => {
|
|
|
1556
1701
|
}
|
|
1557
1702
|
};
|
|
1558
1703
|
const connectedCallback = (elm) => {
|
|
1559
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1704
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1560
1705
|
const hostRef = getHostRef(elm);
|
|
1561
1706
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1562
1707
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1563
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1708
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1564
1709
|
// first time this component has connected
|
|
1565
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1710
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1566
1711
|
{
|
|
1567
1712
|
// initUpdate
|
|
1568
1713
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1569
1714
|
// in here to act as original content anchors as we move nodes around
|
|
1570
1715
|
// host element has been connected to the DOM
|
|
1571
|
-
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1716
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1572
1717
|
setContentReference(elm);
|
|
1573
1718
|
}
|
|
1574
1719
|
}
|
|
@@ -1591,7 +1736,7 @@ const connectedCallback = (elm) => {
|
|
|
1591
1736
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1592
1737
|
if (cmpMeta.$members$) {
|
|
1593
1738
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1594
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1739
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1595
1740
|
const value = elm[memberName];
|
|
1596
1741
|
delete elm[memberName];
|
|
1597
1742
|
elm[memberName] = value;
|
|
@@ -1625,7 +1770,7 @@ const setContentReference = (elm) => {
|
|
|
1625
1770
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1626
1771
|
};
|
|
1627
1772
|
const disconnectedCallback = (elm) => {
|
|
1628
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1773
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1629
1774
|
const hostRef = getHostRef(elm);
|
|
1630
1775
|
const instance = hostRef.$lazyInstance$ ;
|
|
1631
1776
|
{
|
|
@@ -1680,7 +1825,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1680
1825
|
super(self);
|
|
1681
1826
|
self = this;
|
|
1682
1827
|
registerHost(self, cmpMeta);
|
|
1683
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1828
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1684
1829
|
// this component is using shadow dom
|
|
1685
1830
|
// and this browser supports shadow dom
|
|
1686
1831
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1715,7 +1860,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1715
1860
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1716
1861
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1717
1862
|
cmpTags.push(tagName);
|
|
1718
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1863
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1719
1864
|
}
|
|
1720
1865
|
});
|
|
1721
1866
|
});
|
|
@@ -1737,11 +1882,43 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1737
1882
|
// Fallback appLoad event
|
|
1738
1883
|
endBootstrap();
|
|
1739
1884
|
};
|
|
1740
|
-
const
|
|
1741
|
-
|
|
1742
|
-
|
|
1885
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1886
|
+
if (listeners) {
|
|
1887
|
+
listeners.map(([flags, name, method]) => {
|
|
1888
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
1889
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
1890
|
+
const opts = hostListenerOpts(flags);
|
|
1891
|
+
plt.ael(target, name, handler, opts);
|
|
1892
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
};
|
|
1896
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
1897
|
+
try {
|
|
1898
|
+
{
|
|
1899
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
1900
|
+
// instance is ready, let's call it's member method for this event
|
|
1901
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
1902
|
+
}
|
|
1903
|
+
else {
|
|
1904
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
catch (e) {
|
|
1909
|
+
consoleError(e);
|
|
1910
|
+
}
|
|
1743
1911
|
};
|
|
1744
|
-
const
|
|
1912
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
1913
|
+
if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
|
1914
|
+
return doc;
|
|
1915
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
1916
|
+
return win;
|
|
1917
|
+
return elm;
|
|
1918
|
+
};
|
|
1919
|
+
// prettier-ignore
|
|
1920
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1921
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1745
1922
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1746
1923
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1747
1924
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1786,14 +1963,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1786
1963
|
return importedModule[exportName];
|
|
1787
1964
|
}, consoleError);
|
|
1788
1965
|
};
|
|
1789
|
-
const styles = new Map();
|
|
1966
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1967
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
1968
|
+
const doc = win.document || { head: {} };
|
|
1969
|
+
const plt = {
|
|
1970
|
+
$flags$: 0,
|
|
1971
|
+
$resourcesUrl$: '',
|
|
1972
|
+
jmp: (h) => h(),
|
|
1973
|
+
raf: (h) => requestAnimationFrame(h),
|
|
1974
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
1975
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
1976
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
1977
|
+
};
|
|
1978
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
|
1979
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
1980
|
+
try {
|
|
1981
|
+
new CSSStyleSheet();
|
|
1982
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
1983
|
+
}
|
|
1984
|
+
catch (e) { }
|
|
1985
|
+
return false;
|
|
1986
|
+
})()
|
|
1987
|
+
;
|
|
1790
1988
|
const queueDomReads = [];
|
|
1791
1989
|
const queueDomWrites = [];
|
|
1792
1990
|
const queueTask = (queue, write) => (cb) => {
|
|
1793
1991
|
queue.push(cb);
|
|
1794
1992
|
if (!queuePending) {
|
|
1795
1993
|
queuePending = true;
|
|
1796
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
1994
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1797
1995
|
nextTick(flush);
|
|
1798
1996
|
}
|
|
1799
1997
|
else {
|