jaml-ui 2.4.0 → 2.5.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.
Files changed (66) hide show
  1. package/dist/assets/searchPoolWorker-DA5uFkl3.js +2 -0
  2. package/dist/assets/searchPoolWorker-DA5uFkl3.js.map +1 -0
  3. package/dist/chunks/{jamlSeeds-CKHvpjhC.js → jamlSeeds-CRthre97.js} +23 -20
  4. package/dist/chunks/{jamlSeeds-CKHvpjhC.js.map → jamlSeeds-CRthre97.js.map} +1 -1
  5. package/dist/chunks/runtime-D7eHq1kP.js +2060 -0
  6. package/dist/chunks/{runtime-Dx5VPTsV.js.map → runtime-D7eHq1kP.js.map} +1 -1
  7. package/dist/chunks/{searchPoolWorker-CEK2FyxS.js → searchPoolWorker-649yzf3l.js} +2 -2
  8. package/dist/chunks/searchPoolWorker-649yzf3l.js.map +1 -0
  9. package/dist/chunks/spriteMapper-BqG15k6f.js +2496 -0
  10. package/dist/chunks/{spriteMapper-C8uYedXB.js.map → spriteMapper-BqG15k6f.js.map} +1 -1
  11. package/dist/chunks/{ui-BK5rM4AS.js → ui-DwggmAYr.js} +1084 -1164
  12. package/dist/chunks/ui-DwggmAYr.js.map +1 -0
  13. package/dist/components/JamlAestheticSelector.d.ts +1 -1
  14. package/dist/components/JamlCurator.d.ts +1 -0
  15. package/dist/components/JamlIdeVisual.d.ts +0 -2
  16. package/dist/components/JimmolateEditor.d.ts +1 -1
  17. package/dist/components/SeedFinderApp.d.ts +1 -1
  18. package/dist/core.js +13 -10
  19. package/dist/core.js.map +1 -1
  20. package/dist/hooks/useAnalyzer.d.ts +1 -6
  21. package/dist/hooks/useSearch.d.ts +3 -4
  22. package/dist/hooks/useSearchPool.d.ts +1 -1
  23. package/dist/index.d.ts +4 -1
  24. package/dist/index.js +15205 -10106
  25. package/dist/index.js.map +1 -1
  26. package/dist/json-render/builders/analyzer.d.ts +23 -0
  27. package/dist/json-render/builders/encyclopedia.d.ts +14 -0
  28. package/dist/json-render/builders/search.d.ts +24 -0
  29. package/dist/json-render/catalog.d.ts +179 -0
  30. package/dist/json-render/components/domain.d.ts +58 -0
  31. package/dist/json-render/components/game.d.ts +22 -0
  32. package/dist/json-render/components/layout.d.ts +50 -0
  33. package/dist/json-render/components/reference.d.ts +38 -0
  34. package/dist/json-render/engine.d.ts +38 -0
  35. package/dist/json-render/index.d.ts +28 -0
  36. package/dist/json-render/knowledge/bosses.d.ts +18 -0
  37. package/dist/json-render/knowledge/decks.d.ts +22 -0
  38. package/dist/json-render/knowledge/jokers.d.ts +23 -0
  39. package/dist/json-render/knowledge/synergies.d.ts +21 -0
  40. package/dist/json-render/registry.d.ts +14 -0
  41. package/dist/lib/hooks/useSeedAnalyzer.d.ts +2 -14
  42. package/dist/lib/jaml/jamlLangCodemirror.d.ts +3 -12
  43. package/dist/lib/motely/runtime.d.ts +31 -4
  44. package/dist/lib/types.d.ts +1 -1
  45. package/dist/lib/utils.d.ts +2 -0
  46. package/dist/motely.d.ts +3 -3
  47. package/dist/motely.js +93 -73
  48. package/dist/motely.js.map +1 -1
  49. package/dist/ui/JimboPanelSplitter.d.ts +8 -0
  50. package/dist/ui/jimbo.css +1 -1
  51. package/dist/ui/showcase.d.ts +38 -0
  52. package/dist/ui.d.ts +0 -1
  53. package/dist/ui.js +2 -2
  54. package/package.json +40 -45
  55. package/dist/assets/searchPoolWorker-BdrYmnig.js +0 -2
  56. package/dist/assets/searchPoolWorker-BdrYmnig.js.map +0 -1
  57. package/dist/chunks/runtime-Dx5VPTsV.js +0 -2031
  58. package/dist/chunks/searchPoolWorker-CEK2FyxS.js.map +0 -1
  59. package/dist/chunks/spriteMapper-C8uYedXB.js +0 -2455
  60. package/dist/chunks/ui-BK5rM4AS.js.map +0 -1
  61. package/dist/r3f/Card3D.d.ts +0 -48
  62. package/dist/r3f/CardTable.d.ts +0 -35
  63. package/dist/r3f.d.ts +0 -2
  64. package/dist/r3f.js +0 -275
  65. package/dist/r3f.js.map +0 -1
  66. package/dist/ui/JimboCookLever.d.ts +0 -30
@@ -1,13 +1,40 @@
1
- import { MotelyScoredSeedResult } from 'motely-wasm/motely';
1
+ import { JamlAesthetic, JamlConfig, MotelyJamlyzerSeedResult } from 'motely-wasm';
2
2
  export type MotelyRuntimeStatus = "idle" | "booting" | "ready" | "error";
3
- export type JimmolateProbe = (result: MotelyScoredSeedResult) => boolean;
3
+ export declare function parseJaml(jaml: string): JamlConfig;
4
+ /** Column labels for a parsed filter's score tallies (was `MotelyJamlyzerResult.tallyLabels`). */
5
+ export declare function tallyLabelsFor(config: JamlConfig): string[];
6
+ type JimmolateProbe = (seed: string, deck: number, stake: number) => boolean;
4
7
  /** Swap the active Jimmolate predicate. Safe before or after boot. */
5
8
  export declare function setJimmolateProbe(pred: JimmolateProbe): void;
6
9
  /** Reset the probe to pass-through (the engine's default: every survivor matches). */
7
10
  export declare function clearJimmolateProbe(): void;
