├── packages ├── vr360-ui │ └── README.md ├── vr360-ui-react │ └── README.md ├── vr360-ui-vue2 │ └── README.md ├── vr360-ui-vue3 │ └── README.md ├── doc │ ├── .vuepress │ │ ├── plugins │ │ │ ├── code-demo │ │ │ │ ├── index.ts │ │ │ │ ├── constant.ts │ │ │ │ ├── global.d.ts │ │ │ │ ├── CodeDemo.props.ts │ │ │ │ ├── Icons.tsx │ │ │ │ ├── clientConfigFile.ts │ │ │ │ └── CodeDemo.vue │ │ │ └── index.ts │ │ ├── configs │ │ │ ├── navbar │ │ │ │ ├── index.ts │ │ │ │ ├── en.ts │ │ │ │ └── zh.ts │ │ │ ├── sidebar │ │ │ │ ├── index.ts │ │ │ │ ├── en.ts │ │ │ │ └── zh.ts │ │ │ └── index.ts │ │ ├── public │ │ │ ├── favicon.ico │ │ │ ├── nicepkg.png │ │ │ ├── images │ │ │ │ ├── logo.png │ │ │ │ ├── logo-bg.png │ │ │ │ ├── logo-bg2.png │ │ │ │ ├── logo-dark.png │ │ │ │ ├── icons │ │ │ │ │ ├── icon-48x48.png │ │ │ │ │ ├── icon-72x72.png │ │ │ │ │ ├── icon-96x96.png │ │ │ │ │ ├── icon-128x128.png │ │ │ │ │ ├── icon-144x144.png │ │ │ │ │ ├── icon-152x152.png │ │ │ │ │ ├── icon-192x192.png │ │ │ │ │ ├── icon-384x384.png │ │ │ │ │ ├── icon-512x512.png │ │ │ │ │ ├── favicon-16x16.png │ │ │ │ │ ├── favicon-32x32.png │ │ │ │ │ ├── mstile-150x150.png │ │ │ │ │ └── apple-touch-icon.png │ │ │ │ ├── logo.svg │ │ │ │ └── logo-dark.svg │ │ │ ├── code-demo-templates │ │ │ │ ├── vue3 │ │ │ │ │ ├── src │ │ │ │ │ │ ├── App.vue.txt │ │ │ │ │ │ └── main.ts.txt │ │ │ │ │ ├── types │ │ │ │ │ │ └── module.d.ts.txt │ │ │ │ │ ├── vite.config.ts.txt │ │ │ │ │ ├── package.json.txt │ │ │ │ │ ├── tsconfig.json.txt │ │ │ │ │ └── index.html.txt │ │ │ │ ├── vue2 │ │ │ │ │ ├── types │ │ │ │ │ │ └── module.d.ts.txt │ │ │ │ │ ├── src │ │ │ │ │ │ ├── main.ts.txt │ │ │ │ │ │ └── App.vue.txt │ │ │ │ │ ├── vite.config.ts.txt │ │ │ │ │ ├── package.json.txt │ │ │ │ │ ├── tsconfig.json.txt │ │ │ │ │ └── index.html.txt │ │ │ │ ├── html │ │ │ │ │ └── package.json.txt │ │ │ │ ├── react │ │ │ │ │ ├── src │ │ │ │ │ │ └── main.tsx.txt │ │ │ │ │ ├── vite.config.ts.txt │ │ │ │ │ ├── package.json.txt │ │ │ │ │ ├── tsconfig.json.txt │ │ │ │ │ └── index.html.txt │ │ │ │ └── demo.css.txt │ │ │ ├── browserconfig.xml │ │ │ └── manifest.webmanifest │ │ ├── utils │ │ │ └── common.ts │ │ ├── types │ │ │ └── module.d.ts │ │ ├── index.build.html │ │ ├── theme │ │ │ ├── components │ │ │ │ ├── Home.vue │ │ │ │ ├── HomeFeatures.vue │ │ │ │ └── HomeVrBg.vue │ │ │ └── index.ts │ │ ├── components │ │ │ └── NpmBadge.vue │ │ ├── styles │ │ │ └── index.scss │ │ ├── examples │ │ │ └── firstHouse │ │ │ │ └── demo.css │ │ └── client.ts │ ├── libs │ │ ├── vr360-ui-vue2 │ │ │ └── README.md │ │ ├── vr360-ui-vue3 │ │ │ └── README.md │ │ ├── vr360-ui-react │ │ │ └── README.md │ │ ├── vr360-ui │ │ │ └── README.md │ │ └── vr360-core │ │ │ ├── example.md │ │ │ ├── events.md │ │ │ ├── properties.md │ │ │ └── README.md │ ├── guide │ │ ├── questions.md │ │ └── README.md │ ├── tsconfig.json │ ├── bundler.config.ts │ ├── README.md │ ├── package.json │ ├── CHANGELOG.md │ └── vuepress.config.ts ├── vr360-shared │ ├── test-utils.d.ts │ ├── README.md │ ├── test-vue-utils.d.ts │ ├── test-react-utils.d.ts │ ├── src │ │ ├── test-utils.ts │ │ ├── test-vue-utils.ts │ │ ├── test-react-utils.ts │ │ ├── build-utils │ │ │ ├── index.ts │ │ │ ├── build-script.util.ts │ │ │ └── vite-config-common.util.ts │ │ ├── test-utils │ │ │ ├── react │ │ │ │ ├── react-mount.util.ts │ │ │ │ ├── react-helper.util.ts │ │ │ │ └── index.ts │ │ │ ├── vue │ │ │ │ ├── index.ts │ │ │ │ ├── vue-helper.util.ts │ │ │ │ └── vue-mount.util.ts │ │ │ └── common │ │ │ │ ├── polyfill-fetch.util.ts │ │ │ │ ├── index.ts │ │ │ │ ├── mock-global-api.ts │ │ │ │ ├── polyfill-pointer-events.util.ts │ │ │ │ ├── helper.util.ts │ │ │ │ └── mock-server.util.ts │ │ └── index.ts │ ├── build.config.ts │ ├── tsconfig.json │ ├── types │ │ └── global.d.ts │ ├── CHANGELOG.md │ └── package.json └── vr360-core │ ├── src │ ├── index.ts │ ├── assets │ │ └── tips.png │ ├── manager │ │ └── index.ts │ └── types.ts │ ├── test │ ├── index.ts │ └── setup.ts │ ├── scripts │ └── build.ts │ ├── tsconfig.json │ ├── vite.config.ts │ ├── CHANGELOG.md │ ├── package.json │ └── README.md ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── feature_request.yml │ └── bug_report.yml ├── settings.yml ├── workflows │ ├── lint.yml │ ├── test.yml │ ├── release.yml │ └── docs.yml ├── PULL_REQUEST_TEMPLATE.md └── commit-convention.md ├── scripts ├── release.ts ├── build.ts ├── check-update.ts └── utils.ts ├── commitlint.config.js ├── playgrounds ├── vue2 │ ├── picture │ │ └── hotpot.png │ ├── types │ │ └── module.d.ts │ ├── src │ │ ├── main.ts │ │ └── App.vue │ ├── tsconfig.json │ ├── package.json │ ├── unocss.config.ts │ ├── index.html │ └── vite.config.ts ├── vue3 │ ├── public │ │ └── picture │ │ │ └── hotpot.png │ ├── src │ │ ├── EditorSettings.vue │ │ ├── EditorTipsManager.vue │ │ ├── EditorHotPointManager.vue │ │ ├── EditorTopBar.vue │ │ ├── main.ts │ │ ├── Editor.vue │ │ ├── Icons.tsx │ │ ├── EditorLeftBar.vue │ │ ├── ContextMenu.vue │ │ ├── EditorSceneManager.vue │ │ ├── useVr360.ts │ │ └── App.vue │ ├── tsconfig.json │ ├── types │ │ └── module.d.ts │ ├── package.json │ ├── unocss.config.ts │ ├── index.html │ └── vite.config.ts └── react │ ├── src │ ├── Example.tsx │ └── main.tsx │ ├── tsconfig.json │ ├── vite.config.ts │ ├── package.json │ └── index.html ├── pnpm-workspace.yaml ├── .husky ├── pre-commit ├── commit-msg └── prepare-commit-msg ├── .stylelintignore ├── .editorconfig ├── netlify.toml ├── tsconfig.json ├── .eslintignore ├── lint-staged.config.js ├── prettier.config.js ├── .vscode ├── extensions.json └── settings.json ├── .gitignore ├── turbo.json ├── LICENSE ├── tsconfig-base.json ├── .npmrc ├── stylelint.config.js ├── README.md ├── CODE_OF_CONDUCT.md ├── textures.json └── CONTRIBUTING.md /packages/vr360-ui/README.md: -------------------------------------------------------------------------------- 1 | # 开发中 2 | -------------------------------------------------------------------------------- /packages/vr360-ui-react/README.md: -------------------------------------------------------------------------------- 1 | # 开发中 2 | -------------------------------------------------------------------------------- /packages/vr360-ui-vue2/README.md: -------------------------------------------------------------------------------- 1 | # 开发中 2 | -------------------------------------------------------------------------------- /packages/vr360-ui-vue3/README.md: -------------------------------------------------------------------------------- 1 | # 开发中 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [2214962083] 2 | -------------------------------------------------------------------------------- /scripts/release.ts: -------------------------------------------------------------------------------- 1 | import {release} from './utils' 2 | 3 | release() 4 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/plugins/code-demo/index.ts: -------------------------------------------------------------------------------- 1 | export * from './plugin' 2 | -------------------------------------------------------------------------------- /packages/vr360-shared/test-utils.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/test-utils' 2 | -------------------------------------------------------------------------------- /packages/vr360-shared/README.md: -------------------------------------------------------------------------------- 1 | # Vr360-shared 2 | 3 | 内部实用功能的共享包,包括构建和测试功能。 4 | -------------------------------------------------------------------------------- /packages/vr360-shared/test-vue-utils.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/test-vue-utils' 2 | -------------------------------------------------------------------------------- /packages/vr360-shared/test-react-utils.d.ts: -------------------------------------------------------------------------------- 1 | export * from './dist/test-react-utils' 2 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/configs/navbar/index.ts: -------------------------------------------------------------------------------- 1 | export * from './en' 2 | export * from './zh' 3 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/configs/sidebar/index.ts: -------------------------------------------------------------------------------- 1 | export * from './en' 2 | export * from './zh' 3 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@commitlint/config-conventional'] 3 | } 4 | -------------------------------------------------------------------------------- /scripts/build.ts: -------------------------------------------------------------------------------- 1 | import {build, copyFiles} from './utils' 2 | 3 | copyFiles() 4 | 5 | build() 6 | -------------------------------------------------------------------------------- /packages/doc/libs/vr360-ui-vue2/README.md: -------------------------------------------------------------------------------- 1 | # 介绍 2 | 3 | (开发中...)提供一个现成的 vr360 viewer 和 editor 组件,适配 vue2 框架版。 4 | -------------------------------------------------------------------------------- /packages/doc/libs/vr360-ui-vue3/README.md: -------------------------------------------------------------------------------- 1 | # 介绍 2 | 3 | (开发中...)提供一个现成的 vr360 viewer 和 editor 组件,适配 vue3 框架版。 4 | -------------------------------------------------------------------------------- /packages/doc/libs/vr360-ui-react/README.md: -------------------------------------------------------------------------------- 1 | # 介绍 2 | 3 | (开发中...)提供一个现成的 vr360 viewer 和 editor 组件,适配 react 框架版。 4 | -------------------------------------------------------------------------------- /packages/vr360-core/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './vr360' 2 | export * from './types' 3 | export * from './manager' 4 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/configs/index.ts: -------------------------------------------------------------------------------- 1 | export * as navbar from './navbar' 2 | export * as sidebar from './sidebar' 3 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils.ts: -------------------------------------------------------------------------------- 1 | // this file will build as a bundle 2 | export * from './test-utils/common' 3 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-vue-utils.ts: -------------------------------------------------------------------------------- 1 | // this file will build as a bundle 2 | export * from './test-utils/vue' 3 | -------------------------------------------------------------------------------- /playgrounds/vue2/picture/hotpot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/playgrounds/vue2/picture/hotpot.png -------------------------------------------------------------------------------- /packages/doc/libs/vr360-ui/README.md: -------------------------------------------------------------------------------- 1 | # 介绍 2 | 3 | (开发中...)提供一个现成的 vr360 viewer 和 editor 组件,基于 stencil 构建的 web component。 4 | -------------------------------------------------------------------------------- /packages/vr360-core/src/assets/tips.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/vr360-core/src/assets/tips.png -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-react-utils.ts: -------------------------------------------------------------------------------- 1 | // this file will build as a bundle 2 | export * from './test-utils/react' 3 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'packages/**' 3 | - 'examples/**' 4 | - 'playgrounds/**' 5 | - '!**/test/**' 6 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | # lint git stash files 5 | npx --no-install lint-staged 6 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/favicon.ico -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/nicepkg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/nicepkg.png -------------------------------------------------------------------------------- /packages/vr360-shared/src/build-utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './build-script.util' 2 | export * from './vite-config-common.util' 3 | -------------------------------------------------------------------------------- /playgrounds/vue3/public/picture/hotpot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/playgrounds/vue3/public/picture/hotpot.png -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | # lint commit message 5 | npx --no-install commitlint --edit "$1" 6 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/logo.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/logo-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/logo-bg.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/logo-bg2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/logo-bg2.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/logo-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/logo-dark.png -------------------------------------------------------------------------------- /playgrounds/react/src/Example.tsx: -------------------------------------------------------------------------------- 1 | function Example() { 2 | return
Example
3 | } 4 | 5 | export default Example 6 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/icon-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/icon-48x48.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/icon-72x72.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/icon-96x96.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/icon-128x128.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/icon-144x144.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/icon-152x152.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/icon-192x192.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/icon-384x384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/icon-384x384.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/icon-512x512.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/favicon-16x16.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/favicon-32x32.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/mstile-150x150.png -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/images/icons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicepkg/vr360/HEAD/packages/doc/.vuepress/public/images/icons/apple-touch-icon.png -------------------------------------------------------------------------------- /packages/doc/guide/questions.md: -------------------------------------------------------------------------------- 1 | # 常见问题 2 | 3 | ## vr360-ui 为什么没有 angular 版 4 | 5 | vr360-ui 是基于 stencil.js 开发,适配 angular 是很容易的,但是由于本人没怎么用过 angular,适配完也不知道有没有 bug,所以欢迎提 pr 。 6 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/react/react-mount.util.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | export function mount() { 3 | console.log('mount') 4 | } 5 | -------------------------------------------------------------------------------- /.stylelintignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | **/*.spec.* 3 | es/ 4 | lib/ 5 | _site/ 6 | dist/ 7 | **/node_modules/* 8 | **/segi-ant-theme.less 9 | **/.rollup.cache/* 10 | **/index.html 11 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/vue/index.ts: -------------------------------------------------------------------------------- 1 | // this file will build as a bundle 2 | // all of vue-demi utils 3 | export * from './vue-helper.util' 4 | export * from './vue-mount.util' 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/utils/common.ts: -------------------------------------------------------------------------------- 1 | import rootPkg from '../../../../package.json' 2 | 3 | export const version = rootPkg.version as string 4 | export const isProd = process.env.NODE_ENV === 'production' 5 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue3/src/App.vue.txt: -------------------------------------------------------------------------------- 1 | 4 | 5 | 8 | -------------------------------------------------------------------------------- /playgrounds/vue3/src/EditorSettings.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/common/polyfill-fetch.util.ts: -------------------------------------------------------------------------------- 1 | import nodeFetch from 'node-fetch' 2 | 3 | export const polyfillFetch = () => { 4 | // @ts-expect-error override 5 | window.fetch = nodeFetch 6 | } 7 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue2/types/module.d.ts.txt: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import type {VueConstructor} from 'vue' 3 | const component: VueConstructor 4 | export default component 5 | } 6 | -------------------------------------------------------------------------------- /playgrounds/vue3/src/EditorTipsManager.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build.environment] 2 | NODE_VERSION = "16" 3 | NPM_FLAGS = "--version" # prevent Netlify npm install 4 | [build] 5 | publish = "packages/doc/.vuepress/dist" 6 | command = "npm i -g pnpm && pnpm build:ci" 7 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue2/src/main.ts.txt: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | Vue.config.productionTip = false 5 | 6 | new Vue({ 7 | render: h => h(App) 8 | }).$mount('#app') 9 | -------------------------------------------------------------------------------- /packages/vr360-core/test/index.ts: -------------------------------------------------------------------------------- 1 | import {polyfillFetch} from '@nicepkg/vr360-shared/test-utils' 2 | export * from '@nicepkg/vr360-shared/test-utils' 3 | export * from '@nicepkg/vr360-shared/test-vue-utils' 4 | 5 | polyfillFetch() 6 | -------------------------------------------------------------------------------- /playgrounds/vue3/src/EditorHotPointManager.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue3/src/main.ts.txt: -------------------------------------------------------------------------------- 1 | import {createApp} from 'vue' 2 | import App from './App.vue' 3 | 4 | const app = createApp(App) 5 | app.mount('#app') 6 | 7 | app.config.globalProperties.productionTip = false 8 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue3/types/module.d.ts.txt: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import type {DefineComponent} from 'vue-demi' 3 | const Component: DefineComponent<{}, {}, any> 4 | export default Component 5 | } 6 | 7 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/common/index.ts: -------------------------------------------------------------------------------- 1 | // this file will build as a bundle 2 | export * from './helper.util' 3 | export * from './mock-server.util' 4 | export * from './polyfill-fetch.util' 5 | export * from './polyfill-pointer-events.util' 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-base.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "include": ["./scripts/**/*", "./types/**/*"], 7 | "exclude": ["./node_modules/**/*", "./lib/**/*", "./es/**/*", "./dist/**/*", "./packages/**/*"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/html/package.json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playground-html", 3 | "private": true, 4 | "scripts": { 5 | "dev": "http-server ./ -p 8000 -o" 6 | }, 7 | "devDependencies": { 8 | "http-server": "^14.1.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.husky/prepare-commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | echo "do not 'git commit' please run 'pnpm commit' instead" 5 | # echo "commit lint please see https://juejin.cn/post/6934292467160514567#heading-3" 6 | echo "See .github/commit-convention.md for more details." 7 | -------------------------------------------------------------------------------- /playgrounds/vue3/src/EditorTopBar.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /playgrounds/vue3/src/main.ts: -------------------------------------------------------------------------------- 1 | import {createApp} from 'vue' 2 | import App from './App.vue' 3 | 4 | // css 5 | import 'uno.css' 6 | import '@unocss/reset/tailwind.css' 7 | 8 | const app = createApp(App) 9 | app.mount('#app') 10 | 11 | app.config.globalProperties.productionTip = false 12 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/configs/sidebar/en.ts: -------------------------------------------------------------------------------- 1 | import type {SidebarConfig} from '@vuepress/theme-default' 2 | 3 | export const en: SidebarConfig = { 4 | '/en/guide/': [ 5 | { 6 | text: 'Guide', 7 | children: ['/en/guide/README.md', '/en/guide/questions.md'] 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue2/src/App.vue.txt: -------------------------------------------------------------------------------- 1 | 4 | 5 | 15 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/plugins/code-demo/constant.ts: -------------------------------------------------------------------------------- 1 | // 用于 Stackblitz 示例的默认标题(未覆盖时) 2 | export const DEFAULT_EDITOR_TITLE = 'Vr360 Example' 3 | 4 | // 用于 Stackblitz 示例的默认描述(未覆盖时) 5 | export const DEFAULT_EDITOR_DESCRIPTION = '' 6 | 7 | // 用于所有 @nicepkg/vr360-*包的默认包版本。 8 | export const DEFAULT_VR360_VERSION = '^6.0.0' 9 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/react/src/main.tsx.txt: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import Example from './Example' 4 | 5 | ReactDOM.render( 6 | 7 | 8 | , 9 | document.querySelector('#app') 10 | ) 11 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | **/node_modules/ 2 | *.html 3 | es/ 4 | **/lib/ 5 | **/dist/ 6 | **/lib-types/ 7 | _site/ 8 | **/dist/ 9 | CHANGELOG.md 10 | .rollup.cache 11 | tsconfig.tsbuildinfo 12 | !.storybook 13 | !.vuepress 14 | types/components.d.ts 15 | types/auto-imports.d.ts 16 | *.generated.ts 17 | **/.vuepress/examples/ 18 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/types/module.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | 3 | declare module '*.vue' { 4 | import type {DefineComponent} from 'vue' 5 | // eslint-disable-next-line @typescript-eslint/ban-types 6 | const Component: DefineComponent<{}, {}, any> 7 | export default Component 8 | } 9 | -------------------------------------------------------------------------------- /lint-staged.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'], 3 | '*.json': ['prettier --write'], 4 | '*.vue': ['eslint --fix', 'stylelint --aei --fix', 'prettier --write'], 5 | '*.{scss,sass,less,css}': ['stylelint --aei --fix', 'prettier --write'], 6 | '*.md': ['prettier --write'] 7 | } 8 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #0c4dc4 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /playgrounds/react/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import Example from './Example' 4 | 5 | import '@unocss/reset/tailwind.css' 6 | import 'uno.css' 7 | 8 | ReactDOM.render( 9 | 10 | 11 | , 12 | document.querySelector('#app') 13 | ) 14 | -------------------------------------------------------------------------------- /packages/vr360-core/scripts/build.ts: -------------------------------------------------------------------------------- 1 | import {buildUtils} from '@nicepkg/vr360-shared' 2 | import {minifyConfig, unMinifyConfig, packagePath} from '../vite.config' 3 | 4 | buildUtils.build({ 5 | minifyConfig, 6 | unMinifyConfig, 7 | packagePath, 8 | dtsOptions: { 9 | // merge all .d.ts files 10 | rollupTypes: true 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /playgrounds/vue2/types/module.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import type {VueConstructor} from 'vue' 3 | const component: VueConstructor 4 | export default component 5 | } 6 | 7 | declare module 'vue-demi/scripts/utils.js' { 8 | /** 9 | * switch vue version 10 | */ 11 | const switchVersion: (vueVersion: 2 | 3 | number) => void 12 | } 13 | -------------------------------------------------------------------------------- /playgrounds/vue2/src/main.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import VueCompositionAPI from '@vue/composition-api' 4 | 5 | // css 6 | import 'uno.css' 7 | import '@unocss/reset/tailwind.css' 8 | 9 | Vue.use(VueCompositionAPI) 10 | 11 | Vue.config.productionTip = false 12 | 13 | new Vue({ 14 | render: h => h(App) 15 | }).$mount('#app') 16 | -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | 3 | module.exports = /** @type { import ('prettier').RequiredOptions } */ ({ 4 | printWidth: 120, 5 | semi: false, 6 | singleQuote: true, 7 | trailingComma: 'none', 8 | bracketSpacing: false, 9 | arrowParens: 'avoid', 10 | insertPragma: false, 11 | tabWidth: 2, 12 | useTabs: false, 13 | endOfLine: 'auto' 14 | }) 15 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/react/react-helper.util.ts: -------------------------------------------------------------------------------- 1 | import {mockGlobalApi} from '../common/mock-global-api' 2 | import createFetchMock from 'vitest-fetch-mock' 3 | 4 | export function commonSetup(options?: {title?: string}) { 5 | document.title = options?.title ?? 'React Starter' 6 | 7 | // Mock fetch 8 | createFetchMock(vi).enableMocks() 9 | 10 | mockGlobalApi() 11 | } 12 | -------------------------------------------------------------------------------- /playgrounds/vue3/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.json", 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist", 6 | "types": ["vite/client"], 7 | "paths": { 8 | "@/*": ["./src/*"] 9 | } 10 | }, 11 | "include": ["./src/**/*", "./scripts/**/*", "./types/**/*", "./*.js", "./*.ts"], 12 | "exclude": ["node_modules", "dist"] 13 | } 14 | -------------------------------------------------------------------------------- /packages/vr360-shared/build.config.ts: -------------------------------------------------------------------------------- 1 | import {defineBuildConfig} from 'unbuild' 2 | 3 | export default defineBuildConfig({ 4 | entries: ['src/index', 'src/test-utils', 'src/test-vue-utils', 'src/test-react-utils'], 5 | clean: true, 6 | declaration: true, 7 | externals: ['vite', 'vitest', 'vue-demi', 'react'], 8 | rollup: { 9 | emitCJS: true, 10 | cjsBridge: true 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "antfu.iconify", 4 | "antfu.unocss", 5 | "antfu.goto-alias", 6 | "csstools.postcss", 7 | "dbaeumer.vscode-eslint", 8 | "esbenp.prettier-vscode", 9 | "mrmlnc.vscode-less", 10 | "mikestead.dotenv", 11 | "stylelint.vscode-stylelint", 12 | "vue.volar", 13 | "streetsidesoftware.code-spell-checker" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/doc/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.json", 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist", 6 | "types": ["vite/client", "@vuepress/client/types"], 7 | "paths": { 8 | "@/*": ["./.vuepress/*"] 9 | } 10 | }, 11 | "include": ["./.vuepress/**/*", "./*.js", "./*.ts"], 12 | "exclude": ["node_modules", "dist", ".vuepress/examples/**/*"] 13 | } 14 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/react/index.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable unicorn/prefer-export-from */ 2 | // this file will build as a bundle 3 | // all of react utils 4 | import * as testLibReact from '@testing-library/react' 5 | import * as testLibUserEvent from '@testing-library/user-event' 6 | 7 | export * from './react-helper.util' 8 | export * from './react-mount.util' 9 | 10 | export {testLibReact, testLibUserEvent} 11 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/common/mock-global-api.ts: -------------------------------------------------------------------------------- 1 | export function mockGlobalApi() { 2 | // Mock matchMedia 3 | vi.stubGlobal('matchMedia', (query: string) => ({ 4 | matches: false, 5 | media: query, 6 | onchange: null, 7 | addListener: vi.fn(), 8 | removeListener: vi.fn(), 9 | addEventListener: vi.fn(), 10 | removeEventListener: vi.fn(), 11 | dispatchEvent: vi.fn() 12 | })) 13 | } 14 | -------------------------------------------------------------------------------- /playgrounds/react/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.json", 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist", 6 | "jsx": "react-jsx", 7 | "types": ["vite/client"], 8 | "paths": { 9 | "@/*": ["./src/*"] 10 | } 11 | }, 12 | "include": ["./src/**/*", "./scripts/**/*", "./types/**/*", "./test/**/*", "./*.js", "./*.ts"], 13 | "exclude": ["node_modules", "dist"] 14 | } 15 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/configs/navbar/en.ts: -------------------------------------------------------------------------------- 1 | import type {NavbarConfig} from '@vuepress/theme-default' 2 | import {version} from '../../utils/common' 3 | 4 | export const en: NavbarConfig = [ 5 | { 6 | text: 'Guide', 7 | link: '/en/guide/' 8 | }, 9 | { 10 | text: `v${version}`, 11 | children: [ 12 | { 13 | text: 'Releases', 14 | link: 'https://github.com/nicepkg/vr360/releases' 15 | } 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/plugins/code-demo/global.d.ts: -------------------------------------------------------------------------------- 1 | import type {ProjectFiles} from '@stackblitz/sdk' 2 | import type {CodeDemoProps} from './CodeDemo.props' 3 | 4 | declare global { 5 | // eslint-disable-next-line @typescript-eslint/consistent-type-definitions 6 | interface Window { 7 | loadCodeDemoOptions?: (preOptions: CodeDemoProps) => CodeDemoProps 8 | loadCodeDemoModeDefaultFiles?: (mode: string) => ProjectFiles | Promise 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/react/vite.config.ts.txt: -------------------------------------------------------------------------------- 1 | import {defineConfig} from 'vite' 2 | import path from 'node:path' 3 | import viteReact from '@vitejs/plugin-react' 4 | 5 | const pathResolve = (..._path: string[]) => path.resolve(__dirname, ..._path) 6 | 7 | export default defineConfig({ 8 | resolve: { 9 | alias: { 10 | '@/': `${pathResolve('./src')}/` 11 | } 12 | }, 13 | 14 | plugins: [ 15 | viteReact() 16 | ] 17 | }) 18 | -------------------------------------------------------------------------------- /packages/vr360-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.json", 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist", 6 | "types": ["vite/client", "vitest", "vitest/globals"], 7 | "paths": { 8 | "@/*": ["./src/*"], 9 | "@test/*": ["./test/*"] 10 | } 11 | }, 12 | "include": ["./src/**/*", "./scripts/**/*", "./types/**/*", "./test/**/*", "./*.js", "./*.ts"], 13 | "exclude": ["node_modules", "dist"] 14 | } 15 | -------------------------------------------------------------------------------- /packages/vr360-shared/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.json", 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist", 6 | "types": ["vite/client", "vitest", "vitest/globals"], 7 | "paths": { 8 | "@/*": ["./src/*"], 9 | "@test/*": ["./test/*"] 10 | } 11 | }, 12 | "include": ["./src/**/*", "./scripts/**/*", "./types/**/*", "./test/**/*", "./*.js", "./*.ts"], 13 | "exclude": ["node_modules", "dist"] 14 | } 15 | -------------------------------------------------------------------------------- /packages/vr360-core/test/setup.ts: -------------------------------------------------------------------------------- 1 | import {polyfillFetch, polyfillPointerEvents} from '@nicepkg/vr360-shared/test-utils' 2 | import {setupVueSwitch} from '@nicepkg/vr360-shared/test-vue-utils' 3 | import {beforeAll, beforeEach} from 'vitest' 4 | 5 | polyfillFetch() 6 | polyfillPointerEvents() 7 | 8 | setupVueSwitch() 9 | 10 | beforeAll(() => { 11 | setupVueSwitch() 12 | }) 13 | 14 | beforeEach(() => { 15 | document.body.innerHTML = '' 16 | document.head.innerHTML = '' 17 | }) 18 | -------------------------------------------------------------------------------- /playgrounds/vue3/types/module.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | declare module '*.vue' { 3 | import type {DefineComponent} from 'vue-demi' 4 | // eslint-disable-next-line @typescript-eslint/ban-types 5 | const Component: DefineComponent<{}, {}, any> 6 | export default Component 7 | } 8 | 9 | declare module 'vue-demi/scripts/utils.js' { 10 | /** 11 | * switch vue version 12 | */ 13 | const switchVersion: (vueVersion: 2 | 3 | number) => void 14 | } 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Question 4 | url: https://github.com/nicepkg/vr360/discussions/new?category=Q-A 5 | about: Ask a question or discuss about vr360 6 | - name: Ideas 7 | url: https://github.com/nicepkg/vr360/discussions/new?category=Ideas 8 | about: Start a discussion to improve vr360 9 | - name: GitHub Sponsors 10 | url: https://github.com/sponsors/2214962083 11 | about: Like this project? Please consider supporting the author. 12 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/index.build.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /playgrounds/react/vite.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from 'vite' 2 | import path from 'node:path' 3 | import viteReact from '@vitejs/plugin-react' 4 | import viteUnocss from 'unocss/vite' 5 | 6 | const pathResolve = (..._path: string[]) => path.resolve(__dirname, ..._path) 7 | 8 | export default defineConfig({ 9 | root: pathResolve('./'), 10 | plugins: [ 11 | viteReact(), 12 | 13 | // https://github.com/antfu/unocss 14 | // 有关配置,请参见 unocss.config.ts 15 | viteUnocss() 16 | ], 17 | server: { 18 | host: true 19 | } 20 | }) 21 | -------------------------------------------------------------------------------- /packages/doc/bundler.config.ts: -------------------------------------------------------------------------------- 1 | import {path} from '@vuepress/utils' 2 | import type {ViteBundlerOptions} from 'vuepress' 3 | 4 | const pathResolve = (..._path: string[]) => path.resolve(__dirname, ..._path) 5 | export const bundlerConfig = { 6 | viteOptions: { 7 | resolve: { 8 | alias: [ 9 | { 10 | find: /@(?=\/)/, 11 | replacement: pathResolve('./.vuepress') 12 | } 13 | ] 14 | }, 15 | build: { 16 | chunkSizeWarningLimit: Number.POSITIVE_INFINITY 17 | } 18 | } 19 | } as ViteBundlerOptions 20 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue3/vite.config.ts.txt: -------------------------------------------------------------------------------- 1 | import path from 'node:path' 2 | import {defineConfig} from 'vite' 3 | import Vue from '@vitejs/plugin-vue' 4 | import vueJsx from '@vitejs/plugin-vue-jsx' 5 | 6 | const pathResolve = (...args: string[]) => path.resolve(__dirname, ...args) 7 | 8 | export default defineConfig({ 9 | resolve: { 10 | alias: { 11 | '@/': `${pathResolve('./src')}/` 12 | } 13 | }, 14 | 15 | plugins: [ 16 | Vue({ 17 | include: [/\.vue$/] 18 | }), 19 | vueJsx() 20 | ] 21 | }) 22 | -------------------------------------------------------------------------------- /packages/vr360-shared/types/global.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | 3 | declare global { 4 | type Writable = { 5 | -readonly [P in keyof T]: T[P] 6 | } 7 | 8 | type DeepPartial = { 9 | [P in keyof T]?: DeepPartial 10 | } 11 | 12 | type TimeoutHandle = ReturnType 13 | type IntervalHandle = ReturnType 14 | 15 | function parseInt(s: string | number, radix?: number): number 16 | 17 | function parseFloat(string: string | number): number 18 | } 19 | 20 | export {} 21 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue2/vite.config.ts.txt: -------------------------------------------------------------------------------- 1 | import path from 'node:path' 2 | import {defineConfig} from 'vite' 3 | import {createVuePlugin} from 'vite-plugin-vue2' 4 | 5 | const pathResolve = (...args: string[]) => path.resolve(__dirname, ...args) 6 | 7 | export default defineConfig({ 8 | resolve: { 9 | alias: { 10 | '@/': `${pathResolve('./src')}/` 11 | } 12 | }, 13 | 14 | plugins: [ 15 | createVuePlugin({ 16 | jsx: true, 17 | jsxOptions: { 18 | compositionAPI: true 19 | } 20 | }) 21 | ] 22 | }) 23 | -------------------------------------------------------------------------------- /.github/settings.yml: -------------------------------------------------------------------------------- 1 | labels: 2 | - name: bug 3 | color: ee0701 4 | - name: contribution welcome 5 | color: 0e8a16 6 | - name: discussion 7 | color: 4935ad 8 | - name: docs 9 | color: 8be281 10 | - name: enhancement 11 | color: a2eeef 12 | - name: good first issue 13 | color: 7057ff 14 | - name: help wanted 15 | color: 008672 16 | - name: question 17 | color: d876e3 18 | - name: wontfix 19 | color: ffffff 20 | - name: WIP 21 | color: ffffff 22 | - name: need repro 23 | color: c9581c 24 | - name: feature request 25 | color: fbca04 26 | -------------------------------------------------------------------------------- /packages/vr360-core/src/manager/index.ts: -------------------------------------------------------------------------------- 1 | export * from './space' 2 | export * from './tip' 3 | 4 | export type ConfigModel = { 5 | id: string 6 | } 7 | 8 | export type ConfigModelManager = { 9 | create(configModel: CM): TM 10 | add(configModel: CM): TM 11 | update(configModel: Partial & Pick): TM | undefined 12 | find(configModel: string | (Partial & Pick)): TM | undefined 13 | findOrCreate(configModel: CM): TM 14 | remove(configModel: string | (Partial & Pick)): void 15 | removeAll(): void 16 | destroy(): void 17 | } 18 | -------------------------------------------------------------------------------- /playgrounds/vue2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.json", 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist", 6 | "types": ["vite/client"], 7 | "paths": { 8 | "@/*": ["./src/*"] 9 | } 10 | }, 11 | "vueCompilerOptions": { 12 | "experimentalCompatMode": 2, 13 | "target": 2, 14 | "experimentalTemplateCompilerOptions": { 15 | "compatConfig": {"MODE": 2} // optional 16 | } 17 | }, 18 | "include": ["./src/**/*", "./scripts/**/*", "./types/**/*", "./*.js", "./*.ts"], 19 | "exclude": ["node_modules", "dist"] 20 | } 21 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/configs/navbar/zh.ts: -------------------------------------------------------------------------------- 1 | import type {NavbarConfig} from '@vuepress/theme-default' 2 | import {version} from '../../utils/common' 3 | 4 | export const zh: NavbarConfig = [ 5 | { 6 | text: '指南', 7 | link: '/guide/' 8 | }, 9 | { 10 | text: '库列表', 11 | children: [ 12 | { 13 | text: 'vr360-core', 14 | link: '/libs/vr360-core/README.md' 15 | } 16 | ] 17 | }, 18 | { 19 | text: `v${version}`, 20 | children: [ 21 | { 22 | text: '更新日志', 23 | link: 'https://github.com/nicepkg/vr360/releases' 24 | } 25 | ] 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue3/package.json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playground-vue3", 3 | "private": true, 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vite build", 7 | "serve": "vite preview" 8 | }, 9 | "dependencies": { 10 | "@nicepkg/vr360-core": "latest", 11 | "three": "^0.145.0", 12 | "vue": "^3.2.40" 13 | }, 14 | "devDependencies": { 15 | "@types/node": "18.7.23", 16 | "@types/three": "^0.144.0", 17 | "@vitejs/plugin-vue": "^3.1.0", 18 | "@vitejs/plugin-vue-jsx": "^2.0.1", 19 | "typescript": "4.7.4", 20 | "vite": "3.0.9" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/configs/sidebar/zh.ts: -------------------------------------------------------------------------------- 1 | import type {SidebarConfig} from '@vuepress/theme-default' 2 | 3 | export const zh: SidebarConfig = { 4 | '/guide/': [ 5 | { 6 | text: '指南', 7 | children: ['/guide/README.md', '/guide/questions.md'] 8 | } 9 | ], 10 | '/libs/vr360-core/': [ 11 | { 12 | text: 'vr360-core', 13 | children: [ 14 | '/libs/vr360-core/README.md', 15 | '/libs/vr360-core/properties.md', 16 | '/libs/vr360-core/methods.md', 17 | '/libs/vr360-core/events.md', 18 | '/libs/vr360-core/example.md' 19 | ] 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /scripts/check-update.ts: -------------------------------------------------------------------------------- 1 | import * as ncu from 'npm-check-updates' 2 | import fs from 'node:fs' 3 | import {packagesPaths, pathResolve} from './utils' 4 | 5 | async function checkNpmPkgUpdate() { 6 | const rookPath = pathResolve('../') 7 | for (const packagePath of [rookPath, ...packagesPaths]) { 8 | const pkgJson = pathResolve(packagePath, 'package.json') 9 | if (!fs.existsSync(pkgJson)) continue 10 | await ncu.run({ 11 | // Pass any cli option 12 | packageFile: pkgJson, 13 | upgrade: false, 14 | jsonUpgraded: false, 15 | silent: false 16 | }) 17 | } 18 | } 19 | 20 | checkNpmPkgUpdate() 21 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue2/package.json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playground-vue2", 3 | "private": true, 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vite build", 7 | "serve": "vite preview" 8 | }, 9 | "dependencies": { 10 | "@nicepkg/vr360-core": "latest", 11 | "three": "^0.145.0", 12 | "vue": "2.6.14" 13 | }, 14 | "devDependencies": { 15 | "@types/node": "18.7.23", 16 | "@types/three": "^0.144.0", 17 | "@vue/runtime-dom": "latest", 18 | "typescript": "4.7.4", 19 | "vite": "^2.9.9", 20 | "vite-plugin-vue2": "^2.0.2", 21 | "vue-template-compiler": "2.6.14" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/plugins/code-demo/CodeDemo.props.ts: -------------------------------------------------------------------------------- 1 | import type {Project} from '@stackblitz/sdk' 2 | import type {ExtractPropTypes, PropType} from 'vue' 3 | 4 | export const getProps = () => ({ 5 | mode: { 6 | type: String, 7 | default: 'node' 8 | }, 9 | project: { 10 | type: Object as PropType 11 | }, 12 | previewOnly: { 13 | type: Boolean, 14 | default: false 15 | }, 16 | clickToLoad: { 17 | type: Boolean, 18 | default: false 19 | }, 20 | openFile: { 21 | type: String, 22 | default: 'src/main.ts' 23 | } 24 | }) 25 | 26 | export type CodeDemoProps = Partial>> 27 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/common/polyfill-pointer-events.util.ts: -------------------------------------------------------------------------------- 1 | export const polyfillPointerEvents = () => { 2 | /* eslint-disable @typescript-eslint/no-explicit-any */ 3 | // polyfill for jsdom (https://github.com/jsdom/jsdom/pull/2666) 4 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition 5 | if (!global.PointerEvent) { 6 | class PointerEvent extends MouseEvent { 7 | public pointerId?: number 8 | 9 | constructor(type: string, params: PointerEventInit = {}) { 10 | super(type, params) 11 | this.pointerId = params.pointerId 12 | } 13 | } 14 | global.PointerEvent = PointerEvent as any 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/react/package.json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playground-react", 3 | "private": true, 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vite build", 7 | "serve": "vite preview" 8 | }, 9 | "dependencies": { 10 | "@nicepkg/vr360-core": "latest", 11 | "clsx": "^1.2.1", 12 | "react": "17.0.2", 13 | "react-dom": "17.0.2", 14 | "three": "^0.145.0" 15 | }, 16 | "devDependencies": { 17 | "@types/node": "^18.7.23", 18 | "@types/react": "18.0.21", 19 | "@types/react-dom": "18.0.6", 20 | "@types/three": "^0.144.0", 21 | "@vitejs/plugin-react": "^2.1.0", 22 | "typescript": "4.7.4", 23 | "vite": "3.0.9" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue2/tsconfig.json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "outDir": "./dist", 5 | "target": "esnext", 6 | "composite": true, 7 | "useDefineForClassFields": true, 8 | "module": "esnext", 9 | "moduleResolution": "node", 10 | "strict": true, 11 | "jsx": "preserve", 12 | "sourceMap": true, 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "esModuleInterop": true, 16 | "lib": ["esnext", "dom"], 17 | "skipLibCheck": true, 18 | "types": ["vite/client"], 19 | "paths": { 20 | "@/*": ["./src/*"] 21 | } 22 | }, 23 | "include": ["src/**/*", "types/**/*", "*.ts", "*.js"] 24 | } 25 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue3/tsconfig.json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "outDir": "./dist", 5 | "target": "esnext", 6 | "composite": true, 7 | "useDefineForClassFields": true, 8 | "module": "esnext", 9 | "moduleResolution": "node", 10 | "strict": true, 11 | "jsx": "preserve", 12 | "sourceMap": true, 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "esModuleInterop": true, 16 | "lib": ["esnext", "dom"], 17 | "skipLibCheck": true, 18 | "types": ["vite/client"], 19 | "paths": { 20 | "@/*": ["./src/*"] 21 | } 22 | }, 23 | "include": ["src/**/*", "types/**/*", "*.ts", "*.js"] 24 | } 25 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/react/tsconfig.json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "outDir": "./dist", 5 | "target": "esnext", 6 | "composite": true, 7 | "useDefineForClassFields": true, 8 | "module": "esnext", 9 | "moduleResolution": "node", 10 | "strict": true, 11 | "jsx": "react-jsx", 12 | "sourceMap": true, 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "esModuleInterop": true, 16 | "lib": ["esnext", "dom"], 17 | "skipLibCheck": true, 18 | "types": ["vite/client"], 19 | "paths": { 20 | "@/*": ["./src/*"] 21 | } 22 | }, 23 | "include": ["src/**/*", "types/**/*", "*.ts", "*.js"] 24 | } 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .vite-ssg-dist 3 | .vite-ssg-temp 4 | *.local 5 | dist 6 | dist-ssr 7 | node_modules 8 | .idea/ 9 | *.log 10 | stats.html 11 | .vite-inspect 12 | .history 13 | **/.rollup.cache 14 | **/test/coverage 15 | tsconfig.tsbuildinfo 16 | **/.temp 17 | **/.cache 18 | 19 | # testing 20 | /coverage 21 | cypress/videos 22 | cypress/screenshots 23 | 24 | # misc 25 | .DS_Store 26 | .env 27 | .env.local 28 | .env.development.local 29 | .env.test.local 30 | .env.production.local 31 | 32 | # Log files 33 | npm-debug.log* 34 | yarn-debug.log* 35 | yarn-error.log* 36 | .pnpm-debug.log* 37 | 38 | # Editor directories and files 39 | .idea 40 | *.suo 41 | *.ntvs* 42 | *.njsproj 43 | *.sln 44 | *.sw? 45 | 46 | .vercel 47 | .turbo 48 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/theme/components/Home.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 22 | -------------------------------------------------------------------------------- /packages/doc/libs/vr360-core/example.md: -------------------------------------------------------------------------------- 1 | # 示例 2 | 3 | ## 效果 4 | 5 |
6 | 7 | 8 | ### vue2 实现 9 | 10 | ::: demo vue2 -- vue2 示例代码 -- 这里是示例代码的描述 11 | 12 | ```vue src/Example.vue 13 | /*# @/examples/firstHouse/vue2.vue #*/ 14 | ``` 15 | 16 | ::: 17 | 18 | ### vue3 实现 19 | 20 | ::: demo vue3 -- vue3 示例代码 -- 这里是示例代码的描述 21 | 22 | ```vue src/Example.vue 23 | /*# @/examples/firstHouse/vue3.vue #*/ 24 | ``` 25 | 26 | ::: 27 | 28 | ### react 实现 29 | 30 | ::: demo react -- react 示例代码 -- 这里是示例代码的描述 31 | 32 | ```tsx src/Example.tsx 33 | /*# @/examples/firstHouse/react.tsx #*/ 34 | ``` 35 | 36 | ::: 37 | 38 | ### 原生实现 39 | 40 | ::: demo html -- html 示例代码 -- 这里是示例代码的描述 41 | 42 | ```html index.html 43 | /*# @/examples/firstHouse/html.html #*/ 44 | ``` 45 | 46 | ::: 47 | -------------------------------------------------------------------------------- /playgrounds/vue3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playground-vue3", 3 | "private": true, 4 | "scripts": { 5 | "dev": "concurrently -r -k -g 'npm:build:deps' 'npm:dev:vite'", 6 | "dev:vite": "vite", 7 | "build": "vite build", 8 | "build:deps": "pnpm --filter @nicepkg/vr360-core build:watch", 9 | "serve": "vite preview" 10 | }, 11 | "dependencies": { 12 | "@nicepkg/vr360-core": "workspace:*", 13 | "qs": "^6.11.0", 14 | "vue": "^3.2.40", 15 | "vue-demi": "*" 16 | }, 17 | "devDependencies": { 18 | "@types/qs": "^6.9.7", 19 | "@unocss/reset": "^0.45.22", 20 | "@vitejs/plugin-vue": "^3.1.0", 21 | "@vitejs/plugin-vue-jsx": "^2.0.1", 22 | "concurrently": "*", 23 | "typescript": "*", 24 | "unocss": "^0.45.22", 25 | "vite": "*" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/common/helper.util.ts: -------------------------------------------------------------------------------- 1 | // Like `until` but works off of any assertion, not application code. 2 | export const retry = (assertion: () => void, {interval = 1, timeout = 100} = {}) => { 3 | return new Promise((resolve, reject) => { 4 | const startTime = Date.now() 5 | 6 | const tryAgain = () => { 7 | setTimeout(() => { 8 | try { 9 | resolve(assertion()) 10 | } catch (error) { 11 | Date.now() - startTime > timeout ? reject(error) : tryAgain() 12 | } 13 | }, interval) 14 | try { 15 | // If useFakeTimers hasn't been called, this will throw 16 | vitest.advanceTimersByTime(interval) 17 | } catch { 18 | /* Expected to throw */ 19 | } 20 | } 21 | 22 | tryAgain() 23 | }) 24 | } 25 | -------------------------------------------------------------------------------- /playgrounds/react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playground-react", 3 | "private": true, 4 | "scripts": { 5 | "dev": "concurrently -r -k -g 'npm:build:deps' 'npm:dev:vite'", 6 | "dev:vite": "vite", 7 | "build": "vite build", 8 | "build:deps": "pnpm --filter @nicepkg/vr360-core build:watch", 9 | "serve": "vite preview" 10 | }, 11 | "dependencies": { 12 | "@nicepkg/vr360-core": "workspace:*", 13 | "clsx": "^1.2.1", 14 | "react": "*", 15 | "react-dom": "*" 16 | }, 17 | "devDependencies": { 18 | "@types/node": "^18.7.23", 19 | "@types/react": "*", 20 | "@types/react-dom": "*", 21 | "@unocss/reset": "^0.45.26", 22 | "@vitejs/plugin-react": "^2.1.0", 23 | "concurrently": "*", 24 | "typescript": "*", 25 | "unocss": "^0.45.26", 26 | "vite": "*" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "baseBranch": "origin/master", 4 | "pipeline": { 5 | "@nicepkg/vr360-core#build": { 6 | "dependsOn": ["@nicepkg/vr360-shared#build"], 7 | "inputs": ["src/**", "scripts/**", "types/**"], 8 | "outputs": ["dist/**"] 9 | }, 10 | "doc-site#build": { 11 | "dependsOn": ["^build"], 12 | "inputs": ["./**"], 13 | "outputs": ["./.vuepress/dist/**"] 14 | }, 15 | "build": { 16 | "dependsOn": ["^build"], 17 | "inputs": ["src/**", "scripts/**", "types/**"], 18 | "outputs": ["dist/**"] 19 | }, 20 | "test": { 21 | "dependsOn": ["build"], 22 | "outputs": [] 23 | }, 24 | "dev": { 25 | "cache": false 26 | } 27 | }, 28 | "globalDependencies": ["tsconfig-base.json"] 29 | } 30 | -------------------------------------------------------------------------------- /playgrounds/vue2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playground-vue2", 3 | "private": true, 4 | "scripts": { 5 | "dev": "concurrently -r -k -g 'npm:build:deps' 'npm:dev:vite'", 6 | "dev:vite": "vite", 7 | "build": "vite build", 8 | "build:deps": "pnpm --filter @nicepkg/vr360-core build:watch ", 9 | "serve": "vite preview" 10 | }, 11 | "dependencies": { 12 | "@nicepkg/vr360-core": "workspace:*", 13 | "@vue/composition-api": "^1.7.1", 14 | "vue": "2.6.14", 15 | "vue-demi": "*", 16 | "vue-template-compiler": "2.6.14" 17 | }, 18 | "devDependencies": { 19 | "@unocss/reset": "^0.45.22", 20 | "@vue/runtime-dom": "latest", 21 | "concurrently": "*", 22 | "unocss": "^0.45.22", 23 | "unplugin-vue2-script-setup": "^0.11.3", 24 | "vite": "^2.9.9", 25 | "vite-plugin-vue2": "^2.0.2" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/doc/guide/README.md: -------------------------------------------------------------------------------- 1 | # 介绍 2 | 3 | Vr360 是一个基于 threejs 能让你快速实现业务全景需求的库,比如全景看房、全景街景、全景景点。 4 | 5 | 它的核心被设计为框架无关性,可以用 json 配置的方式快速实现常见全景需求。 6 | 7 | 后续还会提供高度封装的 viewer 和 editor 等组件,很适合懒人,会提供 vue2/3 、 react 、web component 版本。 8 | 9 | json 驱动视图的特性是好维护,你甚至可以不用接触 threejs。写出来的代码拉条哈士奇过来也能维护。 10 | 11 | ## 库列表 12 | 13 | #### 核心 [vr360-core](/libs/vr360-core/) 14 | 15 | vr360 核心库,提供了基础的全景浏览功能,你可以用它来快速实现你的全景需求。 16 | 17 | #### web 组件 [vr360-ui](/libs/vr360-ui/) 18 | 19 | 提供一个现成的 vr360 viewer 和 editor 组件,基于 stencil 构建的 web component。(开发中...) 20 | 21 | #### vue2 组件 [vr360-ui-vue2](/libs/vr360-ui-vue2/) 22 | 23 | vr360-ui 的 vue2 二次封装版本,开箱即用。(开发中...) 24 | 25 | #### vue3 组件 [vr360-ui-vue3](/libs/vr360-ui-vue2/) 26 | 27 | vr360-ui 的 vue2 二次封装版本,开箱即用。(开发中...) 28 | 29 | #### react 组件 [vr360-ui-react](/libs/vr360-ui-react/) 30 | 31 | vr360-ui 的 react 二次封装版本,开箱即用。(开发中...) 32 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | 9 | pull_request: 10 | branches: 11 | - main 12 | - master 13 | 14 | jobs: 15 | build: 16 | runs-on: ubuntu-latest 17 | env: 18 | TURBO_TOKEN: ${{ secrets.VERCEL_TOKEN }} 19 | TURBO_TEAM: ${{ secrets.VERCEL_TEAM }} 20 | TURBO_CACHE_KEY: ubuntu-latest-16 # reuse cache key from ci workflow 21 | 22 | steps: 23 | - uses: actions/checkout@v2 24 | 25 | - name: Install pnpm 26 | uses: pnpm/action-setup@v2.2.1 27 | 28 | - name: Use Node.js 29 | uses: actions/setup-node@v2 30 | with: 31 | node-version: 16 32 | registry-url: https://registry.npmjs.org/ 33 | cache: pnpm 34 | 35 | - name: Install Dependencies 36 | run: pnpm bootstrap 37 | 38 | - name: Lint 39 | run: pnpm run lint 40 | -------------------------------------------------------------------------------- /playgrounds/vue2/unocss.config.ts: -------------------------------------------------------------------------------- 1 | import { 2 | defineConfig, 3 | presetAttributify, 4 | presetIcons, 5 | presetUno, 6 | transformerDirectives, 7 | transformerVariantGroup 8 | } from 'unocss' 9 | 10 | export default defineConfig({ 11 | shortcuts: [ 12 | [ 13 | 'btn', 14 | 'px-4 py-1 rounded inline-block bg-teal-700 text-white cursor-pointer hover:bg-teal-800 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50' 15 | ], 16 | [ 17 | 'icon-btn', 18 | 'inline-block cursor-pointer select-none opacity-75 transition duration-200 ease-in-out hover:opacity-100 hover:text-teal-600' 19 | ] 20 | ], 21 | presets: [ 22 | presetUno(), 23 | presetAttributify(), 24 | presetIcons({ 25 | scale: 1.2, 26 | warn: true 27 | }) 28 | ], 29 | transformers: [transformerDirectives(), transformerVariantGroup()], 30 | safelist: 'prose prose-sm m-auto text-left'.split(' ') 31 | }) 32 | -------------------------------------------------------------------------------- /playgrounds/vue3/unocss.config.ts: -------------------------------------------------------------------------------- 1 | import { 2 | defineConfig, 3 | presetAttributify, 4 | presetIcons, 5 | presetUno, 6 | transformerDirectives, 7 | transformerVariantGroup 8 | } from 'unocss' 9 | 10 | export default defineConfig({ 11 | shortcuts: [ 12 | [ 13 | 'btn', 14 | 'px-4 py-1 rounded inline-block bg-teal-700 text-white cursor-pointer hover:bg-teal-800 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50' 15 | ], 16 | [ 17 | 'icon-btn', 18 | 'inline-block cursor-pointer select-none opacity-75 transition duration-200 ease-in-out hover:opacity-100 hover:text-teal-600' 19 | ] 20 | ], 21 | presets: [ 22 | presetUno(), 23 | presetAttributify(), 24 | presetIcons({ 25 | scale: 1.2, 26 | warn: true 27 | }) 28 | ], 29 | transformers: [transformerDirectives(), transformerVariantGroup()], 30 | safelist: 'prose prose-sm m-auto text-left'.split(' ') 31 | }) 32 | -------------------------------------------------------------------------------- /packages/vr360-core/vite.config.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import type {UserConfig} from 'vite' 3 | import {defineConfig} from 'vite' 4 | import {buildUtils} from '@nicepkg/vr360-shared' 5 | 6 | export const packagePath = __dirname 7 | 8 | type CreateViteConfigOptions = { 9 | minify?: boolean 10 | } 11 | 12 | const createViteConfig = (options: CreateViteConfigOptions = {}): UserConfig => { 13 | const {minify = false} = options 14 | return buildUtils.createViteConfig({ 15 | packagePath, 16 | minify, 17 | externalMap: { 18 | three: 'THREE' 19 | }, 20 | dedupe: ['three'] // use the same version 21 | }) 22 | } 23 | 24 | // default config and build prod config 25 | export const unMinifyConfig = createViteConfig({minify: false}) 26 | 27 | // build prod and build prod config 28 | export const minifyConfig = createViteConfig({minify: true}) 29 | 30 | // for vitest 31 | export default defineConfig(unMinifyConfig) 32 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/index.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable unicorn/prefer-export-from */ 2 | 3 | import chalk from 'chalk' 4 | import * as msw from 'msw' 5 | import * as globby from 'globby' 6 | import * as ora from 'ora' 7 | import * as nodeFetch from 'node-fetch' 8 | import * as fsExtra from 'fs-extra' 9 | import * as rimraf from 'rimraf' 10 | import * as mock from 'mockjs' 11 | import * as buildUtils from './build-utils' 12 | 13 | // vite 14 | import * as viteReact from '@vitejs/plugin-react' 15 | import * as viteInspect from 'vite-plugin-inspect' 16 | import * as viteMock from 'vite-plugin-mock' 17 | import * as viteTsconfigPaths from 'vite-tsconfig-paths' 18 | import * as viteSvgr from 'vite-plugin-svgr' 19 | 20 | export { 21 | chalk, 22 | msw, 23 | globby, 24 | ora, 25 | nodeFetch, 26 | fsExtra, 27 | rimraf, 28 | mock, 29 | buildUtils, 30 | 31 | // vite 32 | viteReact, 33 | viteInspect, 34 | viteMock, 35 | viteTsconfigPaths, 36 | viteSvgr 37 | } 38 | -------------------------------------------------------------------------------- /playgrounds/vue2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vue2 App 7 | 8 | 19 | 20 | 21 | 24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /playgrounds/vue3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vue3 App 7 | 8 | 19 | 20 | 21 | 24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /playgrounds/react/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | React App 7 | 8 | 19 | 20 | 21 | 24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/react/index.html.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | React App 7 | 8 | 19 | 20 | 21 | 24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue2/index.html.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vue2 App 7 | 8 | 19 | 20 | 21 | 24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/vue3/index.html.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vue3 App 7 | 8 | 19 | 20 | 21 | 24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/components/NpmBadge.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 34 | 35 | 40 | -------------------------------------------------------------------------------- /playgrounds/vue3/src/Editor.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### Description 4 | 5 | 6 | 7 | ### Additional context 8 | 9 | 10 | 11 | --- 12 | 13 | ### What is the purpose of this pull request? 14 | 15 | - [ ] Bug fix 16 | - [ ] New Feature 17 | - [ ] Documentation update 18 | - [ ] Other 19 | 20 | ### Before submitting the PR, please make sure you do the following 21 | 22 | - [ ] Read the [Contributing Guidelines](https://github.com/nicepkg/vr360/blob/master/CONTRIBUTING.md). 23 | - [ ] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate. 24 | - [ ] Provide a description in this PR that addresses **what** the PR is solving, or reference the issue that it solves (e.g. `fixes #123`). 25 | - [ ] Ideally, include relevant tests that fail without this PR but pass with it. 26 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/styles/index.scss: -------------------------------------------------------------------------------- 1 | :root { 2 | // brand colors 3 | --c-brand: #0c4dc4; 4 | --c-brand-light: #0b3788; 5 | 6 | scroll-behavior: smooth; 7 | } 8 | 9 | html.dark { 10 | // brand colors 11 | --c-brand: #1fa8f8; 12 | --c-brand-light: #3bb3f8; 13 | } 14 | 15 | .sidebar-item.collapsible { 16 | cursor: pointer; 17 | } 18 | 19 | .site-name.can-hide { 20 | display: none; 21 | } 22 | 23 | body { 24 | position: relative; 25 | width: 100vw; 26 | min-height: 100vh; 27 | overflow-x: hidden; 28 | overflow-y: auto; 29 | background-color: var(--c-bg); 30 | } 31 | 32 | #app { 33 | position: absolute; 34 | top: 0; 35 | left: 0; 36 | z-index: 99; 37 | min-width: 100vw; 38 | min-height: 100vh; 39 | } 40 | 41 | .code-group { 42 | width: 100%; 43 | max-width: calc(100vw - 3rem); 44 | } 45 | 46 | .theme-default-content div[class*='language-'] { 47 | width: calc(100% + 3rem); 48 | max-width: 100vw; 49 | } 50 | 51 | .theme-default-content .code-group div[class*='language-'] { 52 | width: auto; 53 | max-width: auto; 54 | } 55 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/plugins/index.ts: -------------------------------------------------------------------------------- 1 | import type {PluginConfig} from 'vuepress' 2 | import {registerComponentsPlugin} from '@vuepress/plugin-register-components' 3 | import {googleAnalyticsPlugin} from '@vuepress/plugin-google-analytics' 4 | import {shikiPlugin} from '@vuepress/plugin-shiki' 5 | import {path} from '@vuepress/utils' 6 | import {isProd} from '../utils/common' 7 | import {codeDemoPlugin} from './code-demo' 8 | 9 | const pathResolve = (..._path: string[]) => path.resolve(__dirname, ..._path) 10 | 11 | const vuepressPlugins: PluginConfig = [ 12 | // for google search 13 | googleAnalyticsPlugin({ 14 | id: '' 15 | }), 16 | // auto register globally components 17 | registerComponentsPlugin({ 18 | componentsDir: pathResolve('../components') 19 | }), 20 | codeDemoPlugin({ 21 | clickToLoad: true, 22 | resolvePath: str => str.replace(/^@/, pathResolve('../')) 23 | }) 24 | ] 25 | 26 | if (isProd) { 27 | vuepressPlugins.push( 28 | // code highlighting 29 | shikiPlugin({ 30 | theme: 'dark-plus' 31 | }) 32 | ) 33 | } 34 | 35 | export const plugins = vuepressPlugins 36 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/code-demo-templates/demo.css.txt: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | padding: 0; 4 | margin: 0; 5 | } 6 | 7 | .demo { 8 | position: relative; 9 | display: flex; 10 | flex-direction: column; 11 | width: 100vw; 12 | height: 100vh; 13 | overflow: hidden; 14 | } 15 | 16 | .demo-tip { 17 | position: absolute; 18 | top: 0; 19 | left: 0; 20 | z-index: -1; 21 | display: flex; 22 | flex-direction: column; 23 | justify-content: center; 24 | width: 240px; 25 | height: 60px; 26 | padding: 4px; 27 | color: #fff; 28 | cursor: pointer; 29 | background-color: rgba(0, 0, 0, 0.5); 30 | border-radius: 4px; 31 | } 32 | 33 | .demo-tip-title { 34 | font-weight: bold; 35 | } 36 | 37 | .demo-container { 38 | width: 100%; 39 | height: 100%; 40 | } 41 | 42 | .demo-bottom-bar { 43 | display: flex; 44 | align-items: center; 45 | width: 100%; 46 | height: 100px; 47 | } 48 | 49 | .demo-bottom-card { 50 | width: 140px; 51 | height: 70px; 52 | margin-left: 1rem; 53 | cursor: pointer; 54 | background-repeat: no-repeat; 55 | background-size: cover; 56 | border-radius: 4px; 57 | } 58 | -------------------------------------------------------------------------------- /playgrounds/vue2/vite.config.ts: -------------------------------------------------------------------------------- 1 | import path from 'node:path' 2 | import {defineConfig} from 'vite' 3 | import {createVuePlugin} from 'vite-plugin-vue2' 4 | import ScriptSetup from 'unplugin-vue2-script-setup/vite' 5 | import Unocss from 'unocss/vite' 6 | import {switchVersion} from 'vue-demi/scripts/utils.js' 7 | 8 | const pathResolve = (..._path: string[]) => path.resolve(__dirname, ..._path) 9 | 10 | switchVersion(2) 11 | 12 | export default defineConfig({ 13 | server: { 14 | host: true 15 | }, 16 | plugins: [ 17 | createVuePlugin({ 18 | jsx: true, 19 | jsxOptions: { 20 | compositionAPI: true 21 | } 22 | }), 23 | ScriptSetup(), // supports vue3 setup sugar 24 | 25 | // https://github.com/antfu/unocss 26 | // 有关配置,请参见 unocss.config.ts 27 | Unocss() 28 | ], 29 | resolve: { 30 | dedupe: ['vue', 'vue-demi', '@vue/runtime-core', '@vue/runtime-dom'], // use the same version 31 | alias: { 32 | '@/': `${pathResolve('./src')}/`, 33 | vue: pathResolve('./node_modules/vue/dist/vue.esm.js') // use the same version, also use runtime template compiler 34 | } 35 | } 36 | }) 37 | -------------------------------------------------------------------------------- /packages/doc/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | home: true 3 | title: 首页 4 | heroImage: /images/logo.png 5 | heroImageDark: /images/logo-dark.png 6 | heroText: null 7 | tagline: 快速实现你的全景开发需求 8 | actions: 9 | - text: 快速上手 10 | link: /guide/ 11 | type: primary 12 | - text: Github 13 | link: https://github.com/nicepkg/vr360 14 | type: secondary 15 | features: 16 | - title: vr360-core 17 | details: json 驱动的全景浏览库,设计框架无关性,可用于任何框架,如vue/react/angular/svelte/solidjs... 18 | link: '/libs/vr360-core/README.md' 19 | 20 | - title: vr360-ui 21 | details: (开发中...)提供一个现成的 vr360 viewer 和 editor 组件,基于 stencil 构建的 web component。 22 | disabled: true 23 | link: '' 24 | 25 | - title: vr360-ui-vue2 26 | details: (开发中...)vr360-ui 的 vue2 二次封装版本,开箱即用。 27 | disabled: true 28 | link: '' 29 | 30 | - title: vr360-ui-vue3 31 | details: (开发中...)vr360-ui 的 vue3 二次封装版本,开箱即用。 32 | disabled: true 33 | link: '' 34 | 35 | - title: vr360-ui-react 36 | details: (开发中...)vr360-ui 的 react 二次封装版本,开箱即用。 37 | disabled: true 38 | link: '' 39 | 40 | - title: 41 | details: 42 | footer: MIT License | Copyright © 2022-present YangJinMing 43 | --- 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 YangJinMing 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/examples/firstHouse/demo.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | padding: 0; 4 | margin: 0; 5 | } 6 | 7 | .demo { 8 | position: relative; 9 | display: flex; 10 | flex-direction: column; 11 | width: 100vw; 12 | height: 100vh; 13 | overflow: hidden; 14 | background-color: #fff; 15 | } 16 | 17 | .demo-tip { 18 | position: absolute; 19 | top: 0; 20 | left: 0; 21 | z-index: -1; 22 | display: flex; 23 | flex-direction: column; 24 | justify-content: center; 25 | width: 240px; 26 | height: 60px; 27 | padding: 4px; 28 | color: #fff; 29 | cursor: pointer; 30 | visibility: hidden; 31 | background-color: rgba(0, 0, 0, 0.5); 32 | border-radius: 4px; 33 | } 34 | 35 | .demo-tip-title { 36 | font-weight: bold; 37 | } 38 | 39 | .demo-container { 40 | width: 100%; 41 | height: 100%; 42 | } 43 | 44 | .demo-bottom-bar { 45 | display: flex; 46 | align-items: center; 47 | width: 100%; 48 | height: 100px; 49 | } 50 | 51 | .demo-bottom-card { 52 | width: 140px; 53 | height: 70px; 54 | margin-left: 1rem; 55 | cursor: pointer; 56 | background-repeat: no-repeat; 57 | background-size: cover; 58 | border-radius: 4px; 59 | } 60 | -------------------------------------------------------------------------------- /tsconfig-base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "esnext", 5 | "typeRoots": ["./node_modules/@types", "types"], 6 | "lib": ["dom", "esnext", "dom.iterable", "scripthost"], 7 | "strict": true, 8 | "esModuleInterop": true, 9 | "jsx": "preserve", 10 | "skipLibCheck": true, 11 | "experimentalDecorators": true, 12 | "emitDecoratorMetadata": true, 13 | "moduleResolution": "node", 14 | "resolveJsonModule": true, 15 | "noUnusedLocals": false, 16 | "noImplicitAny": true, 17 | "noUnusedParameters": false, 18 | "noImplicitThis": true, 19 | "noEmitOnError": false, 20 | "strictNullChecks": true, 21 | "allowJs": true, 22 | "sourceMap": true, 23 | "allowSyntheticDefaultImports": true, 24 | "forceConsistentCasingInFileNames": true 25 | }, 26 | "exclude": ["./node_modules/**/*", "./lib/**/*", "./es/**/*", "./dist/**/*"], 27 | "ts-node": { 28 | "compilerOptions": { 29 | "module": "CommonJS", 30 | "resolveJsonModule": true, 31 | "noImplicitAny": false, 32 | "noEmitOnError": false, 33 | "noUnusedLocals": false, 34 | "noUnusedParameters": false 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /playgrounds/vue3/vite.config.ts: -------------------------------------------------------------------------------- 1 | import path from 'node:path' 2 | import type {UserConfig} from 'vite' 3 | import {defineConfig, loadEnv} from 'vite' 4 | import Vue from '@vitejs/plugin-vue' 5 | import vueJsx from '@vitejs/plugin-vue-jsx' 6 | import Unocss from 'unocss/vite' 7 | import {switchVersion} from 'vue-demi/scripts/utils.js' 8 | 9 | const pathResolve = (...args: string[]) => path.resolve(__dirname, ...args) 10 | 11 | switchVersion(3) 12 | 13 | export default defineConfig(({mode}) => { 14 | // 根据当前工作目录中的“mode”加载env文件。 15 | // 将第三个参数设置为 '' 以加载所有 env 16 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 17 | const env = loadEnv(mode, process.cwd(), '') 18 | 19 | return { 20 | resolve: { 21 | dedupe: ['vue', 'vue-demi'], // use the same version 22 | alias: { 23 | '@/': `${pathResolve('./src')}/` 24 | } 25 | }, 26 | 27 | plugins: [ 28 | // vue3 语法支持 29 | Vue({ 30 | include: [/\.vue$/], 31 | reactivityTransform: true 32 | }), 33 | vueJsx(), 34 | 35 | // https://github.com/antfu/unocss 36 | // 有关配置,请参见 unocss.config.ts 37 | Unocss() 38 | ], 39 | 40 | server: { 41 | host: true 42 | } 43 | } as UserConfig 44 | }) 45 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | 9 | pull_request: 10 | branches: 11 | - main 12 | - master 13 | # workflow_run: 14 | # workflows: ['Lint'] 15 | # types: 16 | # - completed 17 | 18 | jobs: 19 | build: 20 | runs-on: ${{ matrix.os }} 21 | env: 22 | TURBO_TOKEN: ${{ secrets.VERCEL_TOKEN }} 23 | TURBO_TEAM: ${{ secrets.VERCEL_TEAM }} 24 | TURBO_CACHE_KEY: ${{ matrix.os }}-${{ matrix.node-version }} 25 | NODE_OPTIONS: '--max_old_space_size=4096' 26 | strategy: 27 | matrix: 28 | node-version: [14, 16] 29 | os: [ubuntu-latest, macOS-latest] 30 | fail-fast: false 31 | 32 | steps: 33 | - uses: actions/checkout@v2 34 | 35 | - name: Install pnpm 36 | uses: pnpm/action-setup@v2.2.1 37 | 38 | - name: Use Node.js ${{ matrix.node-version }} 39 | uses: actions/setup-node@v2 40 | with: 41 | node-version: ${{ matrix.node-version }} 42 | registry-url: https://registry.npmjs.org/ 43 | cache: pnpm 44 | 45 | - name: Install Dependencies and build all packages 46 | run: pnpm bootstrap 47 | 48 | # - name: Build 49 | # run: pnpm run build 50 | 51 | - name: Test 52 | run: pnpm run test 53 | -------------------------------------------------------------------------------- /packages/doc/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "doc", 3 | "version": "0.3.1", 4 | "private": true, 5 | "description": "the libs docs website", 6 | "scripts": { 7 | "build": "vuepress build --clean-cache", 8 | "clean": "rimraf .vuepress/.temp .vuepress/.cache .vuepress/dist", 9 | "dev": "vuepress dev --clean-cache", 10 | "serve": "http-server --port 8080 .vuepress/dist" 11 | }, 12 | "dependencies": { 13 | "@nicepkg/vr360-core": "workspace:*", 14 | "@stackblitz/sdk": "^1.8.0", 15 | "@vueuse/core": "^9.3.0", 16 | "vue-router": "^4.1.5" 17 | }, 18 | "devDependencies": { 19 | "@types/markdown-it-container": "^2.0.5", 20 | "@vuepress/bundler-vite": "2.0.0-beta.51", 21 | "@vuepress/cli": "2.0.0-beta.51", 22 | "@vuepress/client": "2.0.0-beta.51", 23 | "@vuepress/core": "2.0.0-beta.51", 24 | "@vuepress/markdown": "2.0.0-beta.51", 25 | "@vuepress/plugin-google-analytics": "2.0.0-beta.51", 26 | "@vuepress/plugin-register-components": "2.0.0-beta.51", 27 | "@vuepress/plugin-shiki": "2.0.0-beta.51", 28 | "@vuepress/shared": "2.0.0-beta.51", 29 | "@vuepress/theme-default": "2.0.0-beta.51", 30 | "@vuepress/utils": "2.0.0-beta.51", 31 | "http-server": "^14.1.1", 32 | "js-base64": "^3.7.2", 33 | "markdown-it": "^13.0.1", 34 | "markdown-it-container": "^3.0.0", 35 | "rimraf": "^3.0.2", 36 | "sass": "^1.55.0", 37 | "vite": "*", 38 | "vue": "^3.2.40", 39 | "vuepress": "2.0.0-beta.51" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /packages/doc/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.3.0 (2022-10-08) 2 | 3 | ### Bug Fixes 4 | 5 | - **@nicepkg/vr360-core:** 修复移动端的提示移动 bug ([7090a98](https://github.com/nicepkg/vr360/commit/7090a9805bc472240de6ad4467bbadc14fd6151d)) 6 | 7 | # 0.3.0 (2022-10-02) 8 | 9 | ## 0.2.1 (2022-10-02) 10 | 11 | # 0.2.0 (2022-10-02) 12 | 13 | ### Bug Fixes 14 | 15 | - 修复 vr360-core tips 在滑动时的 bug ([e179ebc](https://github.com/nicepkg/vr360/commit/e179ebc2697314bc455320eecf8beb6182a53ded)) 16 | 17 | ### Features 18 | 19 | - 暴露更多的事件,设置默认自动旋转 ([4e21c53](https://github.com/nicepkg/vr360/commit/4e21c53ac945532020a7fbbfa46644294c33b49d)) 20 | - 初始化项目 ([06f39d1](https://github.com/nicepkg/vr360/commit/06f39d141004a1d0b1a125ad598298baf15ffee8)) 21 | - 添加标签提示和空间切换功能 ([6aa67d3](https://github.com/nicepkg/vr360/commit/6aa67d39113b06d05036ecc1d66ab1d70a2f4cf5)) 22 | - 添加如视 vr 导入支持 ([5a9eb5d](https://github.com/nicepkg/vr360/commit/5a9eb5d7a33d092be8cea5565490f268376d2f79)) 23 | - 文档添加示例插件、core 的纹理 top、bottom 改为 up 和 down ([70ccb2c](https://github.com/nicepkg/vr360/commit/70ccb2c40a06079ffb3cf50b27f986ab19b1f7db)) 24 | - 修改 package.json 说明 ([e5e4ad0](https://github.com/nicepkg/vr360/commit/e5e4ad04b1c7a9cddff3af6f73d438fd1de85b25)) 25 | - 优化代码 ([4519c4a](https://github.com/nicepkg/vr360/commit/4519c4a0fb230bb62bed49f97e0824c8977be3ca)) 26 | - 优化 sdk,添加纹理缓存预加载 ([9dd57e7](https://github.com/nicepkg/vr360/commit/9dd57e71b8f5a38ecc9901395a9b189481172edb)) 27 | - 重写核心,添加最小化更新配置支持 ([289091b](https://github.com/nicepkg/vr360/commit/289091b13dfe0495b44ae9e5353b78d2712e9762)) 28 | -------------------------------------------------------------------------------- /packages/vr360-core/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.3.0 (2022-10-08) 2 | 3 | ### Bug Fixes 4 | 5 | - **@nicepkg/vr360-core:** 修复移动端的提示移动 bug ([7090a98](https://github.com/nicepkg/vr360/commit/7090a9805bc472240de6ad4467bbadc14fd6151d)) 6 | 7 | # 0.3.0 (2022-10-02) 8 | 9 | ## 0.2.1 (2022-10-02) 10 | 11 | # 0.2.0 (2022-10-02) 12 | 13 | ### Bug Fixes 14 | 15 | - 修复 vr360-core tips 在滑动时的 bug ([e179ebc](https://github.com/nicepkg/vr360/commit/e179ebc2697314bc455320eecf8beb6182a53ded)) 16 | 17 | ### Features 18 | 19 | - 暴露更多的事件,设置默认自动旋转 ([4e21c53](https://github.com/nicepkg/vr360/commit/4e21c53ac945532020a7fbbfa46644294c33b49d)) 20 | - 初始化项目 ([06f39d1](https://github.com/nicepkg/vr360/commit/06f39d141004a1d0b1a125ad598298baf15ffee8)) 21 | - 添加标签提示和空间切换功能 ([6aa67d3](https://github.com/nicepkg/vr360/commit/6aa67d39113b06d05036ecc1d66ab1d70a2f4cf5)) 22 | - 添加如视 vr 导入支持 ([5a9eb5d](https://github.com/nicepkg/vr360/commit/5a9eb5d7a33d092be8cea5565490f268376d2f79)) 23 | - 文档添加示例插件、core 的纹理 top、bottom 改为 up 和 down ([70ccb2c](https://github.com/nicepkg/vr360/commit/70ccb2c40a06079ffb3cf50b27f986ab19b1f7db)) 24 | - 修改 package.json 说明 ([e5e4ad0](https://github.com/nicepkg/vr360/commit/e5e4ad04b1c7a9cddff3af6f73d438fd1de85b25)) 25 | - 优化代码 ([4519c4a](https://github.com/nicepkg/vr360/commit/4519c4a0fb230bb62bed49f97e0824c8977be3ca)) 26 | - 优化 sdk,添加纹理缓存预加载 ([9dd57e7](https://github.com/nicepkg/vr360/commit/9dd57e71b8f5a38ecc9901395a9b189481172edb)) 27 | - 重写核心,添加最小化更新配置支持 ([289091b](https://github.com/nicepkg/vr360/commit/289091b13dfe0495b44ae9e5353b78d2712e9762)) 28 | -------------------------------------------------------------------------------- /packages/vr360-shared/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.3.0 (2022-10-08) 2 | 3 | ### Bug Fixes 4 | 5 | - **@nicepkg/vr360-core:** 修复移动端的提示移动 bug ([7090a98](https://github.com/nicepkg/vr360/commit/7090a9805bc472240de6ad4467bbadc14fd6151d)) 6 | 7 | # 0.3.0 (2022-10-02) 8 | 9 | ## 0.2.1 (2022-10-02) 10 | 11 | # 0.2.0 (2022-10-02) 12 | 13 | ### Bug Fixes 14 | 15 | - 修复 vr360-core tips 在滑动时的 bug ([e179ebc](https://github.com/nicepkg/vr360/commit/e179ebc2697314bc455320eecf8beb6182a53ded)) 16 | 17 | ### Features 18 | 19 | - 暴露更多的事件,设置默认自动旋转 ([4e21c53](https://github.com/nicepkg/vr360/commit/4e21c53ac945532020a7fbbfa46644294c33b49d)) 20 | - 初始化项目 ([06f39d1](https://github.com/nicepkg/vr360/commit/06f39d141004a1d0b1a125ad598298baf15ffee8)) 21 | - 添加标签提示和空间切换功能 ([6aa67d3](https://github.com/nicepkg/vr360/commit/6aa67d39113b06d05036ecc1d66ab1d70a2f4cf5)) 22 | - 添加如视 vr 导入支持 ([5a9eb5d](https://github.com/nicepkg/vr360/commit/5a9eb5d7a33d092be8cea5565490f268376d2f79)) 23 | - 文档添加示例插件、core 的纹理 top、bottom 改为 up 和 down ([70ccb2c](https://github.com/nicepkg/vr360/commit/70ccb2c40a06079ffb3cf50b27f986ab19b1f7db)) 24 | - 修改 package.json 说明 ([e5e4ad0](https://github.com/nicepkg/vr360/commit/e5e4ad04b1c7a9cddff3af6f73d438fd1de85b25)) 25 | - 优化代码 ([4519c4a](https://github.com/nicepkg/vr360/commit/4519c4a0fb230bb62bed49f97e0824c8977be3ca)) 26 | - 优化 sdk,添加纹理缓存预加载 ([9dd57e7](https://github.com/nicepkg/vr360/commit/9dd57e71b8f5a38ecc9901395a9b189481172edb)) 27 | - 重写核心,添加最小化更新配置支持 ([289091b](https://github.com/nicepkg/vr360/commit/289091b13dfe0495b44ae9e5353b78d2712e9762)) 28 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | 8 | jobs: 9 | release: 10 | runs-on: ubuntu-latest 11 | env: 12 | TURBO_TOKEN: ${{ secrets.VERCEL_TOKEN }} 13 | TURBO_TEAM: ${{ secrets.VERCEL_TEAM }} 14 | TURBO_CACHE_KEY: ubuntu-latest-16 # reuse cache key from ci workflow 15 | NODE_OPTIONS: '--max_old_space_size=4096' 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | with: 20 | fetch-depth: 0 21 | 22 | - name: Install pnpm 23 | uses: pnpm/action-setup@v2.2.1 24 | 25 | - name: Use Node.js v16 26 | uses: actions/setup-node@v2 27 | with: 28 | node-version: 16 29 | registry-url: https://registry.npmjs.org/ 30 | cache: pnpm 31 | 32 | - run: npx conventional-github-releaser -p angular 33 | continue-on-error: true 34 | env: 35 | CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{secrets.GITHUB_TOKEN}} 36 | 37 | - name: Install Dependencies 38 | run: pnpm i 39 | 40 | - name: PNPM build 41 | run: pnpm run build 42 | 43 | - name: Publish to NPM 44 | run: pnpm -r publish --access public --no-git-checks 45 | env: 46 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} 47 | 48 | # - name: Publish to VSCE & OVSX 49 | # run: npm run publish 50 | # working-directory: ./packages/vscode 51 | # env: 52 | # VSCE_TOKEN: ${{secrets.VSCE_TOKEN}} 53 | # OVSX_TOKEN: ${{secrets.OVSX_TOKEN}} 54 | -------------------------------------------------------------------------------- /playgrounds/vue3/src/Icons.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react/no-unknown-property */ 2 | export const DeleteIcon = () => ( 3 | 4 | 9 | 10 | ) 11 | 12 | export const LocationIcon = () => ( 13 | 14 | 15 | 20 | 21 | ) 22 | 23 | export const PaperAirPlaneIcon = () => ( 24 | 25 | 30 | 31 | ) 32 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # registry = "https://registry.npmmirror.com" 2 | 3 | sass_binary_site = "https://cdn.npmmirror.com/binaries/node-sass" 4 | phantomjs_cdnurl = "https://npmmirror.com/package/downloads" 5 | electron_mirror = "https://registry.npmmirror.com/binary.html?path=electron/" 6 | sqlite3_binary_host_mirror = "https://foxgis.oss-cn-shanghai.aliyuncs.com/" 7 | profiler_binary_host_mirror = "https://registry.npmmirror.com/binary.html?path=node-inspector/" 8 | chromedriver_cdnurl = "https://cdn.npmmirror.com/binaries/chromedriver" 9 | 10 | 11 | # pnpm 子线程交叉打印 12 | stream = true 13 | 14 | # pnpm 工作区中的本地包是否优先于注册表中的包 15 | prefer-workspace-packages = true 16 | 17 | # pnpm 将 monorepo 工作区中的本地可用包链接到 node_modules,而不是从注册表重新下载它们。 18 | link-workspace-packages = true 19 | 20 | # 依赖提升 21 | public-hoist-pattern[] = *types* 22 | public-hoist-pattern[] = *eslint* 23 | public-hoist-pattern[] = *stylelint* 24 | public-hoist-pattern[] = @prettier/plugin-* 25 | public-hoist-pattern[] = *prettier-plugin-* 26 | public-hoist-pattern[] = prettier 27 | public-hoist-pattern[] = *jest* 28 | public-hoist-pattern[] = *rollup* 29 | public-hoist-pattern[] = *babel* 30 | public-hoist-pattern[] = core-js 31 | public-hoist-pattern[] = regenerator-runtime 32 | public-hoist-pattern[] = esbuild 33 | public-hoist-pattern[] = *conventional* 34 | public-hoist-pattern[] = jsdom 35 | 36 | hoist-pattern[] = typescript 37 | hoist-pattern[] = @vue/* 38 | hoist-pattern[] = vue-template-compiler 39 | hoist-pattern[] = vue-template-es2015-compiler 40 | hoist-pattern[] = *vuepress* 41 | hoist-pattern[] = *plop* 42 | hoist-pattern[] = vue-demi 43 | 44 | # for doc-site 45 | hoist-pattern[] = nprogress 46 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/public/manifest.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vr360", 3 | "short_name": "vr360", 4 | "description": "快速实现你的全景开发需求", 5 | "theme_color": "#ffffff", 6 | "background_color": "#ffffff", 7 | "display": "standalone", 8 | "scope": "./", 9 | "start_url": "./", 10 | "icons": [ 11 | { 12 | "src": "/images/icons/icon-72x72.png", 13 | "sizes": "72x72", 14 | "type": "image/png", 15 | "purpose": "maskable any" 16 | }, 17 | { 18 | "src": "/images/icons/icon-96x96.png", 19 | "sizes": "96x96", 20 | "type": "image/png", 21 | "purpose": "maskable any" 22 | }, 23 | { 24 | "src": "/images/icons/icon-128x128.png", 25 | "sizes": "128x128", 26 | "type": "image/png", 27 | "purpose": "maskable any" 28 | }, 29 | { 30 | "src": "/images/icons/icon-144x144.png", 31 | "sizes": "144x144", 32 | "type": "image/png", 33 | "purpose": "maskable any" 34 | }, 35 | { 36 | "src": "/images/icons/icon-152x152.png", 37 | "sizes": "152x152", 38 | "type": "image/png", 39 | "purpose": "maskable any" 40 | }, 41 | { 42 | "src": "/images/icons/icon-192x192.png", 43 | "sizes": "192x192", 44 | "type": "image/png", 45 | "purpose": "maskable any" 46 | }, 47 | { 48 | "src": "/images/icons/icon-384x384.png", 49 | "sizes": "384x384", 50 | "type": "image/png", 51 | "purpose": "maskable any" 52 | }, 53 | { 54 | "src": "/images/icons/icon-512x512.png", 55 | "sizes": "512x512", 56 | "type": "image/png", 57 | "purpose": "maskable any" 58 | } 59 | ] 60 | } 61 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/theme/components/HomeFeatures.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 57 | -------------------------------------------------------------------------------- /playgrounds/vue3/src/EditorLeftBar.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/vue/vue-helper.util.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-unsafe-member-access */ 2 | /* eslint-disable @typescript-eslint/no-explicit-any */ 3 | import type {FunctionalComponent} from 'vue-demi' 4 | import {isVue2, Vue2, install} from 'vue-demi' 5 | 6 | export const nextTwoTick = () => 7 | new Promise(resolve => { 8 | setTimeout(() => { 9 | setTimeout(resolve) 10 | }) 11 | }) 12 | 13 | export function setProps(props: Record) { 14 | const {style, class: className, ...otherProps} = props 15 | return isVue2 16 | ? { 17 | style, 18 | class: className, 19 | props: otherProps 20 | } 21 | : { 22 | style, 23 | class: className, 24 | ...props 25 | } 26 | } 27 | 28 | export function createFunctionComponent(fn: (...args: any[]) => any) { 29 | return isVue2 30 | ? { 31 | functional: true, 32 | render: fn 33 | } 34 | : (fn as FunctionalComponent) 35 | } 36 | 37 | /** 38 | * get functional component slots 39 | * @param ctx functional component context 40 | * @returns slots 41 | */ 42 | export function getSlots(ctx: any, slotName: string) { 43 | // eslint-disable-next-line @typescript-eslint/no-unsafe-call 44 | const slots: Record = isVue2 ? ctx.slots?.() : ctx.slots 45 | const slot = slots[slotName] 46 | // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call 47 | return typeof slot === 'function' ? slot() : slot 48 | } 49 | 50 | export function setupVueSwitch() { 51 | if (isVue2) { 52 | Vue2.config.productionTip = false 53 | Vue2.config.devtools = false 54 | install(Vue2) // install vue composition-api 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/plugins/code-demo/Icons.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | import type {VNode} from 'vue' 3 | import {defineComponent, h} from 'vue' 4 | 5 | const createComponent = (name: string, render: (props: Record) => VNode) => 6 | defineComponent({ 7 | name, 8 | render() { 9 | const props = {...this.$props, ...this.$attrs} 10 | return render(props) 11 | } 12 | }) 13 | 14 | export const FullscreenIcon = createComponent('FullscreenIcon', props => { 15 | // 16 | // 17 | // 18 | // 19 | // 20 | 21 | return h( 22 | 'svg', 23 | { 24 | width: '1em', 25 | height: '1em', 26 | viewBox: '0 0 24 24', 27 | ...props 28 | }, 29 | [ 30 | h('path', { 31 | d: 'M5 5h5v2H7v3H5V5m9 0h5v5h-2V7h-3V5m3 9h2v5h-5v-2h3v-3m-7 3v2H5v-5h2v3h3z', 32 | fill: 'currentColor' 33 | }) 34 | ] 35 | ) 36 | }) 37 | 38 | export const ExitFullscreenIcon = createComponent('ExitFullscreenIcon', props => { 39 | // 40 | // 41 | // 42 | 43 | return h( 44 | 'svg', 45 | { 46 | width: '1em', 47 | height: '1em', 48 | viewBox: '0 0 24 24', 49 | ...props 50 | }, 51 | [ 52 | h('path', { 53 | d: 'M14 14h5v2h-3v3h-2v-5m-9 0h5v5H8v-3H5v-2m3-9h2v5H5V8h3V5m11 3v2h-5V5h2v3h3z', 54 | fill: 'currentColor' 55 | }) 56 | ] 57 | ) 58 | }) 59 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/plugins/code-demo/clientConfigFile.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | import type {CodeDemoProps} from './CodeDemo.props' 3 | import {defineClientConfig} from '@vuepress/client' 4 | import type {ConcreteComponent, DefineComponent} from 'vue' 5 | import {h, resolveComponent} from 'vue' 6 | import * as base64 from 'js-base64' 7 | 8 | export default defineClientConfig({ 9 | async enhance({app}) { 10 | // eslint-disable-next-line @typescript-eslint/ban-types 11 | let CodeDemo: DefineComponent<{}, {}, any> | undefined 12 | 13 | if (!__VUEPRESS_SSR__) { 14 | // eslint-disable-next-line unicorn/no-await-expression-member 15 | CodeDemo = (await import('./CodeDemo.vue')).default 16 | 17 | // set global css 18 | const styleEl = document.createElement('style') 19 | styleEl.innerHTML = ` 20 | .code-demo-wrapper { 21 | margin-top: 1rem; 22 | margin-bottom: 1rem; 23 | } 24 | .code-demo-wrapper + .code-demo-wrapper { 25 | margin-top: 3rem; 26 | } 27 | ` 28 | document.head.append(styleEl) 29 | } 30 | if (CodeDemo) { 31 | app.component('CodeDemo', CodeDemo) 32 | } 33 | 34 | // wrap the component with default options 35 | app.component('CodeDemoClient', (defaultProps: CodeDemoProps) => { 36 | if (!CodeDemo) return null 37 | const ClientOnly = resolveComponent('ClientOnly') 38 | // eslint-disable-next-line no-restricted-globals 39 | const codeDemoOptions = self.loadCodeDemoOptions?.(defaultProps) ?? defaultProps 40 | 41 | return h(ClientOnly, {}, () => 42 | h(CodeDemo as ConcreteComponent, { 43 | ...codeDemoOptions 44 | }) 45 | ) 46 | }) 47 | 48 | app.config.globalProperties.base64 = base64 // decode the options in sandbox component 49 | } 50 | }) 51 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: "\U0001F680 New feature proposal" 2 | description: Propose a new feature to be added to Vr360 3 | labels: ['feature request'] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thanks for your interest in the project and taking the time to fill out this feature report! 9 | - type: textarea 10 | id: feature-description 11 | attributes: 12 | label: Clear and concise description of the problem 13 | description: 'As a developer using xxxx package I want [goal / wish] so that [benefit]. If you intend to submit a PR for this issue, tell us in the description. Thanks!' 14 | validations: 15 | required: true 16 | - type: textarea 17 | id: suggested-solution 18 | attributes: 19 | label: Suggested solution 20 | description: 'In module [xy] we could provide following implementation...' 21 | validations: 22 | required: true 23 | - type: textarea 24 | id: alternative 25 | attributes: 26 | label: Alternative 27 | description: Clear and concise description of any alternative solutions or features you've considered. 28 | - type: textarea 29 | id: additional-context 30 | attributes: 31 | label: Additional context 32 | description: Any other context or screenshots about the feature request here. 33 | - type: checkboxes 34 | id: checkboxes 35 | attributes: 36 | label: Validations 37 | description: Before submitting the issue, please make sure you do the following 38 | options: 39 | - label: Follow our [Code of Conduct](https://github.com/nicepkg/vr360/blob/master/CODE_OF_CONDUCT.md) 40 | required: true 41 | - label: Read the [Contributing Guidelines](https://github.com/nicepkg/vr360/blob/master/CONTRIBUTING.md). 42 | required: true 43 | - label: Check that there isn't already an issue that request the same feature to avoid creating a duplicate. 44 | required: true 45 | -------------------------------------------------------------------------------- /packages/vr360-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@nicepkg/vr360-core", 3 | "version": "0.3.1", 4 | "description": "快速实现你的全景开发需求,全景看房、全景街景、全景景点", 5 | "keywords": [ 6 | "vr360", 7 | "vr360-core", 8 | "panorama", 9 | "pannellum", 10 | "photo-sphere-viewer", 11 | "photograph", 12 | "nicepkg", 13 | "webgl", 14 | "threejs" 15 | ], 16 | "author": "yangjinming ", 17 | "funding": "https://github.com/sponsors/2214962083", 18 | "license": "MIT", 19 | "private": false, 20 | "scripts": { 21 | "build": "pnpm type-check &&esno ./scripts/build.ts", 22 | "build:watch": "cross-env WATCH=true pnpm build", 23 | "clean": "rimraf ./dist/**/*", 24 | "dev": "esno ./src/playground.ts", 25 | "test": "vitest run --silent --passWithNoTests", 26 | "test:watch": "pnpm test -- --watch", 27 | "type-check": "tsc --noEmit" 28 | }, 29 | "main": "./dist/index.cjs", 30 | "module": "./dist/index.mjs", 31 | "types": "./dist/index.d.ts", 32 | "unpkg": "./dist/index.min.umd.js", 33 | "jsdelivr": "./dist/index.min.umd.js", 34 | "exports": { 35 | ".": { 36 | "require": "./dist/index.cjs", 37 | "import": "./dist/index.mjs", 38 | "types": "./dist/index.d.ts" 39 | }, 40 | "./*": "./*" 41 | }, 42 | "files": [ 43 | "dist" 44 | ], 45 | "sideEffects": false, 46 | "repository": { 47 | "type": "git", 48 | "url": "git+https://github.com/nicepkg/vr360.git", 49 | "directory": "packages/vr360-core" 50 | }, 51 | "bugs": { 52 | "url": "https://github.com/nicepkg/vr360/issues" 53 | }, 54 | "homepage": "https://github.com/nicepkg/vr360#readme", 55 | "peerDependencies": { 56 | "three": "*" 57 | }, 58 | "dependencies": { 59 | "@tweenjs/tween.js": "^18.6.4", 60 | "eventemitter3": "^4.0.7" 61 | }, 62 | "devDependencies": { 63 | "@nicepkg/vr360-shared": "workspace:*", 64 | "@types/three": "^0.144.0", 65 | "@types/node": "*", 66 | "esno": "*", 67 | "jsdom": "^20.0.1", 68 | "three": "^0.145.0", 69 | "typescript": "*", 70 | "vite": "*", 71 | "vitest": "*" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /packages/vr360-core/README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |

