@netless/window-manager 0.4.0-canary.14 → 0.4.0-canary.18

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.
Files changed (49) hide show
  1. package/.vscode/settings.json +1 -0
  2. package/CHANGELOG.md +29 -1
  3. package/README.md +1 -0
  4. package/dist/AppListener.d.ts +1 -0
  5. package/dist/AppManager.d.ts +10 -7
  6. package/dist/AppProxy.d.ts +3 -2
  7. package/dist/AttributesDelegate.d.ts +2 -2
  8. package/dist/BoxManager.d.ts +5 -3
  9. package/dist/BuiltinApps.d.ts +0 -1
  10. package/dist/Cursor/Cursor.d.ts +8 -11
  11. package/dist/Cursor/index.d.ts +5 -15
  12. package/dist/Register/storage.d.ts +5 -1
  13. package/dist/Utils/Common.d.ts +4 -1
  14. package/dist/Utils/RoomHacker.d.ts +1 -1
  15. package/dist/View/MainView.d.ts +3 -2
  16. package/dist/constants.d.ts +3 -2
  17. package/dist/index.d.ts +16 -2
  18. package/dist/index.es.js +41 -1
  19. package/dist/index.es.js.map +1 -1
  20. package/dist/index.umd.js +41 -1
  21. package/dist/index.umd.js.map +1 -1
  22. package/dist/style.css +1 -1
  23. package/docs/api.md +36 -6
  24. package/docs/concept.md +9 -0
  25. package/package.json +5 -5
  26. package/src/AppContext.ts +1 -4
  27. package/src/AppListener.ts +14 -6
  28. package/src/AppManager.ts +96 -50
  29. package/src/AppProxy.ts +13 -8
  30. package/src/AttributesDelegate.ts +2 -2
  31. package/src/BoxManager.ts +33 -19
  32. package/src/BuiltinApps.ts +0 -1
  33. package/src/Cursor/Cursor.ts +22 -36
  34. package/src/Cursor/index.ts +33 -135
  35. package/src/Register/index.ts +25 -16
  36. package/src/Register/loader.ts +1 -1
  37. package/src/Register/storage.ts +6 -1
  38. package/src/Utils/Common.ts +32 -1
  39. package/src/Utils/RoomHacker.ts +28 -15
  40. package/src/View/MainView.ts +10 -11
  41. package/src/constants.ts +3 -2
  42. package/src/index.ts +61 -2
  43. package/src/shim.d.ts +2 -1
  44. package/src/style.css +1 -1
  45. package/vite.config.js +5 -2
  46. package/dist/Base/Context.d.ts +0 -12
  47. package/dist/Base/index.d.ts +0 -7
  48. package/src/Base/Context.ts +0 -45
  49. package/src/Base/index.ts +0 -10
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .page-renderer-pages-container{position:relative;overflow:hidden}.page-renderer-page{position:absolute;top:0;left:0;will-change:transform;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-scrollbar{position:absolute;top:0;right:0;z-index:2147483647;width:8px;min-height:30px;margin:0;padding:0;border:none;outline:none;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;opacity:0;transition:background .4s,opacity .4s 3s,transform .2s;will-change:transform,height;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.6);opacity:1;transition:background .4s,opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.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}.telebox-collector{position:absolute;right:10px;bottom:15px}.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 .1s;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}.telebox-collector{position:absolute;right:10px;bottom:15px}.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;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{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;touch-action:manipulation}.telebox-title-area{overflow:hidden;position:relative;height:100%;flex:1;display:flex;align-items:center}.telebox-title{overflow:hidden;margin: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-drag-area{position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;z-index:10}.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 .telebox-drag-area{height:100%;min-width:16px;position:static;margin:0;flex-grow:1;flex-shrink:0}.telebox-max-titlebar-maximized{display:flex}.telebox-titles{height:100%;margin:0;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{height:100%;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;user-select:none}.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
@@ -9,9 +9,13 @@
9
9
  - [实例方法](#instance-methods)
10
10
  - [`addApp`](#addApp)
11
11
  - [`closeApp`](#closeApp)
12
+ - [`setMainViewSceneIndex`](#setMainViewSceneIndex)
13
+ - [`setBoxState`](#setBoxState)
12
14
  - [实例属性](#prototypes)
13
15
  - [事件回调](#events)
14
16
 
17
+ <br>
18
+
15
19
  <h2 id="static-methods">静态方法</h2>
16
20
 
17
21
  <h3 id="mount">WindowManager.mount</h3>
@@ -42,6 +46,7 @@ const manager = await WindowManager.mount(
42
46
  | prefersColorScheme | [optional] string | light | auto, light, dark |
43
47
  | debug | [optional] boolean | false | 打印日志信息
44
48
 
49
+
45
50
  <h3 id="register">WindowManager.register</h3>
46
51
 
47
52
  > 注册 `APP` 到 `WindowManager`
@@ -81,6 +86,8 @@ WindowManager.setContainer(document.getElementById("container"));
81
86
  WindowManager.setCollectorContainer(document.getElementById("collector-container"));
82
87
  ```
83
88
 
89
+ <br>
90
+
84
91
  <h2 id="instance-methods">实例方法</h2>
85
92
 
86
93
  <h3 id="addApp">addApp</h3>
@@ -105,15 +112,36 @@ const appId = await manager.addApp({
105
112
  manager.closeApp(appId)
106
113
  ```
107
114
 
115
+ <h3 id="setMainViewSceneIndex">setMainViewSceneIndex</h3>
116
+
117
+ > 设置主白板的 `SceneIndex`
118
+
119
+ ```ts
120
+ manager.setMainViewSceneIndex(1)
121
+ ```
122
+
123
+ <h3 id="setBoxState">setBoxState</h3>
124
+
125
+ > 设置当前的 `boxState`
126
+
127
+ ```ts
128
+ manager.setBoxState("normal") // boxState: normal | maximized | minimized
129
+ ```
130
+
131
+ <br>
132
+
108
133
  <h2 id="prototypes">实例属性</h2>
109
134
 
110
- | name | type | default | desc |
111
- | ------------------ | ------- | ------- | ------ |
112
- | mainView | View | | 主白板 |
113
- | boxState | string | | 当前窗口状态 |
114
- | darkMode | boolean | | 黑夜模式 |
115
- | prefersColorScheme | string | | 颜色主题 |
135
+ | name | type | default | desc |
136
+ | ------------------ | ------- | ------- | ----------------- |
137
+ | mainView | View | | 主白板 |
138
+ | mainViewSceneIndex | number | | 当前主白板的 SceneIndex |
139
+ | boxState | string | | 当前窗口状态 |
140
+ | darkMode | boolean | | 黑夜模式 |
141
+ | prefersColorScheme | string | | 颜色主题 |
142
+ | focused | string | | focus 的 app |
116
143
 
144
+ <br>
117
145
 
118
146
  <h2 id="events">事件回调</h2>
119
147
 
@@ -124,7 +152,9 @@ manager.callbacks.on(events, listener)
124
152
  | name | type | default | desc |
125
153
  | ------------------------ | -------------- | ------- | -------------------------- |
126
154
  | mainViewModeChange | ViewVisionMode | | |
155
+ | mainViewSceneIndexChange | index: number | | |
127
156
  | boxStateChange | string | | normal,minimized,maximized |
128
157
  | darkModeChange | boolean | | |
129
158
  | prefersColorSchemeChange | string | | auto,light,dark |
130
159
  | cameraStateChange | CameraState | | |
160
+ | focusedChange | string, undefined | | 当前 focus 的 appId,主白板时为 undefined |
@@ -0,0 +1,9 @@
1
+ # 概念
2
+
3
+ ## 同步区域
4
+
5
+ 在不同分辨率的设备上,想要看到相同的区域和窗口,我们就需要在所有设备保持一个相同的比例。
6
+
7
+ 所以 `WindowManager` 有一个 `containerSizeRatio` 的选项来配置白板的宽高比,默认为 `9 / 16`
8
+
9
+ 如果外层给到 `WindowManager` 宽高并不是完美适配这个宽高比的话, `WindowManger` 会自动在内部算出一个适配这个比例的最大宽高,然后填充上去,这时在内部就会有一些区域不能操作
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "0.4.0-canary.14",
3
+ "version": "0.4.0-canary.18",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
@@ -23,9 +23,6 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@juggle/resize-observer": "^3.3.1",
26
- "@netless/app-docs-viewer": "0.2.0",
27
- "@netless/app-media-player": "0.1.0-beta.5",
28
- "@netless/telebox-insider": "0.2.18",
29
26
  "emittery": "^0.9.2",
30
27
  "lodash": "^4.17.21",
31
28
  "p-retry": "^4.6.1",
@@ -34,6 +31,9 @@
34
31
  "video.js": ">=7"
35
32
  },
36
33
  "devDependencies": {
34
+ "@netless/app-docs-viewer": "^0.2.5",
35
+ "@netless/app-media-player": "0.1.0-beta.5",
36
+ "@netless/telebox-insider": "0.2.21",
37
37
  "@rollup/plugin-commonjs": "^20.0.0",
38
38
  "@rollup/plugin-node-resolve": "^13.0.4",
39
39
  "@rollup/plugin-url": "^6.1.0",
@@ -58,6 +58,6 @@
58
58
  "typescript": "^4.3.5",
59
59
  "video.js": "^7.14.3",
60
60
  "vite": "^2.5.3",
61
- "white-web-sdk": "^2.16.0"
61
+ "white-web-sdk": "^2.16.1"
62
62
  }
63
63
  }
package/src/AppContext.ts CHANGED
@@ -59,10 +59,7 @@ export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOption
59
59
  public getScenes = (): SceneDefinition[] | undefined => {
60
60
  const appAttr = this.store.getAppAttributes(this.appId);
61
61
  if (appAttr?.isDynamicPPT) {
62
- const appProxy = this.manager.appProxies.get(this.appId);
63
- if (appProxy) {
64
- return appProxy.scenes;
65
- }
62
+ return this.appProxy.scenes;
66
63
  } else {
67
64
  return appAttr?.options["scenes"];
68
65
  }
@@ -1,9 +1,9 @@
1
- import { callbacks } from './index';
2
- import { Events, MagixEventName } from './constants';
1
+ import { callbacks, emitter } from "./index";
2
+ import { Events, MagixEventName } from "./constants";
3
+ import { setViewFocusScenePath } from "./Utils/Common";
3
4
  import type { Event } from "white-web-sdk";
4
5
  import type { AppManager } from "./AppManager";
5
6
  import type { TeleBoxState } from "@netless/telebox-insider";
6
- import { setViewFocusScenePath } from './Utils/Common';
7
7
 
8
8
  export class AppListeners {
9
9
  private displayer = this.manager.displayer;
@@ -46,6 +46,10 @@ export class AppListeners {
46
46
  this.moveCameraToContainHandler(data.payload);
47
47
  break;
48
48
  }
49
+ case Events.CursorMove: {
50
+ this.cursorMoveHandler(data.payload);
51
+ break;
52
+ }
49
53
  default:
50
54
  break;
51
55
  }
@@ -63,14 +67,18 @@ export class AppListeners {
63
67
 
64
68
  private boxStateChangeHandler = (state: TeleBoxState) => {
65
69
  callbacks.emit("boxStateChange", state);
66
- }
70
+ };
67
71
 
68
72
  private setMainViewScenePathHandler = ({ nextScenePath }: { nextScenePath: string }) => {
69
73
  setViewFocusScenePath(this.manager.mainView, nextScenePath);
70
74
  callbacks.emit("mainViewScenePathChange", nextScenePath);
71
- }
75
+ };
72
76
 
73
77
  private moveCameraToContainHandler = (payload: any) => {
74
78
  this.manager.mainView.moveCameraToContain(payload);
75
- }
79
+ };
80
+
81
+ private cursorMoveHandler = (payload: any) => {
82
+ emitter.emit("cursorMove", payload);
83
+ };
76
84
  }
package/src/AppManager.ts CHANGED
@@ -4,11 +4,18 @@ import { AppListeners } from "./AppListener";
4
4
  import { AppProxy } from "./AppProxy";
5
5
  import { autorun, isPlayer, isRoom, ScenePathType } from "white-web-sdk";
6
6
  import { callbacks, emitter, WindowManager, reconnectRefresher } from "./index";
7
- import { genAppId, makeValidScenePath, setScenePath, setViewFocusScenePath } from "./Utils/Common";
7
+ import {
8
+ entireScenes,
9
+ genAppId,
10
+ makeValidScenePath,
11
+ parseSceneDir,
12
+ setScenePath,
13
+ setViewFocusScenePath,
14
+ } from "./Utils/Common";
8
15
  import { log } from "./Utils/log";
9
16
  import { MainViewProxy } from "./View/MainView";
10
17
  import { onObjectRemoved, safeListenPropsUpdated } from "./Utils/Reactive";
11
- import { get, sortBy } from "lodash";
18
+ import { get, isInteger, sortBy } from "lodash";
12
19
  import { store } from "./AttributesDelegate";
13
20
  import { ViewManager } from "./View/ViewManager";
14
21
  import type { ReconnectRefresher } from "./ReconnectRefresher";
@@ -60,6 +67,48 @@ export class AppManager {
60
67
  this.onAppDelete(this.attributes.apps);
61
68
  });
62
69
  }
70
+ emitter.on("removeScenes", scenePath => {
71
+ if (scenePath === "/") {
72
+ this.setMainViewScenePath("/");
73
+ return;
74
+ }
75
+ const mainViewScenePath = this.store.getMainViewScenePath();
76
+ if (this.room && mainViewScenePath) {
77
+ if (mainViewScenePath === scenePath) {
78
+ this.setMainViewScenePath("/");
79
+ }
80
+ }
81
+ });
82
+ }
83
+
84
+ private get eventName() {
85
+ return isRoom(this.displayer) ? "onRoomStateChanged" : "onPlayerStateChanged";
86
+ }
87
+
88
+ public get attributes() {
89
+ return this.windowManger.attributes;
90
+ }
91
+
92
+ public get canOperate() {
93
+ return this.windowManger.canOperate;
94
+ }
95
+
96
+ public get room() {
97
+ return isRoom(this.displayer) ? (this.displayer as Room) : undefined;
98
+ }
99
+
100
+ public get mainView() {
101
+ return this.mainViewProxy.view;
102
+ }
103
+
104
+ public get focusApp() {
105
+ if (this.store.focus) {
106
+ return this.appProxies.get(this.store.focus);
107
+ }
108
+ }
109
+
110
+ public get uid() {
111
+ return this.room?.uid || "";
63
112
  }
64
113
 
65
114
  private async onCreated() {
@@ -111,11 +160,12 @@ export class AppManager {
111
160
  return autorun(() => {
112
161
  const focused = get(this.attributes, "focus");
113
162
  if (this._prevFocused !== focused) {
163
+ this.boxManager?.focusBox({ appId: focused });
114
164
  callbacks.emit("focusedChange", focused);
115
165
  this._prevFocused = focused;
116
166
  }
117
167
  });
118
- })
168
+ });
119
169
  if (!this.attributes.apps || Object.keys(this.attributes.apps).length === 0) {
120
170
  const mainScenePath = this.store.getMainViewScenePath();
121
171
  if (!mainScenePath) return;
@@ -212,10 +262,11 @@ export class AppManager {
212
262
  emitter.emit("mainViewMounted");
213
263
  }
214
264
 
215
- public setMainViewFocusPath() {
216
- const scenePath = this.store.getMainViewScenePath();
217
- if (scenePath) {
218
- setViewFocusScenePath(this.mainView, scenePath);
265
+ public setMainViewFocusPath(scenePath?: string) {
266
+ const focusScenePath = scenePath || this.store.getMainViewScenePath();
267
+ if (focusScenePath) {
268
+ const view = setViewFocusScenePath(this.mainView, focusScenePath);
269
+ return view?.focusScenePath === focusScenePath;
219
270
  }
220
271
  }
221
272
 
@@ -294,10 +345,6 @@ export class AppManager {
294
345
  }
295
346
  });
296
347
  }
297
- if (state.roomMembers) {
298
- this.windowManger.cursorManager?.setRoomMembers(state.roomMembers);
299
- this.windowManger.cursorManager?.cleanMemberAttributes(state.roomMembers);
300
- }
301
348
  this.appProxies.forEach(appProxy => {
302
349
  appProxy.appEmitter.emit("roomStateChange", state);
303
350
  });
@@ -326,32 +373,6 @@ export class AppManager {
326
373
  }
327
374
  };
