jaml-ui 0.2.0 → 0.3.1

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.
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ const TABS = [
4
+ { id: "code", label: "Code" },
5
+ { id: "map", label: "Map" },
6
+ { id: "results", label: "Results" },
7
+ ];
8
+ export function JamlIdeToolbar({ mode, onModeChange, resultCount = 0, className = "" }) {
9
+ return (_jsx("div", { className: className, style: {
10
+ display: "flex",
11
+ alignItems: "center",
12
+ justifyContent: "space-between",
13
+ gap: 8,
14
+ padding: "8px 10px",
15
+ borderBottom: "1px solid rgba(255,255,255,0.08)",
16
+ background: "rgba(255,255,255,0.04)",
17
+ }, children: _jsx("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: TABS.map((tab) => {
18
+ const selected = mode === tab.id;
19
+ return (_jsxs("button", { type: "button", onClick: () => onModeChange(tab.id), style: {
20
+ cursor: "pointer",
21
+ borderRadius: 8,
22
+ border: selected ? "1px solid rgba(247,185,85,0.55)" : "1px solid transparent",
23
+ background: selected ? "rgba(247,185,85,0.16)" : "transparent",
24
+ color: selected ? "#f7b955" : "rgba(255,255,255,0.58)",
25
+ padding: "6px 10px",
26
+ fontSize: 11,
27
+ fontWeight: 600,
28
+ }, children: [tab.label, tab.id === "results" && resultCount > 0 ? (_jsx("span", { style: {
29
+ marginLeft: 6,
30
+ borderRadius: 999,
31
+ background: "rgba(0,0,0,0.25)",
32
+ padding: "1px 6px",
33
+ fontSize: 10,
34
+ }, children: resultCount })) : null] }, tab.id));
35
+ }) }) }));
36
+ }
@@ -0,0 +1,10 @@
1
+ export interface JamlMapPreviewProps {
2
+ jaml: string;
3
+ className?: string;
4
+ title?: string;
5
+ emptyMessage?: string;
6
+ cardScale?: number;
7
+ tagScale?: number;
8
+ bossScale?: number;
9
+ }
10
+ export declare function JamlMapPreview({ jaml, className, title, emptyMessage, cardScale, tagScale, bossScale, }: JamlMapPreviewProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,117 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useMemo } from "react";
4
+ import { JamlBoss, JamlGameCard, JamlTag, JamlVoucher } from "./GameCard.js";
5
+ import { extractVisualJamlItems } from "../utils/jamlMapPreview.js";
6
+ const SECTION_ORDER = ["must", "should", "mustNot"];
7
+ const SECTION_LABELS = {
8
+ must: "Must Requirements",
9
+ should: "Should Requirements",
10
+ mustNot: "Must Not Requirements",
11
+ };
12
+ const SECTION_ACCENTS = {
13
+ must: { color: "#ff6b6b", border: "rgba(255,107,107,0.35)", panel: "rgba(255,107,107,0.08)" },
14
+ should: { color: "#f7b955", border: "rgba(247,185,85,0.35)", panel: "rgba(247,185,85,0.08)" },
15
+ mustNot: { color: "#8d7dff", border: "rgba(141,125,255,0.35)", panel: "rgba(141,125,255,0.08)" },
16
+ };
17
+ function renderPreviewItem(item, cardScale, tagScale, bossScale) {
18
+ switch (item.visualType) {
19
+ case "joker":
20
+ return _jsx(JamlGameCard, { card: { name: item.value, scale: cardScale }, type: "joker" });
21
+ case "consumable":
22
+ return _jsx(JamlGameCard, { card: { name: item.value, scale: cardScale }, type: "consumable" });
23
+ case "voucher":
24
+ return _jsx(JamlVoucher, { voucherName: item.value, scale: cardScale });
25
+ case "tag":
26
+ return _jsx(JamlTag, { tagName: item.value, scale: tagScale });
27
+ case "boss":
28
+ return _jsx(JamlBoss, { bossName: item.value, scale: bossScale });
29
+ default:
30
+ return null;
31
+ }
32
+ }
33
+ export function JamlMapPreview({ jaml, className = "", title = "JAML Map Preview", emptyMessage = "No visual JAML clauses found yet.", cardScale = 0.8, tagScale = 1.1, bossScale = 1.1, }) {
34
+ const groups = useMemo(() => extractVisualJamlItems(jaml), [jaml]);
35
+ const totalItems = SECTION_ORDER.reduce((sum, section) => sum + groups[section].length, 0);
36
+ return (_jsxs("div", { className: className, style: {
37
+ display: "flex",
38
+ flexDirection: "column",
39
+ gap: 16,
40
+ padding: 16,
41
+ color: "#f5f5f5",
42
+ borderRadius: 20,
43
+ border: "1px solid rgba(152,152,192,0.18)",
44
+ background: "linear-gradient(180deg, rgba(28,26,52,0.96) 0%, rgba(18,16,36,0.96) 100%)",
45
+ boxShadow: "0 14px 32px rgba(0,0,0,0.16)",
46
+ }, children: [_jsxs("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 12, flexWrap: "wrap" }, children: [_jsxs("div", { children: [_jsx("div", { style: { fontSize: 14, fontWeight: 700, marginBottom: 4 }, children: title }), _jsx("div", { style: { fontSize: 12, opacity: 0.74, maxWidth: 520 }, children: "Preview the visual targets described directly in your JAML without running a full search." })] }), _jsxs("div", { style: {
47
+ display: "inline-flex",
48
+ alignItems: "center",
49
+ gap: 6,
50
+ borderRadius: 999,
51
+ border: "1px solid rgba(141,125,255,0.3)",
52
+ background: "rgba(141,125,255,0.12)",
53
+ padding: "6px 10px",
54
+ fontSize: 11,
55
+ fontWeight: 700,
56
+ color: "#c8bcff",
57
+ letterSpacing: "0.04em",
58
+ textTransform: "uppercase",
59
+ }, children: [_jsx("span", { children: totalItems }), _jsx("span", { children: totalItems === 1 ? "visual target" : "visual targets" })] })] }), totalItems === 0 ? (_jsx("div", { style: {
60
+ border: "1px dashed rgba(152,152,192,0.28)",
61
+ borderRadius: 16,
62
+ padding: 16,
63
+ fontSize: 12,
64
+ opacity: 0.72,
65
+ background: "rgba(255,255,255,0.035)",
66
+ }, children: emptyMessage })) : null, SECTION_ORDER.map((section) => {
67
+ const items = groups[section];
68
+ if (items.length === 0)
69
+ return null;
70
+ const accent = SECTION_ACCENTS[section];
71
+ return (_jsxs("section", { style: {
72
+ display: "flex",
73
+ flexDirection: "column",
74
+ gap: 10,
75
+ borderRadius: 18,
76
+ border: `1px solid ${accent.border}`,
77
+ background: `linear-gradient(180deg, ${accent.panel} 0%, rgba(255,255,255,0.02) 100%)`,
78
+ padding: 12,
79
+ }, children: [_jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [_jsx("div", { style: {
80
+ width: 6,
81
+ height: 18,
82
+ borderRadius: 999,
83
+ background: accent.color,
84
+ } }), _jsx("div", { style: { fontSize: 12, fontWeight: 700, color: accent.color }, children: SECTION_LABELS[section] }), _jsx("div", { style: {
85
+ marginLeft: "auto",
86
+ borderRadius: 999,
87
+ padding: "3px 8px",
88
+ fontSize: 10,
89
+ fontWeight: 700,
90
+ color: accent.color,
91
+ background: "rgba(255,255,255,0.04)",
92
+ }, children: items.length })] }), _jsx("div", { style: {
93
+ display: "flex",
94
+ flexWrap: "wrap",
95
+ gap: 12,
96
+ }, children: items.map((item) => (_jsxs("div", { style: {
97
+ display: "flex",
98
+ flexDirection: "column",
99
+ alignItems: "center",
100
+ gap: 8,
101
+ minWidth: 96,
102
+ padding: 12,
103
+ borderRadius: 16,
104
+ border: `1px solid ${accent.border}`,
105
+ background: "rgba(10,10,20,0.24)",
106
+ boxShadow: "inset 0 1px 0 rgba(255,255,255,0.04)",
107
+ }, title: `${item.clauseKey}: ${item.value}`, children: [_jsx("div", { style: { minHeight: 72, display: "flex", alignItems: "center", justifyContent: "center" }, children: renderPreviewItem(item, cardScale, tagScale, bossScale) }), _jsx("div", { style: { fontSize: 11, textAlign: "center", lineHeight: 1.35, fontWeight: 600 }, children: item.value }), _jsx("div", { style: { fontSize: 10, opacity: 0.62, textTransform: "uppercase", letterSpacing: "0.06em" }, children: item.clauseKey })] }, item.id))) })] }, section));
108
+ }), _jsx("div", { style: {
109
+ borderRadius: 16,
110
+ border: "1px dashed rgba(141,125,255,0.28)",
111
+ background: "rgba(141,125,255,0.08)",
112
+ padding: 14,
113
+ fontSize: 11,
114
+ lineHeight: 1.5,
115
+ opacity: 0.84,
116
+ }, children: "This preview shows direct visual targets that can be read from the JAML text itself. Advanced scoring logic, positional constraints, nested groups, and runtime-only search behavior are not fully represented here yet." })] }));
117
+ }
package/dist/index.d.ts CHANGED
@@ -2,5 +2,10 @@ export { JAML_ASSET_FILES, clearJamlAssetBaseUrl, getDefaultJamlAssetUrlMap, res
2
2
  export { Layer, type LayerOptions } from "./render/Layer.js";
3
3
  export { JamlCardRenderer, type JamlCardRendererProps } from "./render/CanvasRenderer.js";
4
4
  export { JamlGameCard, JamlVoucher, JamlTag, JamlBoss, resolveAnalyzerShopItem, type JamlGameCardProps, type AnalyzerShopItem, type AnalyzerResolvedItem, } from "./components/GameCard.js";
5
+ export { AnalyzerExplorer, type AnalyzerAnteView, type AnalyzerBadge, type AnalyzerExplorerProps, type AnalyzerFact, type AnalyzerHighlight, type AnalyzerItem, } from "./components/AnalyzerExplorer.js";
6
+ export { JamlMapPreview, type JamlMapPreviewProps } from "./components/JamlMapPreview.js";
7
+ export { JamlIde, type JamlIdeProps, type JamlIdeSearchResult, } from "./components/JamlIde.js";
8
+ export { JamlIdeToolbar, type JamlIdeMode, type JamlIdeToolbarProps, } from "./components/JamlIdeToolbar.js";
5
9
  export { CardList, type CardListProps } from "./components/CardList.js";
10
+ export { extractVisualJamlItems, type JamlPreviewGroups, type JamlPreviewItem, type JamlPreviewSection, type JamlPreviewVisualType, } from "./utils/jamlMapPreview.js";
6
11
  export { useMotelyStream, type StreamItem, type StreamState } from "./hooks/useShopStream.js";
package/dist/index.js CHANGED
@@ -3,5 +3,10 @@ export { JAML_ASSET_FILES, clearJamlAssetBaseUrl, getDefaultJamlAssetUrlMap, res
3
3
  export { Layer } from "./render/Layer.js";
4
4
  export { JamlCardRenderer } from "./render/CanvasRenderer.js";
5
5
  export { JamlGameCard, JamlVoucher, JamlTag, JamlBoss, resolveAnalyzerShopItem, } from "./components/GameCard.js";
6
+ export { AnalyzerExplorer, } from "./components/AnalyzerExplorer.js";
7
+ export { JamlMapPreview } from "./components/JamlMapPreview.js";
8
+ export { JamlIde, } from "./components/JamlIde.js";
9
+ export { JamlIdeToolbar, } from "./components/JamlIdeToolbar.js";
6
10
  export { CardList } from "./components/CardList.js";
11
+ export { extractVisualJamlItems, } from "./utils/jamlMapPreview.js";
7
12
  export { useMotelyStream } from "./hooks/useShopStream.js";
package/dist/motely.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { decodeMotelyItem, decodeMotelyItemToJamlCard, motelyItemTypeName, motelyItemCategory, motelyItemDisplayName, motelyItemRenderCategory, motelyItemEditionName, motelyItemSealName, motelyItemEnhancementName, motelyPlayingCardRankName, motelyPlayingCardSuitName, decodeMotelyItemName, resolveMotelyItemType, warmMotelyItemCache, motelyItemCacheSize, type DecodedMotelyItem, type MotelyItemInput, type MotelyJamlCard, type MotelyRenderableCategory, type MotelyRuntimeItem, } from "./decode/motelyItemDecoder.js";
2
+ export { MOTELY_DISPLAY_SCHEMA, motelyBossDisplayName, motelyBossDisplayNameFromKey, motelyBossKeyFromDisplayName, motelyBoosterPackDisplayName, motelyBoosterPackDisplayNameFromKey, motelyBoosterPackKeyFromDisplayName, motelyItemDisplayNameFromKey, motelyItemDisplayNameFromValue, motelyTagDisplayName, motelyTagDisplayNameFromKey, motelyTagKeyFromDisplayName, motelyVoucherDisplayName, motelyVoucherDisplayNameFromKey, motelyVoucherKeyFromDisplayName, type MotelyBoosterPackKey, type MotelyBossKey, type MotelyDisplaySchema, type MotelyTagKey, type MotelyVoucherKey, } from "./motelyDisplay.js";
package/dist/motely.js CHANGED
@@ -1,2 +1,3 @@
1
1
  "use client";
2
2
  export { decodeMotelyItem, decodeMotelyItemToJamlCard, motelyItemTypeName, motelyItemCategory, motelyItemDisplayName, motelyItemRenderCategory, motelyItemEditionName, motelyItemSealName, motelyItemEnhancementName, motelyPlayingCardRankName, motelyPlayingCardSuitName, decodeMotelyItemName, resolveMotelyItemType, warmMotelyItemCache, motelyItemCacheSize, } from "./decode/motelyItemDecoder.js";
3
+ export { MOTELY_DISPLAY_SCHEMA, motelyBossDisplayName, motelyBossDisplayNameFromKey, motelyBossKeyFromDisplayName, motelyBoosterPackDisplayName, motelyBoosterPackDisplayNameFromKey, motelyBoosterPackKeyFromDisplayName, motelyItemDisplayNameFromKey, motelyItemDisplayNameFromValue, motelyTagDisplayName, motelyTagDisplayNameFromKey, motelyTagKeyFromDisplayName, motelyVoucherDisplayName, motelyVoucherDisplayNameFromKey, motelyVoucherKeyFromDisplayName, } from "./motelyDisplay.js";