ghostcn 1.4.1 → 1.6.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 +16 -9
- package/dist/commands/diff.js +47 -5
- package/dist/commands/init.js +22 -10
- package/dist/commands/list.js +22 -4
- package/dist/registry/components/accordion.json +66 -0
- package/dist/registry/components/alert.json +1 -1
- package/dist/registry/components/announcement-bar.json +79 -0
- package/dist/registry/components/archive-header.json +2 -2
- package/dist/registry/components/author-card.json +2 -2
- package/dist/registry/components/author-list.json +2 -2
- package/dist/registry/components/avatar.json +62 -0
- package/dist/registry/components/badge.json +1 -1
- package/dist/registry/components/breadcrumbs.json +59 -0
- package/dist/registry/components/button.json +1 -1
- package/dist/registry/components/card.json +1 -1
- package/dist/registry/components/featured-posts.json +2 -2
- package/dist/registry/components/input.json +8 -2
- package/dist/registry/components/member-cta.json +1 -1
- 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-navigation.json +1 -1
- package/dist/registry/components/pricing-table.json +24 -4
- package/dist/registry/components/reading-progress.json +73 -0
- package/dist/registry/components/related-posts.json +7 -1
- 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/table-of-contents.json +13 -3
- package/dist/registry/components/tag-grid.json +2 -2
- package/dist/registry/components/tag-list.json +1 -1
- package/dist/registry/components/theme-toggle.json +65 -0
- package/dist/registry/components/visibility-badge.json +71 -0
- package/dist/registry/index.json +89 -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/design-defaults.json +17 -0
- package/dist/utils/playground-server.js +34 -12
- package/dist/utils/preview-renderer.d.ts +5 -0
- package/dist/utils/preview-renderer.js +30 -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 +27 -14
- package/dist/utils/theme.d.ts +3 -3
- package/dist/utils/theme.js +108 -49
- package/package.json +1 -1
|
@@ -1,28 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pricing-table",
|
|
3
3
|
"type": "components:members",
|
|
4
|
-
"description": "Live Ghost tiers, prices, currencies and
|
|
4
|
+
"description": "Live Ghost tiers, prices, currencies, benefits, and progressive monthly/yearly toggle with Portal checkout.",
|
|
5
5
|
"dependencies": [],
|
|
6
6
|
"ghost_version": ">=5.0.0",
|
|
7
|
+
"parameters": {
|
|
8
|
+
"title": {
|
|
9
|
+
"description": "Optional section heading override.",
|
|
10
|
+
"default": "Choose your membership"
|
|
11
|
+
},
|
|
12
|
+
"defaultBilling": {
|
|
13
|
+
"description": "Initial interval when the progressive billing toggle activates.",
|
|
14
|
+
"options": [
|
|
15
|
+
"monthly",
|
|
16
|
+
"yearly"
|
|
17
|
+
],
|
|
18
|
+
"default": "monthly"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
7
21
|
"files": [
|
|
8
22
|
{
|
|
9
23
|
"name": "pricing-table.hbs",
|
|
10
24
|
"type": "partial",
|
|
11
25
|
"target": "partials/components/pricing-table.hbs",
|
|
12
|
-
"content": "{{!-- Styling parameters: class, titleClass, gridClass, cardClass, buttonClass, cardTitleClass, descriptionClass, priceClass, benefitsClass --}}\n{{#with this as |ghostcnStyles|}}\n{{!-- Component: Pricing Table | Usage: {{> \"components/pricing-table\"}} --}}\n{{#if @site.members_enabled}}\n{{#unless @site.members_invite_only}}\n{{#if @site.allow_self_signup}}\n<section class=\"gh-pricing{{#if ghostcnStyles.class}} {{ghostcnStyles.class}}{{/if}}\" aria-label=\"Membership plans\">\n <h2 class=\"gh-pricing-title{{#if ghostcnStyles.titleClass}} {{ghostcnStyles.titleClass}}{{/if}}\">{{#if title}}{{title}}{{else}}Choose your membership{{/if}}</h2>\n <div class=\"gh-pricing-grid{{#if ghostcnStyles.gridClass}} {{ghostcnStyles.gridClass}}{{/if}}\">\n {{#get \"tiers\" filter=\"visibility:public+active:true\" include=\"monthly_price,yearly_price,benefits\"}}\n {{#foreach tiers}}\n {{#match type \"free\"}}\n <article class=\"gh-pricing-card{{#if ghostcnStyles.cardClass}} {{ghostcnStyles.cardClass}}{{/if}}\">\n
|
|
26
|
+
"content": "{{!-- Styling parameters: class, titleClass, gridClass, cardClass, buttonClass, cardTitleClass, descriptionClass, priceClass, benefitsClass --}}\n{{#with this as |ghostcnStyles|}}\n{{!-- Component: Pricing Table | Usage: {{> \"components/pricing-table\"}} --}}\n{{#if @site.members_enabled}}\n{{#unless @site.members_invite_only}}\n{{#if @site.allow_self_signup}}\n<section class=\"gh-pricing{{#if ghostcnStyles.class}} {{ghostcnStyles.class}}{{/if}}\" data-ghcn-pricing data-default-billing=\"{{#match defaultBilling \"yearly\"}}yearly{{else}}monthly{{/match}}\" aria-label=\"Membership plans\">\n <h2 class=\"gh-pricing-title{{#if ghostcnStyles.titleClass}} {{ghostcnStyles.titleClass}}{{/if}}\">{{#if title}}{{title}}{{else}}Choose your membership{{/if}}</h2>\n <div class=\"gh-pricing-billing\" data-ghcn-billing-toggle role=\"group\" aria-label=\"Billing interval\" hidden>\n <button type=\"button\" class=\"gh-pricing-billing__btn\" data-billing-choice=\"monthly\" aria-pressed=\"true\">Monthly</button>\n <button type=\"button\" class=\"gh-pricing-billing__btn\" data-billing-choice=\"yearly\" aria-pressed=\"false\">Yearly <span class=\"gh-pricing-billing__badge\" data-billing-savings hidden></span></button>\n </div>\n <div class=\"gh-pricing-grid{{#if ghostcnStyles.gridClass}} {{ghostcnStyles.gridClass}}{{/if}}\">\n {{#get \"tiers\" filter=\"visibility:public+active:true\" include=\"monthly_price,yearly_price,benefits\"}}\n {{#if tiers}}\n {{#foreach tiers}}\n {{#match type \"free\"}}\n <article class=\"gh-pricing-card{{#if ghostcnStyles.cardClass}} {{ghostcnStyles.cardClass}}{{/if}}\">\n <header class=\"gh-pricing-card__header\">\n <h3 class=\"gh-pricing-card-title{{#if ghostcnStyles.cardTitleClass}} {{ghostcnStyles.cardTitleClass}}{{/if}}\">{{name}}</h3>\n {{#if description}}<p class=\"gh-pricing-description{{#if ghostcnStyles.descriptionClass}} {{ghostcnStyles.descriptionClass}}{{/if}}\">{{description}}</p>{{/if}}\n </header>\n <div class=\"gh-pricing-card__rates\"><p class=\"gh-pricing-price{{#if ghostcnStyles.priceClass}} {{ghostcnStyles.priceClass}}{{/if}}\">Free</p></div>\n {{#if benefits}}\n <ul class=\"gh-pricing-benefits{{#if ghostcnStyles.benefitsClass}} {{ghostcnStyles.benefitsClass}}{{/if}}\" role=\"list\">{{#foreach benefits}}<li>{{this}}</li>{{/foreach}}</ul>\n {{/if}}\n <div class=\"gh-pricing-actions\">\n {{#if @member}}<a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}} ghcn-button--outline\" href=\"#/portal/account\" data-portal=\"account\">Manage account</a>\n {{else}}<a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}} ghcn-button--outline\" href=\"#/portal/signup/free\" data-portal=\"signup/free\">Join free</a>{{/if}}</div>\n</article>\n {{else}}\n {{#if @site.paid_members_enabled}}\n {{#if monthly_price}}\n <article class=\"gh-pricing-card{{#if ghostcnStyles.cardClass}} {{ghostcnStyles.cardClass}}{{/if}} gh-pricing-card--paid\"{{#if monthly_price}} data-monthly-cents=\"{{monthly_price}}\"{{/if}}{{#if yearly_price}} data-yearly-cents=\"{{yearly_price}}\"{{/if}}>\n <header class=\"gh-pricing-card__header\">\n <h3 class=\"gh-pricing-card-title{{#if ghostcnStyles.cardTitleClass}} {{ghostcnStyles.cardTitleClass}}{{/if}}\">{{name}}</h3>\n {{#if description}}<p class=\"gh-pricing-description{{#if ghostcnStyles.descriptionClass}} {{ghostcnStyles.descriptionClass}}{{/if}}\">{{description}}</p>{{/if}}\n </header>\n <div class=\"gh-pricing-card__rates\">\n {{#if monthly_price}}\n <p class=\"gh-pricing-price{{#if ghostcnStyles.priceClass}} {{ghostcnStyles.priceClass}}{{/if}}\"{{#if yearly_price}} data-pricing-interval=\"monthly\"{{/if}}>{{price monthly_price currency=currency}} <span>/ month</span></p>\n {{#if yearly_price}}<p class=\"gh-pricing-price{{#if ghostcnStyles.priceClass}} {{ghostcnStyles.priceClass}}{{/if}} gh-pricing-price--alternate\" data-pricing-interval=\"yearly\">{{price yearly_price currency=currency}} <span>/ year</span></p>{{/if}}\n {{else}}\n {{#if yearly_price}}<p class=\"gh-pricing-price{{#if ghostcnStyles.priceClass}} {{ghostcnStyles.priceClass}}{{/if}}\">{{price yearly_price currency=currency}} <span>/ year</span></p>{{/if}}\n {{/if}}</div>\n {{#if benefits}}\n <ul class=\"gh-pricing-benefits{{#if ghostcnStyles.benefitsClass}} {{ghostcnStyles.benefitsClass}}{{/if}}\" role=\"list\">{{#foreach benefits}}<li>{{this}}</li>{{/foreach}}</ul>\n {{/if}}\n <div class=\"gh-pricing-actions\">\n {{#if @member}}\n <a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" href=\"#/portal/account/plans\" data-portal=\"account/plans\">{{#if @member.paid}}Manage plan{{else}}Upgrade membership{{/if}}</a>\n {{else}}\n {{#if monthly_price}}\n <a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\"{{#if yearly_price}} data-pricing-interval=\"monthly\"{{/if}} href=\"#/portal/signup/{{id}}/monthly\" data-portal=\"signup/{{id}}/monthly\" aria-label=\"Subscribe monthly to {{name}}\">Subscribe monthly</a>\n {{#if yearly_price}}<a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}} gh-pricing-alternate\" data-pricing-interval=\"yearly\" href=\"#/portal/signup/{{id}}/yearly\" data-portal=\"signup/{{id}}/yearly\" aria-label=\"Subscribe yearly to {{name}}\">Subscribe yearly</a>{{/if}}\n {{else}}\n {{#if yearly_price}}<a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" href=\"#/portal/signup/{{id}}/yearly\" data-portal=\"signup/{{id}}/yearly\" aria-label=\"Subscribe yearly to {{name}}\">Subscribe yearly</a>{{/if}}\n {{/if}}\n {{/if}}</div>\n</article>\n {{else if yearly_price}}\n <article class=\"gh-pricing-card{{#if ghostcnStyles.cardClass}} {{ghostcnStyles.cardClass}}{{/if}} gh-pricing-card--paid\"{{#if monthly_price}} data-monthly-cents=\"{{monthly_price}}\"{{/if}}{{#if yearly_price}} data-yearly-cents=\"{{yearly_price}}\"{{/if}}>\n <header class=\"gh-pricing-card__header\">\n <h3 class=\"gh-pricing-card-title{{#if ghostcnStyles.cardTitleClass}} {{ghostcnStyles.cardTitleClass}}{{/if}}\">{{name}}</h3>\n {{#if description}}<p class=\"gh-pricing-description{{#if ghostcnStyles.descriptionClass}} {{ghostcnStyles.descriptionClass}}{{/if}}\">{{description}}</p>{{/if}}\n </header>\n <div class=\"gh-pricing-card__rates\">\n {{#if monthly_price}}\n <p class=\"gh-pricing-price{{#if ghostcnStyles.priceClass}} {{ghostcnStyles.priceClass}}{{/if}}\"{{#if yearly_price}} data-pricing-interval=\"monthly\"{{/if}}>{{price monthly_price currency=currency}} <span>/ month</span></p>\n {{#if yearly_price}}<p class=\"gh-pricing-price{{#if ghostcnStyles.priceClass}} {{ghostcnStyles.priceClass}}{{/if}} gh-pricing-price--alternate\" data-pricing-interval=\"yearly\">{{price yearly_price currency=currency}} <span>/ year</span></p>{{/if}}\n {{else}}\n {{#if yearly_price}}<p class=\"gh-pricing-price{{#if ghostcnStyles.priceClass}} {{ghostcnStyles.priceClass}}{{/if}}\">{{price yearly_price currency=currency}} <span>/ year</span></p>{{/if}}\n {{/if}}</div>\n {{#if benefits}}\n <ul class=\"gh-pricing-benefits{{#if ghostcnStyles.benefitsClass}} {{ghostcnStyles.benefitsClass}}{{/if}}\" role=\"list\">{{#foreach benefits}}<li>{{this}}</li>{{/foreach}}</ul>\n {{/if}}\n <div class=\"gh-pricing-actions\">\n {{#if @member}}\n <a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" href=\"#/portal/account/plans\" data-portal=\"account/plans\">{{#if @member.paid}}Manage plan{{else}}Upgrade membership{{/if}}</a>\n {{else}}\n {{#if monthly_price}}\n <a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\"{{#if yearly_price}} data-pricing-interval=\"monthly\"{{/if}} href=\"#/portal/signup/{{id}}/monthly\" data-portal=\"signup/{{id}}/monthly\" aria-label=\"Subscribe monthly to {{name}}\">Subscribe monthly</a>\n {{#if yearly_price}}<a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}} gh-pricing-alternate\" data-pricing-interval=\"yearly\" href=\"#/portal/signup/{{id}}/yearly\" data-portal=\"signup/{{id}}/yearly\" aria-label=\"Subscribe yearly to {{name}}\">Subscribe yearly</a>{{/if}}\n {{else}}\n {{#if yearly_price}}<a class=\"ghcn-button{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" href=\"#/portal/signup/{{id}}/yearly\" data-portal=\"signup/{{id}}/yearly\" aria-label=\"Subscribe yearly to {{name}}\">Subscribe yearly</a>{{/if}}\n {{/if}}\n {{/if}}</div>\n</article>\n {{/if}}\n {{/if}}\n {{/match}}\n {{/foreach}}\n {{else}}\n <p class=\"gh-pricing-empty\">Membership plans are currently unavailable.</p>\n {{/if}}\n {{else}}\n <p class=\"gh-pricing-empty\">Membership plans are currently unavailable.</p>\n {{/get}}\n </div>\n</section>\n{{/if}}\n{{/unless}}\n{{/if}}\n{{/with}}"
|
|
13
27
|
},
|
|
14
28
|
{
|
|
15
29
|
"name": "pricing-table.css",
|
|
16
30
|
"type": "style",
|
|
17
31
|
"target": "assets/css/components/pricing-table.css",
|
|
18
|
-
"content": "/* ghostcn: live membership pricing */\n.gh-pricing { box-sizing: border-box; width:
|
|
32
|
+
"content": "/* ghostcn: live membership pricing */\n.gh-pricing { box-sizing: border-box; min-width: 0; margin-block: var(--ghcn-section-space, clamp(24px, 4vw, 48px)); font-family: inherit; font-size: var(--ghcn-text-body, 16px); line-height: 1.5; color: var(--foreground); width: min(100% - 32px, 960px); margin-inline: auto; }\n.gh-pricing *, .gh-pricing *::before, .gh-pricing *::after { box-sizing: border-box; }\n.gh-pricing-title { font-size: var(--ghcn-title-section, clamp(24px, 3vw, 32px)); font-weight: 700; line-height: 1.18; letter-spacing: -.035em; text-wrap: balance; margin: 0 0 16px; text-align: center; }\n.gh-pricing-billing { display: flex; align-items: center; justify-content: center; gap: 4px; width: fit-content; margin: 0 auto var(--ghcn-section-gap, 20px); padding: 4px; border: 1px solid var(--border); border-radius: 9999px; background: var(--secondary); }\n.gh-pricing-billing[hidden] { display: none; }\n.gh-pricing-billing__btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid transparent; border-radius: 9999px; background: transparent; color: var(--muted-foreground); font: inherit; font-size: var(--ghcn-text-small, 14px); font-weight: 600; cursor: pointer; transition: background-color 150ms ease, color 150ms ease; }\n.gh-pricing-billing__btn:hover { color: var(--foreground); }\n.gh-pricing-billing__btn[aria-pressed=\"true\"] { background: var(--background); color: var(--foreground); border-color: var(--border); box-shadow: 0 1px 2px #0001; }\n.gh-pricing-billing__badge { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 9999px; background: var(--primary); color: var(--primary-foreground); font-size: 11px; font-weight: 700; }\n.gh-pricing-billing__badge[hidden] { display: none; }\n.gh-pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 288px), 1fr)); gap: var(--ghcn-grid-gap, 16px); }\n.gh-pricing-card { box-sizing: border-box; min-width: 0; overflow-wrap: anywhere; border: 1px solid var(--border, #e4e4e7); border-radius: var(--ghcn-panel-radius, min(var(--radius, 8px), 24px)); background: var(--card, #fff); color: var(--card-foreground, #09090b); display: flex; flex-direction: column; gap: 16px; padding: var(--ghcn-panel-padding, clamp(16px, 3vw, 24px)); }\n.gh-pricing-card--paid { border-color: color-mix(in srgb, var(--foreground) 24%, var(--border)); }\n.gh-pricing-card:only-child { width: min(100%, 440px); justify-self: center; }\n.gh-pricing-card__header { display: grid; gap: 4px; }\n.gh-pricing-card__rates { display: grid; gap: 4px; }\n/* Follow the card's local foreground, not the page's dark/light tokens.\n A custom background must be paired with a readable foreground at the call site. */\n.gh-pricing-card-title { font-size: var(--ghcn-title-card, 20px); font-weight: 650; line-height: 1.3; letter-spacing: -.025em; color: inherit; margin: 0; }\n.gh-pricing-description { margin: 0; color: inherit; font-size: var(--ghcn-text-small, 14px); }\n.gh-pricing-benefits { display: grid; gap: 8px; margin: 0; padding: 14px 0 0; border-block-start: 1px solid var(--border); list-style: none; color: inherit; font-size: var(--ghcn-text-small, 14px); }\n.gh-pricing-benefits li { display: flex; align-items: baseline; gap: 10px; color: inherit; }\n.gh-pricing-benefits li::before { content: \"\"; flex: 0 0 5px; height: 9px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }\n.gh-pricing-price { font-size: var(--ghcn-title-section, clamp(24px, 3vw, 32px)); font-weight: 700; line-height: 1.18; letter-spacing: -.035em; text-wrap: balance; margin: 0; color: inherit; font-variant-numeric: tabular-nums; }\n.gh-pricing-price span { font-size: var(--ghcn-text-small, 14px); font-weight: 400; letter-spacing: normal; color: inherit; }\n.gh-pricing-price--alternate { font-size: var(--ghcn-text-small, 14px); font-weight: 600; line-height: 1.5; letter-spacing: normal; }\n.gh-pricing-actions { display: grid; align-content: start; gap: 4px; margin-block-start: auto; padding-block-start: 4px; }\n.gh-pricing-actions:empty, .gh-pricing-card__rates:empty { display: none; }\n:where(.gh-pricing-actions) .ghcn-button--outline { background: var(--background); }\n.gh-pricing-alternate { justify-self: center; background: transparent; color: inherit; text-decoration: underline; text-underline-offset: 3px; }\n/* Progressive billing toggle: when JS activates, promote the selected interval to primary */\n.gh-pricing:where([data-billing=\"monthly\"]) [data-pricing-interval=\"yearly\"],\n.gh-pricing:where([data-billing=\"yearly\"]) [data-pricing-interval=\"monthly\"] { display: none; }\n.gh-pricing:where([data-billing=\"yearly\"]) .gh-pricing-price--alternate { font-size: var(--ghcn-title-section, clamp(24px, 3vw, 32px)); font-weight: 700; line-height: 1.18; letter-spacing: -.035em; text-wrap: balance; }\n.gh-pricing:where([data-billing=\"yearly\"]) .gh-pricing-alternate { justify-self: stretch; background: var(--primary); color: var(--primary-foreground); text-decoration: none; }\n.gh-pricing:focus-visible, :where(.gh-pricing) :focus-visible { outline: 2px solid var(--ring, currentColor); outline-offset: 2px; }\n@media (min-width: 640px) {\n :where(.gh-pricing:not([data-billing]) .gh-pricing-grid:has(.gh-pricing-price--alternate)) .gh-pricing-card__rates { min-block-size: calc(1.18 * var(--ghcn-title-section, clamp(24px, 3vw, 32px)) + 25px); align-content: start; }\n :where(.gh-pricing:not([data-billing]) .gh-pricing-grid:has(.gh-pricing-price--alternate)) .gh-pricing-actions { min-block-size: calc(2 * var(--ghcn-control-height, 40px) + 8px); }\n}\n@media (prefers-reduced-motion: reduce) { .gh-pricing-billing__btn { transition: none; } }\n"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "pricing-table.js",
|
|
36
|
+
"type": "js",
|
|
37
|
+
"target": "assets/js/components/pricing-table.js",
|
|
38
|
+
"content": "/* ghostcn pricing billing toggle: progressive enhancement, zero-JS fallback, repeat-safe. */\n(() => {\n function init() {\n document.querySelectorAll('[data-ghcn-pricing]').forEach(section => {\n if (section.dataset.ghcnPricingReady) return;\n const toggle = section.querySelector('[data-ghcn-billing-toggle]');\n if (!toggle) return;\n const dualCards = [...section.querySelectorAll('.gh-pricing-card--paid[data-monthly-cents][data-yearly-cents]')];\n if (!dualCards.length) return;\n section.dataset.ghcnPricingReady = 'true';\n\n let bestSavings = 0;\n for (const card of dualCards) {\n const monthly = Number(card.dataset.monthlyCents);\n const yearly = Number(card.dataset.yearlyCents);\n if (monthly > 0 && yearly > 0 && yearly < monthly * 12) {\n bestSavings = Math.max(bestSavings, Math.round((1 - yearly / (monthly * 12)) * 100));\n }\n }\n const savingsBadge = toggle.querySelector('[data-billing-savings]');\n if (savingsBadge && bestSavings >= 5) {\n savingsBadge.textContent = 'Save ' + bestSavings + '%';\n savingsBadge.hidden = false;\n }\n\n const buttons = [...toggle.querySelectorAll('[data-billing-choice]')];\n const setIntervalMode = (mode) => {\n section.dataset.billing = mode;\n buttons.forEach(btn => btn.setAttribute('aria-pressed', String(btn.dataset.billingChoice === mode)));\n };\n buttons.forEach(btn => btn.addEventListener('click', () => setIntervalMode(btn.dataset.billingChoice)));\n toggle.hidden = false;\n setIntervalMode(section.dataset.defaultBilling === 'yearly' ? 'yearly' : 'monthly');\n });\n }\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init, { once: true });\n else init();\n})();"
|
|
19
39
|
}
|
|
20
40
|
],
|
|
21
41
|
"gscan": {
|
|
22
42
|
"rules_satisfied": [
|
|
23
43
|
"GS010-PJ-VALID"
|
|
24
44
|
],
|
|
25
|
-
"notes": "Reads public Ghost tiers;
|
|
45
|
+
"notes": "Reads public Ghost tiers; progressive monthly/yearly toggle with zero-JS fallback."
|
|
26
46
|
},
|
|
27
47
|
"styleSlots": {
|
|
28
48
|
"class": [
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "reading-progress",
|
|
3
|
+
"type": "components:content",
|
|
4
|
+
"description": "Thin scroll-linked reading progress bar tracking article scroll depth.",
|
|
5
|
+
"dependencies": [],
|
|
6
|
+
"ghost_version": ">=5.0.0",
|
|
7
|
+
"parameters": {
|
|
8
|
+
"variant": {
|
|
9
|
+
"description": "Progress bar fill style.",
|
|
10
|
+
"options": [
|
|
11
|
+
"default",
|
|
12
|
+
"subtle",
|
|
13
|
+
"gradient"
|
|
14
|
+
],
|
|
15
|
+
"default": "default"
|
|
16
|
+
},
|
|
17
|
+
"size": {
|
|
18
|
+
"description": "Bar thickness (2px, 3px, or 5px).",
|
|
19
|
+
"options": [
|
|
20
|
+
"sm",
|
|
21
|
+
"default",
|
|
22
|
+
"lg"
|
|
23
|
+
],
|
|
24
|
+
"default": "default"
|
|
25
|
+
},
|
|
26
|
+
"contentSelector": {
|
|
27
|
+
"description": "CSS selector for the article element to track.",
|
|
28
|
+
"default": ".ghcn-article-content"
|
|
29
|
+
},
|
|
30
|
+
"ariaLabel": {
|
|
31
|
+
"description": "Accessible label for the progress bar.",
|
|
32
|
+
"default": "Reading progress"
|
|
33
|
+
},
|
|
34
|
+
"initialValue": {
|
|
35
|
+
"description": "Optional initial percentage (0-100) for static previews.",
|
|
36
|
+
"default": "0"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
{
|
|
41
|
+
"name": "reading-progress.hbs",
|
|
42
|
+
"type": "partial",
|
|
43
|
+
"target": "partials/components/reading-progress.hbs",
|
|
44
|
+
"content": "{{!-- Styling parameters: class, barClass --}}\n{{#with this as |ghostcnStyles|}}\n<div class=\"ghcn-reading-progress{{#if ghostcnStyles.class}} {{ghostcnStyles.class}}{{/if}}\" data-ghcn-reading-progress data-variant=\"{{#match variant \"subtle\"}}subtle{{else}}{{#match variant \"gradient\"}}gradient{{else}}default{{/match}}{{/match}}\" data-size=\"{{#match size \"sm\"}}sm{{else}}{{#match size \"lg\"}}lg{{else}}default{{/match}}{{/match}}\" data-content-selector=\"{{#if contentSelector}}{{contentSelector}}{{else}}.ghcn-article-content{{/if}}\">\n <progress class=\"ghcn-reading-progress__bar{{#if ghostcnStyles.barClass}} {{ghostcnStyles.barClass}}{{/if}}\" max=\"100\" value=\"{{#if initialValue}}{{initialValue}}{{else}}0{{/if}}\" aria-label=\"{{#if ariaLabel}}{{ariaLabel}}{{else}}Reading progress{{/if}}\"></progress>\n</div>\n{{/with}}"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "reading-progress.css",
|
|
48
|
+
"type": "style",
|
|
49
|
+
"target": "assets/css/components/reading-progress.css",
|
|
50
|
+
"content": ".ghcn-reading-progress { box-sizing: border-box; position: sticky; top: 0; z-index: 40; width: 100%; height: 3px; background: color-mix(in srgb, var(--border) 60%, transparent); overflow: hidden; }\n.ghcn-reading-progress:where([data-size=\"sm\"]) { height: 2px; }\n.ghcn-reading-progress:where([data-size=\"lg\"]) { height: 5px; }\n.ghcn-reading-progress__bar { display: block; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; appearance: none; background: transparent; color: var(--primary); accent-color: var(--primary); }\n.ghcn-reading-progress__bar::-webkit-progress-bar { background: transparent; }\n.ghcn-reading-progress__bar::-webkit-progress-value { background: var(--primary); transition: width 80ms linear; }\n.ghcn-reading-progress__bar::-moz-progress-bar { background: var(--primary); }\n.ghcn-reading-progress:where([data-variant=\"subtle\"]) .ghcn-reading-progress__bar { color: var(--muted-foreground); accent-color: var(--muted-foreground); }\n.ghcn-reading-progress:where([data-variant=\"subtle\"]) .ghcn-reading-progress__bar::-webkit-progress-value { background: var(--muted-foreground); }\n.ghcn-reading-progress:where([data-variant=\"subtle\"]) .ghcn-reading-progress__bar::-moz-progress-bar { background: var(--muted-foreground); }\n.ghcn-reading-progress:where([data-variant=\"gradient\"]) .ghcn-reading-progress__bar::-webkit-progress-value { background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--foreground))); }\n.ghcn-reading-progress:where([data-variant=\"gradient\"]) .ghcn-reading-progress__bar::-moz-progress-bar { background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--foreground))); }\n@media (prefers-reduced-motion: reduce) { .ghcn-reading-progress__bar::-webkit-progress-value { transition: none; } }\n"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "reading-progress.js",
|
|
54
|
+
"type": "js",
|
|
55
|
+
"target": "assets/js/components/reading-progress.js",
|
|
56
|
+
"content": "/* ghostcn reading progress: scroll-linked article progress bar, CSP-safe via native <progress>. */\n(() => {\n function init() {\n const widgets = [...document.querySelectorAll('[data-ghcn-reading-progress]')].filter(el => !el.dataset.ghcnProgressReady);\n if (!widgets.length) return;\n const entries = widgets.map(el => {\n el.dataset.ghcnProgressReady = 'true';\n let target = null;\n try { target = document.querySelector(el.dataset.contentSelector || '.ghcn-article-content'); } catch {}\n const bar = el.querySelector('progress');\n return bar ? { el, bar, target } : null;\n }).filter(Boolean);\n if (!entries.length) return;\n\n let frame = 0;\n const update = () => {\n frame = 0;\n const vh = window.innerHeight || 1;\n for (const { bar, target } of entries) {\n let ratio = 0;\n if (target) {\n const rect = target.getBoundingClientRect();\n if (rect.height <= vh) continue;\n ratio = Math.min(1, Math.max(0, -rect.top / Math.max(1, rect.height - vh)));\n } else {\n const doc = document.scrollingElement || document.documentElement;\n if (doc.scrollHeight <= doc.clientHeight + 4) continue;\n ratio = Math.min(1, Math.max(0, doc.scrollTop / Math.max(1, doc.scrollHeight - doc.clientHeight)));\n }\n const percent = Math.round(ratio * 100);\n bar.value = percent;\n bar.setAttribute('aria-valuenow', String(percent));\n }\n };\n const schedule = () => { if (!frame) frame = requestAnimationFrame(update); };\n update();\n window.addEventListener('scroll', schedule, { passive: true });\n window.addEventListener('resize', schedule);\n }\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init, { once: true });\n else init();\n})();"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"gscan": {
|
|
60
|
+
"rules_satisfied": [
|
|
61
|
+
"GS010-PJ-VALID"
|
|
62
|
+
],
|
|
63
|
+
"notes": "Uses native <progress> element updated on scroll via requestAnimationFrame; zero inline styles."
|
|
64
|
+
},
|
|
65
|
+
"styleSlots": {
|
|
66
|
+
"class": [
|
|
67
|
+
".ghcn-reading-progress"
|
|
68
|
+
],
|
|
69
|
+
"barClass": [
|
|
70
|
+
".ghcn-reading-progress__bar"
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
"description": "Related reading from the same primary tag, excluding the current post; recent posts when untagged.",
|
|
5
5
|
"dependencies": [],
|
|
6
6
|
"ghost_version": ">=5.0.0",
|
|
7
|
+
"parameters": {
|
|
8
|
+
"heading": {
|
|
9
|
+
"description": "Optional section heading override.",
|
|
10
|
+
"default": "Keep reading"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
7
13
|
"files": [
|
|
8
14
|
{
|
|
9
15
|
"name": "related-posts.hbs",
|
|
@@ -15,7 +21,7 @@
|
|
|
15
21
|
"name": "related-posts.css",
|
|
16
22
|
"type": "style",
|
|
17
23
|
"target": "assets/css/components/related-posts.css",
|
|
18
|
-
"content": "\n.ghcn-related { margin-block:
|
|
24
|
+
"content": "\n.ghcn-related { box-sizing: border-box; min-width: 0; margin-block: var(--ghcn-section-space, clamp(24px, 4vw, 48px)); font-family: inherit; font-size: var(--ghcn-text-body, 16px); line-height: 1.5; color: var(--foreground); }\n.ghcn-related__title { font-size: var(--ghcn-title-section, clamp(24px, 3vw, 32px)); font-weight: 700; line-height: 1.18; letter-spacing: -.035em; text-wrap: balance; margin: 0 0 var(--ghcn-section-gap, 20px); }\n.ghcn-related__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--ghcn-grid-gap, 16px); }\n.ghcn-related__card { box-sizing: border-box; min-width: 0; overflow-wrap: anywhere; border: 1px solid var(--border, #e4e4e7); border-radius: var(--ghcn-panel-radius, min(var(--radius, 8px), 24px)); background: var(--card, #fff); color: var(--card-foreground, #09090b); overflow: hidden; }\n.ghcn-related__image-link { display: block; aspect-ratio: 16/9; overflow: hidden; }\n.ghcn-related__image { display: block; width: 100%; height: 100%; object-fit: cover; }\n.ghcn-related__content { padding: var(--ghcn-panel-padding, clamp(16px, 3vw, 24px)); }\n.ghcn-related__card-title { font-size: var(--ghcn-title-card, 20px); font-weight: 650; line-height: 1.3; letter-spacing: -.025em; color: inherit; margin: 0 0 8px; }\n.ghcn-related__card-title a { color: inherit; text-decoration: none; }\n.ghcn-related__card-title a:hover { text-decoration: underline; }\n.ghcn-related__description { color: var(--muted-foreground); font-size: var(--ghcn-text-small, 14px); margin: 0; }\n.ghcn-related a:focus-visible { outline: 2px solid var(--ring, currentColor); outline-offset: 2px; }\n"
|
|
19
25
|
}
|
|
20
26
|
],
|
|
21
27
|
"gscan": {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "share-buttons",
|
|
3
|
+
"type": "components:content",
|
|
4
|
+
"description": "Accessible article share links (Copy link, Bluesky, X, LinkedIn, Email, and native Web Share).",
|
|
5
|
+
"dependencies": [],
|
|
6
|
+
"ghost_version": ">=5.0.0",
|
|
7
|
+
"parameters": {
|
|
8
|
+
"variant": {
|
|
9
|
+
"description": "Button presentation (default pills, icon-only squares, or ghost buttons).",
|
|
10
|
+
"options": [
|
|
11
|
+
"default",
|
|
12
|
+
"icon",
|
|
13
|
+
"ghost"
|
|
14
|
+
],
|
|
15
|
+
"default": "default"
|
|
16
|
+
},
|
|
17
|
+
"size": {
|
|
18
|
+
"description": "Button scale.",
|
|
19
|
+
"options": [
|
|
20
|
+
"sm",
|
|
21
|
+
"default",
|
|
22
|
+
"lg"
|
|
23
|
+
],
|
|
24
|
+
"default": "default"
|
|
25
|
+
},
|
|
26
|
+
"heading": {
|
|
27
|
+
"description": "Optional label displayed before the share buttons."
|
|
28
|
+
},
|
|
29
|
+
"shareUrl": {
|
|
30
|
+
"description": "Optional URL override; defaults to current post absolute URL."
|
|
31
|
+
},
|
|
32
|
+
"shareTitle": {
|
|
33
|
+
"description": "Optional title override; defaults to current post title."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
{
|
|
38
|
+
"name": "share-buttons.hbs",
|
|
39
|
+
"type": "partial",
|
|
40
|
+
"target": "partials/components/share-buttons.hbs",
|
|
41
|
+
"content": "{{!-- Styling parameters: class, titleClass, listClass, buttonClass --}}\n{{#with this as |ghostcnStyles|}}\n<div class=\"ghcn-share{{#if ghostcnStyles.class}} {{ghostcnStyles.class}}{{/if}}\" data-ghcn-share data-variant=\"{{#match variant \"icon\"}}icon{{else}}{{#match variant \"ghost\"}}ghost{{else}}default{{/match}}{{/match}}\" data-size=\"{{#match size \"sm\"}}sm{{else}}{{#match size \"lg\"}}lg{{else}}default{{/match}}{{/match}}\" data-share-url=\"{{#if shareUrl}}{{shareUrl}}{{else}}{{url absolute=\"true\"}}{{/if}}\" data-share-title=\"{{#if shareTitle}}{{shareTitle}}{{else}}{{title}}{{/if}}\">\n {{#if heading}}<span class=\"ghcn-share__title{{#if ghostcnStyles.titleClass}} {{ghostcnStyles.titleClass}}{{/if}}\">{{heading}}</span>{{/if}}\n <div class=\"ghcn-share__list{{#if ghostcnStyles.listClass}} {{ghostcnStyles.listClass}}{{/if}}\" role=\"group\" aria-label=\"{{#if heading}}{{heading}}{{else}}Share this post{{/if}}\">\n <button type=\"button\" class=\"ghcn-share__btn{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" data-share-copy aria-label=\"Copy link\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M8.5 11.5a3.5 3.5 0 0 0 5 0l2-2a3.5 3.5 0 0 0-5-5l-1 1\"/><path d=\"M11.5 8.5a3.5 3.5 0 0 0-5 0l-2 2a3.5 3.5 0 0 0 5 5l1-1\"/></svg>\n <span class=\"ghcn-share__label\" data-copy-label>Copy link</span>\n </button>\n <a class=\"ghcn-share__btn{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" href=\"https://bsky.app/intent/compose?text={{encode title}}%20{{encode (url absolute=\"true\")}}\" target=\"_blank\" rel=\"noopener noreferrer\" aria-label=\"Share on Bluesky\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 10.5C8.5 7.4 5.5 4.2 3.6 3.3c-.9-.4-1.6.1-1.6 1.1 0 1 .4 4.2.9 5.3.7 1.4 2.2 1.8 3.6 1.6-2.4.4-4.1 1.7-2.2 4.1 2.2 2.7 4.7-.4 5.7-2.4 1 2 3.5 5.1 5.7 2.4 1.9-2.4.2-3.7-2.2-4.1 1.4.2 2.9-.2 3.6-1.6.5-1.1.9-4.3.9-5.3 0-1-.7-1.5-1.6-1.1-1.9.9-4.9 4.1-6.4 7.2Z\"/></svg>\n <span class=\"ghcn-share__label\">Bluesky</span>\n </a>\n <a class=\"ghcn-share__btn{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" href=\"https://x.com/intent/tweet?text={{encode title}}&url={{encode (url absolute=\"true\")}}\" target=\"_blank\" rel=\"noopener noreferrer\" aria-label=\"Share on X\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3.5 3.5 16.5 16.5M16.5 3.5 3.5 16.5\"/></svg>\n <span class=\"ghcn-share__label\">X</span>\n </a>\n <a class=\"ghcn-share__btn{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" href=\"https://www.linkedin.com/sharing/share-offsite/?url={{encode (url absolute=\"true\")}}\" target=\"_blank\" rel=\"noopener noreferrer\" aria-label=\"Share on LinkedIn\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"3\" width=\"14\" height=\"14\" rx=\"2\"/><path d=\"M7 9v4.5M7 6.5v.01M10 13.5V9m0 1.5a2 2 0 0 1 3.5 1.3v1.7\"/></svg>\n <span class=\"ghcn-share__label\">LinkedIn</span>\n </a>\n <a class=\"ghcn-share__btn{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" href=\"mailto:?subject={{encode title}}&body={{encode (url absolute=\"true\")}}\" aria-label=\"Share by email\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2.5\" y=\"4.5\" width=\"15\" height=\"11\" rx=\"1.5\"/><path d=\"m3.5 5.5 6.5 5 6.5-5\"/></svg>\n <span class=\"ghcn-share__label\">Email</span>\n </a>\n <button type=\"button\" class=\"ghcn-share__btn{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" data-share-native hidden aria-label=\"More share options\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 3v9M6.5 6.5 10 3l3.5 3.5M4 12.5v3a1.5 1.5 0 0 0 1.5 1.5h9a1.5 1.5 0 0 0 1.5-1.5v-3\"/></svg>\n <span class=\"ghcn-share__label\">Share</span>\n </button>\n </div>\n <span class=\"ghcn-share__status\" data-share-status role=\"status\" aria-live=\"polite\"></span>\n</div>\n{{/with}}"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "share-buttons.css",
|
|
45
|
+
"type": "style",
|
|
46
|
+
"target": "assets/css/components/share-buttons.css",
|
|
47
|
+
"content": ".ghcn-share { box-sizing: border-box; min-width: 0; margin-block: var(--ghcn-section-space, clamp(24px, 4vw, 48px)); font-family: inherit; font-size: var(--ghcn-text-body, 16px); line-height: 1.5; color: var(--foreground); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }\n.ghcn-share *, .ghcn-share *::before, .ghcn-share *::after { box-sizing: border-box; }\n.ghcn-share__title { font-size: var(--ghcn-text-small, 14px); font-weight: 600; color: var(--muted-foreground); }\n.ghcn-share__list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }\n.ghcn-share__btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--ghcn-control-radius, var(--radius, 8px)); background: var(--card); color: var(--foreground); font: inherit; font-size: var(--ghcn-text-meta, 13px); font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color 150ms ease, border-color 150ms ease; }\n.ghcn-share__btn[hidden] { display: none; }\n.ghcn-share__btn:hover { background: var(--muted); border-color: color-mix(in srgb, var(--foreground) 22%, var(--border)); }\n.ghcn-share:where([data-size=\"sm\"]) .ghcn-share__btn { min-height: 30px; padding: 4px 9px; font-size: 12px; }\n.ghcn-share:where([data-size=\"lg\"]) .ghcn-share__btn { min-height: 42px; padding: 8px 15px; font-size: 14px; }\n.ghcn-share:where([data-variant=\"icon\"]) .ghcn-share__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.ghcn-share:where([data-variant=\"icon\"]) .ghcn-share__btn { width: 36px; padding: 0; }\n.ghcn-share:where([data-variant=\"icon\"][data-size=\"sm\"]) .ghcn-share__btn { width: 30px; }\n.ghcn-share:where([data-variant=\"icon\"][data-size=\"lg\"]) .ghcn-share__btn { width: 42px; }\n.ghcn-share:where([data-variant=\"ghost\"]) .ghcn-share__btn { border-color: transparent; background: transparent; color: var(--muted-foreground); }\n.ghcn-share:where([data-variant=\"ghost\"]) .ghcn-share__btn:hover { background: var(--muted); color: var(--foreground); }\n.ghcn-share__status { font-size: var(--ghcn-text-meta, 13px); color: var(--muted-foreground); }\n.ghcn-share__status:empty { display: none; }\n.ghcn-share:focus-visible, :where(.ghcn-share) :focus-visible { outline: 2px solid var(--ring, currentColor); outline-offset: 2px; }\n@media (prefers-reduced-motion: reduce) { .ghcn-share__btn { transition: none; } }\n"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "share-buttons.js",
|
|
51
|
+
"type": "js",
|
|
52
|
+
"target": "assets/js/components/share-buttons.js",
|
|
53
|
+
"content": "/* ghostcn share buttons: copy-link feedback and native Web Share progressive enhancement. */\n(() => {\n function init() {\n document.querySelectorAll('[data-ghcn-share]').forEach(root => {\n if (root.dataset.ghcnShareReady) return;\n root.dataset.ghcnShareReady = 'true';\n const status = root.querySelector('[data-share-status]');\n const copyBtn = root.querySelector('[data-share-copy]');\n const nativeBtn = root.querySelector('[data-share-native]');\n const shareUrl = root.dataset.shareUrl || window.location.href;\n const shareTitle = root.dataset.shareTitle || document.title;\n\n if (copyBtn) {\n copyBtn.addEventListener('click', async () => {\n const label = copyBtn.querySelector('[data-copy-label]');\n try {\n if (navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(shareUrl);\n } else {\n const input = document.createElement('input');\n input.value = shareUrl;\n document.body.append(input);\n input.select();\n document.execCommand('copy');\n input.remove();\n }\n if (label) label.textContent = 'Copied';\n if (status) status.textContent = 'Link copied to clipboard.';\n setTimeout(() => {\n if (label) label.textContent = 'Copy link';\n if (status) status.textContent = '';\n }, 2000);\n } catch {\n if (status) status.textContent = 'Could not copy link automatically.';\n }\n });\n }\n\n if (nativeBtn && typeof navigator.share === 'function') {\n nativeBtn.hidden = false;\n nativeBtn.addEventListener('click', () => {\n navigator.share({ title: shareTitle, url: shareUrl }).catch(() => {});\n });\n }\n });\n }\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init, { once: true });\n else init();\n})();"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"gscan": {
|
|
57
|
+
"rules_satisfied": [
|
|
58
|
+
"GS010-PJ-VALID"
|
|
59
|
+
],
|
|
60
|
+
"notes": "Uses native Ghost url and encode helpers with progressive Clipboard and Web Share API support."
|
|
61
|
+
},
|
|
62
|
+
"styleSlots": {
|
|
63
|
+
"class": [
|
|
64
|
+
".ghcn-share"
|
|
65
|
+
],
|
|
66
|
+
"titleClass": [
|
|
67
|
+
".ghcn-share__title"
|
|
68
|
+
],
|
|
69
|
+
"listClass": [
|
|
70
|
+
".ghcn-share__list"
|
|
71
|
+
],
|
|
72
|
+
"buttonClass": [
|
|
73
|
+
".ghcn-share__btn"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"name": "site-footer.hbs",
|
|
10
10
|
"type": "partial",
|
|
11
11
|
"target": "partials/components/site-footer.hbs",
|
|
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
|
|
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=\"{{#match @site.url \"/\"}}/rss/{{else}}{{@site.url}}/rss/{{/match}}\">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",
|
|
16
16
|
"type": "style",
|
|
17
17
|
"target": "assets/css/components/site-footer.css",
|
|
18
|
-
"content": "/* ghostcn: Site Footer */\n.ghcn-footer { box-sizing: border-box; border-top: 1px solid var(--border); color: var(--foreground); background: var(--card); font-family: inherit; font-size: 16px; line-height: 1.5; isolation: isolate; }\n.ghcn-footer *, .ghcn-footer *::before, .ghcn-footer *::after { box-sizing: border-box; }\n.ghcn-footer__inner { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr) auto; gap:
|
|
18
|
+
"content": "/* ghostcn: Site Footer */\n.ghcn-footer { box-sizing: border-box; border-top: 1px solid var(--border); color: var(--foreground); background: var(--card); font-family: inherit; font-size: 16px; line-height: 1.5; isolation: isolate; }\n.ghcn-footer *, .ghcn-footer *::before, .ghcn-footer *::after { box-sizing: border-box; }\n.ghcn-footer__inner { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr) auto; gap: var(--ghcn-section-gap, 20px); padding-block: var(--ghcn-section-space, clamp(24px, 4vw, 48px)); }\n.ghcn-footer__brand a { color: var(--foreground); font-size: 18px; font-weight: 800; text-decoration: none; }\n.ghcn-footer__brand p { max-width: 480px; margin: 8px 0 0; color: var(--muted-foreground); font-size: 14px; }\n.ghcn-footer .nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 24px; margin: 0; padding: 0; list-style: none; }\n.ghcn-footer a { color: var(--muted-foreground); font-size: 14px; text-decoration: none; }\n.ghcn-footer a:hover { color: var(--foreground); }\n.ghcn-footer__social { display: flex; flex-direction: column; gap: 8px; }\n.ghcn-footer__legal { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--border); padding-block: 20px; color: var(--muted-foreground); font-size: 12px; }\n@media (max-width: 720px) { .ghcn-footer__inner { grid-template-columns: 1fr; gap: 32px; } .ghcn-footer__social { flex-direction: row; flex-wrap: wrap; } }\n@media (max-width: 480px) { .ghcn-footer__legal { align-items: flex-start; flex-direction: column; } }\n"
|
|
19
19
|
}
|
|
20
20
|
],
|
|
21
21
|
"gscan": {
|
|
@@ -15,7 +15,7 @@
|
|
|
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:
|
|
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: 64px; align-items: center; gap: var(--ghcn-grid-gap, 16px); }\n.ghcn-header__brand { display: inline-flex; flex: 0 0 auto; align-items: center; color: var(--foreground); font-size: 18px; font-weight: 800; letter-spacing: -0.025em; text-decoration: none; }\n.ghcn-header__brand img { display: block; width: auto; max-width: 176px; max-height: 36px; }\n.ghcn-header__nav { min-width: 0; flex: 1; }\n.ghcn-header .nav { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin: 0; padding: 0; list-style: none; }\n.ghcn-header .nav a, .ghcn-header__signin { color: var(--muted-foreground); font-size: 14px; 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: 12px; }\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 { box-sizing: border-box; min-width: 0; overflow-wrap: anywhere; border: 1px solid var(--border, #e4e4e7); border-radius: var(--ghcn-panel-radius, min(var(--radius, 8px), 24px)); background: var(--card, #fff); color: var(--card-foreground, #09090b); position: absolute; top: calc(100% + 8px); right: 16px; left: 16px; padding: 16px; background: var(--popover); color: var(--popover-foreground); box-shadow: 0 8px 24px #0002; }\n.ghcn-header__panel .nav { align-items: stretch; flex-direction: column; gap: 4px; }\n.ghcn-header__panel .nav a { display: block; border-radius: var(--radius); padding: 10px 12px; }\n.ghcn-header__panel .nav a:hover { background: var(--muted); }\n.ghcn-header__mobile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }\n.ghcn-header__mobile-actions .ghcn-button { flex: 1 1 auto; }\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": {
|
|
@@ -4,24 +4,34 @@
|
|
|
4
4
|
"description": "Progressively enhanced h2/h3 navigation with collision-safe anchors and keyboard focus.",
|
|
5
5
|
"dependencies": [],
|
|
6
6
|
"ghost_version": ">=5.0.0",
|
|
7
|
+
"parameters": {
|
|
8
|
+
"heading": {
|
|
9
|
+
"description": "Optional heading for the table of contents.",
|
|
10
|
+
"default": "On this page"
|
|
11
|
+
},
|
|
12
|
+
"contentSelector": {
|
|
13
|
+
"description": "CSS selector for the article container to scan.",
|
|
14
|
+
"default": ".ghcn-article-content"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
7
17
|
"files": [
|
|
8
18
|
{
|
|
9
19
|
"name": "table-of-contents.hbs",
|
|
10
20
|
"type": "partial",
|
|
11
21
|
"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}}"
|
|
22
|
+
"content": "{{!-- Styling parameters: class, titleClass, listClass, linkClass --}}\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=\"{{#if heading}}{{heading}}{{else}}On this page{{/if}}\" hidden>\n <h2 class=\"ghcn-toc__title{{#if ghostcnStyles.titleClass}} {{ghostcnStyles.titleClass}}{{/if}}\"><svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"><path d=\"M5 5h11M5 10h8M5 15h5M2 5h.01M2 10h.01M2 15h.01\"/></svg>{{#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
23
|
},
|
|
14
24
|
{
|
|
15
25
|
"name": "table-of-contents.css",
|
|
16
26
|
"type": "style",
|
|
17
27
|
"target": "assets/css/components/table-of-contents.css",
|
|
18
|
-
"content": "\n.ghcn-toc {
|
|
28
|
+
"content": "\n.ghcn-toc { box-sizing: border-box; min-width: 0; margin-block: var(--ghcn-section-space, clamp(24px, 4vw, 48px)); font-family: inherit; font-size: var(--ghcn-text-body, 16px); line-height: 1.5; color: var(--foreground); }\n.ghcn-toc[hidden] { display: none; }\n.ghcn-toc__title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--muted-foreground); font: inherit; font-size: var(--ghcn-text-small, 14px); font-weight: 600; }\n.ghcn-toc__title svg { flex: none; }\n.ghcn-toc__list { list-style: none; padding: 0; margin: 0; border-inline-start: 1px solid var(--border); }\n.ghcn-toc__item { margin: 0; padding: 0; }\n.ghcn-toc__link { position: relative; display: block; padding: 7px 12px; color: var(--muted-foreground); font-size: var(--ghcn-text-small, 14px); line-height: 1.45; text-decoration: none; overflow-wrap: anywhere; }\n:where(.ghcn-toc__item--nested) > .ghcn-toc__link { padding-inline-start: 26px; }\n.ghcn-toc__link:hover, .ghcn-toc__link:where([aria-current=\"location\"]) { color: var(--foreground); }\n.ghcn-toc__link:where([aria-current=\"location\"]) { font-weight: 600; }\n.ghcn-toc__link:where([aria-current=\"location\"])::before { content: \"\"; position: absolute; inset-block: 4px; inset-inline-start: -1px; width: 2px; border-radius: 2px; background: currentColor; }\n.ghcn-toc__link:focus-visible { outline: 2px solid var(--ring, currentColor); outline-offset: 2px; }\n:where([data-ghcn-toc-heading]) { scroll-margin-block-start: var(--ghcn-toc-offset, 80px); }\n@media (min-width: 1024px) {\n .ghcn-toc:where(.ghcn-toc--sticky) { position: sticky; inset-block-start: var(--ghcn-toc-top, 80px); align-self: start; margin-block-start: 0; }\n :where(.ghcn-toc--sticky) .ghcn-toc__list { max-block-size: max(120px, 100dvh - var(--ghcn-toc-top, 80px) - 56px); overflow-y: auto; }\n :where(.ghcn-toc--sticky) .ghcn-toc__link:focus-visible { outline-offset: -2px; }\n}\n"
|
|
19
29
|
},
|
|
20
30
|
{
|
|
21
31
|
"name": "table-of-contents.js",
|
|
22
32
|
"type": "js",
|
|
23
33
|
"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
|
|
34
|
+
"content": "/* ghostcn table of contents: no dependencies, no HTML injection, repeat-safe. */\n(() => {\n function setCurrent(group, index) {\n if (index === group.current) return;\n group.views.forEach(links => {\n links[group.current]?.removeAttribute('aria-current');\n links[index]?.setAttribute('aria-current', 'location');\n });\n group.current = index;\n }\n\n function currentFromScroll(group) {\n const { headings } = group;\n const offset = Math.max(0, parseFloat(getComputedStyle(headings[0]).scrollMarginBlockStart) || 0);\n const limit = Math.min(offset + 4, window.innerHeight / 2);\n let index = 0;\n for (let i = 0; i < headings.length; i++) {\n if (headings[i].getBoundingClientRect().top > limit) break;\n index = i;\n }\n // The final heading may never reach the activation line on a short section.\n const page = document.scrollingElement;\n if (page && page.scrollHeight > page.clientHeight + 2 &&\n page.scrollTop + page.clientHeight >= page.scrollHeight - 2 &&\n headings.at(-1).getBoundingClientRect().top < window.innerHeight) {\n index = headings.length - 1;\n }\n setCurrent(group, index);\n }\n\n const init = () => {\n const groups = new Map();\n const used = new Set([...document.querySelectorAll('[id]')].map(el => el.id));\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 const list = nav.querySelector('[data-toc-list]');\n if (!list) return;\n let group = groups.get(content);\n if (!group) {\n // Editor card UI titles are not article sections.\n const headings = [...content.querySelectorAll('h2, h3')]\n .filter(h => h.textContent.trim() && !h.closest('.kg-card, [hidden], [data-ghcn-toc]'));\n if (headings.length < 2) return;\n headings.forEach((heading, index) => {\n if (!heading.id) {\n const slug = heading.textContent.toLowerCase().normalize('NFKD').replace(/[̀-ͯ]/g, '').replace(/[^p{L}p{N}]+/gu, '-').replace(/^-|-$/g, '');\n const base = 'ghcn-' + (slug || '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 heading.setAttribute('data-ghcn-toc-heading', '');\n });\n group = { headings, views: [], current: -1, jumpY: null };\n groups.set(content, group);\n }\n const links = group.headings.map((heading, index) => {\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: 'instant', 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 group.jumpY = window.scrollY;\n setCurrent(group, index);\n });\n item.append(link); list.append(item);\n return link;\n });\n group.views.push(links);\n nav.dataset.ghcnTocReady = 'true'; nav.hidden = false;\n });\n if (!groups.size) return;\n\n function syncHash() {\n let id = '';\n try { id = decodeURIComponent(location.hash.slice(1)); } catch {}\n groups.forEach(group => {\n const index = group.headings.findIndex(heading => heading.id === id);\n group.jumpY = index < 0 ? null : window.scrollY;\n if (index < 0) currentFromScroll(group);\n else setCurrent(group, index);\n });\n }\n\n let frame = 0;\n const schedule = () => {\n if (frame) return;\n frame = requestAnimationFrame(() => {\n frame = 0;\n groups.forEach(group => {\n if (group.jumpY !== null && Math.abs(group.jumpY - window.scrollY) < 2) return;\n group.jumpY = null;\n currentFromScroll(group);\n });\n });\n };\n syncHash();\n window.addEventListener('scroll', schedule, { passive: true });\n window.addEventListener('resize', schedule);\n window.addEventListener('load', schedule, { once: true });\n window.addEventListener('hashchange', syncHash);\n };\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init, { once: true }); else init();\n})();"
|
|
25
35
|
}
|
|
26
36
|
],
|
|
27
37
|
"gscan": {
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"name": "tag-grid.hbs",
|
|
30
30
|
"type": "partial",
|
|
31
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}}"
|
|
32
|
+
"content": "{{!-- Styling parameters: class, titleClass, gridClass, cardClass, cardTitleClass, descriptionClass, buttonClass --}}\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\" ariaLabel=name 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
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"name": "tag-grid.css",
|
|
36
36
|
"type": "style",
|
|
37
37
|
"target": "assets/css/components/tag-grid.css",
|
|
38
|
-
"content": ".ghcn-tag-grid { font-size: 16px; color: var(--foreground); margin-
|
|
38
|
+
"content": ".ghcn-tag-grid { box-sizing: border-box; min-width: 0; margin-block: var(--ghcn-section-space, clamp(24px, 4vw, 48px)); font-family: inherit; font-size: var(--ghcn-text-body, 16px); line-height: 1.5; color: var(--foreground); width: min(100% - 32px, 1152px); margin-inline: auto; }\n.ghcn-tag-grid__title { font-size: var(--ghcn-title-section, clamp(24px, 3vw, 32px)); font-weight: 700; line-height: 1.18; letter-spacing: -.035em; text-wrap: balance; margin: 0 0 var(--ghcn-section-gap, 20px); }\n.ghcn-tag-grid__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--ghcn-grid-gap, 16px); }\n.ghcn-tag-grid__grid > * { min-width: 0; }\n.ghcn-tag-grid__empty { color: var(--muted-foreground); }\n:where(.ghcn-tag-grid__grid) > .ghcn-ui-card { display: flex; flex-direction: column; }\n:where(.ghcn-tag-grid__grid) .ghcn-ui-card__content { margin-top: auto; }\n"
|
|
39
39
|
}
|
|
40
40
|
],
|
|
41
41
|
"styleSlots": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"name": "tag-list.css",
|
|
16
16
|
"type": "style",
|
|
17
17
|
"target": "assets/css/components/tag-list.css",
|
|
18
|
-
"content": "\n.ghcn-tag-list { margin-block: 1.
|
|
18
|
+
"content": "\n.ghcn-tag-list { box-sizing: border-box; min-width: 0; margin-block: var(--ghcn-section-space, clamp(24px, 4vw, 48px)); font-family: inherit; font-size: var(--ghcn-text-body, 16px); line-height: 1.5; color: var(--foreground); }\n.ghcn-tag-list__items { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }\n.ghcn-tag-list__link { display: block; padding: 5px 10px; background: var(--secondary); color: var(--secondary-foreground); border: 1px solid var(--border); border-radius: 999px; font-size: var(--ghcn-text-meta, 13px); font-weight: 600; 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, currentColor); outline-offset: 2px; }\n"
|
|
19
19
|
}
|
|
20
20
|
],
|
|
21
21
|
"gscan": {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "theme-toggle",
|
|
3
|
+
"type": "components:layout",
|
|
4
|
+
"description": "Light, dark, and system theme switcher syncing .dark-mode and .auto-color with localStorage persistence.",
|
|
5
|
+
"dependencies": [],
|
|
6
|
+
"ghost_version": ">=5.0.0",
|
|
7
|
+
"parameters": {
|
|
8
|
+
"variant": {
|
|
9
|
+
"description": "Visual treatment; segmented 3-way pill, compact icon, or outline button.",
|
|
10
|
+
"options": [
|
|
11
|
+
"default",
|
|
12
|
+
"compact",
|
|
13
|
+
"outline"
|
|
14
|
+
],
|
|
15
|
+
"default": "default"
|
|
16
|
+
},
|
|
17
|
+
"size": {
|
|
18
|
+
"description": "Control scale.",
|
|
19
|
+
"options": [
|
|
20
|
+
"sm",
|
|
21
|
+
"default",
|
|
22
|
+
"lg"
|
|
23
|
+
],
|
|
24
|
+
"default": "default"
|
|
25
|
+
},
|
|
26
|
+
"ariaLabel": {
|
|
27
|
+
"description": "Accessible label for the theme toggle group.",
|
|
28
|
+
"default": "Color theme"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
{
|
|
33
|
+
"name": "theme-toggle.hbs",
|
|
34
|
+
"type": "partial",
|
|
35
|
+
"target": "partials/components/theme-toggle.hbs",
|
|
36
|
+
"content": "{{!-- Styling parameters: class, buttonClass --}}\n{{#with this as |ghostcnStyles|}}\n<div class=\"ghcn-theme-toggle{{#if ghostcnStyles.class}} {{ghostcnStyles.class}}{{/if}}\" data-ghcn-theme-toggle data-variant=\"{{#match variant \"compact\"}}compact{{else}}{{#match variant \"outline\"}}outline{{else}}default{{/match}}{{/match}}\" data-size=\"{{#match size \"sm\"}}sm{{else}}{{#match size \"lg\"}}lg{{else}}default{{/match}}{{/match}}\" role=\"group\" aria-label=\"{{#if ariaLabel}}{{ariaLabel}}{{else}}Color theme{{/if}}\">\n {{#match variant \"compact\"}}\n <button type=\"button\" class=\"ghcn-theme-toggle__btn{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}} ghcn-theme-toggle__btn--cycle\" data-theme-cycle aria-label=\"Toggle color theme\"><svg class=\"ghcn-theme-toggle__sun\" aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"10\" cy=\"10\" r=\"3.5\"/><path d=\"M10 2.5v1.5M10 16v1.5M4.7 4.7l1.1 1.1M14.2 14.2l1.1 1.1M2.5 10H4M16 10h1.5M4.7 15.3l1.1-1.1M14.2 5.8l1.1-1.1\"/></svg><svg class=\"ghcn-theme-toggle__moon\" aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16.5 12.2A6.5 6.5 0 0 1 7.8 3.5a6.5 6.5 0 1 0 8.7 8.7Z\"/></svg></button>\n {{else}}{{#match variant \"outline\"}}\n <button type=\"button\" class=\"ghcn-theme-toggle__btn{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}} ghcn-theme-toggle__btn--cycle\" data-theme-cycle aria-label=\"Toggle color theme\"><svg class=\"ghcn-theme-toggle__sun\" aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"10\" cy=\"10\" r=\"3.5\"/><path d=\"M10 2.5v1.5M10 16v1.5M4.7 4.7l1.1 1.1M14.2 14.2l1.1 1.1M2.5 10H4M16 10h1.5M4.7 15.3l1.1-1.1M14.2 5.8l1.1-1.1\"/></svg><svg class=\"ghcn-theme-toggle__moon\" aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16.5 12.2A6.5 6.5 0 0 1 7.8 3.5a6.5 6.5 0 1 0 8.7 8.7Z\"/></svg><span data-theme-label>Theme</span></button>\n {{else}}\n <button type=\"button\" class=\"ghcn-theme-toggle__btn{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" data-theme-value=\"light\" aria-label=\"Light theme\" aria-pressed=\"false\"><svg class=\"ghcn-theme-toggle__sun\" aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"10\" cy=\"10\" r=\"3.5\"/><path d=\"M10 2.5v1.5M10 16v1.5M4.7 4.7l1.1 1.1M14.2 14.2l1.1 1.1M2.5 10H4M16 10h1.5M4.7 15.3l1.1-1.1M14.2 5.8l1.1-1.1\"/></svg></button>\n <button type=\"button\" class=\"ghcn-theme-toggle__btn{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" data-theme-value=\"system\" aria-label=\"System theme\" aria-pressed=\"false\"><svg class=\"ghcn-theme-toggle__system\" aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2.5\" y=\"3.5\" width=\"15\" height=\"10\" rx=\"1.5\"/><path d=\"M7 16.5h6M10 13.5v3\"/></svg></button>\n <button type=\"button\" class=\"ghcn-theme-toggle__btn{{#if ghostcnStyles.buttonClass}} {{ghostcnStyles.buttonClass}}{{/if}}\" data-theme-value=\"dark\" aria-label=\"Dark theme\" aria-pressed=\"false\"><svg class=\"ghcn-theme-toggle__moon\" aria-hidden=\"true\" viewBox=\"0 0 20 20\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16.5 12.2A6.5 6.5 0 0 1 7.8 3.5a6.5 6.5 0 1 0 8.7 8.7Z\"/></svg></button>\n {{/match}}{{/match}}\n</div>\n{{/with}}"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "theme-toggle.css",
|
|
40
|
+
"type": "style",
|
|
41
|
+
"target": "assets/css/components/theme-toggle.css",
|
|
42
|
+
"content": ".ghcn-theme-toggle { box-sizing: border-box; display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 9999px; background: var(--secondary); color: var(--foreground); font-family: inherit; font-size: var(--ghcn-text-small, 14px); line-height: 1; }\n.ghcn-theme-toggle *, .ghcn-theme-toggle *::before, .ghcn-theme-toggle *::after { box-sizing: border-box; }\n.ghcn-theme-toggle:where([data-variant=\"compact\"]), .ghcn-theme-toggle:where([data-variant=\"outline\"]) { padding: 0; background: transparent; border-color: transparent; }\n.ghcn-theme-toggle__btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 9999px; background: transparent; color: var(--muted-foreground); font: inherit; font-weight: 600; cursor: pointer; transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease; }\n.ghcn-theme-toggle:where([data-size=\"sm\"]) .ghcn-theme-toggle__btn { min-width: 28px; height: 28px; padding: 0 6px; font-size: 12px; }\n.ghcn-theme-toggle:where([data-size=\"lg\"]) .ghcn-theme-toggle__btn { min-width: 38px; height: 38px; padding: 0 12px; font-size: 15px; }\n.ghcn-theme-toggle__btn:hover { color: var(--foreground); }\n.ghcn-theme-toggle__btn[aria-pressed=\"true\"] { background: var(--background); color: var(--foreground); border-color: var(--border); box-shadow: 0 1px 2px #0001; }\n.ghcn-theme-toggle:where([data-variant=\"compact\"]) .ghcn-theme-toggle__btn--cycle,\n.ghcn-theme-toggle:where([data-variant=\"outline\"]) .ghcn-theme-toggle__btn--cycle { border-color: var(--border); background: var(--card); color: var(--foreground); border-radius: var(--ghcn-control-radius, var(--radius, 8px)); padding: 0 10px; }\n.ghcn-theme-toggle:where([data-variant=\"compact\"]) .ghcn-theme-toggle__btn--cycle { padding: 0; }\n.ghcn-theme-toggle:where([data-variant=\"compact\"]) .ghcn-theme-toggle__btn--cycle:hover,\n.ghcn-theme-toggle:where([data-variant=\"outline\"]) .ghcn-theme-toggle__btn--cycle:hover { background: var(--muted); }\n.ghcn-theme-toggle__btn--cycle .ghcn-theme-toggle__moon { display: none; }\n.ghcn-theme-toggle[data-resolved=\"dark\"] .ghcn-theme-toggle__btn--cycle .ghcn-theme-toggle__sun { display: none; }\n.ghcn-theme-toggle[data-resolved=\"dark\"] .ghcn-theme-toggle__btn--cycle .ghcn-theme-toggle__moon { display: block; }\n.ghcn-theme-toggle:focus-visible, :where(.ghcn-theme-toggle) :focus-visible { outline: 2px solid var(--ring, currentColor); outline-offset: 2px; }\n@media (prefers-reduced-motion: reduce) { .ghcn-theme-toggle__btn { transition: none; } }\n"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "theme-toggle.js",
|
|
46
|
+
"type": "js",
|
|
47
|
+
"target": "assets/js/components/theme-toggle.js",
|
|
48
|
+
"content": "/* ghostcn theme toggle: persists light/dark/system preference, repeat-safe, no dependencies. */\n(() => {\n const KEY = 'ghcn-theme';\n const root = document.documentElement;\n const media = window.matchMedia('(prefers-color-scheme: dark)');\n\n function readPreference() {\n try {\n const saved = localStorage.getItem(KEY);\n if (saved === 'light' || saved === 'dark' || saved === 'system') return saved;\n } catch {}\n if (root.classList.contains('dark-mode') || root.classList.contains('dark')) return 'dark';\n if (root.classList.contains('auto-color')) return 'system';\n return 'light';\n }\n\n function applyTheme(mode, persist) {\n const resolved = mode === 'system' ? (media.matches ? 'dark' : 'light') : mode;\n root.classList.toggle('auto-color', mode === 'system');\n root.classList.toggle('dark-mode', resolved === 'dark');\n root.classList.toggle('dark', resolved === 'dark');\n root.setAttribute('data-theme', resolved);\n if (persist) {\n try { localStorage.setItem(KEY, mode); } catch {}\n }\n document.querySelectorAll('[data-ghcn-theme-toggle]').forEach(container => {\n container.dataset.mode = mode;\n container.dataset.resolved = resolved;\n container.querySelectorAll('[data-theme-value]').forEach(btn => {\n btn.setAttribute('aria-pressed', String(btn.dataset.themeValue === mode));\n });\n const cycle = container.querySelector('[data-theme-cycle]');\n if (cycle) {\n const next = resolved === 'dark' ? 'light' : 'dark';\n cycle.setAttribute('aria-label', 'Switch to ' + next + ' theme');\n const label = cycle.querySelector('[data-theme-label]');\n if (label) label.textContent = resolved === 'dark' ? 'Dark' : 'Light';\n }\n });\n }\n\n function init() {\n const mode = readPreference();\n applyTheme(mode, false);\n document.querySelectorAll('[data-ghcn-theme-toggle]').forEach(container => {\n if (container.dataset.ghcnThemeReady) return;\n container.dataset.ghcnThemeReady = 'true';\n container.querySelectorAll('[data-theme-value]').forEach(btn => {\n btn.addEventListener('click', () => applyTheme(btn.dataset.themeValue, true));\n });\n const cycle = container.querySelector('[data-theme-cycle]');\n if (cycle) {\n cycle.addEventListener('click', () => {\n const isDark = root.classList.contains('dark-mode') || root.classList.contains('dark');\n applyTheme(isDark ? 'light' : 'dark', true);\n });\n }\n });\n media.addEventListener?.('change', () => {\n if (readPreference() === 'system') applyTheme('system', false);\n });\n }\n\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init, { once: true });\n else init();\n})();"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"gscan": {
|
|
52
|
+
"rules_satisfied": [
|
|
53
|
+
"GS010-PJ-VALID"
|
|
54
|
+
],
|
|
55
|
+
"notes": "Syncs html.dark-mode and html.auto-color with localStorage; zero external dependencies."
|
|
56
|
+
},
|
|
57
|
+
"styleSlots": {
|
|
58
|
+
"class": [
|
|
59
|
+
".ghcn-theme-toggle"
|
|
60
|
+
],
|
|
61
|
+
"buttonClass": [
|
|
62
|
+
".ghcn-theme-toggle__btn"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|