@netless/window-manager 0.3.9 → 0.3.12-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/AppManager.d.ts +3 -3
- package/dist/AppProxy.d.ts +2 -2
- package/dist/BoxManager.d.ts +6 -5
- package/dist/index.d.ts +8 -7
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/AppManager.ts +10 -8
- package/src/AppProxy.ts +26 -12
- package/src/BoxManager.ts +11 -8
- package/src/Utils/RoomHacker.ts +3 -0
- package/src/index.ts +67 -48
package/dist/style.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.netless-window-manager-playground{width:100%;height:100%;position:relative;z-index:1;overflow:hidden}.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-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-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}.telebox-collector-icon{width:18px;height:16px}.telebox-collector-visible{visibility:visible;pointer-events:initial}.telebox-collector-readonly{cursor:not-allowed}.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}
|
1
|
+
.netless-window-manager-playground{width:100%;height:100%;position:relative;z-index:1;overflow:hidden}.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-title{color:#e9e9e9}.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}.telebox-collector-icon{width:18px;height:16px}.telebox-collector-visible{visibility:visible;pointer-events:initial}.telebox-collector-readonly{cursor:not-allowed}.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}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.12-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.21",
|
26
26
|
"@netless/app-media-player": "0.1.0-beta.5",
|
27
|
-
"@netless/telebox-insider": "0.2.
|
27
|
+
"@netless/telebox-insider": "0.2.8",
|
28
28
|
"emittery": "^0.9.2",
|
29
29
|
"lodash": "^4.17.21",
|
30
30
|
"p-retry": "^4.6.1",
|
@@ -56,6 +56,6 @@
|
|
56
56
|
"typescript": "^4.3.5",
|
57
57
|
"video.js": "^7.14.3",
|
58
58
|
"vite": "^2.5.3",
|
59
|
-
"white-web-sdk": "^2.15.
|
59
|
+
"white-web-sdk": "^2.15.12"
|
60
60
|
}
|
61
61
|
}
|
package/src/AppManager.ts
CHANGED
@@ -25,7 +25,7 @@ import { onObjectRemoved, safeListenPropsUpdated } from "./Utils/Reactive";
|
|
25
25
|
import { ReconnectRefresher } from "./ReconnectRefresher";
|
26
26
|
import { ViewManager } from "./ViewManager";
|
27
27
|
import type { Displayer, DisplayerState, Room } from "white-web-sdk";
|
28
|
-
import type {
|
28
|
+
import type { CreateTeleBoxManagerConfig } from "./BoxManager";
|
29
29
|
import type {
|
30
30
|
AddAppParams,
|
31
31
|
BaseInsertParams,
|
@@ -47,7 +47,7 @@ export class AppManager {
|
|
47
47
|
|
48
48
|
private appListeners: AppListeners;
|
49
49
|
|
50
|
-
constructor(public windowManger: WindowManager, options:
|
50
|
+
constructor(public windowManger: WindowManager, options: CreateTeleBoxManagerConfig) {
|
51
51
|
this.displayer = windowManger.displayer;
|
52
52
|
this.cameraStore = new CameraStore();
|
53
53
|
this.mainViewProxy = new MainViewProxy(this);
|
@@ -160,7 +160,7 @@ export class AppManager {
|
|
160
160
|
const ids = Object.keys(apps);
|
161
161
|
this.appProxies.forEach((appProxy, id) => {
|
162
162
|
if (!ids.includes(id)) {
|
163
|
-
appProxy.destroy(true, false);
|
163
|
+
appProxy.destroy(true, false, true);
|
164
164
|
}
|
165
165
|
});
|
166
166
|
};
|
@@ -217,7 +217,7 @@ export class AppManager {
|
|
217
217
|
public async closeApp(appId: string) {
|
218
218
|
const appProxy = this.appProxies.get(appId);
|
219
219
|
if (appProxy) {
|
220
|
-
appProxy.destroy(true, true);
|
220
|
+
appProxy.destroy(true, true, false);
|
221
221
|
}
|
222
222
|
}
|
223
223
|
|
@@ -415,10 +415,12 @@ export class AppManager {
|
|
415
415
|
}
|
416
416
|
}
|
417
417
|
|
418
|
-
public notifyReconnected() {
|
419
|
-
this.appProxies.
|
420
|
-
|
418
|
+
public async notifyReconnected() {
|
419
|
+
const appProxies = Array.from(this.appProxies.values());
|
420
|
+
const reconnected = appProxies.map(appProxy => {
|
421
|
+
return appProxy.onReconnected();
|
421
422
|
});
|
423
|
+
await Promise.all(reconnected);
|
422
424
|
}
|
423
425
|
|
424
426
|
public notifyContainerRectUpdate(rect: TeleBoxRect) {
|
@@ -442,7 +444,7 @@ export class AppManager {
|
|
442
444
|
emitter.clearListeners();
|
443
445
|
if (this.appProxies.size) {
|
444
446
|
this.appProxies.forEach(appProxy => {
|
445
|
-
appProxy.destroy(true, false);
|
447
|
+
appProxy.destroy(true, false, true);
|
446
448
|
});
|
447
449
|
}
|
448
450
|
this.viewManager.destroy();
|
package/src/AppProxy.ts
CHANGED
@@ -101,7 +101,10 @@ export class AppProxy extends Base {
|
|
101
101
|
this.manager.safeUpdateAttributes(["apps", this.id, Fields.FullPath], path);
|
102
102
|
}
|
103
103
|
|
104
|
-
public async baseInsertApp(
|
104
|
+
public async baseInsertApp(
|
105
|
+
skipUpdate = false,
|
106
|
+
focus?: boolean
|
107
|
+
): Promise<{ appId: string; app: NetlessApp }> {
|
105
108
|
const params = this.params;
|
106
109
|
if (!params.kind) {
|
107
110
|
throw new Error("[WindowManager]: kind require");
|
@@ -109,7 +112,7 @@ export class AppProxy extends Base {
|
|
109
112
|
const appImpl = await appRegister.appClasses.get(params.kind)?.();
|
110
113
|
const appParams = appRegister.registered.get(params.kind);
|
111
114
|
if (appImpl) {
|
112
|
-
await this.setupApp(this.id, appImpl, params.options, appParams?.appOptions);
|
115
|
+
await this.setupApp(this.id, skipUpdate, appImpl, params.options, appParams?.appOptions);
|
113
116
|
} else {
|
114
117
|
throw new Error(`[WindowManager]: app load failed ${params.kind} ${params.src}`);
|
115
118
|
}
|
@@ -139,6 +142,7 @@ export class AppProxy extends Base {
|
|
139
142
|
|
140
143
|
private async setupApp(
|
141
144
|
appId: string,
|
145
|
+
skipUpdate: boolean,
|
142
146
|
app: NetlessApp,
|
143
147
|
options?: setAppOptions,
|
144
148
|
appOptions?: any
|
@@ -147,8 +151,11 @@ export class AppProxy extends Base {
|
|
147
151
|
const context = new AppContext(this.manager, appId, this, appOptions);
|
148
152
|
try {
|
149
153
|
emitter.once(`${appId}${Events.WindowCreated}` as any).then(async () => {
|
150
|
-
|
151
|
-
|
154
|
+
let boxInitState: AppInitState | undefined;
|
155
|
+
if (!skipUpdate) {
|
156
|
+
boxInitState = this.getAppInitState(appId);
|
157
|
+
this.boxManager.updateBoxState(boxInitState);
|
158
|
+
}
|
152
159
|
this.appEmitter.onAny(this.appListener);
|
153
160
|
this.appAttributesUpdateListener(appId);
|
154
161
|
this.setViewFocusScenePath();
|
@@ -204,10 +211,12 @@ export class AppProxy extends Base {
|
|
204
211
|
|
205
212
|
public async onReconnected() {
|
206
213
|
this.appEmitter.emit("reconnected", undefined);
|
207
|
-
|
214
|
+
const currentAppState = this.getAppInitState(this.id);
|
215
|
+
await this.destroy(true, false, true);
|
208
216
|
const params = this.params;
|
209
217
|
const appProxy = new AppProxy(params, this.manager, this.id, this.isAddApp);
|
210
|
-
await appProxy.baseInsertApp(this.store.focus === this.id);
|
218
|
+
await appProxy.baseInsertApp(true, this.store.focus === this.id);
|
219
|
+
this.boxManager.updateBoxState(currentAppState);
|
211
220
|
}
|
212
221
|
|
213
222
|
public switchToWritable() {
|
@@ -236,8 +245,8 @@ export class AppProxy extends Base {
|
|
236
245
|
const focus = this.store.focus;
|
237
246
|
const size = attrs?.[AppAttributes.Size];
|
238
247
|
const sceneIndex = attrs?.[AppAttributes.SceneIndex];
|
239
|
-
const maximized = this.
|
240
|
-
const minimized = this.
|
248
|
+
const maximized = this.attributes?.["maximized"];
|
249
|
+
const minimized = this.attributes?.["minimized"];
|
241
250
|
let payload = { maximized, minimized } as AppInitState;
|
242
251
|
if (position) {
|
243
252
|
payload = { ...payload, id: id, x: position.x, y: position.y };
|
@@ -289,7 +298,7 @@ export class AppProxy extends Base {
|
|
289
298
|
}
|
290
299
|
case AppEvents.destroy: {
|
291
300
|
if (this.status === "destroyed") return;
|
292
|
-
this.destroy(true, data?.error);
|
301
|
+
this.destroy(true, false, true, data?.error);
|
293
302
|
if (data?.error) {
|
294
303
|
console.error(data?.error);
|
295
304
|
}
|
@@ -340,7 +349,12 @@ export class AppProxy extends Base {
|
|
340
349
|
return view;
|
341
350
|
}
|
342
351
|
|
343
|
-
public async destroy(
|
352
|
+
public async destroy(
|
353
|
+
needCloseBox: boolean,
|
354
|
+
cleanAttrs: boolean,
|
355
|
+
skipUpdate: boolean,
|
356
|
+
error?: Error
|
357
|
+
) {
|
344
358
|
if (this.status === "destroyed") return;
|
345
359
|
this.status = "destroyed";
|
346
360
|
await appRegister.notifyApp(this.kind, "destroy", { appId: this.id });
|
@@ -348,7 +362,7 @@ export class AppProxy extends Base {
|
|
348
362
|
this.appEmitter.clearListeners();
|
349
363
|
emitter.emit(`destroy-${this.id}` as any, { error });
|
350
364
|
if (needCloseBox) {
|
351
|
-
this.boxManager.closeBox(this.id);
|
365
|
+
this.boxManager.closeBox(this.id, skipUpdate);
|
352
366
|
}
|
353
367
|
if (cleanAttrs) {
|
354
368
|
this.store.cleanAppAttributes(this.id);
|
@@ -362,6 +376,6 @@ export class AppProxy extends Base {
|
|
362
376
|
}
|
363
377
|
|
364
378
|
public close(): Promise<void> {
|
365
|
-
return this.destroy(true, true);
|
379
|
+
return this.destroy(true, true, false);
|
366
380
|
}
|
367
381
|
}
|
package/src/BoxManager.ts
CHANGED
@@ -12,6 +12,7 @@ import {
|
|
12
12
|
TELE_BOX_STATE,
|
13
13
|
TeleBoxCollector,
|
14
14
|
TeleBoxManager,
|
15
|
+
TeleBoxColorScheme
|
15
16
|
} from "@netless/telebox-insider";
|
16
17
|
import type {
|
17
18
|
TeleBoxManagerUpdateConfig,
|
@@ -45,9 +46,10 @@ type SetBoxMinSizeParams = AppId & { minWidth: number; minHeight: number };
|
|
45
46
|
|
46
47
|
type SetBoxTitleParams = AppId & { title: string };
|
47
48
|
|
48
|
-
export type
|
49
|
+
export type CreateTeleBoxManagerConfig = {
|
49
50
|
collectorContainer?: HTMLElement;
|
50
51
|
collectorStyles?: Partial<CSSStyleDeclaration>;
|
52
|
+
prefersColorScheme?: TeleBoxColorScheme;
|
51
53
|
};
|
52
54
|
|
53
55
|
export class BoxManager {
|
@@ -57,9 +59,9 @@ export class BoxManager {
|
|
57
59
|
|
58
60
|
constructor(
|
59
61
|
private manager: AppManager,
|
60
|
-
|
62
|
+
createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig,
|
61
63
|
) {
|
62
|
-
this.teleBoxManager = this.setupBoxManager(
|
64
|
+
this.teleBoxManager = this.setupBoxManager(createTeleBoxManagerConfig);
|
63
65
|
this.teleBoxManager.events.on(TELE_BOX_MANAGER_EVENT.State, state => {
|
64
66
|
if (state) {
|
65
67
|
callbacks.emit("boxStateChange", state);
|
@@ -156,7 +158,7 @@ export class BoxManager {
|
|
156
158
|
}
|
157
159
|
}
|
158
160
|
|
159
|
-
public setupBoxManager(
|
161
|
+
public setupBoxManager(createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig): TeleBoxManager {
|
160
162
|
const root = WindowManager.wrapper ? WindowManager.wrapper : document.body;
|
161
163
|
const rect = root.getBoundingClientRect();
|
162
164
|
const initManagerState: TeleBoxManagerConfig = {
|
@@ -168,9 +170,10 @@ export class BoxManager {
|
|
168
170
|
height: rect.height,
|
169
171
|
},
|
170
172
|
fence: false,
|
173
|
+
prefersColorScheme: createTeleBoxManagerConfig?.prefersColorScheme,
|
171
174
|
};
|
172
|
-
const container =
|
173
|
-
const styles = { ...DEFAULT_COLLECTOR_STYLE, ...
|
175
|
+
const container = createTeleBoxManagerConfig?.collectorContainer || WindowManager.wrapper;
|
176
|
+
const styles = { ...DEFAULT_COLLECTOR_STYLE, ...createTeleBoxManagerConfig?.collectorStyles };
|
174
177
|
const teleBoxCollector = new TeleBoxCollector({
|
175
178
|
styles: styles,
|
176
179
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
@@ -188,8 +191,8 @@ export class BoxManager {
|
|
188
191
|
return this.teleBoxManager.queryOne({ id: appId });
|
189
192
|
}
|
190
193
|
|
191
|
-
public closeBox(appId: string): ReadonlyTeleBox | undefined {
|
192
|
-
return this.teleBoxManager.remove(appId);
|
194
|
+
public closeBox(appId: string, skipUpdate = false): ReadonlyTeleBox | undefined {
|
195
|
+
return this.teleBoxManager.remove(appId, skipUpdate);
|
193
196
|
}
|
194
197
|
|
195
198
|
public boxIsFocus(appId: string): boolean | undefined {
|
package/src/Utils/RoomHacker.ts
CHANGED
@@ -33,6 +33,9 @@ export const replaceRoomFunction = (room: Room, manager: AppManager) => {
|
|
33
33
|
room.moveCameraToContain = (...args) => manager.mainView.moveCameraToContain(...args);
|
34
34
|
room.convertToPointInWorld = (...args) => manager.mainView.convertToPointInWorld(...args);
|
35
35
|
room.setCameraBound = (...args) => manager.mainView.setCameraBound(...args);
|
36
|
+
room.scenePreview = (...args) => manager.mainView.scenePreview(...args);
|
37
|
+
room.fillSceneSnapshot = (...args) => manager.mainView.fillSceneSnapshot(...args);
|
38
|
+
room.generateScreenshot = (...args) => manager.mainView.generateScreenshot(...args);
|
36
39
|
}
|
37
40
|
|
38
41
|
};
|
package/src/index.ts
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
import AppDocsViewer from
|
2
|
-
import AppMediaPlayer, { setOptions } from
|
3
|
-
import Emittery from
|
4
|
-
import pRetry from
|
1
|
+
import AppDocsViewer from "@netless/app-docs-viewer";
|
2
|
+
import AppMediaPlayer, { setOptions } from "@netless/app-media-player";
|
3
|
+
import Emittery from "emittery";
|
4
|
+
import pRetry from "p-retry";
|
5
|
+
import { AppManager } from "./AppManager";
|
6
|
+
import { appRegister } from "./Register";
|
7
|
+
import { CursorManager } from "./Cursor";
|
8
|
+
import { DEFAULT_CONTAINER_RATIO, REQUIRE_VERSION } from "./constants";
|
9
|
+
import { Fields } from "./AttributesDelegate";
|
10
|
+
import { initDb } from "./Register/storage";
|
11
|
+
import { isNull, isObject } from "lodash";
|
12
|
+
import { log } from "./Utils/log";
|
13
|
+
import { replaceRoomFunction } from "./Utils/RoomHacker";
|
14
|
+
import { ResizeObserver as ResizeObserverPolyfill } from "@juggle/resize-observer";
|
15
|
+
import { setupWrapper } from "./ViewManager";
|
16
|
+
import "./style.css";
|
17
|
+
import "@netless/telebox-insider/dist/style.css";
|
5
18
|
import {
|
6
19
|
addEmitterOnceListener,
|
7
20
|
ensureValidScenePath,
|
8
21
|
getVersionNumber,
|
9
22
|
isValidScenePath,
|
10
|
-
wait
|
11
|
-
|
12
|
-
import {
|
13
|
-
import { appRegister } from './Register';
|
14
|
-
import { CursorManager } from './Cursor';
|
15
|
-
import { DEFAULT_CONTAINER_RATIO, REQUIRE_VERSION } from './constants';
|
16
|
-
import { Fields } from './AttributesDelegate';
|
17
|
-
import { initDb } from './Register/storage';
|
18
|
-
import { isNull, isObject } from 'lodash';
|
19
|
-
import { log } from './Utils/log';
|
20
|
-
import { replaceRoomFunction } from './Utils/RoomHacker';
|
21
|
-
import { ResizeObserver as ResizeObserverPolyfill } from '@juggle/resize-observer';
|
22
|
-
import { setupWrapper } from './ViewManager';
|
23
|
-
import './style.css';
|
24
|
-
import '@netless/telebox-insider/dist/style.css';
|
25
|
-
import type { TELE_BOX_STATE } from './BoxManager';
|
23
|
+
wait,
|
24
|
+
} from "./Utils/Common";
|
25
|
+
import type { TELE_BOX_STATE } from "./BoxManager";
|
26
26
|
import {
|
27
27
|
AppCreateError,
|
28
28
|
AppManagerNotInitError,
|
@@ -50,10 +50,11 @@ import type {
|
|
50
50
|
CameraBound,
|
51
51
|
Point,
|
52
52
|
Rectangle,
|
53
|
-
ViewVisionMode
|
53
|
+
ViewVisionMode,
|
54
|
+
} from "white-web-sdk";
|
54
55
|
import type { AppListeners } from "./AppListener";
|
55
56
|
import type { NetlessApp, RegisterParams } from "./typings";
|
56
|
-
import type { TeleBoxState } from "@netless/telebox-insider";
|
57
|
+
import type { TeleBoxColorScheme, TeleBoxState } from "@netless/telebox-insider";
|
57
58
|
import type { AppProxy } from "./AppProxy";
|
58
59
|
|
59
60
|
const ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill;
|
@@ -122,18 +123,18 @@ export type AppInitState = {
|
|
122
123
|
};
|
123
124
|
|
124
125
|
export type EmitterEvent = {
|
125
|
-
onCreated: undefined
|
126
|
-
InitReplay: AppInitState
|
127
|
-
move: { appId: string
|
128
|
-
focus: { appId: string }
|
129
|
-
close: { appId: string }
|
130
|
-
resize: { appId: string
|
131
|
-
error: Error
|
132
|
-
seek: number
|
133
|
-
mainViewMounted: undefined
|
126
|
+
onCreated: undefined;
|
127
|
+
InitReplay: AppInitState;
|
128
|
+
move: { appId: string; x: number; y: number };
|
129
|
+
focus: { appId: string };
|
130
|
+
close: { appId: string };
|
131
|
+
resize: { appId: string; width: number; height: number; x?: number; y?: number };
|
132
|
+
error: Error;
|
133
|
+
seek: number;
|
134
|
+
mainViewMounted: undefined;
|
134
135
|
observerIdChange: number;
|
135
136
|
boxStateChange: string;
|
136
|
-
}
|
137
|
+
};
|
137
138
|
|
138
139
|
export const emitter: Emittery<EmitterEvent> = new Emittery();
|
139
140
|
|
@@ -155,6 +156,7 @@ export type MountParams = {
|
|
155
156
|
cursor?: boolean;
|
156
157
|
debug?: boolean;
|
157
158
|
disableCameraTransform?: boolean;
|
159
|
+
prefersColorScheme?: TeleBoxColorScheme;
|
158
160
|
};
|
159
161
|
|
160
162
|
export const callbacks: Emittery<PublicEvent> = new Emittery();
|
@@ -169,7 +171,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
169
171
|
public static containerSizeRatio = DEFAULT_CONTAINER_RATIO;
|
170
172
|
private static isCreated = false;
|
171
173
|
|
172
|
-
public version = "0.3.
|
174
|
+
public version = "0.3.12-canary.0";
|
173
175
|
|
174
176
|
public appListeners?: AppListeners;
|
175
177
|
|
@@ -224,6 +226,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
224
226
|
let overwriteStyles: string | undefined;
|
225
227
|
let cursor: boolean | undefined;
|
226
228
|
let disableCameraTransform = false;
|
229
|
+
let prefersColorScheme: TeleBoxColorScheme | undefined = "light";
|
227
230
|
if ("room" in params) {
|
228
231
|
room = params.room;
|
229
232
|
container = params.container;
|
@@ -237,6 +240,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
237
240
|
overwriteStyles = params.overwriteStyles;
|
238
241
|
cursor = params.cursor;
|
239
242
|
disableCameraTransform = Boolean(params?.disableCameraTransform);
|
243
|
+
prefersColorScheme = params.prefersColorScheme;
|
240
244
|
} else {
|
241
245
|
room = params;
|
242
246
|
containerSizeRatio = options?.containerSizeRatio;
|
@@ -272,13 +276,16 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
272
276
|
throw new Error("[WindowManager]: init InvisiblePlugin failed");
|
273
277
|
}
|
274
278
|
} else {
|
275
|
-
await pRetry(
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
279
|
+
await pRetry(
|
280
|
+
async count => {
|
281
|
+
manager = await this.initManager(room);
|
282
|
+
if (!manager) {
|
283
|
+
log(`manager is empty. retrying ${count}`);
|
284
|
+
throw new Error();
|
285
|
+
}
|
286
|
+
},
|
287
|
+
{ retries: 10 }
|
288
|
+
);
|
282
289
|
}
|
283
290
|
|
284
291
|
if (containerSizeRatio) {
|
@@ -299,6 +306,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
299
306
|
manager.appManager = new AppManager(manager, {
|
300
307
|
collectorContainer: collectorContainer,
|
301
308
|
collectorStyles: collectorStyles,
|
309
|
+
prefersColorScheme: prefersColorScheme
|
302
310
|
});
|
303
311
|
manager.observePlaygroundSize(playground, sizer, wrapper);
|
304
312
|
if (cursor) {
|
@@ -327,12 +335,18 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
327
335
|
} catch (error) {
|
328
336
|
throw new Error("[WindowManger]: room must be switched to be writable");
|
329
337
|
}
|
330
|
-
manager = (await room.createInvisiblePlugin(
|
338
|
+
manager = (await room.createInvisiblePlugin(
|
339
|
+
WindowManager,
|
340
|
+
{}
|
341
|
+
)) as WindowManager;
|
331
342
|
manager.ensureAttributes();
|
332
343
|
await wait(500);
|
333
344
|
await room.setWritable(false);
|
334
345
|
} else {
|
335
|
-
manager = (await room.createInvisiblePlugin(
|
346
|
+
manager = (await room.createInvisiblePlugin(
|
347
|
+
WindowManager,
|
348
|
+
{}
|
349
|
+
)) as WindowManager;
|
336
350
|
}
|
337
351
|
}
|
338
352
|
}
|
@@ -342,7 +356,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
342
356
|
/**
|
343
357
|
* 注册插件
|
344
358
|
*/
|
345
|
-
|
359
|
+
public static register<AppOptions = any, SetupResult = any, Attributes = any>(
|
346
360
|
params: RegisterParams<AppOptions, SetupResult, Attributes>
|
347
361
|
): Promise<void> {
|
348
362
|
return appRegister.register(params);
|
@@ -406,7 +420,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
406
420
|
}
|
407
421
|
}
|
408
422
|
if (scenePath && scenes === undefined) {
|
409
|
-
this.room?.putScenes(scenePath, [{}])
|
423
|
+
this.room?.putScenes(scenePath, [{}]);
|
410
424
|
}
|
411
425
|
}
|
412
426
|
return isDynamicPPT;
|
@@ -532,13 +546,18 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
532
546
|
return this.appManager?.closeApp(appId);
|
533
547
|
}
|
534
548
|
|
535
|
-
public moveCamera(
|
549
|
+
public moveCamera(
|
550
|
+
camera: Partial<Camera> & { animationMode?: AnimationMode | undefined }
|
551
|
+
): void {
|
536
552
|
this.mainView.moveCamera(camera);
|
537
553
|
}
|
538
554
|
|
539
|
-
public moveCameraToContain(
|
540
|
-
|
541
|
-
|
555
|
+
public moveCameraToContain(
|
556
|
+
rectangle: Rectangle &
|
557
|
+
Readonly<{
|
558
|
+
animationMode?: AnimationMode;
|
559
|
+
}>
|
560
|
+
): void {
|
542
561
|
this.mainView.moveCameraToContain(rectangle);
|
543
562
|
}
|
544
563
|
|