11
+ /** Turn the Jimmolate predicate layer on/off (was `Program.enableJimmolate()`). */
12
+ export declare function enableJimmolate(on?: boolean): void;
13
+ export type EngineSearchMode = "aesthetic" | "seedlist" | "random" | "sequential";
14
+ export interface RunSearchOptions {
15
+ seeds?: string[];
16
+ count?: number;
17
+ aesthetic?: JamlAesthetic | number;
18
+ startBatchIndex?: bigint;
19
+ endBatchIndex?: bigint;
20
+ batchCharacterCount?: number;
21
+ }
22
+ export declare function aestheticSeeds(aesthetic: JamlAesthetic | number): string[];
23
+ /**
24
+ * Run a search to completion against an already-parsed config.
25
+ *
26
+ * v23 searches are fire-and-forget Promises (no IMotelySearch handle, no
27
+ * mid-search cancel). Subscribe to MotelySearch.onProgress / onScoredResult /
28
+ * onSeedMatch BEFORE calling this; the returned Promise resolves when the engine
29
+ * finishes. Callers cancel by tearing down their runtime (e.g. terminating the
30
+ * worker) — there is no engine-level cancel in v23.
31
+ */
32
+ export declare function runSearch(config: JamlConfig, mode: EngineSearchMode, opts?: RunSearchOptions): Promise<void>;
33
+ /** Analyze one or more seeds against a parsed config (was `Program.jamlyzer`). */
34
+ export declare function analyzeSeeds(config: JamlConfig): MotelyJamlyzerSeedResult[];
8
35
  export declare const MOTELY_BIN_PATH = "/motely-wasm/bin";
9
- /** True once the optional File System extension was bound before boot. */
10
36
  export declare function isFileSystemReady(): boolean;
11
- /** The error from a failed or absent File System init, if any. */
37
+ /** The reason the File System Access API is unavailable, or null when it's ready. */
12
38
  export declare function getFileSystemError(): unknown;
13
39
  export declare function ensureMotelyReady(): Promise<void>;
40
+ export {};
@@ -1,4 +1,4 @@
1
- import { MotelyDeck, MotelyStake } from 'motely-wasm/motely/enums';
1
+ import { MotelyDeck, MotelyStake } from 'motely-wasm';
2
2
  export type DeckType = MotelyDeck;
3
3
  export type StakeType = MotelyStake;
