diff --git a/docs/site/img/og.jpg b/docs/site/img/og.jpg new file mode 100644 index 0000000..860f012 Binary files /dev/null and b/docs/site/img/og.jpg differ diff --git a/docs/site/index.html b/docs/site/index.html index 7a3d752..ea46080 100644 --- a/docs/site/index.html +++ b/docs/site/index.html @@ -6,39 +6,130 @@ Magic MessageGate: WhatsApp, RCS, Telegram and SMS for Strapi 5 - - - + + + + + + - - - + + + + + + + + + + @@ -47,310 +138,370 @@
- - + + Magic MessageGate -
-
-
-
-

Strapi 5 plugin · MIT

-

WhatsApp, RCS, Telegram and SMS for Strapi.

-

- Send a template or a file with one call. MessageGate picks the channel, sends the message exactly once, - tracks it to delivered and read, and falls back to RCS and SMS when WhatsApp can't reach - the number. Replies, button taps and photos come back as events your code can answer. It uses the official - provider APIs only. -

- -

- npm version - npm downloads - CI build status - License: MIT - Strapi 5.38+ - Documentation site -

-
    -
  • Strapi ^5.38
  • -
  • Node.js 22 / 24
  • -
  • PostgreSQL · MySQL 8 · SQLite
  • -
  • 5 admin languages
  • -
-
-
- - - - A message in the MessageGate admin with its delivery timeline - -
-
- -
-

What it does

-
-
-

Four channels, one API

-

- WhatsApp through Meta's Cloud API, RCS through Twilio, Telegram through the Bot API, SMS through seven.io - or Twilio. No vendor SDKs. -

-
-
-

Templates with live preview

-

- Variables, a preview per channel and the SMS part count. WhatsApp templates are submitted to Meta from - Strapi, and their approval status updates by itself. +

+
+
+
+ +

WhatsApp, RCS, Telegram and SMS for Strapi

+

+ Magic MessageGate is a free, MIT-licensed Strapi 5 plugin that sends WhatsApp, RCS, Telegram and SMS + messages through the official provider APIs, exactly once, and turns replies into events your code can + answer.

-
-
-

Exactly once

- A durable outbox in your database. Each message goes out once, also with several Strapi processes. The - same idempotency key never sends twice. + Send a template or a file with one call. MessageGate picks the channel, tracks each message to + delivered and read, and falls back to RCS and SMS when WhatsApp can't reach the number.

-
-
-

Delivery and read tracking

-

Every message has a timeline, and failures come with a reason in plain language.

-
-
-

Fallback chain and routing rules

-

- WhatsApp → RCS → SMS. Numbers that aren't on WhatsApp or can't receive RCS are remembered. Set the channel - order per template, tag or country. E-mail through Magic Mail is opt-in and off by default. -

-
-
-

Consent and GDPR

-

- Consent per channel, STOP keywords, export and erasure per contact. Phone numbers are stored encrypted. -

-
-
-

Number checks

-

- A free format check, plus optional paid checks with one cache and budget: Twilio line type and seven.io HLR. - Sends to unassigned numbers can stop before they cost anything. -

-
-
-

Attachments

-

- PDF, images and videos from the media library or a public https URL. SMS gets a short signed link that - expires. -

-
-
-

Inbox and automation

-

- Replies, buttons, photos, documents, voice notes and locations arrive once as an event. Files are checked - and stored in the media library. Answer from code or from the admin. -

-
-
-

Built for tests

-

- A dry run shows the route and message without sending. A sandbox with magic test numbers runs app tests - without network or cost. -

-
-
-

Safe retries

-

- Retries only when the provider provably didn't take the message. An unknown outcome becomes - uncertain, and an admin decides. +

+
    +
  • Strapi ^5.38
  • +
  • Node.js 22.21+ or 24.9+ (to 26.x)
  • +
  • PostgreSQL, MySQL 8, SQLite
  • +
  • 5 admin languages
  • +
+

+ npm version + npm downloads + CI build status + License: MIT + Strapi 5.38+ + Documentation site

-
-
-
- -
-

What the official APIs allow

-

People often ask for things the providers don't offer. Here is what is possible.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
QuestionWhatsAppTelegramSMSMessageGate
Does the number exist?No check before sending; error 131026 on the first send means "not on WhatsApp"Only for people who started your botPaid carrier lookupsFree format check, optional paid lookup, learns from the first send
Can it receive RCS?––Twilio has no RCS checkTries RCS, learns from error 63036, falls back to SMS
Is the person online?Not availableNot availableNot availableShows the last activity instead
Has the person read it?Yes, unless read receipts are offNo read receipts for botsDelivery receipt onlyTimeline per message, read rate per template (a lower bound)
-
-
- -
-

The admin

-

- Built only from the Strapi Design System. Every screen works in light and dark mode and at phone width. -

- +
- + + Analytics with delivery and read rates -
Delivery and read rates
-
-
- - - Number check dialog - -
Number check
+ + +
+ + +
+
+

Is MessageGate the right fit?

+
+
+

Use it when

+
    +
  • Strapi should send WhatsApp, RCS, Telegram or SMS messages from code or from another service.
  • +
  • Each message must go out exactly once and you want to follow it to delivered and read.
  • +
  • Replies, button taps and files should arrive as events your code can answer.
  • +
  • You need consent per channel, STOP keywords and GDPR export and erasure.
  • +
+
+
+

Skip it when

+
    +
  • You want to connect a personal WhatsApp number. Only a Business App number or a new number works.
  • +
  • You need to know before sending whether a number has WhatsApp or RCS. No official API offers that.
  • +
  • You only send e-mail. MessageGate never sends e-mail itself.
  • +
+
+
+

Requirements

+
    +
  • Strapi ^5.38.0
  • +
  • Node.js ^22.21.0 || >=24.9.0 <=26.x.x
  • +
  • PostgreSQL, MySQL 8 or SQLite
  • +
  • An account per channel: Meta app, Twilio, seven.io or a Telegram bot
  • +
+
+
+
+ +
+

What it does

+
+
+

Four channels, one API

+

+ WhatsApp through Meta's Cloud API, RCS through Twilio, Telegram through the Bot API, SMS through seven.io + or Twilio. No vendor SDKs. +

+
+
+

Templates with live preview

+

+ Variables, a preview per channel and the SMS part count. WhatsApp templates are submitted to Meta from + Strapi, and their approval status updates by itself. +

+
+
+

Exactly once

+

+ A durable outbox in your database. Each message goes out once, also with several Strapi processes. The + same idempotency key never sends twice. +

+
+
+

Delivery and read tracking

+

Every message has a timeline, and failures come with a reason in plain language.

+
+
+

Fallback chain and routing rules

+

+ WhatsApp → RCS → SMS. Numbers that aren't on WhatsApp or can't receive RCS are remembered. Set the channel + order per template, tag or country. E-mail through Magic Mail is opt-in and off by default. +

+
+
+

Consent and GDPR

+

+ Consent per channel, STOP keywords, export and erasure per contact. Phone numbers are stored encrypted. +

+
+
+

Number checks

+

+ A free format check, plus optional paid checks with one cache and budget: Twilio line type and seven.io HLR. + Sends to unassigned numbers can stop before they cost anything. +

+
+
+

Attachments

+

