32 Commits

Author SHA1 Message Date
18306c28b9 chore: update plugins / deps
All checks were successful
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Successful in 1m0s
2026-02-04 21:53:39 -05:00
36e7d8ad8b chore: update oxlint / oxfmt settings 2026-02-04 13:31:08 -05:00
fdf32bbc78 feat: VSCode launch configurations 2026-02-03 09:19:08 -05:00
2c44d8137c chore: update deps
All checks were successful
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Successful in 57s
2026-02-03 08:03:05 -05:00
db831700f0 fix: Wrangler config
All checks were successful
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Successful in 56s
2026-02-01 22:47:21 -05:00
9bb09b89d9 feat: Replace eslint => oxlint + oxfmt
All checks were successful
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Successful in 58s
2026-02-01 22:06:16 -05:00
58dbcdd25a chore(release): v0.1.13
All checks were successful
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Successful in 57s
2026-02-01 21:17:39 -05:00
8ae6dafb62 feat: TinyMCE list style
Some checks failed
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Has been cancelled
2026-02-01 21:17:21 -05:00
faf39ca182 fix: wrangler.json needed for wrangler types before build
All checks were successful
Deployment / wordpress (push) Successful in 7s
Deployment / nuxt (push) Successful in 1m2s
2026-02-01 21:09:51 -05:00
8d350bb092 chore(release): v0.1.12
Some checks failed
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Failing after 9s
2026-01-30 16:31:44 -05:00
4338028c60 feat: Event context type for Cloudflare environment
Some checks failed
Deployment / wordpress (push) Successful in 5s
Deployment / nuxt (push) Has been cancelled
2026-01-30 16:31:29 -05:00
ab563a7b37 feat: parseAcfMedia
All checks were successful
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Successful in 1m1s
2026-01-30 15:50:06 -05:00
2cfc1a0047 feat: parseAcfLink 2026-01-30 15:43:49 -05:00
98e8d971e8 feat: showLabel 2026-01-30 15:43:37 -05:00
87be06ecea feat: connexionButton 2026-01-30 15:39:32 -05:00
28f6e1ae7c fix: UApp in app.vue 2026-01-30 15:39:19 -05:00
27380290e1 chore(release): v0.1.11
All checks were successful
Deployment / wordpress (push) Successful in 5s
Deployment / nuxt (push) Successful in 56s
2026-01-30 14:38:25 -05:00
7e44554767 chore: Update deps
Some checks failed
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Has been cancelled
2026-01-30 14:38:11 -05:00
9c3dceef84 fix: ENABLE_CLOUDFLARE_IMAGE
All checks were successful
Deployment / wordpress (push) Successful in 5s
Deployment / nuxt (push) Successful in 53s
2026-01-30 14:35:21 -05:00
ba8d8e00a8 chore: Update README.md
All checks were successful
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Successful in 59s
2026-01-30 14:29:26 -05:00
8f037b5950 fix: wrangler project name
All checks were successful
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Successful in 57s
2026-01-30 14:13:21 -05:00
291fa6eaa4 fix: Cloudflare image provider only in production 2026-01-30 12:20:30 -05:00
4079e4ecfb minor: configure image formats in nuxt.config.ts 2026-01-30 12:10:30 -05:00
eea020b136 fix: remove unneeded wrangler main / assets 2026-01-30 11:51:03 -05:00
5161bff624 minor: typo in component name 2026-01-30 11:50:37 -05:00
3199835e83 feat: AcfSocial / parseAcfSocial 2026-01-30 11:45:39 -05:00
6dd13ead91 feat: mapSocialIcon 2026-01-30 11:18:10 -05:00
980c5271ac chore(release): v0.1.10 2026-01-30 10:42:03 -05:00
115a5d2d38 feat: AcfLink / AcfLinkButton components 2026-01-30 10:24:06 -05:00
6b17201f60 feat: AcfPhone component 2026-01-30 10:05:49 -05:00
ad3c53c5dd feat: GroupSiteOptions.phoneNumber 2026-01-30 10:03:27 -05:00
fefa98021b refactor: OptionsSite => SiteOptions for clearer naming 2026-01-30 08:58:28 -05:00
83 changed files with 16059 additions and 6363 deletions

3
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"recommendations": ["oxc.oxc-vscode"]
}

27
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,27 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Nuxt server",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/wp-content/themes/moonshine/node_modules/nuxt/bin/nuxt.mjs",
"runtimeArgs": ["--inspect"],
"args": ["dev"],
"cwd": "${workspaceFolder}/wp-content/themes/moonshine",
"autoAttachChildProcesses": true,
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"]
},
{
"name": "Nuxt client",
"type": "chrome",
"request": "launch",
"sourceMaps": true,
"trace": false,
"url": "http://localhost:3000",
"userDataDir": "${env:HOME}/.vscode/chromium-profile",
"webRoot": "${workspaceFolder}/wp-content/themes/moonshine"
}
]
}

46
.vscode/settings.json vendored
View File

@@ -1,4 +1,34 @@
{
"[css]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[json]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[postcss]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[scss]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[vue]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll.oxc": "always"
},
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"editor.quickSuggestions": {
"strings": "on"
},
@@ -6,15 +36,11 @@
"*.css": "tailwindcss"
},
"graphql-config.load.rootDir": "wp-content/themes/moonshine",
"tailwindCSS.classAttributes": [
"class",
"ui"
],
"tailwindCSS.experimental.classRegex": [
[
"ui:\\s*{([^)]*)\\s*}",
"(?:'|\"|`)([^']*)(?:'|\"|`)"
]
],
"oxc.fmt.configPath": "wp-content/themes/moonshine/.oxfmtrc.json",
"oxc.path.oxfmt": "wp-content/themes/moonshine/node_modules/.bin/oxfmt",
"oxc.path.oxlint": "wp-content/themes/moonshine/node_modules/.bin/oxlint",
"oxc.tsConfigPath": "wp-content/themes/moonshine/tsconfig.json",
"tailwindCSS.classAttributes": ["class", "ui"],
"tailwindCSS.experimental.classRegex": [["ui:\\s*{([^)]*)\\s*}", "(?:'|\"|`)([^']*)(?:'|\"|`)"]],
"typescript.tsdk": "wp-content/themes/moonshine/node_modules/typescript/lib"
}

View File

@@ -3,4 +3,3 @@
Headless WordPress project boilerplate using Nuxt.
[✨ &nbsp;Release notes](/wp-content/themes/moonshine/CHANGELOG.md)

View File

