🍱 Vue.js components for Nextcloud app development ✌ https://npmjs.org/@nextcloud/vue
Перейти к файлу
Marco Ambrosini e1f68a563b Add ripple effect to buttons
Signed-off-by: Marco Ambrosini <marcoambrosini@proton.me>
2024-07-19 08:39:41 +02:00
.github ci: bump RESUE to v4 2024-07-08 11:55:09 +02:00
LICENSES chore: Update styleguide image assets and add correct license information 2024-06-13 10:35:31 +02:00
build chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
cypress Merge pull request #5777 from nextcloud-libraries/fix/checkbox-attrs-aria 2024-07-04 16:12:36 +02:00
docs chore(directives): add docs 2024-06-14 19:57:01 +02:00
l10n fix(l10n): Translate l10n/messages.pot in nb_NO 2024-07-09 07:15:40 +00:00
src Add ripple effect to buttons 2024-07-19 08:39:41 +02:00
styleguide fix(NcActions): Respect boundaries element for popover height 2024-07-15 22:30:17 +02:00
tests fix(NcCheckboxRadioSwitch): keep data attributes bound to the wrapper 2024-07-04 14:38:47 +02:00
.editorconfig chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
.eslintrc.js chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
.gitignore chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
.stylelintignore chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
AUTHORS.md chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
CHANGELOG.md chore: Prepare release of 8.14.0 2024-07-04 16:36:51 +02:00
LICENSE chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
Makefile chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
README.md Add reuse status badge 2024-07-08 15:04:38 +02:00
REUSE.toml fix: use correct date in header 2024-07-08 12:16:23 +02:00
babel.config.js chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
cypress.config.mjs chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
jest.config.js chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
netlify.toml chore(ci): Add netlify config to have branch dependend node versions 2024-05-31 11:35:52 +02:00
package-lock.json Add ripple effect to buttons 2024-07-19 08:39:41 +02:00
package.json Add ripple effect to buttons 2024-07-19 08:39:41 +02:00
styleguide.config.js fix(NcActions): Respect boundaries element for popover height 2024-07-15 22:30:17 +02:00
stylelint.config.js chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
transifex.yml chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
tsconfig.json enh: Provide `getCurrentSkinTone` and `setCurrentSkinTone` functions and use in `EmojiSearch` 2024-01-23 15:37:55 +01:00
tsconfig.webpack.json chore(deps-dev): Bump @vue/tsconfig from 0.4.0 to 0.5.1 2024-05-31 11:35:47 +02:00
vite.config.mts chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00
webpack.config.js chore: Add SPDX license information and REUSE CI workflow 2024-06-13 10:35:27 +02:00

README.md

Vue components

REUSE status npm last version Dependabot status

This repo contains the various Vue.js components that Nextcloud uses for its internal design and structure. It provides standardized UI elements for building Nextcloud app frontends with Vue.js.

Documentation

A list of available components with examples to try out is available in the documentation.

The documentation is built from the latest development branch, for stable releases the documentation can be found matching the latest minor version:

Getting started

App example

If you want to check a real live example of a nextcloud app that uses this library, you can head over to https://github.com/skjnldsv/vueexample/ We will try to maintain this repository the best we can, but some example might be obsolete. Always check this repository documentation.

Install the library

npm i --save @nextcloud/vue

Usage

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.

import Vue from 'vue'
import { NextcloudVuePlugin } from '@nextcloud/vue'

Vue.use(NextcloudVuePlugin)

Development setup

If you want to work on improving the components its best to run the latest code and link it to your local Nextcloud installation:

  1. Install the dependencies with npm ci
  2. Build the components every time you do changes: npm run build
    • To make development build: npm run dev
    • To watch for changes and rebuild automatically: npm run watch
    • To watch for changes and rebuild development build: npm run dev:watch
  3. Connect it to your local Nextcloud development setup:
    • In this repository do npm link
    • In the repository of an app do npm link @nextcloud/vue (you need to re-link any time you do npm ci in the app)
  4. Then build the app with: npm run build (or watch for changes with npm run watch)

Translations

This library uses translated strings. When you edit/create a translated string, you need to run npm run l10n:extract to update the source files. Our awesome translation community will then be notified and a bot will sync those changes automatically.

Nonetheless, it requires a bit of caution. When you implement a translated string, import the translate or translatePlural and add it in your methods like so:

<template>
	<element>
		{{ t('Choose') }}
	</element>
</template>

<script>
import { translate as t } from '@nextcloud/l10n'

export default {
	methods: {
		t,
	},
}
</script>

Please note that using a translated string as an attribute will NOT work. But it will work if it's within an element (like the example above)

<template>
	<element :prop="t('This will not work')" />
</template>

You will instead have to define the string in the data section and use the relevant variable reference.

<template>
	<element :prop="chooseProp" />
</template>

<script>
export default {
	data() {
		return {
			chooseProp: t('Choose'),
		},
	}
}
</script>

Styleguide

When developing new components or extending components, make sure to also have some bits of related documentation like examples, where applicable. To test components and the documentation in that context, you can run npm run styleguide to run a local server that serves the style guide with all the components.

Using vue-devtools in Firefox

If you want to use vue-devtools in Firefox, you need to:

  • Either enable the HMR Enabler app …
  • … or patch your nextcloud instance as follows:
diff --git a/lib/public/AppFramework/Http/ContentSecurityPolicy.php b/lib/public/AppFramework/Http/ContentSecurityPolicy.php
index 0e3a6a705d..416b8b0fb9 100644
--- a/lib/public/AppFramework/Http/ContentSecurityPolicy.php
+++ b/lib/public/AppFramework/Http/ContentSecurityPolicy.php
@@ -41,9 +41,9 @@ namespace OCP\AppFramework\Http;
  */
 class ContentSecurityPolicy extends EmptyContentSecurityPolicy {
        /** @var bool Whether inline JS snippets are allowed */
-       protected $inlineScriptAllowed = false;
+       protected $inlineScriptAllowed = true;
        /** @var bool Whether eval in JS scripts is allowed */
-       protected $evalScriptAllowed = false;
+       protected $evalScriptAllowed = true;
        /** @var bool Whether strict-dynamic should be set */
        protected $strictDynamicAllowed = false;
        /** @var array Domains from which scripts can get loaded */

Releasing a new version

  • Pull the latest changes from master or stableX
  • Checkout a new branch with the tag name (e.g v4.0.1): git checkout -b v<version>
  • Run npm version patch --no-git-tag-version (npm version minor --no-git-tag-version if minor). This will return a new version name, make sure it matches what you expect
  • Generate the changelog content from the release page. Create a draft release, select the previous tag, click generate then paste the content to the CHANGELOG.md file
    1. use the the version as tag AND title (e.g v4.0.1)
    2. add the changelog content as description (https://github.com/nextcloud-libraries/nextcloud-vue/releases)
  • Commit, push and create PR
  • Get your PR reviewed and merged
  • Create a milestone with the follow-up version at https://github.com/nextcloud-libraries/nextcloud-vue/milestones
  • Move all open tickets and PRs to the follow-up
  • Close the milestone of the version you release
  • Publish the previously drafted release on GitHub image

Releasing a pre-release

A pre-release can be built in the same way as described above, however it requires manual adjustments to avoid that npm ships the pre-release to all users:

  1. Retag latest to the last stable release

    npm dist-tag add @nextcloud/vue@5.4.0 latest

  2. Tag the new pre-release as next

    npm dist-tag add @nextcloud/vue@6.0.0-beta.2 next