Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #6 support vue2 / optional API #7

Merged
merged 44 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e046ffe
fix: composable の構成を変更 (optional api サポートと vue2 向け)
Sep 27, 2023
61271da
fix: 微修正
Sep 27, 2023
5f8c99a
fix: 微調整
Sep 27, 2023
79f4b79
fix: 微調整
Sep 27, 2023
2bb68f7
fix: 微調整
Sep 27, 2023
a76c136
fix: 微調整
Sep 27, 2023
8ec9a6b
update: dependencies
Sep 28, 2023
fb1c861
fix: structure
Sep 28, 2023
d0a7e7b
fix: support vue2, vue-router4
Sep 28, 2023
0f49e04
chore: ついで
Sep 28, 2023
3edce01
fix: script
mew-ton Sep 29, 2023
583af90
fix: nuxt 配下の playground を移設
Sep 30, 2023
02ed023
feat: [wip] 一旦 enclosure-nuxt で nuxt2 向けのビルドができるところまでは対応
Oct 1, 2023
9e56486
fix: 構成変更
Oct 2, 2023
ce8cb86
fix: vue2 の playground を頑張って作ってみたけど、 packages 周りでしんどくなったところまで
Oct 3, 2023
425f1c9
fix: monorepo の分離
Oct 3, 2023
e7d8351
fix: 構造変更と型安全にならない問題の対応
Oct 3, 2023
0af7ce6
feat: add example vue2.6
Oct 3, 2023
855fb4f
feat: example/insider-vue2* 以外は動いた
Oct 5, 2023
a9830da
WIP
Oct 5, 2023
2ca9e74
fix: example でデバッグしながらライブラリの出力をきれいにした
Oct 8, 2023
0606c70
fix: enclosure-vue 2.7 で iframe に src が反映されない問題の対応
Oct 8, 2023
3d75aef
fix: example の細かい対応漏れの修正
Oct 8, 2023
e244d20
fix: テスト用コンポーネントの更新と、見つかった細かい不具合の修正
Oct 9, 2023
e874080
fix: layout 取得のテスト vue3 はできたが・・ vue2.7 x optionalがまだ
Oct 12, 2023
46f874a
test: add typecheck test
Oct 14, 2023
eff1c24
fix: update yarn.lock
Oct 14, 2023
6c328fe
fix: update yarn.lock
Oct 14, 2023
d188162
fix: failed actions
mew-ton Oct 16, 2023
e1077ff
fix: failed actions
mew-ton Oct 16, 2023
81fb93a
fix: failed actions
mew-ton Oct 16, 2023
7d3d790
fix: failed actions
mew-ton Oct 16, 2023
33f8b4a
fix: failed actions
mew-ton Oct 16, 2023
eaea415
fix: failed actions
mew-ton Oct 16, 2023
2738066
fix: failed actions
Oct 16, 2023
4186770
fix: failed actions
Oct 16, 2023
07cf154
fix: failed typecheck
mew-ton Oct 18, 2023
96c7977
fix: types
mew-ton Oct 18, 2023
590d21a
fix: types
mew-ton Oct 18, 2023
34d9e8b
update misc
Oct 22, 2023
289cd60
fix: failed tests
Oct 22, 2023
57e0d13
fix: syntax error
Oct 22, 2023
e265b79
fix: min
Oct 22, 2023
d315419
versioning
Oct 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
!.vscode/*.code-workspace

# Intellij idea
*.iml
.idea

# OSX
.DS_Store
.AppleDouble
.LSOverride
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


# Logs
logs
*.log
Expand Down Expand Up @@ -123,10 +147,15 @@ dist
.vscode-test

# yarn v2
examples/*/.yarn
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# turborepo
.turbo

