@puckeditor/plugin-ai 0.9.0-canary.9c664bf4 → 0.9.0-canary.bccb8f95
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/index.js +48 -1
- package/dist/index.mjs +48 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1814,6 +1814,42 @@ var matchesAccept = (file, accept) => {
|
|
|
1814
1814
|
return file.type === entry;
|
|
1815
1815
|
});
|
|
1816
1816
|
};
|
|
1817
|
+
var documentExtensionByMediaType = {
|
|
1818
|
+
"application/msword": "doc",
|
|
1819
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
|
|
1820
|
+
"text/markdown": "md",
|
|
1821
|
+
"application/pdf": "pdf",
|
|
1822
|
+
"text/plain": "txt"
|
|
1823
|
+
};
|
|
1824
|
+
var mediaTypeToExtension = (mediaType) => {
|
|
1825
|
+
const mapped = documentExtensionByMediaType[mediaType];
|
|
1826
|
+
if (mapped) {
|
|
1827
|
+
return mapped;
|
|
1828
|
+
}
|
|
1829
|
+
const subtype = mediaType.split("/")[1] ?? "";
|
|
1830
|
+
return subtype.split("+")[0] || "bin";
|
|
1831
|
+
};
|
|
1832
|
+
var getFilesFromClipboard = (data) => {
|
|
1833
|
+
const files = [];
|
|
1834
|
+
for (const item of data.items ? Array.from(data.items) : []) {
|
|
1835
|
+
if (item.kind === "file") {
|
|
1836
|
+
const file = item.getAsFile();
|
|
1837
|
+
if (file) {
|
|
1838
|
+
files.push(file);
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
if (files.length === 0 && data.files) {
|
|
1843
|
+
files.push(...Array.from(data.files));
|
|
1844
|
+
}
|
|
1845
|
+
return files.map(
|
|
1846
|
+
(file, index) => file.name ? file : new File(
|
|
1847
|
+
[file],
|
|
1848
|
+
`pasted-${Date.now()}-${index}.${mediaTypeToExtension(file.type)}`,
|
|
1849
|
+
{ type: file.type }
|
|
1850
|
+
)
|
|
1851
|
+
);
|
|
1852
|
+
};
|
|
1817
1853
|
var getAttachmentIdFromRef = (url) => url.startsWith("attachment://") ? url.slice("attachment://".length) : null;
|
|
1818
1854
|
var resolveAttachmentUrl = (url, attachmentEndpoint) => {
|
|
1819
1855
|
if (!attachmentEndpoint) {
|
|
@@ -1896,6 +1932,16 @@ function PromptForm({
|
|
|
1896
1932
|
},
|
|
1897
1933
|
[canDrop, onFileDrop]
|
|
1898
1934
|
);
|
|
1935
|
+
const handlePaste = (0, import_react19.useCallback)(
|
|
1936
|
+
(e) => {
|
|
1937
|
+
if (!canDrop) return;
|
|
1938
|
+
const files = getFilesFromClipboard(e.clipboardData);
|
|
1939
|
+
if (files.length === 0) return;
|
|
1940
|
+
e.preventDefault();
|
|
1941
|
+
onFileDrop(files);
|
|
1942
|
+
},
|
|
1943
|
+
[canDrop, onFileDrop]
|
|
1944
|
+
);
|
|
1899
1945
|
(0, import_react19.useEffect)(() => {
|
|
1900
1946
|
setPrompt(value);
|
|
1901
1947
|
}, [setPrompt, value]);
|
|
@@ -1997,6 +2043,7 @@ function PromptForm({
|
|
|
1997
2043
|
internalRef.current = node;
|
|
1998
2044
|
},
|
|
1999
2045
|
onChange: (e) => setPrompt(e.target.value),
|
|
2046
|
+
onPaste: onFileDrop ? handlePaste : void 0,
|
|
2000
2047
|
onKeyDown: (e) => {
|
|
2001
2048
|
if (!e.shiftKey && e.key === "Enter") {
|
|
2002
2049
|
e.preventDefault();
|
|
@@ -4584,7 +4631,7 @@ var q = (0, import_qler.default)();
|
|
|
4584
4631
|
var DEFAULT_API_VERSION = "v2";
|
|
4585
4632
|
var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
|
|
4586
4633
|
var CLIENT_TOOL_ENDPOINT_UNAVAILABLE_ERROR_MESSAGE = "Unable to verify the page data. Please enable the `/chat/tool` endpoint on the server and try again.";
|
|
4587
|
-
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.
|
|
4634
|
+
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.bccb8f95" : "unknown";
|
|
4588
4635
|
var BENCHMARK = false;
|
|
4589
4636
|
var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${(0, import_ulid.ulid)()}`;
|
|
4590
4637
|
var getClassName18 = getClassNameFactory("Chat", styles_module_default);
|
package/dist/index.mjs
CHANGED
|
@@ -1834,6 +1834,42 @@ var matchesAccept = (file, accept) => {
|
|
|
1834
1834
|
return file.type === entry;
|
|
1835
1835
|
});
|
|
1836
1836
|
};
|
|
1837
|
+
var documentExtensionByMediaType = {
|
|
1838
|
+
"application/msword": "doc",
|
|
1839
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
|
|
1840
|
+
"text/markdown": "md",
|
|
1841
|
+
"application/pdf": "pdf",
|
|
1842
|
+
"text/plain": "txt"
|
|
1843
|
+
};
|
|
1844
|
+
var mediaTypeToExtension = (mediaType) => {
|
|
1845
|
+
const mapped = documentExtensionByMediaType[mediaType];
|
|
1846
|
+
if (mapped) {
|
|
1847
|
+
return mapped;
|
|
1848
|
+
}
|
|
1849
|
+
const subtype = mediaType.split("/")[1] ?? "";
|
|
1850
|
+
return subtype.split("+")[0] || "bin";
|
|
1851
|
+
};
|
|
1852
|
+
var getFilesFromClipboard = (data) => {
|
|
1853
|
+
const files = [];
|
|
1854
|
+
for (const item of data.items ? Array.from(data.items) : []) {
|
|
1855
|
+
if (item.kind === "file") {
|
|
1856
|
+
const file = item.getAsFile();
|
|
1857
|
+
if (file) {
|
|
1858
|
+
files.push(file);
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
if (files.length === 0 && data.files) {
|
|
1863
|
+
files.push(...Array.from(data.files));
|
|
1864
|
+
}
|
|
1865
|
+
return files.map(
|
|
1866
|
+
(file, index) => file.name ? file : new File(
|
|
1867
|
+
[file],
|
|
1868
|
+
`pasted-${Date.now()}-${index}.${mediaTypeToExtension(file.type)}`,
|
|
1869
|
+
{ type: file.type }
|
|
1870
|
+
)
|
|
1871
|
+
);
|
|
1872
|
+
};
|
|
1837
1873
|
var getAttachmentIdFromRef = (url) => url.startsWith("attachment://") ? url.slice("attachment://".length) : null;
|
|
1838
1874
|
var resolveAttachmentUrl = (url, attachmentEndpoint) => {
|
|
1839
1875
|
if (!attachmentEndpoint) {
|
|
@@ -1916,6 +1952,16 @@ function PromptForm({
|
|
|
1916
1952
|
},
|
|
1917
1953
|
[canDrop, onFileDrop]
|
|
1918
1954
|
);
|
|
1955
|
+
const handlePaste = useCallback4(
|
|
1956
|
+
(e) => {
|
|
1957
|
+
if (!canDrop) return;
|
|
1958
|
+
const files = getFilesFromClipboard(e.clipboardData);
|
|
1959
|
+
if (files.length === 0) return;
|
|
1960
|
+
e.preventDefault();
|
|
1961
|
+
onFileDrop(files);
|
|
1962
|
+
},
|
|
1963
|
+
[canDrop, onFileDrop]
|
|
1964
|
+
);
|
|
1919
1965
|
useEffect8(() => {
|
|
1920
1966
|
setPrompt(value);
|
|
1921
1967
|
}, [setPrompt, value]);
|
|
@@ -2017,6 +2063,7 @@ function PromptForm({
|
|
|
2017
2063
|
internalRef.current = node;
|
|
2018
2064
|
},
|
|
2019
2065
|
onChange: (e) => setPrompt(e.target.value),
|
|
2066
|
+
onPaste: onFileDrop ? handlePaste : void 0,
|
|
2020
2067
|
onKeyDown: (e) => {
|
|
2021
2068
|
if (!e.shiftKey && e.key === "Enter") {
|
|
2022
2069
|
e.preventDefault();
|
|
@@ -4616,7 +4663,7 @@ var q = qler();
|
|
|
4616
4663
|
var DEFAULT_API_VERSION = "v2";
|
|
4617
4664
|
var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
|
|
4618
4665
|
var CLIENT_TOOL_ENDPOINT_UNAVAILABLE_ERROR_MESSAGE = "Unable to verify the page data. Please enable the `/chat/tool` endpoint on the server and try again.";
|
|
4619
|
-
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.
|
|
4666
|
+
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.bccb8f95" : "unknown";
|
|
4620
4667
|
var BENCHMARK = false;
|
|
4621
4668
|
var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${ulid()}`;
|
|
4622
4669
|
var getClassName18 = getClassNameFactory("Chat", styles_module_default);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puckeditor/plugin-ai",
|
|
3
|
-
"version": "0.9.0-canary.
|
|
3
|
+
"version": "0.9.0-canary.bccb8f95",
|
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"tsup": "^8.2.4",
|
|
53
53
|
"typescript": "^5.5.4",
|
|
54
54
|
"vitest": "^4.1.11",
|
|
55
|
-
"@puckeditor/
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"eslint-config-custom": "0.9.0-canary.
|
|
60
|
-
"reducer": "0.9.0-canary.
|
|
55
|
+
"@puckeditor/ai-types": "0.9.0-canary.bccb8f95",
|
|
56
|
+
"@puckeditor/platform-types": "0.9.0-canary.bccb8f95",
|
|
57
|
+
"tsconfig": "0.9.0-canary.bccb8f95",
|
|
58
|
+
"tsup-config": "0.9.0-canary.bccb8f95",
|
|
59
|
+
"eslint-config-custom": "0.9.0-canary.bccb8f95",
|
|
60
|
+
"reducer": "0.9.0-canary.bccb8f95"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@puckeditor/core": "^0",
|