+ PDF, images and videos from the media library or a public https URL. SMS gets a short signed link that + expires. +

+
+
+

Inbox and automation

+

+ Replies, buttons, photos, documents, voice notes and locations arrive once as an event. Files are checked + and stored in the media library. Answer from code or from the admin. +

+
+
+

Built for tests

+

+ A dry run shows the route and message without sending. A sandbox with magic test numbers runs app tests + without network or cost. +

+
+
+

Safe retries

+

+ Retries only when the provider provably didn't take the message. An unknown outcome becomes + uncertain, and an admin decides. +

+
+
+
+ +
+

What the official APIs allow

+

People often ask for things the providers don't offer. Here is what is possible.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
QuestionWhatsAppTelegramSMSMessageGate
Does the number exist?No check before sending; error 131026 on the first send means "not on WhatsApp"Only for people who started your botPaid carrier lookupsFree format check, optional paid lookup, learns from the first send
Can it receive RCS?––Twilio has no RCS checkTries RCS, learns from error 63036, falls back to SMS
Is the person online?Not availableNot availableNot availableShows the last activity instead
Has the person read it?Yes, unless read receipts are offNo read receipts for botsDelivery receipt onlyTimeline per message, read rate per template (a lower bound)
+
+
+ +
+

The admin

+

+ Built only from the Strapi Design System. Every screen works in light and dark mode and at phone width. +

+ +
-
-

Install in five minutes

