diff --git a/CHANGELOG.md b/CHANGELOG.md index 5327b904d6..1b58e86733 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ All notable changes to this project will be documented in this file. ### 💥 Breaking Changes * The package now uses Vue 3 instead of Vue 2.7 * The package is now a native ESM package and the CommonJS entry points were dropped! -* The `limitWidth` prop of `NcSettingsSection` was removed (the content is now always limitted width) [\#5605](https://github.com/nextcloud-libraries/nextcloud-vue/pull/5605) +* The plugin registering all the components and directives globally is removed. Use local registration instead. Use [`unplugin-vue-components`](https://github.com/unplugin/unplugin-vue-components) if you need an alternative. +* The `limitWidth` prop of `NcSettingsSection` was removed (the content is now always limited width) [\#5605](https://github.com/nextcloud-libraries/nextcloud-vue/pull/5605) * The `closing` and `opening` events of `NcAppSidebar` were removed as they are directly emitted when the sidebar was opened when using `v-if` and also just duplicated the state of the `open` prop [\#5606](https://github.com/nextcloud-libraries/nextcloud-vue/pull/5606) * The `checked` prop was renamed to `modelValue`, the `update:checked` event was renamed to `update:modelValue`. This affects the following components. - `NcActionCheckbox` diff --git a/README.md b/README.md index d123a70183..88ae1c1f1b 100644 --- a/README.md +++ b/README.md @@ -40,17 +40,6 @@ To use a component, just import it: import { NcAppNavigation, NcActions, NcActionButton } from '@nextcloud/vue' ``` -### Registering all components. - -> Be careful, this will registry all components and directives, even the ones not being used. - -```js -import Vue from 'vue' -import { NextcloudVuePlugin } from '@nextcloud/vue' - -Vue.use(NextcloudVuePlugin) -``` - ## Development setup If you want to work on improving the components it’s best to run the latest code and link it to your local Nextcloud installation: diff --git a/src/index.ts b/src/index.ts index b8ef8f3cec..8965ef1767 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,5 +9,3 @@ export * from './composables/index.js' export * from './functions/index.ts' export * from './directives/index.js' export * from './mixins/index.js' - -export { NextcloudVuePlugin } from './plugin' diff --git a/src/plugin.ts b/src/plugin.ts deleted file mode 100644 index 6017ed3da5..0000000000 --- a/src/plugin.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -import type { Directive, Plugin } from 'vue' - -import * as NcComponents from './components/index' -import * as NcDirectives from './directives/index' - -/** - * Install all Nextcloud Vue components and directives globally - * @example - * ```js - * import { NextcloudVuePlugin } from '@nextcloud/vue' - * import { createApp } from 'vue' - * - * const app = createApp({}) - * - * app.use(NextcloudVuePlugin, { - * // optional options - * }) - * ``` - */ -export const NextcloudVuePlugin: Plugin = { - install(app) { - // Install components - Object.entries(NcComponents).forEach(([name, component]) => { - app.component(component.name || name, component) - }) - - // Install directives - Object.entries(NcDirectives as { [key: string]: Directive }).forEach(([name, directive]) => { - app.directive(name, directive) - }) - }, -} diff --git a/tests/unit/plugin.spec.ts b/tests/unit/plugin.spec.ts deleted file mode 100644 index 9a4fc8bc9a..0000000000 --- a/tests/unit/plugin.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -import { describe, expect, it } from 'vitest' -import { mount } from '@vue/test-utils' -import { h, resolveComponent } from 'vue' - -import { NextcloudVuePlugin } from '../../src/plugin' - -describe('Nextcloud Vue Plugin', () => { - it('can be installed', () => { - const wrapper = mount( - { - setup() { - const ButtonCounter = resolveComponent('NcButton') - return () => h(ButtonCounter, { ariaLabel: 'button' }) - }, - }, { - global: { - plugins: [NextcloudVuePlugin], - }, - } - ) - expect(wrapper.vm.$el.tagName).not.toBe('NCBUTTON') // If it could no be installed it would be 'NCBUTTON', otherwise it would be 'A' or 'BUTTON' - }) -})