328
375
 
329
- private get eventName() {
330
- return isRoom(this.displayer) ? "onRoomStateChanged" : "onPlayerStateChanged";
331
- }
332
-
333
- public get attributes() {
334
- return this.windowManger.attributes;
335
- }
336
-
337
- public get canOperate() {
338
- return this.windowManger.canOperate;
339
- }
340
-
341
- public get room() {
342
- return isRoom(this.displayer) ? (this.displayer as Room) : undefined;
343
- }
344
-
345
- public get mainView() {
346
- return this.mainViewProxy.view;
347
- }
348
-
349
- public get focusApp() {
350
- if (this.store.focus) {
351
- return this.appProxies.get(this.store.focus);
352
- }
353
- }
354
-
355
376
  public safeSetAttributes(attributes: any) {
356
377
  this.windowManger.safeSetAttributes(attributes);
357
378
  }
@@ -377,27 +398,47 @@ export class AppManager {
377
398
  }
378
399
 
379
400
  private async _setMainViewScenePath(scenePath: string) {
380
- this.safeSetAttributes({ _mainScenePath: scenePath });
381
- this.setMainViewFocusPath();
382
- this.store.setMainViewFocusPath(this.mainView);
383
- this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath: scenePath });
401
+ const success = this.setMainViewFocusPath(scenePath);
402
+ if (success) {
403
+ this.safeSetAttributes({ _mainScenePath: scenePath });
404
+ this.store.setMainViewFocusPath(this.mainView);
405
+ this.updateSceneIndex();
406
+ this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath: scenePath });
407
+ }
384
408
  }