@@ -33,6 +33,7 @@
},
"require": {
"axepress/wp-graphql-rank-math": "*",
"lewebsimple/acf-phone": "*",
"lewebsimple/advanced-custom-fields-pro": "*",
"lewebsimple/kaliroots": "*",
"lewebsimple/wp-graphql-headless-login": "*",

45
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f563233465b6f95dac3c6b33962f6aed",
"content-hash": "e3ce417e8c09ed84502559af141f6530",
"packages": [
{
"name": "axepress/wp-graphql-plugin-boilerplate",
@@ -313,6 +313,43 @@
],
"time": "2024-06-24T20:46:46+00:00"
},
{
"name": "lewebsimple/acf-phone",
"version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/lewebsimple/acf-phone.git",
"reference": "cf4c6440e0c2cdf7e422423bb629014204e721bf"
},
"dist": {
"type": "zip",
"url": "https://satis.ledevsimple.ca/dist/lewebsimple/acf-phone/lewebsimple-acf-phone-cf4c6440e0c2cdf7e422423bb629014204e721bf-zip-439080.zip",
"reference": "cf4c6440e0c2cdf7e422423bb629014204e721bf",
"shasum": "f9d7cbcf27985656245285e5bc035578621f1a69"
},
"require-dev": {
"lewebsimple/wp-phpcs-ruleset": "*",
"php-stubs/acf-pro-stubs": "*",
"squizlabs/php_codesniffer": "*"
},
"type": "wordpress-plugin",
"scripts": {
"post-create-project-cmd": [
"./scripts/post-create.sh"
],
"lint": [
"vendor/bin/phpcs"
],
"lintfix": [
"vendor/bin/phpcbf"
]
},
"support": {
"source": "https://github.com/lewebsimple/acf-phone/tree/v3.1.0",
"issues": "https://github.com/lewebsimple/acf-phone/issues"
},
"time": "2026-01-30T15:01:34+00:00"
},
{
"name": "lewebsimple/advanced-custom-fields-pro",
"version": "v6.7.0.2",
@@ -456,15 +493,15 @@
},
{
"name": "wpackagist-plugin/wp-graphql",
"version": "2.7.0",
"version": "2.8.0",
"source": {
"type": "svn",
"url": "https://plugins.svn.wordpress.org/wp-graphql/",
"reference": "tags/2.7.0"
"reference": "tags/2.8.0"
},
"dist": {
"type": "zip",
"url": "https://downloads.wordpress.org/plugin/wp-graphql.2.7.0.zip"
"url": "https://downloads.wordpress.org/plugin/wp-graphql.2.8.0.zip"
},
"require": {
"composer/installers": "^1.0 || ^2.0"

View File

@@ -25,3 +25,4 @@ logs
# Wrangler files
.wrangler
server/types/cloudflare.d.ts

View File

@@ -0,0 +1,20 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"experimentalSortImports": {
"groups": [
["side-effect"],
["builtin"],
["external", "type-external"],
["internal", "type-internal"],
["parent", "type-parent"],
["sibling", "type-sibling"],
["index", "type-index"]
]
},
"experimentalTailwindcss": {
"attributes": ["class"],
"functions": ["tv"],
"preserveWhitespace": true,
"stylesheet": "./app/assets/css/_main.css"
}
}

View File

@@ -0,0 +1,22 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"categories": {},
"env": {
"builtin": true,
"browser": true,
"node": true
},
"globals": {},
"ignorePatterns": [],
"plugins": ["import", "vue"],
"rules": {
"vue/define-emits-declaration": ["error", "type-based"],
"vue/define-props-declaration": ["error", "type-based"],
"vue/require-typed-ref": "error"
},
"settings": {
"vitest": {
"typecheck": false
}
}
}

View File

