@edhspace-extension/mana-curve 0.0.0-stage → 0.2.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 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,26 @@
1
- # Temporary Holding Version
1
+ # Mana curve & draw calculator
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Read-only extension using `@edhspace/api` and `@edhspace/ui`.
4
+ Requests one deck read and permission-gated native card inspection; never saves
5
+ or changes the deck.
6
+
7
+ The curve counts quantities and excludes commanders/land fronts. Draw probability
8
+ uses sampling without replacement and no mulligans. The default model counts the
9
+ library and its land-front cards, excluding commanders; controls can adjust the
10
+ model independently. Invalid inputs remove the result and explain the problem.
11
+
12
+ From the community monorepo root run `npm run build`, then
13
+ `npm run dev -- extensions/mana-curve`. The mock workbench needs no login.
14
+ In EDHspace open Workspace > Extensions with an owned deck and approve access.
15
+
16
+ To test your local changes inside the hosted site without private-source access:
17
+
18
+ ```sh
19
+ npm run build:sideload -- extensions/mana-curve
20
+ ```
21
+
22
+ Open a disposable test deck you own in EDHspace, then Workspace > Extensions > Test an extension.
23
+ In the dialog, choose or drop `extensions/mana-curve/dist/sideload.edhspace-extension.json`
24
+ and approve its permissions. Rebuild and reopen Manage test extension to upload
25
+ your changes. The build is temporary and runs in a sandboxed panel; it is not
26
+ added to the reviewed catalog. See the [sideloading guide](../../README.md#test-inside-edhspace).
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
2
+ <path d="M3 3v18h18M7 17v-4h3v4M12 17V8h3v9M17 17V5h3v12"/>
3
+ </svg>
@@ -0,0 +1,41 @@
1
+ {
2
+ "manifest": {
3
+ "id": "edhspace-extension.mana-curve",
4
+ "apiVersion": 1,
5
+ "version": "0.2.0",
6
+ "title": "Mana curve & draw calculator",
7
+ "description": "Inspect your mana curve and calculate draw probabilities without editing the deck.",
8
+ "author": "EDHspace",
9
+ "permissions": [
10
+ "deck.read",
11
+ "cards.inspect"
12
+ ],
13
+ "panels": [
14
+ {
15
+ "id": "mana-curve",
16
+ "title": "Mana curve & draw calculator",
17
+ "location": "workspace"
18
+ }
19
+ ],
20
+ "commands": [],
21
+ "preferences": [
22
+ {
23
+ "id": "show-cards",
24
+ "title": "Show the deck's card list",
25
+ "type": "boolean",
26
+ "default": true
27
+ }
28
+ ],
29
+ "network": []
30
+ },
31
+ "apiVersion": 1,
32
+ "dependencies": [],
33
+ "licenses": [],
34
+ "artifacts": [
35
+ {
36
+ "file": "mana-curve.js",
37
+ "bytes": 2699,
38
+ "sha256": "89989a732c92634fad1b5d7dbe6327e5d0496e67d3926ed3b5f17aefe057db4f"
39
+ }
40
+ ]
41
+ }
@@ -0,0 +1 @@
1
+ export default function ManaCurvePanel(): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{useEffect as C,useState as g}from"react";import{useActiveDeck as N,useExtension as M}from"@edhspace/api/react";import{drawProbability as P,manaCurve as v}from"@edhspace/api/math";import{ActionPanel as A,Button as k,CardList as B,DataTable as F,EmptyState as x,Field as D,FilterBar as S,Notice as i,PanelLayout as q,StatBadge as w}from"@edhspace/ui";import{Fragment as y,jsx as e,jsxs as n}from"react/jsx-runtime";function I(){let E=M(),{data:t,loading:u,error:m,refresh:L}=N(),[p,b]=g(),[s,h]=g({population:99,successes:38,draws:7,atLeast:2});C(()=>{if(!t)return;let a=t.cards.filter(o=>!o.commander),r=a.reduce((o,d)=>o+d.quantity,0),c=a.filter(o=>/\bLand\b/.test(o.typeLine?.split(/\s*\/\/\s*/)[0]??"")).reduce((o,d)=>o+d.quantity,0);r&&h({population:r,successes:c,draws:Math.min(7,r),atLeast:Math.min(2,r)})},[t?.id,t?.revision]);let f,l="";try{f=P(s)}catch(a){if(!(a instanceof RangeError))throw a;l=a.message}return n(q,{title:t?.name??"Mana curve & draw calculator",actions:e(A,{label:"Calculator actions",children:e(k,{onClick:()=>{L()},disabled:u,children:"Refresh deck"})}),children:[m&&e(i,{error:!0,children:m.message}),p&&e(i,{error:!0,children:p.message}),u&&!t&&e(i,{children:"Loading the approved deck..."}),t&&n(y,{children:[n("p",{children:[e(w,{label:"Cards",value:t.cards.reduce((a,r)=>a+r.quantity,0)}),e(w,{label:"Format",value:t.format})]}),e("h3",{children:"Mana curve"}),e("p",{children:"Excludes commanders and land-front cards. Unknown mana values remain visible."}),v(t.cards).length?e(F,{label:"Mana curve",rows:v(t.cards),rowId:a=>a.manaValue,columns:[{id:"mana",title:"Mana value",render:a=>a.manaValue},{id:"count",title:"Cards",render:a=>a.count}]}):e(x,{title:"No spells to plot",children:"Add nonland cards to your deck to see its curve."})]}),e("h3",{children:"Draw probability"}),e("p",{children:"Without replacement, with no mulligans. Commanders start outside the library. You can adjust this model without editing the deck."}),e(S,{label:"Probability model",children:[["population","Library size"],["successes","Target cards"],["draws","Cards drawn"],["atLeast","Minimum targets"]].map(([a,r])=>e(D,{label:r,type:"number",step:1,min:a==="population"?1:0,max:a==="population"?1e3:s.population,value:Number.isNaN(s[a])?"":s[a],onChange:c=>h(o=>({...o,[a]:c.target.valueAsNumber}))},a))}),l?e(i,{error:!0,children:l}):n("p",{role:"status","aria-live":"polite",children:[n("strong",{children:[(f*100).toFixed(2),"%"]})," chance of drawing at least"," ",s.atLeast," targets."]}),t?.cards.length?n(y,{children:[e("h3",{children:"Deck cards"}),e(B,{cards:t.cards,onInspect:a=>{b(void 0),E.cards.inspect(a.id).catch(r=>b(r))}})]}):null]})}export{I as default};
package/package.json CHANGED
@@ -1,6 +1,70 @@
1
1
  {
2
- "name": "@edhspace-extension/mana-curve",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@edhspace-extension/mana-curve",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "license": "ISC",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/EDHspace/extensions.git",
9
+ "directory": "extensions/mana-curve"
10
+ },
11
+ "homepage": "https://github.com/EDHspace/extensions/tree/main/extensions/mana-curve#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/EDHspace/extensions/issues"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public",
17
+ "registry": "https://registry.npmjs.org/"
18
+ },
19
+ "title": "Mana curve & draw calculator",
20
+ "description": "Inspect your mana curve and calculate draw probabilities without editing the deck.",
21
+ "author": "EDHspace",
22
+ "icon": "assets/icon.svg",
23
+ "apiVersion": 1,
24
+ "permissions": [
25
+ "deck.read",
26
+ "cards.inspect"
27
+ ],
28
+ "panels": [
29
+ {
30
+ "id": "mana-curve",
31
+ "title": "Mana curve & draw calculator",
32
+ "entry": "src/index.tsx",
33
+ "location": "workspace"
34
+ }
35
+ ],
36
+ "commands": [],
37
+ "preferences": [
38
+ {
39
+ "id": "show-cards",
40
+ "title": "Show the deck's card list",
41
+ "type": "boolean",
42
+ "default": true
43
+ }
44
+ ],
45
+ "files": [
46
+ "dist",
47
+ "assets",
48
+ "README.md"
49
+ ],
50
+ "exports": {
51
+ ".": {
52
+ "types": "./dist/index.d.ts",
53
+ "import": "./dist/mana-curve.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.2.0",
64
+ "@edhspace/ui": "^0.2.0",
65
+ "react": "^19.0.0"
66
+ },
67
+ "devDependencies": {
68
+ "@edhspace/devkit": "^0.2.0"
69
+ }
70
+ }