Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo-mod-jslibs-dist.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'alpinejs/packages/alpinejs/src/directives/index.js')
-rw-r--r--alpinejs/packages/alpinejs/src/directives/index.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/alpinejs/packages/alpinejs/src/directives/index.js b/alpinejs/packages/alpinejs/src/directives/index.js
index 8da02c5..0c9ed3b 100644
--- a/alpinejs/packages/alpinejs/src/directives/index.js
+++ b/alpinejs/packages/alpinejs/src/directives/index.js
@@ -1,3 +1,6 @@
+import { directive } from '../directives'
+import { warn } from '../utils/warn'
+
import './x-transition'
import './x-modelable'
import './x-teleport'
@@ -16,3 +19,13 @@ import './x-ref'
import './x-if'
import './x-id'
import './x-on'
+
+// Register warnings for people using plugin syntaxes and not loading the plugin itself:
+warnMissingPluginDirective('Collapse', 'collapse', 'collapse')
+warnMissingPluginDirective('Intersect', 'intersect', 'intersect')
+warnMissingPluginDirective('Focus', 'trap', 'focus')
+warnMissingPluginDirective('Mask', 'mask', 'mask')
+
+function warnMissingPluginDirective(name, directiveName, slug) {
+ directive(directiveName, (el) => warn(`You can't use [x-${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el))
+}