ghostcn 1.1.0 → 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/README.md +225 -3
- package/dist/commands/add.d.ts +6 -1
- package/dist/commands/add.js +121 -83
- package/dist/commands/create.js +8 -1
- package/dist/commands/diff.d.ts +5 -0
- package/dist/commands/diff.js +54 -0
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/doctor.js +7 -0
- package/dist/commands/init.js +5 -0
- package/dist/commands/pack.d.ts +1 -0
- package/dist/commands/pack.js +8 -0
- package/dist/commands/playground.d.ts +3 -0
- package/dist/commands/playground.js +29 -0
- package/dist/index.js +20 -2
- package/dist/registry/components/alert.json +62 -0
- package/dist/registry/components/archive-header.json +57 -0
- package/dist/registry/components/author-card.json +23 -2
- package/dist/registry/components/author-list.json +55 -0
- package/dist/registry/components/badge.json +51 -0
- package/dist/registry/components/button.json +74 -0
- package/dist/registry/components/card.json +70 -0
- package/dist/registry/components/featured-posts.json +18 -1
- package/dist/registry/components/input.json +94 -0
- package/dist/registry/components/member-cta.json +15 -1
- package/dist/registry/components/newsletter-form.json +23 -2
- package/dist/registry/components/pagination.json +12 -1
- package/dist/registry/components/post-card.json +25 -2
- package/dist/registry/components/post-grid.json +54 -0
- package/dist/registry/components/post-header.json +18 -1
- package/dist/registry/components/post-navigation.json +41 -0
- package/dist/registry/components/pricing-table.json +34 -5
- package/dist/registry/components/related-posts.json +53 -0
- package/dist/registry/components/site-footer.json +15 -1
- package/dist/registry/components/site-header.json +17 -2
- package/dist/registry/components/table-of-contents.json +47 -0
- package/dist/registry/components/tag-grid.json +64 -0
- package/dist/registry/components/tag-list.json +38 -0
- package/dist/registry/index.json +131 -0
- package/dist/templates/playground/index.html +5 -0
- package/dist/templates/playground/playground.css +18 -0
- package/dist/templates/playground/playground.js +71 -0
- package/dist/templates/playground/preview.css +5 -0
- package/dist/templates/playground/preview.js +12 -0
- package/dist/templates/theme-tools.mjs +178 -0
- package/dist/utils/component-diff.d.ts +18 -0
- package/dist/utils/component-diff.js +93 -0
- package/dist/utils/component-files.d.ts +9 -0
- package/dist/utils/component-files.js +48 -0
- package/dist/utils/component-history.d.ts +11 -0
- package/dist/utils/component-history.js +47 -0
- package/dist/utils/component-installer.d.ts +2 -0
- package/dist/utils/component-installer.js +34 -36
- package/dist/utils/component-plan.d.ts +7 -0
- package/dist/utils/component-plan.js +43 -0
- package/dist/utils/playground-server.d.ts +9 -0
- package/dist/utils/playground-server.js +189 -0
- package/dist/utils/preview-renderer.d.ts +143 -0
- package/dist/utils/preview-renderer.js +70 -0
- package/dist/utils/registry.d.ts +7 -0
- package/dist/utils/registry.js +12 -18
- package/dist/utils/styles.d.ts +3 -0
- package/dist/utils/styles.js +20 -0
- package/dist/utils/theme-files.d.ts +2 -0
- package/dist/utils/theme-files.js +46 -4
- package/dist/utils/theme-project.js +9 -4
- package/dist/utils/theme-scaffold.js +61 -24
- package/dist/utils/theme-tooling.d.ts +2 -0
- package/dist/utils/theme-tooling.js +20 -0
- package/dist/utils/theme.js +4 -2
- package/package.json +6 -4
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"name": "site-footer.hbs",
|
|
10
10
|
"type": "partial",
|
|
11
11
|
"target": "partials/components/site-footer.hbs",
|
|
12
|
-
"content": "{{!-- Component: Site Footer | Usage: {{> \"components/site-footer\"}} --}}\n<footer class=\"ghcn-footer\">\n <div class=\"ghcn-footer__inner ghcn-container\">\n <div class=\"ghcn-footer__brand\">\n <a href=\"{{@site.url}}\">{{@site.title}}</a>\n {{#if @site.description}}<p>{{@site.description}}</p>{{/if}}\n </div>\n <nav class=\"ghcn-footer__nav\" aria-label=\"Footer navigation\">{{navigation type=\"secondary\"}}</nav>\n <div class=\"ghcn-footer__social\">\n {{#if @site.facebook}}<a href=\"{{social_url type=\"facebook\"}}\" target=\"_blank\" rel=\"noopener\">Facebook</a>{{/if}}\n {{#if @site.twitter}}<a href=\"{{social_url type=\"twitter\"}}\" target=\"_blank\" rel=\"noopener\">X</a>{{/if}}\n <a href=\"{{@site.url}}/rss/\">RSS</a>\n </div>\n </div>\n <div class=\"ghcn-footer__legal ghcn-container\">\n <span>© {{date format=\"YYYY\"}} {{@site.title}}</span>\n <span>Published with <a href=\"https://ghost.org\" target=\"_blank\" rel=\"noopener\">Ghost</a></span>\n </div>\n</footer
|
|
12
|
+
"content": "{{!-- Styling parameters: class, innerClass, navClass, socialClass --}}\n{{#with this as |ghostcnStyles|}}\n{{!-- Component: Site Footer | Usage: {{> \"components/site-footer\"}} --}}\n<footer class=\"ghcn-footer{{#if ghostcnStyles.class}} {{ghostcnStyles.class}}{{/if}}\">\n <div class=\"ghcn-footer__inner{{#if ghostcnStyles.innerClass}} {{ghostcnStyles.innerClass}}{{/if}} ghcn-container\">\n <div class=\"ghcn-footer__brand\">\n <a href=\"{{@site.url}}\">{{@site.title}}</a>\n {{#if @site.description}}<p>{{@site.description}}</p>{{/if}}\n </div>\n <nav class=\"ghcn-footer__nav{{#if ghostcnStyles.navClass}} {{ghostcnStyles.navClass}}{{/if}}\" aria-label=\"Footer navigation\">{{navigation type=\"secondary\"}}</nav>\n <div class=\"ghcn-footer__social{{#if ghostcnStyles.socialClass}} {{ghostcnStyles.socialClass}}{{/if}}\">\n {{#if @site.facebook}}<a href=\"{{social_url type=\"facebook\"}}\" target=\"_blank\" rel=\"noopener\">Facebook</a>{{/if}}\n {{#if @site.twitter}}<a href=\"{{social_url type=\"twitter\"}}\" target=\"_blank\" rel=\"noopener\">X</a>{{/if}}\n <a href=\"{{@site.url}}/rss/\">RSS</a>\n </div>\n </div>\n <div class=\"ghcn-footer__legal ghcn-container\">\n <span>© {{date format=\"YYYY\"}} {{@site.title}}</span>\n <span>Published with <a href=\"https://ghost.org\" target=\"_blank\" rel=\"noopener\">Ghost</a></span>\n </div>\n</footer>\n{{/with}}"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "site-footer.css",
|
|
@@ -23,5 +23,19 @@
|
|
|
23
23
|
"GS010-PJ-VALID"
|
|
24
24
|
],
|
|
25
25
|
"notes": "Uses Ghost secondary navigation and site globals."
|
|
26
|
+
},
|
|
27
|
+
"styleSlots": {
|
|
28
|
+
"class": [
|
|
29
|
+
".ghcn-footer"
|
|
30
|
+
],
|
|
31
|
+
"innerClass": [
|
|
32
|
+
".ghcn-footer__inner"
|
|
33
|
+
],
|
|
34
|
+
"navClass": [
|
|
35
|
+
".ghcn-footer__nav"
|
|
36
|
+
],
|
|
37
|
+
"socialClass": [
|
|
38
|
+
".ghcn-footer__social"
|
|
39
|
+
]
|
|
26
40
|
}
|
|
27
41
|
}
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"name": "site-header.hbs",
|
|
10
10
|
"type": "partial",
|
|
11
11
|
"target": "partials/components/site-header.hbs",
|
|
12
|
-
"content": "{{!-- Component: Site Header | Usage: {{> \"components/site-header\"}} --}}\n<header class=\"ghcn-header\">\n <div class=\"ghcn-header__inner ghcn-container\">\n <a class=\"ghcn-header__brand\" href=\"{{@site.url}}\" aria-label=\"{{@site.title}} home\">\n {{#if @site.logo}}\n <img src=\"{{@site.logo}}\" alt=\"{{@site.title}}\" />\n {{else}}\n <span>{{@site.title}}</span>\n {{/if}}\n </a>\n\n <nav class=\"ghcn-header__nav\" aria-label=\"Primary navigation\">{{navigation}}</nav>\n\n <div class=\"ghcn-header__actions\">\n {{search}}\n {{#if @member}}\n <a class=\"ghcn-button ghcn-button--outline\" href=\"#/portal/account\" data-portal=\"account\">Account</a>\n {{else}}\n <a class=\"ghcn-header__signin\" href=\"#/portal/signin\" data-portal=\"signin\">Sign in</a>\n <a class=\"ghcn-button\" href=\"#/portal/signup\" data-portal=\"signup\">Subscribe</a>\n {{/if}}\n </div>\n\n <details class=\"ghcn-header__mobile\">\n <summary class=\"ghcn-icon-button ghcn-button--outline\" aria-label=\"Open navigation\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" width=\"20\" height=\"20\"><path d=\"M4 7h16M4 12h16M4 17h16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>\n </summary>\n <div class=\"ghcn-header__panel\">\n <nav aria-label=\"Mobile navigation\">{{navigation}}</nav>\n <div class=\"ghcn-header__mobile-actions\">\n {{search}}\n {{#if @member}}\n <a class=\"ghcn-button ghcn-button--outline\" href=\"#/portal/account\" data-portal=\"account\">Account</a>\n {{else}}\n <a class=\"ghcn-button ghcn-button--outline\" href=\"#/portal/signin\" data-portal=\"signin\">Sign in</a>\n <a class=\"ghcn-button\" href=\"#/portal/signup\" data-portal=\"signup\">Subscribe</a>\n {{/if}}\n </div>\n </div>\n </details>\n </div>\n</header
|
|
12
|
+
"content": "{{!-- Styling parameters: class, innerClass, navClass, buttonClass --}}\n{{#with this as |ghostcnStyles|}}\n{{!-- Component: Site Header | Usage: {{> \"components/site-header\"}} --}}\n<header class=\"ghcn-header{{#if ghostcnStyles.class}} {{ghostcnStyles.class}}{{/if}}\">\n <div class=\"ghcn-header__inner{{#if ghostcnStyles.innerClass}} {{ghostcnStyles.innerClass}}{{/if}} ghcn-container\">\n <a class=\"ghcn-header__brand\" href=\"{{@site.url}}\" aria-label=\"{{@site.title}} home\">\n {{#if @site.logo}}\n <img src=\"{{@site.logo}}\" alt=\"{{@site.title}}\" />\n {{else}}\n <span>{{@site.title}}</span>\n {{/if}}\n </a>\n\n <nav class=\"ghcn-header__nav{{#if ghostcnStyles.navClass}} {{ghostcnStyles.navClass}}{{/if}}\" aria-label=\"Primary navigation\">{{navigation}}</nav>\n\n <div class=\"ghcn-header__actions\">\n {{search}}\n {{#if @site.members_enabled}}\n {{#if @member}}\n <a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}} ghcn-button--outline\" href=\"#/portal/account\" data-portal=\"account\">Account</a>\n {{else}}\n <a class=\"ghcn-header__signin\" href=\"#/portal/signin\" data-portal=\"signin\">Sign in</a>\n {{#unless @site.members_invite_only}}\n {{#if @site.allow_self_signup}}\n <a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" href=\"#/portal/signup\" data-portal=\"signup\">Subscribe</a>\n {{/if}}\n {{/unless}}\n {{/if}}\n {{/if}}\n </div>\n\n <details class=\"ghcn-header__mobile\">\n <summary class=\"ghcn-icon-button ghcn-button--outline\" aria-label=\"Open navigation\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" width=\"20\" height=\"20\"><path d=\"M4 7h16M4 12h16M4 17h16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>\n </summary>\n <div class=\"ghcn-header__panel\">\n <nav class=\"ghcn-header__mobile-nav{{#if ghostcnStyles.navClass}} {{ghostcnStyles.navClass}}{{/if}}\" aria-label=\"Mobile navigation\">{{navigation}}</nav>\n <div class=\"ghcn-header__mobile-actions\">\n {{search}}\n {{#if @site.members_enabled}}\n {{#if @member}}\n <a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}} ghcn-button--outline\" href=\"#/portal/account\" data-portal=\"account\">Account</a>\n {{else}}\n <a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}} ghcn-button--outline\" href=\"#/portal/signin\" data-portal=\"signin\">Sign in</a>\n {{#unless @site.members_invite_only}}\n {{#if @site.allow_self_signup}}\n <a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" href=\"#/portal/signup\" data-portal=\"signup\">Subscribe</a>\n {{/if}}\n {{/unless}}\n {{/if}}\n {{/if}}\n </div>\n </div>\n </details>\n </div>\n</header>\n{{/with}}"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "site-header.css",
|
|
16
16
|
"type": "style",
|
|
17
17
|
"target": "assets/css/components/site-header.css",
|
|
18
|
-
"content": "/* ghostcn: Site Header */\n.ghcn-header { box-sizing: border-box; position: relative; z-index: 30; border-bottom: 1px solid var(--border); color: var(--foreground); background: color-mix(in srgb, var(--background) 92%, transparent); font-family: inherit; font-size: 16px; line-height: 1.5; isolation: isolate; }\n.ghcn-header *, .ghcn-header *::before, .ghcn-header *::after { box-sizing: border-box; }\n.ghcn-header__inner { display: flex; min-height: 4.5em; align-items: center; gap: 1.5em; }\n.ghcn-header__brand { display: inline-flex; flex: 0 0 auto; align-items: center; color: var(--foreground); font-size: 1.125em; font-weight: 800; letter-spacing: -0.025em; text-decoration: none; }\n.ghcn-header__brand img { display: block; width: auto; max-width: 11em; max-height: 2.25em; }\n.ghcn-header__nav { min-width: 0; flex: 1; }\n.ghcn-header .nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25em; margin: 0; padding: 0; list-style: none; }\n.ghcn-header .nav a, .ghcn-header__signin { color: var(--muted-foreground); font-size: 0.875em; font-weight: 600; text-decoration: none; }\n.ghcn-header .nav a:hover, .ghcn-header .nav-current a, .ghcn-header__signin:hover { color: var(--foreground); }\n.ghcn-header__actions { display: flex; align-items: center; gap: 0.75em; }\n.ghcn-
|
|
18
|
+
"content": "/* ghostcn: Site Header */\n.ghcn-header { box-sizing: border-box; position: relative; z-index: 30; border-bottom: 1px solid var(--border); color: var(--foreground); background: color-mix(in srgb, var(--background) 92%, transparent); font-family: inherit; font-size: 16px; line-height: 1.5; isolation: isolate; }\n.ghcn-header *, .ghcn-header *::before, .ghcn-header *::after { box-sizing: border-box; }\n.ghcn-header__inner { display: flex; min-height: 4.5em; align-items: center; gap: 1.5em; }\n.ghcn-header__brand { display: inline-flex; flex: 0 0 auto; align-items: center; color: var(--foreground); font-size: 1.125em; font-weight: 800; letter-spacing: -0.025em; text-decoration: none; }\n.ghcn-header__brand img { display: block; width: auto; max-width: 11em; max-height: 2.25em; }\n.ghcn-header__nav { min-width: 0; flex: 1; }\n.ghcn-header .nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25em; margin: 0; padding: 0; list-style: none; }\n.ghcn-header .nav a, .ghcn-header__signin { color: var(--muted-foreground); font-size: 0.875em; font-weight: 600; text-decoration: none; }\n.ghcn-header .nav a:hover, .ghcn-header .nav-current a, .ghcn-header__signin:hover { color: var(--foreground); }\n.ghcn-header__actions { display: flex; align-items: center; gap: 0.75em; }\n.ghcn-header .gh-search-icon:focus-visible { border-radius: var(--radius); box-shadow: 0 0 0 2px var(--ring); }\n.ghcn-header__mobile { display: none; margin-left: auto; }\n.ghcn-header__mobile summary { list-style: none; }\n.ghcn-header__mobile summary::-webkit-details-marker { display: none; }\n.ghcn-header__panel { position: absolute; top: calc(100% + 0.5em); right: 1em; left: 1em; border: 1px solid var(--border); border-radius: min(var(--radius), 1em); padding: 1em; background: var(--popover); box-shadow: 0 1em 2.5em rgba(0,0,0,.14); }\n.ghcn-header__panel .nav { align-items: stretch; flex-direction: column; gap: 0.25em; }\n.ghcn-header__panel .nav a { display: block; border-radius: var(--radius); padding: 0.625em 0.75em; }\n.ghcn-header__panel .nav a:hover { background: var(--muted); }\n.ghcn-header__mobile-actions { display: grid; grid-template-columns: auto 1fr 1fr; gap: 0.5em; margin-top: 1em; padding-top: 1em; border-top: 1px solid var(--border); }\n@media (max-width: 800px) { .ghcn-header__nav, .ghcn-header__actions { display: none; } .ghcn-header__mobile { display: block; } }\n"
|
|
19
19
|
}
|
|
20
20
|
],
|
|
21
21
|
"gscan": {
|
|
@@ -23,5 +23,20 @@
|
|
|
23
23
|
"GS010-PJ-VALID"
|
|
24
24
|
],
|
|
25
25
|
"notes": "Uses Ghost navigation, search, member state, and Portal triggers."
|
|
26
|
+
},
|
|
27
|
+
"styleSlots": {
|
|
28
|
+
"class": [
|
|
29
|
+
".ghcn-header"
|
|
30
|
+
],
|
|
31
|
+
"innerClass": [
|
|
32
|
+
".ghcn-header__inner"
|
|
33
|
+
],
|
|
34
|
+
"navClass": [
|
|
35
|
+
".ghcn-header__nav",
|
|
36
|
+
".ghcn-header__mobile-nav"
|
|
37
|
+
],
|
|
38
|
+
"buttonClass": [
|
|
39
|
+
".ghcn-button"
|
|
40
|
+
]
|
|
26
41
|
}
|
|
27
42
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "table-of-contents",
|
|
3
|
+
"type": "components:content",
|
|
4
|
+
"description": "Progressively enhanced h2/h3 navigation with collision-safe anchors and keyboard focus.",
|
|
5
|
+
"dependencies": [],
|
|
6
|
+
"ghost_version": ">=5.0.0",
|
|
7
|
+
"files": [
|
|
8
|
+
{
|
|
9
|
+
"name": "table-of-contents.hbs",
|
|
10
|
+
"type": "partial",
|
|
11
|
+
"target": "partials/components/table-of-contents.hbs",
|
|
12
|
+
"content": "{{!-- Styling parameters: class, titleClass, listClass --}}\n{{#with this as |ghostcnStyles|}}\n{{!-- add manages the deferred script in default.hbs. Set contentSelector for existing themes. --}}\n<nav class=\"ghcn-toc{{#if ghostcnStyles.class}} {{ghostcnStyles.class}}{{/if}}\" data-ghcn-toc data-toc-content=\"{{#if contentSelector}}{{contentSelector}}{{else}}.ghcn-article-content{{/if}}\" data-link-class=\"{{linkClass}}\" aria-label=\"On this page\" hidden>\n <h2 class=\"ghcn-toc__title{{#if ghostcnStyles.titleClass}} {{ghostcnStyles.titleClass}}{{/if}}\">{{#if heading}}{{heading}}{{else}}On this page{{/if}}</h2>\n <ol class=\"ghcn-toc__list{{#if ghostcnStyles.listClass}} {{ghostcnStyles.listClass}}{{/if}}\" data-toc-list></ol>\n</nav>\n{{/with}}"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "table-of-contents.css",
|
|
16
|
+
"type": "style",
|
|
17
|
+
"target": "assets/css/components/table-of-contents.css",
|
|
18
|
+
"content": "\n.ghcn-toc { padding: 1.25em; margin-block: 1.5em; background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: var(--radius); }\n.ghcn-toc[hidden] { display: none; }\n.ghcn-toc__title { margin: 0 0 .75em; font-size: 1em; font-weight: 600; }\n.ghcn-toc__list { padding-left: 1.25em; margin: 0; }\n.ghcn-toc__item { padding-block: .25em; }\n.ghcn-toc__item--nested { margin-left: 1em; }\n.ghcn-toc__link { color: inherit; text-decoration: none; overflow-wrap: anywhere; }\n.ghcn-toc__link:hover { text-decoration: underline; }\n.ghcn-toc__link:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }\n"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "table-of-contents.js",
|
|
22
|
+
"type": "js",
|
|
23
|
+
"target": "assets/js/components/table-of-contents.js",
|
|
24
|
+
"content": "/* ghostcn table of contents: no dependencies, no HTML injection, repeat-safe. */\n(() => {\n const init = () => {\n document.querySelectorAll('[data-ghcn-toc]').forEach(nav => {\n if (nav.dataset.ghcnTocReady) return;\n let content;\n try { content = document.querySelector(nav.dataset.tocContent); } catch { return; }\n if (!content) return;\n // Editor card UI titles are not article sections (e.g. signup or product headings).\n const headings = [...content.querySelectorAll('h2, h3')].filter(h => h.textContent.trim() && !h.closest('.kg-card'));\n if (headings.length < 2) return;\n const list = nav.querySelector('[data-toc-list]');\n if (!list) return;\n const used = new Set([...document.querySelectorAll('[id]')].map(el => el.id));\n headings.forEach((heading, index) => {\n if (!heading.id) {\n const base = 'ghcn-' + (heading.textContent.toLowerCase().normalize('NFKD').replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'section-' + (index + 1));\n let id = base, suffix = 2;\n while (used.has(id)) id = base + '-' + suffix++;\n heading.id = id; used.add(id);\n }\n const item = document.createElement('li');\n item.className = 'ghcn-toc__item' + (heading.tagName === 'H3' ? ' ghcn-toc__item--nested' : '');\n const link = document.createElement('a');\n link.className = 'ghcn-toc__link';\n if (nav.dataset.linkClass) nav.dataset.linkClass.split(/\\s+/).filter(Boolean).forEach(value => link.classList.add(value));\n link.href = '#' + encodeURIComponent(heading.id);\n link.textContent = heading.textContent.trim();\n link.addEventListener('click', event => {\n if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;\n event.preventDefault();\n heading.scrollIntoView({ behavior: 'auto', block: 'start' });\n if (!heading.hasAttribute('tabindex')) {\n heading.setAttribute('tabindex', '-1');\n heading.addEventListener('blur', () => heading.removeAttribute('tabindex'), { once: true });\n }\n heading.focus({ preventScroll: true });\n try { history.replaceState(null, '', '#' + encodeURIComponent(heading.id)); } catch {}\n });\n item.append(link); list.append(item);\n });\n nav.dataset.ghcnTocReady = 'true'; nav.hidden = false;\n });\n };\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init, { once: true }); else init();\n})();"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"gscan": {
|
|
28
|
+
"rules_satisfied": [
|
|
29
|
+
"GS010-PJ-VALID"
|
|
30
|
+
],
|
|
31
|
+
"notes": "Uses native Ghost post data and optional progressive enhancement."
|
|
32
|
+
},
|
|
33
|
+
"styleSlots": {
|
|
34
|
+
"class": [
|
|
35
|
+
".ghcn-toc"
|
|
36
|
+
],
|
|
37
|
+
"titleClass": [
|
|
38
|
+
".ghcn-toc__title"
|
|
39
|
+
],
|
|
40
|
+
"listClass": [
|
|
41
|
+
".ghcn-toc__list"
|
|
42
|
+
],
|
|
43
|
+
"linkClass": [
|
|
44
|
+
".ghcn-toc__link"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tag-grid",
|
|
3
|
+
"type": "components:content",
|
|
4
|
+
"description": "Public tag archive links composed from card and button primitives.",
|
|
5
|
+
"dependencies": [
|
|
6
|
+
"card",
|
|
7
|
+
"button"
|
|
8
|
+
],
|
|
9
|
+
"ghost_version": ">=5.0.0",
|
|
10
|
+
"parameters": {
|
|
11
|
+
"heading": {
|
|
12
|
+
"description": "Optional section heading."
|
|
13
|
+
},
|
|
14
|
+
"emptyText": {
|
|
15
|
+
"description": "Optional message when no content is available; otherwise render nothing."
|
|
16
|
+
},
|
|
17
|
+
"cardVariant": {
|
|
18
|
+
"description": "Variant forwarded to each card.",
|
|
19
|
+
"options": [
|
|
20
|
+
"default",
|
|
21
|
+
"secondary",
|
|
22
|
+
"outline"
|
|
23
|
+
],
|
|
24
|
+
"default": "default"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
{
|
|
29
|
+
"name": "tag-grid.hbs",
|
|
30
|
+
"type": "partial",
|
|
31
|
+
"target": "partials/components/tag-grid.hbs",
|
|
32
|
+
"content": "{{!-- Styling parameters: class, titleClass, gridClass --}}\n{{#with this as |ghostcnStyles|}}\n{{#get \"tags\" filter=\"visibility:public\" limit=\"100\" include=\"count.posts\"}}\n{{#if tags}}<section class=\"ghcn-tag-grid{{#if ghostcnStyles.class}} {{ghostcnStyles.class}}{{/if}}\" aria-label=\"Topics\">\n {{#if ghostcnStyles.heading}}<h2 class=\"ghcn-tag-grid__title{{#if ghostcnStyles.titleClass}} {{ghostcnStyles.titleClass}}{{/if}}\">{{ghostcnStyles.heading}}</h2>{{/if}}\n <div class=\"ghcn-tag-grid__grid{{#if ghostcnStyles.gridClass}} {{ghostcnStyles.gridClass}}{{/if}}\">{{#foreach tags visibility=\"public\"}}\n {{#> \"components/card\" heading=name description=description class=ghostcnStyles.cardClass titleClass=ghostcnStyles.cardTitleClass descriptionClass=ghostcnStyles.descriptionClass variant=ghostcnStyles.cardVariant}}\n {{> \"components/button\" href=url text=\"Explore topic\" variant=\"outline\" size=\"sm\" class=ghostcnStyles.buttonClass}}\n {{/components/card}}\n {{/foreach}}</div>\n</section>{{else}}{{#if ghostcnStyles.emptyText}}<section class=\"ghcn-tag-grid{{#if ghostcnStyles.class}} {{ghostcnStyles.class}}{{/if}}\"><p class=\"ghcn-tag-grid__empty\">{{ghostcnStyles.emptyText}}</p></section>{{/if}}{{/if}}\n{{/get}}\n{{/with}}"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "tag-grid.css",
|
|
36
|
+
"type": "style",
|
|
37
|
+
"target": "assets/css/components/tag-grid.css",
|
|
38
|
+
"content": ".ghcn-tag-grid { font-size: 16px; color: var(--foreground); margin-block: 2em; }\n.ghcn-tag-grid__title { font-size: 1.5em; line-height: 1.25; margin: 0 0 1em; }\n.ghcn-tag-grid__grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1.5em; }\n.ghcn-tag-grid__grid > * { min-width: 0; }\n.ghcn-tag-grid__empty { color: var(--muted-foreground); }\n@media(max-width:900px) { .ghcn-tag-grid__grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }\n@media(max-width:620px) { .ghcn-tag-grid__grid { grid-template-columns: 1fr; } }"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"styleSlots": {
|
|
42
|
+
"class": [
|
|
43
|
+
".ghcn-tag-grid"
|
|
44
|
+
],
|
|
45
|
+
"titleClass": [
|
|
46
|
+
".ghcn-tag-grid__title"
|
|
47
|
+
],
|
|
48
|
+
"gridClass": [
|
|
49
|
+
".ghcn-tag-grid__grid"
|
|
50
|
+
],
|
|
51
|
+
"cardClass": [
|
|
52
|
+
".ghcn-ui-card"
|
|
53
|
+
],
|
|
54
|
+
"cardTitleClass": [
|
|
55
|
+
".ghcn-ui-card__title"
|
|
56
|
+
],
|
|
57
|
+
"descriptionClass": [
|
|
58
|
+
".ghcn-ui-card__description"
|
|
59
|
+
],
|
|
60
|
+
"buttonClass": [
|
|
61
|
+
".ghcn-ui-button"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tag-list",
|
|
3
|
+
"type": "components:content",
|
|
4
|
+
"description": "Linked public tags for the current post, omitting internal tags and empty tag lists.",
|
|
5
|
+
"dependencies": [],
|
|
6
|
+
"ghost_version": ">=5.0.0",
|
|
7
|
+
"files": [
|
|
8
|
+
{
|
|
9
|
+
"name": "tag-list.hbs",
|
|
10
|
+
"type": "partial",
|
|
11
|
+
"target": "partials/components/tag-list.hbs",
|
|
12
|
+
"content": "{{!-- Styling parameters: class, listClass, linkClass --}}\n{{#with this as |ghostcnStyles|}}\n{{!-- Use inside {{#post}}; Ghost foreach filters internal tags. --}}\n{{#foreach tags visibility=\"public\"}}{{#if @first}}<nav class=\"ghcn-tag-list{{#if ghostcnStyles.class}} {{ghostcnStyles.class}}{{/if}}\" aria-label=\"Post tags\"><ul class=\"ghcn-tag-list__items{{#if ghostcnStyles.listClass}} {{ghostcnStyles.listClass}}{{/if}}\">{{/if}}<li><a class=\"ghcn-tag-list__link{{#if ghostcnStyles.linkClass}} {{ghostcnStyles.linkClass}}{{/if}}\" href=\"{{url}}\">{{name}}</a></li>{{#if @last}}</ul></nav>{{/if}}{{/foreach}}\n{{/with}}"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "tag-list.css",
|
|
16
|
+
"type": "style",
|
|
17
|
+
"target": "assets/css/components/tag-list.css",
|
|
18
|
+
"content": "\n.ghcn-tag-list { margin-block: 1.5em; }\n.ghcn-tag-list__items { display: flex; flex-wrap: wrap; gap: .5em; list-style: none; padding: 0; margin: 0; }\n.ghcn-tag-list__link { display: block; padding: .375em .875em; background: var(--muted); color: var(--foreground); border: 1px solid var(--border); border-radius: 999px; font-size: .875em; text-decoration: none; }\n.ghcn-tag-list__link:hover { background: var(--secondary); text-decoration: underline; }\n.ghcn-tag-list__link:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }\n"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"gscan": {
|
|
22
|
+
"rules_satisfied": [
|
|
23
|
+
"GS010-PJ-VALID"
|
|
24
|
+
],
|
|
25
|
+
"notes": "Uses native Ghost post data and optional progressive enhancement."
|
|
26
|
+
},
|
|
27
|
+
"styleSlots": {
|
|
28
|
+
"class": [
|
|
29
|
+
".ghcn-tag-list"
|
|
30
|
+
],
|
|
31
|
+
"listClass": [
|
|
32
|
+
".ghcn-tag-list__items"
|
|
33
|
+
],
|
|
34
|
+
"linkClass": [
|
|
35
|
+
".ghcn-tag-list__link"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
package/dist/registry/index.json
CHANGED
|
@@ -98,5 +98,136 @@
|
|
|
98
98
|
"member-cta.hbs",
|
|
99
99
|
"member-cta.css"
|
|
100
100
|
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "related-posts",
|
|
104
|
+
"description": "Related reading from the same primary tag, excluding the current post; recent posts when untagged.",
|
|
105
|
+
"category": "components:content",
|
|
106
|
+
"ghost_version": ">=5.0.0",
|
|
107
|
+
"files": [
|
|
108
|
+
"related-posts.hbs",
|
|
109
|
+
"related-posts.css"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "post-navigation",
|
|
114
|
+
"description": "Accessible chronological previous/next post links, with no dead links at either end.",
|
|
115
|
+
"category": "components:content",
|
|
116
|
+
"ghost_version": ">=5.0.0",
|
|
117
|
+
"files": [
|
|
118
|
+
"post-navigation.hbs",
|
|
119
|
+
"post-navigation.css"
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "table-of-contents",
|
|
124
|
+
"description": "Progressively enhanced h2/h3 navigation with collision-safe anchors and keyboard focus.",
|
|
125
|
+
"category": "components:content",
|
|
126
|
+
"ghost_version": ">=5.0.0",
|
|
127
|
+
"files": [
|
|
128
|
+
"table-of-contents.hbs",
|
|
129
|
+
"table-of-contents.css",
|
|
130
|
+
"table-of-contents.js"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "tag-list",
|
|
135
|
+
"description": "Linked public tags for the current post, omitting internal tags and empty tag lists.",
|
|
136
|
+
"category": "components:content",
|
|
137
|
+
"ghost_version": ">=5.0.0",
|
|
138
|
+
"files": [
|
|
139
|
+
"tag-list.hbs",
|
|
140
|
+
"tag-list.css"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "button",
|
|
145
|
+
"description": "A native button or link with variants, sizes and per-instance classes.",
|
|
146
|
+
"category": "components:ui",
|
|
147
|
+
"ghost_version": ">=5.0.0",
|
|
148
|
+
"files": [
|
|
149
|
+
"button.hbs",
|
|
150
|
+
"button.css"
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "card",
|
|
155
|
+
"description": "A composable content card with optional heading, description and footer.",
|
|
156
|
+
"category": "components:ui",
|
|
157
|
+
"ghost_version": ">=5.0.0",
|
|
158
|
+
"files": [
|
|
159
|
+
"card.hbs",
|
|
160
|
+
"card.css"
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"name": "badge",
|
|
165
|
+
"description": "A small non-interactive label with variants and sizes.",
|
|
166
|
+
"category": "components:ui",
|
|
167
|
+
"ghost_version": ">=5.0.0",
|
|
168
|
+
"files": [
|
|
169
|
+
"badge.hbs",
|
|
170
|
+
"badge.css"
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"name": "input",
|
|
175
|
+
"description": "An accessible labeled native input, with optional hint and invalid/disabled states.",
|
|
176
|
+
"category": "components:ui",
|
|
177
|
+
"ghost_version": ">=5.0.0",
|
|
178
|
+
"files": [
|
|
179
|
+
"input.hbs",
|
|
180
|
+
"input.css"
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "alert",
|
|
185
|
+
"description": "An accessible status message with an optional urgent announcement.",
|
|
186
|
+
"category": "components:ui",
|
|
187
|
+
"ghost_version": ">=5.0.0",
|
|
188
|
+
"files": [
|
|
189
|
+
"alert.hbs",
|
|
190
|
+
"alert.css"
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"name": "post-grid",
|
|
195
|
+
"description": "A responsive grid using post-card; pass posts from a loop, archive or get query.",
|
|
196
|
+
"category": "components:content",
|
|
197
|
+
"ghost_version": ">=5.0.0",
|
|
198
|
+
"files": [
|
|
199
|
+
"post-grid.hbs",
|
|
200
|
+
"post-grid.css"
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"name": "author-list",
|
|
205
|
+
"description": "Publication authors rendered with reusable author cards.",
|
|
206
|
+
"category": "components:content",
|
|
207
|
+
"ghost_version": ">=5.0.0",
|
|
208
|
+
"files": [
|
|
209
|
+
"author-list.hbs",
|
|
210
|
+
"author-list.css"
|
|
211
|
+
]
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"name": "tag-grid",
|
|
215
|
+
"description": "Public tag archive links composed from card and button primitives.",
|
|
216
|
+
"category": "components:content",
|
|
217
|
+
"ghost_version": ">=5.0.0",
|
|
218
|
+
"files": [
|
|
219
|
+
"tag-grid.hbs",
|
|
220
|
+
"tag-grid.css"
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"name": "archive-header",
|
|
225
|
+
"description": "A reusable tag or author archive heading with an optional badge and image.",
|
|
226
|
+
"category": "components:content",
|
|
227
|
+
"ghost_version": ">=5.0.0",
|
|
228
|
+
"files": [
|
|
229
|
+
"archive-header.hbs",
|
|
230
|
+
"archive-header.css"
|
|
231
|
+
]
|
|
101
232
|
}
|
|
102
233
|
]
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Ghostcn playground</title><link rel="stylesheet" href="/playground.css"><script defer src="/playground.js"></script></head>
|
|
3
|
+
<body><header><p class="eyebrow">LOCAL COMPONENT PLAYGROUND</p><h1>Build it your way.</h1><p>Installed theme files. Synthetic content. No emails, payments or Ghost settings changes.</p></header>
|
|
4
|
+
<main><aside aria-label="Preview controls"><label>Component<select id="component"></select></label><p id="description"></p><label>Theme<select id="scheme"><option value="light">Light</option><option value="dark">Dark</option><option value="auto">Auto</option></select></label><label>Member state<select id="state"><option value="visitor">Visitor</option><option value="free">Free member</option><option value="paid">Paid member</option><option value="disabled">Membership disabled</option><option value="invite">Invite only</option><option value="restricted">Self-signup restricted</option></select></label><div id="parameters"></div><button id="reload" type="button">Reload preview</button><p id="status" role="status"></p></aside>
|
|
5
|
+
<section aria-label="Component preview"><iframe id="preview" title="Installed component preview" sandbox="allow-scripts"></iframe><h2>Use in your template</h2><pre><code id="usage"></code></pre><p>Classes only preview if your CSS defines them. For Tailwind, put utilities in a scanned .hbs file and keep <code>npm run dev</code> running. Verify real data, editor cards and member behavior in Ghost.</p><p>Preview changes are temporary. Copy the usage into your theme to keep them.</p></section></main></body></html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
:root { color-scheme: light dark; font-family: ui-sans-serif, system-ui, sans-serif; background: #101419; color: #e8edf2; }
|
|
2
|
+
* { box-sizing: border-box; }
|
|
3
|
+
body { margin: 0; }
|
|
4
|
+
header { padding: 32px; border-bottom: 1px solid #34414e; }
|
|
5
|
+
.eyebrow { font-size: 12px; letter-spacing: .12em; color: #a0bdcf; }
|
|
6
|
+
h1 { margin: 8px 0; font-size: clamp(28px,4vw,42px); }
|
|
7
|
+
p { line-height: 1.6; }
|
|
8
|
+
main { display: grid; grid-template-columns: minmax(240px,320px) minmax(0,1fr); }
|
|
9
|
+
aside { padding: 24px; border-right: 1px solid #34414e; }
|
|
10
|
+
section { min-width: 0; padding: 24px; }
|
|
11
|
+
label { display: grid; gap: 8px; margin-bottom: 18px; font-size: 14px; }
|
|
12
|
+
input, select, button { font: inherit; width: 100%; min-width: 0; padding: 10px; border-radius: 6px; border: 1px solid #516475; color: #e8edf2; background: #1d2731; }
|
|
13
|
+
button { cursor: pointer; }
|
|
14
|
+
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid #bca1f8; outline-offset: 3px; }
|
|
15
|
+
label small, #description { color: #a0bdcf; }
|
|
16
|
+
iframe { width: 100%; height: 650px; border: 1px solid #516475; border-radius: 8px; background: #fff; }
|
|
17
|
+
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #1d2731; padding: 20px; border-radius: 8px; }
|
|
18
|
+
@media(max-width:760px) { main { grid-template-columns: 1fr; } aside { border-right: 0; border-bottom: 1px solid #34414e; } header, aside, section { padding: 20px; } }
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const component = document.querySelector('#component');
|
|
2
|
+
const parameters = document.querySelector('#parameters');
|
|
3
|
+
const status = document.querySelector('#status');
|
|
4
|
+
const controls = new Map();
|
|
5
|
+
let catalog = [], revision, busy = false;
|
|
6
|
+
const current = () => catalog.find(item => item.name === component.value);
|
|
7
|
+
function render() {
|
|
8
|
+
const item = current();
|
|
9
|
+
if (!item) return;
|
|
10
|
+
const query = new URLSearchParams({ scheme: document.querySelector('#scheme').value, state: document.querySelector('#state').value });
|
|
11
|
+
const args = [];
|
|
12
|
+
for (const [name, input] of controls) {
|
|
13
|
+
query.set(name, input.value);
|
|
14
|
+
if (input.value) args.push(`${name}=${['disabled','required','invalid','urgent'].includes(name) ? input.value : JSON.stringify(input.value)}`);
|
|
15
|
+
}
|
|
16
|
+
document.querySelector('#preview').src = `/preview/${item.name}?${query}`;
|
|
17
|
+
const context = item.name === 'author-card' ? ' primary_author' : item.name === 'pagination' ? ' pagination' : '';
|
|
18
|
+
document.querySelector('#usage').textContent = `{{> "${item.partial}"${context}${args.map(arg => `\n ${arg}`).join('')}\n}}`;
|
|
19
|
+
}
|
|
20
|
+
function selectComponent() {
|
|
21
|
+
controls.clear(); parameters.replaceChildren();
|
|
22
|
+
const item = current();
|
|
23
|
+
if (!item) { status.textContent = 'No components installed. Run ghostcn add button (or another component), then reload.'; return; }
|
|
24
|
+
document.querySelector('#description').textContent = item.description;
|
|
25
|
+
const definitions = { ...item.parameters, ...Object.fromEntries(Object.keys(item.styleSlots).map(key => [key, { description: key === 'class' ? 'Root classes for this instance.' : `Classes for ${item.styleSlots[key].join(', ')}.` }])) };
|
|
26
|
+
for (const [name, definition] of Object.entries(definitions)) {
|
|
27
|
+
const boolean = ['disabled','required','invalid','urgent'].includes(name);
|
|
28
|
+
const label = document.createElement('label'); label.append(document.createTextNode(name));
|
|
29
|
+
const input = document.createElement(definition.options || boolean ? 'select' : 'input');
|
|
30
|
+
input.name = name;
|
|
31
|
+
if (input.tagName === 'SELECT') for (const value of boolean ? ['false','true'] : definition.options) { const option = document.createElement('option'); option.value = value; option.textContent = value; input.append(option); }
|
|
32
|
+
input.value = item.defaults[name] || definition.default || (boolean ? 'false' : '');
|
|
33
|
+
const help = document.createElement('small'); help.textContent = definition.description;
|
|
34
|
+
label.append(input, help); parameters.append(label); controls.set(name, input);
|
|
35
|
+
input.addEventListener('change', render);
|
|
36
|
+
}
|
|
37
|
+
status.textContent = 'Read-only preview. Your files have not been changed.';
|
|
38
|
+
render();
|
|
39
|
+
}
|
|
40
|
+
async function loadCatalog() {
|
|
41
|
+
const selected = component.value;
|
|
42
|
+
const response = await fetch('/catalog');
|
|
43
|
+
if (!response.ok) throw new Error('Cannot read installed components.');
|
|
44
|
+
catalog = (await response.json()).components;
|
|
45
|
+
component.replaceChildren();
|
|
46
|
+
for (const item of catalog) { const option = document.createElement('option'); option.value = item.name; option.textContent = item.name; component.append(option); }
|
|
47
|
+
if (catalog.some(item => item.name === selected)) component.value = selected;
|
|
48
|
+
selectComponent();
|
|
49
|
+
}
|
|
50
|
+
component.addEventListener('change', selectComponent);
|
|
51
|
+
document.querySelector('#scheme').addEventListener('change', render);
|
|
52
|
+
document.querySelector('#state').addEventListener('change', render);
|
|
53
|
+
document.querySelector('#reload').addEventListener('click', render);
|
|
54
|
+
loadCatalog().catch(error => { status.textContent = error.message; });
|
|
55
|
+
setInterval(async () => {
|
|
56
|
+
if (busy) return;
|
|
57
|
+
busy = true;
|
|
58
|
+
try {
|
|
59
|
+
const response = await fetch('/revision');
|
|
60
|
+
if (!response.ok) throw new Error('Cannot watch theme files.');
|
|
61
|
+
const next = (await response.json()).revision;
|
|
62
|
+
if (revision && next !== revision) {
|
|
63
|
+
const fresh = await (await fetch('/catalog')).json();
|
|
64
|
+
if (fresh.components.map(item => item.name).join(',') !== catalog.map(item => item.name).join(',')) await loadCatalog();
|
|
65
|
+
else render();
|
|
66
|
+
status.textContent = 'Reloaded after a theme file changed.';
|
|
67
|
+
}
|
|
68
|
+
revision = next;
|
|
69
|
+
} catch (error) { status.textContent = `${error.message} Check the playground terminal.`; }
|
|
70
|
+
finally { busy = false; }
|
|
71
|
+
}, 1000);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* Only the preview shell, never component defaults. */
|
|
2
|
+
body { margin: 0; background: var(--background); color: var(--foreground); font: 16px/1.5 ui-sans-serif,system-ui,sans-serif; }
|
|
3
|
+
.playground-preview { padding: 24px; overflow-wrap: anywhere; }
|
|
4
|
+
#preview-feedback { font-size: 14px; color: var(--muted-foreground); margin-top: 16px; }
|
|
5
|
+
#preview-feedback:empty { display: none; }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Sandbox interactions never navigate, submit email, or open Ghost Portal.
|
|
2
|
+
document.addEventListener('submit', event => { event.preventDefault(); document.querySelector('#preview-feedback').textContent = 'Demo only. No email was sent or stored.'; });
|
|
3
|
+
document.addEventListener('click', event => {
|
|
4
|
+
const element = event.target.closest('a,button');
|
|
5
|
+
if (!element || element.closest('[data-ghcn-toc]')) return;
|
|
6
|
+
event.preventDefault();
|
|
7
|
+
if (element.type === 'submit') {
|
|
8
|
+
document.querySelector('#preview-feedback').textContent = 'Demo only. No email was sent or stored.';
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
document.querySelector('#preview-feedback').textContent = element.getAttribute('aria-disabled') === 'true' || element.disabled ? 'This action is disabled.' : 'Demo action. Test navigation, search and Portal on your Ghost publication.';
|
|
12
|
+
});
|