385
409
 
410
+ private updateSceneIndex = () => {
411
+ const scenePath = this.store.getMainViewScenePath() as string;
412
+ const sceneDir = parseSceneDir(scenePath);
413
+ const scenes = entireScenes(this.displayer)[sceneDir];
414
+ if (scenes.length) {
415
+ // "/ppt3/1" -> "1"
416
+ const pageName = scenePath.replace(sceneDir, "").replace("/", "");
417
+ const index = scenes.findIndex(scene => scene.name === pageName);
418
+ if (isInteger(index) && index >= 0) {
419
+ this.safeSetAttributes({ _mainSceneIndex: index });
420
+ }
421
+ }
422
+ };
423
+
386
424
  public async setMainViewSceneIndex(index: number) {
387
425
  if (this.room) {
388
- this.safeSetAttributes({ _mainSceneIndex: index });
426
+ if (this.store.getMainViewSceneIndex() === index) return;
389
427
  const mainViewScenePath = this.store.getMainViewScenePath() as string;
390
428
  if (mainViewScenePath) {
391
- const sceneList = mainViewScenePath.split("/");
392
- sceneList.pop();
393
- let sceneDir = sceneList.join("/");
394
- if (sceneDir === "") {
395
- sceneDir = "/";
396
- }
429
+ const sceneDir = parseSceneDir(mainViewScenePath);
397
430
  const scenePath = makeValidScenePath(this.displayer, sceneDir, index);
398
431
  if (scenePath) {
399
- this.store.setMainViewScenePath(scenePath);
400
- this.setMainViewFocusPath();
432
+ const success = this.setMainViewFocusPath(scenePath);
433
+ if (success) {
434
+ this.store.setMainViewScenePath(scenePath);
435
+ this.safeSetAttributes({ _mainSceneIndex: index });
436
+ this.dispatchInternalEvent(Events.SetMainViewScenePath, {
437
+ nextScenePath: scenePath,
438
+ });
439
+ }
440
+ } else {
441
+ throw new Error(`[WindowManager]: ${sceneDir}: ${index} not valid index`);
401
442
  }
402
443
  }
403
444
  }
@@ -486,6 +527,11 @@ export class AppManager {
486
527
  });