@@ -1,5 +1,63 @@
# Changelog
## v0.1.13
[compare changes](https://gitea.websimple.com/wp-sites/wp-headless/compare/v0.1.12...v0.1.13)
### 🚀 Enhancements
- TinyMCE list style (8ae6daf)
### 🩹 Fixes
- Wrangler.json needed for wrangler types before build (faf39ca)
## v0.1.12
[compare changes](https://gitea.websimple.com/wp-sites/wp-headless/compare/v0.1.11...v0.1.12)
### 🚀 Enhancements
- ConnexionButton (87be06e)
- ShowLabel (98e8d97)
- ParseAcfLink (2cfc1a0)
- ParseAcfMedia (ab563a7)
- Event context type for Cloudflare environment (4338028)
### 🩹 Fixes
- UApp in app.vue (28f6e1a)
## v0.1.11
[compare changes](https://gitea.websimple.com/wp-sites/wp-headless/compare/v0.1.10...v0.1.11)
### 🚀 Enhancements
- MapSocialIcon (6dd13ea)
- AcfSocial / parseAcfSocial (3199835)
### 🩹 Fixes
- Remove unneeded wrangler main / assets (eea020b)
- Cloudflare image provider only in production (291fa6e)
- Wrangler project name (8f037b5)
- ENABLE_CLOUDFLARE_IMAGE (9c3dcee)
## v0.1.10
[compare changes](https://gitea.websimple.com/templates/wp-headless/compare/v0.1.9...v0.1.10)
### 🚀 Enhancements
- GroupSiteOptions.phoneNumber (ad3c53c)
- AcfPhone component (6b17201)
- AcfLink / AcfLinkButton components (115a5d2)
### 💅 Refactors
- OptionsSite => SiteOptions for clearer naming (fefa980)
## v0.1.9
[compare changes](https://gitea.websimple.com/templates/wp-headless/compare/v0.1.8...v0.1.9)
@@ -132,7 +190,6 @@
## v0.1.1
### 🚀 Enhancements
- Initial Moonshine theme - Headless WordPress theme based on Nuxt (b3134fe)

View File

@@ -5,8 +5,15 @@ Thème WordPress en headless basé sur Nuxt.
## Variables d'environnement
| Nom | Description | Exemple | Requise |
|-----|-------------|---------|---------|
| `NUXT_SESSION_PASSWORD` | Clé secrète pour l'authentification | `date \| md5sum` | ✅ |
| `NUXT_WP_URL` | URL du backend WordPress | https://wp.exemple.com | ✅ |
| `NUXT_SITE_URL` | URL du frontend Nuxt | https://www.example.com | |
| --------------- | ------------------------ | ----------------------- | ------- |
| `NUXT_SITE_ENV` | Environnement | staging \| production | |
| `NUXT_SITE_URL` | URL du frontend Nuxt | https://www.example.com | |
| `NUXT_WP_URL` | URL du backend WordPress | https://wp.exemple.com | ✅ |
## Secrets
Configurer les secrets nécessaires au projet:
```sh
pnpm wrangler secret put NUXT_SESSION_PASSWORD
```

View File

@@ -24,11 +24,7 @@
"acfe_flexible_layouts_placeholder": 0,
"acfe_flexible_layouts_thumbnails": 0,
"acfe_flexible_async": [],
"acfe_flexible_add_actions": [
"copy",
"title",
"toggle"
],
"acfe_flexible_add_actions": ["copy", "title", "toggle"],
"acfe_flexible_remove_button": [],
"acfe_flexible_remove_top_actions": [],
"acfe_flexible_modal_edit": {
@@ -100,9 +96,7 @@
"min": "",
"max": "",
"acfe_flexible_modal_edit_size": "",
"acfe_flexible_settings": [
"group_layout_contained"
],
"acfe_flexible_settings": ["group_layout_contained"],
"acfe_flexible_settings_size": "large",
"acfe_flexible_render_template": false,
"acfe_flexible_render_style": false,
@@ -156,9 +150,7 @@
"id": ""
},
"graphql_field_name": "media",
"clone": [
"group_abstract_media"
],
"clone": ["group_abstract_media"],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
@@ -231,16 +223,12 @@
"style": "seamless",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": [
"the_content"
],
"hide_on_screen": ["the_content"],
"active": true,
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": [
"json"
],
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupAbstractBuilder",

View File

@@ -109,9 +109,7 @@
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": [
"json"
],
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupAbstractMedia",

View File

@@ -0,0 +1,84 @@
{
"key": "group_abstract_social",
"title": "Abstract - Social",
"fields": [
{
"key": "field_6855a1d643408",
"label": "Médias sociaux",
"name": "profiles",
"aria-label": "",
"type": "repeater",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"acfe_repeater_stylised_button": 0,
"layout": "table",
"pagination": 0,
"min": 0,
"max": 0,
"collapsed": "",
"button_label": "Ajouter un élément",
"show_in_graphql": 1,
"graphql_description": "",
"graphql_field_name": "profiles",
"graphql_non_null": 1,
"rows_per_page": 20,
"sub_fields": [
{
"key": "field_6855a7e143409",
"label": "URL",
"name": "url",
"aria-label": "",
"type": "url",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"allow_in_bindings": 0,
"placeholder": "",
"show_in_graphql": 1,
"graphql_description": "",
"graphql_field_name": "url",
"graphql_non_null": 1,
"parent_repeater": "field_6855a1d643408"
}
]
}
],
"location": [
[
{
"param": "abstract"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "seamless",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupAbstractSocial",
"map_graphql_types_from_location_rules": 0,
"graphql_types": "",
"acfe_meta": "",
"acfe_note": "",
"modified": 1769788591
}

View File

@@ -135,9 +135,7 @@
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": [
"json"
],
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupLayoutContained",

View File

@@ -25,6 +25,102 @@
"graphql_description": "",
"graphql_field_name": "email",
"graphql_non_null": 1
},
{
"key": "field_697cbf414fdd5",
"label": "Phone number",
"name": "phone_number",
"aria-label": "",
"type": "phone",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"initial_country": "CA",
"return_format": "national",
"allow_in_bindings": 0,
"show_in_graphql": 1,
"graphql_description": "",
"graphql_field_name": "phoneNumber",
"graphql_non_null": 1
},
{
"key": "field_697cd4c5fc56a",
"label": "Médias sociaux",
"name": "social",
"aria-label": "",
"type": "clone",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"graphql_field_name": "social",
"clone": ["group_abstract_social"],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
"prefix_name": 0,
"acfe_seamless_style": 0,
"acfe_clone_modal": 0,
"acfe_clone_modal_close": 0,
"acfe_clone_modal_button": "",
"acfe_clone_modal_size": "large"
},
{
"key": "field_697cc921234cc",
"label": "Liens globaux",
"name": "links",
"aria-label": "",
"type": "group",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"layout": "row",
"acfe_seamless_style": 0,
"acfe_group_modal": 0,
"show_in_graphql": 1,
"graphql_description": "",
"graphql_field_name": "links",
"graphql_non_null": 0,
"sub_fields": [
{
"key": "field_697cc93e234cd",
"label": "Contact",
"name": "contact",
"aria-label": "",
"type": "link",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"return_format": "array",
"allow_in_bindings": 0,
"show_in_graphql": 1,
"graphql_description": "",
"graphql_field_name": "contact",
"graphql_non_null": 1
}
],
"acfe_group_modal_close": 0,
"acfe_group_modal_button": "",
"acfe_group_modal_size": "large"
}
],
"location": [
@@ -46,15 +142,13 @@
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": [
"json"
],
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupSite",
"graphql_field_name": "GroupSiteOptions",
"map_graphql_types_from_location_rules": 0,
"graphql_types": "",
"acfe_meta": "",
"acfe_note": "",
"modified": 1769087407
"modified": 1769788698
}

View File

@@ -17,9 +17,7 @@
"id": ""
},
"graphql_field_name": "builder",
"clone": [
"group_abstract_builder"
],
"clone": ["group_abstract_builder"],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
@@ -45,16 +43,12 @@
"style": "seamless",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": [
"the_content"
],
"hide_on_screen": ["the_content"],
"active": true,
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": [
"json"
],
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupPostPage",

View File

@@ -20,6 +20,6 @@
"post_id": "",
"autoload": 0,
"show_in_graphql": 1,
"graphql_type_name": "OptionsSite",
"modified": 1769086997
"graphql_type_name": "SiteOptions",
"modified": 1769693948
}

View File

@@ -1,9 +1,13 @@
<script setup lang="ts">
import { fr } from "@nuxt/ui/locale";
</script>
<template>
<div>
<UApp :locale="fr">
<NuxtRouteAnnouncer />
<NuxtLoadingIndicator />
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</div>
</UApp>
</template>

View File

@@ -4,6 +4,7 @@
@import "./a11y.css";
@import "./containers.css";
@import "./links.css";
@import "./lists.css";
@import "./prose.css";
@import "./typography.css";

View File

@@ -8,13 +8,27 @@
}
/* Container sizes */
@utility container { @apply mx-auto px-container max-w-(--breakpoint-2xl); }
@utility container-xl { @apply container max-w-(--breakpoint-xl); }
@utility container-lg { @apply container max-w-(--breakpoint-lg); }
@utility container-md { @apply container max-w-(--breakpoint-md); }
@utility container-sm { @apply container max-w-(--breakpoint-sm); }
@utility container-fluid { @apply container max-w-screen; }
@utility container-none { @apply w-full max-w-screen; }
@utility container {
@apply mx-auto px-container max-w-(--breakpoint-2xl);
}
@utility container-xl {
@apply container max-w-(--breakpoint-xl);
}
@utility container-lg {
@apply container max-w-(--breakpoint-lg);
}
@utility container-md {
@apply container max-w-(--breakpoint-md);
}
@utility container-sm {
@apply container max-w-(--breakpoint-sm);
}
@utility container-fluid {
@apply container max-w-screen;
}
@utility container-none {
@apply w-full max-w-screen;
}
/* Split containers */
:root {
@@ -42,6 +56,12 @@
}
}
@utility container-left { @apply ml-(--container-outside-margin) px-container;}
@utility container-right { @apply mr-(--container-outside-margin) px-container;}
@utility container-half { width: calc(var(--container-width) / 2);}
@utility container-left {
@apply ml-(--container-outside-margin) px-container;
}
@utility container-right {
@apply mr-(--container-outside-margin) px-container;
}
@utility container-half {
width: calc(var(--container-width) / 2);
}

