@ailuracode/alpine-command 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/global.d.ts +56 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +173 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) ailuracode
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @ailuracode/alpine-command
|
|
2
|
+
|
|
3
|
+
Headless command palette store for Alpine.js — searchable actions, keyboard navigation, groups, and shortcuts. Compose optionally with dialog and toast plugins.
|
|
4
|
+
|
|
5
|
+
**[Full documentation →](../../docs/plugins/command.md)**
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @ailuracode/alpine-command alpinejs
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Store API
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
$store.command.open();
|
|
17
|
+
$store.command.search = "theme";
|
|
18
|
+
$store.command.register({
|
|
19
|
+
id: "toggle-theme",
|
|
20
|
+
label: "Toggle theme",
|
|
21
|
+
group: "Appearance",
|
|
22
|
+
shortcut: "⌘K",
|
|
23
|
+
action: () => {},
|
|
24
|
+
});
|
|
25
|
+
$store.command.run("toggle-theme");
|
|
26
|
+
```
|
package/dist/global.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/// <reference types="@types/alpinejs" />
|
|
2
|
+
|
|
3
|
+
export type CommandAction = () => void | Promise<void>;
|
|
4
|
+
|
|
5
|
+
export type CommandItem = {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
group?: string;
|
|
9
|
+
shortcut?: string;
|
|
10
|
+
keywords?: string[];
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
action: CommandAction;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export interface CommandStore {
|
|
16
|
+
search: string;
|
|
17
|
+
activeIndex: number;
|
|
18
|
+
visible: boolean;
|
|
19
|
+
items: Record<string, CommandItem>;
|
|
20
|
+
readonly isOpen: boolean;
|
|
21
|
+
open(): void;
|
|
22
|
+
close(): void;
|
|
23
|
+
toggle(): void;
|
|
24
|
+
register(item: CommandItem): void;
|
|
25
|
+
unregister(id: string): void;
|
|
26
|
+
run(id: string): Promise<void>;
|
|
27
|
+
handleKeydown(event: KeyboardEvent): void;
|
|
28
|
+
readonly filteredItems: CommandItem[];
|
|
29
|
+
readonly groupedItems: Record<string, CommandItem[]>;
|
|
30
|
+
destroy(): void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface CommandPluginOptions {
|
|
34
|
+
onOpen?: () => void;
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
onRun?: (item: CommandItem) => void;
|
|
37
|
+
filter?: (item: CommandItem, search: string) => boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function commandOptions<const T extends CommandPluginOptions>(options: T): T;
|
|
41
|
+
export function createCommandStore(options?: CommandPluginOptions): CommandStore;
|
|
42
|
+
|
|
43
|
+
export default function commandPlugin(
|
|
44
|
+
options?: CommandPluginOptions
|
|
45
|
+
): import("alpinejs").PluginCallback;
|
|
46
|
+
|
|
47
|
+
declare global {
|
|
48
|
+
namespace Alpine {
|
|
49
|
+
interface Stores {
|
|
50
|
+
command: CommandStore;
|
|
51
|
+
}
|
|
52
|
+
interface Magics<T> {
|
|
53
|
+
$command: CommandStore;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import AlpineType from 'alpinejs';
|
|
2
|
+
|
|
3
|
+
type CommandAction = () => void | Promise<void>;
|
|
4
|
+
type CommandItem = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
group?: string;
|
|
8
|
+
shortcut?: string;
|
|
9
|
+
keywords?: string[];
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
action: CommandAction;
|
|
12
|
+
};
|
|
13
|
+
type CommandStore = {
|
|
14
|
+
search: string;
|
|
15
|
+
activeIndex: number;
|
|
16
|
+
/** Whether the palette is visible. */
|
|
17
|
+
visible: boolean;
|
|
18
|
+
/** Registered command items. */
|
|
19
|
+
items: Record<string, CommandItem>;
|
|
20
|
+
readonly isOpen: boolean;
|
|
21
|
+
open(): void;
|
|
22
|
+
close(): void;
|
|
23
|
+
toggle(): void;
|
|
24
|
+
register(item: CommandItem): void;
|
|
25
|
+
unregister(id: string): void;
|
|
26
|
+
run(id: string): Promise<void>;
|
|
27
|
+
handleKeydown(event: KeyboardEvent): void;
|
|
28
|
+
readonly filteredItems: CommandItem[];
|
|
29
|
+
readonly groupedItems: Record<string, CommandItem[]>;
|
|
30
|
+
destroy(): void;
|
|
31
|
+
};
|
|
32
|
+
type CommandStoreConfig = {
|
|
33
|
+
onOpen?: () => void;
|
|
34
|
+
onClose?: () => void;
|
|
35
|
+
onRun?: (item: CommandItem) => void;
|
|
36
|
+
filter?: (item: CommandItem, search: string) => boolean;
|
|
37
|
+
};
|
|
38
|
+
/** Creates the headless command palette store. */
|
|
39
|
+
declare function createCommandStore(config?: CommandStoreConfig): CommandStore;
|
|
40
|
+
|
|
41
|
+
interface CommandPluginOptions extends CommandStoreConfig {
|
|
42
|
+
}
|
|
43
|
+
/** Builds typed command plugin options. */
|
|
44
|
+
declare function commandOptions<const T extends CommandPluginOptions>(options: T): T;
|
|
45
|
+
/** Alpine.js command palette plugin. Registers `$store.command`. */
|
|
46
|
+
declare function commandPlugin(options?: CommandPluginOptions): AlpineType.PluginCallback;
|
|
47
|
+
declare global {
|
|
48
|
+
namespace Alpine {
|
|
49
|
+
interface Stores {
|
|
50
|
+
command: CommandStore;
|
|
51
|
+
}
|
|
52
|
+
interface Magics<T> {
|
|
53
|
+
$command: CommandStore;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { type CommandAction, type CommandItem, type CommandPluginOptions, type CommandStore, type CommandStoreConfig, commandOptions, createCommandStore, commandPlugin as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// src/store.ts
|
|
2
|
+
function defaultFilter(item, search) {
|
|
3
|
+
if (!search.trim()) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
const query = search.trim().toLowerCase();
|
|
7
|
+
const haystack = [item.label, item.group ?? "", item.shortcut ?? "", ...item.keywords ?? []].join(" ").toLowerCase();
|
|
8
|
+
return haystack.includes(query);
|
|
9
|
+
}
|
|
10
|
+
function isEditableTarget(target) {
|
|
11
|
+
if (!(target instanceof HTMLElement)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
const tag = target.tagName;
|
|
15
|
+
return tag === "INPUT" || tag === "TEXTAREA" || target.isContentEditable;
|
|
16
|
+
}
|
|
17
|
+
function isTypingKey(event) {
|
|
18
|
+
return event.key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey && !event.isComposing;
|
|
19
|
+
}
|
|
20
|
+
function handlePaletteTyping(store, event) {
|
|
21
|
+
if (isEditableTarget(event.target)) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (event.key === "Backspace") {
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
store.search = store.search.slice(0, -1);
|
|
27
|
+
store.activeIndex = 0;
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (isTypingKey(event)) {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
store.search += event.key;
|
|
33
|
+
store.activeIndex = 0;
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
function createCommandStore(config = {}) {
|
|
39
|
+
const filter = config.filter ?? defaultFilter;
|
|
40
|
+
const store = {
|
|
41
|
+
search: "",
|
|
42
|
+
activeIndex: 0,
|
|
43
|
+
visible: false,
|
|
44
|
+
items: {},
|
|
45
|
+
get isOpen() {
|
|
46
|
+
return this.visible;
|
|
47
|
+
},
|
|
48
|
+
get filteredItems() {
|
|
49
|
+
const list = Object.values(this.items).filter(
|
|
50
|
+
(item) => !item.disabled && filter(item, this.search)
|
|
51
|
+
);
|
|
52
|
+
if (this.activeIndex >= list.length) {
|
|
53
|
+
this.activeIndex = Math.max(list.length - 1, 0);
|
|
54
|
+
}
|
|
55
|
+
return list;
|
|
56
|
+
},
|
|
57
|
+
get groupedItems() {
|
|
58
|
+
const groups = {};
|
|
59
|
+
for (const item of this.filteredItems) {
|
|
60
|
+
const group = item.group ?? "General";
|
|
61
|
+
groups[group] ??= [];
|
|
62
|
+
groups[group].push(item);
|
|
63
|
+
}
|
|
64
|
+
return groups;
|
|
65
|
+
},
|
|
66
|
+
open() {
|
|
67
|
+
if (this.visible) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this.visible = true;
|
|
71
|
+
this.search = "";
|
|
72
|
+
this.activeIndex = 0;
|
|
73
|
+
config.onOpen?.();
|
|
74
|
+
},
|
|
75
|
+
close() {
|
|
76
|
+
if (!this.visible) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.visible = false;
|
|
80
|
+
this.search = "";
|
|
81
|
+
this.activeIndex = 0;
|
|
82
|
+
config.onClose?.();
|
|
83
|
+
},
|
|
84
|
+
toggle() {
|
|
85
|
+
if (this.visible) {
|
|
86
|
+
this.close();
|
|
87
|
+
} else {
|
|
88
|
+
this.open();
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
register(item) {
|
|
92
|
+
this.items[item.id] = item;
|
|
93
|
+
},
|
|
94
|
+
unregister(id) {
|
|
95
|
+
delete this.items[id];
|
|
96
|
+
},
|
|
97
|
+
async run(id) {
|
|
98
|
+
const item = this.items[id];
|
|
99
|
+
if (!item || item.disabled) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
await item.action();
|
|
103
|
+
config.onRun?.(item);
|
|
104
|
+
this.close();
|
|
105
|
+
},
|
|
106
|
+
handleKeydown(event) {
|
|
107
|
+
if (!this.visible) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const list = this.filteredItems;
|
|
111
|
+
if (handlePaletteTyping(this, event)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
switch (event.key) {
|
|
115
|
+
case "ArrowDown":
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
this.activeIndex = list.length === 0 ? 0 : (this.activeIndex + 1) % list.length;
|
|
118
|
+
break;
|
|
119
|
+
case "ArrowUp":
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
this.activeIndex = list.length === 0 ? 0 : (this.activeIndex - 1 + list.length) % list.length;
|
|
122
|
+
break;
|
|
123
|
+
case "Home":
|
|
124
|
+
event.preventDefault();
|
|
125
|
+
this.activeIndex = 0;
|
|
126
|
+
break;
|
|
127
|
+
case "End":
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
this.activeIndex = Math.max(list.length - 1, 0);
|
|
130
|
+
break;
|
|
131
|
+
case "Enter": {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
const active = list[this.activeIndex];
|
|
134
|
+
if (active) {
|
|
135
|
+
void this.run(active.id);
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
case "Escape":
|
|
140
|
+
event.preventDefault();
|
|
141
|
+
this.close();
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
destroy() {
|
|
148
|
+
this.items = {};
|
|
149
|
+
this.visible = false;
|
|
150
|
+
this.search = "";
|
|
151
|
+
this.activeIndex = 0;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
return store;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// src/index.ts
|
|
158
|
+
function commandOptions(options) {
|
|
159
|
+
return options;
|
|
160
|
+
}
|
|
161
|
+
function commandPlugin(options = {}) {
|
|
162
|
+
return function registerCommand(Alpine) {
|
|
163
|
+
const store = createCommandStore(options);
|
|
164
|
+
Alpine.store("command", store);
|
|
165
|
+
Alpine.magic("command", () => Alpine.store("command"));
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export {
|
|
169
|
+
commandOptions,
|
|
170
|
+
createCommandStore,
|
|
171
|
+
commandPlugin as default
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/store.ts","../src/index.ts"],"sourcesContent":["export type CommandAction = () => void | Promise<void>;\n\nexport type CommandItem = {\n id: string;\n label: string;\n group?: string;\n shortcut?: string;\n keywords?: string[];\n disabled?: boolean;\n action: CommandAction;\n};\n\nexport type CommandStore = {\n search: string;\n activeIndex: number;\n /** Whether the palette is visible. */\n visible: boolean;\n /** Registered command items. */\n items: Record<string, CommandItem>;\n readonly isOpen: boolean;\n open(): void;\n close(): void;\n toggle(): void;\n register(item: CommandItem): void;\n unregister(id: string): void;\n run(id: string): Promise<void>;\n handleKeydown(event: KeyboardEvent): void;\n readonly filteredItems: CommandItem[];\n readonly groupedItems: Record<string, CommandItem[]>;\n destroy(): void;\n};\n\nexport type CommandStoreConfig = {\n onOpen?: () => void;\n onClose?: () => void;\n onRun?: (item: CommandItem) => void;\n filter?: (item: CommandItem, search: string) => boolean;\n};\n\nfunction defaultFilter(item: CommandItem, search: string): boolean {\n if (!search.trim()) {\n return true;\n }\n\n const query = search.trim().toLowerCase();\n const haystack = [item.label, item.group ?? \"\", item.shortcut ?? \"\", ...(item.keywords ?? [])]\n .join(\" \")\n .toLowerCase();\n\n return haystack.includes(query);\n}\n\nfunction isEditableTarget(target: EventTarget | null): boolean {\n if (!(target instanceof HTMLElement)) {\n return false;\n }\n\n const tag = target.tagName;\n return tag === \"INPUT\" || tag === \"TEXTAREA\" || target.isContentEditable;\n}\n\nfunction isTypingKey(event: KeyboardEvent): boolean {\n return (\n event.key.length === 1 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.altKey &&\n !event.isComposing\n );\n}\n\nfunction handlePaletteTyping(\n store: Pick<CommandStore, \"search\" | \"activeIndex\">,\n event: KeyboardEvent\n): boolean {\n if (isEditableTarget(event.target)) {\n return false;\n }\n\n if (event.key === \"Backspace\") {\n event.preventDefault();\n store.search = store.search.slice(0, -1);\n store.activeIndex = 0;\n return true;\n }\n\n if (isTypingKey(event)) {\n event.preventDefault();\n store.search += event.key;\n store.activeIndex = 0;\n return true;\n }\n\n return false;\n}\n\n/** Creates the headless command palette store. */\nexport function createCommandStore(config: CommandStoreConfig = {}): CommandStore {\n const filter = config.filter ?? defaultFilter;\n\n const store: CommandStore = {\n search: \"\",\n activeIndex: 0,\n visible: false,\n items: {},\n\n get isOpen() {\n return this.visible;\n },\n\n get filteredItems() {\n const list = Object.values(this.items).filter(\n (item) => !item.disabled && filter(item, this.search)\n );\n if (this.activeIndex >= list.length) {\n this.activeIndex = Math.max(list.length - 1, 0);\n }\n return list;\n },\n\n get groupedItems() {\n const groups: Record<string, CommandItem[]> = {};\n for (const item of this.filteredItems) {\n const group = item.group ?? \"General\";\n groups[group] ??= [];\n groups[group].push(item);\n }\n return groups;\n },\n\n open() {\n if (this.visible) {\n return;\n }\n this.visible = true;\n this.search = \"\";\n this.activeIndex = 0;\n config.onOpen?.();\n },\n\n close() {\n if (!this.visible) {\n return;\n }\n this.visible = false;\n this.search = \"\";\n this.activeIndex = 0;\n config.onClose?.();\n },\n\n toggle() {\n if (this.visible) {\n this.close();\n } else {\n this.open();\n }\n },\n\n register(item) {\n this.items[item.id] = item;\n },\n\n unregister(id) {\n delete this.items[id];\n },\n\n async run(id) {\n const item = this.items[id];\n if (!item || item.disabled) {\n return;\n }\n\n await item.action();\n config.onRun?.(item);\n this.close();\n },\n\n handleKeydown(event) {\n if (!this.visible) {\n return;\n }\n\n const list = this.filteredItems;\n\n if (handlePaletteTyping(this, event)) {\n return;\n }\n\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n this.activeIndex = list.length === 0 ? 0 : (this.activeIndex + 1) % list.length;\n break;\n case \"ArrowUp\":\n event.preventDefault();\n this.activeIndex =\n list.length === 0 ? 0 : (this.activeIndex - 1 + list.length) % list.length;\n break;\n case \"Home\":\n event.preventDefault();\n this.activeIndex = 0;\n break;\n case \"End\":\n event.preventDefault();\n this.activeIndex = Math.max(list.length - 1, 0);\n break;\n case \"Enter\": {\n event.preventDefault();\n const active = list[this.activeIndex];\n if (active) {\n void this.run(active.id);\n }\n break;\n }\n case \"Escape\":\n event.preventDefault();\n this.close();\n break;\n default:\n break;\n }\n },\n\n destroy() {\n this.items = {};\n this.visible = false;\n this.search = \"\";\n this.activeIndex = 0;\n },\n };\n\n return store;\n}\n","import type AlpineType from \"alpinejs\";\nimport { type CommandStore, type CommandStoreConfig, createCommandStore } from \"./store.js\";\n\nexport {\n type CommandAction,\n type CommandItem,\n type CommandStore,\n type CommandStoreConfig,\n createCommandStore,\n} from \"./store.js\";\n\nexport interface CommandPluginOptions extends CommandStoreConfig {}\n\n/** Builds typed command plugin options. */\nexport function commandOptions<const T extends CommandPluginOptions>(options: T): T {\n return options;\n}\n\n/** Alpine.js command palette plugin. Registers `$store.command`. */\nexport default function commandPlugin(\n options: CommandPluginOptions = {}\n): AlpineType.PluginCallback {\n return function registerCommand(Alpine) {\n const store = createCommandStore(options);\n Alpine.store(\"command\", store);\n Alpine.magic(\"command\", () => Alpine.store(\"command\"));\n };\n}\n\ndeclare global {\n namespace Alpine {\n interface Stores {\n command: CommandStore;\n }\n interface Magics<T> {\n $command: CommandStore;\n }\n }\n}\n"],"mappings":";AAuCA,SAAS,cAAc,MAAmB,QAAyB;AACjE,MAAI,CAAC,OAAO,KAAK,GAAG;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,OAAO,KAAK,EAAE,YAAY;AACxC,QAAM,WAAW,CAAC,KAAK,OAAO,KAAK,SAAS,IAAI,KAAK,YAAY,IAAI,GAAI,KAAK,YAAY,CAAC,CAAE,EAC1F,KAAK,GAAG,EACR,YAAY;AAEf,SAAO,SAAS,SAAS,KAAK;AAChC;AAEA,SAAS,iBAAiB,QAAqC;AAC7D,MAAI,EAAE,kBAAkB,cAAc;AACpC,WAAO;AAAA,EACT;AAEA,QAAM,MAAM,OAAO;AACnB,SAAO,QAAQ,WAAW,QAAQ,cAAc,OAAO;AACzD;AAEA,SAAS,YAAY,OAA+B;AAClD,SACE,MAAM,IAAI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S;AACZ,gBAAM,eAAe;AACrB,gBAAM,SAAS,KAAK,KAAK,WAAW;AACpC,cAAI,QAAQ;AACV,iBAAK,KAAK,IAAI,OAAO,EAAE;AAAA,UACzB;AACA;AAAA,QACF;AAAA,QACA,KAAK;AACH,gBAAM,eAAe;AACrB,eAAK,MAAM;AACX;AAAA,QACF;AACE;AAAA,MACJ;AAAA,IACF;AAAA,IAEA,UAAU;AACR,WAAK,QAAQ,CAAC;AACd,WAAK,UAAU;AACf,WAAK,SAAS;AACd,WAAK,cAAc;AAAA,IACrB;AAAA,EACF;AAEA,SAAO;AACT;;;AC1NO,SAAS,eAAqD,SAAe;AAClF,SAAO;AACT;AAGe,SAAR,cACL,UAAgC,CAAC,GACN;AAC3B,SAAO,SAAS,gBAAgB,QAAQ;AACtC,UAAM,QAAQ,mBAAmB,OAAO;AACxC,WAAO,MAAM,WAAW,KAAK;AAC7B,WAAO,MAAM,WAAW,MAAM,OAAO,MAAM,SAAS,CAAC;AAAA,EACvD;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ailuracode/alpine-command",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Alpine.js headless command palette store",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "ailuracode",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/ailuracode/alpinejs-toolkit.git",
|
|
14
|
+
"directory": "packages/command"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/ailuracode/alpinejs-toolkit/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/ailuracode/alpinejs-toolkit/tree/master/packages/command#readme",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./global": {
|
|
30
|
+
"types": "./dist/global.d.ts"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"types": "./dist/global.d.ts",
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"alpinejs": "^3.0.0",
|
|
36
|
+
"@types/alpinejs": "^3.13.11"
|
|
37
|
+
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"@types/alpinejs": {
|
|
40
|
+
"optional": true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"alpinejs",
|
|
45
|
+
"alpine",
|
|
46
|
+
"plugin",
|
|
47
|
+
"command",
|
|
48
|
+
"palette",
|
|
49
|
+
"spotlight",
|
|
50
|
+
"headless"
|
|
51
|
+
],
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsup src/index.ts --format esm --dts --clean --sourcemap --out-dir dist && cp src/global.d.ts dist/global.d.ts",
|
|
54
|
+
"test": "vitest run --config ../../vitest.config.ts test"
|
|
55
|
+
}
|
|
56
|
+
}
|