@tower_74/cms-app 0.2.0 → 0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tower_74/cms-app",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Front-end app shell for the Base CMS — Inertia/Vue pages, layouts, components and composables. Ships source; consumed by client sites as a versioned dependency (ADR-0023) and overridable per site.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@inertiajs/vue3": "^2.0.0-beta.3",
29
- "@tower_74/cms-ui": "^0.12.0",
29
+ "@tower_74/cms-ui": "^0.13.0",
30
30
  "@vueuse/core": "^12.0.0",
31
31
  "laravel-vite-plugin": "^1.0",
32
32
  "lucide-vue-next": "^0.468.0",
package/src/index.ts CHANGED
@@ -4,9 +4,9 @@ import { cmsPages } from './pages';
4
4
  import { pluginPages } from './plugins';
5
5
 
6
6
  export { initializeTheme } from './composables/useAppearance';
7
- export { cmsPages };
8
7
  export { pluginBlocks, pluginIcons, registerCmsPlugins } from './plugins';
9
8
  export type { CmsPlugin } from './plugins';
9
+ export { cmsPages };
10
10
 
11
11
  type PageGlob = Record<string, () => Promise<unknown>>;
12
12
 
@@ -29,6 +29,7 @@ import {
29
29
  ListOrdered,
30
30
  Menu,
31
31
  Paintbrush,
32
+ Puzzle,
32
33
  Settings,
33
34
  ShoppingBag,
34
35
  Tag,
@@ -60,6 +61,7 @@ const nav: NavItem[] = [
60
61
  { label: 'Theme', href: '/admin/appearance/theme', icon: Paintbrush, permission: 'theme' },
61
62
  { label: 'Widgets', href: '/admin/appearance/widgets', icon: LayoutGrid, permission: 'widgets' },
62
63
  { label: 'Settings', href: '/admin/settings', icon: Settings, permission: 'settings' },
64
+ { label: 'Plugins', href: '/admin/plugins', icon: Puzzle, permission: 'plugins' },
63
65
  ];
64
66
 
65
67
  const page = usePage();
@@ -79,8 +81,7 @@ const can = computed(() => (page.props.auth as { can?: Record<string, boolean> }
79
81
  // `adminNav` with a lucide icon *name* the plugin's front end resolves (fallback: Box).
80
82
  const pluginNav = computed<NavItem[]>(() => {
81
83
  const icons = pluginIcons();
82
- const items =
83
- (page.props.adminNav as Array<{ label: string; href: string; icon: string | null; permission: string | null }> | undefined) ?? [];
84
+ const items = (page.props.adminNav as Array<{ label: string; href: string; icon: string | null; permission: string | null }> | undefined) ?? [];
84
85
 
85
86
  return items.map((item) => ({
86
87
  label: item.label,
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import AuthBar from '@/components/AuthBar.vue';
3
+ import { pluginBlocks } from '@/plugins';
3
4
  import { type Block, BlockRenderer } from '@tower_74/cms-ui';
4
5
  import { computed } from 'vue';
5
6
 
@@ -46,7 +47,7 @@ const showName = computed(() => !props.site.logo || props.site.showName);
46
47
  </main>
47
48
 
48
49
  <footer class="border-t border-border bg-surface">
49
- <BlockRenderer v-if="footerWidgets.length" :blocks="footerWidgets" />
50
+ <BlockRenderer v-if="footerWidgets.length" :blocks="footerWidgets" :components="pluginBlocks()" />
50
51
  <div class="mx-auto max-w-6xl px-4 py-6 text-sm text-muted sm:px-6">© {{ year }} {{ site.name }}</div>
51
52
  </footer>
52
53
  </div>
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { pluginBlocks } from '@/plugins';
2
3
  import { Link } from '@inertiajs/vue3';
3
4
  import { type Block, Button, LandingPageTemplate } from '@tower_74/cms-ui';
4
5
 
@@ -19,7 +20,7 @@ defineProps<{
19
20
  </Link>
20
21
  </div>
21
22
 
22
- <LandingPageTemplate v-if="blocks.length" :blocks="blocks" />
23
+ <LandingPageTemplate v-if="blocks.length" :blocks="blocks" :components="pluginBlocks()" />
23
24
  <p v-else class="px-4 py-20 text-center text-muted">This page has no blocks yet. Add some in the editor.</p>
24
25
  </div>
25
26
  </template>
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts">
2
+ import AdminLayout from '@/layouts/AdminLayout.vue';
3
+ import { router } from '@inertiajs/vue3';
4
+
5
+ defineProps<{
6
+ plugins: Array<{ key: string; name: string; version: string; enabled: boolean }>;
7
+ }>();
8
+
9
+ // Enabling/disabling persists via the PluginRegistry; the redirect back reflects the new
10
+ // state (a plugin's capabilities are gated on enable at boot — ADR-0026).
11
+ const toggle = (plugin: { key: string; enabled: boolean }) => {
12
+ router.post(`/admin/plugins/${plugin.key}/${plugin.enabled ? 'disable' : 'enable'}`, {}, { preserveScroll: true });
13
+ };
14
+ </script>
15
+
16
+ <template>
17
+ <AdminLayout>
18
+ <div class="p-6">
19
+ <h1 class="text-2xl font-semibold">Plugins</h1>
20
+ <p class="mt-1 text-sm text-muted">
21
+ Enable or disable installed plugins. New plugins become available by installing their package; manage them here.
22
+ </p>
23
+
24
+ <div v-if="plugins.length" class="mt-6 divide-y divide-border overflow-hidden rounded-lg border border-border">
25
+ <div v-for="plugin in plugins" :key="plugin.key" class="flex items-center justify-between gap-4 p-4">
26
+ <div>
27
+ <div class="font-medium">{{ plugin.name }}</div>
28
+ <div class="text-xs text-muted">{{ plugin.key }} · v{{ plugin.version }}</div>
29
+ </div>
30
+ <button
31
+ type="button"
32
+ class="rounded-md px-3 py-1.5 text-sm font-medium transition"
33
+ :class="
34
+ plugin.enabled
35
+ ? 'bg-accent text-accent-foreground hover:bg-accent/80'
36
+ : 'bg-primary text-primary-foreground hover:opacity-90'
37
+ "
38
+ @click="toggle(plugin)"
39
+ >
40
+ {{ plugin.enabled ? 'Disable' : 'Enable' }}
41
+ </button>
42
+ </div>
43
+ </div>
44
+
45
+ <p v-else class="mt-6 text-sm text-muted">No plugins installed. Install a plugin package to manage it here.</p>
46
+ </div>
47
+ </AdminLayout>
48
+ </template>
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import Seo from '@/components/Seo.vue';
3
3
  import PublicLayout from '@/layouts/PublicLayout.vue';
4
+ import { pluginBlocks } from '@/plugins';
4
5
  import { router } from '@inertiajs/vue3';
5
6
  import { type Block, BlockRenderer, ProductOverview } from '@tower_74/cms-ui';
6
7
 
@@ -41,6 +42,6 @@ const addToCart = (payload: { variantId: number | string; quantity: number }) =>
41
42
  @add-to-cart="addToCart"
42
43
  />
43
44
 
44
- <BlockRenderer v-if="product.blocks.length" :blocks="product.blocks" />
45
+ <BlockRenderer v-if="product.blocks.length" :blocks="product.blocks" :components="pluginBlocks()" />
45
46
  </PublicLayout>
46
47
  </template>
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import Seo from '@/components/Seo.vue';
3
3
  import PublicLayout from '@/layouts/PublicLayout.vue';
4
+ import { pluginBlocks } from '@/plugins';
4
5
  import { type Block, DetailPageTemplate, LandingPageTemplate } from '@tower_74/cms-ui';
5
6
 
6
7
  defineProps<{
@@ -29,13 +30,13 @@ defineProps<{
29
30
  <div v-if="page.showTitle" class="mx-auto max-w-6xl px-4 pb-2 pt-10 sm:px-6">
30
31
  <h1 class="text-3xl font-bold tracking-tight text-text">{{ page.title }}</h1>
31
32
  </div>
32
- <LandingPageTemplate :blocks="page.blocks" />
33
+ <LandingPageTemplate :blocks="page.blocks" :components="pluginBlocks()" />
33
34
  </template>
34
35
  <template v-else>
35
36
  <div v-if="page.featuredImage" class="mx-auto max-w-3xl px-4 pt-8 sm:px-6">
36
37
  <img :src="page.featuredImage.src" :alt="page.featuredImage.alt ?? ''" class="w-full rounded-lg object-cover" />
37
38
  </div>
38
- <DetailPageTemplate :header="page.header" :blocks="page.blocks" />
39
+ <DetailPageTemplate :header="page.header" :blocks="page.blocks" :components="pluginBlocks()" />
39
40
  </template>
40
41
  </PublicLayout>
41
42
  </template>