487
528
  }
488
529
 
530
+ public findMemberByUid = (uid: string) => {
531
+ const roomMembers = this.room?.state.roomMembers;
532
+ return roomMembers?.find(member => member.payload?.uid === uid);
533
+ };
534
+
489
535
  public destroy() {
490
536
  this.displayer.callbacks.off(this.eventName, this.displayerStateListener);
491
537
  this.displayer.callbacks.off("onEnableWriteNowChanged", this.displayerWritableListener);
package/src/AppProxy.ts CHANGED
@@ -3,11 +3,12 @@ import { AppAttributes, AppEvents, Events } from "./constants";
3
3
  import { AppContext } from "./AppContext";
4
4
  import { appRegister } from "./Register";
5
5
  import { autorun } from "white-web-sdk";
6
+ import { BoxManagerNotFoundError } from "./Utils/error";
7
+ import { debounce, get } from "lodash";
6
8
  import { emitter } from "./index";
7
9
  import { Fields } from "./AttributesDelegate";
8
- import { debounce, get } from "lodash";
10
+ import { getScenePath, removeScenes, setScenePath, setViewFocusScenePath } from "./Utils/Common";
9
11
  import { log } from "./Utils/log";
10
- import { setScenePath, setViewFocusScenePath, getScenePath } from "./Utils/Common";
11
12
  import type {
12
13
  AppEmitterEvent,
13
14
  AppInitState,
@@ -19,10 +20,8 @@ import type { SceneState, View, SceneDefinition } from "white-web-sdk";
19
20
  import type { AppManager } from "./AppManager";
20
21
  import type { NetlessApp } from "./typings";
21
22
  import type { ReadonlyTeleBox } from "@netless/telebox-insider";
22
- import { Base } from "./Base";
23
- import { BoxManagerNotFoundError } from "./Utils/error";
24
23
 
25
- export class AppProxy extends Base {
24
+ export class AppProxy {
26
25
  public id: string;
27
26
  public scenePath?: string;
28
27
  public appEmitter: Emittery<AppEmitterEvent>;
@@ -32,6 +31,7 @@ export class AppProxy extends Base {
32
31
  private boxManager = this.manager.boxManager;
33
32
  private appProxies = this.manager.appProxies;
34
33
  private viewManager = this.manager.viewManager;
34
+ private store = this.manager.store;
35
35
  private kind: string;
36
36
  public isAddApp: boolean;
37
37
  private status: "normal" | "destroyed" = "normal";
@@ -41,11 +41,10 @@ export class AppProxy extends Base {
41
41
 
42
42
  constructor(
43
43
  private params: BaseInsertParams,
44
- manager: AppManager,
44
+ private manager: AppManager,
45
45
  appId: string,
46
46
  isAddApp: boolean
47
47
  ) {
48
- super(manager);
49
48
  this.kind = params.kind;
50
49
  this.id = appId;
51
50
  this.stateKey = `${this.id}_state`;
@@ -127,7 +126,7 @@ export class AppProxy extends Base {
127
126
  } else {
128
127
  throw new Error(`[WindowManager]: app load failed ${params.kind} ${params.src}`);
129
128
  }
130
- this.context.updateManagerRect();
129
+ this.boxManager?.updateManagerRect();
131
130
  return {
132
131
  appId: this.id,
133
132
  app: appImpl,
@@ -186,6 +185,9 @@ export class AppProxy extends Base {
186
185
  canOperate: this.manager.canOperate,
187
186
  smartPosition: this.isAddApp,
188
187
  });
188
+ if (this.isAddApp && this.box) {
189
+ this.store.updateAppState(appId, AppAttributes.ZIndex, this.box.zIndex);
190
+ }
189
191
  } catch (error: any) {
190
192
  console.error(error);
191
193
  throw new Error(`[WindowManager]: app setup error: ${error.message}`);
@@ -377,6 +379,9 @@ export class AppProxy extends Base {
377
379
  }
378
380
  if (cleanAttrs) {
379
381
  this.store.cleanAppAttributes(this.id);
382
+ if (this.scenePath) {
383
+ removeScenes(this.manager.room, this.scenePath);
384
+ }
380
385
  }
381
386
  this.appProxies.delete(this.id);
382
387
 
@@ -123,7 +123,7 @@ export class AttributesDelegate {
123
123
  return this.getAppAttributes(id)?.options?.scenePath;
124
124
  }
125
125
 
126
- public getMainViewScenePath() {
126
+ public getMainViewScenePath(): string | undefined {
127
127
  return this.attributes["_mainScenePath"];
128
128
  }
129
129
 
@@ -159,7 +159,7 @@ export class AttributesDelegate {
159
159
  this.context.safeSetAttributes({ [Fields.MainViewSize]: { ...size } });
160
160
  }
161
161
 
162
- public setAppFocus(appId: string, focus: boolean) {
162
+ public setAppFocus = (appId: string, focus: boolean) => {
163
163
  if (focus) {
164
164
  this.context.safeSetAttributes({ [Fields.Focus]: appId });
165
165
  } else {