-
    -
  1. -

    Install the package:

    -
    npm install strapi-plugin-magic-messagegate
    -
  2. -
  3. -

    Enable it in config/plugins.js:

    -
    module.exports = ({ env }) => ({
    +        
    +

    Install in five minutes

    +
      +
    1. +

      Install the package:

      +
      +
      npm install strapi-plugin-magic-messagegate
      +
      +
    2. +
    3. +

      Enable it in config/plugins.js:

      +
      +
      module.exports = ({ env }) => ({
         'magic-messagegate': {
           enabled: true,
           config: {
      @@ -359,36 +510,38 @@ 

      Install in five minutes

      }, }, });
      -
    4. -
    5. Build and start Strapi, then open MessageGate in the admin menu.

    6. -
    7. -

      - Accounts → Connect a channel. SMS (seven.io or Twilio) or Telegram (a bot token from - @BotFather) are the quickest first test. -

      -
    8. -
    9. -

      - Templates → Create template, then send it from Messages → Send message. -

      -
    10. -
    -

    WhatsApp

    -

    - You need a Meta business portfolio, a Meta app with the WhatsApp product and a payment method. Meta charges per - delivered template message (pricing). - Connect a new number, or your existing WhatsApp Business App number by QR code (coexistence), through - Connect with Meta, or paste the credentials by hand. For the Meta window, allow - https://connect.facebook.net in script-src and https://www.facebook.com - in frame-src of Strapi's security middleware. The - README has the full setup. -

    -
    +
+ +
  • Build and start Strapi, then open MessageGate in the admin menu.

  • +
  • +

    + Accounts → Connect a channel. SMS (seven.io or Twilio) or Telegram (a bot token from + @BotFather) are the quickest first test. +

    +
  • +
  • +

    + Templates → Create template, then send it from Messages → Send message. +

    +
  • + +

    WhatsApp

    +

    + You need a Meta business portfolio, a Meta app with the WhatsApp product and a payment method. Meta charges per + delivered template message (pricing). + Connect a new number, or your existing WhatsApp Business App number by QR code (coexistence), through + Connect with Meta, or paste the credentials by hand. For the Meta window, allow + https://connect.facebook.net in script-src and https://www.facebook.com + in frame-src of Strapi's security middleware. The + README has the full setup. +

    + -
    -

    API

    -

    From Strapi code

    -
    const { id, status, channel, duplicate } = await strapi
    +        
    +

    API

    +

    From Strapi code

    +
    +
    const { id, status, channel, duplicate } = await strapi
       .plugin('magic-messagegate')
       .service('messages')
       .send({
    @@ -398,114 +551,199 @@ 

    From Strapi code

    variables: { first_name: 'Anna', order_id: 'A-10423' }, idempotencyKey: 'order-shipped-A-10423', });
    -

    From another service

    -
    curl -X POST https://cms.example.com/api/magic-messagegate/messages \
    +          
    +

    From another service

    +
    +
    curl -X POST https://cms.example.com/api/magic-messagegate/messages \
       -H "Authorization: Bearer $STRAPI_API_TOKEN" \
       -H "Content-Type: application/json" \
       -d '{"data":{"to":"+4915123456789","template":"order_shipped","variables":{"first_name":"Anna","order_id":"A-10423"}}}'
    -

    - The Content API accepts Strapi API tokens only. It answers 202 for a new message and - 200 with duplicate: true for a repeated idempotency key, and the plan without - sending for "dryRun": true. Other routes: GET /messages/:id, - POST /consent, POST /telegram-link, POST /lookup, - POST /capabilities, POST /templates/render, and for inbound messages (a separate - permission) GET /inbound, GET /inbound/:id/media, - POST /inbound/:id/reply, GET /conversations/:contactId. -

    -

    Receive and answer

    -
    const mg = strapi.plugin('magic-messagegate');
    +          
    +

    + The Content API accepts Strapi API tokens only. It answers 202 for a new message and + 200 with duplicate: true for a repeated idempotency key, and the plan without + sending for "dryRun": true. Other routes: GET /messages/:id, + POST /consent, POST /telegram-link, POST /lookup, + POST /capabilities, POST /templates/render, and for inbound messages (a separate + permission) GET /inbound, GET /inbound/:id/media, + POST /inbound/:id/reply, GET /conversations/:contactId. +

    +

    Receive and answer

    +
    +
    const mg = strapi.plugin('magic-messagegate');
     mg.service('inbound').onReceived(async ({ inboundId, buttonPayload }) => {
       const message = await mg.service('inbound').get(inboundId); // text, button, location, media
       const { items } = await mg.service('conversations').history({ inboundId });
       await mg.service('messages').reply(inboundId, { text: 'Thanks, we are on it.' });
       await mg.service('inbound').markProcessed(inboundId);
     });
    -

    - Files: inbound.getMedia(id, { as: 'buffer' | 'stream' | 'base64' }) or a short-lived signed URL - with inbound.createMediaUrl(id). Optional: forward events to your own https endpoint, signed with - HMAC-SHA256. -

    -

    Tests without network

    -
    // config/env/test/plugins.js
    +          
    +

    + Files: inbound.getMedia(id, { as: 'buffer' | 'stream' | 'base64' }) or a short-lived signed URL + with inbound.createMediaUrl(id). Optional: forward events to your own https endpoint, signed with + HMAC-SHA256. +

    +

    Tests without network

    +
    +
    // config/env/test/plugins.js
     const { sandboxConfig } = require('strapi-plugin-magic-messagegate/testing');
     module.exports = { 'magic-messagegate': { enabled: true, config: sandboxConfig() } };
    -

    - Magic test numbers decide the outcome (read, not on WhatsApp, no RCS, undelivered, uncertain, unassigned). - sandbox.simulateInbound() feeds replies and files into your automations. -

    -

    Events

    -
    strapi.eventHub.on('messagegate.message.failed', ({ messageId, channel, code }) => {
    +          
    +

    + Magic test numbers decide the outcome (read, not on WhatsApp, no RCS, undelivered, uncertain, unassigned). + sandbox.simulateInbound() feeds replies and files into your automations. +

    +

    Events

    +
    +
    strapi.eventHub.on('messagegate.message.failed', ({ messageId, channel, code }) => {
       strapi.log.warn(`Message ${messageId} on ${channel} failed: ${code}`);
     });
    -

    - The full contract, with every field, status, event and error code, is in - AGENTS.md. For AI tools: - llms.txt and llms-full.txt. -

    -
    + +

    + The full contract, with every field, status, event and error code, is in + AGENTS.md. For AI tools: + llms.txt and llms-full.txt. +

    +
    -
    -

    Configuration

    -

    - config/plugins.js holds the infrastructure options: encryption key, public URL, worker interval - and concurrency, retry delays, rate limits, provider timeouts and the Meta app for Embedded Signup. Business - rules live on the Settings page: consent, opt-out keywords, channel chain, routing rules, - e-mail fallback (off by default), lookups and their budget, inbox and inbound files, the outgoing webhook and - retention. The - README lists both with defaults. -

    -

    Several instances

    -

    - All state lives in the database, so Railway replicas or a pm2 cluster share it without sticky sessions. In the - acceptance run, 8 processes on one PostgreSQL database sent 500 messages with 0 duplicates. When a deploy - changes tables, start one replica first. -

    -
    +
    +

    Configuration

    +

    + config/plugins.js holds the infrastructure options: encryption key, public URL, worker interval + and concurrency, retry delays, rate limits, provider timeouts and the Meta app for Embedded Signup. Business + rules live on the Settings page: consent, opt-out keywords, channel chain, routing rules, + e-mail fallback (off by default), lookups and their budget, inbox and inbound files, the outgoing webhook and + retention. The + README lists both with defaults. +

    +

    Several instances

    +

    + All state lives in the database, so Railway replicas or a pm2 cluster share it without sticky sessions. In the + acceptance run, 8 processes on one PostgreSQL database sent 500 messages with 0 duplicates. When a deploy + changes tables, start one replica first. +

    +
    -
    -

    Security and privacy

    -
      -
    • - Admin routes need a MessageGate permission (16 actions). The Content API needs an API token; reading inbound - text and files is a separate permission. -
    • -
    • Provider secrets are encrypted and never returned. Phone numbers are encrypted and found by a keyed hash.
    • -
    • Webhooks check the provider signature (Meta, Telegram, seven.io, Twilio) and ignore repeats.
    • -
    • Template variables are plain text, and Telegram HTML is escaped. No URL from user input is fetched.
    • -
    • - Attachment and webhook URLs must be public https; inbound files come only from the provider's own hosts, with - a size cap while streaming, a type allow-list, a content check and EXIF removal. -
    • -
    • Download links are signed and expire; every invalid link gets the same 404.
    • -
    • Rate limits and the lookup budget are counted in the database, so they hold across processes.
    • -
    • Two runtime dependencies: zod and libphonenumber-js.
    • -
    -

    - Report vulnerabilities privately through - GitHub security advisories. -

    -
    +
    +

    Security and privacy

    +
      +
    • + Admin routes need a MessageGate permission (16 actions). The Content API needs an API token; reading inbound + text and files is a separate permission. +
    • +
    • Provider secrets are encrypted and never returned. Phone numbers are encrypted and found by a keyed hash.
    • +
    • Webhooks check the provider signature (Meta, Telegram, seven.io, Twilio) and ignore repeats.
    • +
    • Template variables are plain text, and Telegram HTML is escaped. No URL from user input is fetched.
    • +
    • + Attachment and webhook URLs must be public https; inbound files come only from the provider's own hosts, with + a size cap while streaming, a type allow-list, a content check and EXIF removal. +
    • +
    • Download links are signed and expire; every invalid link gets the same 404.
    • +
    • Rate limits and the lookup budget are counted in the database, so they hold across processes.
    • +
    • Two runtime dependencies: zod and libphonenumber-js.
    • +
    +

    + Report vulnerabilities privately through + GitHub security advisories. +

    +
    -
    -

    Releases

    -

    - Versions follow semantic versioning and are published to - npm. Changes and migration notes - are in the changelog. - MessageGate replaces the unpublished magic-whatsapp plugin, which drove WhatsApp Web through an - unofficial library; see the - migration notes. -

    -
    +
    +

    FAQ

    +
    +
    + Can MessageGate check whether a number has WhatsApp or RCS before sending? +

    + No. Neither Meta's Cloud API nor Twilio has such a check. MessageGate learns it from the first send + and falls back to the next channel. Unofficial WhatsApp checks are not used. +

    +
    +
    + Does MessageGate send e-mail? +

    + No. E-mail is an opt-in last step of the chain that hands the message to Magic Mail; it is off by + default. +

    +
    +
    + Why is a message "uncertain"? +

    + The request reached the provider, but no clear answer came back in time. The provider may or may not + have the message, so sending again could deliver it twice. An admin can retry it (after confirming the + risk) or mark it as sent. +

    +
    +
    + Can I send free text on WhatsApp? +

    + Only within 24 hours after the contact last wrote to you. Outside that window, Meta requires an + approved template. +

    +
    +
    + Can I connect my personal WhatsApp number? +

    + No. Only a WhatsApp Business App number (coexistence) or a new number can be connected through the + official API. +

    +
    +
    + What does it cost? +

    + MessageGate is free (MIT). The providers charge you: Meta per delivered WhatsApp template message, + Twilio per RCS message, seven.io or Twilio per SMS, and paid lookups if you turn them on. Telegram and + the sandbox are free. +

    +
    +
    +
    + +
    +

    Releases

    +

    + Versions follow semantic versioning and are published to + npm. Changes and migration notes + are in the changelog. + MessageGate replaces the unpublished magic-whatsapp plugin, which drove WhatsApp Web through an + unofficial library; see the + migration notes. +

    +
    +
    diff --git a/docs/site/llms.txt b/docs/site/llms.txt index d5165c0..292bbc8 100644 --- a/docs/site/llms.txt +++ b/docs/site/llms.txt @@ -2,6 +2,8 @@ > Strapi 5 plugin (npm: strapi-plugin-magic-messagegate, plugin id: magic-messagegate) that sends and receives messages over WhatsApp (Meta Cloud API), RCS (Twilio), Telegram (Bot API) and SMS (seven.io, Twilio): send -> receive -> process -> automate. It has a durable exactly-once outbox, attachments, delivery and read tracking, inbound messages with buttons and files, a fallback chain (WhatsApp -> RCS -> SMS; e-mail through Magic Mail only when enabled), per-channel consent with STOP keywords, number checks, a dry run, a sandbox mode for tests, and an admin built from the Strapi Design System. +Requirements: Strapi `^5.38.0`, Node.js `^22.21.0 || >=24.9.0 <=26.x.x`, PostgreSQL, MySQL 8 or SQLite. Install with `npm install strapi-plugin-magic-messagegate`; the current version is on npm. MIT licensed; the providers charge for their messages. + Key facts for code generation: - Send from Strapi code: `strapi.plugin('magic-messagegate').service('messages').send({ to, template, language, variables, idempotencyKey })` returns `{ id, status, channel, duplicate }`. @@ -19,12 +21,15 @@ Key facts for code generation: ## Docs +- [Documentation site](https://schero94.github.io/Magic-MessageGate/): overview, API limits, screenshots, install, API, configuration, security, FAQ - [README](https://github.com/Schero94/Magic-MessageGate/blob/main/README.md): setup per channel, receiving messages and recipes, configuration, sandbox, permissions, consent, security, several instances, FAQ - [AGENTS.md](https://github.com/Schero94/Magic-MessageGate/blob/main/AGENTS.md): exact API contract (inputs, statuses, events, error codes, webhooks) - [llms-full.txt](https://schero94.github.io/Magic-MessageGate/llms-full.txt): README and AGENTS.md in one file ## Optional +- [npm package](https://www.npmjs.com/package/strapi-plugin-magic-messagegate) +- [Plugin hub overview](https://schero94.github.io/plugins/magic-messagegate/) - [CHANGELOG](https://github.com/Schero94/Magic-MessageGate/blob/main/CHANGELOG.md): versions and migration notes - [CONCEPT.md](https://github.com/Schero94/Magic-MessageGate/blob/main/CONCEPT.md): design decisions - [Multi-instance acceptance record](https://github.com/Schero94/Magic-MessageGate/blob/main/docs/acceptance/2026-11-11-cluster.md) diff --git a/docs/site/robots.txt b/docs/site/robots.txt new file mode 100644 index 0000000..e9ffe2f --- /dev/null +++ b/docs/site/robots.txt @@ -0,0 +1,26 @@ +# Magic MessageGate documentation. Search engines and AI crawlers are welcome. +User-agent: * +Allow: / + +User-agent: Googlebot +Allow: / + +User-agent: Google-Extended +Allow: / + +User-agent: GPTBot +Allow: / + +User-agent: OAI-SearchBot +Allow: / + +User-agent: ClaudeBot +Allow: / + +User-agent: Claude-SearchBot +Allow: / + +User-agent: PerplexityBot +Allow: / + +Sitemap: https://schero94.github.io/Magic-MessageGate/sitemap.xml diff --git a/docs/site/site-extra.css b/docs/site/site-extra.css new file mode 100644 index 0000000..98d307d --- /dev/null +++ b/docs/site/site-extra.css @@ -0,0 +1,44 @@ +/* Magic MessageGate page styles. site.css is the shared theme, byte-identical + in every plugin docs site; this file holds the MessageGate accent (taken + from the plugin icon) and the few rules this page alone needs. */ + +:root { + --accent: #c2410c; + --accent-ink: #ad3a0b; + --on-accent: #ffffff; + --accent-soft: #fdebdf; + --hero-accent: #ffae7a; +} + +@media (prefers-color-scheme: dark) { + :root { + --accent: #ff9a5c; + --accent-ink: #ffb07f; + --on-accent: #0e1016; + --accent-soft: #3a2014; + } +} + +/* Screenshots switch to their dark or phone version through . */ +.hero-shot picture, +.shot picture { + display: block; + line-height: 0; +} + +/* The long plugin name and four top links do not fit one row on small phones: + npm and the changelog stay in the hero badges and the footer. */ +.brand span { + white-space: nowrap; +} +@media (max-width: 520px) { + .top-links a[href$='CHANGELOG.md'], + .top-links a[href^='https://www.npmjs.com'] { + display: none; + } +} + +/* Install steps carry wide code blocks; let the list use the full content width. */ +.section > .steps { + max-width: none; +} diff --git a/docs/site/site.css b/docs/site/site.css index d45ff79..418e4cc 100644 --- a/docs/site/site.css +++ b/docs/site/site.css @@ -1,416 +1,425 @@ +/* Shared theme for the Schero94 Strapi plugin documentation sites. + This file is byte-identical in every plugin repository (docs/site/site.css). + Plugin-specific colours and the few page-only components live in + docs/site/site-extra.css, linked after this file. */ + +/* 1. Tokens ---------------------------------------------------------------- */ :root { color-scheme: light dark; - --bg: #f6f6f9; + + /* Spacing scale (4 px base). */ + --space-1: 0.25rem; + --space-2: 0.5rem; + --space-3: 0.75rem; + --space-4: 1rem; + --space-5: 1.5rem; + --space-6: 2rem; + --space-7: 3rem; + --space-8: 4.5rem; + --space-9: 6.5rem; + + /* Type scale. Body text is 17 px; one large display step for the h1. */ + --text-xs: 0.8125rem; + --text-s: 0.9375rem; + --text-m: 1.0625rem; + --text-l: 1.25rem; + --text-xl: clamp(1.5rem, 1.1rem + 1.4vw, 2.125rem); + --text-display: clamp(2.25rem, 1.2rem + 4.2vw, 4.25rem); + --leading-tight: 1.08; + --leading-snug: 1.3; + --leading-body: 1.65; + --measure: 68ch; + + --font-text: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; + --font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; + + --radius-s: 4px; + --radius: 8px; + --page-max: 1240px; + --gutter: clamp(1rem, 0.6rem + 1.8vw, 2rem); + --topbar-h: 3.75rem; + + /* Neutral colours, light. Each text pair meets WCAG AA (4.5:1) on --bg and --surface. */ + --bg: #f5f6f8; --surface: #ffffff; - --surface-2: #f0f0ff; - --ink: #212134; - --muted: #555570; - --line: #dcdce4; - --accent: #4945ff; - --accent-ink: #ffffff; - --link: #3c37e0; - --code-bg: #1d1d2c; - --code-ink: #eaeaf4; - --focus: #7b79ff; - --radius: 14px; - font-family: - Inter, - ui-sans-serif, - system-ui, - -apple-system, - BlinkMacSystemFont, - 'Segoe UI', - sans-serif; + --surface-2: #eceef2; + --ink: #12151d; + --ink-2: #434a5a; + --line: #d9dde5; + --code-bg: #12151d; + --code-ink: #e8ebf2; + --code-muted: #a9b0c0; + --hero-bg: #12151d; + --hero-ink: #f4f5f8; + --hero-ink-2: #c4c9d6; + --note-bg: #e6f2f4; + --note-line: #1f7f8c; + --warn-bg: #fbf1dc; + --warn-line: #a5650a; + --good: #1d7a47; + --bad: #b42318; + --open: #8a5a00; + --focus: #0b6e7a; + + /* Accent. Overridden per plugin in site-extra.css. */ + --accent: #3d4bd6; + --accent-ink: #3340c0; + --on-accent: #ffffff; + --accent-soft: #e8eafb; + --hero-accent: #9aa6ff; + + /* Aliases kept for page-specific stylesheets written against the first theme. */ + --muted: var(--ink-2); + --paper: var(--bg); + --white: var(--surface); + --card-bg: var(--surface); + --soft-bg: var(--surface-2); + --link: var(--accent-ink); } @media (prefers-color-scheme: dark) { :root { - --bg: #181826; - --surface: #212134; - --surface-2: #2a2a45; - --ink: #f0f0ff; - --muted: #b6b6cc; - --line: #3a3a56; - --link: #9a98ff; - --code-bg: #10101a; - --focus: #9a98ff; + --bg: #0e1016; + --surface: #171a23; + --surface-2: #1f2330; + --ink: #eceef3; + --ink-2: #b1b8c8; + --line: #2e3443; + --code-bg: #090b10; + --code-ink: #e8ebf2; + --code-muted: #9aa2b4; + --hero-bg: #171a23; + --hero-ink: #f4f5f8; + --hero-ink-2: #c4c9d6; + --note-bg: #10282c; + --note-line: #5cc3cf; + --warn-bg: #2d2210; + --warn-line: #e6b24f; + --good: #6fd29e; + --bad: #ff8a80; + --open: #f2c063; + --focus: #7fd6e0; + --accent: #8f9bff; + --accent-ink: #aab3ff; + --on-accent: #0e1016; + --accent-soft: #232845; } } -* { - box-sizing: border-box; -} +/* 2. Base ------------------------------------------------------------------ */ +*, +*::before, +*::after { box-sizing: border-box; } html { scroll-behavior: smooth; - scroll-padding-top: 5rem; + scroll-padding-top: calc(var(--topbar-h) + var(--space-4)); + -webkit-text-size-adjust: 100%; + text-size-adjust: 100%; } body { margin: 0; background: var(--bg); color: var(--ink); - line-height: 1.6; + font-family: var(--font-text); + font-size: var(--text-m); + line-height: var(--leading-body); + font-synthesis: none; + text-rendering: optimizeLegibility; overflow-wrap: break-word; } -img { - display: block; - max-width: 100%; - height: auto; -} -a { - color: var(--link); - text-underline-offset: 0.18em; -} -a:focus-visible, -.table-wrap:focus-visible, -main:focus-visible { - outline: 3px solid var(--focus); - outline-offset: 3px; - border-radius: 6px; -} -code, -pre { - font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; -} -code { - font-size: 0.92em; -} -p code, -li code, -td code { - padding: 0.05em 0.3em; - border-radius: 4px; - background: var(--surface-2); -} -pre { - overflow-x: auto; - margin: 0.75rem 0 1.25rem; - padding: 1rem 1.1rem; - border-radius: 10px; - background: var(--code-bg); - color: var(--code-ink); - font-size: 0.86rem; - line-height: 1.55; - tab-size: 2; +img, svg, video { max-width: 100%; height: auto; } +h1, h2, h3, h4 { color: var(--ink); line-height: var(--leading-snug); text-wrap: balance; } +p, li { text-wrap: pretty; } +a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 0.2em; } +a:hover { text-decoration-thickness: 2px; } +:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: var(--radius-s); } +code, pre, kbd { font-family: var(--font-code); } +code { font-size: 0.9em; } +:not(pre) > code { padding: 0.08em 0.32em; border-radius: var(--radius-s); background: var(--surface-2); overflow-wrap: anywhere; } +strong { font-weight: 680; } +.visually-hidden { + position: absolute !important; + width: 1px; + height: 1px; + overflow: hidden; + clip: rect(0 0 0 0); + clip-path: inset(50%); + white-space: nowrap; } +/* 3. Skip link and top bar ------------------------------------------------- */ .skip-link { position: absolute; - left: 1rem; - top: -5rem; - z-index: 10; - padding: 0.6rem 1rem; - border-radius: 8px; + left: var(--space-4); + top: -6rem; + z-index: 20; + padding: var(--space-3) var(--space-4); + border-radius: var(--radius); background: var(--surface); color: var(--ink); + font-weight: 650; } -.skip-link:focus { - top: 1rem; -} - -.topbar { - position: sticky; - top: 0; - z-index: 5; - border-bottom: 1px solid var(--line); - background: color-mix(in srgb, var(--surface) 92%, transparent); - backdrop-filter: blur(10px); -} +.skip-link:focus { top: var(--space-3); } +.topbar { position: sticky; top: 0; z-index: 10; background: var(--hero-bg); color: var(--hero-ink); } .topbar-inner { display: flex; - flex-wrap: wrap; align-items: center; justify-content: space-between; - gap: 0.5rem 1rem; - max-width: 1180px; + gap: var(--space-4); + max-width: var(--page-max); + min-height: var(--topbar-h); margin: 0 auto; - padding: 0.75rem 1.5rem; -} -.brand { - display: flex; - align-items: center; - gap: 0.6rem; - color: var(--ink); - font-weight: 700; - text-decoration: none; -} -.brand-mark { - display: block; - width: 2rem; - height: 2rem; - border-radius: 8px; -} -.top-links { - display: flex; - flex-wrap: wrap; - gap: 0.25rem 1rem; -} -.top-links a { - color: var(--muted); - font-size: 0.9rem; - font-weight: 600; - text-decoration: none; -} -.top-links a:hover { - color: var(--ink); -} + padding: var(--space-2) var(--gutter); +} +.brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; color: var(--hero-ink); font-weight: 720; letter-spacing: -0.01em; text-decoration: none; } +.brand:hover { color: var(--hero-ink); } +.brand-logo, .brand-mark { display: block; flex: 0 0 auto; width: 2rem; height: 2rem; } +.top-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-1) var(--space-4); } +.top-links a { display: inline-flex; align-items: center; min-height: 2.25rem; color: var(--hero-ink-2); font-size: var(--text-s); font-weight: 600; text-decoration: none; } +.top-links a:hover { color: var(--hero-ink); text-decoration: underline; } +.topbar :focus-visible, .hero :focus-visible { outline-color: var(--hero-accent); } -main { - max-width: 1180px; - margin: 0 auto; - padding: 0 1.5rem 3rem; -} - -.hero { - display: grid; - grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); - align-items: center; - gap: clamp(1.5rem, 4vw, 3rem); - padding: clamp(2rem, 5vw, 4rem) 0 2.5rem; -} -.eyebrow { - margin: 0; - color: var(--accent); - font-size: 0.78rem; - font-weight: 700; - letter-spacing: 0.12em; - text-transform: uppercase; -} -@media (prefers-color-scheme: dark) { - .eyebrow { - color: var(--link); - } -} -.hero h1 { - margin: 0.6rem 0 0.8rem; - font-size: clamp(2rem, 4.6vw, 3.4rem); - line-height: 1.08; - letter-spacing: -0.03em; -} -.lead { - margin: 0; - color: var(--muted); - font-size: clamp(1rem, 1.4vw, 1.12rem); -} -.hero-actions { - display: flex; - flex-wrap: wrap; - gap: 0.6rem; - margin-top: 1.5rem; -} +/* 4. Hero ------------------------------------------------------------------ */ +.hero-wrap { background: var(--hero-bg); color: var(--hero-ink); } +.hero { max-width: var(--page-max); margin: 0 auto; padding: var(--space-7) var(--gutter) var(--space-8); color: var(--hero-ink); } +.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: center; gap: var(--space-7); } +.hero .hero-grid h1 { font-size: clamp(2.25rem, 1.5rem + 1.8vw, 3.125rem); } +.hero .hero-grid p { font-size: var(--text-m); } +.hero .hero-grid p.definition { font-size: var(--text-l); } +.hero-copy { max-width: 46rem; } +.crumbs ol { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); margin: 0 0 var(--space-5); padding: 0; list-style: none; font-size: var(--text-s); color: var(--hero-ink-2); } +.crumbs li + li::before { margin-right: var(--space-2); content: "/"; color: var(--hero-ink-2); } +.crumbs a { color: var(--hero-ink-2); } +.crumbs a:hover { color: var(--hero-ink); } +.crumbs [aria-current] { color: var(--hero-ink); } +.eyebrow { display: block; margin: 0 0 var(--space-3); color: var(--hero-ink-2); font-size: var(--text-s); font-weight: 600; } +.hero h1 { margin: 0 0 var(--space-5); color: var(--hero-ink); font-size: var(--text-display); font-weight: 760; line-height: var(--leading-tight); letter-spacing: -0.025em; } +.hero p { max-width: 40rem; margin: 0 0 var(--space-4); color: var(--hero-ink-2); font-size: var(--text-l); line-height: 1.55; } +.hero p.definition, .hero .lead { color: var(--hero-ink); } +.hero code { color: var(--hero-ink); background: rgba(255, 255, 255, 0.1); } +.hero a:not(.button) { color: var(--hero-ink); } +.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-5) 0 0; } .button { display: inline-flex; align-items: center; - min-height: 2.75rem; - padding: 0.6rem 1rem; - border: 1px solid var(--line); - border-radius: 8px; - background: var(--surface); - color: var(--ink); - font-weight: 650; + justify-content: center; + min-height: 2.875rem; + padding: var(--space-2) var(--space-5); + border: 2px solid var(--hero-ink-2); + border-radius: var(--radius-s); + color: var(--hero-ink); + background: transparent; + font-size: var(--text-m); + font-weight: 680; text-decoration: none; + transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease; } -.button:hover { - border-color: var(--accent); -} -.button.primary { - border-color: var(--accent); - background: var(--accent); - color: var(--accent-ink); -} -.badges { - display: flex; - flex-wrap: wrap; - gap: 0.4rem; - margin: 1.25rem 0 0; - padding: 0; - list-style: none; -} -.badges li { - padding: 0.2rem 0.6rem; - border: 1px solid var(--line); - border-radius: 999px; - color: var(--muted); - font-size: 0.78rem; - font-weight: 600; -} -.hero-shot { - margin: 0; -} -.hero-shot img, -.gallery img { - border: 1px solid var(--line); - border-radius: 10px; - box-shadow: 0 12px 40px rgb(33 33 52 / 12%); -} - -.section { - padding: 2.25rem 0 0.5rem; - scroll-margin-top: 5rem; -} -.section h2 { - margin: 0 0 0.6rem; - font-size: clamp(1.4rem, 2.6vw, 1.9rem); - line-height: 1.2; - letter-spacing: -0.02em; -} -.section h3 { - margin: 1.5rem 0 0.4rem; - font-size: 1.05rem; -} -.section > p, -.section-lead { - max-width: 780px; -} -.section-lead { - margin: 0 0 1.2rem; - color: var(--muted); -} +.button:hover { background: rgba(255, 255, 255, 0.1); color: var(--hero-ink); } +.button:active { transform: translateY(1px); } +.button.primary { border-color: var(--hero-accent); color: #0e1016; background: var(--hero-accent); } +.button.primary:hover { color: #0e1016; background: var(--hero-ink); border-color: var(--hero-ink); } +.hero-install, .install-line { + display: inline-flex; + align-items: center; + gap: var(--space-3); + max-width: 100%; + margin: var(--space-5) 0 0; + padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); + border-radius: var(--radius-s); + background: rgba(255, 255, 255, 0.08); + color: var(--hero-ink); + font-family: var(--font-code); + font-size: var(--text-s); + overflow-wrap: anywhere; +} +.badges { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: var(--space-6) 0 0; padding: 0; list-style: none; color: var(--hero-ink-2); font-size: var(--text-s); } +.badges li, .badge { display: inline; padding: 0; border: 0; background: none; color: var(--hero-ink-2); font-size: var(--text-s); font-weight: 600; } +.shields { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-4) 0 0; } +.shields a { display: inline-flex; } +.shields img { display: block; width: auto; height: 20px; } +.hero .hero-shot { margin: 0; background: rgba(255, 255, 255, 0.06); } -.cards { +/* 5. Page layout ----------------------------------------------------------- */ +.layout { display: grid; - grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); - gap: 1rem; - margin-top: 1rem; -} -.card { - padding: 1.1rem 1.2rem; - border: 1px solid var(--line); - border-radius: var(--radius); - background: var(--surface); -} -.card h3 { - margin: 0 0 0.35rem; - font-size: 1rem; -} -.card p { - margin: 0; - color: var(--muted); - font-size: 0.93rem; -} + grid-template-columns: 13rem minmax(0, 1fr); + gap: var(--space-7); + max-width: var(--page-max); + margin: 0 auto; + padding: var(--space-7) var(--gutter) var(--space-8); +} +.layout:focus { outline: none; } +.side-nav { position: sticky; top: calc(var(--topbar-h) + var(--space-4)); align-self: start; display: grid; gap: 2px; max-height: calc(100vh - var(--topbar-h) - var(--space-6)); overflow-y: auto; } +.side-nav a { display: block; padding: var(--space-2) var(--space-3); border-radius: var(--radius-s); color: var(--ink-2); font-size: var(--text-s); font-weight: 600; text-decoration: none; } +.side-nav a:hover { color: var(--ink); background: var(--surface-2); } +.content { min-width: 0; } +.section { margin: 0 0 var(--space-8); scroll-margin-top: calc(var(--topbar-h) + var(--space-4)); } +.section:last-child { margin-bottom: 0; } +.section h2 { margin: 0 0 var(--space-4); font-size: var(--text-xl); line-height: 1.2; letter-spacing: -0.025em; } +.section h3, .sub-title, .subhead { margin: var(--space-6) 0 var(--space-3); font-size: var(--text-l); letter-spacing: -0.01em; } +.section > p, .section > ul, .section > ol, .section-lead, .lead { max-width: var(--measure); } +.section-lead { margin: 0 0 var(--space-5); color: var(--ink-2); font-size: var(--text-l); line-height: 1.55; } +.section p { margin: 0 0 var(--space-4); } +.section ul, .section ol { padding-left: 1.3rem; } +.section li { margin-bottom: var(--space-2); } -.table-wrap { - overflow-x: auto; - border: 1px solid var(--line); - border-radius: var(--radius); - background: var(--surface); -} -table { - width: 100%; - min-width: 640px; - border-collapse: collapse; - text-align: left; -} -th, -td { - padding: 0.7rem 0.9rem; - border-bottom: 1px solid var(--line); - vertical-align: top; - font-size: 0.9rem; -} -thead th { - background: var(--surface-2); - font-size: 0.8rem; -} -tbody th { - font-weight: 650; -} -td { - color: var(--muted); -} -tr:last-child th, -tr:last-child td { - border-bottom: 0; -} +/* 6. Definition, fit blocks and requirements ------------------------------- */ +.summary { margin: 0 0 var(--space-8); } +.definition { max-width: var(--measure); margin: 0 0 var(--space-5); font-size: var(--text-l); line-height: 1.55; } +.fit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); margin: 0; } +.fit { padding: var(--space-5); border-radius: var(--radius); background: var(--surface); } +.fit h2, .fit h3 { margin: 0 0 var(--space-3); font-size: var(--text-m); letter-spacing: 0; } +.fit ul { margin: 0; padding-left: 1.1rem; } +.fit li { margin-bottom: var(--space-2); font-size: var(--text-s); } +.fit-yes { box-shadow: inset 0 4px 0 var(--good); } +.fit-no { box-shadow: inset 0 4px 0 var(--bad); } +.fit-req { box-shadow: inset 0 4px 0 var(--accent); } -.gallery { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); - gap: 1.25rem; -} -.gallery figure { - margin: 0; -} -figcaption { - margin-top: 0.5rem; - color: var(--muted); - font-size: 0.88rem; -} +/* 7. Cards, steps and lists ----------------------------------------------- */ +.card-grid, .cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); } +.card { padding: var(--space-5); border-radius: var(--radius); background: var(--surface); } +.card h3 { margin: 0 0 var(--space-2); font-size: var(--text-m); line-height: var(--leading-snug); letter-spacing: -0.005em; } +.card p { margin: 0; color: var(--ink-2); font-size: var(--text-s); } +.card p + p { margin-top: var(--space-2); } +.card ul { margin: var(--space-2) 0 0; padding-left: 1.1rem; color: var(--ink-2); font-size: var(--text-s); } +.number { display: inline-grid; place-items: center; min-width: 2rem; height: 2rem; margin-bottom: var(--space-3); padding: 0 var(--space-2); border-radius: var(--radius-s); color: var(--accent-ink); background: var(--accent-soft); font-weight: 750; } +.section .steps { max-width: none; margin: 0 0 var(--space-5); padding-left: 1.4rem; } +.steps > li { margin-bottom: var(--space-4); padding-left: var(--space-2); } +.steps > li::marker { color: var(--accent-ink); font-weight: 750; } +.steps li p { margin: 0 0 var(--space-2); } +.steps .code-card { margin: var(--space-2) 0 var(--space-3); } +.check-list, .checklist, .checks { margin: 0 0 var(--space-4); padding: 0; list-style: none; } +.check-list li, .checklist li, .checks li { position: relative; margin-bottom: var(--space-2); padding-left: 1.6rem; } +.check-list li::before, .checklist li::before, .checks li::before { position: absolute; left: 0.15rem; top: 0.55em; width: 0.7rem; height: 0.4rem; border-left: 2px solid var(--good); border-bottom: 2px solid var(--good); transform: rotate(-45deg); content: ""; } +.link-list { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); } +.link-list a { display: inline-flex; align-items: center; min-height: 2.5rem; padding: var(--space-2) var(--space-4); border-radius: var(--radius-s); background: var(--surface); font-size: var(--text-s); font-weight: 650; text-decoration: none; } +.link-list a:hover { background: var(--accent-soft); } -.steps { - max-width: 780px; - padding-left: 1.3rem; -} -.steps li { - padding-left: 0.3rem; -} -.steps p { - margin: 0.4rem 0; -} -.checks { - max-width: 780px; - padding-left: 1.2rem; -} -.checks li { - margin: 0.35rem 0; -} +/* 8. Callouts --------------------------------------------------------------- */ +.callout { max-width: var(--measure); margin: var(--space-4) 0; padding: var(--space-4) var(--space-5); border-left: 4px solid var(--note-line); border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink); background: var(--note-bg); } +.callout p { margin: 0; } +.callout p + p { margin-top: var(--space-2); } +.callout.warning { border-left-color: var(--warn-line); background: var(--warn-bg); } -.footer { - max-width: 1180px; - margin: 0 auto; - padding: 1.5rem; - border-top: 1px solid var(--line); - color: var(--muted); - font-size: 0.85rem; -} +/* 9. Code ------------------------------------------------------------------ */ +.code-card { overflow: hidden; margin: var(--space-4) 0; border-radius: var(--radius); color: var(--code-ink); background: var(--code-bg); } +.code-card pre { overflow-x: auto; margin: 0; padding: var(--space-4) var(--space-5); font-size: 0.875rem; line-height: 1.6; tab-size: 2; } +.code-card code { padding: 0; color: inherit; background: none; font-size: inherit; } +.code-label { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 2.5rem; padding: var(--space-1) var(--space-2) var(--space-1) var(--space-5); background: rgba(255, 255, 255, 0.05); color: var(--code-muted); font-size: var(--text-xs); } +.copy-button { + min-height: 2rem; + padding: var(--space-1) var(--space-3); + border: 1px solid rgba(255, 255, 255, 0.25); + border-radius: var(--radius-s); + color: var(--code-ink); + background: transparent; + font: 600 var(--text-xs) / 1 var(--font-text); + cursor: pointer; +} +.copy-button:hover { background: rgba(255, 255, 255, 0.1); } +.copy-button { flex: 0 0 auto; white-space: nowrap; } +.hero-install code, .install-line code { padding: 0; color: inherit; background: none; font-size: inherit; } +.hero-install .copy-button, .install-line .copy-button { border-color: rgba(255, 255, 255, 0.3); } + +/* 10. Tables --------------------------------------------------------------- */ +.table-wrap { overflow-x: auto; margin: var(--space-4) 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); } +table { width: 100%; border-collapse: collapse; text-align: left; } +caption { padding: var(--space-3) var(--space-4); color: var(--ink); font-size: var(--text-s); font-weight: 700; text-align: left; } +th, td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); vertical-align: top; } +th { color: var(--ink); background: var(--surface-2); font-size: var(--text-s); font-weight: 680; } +td { color: var(--ink); font-size: var(--text-s); } +th[scope="row"] { min-width: 9rem; } +tr:last-child td, tr:last-child th { border-bottom: 0; } +td code, th code { overflow-wrap: break-word; } + +/* 11. Screenshots ---------------------------------------------------------- */ +.hero-shot { margin: 0 0 var(--space-7); overflow: hidden; border-radius: var(--radius); background: var(--surface-2); } +.hero-shot img, .hero-shot picture, .shot picture { display: block; width: 100%; height: auto; } +.hero-shot figcaption, .shot figcaption { padding: var(--space-3) var(--space-4); color: var(--ink-2); font-size: var(--text-s); } +.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5) var(--space-4); margin: var(--space-4) 0; } +.gallery-mobile { grid-template-columns: repeat(3, minmax(0, 15rem)); } +.shot { margin: 0; overflow: hidden; border-radius: var(--radius); background: var(--surface); } +.shot-wide { grid-column: 1 / -1; } +.shot a { display: block; line-height: 0; } +.shot a:focus-visible { outline-offset: -3px; } +.shot img { display: block; width: 100%; height: auto; background: var(--surface-2); } + +/* 12. FAQ ------------------------------------------------------------------ */ +.faq { display: grid; gap: var(--space-2); max-width: var(--measure); } +.faq details { border-radius: var(--radius); background: var(--surface); } +.faq summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 3rem; padding: var(--space-3) var(--space-5); cursor: pointer; font-weight: 680; list-style: none; } +.faq summary::-webkit-details-marker { display: none; } +.faq summary::after { flex: 0 0 auto; color: var(--accent-ink); font-size: 1.4rem; font-weight: 400; line-height: 1; content: "+"; } +.faq details[open] summary::after { content: "\2212"; } +.faq details > :not(summary) { margin: 0; padding: 0 var(--space-5) var(--space-4); color: var(--ink-2); } +.faq details > p + p { padding-top: 0; } + +/* 13. Status cards --------------------------------------------------------- */ +.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin: 0 0 var(--space-4); } +.status-card { box-shadow: inset 0 4px 0 var(--line); } +.status-good { box-shadow: inset 0 4px 0 var(--good); } +.status-bad { box-shadow: inset 0 4px 0 var(--bad); } +.status-open { box-shadow: inset 0 4px 0 var(--open); } +.status-good h3 { color: var(--good); } +.status-bad h3 { color: var(--bad); } +.status-open h3 { color: var(--open); } + +/* 14. Footer --------------------------------------------------------------- */ +.footer { margin-top: var(--space-6); background: var(--surface-2); color: var(--ink-2); font-size: var(--text-s); } +.footer-inner, .footer > p:first-child { max-width: var(--page-max); margin: 0 auto; } +.footer-inner { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: var(--space-6); padding: var(--space-7) var(--gutter); } +.footer-name { margin: 0 0 var(--space-2); color: var(--ink); font-size: var(--text-l); font-weight: 720; } +.footer h2 { margin: 0 0 var(--space-3); color: var(--ink); font-size: var(--text-s); } +.footer ul { margin: 0; padding: 0; list-style: none; } +.footer li { margin-bottom: var(--space-2); } +.footer p { margin: 0 0 var(--space-2); } +.footer > p { max-width: var(--page-max); margin: 0 auto; padding: var(--space-2) var(--gutter); } +/* 15. Responsive ----------------------------------------------------------- */ +@media (max-width: 1080px) { + .hero-grid { grid-template-columns: 1fr; gap: var(--space-6); } + .fit-grid { grid-template-columns: 1fr; } +} @media (max-width: 820px) { - .hero { - grid-template-columns: 1fr; - } - .hero-shot { - max-width: 420px; - } + :root { --topbar-h: 3.5rem; } + .hero { padding: var(--space-6) var(--gutter) var(--space-7); } + .layout { grid-template-columns: 1fr; gap: var(--space-5); padding: var(--space-5) var(--gutter) var(--space-7); } + .side-nav { position: static; display: flex; flex-wrap: wrap; gap: var(--space-1); max-height: none; overflow: visible; } + .side-nav a { display: inline-flex; align-items: center; min-height: 2.25rem; background: var(--surface); } + .section { margin-bottom: var(--space-7); } + .status-grid { grid-template-columns: 1fr; } + .footer-inner { grid-template-columns: 1fr 1fr; } + .footer-inner > :first-child { grid-column: 1 / -1; } } @media (max-width: 560px) { - .topbar-inner, - main { - padding-left: 1rem; - padding-right: 1rem; - } - .top-links { - gap: 0.25rem 0.75rem; - } - .top-links a { - font-size: 0.82rem; - } - pre { - font-size: 0.78rem; - } -} -@media (prefers-reduced-motion: reduce) { - html { - scroll-behavior: auto; - } - *, - *::before, - *::after { - transition-duration: 0.01ms !important; - animation-duration: 0.01ms !important; - } + body { font-size: 1rem; } + .topbar-inner { gap: var(--space-2); } + .top-links { gap: 0 var(--space-3); } + .top-links a { font-size: var(--text-xs); } + .hero p { font-size: var(--text-m); } + .section-lead, .definition { font-size: var(--text-m); } + .card-grid, .cards, .gallery { grid-template-columns: 1fr; } + .gallery-mobile { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); } + .gallery-mobile .shot figcaption { padding: var(--space-2); font-size: var(--text-xs); } + .button { flex: 1 1 auto; } + .code-card pre { padding: var(--space-4); white-space: pre-wrap; overflow-wrap: anywhere; } + .code-label { padding-left: var(--space-4); } + th, td { padding: var(--space-2) var(--space-3); } + th[scope="row"] { min-width: 0; } + td code, th code { overflow-wrap: anywhere; } + .footer-inner { grid-template-columns: 1fr; } +} +@media (max-width: 380px) { + .brand span { font-size: var(--text-s); } } -/* Project status badges in the hero: same row as the README. */ -.shields { - display: flex; - flex-wrap: wrap; - gap: 0.4rem; - margin: 1.25rem 0 0; -} -.shields a { - display: inline-flex; +/* 16. Motion and print ----------------------------------------------------- */ +@media (prefers-reduced-motion: reduce) { + html { scroll-behavior: auto; } + *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } } -.shields img { - display: block; - width: auto; - height: 20px; +@media print { + .topbar, .side-nav, .skip-link, .copy-button, .shields { display: none !important; } + .layout { display: block; } + .hero-wrap, .hero { background: none; color: #000; } } diff --git a/docs/site/site.js b/docs/site/site.js new file mode 100644 index 0000000..af5014e --- /dev/null +++ b/docs/site/site.js @@ -0,0 +1,68 @@ +// Shared script for the Schero94 Strapi plugin documentation sites. +// Byte-identical in every plugin repository (docs/site/site.js), loaded with +// `defer`. It only adds "Copy" buttons to code blocks; the page works without it. +/* global window, document, navigator */ +(() => { + if (!navigator.clipboard || !window.isSecureContext) return; + + /** + * Adds a copy button that copies the text of `source` to the clipboard. + * @param {HTMLElement} host Element that receives the button. + * @param {HTMLElement} source Element whose text is copied. + * @param {string} label Accessible name, for example "Copy install command". + */ + const addButton = (host, source, label) => { + const button = document.createElement('button'); + button.type = 'button'; + button.className = 'copy-button'; + button.textContent = 'Copy'; + button.setAttribute('aria-label', label); + const status = document.createElement('span'); + status.className = 'visually-hidden'; + status.setAttribute('role', 'status'); + button.addEventListener('click', async () => { + try { + await navigator.clipboard.writeText(source.innerText.trim()); + button.textContent = 'Copied'; + status.textContent = 'Copied to the clipboard'; + } catch { + button.textContent = 'Select and copy'; + status.textContent = 'Copy failed. Select the text and copy it.'; + } + window.setTimeout(() => { + button.textContent = 'Copy'; + status.textContent = ''; + }, 2000); + }); + host.append(button, status); + }; + + for (const card of document.querySelectorAll('.code-card')) { + const code = card.querySelector('pre'); + if (!code) continue; + let label = card.querySelector('.code-label'); + if (!label) { + label = document.createElement('div'); + label.className = 'code-label'; + label.append(document.createElement('span')); + card.prepend(label); + } + const name = label.textContent.trim(); + addButton(label, code, name ? `Copy code: ${name}` : 'Copy code'); + } + + for (const line of document.querySelectorAll('.hero-install, .install-line')) { + const code = line.querySelector('code') || line; + if (line.tagName === 'CODE') { + // Wrap a bare so the button sits beside the command. + const wrap = document.createElement('span'); + wrap.className = line.className; + line.className = ''; + line.replaceWith(wrap); + wrap.append(line); + addButton(wrap, line, 'Copy install command'); + } else { + addButton(line, code, 'Copy install command'); + } + } +})(); diff --git a/docs/site/sitemap.xml b/docs/site/sitemap.xml new file mode 100644 index 0000000..e2f59f9 --- /dev/null +++ b/docs/site/sitemap.xml @@ -0,0 +1,6 @@ + + + + https://schero94.github.io/Magic-MessageGate/ + +