contents-popup-redtombo 1.1.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/module.cjs +21 -0
- package/dist/module.d.cts +5 -0
- package/dist/module.d.mts +5 -0
- package/dist/module.d.ts +5 -0
- package/dist/module.mjs +18 -0
- package/package.json +25 -12
- package/components/componentPopup.vue +0 -46
- package/components/componentPopup2.vue +0 -69
- package/components/componentPopup3.vue +0 -24
- package/composables/usePopup.ts +0 -67
- package/module.ts +0 -14
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
すべての重要な変更はこのファイルに記録されます。
|
|
3
|
+
|
|
4
|
+
## [1.3.0] - 2025-10-10
|
|
5
|
+
### 修正 (Fixed)
|
|
6
|
+
- `unbuild` を導入し、**dist配布**に変更。
|
|
7
|
+
- `nuxt` の対応範囲を `^3.0.0 || ^4.0.0` に拡張。
|
|
8
|
+
- `module.ts` を ESM 形式に修正(`createResolver(import.meta.url)` を使用)。
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## [1.2.0] - 2024-01-22
|
|
13
|
+
### 変更 (Changed)
|
|
14
|
+
- componentPopupコンポーネントに渡すクリックイベントの指定を省略可能にしました。
|
|
15
|
+
- ボタンに名前を付けられる機能を追加しました。
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## [1.1.0] - 2024-01-21
|
|
20
|
+
### 変更 (Changed)
|
|
21
|
+
- パッケージの説明を追加。
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## [1.0.0] - 2024-01-21
|
|
26
|
+
### 初回リリース (Initial Release)
|
|
27
|
+
- プロジェクト初回リリース。
|
|
28
|
+
- ポップアップを提供。
|
package/dist/module.cjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const kit = require('nuxt/kit');
|
|
4
|
+
|
|
5
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
6
|
+
const module$1 = kit.defineNuxtModule({
|
|
7
|
+
meta: {
|
|
8
|
+
name: "contents-popup-redtombo",
|
|
9
|
+
compatibility: { nuxt: "^3.0.0 || ^4.0.0" }
|
|
10
|
+
},
|
|
11
|
+
setup(_options, _nuxt) {
|
|
12
|
+
const { resolve } = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('module.cjs', document.baseURI).href)));
|
|
13
|
+
kit.addComponentsDir({
|
|
14
|
+
path: resolve("./components"),
|
|
15
|
+
pathPrefix: false
|
|
16
|
+
});
|
|
17
|
+
kit.addImportsDir(resolve("./composables"));
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
module.exports = module$1;
|
package/dist/module.d.ts
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from 'nuxt/kit';
|
|
2
|
+
|
|
3
|
+
const module = defineNuxtModule({
|
|
4
|
+
meta: {
|
|
5
|
+
name: "contents-popup-redtombo",
|
|
6
|
+
compatibility: { nuxt: "^3.0.0 || ^4.0.0" }
|
|
7
|
+
},
|
|
8
|
+
setup(_options, _nuxt) {
|
|
9
|
+
const { resolve } = createResolver(import.meta.url);
|
|
10
|
+
addComponentsDir({
|
|
11
|
+
path: resolve("./components"),
|
|
12
|
+
pathPrefix: false
|
|
13
|
+
});
|
|
14
|
+
addImportsDir(resolve("./composables"));
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { module as default };
|
package/package.json
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contents-popup-redtombo",
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "ポップアップの中のComponentsを動的に切り替えることができるポップアップ",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/module.mjs",
|
|
9
|
+
"require": "./dist/module.cjs",
|
|
10
|
+
"types": "./dist/module.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"CHANGELOG.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "unbuild",
|
|
20
|
+
"prepublishOnly": "pnpm build"
|
|
21
|
+
},
|
|
9
22
|
"peerDependencies": {
|
|
10
23
|
"bootstrap": "^5.0.0",
|
|
11
|
-
"nuxt": "^3.0.0"
|
|
24
|
+
"nuxt": "^3.0.0 || ^4.0.0"
|
|
12
25
|
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"nuxt": "4",
|
|
28
|
+
"typescript": "^5.9.3",
|
|
29
|
+
"unbuild": "^2.0.0"
|
|
30
|
+
}
|
|
18
31
|
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { toRefs, watch } from "vue";
|
|
3
|
-
import { usePopup } from "../composables/usePopup";
|
|
4
|
-
import type { Component } from "vue";
|
|
5
|
-
|
|
6
|
-
const { state, openPopup, changePopup, initPopup } = usePopup();
|
|
7
|
-
const { popupVisible } = toRefs(state);
|
|
8
|
-
|
|
9
|
-
// プロパティ定義と取得
|
|
10
|
-
const props = defineProps<{
|
|
11
|
-
buttonName: string;
|
|
12
|
-
component: string;
|
|
13
|
-
componentList: Record<string, Component>;
|
|
14
|
-
click?: (variable?: any) => void;
|
|
15
|
-
}>();
|
|
16
|
-
|
|
17
|
-
// 必要な props をリアクティブに扱うため分割代入
|
|
18
|
-
const { component, componentList } = toRefs(props);
|
|
19
|
-
|
|
20
|
-
// 初期化処理
|
|
21
|
-
initPopup(componentList.value);
|
|
22
|
-
|
|
23
|
-
// `component` が変更された場合にポップアップを開く
|
|
24
|
-
watch(
|
|
25
|
-
component, // 監視対象としてリアクティブな `component` を指定
|
|
26
|
-
(newComponent: string) => {
|
|
27
|
-
changePopup(newComponent); // ポップアップを変更する
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
function handleClick() {
|
|
32
|
-
// 親コンポーネントの関数が存在するなら、
|
|
33
|
-
// 親コンポーネントの関数を呼び出す。
|
|
34
|
-
if(props.click){
|
|
35
|
-
props.click();
|
|
36
|
-
}
|
|
37
|
-
openPopup(props.component)
|
|
38
|
-
}
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<template>
|
|
42
|
-
<div>
|
|
43
|
-
<button @click="handleClick();" class="btn btn-primary">{{ props.buttonName }}</button>
|
|
44
|
-
<componentPopup2 v-if="popupVisible" />
|
|
45
|
-
</div>
|
|
46
|
-
</template>
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { toRefs } from "vue";
|
|
3
|
-
import { usePopup } from "../composables/usePopup";
|
|
4
|
-
|
|
5
|
-
import PopupContents from "./componentPopup3.vue";
|
|
6
|
-
const { state } = usePopup();
|
|
7
|
-
const { componentErrorMessage } = toRefs(state);
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<Teleport to="body">
|
|
12
|
-
<div
|
|
13
|
-
class="modal show fade d-flex align-items-center justify-content-center"
|
|
14
|
-
tabindex="-1"
|
|
15
|
-
style="display: block"
|
|
16
|
-
>
|
|
17
|
-
<div class="modal-dialog custom-size" @click.stop>
|
|
18
|
-
<div
|
|
19
|
-
class="modal-content p-3"
|
|
20
|
-
:class="{ 'modal-danger': componentErrorMessage }"
|
|
21
|
-
>
|
|
22
|
-
<div class="modal-body">
|
|
23
|
-
<!-- エラーメッセージ表示 -->
|
|
24
|
-
<p
|
|
25
|
-
v-if="componentErrorMessage"
|
|
26
|
-
class="text-danger"
|
|
27
|
-
>
|
|
28
|
-
エラーが発生しました<br/>
|
|
29
|
-
{{ componentErrorMessage }}
|
|
30
|
-
</p>
|
|
31
|
-
<componentPopup3 v-else/>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
</Teleport>
|
|
37
|
-
</template>
|
|
38
|
-
|
|
39
|
-
<style scoped>
|
|
40
|
-
.modal.show {
|
|
41
|
-
background: rgba(0, 0, 0, 0.5);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.modal-content {
|
|
45
|
-
border-radius: 8px;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.custom-size {
|
|
49
|
-
width: 1080px !important; /* 任意の幅を指定 */
|
|
50
|
-
max-width: none !important; /* 最大幅の制限を解除 */
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.modal.show {
|
|
54
|
-
display: flex !important; /* Flexbox有効 */
|
|
55
|
-
align-items: center !important; /* 縦中央揃え */
|
|
56
|
-
justify-content: center !important; /* 横中央揃え */
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.modal-danger {
|
|
60
|
-
background-color: var(
|
|
61
|
-
--bs-danger-bg-subtle,
|
|
62
|
-
#f8d7da
|
|
63
|
-
); /* Bootstrapのalert-dangerの背景色 */
|
|
64
|
-
color: var(
|
|
65
|
-
--bs-danger-text,
|
|
66
|
-
#842029
|
|
67
|
-
); /* Bootstrapのalert-dangerのテキスト色 */
|
|
68
|
-
}
|
|
69
|
-
</style>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { toRefs } from "vue";
|
|
3
|
-
import { usePopup } from "../composables/usePopup";
|
|
4
|
-
|
|
5
|
-
// EditSongを登録
|
|
6
|
-
const { state, closePopup } = usePopup();
|
|
7
|
-
const { isLoading,currentComponent } = toRefs(state);
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<div class="d-flex justify-content-end mb-4">
|
|
12
|
-
<button @click="closePopup()" class="btn btn-close" type="button"></button>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<!-- currentComponentでコンポーネントの表示を切り替える。 -->
|
|
16
|
-
<p v-show="isLoading" class="text-center text-primary">
|
|
17
|
-
データ取得中...
|
|
18
|
-
</p>
|
|
19
|
-
<div v-show="!isLoading">
|
|
20
|
-
<div>
|
|
21
|
-
<component :is="currentComponent" />
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
package/composables/usePopup.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { reactive, markRaw } from "vue";
|
|
2
|
-
import type { Component } from "vue";
|
|
3
|
-
|
|
4
|
-
interface State {
|
|
5
|
-
componentErrorMessage: string; // コンポーネントエラーメッセージ
|
|
6
|
-
popupVisible: boolean; // ポップアップが表示中かどうか
|
|
7
|
-
isLoading: boolean; // ローディング中かどうか
|
|
8
|
-
currentComponent: Component | null; // 現在のコンポーネント
|
|
9
|
-
componentList: Record<string, Component>; // 使用可能なコンポーネントのリスト
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// グローバルな状態管理
|
|
13
|
-
const state = reactive<State>({
|
|
14
|
-
componentErrorMessage: "",
|
|
15
|
-
popupVisible: false,
|
|
16
|
-
isLoading: true,
|
|
17
|
-
currentComponent: null,
|
|
18
|
-
componentList: {},
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// `usePopup` composable 関数
|
|
22
|
-
export function usePopup() {
|
|
23
|
-
// ポップアップの初期化
|
|
24
|
-
function initPopup(componentList: Record<string, Component>): void {
|
|
25
|
-
state.componentList = Object.fromEntries(
|
|
26
|
-
Object.entries(componentList).map(([key, component]) => [key, markRaw(component)])
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// ポップアップを開く関数
|
|
31
|
-
function openPopup(component: string): void {
|
|
32
|
-
state.popupVisible = true;
|
|
33
|
-
|
|
34
|
-
changePopup(component);
|
|
35
|
-
|
|
36
|
-
state.isLoading = false; // ローディングを終了
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// 指定されたコンポーネントをセットする関数
|
|
40
|
-
function changePopup(component: string): void {
|
|
41
|
-
if (component in state.componentList) {
|
|
42
|
-
state.currentComponent = markRaw(state.componentList[component]);
|
|
43
|
-
state.componentErrorMessage = ""; // エラーメッセージをリセット
|
|
44
|
-
} else {
|
|
45
|
-
const errorMessage = `選択されたコンポーネントが無効です: ${component}`;
|
|
46
|
-
console.error(errorMessage);
|
|
47
|
-
state.componentErrorMessage = errorMessage;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// ポップアップを閉じる関数
|
|
52
|
-
function closePopup(): void {
|
|
53
|
-
state.currentComponent = null; // 現在のコンポーネントをリセット
|
|
54
|
-
state.componentErrorMessage = ""; // エラーメッセージをリセット
|
|
55
|
-
|
|
56
|
-
state.popupVisible = false;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// 必要なものを返却
|
|
60
|
-
return {
|
|
61
|
-
state,
|
|
62
|
-
initPopup,
|
|
63
|
-
openPopup,
|
|
64
|
-
closePopup,
|
|
65
|
-
changePopup,
|
|
66
|
-
};
|
|
67
|
-
}
|
package/module.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { defineNuxtModule } from '@nuxt/kit'
|
|
2
|
-
import { resolve } from 'path'
|
|
3
|
-
|
|
4
|
-
export default defineNuxtModule({
|
|
5
|
-
setup(_, nuxt) {
|
|
6
|
-
// コンポーネントディレクトリを追加
|
|
7
|
-
nuxt.hook('components:dirs', (dirs) => {
|
|
8
|
-
dirs.push({
|
|
9
|
-
path: resolve(__dirname, 'components'), // モジュール内のコンポーネントを登録
|
|
10
|
-
pathPrefix: false,
|
|
11
|
-
})
|
|
12
|
-
})
|
|
13
|
-
},
|
|
14
|
-
})
|