@anvilkit/plugin-asset-manager 0.1.6 → 0.1.7

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.
Files changed (209) hide show
  1. package/README.md +26 -18
  2. package/dist/index.cjs +7 -0
  3. package/dist/index.d.cts +11 -3
  4. package/dist/index.d.cts.map +1 -1
  5. package/dist/index.d.ts +11 -3
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -1
  8. package/dist/plugin.cjs +67 -4
  9. package/dist/plugin.d.cts +3 -2
  10. package/dist/plugin.d.cts.map +1 -1
  11. package/dist/plugin.d.ts +3 -2
  12. package/dist/plugin.d.ts.map +1 -1
  13. package/dist/plugin.js +67 -4
  14. package/dist/sources/composite-source.cjs +137 -0
  15. package/dist/sources/composite-source.d.cts +39 -0
  16. package/dist/sources/composite-source.d.cts.map +1 -0
  17. package/dist/sources/composite-source.d.ts +39 -0
  18. package/dist/sources/composite-source.d.ts.map +1 -0
  19. package/dist/sources/composite-source.js +99 -0
  20. package/dist/sources/federated-search.cjs +163 -0
  21. package/dist/sources/federated-search.d.cts +33 -0
  22. package/dist/sources/federated-search.d.cts.map +1 -0
  23. package/dist/sources/federated-search.d.ts +33 -0
  24. package/dist/sources/federated-search.d.ts.map +1 -0
  25. package/dist/sources/federated-search.js +113 -0
  26. package/dist/sources/provider.cjs +18 -0
  27. package/dist/sources/provider.d.cts +51 -0
  28. package/dist/sources/provider.d.cts.map +1 -0
  29. package/dist/sources/provider.d.ts +51 -0
  30. package/dist/sources/provider.d.ts.map +1 -0
  31. package/dist/sources/provider.js +1 -0
  32. package/dist/sources/unsplash/client.cjs +189 -0
  33. package/dist/sources/unsplash/client.d.cts +87 -0
  34. package/dist/sources/unsplash/client.d.cts.map +1 -0
  35. package/dist/sources/unsplash/client.d.ts +87 -0
  36. package/dist/sources/unsplash/client.d.ts.map +1 -0
  37. package/dist/sources/unsplash/client.js +151 -0
  38. package/dist/sources/unsplash/index.cjs +192 -0
  39. package/dist/sources/unsplash/index.d.cts +16 -0
  40. package/dist/sources/unsplash/index.d.cts.map +1 -0
  41. package/dist/sources/unsplash/index.d.ts +16 -0
  42. package/dist/sources/unsplash/index.d.ts.map +1 -0
  43. package/dist/sources/unsplash/index.js +148 -0
  44. package/dist/sources/unsplash/themes.cjs +141 -0
  45. package/dist/sources/unsplash/themes.d.cts +18 -0
  46. package/dist/sources/unsplash/themes.d.cts.map +1 -0
  47. package/dist/sources/unsplash/themes.d.ts +18 -0
  48. package/dist/sources/unsplash/themes.d.ts.map +1 -0
  49. package/dist/sources/unsplash/themes.js +93 -0
  50. package/dist/sources/unsplash/throttle-cache.cjs +86 -0
  51. package/dist/sources/unsplash/throttle-cache.d.cts +25 -0
  52. package/dist/sources/unsplash/throttle-cache.d.cts.map +1 -0
  53. package/dist/sources/unsplash/throttle-cache.d.ts +25 -0
  54. package/dist/sources/unsplash/throttle-cache.d.ts.map +1 -0
  55. package/dist/sources/unsplash/throttle-cache.js +45 -0
  56. package/dist/types/categories.cjs +18 -0
  57. package/dist/types/categories.d.cts +48 -0
  58. package/dist/types/categories.d.cts.map +1 -0
  59. package/dist/types/categories.d.ts +48 -0
  60. package/dist/types/categories.d.ts.map +1 -0
  61. package/dist/types/categories.js +1 -0
  62. package/dist/types/data-source.cjs +18 -0
  63. package/dist/types/data-source.d.cts +59 -0
  64. package/dist/types/data-source.d.cts.map +1 -0
  65. package/dist/types/data-source.d.ts +59 -0
  66. package/dist/types/data-source.d.ts.map +1 -0
  67. package/dist/types/data-source.js +1 -0
  68. package/dist/types/filter.cjs +18 -0
  69. package/dist/types/filter.d.cts +55 -0
  70. package/dist/types/filter.d.cts.map +1 -0
  71. package/dist/types/filter.d.ts +55 -0
  72. package/dist/types/filter.d.ts.map +1 -0
  73. package/dist/types/filter.js +1 -0
  74. package/dist/types/folders.cjs +42 -0
  75. package/dist/types/folders.d.cts +46 -0
  76. package/dist/types/folders.d.cts.map +1 -0
  77. package/dist/types/folders.d.ts +46 -0
  78. package/dist/types/folders.d.ts.map +1 -0
  79. package/dist/types/folders.js +4 -0
  80. package/dist/types/options.cjs +18 -0
  81. package/dist/types/options.d.cts +68 -0
  82. package/dist/types/options.d.cts.map +1 -0
  83. package/dist/types/options.d.ts +68 -0
  84. package/dist/types/options.d.ts.map +1 -0
  85. package/dist/types/options.js +1 -0
  86. package/dist/types/types.d.cts +15 -27
  87. package/dist/types/types.d.cts.map +1 -1
  88. package/dist/types/types.d.ts +15 -27
  89. package/dist/types/types.d.ts.map +1 -1
  90. package/dist/types/unsplash.cjs +18 -0
  91. package/dist/types/unsplash.d.cts +60 -0
  92. package/dist/types/unsplash.d.cts.map +1 -0
  93. package/dist/types/unsplash.d.ts +60 -0
  94. package/dist/types/unsplash.d.ts.map +1 -0
  95. package/dist/types/unsplash.js +1 -0
  96. package/dist/ui/AssetBrowser.cjs +33 -12
  97. package/dist/ui/AssetBrowser.d.cts +12 -1
  98. package/dist/ui/AssetBrowser.d.cts.map +1 -1
  99. package/dist/ui/AssetBrowser.d.ts +12 -1
  100. package/dist/ui/AssetBrowser.d.ts.map +1 -1
  101. package/dist/ui/AssetBrowser.js +33 -12
  102. package/dist/ui/AssetManagerUI.cjs +8 -2
  103. package/dist/ui/AssetManagerUI.d.cts +19 -3
  104. package/dist/ui/AssetManagerUI.d.cts.map +1 -1
  105. package/dist/ui/AssetManagerUI.d.ts +19 -3
  106. package/dist/ui/AssetManagerUI.d.ts.map +1 -1
  107. package/dist/ui/AssetManagerUI.js +8 -2
  108. package/dist/ui/DeleteFolderDialog.cjs +78 -0
  109. package/dist/ui/DeleteFolderDialog.d.cts +11 -0
  110. package/dist/ui/DeleteFolderDialog.d.cts.map +1 -0
  111. package/dist/ui/DeleteFolderDialog.d.ts +11 -0
  112. package/dist/ui/DeleteFolderDialog.d.ts.map +1 -0
  113. package/dist/ui/DeleteFolderDialog.js +40 -0
  114. package/dist/ui/EmptyFolderState.cjs +53 -0
  115. package/dist/ui/EmptyFolderState.d.cts +6 -0
  116. package/dist/ui/EmptyFolderState.d.cts.map +1 -0
  117. package/dist/ui/EmptyFolderState.d.ts +6 -0
  118. package/dist/ui/EmptyFolderState.d.ts.map +1 -0
  119. package/dist/ui/EmptyFolderState.js +15 -0
  120. package/dist/ui/FolderBreadcrumb.cjs +73 -0
  121. package/dist/ui/FolderBreadcrumb.d.cts +9 -0
  122. package/dist/ui/FolderBreadcrumb.d.cts.map +1 -0
  123. package/dist/ui/FolderBreadcrumb.d.ts +9 -0
  124. package/dist/ui/FolderBreadcrumb.d.ts.map +1 -0
  125. package/dist/ui/FolderBreadcrumb.js +35 -0
  126. package/dist/ui/FolderNameDialog.cjs +98 -0
  127. package/dist/ui/FolderNameDialog.d.cts +14 -0
  128. package/dist/ui/FolderNameDialog.d.cts.map +1 -0
  129. package/dist/ui/FolderNameDialog.d.ts +14 -0
  130. package/dist/ui/FolderNameDialog.d.ts.map +1 -0
  131. package/dist/ui/FolderNameDialog.js +60 -0
  132. package/dist/ui/FolderTree.cjs +83 -0
  133. package/dist/ui/FolderTree.d.cts +13 -0
  134. package/dist/ui/FolderTree.d.cts.map +1 -0
  135. package/dist/ui/FolderTree.d.ts +13 -0
  136. package/dist/ui/FolderTree.d.ts.map +1 -0
  137. package/dist/ui/FolderTree.js +42 -0
  138. package/dist/ui/MetadataPanel.cjs +7 -4
  139. package/dist/ui/MetadataPanel.d.cts.map +1 -1
  140. package/dist/ui/MetadataPanel.d.ts.map +1 -1
  141. package/dist/ui/MetadataPanel.js +7 -4
  142. package/dist/ui/MoveTargetPicker.cjs +84 -0
  143. package/dist/ui/MoveTargetPicker.d.cts +16 -0
  144. package/dist/ui/MoveTargetPicker.d.cts.map +1 -0
  145. package/dist/ui/MoveTargetPicker.d.ts +16 -0
  146. package/dist/ui/MoveTargetPicker.d.ts.map +1 -0
  147. package/dist/ui/MoveTargetPicker.js +46 -0
  148. package/dist/ui/ReplaceAssetDialog.d.cts +2 -1
  149. package/dist/ui/ReplaceAssetDialog.d.cts.map +1 -1
  150. package/dist/ui/ReplaceAssetDialog.d.ts +2 -1
  151. package/dist/ui/ReplaceAssetDialog.d.ts.map +1 -1
  152. package/dist/ui/UnsplashPanel.cjs +134 -0
  153. package/dist/ui/UnsplashPanel.d.cts +28 -0
  154. package/dist/ui/UnsplashPanel.d.cts.map +1 -0
  155. package/dist/ui/UnsplashPanel.d.ts +28 -0
  156. package/dist/ui/UnsplashPanel.d.ts.map +1 -0
  157. package/dist/ui/UnsplashPanel.js +96 -0
  158. package/dist/ui/UploadButton.cjs +1 -5
  159. package/dist/ui/UploadButton.d.cts +9 -2
  160. package/dist/ui/UploadButton.d.cts.map +1 -1
  161. package/dist/ui/UploadButton.d.ts +9 -2
  162. package/dist/ui/UploadButton.d.ts.map +1 -1
  163. package/dist/ui/UploadButton.js +1 -5
  164. package/dist/ui/index.cjs +37 -0
  165. package/dist/ui/index.d.cts +14 -0
  166. package/dist/ui/index.d.cts.map +1 -1
  167. package/dist/ui/index.d.ts +14 -0
  168. package/dist/ui/index.d.ts.map +1 -1
  169. package/dist/ui/index.js +7 -0
  170. package/dist/utils/data-source.cjs +177 -0
  171. package/dist/utils/data-source.d.cts +63 -0
  172. package/dist/utils/data-source.d.cts.map +1 -0
  173. package/dist/utils/data-source.d.ts +63 -0
  174. package/dist/utils/data-source.d.ts.map +1 -0
  175. package/dist/utils/data-source.js +136 -0
  176. package/dist/utils/errors.cjs +18 -0
  177. package/dist/utils/errors.d.cts +27 -0
  178. package/dist/utils/errors.d.cts.map +1 -1
  179. package/dist/utils/errors.d.ts +27 -0
  180. package/dist/utils/errors.d.ts.map +1 -1
  181. package/dist/utils/errors.js +16 -1
  182. package/dist/utils/folders.cjs +261 -0
  183. package/dist/utils/folders.d.cts +49 -0
  184. package/dist/utils/folders.d.cts.map +1 -0
  185. package/dist/utils/folders.d.ts +49 -0
  186. package/dist/utils/folders.d.ts.map +1 -0
  187. package/dist/utils/folders.js +223 -0
  188. package/dist/utils/registry.cjs +27 -12
  189. package/dist/utils/registry.d.cts +21 -1
  190. package/dist/utils/registry.d.cts.map +1 -1
  191. package/dist/utils/registry.d.ts +21 -1
  192. package/dist/utils/registry.d.ts.map +1 -1
  193. package/dist/utils/registry.js +20 -11
  194. package/dist/utils/studio-asset-source.cjs +5 -2
  195. package/dist/utils/studio-asset-source.d.cts +6 -1
  196. package/dist/utils/studio-asset-source.d.cts.map +1 -1
  197. package/dist/utils/studio-asset-source.d.ts +6 -1
  198. package/dist/utils/studio-asset-source.d.ts.map +1 -1
  199. package/dist/utils/studio-asset-source.js +1 -1
  200. package/dist/utils/validate-upload-result.d.cts +2 -1
  201. package/dist/utils/validate-upload-result.d.cts.map +1 -1
  202. package/dist/utils/validate-upload-result.d.ts +2 -1
  203. package/dist/utils/validate-upload-result.d.ts.map +1 -1
  204. package/dist/version.cjs +1 -1
  205. package/dist/version.d.cts +1 -1
  206. package/dist/version.d.ts +1 -1
  207. package/dist/version.js +1 -1
  208. package/meta/config.json +1 -1
  209. package/package.json +12 -2