4
4
  /**
@@ -0,0 +1,2 @@
1
+ import { ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): any;
package/dist/motely.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { default as bootsharp } from 'motely-wasm';
2
- export { Program as Motely } from 'motely-wasm/motely/wasm';
1
+ export { default as bootsharp, MotelyWasm, MotelyJaml, MotelyJummy, MotelyUtilities, MotelyJamlyzer, MotelySearch, Jimmolate, MotelyDeck, MotelyStake, MotelyBossBlind, MotelyVoucher, MotelyTag, MotelyBoosterPack, MotelyItemEdition, JamlAesthetic, } from 'motely-wasm';
2
+ export type { JamlConfig, IJamlClause, JamlSearchPlan, MotelyProgress, MotelyScoredSeedResult, MotelyItem, MotelyJamlyzerSeedResult, MotelyJamlyzerAnteResult, } from 'motely-wasm';
3
3
  export { decodeMotelyItem, decodeMotelyItemToJamlCard, motelyItemTypeName, motelyItemCategory, motelyItemDisplayName, motelyItemRenderCategory, motelyItemEditionName, motelyItemSealName, motelyItemEnhancementName, motelyStandardcardRankName, motelyStandardcardSuitName, decodeMotelyItemName, resolveMotelyItemType, type DecodedMotelyItem, type MotelyItemInput, type MotelyJamlCard, type MotelyRenderableCategory, type MotelyRuntimeItem, } from './decode/motelyItemDecoder.js';
4
4
  export { motelyItemToSprite, getMotelySpriteByName, type MotelySpriteData, } from './decode/motelySprite.js';
5
5
  export { motelyBossDisplayName, motelyBossDisplayNameFromKey, motelyBoosterPackDisplayName, motelyBoosterPackDisplayNameFromKey, motelyItemDisplayNameFromKey, motelyItemDisplayNameFromValue, motelyTagDisplayName, motelyTagDisplayNameFromKey, motelyVoucherDisplayName, motelyVoucherDisplayNameFromKey, } from './motelyDisplay.js';
6
6
  export { useJamlLibrary, type JamlLibraryStatus, type UseJamlLibraryState, } from './hooks/useJamlLibrary.js';
7
- export { ensureMotelyReady, MOTELY_BIN_PATH, type MotelyRuntimeStatus, } from './lib/motely/runtime.js';
7
+ export { ensureMotelyReady, parseJaml, tallyLabelsFor, runSearch, aestheticSeeds, analyzeSeeds, setJimmolateProbe, clearJimmolateProbe, enableJimmolate, isFileSystemReady, getFileSystemError, MOTELY_BIN_PATH, type MotelyRuntimeStatus, type EngineSearchMode, type RunSearchOptions, } from './lib/motely/runtime.js';
package/dist/motely.js CHANGED
@@ -1,31 +1,29 @@
1
1
  "use client";
2
- import { f as e, g as t, r as n, t as r, x as i } from "./chunks/spriteMapper-C8uYedXB.js";
3
- import { _ as a, a as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, p as h, r as g, s as _, t as v, u as y, v as b, w as x, y as S } from "./chunks/runtime-Dx5VPTsV.js";
4
- import { useCallback as C, useState as w } from "react";
5
- import { Program as T, Program as E } from "motely-wasm/motely/wasm";
6
- import D from "motely-wasm";
7
- import { PermissionMode as O } from "motely-wasm/bootsharp/file-system";
8
- //#region src/decode/motelySprite.ts
9
- function k(a) {
10
- let o = _(a);
2
+ import { S as e, d as t, h as n, r, t as i, x as a, y as o } from "./chunks/spriteMapper-BqG15k6f.js";
3
+ import { C as s, E as c, M as l, N as ee, S as te, T as u, _ as d, a as f, b as p, c as m, d as ne, f as re, g as h, h as ie, i as g, l as _, m as v, n as y, o as b, p as x, r as S, s as C, t as w, u as T, v as E, w as D, x as O, y as k } from "./chunks/runtime-D7eHq1kP.js";
4
+ import { useCallback as A, useRef as j, useState as M } from "react";
5
+ import N, { JamlAesthetic as P, Jimmolate as F, MotelyBoosterPack as I, MotelyBoosterPack as L, MotelyBossBlind as R, MotelyBossBlind as z, MotelyDeck as B, MotelyItemEdition as V, MotelyJaml as H, MotelyJamlyzer as U, MotelyJummy as ae, MotelySearch as W, MotelyStake as G, MotelyTag as K, MotelyTag as q, MotelyUtilities as J, MotelyVoucher as oe, MotelyVoucher as se, MotelyWasm as ce } from "motely-wasm";
6
+ ee(), h(), o(), a();
7
+ function le(a) {
8
+ let o = x(a);
11
9
  if (!o) return null;
12
10
  if (o.category === "playing" && o.rank && o.suit) {
13
- let n = e[o.rank], r = t[o.suit];
14
- if (n !== void 0 && r !== void 0) return {
15
- atlasPath: i("deck"),
16
- gridCol: n,
17
- gridRow: r,
11
+ let r = t[o.rank], i = n[o.suit];
12
+ if (r !== void 0 && i !== void 0) return {
13
+ atlasPath: e("deck"),
14
+ gridCol: r,
15
+ gridRow: i,
18
16
  gridCols: 13,
19
17
  gridRows: 4,
20
18
  displayName: o.displayName,
21
19
  category: "playing"
22
20
  };
23
21
  }
24
- let s = n(o.displayName);
22
+ let s = r(o.displayName);
25
23
  if (!s) return null;
26
- let c = r[s.type];
24
+ let c = i[s.type];
27
25
  return c ? {
28
- atlasPath: i(c.assetKey),
26
+ atlasPath: e(c.assetKey),
29
27
  gridCol: s.pos.x,
30
28
  gridRow: s.pos.y,
31
29
  gridCols: c.cols,
@@ -34,13 +32,13 @@ function k(a) {
34
32
  category: o.category
35
33
  } : null;
36
34
  }
37
- function A(a, o = "unknown") {
35
+ function ue(a, o = "unknown") {
38
36
  if (o === "playing") {
39
- let n = /^(.*?)\s+of\s+(.*?)$/i.exec(a);
40
- if (n) {
41
- let r = n[1], o = n[2], s = e[r], c = t[o];
37
+ let r = /^(.*?)\s+of\s+(.*?)$/i.exec(a);
38
+ if (r) {
39
+ let i = r[1], o = r[2], s = t[i], c = n[o];
42
40
  if (s !== void 0 && c !== void 0) return {
43
- atlasPath: i("deck"),
41
+ atlasPath: e("deck"),
44
42
  gridCol: s,
45
43
  gridRow: c,
46
44
  gridCols: 13,
@@ -50,11 +48,11 @@ function A(a, o = "unknown") {
50
48
  };
51
49
  }
52
50
  }
53
- let s = n(a);
51
+ let s = r(a);
54
52
  if (!s) return null;
55
- let c = r[s.type];
53
+ let c = i[s.type];
56
54
  return c ? {
57
- atlasPath: i(c.assetKey),
55
+ atlasPath: e(c.assetKey),
58
56
  gridCol: s.pos.x,
59
57
  gridRow: s.pos.y,
60
58
  gridCols: c.cols,
@@ -65,90 +63,112 @@ function A(a, o = "unknown") {
65
63
  }
66
64
  //#endregion
67
65
  //#region src/motelyDisplay.ts
68
- var j = T;
69
- function M(e, t) {
66
+ var Y = {
67
+ MotelyBossBlind: z,
68
+ MotelyVoucher: se,
69
+ MotelyTag: q,
70
+ MotelyBoosterPack: L
71
+ };
72
+ function X(e, t) {
70
73
  let n = e[String(t)];
71
74
  return typeof n == "string" && n.length > 0 ? n : null;
72
75
  }
73
- function N(e) {
74
- return M(j.MotelyBossBlind, e & 255) ?? `boss#${e}`;
76
+ function de(e) {
77
+ return X(Y.MotelyBossBlind, e & 255) ?? `boss#${e}`;
75
78
  }
76
- function P(e) {
79
+ function fe(e) {
77
80
  return e;
78
81
  }
79
- function F(e) {
80
- return M(j.MotelyVoucher, e) ?? `voucher#${e}`;
82
+ function pe(e) {
83
+ return X(Y.MotelyVoucher, e) ?? `voucher#${e}`;
81
84
  }
82
- function I(e) {
85
+ function me(e) {
83
86
  return e;
84
87
  }
85
- function L(e) {
86
- return M(j.MotelyTag, e) ?? `tag#${e}`;
88
+ function he(e) {
89
+ return X(Y.MotelyTag, e) ?? `tag#${e}`;
87
90
  }
88
- function R(e) {
91
+ function Z(e) {
89
92
  return e;
90
93
  }
91
- function z(e) {
92
- return M(j.MotelyBoosterPack, e) ?? `pack#${e}`;
94
+ function ge(e) {
95
+ return X(Y.MotelyBoosterPack, e) ?? `pack#${e}`;
93
96
  }
94
- function B(e) {
97
+ function _e(e) {
95
98
  return `${e} Pack`;
96
99
  }
97
- function V(e) {
100
+ function ve(e) {
98
101
  return e;
99
102
  }
100
- function H(e) {
101
- return x[e & 65535]?.displayName ?? `item#${e}`;
103
+ function ye(e) {
104
+ return l[e & 65535]?.displayName ?? `item#${e}`;
102
105
  }
103
106
  //#endregion
104
107
  //#region src/hooks/useJamlLibrary.ts
105
- function U(e) {
108
+ var be = /\.(jaml|ya?ml)$/i;
109
+ function xe() {
110
+ return m() ? window.showDirectoryPicker : null;
111
+ }
112
+ function Q(e) {
106
113
  return e instanceof Error ? e.message : String(e);
107
114
  }
108
- function W() {
109
- let [e, t] = w("idle"), [n, r] = w(null), [i, a] = w([]), [s, c] = w(null), l = C(() => {
110
- n && a((e) => [...e]);
111
- }, [n]);
115
+ async function $(e) {
116
+ let t = [];
117
+ for await (let [n, r] of e.entries()) r.kind === "file" && be.test(n) && t.push(n);
118
+ return t.sort((e, t) => e.localeCompare(t));
119
+ }
120
+ function Se() {
121
+ let [e, t] = M(() => m() ? "idle" : "unsupported"), [n, r] = M(null), [i, a] = M([]), [o, s] = M(null), c = j(null), l = A(() => {
122
+ let e = c.current;
123
+ e && $(e).then(a).catch((e) => s(Q(e)));
124
+ }, []);
112
125
  return {
113
126
  status: e,
114
127
  rootId: n,
115
128
  files: i,
116
- error: s,
117
- mount: C(async () => {
118
- t("mounting"), c(null);
129
+ error: o,
130
+ mount: A(async () => {
131
+ let e = xe();
132
+ if (!e) {
133
+ t("unsupported"), s(Q(C()));
134
+ return;
135
+ }
136
+ t("mounting"), s(null);
119
137
  try {
120
- if (await g(), !o()) {
121
- t("unsupported"), c(U(f() ?? "Bootsharp FileSystem package is not available."));
122
- return;
123
- }
124
- let e = await T.pickRoot({
125
- mode: O.ReadWrite,
126
- id: "jaml-library"
138
+ let n = await e({
139
+ id: "jaml-library",
140
+ mode: "readwrite"
127
141
  });
128
- if (!e) {
129
- t("idle");
142
+ c.current = n, r(n.name), a(await $(n)), t("ready");
143
+ } catch (e) {
144
+ if (e instanceof DOMException && e.name === "AbortError") {
145
+ t(c.current ? "ready" : "idle");
130
146
  return;
131
147
  }
132
- r(await T.mountRoot(e, { mode: O.ReadWrite })), a([]), t("ready");
133
- } catch (e) {
134
- t("error"), c(U(e));
148
+ t("error"), s(Q(e));
135
149
  }
136
150
  }, []),
137
- unmount: C(async () => {
138
- n && (await g(), await T.unmountRoot(n), r(null), a([]), t(o() ? "idle" : "unsupported"));
139
- }, [n]),
140
- loadFile: C(async (e) => {
141
- if (!n) throw Error("JAML library is not mounted.");
142
- return await g(), await T.readTextFile(n, e);
143
- }, [n]),
144
- saveFile: C(async (e, t) => {
151
+ unmount: A(async () => {
152
+ c.current = null, r(null), a([]), t(m() ? "idle" : "unsupported");
153
+ }, []),
154
+ loadFile: A(async (e) => {
155
+ let t = c.current;
156
+ if (!t) throw Error("JAML library is not mounted.");
157
+ return (await (await t.getFileHandle(e)).getFile()).text();
158
+ }, []),
159
+ saveFile: A(async (e, t) => {
160
+ let n = c.current;
145
161
  if (!n) throw Error("JAML library is not mounted.");
146
- await g(), await T.writeTextFile(n, e, t), a((t) => (t.includes(e) ? t : [...t, e]).sort((e, t) => e.localeCompare(t)));
147
- }, [n]),
162
+ let r = await (await n.getFileHandle(e, { create: !0 })).createWritable();
163
+ await r.write(t), await r.close(), a((t) => t.includes(e) ? t : [...t, e].sort((e, t) => e.localeCompare(t)));
164
+ }, []),
148
165
  refresh: l
149
166
  };
150
167
  }
151
168
  //#endregion
152
- export { v as MOTELY_BIN_PATH, E as Motely, D as bootsharp, _ as decodeMotelyItem, s as decodeMotelyItemName, p as decodeMotelyItemToJamlCard, g as ensureMotelyReady, A as getMotelySpriteByName, z as motelyBoosterPackDisplayName, B as motelyBoosterPackDisplayNameFromKey, N as motelyBossDisplayName, P as motelyBossDisplayNameFromKey, y as motelyItemCategory, c as motelyItemDisplayName, V as motelyItemDisplayNameFromKey, H as motelyItemDisplayNameFromValue, l as motelyItemEditionName, h as motelyItemEnhancementName, m as motelyItemRenderCategory, d as motelyItemSealName, k as motelyItemToSprite, u as motelyItemTypeName, a as motelyStandardcardRankName, b as motelyStandardcardSuitName, L as motelyTagDisplayName, R as motelyTagDisplayNameFromKey, F as motelyVoucherDisplayName, I as motelyVoucherDisplayNameFromKey, S as resolveMotelyItemType, W as useJamlLibrary };
169
+ //#region src/motely.ts
170
+ h();
171
+ //#endregion
172
+ export { P as JamlAesthetic, F as Jimmolate, w as MOTELY_BIN_PATH, I as MotelyBoosterPack, R as MotelyBossBlind, B as MotelyDeck, V as MotelyItemEdition, H as MotelyJaml, U as MotelyJamlyzer, ae as MotelyJummy, W as MotelySearch, G as MotelyStake, K as MotelyTag, J as MotelyUtilities, oe as MotelyVoucher, ce as MotelyWasm, y as aestheticSeeds, S as analyzeSeeds, N as bootsharp, g as clearJimmolateProbe, x as decodeMotelyItem, v as decodeMotelyItemName, ie as decodeMotelyItemToJamlCard, f as enableJimmolate, b as ensureMotelyReady, C as getFileSystemError, ue as getMotelySpriteByName, m as isFileSystemReady, ge as motelyBoosterPackDisplayName, _e as motelyBoosterPackDisplayNameFromKey, de as motelyBossDisplayName, fe as motelyBossDisplayNameFromKey, d as motelyItemCategory, E as motelyItemDisplayName, ve as motelyItemDisplayNameFromKey, ye as motelyItemDisplayNameFromValue, k as motelyItemEditionName, p as motelyItemEnhancementName, O as motelyItemRenderCategory, te as motelyItemSealName, le as motelyItemToSprite, s as motelyItemTypeName, D as motelyStandardcardRankName, u as motelyStandardcardSuitName, he as motelyTagDisplayName, Z as motelyTagDisplayNameFromKey, pe as motelyVoucherDisplayName, me as motelyVoucherDisplayNameFromKey, _ as parseJaml, c as resolveMotelyItemType, T as runSearch, ne as setJimmolateProbe, re as tallyLabelsFor, Se as useJamlLibrary };
153
173
 
154
174
  //# sourceMappingURL=motely.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"motely.js","names":[],"sources":["../src/decode/motelySprite.ts","../src/motelyDisplay.ts","../src/hooks/useJamlLibrary.ts"],"sourcesContent":["import { decodeMotelyItem, type MotelyRenderableCategory } from \"./motelyItemDecoder.js\";\nimport { getSpriteData, SHEET_META } from \"../sprites/spriteMapper.js\";\nimport { RANK_MAP, SUIT_MAP } from \"../sprites/spriteData.js\";\nimport { resolveJamlAssetUrl } from \"../assets.js\";\n\nexport interface MotelySpriteData {\n atlasPath: string;\n gridCol: number;\n gridRow: number;\n gridCols: number;\n gridRows: number;\n displayName: string;\n category: MotelyRenderableCategory;\n}\n\n/**\n * Given a raw motely-wasm item value (which may be a bitpacked integer or raw MotelyItemType),\n * resolves it to a sprite atlas path and grid coordinates for rendering.\n */\nexport function motelyItemToSprite(rawValue: number): MotelySpriteData | null {\n const decoded = decodeMotelyItem(rawValue);\n if (!decoded) return null;\n\n if (decoded.category === \"playing\" && decoded.rank && decoded.suit) {\n const col = RANK_MAP[decoded.rank];\n const row = SUIT_MAP[decoded.suit];\n if (col !== undefined && row !== undefined) {\n return {\n atlasPath: resolveJamlAssetUrl('deck'),\n gridCol: col,\n gridRow: row,\n gridCols: 13,\n gridRows: 4,\n displayName: decoded.displayName,\n category: \"playing\"\n };\n }\n }\n\n const sprite = getSpriteData(decoded.displayName);\n if (!sprite) return null;\n\n const meta = SHEET_META[sprite.type];\n if (!meta) return null;\n\n return {\n atlasPath: resolveJamlAssetUrl(meta.assetKey),\n gridCol: sprite.pos.x,\n gridRow: sprite.pos.y,\n gridCols: meta.cols,\n gridRows: meta.rows,\n displayName: decoded.displayName,\n category: decoded.category\n };\n}\n\n/**\n * Resolves a sprite by name and category without needing a Motely integer.\n */\nexport function getMotelySpriteByName(name: string, category: MotelyRenderableCategory = \"unknown\"): MotelySpriteData | null {\n if (category === \"playing\") {\n // Attempt to parse \"Rank of Suit\"\n const match = /^(.*?)\\s+of\\s+(.*?)$/i.exec(name);\n if (match) {\n const rank = match[1];\n const suit = match[2];\n const col = RANK_MAP[rank];\n const row = SUIT_MAP[suit];\n if (col !== undefined && row !== undefined) {\n return {\n atlasPath: resolveJamlAssetUrl('deck'),\n gridCol: col,\n gridRow: row,\n gridCols: 13,\n gridRows: 4,\n displayName: name,\n category: \"playing\"\n };\n }\n }\n }\n\n const sprite = getSpriteData(name);\n if (!sprite) return null;\n\n const meta = SHEET_META[sprite.type];\n if (!meta) return null;\n\n return {\n atlasPath: resolveJamlAssetUrl(meta.assetKey),\n gridCol: sprite.pos.x,\n gridRow: sprite.pos.y,\n gridCols: meta.cols,\n gridRows: meta.rows,\n displayName: name,\n category\n };\n}\n","import { Program as Motely } from \"motely-wasm/motely/wasm\";\nimport { MOTELY_ITEM_FORMATS_BY_VALUE } from \"./decode/motelyItemFormats.js\";\n\ntype RuntimeEnum = Record<string, string | number>;\ntype MotelyRuntimeEnums = typeof Motely & Record<string, RuntimeEnum>;\n\nconst MotelyEnums = Motely as MotelyRuntimeEnums;\n\nfunction runtimeEnumKey(\n enumObject: Record<string, unknown>,\n value: number,\n): string | null {\n const key = enumObject[String(value)];\n return typeof key === \"string\" && key.length > 0 ? key : null;\n}\n\nexport function motelyBossDisplayName(value: number): string {\n const key = runtimeEnumKey(MotelyEnums.MotelyBossBlind, value & 0xff);\n return key ?? `boss#${value}`;\n}\n\nexport function motelyBossDisplayNameFromKey(key: string): string {\n return key;\n}\n\nexport function motelyVoucherDisplayName(value: number): string {\n const key = runtimeEnumKey(MotelyEnums.MotelyVoucher, value);\n return key ?? `voucher#${value}`;\n}\n\nexport function motelyVoucherDisplayNameFromKey(key: string): string {\n return key;\n}\n\nexport function motelyTagDisplayName(value: number): string {\n const key = runtimeEnumKey(MotelyEnums.MotelyTag, value);\n return key ?? `tag#${value}`;\n}\n\nexport function motelyTagDisplayNameFromKey(key: string): string {\n return key;\n}\n\nexport function motelyBoosterPackDisplayName(value: number): string {\n const key = runtimeEnumKey(MotelyEnums.MotelyBoosterPack, value);\n return key ?? `pack#${value}`;\n}\n\nexport function motelyBoosterPackDisplayNameFromKey(key: string): string {\n return `${key} Pack`;\n}\n\nexport function motelyItemDisplayNameFromKey(key: string): string {\n return key;\n}\n\nexport function motelyItemDisplayNameFromValue(value: number): string {\n const itemType = value & 0xffff;\n return MOTELY_ITEM_FORMATS_BY_VALUE[itemType as keyof typeof MOTELY_ITEM_FORMATS_BY_VALUE]?.displayName ?? `item#${value}`;\n}\n","\"use client\";\n\nimport { useCallback, useState } from \"react\";\nimport { Program as Motely } from \"motely-wasm/motely/wasm\";\nimport { ensureMotelyReady, isFileSystemReady, getFileSystemError } from \"../lib/motely/runtime.js\";\nimport { PermissionMode } from \"motely-wasm/bootsharp/file-system\";\n\n// The optional File System extension is bound pre-boot inside ensureMotelyReady()\n// (see runtime.ts) — that's the only place the init can win the boot race. Here we\n// just boot and read back whether the mounter actually bound.\n\nexport type JamlLibraryStatus = \"idle\" | \"unsupported\" | \"mounting\" | \"ready\" | \"error\";\n\nexport interface UseJamlLibraryState {\n status: JamlLibraryStatus;\n rootId: string | null;\n files: string[];\n error: string | null;\n mount: () => Promise<void>;\n unmount: () => Promise<void>;\n loadFile: (uri: string) => Promise<string>;\n saveFile: (uri: string, content: string) => Promise<void>;\n refresh: () => void;\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n\nexport function useJamlLibrary(): UseJamlLibraryState {\n const [status, setStatus] = useState<JamlLibraryStatus>(\"idle\");\n const [rootId, setRootId] = useState<string | null>(null);\n const [files, setFiles] = useState<string[]>([]);\n const [error, setError] = useState<string | null>(null);\n\n const refresh = useCallback(() => {\n if (!rootId) return;\n setFiles((prev) => [...prev]);\n }, [rootId]);\n\n const mount = useCallback(async () => {\n setStatus(\"mounting\");\n setError(null);\n\n try {\n await ensureMotelyReady();\n if (!isFileSystemReady()) {\n setStatus(\"unsupported\");\n setError(errorMessage(getFileSystemError() ?? \"Bootsharp FileSystem package is not available.\"));\n return;\n }\n const pickedRoot = await Motely.pickRoot({ mode: PermissionMode.ReadWrite, id: \"jaml-library\" });\n if (!pickedRoot) {\n setStatus(\"idle\");\n return;\n }\n\n const mountedRoot = await Motely.mountRoot(pickedRoot, { mode: PermissionMode.ReadWrite });\n setRootId(mountedRoot);\n setFiles([]);\n setStatus(\"ready\");\n } catch (err) {\n setStatus(\"error\");\n setError(errorMessage(err));\n }\n }, []);\n\n const unmount = useCallback(async () => {\n if (!rootId) return;\n await ensureMotelyReady();\n await Motely.unmountRoot(rootId);\n setRootId(null);\n setFiles([]);\n setStatus(isFileSystemReady() ? \"idle\" : \"unsupported\");\n }, [rootId]);\n\n const loadFile = useCallback(async (uri: string) => {\n if (!rootId) throw new Error(\"JAML library is not mounted.\");\n await ensureMotelyReady();\n return await Motely.readTextFile(rootId, uri);\n }, [rootId]);\n\n const saveFile = useCallback(async (uri: string, content: string) => {\n if (!rootId) throw new Error(\"JAML library is not mounted.\");\n await ensureMotelyReady();\n await Motely.writeTextFile(rootId, uri, content);\n setFiles((prev) => (prev.includes(uri) ? prev : [...prev, uri]).sort((a, b) => a.localeCompare(b)));\n }, [rootId]);\n\n return { status, rootId, files, error, mount, unmount, loadFile, saveFile, refresh };\n}\n"],"mappings":";;;;;;;;AAmBA,SAAgB,EAAmB,GAA2C;CAC5E,IAAM,IAAU,EAAiB,CAAQ;CACzC,IAAI,CAAC,GAAS,OAAO;CAErB,IAAI,EAAQ,aAAa,aAAa,EAAQ,QAAQ,EAAQ,MAAM;EAClE,IAAM,IAAM,EAAS,EAAQ,OACvB,IAAM,EAAS,EAAQ;EAC7B,IAAI,MAAQ,KAAA,KAAa,MAAQ,KAAA,GAC/B,OAAO;GACL,WAAW,EAAoB,MAAM;GACrC,SAAS;GACT,SAAS;GACT,UAAU;GACV,UAAU;GACV,aAAa,EAAQ;GACrB,UAAU;EACZ;CAEJ;CAEA,IAAM,IAAS,EAAc,EAAQ,WAAW;CAChD,IAAI,CAAC,GAAQ,OAAO;CAEpB,IAAM,IAAO,EAAW,EAAO;CAG/B,OAFK,IAEE;EACL,WAAW,EAAoB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,SAAS,GAAK;IAEZ,AADA,EAAU,OAAO,GACjB,EAAS,EAAa,CAAG,CAAC;GAC5B;EACF,GAAG,CAAC,CAwBmC;EAAO,SAtB9B,EAAY,YAAY;GACjC,MACL,MAAM,EAAkB,GACxB,MAAM,EAAO,YAAY,CAAM,GAC/B,EAAU,IAAI,GACd,EAAS,CAAC,CAAC,GACX,EAAU,EAAkB,IAAI,SAAS,aAAa;EACxD,GAAG,CAAC,CAAM,CAeoC;EAAS,UAbtC,EAAY,OAAO,MAAgB;GAClD,IAAI,CAAC,GAAQ,MAAU,MAAM,8BAA8B;GAE3D,OADA,MAAM,EAAkB,GACjB,MAAM,EAAO,aAAa,GAAQ,CAAG;EAC9C,GAAG,CAAC,CAAM,CAS6C;EAAU,UAPhD,EAAY,OAAO,GAAa,MAAoB;GACnE,IAAI,CAAC,GAAQ,MAAU,MAAM,8BAA8B;GAG3D,AAFA,MAAM,EAAkB,GACxB,MAAM,EAAO,cAAc,GAAQ,GAAK,CAAO,GAC/C,GAAU,OAAU,EAAK,SAAS,CAAG,IAAI,IAAO,CAAC,GAAG,GAAM,CAAG,GAAG,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;EACpG,GAAG,CAAC,CAAM,CAEuD;EAAU;CAAQ;AACrF"}
