@vonage/vivid 5.1.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion-item/definition.cjs +2 -1
- package/accordion-item/definition.js +2 -1
- package/alert/index.cjs +1 -1
- package/alert/index.js +1 -1
- package/audio-player/definition.cjs +41 -6
- package/audio-player/definition.js +41 -6
- package/audio-player/index.cjs +27 -25
- package/audio-player/index.js +88 -62
- package/badge/index.cjs +2 -2
- package/badge/index.js +4 -4
- package/banner/index.cjs +3 -3
- package/banner/index.js +6 -6
- package/breadcrumb-item/index.cjs +1 -1
- package/breadcrumb-item/index.js +1 -1
- package/bundled/affix.cjs +7 -7
- package/bundled/affix.js +5 -5
- package/bundled/anchored.cjs +1 -1
- package/bundled/anchored.js +6 -6
- package/bundled/attribute-binding-behaviour.cjs +1 -1
- package/bundled/attribute-binding-behaviour.js +15 -13
- package/bundled/base-color-picker.cjs +13 -0
- package/bundled/base-color-picker.js +194 -0
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +2 -2
- package/bundled/calendar-picker.template.cjs +1 -1
- package/bundled/calendar-picker.template.js +21 -21
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/children.cjs +1 -1
- package/bundled/children.js +28 -20
- package/bundled/definition.cjs +3 -3
- package/bundled/definition.js +38 -38
- package/bundled/definition10.cjs +72 -18
- package/bundled/definition10.js +351 -65
- package/bundled/definition11.cjs +19 -10
- package/bundled/definition11.js +66 -37
- package/bundled/definition12.cjs +10 -1
- package/bundled/definition12.js +38 -14
- package/bundled/definition13.cjs +1 -73
- package/bundled/definition13.js +15 -354
- package/bundled/definition15.cjs +1 -1
- package/bundled/definition15.js +1 -1
- package/bundled/definition16.cjs +2 -2
- package/bundled/definition16.js +8 -8
- package/bundled/definition17.cjs +7 -7
- package/bundled/definition17.js +17 -17
- package/bundled/definition19.cjs +17 -14
- package/bundled/definition19.js +85 -77
- package/bundled/definition2.cjs +9 -5
- package/bundled/definition2.js +21 -17
- package/bundled/definition22.cjs +9 -9
- package/bundled/definition22.js +31 -31
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- package/bundled/definition6.cjs +6 -6
- package/bundled/definition6.js +34 -31
- package/bundled/definition7.cjs +1 -1
- package/bundled/definition7.js +6 -6
- package/bundled/definition8.cjs +2 -2
- package/bundled/definition8.js +4 -4
- package/bundled/definition9.cjs +1 -1
- package/bundled/definition9.js +1 -1
- package/bundled/delegates-aria.cjs +1 -1
- package/bundled/delegates-aria.js +59 -46
- package/bundled/form-associated.cjs +1 -1
- package/bundled/form-associated.js +3 -3
- package/bundled/host-semantics.cjs +1 -1
- package/bundled/host-semantics.js +48 -34
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +43 -31
- package/bundled/mixins.cjs +18 -18
- package/bundled/mixins.js +99 -93
- package/bundled/normalize.cjs +1 -0
- package/bundled/normalize.js +7 -0
- package/bundled/picker-field.template.cjs +18 -13
- package/bundled/picker-field.template.js +45 -37
- package/bundled/ref.cjs +1 -1
- package/bundled/ref.js +8 -25
- package/bundled/repeat.cjs +1 -1
- package/bundled/repeat.js +459 -233
- package/bundled/slider.template.cjs +1 -1
- package/bundled/slider.template.js +2 -2
- package/bundled/slotted.cjs +1 -1
- package/bundled/slotted.js +62 -45
- package/bundled/text-field.cjs +1 -1
- package/bundled/text-field.js +1 -1
- package/bundled/time-selection-picker.template.cjs +1 -1
- package/bundled/time-selection-picker.template.js +5 -5
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +2126 -1172
- package/bundled/when.cjs +1 -1
- package/bundled/when.js +8 -7
- package/bundled/with-contextual-help.cjs +1 -1
- package/bundled/with-contextual-help.js +17 -7
- package/calendar/definition.cjs +1 -1
- package/calendar/definition.js +2 -2
- package/calendar/index.cjs +1 -1
- package/calendar/index.js +6 -6
- package/calendar-event/index.cjs +1 -1
- package/calendar-event/index.js +1 -1
- package/card/definition.cjs +10 -2
- package/card/definition.js +10 -2
- package/card/index.cjs +19 -11
- package/card/index.js +35 -27
- package/color-picker/definition.cjs +1079 -0
- package/color-picker/definition.js +1073 -0
- package/color-picker/index.cjs +127 -0
- package/color-picker/index.js +726 -0
- package/combobox/definition.cjs +13 -6
- package/combobox/definition.js +14 -7
- package/combobox/index.cjs +15 -11
- package/combobox/index.js +82 -75
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +1621 -325
- package/data-grid/definition.cjs +862 -27
- package/data-grid/definition.js +863 -28
- package/data-grid/index.cjs +25 -25
- package/data-grid/index.js +175 -168
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +2 -2
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +2 -2
- package/dial-pad/definition.cjs +55 -1
- package/dial-pad/definition.js +56 -2
- package/dial-pad/index.cjs +21 -18
- package/dial-pad/index.js +138 -104
- package/dialog/definition.cjs +4 -1
- package/dialog/definition.js +4 -1
- package/dialog/index.cjs +21 -18
- package/dialog/index.js +43 -40
- package/empty-state/definition.cjs +7 -2
- package/empty-state/definition.js +7 -2
- package/empty-state/index.cjs +10 -5
- package/empty-state/index.js +18 -13
- package/fab/index.cjs +2 -2
- package/fab/index.js +4 -4
- package/file-picker/definition.cjs +16 -7
- package/file-picker/definition.js +17 -8
- package/file-picker/index.cjs +12 -9
- package/file-picker/index.js +103 -93
- package/icon/definition.cjs +10 -6
- package/icon/definition.js +10 -6
- package/index.cjs +4 -0
- package/index.js +1 -0
- package/lib/accordion-item/accordion-item.d.ts +2 -2
- package/lib/action-group/action-group.d.ts +2 -2
- package/lib/alert/alert.d.ts +4 -4
- package/lib/audio-player/audio-player.d.ts +6 -2
- package/lib/avatar/avatar.d.ts +2 -2
- package/lib/badge/badge.d.ts +2 -2
- package/lib/banner/banner.d.ts +6 -6
- package/lib/breadcrumb/breadcrumb.d.ts +2 -2
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
- package/lib/button/button.d.ts +6 -6
- package/lib/button/button.template.d.ts +2 -1
- package/lib/calendar/calendar.d.ts +1 -1
- package/lib/calendar-event/calendar-event.d.ts +2 -2
- package/lib/card/card.d.ts +2 -2
- package/lib/checkbox/checkbox.d.ts +12 -12
- package/lib/color-picker/color-picker.d.ts +2420 -0
- package/lib/color-picker/color-picker.template.d.ts +3 -0
- package/lib/color-picker/definition.d.ts +4 -0
- package/lib/color-picker/locale.d.ts +9 -0
- package/lib/combobox/combobox.d.ts +495 -78
- package/lib/components.d.ts +1 -0
- package/lib/data-grid/data-grid-cell.d.ts +4 -4
- package/lib/data-grid/data-grid-row.d.ts +3 -4
- package/lib/data-grid/data-grid.d.ts +1 -2
- package/lib/date-picker/date-picker.d.ts +906 -894
- package/lib/date-range-picker/date-range-picker.d.ts +596 -590
- package/lib/date-time-picker/date-time-picker.d.ts +907 -895
- package/lib/dial-pad/dial-pad.d.ts +3 -2
- package/lib/dial-pad/dial-pad.template.d.ts +1 -1
- package/lib/dial-pad/locale.d.ts +1 -0
- package/lib/dialog/dialog.d.ts +4 -4
- package/lib/divider/divider.d.ts +2 -2
- package/lib/fab/fab.d.ts +2 -2
- package/lib/file-picker/file-picker.d.ts +495 -78
- package/lib/header/header.d.ts +2 -2
- package/lib/menu/menu.d.ts +5 -4
- package/lib/menu-item/menu-item.d.ts +4 -4
- package/lib/nav/nav.d.ts +2 -2
- package/lib/nav-disclosure/nav-disclosure.d.ts +4 -4
- package/lib/nav-item/nav-item.d.ts +4 -4
- package/lib/note/note.d.ts +2 -2
- package/lib/number-field/number-field.d.ts +19 -18
- package/lib/option/option.d.ts +4 -4
- package/lib/pagination/pagination.d.ts +2 -2
- package/lib/progress/progress.d.ts +2 -2
- package/lib/progress-ring/progress-ring.d.ts +2 -2
- package/lib/radio/radio.d.ts +6 -6
- package/lib/radio-group/radio-group.d.ts +2 -2
- package/lib/range-slider/range-slider.d.ts +6 -6
- package/lib/rich-text-editor/menubar/menubar.d.ts +2 -2
- package/lib/rich-text-editor/rich-text-editor.d.ts +2 -2
- package/lib/searchable-select/option-tag.d.ts +2 -2
- package/lib/searchable-select/searchable-select.d.ts +521 -104
- package/lib/select/select.d.ts +484 -67
- package/lib/selectable-box/selectable-box.d.ts +2 -2
- package/lib/simple-color-picker/locale.d.ts +0 -1
- package/lib/simple-color-picker/simple-color-picker.d.ts +47 -821
- package/lib/slider/slider.d.ts +6 -6
- package/lib/split-button/split-button.d.ts +6 -6
- package/lib/switch/switch.d.ts +4 -4
- package/lib/tab/tab.d.ts +6 -6
- package/lib/tab-panel/tab-panel.d.ts +2 -2
- package/lib/tag/tag.d.ts +6 -6
- package/lib/tag-group/tag-group.d.ts +2 -2
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/text-area/text-area.d.ts +17 -16
- package/lib/text-field/text-field.d.ts +19 -18
- package/lib/time-picker/time-picker.d.ts +579 -573
- package/lib/toggletip/toggletip.d.ts +4 -4
- package/lib/tooltip/tooltip.d.ts +2 -2
- package/lib/tree-item/tree-item.d.ts +4 -4
- package/lib/tree-view/tree-view.d.ts +2 -2
- package/lib/video-player/video-player.d.ts +2 -2
- package/locales/de-DE.cjs +15 -3
- package/locales/de-DE.js +15 -3
- package/locales/en-GB.cjs +15 -3
- package/locales/en-GB.js +15 -3
- package/locales/en-US.cjs +15 -3
- package/locales/en-US.js +15 -3
- package/locales/ja-JP.cjs +15 -3
- package/locales/ja-JP.js +15 -3
- package/locales/zh-CN.cjs +15 -3
- package/locales/zh-CN.js +15 -3
- package/menu/definition.cjs +8 -4
- package/menu/definition.js +9 -5
- package/note/index.cjs +2 -2
- package/note/index.js +4 -4
- package/number-field/definition.cjs +3 -3
- package/number-field/definition.js +4 -4
- package/number-field/index.cjs +8 -8
- package/number-field/index.js +41 -40
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +5 -5
- package/pagination/definition.cjs +2 -1
- package/pagination/definition.js +2 -1
- package/pagination/index.cjs +12 -12
- package/pagination/index.js +59 -59
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/radio/definition.cjs +9 -9
- package/radio/definition.js +10 -10
- package/radio-group/definition.cjs +2 -1
- package/radio-group/definition.js +2 -1
- package/radio-group/index.cjs +5 -5
- package/radio-group/index.js +80 -77
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/rich-text-editor/definition.cjs +1 -1
- package/rich-text-editor/definition.js +2 -2
- package/rich-text-editor/index.cjs +2 -2
- package/rich-text-editor/index.js +3 -3
- package/searchable-select/definition.cjs +30 -21
- package/searchable-select/definition.js +31 -22
- package/searchable-select/index.cjs +28 -25
- package/searchable-select/index.js +149 -140
- package/select/definition.cjs +15 -7
- package/select/definition.js +16 -8
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/selectable-box/index.cjs +3 -3
- package/selectable-box/index.js +20 -20
- package/shared/aria/aria-change-subscription.d.ts +0 -1
- package/shared/aria/aria-mixin.d.ts +2 -2
- package/shared/aria/delegate-aria-behavior.d.ts +5 -10
- package/shared/aria/delegates-aria.d.ts +3 -3
- package/shared/aria/host-semantics-behavior.d.ts +5 -8
- package/shared/aria/host-semantics.d.ts +3 -3
- package/shared/color-picker/base-color-picker.d.ts +436 -0
- package/shared/color-picker/index.d.ts +1 -0
- package/shared/color-picker/locale.d.ts +3 -0
- package/shared/color-picker/utils.d.ts +1 -0
- package/shared/deprecation/replaced-props.d.ts +317 -2
- package/shared/design-system/defineVividComponent.d.ts +2 -2
- package/shared/feedback/feedback-message.d.ts +2 -2
- package/shared/feedback/mixins.d.ts +4 -4
- package/shared/foundation/button/button.d.ts +4 -4
- package/shared/foundation/form-associated/form-associated.d.ts +4 -4
- package/shared/foundation/vivid-element/vivid-element.d.ts +335 -8
- package/shared/localization/Locale.d.ts +4 -0
- package/shared/patterns/affix.d.ts +4 -4
- package/shared/patterns/anchored.d.ts +4 -4
- package/shared/patterns/char-count/char-count.d.ts +2 -2
- package/shared/patterns/form-elements/form-element.d.ts +4 -4
- package/shared/patterns/form-elements/index.d.ts +1 -0
- package/shared/patterns/form-elements/with-contextual-help.d.ts +7 -6
- package/shared/patterns/form-elements/with-error-text.d.ts +6 -6
- package/shared/patterns/form-elements/with-success-text.d.ts +2 -2
- package/shared/patterns/linkable.d.ts +2 -2
- package/shared/patterns/localized.d.ts +2 -2
- package/shared/patterns/trapped-focus.d.ts +2 -2
- package/shared/picker-field/mixins/calendar-picker.d.ts +454 -451
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +454 -451
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +2 -2
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +600 -594
- package/shared/picker-field/mixins/single-date-picker.d.ts +746 -737
- package/shared/picker-field/mixins/single-value-picker.d.ts +451 -448
- package/shared/picker-field/mixins/time-selection-picker.d.ts +580 -574
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +579 -573
- package/shared/picker-field/picker-field.d.ts +495 -78
- package/shared/templating/attribute-binding-behaviour.d.ts +3 -4
- package/shared/templating/render-in-light-dom.d.ts +13 -12
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/simple-color-picker/definition.cjs +28 -215
- package/simple-color-picker/definition.js +29 -216
- package/simple-color-picker/index.cjs +9 -21
- package/simple-color-picker/index.js +71 -185
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.cjs +2 -2
- package/switch/index.js +4 -4
- package/tabs/definition.cjs +1 -1
- package/tabs/definition.js +2 -2
- package/tabs/index.cjs +2 -2
- package/tabs/index.js +16 -16
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/text-area/definition.cjs +1 -1
- package/text-area/definition.js +1 -1
- package/text-area/index.cjs +3 -3
- package/text-area/index.js +9 -9
- package/text-field/definition.cjs +3 -3
- package/text-field/definition.js +4 -4
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +2 -2
- package/toggletip/definition.cjs +1 -1
- package/toggletip/definition.js +2 -2
- package/tree-view/definition.cjs +1 -1
- package/tree-view/definition.js +2 -2
- package/tree-view/index.cjs +2 -2
- package/tree-view/index.js +6 -6
- package/unbundled/_commonjsHelpers.cjs +36 -0
- package/unbundled/_commonjsHelpers.js +32 -0
- package/unbundled/affix.cjs +1 -1
- package/unbundled/affix.js +1 -1
- package/unbundled/attribute-binding-behaviour.cjs +11 -10
- package/unbundled/attribute-binding-behaviour.js +11 -10
- package/unbundled/base-color-picker.cjs +278 -0
- package/unbundled/base-color-picker.js +275 -0
- package/unbundled/button.cjs +1 -1
- package/unbundled/button.js +2 -2
- package/unbundled/calendar-picker.template.cjs +3 -3
- package/unbundled/calendar-picker.template.js +4 -4
- package/unbundled/definition2.cjs +1 -1
- package/unbundled/definition2.js +2 -2
- package/unbundled/definition3.cjs +2 -1
- package/unbundled/definition3.js +2 -1
- package/unbundled/delegates-aria.cjs +67 -33
- package/unbundled/delegates-aria.js +69 -35
- package/unbundled/form-associated.cjs +2 -2
- package/unbundled/form-associated.js +3 -3
- package/unbundled/host-semantics.cjs +47 -22
- package/unbundled/host-semantics.js +48 -23
- package/unbundled/mixins.cjs +34 -27
- package/unbundled/mixins.js +35 -28
- package/unbundled/picker-field.template.cjs +13 -5
- package/unbundled/picker-field.template.js +14 -6
- package/unbundled/text-field.cjs +1 -1
- package/unbundled/text-field.js +1 -1
- package/unbundled/time-selection-picker.template.cjs +4 -4
- package/unbundled/time-selection-picker.template.js +5 -5
- package/unbundled/vivid-element.cjs +22 -15
- package/unbundled/vivid-element.js +23 -15
- package/unbundled/with-contextual-help.cjs +11 -0
- package/unbundled/with-contextual-help.js +11 -0
- package/video-player/definition.cjs +69007 -1
- package/video-player/definition.js +69007 -1
- package/video-player/index.cjs +35 -35
- package/video-player/index.js +1358 -1384
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/vivid.api.json +347 -69
package/bundled/repeat.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("./vivid-element.cjs");function v(i,e,t){return{index:i,removed:e,addedCount:t}}const I=0,$=1,y=2,O=3;function M(i,e,t,o,s,d){const c=d-s+1,f=t-e+1,n=new Array(c);let r,h;for(let l=0;l<c;++l)n[l]=new Array(f),n[l][0]=l;for(let l=0;l<f;++l)n[0][l]=l;for(let l=1;l<c;++l)for(let u=1;u<f;++u)i[e+u-1]===o[s+l-1]?n[l][u]=n[l-1][u-1]:(r=n[l-1][u]+1,h=n[l][u-1]+1,n[l][u]=r<h?r:h);return n}function Q(i){let e=i.length-1,t=i[0].length-1,o=i[e][t];const s=[];for(;e>0||t>0;){if(e===0){s.push(y),t--;continue}if(t===0){s.push(O),e--;continue}const d=i[e-1][t-1],c=i[e-1][t],f=i[e][t-1];let n;c<f?n=c<d?c:d:n=f<d?f:d,n===d?(d===o?s.push(I):(s.push($),o=d),e--,t--):n===c?(s.push(O),e--,o=c):(s.push(y),t--,o=f)}return s.reverse(),s}function k(i,e,t){for(let o=0;o<t;++o)if(i[o]!==e[o])return o;return t}function E(i,e,t){let o=i.length,s=e.length,d=0;for(;d<t&&i[--o]===e[--s];)d++;return d}function _(i,e,t,o){return e<t||o<i?-1:e===t||o===i?0:i<t?e<o?e-t:o-t:o<e?o-i:e-i}function j(i,e,t,o,s,d){let c=0,f=0;const n=Math.min(t-e,d-s);if(e===0&&s===0&&(c=k(i,o,n)),t===i.length&&d===o.length&&(f=E(i,o,n-c)),e+=c,s+=c,t-=f,d-=f,t-e===0&&d-s===0)return a.emptyArray;if(e===t){const m=v(e,[],0);for(;s<d;)m.removed.push(o[s++]);return[m]}else if(s===d)return[v(e,[],t-e)];const r=Q(M(i,e,t,o,s,d)),h=[];let l,u=e,p=s;for(let m=0;m<r.length;++m)switch(r[m]){case I:l!==void 0&&(h.push(l),l=void 0),u++,p++;break;case $:l===void 0&&(l=v(u,[],0)),l.addedCount++,u++,l.removed.push(o[p]),p++;break;case y:l===void 0&&(l=v(u,[],0)),l.addedCount++,u++;break;case O:l===void 0&&(l=v(u,[],0)),l.removed.push(o[p]),p++;break}return l!==void 0&&h.push(l),h}const B=Array.prototype.push;function q(i,e,t,o){const s=v(e,t,o);let d=!1,c=0;for(let f=0;f<i.length;f++){const n=i[f];if(n.index+=c,d)continue;const r=_(s.index,s.index+s.removed.length,n.index,n.index+n.addedCount);if(r>=0){i.splice(f,1),f--,c-=n.addedCount-n.removed.length,s.addedCount+=n.addedCount-r;const h=s.removed.length+n.removed.length-r;if(!s.addedCount&&!h)d=!0;else{let l=n.removed;if(s.index<n.index){const u=s.removed.slice(0,n.index-s.index);B.apply(u,l),l=u}if(s.index+s.removed.length>n.index+n.addedCount){const u=s.removed.slice(n.index+n.addedCount-s.index);B.apply(l,u)}s.removed=l,n.index<s.index&&(s.index=n.index)}}else if(s.index<n.index){d=!0,i.splice(f,0,s),f++;const h=s.addedCount-s.removed.length;n.index+=h,c+=h}}d||i.push(s)}function U(i){const e=[];for(let t=0,o=i.length;t<o;t++){const s=i[t];q(e,s.index,s.removed,s.addedCount)}return e}function W(i,e){let t=[];const o=U(e);for(let s=0,d=o.length;s<d;++s){const c=o[s];if(c.addedCount===1&&c.removed.length===1){c.removed[0]!==i[c.index]&&t.push(c);continue}t=t.concat(j(i,c.index,c.index+c.addedCount,c.removed,0,c.removed.length))}return t}let A=!1;function w(i,e){let t=i.index;const o=e.length;return t>o?t=o-i.addedCount:t<0&&(t=o+i.removed.length+t-i.addedCount),t<0&&(t=0),i.index=t,i}class F extends a.SubscriberSet{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,Reflect.defineProperty(e,"$fastController",{value:this,enumerable:!1})}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){this.splices===void 0?this.splices=[e]:this.splices.push(e),this.needsQueue&&(this.needsQueue=!1,a.DOM.queueUpdate(this))}reset(e){this.oldCollection=e,this.needsQueue&&(this.needsQueue=!1,a.DOM.queueUpdate(this))}flush(){const e=this.splices,t=this.oldCollection;if(e===void 0&&t===void 0)return;this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0;const o=t===void 0?W(this.source,e):j(this.source,0,this.source.length,t,0,t.length);this.notify(o)}}function H(){if(A)return;A=!0,a.Observable.setArrayObserverFactory(n=>new F(n));const i=Array.prototype;if(i.$fastPatch)return;Reflect.defineProperty(i,"$fastPatch",{value:1,enumerable:!1});const e=i.pop,t=i.push,o=i.reverse,s=i.shift,d=i.sort,c=i.splice,f=i.unshift;i.pop=function(){const n=this.length>0,r=e.apply(this,arguments),h=this.$fastController;return h!==void 0&&n&&h.addSplice(v(this.length,[r],0)),r},i.push=function(){const n=t.apply(this,arguments),r=this.$fastController;return r!==void 0&&r.addSplice(w(v(this.length-arguments.length,[],arguments.length),this)),n},i.reverse=function(){let n;const r=this.$fastController;r!==void 0&&(r.flush(),n=this.slice());const h=o.apply(this,arguments);return r!==void 0&&r.reset(n),h},i.shift=function(){const n=this.length>0,r=s.apply(this,arguments),h=this.$fastController;return h!==void 0&&n&&h.addSplice(v(0,[r],0)),r},i.sort=function(){let n;const r=this.$fastController;r!==void 0&&(r.flush(),n=this.slice());const h=d.apply(this,arguments);return r!==void 0&&r.reset(n),h},i.splice=function(){const n=c.apply(this,arguments),r=this.$fastController;return r!==void 0&&r.addSplice(w(v(+arguments[0],n,arguments.length>2?arguments.length-2:0),this)),n},i.unshift=function(){const n=f.apply(this,arguments),r=this.$fastController;return r!==void 0&&r.addSplice(w(v(0,[],arguments.length),this)),n}}const D=Object.freeze({positioning:!1,recycle:!0});function N(i,e,t,o){i.bind(e[t],o)}function z(i,e,t,o){const s=Object.create(o);s.index=t,s.length=e.length,i.bind(e[t],s)}class G{constructor(e,t,o,s,d,c){this.location=e,this.itemsBinding=t,this.templateBinding=s,this.options=c,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.originalContext=void 0,this.childContext=void 0,this.bindView=N,this.itemsBindingObserver=a.Observable.binding(t,this,o),this.templateBindingObserver=a.Observable.binding(s,this,d),c.positioning&&(this.bindView=z)}bind(e,t){this.source=e,this.originalContext=t,this.childContext=Object.create(t),this.childContext.parent=e,this.childContext.parentContext=this.originalContext,this.items=this.itemsBindingObserver.observe(e,this.originalContext),this.template=this.templateBindingObserver.observe(e,this.originalContext),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,this.itemsObserver!==null&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.disconnect(),this.templateBindingObserver.disconnect()}handleChange(e,t){e===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.originalContext),this.observeItems(),this.refreshAllViews()):e===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.originalContext),this.refreshAllViews(!0)):this.updateViews(t)}observeItems(e=!1){if(!this.items){this.items=a.emptyArray;return}const t=this.itemsObserver,o=this.itemsObserver=a.Observable.getNotifier(this.items),s=t!==o;s&&t!==null&&t.unsubscribe(this),(s||e)&&o.subscribe(this)}updateViews(e){const t=this.childContext,o=this.views,s=this.bindView,d=this.items,c=this.template,f=this.options.recycle,n=[];let r=0,h=0;for(let l=0,u=e.length;l<u;++l){const p=e[l],m=p.removed;let C=0,g=p.index;const R=g+p.addedCount,x=o.splice(p.index,m.length),T=h=n.length+x.length;for(;g<R;++g){const V=o[g],L=V?V.firstChild:this.location;let b;f&&h>0?(C<=T&&x.length>0?(b=x[C],C++):(b=n[r],r++),h--):b=c.create(),o.splice(g,0,b),s(b,d,g,t),b.insertBefore(L)}x[C]&&n.push(...x.slice(C))}for(let l=r,u=n.length;l<u;++l)n[l].dispose();if(this.options.positioning)for(let l=0,u=o.length;l<u;++l){const p=o[l].context;p.length=u,p.index=l}}refreshAllViews(e=!1){const t=this.items,o=this.childContext,s=this.template,d=this.location,c=this.bindView;let f=t.length,n=this.views,r=n.length;if((f===0||e||!this.options.recycle)&&(a.HTMLView.disposeContiguousBatch(n),r=0),r===0){this.views=n=new Array(f);for(let h=0;h<f;++h){const l=s.create();c(l,t,h,o),n[h]=l,l.insertBefore(d)}}else{let h=0;for(;h<f;++h)if(h<r){const u=n[h];c(u,t,h,o)}else{const u=s.create();c(u,t,h,o),n.push(u),u.insertBefore(d)}const l=n.splice(h,r-h);for(h=0,f=l.length;h<f;++h)l[h].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,o=e.length;t<o;++t)e[t].unbind()}}class P extends a.HTMLDirective{constructor(e,t,o){super(),this.itemsBinding=e,this.templateBinding=t,this.options=o,this.createPlaceholder=a.DOM.createBlockPlaceholder,H(),this.isItemsBindingVolatile=a.Observable.isVolatileBinding(e),this.isTemplateBindingVolatile=a.Observable.isVolatileBinding(t)}createBehavior(e){return new G(e,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function J(i,e,t=D){const o=typeof e=="function"?e:()=>e;return new P(i,o,Object.assign(Object.assign({},D),t))}exports.RepeatDirective=P;exports.repeat=J;
|
|
1
|
+
"use strict";const f=require("./vivid-element.cjs"),V=require("./normalize.cjs");class v{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}class S{constructor(e){this.sorted=e}}const T=Object.freeze({reset:1,splice:2,optimized:3}),j=new v(0,f.emptyArray,0);j.reset=!0;const _=[j];function H(i,e,t,s,o,n){const l=n-o+1,h=t-e+1,d=new Array(l);let a,c;for(let r=0;r<l;++r)d[r]=new Array(h),d[r][0]=r;for(let r=0;r<h;++r)d[0][r]=r;for(let r=1;r<l;++r)for(let u=1;u<h;++u)i[e+u-1]===s[o+r-1]?d[r][u]=d[r-1][u-1]:(a=d[r-1][u]+1,c=d[r][u-1]+1,d[r][u]=a<c?a:c);return d}function L(i){let e=i.length-1,t=i[0].length-1,s=i[e][t];const o=[];for(;e>0||t>0;){if(e===0){o.push(2),t--;continue}if(t===0){o.push(3),e--;continue}const n=i[e-1][t-1],l=i[e-1][t],h=i[e][t-1];let d;l<h?d=l<n?l:n:d=h<n?h:n,d===n?(n===s?o.push(0):(o.push(1),s=n),e--,t--):d===l?(o.push(3),e--,s=l):(o.push(2),t--,s=h)}return o.reverse()}function $(i,e,t){for(let s=0;s<t;++s)if(i[s]!==e[s])return s;return t}function E(i,e,t){let s=i.length,o=e.length,n=0;for(;n<t&&i[--s]===e[--o];)n++;return n}function q(i,e,t,s){return e<t||s<i?-1:e===t||s===i?0:i<t?e<s?e-t:s-t:s<e?s-i:e-i}function D(i,e,t,s,o,n){let l=0,h=0;const d=Math.min(t-e,n-o);if(e===0&&o===0&&(l=$(i,s,d)),t===i.length&&n===s.length&&(h=E(i,s,d-l)),e+=l,o+=l,t-=h,n-=h,t-e===0&&n-o===0)return f.emptyArray;if(e===t){const g=new v(e,[],0);for(;o<n;)g.removed.push(s[o++]);return[g]}else if(o===n)return[new v(e,[],t-e)];const a=L(H(i,e,t,s,o,n)),c=[];let r,u=e,p=o;for(let g=0;g<a.length;++g)switch(a[g]){case 0:r!==void 0&&(c.push(r),r=void 0),u++,p++;break;case 1:r===void 0&&(r=new v(u,[],0)),r.addedCount++,u++,r.removed.push(s[p]),p++;break;case 2:r===void 0&&(r=new v(u,[],0)),r.addedCount++,u++;break;case 3:r===void 0&&(r=new v(u,[],0)),r.removed.push(s[p]),p++;break}return r!==void 0&&c.push(r),c}function P(i,e){let t=!1,s=0;for(let o=0;o<e.length;o++){const n=e[o];if(n.index+=s,t)continue;const l=q(i.index,i.index+i.removed.length,n.index,n.index+n.addedCount);if(l>=0){e.splice(o,1),o--,s-=n.addedCount-n.removed.length,i.addedCount+=n.addedCount-l;const h=i.removed.length+n.removed.length-l;if(!i.addedCount&&!h)t=!0;else{let d=n.removed;if(i.index<n.index){const a=i.removed.slice(0,n.index-i.index);a.push(...d),d=a}if(i.index+i.removed.length>n.index+n.addedCount){const a=i.removed.slice(n.index+n.addedCount-i.index);d.push(...a)}i.removed=d,n.index<i.index&&(i.index=n.index)}}else if(i.index<n.index){t=!0,e.splice(o,0,i),o++;const h=i.addedCount-i.removed.length;n.index+=h,s+=h}}t||e.push(i)}function Q(i,e){let t=[];const s=[];for(let o=0,n=e.length;o<n;o++)P(e[o],s);for(let o=0,n=s.length;o<n;++o){const l=s[o];if(l.addedCount===1&&l.removed.length===1){l.removed[0]!==i[l.index]&&t.push(l);continue}t=t.concat(D(i,l.index,l.index+l.addedCount,l.removed,0,l.removed.length))}return t}let z=Object.freeze({support:T.optimized,normalize(i,e,t){return i===void 0?t===void 0?f.emptyArray:Q(e,t):_},pop(i,e,t,s){const o=i.length>0,n=t.apply(i,s);return o&&e.addSplice(new v(i.length,[n],0)),n},push(i,e,t,s){const o=t.apply(i,s);return e.addSplice(new v(i.length-s.length,[],s.length).adjustTo(i)),o},reverse(i,e,t,s){const o=t.apply(i,s);i.sorted++;const n=[];for(let l=i.length-1;l>=0;l--)n.push(l);return e.addSort(new S(n)),o},shift(i,e,t,s){const o=i.length>0,n=t.apply(i,s);return o&&e.addSplice(new v(0,[n],0)),n},sort(i,e,t,s){const o=new Map;for(let h=0,d=i.length;h<d;++h){const a=o.get(i[h])||[];o.set(i[h],[...a,h])}const n=t.apply(i,s);i.sorted++;const l=[];for(let h=0,d=i.length;h<d;++h){const a=o.get(i[h]);l.push(a[0]),o.set(i[h],a.splice(1))}return e.addSort(new S(l)),n},splice(i,e,t,s){const o=t.apply(i,s);return e.addSplice(new v(+s[0],o,s.length>2?s.length-2:0).adjustTo(i)),o},unshift(i,e,t,s){const o=t.apply(i,s);return e.addSplice(new v(0,[],s.length).adjustTo(i)),o}});function y(i,e,t,s=!0){Reflect.defineProperty(i,e,{value:t,enumerable:!1,writable:s})}class W extends f.SubscriberSet{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.sorts=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this._sortObserver=void 0,this.call=this.flush,y(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(e===void 0){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,f.Observable.notify(e,"length"))}},this.subscribe(e)}return e}get sortObserver(){let e=this._sortObserver;if(e===void 0){const t=this.subject;this._sortObserver=e={sorted:t.sorted,handleChange(){this.sorted!==t.sorted&&(this.sorted=t.sorted,f.Observable.notify(e,"sorted"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){this.splices===void 0?this.splices=[e]:this.splices.push(e),this.enqueue()}addSort(e){this.sorts===void 0?this.sorts=[e]:this.sorts.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.sorts,o=this.oldCollection;t===void 0&&o===void 0&&s===void 0||(this.needsQueue=!0,this.splices=void 0,this.sorts=void 0,this.oldCollection=void 0,s!==void 0?this.notify(s):this.notify(((e=this._strategy)!==null&&e!==void 0?e:z).normalize(o,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,f.Updates.enqueue(this))}}let B=!1;const F=Object.freeze({sorted:0,enable(){if(B)return;B=!0,f.Observable.setArrayObserverFactory(e=>new W(e));const i=Array.prototype;i.$fastPatch||(y(i,"$fastPatch",1),y(i,"sorted",0),[i.pop,i.push,i.reverse,i.shift,i.sort,i.splice,i.unshift].forEach(e=>{i[e.name]=function(...t){var s;const o=this.$fastController;return o===void 0?e.apply(this,t):((s=o.strategy)!==null&&s!==void 0?s:z)[e.name](this,o,e,t)}}))}}),N=Object.freeze({positioning:!1,recycle:!0});function U(i,e,t,s){i.context.parent=s.source,i.context.parentContext=s.context,i.bind(e[t])}function X(i,e,t,s){i.context.parent=s.source,i.context.parentContext=s.context,i.context.length=e.length,i.context.index=t,i.bind(e[t])}function M(i){return i.nodeType===Node.COMMENT_NODE}class A extends Error{constructor(e,t){super(e),this.propertyBag=t}}class G{constructor(e){this.directive=e,this.items=null,this.itemsObserver=null,this.bindView=U,this.views=[],this.itemsBindingObserver=e.dataBinding.createObserver(this,e),this.templateBindingObserver=e.templateBinding.createObserver(this,e),e.options.positioning&&(this.bindView=X)}bind(e){this.location=e.targets[this.directive.targetNodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),f.isHydratable(this.template)&&f.isHydratable(e)&&e.hydrationStage!==f.HydrationStage.hydrated?this.hydrateViews(this.template):this.refreshAllViews(),e.onUnbind(this)}unbind(){this.itemsObserver!==null&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else if(t[0])t[0].reset?this.refreshAllViews():t[0].sorted?this.updateSortedViews(t):this.updateSplicedViews(t);else return}observeItems(e=!1){if(!this.items){this.items=f.emptyArray;return}const t=this.itemsObserver,s=this.itemsObserver=f.Observable.getNotifier(this.items),o=t!==s;o&&t!==null&&t.unsubscribe(this),(o||e)&&s.subscribe(this)}updateSortedViews(e){const t=this.views;for(let s=0,o=e.length;s<o;++s){const n=e[s].sorted.slice(),l=n.slice().sort();for(let h=0,d=n.length;h<d;++h){const a=n.find(c=>n[h]===l[c]);if(a!==h){const c=l.splice(a,1);l.splice(h,0,...c);const r=t[h],u=r?r.firstChild:this.location;t[a].remove(),t[a].insertBefore(u);const p=t.splice(a,1);t.splice(h,0,...p)}}}}updateSplicedViews(e){const t=this.views,s=this.bindView,o=this.items,n=this.template,l=this.controller,h=this.directive.options.recycle,d=[];let a=0,c=0;for(let r=0,u=e.length;r<u;++r){const p=e[r],g=p.removed;let w=0,m=p.index;const R=m+p.addedCount,x=t.splice(p.index,g.length),k=c=d.length+x.length;for(;m<R;++m){const C=t[m],I=C?C.firstChild:this.location;let b;h&&c>0?(w<=k&&x.length>0?(b=x[w],w++):(b=d[a],a++),c--):b=n.create(),t.splice(m,0,b),s(b,o,m,l),b.insertBefore(I)}x[w]&&d.push(...x.slice(w))}for(let r=a,u=d.length;r<u;++r)d[r].dispose();if(this.directive.options.positioning)for(let r=0,u=t.length;r<u;++r){const p=t[r].context;p.length=u,p.index=r}}refreshAllViews(e=!1){const t=this.items,s=this.template,o=this.location,n=this.bindView,l=this.controller;let h=t.length,d=this.views,a=d.length;if((h===0||e||!this.directive.options.recycle)&&(f.HTMLView.disposeContiguousBatch(d),a=0),a===0){this.views=d=new Array(h);for(let c=0;c<h;++c){const r=s.create();n(r,t,c,l),d[c]=r,r.insertBefore(o)}}else{let c=0;for(;c<h;++c)if(c<a){const u=d[c];if(!u){const p=new XMLSerializer;throw new A(`View is null or undefined inside "${this.location.getRootNode().host.nodeName}".`,{index:c,hydrationStage:this.controller.hydrationStage,itemsLength:h,viewsState:d.map(g=>g?"hydrated":"empty"),viewTemplateString:p.serializeToString(s.create().fragment),rootNodeContent:p.serializeToString(this.location.getRootNode())})}n(u,t,c,l)}else{const u=s.create();n(u,t,c,l),d.push(u),u.insertBefore(o)}const r=d.splice(c,a-c);for(c=0,h=r.length;c<h;++c)r[c].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t){const o=e[t];if(!o){const n=new XMLSerializer;throw new A(`View is null or undefined inside "${this.location.getRootNode().host.nodeName}".`,{index:t,hydrationStage:this.controller.hydrationStage,viewsState:e.map(l=>l?"hydrated":"empty"),rootNodeContent:n.serializeToString(this.location.getRootNode())})}o.unbind()}}hydrateViews(e){if(!this.items)return;this.views=new Array(this.items.length);let t=this.location.previousSibling;for(;t!==null;){if(!M(t)){t=t.previousSibling;continue}const s=f.HydrationMarkup.parseRepeatEndMarker(t.data);if(s===null){t=t.previousSibling;continue}t.data="";const o=t.previousSibling;if(!o)throw new Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": end should never be null.`);let n=o,l=0;for(;n!==null;){if(M(n)){if(f.HydrationMarkup.isRepeatViewEndMarker(n.data))l++;else if(f.HydrationMarkup.isRepeatViewStartMarker(n.data))if(l)l--;else{if(f.HydrationMarkup.parseRepeatStartMarker(n.data)!==s)throw new Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": Mismatched start and end markers.`);n.data="",t=n.previousSibling,n=n.nextSibling;const h=e.hydrate(n,o);this.views[s]=h,this.bindView(h,this.items,s,this.controller);break}}n=n.previousSibling}if(!n)throw new Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": start should never be null.`)}}}class O{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,F.enable()}createHTML(e){return f.Markup.comment(e(this))}createBehavior(){return new G(this)}}f.HTMLDirective.define(O);function J(i,e,t=N){const s=V.normalizeBinding(i),o=V.normalizeBinding(e);return new O(s,o,Object.assign(Object.assign({},N),t))}exports.RepeatDirective=O;exports.repeat=J;
|