@@ -1 +1 @@
1
- {"version":3,"file":"MetadataPanel.d.cts","sourceRoot":"","sources":["../../src/ui/MetadataPanel.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,CACnB,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,KAC7D,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,SAAS,GACT,EAAE,kBAAkB,2CAuIpB"}
1
+ {"version":3,"file":"MetadataPanel.d.cts","sourceRoot":"","sources":["../../src/ui/MetadataPanel.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,CACnB,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,KAC7D,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,SAAS,GACT,EAAE,kBAAkB,2CAyIpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"MetadataPanel.d.ts","sourceRoot":"","sources":["../../src/ui/MetadataPanel.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,CACnB,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,KAC7D,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,SAAS,GACT,EAAE,kBAAkB,2CAuIpB"}
1
+ {"version":3,"file":"MetadataPanel.d.ts","sourceRoot":"","sources":["../../src/ui/MetadataPanel.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,CACnB,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,KAC7D,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,SAAS,GACT,EAAE,kBAAkB,2CAyIpB"}
@@ -2,6 +2,7 @@
2
2
  import { Button } from "@anvilkit/ui/button";
3
3
  import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@anvilkit/ui/dialog";
4
4
  import { Input } from "@anvilkit/ui/input";
5
+ import { Label } from "@anvilkit/ui/label";
5
6
  import * as __rspack_external_react from "react";
6
7
  function MetadataPanel({ asset, onCancel, onConfirm }) {
7
8
  const [name, setName] = __rspack_external_react.useState("");
@@ -64,7 +65,7 @@ function MetadataPanel({ asset, onCancel, onConfirm }) {
64
65
  onOpenChange: handleOpenChange
65
66
  }, /*#__PURE__*/ __rspack_external_react.createElement(DialogContent, null, /*#__PURE__*/ __rspack_external_react.createElement(DialogHeader, null, /*#__PURE__*/ __rspack_external_react.createElement(DialogTitle, null, "Edit asset"), /*#__PURE__*/ __rspack_external_react.createElement(DialogDescription, null, asset?.id, mimeType ? ` (${mimeType})` : "")), /*#__PURE__*/ __rspack_external_react.createElement("div", {
66
67
  "data-asset-manager-metadata": true
67
- }, /*#__PURE__*/ __rspack_external_react.createElement("label", {
68
+ }, /*#__PURE__*/ __rspack_external_react.createElement(Label, {
68
69
  htmlFor: "asset-metadata-name"
69
70
  }, "Name"), /*#__PURE__*/ __rspack_external_react.createElement(Input, {
70
71
  id: "asset-metadata-name",
@@ -76,21 +77,23 @@ function MetadataPanel({ asset, onCancel, onConfirm }) {
76
77
  disabled: busy
77
78
  }), /*#__PURE__*/ __rspack_external_react.createElement("div", {
78
79
  "data-asset-manager-tag-editor": true
79
- }, /*#__PURE__*/ __rspack_external_react.createElement("label", {
80
+ }, /*#__PURE__*/ __rspack_external_react.createElement(Label, {
80
81
  htmlFor: "asset-metadata-tag-input"
81
82
  }, "Tags"), /*#__PURE__*/ __rspack_external_react.createElement("ul", {
82
83
  "aria-label": "Current tags",
83
84
  role: "list"
84
85
  }, tags.map((tag)=>/*#__PURE__*/ __rspack_external_react.createElement("li", {
85
86
  key: tag
86
- }, /*#__PURE__*/ __rspack_external_react.createElement("span", null, tag), /*#__PURE__*/ __rspack_external_react.createElement("button", {
87
+ }, /*#__PURE__*/ __rspack_external_react.createElement("span", null, tag), /*#__PURE__*/ __rspack_external_react.createElement(Button, {
87
88
  "aria-label": `Remove tag ${tag}`,
88
89
  "data-asset-action": "remove-tag",
89
90
  disabled: busy,
90
91
  onClick: ()=>{
91
92
  removeTag(tag);
92
93
  },
93
- type: "button"
94
+ type: "button",
95
+ variant: "ghost",
96
+ size: "icon-xs"
94
97
  }, "\xd7")))), /*#__PURE__*/ __rspack_external_react.createElement(Input, {
95
98
  id: "asset-metadata-tag-input",
96
99
  value: tagInput,
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ "use client";
3
+ var __webpack_require__ = {};
4
+ (()=>{
5
+ __webpack_require__.d = (exports1, getters, values)=>{
6
+ var define = (defs, kind)=>{
7
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
8
+ enumerable: true,
9
+ [kind]: defs[key]
10
+ });
11
+ };
12
+ define(getters, "get");
13
+ define(values, "value");
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
18
+ })();
19
+ (()=>{
20
+ __webpack_require__.r = (exports1)=>{
21
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
22
+ value: 'Module'
23
+ });
24
+ Object.defineProperty(exports1, '__esModule', {
25
+ value: true
26
+ });
27
+ };
28
+ })();
29
+ var __webpack_exports__ = {};
30
+ __webpack_require__.r(__webpack_exports__);
31
+ __webpack_require__.d(__webpack_exports__, {
32
+ MoveTargetPicker: ()=>MoveTargetPicker
33
+ });
34
+ const button_namespaceObject = require("@anvilkit/ui/button");
35
+ const dialog_namespaceObject = require("@anvilkit/ui/dialog");
36
+ const external_react_namespaceObject = require("react");
37
+ function MoveTargetPicker({ open, onOpenChange, folders, onPick, rootLabel = "All assets" }) {
38
+ const [busy, setBusy] = external_react_namespaceObject.useState(false);
39
+ async function pick(folderId) {
40
+ if (busy) return;
41
+ setBusy(true);
42
+ try {
43
+ await onPick(folderId);
44
+ onOpenChange(false);
45
+ } finally{
46
+ setBusy(false);
47
+ }
48
+ }
49
+ return /*#__PURE__*/ external_react_namespaceObject.createElement(dialog_namespaceObject.Dialog, {
50
+ open: open,
51
+ onOpenChange: (next)=>{
52
+ if (!busy) onOpenChange(next);
53
+ }
54
+ }, /*#__PURE__*/ external_react_namespaceObject.createElement(dialog_namespaceObject.DialogContent, null, /*#__PURE__*/ external_react_namespaceObject.createElement(dialog_namespaceObject.DialogHeader, null, /*#__PURE__*/ external_react_namespaceObject.createElement(dialog_namespaceObject.DialogTitle, null, "Move to folder")), /*#__PURE__*/ external_react_namespaceObject.createElement("ul", {
55
+ "aria-label": "Move to folder",
56
+ "data-testid": "ak-move-target-picker",
57
+ className: "flex max-h-72 flex-col gap-1 overflow-auto"
58
+ }, /*#__PURE__*/ external_react_namespaceObject.createElement("li", null, /*#__PURE__*/ external_react_namespaceObject.createElement(button_namespaceObject.Button, {
59
+ type: "button",
60
+ variant: "ghost",
61
+ size: "sm",
62
+ className: "w-full justify-start",
63
+ "data-move-target": "root",
64
+ disabled: busy,
65
+ onClick: ()=>void pick(null)
66
+ }, rootLabel)), folders.map((folder)=>/*#__PURE__*/ external_react_namespaceObject.createElement("li", {
67
+ key: folder.id
68
+ }, /*#__PURE__*/ external_react_namespaceObject.createElement(button_namespaceObject.Button, {
69
+ type: "button",
70
+ variant: "ghost",
71
+ size: "sm",
72
+ className: "w-full justify-start",
73
+ "data-move-target": folder.id,
74
+ disabled: busy,
75
+ onClick: ()=>void pick(folder.id)
76
+ }, folder.name))))));
77
+ }
78
+ exports.MoveTargetPicker = __webpack_exports__.MoveTargetPicker;
79
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
80
+ "MoveTargetPicker"
81
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
82
+ Object.defineProperty(exports, '__esModule', {
83
+ value: true
84
+ });
@@ -0,0 +1,16 @@
1
+ import type { AssetFolder } from "../types/folders.js";
2
+ /**
3
+ * Keyboard-accessible move-target picker — the a11y fallback for drag-to-folder.
4
+ * Renders, inside a focus-trapping `<Dialog>`, a labelled `<ul>` of Tab-focusable
5
+ * folder `<Button>`s plus a root option (no roving-tabindex listbox; each option
6
+ * is an individually focusable, Enter/Space-activatable button).
7
+ */
8
+ export interface MoveTargetPickerProps {
9
+ readonly open: boolean;
10
+ readonly onOpenChange: (open: boolean) => void;
11
+ readonly folders: readonly AssetFolder[];
12
+ readonly onPick: (folderId: string | null) => void | Promise<void>;
13
+ readonly rootLabel?: string;
14
+ }
15
+ export declare function MoveTargetPicker({ open, onOpenChange, folders, onPick, rootLabel, }: MoveTargetPickerProps): import("react/jsx-runtime").JSX.Element;
16
+ //# sourceMappingURL=MoveTargetPicker.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoveTargetPicker.d.cts","sourceRoot":"","sources":["../../src/ui/MoveTargetPicker.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,EAChC,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,MAAM,EACN,SAAwB,GACxB,EAAE,qBAAqB,2CA8DvB"}
@@ -0,0 +1,16 @@
1
+ import type { AssetFolder } from "../types/folders.js";
2
+ /**
3
+ * Keyboard-accessible move-target picker — the a11y fallback for drag-to-folder.
4
+ * Renders, inside a focus-trapping `<Dialog>`, a labelled `<ul>` of Tab-focusable
5
+ * folder `<Button>`s plus a root option (no roving-tabindex listbox; each option
6
+ * is an individually focusable, Enter/Space-activatable button).
7
+ */
8
+ export interface MoveTargetPickerProps {
9
+ readonly open: boolean;
10
+ readonly onOpenChange: (open: boolean) => void;
11
+ readonly folders: readonly AssetFolder[];
12
+ readonly onPick: (folderId: string | null) => void | Promise<void>;
13
+ readonly rootLabel?: string;
14
+ }
15
+ export declare function MoveTargetPicker({ open, onOpenChange, folders, onPick, rootLabel, }: MoveTargetPickerProps): import("react/jsx-runtime").JSX.Element;
16
+ //# sourceMappingURL=MoveTargetPicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoveTargetPicker.d.ts","sourceRoot":"","sources":["../../src/ui/MoveTargetPicker.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,EAChC,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,MAAM,EACN,SAAwB,GACxB,EAAE,qBAAqB,2CA8DvB"}
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { Button } from "@anvilkit/ui/button";
3
+ import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@anvilkit/ui/dialog";
4
+ import * as __rspack_external_react from "react";
5
+ function MoveTargetPicker({ open, onOpenChange, folders, onPick, rootLabel = "All assets" }) {
6
+ const [busy, setBusy] = __rspack_external_react.useState(false);
7
+ async function pick(folderId) {
8
+ if (busy) return;
9
+ setBusy(true);
10
+ try {
11
+ await onPick(folderId);
12
+ onOpenChange(false);
13
+ } finally{
14
+ setBusy(false);
15
+ }
16
+ }
17
+ return /*#__PURE__*/ __rspack_external_react.createElement(Dialog, {
18
+ open: open,
19
+ onOpenChange: (next)=>{
20
+ if (!busy) onOpenChange(next);
21
+ }
22
+ }, /*#__PURE__*/ __rspack_external_react.createElement(DialogContent, null, /*#__PURE__*/ __rspack_external_react.createElement(DialogHeader, null, /*#__PURE__*/ __rspack_external_react.createElement(DialogTitle, null, "Move to folder")), /*#__PURE__*/ __rspack_external_react.createElement("ul", {
23
+ "aria-label": "Move to folder",
24
+ "data-testid": "ak-move-target-picker",
25
+ className: "flex max-h-72 flex-col gap-1 overflow-auto"
26
+ }, /*#__PURE__*/ __rspack_external_react.createElement("li", null, /*#__PURE__*/ __rspack_external_react.createElement(Button, {
27
+ type: "button",
28
+ variant: "ghost",
29
+ size: "sm",
30
+ className: "w-full justify-start",
31
+ "data-move-target": "root",
32
+ disabled: busy,
33
+ onClick: ()=>void pick(null)
34
+ }, rootLabel)), folders.map((folder)=>/*#__PURE__*/ __rspack_external_react.createElement("li", {
35
+ key: folder.id
36
+ }, /*#__PURE__*/ __rspack_external_react.createElement(Button, {
37
+ type: "button",
38
+ variant: "ghost",
39
+ size: "sm",
40
+ className: "w-full justify-start",
41
+ "data-move-target": folder.id,
42
+ disabled: busy,
43
+ onClick: ()=>void pick(folder.id)
44
+ }, folder.name))))));
45
+ }
46
+ export { MoveTargetPicker };
@@ -1,4 +1,5 @@
1
- import type { AssetManagerOptions, UploadResult } from "../types/types.js";
1
+ import type { AssetManagerOptions } from "../types/options.js";
2
+ import type { UploadResult } from "../types/types.js";
2
3
  export interface ReplaceAssetDialogProps extends Pick<AssetManagerOptions, "acceptedMimeTypes" | "maxFileSize"> {
3
4
  /** Asset to replace. `null` closes the dialog. */
4
5
  readonly asset: UploadResult | null;
@@ -1 +1 @@
1
- {"version":3,"file":"ReplaceAssetDialog.d.cts","sourceRoot":"","sources":["../../src/ui/ReplaceAssetDialog.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE3E,MAAM,WAAW,uBAChB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,aAAa,CAAC;IACtE,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,wBAAgB,kBAAkB,CAAC,EAClC,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,SAAS,GACT,EAAE,uBAAuB,2CAuHzB"}
1
+ {"version":3,"file":"ReplaceAssetDialog.d.cts","sourceRoot":"","sources":["../../src/ui/ReplaceAssetDialog.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,uBAChB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,aAAa,CAAC;IACtE,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,wBAAgB,kBAAkB,CAAC,EAClC,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,SAAS,GACT,EAAE,uBAAuB,2CAuHzB"}
@@ -1,4 +1,5 @@
1
- import type { AssetManagerOptions, UploadResult } from "../types/types.js";
1
+ import type { AssetManagerOptions } from "../types/options.js";
2
+ import type { UploadResult } from "../types/types.js";
2
3
  export interface ReplaceAssetDialogProps extends Pick<AssetManagerOptions, "acceptedMimeTypes" | "maxFileSize"> {
3
4
  /** Asset to replace. `null` closes the dialog. */
4
5
  readonly asset: UploadResult | null;
@@ -1 +1 @@
1
- {"version":3,"file":"ReplaceAssetDialog.d.ts","sourceRoot":"","sources":["../../src/ui/ReplaceAssetDialog.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE3E,MAAM,WAAW,uBAChB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,aAAa,CAAC;IACtE,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,wBAAgB,kBAAkB,CAAC,EAClC,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,SAAS,GACT,EAAE,uBAAuB,2CAuHzB"}
1
+ {"version":3,"file":"ReplaceAssetDialog.d.ts","sourceRoot":"","sources":["../../src/ui/ReplaceAssetDialog.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,uBAChB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,aAAa,CAAC;IACtE,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,wBAAgB,kBAAkB,CAAC,EAClC,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,SAAS,GACT,EAAE,uBAAuB,2CAuHzB"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ "use client";
3
+ var __webpack_require__ = {};
4
+ (()=>{
5
+ __webpack_require__.d = (exports1, getters, values)=>{
6
+ var define = (defs, kind)=>{
7
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
8
+ enumerable: true,
9
+ [kind]: defs[key]
10
+ });
11
+ };
12
+ define(getters, "get");
13
+ define(values, "value");
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
18
+ })();
19
+ (()=>{
20
+ __webpack_require__.r = (exports1)=>{
21
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
22
+ value: 'Module'
23
+ });
24
+ Object.defineProperty(exports1, '__esModule', {
25
+ value: true
26
+ });
27
+ };
28
+ })();
29
+ var __webpack_exports__ = {};
30
+ __webpack_require__.r(__webpack_exports__);
31
+ __webpack_require__.d(__webpack_exports__, {
32
+ UnsplashPanel: ()=>UnsplashPanel
33
+ });
34
+ const button_namespaceObject = require("@anvilkit/ui/button");
35
+ const input_namespaceObject = require("@anvilkit/ui/input");
36
+ const external_react_namespaceObject = require("react");
37
+ function UnsplashPanel({ themes, activeThemeId, onThemeChange, query, onQueryChange, results, status, onPick, onLoadMore, themeLabel = (key)=>key, skeletonCount = 12 }) {
38
+ if ("disabled" === status) return /*#__PURE__*/ external_react_namespaceObject.createElement("div", {
39
+ role: "status",
40
+ "data-testid": "ak-unsplash-disabled",
41
+ className: "flex flex-col items-center gap-2 p-6 text-center text-sm text-[var(--ak-studio-muted-fg)]"
42
+ }, /*#__PURE__*/ external_react_namespaceObject.createElement("p", null, "Connect Unsplash — add an access key via a server proxy."));
43
+ return /*#__PURE__*/ external_react_namespaceObject.createElement("div", {
44
+ "data-testid": "ak-unsplash-panel",
45
+ className: "flex flex-col gap-2"
46
+ }, /*#__PURE__*/ external_react_namespaceObject.createElement("span", {
47
+ role: "status",
48
+ "aria-live": "polite",
49
+ "data-testid": "ak-unsplash-status",
50
+ className: "sr-only"
51
+ }, "loading" === status ? "Loading photos…" : ""), /*#__PURE__*/ external_react_namespaceObject.createElement(input_namespaceObject.Input, {
52
+ value: query,
53
+ placeholder: "Search Unsplash…",
54
+ "data-testid": "ak-unsplash-search",
55
+ onChange: (event)=>onQueryChange(event.currentTarget.value)
56
+ }), themes.length > 0 ? /*#__PURE__*/ external_react_namespaceObject.createElement("div", {
57
+ role: "group",
58
+ "aria-label": "Unsplash themes",
59
+ "data-testid": "ak-unsplash-themes",
60
+ className: "flex flex-wrap gap-1"
61
+ }, themes.map((theme)=>/*#__PURE__*/ external_react_namespaceObject.createElement(button_namespaceObject.Button, {
62
+ key: theme.id,
63
+ type: "button",
64
+ size: "sm",
65
+ variant: theme.id === activeThemeId ? "secondary" : "ghost",
66
+ "aria-pressed": theme.id === activeThemeId,
67
+ "data-theme-id": theme.id,
68
+ onClick: ()=>onThemeChange(theme.id === activeThemeId ? void 0 : theme.id)
69
+ }, themeLabel(theme.label)))) : null, "rateLimited" === status ? /*#__PURE__*/ external_react_namespaceObject.createElement("p", {
70
+ role: "alert",
71
+ "data-testid": "ak-unsplash-rate-limited",
72
+ className: "text-sm"
73
+ }, "Unsplash rate limit reached — try again shortly.") : null, "error" === status ? /*#__PURE__*/ external_react_namespaceObject.createElement("p", {
74
+ role: "alert",
75
+ "data-testid": "ak-unsplash-error",
76
+ className: "text-sm"
77
+ }, "Couldn’t reach Unsplash. Retry.") : null, "loading" === status && 0 === results.length ? /*#__PURE__*/ external_react_namespaceObject.createElement("ul", {
78
+ "data-testid": "ak-unsplash-skeletons",
79
+ className: "grid grid-cols-3 gap-2",
80
+ "aria-hidden": "true"
81
+ }, Array.from({
82
+ length: skeletonCount
83
+ }, (_, index)=>/*#__PURE__*/ external_react_namespaceObject.createElement("li", {
84
+ key: `skeleton-${index}`,
85
+ className: "aspect-square animate-pulse rounded bg-[var(--ak-studio-muted,#e5e7eb)]"
86
+ }))) : 0 === results.length && "idle" === status ? /*#__PURE__*/ external_react_namespaceObject.createElement("p", {
87
+ "data-testid": "ak-unsplash-empty",
88
+ className: "p-4 text-center text-sm"
89
+ }, "Search Unsplash to browse photos.") : /*#__PURE__*/ external_react_namespaceObject.createElement("ul", {
90
+ "data-testid": "ak-unsplash-results",
91
+ className: "grid grid-cols-3 gap-2"
92
+ }, results.map((result)=>/*#__PURE__*/ external_react_namespaceObject.createElement("li", {
93
+ key: result.id,
94
+ className: "flex flex-col gap-0.5"
95
+ }, /*#__PURE__*/ external_react_namespaceObject.createElement("button", {
96
+ type: "button",
97
+ "data-unsplash-id": result.id,
98
+ "aria-label": `Insert photo by ${result.photographerName}`,
99
+ className: "overflow-hidden rounded",
100
+ onClick: ()=>void onPick(result.id)
101
+ }, /*#__PURE__*/ external_react_namespaceObject.createElement("img", {
102
+ src: result.thumbnailUrl,
103
+ alt: `Photo by ${result.photographerName}`,
104
+ className: "aspect-square w-full object-cover",
105
+ loading: "lazy"
106
+ })), /*#__PURE__*/ external_react_namespaceObject.createElement("p", {
107
+ className: "truncate text-[10px] text-[var(--ak-studio-muted-fg)]"
108
+ }, /*#__PURE__*/ external_react_namespaceObject.createElement("a", {
109
+ href: result.photographerUrl,
110
+ target: "_blank",
111
+ rel: "noreferrer noopener",
112
+ className: "underline"
113
+ }, result.photographerName), " ", "\xb7", " ", /*#__PURE__*/ external_react_namespaceObject.createElement("a", {
114
+ href: result.unsplashUrl,
115
+ target: "_blank",
116
+ rel: "noreferrer noopener",
117
+ className: "underline"
118
+ }, "Unsplash"))))), onLoadMore && results.length > 0 ? /*#__PURE__*/ external_react_namespaceObject.createElement("div", {
119
+ className: "flex justify-center"
120
+ }, /*#__PURE__*/ external_react_namespaceObject.createElement(button_namespaceObject.Button, {
121
+ type: "button",
122
+ variant: "outline",
123
+ size: "sm",
124
+ disabled: "loading" === status,
125
+ onClick: onLoadMore
126
+ }, "Load more")) : null);
127
+ }
128
+ exports.UnsplashPanel = __webpack_exports__.UnsplashPanel;
129
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
130
+ "UnsplashPanel"
131
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
132
+ Object.defineProperty(exports, '__esModule', {
133
+ value: true
134
+ });
@@ -0,0 +1,28 @@
1
+ import type { AssetTheme } from "../sources/provider.js";
2
+ /** A browsed Unsplash result + the attribution the tile must show. */
3
+ export interface UnsplashResult {
4
+ readonly id: string;
5
+ readonly thumbnailUrl: string;
6
+ readonly photographerName: string;
7
+ readonly photographerUrl: string;
8
+ readonly unsplashUrl: string;
9
+ }
10
+ export type UnsplashPanelStatus = "idle" | "loading" | "rateLimited" | "error" | "disabled";
11
+ export interface UnsplashPanelProps {
12
+ readonly themes: readonly AssetTheme[];
13
+ readonly activeThemeId?: string;
14
+ readonly onThemeChange: (themeId: string | undefined) => void;
15
+ readonly query: string;
16
+ readonly onQueryChange: (query: string) => void;
17
+ readonly results: readonly UnsplashResult[];
18
+ readonly status: UnsplashPanelStatus;
19
+ /** Insert a result — the host calls the provider's pickResult (download trigger). */
20
+ readonly onPick: (id: string) => void | Promise<void>;
21
+ readonly onLoadMore?: () => void;
22
+ /** Map a theme label key → display text (defaults to the raw key). */
23
+ readonly themeLabel?: (key: string) => string;
24
+ /** Skeleton tile count while loading the first page. */
25
+ readonly skeletonCount?: number;
26
+ }
27
+ export declare function UnsplashPanel({ themes, activeThemeId, onThemeChange, query, onQueryChange, results, status, onPick, onLoadMore, themeLabel, skeletonCount, }: UnsplashPanelProps): import("react/jsx-runtime").JSX.Element;
28
+ //# sourceMappingURL=UnsplashPanel.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnsplashPanel.d.cts","sourceRoot":"","sources":["../../src/ui/UnsplashPanel.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,sEAAsE;AACtE,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,mBAAmB,GAC5B,MAAM,GACN,SAAS,GACT,aAAa,GACb,OAAO,GACP,UAAU,CAAC;AAEd,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC9D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,qFAAqF;IACrF,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,sEAAsE;IACtE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,wDAAwD;IACxD,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,wBAAgB,aAAa,CAAC,EAC7B,MAAM,EACN,aAAa,EACb,aAAa,EACb,KAAK,EACL,aAAa,EACb,OAAO,EACP,MAAM,EACN,MAAM,EACN,UAAU,EACV,UAAyB,EACzB,aAAkB,GAClB,EAAE,kBAAkB,2CAoJpB"}
@@ -0,0 +1,28 @@
1
+ import type { AssetTheme } from "../sources/provider.js";
2
+ /** A browsed Unsplash result + the attribution the tile must show. */
3
+ export interface UnsplashResult {
4
+ readonly id: string;
5
+ readonly thumbnailUrl: string;
6
+ readonly photographerName: string;
7
+ readonly photographerUrl: string;
8
+ readonly unsplashUrl: string;
9
+ }
10
+ export type UnsplashPanelStatus = "idle" | "loading" | "rateLimited" | "error" | "disabled";
11
+ export interface UnsplashPanelProps {
12
+ readonly themes: readonly AssetTheme[];
13
+ readonly activeThemeId?: string;
14
+ readonly onThemeChange: (themeId: string | undefined) => void;
15
+ readonly query: string;
16
+ readonly onQueryChange: (query: string) => void;
17
+ readonly results: readonly UnsplashResult[];
18
+ readonly status: UnsplashPanelStatus;
19
+ /** Insert a result — the host calls the provider's pickResult (download trigger). */
20
+ readonly onPick: (id: string) => void | Promise<void>;
21
+ readonly onLoadMore?: () => void;
22
+ /** Map a theme label key → display text (defaults to the raw key). */
23
+ readonly themeLabel?: (key: string) => string;
24
+ /** Skeleton tile count while loading the first page. */
25
+ readonly skeletonCount?: number;
26
+ }
27
+ export declare function UnsplashPanel({ themes, activeThemeId, onThemeChange, query, onQueryChange, results, status, onPick, onLoadMore, themeLabel, skeletonCount, }: UnsplashPanelProps): import("react/jsx-runtime").JSX.Element;
28
+ //# sourceMappingURL=UnsplashPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnsplashPanel.d.ts","sourceRoot":"","sources":["../../src/ui/UnsplashPanel.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,sEAAsE;AACtE,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,mBAAmB,GAC5B,MAAM,GACN,SAAS,GACT,aAAa,GACb,OAAO,GACP,UAAU,CAAC;AAEd,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC9D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,qFAAqF;IACrF,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,sEAAsE;IACtE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,wDAAwD;IACxD,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,wBAAgB,aAAa,CAAC,EAC7B,MAAM,EACN,aAAa,EACb,aAAa,EACb,KAAK,EACL,aAAa,EACb,OAAO,EACP,MAAM,EACN,MAAM,EACN,UAAU,EACV,UAAyB,EACzB,aAAkB,GAClB,EAAE,kBAAkB,2CAoJpB"}
@@ -0,0 +1,96 @@
1
+ "use client";
2
+ import { Button } from "@anvilkit/ui/button";
3
+ import { Input } from "@anvilkit/ui/input";
4
+ import * as __rspack_external_react from "react";
5
+ function UnsplashPanel({ themes, activeThemeId, onThemeChange, query, onQueryChange, results, status, onPick, onLoadMore, themeLabel = (key)=>key, skeletonCount = 12 }) {
6
+ if ("disabled" === status) return /*#__PURE__*/ __rspack_external_react.createElement("div", {
7
+ role: "status",
8
+ "data-testid": "ak-unsplash-disabled",
9
+ className: "flex flex-col items-center gap-2 p-6 text-center text-sm text-[var(--ak-studio-muted-fg)]"
10
+ }, /*#__PURE__*/ __rspack_external_react.createElement("p", null, "Connect Unsplash — add an access key via a server proxy."));
11
+ return /*#__PURE__*/ __rspack_external_react.createElement("div", {
12
+ "data-testid": "ak-unsplash-panel",
13
+ className: "flex flex-col gap-2"
14
+ }, /*#__PURE__*/ __rspack_external_react.createElement("span", {
15
+ role: "status",
16
+ "aria-live": "polite",
17
+ "data-testid": "ak-unsplash-status",
18
+ className: "sr-only"
19
+ }, "loading" === status ? "Loading photos…" : ""), /*#__PURE__*/ __rspack_external_react.createElement(Input, {
20
+ value: query,
21
+ placeholder: "Search Unsplash…",
22
+ "data-testid": "ak-unsplash-search",
23
+ onChange: (event)=>onQueryChange(event.currentTarget.value)
24
+ }), themes.length > 0 ? /*#__PURE__*/ __rspack_external_react.createElement("div", {
25
+ role: "group",
26
+ "aria-label": "Unsplash themes",
27
+ "data-testid": "ak-unsplash-themes",
28
+ className: "flex flex-wrap gap-1"
29
+ }, themes.map((theme)=>/*#__PURE__*/ __rspack_external_react.createElement(Button, {
30
+ key: theme.id,
31
+ type: "button",
32
+ size: "sm",
33
+ variant: theme.id === activeThemeId ? "secondary" : "ghost",
34
+ "aria-pressed": theme.id === activeThemeId,
35
+ "data-theme-id": theme.id,
36
+ onClick: ()=>onThemeChange(theme.id === activeThemeId ? void 0 : theme.id)
37
+ }, themeLabel(theme.label)))) : null, "rateLimited" === status ? /*#__PURE__*/ __rspack_external_react.createElement("p", {
38
+ role: "alert",
39
+ "data-testid": "ak-unsplash-rate-limited",
40
+ className: "text-sm"
41
+ }, "Unsplash rate limit reached — try again shortly.") : null, "error" === status ? /*#__PURE__*/ __rspack_external_react.createElement("p", {
42
+ role: "alert",
43
+ "data-testid": "ak-unsplash-error",
44
+ className: "text-sm"
45
+ }, "Couldn’t reach Unsplash. Retry.") : null, "loading" === status && 0 === results.length ? /*#__PURE__*/ __rspack_external_react.createElement("ul", {
46
+ "data-testid": "ak-unsplash-skeletons",
47
+ className: "grid grid-cols-3 gap-2",
48
+ "aria-hidden": "true"
49
+ }, Array.from({
50
+ length: skeletonCount
51
+ }, (_, index)=>/*#__PURE__*/ __rspack_external_react.createElement("li", {
52
+ key: `skeleton-${index}`,
53
+ className: "aspect-square animate-pulse rounded bg-[var(--ak-studio-muted,#e5e7eb)]"
54
+ }))) : 0 === results.length && "idle" === status ? /*#__PURE__*/ __rspack_external_react.createElement("p", {
55
+ "data-testid": "ak-unsplash-empty",
56
+ className: "p-4 text-center text-sm"
57
+ }, "Search Unsplash to browse photos.") : /*#__PURE__*/ __rspack_external_react.createElement("ul", {
58
+ "data-testid": "ak-unsplash-results",
59
+ className: "grid grid-cols-3 gap-2"
60
+ }, results.map((result)=>/*#__PURE__*/ __rspack_external_react.createElement("li", {
61
+ key: result.id,
62
+ className: "flex flex-col gap-0.5"
63
+ }, /*#__PURE__*/ __rspack_external_react.createElement("button", {
64
+ type: "button",
65
+ "data-unsplash-id": result.id,
66
+ "aria-label": `Insert photo by ${result.photographerName}`,
67
+ className: "overflow-hidden rounded",
68
+ onClick: ()=>void onPick(result.id)
69
+ }, /*#__PURE__*/ __rspack_external_react.createElement("img", {
70
+ src: result.thumbnailUrl,
71
+ alt: `Photo by ${result.photographerName}`,
72
+ className: "aspect-square w-full object-cover",
73
+ loading: "lazy"
74
+ })), /*#__PURE__*/ __rspack_external_react.createElement("p", {
75
+ className: "truncate text-[10px] text-[var(--ak-studio-muted-fg)]"
76
+ }, /*#__PURE__*/ __rspack_external_react.createElement("a", {
77
+ href: result.photographerUrl,
78
+ target: "_blank",
79
+ rel: "noreferrer noopener",
80
+ className: "underline"
81
+ }, result.photographerName), " ", "\xb7", " ", /*#__PURE__*/ __rspack_external_react.createElement("a", {
82
+ href: result.unsplashUrl,
83
+ target: "_blank",
84
+ rel: "noreferrer noopener",
85
+ className: "underline"
86
+ }, "Unsplash"))))), onLoadMore && results.length > 0 ? /*#__PURE__*/ __rspack_external_react.createElement("div", {
87
+ className: "flex justify-center"
88
+ }, /*#__PURE__*/ __rspack_external_react.createElement(Button, {
89
+ type: "button",
90
+ variant: "outline",
91
+ size: "sm",
92
+ disabled: "loading" === status,
93
+ onClick: onLoadMore
94
+ }, "Load more")) : null);
95
+ }
96
+ export { UnsplashPanel };
@@ -176,13 +176,9 @@ function UploadButton({ acceptedMimeTypes, allowMixedScriptHostnames, dataUrlAll
176
176
  function UploadSpinner() {
177
177
  return /*#__PURE__*/ external_react_namespaceObject.createElement("svg", {
178
178
  "aria-hidden": true,
179
+ className: "mr-1.5 inline-block animate-spin",
179
180
  fill: "none",
180
181
  height: 14,
181
- style: {
182
- display: "inline-block",
183
- marginRight: 6,
184
- animation: "spin 1s linear infinite"
185
- },
186
182
  viewBox: "0 0 24 24",
187
183
  width: 14
188
184
  }, /*#__PURE__*/ external_react_namespaceObject.createElement("circle", {
@@ -1,9 +1,16 @@
1
- import type { AssetManagerOptions, UploadResult } from "../types/types.js";
1
+ import type { AssetManagerOptions } from "../types/options.js";
2
+ import type { UploadAdapter, UploadResult } from "../types/types.js";
2
3
  export interface UploadProgressSnapshot {
3
4
  readonly completed: number;
4
5
  readonly total: number;
5
6
  }
6
- export interface UploadButtonProps extends Pick<AssetManagerOptions, "acceptedMimeTypes" | "maxFileSize" | "uploader" | "dataUrlAllowlistOptIn" | "allowMixedScriptHostnames"> {
7
+ export interface UploadButtonProps extends Pick<AssetManagerOptions, "acceptedMimeTypes" | "maxFileSize" | "dataUrlAllowlistOptIn" | "allowMixedScriptHostnames"> {
8
+ /**
9
+ * Binary uploader. Required at the UI boundary even though
10
+ * `AssetManagerOptions.uploader` is optional — the plugin passes the
11
+ * resolved (defaulted) uploader, so the component never sees `undefined`.
12
+ */
13
+ readonly uploader: UploadAdapter;
7
14
  readonly onUploaded?: (asset: UploadResult) => void;
8
15
  readonly onError?: (error: unknown) => void;
9
16
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"UploadButton.d.cts","sourceRoot":"","sources":["../../src/ui/UploadButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG3E,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iBAChB,SAAQ,IAAI,CACX,mBAAmB,EACjB,mBAAmB,GACnB,aAAa,GACb,UAAU,GACV,uBAAuB,GACvB,2BAA2B,CAC7B;IACD,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACpD,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,KAAK,IAAI,CAAC;CACxE;AAED,wBAAgB,YAAY,CAAC,EAC5B,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,WAAW,EACX,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,GACR,EAAE,iBAAiB,2CA6KnB"}
1
+ {"version":3,"file":"UploadButton.d.cts","sourceRoot":"","sources":["../../src/ui/UploadButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGrE,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iBAChB,SAAQ,IAAI,CACX,mBAAmB,EACjB,mBAAmB,GACnB,aAAa,GACb,uBAAuB,GACvB,2BAA2B,CAC7B;IACD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACpD,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,KAAK,IAAI,CAAC;CACxE;AAED,wBAAgB,YAAY,CAAC,EAC5B,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,WAAW,EACX,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,GACR,EAAE,iBAAiB,2CAgLnB"}
@@ -1,9 +1,16 @@
1
- import type { AssetManagerOptions, UploadResult } from "../types/types.js";
1
+ import type { AssetManagerOptions } from "../types/options.js";
2
+ import type { UploadAdapter, UploadResult } from "../types/types.js";
2
3
  export interface UploadProgressSnapshot {
3
4
  readonly completed: number;
4
5
  readonly total: number;
5
6
  }
6
- export interface UploadButtonProps extends Pick<AssetManagerOptions, "acceptedMimeTypes" | "maxFileSize" | "uploader" | "dataUrlAllowlistOptIn" | "allowMixedScriptHostnames"> {
7
+ export interface UploadButtonProps extends Pick<AssetManagerOptions, "acceptedMimeTypes" | "maxFileSize" | "dataUrlAllowlistOptIn" | "allowMixedScriptHostnames"> {
8
+ /**
9
+ * Binary uploader. Required at the UI boundary even though
10
+ * `AssetManagerOptions.uploader` is optional — the plugin passes the
11
+ * resolved (defaulted) uploader, so the component never sees `undefined`.
12
+ */
13
+ readonly uploader: UploadAdapter;
7
14
  readonly onUploaded?: (asset: UploadResult) => void;
8
15
  readonly onError?: (error: unknown) => void;
9
16
  /**