Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Vue 3 #11339

Merged
merged 146 commits into from
Feb 4, 2025
Merged

[6.x] Vue 3 #11339

merged 146 commits into from
Feb 4, 2025

Conversation

jasonvarga
Copy link
Member

@jasonvarga jasonvarga commented Jan 9, 2025

This upgrades Vue 2 to Vue 3.

This takes over from the awesome progress of #10430.

This PR does the bulk of the upgrade to get things running smoothly enough on Vue 3. There may be minor things broken here or there that may get fixed or replaced entirely in future PRs.

There may also be additional breaking changes introduced related to Vue 3 later. This PR does not necessarily represent the final state of Vue in Statamic 6.

Includes all the dependencies that were already figured out from the other branch.
This is as-is, with import paths updated.
This doesn't actually make it work yet. This code was taken from other branch.
The old way was triggering a warning which is resolved by using shallowRef. This is mostly changing some syntax and moving things around. No logic change.
- Use modelValue prop and update:model-value event so v-model works
- Add emits because you have to now
- Render function returns first element otherwise this.$el would be a text node.
- Swap $on hook:destroyed for the vue 3 way
- Import Fieldtype everywhere rather than relying on it being on window. (Will figure out the best solution for addons later)
- Bring back registration of fieldtypes
- Bard fieldtypes are commented out since they are quite broken at the moment.
- Remove StatusFieldtype as its not used anymore.
…ypes are ...

For a little bit of consistency.
Scrapped the polyfill, it's so widely supported.
Scrapped the underscore mixins, we don't use them.
Scrapped file_icon and resource_url, we don't use them.
Now users can do

import { Fieldtype } from '../../vendor/statamic/cms/resources/js/exports.js'
export default {
  mixins: [Fieldtype]
}

OR

If they add resolve.alias.statamic to their vite.config.js they can simplify it further:

resolve: {
  alias: {
    statamic: path.resolve(__dirname, './vendor/statamic/cms/resources/js/exports.js'),
  },
}

import { Fieldtype } from 'statamic';
- Support the new tree package we're now using
- Avoid using multiple trees
- The "top level" is just the first root item of the tree now, and styled in a way that the indent is removed.
@jasonvarga jasonvarga marked this pull request as ready for review February 4, 2025 15:24
@jasonvarga jasonvarga merged commit 953810f into master Feb 4, 2025
19 checks passed
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.

1 participant