@edhspace/ui 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 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,50 @@
1
- # Temporary Holding Version
1
+ # @edhspace/ui
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
+ Lightweight React 19 components for panels, card lists, mana symbols, and forms.
4
+ Use them with the EDHspace SDK or in a standalone React application.
5
+
6
+ ```tsx
7
+ import { CardList, PanelLayout, Notice } from "@edhspace/ui";
8
+ import "@edhspace/ui/styles.css";
9
+
10
+ <PanelLayout title={deck.name}>
11
+ {error && <Notice error>{error.message}</Notice>}
12
+ <CardList cards={deck.cards} onInspect={inspectCard} />
13
+ </PanelLayout>;
14
+ ```
15
+
16
+ Exports include PanelLayout/Panel, CardList, CardPreview, ManaCost, SymbolText,
17
+ StatBadge, FilterBar, EmptyState, ActionPanel, DataTable, Button, Field, Notice
18
+ and ActionBar, plus the host-controlled ApiRequestDialog. The host injects shared hover anchors/native galleries through
19
+ CardPreviewProvider; standalone consumers get an explicit inspection button.
20
+ Presentation never grants access or performs privileged actions itself.
21
+
22
+ ApiRequestDialog displays the requesting extension, destination, method and
23
+ outgoing data. Its host supplies `onAccept(remember)` and `onCancel`; GET offers
24
+ session consent, while POST has no remember option. Native dialog behavior keeps
25
+ focus inside, focuses Cancel initially, and supports Escape. The component does
26
+ not make requests or grant permissions.
27
+
28
+ Styles are opt-in and namespaced. Native usage inherits live `--set-*` tokens;
29
+ standalone ThemeProvider accepts background, foreground, muted, accent, border
30
+ and font. No theme reopen or animation is required. Mana images use
31
+ `https://svgs.scryfall.io`; hosting CSP must permit that image origin.
32
+
33
+ Controls have 44px targets, visible focus, wrapper-based gaps and wrapping.
34
+ Fields associate labels with inputs; Notice announces status/errors.
35
+ ActionPanel supports arrow/Home/End navigation across enabled buttons while
36
+ preserving Tab. DataTable retains semantic headers and local horizontal scrolling.
37
+
38
+ ## Source layout
39
+
40
+ Keep one React component per file in `src/components/`, including providers and
41
+ internal symbol rendering. Shared React contexts belong in `src/contexts/`;
42
+ shared data types belong in `src/types/`. Components import siblings directly,
43
+ not through the barrel. `src/components/index.ts` defines the public exports and
44
+ `src/index.ts` reexports them for `@edhspace/ui` consumer imports.
45
+ The existing `Panel` and `PanelLayout` names refer to the same component.
46
+
47
+ Run `npm run build`, `npm run typecheck`, and `npm test` in this directory.
48
+ Build emits ESM/CommonJS, declarations and `dist/styles.css`; React remains a peer.
49
+ Native hosts must deduplicate React/React DOM across linked packages.
50
+ `npm pack --dry-run` inspects distributable files without publication.
package/dist/index.cjs ADDED
@@ -0,0 +1,353 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ ActionBar: () => ActionBar,
24
+ ActionPanel: () => ActionPanel,
25
+ ApiRequestDialog: () => ApiRequestDialog,
26
+ Button: () => Button,
27
+ CardList: () => CardList,
28
+ CardPreview: () => CardPreview,
29
+ CardPreviewProvider: () => CardPreviewProvider,
30
+ DataTable: () => DataTable,
31
+ EmptyState: () => EmptyState,
32
+ Field: () => Field,
33
+ FilterBar: () => FilterBar,
34
+ ManaCost: () => ManaCost,
35
+ Notice: () => Notice,
36
+ Panel: () => Panel,
37
+ PanelLayout: () => Panel,
38
+ StatBadge: () => StatBadge,
39
+ SymbolText: () => SymbolText,
40
+ ThemeProvider: () => ThemeProvider
41
+ });
42
+ module.exports = __toCommonJS(index_exports);
43
+
44
+ // src/components/theme-provider.tsx
45
+ var import_jsx_runtime = require("react/jsx-runtime");
46
+ function ThemeProvider({ theme, children }) {
47
+ const style = {
48
+ "--edhspace-background": theme.background,
49
+ "--edhspace-foreground": theme.foreground,
50
+ "--edhspace-muted": theme.muted,
51
+ "--edhspace-accent": theme.accent,
52
+ "--edhspace-border": theme.border,
53
+ "--edhspace-font": theme.font
54
+ };
55
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "edhspace-ui", style, children });
56
+ }
57
+
58
+ // src/components/panel.tsx
59
+ var import_jsx_runtime2 = require("react/jsx-runtime");
60
+ function Panel({
61
+ title,
62
+ children,
63
+ actions
64
+ }) {
65
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "edhspace-panel", children: [
66
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("header", { children: [
67
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: title }),
68
+ actions
69
+ ] }),
70
+ children
71
+ ] });
72
+ }
73
+
74
+ // src/components/action-bar.tsx
75
+ var import_jsx_runtime3 = require("react/jsx-runtime");
76
+ function ActionBar({ children, label }) {
77
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "edhspace-actions", role: "group", "aria-label": label, children });
78
+ }
79
+
80
+ // src/components/button.tsx
81
+ var import_jsx_runtime4 = require("react/jsx-runtime");
82
+ function Button({ type = "button", className = "", ...props }) {
83
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { ...props, type, className: `edhspace-button ${className}`.trim() });
84
+ }
85
+
86
+ // src/components/field.tsx
87
+ var import_react = require("react");
88
+ var import_jsx_runtime5 = require("react/jsx-runtime");
89
+ function Field({ label, ...props }) {
90
+ const id = (0, import_react.useId)();
91
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "edhspace-field", htmlFor: props.id ?? id, children: [
92
+ label,
93
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { ...props, id: props.id ?? id })
94
+ ] });
95
+ }
96
+
97
+ // src/components/notice.tsx
98
+ var import_jsx_runtime6 = require("react/jsx-runtime");
99
+ function Notice({ children, error = false }) {
100
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "edhspace-notice", role: error ? "alert" : "status", children });
101
+ }
102
+
103
+ // src/components/card-preview.tsx
104
+ var import_react3 = require("react");
105
+
106
+ // src/contexts/card-preview.ts
107
+ var import_react2 = require("react");
108
+ var CardPreviewContext = (0, import_react2.createContext)(void 0);
109
+
110
+ // src/components/card-preview.tsx
111
+ var import_jsx_runtime7 = require("react/jsx-runtime");
112
+ function CardPreview({ card, onInspect }) {
113
+ const Renderer = (0, import_react3.useContext)(CardPreviewContext);
114
+ return Renderer ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Renderer, { card, onInspect }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { onClick: onInspect, children: card.name });
115
+ }
116
+
117
+ // src/components/symbol.tsx
118
+ var import_react4 = require("react");
119
+ var import_jsx_runtime8 = require("react/jsx-runtime");
120
+ function Symbol2({ token, labeled = false }) {
121
+ const [failed, setFailed] = (0, import_react4.useState)(false);
122
+ const name = token.slice(1, -1).replaceAll("/", "");
123
+ return failed ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: token }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
124
+ "img",
125
+ {
126
+ src: `https://svgs.scryfall.io/card-symbols/${encodeURIComponent(name)}.svg`,
127
+ alt: labeled ? token : "",
128
+ width: "16",
129
+ height: "16",
130
+ loading: "lazy",
131
+ onError: () => setFailed(true)
132
+ }
133
+ );
134
+ }
135
+
136
+ // src/components/mana-cost.tsx
137
+ var import_jsx_runtime9 = require("react/jsx-runtime");
138
+ function ManaCost({ cost, title = cost }) {
139
+ if (!cost) return null;
140
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "mana-cost", role: "img", "aria-label": `Mana cost ${cost}`, title, children: cost.split(/(\{[^}]+\})/g).filter(Boolean).map(
141
+ (part, index) => part.startsWith("{") && part.endsWith("}") ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Symbol2, { token: part }, `${index}:${part}`) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: part }, index)
142
+ ) });
143
+ }
144
+
145
+ // src/components/card-list.tsx
146
+ var import_jsx_runtime10 = require("react/jsx-runtime");
147
+ function CardList({
148
+ cards,
149
+ onInspect,
150
+ label = "Cards"
151
+ }) {
152
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "edhspace-card-list", "aria-label": label, children: cards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { children: [
153
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-label": `${card.quantity} copies`, children: card.quantity }),
154
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CardPreview, { card, onInspect: () => onInspect(card) }),
155
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ManaCost, { cost: card.manaCost })
156
+ ] }, card.id)) });
157
+ }
158
+
159
+ // src/components/card-preview-provider.tsx
160
+ var import_jsx_runtime11 = require("react/jsx-runtime");
161
+ function CardPreviewProvider({
162
+ renderer,
163
+ children
164
+ }) {
165
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CardPreviewContext.Provider, { value: renderer, children });
166
+ }
167
+
168
+ // src/components/stat-badge.tsx
169
+ var import_jsx_runtime12 = require("react/jsx-runtime");
170
+ function StatBadge({ label, value }) {
171
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "edhspace-stat", children: [
172
+ label,
173
+ ": ",
174
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: value })
175
+ ] });
176
+ }
177
+
178
+ // src/components/filter-bar.tsx
179
+ var import_jsx_runtime13 = require("react/jsx-runtime");
180
+ function FilterBar({ label, children }) {
181
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "edhspace-filter-bar", role: "group", "aria-label": label, children });
182
+ }
183
+
184
+ // src/components/empty-state.tsx
185
+ var import_jsx_runtime14 = require("react/jsx-runtime");
186
+ function EmptyState({
187
+ title,
188
+ children,
189
+ action
190
+ }) {
191
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "edhspace-empty", role: "status", children: [
192
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { children: title }),
193
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children }),
194
+ action
195
+ ] });
196
+ }
197
+
198
+ // src/components/action-panel.tsx
199
+ var import_jsx_runtime15 = require("react/jsx-runtime");
200
+ function ActionPanel({ label, children }) {
201
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
202
+ "div",
203
+ {
204
+ className: "edhspace-actions",
205
+ role: "toolbar",
206
+ "aria-label": label,
207
+ onKeyDown: (event) => {
208
+ if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
209
+ const controls = Array.from(
210
+ event.currentTarget.querySelectorAll("button:not(:disabled)")
211
+ );
212
+ const index = controls.findIndex((control) => control === event.target);
213
+ if (index < 0 || !controls.length) return;
214
+ event.preventDefault();
215
+ const next = event.key === "Home" ? 0 : event.key === "End" ? controls.length - 1 : (index + (event.key === "ArrowRight" ? 1 : -1) + controls.length) % controls.length;
216
+ controls[next].focus();
217
+ },
218
+ children
219
+ }
220
+ );
221
+ }
222
+
223
+ // src/components/data-table.tsx
224
+ var import_jsx_runtime16 = require("react/jsx-runtime");
225
+ function DataTable({
226
+ rows,
227
+ columns,
228
+ rowId,
229
+ label
230
+ }) {
231
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "edhspace-table-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("table", { "aria-label": label, children: [
232
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tr", { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("th", { scope: "col", children: column.title }, column.id)) }) }),
233
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tbody", { children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tr", { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("td", { children: column.render(row) }, column.id)) }, rowId(row))) })
234
+ ] }) });
235
+ }
236
+
237
+ // src/components/symbol-text.tsx
238
+ var import_jsx_runtime17 = require("react/jsx-runtime");
239
+ function SymbolText({ text }) {
240
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children: text?.split(/(\{[^}]+\})/g).map(
241
+ (part, index) => /^\{[^}]+\}$/.test(part) ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "oracle-symbol", title: part, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Symbol2, { token: part, labeled: true }) }, `${index}:${part}`) : part
242
+ ) });
243
+ }
244
+
245
+ // src/components/api-request-dialog.tsx
246
+ var import_react5 = require("react");
247
+ var import_jsx_runtime18 = require("react/jsx-runtime");
248
+ function ApiRequestDialog({
249
+ extension,
250
+ url,
251
+ method,
252
+ data,
253
+ onAccept,
254
+ onCancel
255
+ }) {
256
+ const dialog = (0, import_react5.useRef)(null);
257
+ const cancel = (0, import_react5.useRef)(null);
258
+ const title = (0, import_react5.useId)();
259
+ const description = (0, import_react5.useId)();
260
+ const [remember, setRemember] = (0, import_react5.useState)(false);
261
+ (0, import_react5.useEffect)(() => {
262
+ const element = dialog.current;
263
+ const previous = element?.ownerDocument.activeElement;
264
+ element?.showModal();
265
+ cancel.current?.focus();
266
+ return () => {
267
+ element?.close();
268
+ if (previous instanceof HTMLElement && previous.isConnected) previous.focus();
269
+ };
270
+ }, []);
271
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
272
+ "dialog",
273
+ {
274
+ ref: dialog,
275
+ className: "edhspace-api-dialog",
276
+ "aria-labelledby": title,
277
+ "aria-describedby": description,
278
+ onCancel: (event) => {
279
+ event.preventDefault();
280
+ onCancel();
281
+ },
282
+ onKeyDown: (event) => {
283
+ if (event.key !== "Tab") return;
284
+ const controls = Array.from(
285
+ event.currentTarget.querySelectorAll(
286
+ 'button:not([disabled]), input:not([disabled]), [tabindex="0"]'
287
+ )
288
+ );
289
+ const first = controls[0];
290
+ const last = controls[controls.length - 1];
291
+ const active = event.currentTarget.ownerDocument.activeElement;
292
+ if (event.shiftKey && active === first) {
293
+ event.preventDefault();
294
+ last?.focus();
295
+ } else if (!event.shiftKey && active === last) {
296
+ event.preventDefault();
297
+ first?.focus();
298
+ }
299
+ },
300
+ children: [
301
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { id: title, children: "Allow API request?" }),
302
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { id: description, children: [
303
+ extension,
304
+ " will send the shown data to this service."
305
+ ] }),
306
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("dl", { children: [
307
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("dt", { children: "Request" }),
308
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("dd", { children: method }),
309
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("dt", { children: "Destination" }),
310
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("dd", { children: url })
311
+ ] }),
312
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("pre", { "aria-label": "Request data", tabIndex: 0, children: data }),
313
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: "EDHspace cookies and account credentials are not sent." }),
314
+ method === "GET" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "edhspace-api-remember", children: [
315
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
316
+ "input",
317
+ {
318
+ type: "checkbox",
319
+ checked: remember,
320
+ onChange: (event) => setRemember(event.target.checked)
321
+ }
322
+ ),
323
+ "Allow GET requests to this API for this session"
324
+ ] }),
325
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ActionBar, { label: "API request approval", children: [
326
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { ref: cancel, onClick: onCancel, children: "Cancel" }),
327
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { onClick: () => onAccept(remember), children: "Allow request" })
328
+ ] })
329
+ ]
330
+ }
331
+ );
332
+ }
333
+ // Annotate the CommonJS export names for ESM import in node:
334
+ 0 && (module.exports = {
335
+ ActionBar,
336
+ ActionPanel,
337
+ ApiRequestDialog,
338
+ Button,
339
+ CardList,
340
+ CardPreview,
341
+ CardPreviewProvider,
342
+ DataTable,
343
+ EmptyState,
344
+ Field,
345
+ FilterBar,
346
+ ManaCost,
347
+ Notice,
348
+ Panel,
349
+ PanelLayout,
350
+ StatBadge,
351
+ SymbolText,
352
+ ThemeProvider
353
+ });
@@ -0,0 +1,114 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, ComponentProps, ComponentType } from 'react';
3
+
4
+ type Theme = {
5
+ background: string;
6
+ foreground: string;
7
+ muted: string;
8
+ accent: string;
9
+ border: string;
10
+ font: string;
11
+ };
12
+ declare function ThemeProvider({ theme, children }: {
13
+ theme: Theme;
14
+ children: ReactNode;
15
+ }): react.JSX.Element;
16
+
17
+ declare function Panel({ title, children, actions, }: {
18
+ title: string;
19
+ children: ReactNode;
20
+ actions?: ReactNode;
21
+ }): react.JSX.Element;
22
+
23
+ declare function ActionBar({ children, label }: {
24
+ children: ReactNode;
25
+ label: string;
26
+ }): react.JSX.Element;
27
+
28
+ declare function Button({ type, className, ...props }: ComponentProps<"button">): react.JSX.Element;
29
+
30
+ declare function Field({ label, ...props }: ComponentProps<"input"> & {
31
+ label: string;
32
+ }): react.JSX.Element;
33
+
34
+ declare function Notice({ children, error }: {
35
+ children: ReactNode;
36
+ error?: boolean;
37
+ }): react.JSX.Element;
38
+
39
+ type CardListItem = {
40
+ id: string;
41
+ name: string;
42
+ quantity: number;
43
+ manaCost?: string;
44
+ };
45
+
46
+ declare function CardList<T extends CardListItem>({ cards, onInspect, label, }: {
47
+ cards: readonly T[];
48
+ onInspect(card: T): void;
49
+ label?: string;
50
+ }): react.JSX.Element;
51
+
52
+ type PreviewProps = {
53
+ card: CardListItem;
54
+ onInspect(): void;
55
+ };
56
+
57
+ declare function CardPreviewProvider({ renderer, children, }: {
58
+ renderer: ComponentType<PreviewProps>;
59
+ children: ReactNode;
60
+ }): react.JSX.Element;
61
+
62
+ declare function CardPreview({ card, onInspect }: PreviewProps): react.JSX.Element;
63
+
64
+ declare function StatBadge({ label, value }: {
65
+ label: string;
66
+ value: ReactNode;
67
+ }): react.JSX.Element;
68
+
69
+ declare function FilterBar({ label, children }: {
70
+ label: string;
71
+ children: ReactNode;
72
+ }): react.JSX.Element;
73
+
74
+ declare function EmptyState({ title, children, action, }: {
75
+ title: string;
76
+ children: ReactNode;
77
+ action?: ReactNode;
78
+ }): react.JSX.Element;
79
+
80
+ declare function ActionPanel({ label, children }: {
81
+ label: string;
82
+ children: ReactNode;
83
+ }): react.JSX.Element;
84
+
85
+ declare function DataTable<T>({ rows, columns, rowId, label, }: {
86
+ rows: readonly T[];
87
+ columns: readonly {
88
+ id: string;
89
+ title: string;
90
+ render(row: T): ReactNode;
91
+ }[];
92
+ rowId(row: T): string;
93
+ label: string;
94
+ }): react.JSX.Element;
95
+
96
+ declare function ManaCost({ cost, title }: {
97
+ cost?: string;
98
+ title?: string;
99
+ }): react.JSX.Element | null;
100
+
101
+ declare function SymbolText({ text }: {
102
+ text: string | null | undefined;
103
+ }): react.JSX.Element;
104
+
105
+ declare function ApiRequestDialog({ extension, url, method, data, onAccept, onCancel, }: {
106
+ extension: string;
107
+ url: string;
108
+ method: "GET" | "POST";
109
+ data: string;
110
+ onAccept(remember: boolean): void;
111
+ onCancel(): void;
112
+ }): react.JSX.Element;
113
+
114
+ export { ActionBar, ActionPanel, ApiRequestDialog, Button, CardList, type CardListItem, CardPreview, CardPreviewProvider, DataTable, EmptyState, Field, FilterBar, ManaCost, Notice, Panel, Panel as PanelLayout, StatBadge, SymbolText, type Theme, ThemeProvider };
@@ -0,0 +1,114 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, ComponentProps, ComponentType } from 'react';
3
+
4
+ type Theme = {
5
+ background: string;
6
+ foreground: string;
7
+ muted: string;
8
+ accent: string;
9
+ border: string;
10
+ font: string;
11
+ };
12
+ declare function ThemeProvider({ theme, children }: {
13
+ theme: Theme;
14
+ children: ReactNode;
15
+ }): react.JSX.Element;
16
+
17
+ declare function Panel({ title, children, actions, }: {
18
+ title: string;
19
+ children: ReactNode;
20
+ actions?: ReactNode;
21
+ }): react.JSX.Element;
22
+
23
+ declare function ActionBar({ children, label }: {
24
+ children: ReactNode;
25
+ label: string;
26
+ }): react.JSX.Element;
27
+
28
+ declare function Button({ type, className, ...props }: ComponentProps<"button">): react.JSX.Element;
29
+
30
+ declare function Field({ label, ...props }: ComponentProps<"input"> & {
31
+ label: string;
32
+ }): react.JSX.Element;
33
+
34
+ declare function Notice({ children, error }: {
35
+ children: ReactNode;
36
+ error?: boolean;
37
+ }): react.JSX.Element;
38
+
39
+ type CardListItem = {
40
+ id: string;
41
+ name: string;
42
+ quantity: number;
43
+ manaCost?: string;
44
+ };
45
+
46
+ declare function CardList<T extends CardListItem>({ cards, onInspect, label, }: {
47
+ cards: readonly T[];
48
+ onInspect(card: T): void;
49
+ label?: string;
50
+ }): react.JSX.Element;
51
+
52
+ type PreviewProps = {
53
+ card: CardListItem;
54
+ onInspect(): void;
55
+ };
56
+
57
+ declare function CardPreviewProvider({ renderer, children, }: {
58
+ renderer: ComponentType<PreviewProps>;
59
+ children: ReactNode;
60
+ }): react.JSX.Element;
61
+
62
+ declare function CardPreview({ card, onInspect }: PreviewProps): react.JSX.Element;
63
+
64
+ declare function StatBadge({ label, value }: {
65
+ label: string;
66
+ value: ReactNode;
67
+ }): react.JSX.Element;
68
+
69
+ declare function FilterBar({ label, children }: {
70
+ label: string;
71
+ children: ReactNode;
72
+ }): react.JSX.Element;
73
+
74
+ declare function EmptyState({ title, children, action, }: {
75
+ title: string;
76
+ children: ReactNode;
77
+ action?: ReactNode;
78
+ }): react.JSX.Element;
79
+
80
+ declare function ActionPanel({ label, children }: {
81
+ label: string;
82
+ children: ReactNode;
83
+ }): react.JSX.Element;
84
+
85
+ declare function DataTable<T>({ rows, columns, rowId, label, }: {
86
+ rows: readonly T[];
87
+ columns: readonly {
88
+ id: string;
89
+ title: string;
90
+ render(row: T): ReactNode;
91
+ }[];
92
+ rowId(row: T): string;
93
+ label: string;
94
+ }): react.JSX.Element;
95
+
96
+ declare function ManaCost({ cost, title }: {
97
+ cost?: string;
98
+ title?: string;
99
+ }): react.JSX.Element | null;
100
+
101
+ declare function SymbolText({ text }: {
102
+ text: string | null | undefined;
103
+ }): react.JSX.Element;
104
+
105
+ declare function ApiRequestDialog({ extension, url, method, data, onAccept, onCancel, }: {
106
+ extension: string;
107
+ url: string;
108
+ method: "GET" | "POST";
109
+ data: string;
110
+ onAccept(remember: boolean): void;
111
+ onCancel(): void;
112
+ }): react.JSX.Element;
113
+
114
+ export { ActionBar, ActionPanel, ApiRequestDialog, Button, CardList, type CardListItem, CardPreview, CardPreviewProvider, DataTable, EmptyState, Field, FilterBar, ManaCost, Notice, Panel, Panel as PanelLayout, StatBadge, SymbolText, type Theme, ThemeProvider };
package/dist/index.js ADDED
@@ -0,0 +1,309 @@
1
+ // src/components/theme-provider.tsx
2
+ import { jsx } from "react/jsx-runtime";
3
+ function ThemeProvider({ theme, children }) {
4
+ const style = {
5
+ "--edhspace-background": theme.background,
6
+ "--edhspace-foreground": theme.foreground,
7
+ "--edhspace-muted": theme.muted,
8
+ "--edhspace-accent": theme.accent,
9
+ "--edhspace-border": theme.border,
10
+ "--edhspace-font": theme.font
11
+ };
12
+ return /* @__PURE__ */ jsx("div", { className: "edhspace-ui", style, children });
13
+ }
14
+
15
+ // src/components/panel.tsx
16
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
17
+ function Panel({
18
+ title,
19
+ children,
20
+ actions
21
+ }) {
22
+ return /* @__PURE__ */ jsxs("section", { className: "edhspace-panel", children: [
23
+ /* @__PURE__ */ jsxs("header", { children: [
24
+ /* @__PURE__ */ jsx2("h2", { children: title }),
25
+ actions
26
+ ] }),
27
+ children
28
+ ] });
29
+ }
30
+
31
+ // src/components/action-bar.tsx
32
+ import { jsx as jsx3 } from "react/jsx-runtime";
33
+ function ActionBar({ children, label }) {
34
+ return /* @__PURE__ */ jsx3("div", { className: "edhspace-actions", role: "group", "aria-label": label, children });
35
+ }
36
+
37
+ // src/components/button.tsx
38
+ import { jsx as jsx4 } from "react/jsx-runtime";
39
+ function Button({ type = "button", className = "", ...props }) {
40
+ return /* @__PURE__ */ jsx4("button", { ...props, type, className: `edhspace-button ${className}`.trim() });
41
+ }
42
+
43
+ // src/components/field.tsx
44
+ import { useId } from "react";
45
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
46
+ function Field({ label, ...props }) {
47
+ const id = useId();
48
+ return /* @__PURE__ */ jsxs2("label", { className: "edhspace-field", htmlFor: props.id ?? id, children: [
49
+ label,
50
+ /* @__PURE__ */ jsx5("input", { ...props, id: props.id ?? id })
51
+ ] });
52
+ }
53
+
54
+ // src/components/notice.tsx
55
+ import { jsx as jsx6 } from "react/jsx-runtime";
56
+ function Notice({ children, error = false }) {
57
+ return /* @__PURE__ */ jsx6("p", { className: "edhspace-notice", role: error ? "alert" : "status", children });
58
+ }
59
+
60
+ // src/components/card-preview.tsx
61
+ import { useContext } from "react";
62
+
63
+ // src/contexts/card-preview.ts
64
+ import { createContext } from "react";
65
+ var CardPreviewContext = createContext(void 0);
66
+
67
+ // src/components/card-preview.tsx
68
+ import { jsx as jsx7 } from "react/jsx-runtime";
69
+ function CardPreview({ card, onInspect }) {
70
+ const Renderer = useContext(CardPreviewContext);
71
+ return Renderer ? /* @__PURE__ */ jsx7(Renderer, { card, onInspect }) : /* @__PURE__ */ jsx7(Button, { onClick: onInspect, children: card.name });
72
+ }
73
+
74
+ // src/components/symbol.tsx
75
+ import { useState } from "react";
76
+ import { jsx as jsx8 } from "react/jsx-runtime";
77
+ function Symbol({ token, labeled = false }) {
78
+ const [failed, setFailed] = useState(false);
79
+ const name = token.slice(1, -1).replaceAll("/", "");
80
+ return failed ? /* @__PURE__ */ jsx8("span", { children: token }) : /* @__PURE__ */ jsx8(
81
+ "img",
82
+ {
83
+ src: `https://svgs.scryfall.io/card-symbols/${encodeURIComponent(name)}.svg`,
84
+ alt: labeled ? token : "",
85
+ width: "16",
86
+ height: "16",
87
+ loading: "lazy",
88
+ onError: () => setFailed(true)
89
+ }
90
+ );
91
+ }
92
+
93
+ // src/components/mana-cost.tsx
94
+ import { jsx as jsx9 } from "react/jsx-runtime";
95
+ function ManaCost({ cost, title = cost }) {
96
+ if (!cost) return null;
97
+ return /* @__PURE__ */ jsx9("span", { className: "mana-cost", role: "img", "aria-label": `Mana cost ${cost}`, title, children: cost.split(/(\{[^}]+\})/g).filter(Boolean).map(
98
+ (part, index) => part.startsWith("{") && part.endsWith("}") ? /* @__PURE__ */ jsx9(Symbol, { token: part }, `${index}:${part}`) : /* @__PURE__ */ jsx9("span", { children: part }, index)
99
+ ) });
100
+ }
101
+
102
+ // src/components/card-list.tsx
103
+ import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
104
+ function CardList({
105
+ cards,
106
+ onInspect,
107
+ label = "Cards"
108
+ }) {
109
+ return /* @__PURE__ */ jsx10("ul", { className: "edhspace-card-list", "aria-label": label, children: cards.map((card) => /* @__PURE__ */ jsxs3("li", { children: [
110
+ /* @__PURE__ */ jsx10("span", { "aria-label": `${card.quantity} copies`, children: card.quantity }),
111
+ /* @__PURE__ */ jsx10(CardPreview, { card, onInspect: () => onInspect(card) }),
112
+ /* @__PURE__ */ jsx10(ManaCost, { cost: card.manaCost })
113
+ ] }, card.id)) });
114
+ }
115
+
116
+ // src/components/card-preview-provider.tsx
117
+ import { jsx as jsx11 } from "react/jsx-runtime";
118
+ function CardPreviewProvider({
119
+ renderer,
120
+ children
121
+ }) {
122
+ return /* @__PURE__ */ jsx11(CardPreviewContext.Provider, { value: renderer, children });
123
+ }
124
+
125
+ // src/components/stat-badge.tsx
126
+ import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
127
+ function StatBadge({ label, value }) {
128
+ return /* @__PURE__ */ jsxs4("span", { className: "edhspace-stat", children: [
129
+ label,
130
+ ": ",
131
+ /* @__PURE__ */ jsx12("strong", { children: value })
132
+ ] });
133
+ }
134
+
135
+ // src/components/filter-bar.tsx
136
+ import { jsx as jsx13 } from "react/jsx-runtime";
137
+ function FilterBar({ label, children }) {
138
+ return /* @__PURE__ */ jsx13("div", { className: "edhspace-filter-bar", role: "group", "aria-label": label, children });
139
+ }
140
+
141
+ // src/components/empty-state.tsx
142
+ import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
143
+ function EmptyState({
144
+ title,
145
+ children,
146
+ action
147
+ }) {
148
+ return /* @__PURE__ */ jsxs5("section", { className: "edhspace-empty", role: "status", children: [
149
+ /* @__PURE__ */ jsx14("h3", { children: title }),
150
+ /* @__PURE__ */ jsx14("p", { children }),
151
+ action
152
+ ] });
153
+ }
154
+
155
+ // src/components/action-panel.tsx
156
+ import { jsx as jsx15 } from "react/jsx-runtime";
157
+ function ActionPanel({ label, children }) {
158
+ return /* @__PURE__ */ jsx15(
159
+ "div",
160
+ {
161
+ className: "edhspace-actions",
162
+ role: "toolbar",
163
+ "aria-label": label,
164
+ onKeyDown: (event) => {
165
+ if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
166
+ const controls = Array.from(
167
+ event.currentTarget.querySelectorAll("button:not(:disabled)")
168
+ );
169
+ const index = controls.findIndex((control) => control === event.target);
170
+ if (index < 0 || !controls.length) return;
171
+ event.preventDefault();
172
+ const next = event.key === "Home" ? 0 : event.key === "End" ? controls.length - 1 : (index + (event.key === "ArrowRight" ? 1 : -1) + controls.length) % controls.length;
173
+ controls[next].focus();
174
+ },
175
+ children
176
+ }
177
+ );
178
+ }
179
+
180
+ // src/components/data-table.tsx
181
+ import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
182
+ function DataTable({
183
+ rows,
184
+ columns,
185
+ rowId,
186
+ label
187
+ }) {
188
+ return /* @__PURE__ */ jsx16("div", { className: "edhspace-table-scroll", children: /* @__PURE__ */ jsxs6("table", { "aria-label": label, children: [
189
+ /* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsx16("tr", { children: columns.map((column) => /* @__PURE__ */ jsx16("th", { scope: "col", children: column.title }, column.id)) }) }),
190
+ /* @__PURE__ */ jsx16("tbody", { children: rows.map((row) => /* @__PURE__ */ jsx16("tr", { children: columns.map((column) => /* @__PURE__ */ jsx16("td", { children: column.render(row) }, column.id)) }, rowId(row))) })
191
+ ] }) });
192
+ }
193
+
194
+ // src/components/symbol-text.tsx
195
+ import { Fragment, jsx as jsx17 } from "react/jsx-runtime";
196
+ function SymbolText({ text }) {
197
+ return /* @__PURE__ */ jsx17(Fragment, { children: text?.split(/(\{[^}]+\})/g).map(
198
+ (part, index) => /^\{[^}]+\}$/.test(part) ? /* @__PURE__ */ jsx17("span", { className: "oracle-symbol", title: part, children: /* @__PURE__ */ jsx17(Symbol, { token: part, labeled: true }) }, `${index}:${part}`) : part
199
+ ) });
200
+ }
201
+
202
+ // src/components/api-request-dialog.tsx
203
+ import { useEffect, useId as useId2, useRef, useState as useState2 } from "react";
204
+ import { jsx as jsx18, jsxs as jsxs7 } from "react/jsx-runtime";
205
+ function ApiRequestDialog({
206
+ extension,
207
+ url,
208
+ method,
209
+ data,
210
+ onAccept,
211
+ onCancel
212
+ }) {
213
+ const dialog = useRef(null);
214
+ const cancel = useRef(null);
215
+ const title = useId2();
216
+ const description = useId2();
217
+ const [remember, setRemember] = useState2(false);
218
+ useEffect(() => {
219
+ const element = dialog.current;
220
+ const previous = element?.ownerDocument.activeElement;
221
+ element?.showModal();
222
+ cancel.current?.focus();
223
+ return () => {
224
+ element?.close();
225
+ if (previous instanceof HTMLElement && previous.isConnected) previous.focus();
226
+ };
227
+ }, []);
228
+ return /* @__PURE__ */ jsxs7(
229
+ "dialog",
230
+ {
231
+ ref: dialog,
232
+ className: "edhspace-api-dialog",
233
+ "aria-labelledby": title,
234
+ "aria-describedby": description,
235
+ onCancel: (event) => {
236
+ event.preventDefault();
237
+ onCancel();
238
+ },
239
+ onKeyDown: (event) => {
240
+ if (event.key !== "Tab") return;
241
+ const controls = Array.from(
242
+ event.currentTarget.querySelectorAll(
243
+ 'button:not([disabled]), input:not([disabled]), [tabindex="0"]'
244
+ )
245
+ );
246
+ const first = controls[0];
247
+ const last = controls[controls.length - 1];
248
+ const active = event.currentTarget.ownerDocument.activeElement;
249
+ if (event.shiftKey && active === first) {
250
+ event.preventDefault();
251
+ last?.focus();
252
+ } else if (!event.shiftKey && active === last) {
253
+ event.preventDefault();
254
+ first?.focus();
255
+ }
256
+ },
257
+ children: [
258
+ /* @__PURE__ */ jsx18("h2", { id: title, children: "Allow API request?" }),
259
+ /* @__PURE__ */ jsxs7("p", { id: description, children: [
260
+ extension,
261
+ " will send the shown data to this service."
262
+ ] }),
263
+ /* @__PURE__ */ jsxs7("dl", { children: [
264
+ /* @__PURE__ */ jsx18("dt", { children: "Request" }),
265
+ /* @__PURE__ */ jsx18("dd", { children: method }),
266
+ /* @__PURE__ */ jsx18("dt", { children: "Destination" }),
267
+ /* @__PURE__ */ jsx18("dd", { children: url })
268
+ ] }),
269
+ /* @__PURE__ */ jsx18("pre", { "aria-label": "Request data", tabIndex: 0, children: data }),
270
+ /* @__PURE__ */ jsx18("p", { children: "EDHspace cookies and account credentials are not sent." }),
271
+ method === "GET" && /* @__PURE__ */ jsxs7("label", { className: "edhspace-api-remember", children: [
272
+ /* @__PURE__ */ jsx18(
273
+ "input",
274
+ {
275
+ type: "checkbox",
276
+ checked: remember,
277
+ onChange: (event) => setRemember(event.target.checked)
278
+ }
279
+ ),
280
+ "Allow GET requests to this API for this session"
281
+ ] }),
282
+ /* @__PURE__ */ jsxs7(ActionBar, { label: "API request approval", children: [
283
+ /* @__PURE__ */ jsx18(Button, { ref: cancel, onClick: onCancel, children: "Cancel" }),
284
+ /* @__PURE__ */ jsx18(Button, { onClick: () => onAccept(remember), children: "Allow request" })
285
+ ] })
286
+ ]
287
+ }
288
+ );
289
+ }
290
+ export {
291
+ ActionBar,
292
+ ActionPanel,
293
+ ApiRequestDialog,
294
+ Button,
295
+ CardList,
296
+ CardPreview,
297
+ CardPreviewProvider,
298
+ DataTable,
299
+ EmptyState,
300
+ Field,
301
+ FilterBar,
302
+ ManaCost,
303
+ Notice,
304
+ Panel,
305
+ Panel as PanelLayout,
306
+ StatBadge,
307
+ SymbolText,
308
+ ThemeProvider
309
+ };
@@ -0,0 +1,238 @@
1
+ .edhspace-ui {
2
+ --edhspace-background: var(--set-panel, #fff);
3
+ --edhspace-foreground: var(--set-text, #182b24);
4
+ --edhspace-muted: var(--set-muted, #485b53);
5
+ --edhspace-accent: var(--set-accent, #245a42);
6
+ --edhspace-border: var(--set-border, #81968b);
7
+ --edhspace-font: inherit;
8
+ min-height: 100%;
9
+ background: var(--edhspace-background);
10
+ color: var(--edhspace-foreground);
11
+ font-family: var(--edhspace-font);
12
+ line-height: 1.5;
13
+ accent-color: var(--edhspace-accent);
14
+ caret-color: var(--edhspace-accent);
15
+ scrollbar-color: var(--edhspace-border) var(--edhspace-background);
16
+ }
17
+ .edhspace-ui *,
18
+ .edhspace-ui *::before,
19
+ .edhspace-ui *::after {
20
+ box-sizing: border-box;
21
+ }
22
+ .edhspace-ui ::selection {
23
+ background: var(--edhspace-accent);
24
+ color: var(--edhspace-background);
25
+ }
26
+ .edhspace-panel {
27
+ padding: 1rem;
28
+ min-width: 0;
29
+ }
30
+ .edhspace-panel > header {
31
+ display: flex;
32
+ flex-wrap: wrap;
33
+ align-items: center;
34
+ gap: 0.65rem;
35
+ margin-bottom: 1rem;
36
+ }
37
+ .edhspace-panel h2 {
38
+ flex: 1 1 12rem;
39
+ font-size: 1.15rem;
40
+ margin: 0;
41
+ overflow-wrap: anywhere;
42
+ }
43
+ .edhspace-actions {
44
+ display: flex;
45
+ flex-wrap: wrap;
46
+ gap: 0.65rem;
47
+ align-items: center;
48
+ }
49
+ .edhspace-ui .edhspace-button,
50
+ .edhspace-ui .edhspace-field input {
51
+ margin: 0;
52
+ min-height: 44px;
53
+ max-width: 100%;
54
+ border: 1px solid var(--edhspace-border);
55
+ border-radius: 6px;
56
+ background: var(--edhspace-background);
57
+ color: var(--edhspace-foreground);
58
+ font: inherit;
59
+ padding: 0.5rem 0.75rem;
60
+ }
61
+ .edhspace-ui .edhspace-button {
62
+ cursor: pointer;
63
+ min-width: 44px;
64
+ overflow-wrap: anywhere;
65
+ }
66
+ .edhspace-ui .edhspace-button:hover:not(:disabled) {
67
+ background: color-mix(in srgb, var(--edhspace-accent) 12%, var(--edhspace-background));
68
+ }
69
+ .edhspace-ui .edhspace-button:disabled,
70
+ .edhspace-ui .edhspace-button[aria-disabled="true"] {
71
+ opacity: 0.55;
72
+ cursor: not-allowed;
73
+ }
74
+ .edhspace-ui :focus-visible {
75
+ outline: 2px solid var(--edhspace-accent);
76
+ outline-offset: 2px;
77
+ }
78
+ .edhspace-ui .edhspace-field {
79
+ display: grid;
80
+ gap: 0.4rem;
81
+ min-width: 0;
82
+ margin: 0;
83
+ }
84
+ .edhspace-notice {
85
+ color: var(--edhspace-muted);
86
+ overflow-wrap: anywhere;
87
+ }
88
+ .edhspace-notice[role="alert"] {
89
+ color: var(--edhspace-foreground);
90
+ font-weight: 600;
91
+ }
92
+ .edhspace-card-list {
93
+ padding: 0;
94
+ margin: 1rem 0;
95
+ list-style: none;
96
+ }
97
+ .edhspace-card-list > li {
98
+ display: flex;
99
+ align-items: center;
100
+ gap: 0.65rem;
101
+ padding: 0.25rem 0;
102
+ border-bottom: 1px solid var(--edhspace-border);
103
+ }
104
+ .edhspace-card-list > li > span:first-child {
105
+ min-width: 2ch;
106
+ font-variant-numeric: tabular-nums;
107
+ }
108
+ .edhspace-card-list .edhspace-button {
109
+ flex: 1;
110
+ min-width: 0;
111
+ border: 0;
112
+ text-align: start;
113
+ }
114
+ .edhspace-ui .mana-cost {
115
+ display: inline-flex;
116
+ flex-wrap: wrap;
117
+ align-items: center;
118
+ gap: 0.12rem;
119
+ max-width: 35%;
120
+ }
121
+ .edhspace-ui .mana-cost img {
122
+ display: block;
123
+ width: 1em;
124
+ height: 1em;
125
+ min-width: 14px;
126
+ min-height: 14px;
127
+ }
128
+ .edhspace-ui .oracle-symbol {
129
+ display: inline-block;
130
+ vertical-align: -0.12em;
131
+ margin-inline: 0.06em;
132
+ }
133
+ .edhspace-ui .oracle-symbol img {
134
+ width: 1em;
135
+ height: 1em;
136
+ }
137
+ .edhspace-filter-bar {
138
+ display: flex;
139
+ flex-wrap: wrap;
140
+ gap: 0.75rem;
141
+ align-items: end;
142
+ margin-block: 1rem;
143
+ }
144
+ .edhspace-filter-bar > * {
145
+ flex: 1 1 9rem;
146
+ }
147
+ .edhspace-filter-bar .edhspace-field input {
148
+ width: 100%;
149
+ }
150
+ .edhspace-stat {
151
+ display: inline-block;
152
+ margin-inline-end: 1rem;
153
+ font-variant-numeric: tabular-nums;
154
+ }
155
+ .edhspace-table-scroll {
156
+ overflow-x: auto;
157
+ margin-block: 1rem;
158
+ }
159
+ .edhspace-table-scroll table {
160
+ width: 100%;
161
+ border-collapse: collapse;
162
+ font-variant-numeric: tabular-nums;
163
+ }
164
+ .edhspace-table-scroll th,
165
+ .edhspace-table-scroll td {
166
+ padding: 0.55rem;
167
+ text-align: start;
168
+ border-bottom: 1px solid var(--edhspace-border);
169
+ }
170
+ .edhspace-card-list .inline-card-link {
171
+ flex: 1;
172
+ min-width: 0;
173
+ min-height: 44px;
174
+ display: inline-flex;
175
+ align-items: center;
176
+ color: var(--edhspace-accent);
177
+ text-underline-offset: 0.2em;
178
+ overflow-wrap: anywhere;
179
+ }
180
+ .edhspace-api-dialog {
181
+ width: min(36rem, calc(100vw - 2rem));
182
+ max-height: calc(100dvh - 2rem);
183
+ overflow: auto;
184
+ padding: 1.25rem;
185
+ border: 1px solid var(--edhspace-border);
186
+ border-radius: 6px;
187
+ background: var(--edhspace-background);
188
+ color: var(--edhspace-foreground);
189
+ font: inherit;
190
+ }
191
+ .edhspace-api-dialog::backdrop {
192
+ background: rgb(0 0 0 / 45%);
193
+ }
194
+ .edhspace-api-dialog:not([open]) {
195
+ display: none;
196
+ }
197
+ .edhspace-api-dialog h2 {
198
+ margin-block: 0 0.75rem;
199
+ font-size: 1.15rem;
200
+ }
201
+ .edhspace-api-dialog dl {
202
+ display: grid;
203
+ grid-template-columns: minmax(0, 1fr);
204
+ gap: 0.4rem 0.75rem;
205
+ }
206
+ .edhspace-api-dialog dt {
207
+ font-weight: 600;
208
+ }
209
+ .edhspace-api-dialog p {
210
+ overflow-wrap: anywhere;
211
+ }
212
+ @media (min-width: 600px) {
213
+ .edhspace-api-dialog dl {
214
+ grid-template-columns: auto minmax(0, 1fr);
215
+ }
216
+ }
217
+ .edhspace-api-dialog dd {
218
+ margin: 0;
219
+ overflow-wrap: anywhere;
220
+ }
221
+ .edhspace-api-dialog pre {
222
+ white-space: pre-wrap;
223
+ overflow-wrap: anywhere;
224
+ max-height: 12rem;
225
+ overflow: auto;
226
+ }
227
+ .edhspace-ui .edhspace-api-remember {
228
+ display: flex;
229
+ gap: 0.65rem;
230
+ align-items: center;
231
+ min-height: 44px;
232
+ margin-block: 1rem;
233
+ }
234
+ .edhspace-api-remember input {
235
+ width: 20px;
236
+ height: 20px;
237
+ flex-shrink: 0;
238
+ }
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
- "name": "@edhspace/ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@edhspace/ui",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Standalone themed React primitives for EDHspace and community extensions",
6
+ "license": "ISC",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/EDHspace/extensions.git",
10
+ "directory": "packages/ui"
11
+ },
12
+ "homepage": "https://github.com/EDHspace/extensions/tree/main/packages/ui#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/EDHspace/extensions/issues"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "registry": "https://registry.npmjs.org/"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md"
23
+ ],
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js",
28
+ "require": "./dist/index.cjs"
29
+ },
30
+ "./styles.css": "./dist/styles.css"
31
+ },
32
+ "sideEffects": [
33
+ "*.css"
34
+ ],
35
+ "scripts": {
36
+ "build": "tsup",
37
+ "typecheck": "tsc --noEmit",
38
+ "test": "vitest run"
39
+ },
40
+ "peerDependencies": {
41
+ "react": "^19.0.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/react": "^19.2.18",
45
+ "@types/react-dom": "^19.2.4",
46
+ "react": "^19.2.8",
47
+ "react-dom": "^19.2.8",
48
+ "tsup": "^8.0.0",
49
+ "typescript": "^5.3.3",
50
+ "vitest": "3.2.7"
51
+ },
52
+ "engines": {
53
+ "node": ">=22.12.0"
54
+ }
55
+ }