@edhspace-extension/card-lookup 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +14 -0
- package/README.md +13 -2
- package/assets/icon.svg +1 -0
- package/dist/build.json +42 -0
- package/dist/card-lookup.js +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +69 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) EDHspace contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
6
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
7
|
+
and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
11
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
|
|
12
|
+
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
13
|
+
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
|
14
|
+
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# External card lookup
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An API-connected extension using the SDK and shared UI. Enter a card name and
|
|
4
|
+
choose **Look up card**. The host shows the destination and query before sending
|
|
5
|
+
anything to Scryfall. Cancel leaves the request unsent; an optional GET grant lasts
|
|
6
|
+
only for the current session.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm run dev -- extensions/card-lookup
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The workbench uses synthetic data. This extension sends only the card name you
|
|
13
|
+
enter, never your deck or EDHspace account credentials. Scryfall must allow CORS;
|
|
14
|
+
provider failures appear in the panel. Network requests are not made on mount.
|
package/assets/icon.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="4" y="3" width="12" height="18" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><circle cx="15" cy="10" r="4" fill="none" stroke="currentColor" stroke-width="2"/><path d="m18 13 4 4" stroke="currentColor" stroke-width="2"/></svg>
|
package/dist/build.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest": {
|
|
3
|
+
"id": "edhspace-extension.card-lookup",
|
|
4
|
+
"apiVersion": 1,
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"title": "External card lookup",
|
|
7
|
+
"description": "Look up a card through Scryfall with explicit API request approval.",
|
|
8
|
+
"author": "EDHspace",
|
|
9
|
+
"permissions": [
|
|
10
|
+
"network.request"
|
|
11
|
+
],
|
|
12
|
+
"panels": [
|
|
13
|
+
{
|
|
14
|
+
"id": "card-lookup",
|
|
15
|
+
"title": "External card lookup",
|
|
16
|
+
"location": "workspace"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"commands": [],
|
|
20
|
+
"preferences": [],
|
|
21
|
+
"network": [
|
|
22
|
+
{
|
|
23
|
+
"id": "scryfall",
|
|
24
|
+
"title": "Scryfall card lookup",
|
|
25
|
+
"url": "https://api.scryfall.com/cards/",
|
|
26
|
+
"methods": [
|
|
27
|
+
"GET"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"apiVersion": 1,
|
|
33
|
+
"dependencies": [],
|
|
34
|
+
"licenses": [],
|
|
35
|
+
"artifacts": [
|
|
36
|
+
{
|
|
37
|
+
"file": "card-lookup.js",
|
|
38
|
+
"bytes": 1133,
|
|
39
|
+
"sha256": "5529a2304bd217e1d80d17afde1db857a13cad0be0fdf1558dc6ba366812b389"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as o}from"react";import{useExtension as g}from"@edhspace/api/react";import{Button as k,Field as b,FilterBar as h,Notice as u,Panel as C}from"@edhspace/ui";import{jsx as t,jsxs as p}from"react/jsx-runtime";function E(){let f=g(),[a,m]=o("Sol Ring"),[i,l]=o(),[s,d]=o(),[n,c]=o(!1);async function y(){c(!0),d(void 0),l(void 0);try{let e=(await f.network.request({endpoint:"scryfall",path:"named",query:{exact:a.trim()}})).data;if(!e||typeof e!="object"||Array.isArray(e)||typeof e.name!="string"||typeof e.type_line!="string")throw new Error("Scryfall returned unexpected card data.");l(`${e.name} - ${e.type_line}`)}catch(r){d(r instanceof Error?r.message:"The card lookup failed.")}finally{c(!1)}}return p(C,{title:"External card lookup",children:[p(h,{label:"Card lookup",children:[t(b,{label:"Card name",value:a,onChange:r=>m(r.target.value)}),t(k,{disabled:!a.trim(),"aria-disabled":n,onClick:()=>{n||y()},children:n?"Waiting for lookup...":"Look up card"})]}),t("p",{children:"Your card-name query is sent to Scryfall after approval."}),s&&t(u,{error:!0,children:s}),i&&t(u,{children:i})]})}export{E as default};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CardLookupPanel(): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@edhspace-extension/card-lookup",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/EDHspace/extensions.git",
|
|
9
|
+
"directory": "extensions/card-lookup"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"registry": "https://registry.npmjs.org/"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/EDHspace/extensions/tree/main/extensions/card-lookup#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/EDHspace/extensions/issues"
|
|
18
|
+
},
|
|
19
|
+
"title": "External card lookup",
|
|
20
|
+
"description": "Look up a card through Scryfall with explicit API request approval.",
|
|
21
|
+
"author": "EDHspace",
|
|
22
|
+
"icon": "assets/icon.svg",
|
|
23
|
+
"apiVersion": 1,
|
|
24
|
+
"permissions": [
|
|
25
|
+
"network.request"
|
|
26
|
+
],
|
|
27
|
+
"network": [
|
|
28
|
+
{
|
|
29
|
+
"id": "scryfall",
|
|
30
|
+
"title": "Scryfall card lookup",
|
|
31
|
+
"url": "https://api.scryfall.com/cards/",
|
|
32
|
+
"methods": [
|
|
33
|
+
"GET"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"panels": [
|
|
38
|
+
{
|
|
39
|
+
"id": "card-lookup",
|
|
40
|
+
"title": "External card lookup",
|
|
41
|
+
"entry": "src/index.tsx",
|
|
42
|
+
"location": "workspace"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"files": [
|
|
46
|
+
"dist",
|
|
47
|
+
"assets",
|
|
48
|
+
"README.md"
|
|
49
|
+
],
|
|
50
|
+
"exports": {
|
|
51
|
+
".": {
|
|
52
|
+
"types": "./dist/index.d.ts",
|
|
53
|
+
"import": "./dist/card-lookup.js"
|
|
54
|
+
},
|
|
55
|
+
"./package.json": "./package.json"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "edhspace build .",
|
|
59
|
+
"typecheck": "tsc --noEmit",
|
|
60
|
+
"dev": "edhspace dev ."
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@edhspace/api": "^0.1.0",
|
|
64
|
+
"@edhspace/ui": "^0.1.0",
|
|
65
|
+
"react": "^19.0.0"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@edhspace/devkit": "^0.1.0"
|
|
69
|
+
}
|
|
70
|
+
}
|