@puckeditor/plugin-ai 0.9.0-canary.826f250e → 0.9.0-canary.9c664bf4

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 CHANGED
@@ -1814,42 +1814,6 @@ 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
- };
1853
1817
  var getAttachmentIdFromRef = (url) => url.startsWith("attachment://") ? url.slice("attachment://".length) : null;
1854
1818
  var resolveAttachmentUrl = (url, attachmentEndpoint) => {
1855
1819
  if (!attachmentEndpoint) {
@@ -1932,16 +1896,6 @@ function PromptForm({
1932
1896
  },
1933
1897
  [canDrop, onFileDrop]
1934
1898
  );
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
- );
1945
1899
  (0, import_react19.useEffect)(() => {
1946
1900
  setPrompt(value);
1947
1901
  }, [setPrompt, value]);
@@ -2043,7 +1997,6 @@ function PromptForm({
2043
1997
  internalRef.current = node;
2044
1998
  },
2045
1999
  onChange: (e) => setPrompt(e.target.value),
2046
- onPaste: onFileDrop ? handlePaste : void 0,
2047
2000
  onKeyDown: (e) => {
2048
2001
  if (!e.shiftKey && e.key === "Enter") {
2049
2002
  e.preventDefault();
@@ -4631,7 +4584,7 @@ var q = (0, import_qler.default)();
4631
4584
  var DEFAULT_API_VERSION = "v2";
4632
4585
  var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
4633
4586
  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.";
4634
- var PLUGIN_AI_VERSION = true ? "0.9.0-canary.826f250e" : "unknown";
4587
+ var PLUGIN_AI_VERSION = true ? "0.9.0-canary.9c664bf4" : "unknown";
4635
4588
  var BENCHMARK = false;
4636
4589
  var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${(0, import_ulid.ulid)()}`;
4637
4590
  var getClassName18 = getClassNameFactory("Chat", styles_module_default);
package/dist/index.mjs CHANGED
@@ -1834,42 +1834,6 @@ 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
- };
1873
1837
  var getAttachmentIdFromRef = (url) => url.startsWith("attachment://") ? url.slice("attachment://".length) : null;
1874
1838
  var resolveAttachmentUrl = (url, attachmentEndpoint) => {
1875
1839
  if (!attachmentEndpoint) {
@@ -1952,16 +1916,6 @@ function PromptForm({
1952
1916
  },
1953
1917
  [canDrop, onFileDrop]
1954
1918
  );
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
- );
1965
1919
  useEffect8(() => {
1966
1920
  setPrompt(value);
1967
1921
  }, [setPrompt, value]);
@@ -2063,7 +2017,6 @@ function PromptForm({
2063
2017
  internalRef.current = node;
2064
2018
  },
2065
2019
  onChange: (e) => setPrompt(e.target.value),
2066
- onPaste: onFileDrop ? handlePaste : void 0,
2067
2020
  onKeyDown: (e) => {
2068
2021
  if (!e.shiftKey && e.key === "Enter") {
2069
2022
  e.preventDefault();
@@ -4663,7 +4616,7 @@ var q = qler();
4663
4616
  var DEFAULT_API_VERSION = "v2";
4664
4617
  var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
4665
4618
  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.";
4666
- var PLUGIN_AI_VERSION = true ? "0.9.0-canary.826f250e" : "unknown";
4619
+ var PLUGIN_AI_VERSION = true ? "0.9.0-canary.9c664bf4" : "unknown";
4667
4620
  var BENCHMARK = false;
4668
4621
  var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${ulid()}`;
4669
4622
  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.826f250e",
3
+ "version": "0.9.0-canary.9c664bf4",
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/ai-types": "0.9.0-canary.826f250e",
56
- "@puckeditor/platform-types": "0.9.0-canary.826f250e",
57
- "reducer": "0.9.0-canary.826f250e",
58
- "tsconfig": "0.9.0-canary.826f250e",
59
- "eslint-config-custom": "0.9.0-canary.826f250e",
60
- "tsup-config": "0.9.0-canary.826f250e"
55
+ "@puckeditor/platform-types": "0.9.0-canary.9c664bf4",
56
+ "tsup-config": "0.9.0-canary.9c664bf4",
57
+ "@puckeditor/ai-types": "0.9.0-canary.9c664bf4",
58
+ "tsconfig": "0.9.0-canary.9c664bf4",
59
+ "eslint-config-custom": "0.9.0-canary.9c664bf4",
60
+ "reducer": "0.9.0-canary.9c664bf4"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@puckeditor/core": "^0",