Skip to content

Commit dc06c2e

Browse files
committed
Merge v2-local: add global state, preview action, and selective rendering
2 parents 8eaaefa + acb782e commit dc06c2e

File tree

81 files changed

+7955
-927
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+7955
-927
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"andreiio/blade-remix-icon": "^3.6",
2828
"blade-ui-kit/blade-heroicons": "^2.4",
2929
"blade-ui-kit/blade-icons": "^1.7",
30-
"craftile/laravel": "^0.3.1",
30+
"craftile/laravel": "^0.4.0",
3131
"illuminate/contracts": "^10.0||^11.0",
3232
"mallardduck/blade-lucide-icons": "^1.23",
3333
"matthieumastadenis/couleur": "^0.1.2",

docs/.vitepress/config.ts

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { defineConfig } from 'vitepress';
22
import tabsPlugin from '@red-asuka/vitepress-plugin-tabs';
33
import llmstxt from 'vitepress-plugin-llms';
4+
import { genFeed } from './genFeed';
5+
import { getVersion } from './version';
6+
7+
const version = getVersion();
48

59
// https://vitepress.dev/reference/site-config
610
export default defineConfig({
@@ -14,8 +18,22 @@ export default defineConfig({
1418
nav: [
1519
{ text: 'Guide', link: '/introduction/getting-started' },
1620
{ text: 'Theme Editor', link: '/theme-editor/overview' },
21+
{ text: 'Blog', link: '/blog/' },
1722
{ text: 'Demo', link: 'https://visual-debut-demo.bagistoplus.com' },
1823
{ text: 'Sections Pack', link: 'https://bagistosectionspro.com/?ref=doc' },
24+
{
25+
text: version,
26+
items: [
27+
{
28+
text: 'v1 Docs',
29+
link: 'https://visual-v1.bagistoplus.com',
30+
},
31+
{
32+
text: 'Changelog',
33+
link: 'https://github.com/bagistoplus/visual/blob/main/CHANGELOG.md',
34+
},
35+
],
36+
},
1937
// { text: 'GitHub', link: 'https://github.com/bagistoplus/visual' },
2038
],
2139

@@ -40,20 +58,26 @@ export default defineConfig({
4058
collapsed: true,
4159
items: [
4260
{ text: 'Overview', link: '/core-concepts/templates/overview' },
43-
{ text: 'JSON Template', link: '/core-concepts/templates/json-template' },
61+
{ text: 'JSON & YAML', link: '/core-concepts/templates/json-yaml' },
62+
{ text: 'PHP Templates', link: '/core-concepts/templates/php-templates' },
4463
{ text: 'Available templates', link: '/core-concepts/templates/available' },
4564
],
4665
},
4766
{ text: 'Sections', link: '/core-concepts/sections' },
67+
{ text: 'Regions', link: '/core-concepts/regions' },
68+
{ text: 'Blocks', link: '/core-concepts/blocks' },
69+
{ text: 'Presets', link: '/core-concepts/presets' },
4870
{
4971
text: 'Settings',
5072
collapsed: true,
5173
items: [
5274
{ text: 'Overview', link: '/core-concepts/settings/overview' },
5375
{ text: 'Setting types', link: '/core-concepts/settings/types' },
5476
{ text: 'Theme settings', link: '/core-concepts/settings/theme-settings' },
77+
{ text: 'Conditional visibility', link: '/core-concepts/settings/conditional-visibility' },
5578
],
5679
},
80+
{ text: 'Dynamic Sources', link: '/core-concepts/dynamic-sources' },
5781
],
5882
},
5983
{
@@ -69,23 +93,30 @@ export default defineConfig({
6993
{ text: 'Overview', link: '/building-theme/adding-sections/overview' },
7094
{ text: 'Creating a section', link: '/building-theme/adding-sections/creating-section' },
7195
{ text: 'Section attributes', link: '/building-theme/adding-sections/section-attributes' },
72-
{
73-
text: 'Defining settings and blocks',
74-
link: '/building-theme/adding-sections/defining-section-schema',
75-
},
7696
{ text: 'Writing the section view', link: '/building-theme/adding-sections/writing-section-view' },
7797
{
7898
text: 'Using section in templates',
7999
link: '/building-theme/adding-sections/using-section',
80100
},
81-
{ text: 'Integrating with the editor', link: '/building-theme/adding-sections/integrating-editor' },
101+
],
102+
},
103+
{
104+
text: 'Adding Blocks',
105+
collapsed: true,
106+
items: [
107+
{ text: 'Overview', link: '/building-theme/adding-blocks/overview' },
108+
{ text: 'Creating a block', link: '/building-theme/adding-blocks/creating-block' },
109+
{ text: 'Block schema', link: '/building-theme/adding-blocks/block-schema' },
110+
{ text: 'Static blocks', link: '/building-theme/adding-blocks/static-blocks' },
111+
{ text: 'Container blocks', link: '/building-theme/adding-blocks/container-blocks' },
82112
],
83113
},
84114
{
85115
text: 'Best practices',
86116
collapsed: true,
87117
items: [
88118
{ text: 'Overview', link: '/building-theme/best-practices/overview' },
119+
{ text: 'Integrating with the editor', link: '/building-theme/best-practices/integrating-editor' },
89120
{ text: 'Styling and Color System', link: '/building-theme/best-practices/styling' },
90121
{ text: 'Accessibility', link: '/building-theme/best-practices/accessibility' },
91122
{ text: 'Performance', link: '/building-theme/best-practices/performance' },
@@ -153,4 +184,6 @@ export default defineConfig({
153184
sitemap: {
154185
hostname: 'https://visual.bagistoplus.com',
155186
},
187+
188+
buildEnd: genFeed,
156189
});

docs/.vitepress/genFeed.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import path from 'path';
2+
import { writeFileSync } from 'fs';
3+
import { Feed } from 'feed';
4+
import { createContentLoader, type SiteConfig } from 'vitepress';
5+
6+
const baseUrl = 'https://visual.bagistoplus.com';
7+
8+
export async function genFeed(config: SiteConfig) {
9+
const feed = new Feed({
10+
title: 'Bagisto Visual Blog',
11+
description: 'Updates, tutorials, and insights from the Bagisto Visual team',
12+
id: baseUrl,
13+
link: baseUrl,
14+
language: 'en',
15+
image: `${baseUrl}/bagistoplus-visual-logo.png`,
16+
favicon: `${baseUrl}/favicon.ico`,
17+
copyright: 'Copyright © 2025 BagistoPlus',
18+
});
19+
20+
const posts = await createContentLoader('blog/*.md', {
21+
excerpt: true,
22+
render: true,
23+
}).load();
24+
25+
posts.sort((a, b) => +new Date(b.frontmatter.date) - +new Date(a.frontmatter.date));
26+
27+
for (const { url, excerpt, frontmatter, html } of posts) {
28+
feed.addItem({
29+
title: frontmatter.title,
30+
id: `${baseUrl}${url}`,
31+
link: `${baseUrl}${url}`,
32+
description: excerpt,
33+
content: html,
34+
author: [
35+
{
36+
name: frontmatter.author,
37+
link: frontmatter.twitter ? `https://twitter.com/${frontmatter.twitter.replace('@', '')}` : undefined,
38+
},
39+
],
40+
date: new Date(frontmatter.date),
41+
});
42+
}
43+
44+
writeFileSync(path.join(config.outDir, 'feed.rss'), feed.rss2());
45+
}

docs/.vitepress/theme/Layout.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
<script setup>
2-
import DefaultTheme from "vitepress/theme";
2+
import DefaultTheme from "vitepress/theme";
3+
import { useData, useRoute } from 'vitepress';
4+
import { computed } from 'vue';
5+
import BlogHome from './components/BlogHome.vue';
6+
import BlogPost from './components/BlogPost.vue';
7+
8+
const { frontmatter } = useData();
9+
const route = useRoute();
10+
11+
const isBlogPost = computed(() => route.path.startsWith('/blog/') && route.path !== '/blog/');
12+
const isLandingPage = computed(() => frontmatter.value.pageClass === 'landing');
313
</script>
414

515
<template>
6-
<DefaultTheme.Layout>
7-
<template #home-hero-image>
16+
<BlogHome v-if="frontmatter.layout === 'blog'" />
17+
<BlogPost v-else-if="isBlogPost" />
18+
<DefaultTheme.Layout v-else :class="frontmatter.pageClass">
19+
<template v-if="!isLandingPage" #home-hero-image>
820
<iframe
921
class="video"
1022
src="https://www.youtube.com/embed/fB7ik1hOWMc?loop=1&playlist=fB7ik1hOWMc&start=7&modestbranding=1&showinfo=0&rel=0"
@@ -14,6 +26,9 @@
1426
allowfullscreen
1527
></iframe>
1628
</template>
29+
<template #layout-top>
30+
<slot name="layout-top" />
31+
</template>
1732
</DefaultTheme.Layout>
1833
</template>
1934

docs/.vitepress/theme/blog.data.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { createContentLoader } from 'vitepress';
2+
3+
export interface Post {
4+
title: string;
5+
url: string;
6+
date: {
7+
time: number;
8+
string: string;
9+
};
10+
excerpt: string | undefined;
11+
author: string;
12+
gravatar?: string;
13+
twitter?: string;
14+
}
15+
16+
declare const data: Post[];
17+
export { data };
18+
19+
function formatDate(raw: string): Post['date'] {
20+
const date = new Date(raw);
21+
date.setUTCHours(12);
22+
return {
23+
time: +date,
24+
string: date.toLocaleDateString('en-US', {
25+
year: 'numeric',
26+
month: 'long',
27+
day: 'numeric',
28+
}),
29+
};
30+
}
31+
32+
export default createContentLoader('blog/*.md', {
33+
excerpt: true,
34+
transform(raw): Post[] {
35+
return raw
36+
.filter(({ url }) => url !== '/blog/')
37+
.map(({ url, frontmatter, excerpt }) => ({
38+
title: frontmatter.title,
39+
url,
40+
excerpt: frontmatter.excerpt || excerpt,
41+
date: formatDate(frontmatter.date),
42+
author: frontmatter.author,
43+
gravatar: frontmatter.gravatar,
44+
twitter: frontmatter.twitter,
45+
}))
46+
.sort((a, b) => b.date.time - a.date.time);
47+
},
48+
});

0 commit comments

Comments
 (0)