Skip to content

[6.x] Inertia UI#18709

Merged
brianjhanson merged 180 commits into
6.xfrom
feature/inertia-ui
May 26, 2026
Merged

[6.x] Inertia UI#18709
brianjhanson merged 180 commits into
6.xfrom
feature/inertia-ui

Conversation

@brianjhanson
Copy link
Copy Markdown
Contributor

@brianjhanson brianjhanson commented Apr 14, 2026

Opening this as the Super Branch™ that we'll merge into while converting the UI over to inertia and Vue. A handful of branches have already made it into 6.x, but it's getting harder to make sure things don't break while work is in progress. Merging updates into this branch first will help insulate the main 6.x branch from at least front-end messes.

Included PRs


CpAssetBundle

The CpAssetBundle is now loaded in both the Inertia and Twig render paths. Twig works as it always has. On the Inertia side, the HandleInertiaRequests middleware will register the CpAssetBundle and then inject the headHtml and bodyHtml into the app.blade.php template. That will throw the same old Craft global variable you know and love onto the page. With the variable on the page, when the cp.js file gets loaded by its position in bodyHtml it will populate the global variable with all the methods we've always had.

This means you can call your Craft.* Javascript just like you always have. The one caveat is that it's more possible than previously to create click handlers, etc. for content that will be loaded in after the fact.

At the moment you have both the legacy Craft global variable and the new Cp variable. Over time, we'll move methods and configuration from Craft to Cp .

Styling

Styling presented a bit of a challenge as we can have both old and new markup on a page at one time (if a slideout with legacy content is rendered for example). This can make styles a bit messy in some places, but I've done my best to isolate things.
The TailwindResetAsset will now only apply styles to .cp-legacy-reset, .slideout-container, .menu--disclosure and (almost) all legacy styles will only kick in when wrapped with a .cp-legacy class.
This falls down a bit for modals, menus, huds, etc. because we render those at the document root instead of in a container where we can add the cp-legacy class. Those styles are still applied globally for now.

Potential Breaking Changes

  • Javascript registerred with the {% js %} twig tags will now result in a <script type="module"> tag. In theory, this shouldn't break anything because the load order will still be respected, but it is a shift.
  • Event delegation is recommended so you can ensure your click handlers, etc. will fire even if the markup they expect isn't on the page when the handler is initially registerred.

brianjhanson and others added 11 commits May 19, 2026 14:58
Reorganizes resources/js/ following the Spatie Laravel/Inertia frontend
structure pattern, adapted for Vue 3.

- common/ — generic, domain-agnostic code
  - layouts/ (was layout/)
  - components/ (generic UI primitives)
  - form/ (generic form inputs)
  - composables/ (generic Vue composables)
  - types/ (shared types)
  - utils/ (shared utilities)

- modules/ — feature-specific domains
  - admin-table/
  - auth/
  - entry-types/
  - install/
  - navigation/
  - permissions/
  - plugin-manager/
  - sections/
  - settings/
  - sites/
  - updater/
  - user/
  - utilities/

- pages/ — Inertia pages reorganized into subdirs, names deduplicated
  - auth/, graphql/, install/, settings/, updater/, utilities/
  - Domain prefix stripped (SettingsEmailPage → settings/Email)
  - Page suffix stripped (LoginPage → auth/Login)

PHP Inertia::render() and ->inertiaPage() calls updated to use
new path-based keys throughout src/Http/Controllers/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@brianjhanson brianjhanson marked this pull request as ready for review May 26, 2026 14:29
@brianjhanson brianjhanson marked this pull request as draft May 26, 2026 14:32
Comment thread src/Cp/JsonResource.php Outdated
@brianjhanson brianjhanson marked this pull request as ready for review May 26, 2026 15:15
brianjhanson and others added 9 commits May 26, 2026 10:43
Aligns test assertions with the page restructure from PR #18964.
All component() calls now use the subdirectory path form that matches
the new pages/ file layout (e.g. 'settings/Email' instead of
'SettingsEmailPage').

17 test files updated across:
- Feature/Integration/PagesTest.php
- Feature/Http/Controllers/**/*Test.php
- Feature/Http/Middleware/EnsureInstalledTest.php

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Installs eslint@^9, typescript-eslint@^8, eslint-plugin-vue@^9
- Creates eslint.config.ts with recommended rules for TS + Vue 3
- Adds lint:js and lint scripts to package.json
- Adds .github/workflows/js-ci.yml CI job
- Updates .lintstagedrc.json to lint staged resources/js/ files
- Disables vue/no-deprecated-slot-attribute: the codebase uses both
  Vue components (CamelCase) and Lit web components (kebab-case);
  web components require the HTML-standard slot="name" attribute
  which the rule cannot distinguish from deprecated Vue syntax

Fixes found on first run:
- Computed with side effects in ActionMenu.vue
- Duplicate prop/computed locale key in Date.vue
- Duplicate modelValue in defineModel + defineProps in CraftCombobox.vue
- Missing v-for :key bindings (6 files)
- @ts-ignore@ts-expect-error with descriptions (cp.ts, Sites.vue, Install.vue)
- Unused private field and dead import in login-challenge.ts
- Missing imports for SelectOption, useFlashMessages, SystemMessagesController
  in SystemMessageEditModal.vue
- Object → object primitive type in globals.d.ts
- let → const for module-level ref in useFlashMessages.ts
- eslint-disable comments for legacy Craft constructor interface patterns

Widespread patterns downgraded to warnings for follow-up:
- @typescript-eslint/no-explicit-any
- @typescript-eslint/no-unused-vars

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@brianjhanson
Copy link
Copy Markdown
Contributor Author

Still a lot of work to do, but I'm going to merge this in as keeping it up to date with the 6.x branch is a little cumbersome.

@brianjhanson brianjhanson merged commit 9449219 into 6.x May 26, 2026
22 checks passed
@brianjhanson brianjhanson deleted the feature/inertia-ui branch May 26, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants