@roxyapi/ui 0.18.4 → 0.18.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/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const ROXY_UI_VERSION = "0.18.4";
1
+ export declare const ROXY_UI_VERSION = "0.18.5";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roxyapi/ui",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
4
4
  "description": "Web components for the RoxyAPI catalog. Drop-in charts, tables, cards, forms for astrology, tarot, numerology, biorhythm, I Ching, crystals, dreams, angel numbers, and more. One key, beautiful in 30 minutes.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -27,6 +27,11 @@ type TarotSpreadData =
27
27
  * Tarot spread card. Renders /tarot/spreads/{three-card,celtic-cross,love},
28
28
  * /tarot/yes-no, /tarot/draw responses.
29
29
  */
30
+ /** "three card" -> "Three card". Spread names arrive lowercase from both the API and the attribute, and a heading should not. */
31
+ function titleCase(v: string): string {
32
+ return v ? v.charAt(0).toUpperCase() + v.slice(1) : v;
33
+ }
34
+
30
35
  @customElement('roxy-tarot-spread')
31
36
  export class RoxyTarotSpread extends RoxyDataElement<TarotSpreadData> {
32
37
  static styles = [
@@ -203,10 +208,19 @@ export class RoxyTarotSpread extends RoxyDataElement<TarotSpreadData> {
203
208
  const answer = isYesNo ? (d as CastYesNoResponse).answer : undefined;
204
209
  const strength = isYesNo ? (d as CastYesNoResponse).strength : undefined;
205
210
  const verdictCard = isYesNo ? (d as CastYesNoResponse).card : undefined;
206
- const spreadLabel =
207
- 'spread' in d
208
- ? (d as CastThreeCardResponse).spread
209
- : this.spread.replace(/-/g, ' ');
211
+ // Title from the RESPONSE SHAPE first, the attribute only as a last resort.
212
+ // The API sends `spread: null` on several casts, and a host that cannot set
213
+ // attributes (the WordPress plugin maps an operationId to a bare tag) always
214
+ // falls through to the property default, so a yes or no reading was headed
215
+ // "three card". Reading the shape means the heading is right either way.
216
+ const spreadLabel = isYesNo
217
+ ? 'Yes or no'
218
+ : isDrawn
219
+ ? 'Card draw'
220
+ : titleCase(
221
+ ('spread' in d ? (d as CastThreeCardResponse).spread : '') ||
222
+ this.spread.replace(/-/g, ' '),
223
+ );
210
224
  const question =
211
225
  'question' in d ? (d as CastThreeCardResponse).question : undefined;
212
226
  const summary =
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/sync-version.ts. Do not edit.
2
- export const ROXY_UI_VERSION = '0.18.4';
2
+ export const ROXY_UI_VERSION = '0.18.5';