ghostcn 1.5.0 → 1.7.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/dist/commands/create.js +10 -3
- package/dist/commands/diff.js +47 -5
- package/dist/commands/init.js +17 -8
- package/dist/commands/list.js +22 -4
- package/dist/registry/components/accordion.json +66 -0
- package/dist/registry/components/account-card.json +57 -0
- package/dist/registry/components/announcement-bar.json +79 -0
- package/dist/registry/components/archive-header.json +1 -1
- package/dist/registry/components/author-card.json +2 -2
- package/dist/registry/components/author-list.json +1 -1
- package/dist/registry/components/author-stack.json +63 -0
- package/dist/registry/components/avatar.json +62 -0
- package/dist/registry/components/back-to-top.json +72 -0
- package/dist/registry/components/breadcrumbs.json +59 -0
- package/dist/registry/components/button.json +1 -1
- package/dist/registry/components/callout.json +56 -0
- package/dist/registry/components/checkbox.json +82 -0
- package/dist/registry/components/code-copy.json +52 -0
- package/dist/registry/components/comments-section.json +56 -0
- package/dist/registry/components/dialog.json +83 -0
- package/dist/registry/components/dropdown.json +85 -0
- package/dist/registry/components/empty-state.json +65 -0
- package/dist/registry/components/error-card.json +74 -0
- package/dist/registry/components/faq-section.json +83 -0
- package/dist/registry/components/featured-posts.json +2 -2
- package/dist/registry/components/hero.json +89 -0
- package/dist/registry/components/image-lightbox.json +44 -0
- package/dist/registry/components/input.json +8 -2
- package/dist/registry/components/magazine-grid.json +62 -0
- package/dist/registry/components/member-cta.json +1 -1
- package/dist/registry/components/mobile-dock.json +69 -0
- package/dist/registry/components/newsletter-form.json +12 -3
- package/dist/registry/components/pagination.json +2 -2
- package/dist/registry/components/post-card.json +2 -2
- package/dist/registry/components/post-grid.json +2 -2
- package/dist/registry/components/post-header.json +2 -2
- package/dist/registry/components/post-list.json +62 -0
- package/dist/registry/components/pricing-table.json +24 -4
- package/dist/registry/components/pull-quote.json +70 -0
- package/dist/registry/components/radio-group.json +94 -0
- package/dist/registry/components/reader-controls.json +60 -0
- package/dist/registry/components/reading-meta.json +49 -0
- package/dist/registry/components/reading-progress.json +73 -0
- package/dist/registry/components/related-posts.json +7 -1
- package/dist/registry/components/search-trigger.json +68 -0
- package/dist/registry/components/select.json +94 -0
- package/dist/registry/components/separator.json +46 -0
- package/dist/registry/components/series-nav.json +62 -0
- package/dist/registry/components/share-buttons.json +76 -0
- package/dist/registry/components/site-footer.json +2 -2
- package/dist/registry/components/site-header.json +1 -1
- package/dist/registry/components/skeleton.json +48 -0
- package/dist/registry/components/skip-link.json +53 -0
- package/dist/registry/components/social-links.json +74 -0
- package/dist/registry/components/stat-strip.json +85 -0
- package/dist/registry/components/sticky-subscribe.json +82 -0
- package/dist/registry/components/subscribe-bar.json +61 -0
- package/dist/registry/components/switch.json +76 -0
- package/dist/registry/components/table-of-contents.json +12 -2
- package/dist/registry/components/tabs.json +81 -0
- package/dist/registry/components/tag-bar.json +63 -0
- package/dist/registry/components/tag-grid.json +1 -1
- package/dist/registry/components/tag-list.json +1 -1
- package/dist/registry/components/textarea.json +95 -0
- package/dist/registry/components/theme-toggle.json +65 -0
- package/dist/registry/components/tier-comparison.json +55 -0
- package/dist/registry/components/timeline.json +85 -0
- package/dist/registry/components/tooltip.json +65 -0
- package/dist/registry/components/visibility-badge.json +71 -0
- package/dist/registry/index.json +478 -4
- package/dist/templates/playground/index.html +2 -2
- package/dist/templates/playground/playground.css +8 -1
- package/dist/templates/playground/playground.js +39 -5
- package/dist/templates/playground/preview.css +1 -0
- package/dist/templates/theme-tools.mjs +62 -24
- package/dist/utils/component-diff.d.ts +1 -1
- package/dist/utils/component-diff.js +46 -17
- package/dist/utils/component-files.js +3 -2
- package/dist/utils/component-history.js +1 -1
- package/dist/utils/playground-server.js +40 -12
- package/dist/utils/preview-renderer.d.ts +77 -0
- package/dist/utils/preview-renderer.js +68 -8
- package/dist/utils/registry.js +15 -5
- package/dist/utils/theme-files.js +14 -7
- package/dist/utils/theme-project.js +6 -4
- package/dist/utils/theme-scaffold.js +22 -7
- package/dist/utils/theme.js +39 -32
- package/package.json +1 -1
|
@@ -15,8 +15,14 @@ exports.demoImage = editorialImage('#ded4c3', '#38362f', '<path d="M315 475V220L
|
|
|
15
15
|
const secondImage = editorialImage('#cbd1c5', '#374738', '<circle cx="600" cy="337" r="210"/><path d="M380 336h440v35H380z" fill="#f0ede1"/><circle cx="600" cy="337" r="116" fill="#aab4a1"/><path d="M573 121h54v431h-54z" fill="#677c65" opacity=".8"/>');
|
|
16
16
|
const thirdImage = editorialImage('#dbc7bb', '#6a483e', '<path d="M334 454l140-235 127 208 126-208 140 235z"/><path d="M312 485h576v40H312z" fill="#9c6956"/><circle cx="603" cy="166" r="44" fill="#f5e4cd"/>');
|
|
17
17
|
exports.demoAuthor = { name: 'Alex Reader', url: '/author/alex/', bio: 'Writing about independent publishing, thoughtful design, and building a home for your readers.', location: 'Everywhere', count: { posts: 12 } };
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const coAuthor = { name: 'Jordan Lee', url: '/author/jordan/', bio: 'Editorial design and typography for independent publications.', location: 'Remote', count: { posts: 7 } };
|
|
19
|
+
const tags = [
|
|
20
|
+
{ name: 'Publishing', slug: 'publishing', description: 'Stories about independent publishing.', url: '/tag/publishing/', visibility: 'public', count: { posts: 14 } },
|
|
21
|
+
{ name: 'Design', slug: 'design', description: 'The details that make it yours.', url: '/tag/design/', visibility: 'public', count: { posts: 9 } },
|
|
22
|
+
{ name: 'Membership', slug: 'membership', description: 'Building sustainable reader communities.', url: '/tag/membership/', visibility: 'public', count: { posts: 6 } },
|
|
23
|
+
{ name: 'Engineering', slug: 'engineering', description: 'Theme craft, CSS tokens, and performance.', url: '/tag/engineering/', visibility: 'public', count: { posts: 11 } }
|
|
24
|
+
];
|
|
25
|
+
exports.demoPost = { title: 'A home for independent ideas', url: '/a-home-for-independent-ideas/', excerpt: 'Good stories deserve a place of their own. Build a publication around your ideas, your community, and your voice.', custom_excerpt: 'Good stories deserve a place of their own.', feature_image: exports.demoImage, feature_image_alt: 'An abstract illustration of folded paper', primary_author: exports.demoAuthor, authors: [exports.demoAuthor, coAuthor], primary_tag: tags[0], tags, access: true, visibility: 'members', comments: true };
|
|
20
26
|
exports.demoPosts = [
|
|
21
27
|
exports.demoPost,
|
|
22
28
|
{ ...exports.demoPost, title: 'Make room for your readers', url: '/make-room-for-your-readers/', feature_image: secondImage, feature_image_alt: 'An abstract illustration of intersecting circles', excerpt: 'A thoughtful reading experience starts with space for the story and a clear path to what comes next.' },
|
|
@@ -32,10 +38,57 @@ exports.demoParameters = {
|
|
|
32
38
|
input: { label: 'Email address', type: 'email', name: 'email', placeholder: 'you@example.com', hint: 'We will keep your email private.', hintId: 'demo-email-hint' },
|
|
33
39
|
alert: { heading: 'You are all set', description: 'Your theme is ready to customize.' },
|
|
34
40
|
'post-grid': { heading: 'Latest stories' }, 'author-list': { heading: 'Meet the authors' }, 'tag-grid': { heading: 'Explore topics' },
|
|
35
|
-
'archive-header': { heading: 'Publishing', description: 'Ideas for a publication of your own.', eyebrow: 'Topic', archiveImage: exports.demoImage, imageAlt: 'Demo archive image' }
|
|
41
|
+
'archive-header': { heading: 'Publishing', description: 'Ideas for a publication of your own.', eyebrow: 'Topic', archiveImage: exports.demoImage, imageAlt: 'Demo archive image' },
|
|
42
|
+
avatar: { name: 'Alex Reader' },
|
|
43
|
+
accordion: { heading: 'How does membership work?', body: 'Choose a free or paid tier in Ghost Portal to unlock member-only essays and newsletters.' },
|
|
44
|
+
'theme-toggle': { ariaLabel: 'Color theme' },
|
|
45
|
+
'announcement-bar': { text: 'Issue 14 is live — read our spring editorial report.', linkText: 'Read issue', href: '/archive/' },
|
|
46
|
+
'reading-progress': { initialValue: '42' },
|
|
47
|
+
'share-buttons': { heading: 'Share' },
|
|
48
|
+
breadcrumbs: { homeLabel: 'Home' },
|
|
49
|
+
'visibility-badge': { membersLabel: 'Members only' },
|
|
50
|
+
callout: { heading: 'Editorial note', body: 'Ghost partials inherit your active accent color, border radius, and color scheme automatically.' },
|
|
51
|
+
tabs: { tab1Label: 'Overview', tab1Body: 'Add Ghost-native Handlebars partials straight to your theme with zero runtime lock-in.', tab2Label: 'Styling', tab2Body: 'Override tokens in ghostcn.css or pass call-site classes via class and slot parameters.', tab3Label: 'Members', tab3Body: 'Native Portal links and data-members-form states work out of the box.' },
|
|
52
|
+
dialog: { triggerText: 'Open dialog', heading: 'Stay in the loop', description: 'Get weekly essays and theme updates.', body: 'Press Escape or click outside to close. Powered by the native HTML <dialog> element.', actionText: 'Subscribe', dataPortal: 'signup' },
|
|
53
|
+
dropdown: { label: 'More actions', item1Label: 'Latest issues', item1Href: '/archive/', item2Label: 'About the journal', item2Href: '/about/', item3Label: 'Manage membership', item3Href: '#/portal/account' },
|
|
54
|
+
separator: { label: 'Continue reading' },
|
|
55
|
+
'empty-state': { heading: 'No stories here yet', description: 'New essays will appear here as soon as they are published.', actionText: 'Browse all stories', actionHref: '/archive/' },
|
|
56
|
+
textarea: { label: 'Your message', name: 'message', placeholder: 'Share feedback or pitch a story...', hint: 'We read every note from subscribers.', hintId: 'demo-message-hint' },
|
|
57
|
+
select: { label: 'Topic', name: 'topic', placeholder: 'Choose a topic', option1: 'Editorial & essays', option2: 'Design systems', option3: 'Membership strategy', hint: 'Filter stories by section.', hintId: 'demo-topic-hint' },
|
|
58
|
+
checkbox: { label: 'Send weekly editorial digest', description: 'One curated summary every Sunday morning. Unsubscribe anytime.', name: 'digest' },
|
|
59
|
+
hero: { eyebrow: 'Independent Publishing', heading: 'Stories worth reading slowly', description: 'Essays on design, craft, and building a lasting publication around your readers.', primaryText: 'Subscribe free', primaryPortal: 'signup', secondaryText: 'Browse archive', secondaryHref: '/archive/', coverImage: exports.demoImage, imageAlt: 'Featured publication illustration' },
|
|
60
|
+
'post-list': { heading: 'Recent dispatches' },
|
|
61
|
+
'author-stack': {},
|
|
62
|
+
'code-copy': {},
|
|
63
|
+
'image-lightbox': {},
|
|
64
|
+
'back-to-top': { label: 'Back to top', alwaysVisible: 'true' },
|
|
65
|
+
'reading-meta': {},
|
|
66
|
+
'subscribe-bar': { placeholder: 'you@example.com', buttonText: 'Subscribe' },
|
|
67
|
+
'search-trigger': { label: 'Search posts...', shortcut: '⌘K' },
|
|
68
|
+
'tier-comparison': { heading: 'Compare membership plans', description: 'Choose the level of access that fits how you read.' },
|
|
69
|
+
'social-links': { github: 'https://github.com/ghostcn', bluesky: 'https://bsky.app/profile/ghostcn.dev', email: 'hello@example.com' },
|
|
70
|
+
'tag-bar': { allLabel: 'All stories', showCounts: 'true' },
|
|
71
|
+
'series-nav': { eyebrow: 'Series', heading: 'Building an Independent Publication' },
|
|
72
|
+
'magazine-grid': { heading: 'Top stories', actionText: 'View archive', actionHref: '/archive/' },
|
|
73
|
+
'comments-section': { heading: 'Discussion', description: 'Share your perspective with fellow subscribers.' },
|
|
74
|
+
'reader-controls': { ariaLabel: 'Reading display preferences' },
|
|
75
|
+
'pull-quote': { quote: 'Independent publishing works best when the design gets out of the way and lets ideas breathe.', attribution: 'Alex Reader', role: 'Editor, Ghostcn Journal' },
|
|
76
|
+
'account-card': { heading: 'Sign in to your account', description: 'Manage your newsletter preferences, billing plan, and member-only access.' },
|
|
77
|
+
'sticky-subscribe': { heading: 'Enjoying this story?', description: 'Get new essays delivered straight to your inbox.', alwaysVisible: 'true' },
|
|
78
|
+
'faq-section': { eyebrow: 'Membership FAQ', heading: 'Frequently asked questions', description: 'Everything you need to know about free and paid subscriptions.' },
|
|
79
|
+
'stat-strip': { stat1Value: '14,200+', stat1Label: 'Active readers', stat2Value: '180+', stat2Label: 'Published issues', stat3Value: '54%', stat3Label: 'Average open rate' },
|
|
80
|
+
switch: { label: 'Weekly editorial digest', description: 'Receive one curated roundup every Sunday morning.', checked: 'true' },
|
|
81
|
+
'radio-group': { legend: 'Email cadence', option1: 'Every new post', option1Desc: 'Delivered immediately when published.', option2: 'Weekly Sunday digest', option2Desc: 'A calm single summary once a week.', option3: 'Monthly highlights', option3Desc: 'Only our flagship long-form essays.' },
|
|
82
|
+
tooltip: { label: 'Hover or focus me', content: 'Pure CSS tooltip with keyboard focus and hover support.' },
|
|
83
|
+
timeline: {},
|
|
84
|
+
skeleton: { variant: 'card' },
|
|
85
|
+
'error-card': { statusCode: '404', heading: 'Page not found', description: 'The page you are looking for may have been moved, renamed, or unpublished.' },
|
|
86
|
+
'skip-link': { label: 'Skip to main content', alwaysVisible: 'true' },
|
|
87
|
+
'mobile-dock': { alwaysVisible: 'true' }
|
|
36
88
|
};
|
|
37
89
|
function renderPreviewTemplate(partials, template, options = {}) {
|
|
38
90
|
const state = options.state || 'visitor';
|
|
91
|
+
const postContext = options.access === undefined ? exports.demoPost : { ...exports.demoPost, access: options.access };
|
|
39
92
|
const hbs = handlebars_1.default.create();
|
|
40
93
|
hbs.registerPartial(partials);
|
|
41
94
|
hbs.registerHelper('foreach', (items, opts) => {
|
|
@@ -49,13 +102,19 @@ function renderPreviewTemplate(partials, template, options = {}) {
|
|
|
49
102
|
hbs.registerHelper('get', (resource, opts) => opts.fn(resource === 'tiers' ? { tiers } : resource === 'authors' ? { authors: [exports.demoAuthor] } : resource === 'tags' ? { tags } : { posts: exports.demoPosts }, { data: opts.data }));
|
|
50
103
|
hbs.registerHelper('match', function (value, expected, opts) { return value === expected ? opts.fn(this) : opts.inverse(this); });
|
|
51
104
|
hbs.registerHelper('has', function (opts) { return String(opts.data?.index) === opts.hash.index ? opts.fn(this) : opts.inverse(this); });
|
|
52
|
-
hbs.registerHelper('post', opts => opts.fn(
|
|
105
|
+
hbs.registerHelper('post', opts => opts.fn(postContext, { data: opts.data }));
|
|
53
106
|
hbs.registerHelper('primary_author', function (opts) { return opts.fn(this.primary_author, { data: opts.data }); });
|
|
54
107
|
hbs.registerHelper('img_url', value => value);
|
|
55
|
-
hbs.registerHelper('url', function () {
|
|
108
|
+
hbs.registerHelper('url', function (opts) {
|
|
109
|
+
const pathUrl = this.url || '/a-home-for-independent-ideas/';
|
|
110
|
+
return opts?.hash?.absolute ? `https://example.com${pathUrl}` : pathUrl;
|
|
111
|
+
});
|
|
112
|
+
hbs.registerHelper('encode', value => encodeURIComponent(String(value ?? '')));
|
|
56
113
|
hbs.registerHelper('excerpt', function () { return this.excerpt; });
|
|
57
114
|
hbs.registerHelper('asset', value => `/theme-assets/${value}`);
|
|
58
115
|
hbs.registerHelper('reading_time', () => '4 min read');
|
|
116
|
+
hbs.registerHelper('comment_count', () => '4 comments');
|
|
117
|
+
hbs.registerHelper('comments', () => new hbs.SafeString('<div class="ghcn-comments-preview" role="note">Ghost native comments render here on your live publication.</div>'));
|
|
59
118
|
hbs.registerHelper('date', opts => opts.hash.format === 'YYYY' ? '2026' : opts.hash.format === 'YYYY-MM-DD' ? '2026-10-01' : '1 Oct 2026');
|
|
60
119
|
hbs.registerHelper('plural', (count, opts) => String(count === 0 ? opts.hash.empty : count === 1 ? opts.hash.singular : opts.hash.plural).replace('%', String(count)));
|
|
61
120
|
hbs.registerHelper('social_url', () => 'https://example.com');
|
|
@@ -63,9 +122,10 @@ function renderPreviewTemplate(partials, template, options = {}) {
|
|
|
63
122
|
hbs.registerHelper('navigation', () => new hbs.SafeString('<ul class="nav"><li class="nav-current"><a href="/">Home</a></li><li><a href="/about/">About</a></li><li><a href="/archive/">Archive</a></li></ul>'));
|
|
64
123
|
hbs.registerHelper('search', () => new hbs.SafeString('<button type="button" class="ghcn-icon-button ghcn-button--ghost" aria-label="Search"><svg width="20" height="20" viewBox="0 0 24 24" aria-hidden="true"><circle cx="10" cy="10" r="6" fill="none" stroke="currentColor" stroke-width="2"/><path d="m15 15 6 6" stroke="currentColor" stroke-width="2"/></svg></button>'));
|
|
65
124
|
hbs.registerHelper('price', (amount, opts) => new Intl.NumberFormat('en', { style: 'currency', currency: opts.hash.currency }).format(amount / 100));
|
|
66
|
-
const site = { title: 'Ghostcn Journal', url: '/', description: 'Independent ideas, shared with your readers.', locale: 'en', members_enabled: state !== 'disabled', paid_members_enabled: state !== 'disabled', members_invite_only: state === 'invite', allow_self_signup: !['disabled', 'invite', 'restricted'].includes(state) };
|
|
67
|
-
const data = { site, member: ['free', 'paid'].includes(state) ? { paid: state === 'paid' } : undefined };
|
|
68
|
-
|
|
125
|
+
const site = { title: 'Ghostcn Journal', url: '/', description: 'Independent ideas, shared with your readers.', locale: 'en', twitter: '@ghostcn', facebook: 'ghostcn', comments_enabled: true, members_enabled: state !== 'disabled', paid_members_enabled: state !== 'disabled' && state !== 'free-only', members_invite_only: state === 'invite', allow_self_signup: !['disabled', 'invite', 'restricted'].includes(state) };
|
|
126
|
+
const data = { site, member: ['free', 'paid'].includes(state) ? { name: 'Alex Reader', email: 'alex@example.com', paid: state === 'paid' } : undefined };
|
|
127
|
+
const context = options.context || (options.access === undefined ? exports.previewDemoContext : { ...exports.previewDemoContext, access: options.access });
|
|
128
|
+
return hbs.compile(template)(context, { data });
|
|
69
129
|
}
|
|
70
130
|
function previewInvocation(partialName, parameters) {
|
|
71
131
|
// Values are bound as data, never interpolated into executable Handlebars source.
|
package/dist/utils/registry.js
CHANGED
|
@@ -35,22 +35,32 @@ async function fetchRegistryJson(url, timeoutMs = 5000) {
|
|
|
35
35
|
controller.abort();
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
function safeRegistryBase(raw) {
|
|
39
|
+
const url = new URL(raw.trim().replace(/\/+$/, ''));
|
|
40
|
+
if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password) {
|
|
41
|
+
throw new Error('Invalid GHOST_UI_REGISTRY_URL.');
|
|
42
|
+
}
|
|
43
|
+
return url.href.replace(/\/+$/, '');
|
|
44
|
+
}
|
|
45
|
+
function isValidRegistryDir(dir) {
|
|
46
|
+
return fs_1.default.existsSync(path_1.default.join(dir, 'index.json')) && fs_1.default.statSync(path_1.default.join(dir, 'index.json')).isFile();
|
|
47
|
+
}
|
|
38
48
|
function findLocalRegistryDir() {
|
|
39
49
|
const bundledCandidates = [
|
|
40
50
|
path_1.default.join(__dirname, 'registry'),
|
|
41
51
|
path_1.default.join(__dirname, '..', 'registry')
|
|
42
52
|
];
|
|
43
53
|
for (const cand of bundledCandidates) {
|
|
44
|
-
if (
|
|
54
|
+
if (isValidRegistryDir(cand)) {
|
|
45
55
|
return cand;
|
|
46
56
|
}
|
|
47
57
|
}
|
|
48
|
-
const searchStarts = [process.cwd()
|
|
58
|
+
const searchStarts = [__dirname, process.cwd()];
|
|
49
59
|
for (const start of searchStarts) {
|
|
50
60
|
let currentDir = start;
|
|
51
61
|
while (currentDir !== path_1.default.parse(currentDir).root) {
|
|
52
62
|
const potentialPath = path_1.default.join(currentDir, 'registry');
|
|
53
|
-
if (
|
|
63
|
+
if (isValidRegistryDir(potentialPath)) {
|
|
54
64
|
return potentialPath;
|
|
55
65
|
}
|
|
56
66
|
currentDir = path_1.default.dirname(currentDir);
|
|
@@ -92,7 +102,7 @@ async function getRegistryIndex() {
|
|
|
92
102
|
// If custom registry URL explicitly configured, try remote first
|
|
93
103
|
if (process.env.GHOST_UI_REGISTRY_URL) {
|
|
94
104
|
try {
|
|
95
|
-
return await fetchRegistryJson(`${process.env.GHOST_UI_REGISTRY_URL}/index.json`);
|
|
105
|
+
return await fetchRegistryJson(`${safeRegistryBase(process.env.GHOST_UI_REGISTRY_URL)}/index.json`);
|
|
96
106
|
}
|
|
97
107
|
catch {
|
|
98
108
|
// Fallback to local
|
|
@@ -117,7 +127,7 @@ async function getComponent(componentName) {
|
|
|
117
127
|
// If custom registry URL explicitly configured, try remote first
|
|
118
128
|
if (process.env.GHOST_UI_REGISTRY_URL) {
|
|
119
129
|
try {
|
|
120
|
-
return await fetchRegistryJson(`${process.env.GHOST_UI_REGISTRY_URL}/components/${sanitized}.json`);
|
|
130
|
+
return await fetchRegistryJson(`${safeRegistryBase(process.env.GHOST_UI_REGISTRY_URL)}/components/${sanitized}.json`);
|
|
121
131
|
}
|
|
122
132
|
catch {
|
|
123
133
|
// Fallback to local
|
|
@@ -53,9 +53,9 @@ function syncGhostcnScripts(themeRoot, scriptsDir) {
|
|
|
53
53
|
const templatePath = safeThemePath(themeRoot, 'default.hbs');
|
|
54
54
|
const directory = safeThemePath(themeRoot, scriptsDir);
|
|
55
55
|
const assetPaths = fs_1.default.existsSync(directory) ? fs_1.default.readdirSync(directory, { withFileTypes: true })
|
|
56
|
-
.filter(entry => entry.isFile() && entry.name.endsWith('.js'))
|
|
56
|
+
.filter(entry => entry.isFile() && entry.name.toLowerCase().endsWith('.js'))
|
|
57
57
|
.map(entry => toGhostAssetPath(path_1.default.relative(themeRoot, path_1.default.join(directory, entry.name))))
|
|
58
|
-
.sort() : [];
|
|
58
|
+
.sort((a, b) => a.localeCompare(b)) : [];
|
|
59
59
|
if (!fs_1.default.existsSync(templatePath))
|
|
60
60
|
return { status: 'missing-template', templatePath, assetPaths };
|
|
61
61
|
if (!assetPaths.length)
|
|
@@ -64,12 +64,17 @@ function syncGhostcnScripts(themeRoot, scriptsDir) {
|
|
|
64
64
|
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
65
65
|
const start = '{{!-- ghostcn:scripts:start --}}', end = '{{!-- ghostcn:scripts:end --}}';
|
|
66
66
|
const block = [start, ...assetPaths.map(asset => `<script defer src="{{asset "${asset}"}}"></script>`), end].join(newline);
|
|
67
|
-
let updated = original.replace(
|
|
67
|
+
let updated = original.replace(/^[ \t]*\{\{!-- ghostcn:scripts:start --\}\}[\s\S]*?\{\{!-- ghostcn:scripts:end --\}\}[ \t]*(?:\r?\n)?/gm, '');
|
|
68
68
|
// Preserve unrelated host scripts; deduplicate only these owned asset URLs.
|
|
69
|
-
updated = updated.replace(
|
|
69
|
+
updated = updated.replace(/^[ \t]*<script\b[^>]*\bsrc=["'][^"']*\{\{asset\s+["']([^"']+)["']\}\}[^>]*>\s*<\/script>[ \t]*(?:\r?\n)?/gim, (tag, asset) => assetPaths.includes(asset) ? '' : tag);
|
|
70
70
|
if (!/<\/body\s*>/i.test(updated))
|
|
71
71
|
return { status: 'missing-template', templatePath, assetPaths };
|
|
72
|
-
|
|
72
|
+
if (/^[ \t]*<\/body\s*>/im.test(updated)) {
|
|
73
|
+
updated = updated.replace(/^([ \t]*)<\/body\s*>/im, (_match, indent) => `${indentBlock(block, indent, newline)}${newline}${indent}</body>`);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
updated = updated.replace(/<\/body\s*>/i, `${newline}${block}${newline}</body>`);
|
|
77
|
+
}
|
|
73
78
|
if (updated !== original)
|
|
74
79
|
fs_1.default.writeFileSync(templatePath, updated, 'utf8');
|
|
75
80
|
return { status: updated === original ? 'unchanged' : 'updated', templatePath, assetPaths };
|
|
@@ -100,12 +105,14 @@ function syncGhostcnStyles(options) {
|
|
|
100
105
|
const templatePath = safeThemePath(options.themeRoot, 'default.hbs');
|
|
101
106
|
const cssPath = safeThemePath(options.themeRoot, options.cssFile);
|
|
102
107
|
const stylesDirPath = safeThemePath(options.themeRoot, options.stylesDir);
|
|
103
|
-
const
|
|
108
|
+
const rootAsset = toGhostAssetPath(options.cssFile);
|
|
109
|
+
const assetPaths = [rootAsset];
|
|
104
110
|
if (fs_1.default.existsSync(stylesDirPath)) {
|
|
105
111
|
const componentStyles = fs_1.default
|
|
106
112
|
.readdirSync(stylesDirPath, { withFileTypes: true })
|
|
107
113
|
.filter(entry => entry.isFile() && entry.name.toLowerCase().endsWith('.css'))
|
|
108
114
|
.map(entry => toGhostAssetPath(path_1.default.relative(options.themeRoot, path_1.default.join(stylesDirPath, entry.name))))
|
|
115
|
+
.filter(assetPath => assetPath !== rootAsset)
|
|
109
116
|
.sort((a, b) => a.localeCompare(b));
|
|
110
117
|
assetPaths.push(...componentStyles);
|
|
111
118
|
}
|
|
@@ -118,7 +125,7 @@ function syncGhostcnStyles(options) {
|
|
|
118
125
|
const original = fs_1.default.readFileSync(templatePath, 'utf8');
|
|
119
126
|
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
120
127
|
const block = stylesheetBlock(assetPaths, newline);
|
|
121
|
-
const managedBlockPattern = new RegExp(`^[ \\t]*${STYLES_START.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?${STYLES_END.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[ \\t]*(?:\\r?\\n)?`, '
|
|
128
|
+
const managedBlockPattern = new RegExp(`^[ \\t]*${STYLES_START.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?${STYLES_END.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[ \\t]*(?:\\r?\\n)?`, 'gm');
|
|
122
129
|
const withoutManagedBlock = original.replace(managedBlockPattern, '');
|
|
123
130
|
const withoutOwnedLinks = removeOwnedStylesheetLinks(withoutManagedBlock, assetPaths);
|
|
124
131
|
const ghostHeadPattern = /^([ \t]*)\{\{ghost_head\}\}/m;
|
|
@@ -13,7 +13,7 @@ const styles_1 = require("./styles");
|
|
|
13
13
|
function buildGhostcnConfig(theme, paths = {}) {
|
|
14
14
|
const normalized = (value, fallback) => value?.trim().replace(/\\/g, '/') || fallback;
|
|
15
15
|
return {
|
|
16
|
-
$schema: 'https://ghostcn.
|
|
16
|
+
$schema: 'https://ghostcn.geekbits.dev/schema.json',
|
|
17
17
|
style: theme.style,
|
|
18
18
|
theme: {
|
|
19
19
|
baseColor: theme.baseColor,
|
|
@@ -29,13 +29,15 @@ function buildGhostcnConfig(theme, paths = {}) {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
function initializeThemeProject(options) {
|
|
32
|
-
const configPath = (0, theme_files_1.
|
|
33
|
-
const cssPath = (0, theme_files_1.
|
|
32
|
+
const configPath = (0, theme_files_1.safeThemePath)(options.themeRoot, 'components.json');
|
|
33
|
+
const cssPath = (0, theme_files_1.safeThemePath)(options.themeRoot, options.config.cssFile);
|
|
34
34
|
fs_1.default.mkdirSync(path_1.default.dirname(cssPath), { recursive: true });
|
|
35
35
|
fs_1.default.writeFileSync(configPath, JSON.stringify(options.config, null, 2) + '\n', 'utf8');
|
|
36
36
|
fs_1.default.writeFileSync(cssPath, (0, theme_1.generateThemeCss)({ style: options.config.style, ...options.config.theme }), 'utf8');
|
|
37
37
|
if (options.config.style === 'tailwind') {
|
|
38
|
-
|
|
38
|
+
const tailwindRelative = path_1.default.posix.join(path_1.default.posix.dirname(options.config.cssFile.replace(/\\/g, '/')), 'ghostcn-tailwind.css');
|
|
39
|
+
const tailwindPath = (0, theme_files_1.safeThemePath)(options.themeRoot, tailwindRelative);
|
|
40
|
+
fs_1.default.writeFileSync(tailwindPath, (0, styles_1.tailwindTheme)(), 'utf8');
|
|
39
41
|
}
|
|
40
42
|
const styleSync = (0, theme_files_1.syncGhostcnStyles)({
|
|
41
43
|
themeRoot: options.themeRoot,
|
|
@@ -47,7 +47,7 @@ img { max-width: 100%; }
|
|
|
47
47
|
Match the embedded document's native scheme so dark mode does not force a white canvas. */
|
|
48
48
|
iframe[title="comments-frame"] { color-scheme: normal; }
|
|
49
49
|
h1, h2, h3, h4, h5, h6 { font-family: var(--gh-font-heading, inherit); }
|
|
50
|
-
.ghcn-main { min-height: 65vh; }
|
|
50
|
+
.ghcn-main { min-height: 65vh; overflow-x: clip; }
|
|
51
51
|
.ghcn-page-heading { width: min(100% - 32px, 1152px); margin: var(--ghcn-section-space) auto var(--ghcn-section-gap); }
|
|
52
52
|
.ghcn-page-heading h1 { margin: 0; font-size: var(--ghcn-title-display); line-height: 1.08; letter-spacing: -.045em; overflow-wrap: anywhere; text-wrap: balance; }
|
|
53
53
|
.ghcn-page-heading p { max-width: 42rem; margin: 1rem 0 0; color: var(--muted-foreground); font-size: 1.125rem; }
|
|
@@ -61,9 +61,13 @@ h1, h2, h3, h4, h5, h6 { font-family: var(--gh-font-heading, inherit); }
|
|
|
61
61
|
.ghcn-article-content .kg-width-wide { width: min(72rem, 100vw - 2rem); max-width: none; margin-left: 50%; transform: translateX(-50%); }
|
|
62
62
|
.ghcn-article-content .kg-width-full { width: 100vw; max-width: none; margin-left: 50%; transform: translateX(-50%); }
|
|
63
63
|
.ghcn-empty { width: min(100% - 2rem, 42rem); margin: 4rem auto; padding: 3rem; border: 1px dashed var(--border); border-radius: min(var(--radius), 1rem); color: var(--muted-foreground); text-align: center; }
|
|
64
|
+
.ghcn-error { width: min(100% - 2rem, 38rem); margin: 5rem auto; text-align: center; }
|
|
65
|
+
.ghcn-error__code { margin: 0; color: var(--muted-foreground); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
|
|
66
|
+
.ghcn-error__title { margin: 0.75rem 0 0; font-size: var(--ghcn-title-display); line-height: 1.1; letter-spacing: -0.04em; }
|
|
67
|
+
.ghcn-error__message { margin: 1rem auto 1.75rem; color: var(--muted-foreground); max-width: 30rem; }
|
|
64
68
|
`;
|
|
65
69
|
}
|
|
66
|
-
function defaultTemplate(
|
|
70
|
+
function defaultTemplate() {
|
|
67
71
|
return `<!DOCTYPE html>
|
|
68
72
|
<html lang="{{@site.locale}}"{{#match @custom.color_scheme "Dark"}} class="dark-mode"{{else match @custom.color_scheme "Auto"}} class="auto-color"{{/match}}>
|
|
69
73
|
<head>
|
|
@@ -150,6 +154,17 @@ ${header}
|
|
|
150
154
|
{{pagination}}
|
|
151
155
|
`;
|
|
152
156
|
}
|
|
157
|
+
function errorTemplate() {
|
|
158
|
+
return `{{!< default}}
|
|
159
|
+
|
|
160
|
+
<section class="ghcn-error">
|
|
161
|
+
<p class="ghcn-error__code">{{statusCode}}</p>
|
|
162
|
+
<h1 class="ghcn-error__title">{{message}}</h1>
|
|
163
|
+
<p class="ghcn-error__message">The page you are looking for may have moved or no longer exists.</p>
|
|
164
|
+
<a class="ghcn-button" href="{{@site.url}}">Back to {{@site.title}}</a>
|
|
165
|
+
</section>
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
153
168
|
function packageJson(options) {
|
|
154
169
|
const gscanCommand = {
|
|
155
170
|
npm: 'npx --yes gscan@6.4.2 .',
|
|
@@ -157,24 +172,23 @@ function packageJson(options) {
|
|
|
157
172
|
yarn: 'yarn dlx gscan@6.4.2 .',
|
|
158
173
|
bun: 'bunx gscan@6.4.2 .'
|
|
159
174
|
};
|
|
175
|
+
const zipScript = `${options.packageManager} run build && node ./scripts/zip.mjs`;
|
|
160
176
|
const scripts = options.style === 'tailwind'
|
|
161
177
|
? {
|
|
162
178
|
dev: 'tailwindcss -i ./assets/css/source.css -o ./assets/built/screen.css --watch',
|
|
163
179
|
build: 'tailwindcss -i ./assets/css/source.css -o ./assets/built/screen.css --minify',
|
|
164
180
|
test: 'node ./scripts/check.mjs',
|
|
165
|
-
zip:
|
|
181
|
+
zip: zipScript,
|
|
166
182
|
validate: gscanCommand[options.packageManager]
|
|
167
183
|
}
|
|
168
184
|
: {
|
|
169
185
|
dev: 'node ./scripts/dev.mjs',
|
|
170
186
|
build: 'node ./scripts/build.mjs',
|
|
171
187
|
test: 'node ./scripts/check.mjs',
|
|
172
|
-
zip:
|
|
188
|
+
zip: zipScript,
|
|
173
189
|
validate: gscanCommand[options.packageManager]
|
|
174
190
|
};
|
|
175
191
|
const devDependencies = {};
|
|
176
|
-
// Use the selected package manager for the build preceding archive creation.
|
|
177
|
-
scripts.zip = `${options.packageManager} run build && node ./scripts/zip.mjs`;
|
|
178
192
|
if (options.style === 'tailwind') {
|
|
179
193
|
devDependencies.tailwindcss = '^4.1.0';
|
|
180
194
|
devDependencies['@tailwindcss/cli'] = '^4.1.0';
|
|
@@ -294,13 +308,14 @@ function scaffoldTheme(options) {
|
|
|
294
308
|
: css;
|
|
295
309
|
const files = {
|
|
296
310
|
'package.json': packageJson({ ...options, themeName }),
|
|
297
|
-
'default.hbs': defaultTemplate(
|
|
311
|
+
'default.hbs': defaultTemplate(),
|
|
298
312
|
'index.hbs': indexTemplate(options),
|
|
299
313
|
'post.hbs': postTemplate(options),
|
|
300
314
|
'partials/content-cta.hbs': '{{{html}}}\n{{> "components/member-cta"}}\n',
|
|
301
315
|
'page.hbs': pageTemplate(),
|
|
302
316
|
'tag.hbs': archiveTemplate('tag'),
|
|
303
317
|
'author.hbs': archiveTemplate('author'),
|
|
318
|
+
'error.hbs': errorTemplate(),
|
|
304
319
|
'assets/css/source.css': sourceCss,
|
|
305
320
|
'assets/built/screen.css': css,
|
|
306
321
|
'scripts/check.mjs': "import { fileURLToPath } from 'node:url';\nimport { reportTheme } from './theme-tools.mjs';\nif (!reportTheme(fileURLToPath(new URL('../', import.meta.url)))) process.exitCode = 1;\n",
|
package/dist/utils/theme.js
CHANGED
|
@@ -62,8 +62,8 @@ exports.BASE_PALETTES = {
|
|
|
62
62
|
mutedForeground: '#71717a',
|
|
63
63
|
accent: '#f4f4f5',
|
|
64
64
|
accentForeground: '#18181b',
|
|
65
|
-
destructive: '#
|
|
66
|
-
destructiveForeground: '#
|
|
65
|
+
destructive: '#dc2626',
|
|
66
|
+
destructiveForeground: '#ffffff',
|
|
67
67
|
border: '#e4e4e7',
|
|
68
68
|
input: '#e4e4e7',
|
|
69
69
|
ring: '#18181b'
|
|
@@ -81,8 +81,8 @@ exports.BASE_PALETTES = {
|
|
|
81
81
|
mutedForeground: '#a1a1aa',
|
|
82
82
|
accent: '#27272a',
|
|
83
83
|
accentForeground: '#fafafa',
|
|
84
|
-
destructive: '#
|
|
85
|
-
destructiveForeground: '#
|
|
84
|
+
destructive: '#f87171',
|
|
85
|
+
destructiveForeground: '#450a0a',
|
|
86
86
|
border: '#27272a',
|
|
87
87
|
input: '#27272a',
|
|
88
88
|
ring: '#d4d4d8'
|
|
@@ -102,8 +102,8 @@ exports.BASE_PALETTES = {
|
|
|
102
102
|
mutedForeground: '#64748b',
|
|
103
103
|
accent: '#f1f5f9',
|
|
104
104
|
accentForeground: '#0f172a',
|
|
105
|
-
destructive: '#
|
|
106
|
-
destructiveForeground: '#
|
|
105
|
+
destructive: '#dc2626',
|
|
106
|
+
destructiveForeground: '#ffffff',
|
|
107
107
|
border: '#e2e8f0',
|
|
108
108
|
input: '#e2e8f0',
|
|
109
109
|
ring: '#0f172a'
|
|
@@ -121,8 +121,8 @@ exports.BASE_PALETTES = {
|
|
|
121
121
|
mutedForeground: '#94a3b8',
|
|
122
122
|
accent: '#1e293b',
|
|
123
123
|
accentForeground: '#f8fafc',
|
|
124
|
-
destructive: '#
|
|
125
|
-
destructiveForeground: '#
|
|
124
|
+
destructive: '#f87171',
|
|
125
|
+
destructiveForeground: '#450a0a',
|
|
126
126
|
border: '#1e293b',
|
|
127
127
|
input: '#1e293b',
|
|
128
128
|
ring: '#cbd5e1'
|
|
@@ -142,8 +142,8 @@ exports.BASE_PALETTES = {
|
|
|
142
142
|
mutedForeground: '#78716c',
|
|
143
143
|
accent: '#f5f5f4',
|
|
144
144
|
accentForeground: '#1c1917',
|
|
145
|
-
destructive: '#
|
|
146
|
-
destructiveForeground: '#
|
|
145
|
+
destructive: '#dc2626',
|
|
146
|
+
destructiveForeground: '#ffffff',
|
|
147
147
|
border: '#e7e5e4',
|
|
148
148
|
input: '#e7e5e4',
|
|
149
149
|
ring: '#1c1917'
|
|
@@ -161,8 +161,8 @@ exports.BASE_PALETTES = {
|
|
|
161
161
|
mutedForeground: '#a8a29e',
|
|
162
162
|
accent: '#292524',
|
|
163
163
|
accentForeground: '#fafaf9',
|
|
164
|
-
destructive: '#
|
|
165
|
-
destructiveForeground: '#
|
|
164
|
+
destructive: '#f87171',
|
|
165
|
+
destructiveForeground: '#450a0a',
|
|
166
166
|
border: '#292524',
|
|
167
167
|
input: '#292524',
|
|
168
168
|
ring: '#d6d3d1'
|
|
@@ -182,8 +182,8 @@ exports.BASE_PALETTES = {
|
|
|
182
182
|
mutedForeground: '#6b7280',
|
|
183
183
|
accent: '#f3f4f6',
|
|
184
184
|
accentForeground: '#1f2937',
|
|
185
|
-
destructive: '#
|
|
186
|
-
destructiveForeground: '#
|
|
185
|
+
destructive: '#dc2626',
|
|
186
|
+
destructiveForeground: '#ffffff',
|
|
187
187
|
border: '#e5e7eb',
|
|
188
188
|
input: '#e5e7eb',
|
|
189
189
|
ring: '#1f2937'
|
|
@@ -201,8 +201,8 @@ exports.BASE_PALETTES = {
|
|
|
201
201
|
mutedForeground: '#9ca3af',
|
|
202
202
|
accent: '#1f2937',
|
|
203
203
|
accentForeground: '#f9fafb',
|
|
204
|
-
destructive: '#
|
|
205
|
-
destructiveForeground: '#
|
|
204
|
+
destructive: '#f87171',
|
|
205
|
+
destructiveForeground: '#450a0a',
|
|
206
206
|
border: '#1f2937',
|
|
207
207
|
input: '#1f2937',
|
|
208
208
|
ring: '#d1d5db'
|
|
@@ -222,8 +222,8 @@ exports.BASE_PALETTES = {
|
|
|
222
222
|
mutedForeground: '#737373',
|
|
223
223
|
accent: '#f5f5f5',
|
|
224
224
|
accentForeground: '#171717',
|
|
225
|
-
destructive: '#
|
|
226
|
-
destructiveForeground: '#
|
|
225
|
+
destructive: '#dc2626',
|
|
226
|
+
destructiveForeground: '#ffffff',
|
|
227
227
|
border: '#e5e5e5',
|
|
228
228
|
input: '#e5e5e5',
|
|
229
229
|
ring: '#171717'
|
|
@@ -241,8 +241,8 @@ exports.BASE_PALETTES = {
|
|
|
241
241
|
mutedForeground: '#a3a3a3',
|
|
242
242
|
accent: '#262626',
|
|
243
243
|
accentForeground: '#fafafa',
|
|
244
|
-
destructive: '#
|
|
245
|
-
destructiveForeground: '#
|
|
244
|
+
destructive: '#f87171',
|
|
245
|
+
destructiveForeground: '#450a0a',
|
|
246
246
|
border: '#262626',
|
|
247
247
|
input: '#262626',
|
|
248
248
|
ring: '#d4d4d4'
|
|
@@ -261,9 +261,9 @@ exports.ACCENT_COLORS = {
|
|
|
261
261
|
ring: 'var(--ghost-accent-color, #18181b)'
|
|
262
262
|
},
|
|
263
263
|
dark: {
|
|
264
|
-
primary: 'var(--ghost-accent-color, #
|
|
265
|
-
primaryForeground: '#
|
|
266
|
-
ring: 'var(--ghost-accent-color, #
|
|
264
|
+
primary: 'var(--ghost-accent-color, #4f46e5)',
|
|
265
|
+
primaryForeground: '#ffffff',
|
|
266
|
+
ring: 'var(--ghost-accent-color, #a5b4fc)'
|
|
267
267
|
}
|
|
268
268
|
},
|
|
269
269
|
zinc: {
|
|
@@ -272,27 +272,27 @@ exports.ACCENT_COLORS = {
|
|
|
272
272
|
},
|
|
273
273
|
indigo: {
|
|
274
274
|
light: { primary: '#4f46e5', primaryForeground: '#ffffff', ring: '#4f46e5' },
|
|
275
|
-
dark: { primary: '#
|
|
275
|
+
dark: { primary: '#818cf8', primaryForeground: '#1e1b4b', ring: '#818cf8' }
|
|
276
276
|
},
|
|
277
277
|
violet: {
|
|
278
278
|
light: { primary: '#7c3aed', primaryForeground: '#ffffff', ring: '#7c3aed' },
|
|
279
|
-
dark: { primary: '#
|
|
279
|
+
dark: { primary: '#a78bfa', primaryForeground: '#1e1b4b', ring: '#a78bfa' }
|
|
280
280
|
},
|
|
281
281
|
blue: {
|
|
282
282
|
light: { primary: '#2563eb', primaryForeground: '#ffffff', ring: '#2563eb' },
|
|
283
|
-
dark: { primary: '#
|
|
283
|
+
dark: { primary: '#60a5fa', primaryForeground: '#0f172a', ring: '#60a5fa' }
|
|
284
284
|
},
|
|
285
285
|
emerald: {
|
|
286
|
-
light: { primary: '#
|
|
287
|
-
dark: { primary: '#
|
|
286
|
+
light: { primary: '#047857', primaryForeground: '#ffffff', ring: '#047857' },
|
|
287
|
+
dark: { primary: '#34d399', primaryForeground: '#022c22', ring: '#34d399' }
|
|
288
288
|
},
|
|
289
289
|
rose: {
|
|
290
|
-
light: { primary: '#
|
|
291
|
-
dark: { primary: '#
|
|
290
|
+
light: { primary: '#be123c', primaryForeground: '#ffffff', ring: '#be123c' },
|
|
291
|
+
dark: { primary: '#fb7185', primaryForeground: '#4c0519', ring: '#fb7185' }
|
|
292
292
|
},
|
|
293
293
|
orange: {
|
|
294
|
-
light: { primary: '#
|
|
295
|
-
dark: { primary: '#
|
|
294
|
+
light: { primary: '#c2410c', primaryForeground: '#ffffff', ring: '#c2410c' },
|
|
295
|
+
dark: { primary: '#fb923c', primaryForeground: '#431407', ring: '#fb923c' }
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
298
|
function generateThemeCss(config) {
|
|
@@ -317,6 +317,8 @@ function generateThemeCss(config) {
|
|
|
317
317
|
--accent-foreground: ${base.dark.accentForeground};
|
|
318
318
|
--destructive: ${base.dark.destructive};
|
|
319
319
|
--destructive-foreground: ${base.dark.destructiveForeground};
|
|
320
|
+
--success: #4ade80;
|
|
321
|
+
--success-foreground: #052e16;
|
|
320
322
|
--border: ${base.dark.border};
|
|
321
323
|
--input: ${base.dark.input};
|
|
322
324
|
--ring: ${accent.dark.ring || base.dark.ring};`;
|
|
@@ -343,6 +345,8 @@ function generateThemeCss(config) {
|
|
|
343
345
|
--accent-foreground: ${base.light.accentForeground};
|
|
344
346
|
--destructive: ${base.light.destructive};
|
|
345
347
|
--destructive-foreground: ${base.light.destructiveForeground};
|
|
348
|
+
--success: #15803d;
|
|
349
|
+
--success-foreground: #ffffff;
|
|
346
350
|
--border: ${base.light.border};
|
|
347
351
|
--input: ${base.light.input};
|
|
348
352
|
--ring: ${accent.light.ring || base.light.ring};
|
|
@@ -476,6 +480,9 @@ ${Object.entries(design_defaults_json_1.default).map(([name, value]) => ` --ghc
|
|
|
476
480
|
white-space: nowrap;
|
|
477
481
|
border: 0;
|
|
478
482
|
}
|
|
483
|
+
@media (prefers-reduced-motion: reduce) {
|
|
484
|
+
.ghcn-button, .ghcn-icon-button { transition: none; }
|
|
485
|
+
}
|
|
479
486
|
`;
|
|
480
487
|
return (0, styles_1.componentCss)(css, config.style);
|
|
481
488
|
}
|