From 595a4a9c7cb7ee535c103669b788297bdbf004c3 Mon Sep 17 00:00:00 2001
From: Aditya Agarwal
\ No newline at end of file
diff --git a/public/snippets/installation-integrate-components.html b/public/snippets/installation-integrate-components.html
new file mode 100644
index 0000000..9ed75b0
--- /dev/null
+++ b/public/snippets/installation-integrate-components.html
@@ -0,0 +1,23 @@
+import { defineAction } from 'solid-command-palette';
+
+const minimalAction = defineAction({
+ id: 'minimal',
+ title: 'Minimal Action',
+ run: () => {
+ console.log('ran minimal action');
+ },
+});
+
+const incrementCounterAction = defineAction({
+ id: 'increment-counter',
+ title: 'Increment Counter by 1',
+ subtitle: 'Press CMD + E to trigger this.',
+ shortcut: '$mod+e', // $mod = Command on Mac & Control on Windows.
+ run: ({ rootContext }) => {
+ rootContext.increment();
+ },
+});
+
+export const actions = {
+ [minimalAction.id]: minimalAction,
+ [incrementCounterAction.id]: incrementCounterAction,
+};
+
\ No newline at end of file
diff --git a/public/snippets/installation-packages.html b/public/snippets/installation-packages.html
new file mode 100644
index 0000000..15b6331
--- /dev/null
+++ b/public/snippets/installation-packages.html
@@ -0,0 +1,6 @@
+import { Root, CommandPalette } from 'solid-command-palette';
+import { actions } from './actions';
+import 'solid-command-palette/pkg-dist/style.css';
+
+const App = () => {
+ const actionsContext = {
+ increment() {
+ console.log('increment count state by 1');
+ },
+ };
+
+ return (
+ <div class="my-app">
+ <Root
+ actions={actions}
+ actionsContext={actionsContext}
+ >
+ <CommandPalette />
+ </Root>
+ </div>
+ );
+};
+
\ No newline at end of file
diff --git a/snippets/installation-define-actions.snippet.tsx b/snippets/installation-define-actions.snippet.tsx
new file mode 100644
index 0000000..998aea9
--- /dev/null
+++ b/snippets/installation-define-actions.snippet.tsx
@@ -0,0 +1,24 @@
+import { defineAction } from 'solid-command-palette';
+
+const minimalAction = defineAction({
+ id: 'minimal',
+ title: 'Minimal Action',
+ run: () => {
+ console.log('ran minimal action');
+ },
+});
+
+const incrementCounterAction = defineAction({
+ id: 'increment-counter',
+ title: 'Increment Counter by 1',
+ subtitle: 'Press CMD + E to trigger this.',
+ shortcut: '$mod+e', // $mod = Command on Mac & Control on Windows.
+ run: ({ rootContext }) => {
+ rootContext.increment();
+ },
+});
+
+export const actions = {
+ [minimalAction.id]: minimalAction,
+ [incrementCounterAction.id]: incrementCounterAction,
+};
diff --git a/snippets/installation-integrate-components.snippet.tsx b/snippets/installation-integrate-components.snippet.tsx
new file mode 100644
index 0000000..8baf57a
--- /dev/null
+++ b/snippets/installation-integrate-components.snippet.tsx
@@ -0,0 +1,22 @@
+import { Root, CommandPalette } from 'solid-command-palette';
+import { actions } from './actions';
+import 'solid-command-palette/pkg-dist/style.css';
+
+const App = () => {
+ const actionsContext = {
+ increment() {
+ console.log('increment count state by 1');
+ },
+ };
+
+ return (
+ # Core Library
+npm install solid-command-palette
+
+# Peer Dependencies
+npm install solid-transition-group tinykeys fuse.js
+
Installation
- Install Packages
+
+ Define Actions
+
+ Integrate with Components
+