1
+ {"version":3,"file":"motely.js","names":[],"sources":["../src/decode/motelySprite.ts","../src/motelyDisplay.ts","../src/hooks/useJamlLibrary.ts","../src/motely.ts"],"sourcesContent":["import { decodeMotelyItem, type MotelyRenderableCategory } from \"./motelyItemDecoder.js\";\nimport { getSpriteData, SHEET_META } from \"../sprites/spriteMapper.js\";\nimport { RANK_MAP, SUIT_MAP } from \"../sprites/spriteData.js\";\nimport { resolveJamlAssetUrl } from \"../assets.js\";\n\nexport interface MotelySpriteData {\n atlasPath: string;\n gridCol: number;\n gridRow: number;\n gridCols: number;\n gridRows: number;\n displayName: string;\n category: MotelyRenderableCategory;\n}\n\n/**\n * Given a raw motely-wasm item value (which may be a bitpacked integer or raw MotelyItemType),\n * resolves it to a sprite atlas path and grid coordinates for rendering.\n */\nexport function motelyItemToSprite(rawValue: number): MotelySpriteData | null {\n const decoded = decodeMotelyItem(rawValue);\n if (!decoded) return null;\n\n if (decoded.category === \"playing\" && decoded.rank && decoded.suit) {\n const col = RANK_MAP[decoded.rank];\n const row = SUIT_MAP[decoded.suit];\n if (col !== undefined && row !== undefined) {\n return {\n atlasPath: resolveJamlAssetUrl('deck'),\n gridCol: col,\n gridRow: row,\n gridCols: 13,\n gridRows: 4,\n displayName: decoded.displayName,\n category: \"playing\"\n };\n }\n }\n\n const sprite = getSpriteData(decoded.displayName);\n if (!sprite) return null;\n\n const meta = SHEET_META[sprite.type];\n if (!meta) return null;\n\n return {\n atlasPath: resolveJamlAssetUrl(meta.assetKey),\n gridCol: sprite.pos.x,\n gridRow: sprite.pos.y,\n gridCols: meta.cols,\n gridRows: meta.rows,\n displayName: decoded.displayName,\n category: decoded.category\n };\n}\n\n/**\n * Resolves a sprite by name and category without needing a Motely integer.\n */\nexport function getMotelySpriteByName(name: string, category: MotelyRenderableCategory = \"unknown\"): MotelySpriteData | null {\n if (category === \"playing\") {\n // Attempt to parse \"Rank of Suit\"\n const match = /^(.*?)\\s+of\\s+(.*?)$/i.exec(name);\n if (match) {\n const rank = match[1];\n const suit = match[2];\n const col = RANK_MAP[rank];\n const row = SUIT_MAP[suit];\n if (col !== undefined && row !== undefined) {\n return {\n atlasPath: resolveJamlAssetUrl('deck'),\n gridCol: col,\n gridRow: row,\n gridCols: 13,\n gridRows: 4,\n displayName: name,\n category: \"playing\"\n };\n }\n }\n }\n\n const sprite = getSpriteData(name);\n if (!sprite) return null;\n\n const meta = SHEET_META[sprite.type];\n if (!meta) return null;\n\n return {\n atlasPath: resolveJamlAssetUrl(meta.assetKey),\n gridCol: sprite.pos.x,\n gridRow: sprite.pos.y,\n gridCols: meta.cols,\n gridRows: meta.rows,\n displayName: name,\n category\n };\n}\n","import { MotelyBossBlind, MotelyVoucher, MotelyTag, MotelyBoosterPack } from \"motely-wasm\";\nimport { MOTELY_ITEM_FORMATS_BY_VALUE } from \"./decode/motelyItemFormats.js\";\n\ntype RuntimeEnum = Record<string, string | number>;\n\n// motely-wasm@23 exposes the enums as top-level runtime objects (numeric → name\n// reverse maps) instead of `Program.MotelyBossBlind` etc. Bundle them so the\n// runtimeEnumKey lookups below stay unchanged.\nconst MotelyEnums = {\n MotelyBossBlind,\n MotelyVoucher,\n MotelyTag,\n MotelyBoosterPack,\n} as unknown as Record<string, RuntimeEnum>;\n\nfunction runtimeEnumKey(\n enumObject: Record<string, unknown>,\n value: number,\n): string | null {\n const key = enumObject[String(value)];\n return typeof key === \"string\" && key.length > 0 ? key : null;\n}\n\nexport function motelyBossDisplayName(value: number): string {\n const key = runtimeEnumKey(MotelyEnums.MotelyBossBlind, value & 0xff);\n return key ?? `boss#${value}`;\n}\n\nexport function motelyBossDisplayNameFromKey(key: string): string {\n return key;\n}\n\nexport function motelyVoucherDisplayName(value: number): string {\n const key = runtimeEnumKey(MotelyEnums.MotelyVoucher, value);\n return key ?? `voucher#${value}`;\n}\n\nexport function motelyVoucherDisplayNameFromKey(key: string): string {\n return key;\n}\n\nexport function motelyTagDisplayName(value: number): string {\n const key = runtimeEnumKey(MotelyEnums.MotelyTag, value);\n return key ?? `tag#${value}`;\n}\n\nexport function motelyTagDisplayNameFromKey(key: string): string {\n return key;\n}\n\nexport function motelyBoosterPackDisplayName(value: number): string {\n const key = runtimeEnumKey(MotelyEnums.MotelyBoosterPack, value);\n return key ?? `pack#${value}`;\n}\n\nexport function motelyBoosterPackDisplayNameFromKey(key: string): string {\n return `${key} Pack`;\n}\n\nexport function motelyItemDisplayNameFromKey(key: string): string {\n return key;\n}\n\nexport function motelyItemDisplayNameFromValue(value: number): string {\n const itemType = value & 0xffff;\n return MOTELY_ITEM_FORMATS_BY_VALUE[itemType as keyof typeof MOTELY_ITEM_FORMATS_BY_VALUE]?.displayName ?? `item#${value}`;\n}\n","\"use client\";\n\nimport { useCallback, useRef, useState } from \"react\";\nimport { isFileSystemReady, getFileSystemError } from \"../lib/motely/runtime.js\";\n\n// motely-wasm@23 removed the engine-side filesystem ops, so the JAML library is\n// backed directly by the browser File System Access API. JAML files are plain\n// text, so mounting a folder, listing its .jaml/.yaml files, and reading/writing\n// them needs no engine round-trip. Where the API is unavailable (non-Chromium or\n// insecure context) status is \"unsupported\" — reported honestly via\n// isFileSystemReady() in runtime.ts, not a faked mount.\n\n// Minimal typings for the slice of the File System Access API we use (keeps us\n// off lib.dom shipping these and clear of the repo's no-explicit-any rule).\ninterface FsWritable {\n write(data: string): Promise<void>;\n close(): Promise<void>;\n}\ninterface FsFileHandle {\n kind: \"file\";\n getFile(): Promise<File>;\n createWritable(): Promise<FsWritable>;\n}\ninterface FsDirectoryHandle {\n kind: \"directory\";\n name: string;\n entries(): AsyncIterableIterator<[string, { kind: string }]>;\n getFileHandle(name: string, options?: { create?: boolean }): Promise<FsFileHandle>;\n}\ntype DirectoryPicker = (options?: { id?: string; mode?: \"read\" | \"readwrite\" }) => Promise<FsDirectoryHandle>;\n\nconst JAML_FILE = /\\.(jaml|ya?ml)$/i;\n\nfunction directoryPicker(): DirectoryPicker | null {\n if (!isFileSystemReady()) return null;\n return (window as unknown as { showDirectoryPicker: DirectoryPicker }).showDirectoryPicker;\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nexport type JamlLibraryStatus = \"idle\" | \"unsupported\" | \"mounting\" | \"ready\" | \"error\";\n\nexport interface UseJamlLibraryState {\n status: JamlLibraryStatus;\n rootId: string | null;\n files: string[];\n error: string | null;\n mount: () => Promise<void>;\n unmount: () => Promise<void>;\n loadFile: (uri: string) => Promise<string>;\n saveFile: (uri: string, content: string) => Promise<void>;\n refresh: () => void;\n}\n\nasync function listJamlFiles(dir: FsDirectoryHandle): Promise<string[]> {\n const names: string[] = [];\n for await (const [name, handle] of dir.entries()) {\n if (handle.kind === \"file\" && JAML_FILE.test(name)) names.push(name);\n }\n return names.sort((a, b) => a.localeCompare(b));\n}\n\nexport function useJamlLibrary(): UseJamlLibraryState {\n const [status, setStatus] = useState<JamlLibraryStatus>(() => (isFileSystemReady() ? \"idle\" : \"unsupported\"));\n const [rootId, setRootId] = useState<string | null>(null);\n const [files, setFiles] = useState<string[]>([]);\n const [error, setError] = useState<string | null>(null);\n const dirRef = useRef<FsDirectoryHandle | null>(null);\n\n const refresh = useCallback(() => {\n const dir = dirRef.current;\n if (!dir) return;\n void listJamlFiles(dir).then(setFiles).catch((e) => setError(errorMessage(e)));\n }, []);\n\n const mount = useCallback(async () => {\n const pick = directoryPicker();\n if (!pick) {\n setStatus(\"unsupported\");\n setError(errorMessage(getFileSystemError()));\n return;\n }\n setStatus(\"mounting\");\n setError(null);\n try {\n const dir = await pick({ id: \"jaml-library\", mode: \"readwrite\" });\n dirRef.current = dir;\n setRootId(dir.name);\n setFiles(await listJamlFiles(dir));\n setStatus(\"ready\");\n } catch (err) {\n // The user dismissing the directory picker raises AbortError — not a failure.\n if (err instanceof DOMException && err.name === \"AbortError\") {\n setStatus(dirRef.current ? \"ready\" : \"idle\");\n return;\n }\n setStatus(\"error\");\n setError(errorMessage(err));\n }\n }, []);\n\n const unmount = useCallback(async () => {\n dirRef.current = null;\n setRootId(null);\n setFiles([]);\n setStatus(isFileSystemReady() ? \"idle\" : \"unsupported\");\n }, []);\n\n const loadFile = useCallback(async (uri: string): Promise<string> => {\n const dir = dirRef.current;\n if (!dir) throw new Error(\"JAML library is not mounted.\");\n const handle = await dir.getFileHandle(uri);\n const file = await handle.getFile();\n return file.text();\n }, []);\n\n const saveFile = useCallback(async (uri: string, content: string): Promise<void> => {\n const dir = dirRef.current;\n if (!dir) throw new Error(\"JAML library is not mounted.\");\n const handle = await dir.getFileHandle(uri, { create: true });\n const writable = await handle.createWritable();\n await writable.write(content);\n await writable.close();\n setFiles((prev) => (prev.includes(uri) ? prev : [...prev, uri].sort((a, b) => a.localeCompare(b))));\n }, []);\n\n return { status, rootId, files, error, mount, unmount, loadFile, saveFile, refresh };\n}\n","\"use client\";\n\n// motely-wasm@23 ships a single root entry: the bootsharp default export plus the\n// flattened namespaces (MotelyJaml / MotelySearch / MotelyJamlyzer / MotelyUtilities\n// / Jimmolate), enums, and types. The old `Program` aggregate is gone; re-export the\n// real v23 surface so `jaml-ui/motely` consumers reach the engine directly.\nexport {\n default as bootsharp,\n MotelyWasm,\n MotelyJaml,\n MotelyJummy,\n MotelyUtilities,\n MotelyJamlyzer,\n MotelySearch,\n Jimmolate,\n MotelyDeck,\n MotelyStake,\n MotelyBossBlind,\n MotelyVoucher,\n MotelyTag,\n MotelyBoosterPack,\n MotelyItemEdition,\n JamlAesthetic,\n} from \"motely-wasm\";\nexport type {\n JamlConfig,\n IJamlClause,\n JamlSearchPlan,\n MotelyProgress,\n MotelyScoredSeedResult,\n MotelyItem,\n MotelyJamlyzerSeedResult,\n MotelyJamlyzerAnteResult,\n} from \"motely-wasm\";\n\nexport {\n decodeMotelyItem,\n decodeMotelyItemToJamlCard,\n motelyItemTypeName,\n motelyItemCategory,\n motelyItemDisplayName,\n motelyItemRenderCategory,\n motelyItemEditionName,\n motelyItemSealName,\n motelyItemEnhancementName,\n motelyStandardcardRankName,\n motelyStandardcardSuitName,\n decodeMotelyItemName,\n resolveMotelyItemType,\n type DecodedMotelyItem,\n type MotelyItemInput,\n type MotelyJamlCard,\n type MotelyRenderableCategory,\n type MotelyRuntimeItem,\n} from \"./decode/motelyItemDecoder.js\";\n\nexport {\n motelyItemToSprite,\n getMotelySpriteByName,\n type MotelySpriteData,\n} from \"./decode/motelySprite.js\";\n\nexport {\n motelyBossDisplayName,\n motelyBossDisplayNameFromKey,\n motelyBoosterPackDisplayName,\n motelyBoosterPackDisplayNameFromKey,\n motelyItemDisplayNameFromKey,\n motelyItemDisplayNameFromValue,\n motelyTagDisplayName,\n motelyTagDisplayNameFromKey,\n motelyVoucherDisplayName,\n motelyVoucherDisplayNameFromKey,\n} from \"./motelyDisplay.js\";\n\nexport {\n useJamlLibrary,\n type JamlLibraryStatus,\n type UseJamlLibraryState,\n} from \"./hooks/useJamlLibrary.js\";\nexport {\n ensureMotelyReady,\n parseJaml,\n tallyLabelsFor,\n runSearch,\n aestheticSeeds,\n analyzeSeeds,\n setJimmolateProbe,\n clearJimmolateProbe,\n enableJimmolate,\n isFileSystemReady,\n getFileSystemError,\n MOTELY_BIN_PATH,\n type MotelyRuntimeStatus,\n type EngineSearchMode,\n type RunSearchOptions,\n} from \"./lib/motely/runtime.js\";\n"],"mappings":";;;;;;AAmBA,SAAA,GAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA;AAKA,SAAA,GAAA,GAAA,IAAA,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA;;;ACzFA,IAAM,IAAc;CAClB,iBAAA;CACA,eAAA;CACA,WAAA;CACA,mBAAA;AACF;AAEA,SAAS,EACP,GACA,GACe;CACf,IAAM,IAAM,EAAW,OAAO,CAAK;CACnC,OAAO,OAAO,KAAQ,YAAY,EAAI,SAAS,IAAI,IAAM;AAC3D;AAEA,SAAgB,GAAsB,GAAuB;CAE3D,OADY,EAAe,EAAY,iBAAiB,IAAQ,GACzD,KAAO,QAAQ;AACxB;AAEA,SAAgB,GAA6B,GAAqB;CAChE,OAAO;AACT;AAEA,SAAgB,GAAyB,GAAuB;CAE9D,OADY,EAAe,EAAY,eAAe,CAC/C,KAAO,WAAW;AAC3B;AAEA,SAAgB,GAAgC,GAAqB;CACnE,OAAO;AACT;AAEA,SAAgB,GAAqB,GAAuB;CAE1D,OADY,EAAe,EAAY,WAAW,CAC3C,KAAO,OAAO;AACvB;AAEA,SAAgB,EAA4B,GAAqB;CAC/D,OAAO;AACT;AAEA,SAAgB,GAA6B,GAAuB;CAElE,OADY,EAAe,EAAY,mBAAmB,CACnD,KAAO,QAAQ;AACxB;AAEA,SAAgB,GAAoC,GAAqB;CACvE,OAAO,GAAG,EAAI;AAChB;AAEA,SA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,EAAO,UAAU,GACjB,EAAU,EAAI,IAAI,GAClB,EAAS,MAAM,EAAc,CAAG,CAAC,GACjC,EAAU,OAAO;GACnB,SAAS,GAAK;IAEZ,IAAI,aAAe,gBAAgB,EAAI,SAAS,cAAc;KAC5D,EAAU,EAAO,UAAU,UAAU,MAAM;KAC3C;IACF;IAEA,AADA,EAAU,OAAO,GACjB,EAAS,EAAa,CAAG,CAAC;GAC5B;EACF,GAAG,CAAC,CA2BmC;EAAO,SAzB9B,EAAY,YAAY;GAItC,AAHA,EAAO,UAAU,MACjB,EAAU,IAAI,GACd,EAAS,CAAC,CAAC,GACX,EAAU,EAAkB,IAAI,SAAS,aAAa;EACxD,GAAG,CAAC,CAoB0C;EAAS,UAlBtC,EAAY,OAAO,MAAiC;GACnE,IAAM,IAAM,EAAO;GACnB,IAAI,CAAC,GAAK,MAAU,MAAM,8BAA8B;GAGxD,QAAO,OADY,MADE,EAAI,cAAc,CAAG,GAChB,QAAQ,GACtB,KAAK;EACnB,GAAG,CAAC,CAYmD;EAAU,UAVhD,EAAY,OAAO,GAAa,MAAmC;GAClF,IAAM,IAAM,EAAO;GACnB,IAAI,CAAC,GAAK,MAAU,MAAM,8BAA8B;GAExD,IAAM,IAAW,OAAM,MADF,EAAI,cAAc,GAAK,EAAE,QAAQ,GAAK,CAAC,GAC9B,eAAe;GAG7C,AAFA,MAAM,EAAS,MAAM,CAAO,GAC5B,MAAM,EAAS,MAAM,GACrB,GAAU,MAAU,EAAK,SAAS,CAAG,IAAI,IAAO,CAAC,GAAG,GAAM,CAAG,EAAE,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC,CAAE;EACpG,GAAG,CAAC,CAE6D;EAAU;CAAQ;AACrF;;;EC3EO"}
@@ -0,0 +1,8 @@
1
+ export interface JimboPanelSplitterProps {
2
+ "aria-label"?: string;
3
+ className?: string;
4
+ onDrag: (delta: number) => void;
5
+ onKeyAdjust?: (delta: number) => void;
6
+ orientation?: "vertical" | "horizontal";
7
+ }
8
+ export declare function JimboPanelSplitter({ orientation, onDrag, onKeyAdjust, className, "aria-label": ariaLabel, }: JimboPanelSplitterProps): import("react/jsx-runtime").JSX.Element;