View File

@@ -2,6 +2,12 @@
@custom-variant links (& a:not([class*='link-']):not([class*='button-']));
/* Link styles */
@utility link-base { @apply cursor-pointer disabled-default transition; }
@utility link-underline { @apply link-base underline hover:decoration-primary; }
@utility link-opacity { @apply link-base hover:opacity-80; }
@utility link-base {
@apply cursor-pointer disabled-default transition;
}
@utility link-underline {
@apply link-base underline hover:decoration-primary;
}
@utility link-opacity {
@apply link-base hover:opacity-80;
}

View File

@@ -0,0 +1,3 @@
@utility list-horizontal {
@apply list-none flex flex-wrap items-center gap-3;
}

View File

@@ -1,15 +1,25 @@
@utility prose {
/* Headings (allow class overrides) */
h1:not([class*="heading-"]) { @apply heading-1; }
h2:not([class*="heading-"]) { @apply heading-2; }
h3:not([class*="heading-"]) { @apply heading-3; }
h4:not([class*="heading-"]) { @apply heading-4; }
h1:not([class*="heading-"]) {
@apply heading-1;
}
h2:not([class*="heading-"]) {
@apply heading-2;
}
h3:not([class*="heading-"]) {
@apply heading-3;
}
h4:not([class*="heading-"]) {
@apply heading-4;
}
/* Links */
@apply links:link-underline;
/* Paragraphs */
p:not([class*="paragraph-"]) { @apply paragraph-base; }
p:not([class*="paragraph-"]) {
@apply paragraph-base;
}
/* Spacing */
@apply space-y-2;

View File

@@ -1,10 +1,24 @@
/* Heading styles */
@utility heading-base { @apply font-bold tracking-tight };
@utility heading-1 { @apply heading-base text-4xl; }
@utility heading-2 { @apply heading-base text-3xl; }
@utility heading-3 { @apply heading-base text-2xl; }
@utility heading-4 { @apply heading-base text-xl; }
@utility heading-base {
@apply font-bold tracking-tight;
}
@utility heading-1 {
@apply heading-base text-4xl;
}
@utility heading-2 {
@apply heading-base text-3xl;
}
@utility heading-3 {
@apply heading-base text-2xl;
}
@utility heading-4 {
@apply heading-base text-xl;
}
/* Paragraph styles */
@utility paragraph-base { @apply font-sans; }
@utility paragraph-lead { @apply paragraph-base text-2xl; }
@utility paragraph-base {
@apply font-sans;
}
@utility paragraph-lead {
@apply paragraph-base text-2xl;
}

View File

@@ -12,7 +12,6 @@ defineProps<{ image?: AcfImageFragment }>();
:width="image.mediaDetails?.width"
:height="image.mediaDetails?.height"
:style="{ objectPosition: image.objectPosition || 'center' }"
format="avif,webp"
placeholder
/>
</template>

View File

@@ -0,0 +1,5 @@
fragment AcfLink on AcfLink {
title
url
target
}

View File

@@ -0,0 +1,23 @@
<script setup lang="ts">
import type { AcfLinkFragment } from "#graphql/operations";
import type { LinkProps } from "@nuxt/ui";
type AcfLinkProps = Omit<LinkProps, "to" | "target" | "href"> & {
link?: AcfLinkFragment;
};
const { link, ...linkProps } = defineProps<AcfLinkProps>();
</script>
<template>
<ULink
v-if="link?.url && link?.title"
v-bind="linkProps"
:to="link.url"
:target="link.target"
:external="link.target === '_blank'"
:rel="link.target === '_blank' ? 'noopener noreferrer' : undefined"
>
<slot>{{ link.title }}</slot>
</ULink>
</template>

View File

@@ -0,0 +1,24 @@
<script setup lang="ts">
import type { AcfLinkFragment } from "#graphql/operations";
import type { ButtonProps } from "@nuxt/ui";
type AcfLinkButtonProps = Omit<ButtonProps, "to" | "target" | "href"> & {
link?: AcfLinkFragment;
showLabel?: boolean;
};
const { link, showLabel, ...buttonProps } = defineProps<AcfLinkButtonProps>();
</script>
<template>
<UButton
v-if="link?.url && link?.title"
v-bind="buttonProps"
:to="link.url"
:target="link.target"
:external="link.target === '_blank'"
:rel="link.target === '_blank' ? 'noopener noreferrer' : undefined"
>
<slot>{{ showLabel ? link.title : "" }}</slot>
</UButton>
</template>

View File

@@ -0,0 +1,5 @@
fragment AcfPhone on AcfPhone {
national
e164
extension
}

View File

@@ -0,0 +1,14 @@
<script setup lang="ts">
import type { AcfPhoneFragment } from "#graphql/operations";
defineProps<{
phone?: AcfPhoneFragment;
link?: boolean;
}>();
</script>
<template>
<Component :is="link ? 'a' : 'span'" v-if="phone" :href="link ? `tel:${phone.e164}` : undefined">
{{ phone.national }}{{ phone.extension ? ` ext. ${phone.extension}` : "" }}
</Component>
</template>

View File

@@ -0,0 +1,5 @@
fragment AcfSocial on GroupAbstractSocial_Fields {
profiles {
url
}
}

View File

@@ -0,0 +1,18 @@
<script setup lang="ts">
defineProps<{ social?: AcfSocialOutput }>();
</script>
<template>
<div v-if="social?.profiles" class="flex gap-1.5">
<a
v-for="({ url, icon }, key) in social.profiles"
:key="key"
:href="url"
target="_blank"
rel="noopener noreferrer"
class="flex"
>
<UIcon :name="icon" />
</a>
</div>
</template>

View File

@@ -1,20 +0,0 @@
<script setup lang="ts">
const { isLoggedIn } = useAuth();
const attrs = computed(() => {
return isLoggedIn.value
? {
label: "Déconnexion",
icon: "i-lucide-log-out",
}
: {
label: "Connexion",
icon: "i-lucide-log-in",
};
});
</script>
<template>
<AuthState>
<UButton to="/connexion" v-bind="attrs" color="neutral" />
</AuthState>
</template>

View File

@@ -7,7 +7,8 @@ const fields = [
label: "Courriel",
placeholder: "Entrez votre courriel",
required: true,
}, {
},
{
name: "password",
label: "Mot de passe",
type: "password" as const,

View File

@@ -5,12 +5,8 @@ const { logout } = useAuthConnexion();
<template>
<div class="w-full space-y-6">
<div class="flex flex-col text-center">
<div class="text-xl text-pretty font-semibold text-highlighted">
Déconnexion
</div>
<div class="mt-1 text-base text-pretty text-muted">
Veuillez confirmer la déconnexion.
</div>
<div class="text-xl font-semibold text-pretty text-highlighted">Déconnexion</div>
<div class="mt-1 text-base text-pretty text-muted">Veuillez confirmer la déconnexion.</div>
</div>
<UButton
icon="i-lucide-log-out"

View File

@@ -1,12 +1,8 @@
<template>
<div class="w-full space-y-6">
<div class="flex flex-col text-center">
<div class="text-xl text-pretty font-semibold text-highlighted">
Redirection en cours
</div>
<div class="mt-1 text-base text-pretty text-muted">
Veuillez patienter...
</div>
<div class="text-xl font-semibold text-pretty text-highlighted">Redirection en cours</div>
<div class="mt-1 text-base text-pretty text-muted">Veuillez patienter...</div>
</div>
</div>
</template>

View File

@@ -1,7 +1,11 @@
fragment BuilderSections on GroupAbstractBuilder_Fields {
sections {
__typename
... on GroupAbstractBuilderSectionsHeroSplitLayout { ... SectionHeroSplit }
... on GroupAbstractBuilderSectionsTextBlockLayout { ... SectionTextBlock }
... on GroupAbstractBuilderSectionsHeroSplitLayout {
...SectionHeroSplit
}
... on GroupAbstractBuilderSectionsTextBlockLayout {
...SectionTextBlock
}
}
}

View File

@@ -2,6 +2,6 @@ fragment NodePage on Page {
title
isFrontPage
groupPostPage {
... BuilderSections
...BuilderSections
}
}

View File

@@ -6,7 +6,7 @@ defineProps<NodePageFragment>();
<template>
<div id="node-page">
<h1 v-if="!isFrontPage" class="font-bold text-4xl">
<h1 v-if="!isFrontPage" class="text-4xl font-bold">
{{ title }}
</h1>
<BuilderSections :sections="groupPostPage?.sections || []" />

View File

@@ -3,4 +3,3 @@ fragment SectionHeroSplit on GroupAbstractBuilderSectionsHeroSplitLayout {
reverse
...AcfMedia
}

View File

@@ -5,7 +5,7 @@ import type { SectionHeroSplitFragment } from "#graphql/operations";
const tvSectionHeroSplit = tv({
slots: {
base: "py-6",
container: "container flex flex-col gap-6 items-center",
container: "container flex flex-col items-center gap-6",
content: "flex-1",
media: "w-full basis-1/2",
},
@@ -34,7 +34,7 @@ const classes = tvSectionHeroSplit({
<section :class="classes.base()">
<div :class="classes.container()">
<UiProse :content="content" :class="classes.content()" />
<AcfMedia :media="$props" :class="classes.media()" />
<AcfMedia :media="parseAcfMedia(props)" :class="classes.media()" />
</div>
</section>
</template>

View File

@@ -1,13 +1,12 @@
<script setup lang="ts">
const { data: siteOptions } = await useSiteOptions();
</script>
<template>
<UFooter id="site-footer">
<template #left>
<SiteFooterCopyright />
</template>
<template #right>
<SiteFooterCredits />
</template>
</UFooter>
<footer class="links:link-prose bg-accented">
<div class="container py-6">
<AcfSocial :social="parseAcfSocial(siteOptions)" />
</div>
<SiteFooterBottom />
</footer>
</template>

View File

@@ -0,0 +1,13 @@
<script setup lang="ts">
const { connexionButton } = useAuthConnexion();
</script>
<template>
<div class="bg-inverted py-1.5 text-inverted">
<div class="container flex flex-col items-center gap-3 sm:flex-row">
<SiteFooterCopyright class="sm:mr-auto" />
<UButton v-bind="connexionButton" color="neutral" variant="link" />
<SiteFooterCredits />
</div>
</div>
</template>

View File

@@ -1,10 +1,10 @@
<script setup lang="ts">
const { data } = await useAsyncGraphQLQuery("GeneralSettings", undefined, { cache: { ttl: 0 } });
const { data: generalSettings } = await useGeneralSettings();
</script>
<template>
<div>
© {{ new Date().getFullYear() }}
<span v-if="data.generalSettings?.title">{{ data.generalSettings.title }}</span>
<span v-if="generalSettings?.title">{{ generalSettings.title }}</span>
</div>
</template>

View File

@@ -1,6 +1,12 @@
<template>
<div class="flex items-center gap-1">
Fait avec <UIcon name="i-lucide-heart" /> par
<ULink href="https://websimple.com" target="_blank" external title="Site web développé par Websimple">Websimple</ULink>
<ULink
href="https://websimple.com"
target="_blank"
external
title="Site web développé par Websimple"
>Websimple</ULink
>
</div>
</template>

View File

@@ -1,6 +1,3 @@
<script setup lang="ts">
</script>
<template>
<UHeader mode="slideover">
<template #left>
@@ -8,8 +5,5 @@
<SvgSiteLogo class="h-12 w-auto" />
</NuxtLink>
</template>
<template #right>
<AuthConnexionButton />
</template>
</UHeader>
</template>

View File

@@ -2,5 +2,6 @@ export function useAuth() {
const { loggedIn: isLoggedIn, session } = useUserSession();
const hasRole = (role: string) => session.value?.user?.roles?.includes(role) || false;
const isAdmin = computed(() => hasRole("administrator"));
return { isLoggedIn, hasRole, isAdmin };
}

View File

@@ -3,9 +3,10 @@ import type { FormSubmitEvent } from "@nuxt/ui";
const isRedirecting = ref(false);
export function useAuthConnexion() {
const { isLoggedIn } = useAuth();
const toast = useToast();
const { fetch: refreshUserSession } = useUserSession();
const routeRedirect = useRoute().query.redirect as string || undefined;
const routeRedirect = (useRoute().query.redirect as string) || undefined;
// Helper: Redirect after login / logout
async function redirectTo(to: string | undefined) {
@@ -29,13 +30,13 @@ export function useAuthConnexion() {
duration: 3000,
});
await redirectTo(redirect);
}
catch (error) {
} catch (error) {
console.log(error);
toast.add({
title: "Erreur de connexion",
color: "error",
description: error instanceof Error ? error.message : "Une erreur est survenue lors de la connexion.",
description:
error instanceof Error ? error.message : "Une erreur est survenue lors de la connexion.",
duration: 5000,
});
}
@@ -55,17 +56,26 @@ export function useAuthConnexion() {
duration: 3000,
});
await redirectTo(redirect);
}
catch (error) {
} catch (error) {
console.log(error);
toast.add({
title: "Erreur de déconnexion",
color: "error",
description: error instanceof Error ? error.message : "Une erreur est survenue lors de la déconnexion.",
description:
error instanceof Error
? error.message
: "Une erreur est survenue lors de la déconnexion.",
duration: 5000,
});
}
}
return { isRedirecting, login, logout };
// Dynamic connexion link
const connexionButton = computed(() => ({
label: isLoggedIn.value ? "Déconnexion" : "Connexion",
icon: isLoggedIn.value ? "i-lucide-log-out" : "i-lucide-log-in",
to: "/connexion",
}));
return { isRedirecting, login, logout, connexionButton };
}

View File

@@ -0,0 +1,8 @@
export const useGeneralSettings = () =>
useAsyncGraphQLQuery(
"GeneralSettings",
{},
{
transform: ({ generalSettings }) => generalSettings,
},
);

View File

@@ -11,8 +11,7 @@ export function useProseLinks(refContent: Ref<HTMLElement | null>) {
try {
const hrefUrl = new URL(href);
return hrefUrl.hostname === siteUrl.hostname;
}
catch {
} catch {
return false;
}
};
@@ -25,8 +24,7 @@ export function useProseLinks(refContent: Ref<HTMLElement | null>) {
if (hrefUrl.hostname === siteUrl.hostname) {
return hrefUrl.pathname + hrefUrl.search + hrefUrl.hash;
}
}
catch {
} catch {
// Invalid URL
}
return href;
@@ -39,7 +37,14 @@ export function useProseLinks(refContent: Ref<HTMLElement | null>) {
if (!link) return;
const href = link.getAttribute("href");
if (!href) return;
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || link.target === "_blank" || link.hasAttribute("download")) {
if (
e.metaKey ||
e.ctrlKey ||
e.shiftKey ||
e.altKey ||
link.target === "_blank" ||
link.hasAttribute("download")
) {
return;
}
if (isInternal(href)) {

View File

@@ -2,7 +2,9 @@ import { breakpointsTailwind, useBreakpoints } from "@vueuse/core";
export function useResponsive() {
const { isMobileOrTablet } = useDevice();
const breakpoints = useBreakpoints(breakpointsTailwind, { ssrWidth: isMobileOrTablet ? 375 : 1024 });
const breakpoints = useBreakpoints(breakpointsTailwind, {
ssrWidth: isMobileOrTablet ? 375 : 1024,
});
const isDesktop = breakpoints.greaterOrEqual("lg");
return { breakpoints, isDesktop };

View File

@@ -0,0 +1,8 @@
export const useSiteOptions = () =>
useAsyncGraphQLQuery(
"SiteOptions",
{},
{
transform: ({ siteOptions }) => siteOptions?.groupSiteOptions,
},
);

View File

@@ -9,11 +9,11 @@ fragment AuthUser on User {
}
mutation AuthLogin($username: String!, $password: String!) {
login( input: { provider: PASSWORD, credentials: { username: $username, password: $password }}) {
login(input: { provider: PASSWORD, credentials: { username: $username, password: $password } }) {
authToken
refreshToken
user {
... AuthUser
...AuthUser
}
}
}

View File

@@ -1,5 +1,5 @@
mutation AuthRefreshToken($refreshToken: String!) {
refreshToken( input: { refreshToken: $refreshToken }) {
refreshToken(input: { refreshToken: $refreshToken }) {
authToken
}
}

View File

@@ -5,6 +5,6 @@ fragment GeneralSettings on GeneralSettings {
query GeneralSettings {
generalSettings {
... GeneralSettings
...GeneralSettings
}
}

View File

@@ -18,10 +18,10 @@ query NodeByUri($uri: String!) {
nodeByUri(uri: $uri) {
__typename
... on Page {
... NodePage
...NodePage
}
... on NodeWithRankMathSeo {
... NodeSeo
...NodeSeo
}
}
}

View File

@@ -1,11 +0,0 @@
fragment SiteOptions on GroupSite_Fields {
email
}
query OptionsSite {
optionsSite {
groupSite {
... SiteOptions
}
}
}

View File

@@ -0,0 +1,20 @@
fragment SiteOptions on GroupSiteOptions {
email
phoneNumber {
...AcfPhone
}
...AcfSocial
links {
contact {
...AcfLink
}
}
}
query SiteOptions {
siteOptions {
groupSiteOptions {
...SiteOptions
}
}
}

View File

@@ -1,13 +1,9 @@
<script setup lang="ts">
import { fr } from "@nuxt/ui/locale";
</script>
<template>
<UApp id="layout-default" :locale="fr">
<div id="layout-default">
<SiteHeader />
<UMain>
<slot />
</UMain>
<SiteFooter />
</UApp>
</div>
</template>

View File

@@ -4,13 +4,21 @@ const { path: uri } = useRoute();
const { data, error } = await useAsyncGraphQLQuery("NodeByUri", { uri });
if (!data.value?.nodeByUri) {
console.error("NodeByUri query error:", error.value);
throw createError({ statusCode: 404, message: `La page demandée est introuvable: ${uri}`, fatal: true });
throw createError({
statusCode: 404,
message: `La page demandée est introuvable: ${uri}`,
fatal: true,
});
}
// Dynamically resolve component based on node type
const componentName = `Node${data.value.nodeByUri.__typename}`;
if (!useNuxtApp().vueApp.component(componentName)) {
throw createError({ statusCode: 404, message: `La page demandée ne peut pas être affichée correctement: ${componentName}`, fatal: true });
throw createError({
statusCode: 404,
message: `La page demandée ne peut pas être affichée correctement: ${componentName}`,
fatal: true,
});
}
useNodeSeo(data.value.nodeByUri);

View File

@@ -0,0 +1,17 @@
import type { AcfLinkFragment } from "#graphql/operations";
import * as z from "zod";
const acfLinkSchema = z.object({
title: z.string(),
url: z.string(),
target: z.string().optional().default(""),
});
export type AcfLinkOutput = z.infer<typeof acfLinkSchema>;
export function parseAcfLink(data?: Partial<AcfLinkFragment>) {
try {
return acfLinkSchema.parse(data);
} catch {
return undefined;
}
}

View File

@@ -0,0 +1,28 @@
import type { AcfMediaFragment } from "#graphql/operations";
import * as z from "zod";
export const acfImageSchema = z.object({
src: z.url(),
alt: z.string(),
mediaDetails: z.object({
width: z.number(),
height: z.number(),
}),
objectPosition: z.string().optional().default("center"),
});
export const acfMediaSchema = z.object({
image: z.object({
node: acfImageSchema,
}),
aspectRatio: z.enum(["square", "video", "portrait", "auto"]).optional().default("auto"),
objectFit: z.enum(["cover", "contain"]).optional().default("cover"),
});
export function parseAcfMedia(data?: Partial<AcfMediaFragment>) {
try {
return acfMediaSchema.parse(data);
} catch {
return undefined;
}
}

View File

@@ -0,0 +1,33 @@
import type { AcfSocialFragment } from "#graphql/operations";
import * as z from "zod";
const socialProfile = z
.object({ url: z.url() })
.transform(({ url }) => ({ url, icon: getSocialIcon(url) }));
const acfSocialSchema = z.object({
profiles: z.array(socialProfile),
});
export type AcfSocialOutput = z.infer<typeof acfSocialSchema>;
export function parseAcfSocial(data?: AcfSocialFragment) {
try {
return acfSocialSchema.parse(data);
} catch {
return undefined;
}
}
const socialIconMap = {
"facebook.com": "i-cib-facebook-f",
"twitter.com": "i-cib-twitter",
"x.com": "i-cib-twitter",
"instagram.com": "i-cib-instagram",
"youtube.com": "i-cib-youtube",
"linkedin.com": "i-cib-linkedin",
"tiktok.com": "i-cib-tiktok",
};
function getSocialIcon(url: string): string {
const domain = new URL(url).hostname.toLowerCase().replace(/^www\./, "");
return socialIconMap[domain as keyof typeof socialIconMap] ?? "i-lucide-globe";
}

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +0,0 @@
// @ts-check
import withNuxt from "./.nuxt/eslint.config.mjs";
export default withNuxt({ rules: {
"vue/max-attributes-per-line": "off",
"vue/no-v-html": "off",
} },
);

View File

@@ -50,6 +50,16 @@ function moonshine_tiny_mce_before_init( $settings ) {
),
),
),
array(
'title' => __( "List styles", 'moonshine' ),
'items' => array(// List styles
array(
'title' => "Liste horizontale",
'selector' => 'ul,ol',
'classes' => 'list-horizontal',
),
),
),
array(
'title' => __( "Heading styles", 'moonshine' ),
'items' => array(// Heading styles

View File

@@ -1,6 +1,6 @@
<?php
// Override TermConnection query args
// Override term connection query args
add_filter( 'graphql_term_object_connection_query_args', 'moonshine_graphql_term_object_connection_query_args', 10, 3 );
function moonshine_graphql_term_object_connection_query_args( $query_args, $source, $args ) {
// Sort by 'order' meta value instead of legacy 'term_order' field

View File

@@ -1,2 +1,29 @@
<?php
return ['project-id-version'=>'Moonshine','report-msgid-bugs-to'=>'','pot-creation-date'=>'2026-01-13 15:52+0000','po-revision-date'=>'2026-01-29 02:55+0000','last-translator'=>'','language-team'=>'Français du Canada','language'=>'fr_CA','plural-forms'=>'nplurals=2; plural=n > 1;','mime-version'=>'1.0','content-type'=>'text/plain; charset=UTF-8','content-transfer-encoding'=>'8bit','x-generator'=>'Loco https://localise.biz/','x-loco-version'=>'2.8.1; wp-6.9; php-8.3.27','x-domain'=>'moonshine','messages'=>['Heading styles'=>'Styles de titres','Headless WordPress theme based on Nuxt.'=>'Thème Wordpress headless basé sur Nuxt.','https://websimple.com/'=>'https://websimple.com/','Inline styles'=>'Styles de caractères','Link styles'=>'Styles de liens','Main menu'=>'Menu principal','Moonshine'=>'Moonshine','Paragraph styles'=>'Styles de paragraphes','Pascal Martineau '=>'Pascal Martineau ','Semi-bold'=>'Semi-gras']];
return array(
'project-id-version' => 'Moonshine',
'report-msgid-bugs-to' => '',
'pot-creation-date' => '2026-01-13 15:52+0000',
'po-revision-date' => '2026-01-29 02:55+0000',
'last-translator' => '',
'language-team' => 'Français du Canada',
'language' => 'fr_CA',
'plural-forms' => 'nplurals=2; plural=n > 1;',
'mime-version' => '1.0',
'content-type' => 'text/plain; charset=UTF-8',
'content-transfer-encoding' => '8bit',
'x-generator' => 'Loco https://localise.biz/',
'x-loco-version' => '2.8.1; wp-6.9; php-8.3.27',
'x-domain' => 'moonshine',
'messages' => array(
'Heading styles' => 'Styles de titres',
'Headless WordPress theme based on Nuxt.' => 'Thème Wordpress headless basé sur Nuxt.',
'https://websimple.com/' => 'https://websimple.com/',
'Inline styles' => 'Styles de caractères',
'Link styles' => 'Styles de liens',
'Main menu' => 'Menu principal',
'Moonshine' => 'Moonshine',
'Paragraph styles' => 'Styles de paragraphes',
'Pascal Martineau ' => 'Pascal Martineau ',
'Semi-bold' => 'Semi-gras',
),
);

View File

@@ -1,24 +1,26 @@
import { version } from "./package.json";
const isDev = process.env.NODE_ENV !== "production";
const siteUrl = process.env.NUXT_SITE_URL;
if (!siteUrl) {
throw new Error(`NUXT_SITE_URL is not defined. Make sure to set it in your build environment variables.`);
throw new Error(
`NUXT_SITE_URL is not defined. Make sure to set it in your build environment variables.`,
);
}
const wpUrl = process.env.NUXT_WP_URL;
if (!wpUrl) {
throw new Error(`NUXT_WP_URL is not defined. Make sure to set it in your build environment variables.`);
throw new Error(
`NUXT_WP_URL is not defined. Make sure to set it in your build environment variables.`,
);
}
const wpDomain = new URL(wpUrl).hostname;
const enableCloudflareImages = Boolean(process.env.ENABLE_CLOUDFLARE_IMAGES);
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: [
"@lewebsimple/nuxt-graphql",
"@nuxt/eslint",
"@nuxt/image",
"@nuxt/ui",
"@nuxtjs/device",
@@ -28,9 +30,7 @@ export default defineNuxtConfig({
],
components: {
dirs: [
{ path: "~/components", pathPrefix: false },
],
dirs: [{ path: "~/components", pathPrefix: false }],
},
devtools: { enabled: true },
@@ -56,39 +56,12 @@ export default defineNuxtConfig({
nitro: {
preset: "cloudflare_module",
cloudflare: {
deployConfig: true,
nodeCompat: true,
wrangler: {
// Project name
name: "moonshine",
// Cloudflare Workers settings
compatibility_date: "2026-01-27",
main: "./.output/server/index.mjs",
observability: { enabled: true },
preview_urls: false,
// Environment variables
vars: {
NODE_ENV: "staging",
NUXT_SITE_URL: siteUrl,
NUXT_WP_URL: wpUrl,
},
// Bindings
assets: {
binding: "ASSETS",
directory: "./.output/public/",
},
},
},
},
eslint: {
config: {
stylistic: {
arrowParens: true,
commaDangle: "always-multiline",
indent: 2,
quotes: "double",
semi: true,
},
},
},
@@ -108,8 +81,10 @@ export default defineNuxtConfig({
},
image: {
...isDev ? {} : { provider: "cloudflare", cloudflare: { baseURL: "/" } },
provider: enableCloudflareImages ? "cloudflare" : "none",
cloudflare: { baseURL: `${siteUrl}/` },
domains: [wpDomain],
format: ["avif", "webp"],
},
robots: {

View File

@@ -1,22 +1,31 @@
{
"name": "@lewebsimple/moonshine",
"description": "Headless WordPress theme based on Nuxt.",
"version": "0.1.9",
"type": "module",
"version": "0.1.13",
"private": true,
"description": "Headless WordPress theme based on Nuxt.",
"type": "module",
"scripts": {
"build": "nuxt build",
"editor-style": "pnpx @tailwindcss/cli -i ./app/assets/css/_main.css -o ./editor-style.css --minify",
"build": "pnpm --sequential /build:.*/",
"build:nuxt": "nuxt build",
"dev": "nuxt dev",
"lint": "eslint --fix .",
"postinstall": "nuxt prepare",
"preview": "pnpm run build && wrangler dev --port 3000",
"release": "pnpm lint && changelogen --noAuthors --release --push",
"typecheck": "nuxt typecheck"
"editor-style": "pnpx @tailwindcss/cli -i ./app/assets/css/_main.css -o ./editor-style.css --minify",
"format": "oxfmt .",
"lint": "oxlint . --fix",
"postinstall": "pnpm --sequential /postinstall:.*/",
"postinstall:wrangler-types": "wrangler types ./server/types/cloudflare.d.ts",
"postinstall:nuxt": "nuxt prepare",
"preview": "pnpm --sequential /preview:.*/",
"preview:build": "pnpm run build",
"preview:wrangler-dev": "wrangler dev --port 3000",
"release": "pnpm --sequential /release:.*/",
"release:lint": "oxlint .",
"release:typecheck": "nuxt typecheck",
"release:changelogen": "changelogen --noAuthors --release --push"
},
"dependencies": {
"@iconify-json/lucide": "^1.2.87",
"@lewebsimple/nuxt-graphql": "^0.6.7",
"@iconify-json/cib": "^1.2.3",
"@iconify-json/lucide": "^1.2.88",
"@lewebsimple/nuxt-graphql": "^0.6.8",
"@nuxt/image": "^2.0.0",
"@nuxt/ui": "4.3.0",
"@nuxtjs/device": "4.0.0",
@@ -31,12 +40,12 @@
"zod": "^4.3.6"
},
"devDependencies": {
"@nuxt/eslint": "^1.13.0",
"changelogen": "^0.6.2",
"eslint": "^9.39.2",
"oxfmt": "^0.28.0",
"oxlint": "^1.43.0",
"typescript": "^5.9.3",
"vue-tsc": "^3.2.4",
"wrangler": "^4.61.1"
"wrangler": "^4.62.0"
},
"pnpm": {
"overrides": {

File diff suppressed because it is too large Load Diff

View File

@@ -5,17 +5,17 @@ export default defineEventHandler(async (event) => {
if (!data?.login) {
throw new Error("INVALID_LOGIN");
}
if (!await handleLogin(event, data)) {
if (!(await handleLogin(event, data))) {
throw new Error("LOGIN_FAILED");
}
return { success: true, message: "Connexion réussie" };
}
catch (error) {
} catch (error) {
const messages = {
INVALID_LOGIN: "Identifiants invalides. Veuillez réessayer.",
LOGIN_FAILED: "Une erreur est survenue lors de la connexion. Veuillez réessayer plus tard.",
};
const message = (error instanceof Error && error.message in messages) ? error.message : "LOGIN_FAILED";
const message =
error instanceof Error && error.message in messages ? error.message : "LOGIN_FAILED";
return { success: false, message: messages[message as keyof typeof messages] };
}
});

View File

@@ -4,9 +4,9 @@ export default defineEventHandler(async (event) => {
try {
await handleLogout(event);
return { success: true, message: "Déconnexion réussie" };
}
catch (error) {
const message = error instanceof Error ? error.message : "Une erreur est survenue lors de la déconnexion.";
} catch (error) {
const message =
error instanceof Error ? error.message : "Une erreur est survenue lors de la déconnexion.";
return { success: false, message };
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,9 @@ export default defineRemoteExecutorHooks({
onRequest(request) {
// Attach the Authorization header if an authToken is present in the context
if (request.context?.authToken) {
request.extensions = defu(request.extensions, { headers: { Authorization: `Bearer ${request.context.authToken}` } });
request.extensions = defu(request.extensions, {
headers: { Authorization: `Bearer ${request.context.authToken}` },
});
}
},
});

View File

@@ -0,0 +1,9 @@
import "h3";
declare module "h3" {
interface H3EventContext {
cloudflare: {
env: Cloudflare.Env;
};
}
}

View File

@@ -1,9 +1,9 @@
import type { H3Event } from "h3";
import { jwtDecode } from "jwt-decode";
import type { User } from "#auth-utils";
import type { AuthUserFragment, AuthLoginMutationResult } from "#graphql/operations";
import { AuthRefreshTokenDocument } from "#graphql/operations";
import type { ResultOf } from "#graphql/registry";
import type { H3Event } from "h3";
import { jwtDecode } from "jwt-decode";
// Handle login result and store user session
export async function handleLogin(event: H3Event, loginResult: AuthLoginMutationResult) {
@@ -54,10 +54,13 @@ export async function refreshAuthToken(refreshToken: string): Promise<string | u
const refreshPromise = (async () => {
const { wpUrl } = useRuntimeConfig();
const endpoint = `${wpUrl}/graphql`;
const { data } = await executeGraphQLHTTP<ResultOf<"AuthRefreshToken">>({
const { data } = await executeGraphQLHTTP<ResultOf<"AuthRefreshToken">>(
{
query: AuthRefreshTokenDocument,
variables: { refreshToken },
}, { endpoint });
},
{ endpoint },
);
return data?.refreshToken?.authToken || undefined;
})();
@@ -91,8 +94,7 @@ export async function getAuthToken(event: H3Event): Promise<string | undefined>
}
session.secure.authToken = newAuthToken;
await setUserSession(event, session);
}
catch {
} catch {
await clearUserSession(event);
return;
}

View File

@@ -16,4 +16,4 @@ declare module "#auth-utils" {
}
}
export { };
export {};

View File

@@ -0,0 +1,15 @@
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "wp-headless",
"main": ".output/server/index.mjs",
"compatibility_date": "2026-02-01",
"compatibility_flags": ["nodejs_compat", "no_nodejs_compat_v2"],
"observability": {
"enabled": true
},
"preview_urls": false,
"assets": {
"binding": "ASSETS",
"directory": ".output/public"
}
}