@dust-tt/sparkle 0.2.448 → 0.2.449-rc-samuel
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/dist/cjs/index.js +1 -1
- package/dist/esm/components/AppCommandPalette.d.ts +11 -0
- package/dist/esm/components/AppCommandPalette.d.ts.map +1 -0
- package/dist/esm/components/AppCommandPalette.js +44 -0
- package/dist/esm/components/AppCommandPalette.js.map +1 -0
- package/dist/esm/components/CommandPalette.d.ts +3 -0
- package/dist/esm/components/CommandPalette.d.ts.map +1 -0
- package/dist/esm/components/CommandPalette.js +61 -0
- package/dist/esm/components/CommandPalette.js.map +1 -0
- package/dist/esm/components/Input.d.ts +1 -0
- package/dist/esm/components/Input.d.ts.map +1 -1
- package/dist/esm/components/Input.js +2 -2
- package/dist/esm/components/Input.js.map +1 -1
- package/dist/esm/components/Notification.d.ts +2 -2
- package/dist/esm/components/Notification.d.ts.map +1 -1
- package/dist/esm/components/Notification.js +25 -3
- package/dist/esm/components/Notification.js.map +1 -1
- package/dist/esm/components/Resizable.d.ts +1 -1
- package/dist/esm/components/SamsCommandPalette.d.ts +81 -0
- package/dist/esm/components/SamsCommandPalette.d.ts.map +1 -0
- package/dist/esm/components/SamsCommandPalette.js +56 -0
- package/dist/esm/components/SamsCommandPalette.js.map +1 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/components/markdown/List.d.ts.map +1 -1
- package/dist/esm/components/markdown/List.js +3 -7
- package/dist/esm/components/markdown/List.js.map +1 -1
- package/dist/esm/contexts/CommandPaletteContext.d.ts +28 -0
- package/dist/esm/contexts/CommandPaletteContext.d.ts.map +1 -0
- package/dist/esm/contexts/CommandPaletteContext.js +83 -0
- package/dist/esm/contexts/CommandPaletteContext.js.map +1 -0
- package/dist/esm/hooks/useCommandPalette.d.ts +27 -0
- package/dist/esm/hooks/useCommandPalette.d.ts.map +1 -0
- package/dist/esm/hooks/useCommandPalette.js +62 -0
- package/dist/esm/hooks/useCommandPalette.js.map +1 -0
- package/dist/esm/stories/Notification.stories.js +8 -1
- package/dist/esm/stories/Notification.stories.js.map +1 -1
- package/dist/esm/stories/SamsCommandPalette.stories.d.ts +25 -0
- package/dist/esm/stories/SamsCommandPalette.stories.d.ts.map +1 -0
- package/dist/esm/stories/SamsCommandPalette.stories.js +100 -0
- package/dist/esm/stories/SamsCommandPalette.stories.js.map +1 -0
- package/dist/sparkle.css +136 -0
- package/package.json +2 -1
- package/src/components/AppCommandPalette.tsx +58 -0
- package/src/components/CommandPalette.tsx +112 -0
- package/src/components/Input.tsx +8 -1
- package/src/components/Notification.tsx +38 -19
- package/src/components/SamsCommandPalette.tsx +166 -0
- package/src/components/index.ts +1 -0
- package/src/components/markdown/List.tsx +3 -7
- package/src/contexts/CommandPaletteContext.tsx +135 -0
- package/src/hooks/useCommandPalette.tsx +87 -0
- package/src/stories/Notification.stories.tsx +10 -0
- package/src/stories/SamsCommandPalette.stories.tsx +133 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __read, __spreadArray } from "tslib";
|
|
3
|
+
import React, { createContext, useCallback, useContext, useEffect, useState, } from "react";
|
|
4
|
+
var CommandPaletteContext = createContext(undefined);
|
|
5
|
+
export var CommandPaletteProvider = function (_a) {
|
|
6
|
+
var children = _a.children;
|
|
7
|
+
var _b = __read(useState([]), 2), commands = _b[0], setCommands = _b[1];
|
|
8
|
+
var _c = __read(useState(false), 2), isOpen = _c[0], setIsOpen = _c[1];
|
|
9
|
+
// Register a single command
|
|
10
|
+
var registerCommand = useCallback(function (command) {
|
|
11
|
+
setCommands(function (prevCommands) {
|
|
12
|
+
// Check if command with same ID already exists
|
|
13
|
+
var index = prevCommands.findIndex(function (c) { return c.id === command.id; });
|
|
14
|
+
if (index >= 0) {
|
|
15
|
+
// Replace existing command
|
|
16
|
+
var newCommands = __spreadArray([], __read(prevCommands), false);
|
|
17
|
+
newCommands[index] = command;
|
|
18
|
+
return newCommands;
|
|
19
|
+
}
|
|
20
|
+
// Add new command
|
|
21
|
+
return __spreadArray(__spreadArray([], __read(prevCommands), false), [command], false);
|
|
22
|
+
});
|
|
23
|
+
}, []);
|
|
24
|
+
// Register multiple commands at once
|
|
25
|
+
var registerCommands = useCallback(function (newCommands) {
|
|
26
|
+
setCommands(function (prevCommands) {
|
|
27
|
+
var commandMap = new Map(prevCommands.map(function (c) { return [c.id, c]; }));
|
|
28
|
+
// Update or add new commands
|
|
29
|
+
newCommands.forEach(function (command) {
|
|
30
|
+
commandMap.set(command.id, command);
|
|
31
|
+
});
|
|
32
|
+
return Array.from(commandMap.values());
|
|
33
|
+
});
|
|
34
|
+
}, []);
|
|
35
|
+
// Unregister a command by ID
|
|
36
|
+
var unregisterCommand = useCallback(function (commandId) {
|
|
37
|
+
setCommands(function (prevCommands) {
|
|
38
|
+
return prevCommands.filter(function (c) { return c.id !== commandId; });
|
|
39
|
+
});
|
|
40
|
+
}, []);
|
|
41
|
+
// Unregister commands by entity type
|
|
42
|
+
var unregisterCommandsByEntityType = useCallback(function (entityType) {
|
|
43
|
+
setCommands(function (prevCommands) {
|
|
44
|
+
return prevCommands.filter(function (c) { return c.entityType !== entityType; });
|
|
45
|
+
});
|
|
46
|
+
}, []);
|
|
47
|
+
// Unregister commands by entity ID
|
|
48
|
+
var unregisterCommandsByEntityId = useCallback(function (entityId) {
|
|
49
|
+
setCommands(function (prevCommands) {
|
|
50
|
+
return prevCommands.filter(function (c) { return c.entityId !== entityId; });
|
|
51
|
+
});
|
|
52
|
+
}, []);
|
|
53
|
+
// Handle keyboard shortcut
|
|
54
|
+
useEffect(function () {
|
|
55
|
+
var handleKeyDown = function (event) {
|
|
56
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "k") {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
setIsOpen(function (prev) { return !prev; });
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
62
|
+
return function () { return window.removeEventListener("keydown", handleKeyDown); };
|
|
63
|
+
}, []);
|
|
64
|
+
var contextValue = {
|
|
65
|
+
commands: commands,
|
|
66
|
+
isOpen: isOpen,
|
|
67
|
+
registerCommand: registerCommand,
|
|
68
|
+
registerCommands: registerCommands,
|
|
69
|
+
unregisterCommand: unregisterCommand,
|
|
70
|
+
unregisterCommandsByEntityType: unregisterCommandsByEntityType,
|
|
71
|
+
unregisterCommandsByEntityId: unregisterCommandsByEntityId,
|
|
72
|
+
setOpen: setIsOpen,
|
|
73
|
+
};
|
|
74
|
+
return (React.createElement(CommandPaletteContext.Provider, { value: contextValue }, children));
|
|
75
|
+
};
|
|
76
|
+
export var useCommandPaletteContext = function () {
|
|
77
|
+
var context = useContext(CommandPaletteContext);
|
|
78
|
+
if (context === undefined) {
|
|
79
|
+
throw new Error("useCommandPaletteContext must be used within a CommandPaletteProvider");
|
|
80
|
+
}
|
|
81
|
+
return context;
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=CommandPaletteContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPaletteContext.js","sourceRoot":"","sources":["../../../src/contexts/CommandPaletteContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAC;AA0Bf,IAAM,qBAAqB,GAAG,aAAa,CAEzC,SAAS,CAAC,CAAC;AAEb,MAAM,CAAC,IAAM,sBAAsB,GAE9B,UAAC,EAAY;QAAV,QAAQ,cAAA;IACR,IAAA,KAAA,OAA0B,QAAQ,CAAY,EAAE,CAAC,IAAA,EAAhD,QAAQ,QAAA,EAAE,WAAW,QAA2B,CAAC;IAClD,IAAA,KAAA,OAAsB,QAAQ,CAAC,KAAK,CAA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C,EAAE,EAAE,CAAC,CAAC;IAEP,IAAM,YAAY,GAA8B;QAC9C,QAAQ,UAAA;QACR,MAAM,QAAA;QACN,eAAe,iBAAA;QACf,gBAAgB,kBAAA;QAChB,iBAAiB,mBAAA;QACjB,8BAA8B,gCAAA;QAC9B,4BAA4B,8BAAA;QAC5B,OAAO,EAAE,SAAS;KACnB,CAAC;IAEF,OAAO,CACL,oBAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,IAChD,QAAQ,CACsB,CAClC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,wBAAwB,GAAG;IACtC,IAAM,OAAO,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Command } from "../contexts/CommandPaletteContext";
|
|
2
|
+
interface UseCommandPaletteProps {
|
|
3
|
+
commands?: Command[];
|
|
4
|
+
entityType?: string;
|
|
5
|
+
entityId?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Hook for interacting with the command palette
|
|
9
|
+
*
|
|
10
|
+
* Optionally register commands when the component mounts and
|
|
11
|
+
* automatically unregister them when the component unmounts.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useCommandPalette: (props?: UseCommandPaletteProps) => {
|
|
14
|
+
commands: Command[];
|
|
15
|
+
isOpen: boolean;
|
|
16
|
+
registerCommand: (command: Command) => void;
|
|
17
|
+
registerCommands: (commands: Command[]) => void;
|
|
18
|
+
unregisterCommand: (commandId: string) => void;
|
|
19
|
+
unregisterCommandsByEntityType: (entityType: string) => void;
|
|
20
|
+
unregisterCommandsByEntityId: (entityId: string) => void;
|
|
21
|
+
openCommandPalette: () => void;
|
|
22
|
+
closeCommandPalette: () => void;
|
|
23
|
+
toggleCommandPalette: () => void;
|
|
24
|
+
setOpen: (isOpen: boolean) => void;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=useCommandPalette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCommandPalette.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCommandPalette.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,OAAO,EAER,MAAM,mCAAmC,CAAC;AAE3C,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAY,sBAAsB;;;;;;;;;;;;CAiE/D,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { useCommandPaletteContext, } from "../contexts/CommandPaletteContext";
|
|
4
|
+
/**
|
|
5
|
+
* Hook for interacting with the command palette
|
|
6
|
+
*
|
|
7
|
+
* Optionally register commands when the component mounts and
|
|
8
|
+
* automatically unregister them when the component unmounts.
|
|
9
|
+
*/
|
|
10
|
+
export var useCommandPalette = function (props) {
|
|
11
|
+
var _a = useCommandPaletteContext(), allCommands = _a.commands, isOpen = _a.isOpen, registerCommand = _a.registerCommand, registerCommands = _a.registerCommands, unregisterCommand = _a.unregisterCommand, unregisterCommandsByEntityType = _a.unregisterCommandsByEntityType, unregisterCommandsByEntityId = _a.unregisterCommandsByEntityId, setOpen = _a.setOpen;
|
|
12
|
+
// Register commands on mount, unregister on unmount
|
|
13
|
+
useEffect(function () {
|
|
14
|
+
var _a;
|
|
15
|
+
if ((_a = props === null || props === void 0 ? void 0 : props.commands) === null || _a === void 0 ? void 0 : _a.length) {
|
|
16
|
+
registerCommands(props.commands);
|
|
17
|
+
}
|
|
18
|
+
return function () {
|
|
19
|
+
// Clean up commands when component unmounts
|
|
20
|
+
if (props === null || props === void 0 ? void 0 : props.entityType) {
|
|
21
|
+
unregisterCommandsByEntityType(props.entityType);
|
|
22
|
+
}
|
|
23
|
+
if (props === null || props === void 0 ? void 0 : props.entityId) {
|
|
24
|
+
unregisterCommandsByEntityId(props.entityId);
|
|
25
|
+
}
|
|
26
|
+
if (props === null || props === void 0 ? void 0 : props.commands) {
|
|
27
|
+
props.commands.forEach(function (command) {
|
|
28
|
+
unregisterCommand(command.id);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}, [
|
|
33
|
+
props === null || props === void 0 ? void 0 : props.commands,
|
|
34
|
+
props === null || props === void 0 ? void 0 : props.entityType,
|
|
35
|
+
props === null || props === void 0 ? void 0 : props.entityId,
|
|
36
|
+
registerCommands,
|
|
37
|
+
unregisterCommand,
|
|
38
|
+
unregisterCommandsByEntityType,
|
|
39
|
+
unregisterCommandsByEntityId,
|
|
40
|
+
]);
|
|
41
|
+
// Utility functions
|
|
42
|
+
var openCommandPalette = function () { return setOpen(true); };
|
|
43
|
+
var closeCommandPalette = function () { return setOpen(false); };
|
|
44
|
+
var toggleCommandPalette = function () { return setOpen(!isOpen); };
|
|
45
|
+
return {
|
|
46
|
+
// State
|
|
47
|
+
commands: allCommands,
|
|
48
|
+
isOpen: isOpen,
|
|
49
|
+
// Register/unregister methods
|
|
50
|
+
registerCommand: registerCommand,
|
|
51
|
+
registerCommands: registerCommands,
|
|
52
|
+
unregisterCommand: unregisterCommand,
|
|
53
|
+
unregisterCommandsByEntityType: unregisterCommandsByEntityType,
|
|
54
|
+
unregisterCommandsByEntityId: unregisterCommandsByEntityId,
|
|
55
|
+
// Open/close controls
|
|
56
|
+
openCommandPalette: openCommandPalette,
|
|
57
|
+
closeCommandPalette: closeCommandPalette,
|
|
58
|
+
toggleCommandPalette: toggleCommandPalette,
|
|
59
|
+
setOpen: setOpen,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=useCommandPalette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCommandPalette.js","sourceRoot":"","sources":["../../../src/hooks/useCommandPalette.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAEL,wBAAwB,GACzB,MAAM,mCAAmC,CAAC;AAQ3C;;;;;GAKG;AACH,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAAC,KAA8B;IACxD,IAAA,KASF,wBAAwB,EAAE,EARlB,WAAW,cAAA,EACrB,MAAM,YAAA,EACN,eAAe,qBAAA,EACf,gBAAgB,sBAAA,EAChB,iBAAiB,uBAAA,EACjB,8BAA8B,oCAAA,EAC9B,4BAA4B,kCAAA,EAC5B,OAAO,aACqB,CAAC;IAE/B,oDAAoD;IACpD,SAAS,CAAC;;QACR,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,0CAAE,MAAM,EAAE,CAAC;YAC5B,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACnC,CAAC;QAED,OAAO;YACL,4CAA4C;YAC5C,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,EAAE,CAAC;gBACtB,8BAA8B,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACnD,CAAC;YACD,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,EAAE,CAAC;gBACpB,4BAA4B,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC/C,CAAC;YACD,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,EAAE,CAAC;gBACpB,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAC,OAAO;oBAC7B,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;gBAChC,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE;QACD,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ;QACf,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU;QACjB,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ;QACf,gBAAgB;QAChB,iBAAiB;QACjB,8BAA8B;QAC9B,4BAA4B;KAC7B,CAAC,CAAC;IAEH,oBAAoB;IACpB,IAAM,kBAAkB,GAAG,cAAM,OAAA,OAAO,CAAC,IAAI,CAAC,EAAb,CAAa,CAAC;IAC/C,IAAM,mBAAmB,GAAG,cAAM,OAAA,OAAO,CAAC,KAAK,CAAC,EAAd,CAAc,CAAC;IACjD,IAAM,oBAAoB,GAAG,cAAM,OAAA,OAAO,CAAC,CAAC,MAAM,CAAC,EAAhB,CAAgB,CAAC;IAEpD,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,WAAW;QACrB,MAAM,QAAA;QAEN,8BAA8B;QAC9B,eAAe,iBAAA;QACf,gBAAgB,kBAAA;QAChB,iBAAiB,mBAAA;QACjB,8BAA8B,gCAAA;QAC9B,4BAA4B,8BAAA;QAE5B,sBAAsB;QACtB,kBAAkB,oBAAA;QAClB,mBAAmB,qBAAA;QACnB,oBAAoB,sBAAA;QACpB,OAAO,SAAA;KACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -25,6 +25,13 @@ var NotificationExample = function () {
|
|
|
25
25
|
description: "Something went wrong",
|
|
26
26
|
type: "error",
|
|
27
27
|
});
|
|
28
|
-
}, label: "Show Error" })
|
|
28
|
+
}, label: "Show Error" }),
|
|
29
|
+
React.createElement(Button, { onClick: function () {
|
|
30
|
+
return sendNotification({
|
|
31
|
+
title: "Info",
|
|
32
|
+
description: "Some information",
|
|
33
|
+
type: "info",
|
|
34
|
+
});
|
|
35
|
+
}, label: "Show Info" })));
|
|
29
36
|
};
|
|
30
37
|
//# sourceMappingURL=Notification.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.stories.js","sourceRoot":"","sources":["../../../src/stories/Notification.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE7D,IAAM,IAAI,GAA8B;IACtC,KAAK,EAAE,sBAAsB;CACM,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,MAAM,CAAC,IAAM,OAAO,GAAG;IACrB,OAAO,CACL,oBAAC,YAAY,CAAC,IAAI;QAChB,oBAAC,mBAAmB,OAAG,CACL,CACrB,CAAC;AACJ,CAAC,CAAC;AAEF,IAAM,mBAAmB,GAAG;IAC1B,IAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAE/C,OAAO,CACL,6BAAK,SAAS,EAAC,2BAA2B;QACxC,oBAAC,MAAM,IACL,OAAO,EAAE;gBACP,OAAA,gBAAgB,CAAC;oBACf,KAAK,EAAE,SAAS;oBAChB,WAAW,EAAE,kCAAkC;oBAC/C,IAAI,EAAE,SAAS;iBAChB,CAAC;YAJF,CAIE,EAEJ,KAAK,EAAC,cAAc,GACpB;QACF,oBAAC,MAAM,IACL,OAAO,EAAE;gBACP,OAAA,gBAAgB,CAAC;oBACf,KAAK,EAAE,OAAO;oBACd,WAAW,EAAE,sBAAsB;oBACnC,IAAI,EAAE,OAAO;iBACd,CAAC;YAJF,CAIE,EAEJ,KAAK,EAAC,YAAY,GAClB,CACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"Notification.stories.js","sourceRoot":"","sources":["../../../src/stories/Notification.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE7D,IAAM,IAAI,GAA8B;IACtC,KAAK,EAAE,sBAAsB;CACM,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,MAAM,CAAC,IAAM,OAAO,GAAG;IACrB,OAAO,CACL,oBAAC,YAAY,CAAC,IAAI;QAChB,oBAAC,mBAAmB,OAAG,CACL,CACrB,CAAC;AACJ,CAAC,CAAC;AAEF,IAAM,mBAAmB,GAAG;IAC1B,IAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAE/C,OAAO,CACL,6BAAK,SAAS,EAAC,2BAA2B;QACxC,oBAAC,MAAM,IACL,OAAO,EAAE;gBACP,OAAA,gBAAgB,CAAC;oBACf,KAAK,EAAE,SAAS;oBAChB,WAAW,EAAE,kCAAkC;oBAC/C,IAAI,EAAE,SAAS;iBAChB,CAAC;YAJF,CAIE,EAEJ,KAAK,EAAC,cAAc,GACpB;QACF,oBAAC,MAAM,IACL,OAAO,EAAE;gBACP,OAAA,gBAAgB,CAAC;oBACf,KAAK,EAAE,OAAO;oBACd,WAAW,EAAE,sBAAsB;oBACnC,IAAI,EAAE,OAAO;iBACd,CAAC;YAJF,CAIE,EAEJ,KAAK,EAAC,YAAY,GAClB;QACF,oBAAC,MAAM,IACL,OAAO,EAAE;gBACP,OAAA,gBAAgB,CAAC;oBACf,KAAK,EAAE,MAAM;oBACb,WAAW,EAAE,kBAAkB;oBAC/B,IAAI,EAAE,MAAM;iBACb,CAAC;YAJF,CAIE,EAEJ,KAAK,EAAC,WAAW,GACjB,CACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.ForwardRefExoticComponent<Omit<{
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
7
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
8
|
+
} & {
|
|
9
|
+
asChild?: boolean | undefined;
|
|
10
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
11
|
+
label?: string | undefined;
|
|
12
|
+
shouldFilter?: boolean | undefined;
|
|
13
|
+
filter?: ((value: string, search: string, keywords?: string[] | undefined) => number) | undefined;
|
|
14
|
+
defaultValue?: string | undefined;
|
|
15
|
+
value?: string | undefined;
|
|
16
|
+
onValueChange?: ((value: string) => void) | undefined;
|
|
17
|
+
loop?: boolean | undefined;
|
|
18
|
+
disablePointerSelection?: boolean | undefined;
|
|
19
|
+
vimBindings?: boolean | undefined;
|
|
20
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
};
|
|
22
|
+
export default meta;
|
|
23
|
+
export declare function SimpleExample(): React.JSX.Element;
|
|
24
|
+
export declare function EntitySpecificCommands(): React.JSX.Element;
|
|
25
|
+
//# sourceMappingURL=SamsCommandPalette.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SamsCommandPalette.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/SamsCommandPalette.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAgBxC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;CAG0B,CAAC;AAErC,eAAe,IAAI,CAAC;AAEpB,wBAAgB,aAAa,sBAS5B;AAGD,wBAAgB,sBAAsB,sBAMrC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { CodeBlock, Icon, Label, RadioGroup, RadioGroupItem, } from "../components";
|
|
4
|
+
import { SamsCommand } from "../components/SamsCommandPalette";
|
|
5
|
+
import { useCommandPalette } from "../hooks/useCommandPalette";
|
|
6
|
+
import { FolderIcon } from "../icons";
|
|
7
|
+
import { AppCommandPalette } from "../components/AppCommandPalette";
|
|
8
|
+
var meta = {
|
|
9
|
+
title: "Primitives/Sam's CommandPalette",
|
|
10
|
+
component: SamsCommand,
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export function SimpleExample() {
|
|
14
|
+
return (React.createElement(AppCommandPalette, null,
|
|
15
|
+
React.createElement(Label, null,
|
|
16
|
+
"Press ",
|
|
17
|
+
React.createElement(CodeBlock, { inline: true }, "\u2318 K"),
|
|
18
|
+
" to open the command palette"),
|
|
19
|
+
React.createElement(SamsCommand, null)));
|
|
20
|
+
}
|
|
21
|
+
// Example with entity-specific commands
|
|
22
|
+
export function EntitySpecificCommands() {
|
|
23
|
+
return (React.createElement(AppCommandPalette, null,
|
|
24
|
+
React.createElement(EntitySelector, null)));
|
|
25
|
+
}
|
|
26
|
+
// Predefined entity commands - moved outside component to avoid recreation
|
|
27
|
+
var entity1Commands = [
|
|
28
|
+
{
|
|
29
|
+
id: "entity1.actionA",
|
|
30
|
+
label: "Action A",
|
|
31
|
+
category: "Entity 1",
|
|
32
|
+
entityType: "entity1",
|
|
33
|
+
action: function () {
|
|
34
|
+
window.alert("Executing Action A for Entity 1");
|
|
35
|
+
},
|
|
36
|
+
priority: 0,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "entity1.actionB",
|
|
40
|
+
label: "Action B",
|
|
41
|
+
category: "Entity 1",
|
|
42
|
+
entityType: "entity1",
|
|
43
|
+
action: function () {
|
|
44
|
+
window.alert("Executing Action B for Entity 1");
|
|
45
|
+
},
|
|
46
|
+
priority: 1,
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
var entity2Commands = [
|
|
50
|
+
{
|
|
51
|
+
id: "entity2.actionC.warning",
|
|
52
|
+
label: "Action C",
|
|
53
|
+
category: "Entity 2",
|
|
54
|
+
entityType: "entity2",
|
|
55
|
+
action: function () {
|
|
56
|
+
window.alert("Executing Action C for Entity 2");
|
|
57
|
+
},
|
|
58
|
+
priority: 0,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "entity2.actionD",
|
|
62
|
+
label: "Action D",
|
|
63
|
+
icon: React.createElement(Icon, { visual: FolderIcon }),
|
|
64
|
+
category: "Entity 2",
|
|
65
|
+
entityType: "entity2",
|
|
66
|
+
action: function () {
|
|
67
|
+
window.alert("Executing Action D for Entity 2");
|
|
68
|
+
},
|
|
69
|
+
priority: 1,
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
// Component to demonstrate entity selection and entity-specific commands
|
|
73
|
+
function EntitySelector() {
|
|
74
|
+
var _a = useCommandPalette(), registerCommands = _a.registerCommands, unregisterCommandsByEntityType = _a.unregisterCommandsByEntityType;
|
|
75
|
+
var _b = __read(useState(), 2), currentEntity = _b[0], setCurrentEntity = _b[1];
|
|
76
|
+
// Default to entity 1 commands
|
|
77
|
+
function handleEntityChange(newEntity) {
|
|
78
|
+
setCurrentEntity(function (previous) {
|
|
79
|
+
if (previous) {
|
|
80
|
+
unregisterCommandsByEntityType(previous);
|
|
81
|
+
}
|
|
82
|
+
registerCommands(newEntity === "entity1" ? entity1Commands : entity2Commands);
|
|
83
|
+
return newEntity;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return (React.createElement("div", { className: "s-flex s-flex-col s-gap-4" },
|
|
87
|
+
React.createElement("div", { className: "s-flex s-flex-col s-gap-2" },
|
|
88
|
+
React.createElement(Label, null, "Current Entity"),
|
|
89
|
+
React.createElement("div", { className: "s-flex s-gap-4" },
|
|
90
|
+
React.createElement(RadioGroup, { value: currentEntity, onValueChange: handleEntityChange },
|
|
91
|
+
React.createElement(RadioGroupItem, { value: "entity1", label: "Entity 1" }),
|
|
92
|
+
React.createElement(RadioGroupItem, { value: "entity2", label: "Entity 2" })))),
|
|
93
|
+
React.createElement("div", { className: "s-flex s-flex-col s-gap-2" },
|
|
94
|
+
React.createElement(Label, null, "Command Palette"),
|
|
95
|
+
React.createElement("p", { className: "s-text-sm s-text-muted-foreground" },
|
|
96
|
+
"Press ",
|
|
97
|
+
React.createElement(CodeBlock, { inline: true }, "\u2318 K"),
|
|
98
|
+
" to open the command palette. The commands change based on the selected entity."))));
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=SamsCommandPalette.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SamsCommandPalette.stories.js","sourceRoot":"","sources":["../../../src/stories/SamsCommandPalette.stories.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EACL,SAAS,EACT,IAAI,EACJ,KAAK,EACL,UAAU,EACV,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,IAAM,IAAI,GAAG;IACX,KAAK,EAAE,iCAAiC;IACxC,SAAS,EAAE,WAAW;CACY,CAAC;AAErC,eAAe,IAAI,CAAC;AAEpB,MAAM,UAAU,aAAa;IAC3B,OAAO,CACL,oBAAC,iBAAiB;QAChB,oBAAC,KAAK;;YACE,oBAAC,SAAS,IAAC,MAAM,qBAAgB;2CACjC;QACR,oBAAC,WAAW,OAAG,CACG,CACrB,CAAC;AACJ,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,sBAAsB;IACpC,OAAO,CACL,oBAAC,iBAAiB;QAChB,oBAAC,cAAc,OAAG,CACA,CACrB,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,IAAM,eAAe,GAAc;IACjC;QACE,EAAE,EAAE,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,IAAI,QAAQ,EAAE,CAAC;gBACb,8BAA8B,CAAC,QAAQ,CAAC,CAAC;YAC3C,CAAC;YACD,gBAAgB,CACd,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAC5D,CAAC;YACF,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CACL,6BAAK,SAAS,EAAC,2BAA2B;QACxC,6BAAK,SAAS,EAAC,2BAA2B;YACxC,oBAAC,KAAK,yBAAuB;YAC7B,6BAAK,SAAS,EAAC,gBAAgB;gBAC7B,oBAAC,UAAU,IAAC,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB;oBACjE,oBAAC,cAAc,IAAC,KAAK,EAAC,SAAS,EAAC,KAAK,EAAC,UAAU,GAAG;oBACnD,oBAAC,cAAc,IAAC,KAAK,EAAC,SAAS,EAAC,KAAK,EAAC,UAAU,GAAG,CACxC,CACT,CACF;QAEN,6BAAK,SAAS,EAAC,2BAA2B;YACxC,oBAAC,KAAK,0BAAwB;YAC9B,2BAAG,SAAS,EAAC,mCAAmC;;gBACxC,oBAAC,SAAS,IAAC,MAAM,qBAAgB;kGAErC,CACA,CACF,CACP,CAAC;AACJ,CAAC"}
|
package/dist/sparkle.css
CHANGED
|
@@ -1442,6 +1442,10 @@ select {
|
|
|
1442
1442
|
max-height: 18rem;
|
|
1443
1443
|
}
|
|
1444
1444
|
|
|
1445
|
+
.s-max-h-\[300px\] {
|
|
1446
|
+
max-height: 300px;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1445
1449
|
.s-max-h-\[500px\] {
|
|
1446
1450
|
max-height: 500px;
|
|
1447
1451
|
}
|
|
@@ -2284,6 +2288,11 @@ select {
|
|
|
2284
2288
|
border-radius: 0.75rem;
|
|
2285
2289
|
}
|
|
2286
2290
|
|
|
2291
|
+
.s-rounded-b-xl {
|
|
2292
|
+
border-bottom-right-radius: 0.75rem;
|
|
2293
|
+
border-bottom-left-radius: 0.75rem;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2287
2296
|
.s-rounded-l-none {
|
|
2288
2297
|
border-top-left-radius: 0px;
|
|
2289
2298
|
border-bottom-left-radius: 0px;
|
|
@@ -4362,6 +4371,10 @@ select {
|
|
|
4362
4371
|
object-position: center;
|
|
4363
4372
|
}
|
|
4364
4373
|
|
|
4374
|
+
.s-p-0 {
|
|
4375
|
+
padding: 0px;
|
|
4376
|
+
}
|
|
4377
|
+
|
|
4365
4378
|
.s-p-1 {
|
|
4366
4379
|
padding: 0.25rem;
|
|
4367
4380
|
}
|
|
@@ -4509,6 +4522,11 @@ select {
|
|
|
4509
4522
|
padding-bottom: 1rem;
|
|
4510
4523
|
}
|
|
4511
4524
|
|
|
4525
|
+
.s-py-6 {
|
|
4526
|
+
padding-top: 1.5rem;
|
|
4527
|
+
padding-bottom: 1.5rem;
|
|
4528
|
+
}
|
|
4529
|
+
|
|
4512
4530
|
.s-py-8 {
|
|
4513
4531
|
padding-top: 2rem;
|
|
4514
4532
|
padding-bottom: 2rem;
|
|
@@ -5055,6 +5073,11 @@ select {
|
|
|
5055
5073
|
color: rgb(255 170 13 / var(--tw-text-opacity));
|
|
5056
5074
|
}
|
|
5057
5075
|
|
|
5076
|
+
.s-text-info-600 {
|
|
5077
|
+
--tw-text-opacity: 1;
|
|
5078
|
+
color: rgb(254 156 26 / var(--tw-text-opacity));
|
|
5079
|
+
}
|
|
5080
|
+
|
|
5058
5081
|
.s-text-info-800 {
|
|
5059
5082
|
--tw-text-opacity: 1;
|
|
5060
5083
|
color: rgb(175 85 17 / var(--tw-text-opacity));
|
|
@@ -6311,6 +6334,10 @@ select {
|
|
|
6311
6334
|
opacity: 0.7;
|
|
6312
6335
|
}
|
|
6313
6336
|
|
|
6337
|
+
.data-\[disabled\=true\]\:s-pointer-events-none[data-disabled=true] {
|
|
6338
|
+
pointer-events: none;
|
|
6339
|
+
}
|
|
6340
|
+
|
|
6314
6341
|
.data-\[disabled\]\:s-pointer-events-none[data-disabled] {
|
|
6315
6342
|
pointer-events: none;
|
|
6316
6343
|
}
|
|
@@ -6374,6 +6401,16 @@ select {
|
|
|
6374
6401
|
border-color: rgb(42 50 65 / var(--tw-border-opacity));
|
|
6375
6402
|
}
|
|
6376
6403
|
|
|
6404
|
+
.data-\[selected\=true\]\:s-bg-muted-background[data-selected=true] {
|
|
6405
|
+
--tw-bg-opacity: 1;
|
|
6406
|
+
background-color: rgb(247 247 247 / var(--tw-bg-opacity));
|
|
6407
|
+
}
|
|
6408
|
+
|
|
6409
|
+
.data-\[selected\=true\]\:s-bg-warning-50[data-selected=true] {
|
|
6410
|
+
--tw-bg-opacity: 1;
|
|
6411
|
+
background-color: rgb(255 241 247 / var(--tw-bg-opacity));
|
|
6412
|
+
}
|
|
6413
|
+
|
|
6377
6414
|
.data-\[state\=checked\]\:s-bg-primary[data-state=checked] {
|
|
6378
6415
|
--tw-bg-opacity: 1;
|
|
6379
6416
|
background-color: rgb(42 50 65 / var(--tw-bg-opacity));
|
|
@@ -6394,6 +6431,16 @@ select {
|
|
|
6394
6431
|
color: rgb(150 156 165 / var(--tw-text-opacity));
|
|
6395
6432
|
}
|
|
6396
6433
|
|
|
6434
|
+
.data-\[selected\=true\]\:s-text-foreground[data-selected=true] {
|
|
6435
|
+
--tw-text-opacity: 1;
|
|
6436
|
+
color: rgb(17 20 24 / var(--tw-text-opacity));
|
|
6437
|
+
}
|
|
6438
|
+
|
|
6439
|
+
.data-\[selected\=true\]\:s-text-warning-500[data-selected=true] {
|
|
6440
|
+
--tw-text-opacity: 1;
|
|
6441
|
+
color: rgb(225 67 34 / var(--tw-text-opacity));
|
|
6442
|
+
}
|
|
6443
|
+
|
|
6397
6444
|
.data-\[state\=checked\]\:s-text-white[data-state=checked] {
|
|
6398
6445
|
--tw-text-opacity: 1;
|
|
6399
6446
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
@@ -6404,6 +6451,10 @@ select {
|
|
|
6404
6451
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
6405
6452
|
}
|
|
6406
6453
|
|
|
6454
|
+
.data-\[disabled\=true\]\:s-opacity-50[data-disabled=true] {
|
|
6455
|
+
opacity: 0.5;
|
|
6456
|
+
}
|
|
6457
|
+
|
|
6407
6458
|
.data-\[state\=closed\]\:s-duration-300[data-state=closed] {
|
|
6408
6459
|
transition-duration: 300ms;
|
|
6409
6460
|
}
|
|
@@ -8836,6 +8887,11 @@ select {
|
|
|
8836
8887
|
color: rgb(238 242 255 / var(--tw-text-opacity));
|
|
8837
8888
|
}
|
|
8838
8889
|
|
|
8890
|
+
:is(.s-dark .dark\:s-text-info-400-night) {
|
|
8891
|
+
--tw-text-opacity: 1;
|
|
8892
|
+
color: rgb(254 156 26 / var(--tw-text-opacity));
|
|
8893
|
+
}
|
|
8894
|
+
|
|
8839
8895
|
:is(.s-dark .dark\:s-text-info-500-night) {
|
|
8840
8896
|
--tw-text-opacity: 1;
|
|
8841
8897
|
color: rgb(255 170 13 / var(--tw-text-opacity));
|
|
@@ -9561,3 +9617,83 @@ select {
|
|
|
9561
9617
|
--tw-rotate: 90deg;
|
|
9562
9618
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
9563
9619
|
}
|
|
9620
|
+
|
|
9621
|
+
.\[\&_\[cmdk-group-heading\]\]\:s-p-2 [cmdk-group-heading] {
|
|
9622
|
+
padding: 0.5rem;
|
|
9623
|
+
}
|
|
9624
|
+
|
|
9625
|
+
.\[\&_\[cmdk-group-heading\]\]\:s-px-2 [cmdk-group-heading] {
|
|
9626
|
+
padding-left: 0.5rem;
|
|
9627
|
+
padding-right: 0.5rem;
|
|
9628
|
+
}
|
|
9629
|
+
|
|
9630
|
+
.\[\&_\[cmdk-group-heading\]\]\:s-py-1\.5 [cmdk-group-heading] {
|
|
9631
|
+
padding-top: 0.375rem;
|
|
9632
|
+
padding-bottom: 0.375rem;
|
|
9633
|
+
}
|
|
9634
|
+
|
|
9635
|
+
.\[\&_\[cmdk-group-heading\]\]\:s-text-xs [cmdk-group-heading] {
|
|
9636
|
+
font-size: 12px;
|
|
9637
|
+
line-height: 16px;
|
|
9638
|
+
letter-spacing: normal;
|
|
9639
|
+
}
|
|
9640
|
+
|
|
9641
|
+
.\[\&_\[cmdk-group-heading\]\]\:s-font-medium [cmdk-group-heading] {
|
|
9642
|
+
font-weight: 500;
|
|
9643
|
+
}
|
|
9644
|
+
|
|
9645
|
+
.\[\&_\[cmdk-group-heading\]\]\:s-text-muted-foreground [cmdk-group-heading] {
|
|
9646
|
+
--tw-text-opacity: 1;
|
|
9647
|
+
color: rgb(84 93 108 / var(--tw-text-opacity));
|
|
9648
|
+
}
|
|
9649
|
+
|
|
9650
|
+
.\[\&_\[cmdk-group-items\]\]\:s-pb-1 [cmdk-group-items] {
|
|
9651
|
+
padding-bottom: 0.25rem;
|
|
9652
|
+
}
|
|
9653
|
+
|
|
9654
|
+
.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:s-pt-0 [cmdk-group]:not([hidden]) ~[cmdk-group] {
|
|
9655
|
+
padding-top: 0px;
|
|
9656
|
+
}
|
|
9657
|
+
|
|
9658
|
+
.\[\&_\[cmdk-group\]\]\:s-px-2 [cmdk-group] {
|
|
9659
|
+
padding-left: 0.5rem;
|
|
9660
|
+
padding-right: 0.5rem;
|
|
9661
|
+
}
|
|
9662
|
+
|
|
9663
|
+
.\[\&_\[cmdk-input-wrapper\]_svg\]\:s-h-5 [cmdk-input-wrapper] svg {
|
|
9664
|
+
height: 1.25rem;
|
|
9665
|
+
}
|
|
9666
|
+
|
|
9667
|
+
.\[\&_\[cmdk-input-wrapper\]_svg\]\:s-w-5 [cmdk-input-wrapper] svg {
|
|
9668
|
+
width: 1.25rem;
|
|
9669
|
+
}
|
|
9670
|
+
|
|
9671
|
+
.\[\&_\[cmdk-input\]\]\:s-h-12 [cmdk-input] {
|
|
9672
|
+
height: 3rem;
|
|
9673
|
+
}
|
|
9674
|
+
|
|
9675
|
+
.\[\&_\[cmdk-item\]\]\:s-px-2 [cmdk-item] {
|
|
9676
|
+
padding-left: 0.5rem;
|
|
9677
|
+
padding-right: 0.5rem;
|
|
9678
|
+
}
|
|
9679
|
+
|
|
9680
|
+
.\[\&_\[cmdk-item\]\]\:s-py-3 [cmdk-item] {
|
|
9681
|
+
padding-top: 0.75rem;
|
|
9682
|
+
padding-bottom: 0.75rem;
|
|
9683
|
+
}
|
|
9684
|
+
|
|
9685
|
+
.\[\&_\[cmdk-item\]_svg\]\:s-h-5 [cmdk-item] svg {
|
|
9686
|
+
height: 1.25rem;
|
|
9687
|
+
}
|
|
9688
|
+
|
|
9689
|
+
.\[\&_\[cmdk-item\]_svg\]\:s-w-5 [cmdk-item] svg {
|
|
9690
|
+
width: 1.25rem;
|
|
9691
|
+
}
|
|
9692
|
+
|
|
9693
|
+
.\[\&_svg\]\:s-pointer-events-none svg {
|
|
9694
|
+
pointer-events: none;
|
|
9695
|
+
}
|
|
9696
|
+
|
|
9697
|
+
.\[\&_svg\]\:s-shrink-0 svg {
|
|
9698
|
+
flex-shrink: 0;
|
|
9699
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dust-tt/sparkle",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.449-rc-samuel",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "rm -rf dist && npm run tailwind && npm run build:esm && npm run build:cjs",
|
|
6
6
|
"tailwind": "tailwindcss -i ./src/styles/tailwind.css -o dist/sparkle.css",
|
|
@@ -117,6 +117,7 @@
|
|
|
117
117
|
"@tanstack/react-table": "^8.13.0",
|
|
118
118
|
"class-variance-authority": "^0.7.1",
|
|
119
119
|
"clsx": "^2.1.1",
|
|
120
|
+
"cmdk": "^1.1.1",
|
|
120
121
|
"emoji-mart": "^5.5.2",
|
|
121
122
|
"lottie-react": "^2.4.0",
|
|
122
123
|
"lottie-web": "^5.12.2",
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from "react";
|
|
4
|
+
|
|
5
|
+
import { CommandPaletteProvider } from "../contexts/CommandPaletteContext";
|
|
6
|
+
import { useCommandPalette } from "../hooks/useCommandPalette";
|
|
7
|
+
import { CommandPalette } from "./CommandPalette";
|
|
8
|
+
|
|
9
|
+
interface AppCommandPaletteProps {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function GlobalCommands() {
|
|
14
|
+
const globalCommands = useMemo(
|
|
15
|
+
() => [
|
|
16
|
+
{
|
|
17
|
+
id: "global.help",
|
|
18
|
+
label: "Help",
|
|
19
|
+
shortcut: "?",
|
|
20
|
+
category: "System",
|
|
21
|
+
action: () => {
|
|
22
|
+
window.alert("Help requested");
|
|
23
|
+
},
|
|
24
|
+
priority: 0,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "global.settings",
|
|
28
|
+
label: "Settings",
|
|
29
|
+
category: "System",
|
|
30
|
+
action: () => {
|
|
31
|
+
window.alert("Navigate to settings");
|
|
32
|
+
},
|
|
33
|
+
priority: 0,
|
|
34
|
+
},
|
|
35
|
+
// Add more global commands here
|
|
36
|
+
],
|
|
37
|
+
[]
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// Register global commands
|
|
41
|
+
useCommandPalette({ commands: globalCommands });
|
|
42
|
+
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* AppCommandPalette - Provides the command palette context to the entire app
|
|
48
|
+
* and initializes it with global commands
|
|
49
|
+
*/
|
|
50
|
+
export function AppCommandPalette({ children }: AppCommandPaletteProps) {
|
|
51
|
+
return (
|
|
52
|
+
<CommandPaletteProvider>
|
|
53
|
+
<GlobalCommands />
|
|
54
|
+
<CommandPalette />
|
|
55
|
+
{children}
|
|
56
|
+
</CommandPaletteProvider>
|
|
57
|
+
);
|
|
58
|
+
}
|