openvibers/openvibe.shared dock-mount.js
dock-mount.js
| 1 | // The Dock body inside a host sheet. Loaded only when mountInto is first used. |
| 2 | (function (root) { |
| 3 | ; |
| 4 | function mount(host, first, bridge) { |
| 5 | if (!document.getElementById('ovdk-mount-styles')) { |
| 6 | const style = document.createElement('style'); |
| 7 | style.id = 'ovdk-mount-styles'; |
| 8 | style.textContent = ` |
| 9 | .ovdk.ovdk-inline, .ovdk.ovdk-inline[data-corner] { position: relative !important; inset: auto !important; z-index: auto !important; width: 100% !important; height: 100% !important; max-width: 100% !important; max-height: none !important; min-height: 0; padding: 0 !important; border: 0; border-radius: 0; box-shadow: none !important; transform: none !important; animation: none !important; } |
| 10 | .ovdk-inline .ovdk-body { width: 100%; min-width: 0; border: 0; overflow: hidden; } |
| 11 | .ovdk-inline .ovdk-panel { min-width: 0; overflow-x: hidden; } |
| 12 | @media (max-width: 640px) { .ovdk-inline button, .ovdk-inline a, .ovdk-inline summary, .ovdk-inline input, .ovdk-inline textarea { min-height: 44px !important; max-height: none !important; box-sizing: border-box; } } |
| 13 | `; |
| 14 | document.head.append(style); |
| 15 | } |
| 16 | const wrap = document.createElement('section'); |
| 17 | wrap.className = 'ovdk ovdk-inline'; |
| 18 | wrap.setAttribute('aria-label', 'Dock panel'); |
| 19 | host.replaceChildren(wrap); |
| 20 | bridge.start(wrap); |
| 21 | let gone = false; |
| 22 | const show = (tab) => { if (!gone) bridge.show(tab); }; |
| 23 | show(first); |
| 24 | return { show, destroy() { if (gone) return; gone = true; bridge.end(); host.replaceChildren(); } }; |
| 25 | } |
| 26 | root.OpenVibeDockMount = { mount }; |
| 27 | })(typeof window !== 'undefined' ? window : globalThis); |
| 28 |