# vite timestamp
vite.config.ts.timestamp-*
35 changes: 20 additions & 15 deletions .vscode/project.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"name": "#root"
},
{
"path": "../docs",
"name": "#documentation"
"path": "./_n",
"name": "___PACKAGES___"
},
{
"path": "../packages/enclosure-vue",
Expand All @@ -17,28 +17,32 @@
"name": "@passerelle/insider-vue"
},
{
"path": "../packages/enclosure-nuxt",
"name": "@passerelle/enclosure-nuxt"
"path": "./_e",
"name": "___EXAMPLES___"
},
{
"path": "../packages/insider-nuxt",
"name": "@passerelle/insider-nuxt"
"path": "../examples/enclosure-vue2",
"name": "#example/enclosure-vue2"
},
{
"path": "../packages/insider-nuxt",
"name": "@passerelle/insider-nuxt"
"path": "../examples/enclosure-vue3",
"name": "#example/enclosure-vue3"
},
{
"path": "../fixtures/playground-enclosure",
"name": "#fixtures/playground-enclosure"
"path": "../examples/insider-vue2",
"name": "#example/insider-vue2"
},
{
"path": "../fixtures/playground-insider",
"name": "#fixtures/playground-insider"
"path": "../examples/insider-vue3",
"name": "#example/insider-vue3"
},
{
"path": "../fixtures/playground-vue-components",
"name": "#fixtures/playground-vue-components"
"path": "./_f",
"name": "___FIXTURES___"
},
{
"path": "../fixtures/vue-components",
"name": "#fixtures/vue-components"
}
],
"settings": {
Expand All @@ -57,7 +61,8 @@
"editor.rulers": [150],
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"liveServer.settings.multiRootWorkspaceName": "#root"
},
"extensions": {
"recommendations": [
Expand Down
3 changes: 3 additions & 0 deletions examples/enclosure-vue2/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
nodeLinker: node-modules
yarnPath: ../../.yarn/releases/yarn-3.6.3.cjs
15 changes: 15 additions & 0 deletions examples/enclosure-vue2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app">
<App />
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions examples/enclosure-vue2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "example-enclosure-vue2",
"private": true,
"type": "module",
"scripts": {
"dev": "vite . --port 5173",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@passerelle/enclosure-vue": "file:../../packages/enclosure-vue",
"@vue/composition-api": "^1.7.2",
"fixtures-vue-components": "file:../../fixtures/vue-components",
"vite": "^4.3.0",
"vite-plugin-vue2": "^2.0.3",
"vue": "^2.7.14",
"vue-router": "^3.6.5"
}
}
35 changes: 35 additions & 0 deletions examples/enclosure-vue2/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<script lang="ts">
mew-ton marked this conversation as resolved.
Show resolved Hide resolved
import { defineComponent } from 'vue'
import { RouterView } from 'vue-router'
import Header from './components/Header.vue'
import Playground from 'fixture-vue-component'

export default defineComponent({
name: 'App',
components: {
Header,
Playground,
RouterView
}
})
</script>

<template>
<div>
<section>
<Header />
<Playground mode="enclosure" />
</section>

<section>
<RouterView />
</section>
</div>
</template>

<style scoped>
section {
line-height: 1.5;
height: 95vh;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
<script lang="ts">
mew-ton marked this conversation as resolved.
Show resolved Hide resolved
import { defineComponent } from 'vue'
import { RouterLink } from 'vue-router'

export default defineComponent({
name: 'Header',
components: {
RouterLink
}
})
</script>

<template>
<header>
<img
Expand All @@ -8,13 +20,13 @@
height="125" />

<div class="wrapper">
<h1>@passerelle/enclosure-nuxt</h1>
<h1>enclosure vue2</h1>

<nav>
<nuxt-link to="/">Home</nuxt-link>
<nuxt-link to="/bridge/about">About</nuxt-link>
<nuxt-link to="/bridge/works">Works</nuxt-link>
<nuxt-link to="/bridge/contact">Contact</nuxt-link>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/bridge/about">About</RouterLink>
<RouterLink to="/bridge/works">Works</RouterLink>
<RouterLink to="/bridge/contact">Contact</RouterLink>
</nav>
</div>
</header>
Expand Down
17 changes: 17 additions & 0 deletions examples/enclosure-vue2/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import './assets/css/main.css'

// import Vue from 'vue/dist/vue.esm'
import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
import router from './router'

Vue.use(VueRouter)

new Vue({
el: '#app',
router,
render(h) {
return h(App)
}
})
21 changes: 21 additions & 0 deletions examples/enclosure-vue2/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import BridgeView from '../views/BridgeView.vue'

const router = new VueRouter({
// history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: "/",
name: "home",
component: HomeView
},
{
path: '/bridge/:pathMatch(.*)*',
name: 'bridge',
component: BridgeView
}
]
})

export default router
66 changes: 66 additions & 0 deletions examples/enclosure-vue2/src/views/BridgeView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<script lang="ts">
mew-ton marked this conversation as resolved.
Show resolved Hide resolved
import { defineComponent, onMounted, ref } from 'vue'
import { useRoute } from 'vue-router/composables'
import {
type ParentToChild,
type ChildToParent,
BridgeFrame
} from '@passerelle/enclosure-vue'

export default defineComponent({
components: {
BridgeFrame
},
setup() {
const route = useRoute()

const defaultPath = `http://localhost:5174${extractChildPath(route.path)}`

function extractChildPath(path: string): string {
const [, matchedPath] = /^\/bridge(\/.*?)$/.exec(path) ?? []
if (!matchedPath) {
throw new Error(`invalid path: ${path}`)
}
return matchedPath
}

const parentToChild: ParentToChild = (location) => {
return extractChildPath(location.path)
}

const childToParent: ChildToParent = ({ path, params }) => {
return { path: `/bridge${path}`, params }
}

const bridge = ref()

onMounted(() => {
// デバッグのためにわざと window を介してルートに communicator を公開している
;(window as any).getCommunicator = () => bridge.value.getCommunicator()
})
return {
defaultPath,
parentToChild,
childToParent,
bridge
}
}
})
</script>

<template>
<BridgeFrame
class="frame"
ref="bridge"
communicate-key="passerelle-playground"
:initial-src="defaultPath"
:to-child-path="parentToChild"
:to-parent-path="childToParent"
required-collab />
</template>

<style scoped>
.frame {
border: 1px solid var(--color-border);
}
</style>
5 changes: 5 additions & 0 deletions examples/enclosure-vue2/src/views/HomeView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
empty
</div>
mew-ton marked this conversation as resolved.
Show resolved Hide resolved
</template>
8 changes: 8 additions & 0 deletions examples/enclosure-vue2/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": ["../../tsconfig.json"],
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}
17 changes: 17 additions & 0 deletions examples/enclosure-vue2/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import { createVuePlugin } from 'vite-plugin-vue2'

export default defineConfig({
mode: 'development',
base: '/',
plugins: [
createVuePlugin()
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})
Loading