jaml-ui 0.21.4 → 0.21.5

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/dist/assets.d.ts CHANGED
@@ -15,6 +15,4 @@ export declare const JAML_ASSET_FILES: {
15
15
  export type JamlAssetKey = keyof typeof JAML_ASSET_FILES;
16
16
  export type JamlAssetFile = (typeof JAML_ASSET_FILES)[JamlAssetKey];
17
17
  export declare function setJamlAssetBaseUrl(baseUrl: string | null | undefined): void;
18
- export declare function clearJamlAssetBaseUrl(): void;
19
18
  export declare function resolveJamlAssetUrl(asset: JamlAssetKey | JamlAssetFile): string;
20
- export declare function getDefaultJamlAssetUrlMap(): Readonly<Record<JamlAssetKey, string>>;
package/dist/assets.js CHANGED
@@ -13,28 +13,13 @@ export const JAML_ASSET_FILES = {
13
13
  font: "fonts/m6x11plusplus.otf",
14
14
  };
15
15
  const assetKeyByFileName = Object.fromEntries(Object.entries(JAML_ASSET_FILES).map(([key, fileName]) => [fileName, key]));
16
- const defaultAssetUrls = {
17
- deck: new URL(`../assets/${JAML_ASSET_FILES.deck}`, import.meta.url).href,
18
- blinds: new URL(`../assets/${JAML_ASSET_FILES.blinds}`, import.meta.url).href,
19
- boosters: new URL(`../assets/${JAML_ASSET_FILES.boosters}`, import.meta.url).href,
20
- editions: new URL(`../assets/${JAML_ASSET_FILES.editions}`, import.meta.url).href,
21
- enhancers: new URL(`../assets/${JAML_ASSET_FILES.enhancers}`, import.meta.url).href,
22
- jokers: new URL(`../assets/${JAML_ASSET_FILES.jokers}`, import.meta.url).href,
23
- tarots: new URL(`../assets/${JAML_ASSET_FILES.tarots}`, import.meta.url).href,
24
- vouchers: new URL(`../assets/${JAML_ASSET_FILES.vouchers}`, import.meta.url).href,
25
- stickers: new URL(`../assets/${JAML_ASSET_FILES.stickers}`, import.meta.url).href,
26
- tags: new URL(`../assets/${JAML_ASSET_FILES.tags}`, import.meta.url).href,
27
- stakes: new URL(`../assets/${JAML_ASSET_FILES.stakes}`, import.meta.url).href,
28
- font: new URL(`../assets/${JAML_ASSET_FILES.font}`, import.meta.url).href,
29
- };
16
+ const defaultAssetUrls = Object.fromEntries(Object.entries(JAML_ASSET_FILES).map(([key, fileName]) => [key, new URL(`../assets/${fileName}`, import.meta.url).href]));
30
17
  let customAssetBaseUrl = null;
31
18
  function normalizeBaseUrl(baseUrl) {
32
- const trimmed = baseUrl.trim();
33
- if (trimmed.length === 0) {
34
- throw new Error("Jaml asset base URL must not be empty.");
35
- }
36
- return trimmed.endsWith("/") ? trimmed : `${trimmed}/`;
19
+ return baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
37
20
  }
21
+ // `new URL(file, base)` requires `base` to be absolute. weejoker.app passes
22
+ // "/assets" (relative path), so we fall back to string concatenation for that case.
38
23
  function joinAssetUrl(baseUrl, fileName) {
39
24
  const normalized = normalizeBaseUrl(baseUrl);
40
25
  if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(normalized) || normalized.startsWith("//")) {
@@ -50,9 +35,6 @@ export function setJamlAssetBaseUrl(baseUrl) {
50
35
  const trimmed = baseUrl.trim();
51
36
  customAssetBaseUrl = trimmed.length === 0 ? null : normalizeBaseUrl(trimmed);
52
37
  }
53
- export function clearJamlAssetBaseUrl() {
54
- customAssetBaseUrl = null;
55
- }
56
38
  export function resolveJamlAssetUrl(asset) {
57
39
  const assetKey = asset in JAML_ASSET_FILES
58
40
  ? asset
@@ -60,11 +42,7 @@ export function resolveJamlAssetUrl(asset) {
60
42
  if (!assetKey) {
61
43
  throw new Error(`Unknown Jaml asset '${asset}'.`);
62
44
  }
63
- if (customAssetBaseUrl) {
64
- return joinAssetUrl(customAssetBaseUrl, JAML_ASSET_FILES[assetKey]);
65
- }
66
- return defaultAssetUrls[assetKey];
67
- }
68
- export function getDefaultJamlAssetUrlMap() {
69
- return defaultAssetUrls;
45
+ return customAssetBaseUrl
46
+ ? joinAssetUrl(customAssetBaseUrl, JAML_ASSET_FILES[assetKey])
47
+ : defaultAssetUrls[assetKey];
70
48
  }
package/dist/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { JAML_ASSET_FILES, clearJamlAssetBaseUrl, getDefaultJamlAssetUrlMap, resolveJamlAssetUrl, setJamlAssetBaseUrl, type JamlAssetFile, type JamlAssetKey, } from "./assets.js";
1
+ export { JAML_ASSET_FILES, resolveJamlAssetUrl, setJamlAssetBaseUrl, type JamlAssetFile, type JamlAssetKey, } from "./assets.js";
2
2
  export { Layer, type LayerOptions } from "./render/Layer.js";
3
3
  export { getSpriteData, type SpriteData, type SpriteSheetType } from "./sprites/spriteMapper.js";
4
4
  export { SPRITE_SHEETS, JOKERS, JOKER_FACES, TAROTS_AND_PLANETS, CONSUMABLE_FACES, VOUCHERS, BOSSES, TAGS, BOOSTER_PACKS, EDITION_MAP, STICKER_MAP, RANK_MAP, SUIT_MAP, ENHANCER_MAP, SEAL_MAP, type SpritePos, type SpriteEntry, type SpriteSheetInfo, } from "./sprites/spriteData.js";
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- export { JAML_ASSET_FILES, clearJamlAssetBaseUrl, getDefaultJamlAssetUrlMap, resolveJamlAssetUrl, setJamlAssetBaseUrl, } from "./assets.js";
1
+ export { JAML_ASSET_FILES, resolveJamlAssetUrl, setJamlAssetBaseUrl, } from "./assets.js";
2
2
  export { Layer } from "./render/Layer.js";
3
3
  export { getSpriteData } from "./sprites/spriteMapper.js";
4
4
  export { SPRITE_SHEETS, JOKERS, JOKER_FACES, TAROTS_AND_PLANETS, CONSUMABLE_FACES, VOUCHERS, BOSSES, TAGS, BOOSTER_PACKS, EDITION_MAP, STICKER_MAP, RANK_MAP, SUIT_MAP, ENHANCER_MAP, SEAL_MAP, } from "./sprites/spriteData.js";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { JAML_ASSET_FILES, clearJamlAssetBaseUrl, getDefaultJamlAssetUrlMap, resolveJamlAssetUrl, setJamlAssetBaseUrl, type JamlAssetFile, type JamlAssetKey, } from "./assets.js";
1
+ export { JAML_ASSET_FILES, resolveJamlAssetUrl, setJamlAssetBaseUrl, type JamlAssetFile, type JamlAssetKey, } from "./assets.js";
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";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- export { JAML_ASSET_FILES, clearJamlAssetBaseUrl, getDefaultJamlAssetUrlMap, resolveJamlAssetUrl, setJamlAssetBaseUrl, } from "./assets.js";
2
+ export { JAML_ASSET_FILES, resolveJamlAssetUrl, setJamlAssetBaseUrl, } from "./assets.js";
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";
@@ -27,7 +27,7 @@ export interface JamlFilter {
27
27
  should: JamlClause[];
28
28
  mustNot: JamlClause[];
29
29
  }
30
- import { DECK_OPTIONS, STAKE_OPTIONS, ANTE_OPTIONS, SLOT_OPTIONS, CLAUSE_TYPES, SOURCE_OPTIONS, EDITION_OPTIONS, SEAL_OPTIONS, ENHANCEMENT_OPTIONS } from '@/lib/data/constants';
30
+ import { DECK_OPTIONS, STAKE_OPTIONS, ANTE_OPTIONS, SLOT_OPTIONS, CLAUSE_TYPES, SOURCE_OPTIONS, EDITION_OPTIONS, SEAL_OPTIONS, ENHANCEMENT_OPTIONS } from '../data/constants.js';
31
31
  export { DECK_OPTIONS, STAKE_OPTIONS, ANTE_OPTIONS, SLOT_OPTIONS, CLAUSE_TYPES, SOURCE_OPTIONS, EDITION_OPTIONS, SEAL_OPTIONS, ENHANCEMENT_OPTIONS };
32
32
  export declare function useJamlFilter(initialJaml?: string): {
33
33
  filter: JamlFilter;
@@ -1,5 +1,5 @@
1
1
  import { useState, useCallback, useMemo } from 'react';
2
- import { DECK_OPTIONS, STAKE_OPTIONS, ANTE_OPTIONS, SLOT_OPTIONS, CLAUSE_TYPES, SOURCE_OPTIONS, EDITION_OPTIONS, SEAL_OPTIONS, ENHANCEMENT_OPTIONS } from '@/lib/data/constants';
2
+ import { DECK_OPTIONS, STAKE_OPTIONS, ANTE_OPTIONS, SLOT_OPTIONS, CLAUSE_TYPES, SOURCE_OPTIONS, EDITION_OPTIONS, SEAL_OPTIONS, ENHANCEMENT_OPTIONS } from '../data/constants.js';
3
3
  export { DECK_OPTIONS, STAKE_OPTIONS, ANTE_OPTIONS, SLOT_OPTIONS, CLAUSE_TYPES, SOURCE_OPTIONS, EDITION_OPTIONS, SEAL_OPTIONS, ENHANCEMENT_OPTIONS };
4
4
  export function useJamlFilter(initialJaml) {
5
5
  const [filter, setFilter] = useState(parseJamlToFilter(initialJaml || ''));
@@ -1,11 +1,4 @@
1
1
  import { Motely } from "motely-wasm";
2
- /**
3
- * Display-name utilities — thin wrappers over motely-wasm runtime enums.
4
- * No hand-maintained lookup tables. The enum IS the source of truth.
5
- */
6
- function spaceSplit(value) {
7
- return value.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2");
8
- }
9
2
  function runtimeEnumKey(enumObject, value) {
10
3
  if (!enumObject || typeof enumObject !== "object")
11
4
  return null;
@@ -15,36 +8,36 @@ function runtimeEnumKey(enumObject, value) {
15
8
  // ─── Public API (same signatures as before, zero hand-rolled tables) ────────
16
9
  export function motelyBossDisplayName(value) {
17
10
  const key = runtimeEnumKey(Motely.MotelyBossBlind, value & 0xff);
18
- return key === null ? `boss#${value}` : spaceSplit(key);
11
+ return key === null ? `boss#${value}` : key;
19
12
  }
20
13
  export function motelyBossDisplayNameFromKey(key) {
21
- return spaceSplit(key);
14
+ return key;
22
15
  }
23
16
  export function motelyVoucherDisplayName(value) {
24
17
  const key = runtimeEnumKey(Motely.MotelyVoucher, value);
25
- return key === null ? `voucher#${value}` : spaceSplit(key);
18
+ return key === null ? `voucher#${value}` : key;
26
19
  }
27
20
  export function motelyVoucherDisplayNameFromKey(key) {
28
- return spaceSplit(key);
21
+ return key;
29
22
  }
30
23
  export function motelyTagDisplayName(value) {
31
24
  const key = runtimeEnumKey(Motely.MotelyTag, value);
32
- return key === null ? `tag#${value}` : spaceSplit(key);
25
+ return key === null ? `tag#${value}` : key;
33
26
  }
34
27
  export function motelyTagDisplayNameFromKey(key) {
35
- return spaceSplit(key);
28
+ return key;
36
29
  }
37
30
  export function motelyBoosterPackDisplayName(value) {
38
31
  const key = runtimeEnumKey(Motely.MotelyBoosterPack, value);
39
- return key === null ? `pack#${value}` : spaceSplit(key);
32
+ return key === null ? `pack#${value}` : key;
40
33
  }
41
34
  export function motelyBoosterPackDisplayNameFromKey(key) {
42
- return `${spaceSplit(key)} Pack`;
35
+ return `${key} Pack`;
43
36
  }
44
37
  export function motelyItemDisplayNameFromKey(key) {
45
- return spaceSplit(key);
38
+ return key;
46
39
  }
47
40
  export function motelyItemDisplayNameFromValue(value) {
48
41
  const key = runtimeEnumKey(Motely.MotelyItemType, value & 0xffff);
49
- return key === null ? `item#${value}` : spaceSplit(key);
42
+ return key === null ? `item#${value}` : key;
50
43
  }
package/dist/ui/jimbo.css CHANGED
@@ -206,7 +206,8 @@
206
206
  transform: translate(0, 0);
207
207
  transition: transform var(--j-press-speed) linear, box-shadow var(--j-press-speed) linear;
208
208
  }
209
- .j-btn[data-pressed="true"] .j-btn__face {
209
+ .j-btn[data-pressed="true"] .j-btn__face,
210
+ .j-btn:active:not(:disabled):not(.j-btn--disabled) .j-btn__face {
210
211
  transform: translateY(var(--j-press-y));
211
212
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.6);
212
213
  }
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  export interface JimboTabItem {
3
3
  id: string;
4
4
  label: string;
package/dist/ui/panel.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState, memo } from 'react';
3
+ import { memo } from 'react';
4
4
  import { useSway } from './hooks.js';
5
5
  import { JimboText } from './jimboText.js';
6
6
  export const JimboPanel = memo(({ children, className = '', sway = false, onBack, hideBack = false, style, ...props }) => {
@@ -11,12 +11,8 @@ JimboPanel.displayName = 'JimboPanel';
11
11
  export const JimboInnerPanel = memo(({ children, className = '', style, ...props }) => (_jsx("div", { className: `j-inner-panel ${className}`, style: style, ...props, children: children })));
12
12
  JimboInnerPanel.displayName = 'JimboInnerPanel';
13
13
  export function JimboButton({ tone = 'orange', size = 'md', fullWidth = false, disabled = false, uppercase = false, onClick, style, className = '', children, }) {
14
- const [pressed, setPressed] = useState(false);
15
14
  const textSize = size === 'xs' ? 'xs' : size === 'sm' ? 'sm' : size === 'lg' ? 'lg' : 'md';
16
- return (_jsx("div", { className: `j-btn j-btn--${tone} j-btn--${size} ${fullWidth ? 'j-btn--full' : ''} ${disabled ? 'j-btn--disabled' : ''} ${className}`, "data-pressed": pressed, onMouseDown: () => { if (!disabled)
17
- setPressed(true); }, onMouseUp: () => setPressed(false), onMouseLeave: () => setPressed(false), onTouchStart: () => { if (!disabled)
18
- setPressed(true); }, onTouchEnd: () => setPressed(false), onClick: () => { if (!disabled)
19
- onClick?.(); }, style: style, children: _jsx("div", { className: "j-btn__face", children: _jsx(JimboText, { size: textSize, uppercase: uppercase, children: children }) }) }));
15
+ return (_jsx("button", { type: "button", className: `j-btn j-btn--${tone} j-btn--${size} ${fullWidth ? 'j-btn--full' : ''} ${disabled ? 'j-btn--disabled' : ''} ${className}`, disabled: disabled, onClick: onClick, style: style, children: _jsx("div", { className: "j-btn__face", children: _jsx(JimboText, { size: textSize, uppercase: uppercase, children: children }) }) }));
20
16
  }
21
17
  export function JimboBackButton({ onClick }) {
22
18
  return (_jsx("div", { className: "j-flex j-justify-center j-w-full", style: { padding: '4px 0' }, children: _jsx(JimboButton, { tone: "orange", size: "md", fullWidth: true, onClick: onClick, children: "Back" }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaml-ui",
3
- "version": "0.21.4",
3
+ "version": "0.21.5",
4
4
  "description": "Balatro rendering components, sprite metadata, and optional Motely helpers for React apps.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",