@netless/window-manager 0.3.18 → 0.4.0-canary.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/dist/style.css CHANGED
@@ -1 +1 @@
1
- .netless-window-manager-playground{width:100%;height:100%;position:relative;z-index:1;overflow:hidden;user-select:none}.netless-window-manager-sizer{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;overflow:hidden;display:flex}.netless-window-manager-sizer-horizontal{flex-direction:column}.netless-window-manager-sizer:before,.netless-window-manager-sizer:after{flex:1;content:"";display:block}.netless-window-manager-chess-sizer:before,.netless-window-manager-chess-sizer:after{background-image:linear-gradient(45deg,#b0b0b0 25%,transparent 25%),linear-gradient(-45deg,#b0b0b0 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#b0b0b0 75%),linear-gradient(-45deg,transparent 75%,#b0b0b0 75%);background-color:#fff;background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0px}.netless-window-manager-wrapper{position:relative;z-index:1;width:100%;height:100%;overflow:hidden}.netless-window-manager-main-view{width:100%;height:100%}.netless-window-manager-cursor-pencil-image{width:26px;height:26px}.netless-window-manager-cursor-eraser-image{width:26px;height:26px}.netless-window-manager-cursor-selector-image{width:24px;height:24px}.netless-window-manager-cursor-selector-avatar{border-radius:50%;border-style:solid;border-width:2px;border-color:#fff;margin-bottom:2px}.netless-window-manager-cursor-selector-avatar img{width:12px}.netless-window-manager-cursor-inner{border-radius:4px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:4px;padding-right:4px;font-size:12px}.netless-window-manager-cursor-inner-mellow{height:32px;border-radius:16px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:16px;padding-right:16px}.netless-window-manager-cursor-tag-name{font-size:12px;margin-left:4px;padding:2px 8px;border-radius:4px}.netless-window-manager-cursor-mid{display:flex;flex-direction:column;align-items:center;justify-content:center;position:fixed;width:26px;height:26px;z-index:2147483647;left:0;top:0;will-change:transform;transition:transform .05s;transform-origin:0 0;user-select:none}.netless-window-manager-cursor-pencil-offset{margin-left:-20px}.netless-window-manager-cursor-selector-offset{margin-left:-22px;margin-top:56px}.netless-window-manager-cursor-text-offset{margin-left:-30px;margin-top:18px}.netless-window-manager-cursor-shape-offset{display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:180px;height:64px;margin-left:-30px;margin-top:12px}.netless-window-manager-cursor-name{width:100%;height:48px;display:flex;align-items:center;justify-content:center;position:absolute;top:-40px}.cursor-image-wrapper{display:flex;justify-content:center}.tele-fancy-scrollbar{overscroll-behavior:contain;overflow:auto;overflow-y:scroll;overflow-y:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.tele-fancy-scrollbar::-webkit-scrollbar{height:8px;width:8px}.tele-fancy-scrollbar::-webkit-scrollbar-track{background-color:transparent}.tele-fancy-scrollbar::-webkit-scrollbar-thumb{background-color:#444e601a;background-color:transparent;border-radius:4px;transition:background-color .4s}.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb{background-color:#444e601a}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover{background-color:#444e6033}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active{background-color:#444e6033}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical{min-height:50px}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-box{position:absolute;top:0;left:0;z-index:100;will-change:transform;transition:width .4s cubic-bezier(.4,.9,.71,1.02),height .4s cubic-bezier(.55,.82,.63,.95),opacity .6s cubic-bezier(.7,0,.84,0),transform .4s ease}.telebox-box-main{position:relative;width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;background:#f9f9fc;box-shadow:0 4px 10px #2f419226;border-radius:6px;border:1px solid #e3e3ec}.telebox-titlebar-wrap{flex-shrink:0;position:relative;z-index:1}.telebox-content-wrap{flex:1;width:100%;overflow:hidden;display:flex;justify-content:center;align-items:center}.telebox-content{width:100%;height:100%;position:relative}.telebox-footer-wrap{flex-shrink:0;display:flex;flex-direction:column}.telebox-footer-wrap:before{content:"";display:block;flex:1}.telebox-resize-handle{position:absolute;z-index:2147483647}.telebox-n{width:100%;height:5px;left:0;top:-5px;cursor:n-resize}.telebox-s{width:100%;height:5px;left:0;bottom:-5px;cursor:s-resize}.telebox-w{width:5px;height:100%;left:-5px;top:0;cursor:w-resize}.telebox-e{width:5px;height:100%;right:-5px;top:0;cursor:e-resize}.telebox-nw{width:15px;height:15px;top:-5px;left:-5px;cursor:nw-resize}.telebox-ne{width:15px;height:15px;top:-5px;right:-5px;cursor:ne-resize}.telebox-se{width:15px;height:15px;bottom:-5px;right:-5px;cursor:se-resize}.telebox-sw{width:15px;height:15px;bottom:-5px;left:-5px;cursor:sw-resize}.telebox-track-mask{position:fixed;top:0;left:0;z-index:2147483647;width:100%;height:100%;background:rgba(0,0,0,.0001);cursor:move}.telebox-cursor-n{cursor:n-resize}.telebox-cursor-s{cursor:s-resize}.telebox-cursor-w{cursor:w-resize}.telebox-cursor-e{cursor:e-resize}.telebox-cursor-nw{cursor:nw-resize}.telebox-cursor-ne{cursor:ne-resize}.telebox-cursor-se{cursor:se-resize}.telebox-cursor-sw{cursor:sw-resize}.telebox-maximized .telebox-resize-handles,.telebox-no-resize .telebox-resize-handles{display:none}.telebox-maximized{box-shadow:none;transition:none}.telebox-minimized{will-change:transform;transition:width 50ms cubic-bezier(.4,.9,.71,1.02),height 50ms cubic-bezier(.55,.82,.63,.95),opacity .6s cubic-bezier(.7,0,.84,0),transform .6s ease;opacity:0;pointer-events:none;user-select:none}.telebox-transforming{will-change:transform;transition:opacity .6s cubic-bezier(.7,0,.84,0)}.telebox-readonly .telebox-resize-handle{cursor:initial!important;pointer-events:none!important}.telebox-color-scheme-dark .telebox-box-main{color:#e9e9e9;background:#212126;border-color:#43434d}.telebox-titlebar{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;background:#fff;user-select:none;border-bottom:1px solid #eeeef7}.telebox-title{overflow:hidden;margin:0 24px 0 0;padding:0;font-size:14px;font-weight:400;font-family:PingFangSC-Regular,PingFang SC;white-space:nowrap;word-break:keep-all;text-overflow:ellipsis;color:#191919}.telebox-titlebar-btns{white-space:nowrap;word-break:keep-all;margin-left:auto;font-size:0}.telebox-titlebar-btn{width:22px;height:22px;padding:0;outline:0;border:none;background:0 0;cursor:pointer}.telebox-titlebar-btn~.telebox-titlebar-btn{margin-left:10px}.telebox-titlebar-btn-icon{width:22px;height:22px}.telebox-readonly .telebox-titlebar-btn{cursor:not-allowed}.telebox-titlebar-icon-minimize{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPHBhdGggZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNOSAxM2gxMHYxLjZIOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=)}.telebox-titlebar-icon-maximize{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPGcgZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBtYXNrPSJ1cmwoI2IpIj4KICAgICAgICAgICAgPHBhdGgKICAgICAgICAgICAgICAgIGQ9Ik0yMC40ODEgMTcuMWgxLjJ2NC41ODFIMTcuMXYtMS4yaDMuMzgxVjE3LjF6bS0xNC4xOTA1LS4wMDloMS4ydjMuMzgxaDMuMzgwOXYxLjJoLTQuNTgxdi00LjU4MXpNMTcuMSA2LjE5MDVoNC41ODF2NC41ODA5aC0xLjJ2LTMuMzgxSDE3LjF2LTEuMnptLTEwLjcwMDguMTA4N2g0Ljc5ODV2MS4ySDcuNTk5MnYzLjU5ODVoLTEuMlY2LjI5OTJ6IiAvPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==)}.telebox-titlebar-icon-maximize.is-active{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjZ2MjZIMHoiIC8+CiAgICAgICAgPHBhdGggaWQ9ImMiIGQ9Ik0yNi44NjkgMEwyOCAxLjEzMVYyNi44N0wyNi44NjkgMjhIMS4xM0wwIDI2Ljg3VjEuMTMxTDEuMTMgMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPgogICAgICAgICAgICA8bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNhIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tNC42NDI5LTQuNjQyOWgzNS4yODU4djM1LjI4NThILTQuNjQyOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxnPgogICAgICAgICAgICA8bWFzayBpZD0iZCIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNjIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tMTcuNTE2OCAxNEwxNC0xNy41MTY4IDQ1LjUxNjggMTQgMTQgNDUuNTE2OHoiIG1hc2s9InVybCgjZCkiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxwYXRoIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjIiCiAgICAgICAgICAgIGQ9Ik0xMC4wODg2IDIxLjQ4NjV2LTMuNjk2Nkg2LjM5Mk0yMS4zODU1IDEwLjE4OTVoLTMuNjk2NlY2LjQ5M00yMS40MDIgMTcuNzk4M2gtMy42OTY2djMuNjk2Nk0xMC4yNTAzIDYuMTQ5OHYzLjg5ODVINi4zNTE3IiAvPgogICAgPC9nPgo8L3N2Zz4K)}.telebox-titlebar-icon-close{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyOCAyOCI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjQiPgogICAgICAgIDxwYXRoIGQ9Ik04LjM1MyAyMC4zMzIxTDIwLjMzMiA4LjM1M00yMC4zMzIyIDIwLjMzMjFMOC4zNTMgOC4zNTMiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=)}.telebox-color-scheme-dark .telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-collector{visibility:hidden;display:block;position:absolute;z-index:200;width:40px;height:40px;margin:0;padding:0;border:none;outline:0;font-size:0;border-radius:50%;background:#fff;box-shadow:0 2px 6px #2f419226;cursor:pointer;user-select:none;pointer-events:none;background-repeat:no-repeat;background-size:18px 16px;background-position:center}.telebox-collector-visible{visibility:visible;pointer-events:initial}.telebox-collector-readonly{cursor:not-allowed}.telebox-color-scheme-dark.telebox-collector{background-color:#43434d}.telebox-max-titlebar{display:none;position:absolute;top:0;left:0;z-index:50000;user-select:none}.telebox-max-titlebar-maximized{display:flex}.telebox-titles{flex:1;height:100%;margin:0 16px 0 -16px;overflow-y:hidden;overflow-x:scroll;overflow-x:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.telebox-titles::-webkit-scrollbar{height:8px;width:8px}.telebox-titles::-webkit-scrollbar-track{background-color:transparent}.telebox-titles::-webkit-scrollbar-thumb{background-color:#eeeef7cc;background-color:transparent;border-radius:4px;transition:background-color .4s}.telebox-titles:hover::-webkit-scrollbar-thumb{background-color:#eeeef7cc}.telebox-titles::-webkit-scrollbar-thumb:hover{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:active{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:vertical{min-height:50px}.telebox-titles::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-titles-content{height:100%;display:flex;flex-wrap:nowrap;align-items:center;padding:0}.telebox-titles-tab{overflow:hidden;max-width:182px;min-width:50px;padding:0 26px 0 16px;outline:0;font-size:13px;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;border:none;border-right:1px solid #e5e5f0;color:#7b88a0;background:0 0;cursor:pointer}.telebox-titles-tab~.telebox-titles-tab{margin-left:2px}.telebox-titles-tab-focus{color:#357bf6}.telebox-readonly .telebox-titles-tab{cursor:not-allowed}.telebox-color-scheme-dark{color-scheme:dark}.telebox-color-scheme-dark.telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-color-scheme-dark .telebox-titles-tab{border-right-color:#7b88a0}.telebox-color-scheme-dark .telebox-title{color:#e9e9e9}
1
+ .netless-window-manager-playground{width:100%;height:100%;position:relative;z-index:1;overflow:hidden;user-select:none}.netless-window-manager-sizer{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;overflow:hidden;display:flex}.netless-window-manager-sizer-horizontal{flex-direction:column}.netless-window-manager-sizer:before,.netless-window-manager-sizer:after{flex:1;content:"";display:block}.netless-window-manager-chess-sizer:before,.netless-window-manager-chess-sizer:after{background-image:linear-gradient(45deg,#b0b0b0 25%,transparent 25%),linear-gradient(-45deg,#b0b0b0 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#b0b0b0 75%),linear-gradient(-45deg,transparent 75%,#b0b0b0 75%);background-color:#fff;background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0px}.netless-window-manager-wrapper{position:relative;z-index:1;width:100%;height:100%;overflow:hidden}.netless-window-manager-main-view{width:100%;height:100%}.netless-window-manager-cursor-pencil-image{width:26px;height:26px}.netless-window-manager-cursor-eraser-image{width:26px;height:26px}.netless-window-manager-cursor-selector-image{width:24px;height:24px}.netless-window-manager-cursor-selector-avatar{border-radius:50%;border-style:solid;border-width:2px;border-color:#fff;margin-bottom:2px}.netless-window-manager-cursor-selector-avatar img{width:12px}.netless-window-manager-cursor-inner{border-radius:4px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:4px;padding-right:4px;font-size:12px}.netless-window-manager-cursor-inner-mellow{height:32px;border-radius:16px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:16px;padding-right:16px}.netless-window-manager-cursor-tag-name{font-size:12px;margin-left:4px;padding:2px 8px;border-radius:4px}.netless-window-manager-cursor-mid{display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:26px;height:26px;z-index:2147483647;left:0;top:0;will-change:transform;transition:transform .05s;transform-origin:0 0;user-select:none}.netless-window-manager-cursor-pencil-offset{margin-left:-20px}.netless-window-manager-cursor-selector-offset{margin-left:-22px;margin-top:56px}.netless-window-manager-cursor-text-offset{margin-left:-30px;margin-top:18px}.netless-window-manager-cursor-shape-offset{display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:180px;height:64px;margin-left:-30px;margin-top:12px}.netless-window-manager-cursor-name{width:100%;height:48px;display:flex;align-items:center;justify-content:center;position:absolute;top:-40px}.cursor-image-wrapper{display:flex;justify-content:center}.tele-fancy-scrollbar{overscroll-behavior:contain;overflow:auto;overflow-y:scroll;overflow-y:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.tele-fancy-scrollbar::-webkit-scrollbar{height:8px;width:8px}.tele-fancy-scrollbar::-webkit-scrollbar-track{background-color:transparent}.tele-fancy-scrollbar::-webkit-scrollbar-thumb{background-color:#444e601a;background-color:transparent;border-radius:4px;transition:background-color .4s}.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb{background-color:#444e601a}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover{background-color:#444e6033}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active{background-color:#444e6033}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical{min-height:50px}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-box{position:absolute;top:0;left:0;z-index:100;will-change:transform;transition:width .4s cubic-bezier(.4,.9,.71,1.02),height .4s cubic-bezier(.55,.82,.63,.95),opacity .6s cubic-bezier(.7,0,.84,0),transform .4s ease}.telebox-box-main{position:relative;width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;background:#f9f9fc;box-shadow:0 4px 10px #2f419226;border-radius:6px;border:1px solid #e3e3ec}.telebox-titlebar-wrap{flex-shrink:0;position:relative;z-index:1}.telebox-content-wrap{flex:1;width:100%;overflow:hidden;display:flex;justify-content:center;align-items:center}.telebox-content{width:100%;height:100%;position:relative}.telebox-footer-wrap{flex-shrink:0;display:flex;flex-direction:column}.telebox-footer-wrap:before{content:"";display:block;flex:1}.telebox-resize-handle{position:absolute;z-index:2147483647}.telebox-n{width:100%;height:5px;left:0;top:-5px;cursor:n-resize}.telebox-s{width:100%;height:5px;left:0;bottom:-5px;cursor:s-resize}.telebox-w{width:5px;height:100%;left:-5px;top:0;cursor:w-resize}.telebox-e{width:5px;height:100%;right:-5px;top:0;cursor:e-resize}.telebox-nw{width:15px;height:15px;top:-5px;left:-5px;cursor:nw-resize}.telebox-ne{width:15px;height:15px;top:-5px;right:-5px;cursor:ne-resize}.telebox-se{width:15px;height:15px;bottom:-5px;right:-5px;cursor:se-resize}.telebox-sw{width:15px;height:15px;bottom:-5px;left:-5px;cursor:sw-resize}.telebox-track-mask{position:fixed;top:0;left:0;z-index:2147483647;width:100%;height:100%;background:rgba(0,0,0,.0001);cursor:move}.telebox-cursor-n{cursor:n-resize}.telebox-cursor-s{cursor:s-resize}.telebox-cursor-w{cursor:w-resize}.telebox-cursor-e{cursor:e-resize}.telebox-cursor-nw{cursor:nw-resize}.telebox-cursor-ne{cursor:ne-resize}.telebox-cursor-se{cursor:se-resize}.telebox-cursor-sw{cursor:sw-resize}.telebox-maximized .telebox-resize-handles,.telebox-no-resize .telebox-resize-handles{display:none}.telebox-maximized{box-shadow:none;transition:none}.telebox-minimized{will-change:transform;transition:width 50ms cubic-bezier(.4,.9,.71,1.02),height 50ms cubic-bezier(.55,.82,.63,.95),opacity .6s cubic-bezier(.7,0,.84,0),transform .6s ease;opacity:0;pointer-events:none;user-select:none}.telebox-transforming{will-change:transform;transition:opacity .6s cubic-bezier(.7,0,.84,0)}.telebox-readonly .telebox-resize-handle{cursor:initial!important;pointer-events:none!important}.telebox-color-scheme-dark .telebox-box-main{color:#e9e9e9;background:#212126;border-color:#43434d}.telebox-titlebar{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;background:#fff;user-select:none;border-bottom:1px solid #eeeef7}.telebox-title{overflow:hidden;margin:0 24px 0 0;padding:0;font-size:14px;font-weight:400;font-family:PingFangSC-Regular,PingFang SC;white-space:nowrap;word-break:keep-all;text-overflow:ellipsis;color:#191919}.telebox-titlebar-btns{white-space:nowrap;word-break:keep-all;margin-left:auto;font-size:0}.telebox-titlebar-btn{width:22px;height:22px;padding:0;outline:0;border:none;background:0 0;cursor:pointer}.telebox-titlebar-btn~.telebox-titlebar-btn{margin-left:10px}.telebox-titlebar-btn-icon{width:22px;height:22px}.telebox-readonly .telebox-titlebar-btn{cursor:not-allowed}.telebox-titlebar-icon-minimize{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPHBhdGggZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNOSAxM2gxMHYxLjZIOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=)}.telebox-titlebar-icon-maximize{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPGcgZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBtYXNrPSJ1cmwoI2IpIj4KICAgICAgICAgICAgPHBhdGgKICAgICAgICAgICAgICAgIGQ9Ik0yMC40ODEgMTcuMWgxLjJ2NC41ODFIMTcuMXYtMS4yaDMuMzgxVjE3LjF6bS0xNC4xOTA1LS4wMDloMS4ydjMuMzgxaDMuMzgwOXYxLjJoLTQuNTgxdi00LjU4MXpNMTcuMSA2LjE5MDVoNC41ODF2NC41ODA5aC0xLjJ2LTMuMzgxSDE3LjF2LTEuMnptLTEwLjcwMDguMTA4N2g0Ljc5ODV2MS4ySDcuNTk5MnYzLjU5ODVoLTEuMlY2LjI5OTJ6IiAvPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==)}.telebox-titlebar-icon-maximize.is-active{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjZ2MjZIMHoiIC8+CiAgICAgICAgPHBhdGggaWQ9ImMiIGQ9Ik0yNi44NjkgMEwyOCAxLjEzMVYyNi44N0wyNi44NjkgMjhIMS4xM0wwIDI2Ljg3VjEuMTMxTDEuMTMgMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPgogICAgICAgICAgICA8bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNhIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tNC42NDI5LTQuNjQyOWgzNS4yODU4djM1LjI4NThILTQuNjQyOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxnPgogICAgICAgICAgICA8bWFzayBpZD0iZCIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNjIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tMTcuNTE2OCAxNEwxNC0xNy41MTY4IDQ1LjUxNjggMTQgMTQgNDUuNTE2OHoiIG1hc2s9InVybCgjZCkiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxwYXRoIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjIiCiAgICAgICAgICAgIGQ9Ik0xMC4wODg2IDIxLjQ4NjV2LTMuNjk2Nkg2LjM5Mk0yMS4zODU1IDEwLjE4OTVoLTMuNjk2NlY2LjQ5M00yMS40MDIgMTcuNzk4M2gtMy42OTY2djMuNjk2Nk0xMC4yNTAzIDYuMTQ5OHYzLjg5ODVINi4zNTE3IiAvPgogICAgPC9nPgo8L3N2Zz4K)}.telebox-titlebar-icon-close{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyOCAyOCI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjQiPgogICAgICAgIDxwYXRoIGQ9Ik04LjM1MyAyMC4zMzIxTDIwLjMzMiA4LjM1M00yMC4zMzIyIDIwLjMzMjFMOC4zNTMgOC4zNTMiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=)}.telebox-color-scheme-dark .telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-collector{visibility:hidden;display:block;position:absolute;z-index:200;width:40px;height:40px;margin:0;padding:0;border:none;outline:0;font-size:0;border-radius:50%;background:#fff;box-shadow:0 2px 6px #2f419226;cursor:pointer;user-select:none;pointer-events:none;background-repeat:no-repeat;background-size:18px 16px;background-position:center}.telebox-collector-visible{visibility:visible;pointer-events:initial}.telebox-collector-readonly{cursor:not-allowed}.telebox-color-scheme-dark.telebox-collector{background-color:#43434d}.telebox-max-titlebar{display:none;position:absolute;top:0;left:0;z-index:50000;user-select:none}.telebox-max-titlebar-maximized{display:flex}.telebox-titles{flex:1;height:100%;margin:0 16px 0 -16px;overflow-y:hidden;overflow-x:scroll;overflow-x:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.telebox-titles::-webkit-scrollbar{height:8px;width:8px}.telebox-titles::-webkit-scrollbar-track{background-color:transparent}.telebox-titles::-webkit-scrollbar-thumb{background-color:#eeeef7cc;background-color:transparent;border-radius:4px;transition:background-color .4s}.telebox-titles:hover::-webkit-scrollbar-thumb{background-color:#eeeef7cc}.telebox-titles::-webkit-scrollbar-thumb:hover{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:active{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:vertical{min-height:50px}.telebox-titles::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-titles-content{height:100%;display:flex;flex-wrap:nowrap;align-items:center;padding:0}.telebox-titles-tab{overflow:hidden;max-width:182px;min-width:50px;padding:0 26px 0 16px;outline:0;font-size:13px;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;border:none;border-right:1px solid #e5e5f0;color:#7b88a0;background:0 0;cursor:pointer}.telebox-titles-tab~.telebox-titles-tab{margin-left:2px}.telebox-titles-tab-focus{color:#357bf6}.telebox-readonly .telebox-titles-tab{cursor:not-allowed}.telebox-color-scheme-dark{color-scheme:dark}.telebox-color-scheme-dark.telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-color-scheme-dark .telebox-titles-tab{border-right-color:#7b88a0}.telebox-color-scheme-dark .telebox-title{color:#e9e9e9}
package/docs/api.md CHANGED
@@ -4,6 +4,8 @@
4
4
  - [静态方法](#static-methods)
5
5
  - [`mount`](#mount)
6
6
  - [`register`](#register)
7
+ - [`setContainer`](#set-container)
8
+ - [`setCollectorContainer`](#set-collector-container)
7
9
  - [实例方法](#instance-methods)
8
10
  - [`addApp`](#addApp)
9
11
  - [`closeApp`](#closeApp)
@@ -63,6 +65,21 @@ WindowManager.register({
63
65
  })
64
66
  ```
65
67
 
68
+ <h3 id="set-container">setContainer</h3>
69
+
70
+ > 设置白板挂载容器
71
+
72
+ ```typescript
73
+ WindowManager.setContainer(document.getElementById("container"));
74
+ ```
75
+
76
+ <h3 id="set-container">setCollectorContainer</h3>
77
+
78
+ > 设置 `Collector` 挂载的容器
79
+
80
+ ```typescript
81
+ WindowManager.setCollectorContainer(document.getElementById("collector-container"));
82
+ ```
66
83
 
67
84
  <h2 id="instance-methods">实例方法</h2>
68
85
 
@@ -0,0 +1,42 @@
1
+
2
+ ### 注意事项
3
+
4
+ 多窗口模式必须开启白板的 `useMultiViews` 和 `useMobXState` 选项
5
+
6
+ 会造成原本以下 `room` 上的一些方法和 `state` 失效
7
+
8
+ `方法`
9
+
10
+ - `room.bindHtmlElement()` 用 `WindowManager.mount()` 代替
11
+ - `room.scalePptToFit()` 暂无代替,不再推荐调用 `scalePptToFit`
12
+ - `room.setScenePath()` 用 `manager.setMainViewScenePath()` 代替
13
+ - `room.setSceneIndex()` 用 `manager.setMainViewSceneIndex()` 代替
14
+
15
+ > 为了方便使用 `manager` 替换了 `room` 上的一些方法可以直接对 `mainView` 生效
16
+
17
+ - `room.disableCameraTransform`
18
+ - `room.moveCamera`
19
+ - `room.moveCameraToContain`
20
+ - `room.convertToPointInWorld`
21
+ - `room.setCameraBound`
22
+
23
+ `camera`
24
+
25
+ - `room.state.cameraState` 用 `manager.mainView.camera` 和 `manager.mainView.size` 代替
26
+
27
+ 想要监听主白板 `camera` 的变化, 请使用如下方式代替
28
+
29
+ ```javascript
30
+ manager.mainView.callbacks.on("onCameraUpdated", camera => {
31
+ console.log(camera);
32
+ });
33
+ ```
34
+
35
+ 监听主白板 `size` 变化
36
+
37
+ ```javascript
38
+ manager.mainView.callbacks.on("onSizeUpdated", size => {
39
+ console.log(size);
40
+ });
41
+ ```
42
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "0.3.18",
3
+ "version": "0.4.0-canary.0",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
@@ -24,7 +24,7 @@
24
24
  "@juggle/resize-observer": "^3.3.1",
25
25
  "@netless/app-docs-viewer": "0.1.26",
26
26
  "@netless/app-media-player": "0.1.0-beta.5",
27
- "@netless/telebox-insider": "^0.2.16",
27
+ "@netless/telebox-insider": "0.2.17",
28
28
  "emittery": "^0.9.2",
29
29
  "lodash": "^4.17.21",
30
30
  "p-retry": "^4.6.1",
package/src/AppContext.ts CHANGED
@@ -29,19 +29,19 @@ export class AppContext<TAttrs extends Record<string, any>, AppOptions = any> {
29
29
  listenDisposed,
30
30
  unlistenDisposed
31
31
  };
32
- private boxManager: BoxManager;
32
+
33
33
  private store = this.manager.store;
34
34
  public readonly isAddApp: boolean;
35
35
  public readonly isReplay = this.manager.isReplay;
36
36
 
37
37
  constructor(
38
38
  private manager: AppManager,
39
+ private boxManager: BoxManager,
39
40
  public appId: string,
40
41
  private appProxy: AppProxy,
41
42
  private appOptions?: AppOptions | (() => AppOptions),
42
43
  ) {
43
44
  this.emitter = appProxy.appEmitter;
44
- this.boxManager = this.manager.boxManager;
45
45
  this.isAddApp = appProxy.isAddApp;
46
46
  }
47
47
 
@@ -7,10 +7,13 @@ import { setViewFocusScenePath } from './Utils/Common';
7
7
 
8
8
  export class AppListeners {
9
9
  private displayer = this.manager.displayer;
10
- private boxManager = this.manager.boxManager;
11
10
 
12
11
  constructor(private manager: AppManager) {}
13
12
 
13
+ private get boxManager() {
14
+ return this.manager.boxManager;
15
+ }
16
+
14
17
  public addListeners() {
15
18
  this.displayer.addMagixEventListener(MagixEventName, this.mainMagixEventListener);
16
19
  }
@@ -50,11 +53,11 @@ export class AppListeners {
50
53
  };
51
54
 
52
55
  private appMoveHandler = (payload: any) => {
53
- this.boxManager.moveBox(payload);
56
+ this.boxManager?.moveBox(payload);
54
57
  };
55
58
 
56
59
  private appResizeHandler = (payload: any) => {
57
- this.boxManager.resizeBox(Object.assign(payload, { skipUpdate: true }));
60
+ this.boxManager?.resizeBox(Object.assign(payload, { skipUpdate: true }));
58
61
  this.manager.room?.refreshViewSize();
59
62
  };
60
63
 
package/src/AppManager.ts CHANGED
@@ -1,22 +1,11 @@
1
1
  import pRetry from "p-retry";
2
- import {
3
- AppAttributes,
4
- AppStatus,
5
- Events,
6
- MagixEventName
7
- } from "./constants";
2
+ import { sortBy } from "lodash";
3
+ import { AppAttributes, AppStatus, Events, MagixEventName } from "./constants";
8
4
  import { AppListeners } from "./AppListener";
9
5
  import { AppProxy } from "./AppProxy";
10
- import { AttributesDelegate } from "./AttributesDelegate";
11
- import {
12
- autorun,
13
- isPlayer,
14
- isRoom,
15
- ScenePathType,
16
- ViewVisionMode
17
- } from "white-web-sdk";
18
- import { BoxManager } from "./BoxManager";
19
- import { callbacks, emitter } from "./index";
6
+ import { store } from "./AttributesDelegate";
7
+ import { autorun, isPlayer, isRoom, ScenePathType, ViewVisionMode } from "white-web-sdk";
8
+ import { callbacks, emitter, WindowManager } from "./index";
20
9
  import { CameraStore } from "./Utils/CameraStore";
21
10
  import { genAppId, makeValidScenePath, setScenePath } from "./Utils/Common";
22
11
  import { log } from "./Utils/log";
@@ -24,35 +13,33 @@ import { MainViewProxy } from "./MainView";
24
13
  import { onObjectRemoved, safeListenPropsUpdated } from "./Utils/Reactive";
25
14
  import { ReconnectRefresher } from "./ReconnectRefresher";
26
15
  import { ViewManager } from "./ViewManager";
16
+ import type { BoxManager } from "./BoxManager";
27
17
  import type { Displayer, DisplayerState, Room } from "white-web-sdk";
28
- import type { CreateTeleBoxManagerConfig } from "./BoxManager";
29
- import type {
30
- AddAppParams,
31
- BaseInsertParams,
32
- WindowManager,
33
- TeleBoxRect,
34
- EmitterEvent,
35
- } from "./index";
18
+ import type { AddAppParams, BaseInsertParams, TeleBoxRect, EmitterEvent } from "./index";
36
19
  export class AppManager {
37
20
  public displayer: Displayer;
38
- public boxManager: BoxManager;
39
21
  public cameraStore: CameraStore;
40
22
  public viewManager: ViewManager;
41
23
  public appProxies: Map<string, AppProxy> = new Map();
42
24
  public appStatus: Map<string, AppStatus> = new Map();
43
- public store = new AttributesDelegate(this);
25
+ public store = store;
44
26
  public mainViewProxy: MainViewProxy;
45
27
  public refresher?: ReconnectRefresher;
46
28
  public isReplay = this.windowManger.isReplay;
47
29
 
48
30
  private appListeners: AppListeners;
31
+ public boxManager?: BoxManager;
49
32
 
50
- constructor(public windowManger: WindowManager, options: CreateTeleBoxManagerConfig) {
33
+ constructor(public windowManger: WindowManager) {
51
34
  this.displayer = windowManger.displayer;
35
+ this.store.setContext({
36
+ getAttributes: () => this.attributes,
37
+ safeSetAttributes: (attributes) => this.safeSetAttributes(attributes),
38
+ safeUpdateAttributes: (keys, val) => this.safeUpdateAttributes(keys, val),
39
+ });
52
40
  this.cameraStore = new CameraStore();
53
41
  this.mainViewProxy = new MainViewProxy(this);
54
42
  this.viewManager = new ViewManager(this);
55
- this.boxManager = new BoxManager(this, options);
56
43
  this.appListeners = new AppListeners(this);
57
44
  this.displayer.callbacks.on(this.eventName, this.displayerStateListener);
58
45
  this.appListeners.addListeners();
@@ -74,12 +61,15 @@ export class AppManager {
74
61
 
75
62
  private async onCreated() {
76
63
  await this.attributesUpdateCallback(this.attributes.apps);
77
- this.boxManager.updateManagerRect();
64
+ this.boxManager?.updateManagerRect();
78
65
  emitter.onAny(this.boxEventListener);
79
66
  this.refresher?.add("apps", () => {
80
- return safeListenPropsUpdated(() => this.attributes.apps, () => {
81
- this.attributesUpdateCallback(this.attributes.apps);
82
- });
67
+ return safeListenPropsUpdated(
68
+ () => this.attributes.apps,
69
+ () => {
70
+ this.attributesUpdateCallback(this.attributes.apps);
71
+ }
72
+ );
83
73
  });
84
74
  this.refresher?.add("appsClose", () => {
85
75
  return onObjectRemoved(this.attributes.apps, () => {
@@ -89,20 +79,18 @@ export class AppManager {
89
79
  this.refresher?.add("maximized", () => {
90
80
  return autorun(() => {
91
81
  const maximized = this.attributes.maximized;
92
- if (this.boxManager.maximized !== maximized) {
93
- this.boxManager.setMaximized(Boolean(maximized));
94
- }
82
+ this.boxManager?.setMaximized(Boolean(maximized));
95
83
  });
96
84
  });
97
85
  this.refresher?.add("minimized", () => {
98
86
  return autorun(() => {
99
87
  const minimized = this.attributes.minimized;
100
- if (this.boxManager.minimized !== minimized) {
88
+ if (this.boxManager?.minimized !== minimized) {
101
89
  if (minimized === true) {
102
- this.boxManager.blurAllBox();
90
+ this.boxManager?.blurAllBox();
103
91
  }
104
92
  setTimeout(() => {
105
- this.boxManager.setMinimized(Boolean(minimized));
93
+ this.boxManager?.setMinimized(Boolean(minimized));
106
94
  }, 0);
107
95
  }
108
96
  });
@@ -126,29 +114,39 @@ export class AppManager {
126
114
  * @memberof WindowManager
127
115
  */
128
116
  public async attributesUpdateCallback(apps: any) {
129
- if (apps) {
130
- for (const id in apps) {
117
+ if (apps && WindowManager.container) {
118
+ const appIds = Object.keys(apps);
119
+ const appsWithCreatedAt = appIds.map(appId => {
120
+ return {
121
+ id: appId,
122
+ createdAt: apps[appId].createdAt,
123
+ }
124
+ });
125
+ for (const { id } of sortBy(appsWithCreatedAt, "createdAt")) {
131
126
  if (!this.appProxies.has(id) && !this.appStatus.has(id)) {
132
127
  const app = apps[id];
133
128
 
134
- pRetry(async () => {
135
- this.appStatus.set(id, AppStatus.StartCreate);
136
- // 防御 appAttributes 有可能为 undefined 的情况,这里做一个重试
137
- const appAttributes = this.attributes[id];
138
- if (!appAttributes) {
139
- throw new Error("appAttributes is undefined");
140
- }
141
- await this.baseInsertApp(
142
- {
143
- kind: app.kind,
144
- options: app.options,
145
- isDynamicPPT: app.isDynamicPPT,
146
- },
147
- id,
148
- false
149
- );
150
- this.focusByAttributes(apps);
151
- }, { retries: 3 }).catch(err => {
129
+ pRetry(
130
+ async () => {
131
+ this.appStatus.set(id, AppStatus.StartCreate);
132
+ // 防御 appAttributes 有可能为 undefined 的情况,这里做一个重试
133
+ const appAttributes = this.attributes[id];
134
+ if (!appAttributes) {
135
+ throw new Error("appAttributes is undefined");
136
+ }
137
+ await this.baseInsertApp(
138
+ {
139
+ kind: app.kind,
140
+ options: app.options,
141
+ isDynamicPPT: app.isDynamicPPT,
142
+ },
143
+ id,
144
+ false
145
+ );
146
+ this.focusByAttributes(apps);
147
+ },
148
+ { retries: 3 }
149
+ ).catch(err => {
152
150
  console.warn(`[WindowManager]: Insert App Error`, err);
153
151
  this.appStatus.delete(id);
154
152
  });
@@ -157,6 +155,22 @@ export class AppManager {
157
155
  }
158
156
  }
159
157
 
158
+ public refresh() {
159
+ this.attributesUpdateCallback(this.attributes.apps);
160
+ }
161
+
162
+ public setBoxManager(boxManager: BoxManager) {
163
+ this.boxManager = boxManager;
164
+ }
165
+
166
+ public resetMaximized() {
167
+ this.boxManager?.setMaximized(Boolean(this.store.getMaximized()));
168
+ }
169
+
170
+ public resetMinimized() {
171
+ this.boxManager?.setMinimized(Boolean(this.store.getMinimized()));
172
+ }
173
+
160
174
  private onAppDelete = (apps: any) => {
161
175
  const ids = Object.keys(apps);
162
176
  this.appProxies.forEach((appProxy, id) => {
@@ -171,7 +185,7 @@ export class AppManager {
171
185
  mainView.disableCameraTransform = disableCameraTransform;
172
186
  mainView.divElement = divElement;
173
187
  if (!mainView.focusScenePath) {
174
- this.store.setMainViewFocusPath();
188
+ this.store.setMainViewFocusPath(mainView);
175
189
  }
176
190
  if (this.store.focus === undefined && mainView.mode !== ViewVisionMode.Writable) {
177
191
  this.viewManager.switchMainViewToWriter();
@@ -194,7 +208,7 @@ export class AppManager {
194
208
  const attrs = params.attributes ?? {};
195
209
  this.safeUpdateAttributes([appId], attrs);
196
210
  this.store.setupAppAttributes(params, appId, isDynamicPPT);
197
- const needFocus = !this.boxManager.minimized;
211
+ const needFocus = !this.boxManager?.minimized;
198
212
  if (needFocus) {
199
213
  this.store.setAppFocus(appId, true);
200
214
  }
@@ -211,8 +225,8 @@ export class AppManager {
211
225
  });
212
226
  this.store.updateAppState(appProxy.id, AppAttributes.ZIndex, box.zIndex);
213
227
  }
214
- if (this.boxManager.minimized) {
215
- this.boxManager.setMinimized(false, false);
228
+ if (this.boxManager?.minimized) {
229
+ this.boxManager?.setMinimized(false, false);
216
230
  }
217
231
  }
218
232
 
@@ -270,9 +284,9 @@ export class AppManager {
270
284
  const isManualWritable =
271
285
  this.windowManger.readonly === undefined || this.windowManger.readonly === false;
272
286
  if (this.windowManger.readonly === undefined) {
273
- this.boxManager.setReadonly(isReadonly);
287
+ this.boxManager?.setReadonly(isReadonly);
274
288
  } else {
275
- this.boxManager.setReadonly(!(isWritable && isManualWritable));
289
+ this.boxManager?.setReadonly(!(isWritable && isManualWritable));
276
290
  }
277
291
  this.appProxies.forEach(appProxy => {
278
292
  appProxy.emitAppIsWritableChange();
@@ -339,7 +353,7 @@ export class AppManager {
339
353
  this.safeSetAttributes({ _mainScenePath: scenePath });
340
354
  await this.viewManager.switchMainViewToWriter();
341
355
  setScenePath(this.room, scenePath);
342
- this.store.setMainViewFocusPath();
356
+ this.store.setMainViewFocusPath(this.mainView);
343
357
  this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath: scenePath });
344
358
  }
345
359
 
@@ -350,7 +364,7 @@ export class AppManager {
350
364
  this.room.setSceneIndex(index);
351
365
  const nextScenePath = this.room.state.sceneState.scenePath;
352
366
  this.store.setMainViewScenePath(nextScenePath);
353
- this.store.setMainViewFocusPath();
367
+ this.store.setMainViewFocusPath(this.mainView);
354
368
  this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath });
355
369
  }
356
370
  }
@@ -409,7 +423,7 @@ export class AppManager {
409
423
  };
410
424
 
411
425
  public focusByAttributes(apps: any) {
412
- if (apps && Object.keys(apps).length === this.boxManager.appBoxMap.size) {
426
+ if (apps && Object.keys(apps).length === this.boxManager?.boxSize) {
413
427
  const focusAppId = this.store.focus;
414
428
  if (focusAppId) {
415
429
  this.boxManager.focusBox({ appId: focusAppId });
@@ -450,7 +464,7 @@ export class AppManager {
450
464
  });
451
465
  }
452
466
  this.viewManager.destroy();
453
- this.boxManager.destroy();
467
+ this.boxManager?.destroy();
454
468
  this.refresher?.destroy();
455
469
  this.mainViewProxy.destroy();
456
470
  callbacks.clearListeners();
package/src/AppProxy.ts CHANGED
@@ -25,6 +25,7 @@ import type { AppManager } from "./AppManager";
25
25
  import type { NetlessApp } from "./typings";
26
26
  import type { ReadonlyTeleBox } from "@netless/telebox-insider";
27
27
  import { Base } from "./Base";
28
+ import { BoxManagerNotFoundError } from "./Utils/error";
28
29
 
29
30
  export class AppProxy extends Base {
30
31
  public id: string;
@@ -40,6 +41,9 @@ export class AppProxy extends Base {
40
41
  private kind: string;
41
42
  public isAddApp: boolean;
42
43
  private status: "normal" | "destroyed" = "normal";
44
+ private stateKey: string;
45
+ private setupResult?: any;
46
+ private appContext?: AppContext<any, any>;
43
47
 
44
48
  constructor(
45
49
  private params: BaseInsertParams,
@@ -50,6 +54,7 @@ export class AppProxy extends Base {
50
54
  super(manager);
51
55
  this.kind = params.kind;
52
56
  this.id = appId;
57
+ this.stateKey = `${this.id}_state`;
53
58
  this.appProxies.set(this.id, this);
54
59
  this.appEmitter = new Emittery();
55
60
  this.appListener = this.makeAppEventListener(this.id);
@@ -129,15 +134,15 @@ export class AppProxy extends Base {
129
134
  private focusApp() {
130
135
  this.focusBox();
131
136
  this.context.switchAppToWriter(this.id);
132
- this.store.setMainViewFocusPath();
137
+ this.store.setMainViewFocusPath(this.manager.mainView);
133
138
  }
134
139
 
135
140
  public get box(): ReadonlyTeleBox | undefined {
136
- return this.boxManager.getBox(this.id);
141
+ return this.boxManager?.getBox(this.id);
137
142
  }
138
143
 
139
144
  public focusBox() {
140
- this.boxManager.focusBox({ appId: this.id });
145
+ this.boxManager?.focusBox({ appId: this.id });
141
146
  }
142
147
 
143
148
  private async setupApp(
@@ -148,13 +153,17 @@ export class AppProxy extends Base {
148
153
  appOptions?: any
149
154
  ) {
150
155
  log("setupApp", appId, app, options);
151
- const context = new AppContext(this.manager, appId, this, appOptions);
156
+ if (!this.boxManager) {
157
+ throw new BoxManagerNotFoundError();
158
+ }
159
+ const context = new AppContext(this.manager, this.boxManager, appId, this, appOptions);
160
+ this.appContext = context;
152
161
  try {
153
162
  emitter.once(`${appId}${Events.WindowCreated}` as any).then(async () => {
154
163
  let boxInitState: AppInitState | undefined;
155
164
  if (!skipUpdate) {
156
165
  boxInitState = this.getAppInitState(appId);
157
- this.boxManager.updateBoxState(boxInitState);
166
+ this.boxManager?.updateBoxState(boxInitState);
158
167
  }
159
168
  this.appEmitter.onAny(this.appListener);
160
169
  this.appAttributesUpdateListener(appId);
@@ -162,12 +171,13 @@ export class AppProxy extends Base {
162
171
  setTimeout(async () => {
163
172
  // 延迟执行 setup, 防止初始化的属性没有更新成功
164
173
  const result = await app.setup(context);
174
+ this.setupResult = result;
165
175
  appRegister.notifyApp(app.kind, "created", { appId, result });
166
176
  this.afterSetupApp(boxInitState);
167
177
  this.fixMobileSize();
168
178
  }, 50);
169
179
  });
170
- this.boxManager.createBox({
180
+ this.boxManager?.createBox({
171
181
  appId: appId,
172
182
  app,
173
183
  options,
@@ -182,9 +192,9 @@ export class AppProxy extends Base {
182
192
 
183
193
  // 兼容移动端创建时会出现 PPT 不适配的问题
184
194
  private fixMobileSize() {
185
- const box = this.boxManager.getBox(this.id);
195
+ const box = this.boxManager?.getBox(this.id);
186
196
  if (box) {
187
- this.boxManager.resizeBox({
197
+ this.boxManager?.resizeBox({
188
198
  appId: this.id,
189
199
  width: box.intrinsicWidth + 0.001,
190
200
  height: box.intrinsicHeight + 0.001,
@@ -199,7 +209,7 @@ export class AppProxy extends Base {
199
209
  this.context.switchAppToWriter(this.id);
200
210
  }
201
211
  if (!boxInitState?.x || !boxInitState.y) {
202
- this.boxManager.setBoxInitState(this.id);
212
+ this.boxManager?.setBoxInitState(this.id);
203
213
  }
204
214
  }
205
215
  }
@@ -207,7 +217,7 @@ export class AppProxy extends Base {
207
217
  public onSeek(time: number) {
208
218
  this.appEmitter.emit("seek", time);
209
219
  const boxInitState = this.getAppInitState(this.id);
210
- this.boxManager.updateBoxState(boxInitState);
220
+ this.boxManager?.updateBoxState(boxInitState);
211
221
  }
212
222
 
213
223
  public async onReconnected() {
@@ -217,7 +227,7 @@ export class AppProxy extends Base {
217
227
  const params = this.params;
218
228
  const appProxy = new AppProxy(params, this.manager, this.id, this.isAddApp);
219
229
  await appProxy.baseInsertApp(true, this.store.focus === this.id);
220
- this.boxManager.updateBoxState(currentAppState);
230
+ this.boxManager?.updateBoxState(currentAppState);
221
231
  }
222
232
 
223
233
  public switchToWritable() {
@@ -227,7 +237,7 @@ export class AppProxy extends Base {
227
237
  if (this.view.mode === ViewVisionMode.Writable) return;
228
238
  try {
229
239
  if (this.manager.mainView.mode === ViewVisionMode.Writable) {
230
- this.store.setMainViewFocusPath();
240
+ this.store.setMainViewFocusPath(this.manager.mainView);
231
241
  notifyMainViewModeChange(callbacks, ViewVisionMode.Freedom);
232
242
  setViewMode(this.manager.mainView, ViewVisionMode.Freedom);
233
243
  }
@@ -278,7 +288,7 @@ export class AppProxy extends Base {
278
288
  if (!this.manager.canOperate) return;
279
289
  switch (eventName) {
280
290
  case "setBoxSize": {
281
- this.boxManager.resizeBox({
291
+ this.boxManager?.resizeBox({
282
292
  appId,
283
293
  width: data.width,
284
294
  height: data.height,
@@ -287,7 +297,7 @@ export class AppProxy extends Base {
287
297
  break;
288
298
  }
289
299
  case "setBoxMinSize": {
290
- this.boxManager.setBoxMinSize({
300
+ this.boxManager?.setBoxMinSize({
291
301
  appId,
292
302
  minWidth: data.minwidth,
293
303
  minHeight: data.minheight,
@@ -295,7 +305,7 @@ export class AppProxy extends Base {
295
305
  break;
296
306
  }
297
307
  case "setBoxTitle": {
298
- this.boxManager.setBoxTitle({ appId, title: data.title });
308
+ this.boxManager?.setBoxTitle({ appId, title: data.title });
299
309
  break;
300
310
  }
301
311
  case AppEvents.destroy: {
@@ -307,7 +317,7 @@ export class AppProxy extends Base {
307
317
  break;
308
318
  }
309
319
  case "focus": {
310
- this.boxManager.focusBox({ appId: this.id });
320
+ this.boxManager?.focusBox({ appId: this.id });
311
321
  emitter.emit("focus", { appId: this.id });
312
322
  break;
313
323
  }
@@ -327,6 +337,14 @@ export class AppProxy extends Base {
327
337
  }
328
338
  });
329
339
  });
340
+ this.manager.refresher?.add(this.stateKey,() => {
341
+ return autorun(() => {
342
+ const appState = this.appAttributes?.state;
343
+ if (appState?.zIndex > 0 && appState.zIndex !== this.box?.zIndex) {
344
+ this.boxManager?.setZIndex(appId, appState.zIndex);
345
+ }
346
+ });
347
+ });
330
348
  };
331
349
 
332
350
  public setScenePath(): void {
@@ -364,7 +382,7 @@ export class AppProxy extends Base {
364
382
  this.appEmitter.clearListeners();
365
383
  emitter.emit(`destroy-${this.id}` as any, { error });
366
384
  if (needCloseBox) {
367
- this.boxManager.closeBox(this.id, skipUpdate);
385
+ this.boxManager?.closeBox(this.id, skipUpdate);
368
386
  }
369
387
  if (cleanAttrs) {
370
388
  this.store.cleanAppAttributes(this.id);
@@ -375,6 +393,7 @@ export class AppProxy extends Base {
375
393
  this.viewManager.destroyView(this.id);
376
394
  this.manager.appStatus.delete(this.id);
377
395
  this.manager.refresher?.remove(this.id);
396
+ this.manager.refresher?.remove(this.stateKey);
378
397
  }
379
398
 
380
399
  public close(): Promise<void> {