@nicepkg/vr360-core

6 |

json 驱动的全景浏览库核心,设计框架无关性,可用于任何框架,如vue/react/angular/svelte/solidjs...

7 |

8 | version 9 | three 10 | license 11 | coverage 12 | gzip 13 | stars 14 |

15 |
16 | 17 | ## 介绍 18 | 19 | `@nicepkg/vr360-core` 是一个基于 [threejs](https://github.com/mrdoob/three.js/) 的全景库,非常适合用来做全景看房、全景街景、全景景点等业务需求。 20 | 21 | 它支持 json 配置驱动视图,你可以用 json 配置的方式快速实现常见全景需求。 22 | 23 | ## 特性 24 | 25 | - json 驱动视图,快速实现全景业务需求 26 | - 高性能,支持自动找出 json 变更的部分,最小化更新到 3d 全景里,不会整个场景重建。 27 | - 支持增删改提示点,hover 提示点的弹窗支持自定义定制,支持自定义提示点的贴图。 28 | - 内置场景切换穿梭动画 29 | - 暴露 scene、camera、renderer 等 [threejs](https://github.com/mrdoob/three.js/) 对象,方便你更高的定制化 30 | - 基于事件驱动的数据交互,设计框架无关性 31 | - 完整的 ts 支持 32 | 33 | ## 安装 34 | 35 | for npm 36 | 37 | ```bash 38 | npm i @nicepkg/vr360-core threejs 39 | ``` 40 | 41 | for yarn 42 | 43 | ```bash 44 | yarn add @nicepkg/vr360-core threejs 45 | ``` 46 | 47 | for pnpm 48 | 49 | ```bash 50 | pnpm add @nicepkg/vr360-core threejs 51 | ``` 52 | 53 | ## 使用 54 | 55 | 点击查看[使用文档](https://vr360.nicepkg.cn/libs/vr360-core/)。 56 | 57 | ## Contributing 58 | 59 | Learn about contribution [here](https://github.com/nicepkg/vr360/blob/master/CONTRIBUTING.md). 60 | 61 | This project exists thanks to all the people who contribute: 62 | 63 | 64 | 65 | 66 | 67 | ## License 68 | 69 | [MIT](https://github.com/nicepkg/vr360/blob/master/LICENSE) License © 2022-PRESENT [nicepkg](https://github.com/nicepkg) 70 | -------------------------------------------------------------------------------- /packages/doc/vuepress.config.ts: -------------------------------------------------------------------------------- 1 | import {defineUserConfig} from 'vuepress' 2 | import {path} from '@vuepress/utils' 3 | import {viteBundler} from '@vuepress/bundler-vite' 4 | import {plugins} from './.vuepress/plugins' 5 | import {bundlerConfig} from './bundler.config' 6 | import {localTheme} from './.vuepress/theme' 7 | 8 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 9 | const pathResolve = (..._path: string[]) => path.resolve(__dirname, ..._path) 10 | 11 | export default defineUserConfig({ 12 | base: '/', 13 | 14 | head: [ 15 | [ 16 | 'link', 17 | { 18 | rel: 'icon', 19 | type: 'image/png', 20 | sizes: '16x16', 21 | href: `/images/icons/favicon-16x16.png` 22 | } 23 | ], 24 | [ 25 | 'link', 26 | { 27 | rel: 'icon', 28 | type: 'image/png', 29 | sizes: '32x32', 30 | href: `/images/icons/favicon-32x32.png` 31 | } 32 | ], 33 | ['link', {rel: 'manifest', href: '/manifest.webmanifest'}], 34 | ['meta', {name: 'application-name', content: 'Vr360'}], 35 | ['meta', {name: 'apple-mobile-web-app-title', content: 'Vr360'}], 36 | ['meta', {name: 'apple-mobile-web-app-status-bar-style', content: 'black'}], 37 | ['link', {rel: 'apple-touch-icon', href: `/images/icons/apple-touch-icon.png`}], 38 | [ 39 | 'link', 40 | { 41 | rel: 'mask-icon', 42 | href: '/images/icons/safari-pinned-tab.svg', 43 | color: '#0c4dc4' 44 | } 45 | ], 46 | ['meta', {name: 'msapplication-TileColor', content: '#0c4dc4'}], 47 | ['meta', {name: 'theme-color', content: '#0c4dc4'}] 48 | ], 49 | 50 | // site-level locales config 51 | locales: { 52 | '/': { 53 | lang: 'zh-CN', 54 | title: 'Vr360', 55 | description: '快速实现你的全景浏览开发需求' 56 | } 57 | // '/en/': { 58 | // lang: 'en-US', 59 | // title: 'Vr360', 60 | // description: 'Quickly realize your panoramic browsing development needs' 61 | // } 62 | }, 63 | 64 | theme: localTheme(), 65 | bundler: viteBundler(bundlerConfig), 66 | templateDev: pathResolve('.vuepress/index.build.html'), 67 | templateBuild: pathResolve('.vuepress/index.build.html'), 68 | markdown: { 69 | importCode: { 70 | handleImportPath: str => str.replace(/^@/, pathResolve('.vuepress')) 71 | } 72 | }, 73 | plugins 74 | }) 75 | -------------------------------------------------------------------------------- /stylelint.config.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | 3 | module.exports = /** @type { Partial } */ ({ 4 | customSyntax: 'postcss-less', 5 | defaultSeverity: 'error', 6 | extends: [ 7 | 'stylelint-config-standard', 8 | 'stylelint-config-recess-order', 9 | 'stylelint-config-recommended-vue', 10 | 'stylelint-prettier/recommended' 11 | ], 12 | plugins: ['stylelint-declaration-block-no-ignored-properties'], 13 | overrides: [ 14 | { 15 | files: ['**/*.(less|css|html|vue)'], 16 | customSyntax: 'postcss-less', 17 | plugins: ['stylelint-less'] 18 | }, 19 | { 20 | files: ['**/*.(html|vue)'], 21 | customSyntax: 'postcss-html' 22 | } 23 | ], 24 | rules: { 25 | 'media-feature-name-no-vendor-prefix': true, 26 | 'at-rule-no-vendor-prefix': true, 27 | 'selector-no-vendor-prefix': true, 28 | 'property-no-vendor-prefix': true, 29 | 'value-no-vendor-prefix': true, 30 | 'block-no-empty': null, 31 | 'comment-empty-line-before': null, 32 | 'declaration-empty-line-before': null, 33 | 'function-comma-newline-after': null, 34 | 'function-name-case': null, 35 | 'function-parentheses-newline-inside': null, 36 | 'function-max-empty-lines': null, 37 | 'function-whitespace-after': null, 38 | indentation: null, 39 | 'number-leading-zero': null, 40 | 'number-no-trailing-zeros': null, 41 | 'rule-empty-line-before': null, 42 | 'selector-combinator-space-after': null, 43 | 'selector-list-comma-newline-after': null, 44 | 'selector-pseudo-element-colon-notation': null, 45 | 'unit-no-unknown': null, 46 | 'value-list-max-empty-lines': null, 47 | 'font-family-no-missing-generic-family-keyword': null, 48 | 'no-descending-specificity': null, 49 | 'selector-class-pattern': null, 50 | 'keyframes-name-pattern': null, 51 | 'color-function-notation': 'legacy', 52 | 'alpha-value-notation': 'number', 53 | 'no-empty-source': null, 54 | 'function-no-unknown': [ 55 | true, 56 | { 57 | ignoreFunctions: ['constant'] 58 | } 59 | ], 60 | 'at-rule-no-unknown': [ 61 | true, 62 | { 63 | ignoreAtRules: ['extends', 'tailwind', 'apply', 'variants', 'responsive', 'screen'] 64 | } 65 | ], 66 | 'declaration-block-trailing-semicolon': null, 67 | 'selector-pseudo-element-no-unknown': [ 68 | true, 69 | { 70 | ignorePseudoElements: ['v-deep'] 71 | } 72 | ] 73 | } 74 | }) 75 | -------------------------------------------------------------------------------- /playgrounds/vue3/src/ContextMenu.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: Docs 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | 9 | pull_request: 10 | branches: 11 | - main 12 | - master 13 | # workflow_run: 14 | # workflows: ['Test'] 15 | # types: 16 | # - completed 17 | 18 | jobs: 19 | build: 20 | runs-on: ubuntu-latest 21 | env: 22 | TURBO_TOKEN: ${{ secrets.VERCEL_TOKEN }} 23 | TURBO_TEAM: ${{ secrets.VERCEL_TEAM }} 24 | TURBO_CACHE_KEY: ubuntu-latest-16 # reuse cache key from ci workflow 25 | NODE_OPTIONS: '--max_old_space_size=4096' 26 | 27 | steps: 28 | - uses: actions/checkout@v2 29 | 30 | - name: Install pnpm 31 | uses: pnpm/action-setup@v2.2.1 32 | 33 | - name: Use Node.js 34 | uses: actions/setup-node@v2 35 | with: 36 | node-version: 16.x 37 | registry-url: https://registry.npmjs.org/ 38 | cache: pnpm 39 | 40 | - name: Install Dependencies and build all packages 41 | run: pnpm bootstrap 42 | 43 | # - name: deploy docs to vercel 44 | # uses: BetaHuhn/deploy-to-vercel-action@v1 45 | # # see: https://github.com/BetaHuhn/deploy-to-vercel-action 46 | # with: 47 | # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 48 | # VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} 49 | # VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} 50 | # VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_DOC_SITE }} 51 | # # for team settings 52 | # VERCEL_SCOPE: ${{ secrets.VERCEL_ORG_ID }} 53 | # # the docs build dist folder 54 | # WORKING_DIRECTORY: ./packages/doc/.vuepress/dist 55 | # # bind domains 56 | # # ALIAS_DOMAINS: | 57 | # # docs.vr360.com 58 | # # docs.vr360.cn 59 | 60 | - name: deploy docs to vercel 61 | uses: amondnet/vercel-action@v20 62 | # see: https://github.com/amondnet/vercel-action 63 | with: 64 | github-token: ${{ secrets.GITHUB_TOKEN }} 65 | vercel-token: ${{ secrets.VERCEL_TOKEN }} 66 | vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} 67 | vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_DOC_SITE }} 68 | # for team settings 69 | scope: ${{ secrets.VERCEL_ORG_ID }} 70 | # just like npx vercel --prod 71 | vercel-args: '--prod' 72 | # the docs build dist folder 73 | working-directory: ./packages/doc/.vuepress/dist 74 | # bind domains 75 | # alias-domains: | 76 | # docs.vr360.com 77 | # docs.vr360.cn 78 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/theme/index.ts: -------------------------------------------------------------------------------- 1 | import type {Theme} from '@vuepress/core' 2 | import {defaultTheme} from '@vuepress/theme-default' 3 | import {path} from '@vuepress/utils' 4 | import {navbar, sidebar} from '../configs' 5 | import {isProd} from '../utils/common' 6 | 7 | const pathResolve = (..._path: string[]) => path.resolve(__dirname, ..._path) 8 | 9 | export const localTheme = (): Theme => { 10 | return { 11 | name: 'vuepress-theme-local', 12 | extends: defaultTheme({ 13 | logo: '/images/logo.png', 14 | logoDark: '/images/logo-dark.png', 15 | 16 | repo: 'nicepkg/vr360', 17 | 18 | docsBranch: 'master', 19 | 20 | docsDir: 'packages/doc', 21 | 22 | // theme-level locales config 23 | locales: { 24 | /** 25 | * Chinese locale config 26 | */ 27 | '/': { 28 | // navbar 29 | navbar: navbar.zh, 30 | selectLanguageName: '简体中文', 31 | selectLanguageText: '选择语言', 32 | selectLanguageAriaLabel: '选择语言', 33 | 34 | // sidebar 35 | sidebar: sidebar.zh, 36 | 37 | // page meta 38 | editLinkText: '在 GitHub 上编辑此页', 39 | lastUpdatedText: '上次更新', 40 | contributorsText: '贡献者', 41 | 42 | // custom containers 43 | tip: '提示', 44 | warning: '注意', 45 | danger: '警告', 46 | 47 | // 404 page 48 | notFound: ['这里什么都没有', '我们怎么到这来了?', '这是一个 404 页面', '看起来我们进入了错误的链接'], 49 | backToHome: '返回首页', 50 | 51 | // a11y 52 | openInNewWindow: '在新窗口打开', 53 | toggleColorMode: '切换主题', 54 | toggleSidebar: '切换侧边栏' 55 | }, 56 | 57 | /** 58 | * English locale config 59 | * 60 | * As the default locale of @vuepress/theme-default is English, 61 | * we don't need to set all of the locale fields 62 | */ 63 | '/en/': { 64 | // navbar 65 | navbar: navbar.en, 66 | 67 | // sidebar 68 | sidebar: sidebar.en, 69 | 70 | // page meta 71 | editLinkText: 'Edit this page on GitHub' 72 | } 73 | }, 74 | 75 | themePlugins: { 76 | // only enable git plugin in production mode 77 | git: isProd, 78 | // use shiki plugin in production mode instead 79 | prismjs: !isProd, 80 | // disable the @vuepress/plugin-nprogress plugin to fix the bug of `Cannot set properties of undefined (setting 'NProgress')` 81 | nprogress: false 82 | } 83 | }), 84 | alias: { 85 | '@theme/Home.vue': pathResolve('components/Home.vue'), 86 | '@theme/HomeFeatures.vue': pathResolve('components/HomeFeatures.vue') 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/common/mock-server.util.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | /** 3 | * Network mocking with MSW. 4 | * Import this helper into the specific tests that need to make network requests. 5 | */ 6 | 7 | import {setupServer} from 'msw/node' 8 | import type {RestContext, RestRequest} from 'msw' 9 | import {rest} from 'msw' 10 | 11 | const defaultJsonMessage = {hello: 'world'} 12 | const defaultTextMessage = 'Hello World' 13 | const baseUrl = 'https://example.com' 14 | 15 | const commonTransformers = (req: RestRequest, _: any, ctx: RestContext) => { 16 | const t = [] 17 | const qs = req.url.searchParams 18 | 19 | if (qs.get('delay')) t.push(ctx.delay(Number(qs.get('delay')))) 20 | if (qs.get('status')) t.push(ctx.status(Number(qs.get('status')))) 21 | if (qs.get('text') != null) { 22 | t.push(ctx.text(qs.get('text') ?? defaultTextMessage)) 23 | } else if (qs.get('json') != null) { 24 | const jsonVal = qs.get('json') 25 | const jsonTransformer = ctx.json(jsonVal?.length ? JSON.parse(jsonVal) : defaultJsonMessage) 26 | t.push(jsonTransformer) 27 | } 28 | return t 29 | } 30 | 31 | /** 32 | * Allow the client to define the response body. 33 | * @example https://example.com?status=400 will respond with { status: 400 }. 34 | * @example https://example.com?json will respond with the default json message ({ hello: 'world' }). 35 | * @example https://example.com?text will respond with the default text message ('Hello World'). 36 | * @example https://example.com?delay=1000 will respond in 1000ms. 37 | * @example https://example.com?status=301&text=thanks&delay=1000 38 | * will respond in 1000ms with statusCode 300 and the response body "thanks" as a string 39 | */ 40 | export const createServer = () => 41 | setupServer( 42 | rest.post(baseUrl, (req, res, ctx) => { 43 | // Support all the normal examples (delay, status, text, and json) 44 | const t = commonTransformers(req, res, ctx) 45 | 46 | // Echo back the request payload 47 | if (typeof req.body === 'number' || typeof req.body === 'string') t.push(ctx.text(String(req.body))) 48 | else t.push(ctx.json(req.body)) 49 | 50 | return res(...t) 51 | }), 52 | 53 | rest.get(baseUrl, (req, res, ctx) => res(...commonTransformers(req, res, ctx))), 54 | 55 | // Another duplicate route for the sole purpose of re-triggering requests on url change. 56 | rest.get(`${baseUrl}/test`, (req, res, ctx) => res(...commonTransformers(req, res, ctx))) 57 | ) 58 | 59 | export const mockServer = () => { 60 | const server = createServer() 61 | beforeAll(() => server.listen()) 62 | afterEach(() => server.resetHandlers()) 63 | afterAll(() => server.close()) 64 | return server 65 | } 66 | -------------------------------------------------------------------------------- /scripts/utils.ts: -------------------------------------------------------------------------------- 1 | import {copyFileSync, readFileSync, existsSync} from 'node:fs' 2 | import {execSync} from 'node:child_process' 3 | import path from 'node:path' 4 | import globby from 'globby' 5 | 6 | export const pathResolve = (..._path: string[]) => path.resolve(__dirname, ..._path) 7 | export const pathResolveUnix = (..._path: string[]) => pathResolve(..._path).replace(/\\/g, '/') 8 | 9 | export const packagesGlobPaths = pathResolveUnix('../packages/*/') 10 | export const packagesPaths = globby.sync(packagesGlobPaths, {onlyFiles: false, onlyDirectories: true}) 11 | export const rootLicense = pathResolve('../', 'LICENSE') 12 | 13 | export function copyFiles() { 14 | packagesPaths.map(packagePath => { 15 | const pkgJson = pathResolve(packagePath, 'package.json') 16 | const license = pathResolve(packagePath, 'LICENSE') 17 | 18 | if (!existsSync(pkgJson)) return 19 | 20 | const pkg: Record = JSON.parse(readFileSync(pkgJson, 'utf8')) || {} 21 | if (pkg.private) return 22 | if (!existsSync(license)) copyFileSync(rootLicense, license) 23 | }) 24 | } 25 | 26 | export type PackageInfo = {path: string; name: string} 27 | export function getPackagesInfo(type: 'public' | 'all'): PackageInfo[] { 28 | return packagesPaths.reduce((pkgInfos: PackageInfo[], packagePath) => { 29 | const pkgJson = pathResolve(packagePath, 'package.json') 30 | 31 | if (!existsSync(pkgJson)) return pkgInfos 32 | 33 | const pkg: Record = JSON.parse(readFileSync(pkgJson, 'utf8')) || {} 34 | 35 | if (type === 'public') { 36 | if (pkg.private) return pkgInfos 37 | return [ 38 | ...pkgInfos, 39 | { 40 | path: packagePath, 41 | name: pkg.name 42 | } 43 | ] 44 | } else { 45 | return [ 46 | ...pkgInfos, 47 | { 48 | path: packagePath, 49 | name: pkg.name 50 | } 51 | ] 52 | } 53 | }, []) 54 | } 55 | 56 | export function build() { 57 | const cmd = `pnpm run build:all` 58 | console.log('start run command:', cmd) 59 | execSync(cmd, {stdio: 'inherit'}) 60 | } 61 | 62 | export function generateChangelog() { 63 | const pkgInfos = getPackagesInfo('all') 64 | 65 | for (const pkgInfo of pkgInfos) { 66 | const cmd = `pnpm exec conventional-changelog -p angular -i '${path.resolve( 67 | pkgInfo.path, 68 | './CHANGELOG.md' 69 | )}' -s --commit-path . -l ${pkgInfo.name} -r 0` 70 | console.log('start run command:', cmd) 71 | execSync(cmd, {stdio: 'inherit'}) 72 | } 73 | } 74 | 75 | export function release() { 76 | generateChangelog() 77 | execSync('git add .', {stdio: 'inherit'}) 78 | execSync( 79 | 'pnpm exec bumpp package.json packages/*/package.json --push --tag --all --commit "build: the v%s release"', 80 | { 81 | stdio: 'inherit' 82 | } 83 | ) 84 | } 85 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: "\U0001F41E Bug report" 2 | description: Report an issue with Vr360 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | Thanks for taking the time to fill out this bug report! 8 | - type: textarea 9 | id: bug-description 10 | attributes: 11 | label: Describe the bug 12 | description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks! 13 | placeholder: Bug description 14 | validations: 15 | required: true 16 | - type: input 17 | id: reproduction 18 | attributes: 19 | label: Reproduction 20 | description: Please provide a link via [vr360](https://stackblitz.com/edit/vr360/) or a link to a repo that can reproduce the problem you ran into. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is required. 21 | placeholder: Reproduction 22 | validations: 23 | required: true 24 | - type: textarea 25 | id: system-info 26 | attributes: 27 | label: System Info 28 | description: Output of `npx envinfo --system --npmPackages '{@nicepkg/vr360-core,three}' --binaries --browsers` 29 | render: Shell 30 | placeholder: System, Binaries, Browsers 31 | validations: 32 | required: true 33 | - type: dropdown 34 | id: package-manager 35 | attributes: 36 | label: Used Package Manager 37 | description: Select the used package manager 38 | options: 39 | - npm 40 | - yarn 41 | - pnpm 42 | validations: 43 | required: true 44 | - type: checkboxes 45 | id: checkboxes 46 | attributes: 47 | label: Validations 48 | description: Before submitting the issue, please make sure you do the following 49 | options: 50 | - label: Follow our [Code of Conduct](https://github.com/nicepkg/vr360/blob/master/CODE_OF_CONDUCT.md) 51 | required: true 52 | - label: Read the [Contributing Guidelines](https://github.com/nicepkg/vr360/blob/master/CONTRIBUTING.md). 53 | required: true 54 | - label: Check that there isn't [already an issue](https://github.com/nicepkg/vr360/issues) that reports the same bug to avoid creating a duplicate. 55 | required: true 56 | - label: Make sure this is a Vr360 issue and not a framework-specific issue. For example, if it's a threejs related bug, it should likely be reported to https://github.com/mrdoob/three.js instead. 57 | required: true 58 | - label: Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/nicepkg/vr360/discussions). 59 | required: true 60 | - label: The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. 61 | required: true 62 | -------------------------------------------------------------------------------- /packages/doc/libs/vr360-core/events.md: -------------------------------------------------------------------------------- 1 | # 事件 2 | 3 | ## 显示提示 4 | 5 | #### 介绍 6 | 7 | ```ts 8 | interface Vr360Events { 9 | /** 10 | * 触发提示时的回调 11 | */ 12 | showTip: (e: { 13 | /** 14 | * 提示配置信息 15 | */ 16 | tip: Tip 17 | 18 | /** 19 | * 相对于 container 的 left 20 | */ 21 | left: number 22 | 23 | /** 24 | * 相对于 container 的 top 25 | */ 26 | top: number 27 | }) => void 28 | } 29 | ``` 30 | 31 | 点击查看 [tip](./methods.md#tip-空间配置里的提示配置) 类型 32 | 33 | #### 使用 34 | 35 | ```ts 36 | import {Vr360} from '@nicepkg/vr360-core' 37 | 38 | const vr360 = new Vr360({....}) 39 | 40 | vr360.render() 41 | 42 | vr360.on('showTip', (e) => { 43 | console.log('触发提示时的回调', e) 44 | }) 45 | ``` 46 | 47 | ## 隐藏提示 48 | 49 | #### 介绍 50 | 51 | ```ts 52 | interface Vr360Events { 53 | /** 54 | * 隐藏提示时的回调 55 | */ 56 | hideTip: (e: { 57 | /** 58 | * 提示配置信息 59 | */ 60 | tip: Tip 61 | }) => void 62 | } 63 | ``` 64 | 65 | 点击查看 [tip](./methods.md#tip-空间配置里的提示配置) 类型 66 | 67 | #### 使用 68 | 69 | ```ts 70 | import {Vr360} from '@nicepkg/vr360-core' 71 | 72 | const vr360 = new Vr360({....}) 73 | 74 | vr360.render() 75 | 76 | vr360.on('hideTip', (e) => { 77 | console.log('隐藏提示时的回调', e) 78 | }) 79 | ``` 80 | 81 | ## 点击提示图标 82 | 83 | #### 介绍 84 | 85 | ```ts 86 | interface Vr360Events { 87 | /** 88 | * 点击提示时的回调 89 | */ 90 | clickTip: (e: { 91 | /** 92 | * 提示配置信息 93 | */ 94 | tip: Tip 95 | }) => void 96 | } 97 | ``` 98 | 99 | 点击查看 [tip](./methods.md#tip-空间配置里的提示配置) 类型 100 | 101 | #### 使用 102 | 103 | ```ts 104 | import {Vr360} from '@nicepkg/vr360-core' 105 | 106 | const vr360 = new Vr360({....}) 107 | 108 | vr360.render() 109 | 110 | vr360.on('clickTip', (e) => { 111 | console.log('点击提示时的回调', e) 112 | }) 113 | ``` 114 | 115 | ## 每一帧更新 116 | 117 | #### 介绍 118 | 119 | ```ts 120 | interface Vr360Events { 121 | /** 122 | * 每帧更新回调 123 | */ 124 | update: () => void 125 | } 126 | ``` 127 | 128 | #### 使用 129 | 130 | ```ts 131 | import {Vr360} from '@nicepkg/vr360-core' 132 | 133 | const vr360 = new Vr360({....}) 134 | 135 | vr360.render() 136 | 137 | vr360.on('update', () => { 138 | console.log('每帧更新回调') 139 | }) 140 | ``` 141 | 142 | ## 切换全景空间完成 143 | 144 | #### 介绍 145 | 146 | ```ts 147 | interface Vr360Events { 148 | /** 149 | * 完成跳转空间时的回调 150 | */ 151 | afterSwitchSpace: (e: { 152 | /** 153 | * 跳转的目标空间配置 154 | */ 155 | spaceConfig: SpaceConfig 156 | }) => void 157 | } 158 | ``` 159 | 160 | 点击查看 [SpaceConfig](./methods.md#spaceconfig-构造参数里的空间配置) 类型 161 | 162 | #### 使用 163 | 164 | ```ts 165 | import {Vr360} from '@nicepkg/vr360-core' 166 | 167 | const vr360 = new Vr360({....}) 168 | 169 | vr360.render() 170 | 171 | vr360.on('afterSwitchSpace', (e) => { 172 | console.log('完成跳转空间时的回调', e) 173 | }) 174 | ``` 175 | -------------------------------------------------------------------------------- /playgrounds/vue3/src/EditorSceneManager.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /packages/doc/libs/vr360-core/properties.md: -------------------------------------------------------------------------------- 1 | # 属性 2 | 3 | ## 全景容器 4 | 5 | ##### 介绍 6 | 7 | ```ts 8 | class Vr360 { 9 | /** 10 | * 容器 11 | */ 12 | public container: HTMLElement 13 | } 14 | ``` 15 | 16 | ##### 使用 17 | 18 | ```ts 19 | import {Vr360} from '@nicepkg/vr360-core' 20 | 21 | const vr360 = new Vr360({....}) 22 | 23 | vr360.render() 24 | 25 | // 获取容器 26 | console.log('3d 渲染容器是:', vr360.container) 27 | ``` 28 | 29 | ## 相机 30 | 31 | ##### 介绍 32 | 33 | ```ts 34 | class Vr360 { 35 | /** 36 | * 相机 37 | */ 38 | public camera: THREE.PerspectiveCamera 39 | } 40 | ``` 41 | 42 | ##### 使用 43 | 44 | ```ts 45 | import {Vr360} from '@nicepkg/vr360-core' 46 | 47 | const vr360 = new Vr360({....}) 48 | 49 | vr360.render() 50 | 51 | // 获取相机 52 | console.log('3d 相机是:', vr360.camera) 53 | ``` 54 | 55 | ## 渲染器 56 | 57 | #### 介绍 58 | 59 | ```ts 60 | class Vr360 { 61 | /** 62 | * 渲染器 63 | */ 64 | public renderer: THREE.WebGLRenderer 65 | } 66 | ``` 67 | 68 | #### 使用 69 | 70 | ```ts 71 | import {Vr360} from '@nicepkg/vr360-core' 72 | 73 | const vr360 = new Vr360({....}) 74 | 75 | vr360.render() 76 | 77 | // 获取渲染器 78 | console.log('3d 渲染器是:', vr360.renderer) 79 | ``` 80 | 81 | ## 场景 82 | 83 | #### 介绍 84 | 85 | ```ts 86 | class Vr360 { 87 | /** 88 | * 场景 89 | */ 90 | public scene: THREE.Scene 91 | } 92 | ``` 93 | 94 | #### 使用 95 | 96 | ```ts 97 | import {Vr360} from '@nicepkg/vr360-core' 98 | 99 | const vr360 = new Vr360({....}) 100 | 101 | vr360.render() 102 | 103 | // 获取场景 104 | console.log('3d 场景是:', vr360.scene) 105 | ``` 106 | 107 | ## 控制器 108 | 109 | #### 介绍 110 | 111 | ```ts 112 | class Vr360 { 113 | /** 114 | * 控制器 115 | */ 116 | public controls: THREE.OrbitControls 117 | } 118 | ``` 119 | 120 | #### 使用 121 | 122 | ```ts 123 | import {Vr360} from '@nicepkg/vr360-core' 124 | 125 | const vr360 = new Vr360({....}) 126 | 127 | vr360.render() 128 | 129 | // 获取控制器 130 | console.log('3d 控制器是:', vr360.controls) 131 | ``` 132 | 133 | ## 全景空间配置 134 | 135 | #### 介绍 136 | 137 | ```ts 138 | class Vr360 { 139 | /** 140 | * 空间配置 141 | */ 142 | public spacesConfig: SpaceConfig[] 143 | } 144 | ``` 145 | 146 | 点击查看 [SpaceConfig](./methods.md#spaceconfig-构造参数里的空间配置) 类型 147 | 148 | #### 使用 149 | 150 | ```ts 151 | import {Vr360} from '@nicepkg/vr360-core' 152 | 153 | const vr360 = new Vr360({....}) 154 | 155 | vr360.render() 156 | 157 | // 获取空间配置 158 | console.log('3d 空间配置是:', vr360.spacesConfig) 159 | ``` 160 | 161 | ## 提示容器 162 | 163 | #### 介绍 164 | 165 | ```ts 166 | class Vr360 { 167 | /** 168 | * 提示容器 169 | */ 170 | public tipContainer?: HTMLElement 171 | } 172 | ``` 173 | 174 | #### 使用 175 | 176 | ```ts 177 | import {Vr360} from '@nicepkg/vr360-core' 178 | 179 | const vr360 = new Vr360({....}) 180 | 181 | vr360.render() 182 | 183 | // 获取提示容器 184 | console.log('3d 提示容器是:', vr360.tipContainer) 185 | ``` 186 | -------------------------------------------------------------------------------- /packages/vr360-shared/src/test-utils/vue/vue-mount.util.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-unsafe-member-access */ 2 | /* eslint-disable @typescript-eslint/no-explicit-any */ 3 | import type {Component, InjectionKey, Ref} from 'vue-demi' 4 | import {createApp, defineComponent, h, provide, ref, resolveComponent, isVue2, isVue3} from 'vue-demi' 5 | 6 | type InstanceType = V extends new (...arg: any[]) => infer X ? X : never 7 | export type VM = InstanceType & {unmount(): void} 8 | 9 | export function find(selector: string, target?: HTMLElement | null | undefined) { 10 | const el = target?.querySelector(selector) 11 | return { 12 | el, 13 | find: (selector: string) => find(selector, el), 14 | text() { 15 | return el?.textContent ?? '' 16 | }, 17 | html() { 18 | return el?.innerHTML ?? '' 19 | } 20 | } 21 | } 22 | 23 | export type SnapType = 'all' | 'vue2' | 'vue3' 24 | 25 | type MountResult = VM & { 26 | find: typeof find 27 | toSnap: (type?: SnapType) => void 28 | } 29 | 30 | export function mount(Comp: V): MountResult { 31 | const el = document.createElement('div') 32 | document.body.append(el) 33 | const app = createApp(Comp) 34 | 35 | const unmount = () => { 36 | app.unmount() 37 | el.remove() 38 | } 39 | 40 | const comp = app.mount(el) as any as VM 41 | comp.unmount = unmount 42 | 43 | const _find = (selector: string) => { 44 | const el = (comp as any).$el as HTMLElement 45 | return find(selector, el.parentElement) 46 | } 47 | 48 | const toSnap = (type: SnapType = 'vue3') => { 49 | const shouldSnap = type === 'all' || (type === 'vue2' && isVue2) || (type === 'vue3' && isVue3) 50 | if (shouldSnap) { 51 | const el = (comp as any).$el as HTMLElement 52 | expect(el).toMatchSnapshot() 53 | } 54 | } 55 | 56 | Object.assign(comp, {find: _find, toSnap}) 57 | 58 | // eslint-disable-next-line @typescript-eslint/no-unsafe-return 59 | return comp as MountResult 60 | } 61 | 62 | /** 63 | * get component for h first argument 64 | * @param tagName component tag name 65 | * @returns component for h first argument 66 | */ 67 | export function getComponent(tagName: string) { 68 | return isVue2 ? tagName : resolveComponent(tagName) 69 | } 70 | 71 | export function useSetup(setup: () => V) { 72 | const Comp = defineComponent({ 73 | setup, 74 | render() { 75 | return h('div', []) 76 | } 77 | }) 78 | 79 | return mount(Comp) 80 | } 81 | 82 | export const Key: InjectionKey> = Symbol('num') 83 | 84 | export function useInjectedSetup(setup: () => V) { 85 | const Comp = defineComponent({ 86 | setup, 87 | render() { 88 | return h('div', []) 89 | } 90 | }) 91 | 92 | const Provider = defineComponent({ 93 | components: Comp, 94 | setup() { 95 | provide(Key, ref(1)) 96 | }, 97 | render() { 98 | return h('div', []) 99 | } 100 | }) 101 | 102 | return mount(Provider) 103 | } 104 | -------------------------------------------------------------------------------- /playgrounds/vue3/src/useVr360.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-unnecessary-type-arguments */ 2 | /* eslint-disable @typescript-eslint/no-unsafe-member-access */ 3 | import type {Ref} from 'vue' 4 | import {shallowRef, ref, watch} from 'vue' 5 | import type {SpaceConfig} from '@nicepkg/vr360-core' 6 | import {Vr360} from '@nicepkg/vr360-core' 7 | 8 | export type MaybeRef = T | Ref 9 | 10 | export type UseVr360Options = { 11 | containerEl?: MaybeRef 12 | tipEl?: MaybeRef 13 | spacesConfig?: MaybeRef 14 | } 15 | 16 | const containerRef = ref() 17 | const tipRef = ref() 18 | const tipLeft = ref(0) 19 | const tipTop = ref(0) 20 | const showTip = ref(false) 21 | const tipTitle = ref('') 22 | const tipContent = ref('') 23 | const vr360 = shallowRef>() 24 | 25 | const spacesConfig = ref() 26 | 27 | watch( 28 | [containerRef, tipRef, spacesConfig], 29 | () => { 30 | if (containerRef.value && tipRef.value && spacesConfig.value) { 31 | if (!vr360.value) { 32 | console.log('创建 vr360实例') 33 | vr360.value = new Vr360({ 34 | container: containerRef.value, 35 | tipContainer: tipRef.value, 36 | spacesConfig: spacesConfig.value 37 | }) 38 | 39 | // vr360.value.controls.autoRotate = true 40 | 41 | vr360.value.render() 42 | 43 | vr360.value.listenResize() 44 | 45 | vr360.value.on('showTip', e => { 46 | // vr360.value!.controls.autoRotate = false 47 | const {top, left, tip} = e 48 | showTip.value = true 49 | tipLeft.value = left 50 | tipTop.value = top 51 | tipTitle.value = tip.content.title 52 | tipContent.value = tip.content.text 53 | }) 54 | 55 | vr360.value.on('hideTip', () => { 56 | // vr360.value!.controls.autoRotate = true 57 | showTip.value = false 58 | }) 59 | } else { 60 | vr360.value.updateSpacesConfig(spacesConfig.value) 61 | } 62 | } 63 | }, 64 | { 65 | immediate: true, 66 | deep: true 67 | } 68 | ) 69 | 70 | export function useVr360(options: UseVr360Options) { 71 | const createReturn = () => { 72 | return { 73 | vr360, 74 | containerRef, 75 | tipRef, 76 | spacesConfig, 77 | tipLeft, 78 | tipTop, 79 | showTip, 80 | tipTitle, 81 | tipContent 82 | } 83 | } 84 | 85 | watch( 86 | ref(options.containerEl), 87 | val => { 88 | if (val) containerRef.value = val 89 | }, 90 | { 91 | immediate: true 92 | } 93 | ) 94 | 95 | watch( 96 | ref(options.tipEl), 97 | val => { 98 | if (val) tipRef.value = val 99 | }, 100 | { 101 | immediate: true 102 | } 103 | ) 104 | 105 | watch( 106 | ref(options.spacesConfig), 107 | val => { 108 | if (val) spacesConfig.value = val 109 | }, 110 | { 111 | immediate: true, 112 | deep: true 113 | } 114 | ) 115 | 116 | return createReturn() 117 | } 118 | -------------------------------------------------------------------------------- /packages/doc/.vuepress/plugins/code-demo/CodeDemo.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 75 | 111 | -------------------------------------------------------------------------------- /.github/commit-convention.md: -------------------------------------------------------------------------------- 1 | ## Git Commit Message Convention 2 | 3 | > This is adapted from [Angular's commit convention](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular). 4 | 5 | #### TL;DR: 6 | 7 | Messages must be matched by the following regex: 8 | 9 | ```text 10 | /^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip)(\(.+\))?: .{1,50}/ 11 | ``` 12 | 13 | #### Examples 14 | 15 | Appears under "Features" header, `link` subheader: 16 | 17 | ``` 18 | feat(link): add `force` option 19 | ``` 20 | 21 | Appears under "Bug Fixes" header, `view` subheader, with a link to issue #28: 22 | 23 | ``` 24 | fix(view): handle keep-alive with aborted navigations 25 | 26 | close #28 27 | ``` 28 | 29 | Appears under "Performance Improvements" header, and under "Breaking Changes" with the breaking change explanation: 30 | 31 | ``` 32 | perf: improve guard extraction 33 | 34 | BREAKING CHANGE: The 'beforeRouteEnter' option has been removed. 35 | ``` 36 | 37 | The following commit and commit `667ecc1` do not appear in the changelog if they are under the same release. If not, the revert commit appears under the "Reverts" header. 38 | 39 | ``` 40 | revert: feat(compiler): add 'comments' option 41 | 42 | This reverts commit 667ecc1654a317a13331b17617d973392f415f02. 43 | ``` 44 | 45 | ### Full Message Format 46 | 47 | A commit message consists of a **header**, **body** and **footer**. The header has a **type**, **scope** and **subject**: 48 | 49 | ``` 50 | (): 51 | 52 | 53 | 54 |