@prolibu-suite/cobalt-core 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +395 -29
- package/dist/cjs/co-accordion.cjs.entry.js +4 -4
- package/dist/cjs/co-action-bar.cjs.entry.js +1 -1
- package/dist/cjs/co-audio-player.cjs.entry.js +82 -12
- package/dist/cjs/co-avatar.cjs.entry.js +72 -0
- package/dist/cjs/co-button.cjs.entry.js +1 -1
- package/dist/cjs/co-checkbox.cjs.entry.js +3 -3
- package/dist/cjs/co-chip_2.cjs.entry.js +62 -10
- package/dist/cjs/co-color-picker.cjs.entry.js +40 -10
- package/dist/cjs/co-data-table.cjs.entry.js +82 -4
- package/dist/cjs/co-input.cjs.entry.js +6 -2
- package/dist/cjs/co-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/co-modal.cjs.entry.js +7 -3
- package/dist/cjs/co-navbar.cjs.entry.js +2 -2
- package/dist/cjs/co-number-field.cjs.entry.js +3 -3
- package/dist/cjs/co-overlay.cjs.entry.js +1 -1
- package/dist/cjs/co-page-header.cjs.entry.js +1 -1
- package/dist/cjs/co-phone-field.cjs.entry.js +1 -1
- package/dist/cjs/co-progress-bar.cjs.entry.js +2 -2
- package/dist/cjs/co-progress-circle.cjs.entry.js +2 -2
- package/dist/cjs/co-provider-logo_2.cjs.entry.js +1 -1
- package/dist/cjs/co-radio.cjs.entry.js +3 -3
- package/dist/cjs/co-rating.cjs.entry.js +3 -3
- package/dist/cjs/co-ref-field.cjs.entry.js +100 -9
- package/dist/cjs/co-rich-text-editor.cjs.entry.js +3 -3
- package/dist/cjs/co-row.cjs.entry.js +2 -2
- package/dist/cjs/co-select.cjs.entry.js +4 -4
- package/dist/cjs/co-separator.cjs.entry.js +1 -1
- package/dist/cjs/co-sidebar.cjs.entry.js +2 -2
- package/dist/cjs/co-slider.cjs.entry.js +2 -2
- package/dist/cjs/co-switch.cjs.entry.js +3 -3
- package/dist/cjs/co-tab-group.cjs.entry.js +2 -2
- package/dist/cjs/co-tab.cjs.entry.js +2 -2
- package/dist/cjs/co-tags-field.cjs.entry.js +5 -5
- package/dist/cjs/co-textarea.cjs.entry.js +4 -4
- package/dist/cjs/co-time-field.cjs.entry.js +1 -1
- package/dist/cjs/co-toggle-button-group.cjs.entry.js +3 -3
- package/dist/cjs/co-toggle-button.cjs.entry.js +3 -3
- package/dist/cjs/{co-avatar_2.cjs.entry.js → co-tooltip.cjs.entry.js} +2 -70
- package/dist/cjs/co-video.cjs.entry.js +2 -2
- package/dist/cjs/cobalt.cjs.js +1 -1
- package/dist/cjs/index-MDAnKsze.js +12 -8
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cobalt/cobalt.esm.js +1 -1
- package/dist/cobalt/{p-82266f11.entry.js → p-000a15b8.entry.js} +1 -1
- package/dist/cobalt/{p-fe7e8813.entry.js → p-148d4aa6.entry.js} +1 -1
- package/dist/cobalt/p-16f8cee6.entry.js +1 -0
- package/dist/cobalt/p-239c5c5f.entry.js +1 -0
- package/dist/cobalt/{p-4d897896.entry.js → p-28764b8e.entry.js} +1 -1
- package/dist/cobalt/{p-73c6d735.entry.js → p-2a30c143.entry.js} +1 -1
- package/dist/cobalt/{p-85501c6a.entry.js → p-2f0f3bb1.entry.js} +1 -1
- package/dist/cobalt/{p-e01f9b9a.entry.js → p-2fba312b.entry.js} +1 -1
- package/dist/cobalt/p-354d5089.entry.js +1 -0
- package/dist/cobalt/{p-5298c030.entry.js → p-383a998e.entry.js} +1 -1
- package/dist/cobalt/{p-325b91b6.entry.js → p-3c4f7026.entry.js} +1 -1
- package/dist/cobalt/p-416795f5.entry.js +1 -0
- package/dist/cobalt/{p-54c987d7.entry.js → p-5a3e4c81.entry.js} +1 -1
- package/dist/cobalt/p-5adf117c.entry.js +1 -0
- package/dist/cobalt/{p-83a9a05a.entry.js → p-5ca394b1.entry.js} +1 -1
- package/dist/cobalt/{p-1a589c8e.entry.js → p-5e4973a6.entry.js} +1 -1
- package/dist/cobalt/{p-b565104d.entry.js → p-6c82a892.entry.js} +1 -1
- package/dist/cobalt/{p-83ea631d.entry.js → p-789c4b3e.entry.js} +1 -1
- package/dist/cobalt/{p-ea20f048.entry.js → p-7e8e6907.entry.js} +1 -1
- package/dist/cobalt/{p-10b82207.entry.js → p-8471abe2.entry.js} +1 -1
- package/dist/cobalt/p-8f2199ff.entry.js +1 -0
- package/dist/cobalt/p-9246e09c.entry.js +1 -0
- package/dist/cobalt/{p-eb063cc0.entry.js → p-93fe45fd.entry.js} +1 -1
- package/dist/cobalt/{p-ad33c40e.entry.js → p-95cfcb34.entry.js} +1 -1
- package/dist/cobalt/{p-bd683db3.entry.js → p-9cf738ed.entry.js} +1 -1
- package/dist/cobalt/p-a2462d7a.entry.js +1 -0
- package/dist/cobalt/p-a325ea0c.entry.js +1 -0
- package/dist/cobalt/{p-e8a4e6b0.entry.js → p-b5bba7fe.entry.js} +1 -1
- package/dist/cobalt/{p-6bf6bc3e.entry.js → p-b821d9de.entry.js} +1 -1
- package/dist/cobalt/{p-92b092db.entry.js → p-be34e447.entry.js} +1 -1
- package/dist/cobalt/p-c7d7d7f7.entry.js +1 -0
- package/dist/cobalt/{p-aae86f96.entry.js → p-d0b2c418.entry.js} +1 -1
- package/dist/cobalt/{p-50bcc76f.entry.js → p-d3344187.entry.js} +1 -1
- package/dist/cobalt/p-d375014b.entry.js +1 -0
- package/dist/cobalt/p-d9d9e8ae.entry.js +1 -0
- package/dist/cobalt/p-e371ec7a.entry.js +1 -0
- package/dist/cobalt/p-eadfd661.entry.js +1 -0
- package/dist/cobalt/p-ef301976.entry.js +1 -0
- package/dist/cobalt/{p-f68dd124.entry.js → p-fb2d1144.entry.js} +1 -1
- package/dist/collection/components/co-accordion/co-accordion.css +2 -2
- package/dist/collection/components/co-accordion/co-accordion.js +4 -4
- package/dist/collection/components/co-action-bar/co-action-bar.css +9 -2
- package/dist/collection/components/co-audio-player/co-audio-player.js +138 -12
- package/dist/collection/components/co-autocomplete/co-autocomplete.js +1 -1
- package/dist/collection/components/co-avatar-group/co-avatar-group.js +1 -1
- package/dist/collection/components/co-button/co-button.css +6 -3
- package/dist/collection/components/co-checkbox/co-checkbox.js +22 -3
- package/dist/collection/components/co-checkbox-group/co-checkbox-group.js +1 -1
- package/dist/collection/components/co-color-picker/co-color-picker.js +40 -10
- package/dist/collection/components/co-combobox/co-combobox.js +1 -1
- package/dist/collection/components/co-command-search/co-command-search.js +1 -1
- package/dist/collection/components/co-data-table/co-data-table.css +63 -2
- package/dist/collection/components/co-data-table/co-data-table.js +59 -4
- package/dist/collection/components/co-data-table/headerTruncationLogic.js +34 -0
- package/dist/collection/components/co-date-range-picker/co-date-range-picker.js +2 -2
- package/dist/collection/components/co-input/co-input.js +17 -5
- package/dist/collection/components/co-menu-item/co-menu-item.css +9 -0
- package/dist/collection/components/co-modal/co-modal.css +6 -0
- package/dist/collection/components/co-modal/co-modal.js +33 -2
- package/dist/collection/components/co-navbar/co-navbar.js +2 -2
- package/dist/collection/components/co-number-field/co-number-field.js +3 -3
- package/dist/collection/components/co-option-list/co-option-list.js +32 -3
- package/dist/collection/components/co-option-list/optionListLogic.js +31 -8
- package/dist/collection/components/co-overlay/co-overlay.js +1 -1
- package/dist/collection/components/co-page-header/co-page-header.js +1 -1
- package/dist/collection/components/co-phone-field/co-phone-field.js +1 -1
- package/dist/collection/components/co-popover/co-popover.js +1 -1
- package/dist/collection/components/co-progress-bar/co-progress-bar.js +2 -2
- package/dist/collection/components/co-progress-circle/co-progress-circle.js +2 -2
- package/dist/collection/components/co-radio/co-radio.js +3 -3
- package/dist/collection/components/co-radio-group/co-radio-group.js +1 -1
- package/dist/collection/components/co-rating/co-rating.js +3 -3
- package/dist/collection/components/co-ref-field/co-ref-field.css +40 -0
- package/dist/collection/components/co-ref-field/co-ref-field.js +207 -11
- package/dist/collection/components/co-rich-text-editor/co-rich-text-editor.js +3 -3
- package/dist/collection/components/co-row/co-row.js +2 -2
- package/dist/collection/components/co-segmented-bar/co-segmented-bar.js +1 -1
- package/dist/collection/components/co-select/co-select.js +24 -5
- package/dist/collection/components/co-separator/co-separator.js +1 -1
- package/dist/collection/components/co-sidebar/co-sidebar.js +2 -2
- package/dist/collection/components/co-sidebar-nav/co-sidebar-nav.js +1 -1
- package/dist/collection/components/co-skeleton/co-skeleton.js +1 -1
- package/dist/collection/components/co-slider/co-slider.js +2 -2
- package/dist/collection/components/co-switch/co-switch.js +3 -3
- package/dist/collection/components/co-tab/co-tab.js +2 -2
- package/dist/collection/components/co-tab-group/co-tab-group.js +2 -2
- package/dist/collection/components/co-tags-field/co-tags-field.js +5 -5
- package/dist/collection/components/co-textarea/co-textarea.js +4 -4
- package/dist/collection/components/co-time-field/co-time-field.js +1 -1
- package/dist/collection/components/co-toast/co-toast.js +2 -2
- package/dist/collection/components/co-toggle-button/co-toggle-button.css +6 -5
- package/dist/collection/components/co-toggle-button/co-toggle-button.js +2 -2
- package/dist/collection/components/co-toggle-button-group/co-toggle-button-group.css +9 -5
- package/dist/collection/components/co-toggle-button-group/co-toggle-button-group.js +2 -2
- package/dist/collection/components/co-tooltip/co-tooltip.js +2 -2
- package/dist/collection/components/co-transfer-list/co-transfer-list.js +1 -1
- package/dist/collection/components/co-video/co-video.js +2 -2
- package/dist/components/co-accordion.js +1 -1
- package/dist/components/co-action-bar.js +1 -1
- package/dist/components/co-audio-player.js +1 -1
- package/dist/components/co-autocomplete.js +1 -1
- package/dist/components/co-avatar-group.js +1 -1
- package/dist/components/co-avatar.js +1 -1
- package/dist/components/co-button.js +1 -1
- package/dist/components/co-calendar-month.js +1 -1
- package/dist/components/co-calendar-timegrid.js +1 -1
- package/dist/components/co-checkbox.js +1 -1
- package/dist/components/co-color-picker.js +1 -1
- package/dist/components/co-column-picker.js +1 -1
- package/dist/components/co-combobox.js +1 -1
- package/dist/components/co-command-search.js +1 -1
- package/dist/components/co-data-table.js +1 -1
- package/dist/components/co-date-picker.js +1 -1
- package/dist/components/co-date-range-picker.js +1 -1
- package/dist/components/co-date-range.js +1 -1
- package/dist/components/co-date-time-picker.js +1 -1
- package/dist/components/co-drawer.js +1 -1
- package/dist/components/co-event-calendar.js +1 -1
- package/dist/components/co-file-field.js +1 -1
- package/dist/components/co-input.js +1 -1
- package/dist/components/co-lightbox.js +1 -1
- package/dist/components/co-list-item.js +1 -1
- package/dist/components/co-menu-item.js +1 -1
- package/dist/components/co-modal.js +1 -1
- package/dist/components/co-navbar.js +1 -1
- package/dist/components/co-number-field.js +1 -1
- package/dist/components/co-option-list.js +1 -1
- package/dist/components/co-overlay.js +1 -1
- package/dist/components/co-page-header.js +1 -1
- package/dist/components/co-phone-field.js +1 -1
- package/dist/components/co-progress-bar.js +1 -1
- package/dist/components/co-progress-circle.js +1 -1
- package/dist/components/co-radio.js +1 -1
- package/dist/components/co-rating.js +1 -1
- package/dist/components/co-ref-field.js +1 -1
- package/dist/components/co-rich-text-editor.js +1 -1
- package/dist/components/co-row.js +1 -1
- package/dist/components/co-select.js +1 -1
- package/dist/components/co-separator.js +1 -1
- package/dist/components/co-sidebar-nav.js +1 -1
- package/dist/components/co-sidebar.js +1 -1
- package/dist/components/co-skeleton.js +1 -1
- package/dist/components/co-slider.js +1 -1
- package/dist/components/co-switch.js +1 -1
- package/dist/components/co-tab-group.js +1 -1
- package/dist/components/co-tab.js +1 -1
- package/dist/components/co-tags-field.js +1 -1
- package/dist/components/co-textarea.js +1 -1
- package/dist/components/co-time-field.js +1 -1
- package/dist/components/co-toggle-button-group.js +1 -1
- package/dist/components/co-toggle-button.js +1 -1
- package/dist/components/co-tooltip.js +1 -1
- package/dist/components/co-video.js +1 -1
- package/dist/components/p-7TncUlLN.js +1 -0
- package/dist/components/{p-BxP8OBw6.js → p-B9xitpGU.js} +1 -1
- package/dist/components/{p-x4grh-eZ.js → p-CBTGN490.js} +1 -1
- package/dist/components/{p-CXPRaTuo.js → p-CLsAo0-A.js} +1 -1
- package/dist/components/{p-B1QFLcY9.js → p-D2ldYZo1.js} +1 -1
- package/dist/components/{p-Bv6U5y3d.js → p-D3mVYO-G.js} +1 -1
- package/dist/components/{p-DkDTmHCg.js → p-DDV_bRcU.js} +1 -1
- package/dist/components/{p-Be_kyNRE.js → p-DSnJWzQw.js} +1 -1
- package/dist/components/{p-BBP5__CY.js → p-DTi2O4O8.js} +1 -1
- package/dist/components/p-De7w9k6_.js +1 -0
- package/dist/components/{p-Cl3AdEQJ.js → p-DoHLTC0n.js} +1 -1
- package/dist/components/{p-CnX3L8aF.js → p-DxtNejr2.js} +1 -1
- package/dist/components/p-wjt4IAGZ.js +1 -0
- package/dist/components/{p-DIo66nBr.js → p-zuhal3IZ.js} +1 -1
- package/dist/esm/co-accordion.entry.js +4 -4
- package/dist/esm/co-action-bar.entry.js +1 -1
- package/dist/esm/co-audio-player.entry.js +82 -12
- package/dist/esm/co-avatar.entry.js +70 -0
- package/dist/esm/co-button.entry.js +1 -1
- package/dist/esm/co-checkbox.entry.js +3 -3
- package/dist/esm/co-chip_2.entry.js +62 -10
- package/dist/esm/co-color-picker.entry.js +40 -10
- package/dist/esm/co-data-table.entry.js +82 -4
- package/dist/esm/co-input.entry.js +6 -2
- package/dist/esm/co-menu-item.entry.js +1 -1
- package/dist/esm/co-modal.entry.js +7 -3
- package/dist/esm/co-navbar.entry.js +2 -2
- package/dist/esm/co-number-field.entry.js +3 -3
- package/dist/esm/co-overlay.entry.js +1 -1
- package/dist/esm/co-page-header.entry.js +1 -1
- package/dist/esm/co-phone-field.entry.js +1 -1
- package/dist/esm/co-progress-bar.entry.js +2 -2
- package/dist/esm/co-progress-circle.entry.js +2 -2
- package/dist/esm/co-provider-logo_2.entry.js +1 -1
- package/dist/esm/co-radio.entry.js +3 -3
- package/dist/esm/co-rating.entry.js +3 -3
- package/dist/esm/co-ref-field.entry.js +100 -9
- package/dist/esm/co-rich-text-editor.entry.js +3 -3
- package/dist/esm/co-row.entry.js +2 -2
- package/dist/esm/co-select.entry.js +4 -4
- package/dist/esm/co-separator.entry.js +1 -1
- package/dist/esm/co-sidebar.entry.js +2 -2
- package/dist/esm/co-slider.entry.js +2 -2
- package/dist/esm/co-switch.entry.js +3 -3
- package/dist/esm/co-tab-group.entry.js +2 -2
- package/dist/esm/co-tab.entry.js +2 -2
- package/dist/esm/co-tags-field.entry.js +5 -5
- package/dist/esm/co-textarea.entry.js +4 -4
- package/dist/esm/co-time-field.entry.js +1 -1
- package/dist/esm/co-toggle-button-group.entry.js +3 -3
- package/dist/esm/co-toggle-button.entry.js +3 -3
- package/dist/esm/{co-avatar_2.entry.js → co-tooltip.entry.js} +3 -70
- package/dist/esm/co-video.entry.js +2 -2
- package/dist/esm/cobalt.js +1 -1
- package/dist/esm/index-DH5lfRNj.js +12 -8
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/co-accordion/co-accordion.d.ts +6 -0
- package/dist/types/components/co-audio-player/co-audio-player.d.ts +25 -0
- package/dist/types/components/co-checkbox/co-checkbox.d.ts +4 -0
- package/dist/types/components/co-color-picker/co-color-picker.d.ts +4 -2
- package/dist/types/components/co-data-table/co-data-table.d.ts +15 -0
- package/dist/types/components/co-data-table/headerTruncationLogic.d.ts +24 -0
- package/dist/types/components/co-input/co-input.d.ts +5 -1
- package/dist/types/components/co-modal/co-modal.d.ts +10 -0
- package/dist/types/components/co-option-list/co-option-list.d.ts +13 -0
- package/dist/types/components/co-option-list/optionListLogic.d.ts +23 -6
- package/dist/types/components/co-ref-field/co-ref-field.d.ts +38 -0
- package/dist/types/components/co-select/co-select.d.ts +6 -0
- package/dist/types/components.d.ts +79 -3
- package/package.json +2 -2
- package/dist/cobalt/p-15d59169.entry.js +0 -1
- package/dist/cobalt/p-1788aab5.entry.js +0 -1
- package/dist/cobalt/p-20a39218.entry.js +0 -1
- package/dist/cobalt/p-3cc3ff93.entry.js +0 -1
- package/dist/cobalt/p-4908f33f.entry.js +0 -1
- package/dist/cobalt/p-63825d7f.entry.js +0 -1
- package/dist/cobalt/p-6f700f0d.entry.js +0 -1
- package/dist/cobalt/p-88195a63.entry.js +0 -1
- package/dist/cobalt/p-8fa5dc4a.entry.js +0 -1
- package/dist/cobalt/p-b1e8d69e.entry.js +0 -1
- package/dist/cobalt/p-b48917c9.entry.js +0 -1
- package/dist/cobalt/p-c32c176a.entry.js +0 -1
- package/dist/cobalt/p-e48f4e45.entry.js +0 -1
- package/dist/cobalt/p-ef5ca521.entry.js +0 -1
- package/dist/components/p-9ceBPSd1.js +0 -1
- package/dist/components/p-B2IsXte7.js +0 -1
- package/dist/components/p-BsTO1uUA.js +0 -1
|
@@ -79,6 +79,7 @@ const CoAudioPlayer = class {
|
|
|
79
79
|
this.coPause = createEvent(this, "coPause", 7);
|
|
80
80
|
this.coEnded = createEvent(this, "coEnded", 7);
|
|
81
81
|
this.coError = createEvent(this, "coError", 7);
|
|
82
|
+
this.coTimeUpdate = createEvent(this, "coTimeUpdate", 3);
|
|
82
83
|
/** Compact variant: narrower, hides the download button. */
|
|
83
84
|
this.compact = false;
|
|
84
85
|
/** Fallback bar count used before the container width is measured. Once
|
|
@@ -115,10 +116,22 @@ const CoAudioPlayer = class {
|
|
|
115
116
|
// Bumped by every init(); an in-flight extractPeaks whose token no longer matches
|
|
116
117
|
// belongs to a superseded `src` and must not write peaks/duration.
|
|
117
118
|
this.loadToken = 0;
|
|
118
|
-
this.onMeta = () => { this.syncDuration(); };
|
|
119
|
-
|
|
119
|
+
this.onMeta = () => { this.syncDuration(); this.applyPendingSeek(); };
|
|
120
|
+
/**
|
|
121
|
+
* A seek asked for before the media had data. `<audio>` DROPS a `currentTime`
|
|
122
|
+
* write while `readyState` is HAVE_NOTHING, silently: with `preload="metadata"`
|
|
123
|
+
* and a clip never played, the very first jump (clicking a transcript line on
|
|
124
|
+
* a recording nobody opened yet) went nowhere. Kept here and applied as soon
|
|
125
|
+
* as the element can take it.
|
|
126
|
+
*/
|
|
127
|
+
this.pendingSeek = null;
|
|
128
|
+
this.onCanPlay = () => { this.isLoading = false; this.applyPendingSeek(); };
|
|
120
129
|
this.onWaiting = () => { this.isLoading = true; };
|
|
121
|
-
this.onTime = () => {
|
|
130
|
+
this.onTime = () => {
|
|
131
|
+
var _a;
|
|
132
|
+
this.currentTime = ((_a = this.audio) === null || _a === void 0 ? void 0 : _a.currentTime) || 0;
|
|
133
|
+
this.coTimeUpdate.emit({ currentTime: this.currentTime, duration: this.knownDuration });
|
|
134
|
+
};
|
|
122
135
|
this.onEnded = () => { this.isPlaying = false; this.currentTime = 0; this.coEnded.emit(); };
|
|
123
136
|
this.onErr = (e) => { this.isLoading = false; this.hasError = true; this.coError.emit(e); };
|
|
124
137
|
this.toggle = () => {
|
|
@@ -275,12 +288,26 @@ const CoAudioPlayer = class {
|
|
|
275
288
|
this.isPlaying = false;
|
|
276
289
|
}
|
|
277
290
|
async extractPeaks(url, token) {
|
|
291
|
+
var _a;
|
|
278
292
|
let ctx;
|
|
279
293
|
try {
|
|
294
|
+
/**
|
|
295
|
+
* `OfflineAudioContext` FIRST, and a live `AudioContext` only as the
|
|
296
|
+
* fallback: decoding a waveform needs no audio OUTPUT, and a live context
|
|
297
|
+
* created before the user has interacted trips the browser's autoplay
|
|
298
|
+
* policy — "The AudioContext was not allowed to start. It must be resumed
|
|
299
|
+
* (or created) after a user gesture on the page", once per player. A page
|
|
300
|
+
* with 15 recordings logged it 15 times. The offline one has no output
|
|
301
|
+
* device, so the policy does not apply to it.
|
|
302
|
+
*
|
|
303
|
+
* Its arguments are placeholders: nothing is ever rendered through this
|
|
304
|
+
* context, it is only the host for `decodeAudioData`.
|
|
305
|
+
*/
|
|
306
|
+
const OfflineCtx = window.OfflineAudioContext || window.webkitOfflineAudioContext;
|
|
280
307
|
const Ctx = window.AudioContext || window.webkitAudioContext;
|
|
281
|
-
if (!Ctx || typeof fetch === 'undefined')
|
|
308
|
+
if ((!OfflineCtx && !Ctx) || typeof fetch === 'undefined')
|
|
282
309
|
return; // keep fallback
|
|
283
|
-
ctx = new Ctx();
|
|
310
|
+
ctx = OfflineCtx ? new OfflineCtx(1, 1, 44100) : new Ctx();
|
|
284
311
|
const buf = await (await fetch(url)).arrayBuffer();
|
|
285
312
|
const audioBuf = await ctx.decodeAudioData(buf);
|
|
286
313
|
if (token !== this.loadToken)
|
|
@@ -289,7 +316,7 @@ const CoAudioPlayer = class {
|
|
|
289
316
|
this.decodedDuration = audioBuf.duration;
|
|
290
317
|
this.peaks = resamplePeaks(this.rawChannelData, this.effectiveBars);
|
|
291
318
|
}
|
|
292
|
-
catch (
|
|
319
|
+
catch (_b) {
|
|
293
320
|
if (token !== this.loadToken)
|
|
294
321
|
return;
|
|
295
322
|
// Undecodable (codec WebAudio can't handle, CORS, network): keep the
|
|
@@ -302,11 +329,13 @@ const CoAudioPlayer = class {
|
|
|
302
329
|
finally {
|
|
303
330
|
// Always release the context. Chrome caps concurrent AudioContexts per
|
|
304
331
|
// document, so leaking one per failed decode would eventually stop every
|
|
305
|
-
// later player on the page from decoding at all.
|
|
332
|
+
// later player on the page from decoding at all. `close()` lives on
|
|
333
|
+
// AudioContext, not on every BaseAudioContext (an OfflineAudioContext
|
|
334
|
+
// needs no closing and may not implement it): optional call, not a cast.
|
|
306
335
|
try {
|
|
307
|
-
await (ctx === null || ctx === void 0 ? void 0 : ctx.close());
|
|
336
|
+
await ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.close) === null || _a === void 0 ? void 0 : _a.call(ctx));
|
|
308
337
|
}
|
|
309
|
-
catch ( /* already closed */
|
|
338
|
+
catch ( /* already closed */_c) { /* already closed */ }
|
|
310
339
|
}
|
|
311
340
|
if (token === this.loadToken)
|
|
312
341
|
this.syncDuration();
|
|
@@ -321,6 +350,47 @@ const CoAudioPlayer = class {
|
|
|
321
350
|
if (!Object.is(next, this.duration))
|
|
322
351
|
this.duration = next;
|
|
323
352
|
}
|
|
353
|
+
applyPendingSeek() {
|
|
354
|
+
if (this.pendingSeek == null || !this.audio)
|
|
355
|
+
return;
|
|
356
|
+
const target = this.pendingSeek;
|
|
357
|
+
this.pendingSeek = null;
|
|
358
|
+
this.audio.currentTime = target;
|
|
359
|
+
this.currentTime = this.audio.currentTime;
|
|
360
|
+
this.coTimeUpdate.emit({ currentTime: this.currentTime, duration: this.knownDuration });
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Move the playhead. Clamped to `[0, duration]`: `audio.currentTime` takes a
|
|
364
|
+
* restricted double and THROWS on a non-finite value, and a duration that is
|
|
365
|
+
* not known yet reads as 0 (see `knownDuration`).
|
|
366
|
+
*/
|
|
367
|
+
async seek(seconds) {
|
|
368
|
+
var _a;
|
|
369
|
+
if (!this.audio || !Number.isFinite(seconds))
|
|
370
|
+
return;
|
|
371
|
+
const total = this.knownDuration;
|
|
372
|
+
const target = total ? Math.max(0, Math.min(total, seconds)) : Math.max(0, seconds);
|
|
373
|
+
this.audio.currentTime = target;
|
|
374
|
+
// The element could not take it yet (no data): keep it for `loadedmetadata`.
|
|
375
|
+
// The readback is the only way to tell — the write throws nothing.
|
|
376
|
+
if (Math.abs(((_a = this.audio.currentTime) !== null && _a !== void 0 ? _a : 0) - target) > 0.05)
|
|
377
|
+
this.pendingSeek = target;
|
|
378
|
+
// Optimistic either way: the UI shows where playback is GOING, and the
|
|
379
|
+
// pending write lands on its own.
|
|
380
|
+
this.currentTime = target;
|
|
381
|
+
this.coTimeUpdate.emit({ currentTime: this.currentTime, duration: total });
|
|
382
|
+
}
|
|
383
|
+
/** Start playback if it is not already running (no-op on a failed load). */
|
|
384
|
+
async play() {
|
|
385
|
+
if (!this.audio || this.isPlaying || this.hasError)
|
|
386
|
+
return;
|
|
387
|
+
try {
|
|
388
|
+
await this.audio.play();
|
|
389
|
+
this.isPlaying = true;
|
|
390
|
+
this.coPlay.emit();
|
|
391
|
+
}
|
|
392
|
+
catch ( /* autoplay blocked or source not ready: the button still works */_a) { /* autoplay blocked or source not ready: the button still works */ }
|
|
393
|
+
}
|
|
324
394
|
async download() {
|
|
325
395
|
if (!this.src || typeof fetch === 'undefined')
|
|
326
396
|
return;
|
|
@@ -347,13 +417,13 @@ const CoAudioPlayer = class {
|
|
|
347
417
|
// below `aria-valuenow` the moment playback advances. ARIA 1.2 makes valuemax
|
|
348
418
|
// optional for `slider`, so leaving it off while unknown is well-formed.
|
|
349
419
|
const ariaMax = total ? Math.floor(total) : undefined;
|
|
350
|
-
const bar = (hFrac, i, played = false) => (h("rect", { key: '
|
|
351
|
-
return (h("div", { key: '
|
|
420
|
+
const bar = (hFrac, i, played = false) => (h("rect", { key: '7cbeb92ef52ffc865077340d72bae11139ced551', x: i * UNIT, y: H / 2 - (hFrac * H) / 2, width: W, height: Math.max(hFrac * H, 2), rx: R, class: { 'co-audio-player__bar': true, 'co-audio-player__bar--played': played } }));
|
|
421
|
+
return (h("div", { key: '34078ed0540dc72c87644c3ae830b3a2ff43a99e', class: {
|
|
352
422
|
'co-audio-player': true,
|
|
353
423
|
'co-audio-player--compact': this.compact,
|
|
354
424
|
'co-audio-player--error': this.hasError,
|
|
355
425
|
'co-audio-player--playing': this.isPlaying,
|
|
356
|
-
}, part: "player" }, h("button", { key: '
|
|
426
|
+
}, part: "player" }, h("button", { key: '7f692d951704a6e101f77512967d4b206f985e18', type: "button", class: "co-audio-player__play", part: "play", "aria-label": this.hasError ? 'Audio no disponible' : this.isPlaying ? 'Pausar' : 'Reproducir', "aria-busy": this.isLoading ? 'true' : 'false', disabled: this.hasError || !this.src, onClick: this.toggle }, h("co-icon", { key: 'fdc0a0a0703189efe10bbc1b1182572d1120a347', name: this.hasError ? 'warning-circle' : this.isPlaying ? 'pause' : 'play', weight: "fill", size: this.compact ? 12 : 14 })), h("div", { key: '6842ce24993895bf70461a28eb837a0558d277d7', class: "co-audio-player__wave", part: "wave", role: "slider", tabindex: "0", "aria-label": "Progreso de reproducci\u00F3n", "aria-valuemin": 0, "aria-valuemax": ariaMax, "aria-valuenow": Math.floor(this.currentTime), ref: (el) => (this.waveEl = el), onClick: (e) => this.seekAt(e.clientX), onKeyDown: this.onWaveKey }, h("svg", { key: 'e75c5e1f78633194608758f43a47987bc28c2081', class: "co-audio-player__svg", viewBox: `0 0 ${vbW} ${H}`, preserveAspectRatio: "none", "aria-hidden": "true" }, this.peaks.map((hFrac, i) => bar(hFrac, i)), h("clipPath", { key: 'c4136dddad555e8b5ef09a81c38433cd2bf39d7c', id: "co-ap-clip" }, h("rect", { key: 'edb79083fbc7d225bd5668443fb6541fe77c8f9d', x: "0", y: "0", width: (pct / 100) * vbW, height: H })), h("g", { key: 'c91b8b285f53b9dc4f6110f9cb73b7f3f892fad6', "clip-path": "url(#co-ap-clip)" }, this.peaks.map((hFrac, i) => bar(hFrac, i, true))))), h("span", { key: '26af75ef91f36d432add06bb636c4d3194902b0a', class: "co-audio-player__time", part: "time" }, formatTime(this.currentTime), " / ", formatTime(this.duration)), !this.compact && (h("button", { key: 'a2093fc2d9c9a9c120e97e59f5e8b91467e1c20c', type: "button", class: "co-audio-player__speed", part: "speed", "aria-label": `Velocidad de reproducción ${this.playbackRate}x`, onClick: this.cycleSpeed }, this.playbackRate, "x")), !this.compact && !this.noDownload && (h("button", { key: '327336de6ad09adac5f8cba6e048b58bbef0008e', type: "button", class: "co-audio-player__dl", part: "download", "aria-label": "Descargar", onClick: () => this.download() }, h("co-icon", { key: '787738fea40ab74531c943f876e20acf6ceb54df', name: "download-simple", size: 14 })))));
|
|
357
427
|
}
|
|
358
428
|
static get watchers() { return {
|
|
359
429
|
"src": [{
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { r as registerInstance, h } from './index-DH5lfRNj.js';
|
|
2
|
+
import { i as isLightColor } from './color-BRbgGqLw.js';
|
|
3
|
+
|
|
4
|
+
const coAvatarCss = () => `:host{display:inline-flex;--co-avatar-squircle:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><path d='M100 50L99.94 68.06L99.75 73.81L99.44 77.94L99.01 81.26L98.44 84.05L97.74 86.46L96.91 88.57L95.94 90.43L94.81 92.07L93.53 93.53L92.07 94.81L90.43 95.94L88.57 96.91L86.46 97.74L84.05 98.44L81.26 99.01L77.94 99.44L73.81 99.75L68.06 99.94L50 100L31.94 99.94L26.19 99.75L22.06 99.44L18.74 99.01L15.95 98.44L13.54 97.74L11.43 96.91L9.57 95.94L7.93 94.81L6.47 93.53L5.19 92.07L4.06 90.43L3.09 88.57L2.26 86.46L1.56 84.05L0.99 81.26L0.56 77.94L0.25 73.81L0.06 68.06L0 50L0.06 31.94L0.25 26.19L0.56 22.06L0.99 18.74L1.56 15.95L2.26 13.54L3.09 11.43L4.06 9.57L5.19 7.93L6.47 6.47L7.93 5.19L9.57 4.06L11.43 3.09L13.54 2.26L15.95 1.56L18.74 0.99L22.06 0.56L26.19 0.25L31.94 0.06L50 0L68.06 0.06L73.81 0.25L77.94 0.56L81.26 0.99L84.05 1.56L86.46 2.26L88.57 3.09L90.43 4.06L92.07 5.19L93.53 6.47L94.81 7.93L95.94 9.57L96.91 11.43L97.74 13.54L98.44 15.95L99.01 18.74L99.44 22.06L99.75 26.19L99.94 31.94Z' fill='%23fff'/></svg>")}.co-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--co-border-radius-full);background:var(--co-semantic-surface-primary);color:var(--co-semantic-on-primary);font-family:var(--co-font-family-primary);font-weight:600;line-height:1;letter-spacing:var(--co-font-letter-spacing-body);overflow:hidden;flex-shrink:0;user-select:none;-webkit-font-smoothing:antialiased}.co-avatar::after{content:'';position:absolute;inset:0;pointer-events:none;border-radius:inherit;box-shadow:inset 0 0 0 var(--co-avatar-border-width, 1px) var(--co-avatar-border-color, transparent)}.co-avatar__text{text-transform:uppercase}.co-avatar__img{width:100%;height:100%;object-fit:cover;display:block}.co-avatar--square{border-radius:0;-webkit-mask:var(--co-avatar-squircle) center / 100% 100% no-repeat;mask:var(--co-avatar-squircle) center / 100% 100% no-repeat}.co-avatar--square::after{--co-avatar-bw:var(--co-avatar-border-width, 1px);box-shadow:none;background:var(--co-avatar-border-color, transparent);-webkit-mask:var(--co-avatar-squircle) center / 100% 100% no-repeat, var(--co-avatar-squircle) center / calc(100% - 2 * var(--co-avatar-bw)) calc(100% - 2 * var(--co-avatar-bw)) no-repeat;-webkit-mask-composite:xor;mask:var(--co-avatar-squircle) center / 100% 100% no-repeat, var(--co-avatar-squircle) center / calc(100% - 2 * var(--co-avatar-bw)) calc(100% - 2 * var(--co-avatar-bw)) no-repeat;mask-composite:exclude}.co-avatar--light{color:rgba(0, 0, 0, 0.87)}co-tooltip{display:inline-flex;align-items:center;line-height:0}`;
|
|
5
|
+
|
|
6
|
+
const SIZE_MAP = {
|
|
7
|
+
xl: 80, lg: 64, md: 56, sm: 48, xs: 32, xxs: 24,
|
|
8
|
+
};
|
|
9
|
+
const ICON_SIZE_MAP = {
|
|
10
|
+
xl: 32, lg: 28, md: 24, sm: 20, xs: 16, xxs: 12,
|
|
11
|
+
};
|
|
12
|
+
const FONT_SIZE_MAP = {
|
|
13
|
+
xl: 'var(--co-font-size-26)',
|
|
14
|
+
lg: 'var(--co-font-size-22)',
|
|
15
|
+
md: 'var(--co-font-size-18)',
|
|
16
|
+
sm: 'var(--co-font-size-16)',
|
|
17
|
+
xs: 'var(--co-font-size-12)',
|
|
18
|
+
xxs: 'var(--co-font-size-10)',
|
|
19
|
+
};
|
|
20
|
+
const CoAvatar = class {
|
|
21
|
+
constructor(hostRef) {
|
|
22
|
+
registerInstance(this, hostRef);
|
|
23
|
+
/** Display type: text shows initials, icon shows a Phosphor icon, image shows a picture */
|
|
24
|
+
this.type = 'text';
|
|
25
|
+
/** Size of the avatar */
|
|
26
|
+
this.size = 'md';
|
|
27
|
+
/** Phosphor icon name (type="icon"), defaults to "user" */
|
|
28
|
+
this.icon = 'user';
|
|
29
|
+
/** Icon weight */
|
|
30
|
+
this.iconWeight = 'regular';
|
|
31
|
+
/** Shape of the avatar */
|
|
32
|
+
this.shape = 'circle';
|
|
33
|
+
this.imgFailed = false;
|
|
34
|
+
this.handleImgError = () => {
|
|
35
|
+
this.imgFailed = true;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
40
|
+
const dim = (_a = SIZE_MAP[this.size]) !== null && _a !== void 0 ? _a : 56;
|
|
41
|
+
const iconSize = (_b = ICON_SIZE_MAP[this.size]) !== null && _b !== void 0 ? _b : 24;
|
|
42
|
+
const fontSize = (_c = FONT_SIZE_MAP[this.size]) !== null && _c !== void 0 ? _c : 'var(--co-font-size-18)';
|
|
43
|
+
const showImage = this.type === 'image' && this.src && !this.imgFailed;
|
|
44
|
+
// Broken/missing image without initials falls back to the ICON (default
|
|
45
|
+
// "user") — never an empty disc. With `text` present, initials win (they
|
|
46
|
+
// identify the record better than a generic glyph).
|
|
47
|
+
const showIcon = this.type === 'icon' || (this.type === 'image' && !showImage && !this.text);
|
|
48
|
+
const ariaLabel = this.type === 'text'
|
|
49
|
+
? this.text
|
|
50
|
+
: this.type === 'image'
|
|
51
|
+
? (_e = (_d = this.alt) !== null && _d !== void 0 ? _d : this.text) !== null && _e !== void 0 ? _e : this.icon
|
|
52
|
+
: this.icon;
|
|
53
|
+
const disc = (h("div", { class: {
|
|
54
|
+
'co-avatar': true,
|
|
55
|
+
[`co-avatar--${this.size}`]: true,
|
|
56
|
+
[`co-avatar--${this.type}`]: true,
|
|
57
|
+
'co-avatar--square': this.shape === 'square',
|
|
58
|
+
'co-avatar--light': !!this.color && isLightColor(this.color),
|
|
59
|
+
}, style: Object.assign(Object.assign({ width: `var(--co-avatar-size, ${dim}px)`, height: `var(--co-avatar-size, ${dim}px)`, fontSize }, (this.color ? { background: this.color } : {})), (this.ringColor
|
|
60
|
+
? { '--co-avatar-border-color': this.ringColor, '--co-avatar-border-width': '2px' }
|
|
61
|
+
: {})), part: "avatar", role: "img", "aria-label": ariaLabel }, showImage ? (h("img", { class: "co-avatar__img", src: this.src, alt: (_g = (_f = this.alt) !== null && _f !== void 0 ? _f : this.text) !== null && _g !== void 0 ? _g : '', onError: this.handleImgError })) : showIcon ? (h("co-icon", { name: this.icon, weight: this.iconWeight, size: iconSize })) : (h("span", { class: "co-avatar__text" }, this.text))));
|
|
62
|
+
// No tooltip when `name` is unset/empty — renders exactly as before, no wrapper.
|
|
63
|
+
if (!this.name)
|
|
64
|
+
return disc;
|
|
65
|
+
return h("co-tooltip", { content: this.name }, disc);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
CoAvatar.style = coAvatarCss();
|
|
69
|
+
|
|
70
|
+
export { CoAvatar as co_avatar };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, a as getElement } from './index-DH5lfRNj.js';
|
|
2
2
|
|
|
3
|
-
const coButtonCss = () => `:host{display:inline-flex}:host([disabled]){pointer-events:none}.co-button{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;border:1px solid transparent;outline:none;font-family:var(--co-font-family-primary);font-weight:400;line-height:1;letter-spacing:var(--co-font-letter-spacing-body);white-space:nowrap;-webkit-font-smoothing:antialiased;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-out), background var(--co-motion-duration-fast) var(--co-motion-ease-out), transform var(--co-motion-duration-fast) var(--co-motion-ease-out);box-sizing:border-box;-webkit-backdrop-filter:var(--co-glass-filter, blur(var(--co-glass-blur)) saturate(var(--co-glass-saturate)));backdrop-filter:var(--co-glass-filter, blur(var(--co-glass-blur)) saturate(var(--co-glass-saturate)))}.co-button--primary{background:var(--co-semantic-surface-primary);color:var(--co-semantic-on-primary);border-color:color-mix(in srgb, var(--co-semantic-on-primary) 28%, transparent)}.co-button--secondary{background:color-mix(in srgb, var(--co-semantic-surface-secondary) 55%, transparent);color:var(--co-semantic-on-secondary);border-color:var(--co-semantic-border-subtle)}.co-button--stroke{background:color-mix(in srgb, var(--co-semantic-surface-secondary) 25%, transparent);color:var(--co-semantic-text-default);border-color:var(--co-semantic-border-default)}.co-button--ghost{background:transparent;color:var(--co-semantic-text-default);border-color:transparent;-webkit-backdrop-filter:none;backdrop-filter:none}.co-button--danger{background:var(--co-semantic-status-error);color:var(--co-color-base-blanco);border-color:transparent}.co-button--success{background:var(--co-semantic-status-success);color:var(--co-color-base-blanco);border-color:transparent}.co-button--rounded.co-button--l{padding:var(--co-spacing-xl) var(--co-spacing-2xl);gap:var(--co-spacing-md);font-size:var(--co-font-size-18);border-radius:var(--co-button-radius, var(--co-border-radius-full))}.co-button--rounded.co-button--m{padding:var(--co-spacing-lg) var(--co-spacing-xl);gap:var(--co-spacing-md);font-size:var(--co-font-size-16);border-radius:var(--co-button-radius, var(--co-border-radius-full))}.co-button--rounded.co-button--s{padding:var(--co-spacing-md) var(--co-spacing-lg);gap:var(--co-spacing-sm2);font-size:var(--co-font-size-14);border-radius:var(--co-button-radius, var(--co-border-radius-full))}.co-button--rounded.co-button--xs{padding:var(--co-spacing-md) var(--co-spacing-lg);gap:var(--co-spacing-sm2);font-size:var(--co-font-size-12);border-radius:var(--co-button-radius, var(--co-border-radius-full))}.co-button--square.co-button--l{padding:var(--co-spacing-lg) var(--co-spacing-xl);gap:var(--co-spacing-md);font-size:var(--co-font-size-18);border-radius:var(--co-border-radius-lg)}.co-button--square.co-button--m{padding:var(--co-spacing-md) var(--co-spacing-lg);gap:var(--co-spacing-sm2);font-size:var(--co-font-size-16);border-radius:var(--co-border-radius-sm)}.co-button--square.co-button--s{padding:var(--co-spacing-sm2) var(--co-spacing-md);gap:var(--co-spacing-sm);font-size:var(--co-font-size-14);border-radius:var(--co-border-radius-xs)}.co-button--square.co-button--xs{padding:var(--co-spacing-sm) var(--co-spacing-sm2);gap:var(--co-spacing-xs);font-size:var(--co-font-size-12);border-radius:var(--co-spacing-sm)}.co-button--disabled,.co-button:disabled{opacity:0.4;cursor:not-allowed;pointer-events:none}.co-button--primary:hover:not(:disabled){opacity:0.88}.co-button--secondary:hover:not(:disabled),.co-button--stroke:hover:not(:disabled){background:var(--co-semantic-surface-hover)}.co-button--ghost:hover:not(:disabled){background:color-mix(in srgb, var(--co-semantic-surface-hover) 60%, transparent);-webkit-backdrop-filter:var(--co-glass-filter, blur(var(--co-glass-blur)) saturate(var(--co-glass-saturate)));backdrop-filter:var(--co-glass-filter, blur(var(--co-glass-blur)) saturate(var(--co-glass-saturate)))}.co-button--danger:hover:not(:disabled),.co-button--success:hover:not(:disabled){opacity:0.88}.co-button:active:not(:disabled){transform:scale(0.97);transition-duration:var(--co-motion-duration-instant)}.co-button--primary{transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-out), background var(--co-motion-duration-fast) var(--co-motion-ease-out), transform var(--co-motion-duration-slow) var(--co-motion-ease-spring)}.co-button--secondary.co-button--elevated{box-shadow:var(--co-shadow-sm, 0 1px 2px 0 rgba(26, 26, 26, 0.04)), inset 0 0 0 1px var(--co-color-opacity-negro-8)}.co-button--ghost.co-button--surface-dark,.co-button--stroke.co-button--surface-dark{color:var(--co-color-base-blanco, #fff)}.co-button--ghost.co-button--surface-dark:hover:not(:disabled),.co-button--stroke.co-button--surface-dark:hover:not(:disabled){background:var(--co-color-opacity-blanco-16);-webkit-backdrop-filter:none;backdrop-filter:none}.co-button--danger.co-button--surface-dark:hover:not(:disabled){opacity:1;background:color-mix(in srgb, var(--co-semantic-status-error) 84%, var(--co-color-base-blanco, #fff))}.co-button--danger.co-button--surface-dark:focus-visible{box-shadow:0 0 0 2px color-mix(in srgb, var(--co-color-base-blanco, #fff) 45%, transparent)}::slotted([slot="icon-left"]),::slotted([slot="icon-right"]){display:inline-flex;flex-shrink:0}@supports not (background: color-mix(in srgb, red, transparent)){.co-button--primary{background:var(--co-semantic-surface-primary)}.co-button--secondary{background:var(--co-semantic-surface-secondary)}.co-button--stroke{background:transparent}}`;
|
|
3
|
+
const coButtonCss = () => `:host{display:inline-flex}:host([disabled]){pointer-events:none}.co-button{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;border:1px solid transparent;outline:none;font-family:var(--co-font-family-primary);font-weight:400;line-height:1;letter-spacing:var(--co-font-letter-spacing-body);white-space:nowrap;-webkit-font-smoothing:antialiased;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-out), background var(--co-motion-duration-fast) var(--co-motion-ease-out), transform var(--co-motion-duration-fast) var(--co-motion-ease-out);box-sizing:border-box;-webkit-backdrop-filter:var(--co-glass-filter, blur(var(--co-glass-blur)) saturate(var(--co-glass-saturate)));backdrop-filter:var(--co-glass-filter, blur(var(--co-glass-blur)) saturate(var(--co-glass-saturate)))}.co-button--primary{background:var(--co-semantic-surface-primary);color:var(--co-semantic-on-primary);border-color:color-mix(in srgb, var(--co-semantic-on-primary) 28%, transparent)}.co-button--secondary{background:color-mix(in srgb, var(--co-button-bg, var(--co-semantic-surface-secondary)) 55%, transparent);color:var(--co-button-color, var(--co-semantic-on-secondary));border-color:var(--co-button-border, var(--co-semantic-border-subtle))}.co-button--stroke{background:color-mix(in srgb, var(--co-semantic-surface-secondary) 25%, transparent);color:var(--co-semantic-text-default);border-color:var(--co-semantic-border-default)}.co-button--ghost{background:transparent;color:var(--co-semantic-text-default);border-color:transparent;-webkit-backdrop-filter:none;backdrop-filter:none}.co-button--danger{background:var(--co-semantic-status-error);color:var(--co-color-base-blanco);border-color:transparent}.co-button--success{background:var(--co-semantic-status-success);color:var(--co-color-base-blanco);border-color:transparent}.co-button--rounded.co-button--l{padding:var(--co-spacing-xl) var(--co-spacing-2xl);gap:var(--co-spacing-md);font-size:var(--co-font-size-18);border-radius:var(--co-button-radius, var(--co-border-radius-full))}.co-button--rounded.co-button--m{padding:var(--co-spacing-lg) var(--co-spacing-xl);gap:var(--co-spacing-md);font-size:var(--co-font-size-16);border-radius:var(--co-button-radius, var(--co-border-radius-full))}.co-button--rounded.co-button--s{padding:var(--co-spacing-md) var(--co-spacing-lg);gap:var(--co-spacing-sm2);font-size:var(--co-font-size-14);border-radius:var(--co-button-radius, var(--co-border-radius-full))}.co-button--rounded.co-button--xs{padding:var(--co-spacing-md) var(--co-spacing-lg);gap:var(--co-spacing-sm2);font-size:var(--co-font-size-12);border-radius:var(--co-button-radius, var(--co-border-radius-full))}.co-button--square.co-button--l{padding:var(--co-spacing-lg) var(--co-spacing-xl);gap:var(--co-spacing-md);font-size:var(--co-font-size-18);border-radius:var(--co-border-radius-lg)}.co-button--square.co-button--m{padding:var(--co-spacing-md) var(--co-spacing-lg);gap:var(--co-spacing-sm2);font-size:var(--co-font-size-16);border-radius:var(--co-border-radius-sm)}.co-button--square.co-button--s{padding:var(--co-spacing-sm2) var(--co-spacing-md);gap:var(--co-spacing-sm);font-size:var(--co-font-size-14);border-radius:var(--co-border-radius-xs)}.co-button--square.co-button--xs{padding:var(--co-spacing-sm) var(--co-spacing-sm2);gap:var(--co-spacing-xs);font-size:var(--co-font-size-12);border-radius:var(--co-spacing-sm)}.co-button--disabled,.co-button:disabled{opacity:0.4;cursor:not-allowed;pointer-events:none}.co-button--primary:hover:not(:disabled){opacity:0.88}.co-button--secondary:hover:not(:disabled),.co-button--stroke:hover:not(:disabled){background:var(--co-semantic-surface-hover)}.co-button--ghost:hover:not(:disabled){background:color-mix(in srgb, var(--co-semantic-surface-hover) 60%, transparent);-webkit-backdrop-filter:var(--co-glass-filter, blur(var(--co-glass-blur)) saturate(var(--co-glass-saturate)));backdrop-filter:var(--co-glass-filter, blur(var(--co-glass-blur)) saturate(var(--co-glass-saturate)))}.co-button--danger:hover:not(:disabled),.co-button--success:hover:not(:disabled){opacity:0.88}.co-button:active:not(:disabled){transform:scale(0.97);transition-duration:var(--co-motion-duration-instant)}.co-button--primary{transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-out), background var(--co-motion-duration-fast) var(--co-motion-ease-out), transform var(--co-motion-duration-slow) var(--co-motion-ease-spring)}.co-button--secondary.co-button--elevated{box-shadow:var(--co-shadow-sm, 0 1px 2px 0 rgba(26, 26, 26, 0.04)), inset 0 0 0 1px var(--co-color-opacity-negro-8)}.co-button--ghost.co-button--surface-dark,.co-button--stroke.co-button--surface-dark{color:var(--co-color-base-blanco, #fff)}.co-button--ghost.co-button--surface-dark:hover:not(:disabled),.co-button--stroke.co-button--surface-dark:hover:not(:disabled){background:var(--co-color-opacity-blanco-16);-webkit-backdrop-filter:none;backdrop-filter:none}.co-button--danger.co-button--surface-dark:hover:not(:disabled){opacity:1;background:color-mix(in srgb, var(--co-semantic-status-error) 84%, var(--co-color-base-blanco, #fff))}.co-button--danger.co-button--surface-dark:focus-visible{box-shadow:0 0 0 2px color-mix(in srgb, var(--co-color-base-blanco, #fff) 45%, transparent)}::slotted([slot="icon-left"]),::slotted([slot="icon-right"]){display:inline-flex;flex-shrink:0}@supports not (background: color-mix(in srgb, red, transparent)){.co-button--primary{background:var(--co-semantic-surface-primary)}.co-button--secondary{background:var(--co-semantic-surface-secondary)}.co-button--stroke{background:transparent}}`;
|
|
4
4
|
|
|
5
5
|
const ICON_SIZE = { l: 20, m: 18, s: 16, xs: 14 };
|
|
6
6
|
const CoButton = class {
|
|
@@ -48,17 +48,17 @@ const CoCheckbox = class {
|
|
|
48
48
|
// Only override the fill when a custom color is provided AND the box is "on".
|
|
49
49
|
// Leaving this undefined keeps the default appearance byte-identical to before.
|
|
50
50
|
const boxStyle = this.checkedColor && isOn ? { background: this.checkedColor } : undefined;
|
|
51
|
-
return (h("div", { key: '
|
|
51
|
+
return (h("div", { key: 'cfcbd567066331d7751064f857407a8f9d56d386', class: {
|
|
52
52
|
'co-checkbox-row': true,
|
|
53
53
|
'co-checkbox-row--disabled': this.disabled,
|
|
54
|
-
}, onClick: this.handleClick }, h("span", { key: '
|
|
54
|
+
}, onClick: this.handleClick }, h("span", { key: '21c39833a43324e47718cc83ba74253f00e67e82', role: "checkbox", "aria-checked": this.indeterminate ? 'mixed' : String(this.checked), "aria-label": this.label || this.ariaLabelText || '', "aria-disabled": this.disabled ? 'true' : undefined, tabIndex: this.disabled ? -1 : 0, onKeyDown: this.handleKeyDown, class: {
|
|
55
55
|
'co-checkbox': true,
|
|
56
56
|
[`co-checkbox--${this.size}`]: true,
|
|
57
57
|
'co-checkbox--overlay': isOverlay,
|
|
58
58
|
'co-checkbox--checked': this.checked && !this.indeterminate,
|
|
59
59
|
'co-checkbox--indeterminate': this.indeterminate,
|
|
60
60
|
'co-checkbox--disabled': this.disabled,
|
|
61
|
-
}, style: boxStyle, part: "box" }, h("svg", { key: '
|
|
61
|
+
}, style: boxStyle, part: "box" }, h("svg", { key: '6e49dd81e78da092340b1cbdb5c45ee6e345fb3c', class: "co-checkbox__glyph", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true" }, h("path", { key: 'dbcadf848fb8cb64acea875fb03186258210c43f', class: "co-checkbox__check", d: "M3.5 8.5l3 3 6-6.5", pathLength: "1", "stroke-linecap": "round", "stroke-linejoin": "round" }), h("path", { key: '0b58a11353c3d8b8249e5852933f290cd63f0705', class: "co-checkbox__dash", d: "M3 8h10", pathLength: "1", "stroke-linecap": "round" }))), this.label && (h("span", { key: 'e1a4beabf2b472aeff1fe5ecd5bcb458e949ee11', class: "co-checkbox__label", part: "label" }, this.label))));
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
CoCheckbox.style = coCheckboxCss();
|
|
@@ -119,12 +119,13 @@ function parseValue(raw) {
|
|
|
119
119
|
* snapshotDisplay los que la página actual no contiene) + resto en orden de
|
|
120
120
|
* server; buscando → solo resultados reales, seleccionados primero.
|
|
121
121
|
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
122
|
+
* El bloque idle se recorre por `snapshotIds` (Set ordenado por selección, igual
|
|
123
|
+
* que `snapshotDisplay`) resolviendo cada id contra la página primero y contra el
|
|
124
|
+
* display después. Así un seleccionado AUSENTE de `snapshotDisplay` pero presente
|
|
125
|
+
* en `items` sigue en la lista: `rest` filtra todo id del snapshot, así que sin
|
|
126
|
+
* esa resolución desaparecía de la lista entera, no sólo del bloque de arriba.
|
|
127
|
+
* Un id que no está en ninguna de las dos fuentes no tiene nada que pintar y se
|
|
128
|
+
* ignora (no hay label que mostrar).
|
|
128
129
|
*/
|
|
129
130
|
function orderItems(items, snapshotIds, snapshotDisplay, searching) {
|
|
130
131
|
var _a;
|
|
@@ -133,8 +134,12 @@ function orderItems(items, snapshotIds, snapshotDisplay, searching) {
|
|
|
133
134
|
const byId = new Map(items.map((i) => [i._id, i]));
|
|
134
135
|
const selectedBlock = [];
|
|
135
136
|
if (!searching) {
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
const displayById = new Map(snapshotDisplay.map((d) => [d._id, d]));
|
|
138
|
+
for (const id of snapshotIds) {
|
|
139
|
+
const resolved = (_a = byId.get(id)) !== null && _a !== void 0 ? _a : displayById.get(id);
|
|
140
|
+
if (resolved)
|
|
141
|
+
selectedBlock.push(resolved);
|
|
142
|
+
}
|
|
138
143
|
}
|
|
139
144
|
else {
|
|
140
145
|
for (const i of items)
|
|
@@ -144,6 +149,24 @@ function orderItems(items, snapshotIds, snapshotDisplay, searching) {
|
|
|
144
149
|
const rest = items.filter((i) => !snapshotIds.has(i._id));
|
|
145
150
|
return [...selectedBlock, ...rest];
|
|
146
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* ¿Hay que re-tomar el snapshot selected-first por el cambio del término?
|
|
154
|
+
*
|
|
155
|
+
* Sólo en el flanco "había búsqueda → ya no": volver a la lista completa es un
|
|
156
|
+
* contexto de listado nuevo, y ahí el bloque de arriba tiene que incluir lo que
|
|
157
|
+
* se seleccionó DURANTE la sesión del panel. Sin esto, un panel abierto sin nada
|
|
158
|
+
* seleccionado se quedaba con el snapshot VACÍO para siempre (`orderItems`
|
|
159
|
+
* cortocircuita en `size === 0`): lo elegido mientras se buscaba desaparecía de
|
|
160
|
+
* la lista al limpiar el término, porque el servidor devuelve la página 1 y esos
|
|
161
|
+
* registros casi nunca están ahí. Se leía como "se deselecciona solo".
|
|
162
|
+
*
|
|
163
|
+
* El re-snapshot por SELECCIÓN no pasa por acá: vive en el componente
|
|
164
|
+
* (`@Watch('value')`, selected-first vivo desde 2026-09-14 — marcar sube la fila
|
|
165
|
+
* al instante). Esta función solo decide el flanco del TÉRMINO.
|
|
166
|
+
*/
|
|
167
|
+
function shouldResnapshotOnTerm(prevTerm, nextTerm) {
|
|
168
|
+
return !!prevTerm && !nextTerm;
|
|
169
|
+
}
|
|
147
170
|
/** Aplana a filas de render insertando un header cuando `group` cambia
|
|
148
171
|
* (groupItems de co-command-search). `index` cuenta solo items. */
|
|
149
172
|
function buildRows(items) {
|
|
@@ -333,10 +356,15 @@ const CoOptionList = class {
|
|
|
333
356
|
};
|
|
334
357
|
this.onSearchInput = (e) => {
|
|
335
358
|
const v = e.target.value;
|
|
359
|
+
// Al volver a la lista completa el bloque selected-first se rearma con lo que
|
|
360
|
+
// se seleccionó durante la sesión del panel (ver shouldResnapshotOnTerm).
|
|
361
|
+
const resnapshot = shouldResnapshotOnTerm(this.term, v);
|
|
336
362
|
this.term = v;
|
|
337
363
|
this.activeIndex = -1;
|
|
338
364
|
// Resultset nuevo: re-habilita fillViewport aunque venga del mismo largo.
|
|
339
365
|
this.lastFillLen = -1;
|
|
366
|
+
if (resnapshot)
|
|
367
|
+
this.takeSnapshot();
|
|
340
368
|
if (this.debounceTimer)
|
|
341
369
|
clearTimeout(this.debounceTimer);
|
|
342
370
|
this.debounceTimer = setTimeout(() => this.coSearch.emit(v), this.searchDebounce);
|
|
@@ -507,6 +535,27 @@ const CoOptionList = class {
|
|
|
507
535
|
this.scrollTop = maxScrollTop;
|
|
508
536
|
}
|
|
509
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* Selected-first VIVO (decisión de producto 2026-09-14, campo Colaboradores):
|
|
540
|
+
* la partición sigue a `value` — marcar un ítem lo sube al bloque de
|
|
541
|
+
* seleccionados al instante y desmarcarlo lo devuelve a su lugar del orden del
|
|
542
|
+
* server. Reemplaza el snapshot congelado al abrir (evitaba saltos, pero se
|
|
543
|
+
* leía como "no pasó nada" al elegir). El reacomodo se anima con el mismo FLIP
|
|
544
|
+
* del reorder: tops capturados ANTES de re-particionar, runFlip corre en
|
|
545
|
+
* componentDidRender. El highlight de teclado se queda sobre el MISMO ítem
|
|
546
|
+
* (Enter sobre una fila la mueve; el índice viejo apuntaría a otra fila).
|
|
547
|
+
* Tras un drop del reorder el host manda el value en el orden del preview:
|
|
548
|
+
* mismo orden → deltas 0 → no-op visual.
|
|
549
|
+
*/
|
|
550
|
+
onValueChange() {
|
|
551
|
+
var _a;
|
|
552
|
+
if (!this.selectedFirst)
|
|
553
|
+
return;
|
|
554
|
+
const activeId = this.activeIndex >= 0 ? (_a = this.orderedItems[this.activeIndex]) === null || _a === void 0 ? void 0 : _a._id : undefined;
|
|
555
|
+
this.pendingFlip = { tops: this.captureRowTops(), movedId: '', spring: false };
|
|
556
|
+
this.takeSnapshot();
|
|
557
|
+
this.activeIndex = activeId ? this.orderedItems.findIndex((i) => i._id === activeId) : -1;
|
|
558
|
+
}
|
|
510
559
|
// ── Métodos públicos ───────────────────────────────────────
|
|
511
560
|
/** Re-toma el snapshot selected-first. El host la llama al abrir su panel. */
|
|
512
561
|
async snapshotOrder() {
|
|
@@ -938,16 +987,19 @@ const CoOptionList = class {
|
|
|
938
987
|
const selectedIds = this.selectedIds;
|
|
939
988
|
const { hasMore, remaining } = deriveMore(this.parsedItems.length, this.total, this.hasMore);
|
|
940
989
|
const showClear = !!this.clearOptionLabel && selectedIds.length > 0;
|
|
941
|
-
return (h("div", { key: '
|
|
990
|
+
return (h("div", { key: '3d1df259b90836a6a125627e850ff2d2e1556d4c', class: "co-option-list", onKeyDown: this.onRootKeyDown }, this.searchable && (h("div", { key: '181a0c89ff38821301c0728f4eb5edb9c4e11b2d', class: "co-option-list__search", part: "search" }, h("co-icon", { key: 'cac54346c457d884fbbc1257b00dbe932e5419ca', name: "magnifying-glass", size: 16 }), h("input", { key: 'bbc27b7821651189718cf763e689dd08e6fa0050', class: "co-option-list__search-input", type: "text", placeholder: this.searchPlaceholder, value: this.term, onInput: this.onSearchInput, ref: (el) => (this.searchInputEl = el), role: "combobox", "aria-expanded": "true", "aria-autocomplete": "list" }))), h("div", { key: '993c2308c9d6e1958f8f3ddc73b08e9ebc0bd409', class: "co-option-list__options", part: "options", role: "listbox", "aria-multiselectable": this.multiple ? 'true' : 'false', ref: (el) => (this.optionsEl = el), onScroll: this.onNativeScroll }, h("div", { key: '458e04427d5dd6a4e74537483b18d8e4ba9c71a5', class: "co-option-list__inner" }, showClear && (h("button", { key: '03d067e6a79dfb51f39aa52ad8b7b6464aa2f37d', class: "co-option-list__clear-row", type: "button", onClick: () => this.coClearSelection.emit() }, h("co-icon", { key: '394b7c318f942d74cb7d68859aa54fce5ed2dc58', name: "x-circle", size: 14 }), h("span", { key: '3dd47de0ed422bb5dd3a3c63ac7dc3936578fdaa' }, this.clearOptionLabel))), this.loading && items.length === 0 && (h("div", { key: '02dae3b4322ce67325617870c090fd3f3946f8c1', class: "co-option-list__loading" }, h("co-loader", { key: 'aaa67b4cf0f37be7364cbd00f2b156bed4018c13', size: "sm" }))), !this.loading && items.length === 0 && (h("div", { key: 'caa5a5b33817577084b9e82a40f97632972e5068', class: "co-option-list__empty" }, h("co-icon", { key: '0cd622efe4ea8bc4483322b4a81c5e3a254f08ab', name: "magnifying-glass", size: 20 }), h("span", { key: 'ca1fb6cf98eacba682f308f610befe6f9da9edd2' }, this.emptyMessage))), items.length > 0 && this.virtual
|
|
942
991
|
? this.renderVirtual(items, selectedIds)
|
|
943
992
|
: buildRows(items).map((row) => row.kind === 'header'
|
|
944
993
|
? h("div", { class: "co-option-list__group", role: "presentation" }, row.label)
|
|
945
|
-
: this.renderRow(row.item, row.index, selectedIds)), this.loading && items.length > 0 && (h("div", { key: '
|
|
994
|
+
: this.renderRow(row.item, row.index, selectedIds)), this.loading && items.length > 0 && (h("div", { key: '7e9ce17adba91610cf8c2b4c7c1d544db4879122', class: "co-option-list__loading-more" }, h("co-loader", { key: '974bc5404e175c89f6a1972900f2e3b8e2d95373', size: "sm" }))), !this.loading && hasMore && remaining > 0 && (h("div", { key: '34261e4bf8349cd4973a642d7137e72f80c2a867', class: "co-option-list__more" }, remaining, " more results")))), h("slot", { key: 'e350a3a8e731f6d2bb609c84cd0e601e93e6b063', name: "footer" })));
|
|
946
995
|
}
|
|
947
996
|
get el() { return getElement(this); }
|
|
948
997
|
static get watchers() { return {
|
|
949
998
|
"items": [{
|
|
950
999
|
"onItemsChange": 0
|
|
1000
|
+
}],
|
|
1001
|
+
"value": [{
|
|
1002
|
+
"onValueChange": 0
|
|
951
1003
|
}]
|
|
952
1004
|
}; }
|
|
953
1005
|
};
|
|
@@ -465,6 +465,12 @@ const CoColorPicker = class {
|
|
|
465
465
|
};
|
|
466
466
|
this.handleGridKeyDown = (e) => {
|
|
467
467
|
var _a;
|
|
468
|
+
// La grilla es el único control del panel que es un `<div>`: no hereda
|
|
469
|
+
// `disabled` del DOM como el range o el input, así que el guard tiene que
|
|
470
|
+
// ser explícito. Sin él, deshabilitar con el panel abierto dejaba la
|
|
471
|
+
// navegación por flechas viva y Enter commiteando sobre un campo apagado.
|
|
472
|
+
if (this.disabled)
|
|
473
|
+
return;
|
|
468
474
|
// `presetGroups` re-parsea el JSON de `presets` y remapea en CADA lectura, y
|
|
469
475
|
// todos los consumidores reales pasan presets custom por prop: se resuelve
|
|
470
476
|
// UNA vez por tecla y se pasa por parámetro, no dos veces por getter.
|
|
@@ -690,8 +696,10 @@ const CoColorPicker = class {
|
|
|
690
696
|
* que `this.hsv` llega `undefined` al primer render y el destructuring de
|
|
691
697
|
* `renderArea` tira). Los otros @State del componente lo toleraban porque
|
|
692
698
|
* `undefined` es falsy justo donde se usan.
|
|
693
|
-
* Sin hex válido el estado arranca en
|
|
694
|
-
*
|
|
699
|
+
* Sin hex válido el estado arranca en `EMPTY_HSV` —rojo puro, el vértice
|
|
700
|
+
* VIVO—, no en negro: ver su docstring, que explica por qué el vértice negro
|
|
701
|
+
* dejaría dos de los tres controles sin poder producir color. Es un seed de
|
|
702
|
+
* display; `value` sigue vacío y el trigger sigue mostrando el placeholder.
|
|
695
703
|
*/
|
|
696
704
|
componentWillLoad() {
|
|
697
705
|
const parsed = hexToHsv(this.value || '');
|
|
@@ -853,6 +861,11 @@ const CoColorPicker = class {
|
|
|
853
861
|
}
|
|
854
862
|
}
|
|
855
863
|
handleSwatchClick(hex) {
|
|
864
|
+
// Mismo guard que el resto de los controles del panel: el host puede
|
|
865
|
+
// deshabilitar el campo CON EL PANEL ABIERTO, y un swatch deshabilitado no
|
|
866
|
+
// commitea. El `pointer-events:none` del CSS tapa el mouse, no el teclado.
|
|
867
|
+
if (this.disabled)
|
|
868
|
+
return;
|
|
856
869
|
// Elegir un preset es un commit como cualquier otro: la asignación y el
|
|
857
870
|
// emit viven en `commit`, no duplicados acá (si no, el swatch dejaría el
|
|
858
871
|
// HSV del color anterior y el área abriría en el color equivocado).
|
|
@@ -958,7 +971,16 @@ const CoColorPicker = class {
|
|
|
958
971
|
h("div", { class: "co-color-picker__grid-group", key: g.from, role: g.label ? 'group' : 'presentation', "aria-label": g.label }, g.items.map((preset, j) => {
|
|
959
972
|
const i = g.from + j;
|
|
960
973
|
const selected = preset.value.toUpperCase() === (this.value || '').toUpperCase();
|
|
961
|
-
return (h("div", { key: preset.value, role: "option", "aria-selected": selected ? 'true' : 'false', "aria-label": preset.name,
|
|
974
|
+
return (h("div", { key: preset.value, role: "option", "aria-selected": selected ? 'true' : 'false', "aria-label": preset.name,
|
|
975
|
+
// El `aria-label` cubre al lector de pantalla; al usuario con
|
|
976
|
+
// mouse no le dice nada. Sin el `title`, la paleta por default
|
|
977
|
+
// deja dos grises contiguos ("Humo" y "Hueso") indistinguibles
|
|
978
|
+
// salvo por el pixel de color. El tooltip nativo es la
|
|
979
|
+
// convención de este design system para celdas de grilla
|
|
980
|
+
// —co-emoji-picker:419 hace exactamente esto, y el propio
|
|
981
|
+
// panel ya lo usa en gotero y copiar—; la regla que lo prohíbe
|
|
982
|
+
// es de suite-v2, no de cobalt core.
|
|
983
|
+
title: preset.name, tabIndex: i === this.focusedIndex ? 0 : -1, class: {
|
|
962
984
|
'co-color-picker__grid-item': true,
|
|
963
985
|
'co-color-picker__grid-item--selected': selected,
|
|
964
986
|
// Un swatch claro se pierde contra el panel: se decide por
|
|
@@ -1081,12 +1103,20 @@ const CoColorPicker = class {
|
|
|
1081
1103
|
this.hsv = EMPTY_HSV;
|
|
1082
1104
|
if ((this.value || '').toUpperCase() === (target || '').toUpperCase())
|
|
1083
1105
|
return;
|
|
1084
|
-
// SIN sellar:
|
|
1085
|
-
//
|
|
1106
|
+
// SIN sellar a mano: el @Watch re-deriva el HSV —que es lo que hace volver
|
|
1107
|
+
// el área al color commiteado en vez de quedarse en el abandonado— y sella
|
|
1108
|
+
// `emitted` él mismo, ANTES del guard de parseo, así que también cubre el
|
|
1109
|
+
// caso en que `target` no es un hex (nunca se commiteó nada y el campo
|
|
1110
|
+
// vuelve a vacío).
|
|
1111
|
+
//
|
|
1112
|
+
// Acá vivía un `this.emitted = target` con un comentario que describía el
|
|
1113
|
+
// orden VIEJO de `syncFromValue` (sellado gateado por el parseo). Desde que
|
|
1114
|
+
// el sellado subió, la línea era muerta por dos vías: o el @Watch ya la
|
|
1115
|
+
// dejó idéntica, o entró por su guard de eco —que compara contra `emitted`—
|
|
1116
|
+
// y entonces `emitted` ya era `target` salvo por mayúsculas, que es el único
|
|
1117
|
+
// lector que tiene. Medido: una sonda en esa línea sobre la suite entera la
|
|
1118
|
+
// alcanza cuatro veces y las cuatro con `emitted === target` estricto.
|
|
1086
1119
|
this.value = target;
|
|
1087
|
-
// El @Watch no sella cuando `target` no es un hex (nunca se commiteó nada y
|
|
1088
|
-
// el campo vuelve a vacío), así que se sella acá.
|
|
1089
|
-
this.emitted = target;
|
|
1090
1120
|
// El preview se anunció por `coInput`; retirarlo también. Un host que
|
|
1091
1121
|
// previsualiza en vivo se quedaría si no con el color que nadie eligió.
|
|
1092
1122
|
this.coInput.emit(target);
|
|
@@ -1124,12 +1154,12 @@ const CoColorPicker = class {
|
|
|
1124
1154
|
render() {
|
|
1125
1155
|
const hasValue = !!this.value;
|
|
1126
1156
|
const statusClass = this.status !== 'default' ? `co-color-picker--${this.status}` : '';
|
|
1127
|
-
return (h("div", { key: '
|
|
1157
|
+
return (h("div", { key: '5e4239ff9ef0dc3f15004898d2d891f8d231e95d', class: `co-color-picker co-color-picker--${this.size} ${statusClass} ${this.isOpen ? 'co-color-picker--open' : ''} ${this.disabled ? 'co-color-picker--disabled' : ''}` }, this.label && (h("label", { key: '003a893c3c840cd03d87c4291795499ac80b8b73', class: "co-color-picker__label" }, this.label, h(RequiredMark, { key: '4c14eaf668b0677b91b23a00f001ffaa4c21f5c5', required: this.required }))), h("co-popover", { key: 'f4a489f77c2d629ea1d9b69786cfad0f95d5422b', open: this.isOpen, placement: "bottom-start",
|
|
1128
1158
|
// Sin `matchWidth`: el panel tiene ancho INTRÍNSECO (grilla de 8
|
|
1129
1159
|
// swatches fijos de 32px). Copiar el ancho del trigger achica los
|
|
1130
1160
|
// tracks bajo 32px con un campo angosto (media columna de un modal) y
|
|
1131
1161
|
// los swatches desbordan el card — guard: panel-width.spec.
|
|
1132
|
-
offset: 4, onCoOpen: this.handlePopoverOpen, onCoClose: this.handlePopoverClose }, h("div", { key: '
|
|
1162
|
+
offset: 4, onCoOpen: this.handlePopoverOpen, onCoClose: this.handlePopoverClose }, h("div", { key: '229e0095d6b6a723e77cf0d001d780cf51116851', slot: "trigger", class: "co-color-picker__trigger", role: "combobox", "aria-expanded": this.isOpen ? 'true' : 'false', "aria-haspopup": "dialog", "aria-controls": this.isOpen ? CoColorPicker.PANEL_ID : undefined, "aria-label": this.label || undefined, "aria-disabled": this.disabled ? 'true' : undefined, tabIndex: this.disabled ? -1 : 0, ref: (el) => (this.triggerEl = el), onKeyDown: this.handleTriggerKeyDown }, h("span", { key: '9267f104b7f0542653038ef381fb81a7f7f0188e', class: "co-color-picker__swatch", style: { background: hasValue ? this.value : 'transparent' } }), h("span", { key: '64efb900a60576022b3f487db56380973d2934c9', class: `co-color-picker__value ${!hasValue ? 'co-color-picker__value--empty' : ''}` }, hasValue ? this.value : this.placeholder)), this.isOpen && (h("div", { key: '22abcb6c79531f41a6655fc48320e4c108a33049', class: "co-color-picker__panel", id: CoColorPicker.PANEL_ID, role: "dialog", "aria-label": this.label || this.placeholder }, this.renderArea(), this.renderHue(), this.renderSwatches(), this.renderHexRow()))), this.helperText && (h("div", { key: '901b7094f7da8c09ea25cad568eda8d5fcaf2d6e', class: "co-color-picker__helper" }, this.statusIcon && (h("co-icon", { key: 'fb341f791466f133f6a6c4bd04a8dd71c519c7c0', name: this.statusIcon, size: 14, weight: "fill", class: "co-color-picker__helper-icon" })), h("span", { key: '0ecfc7d46a07c741d42b59660979559fb78117df', class: "co-color-picker__helper-text" }, this.helperText)))));
|
|
1133
1163
|
}
|
|
1134
1164
|
get el() { return getElement(this); }
|
|
1135
1165
|
static get watchers() { return {
|