@roxyapi/ui 0.8.1 → 0.10.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/AGENTS.md +54 -13
- package/README.md +33 -22
- package/THEMING.md +7 -5
- package/dist/cdn/components/angel-number-card.js +45 -0
- package/dist/cdn/components/angel-number-card.js.map +7 -0
- package/dist/cdn/components/angel-number-lookup.js +45 -0
- package/dist/cdn/components/angel-number-lookup.js.map +7 -0
- package/dist/cdn/components/ashtakavarga-grid.js +3 -3
- package/dist/cdn/components/ashtakavarga-grid.js.map +3 -3
- package/dist/cdn/components/biorhythm-chart.js +3 -3
- package/dist/cdn/components/biorhythm-chart.js.map +3 -3
- package/dist/cdn/components/bodygraph.js +8 -8
- package/dist/cdn/components/bodygraph.js.map +3 -3
- package/dist/cdn/components/choghadiya-grid.js +3 -3
- package/dist/cdn/components/choghadiya-grid.js.map +3 -3
- package/dist/cdn/components/compatibility-card.js +2 -2
- package/dist/cdn/components/compatibility-card.js.map +3 -3
- package/dist/cdn/components/crystal-grid.js +45 -0
- package/dist/cdn/components/crystal-grid.js.map +7 -0
- package/dist/cdn/components/dasha-timeline.js +2 -2
- package/dist/cdn/components/dasha-timeline.js.map +3 -3
- package/dist/cdn/components/data.js +2 -2
- package/dist/cdn/components/data.js.map +3 -3
- package/dist/cdn/components/divisional-chart.js +7 -7
- package/dist/cdn/components/divisional-chart.js.map +3 -3
- package/dist/cdn/components/dosha-card.js +3 -3
- package/dist/cdn/components/dosha-card.js.map +3 -3
- package/dist/cdn/components/dream-card.js +45 -0
- package/dist/cdn/components/dream-card.js.map +7 -0
- package/dist/cdn/components/forecast-timeline.js +3 -3
- package/dist/cdn/components/forecast-timeline.js.map +3 -3
- package/dist/cdn/components/guna-milan.js +3 -3
- package/dist/cdn/components/guna-milan.js.map +3 -3
- package/dist/cdn/components/hexagram.js +2 -2
- package/dist/cdn/components/hexagram.js.map +3 -3
- package/dist/cdn/components/horoscope-card.js +3 -3
- package/dist/cdn/components/horoscope-card.js.map +3 -3
- package/dist/cdn/components/kp-chart.js +2 -2
- package/dist/cdn/components/kp-chart.js.map +3 -3
- package/dist/cdn/components/kp-planets-table.js +3 -3
- package/dist/cdn/components/kp-planets-table.js.map +3 -3
- package/dist/cdn/components/kp-ruling-planets.js +3 -3
- package/dist/cdn/components/kp-ruling-planets.js.map +3 -3
- package/dist/cdn/components/moon-phase.js +3 -3
- package/dist/cdn/components/moon-phase.js.map +3 -3
- package/dist/cdn/components/nakshatra-card.js +3 -3
- package/dist/cdn/components/nakshatra-card.js.map +3 -3
- package/dist/cdn/components/natal-chart.js +2 -2
- package/dist/cdn/components/natal-chart.js.map +3 -3
- package/dist/cdn/components/numerology-card.js +3 -3
- package/dist/cdn/components/numerology-card.js.map +3 -3
- package/dist/cdn/components/panchang-table.js +2 -2
- package/dist/cdn/components/panchang-table.js.map +3 -3
- package/dist/cdn/components/shadbala-table.js +3 -3
- package/dist/cdn/components/shadbala-table.js.map +3 -3
- package/dist/cdn/components/synastry-chart.js +5 -5
- package/dist/cdn/components/synastry-chart.js.map +3 -3
- package/dist/cdn/components/tarot-card.js.map +3 -3
- package/dist/cdn/components/tarot-spread.js +3 -3
- package/dist/cdn/components/tarot-spread.js.map +3 -3
- package/dist/cdn/components/transits-table.js +3 -3
- package/dist/cdn/components/transits-table.js.map +3 -3
- package/dist/cdn/components/vedic-kundli.js +16 -16
- package/dist/cdn/components/vedic-kundli.js.map +3 -3
- package/dist/cdn/components/vedic-planets-table.js +3 -3
- package/dist/cdn/components/vedic-planets-table.js.map +3 -3
- package/dist/cdn/components/western-planets-table.js +2 -2
- package/dist/cdn/components/western-planets-table.js.map +3 -3
- package/dist/cdn/components/yoga-list.js +2 -2
- package/dist/cdn/components/yoga-list.js.map +3 -3
- package/dist/cdn/roxy-ui.js +289 -66
- package/dist/cdn/roxy-ui.js.map +4 -4
- package/dist/cdn.d.ts +8 -0
- package/dist/cdn.d.ts.map +1 -0
- package/dist/components/angel-number-card.d.ts +18 -0
- package/dist/components/angel-number-card.d.ts.map +1 -0
- package/dist/components/angel-number-card.js +2 -0
- package/dist/components/angel-number-card.js.map +7 -0
- package/dist/components/angel-number-lookup.d.ts +18 -0
- package/dist/components/angel-number-lookup.d.ts.map +1 -0
- package/dist/components/angel-number-lookup.js +2 -0
- package/dist/components/angel-number-lookup.js.map +7 -0
- package/dist/components/ashtakavarga-grid.js +1 -1
- package/dist/components/ashtakavarga-grid.js.map +3 -3
- package/dist/components/biorhythm-chart.js +1 -1
- package/dist/components/biorhythm-chart.js.map +3 -3
- package/dist/components/bodygraph.js +4 -4
- package/dist/components/bodygraph.js.map +3 -3
- package/dist/components/choghadiya-grid.js +1 -1
- package/dist/components/choghadiya-grid.js.map +3 -3
- package/dist/components/compatibility-card.js +1 -1
- package/dist/components/compatibility-card.js.map +3 -3
- package/dist/components/crystal-grid.d.ts +27 -0
- package/dist/components/crystal-grid.d.ts.map +1 -0
- package/dist/components/crystal-grid.js +2 -0
- package/dist/components/crystal-grid.js.map +7 -0
- package/dist/components/dasha-timeline.js +1 -1
- package/dist/components/dasha-timeline.js.map +3 -3
- package/dist/components/data.js +1 -1
- package/dist/components/data.js.map +3 -3
- package/dist/components/divisional-chart.js +34 -34
- package/dist/components/divisional-chart.js.map +3 -3
- package/dist/components/dosha-card.js +1 -1
- package/dist/components/dosha-card.js.map +3 -3
- package/dist/components/dream-card.d.ts +17 -0
- package/dist/components/dream-card.d.ts.map +1 -0
- package/dist/components/dream-card.js +2 -0
- package/dist/components/dream-card.js.map +7 -0
- package/dist/components/forecast-timeline.js.map +3 -3
- package/dist/components/guna-milan.js +1 -1
- package/dist/components/guna-milan.js.map +3 -3
- package/dist/components/hexagram.js +1 -1
- package/dist/components/hexagram.js.map +3 -3
- package/dist/components/horoscope-card.js +1 -1
- package/dist/components/horoscope-card.js.map +3 -3
- package/dist/components/kp-chart.js +1 -1
- package/dist/components/kp-chart.js.map +3 -3
- package/dist/components/kp-planets-table.js +1 -1
- package/dist/components/kp-planets-table.js.map +3 -3
- package/dist/components/kp-ruling-planets.js +1 -1
- package/dist/components/kp-ruling-planets.js.map +3 -3
- package/dist/components/moon-phase.js +1 -1
- package/dist/components/moon-phase.js.map +3 -3
- package/dist/components/nakshatra-card.js +1 -1
- package/dist/components/nakshatra-card.js.map +3 -3
- package/dist/components/natal-chart.js +5 -5
- package/dist/components/natal-chart.js.map +3 -3
- package/dist/components/numerology-card.d.ts +7 -3
- package/dist/components/numerology-card.d.ts.map +1 -1
- package/dist/components/numerology-card.js +1 -1
- package/dist/components/numerology-card.js.map +3 -3
- package/dist/components/panchang-table.js +1 -1
- package/dist/components/panchang-table.js.map +3 -3
- package/dist/components/shadbala-table.js +1 -1
- package/dist/components/shadbala-table.js.map +3 -3
- package/dist/components/synastry-chart.js +4 -4
- package/dist/components/synastry-chart.js.map +3 -3
- package/dist/components/tarot-card.js +1 -1
- package/dist/components/tarot-card.js.map +3 -3
- package/dist/components/tarot-spread.js +1 -1
- package/dist/components/tarot-spread.js.map +3 -3
- package/dist/components/transits-table.js +1 -1
- package/dist/components/transits-table.js.map +3 -3
- package/dist/components/vedic-kundli.d.ts +18 -0
- package/dist/components/vedic-kundli.d.ts.map +1 -1
- package/dist/components/vedic-kundli.js +62 -62
- package/dist/components/vedic-kundli.js.map +3 -3
- package/dist/components/vedic-planets-table.js +1 -1
- package/dist/components/vedic-planets-table.js.map +3 -3
- package/dist/components/western-planets-table.js +1 -1
- package/dist/components/western-planets-table.js.map +3 -3
- package/dist/components/yoga-list.js +1 -1
- package/dist/components/yoga-list.js.map +3 -3
- package/dist/index.cjs +74 -74
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +74 -74
- package/dist/index.js.map +4 -4
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.json +28 -24
- package/dist/styles/tokens-css.d.ts +2 -0
- package/dist/styles/tokens-css.d.ts.map +1 -0
- package/dist/styles/tokens.css +26 -11
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.gen.d.ts +43 -26
- package/dist/types/types.gen.d.ts.map +1 -1
- package/dist/utils/inject-tokens.d.ts +16 -0
- package/dist/utils/inject-tokens.d.ts.map +1 -0
- package/dist/utils/kundli-render.d.ts +2 -1
- package/dist/utils/kundli-render.d.ts.map +1 -1
- package/dist/utils/markup-data.d.ts +34 -0
- package/dist/utils/markup-data.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cdn.ts +15 -0
- package/src/components/angel-number-card.ts +234 -0
- package/src/components/angel-number-lookup.ts +208 -0
- package/src/components/crystal-grid.ts +191 -0
- package/src/components/dream-card.ts +98 -0
- package/src/components/numerology-card.ts +22 -10
- package/src/components/vedic-kundli.ts +37 -2
- package/src/index.ts +14 -0
- package/src/manifest.ts +57 -5
- package/src/styles/tokens-css.ts +225 -0
- package/src/styles/tokens.css +26 -11
- package/src/types/index.ts +1 -1
- package/src/types/types.gen.ts +43 -26
- package/src/utils/inject-tokens.ts +27 -0
- package/src/utils/kundli-render.ts +9 -2
- package/src/utils/markup-data.ts +45 -0
- package/src/version.ts +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var y=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
var y=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var p=(t,r,e,o)=>{for(var a=o>1?void 0:o?h(r,e):r,c=t.length-1,d;c>=0;c--)(d=t[c])&&(a=(o?d(r,e,a):d(a))||a);return o&&a&&y(r,e,a),a};import{css as $,html as n,LitElement as w,nothing as i}from"lit";import{customElement as M,property as f}from"lit/decorators.js";var v=["Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"],C=v.map(t=>t.toLowerCase());var l={"new moon":"\u{1F311}","waxing crescent":"\u{1F312}","first quarter":"\u{1F313}","waxing gibbous":"\u{1F314}","full moon":"\u{1F315}","waning gibbous":"\u{1F316}","last quarter":"\u{1F317}","waning crescent":"\u{1F318}"};import{css as b}from"lit";var m=b`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;function g(t,r=1){return typeof t!="number"||!Number.isFinite(t)?"":t.toFixed(r).replace(/\.?0+$/,"")}var S="roxy-data";function L(t){return t.nodeName==="SCRIPT"&&t.getAttribute("type")==="application/json"}var u=class{constructor(r){this.host=r,r.addController(this)}hostConnected(){if(this.host.data!=null)return;let r=this.read();r!==void 0&&(this.host.data=r,this.host.requestUpdate())}read(){let r=this.findInlineScript();return r?this.parse(r.textContent):void 0}findInlineScript(){for(let r of Array.from(this.host.children))if(L(r)&&r.classList.contains(S))return r;return null}parse(r){if(r?.trim())try{return JSON.parse(r)}catch{return}}};var s=class extends w{constructor(){super();this.data=null;this.mode="current";new u(this)}render(){let e=this.data;if(!e)return n`<div class="roxy-empty" role="status">No moon phase data</div>`;let o="phases"in e?e.phases:"calendar"in e?e.calendar:[];if(this.mode!=="current"&&o.length>0){let a="month"in e?e.month:void 0,c="year"in e?e.year:void 0;return n`<article class="card" aria-label="Moon phase calendar"><h2 class="label">${a??"Moon phases"} ${c??""}</h2><div class="list" role="list">${o.map(d=>this.renderListItem(d))}</div></article>`}return"phase"in e?this.renderSingle(e):i}renderSingle(e){let o=x(e.phase);return n`<article class="card" aria-label="Current moon phase"><div class="hero"><span class="emoji" aria-hidden="true">${o}</span><div><h2 class="label">${e.phase??"Moon"}</h2>${e.date?n`<div class="date">${e.date}</div>`:i}</div></div><div class="stats">${typeof e.illumination=="number"?n`<div><span>Illumination</span> <strong>${R(e.illumination)}</strong></div>`:i} ${typeof e.age=="number"?n`<div><span>Age</span> <strong>${g(e.age,1)} days</strong></div>`:i} ${e.sign?n`<div><span>Sign</span> <strong>${e.sign}</strong></div>`:i} ${typeof e.distance=="number"?n`<div><span>Distance</span> <strong>${(e.distance/1e3).toFixed(0)}k km</strong></div>`:i}</div>${e.meaning?.description?n`<p class="meaning">${e.meaning.description}</p>`:i} ${e.meaning?.keywords?.length?n`<div class="keywords">${e.meaning.keywords.map(a=>n`<span>${a}</span>`)}</div>`:i}</article>`}renderListItem(e){let o=x(e.phase);return n`<div class="list-item" role="listitem"><span aria-hidden="true">${o}</span> <span>${e.phase}</span> <span>${e.date??""}</span></div>`}};s.styles=[m,$`.card{background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);gap:var(--roxy-space-md,1rem);display:grid}.hero{align-items:center;gap:var(--roxy-space-md,1rem);display:flex}.emoji{font-size:3rem;line-height:1}.label{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);text-transform:capitalize;margin:0}.date{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}.stats{gap:var(--roxy-space-md,1rem);font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-secondary,#475569);grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));display:grid}.stats div span:first-child{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);text-transform:uppercase;letter-spacing:.06em;display:block}.stats strong{color:var(--roxy-fg,#0a0a0a);font-variant-numeric:tabular-nums}.meaning{color:var(--roxy-fg,#0a0a0a)}.keywords{gap:var(--roxy-space-xs,.25rem);margin-top:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.keywords span{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 14%, transparent);border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);padding:2px 8px}.list{gap:var(--roxy-space-sm,.5rem);display:grid}.list-item{gap:var(--roxy-space-sm,.5rem);border-bottom:1px solid var(--roxy-border,#e4e4e7);padding:var(--roxy-space-sm,.5rem) 0;font-size:var(--roxy-text-sm,.875rem);grid-template-columns:2.5rem 1fr auto;align-items:center;display:grid}.list-item:last-child{border-bottom:none}`],p([f({attribute:!1})],s.prototype,"data",2),p([f({type:String,reflect:!0})],s.prototype,"mode",2),s=p([M("roxy-moon-phase")],s);function x(t){return t?l[t.toLowerCase()]??"\u{1F319}":"\u{1F319}"}function R(t){let r=t<=1?t*100:t;return`${Math.round(r)}%`}export{s as RoxyMoonPhase};
|
|
2
2
|
//# sourceMappingURL=moon-phase.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/moon-phase.ts", "../../src/tokens/index.ts", "../../src/utils/base-styles.ts", "../../src/utils/format.ts", "../../src/utils/markup-data.ts"],
|
|
4
|
-
"sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { MOON_PHASE_EMOJI } from '../tokens/index.js';\nimport type {\n\tGetCurrentMoonPhaseResponse,\n\tGetMoonCalendarResponse,\n\tGetUpcomingMoonPhasesResponse,\n} from '../types/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { formatNumber } from '../utils/format.js';\nimport { MarkupDataController } from '../utils/markup-data.js';\n\ntype MoonPhaseData =\n\t| GetCurrentMoonPhaseResponse\n\t| GetUpcomingMoonPhasesResponse\n\t| GetMoonCalendarResponse;\ntype MoonListEntry =\n\t| GetUpcomingMoonPhasesResponse['phases'][number]\n\t| GetMoonCalendarResponse['calendar'][number];\n\n/**\n * Moon phase card. Renders /astrology/moon-phase/{current,upcoming,calendar/...}.\n */\n@customElement('roxy-moon-phase')\nexport class RoxyMoonPhase extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.card{background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);gap:var(--roxy-space-md,1rem);display:grid}.hero{align-items:center;gap:var(--roxy-space-md,1rem);display:flex}.emoji{font-size:3rem;line-height:1}.label{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);text-transform:capitalize;margin:0}.date{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}.stats{gap:var(--roxy-space-md,1rem);font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-secondary,#475569);grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));display:grid}.stats div span:first-child{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);text-transform:uppercase;letter-spacing:.06em;display:block}.stats strong{color:var(--roxy-fg,#0a0a0a);font-variant-numeric:tabular-nums}.meaning{color:var(--roxy-fg,#0a0a0a)}.keywords{gap:var(--roxy-space-xs,.25rem);margin-top:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.keywords span{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 14%, transparent);border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);padding:2px 8px}.list{gap:var(--roxy-space-sm,.5rem);display:grid}.list-item{gap:var(--roxy-space-sm,.5rem);border-bottom:1px solid var(--roxy-border,#e4e4e7);padding:var(--roxy-space-sm,.5rem) 0;font-size:var(--roxy-text-sm,.875rem);grid-template-columns:2.5rem 1fr auto;align-items:center;display:grid}.list-item:last-child{border-bottom:none}`,\n\t];\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Enables hydrating `data` from a direct-child\n\t\t// <script type=\"application/json\" class=\"roxy-data\"> for server-rendered\n\t\t// and cached consumers. The JavaScript `data` property still wins.\n\t\tnew MarkupDataController(this);\n\t}\n\n\t@property({ attribute: false })\n\tdata: MoonPhaseData | null = null;\n\n\t@property({ type: String, reflect: true })\n\tmode: 'current' | 'upcoming' | 'calendar' = 'current';\n\n\trender() {\n\t\tconst d = this.data;\n\t\tif (!d)\n\t\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No moon phase data</div>`;\n\t\tconst list: MoonListEntry[] =\n\t\t\t'phases' in d ? d.phases : 'calendar' in d ? d.calendar : [];\n\t\tif (this.mode !== 'current' && list.length > 0) {\n\t\t\tconst month = 'month' in d ? d.month : undefined;\n\t\t\tconst year = 'year' in d ? d.year : undefined;\n\t\t\treturn html`<article class=\"card\" aria-label=\"Moon phase calendar\"><h2 class=\"label\">${month ?? 'Moon phases'} ${year ?? ''}</h2><div class=\"list\" role=\"list\">${list.map((phase) => this.renderListItem(phase))}</div></article>`;\n\t\t}\n\t\tif (!('phase' in d)) return nothing;\n\t\treturn this.renderSingle(d);\n\t}\n\n\tprivate renderSingle(d: GetCurrentMoonPhaseResponse) {\n\t\tconst emoji = phaseEmoji(d.phase);\n\t\treturn html`<article class=\"card\" aria-label=\"Current moon phase\"><div class=\"hero\"><span class=\"emoji\" aria-hidden=\"true\">${emoji}</span><div><h2 class=\"label\">${d.phase ?? 'Moon'}</h2>${d.date ? html`<div class=\"date\">${d.date}</div>` : nothing}</div></div><div class=\"stats\">${\n\t\t\t\t\ttypeof d.illumination === 'number'\n\t\t\t\t\t\t? html`<div><span>Illumination</span> <strong>${formatIllumination(d.illumination)}</strong></div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${\n\t\t\t\t\ttypeof d.age === 'number'\n\t\t\t\t\t\t? html`<div><span>Age</span> <strong>${formatNumber(d.age, 1)} days</strong></div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${\n\t\t\t\t\td.sign\n\t\t\t\t\t\t? html`<div><span>Sign</span> <strong>${d.sign}</strong></div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${\n\t\t\t\t\ttypeof d.distance === 'number'\n\t\t\t\t\t\t? html`<div><span>Distance</span> <strong>${(d.distance / 1000).toFixed(0)}k km</strong></div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</div>${\n\t\t\t\td.meaning?.description\n\t\t\t\t\t? html`<p class=\"meaning\">${d.meaning.description}</p>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\td.meaning?.keywords?.length\n\t\t\t\t\t? html`<div class=\"keywords\">${d.meaning.keywords.map((k) => html`<span>${k}</span>`)}</div>`\n\t\t\t\t\t: nothing\n\t\t\t}</article>`;\n\t}\n\n\tprivate renderListItem(p: MoonListEntry) {\n\t\tconst emoji = phaseEmoji(p.phase);\n\t\treturn html`<div class=\"list-item\" role=\"listitem\"><span aria-hidden=\"true\">${emoji}</span> <span>${p.phase}</span> <span>${p.date ?? ''}</span></div>`;\n\t}\n}\n\nfunction phaseEmoji(phase: string | undefined): string {\n\tif (!phase) return '\uD83C\uDF19';\n\treturn MOON_PHASE_EMOJI[phase.toLowerCase()] ?? '\uD83C\uDF19';\n}\n\nfunction formatIllumination(v: number): string {\n\tconst pct = v <= 1 ? v * 100 : v;\n\treturn `${Math.round(pct)}%`;\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-moon-phase': RoxyMoonPhase;\n\t}\n}\n", "/**\n * Symbol constants used across components. Single source of truth so chart\n * wheels, card headers, hexagram displays, and panchang tables stay visually\n * consistent.\n */\n\nexport const PLANET_GLYPH: Record<string, string> = {\n\tSun: '\u2609',\n\tMoon: '\u263D',\n\tMercury: '\u263F',\n\tVenus: '\u2640',\n\tEarth: '\u2641',\n\tMars: '\u2642',\n\tJupiter: '\u2643',\n\tSaturn: '\u2644',\n\tUranus: '\u2645',\n\tNeptune: '\u2646',\n\tPluto: '\u2647',\n\tRahu: '\u260A',\n\tKetu: '\u260B',\n\tAscendant: 'Asc',\n\tLagna: 'La',\n\tNorthNode: '\u260A',\n\tSouthNode: '\u260B',\n\t'North node': '\u260A',\n\t'South node': '\u260B',\n\tChiron: '\u26B7',\n\tLilith: '\u26B8',\n\t'Black moon lilith': '\u26B8',\n};\n\nexport const PLANET_ABBR: Record<string, string> = {\n\tSun: 'Su',\n\tMoon: 'Mo',\n\tMercury: 'Me',\n\tVenus: 'Ve',\n\tMars: 'Ma',\n\tJupiter: 'Ju',\n\tSaturn: 'Sa',\n\tUranus: 'Ur',\n\tNeptune: 'Ne',\n\tPluto: 'Pl',\n\tRahu: 'Ra',\n\tKetu: 'Ke',\n\tAscendant: 'Asc',\n\tLagna: 'La',\n};\n\nexport const SIGN_GLYPH: Record<string, string> = {\n\tAries: '\u2648',\n\tTaurus: '\u2649',\n\tGemini: '\u264A',\n\tCancer: '\u264B',\n\tLeo: '\u264C',\n\tVirgo: '\u264D',\n\tLibra: '\u264E',\n\tScorpio: '\u264F',\n\tSagittarius: '\u2650',\n\tCapricorn: '\u2651',\n\tAquarius: '\u2652',\n\tPisces: '\u2653',\n};\n\nexport const SIGN_ABBR: Record<string, string> = {\n\tAries: 'Ar',\n\tTaurus: 'Ta',\n\tGemini: 'Ge',\n\tCancer: 'Cn',\n\tLeo: 'Le',\n\tVirgo: 'Vi',\n\tLibra: 'Li',\n\tScorpio: 'Sc',\n\tSagittarius: 'Sg',\n\tCapricorn: 'Cp',\n\tAquarius: 'Aq',\n\tPisces: 'Pi',\n};\n\nexport const SIGNS_ORDER = [\n\t'Aries',\n\t'Taurus',\n\t'Gemini',\n\t'Cancer',\n\t'Leo',\n\t'Virgo',\n\t'Libra',\n\t'Scorpio',\n\t'Sagittarius',\n\t'Capricorn',\n\t'Aquarius',\n\t'Pisces',\n] as const;\n\n/**\n * Lowercase rashi keys in canonical zodiac order. Derived from `SIGNS_ORDER`\n * so the two stay in lockstep. The /vedic-astrology/birth-chart response\n * carries planet buckets keyed by these names.\n */\nexport const RASHI_KEYS = SIGNS_ORDER.map((s) =>\n\ts.toLowerCase(),\n) as readonly Lowercase<(typeof SIGNS_ORDER)[number]>[];\n\n/** Aspect symbols. Used by synastry and natal chart aspect tables. */\nexport const ASPECT_SYMBOL: Record<string, string> = {\n\tconjunction: '\u260C',\n\topposition: '\u260D',\n\ttrine: '\u25B3',\n\tsquare: '\u25A1',\n\tsextile: '\u2731',\n\tquincunx: '\u22BB',\n\tsemisextile: '\u22BC',\n};\n\n/** Trigrams used by I Ching hexagrams. Eight trigrams compose 64 hexagrams. */\nexport const TRIGRAM_GLYPH: Record<string, string> = {\n\theaven: '\u2630',\n\tlake: '\u2631',\n\tfire: '\u2632',\n\tthunder: '\u2633',\n\twind: '\u2634',\n\twater: '\u2635',\n\tmountain: '\u2636',\n\tearth: '\u2637',\n\tHeaven: '\u2630',\n\tLake: '\u2631',\n\tFire: '\u2632',\n\tThunder: '\u2633',\n\tWind: '\u2634',\n\tWater: '\u2635',\n\tMountain: '\u2636',\n\tEarth: '\u2637',\n};\n\n/** Moon phase emoji set. Used by moon phase card. */\nexport const MOON_PHASE_EMOJI: Record<string, string> = {\n\t'new moon': '\uD83C\uDF11',\n\t'waxing crescent': '\uD83C\uDF12',\n\t'first quarter': '\uD83C\uDF13',\n\t'waxing gibbous': '\uD83C\uDF14',\n\t'full moon': '\uD83C\uDF15',\n\t'waning gibbous': '\uD83C\uDF16',\n\t'last quarter': '\uD83C\uDF17',\n\t'waning crescent': '\uD83C\uDF18',\n};\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "/**\n * Display formatters for ISO timestamps and floats coming back from the API.\n * Every helper returns \"\" for nullish or unparseable input so it falls out of\n * template literals cleanly.\n */\n\nexport function formatTime(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tif (/^\\d{4}-\\d{2}-\\d{2}$/.test(input)) return '';\n\tconst bareTime = /^\\d{2}:\\d{2}(:\\d{2})?$/.test(input);\n\tconst iso = bareTime ? `1970-01-01T${input}` : input;\n\tconst d = new Date(iso);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleTimeString(undefined, {\n\t\thour: 'numeric',\n\t\tminute: '2-digit',\n\t\thour12: true,\n\t});\n}\n\nexport function formatDate(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tconst d = new Date(\n\t\t/^\\d{4}-\\d{2}-\\d{2}$/.test(input) ? `${input}T00:00:00` : input,\n\t);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleDateString(undefined, {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t\tyear: 'numeric',\n\t});\n}\n\nexport function formatTimeRange(\n\tt: { start?: string; end?: string } | undefined,\n): string {\n\tif (!t) return '';\n\tconst start = formatTime(t.start);\n\tconst end = formatTime(t.end);\n\tif (start && end) return `${start} - ${end}`;\n\treturn start || end || '';\n}\n\nexport function formatNumber(value: unknown, dp = 1): string {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return '';\n\treturn value.toFixed(dp).replace(/\\.?0+$/, '');\n}\n\nexport function formatPercent(value: unknown, dp = 1): string {\n\tconst n = formatNumber(value, dp);\n\treturn n ? `${n}%` : '';\n}\n\n/**\n * CSS class name per aspect type. Used by natal and synastry chart aspect\n * lines so the same color encoding (harmonious vs challenging) applies in\n * both wheels. Keys are lowercase canonical names, values are CSS class\n * suffixes the chart components define in their `:host` styles.\n */\nexport const ASPECT_CLASS: Record<string, string> = {\n\tconjunction: 'aspect-conjunction',\n\tsextile: 'aspect-sextile',\n\tsquare: 'aspect-square',\n\ttrine: 'aspect-trine',\n\topposition: 'aspect-opposition',\n};\n\n/**\n * Normalize the `type` field on an aspect entry to a lowercase, hyphen-separated\n * canonical name (`SEMI_SEXTILE` \u2192 `semi-sextile`). Accepts any aspect-shaped\n * object so both natal and synastry inter-aspect entries can share this.\n */\nexport function normalizeAspect(a: { type?: string }): string {\n\treturn (a.type ?? '').toLowerCase().replace(/_/g, '-');\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n"],
|
|
5
|
-
"mappings": "wMAAA,OAAS,OAAAA,EAAK,QAAAC,EAAM,cAAAC,EAAY,WAAAC,MAAe,MAC/C,OAAS,iBAAAC,EAAe,YAAAC,MAAgB,oBC6EjC,IAAMC,EAAc,CAC1B,QACA,SACA,SACA,SACA,MACA,QACA,QACA,UACA,cACA,YACA,WACA,QACD,EAOaC,EAAaD,EAAY,IAAKE,GAC1CA,EAAE,YAAY,CACf,EAkCO,IAAMC,EAA2C,CACvD,WAAY,YACZ,kBAAmB,YACnB,gBAAiB,YACjB,iBAAkB,YAClB,YAAa,YACb,iBAAkB,YAClB,eAAgB,YAChB,kBAAmB,WACpB,EC/IA,OAAS,OAAAC,MAAW,MAMb,IAAMC,EAAaD,myCCqCnB,SAASE,EAAaC,EAAgBC,EAAK,EAAW,CAC5D,OAAI,OAAOD,GAAU,UAAY,CAAC,OAAO,SAASA,CAAK,EAAU,GAC1DA,EAAM,QAAQC,CAAE,EAAE,QAAQ,SAAU,EAAE,CAC9C,CClCA,IAAMC,EAAkB,
|
|
6
|
-
"names": ["css", "html", "LitElement", "nothing", "customElement", "property", "SIGNS_ORDER", "RASHI_KEYS", "s", "MOON_PHASE_EMOJI", "css", "baseStyles", "formatNumber", "value", "dp", "ROXY_DATA_CLASS", "isJsonScript", "el", "MarkupDataController", "host", "parsed", "inline", "child", "text", "RoxyMoonPhase", "LitElement", "MarkupDataController", "d", "html", "list", "month", "year", "phase", "nothing", "emoji", "phaseEmoji", "formatIllumination", "formatNumber", "k", "p", "baseStyles", "css", "__decorateClass", "property", "customElement", "MOON_PHASE_EMOJI", "v", "pct"]
|
|
4
|
+
"sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { MOON_PHASE_EMOJI } from '../tokens/index.js';\nimport type {\n\tGetCurrentMoonPhaseResponse,\n\tGetMoonCalendarResponse,\n\tGetUpcomingMoonPhasesResponse,\n} from '../types/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { formatNumber } from '../utils/format.js';\nimport { MarkupDataController } from '../utils/markup-data.js';\n\ntype MoonPhaseData =\n\t| GetCurrentMoonPhaseResponse\n\t| GetUpcomingMoonPhasesResponse\n\t| GetMoonCalendarResponse;\ntype MoonListEntry =\n\t| GetUpcomingMoonPhasesResponse['phases'][number]\n\t| GetMoonCalendarResponse['calendar'][number];\n\n/**\n * Moon phase card. Renders /astrology/moon-phase/{current,upcoming,calendar/...}.\n */\n@customElement('roxy-moon-phase')\nexport class RoxyMoonPhase extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.card{background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);gap:var(--roxy-space-md,1rem);display:grid}.hero{align-items:center;gap:var(--roxy-space-md,1rem);display:flex}.emoji{font-size:3rem;line-height:1}.label{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);text-transform:capitalize;margin:0}.date{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}.stats{gap:var(--roxy-space-md,1rem);font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-secondary,#475569);grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));display:grid}.stats div span:first-child{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);text-transform:uppercase;letter-spacing:.06em;display:block}.stats strong{color:var(--roxy-fg,#0a0a0a);font-variant-numeric:tabular-nums}.meaning{color:var(--roxy-fg,#0a0a0a)}.keywords{gap:var(--roxy-space-xs,.25rem);margin-top:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.keywords span{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 14%, transparent);border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);padding:2px 8px}.list{gap:var(--roxy-space-sm,.5rem);display:grid}.list-item{gap:var(--roxy-space-sm,.5rem);border-bottom:1px solid var(--roxy-border,#e4e4e7);padding:var(--roxy-space-sm,.5rem) 0;font-size:var(--roxy-text-sm,.875rem);grid-template-columns:2.5rem 1fr auto;align-items:center;display:grid}.list-item:last-child{border-bottom:none}`,\n\t];\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Enables hydrating `data` from a direct-child\n\t\t// <script type=\"application/json\" class=\"roxy-data\"> for server-rendered\n\t\t// and cached consumers. The JavaScript `data` property still wins.\n\t\tnew MarkupDataController(this);\n\t}\n\n\t@property({ attribute: false })\n\tdata: MoonPhaseData | null = null;\n\n\t@property({ type: String, reflect: true })\n\tmode: 'current' | 'upcoming' | 'calendar' = 'current';\n\n\trender() {\n\t\tconst d = this.data;\n\t\tif (!d)\n\t\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No moon phase data</div>`;\n\t\tconst list: MoonListEntry[] =\n\t\t\t'phases' in d ? d.phases : 'calendar' in d ? d.calendar : [];\n\t\tif (this.mode !== 'current' && list.length > 0) {\n\t\t\tconst month = 'month' in d ? d.month : undefined;\n\t\t\tconst year = 'year' in d ? d.year : undefined;\n\t\t\treturn html`<article class=\"card\" aria-label=\"Moon phase calendar\"><h2 class=\"label\">${month ?? 'Moon phases'} ${year ?? ''}</h2><div class=\"list\" role=\"list\">${list.map((phase) => this.renderListItem(phase))}</div></article>`;\n\t\t}\n\t\tif (!('phase' in d)) return nothing;\n\t\treturn this.renderSingle(d);\n\t}\n\n\tprivate renderSingle(d: GetCurrentMoonPhaseResponse) {\n\t\tconst emoji = phaseEmoji(d.phase);\n\t\treturn html`<article class=\"card\" aria-label=\"Current moon phase\"><div class=\"hero\"><span class=\"emoji\" aria-hidden=\"true\">${emoji}</span><div><h2 class=\"label\">${d.phase ?? 'Moon'}</h2>${d.date ? html`<div class=\"date\">${d.date}</div>` : nothing}</div></div><div class=\"stats\">${\n\t\t\t\t\ttypeof d.illumination === 'number'\n\t\t\t\t\t\t? html`<div><span>Illumination</span> <strong>${formatIllumination(d.illumination)}</strong></div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${\n\t\t\t\t\ttypeof d.age === 'number'\n\t\t\t\t\t\t? html`<div><span>Age</span> <strong>${formatNumber(d.age, 1)} days</strong></div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${\n\t\t\t\t\td.sign\n\t\t\t\t\t\t? html`<div><span>Sign</span> <strong>${d.sign}</strong></div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${\n\t\t\t\t\ttypeof d.distance === 'number'\n\t\t\t\t\t\t? html`<div><span>Distance</span> <strong>${(d.distance / 1000).toFixed(0)}k km</strong></div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</div>${\n\t\t\t\td.meaning?.description\n\t\t\t\t\t? html`<p class=\"meaning\">${d.meaning.description}</p>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\td.meaning?.keywords?.length\n\t\t\t\t\t? html`<div class=\"keywords\">${d.meaning.keywords.map((k) => html`<span>${k}</span>`)}</div>`\n\t\t\t\t\t: nothing\n\t\t\t}</article>`;\n\t}\n\n\tprivate renderListItem(p: MoonListEntry) {\n\t\tconst emoji = phaseEmoji(p.phase);\n\t\treturn html`<div class=\"list-item\" role=\"listitem\"><span aria-hidden=\"true\">${emoji}</span> <span>${p.phase}</span> <span>${p.date ?? ''}</span></div>`;\n\t}\n}\n\nfunction phaseEmoji(phase: string | undefined): string {\n\tif (!phase) return '\uD83C\uDF19';\n\treturn MOON_PHASE_EMOJI[phase.toLowerCase()] ?? '\uD83C\uDF19';\n}\n\nfunction formatIllumination(v: number): string {\n\tconst pct = v <= 1 ? v * 100 : v;\n\treturn `${Math.round(pct)}%`;\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-moon-phase': RoxyMoonPhase;\n\t}\n}\n", "/**\n * Symbol constants used across components. Single source of truth so chart\n * wheels, card headers, hexagram displays, and panchang tables stay visually\n * consistent.\n */\n\nexport const PLANET_GLYPH: Record<string, string> = {\n\tSun: '\u2609',\n\tMoon: '\u263D',\n\tMercury: '\u263F',\n\tVenus: '\u2640',\n\tEarth: '\u2641',\n\tMars: '\u2642',\n\tJupiter: '\u2643',\n\tSaturn: '\u2644',\n\tUranus: '\u2645',\n\tNeptune: '\u2646',\n\tPluto: '\u2647',\n\tRahu: '\u260A',\n\tKetu: '\u260B',\n\tAscendant: 'Asc',\n\tLagna: 'La',\n\tNorthNode: '\u260A',\n\tSouthNode: '\u260B',\n\t'North node': '\u260A',\n\t'South node': '\u260B',\n\tChiron: '\u26B7',\n\tLilith: '\u26B8',\n\t'Black moon lilith': '\u26B8',\n};\n\nexport const PLANET_ABBR: Record<string, string> = {\n\tSun: 'Su',\n\tMoon: 'Mo',\n\tMercury: 'Me',\n\tVenus: 'Ve',\n\tMars: 'Ma',\n\tJupiter: 'Ju',\n\tSaturn: 'Sa',\n\tUranus: 'Ur',\n\tNeptune: 'Ne',\n\tPluto: 'Pl',\n\tRahu: 'Ra',\n\tKetu: 'Ke',\n\tAscendant: 'Asc',\n\tLagna: 'La',\n};\n\nexport const SIGN_GLYPH: Record<string, string> = {\n\tAries: '\u2648',\n\tTaurus: '\u2649',\n\tGemini: '\u264A',\n\tCancer: '\u264B',\n\tLeo: '\u264C',\n\tVirgo: '\u264D',\n\tLibra: '\u264E',\n\tScorpio: '\u264F',\n\tSagittarius: '\u2650',\n\tCapricorn: '\u2651',\n\tAquarius: '\u2652',\n\tPisces: '\u2653',\n};\n\nexport const SIGN_ABBR: Record<string, string> = {\n\tAries: 'Ar',\n\tTaurus: 'Ta',\n\tGemini: 'Ge',\n\tCancer: 'Cn',\n\tLeo: 'Le',\n\tVirgo: 'Vi',\n\tLibra: 'Li',\n\tScorpio: 'Sc',\n\tSagittarius: 'Sg',\n\tCapricorn: 'Cp',\n\tAquarius: 'Aq',\n\tPisces: 'Pi',\n};\n\nexport const SIGNS_ORDER = [\n\t'Aries',\n\t'Taurus',\n\t'Gemini',\n\t'Cancer',\n\t'Leo',\n\t'Virgo',\n\t'Libra',\n\t'Scorpio',\n\t'Sagittarius',\n\t'Capricorn',\n\t'Aquarius',\n\t'Pisces',\n] as const;\n\n/**\n * Lowercase rashi keys in canonical zodiac order. Derived from `SIGNS_ORDER`\n * so the two stay in lockstep. The /vedic-astrology/birth-chart response\n * carries planet buckets keyed by these names.\n */\nexport const RASHI_KEYS = SIGNS_ORDER.map((s) =>\n\ts.toLowerCase(),\n) as readonly Lowercase<(typeof SIGNS_ORDER)[number]>[];\n\n/** Aspect symbols. Used by synastry and natal chart aspect tables. */\nexport const ASPECT_SYMBOL: Record<string, string> = {\n\tconjunction: '\u260C',\n\topposition: '\u260D',\n\ttrine: '\u25B3',\n\tsquare: '\u25A1',\n\tsextile: '\u2731',\n\tquincunx: '\u22BB',\n\tsemisextile: '\u22BC',\n};\n\n/** Trigrams used by I Ching hexagrams. Eight trigrams compose 64 hexagrams. */\nexport const TRIGRAM_GLYPH: Record<string, string> = {\n\theaven: '\u2630',\n\tlake: '\u2631',\n\tfire: '\u2632',\n\tthunder: '\u2633',\n\twind: '\u2634',\n\twater: '\u2635',\n\tmountain: '\u2636',\n\tearth: '\u2637',\n\tHeaven: '\u2630',\n\tLake: '\u2631',\n\tFire: '\u2632',\n\tThunder: '\u2633',\n\tWind: '\u2634',\n\tWater: '\u2635',\n\tMountain: '\u2636',\n\tEarth: '\u2637',\n};\n\n/** Moon phase emoji set. Used by moon phase card. */\nexport const MOON_PHASE_EMOJI: Record<string, string> = {\n\t'new moon': '\uD83C\uDF11',\n\t'waxing crescent': '\uD83C\uDF12',\n\t'first quarter': '\uD83C\uDF13',\n\t'waxing gibbous': '\uD83C\uDF14',\n\t'full moon': '\uD83C\uDF15',\n\t'waning gibbous': '\uD83C\uDF16',\n\t'last quarter': '\uD83C\uDF17',\n\t'waning crescent': '\uD83C\uDF18',\n};\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "/**\n * Display formatters for ISO timestamps and floats coming back from the API.\n * Every helper returns \"\" for nullish or unparseable input so it falls out of\n * template literals cleanly.\n */\n\nexport function formatTime(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tif (/^\\d{4}-\\d{2}-\\d{2}$/.test(input)) return '';\n\tconst bareTime = /^\\d{2}:\\d{2}(:\\d{2})?$/.test(input);\n\tconst iso = bareTime ? `1970-01-01T${input}` : input;\n\tconst d = new Date(iso);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleTimeString(undefined, {\n\t\thour: 'numeric',\n\t\tminute: '2-digit',\n\t\thour12: true,\n\t});\n}\n\nexport function formatDate(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tconst d = new Date(\n\t\t/^\\d{4}-\\d{2}-\\d{2}$/.test(input) ? `${input}T00:00:00` : input,\n\t);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleDateString(undefined, {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t\tyear: 'numeric',\n\t});\n}\n\nexport function formatTimeRange(\n\tt: { start?: string; end?: string } | undefined,\n): string {\n\tif (!t) return '';\n\tconst start = formatTime(t.start);\n\tconst end = formatTime(t.end);\n\tif (start && end) return `${start} - ${end}`;\n\treturn start || end || '';\n}\n\nexport function formatNumber(value: unknown, dp = 1): string {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return '';\n\treturn value.toFixed(dp).replace(/\\.?0+$/, '');\n}\n\nexport function formatPercent(value: unknown, dp = 1): string {\n\tconst n = formatNumber(value, dp);\n\treturn n ? `${n}%` : '';\n}\n\n/**\n * CSS class name per aspect type. Used by natal and synastry chart aspect\n * lines so the same color encoding (harmonious vs challenging) applies in\n * both wheels. Keys are lowercase canonical names, values are CSS class\n * suffixes the chart components define in their `:host` styles.\n */\nexport const ASPECT_CLASS: Record<string, string> = {\n\tconjunction: 'aspect-conjunction',\n\tsextile: 'aspect-sextile',\n\tsquare: 'aspect-square',\n\ttrine: 'aspect-trine',\n\topposition: 'aspect-opposition',\n};\n\n/**\n * Normalize the `type` field on an aspect entry to a lowercase, hyphen-separated\n * canonical name (`SEMI_SEXTILE` \u2192 `semi-sextile`). Accepts any aspect-shaped\n * object so both natal and synastry inter-aspect entries can share this.\n */\nexport function normalizeAspect(a: { type?: string }): string {\n\treturn (a.type ?? '').toLowerCase().replace(/_/g, '-');\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * Serialize a RoxyAPI response for embedding inside an inline `<script type=\"application/json\" class=\"roxy-data\">`. This is the safe writer counterpart to {@link MarkupDataController}, the reader: server-rendered and cached consumers (WordPress, JSX SSR, static HTML) emit the script with this, and the component hydrates `data` from it on connect.\n *\n * @remarks\n * Use this instead of a bare `JSON.stringify`. A raw stringify of a response that contains the literal text `</script>` (common in long interpretation prose) closes the script element early, corrupting the page and creating an HTML-injection vector. This escapes the script-unsafe characters to their `\\uXXXX` JSON escapes, which `JSON.parse` restores to the original characters, so the value the component receives is identical to the response you passed.\n *\n * `<` is the load-bearing escape (it defeats `</script>` and `<!--`). `>` and `&` are escaped for defence in depth, and U+2028 / U+2029 because they are valid in JSON yet are line terminators in a `<script>` context and break some parsers. The escapes introduce only `\\uXXXX` sequences, so the replacements never feed each other and order is irrelevant.\n *\n * Pass the unwrapped RoxyAPI response, the same shape you would assign to `element.data`. Do not pass the SDK envelope (`{ data, error, request, response }`).\n *\n * @example\n * ```ts\n * import { serializeRoxyData } from '@roxyapi/ui';\n *\n * const { data } = await roxy.dreams.getDreamSymbol({ path: { id: 'water' } });\n * const html = `<roxy-dream-card><script type=\"application/json\" class=\"roxy-data\">${serializeRoxyData(data)}</script></roxy-dream-card>`;\n * ```\n */\nexport function serializeRoxyData(data: unknown): string {\n\treturn JSON.stringify(data)\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/&/g, '\\\\u0026')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n\n/**\n * Build the complete `<script type=\"application/json\" class=\"roxy-data\">\u2026</script>` element a server nests inside a `roxy-*` component for the no-JavaScript hydration path. The payload is escaped via {@link serializeRoxyData}, so it is safe to drop straight into HTML output.\n *\n * @remarks\n * The element carries both `type=\"application/json\"` and `class=\"roxy-data\"` because {@link MarkupDataController} reads only a direct-child script that has both. Emit one of these inside the target component; the JavaScript `data` property still wins if it is later assigned.\n *\n * @example\n * ```ts\n * import { roxyDataScript } from '@roxyapi/ui';\n *\n * const { data } = await roxy.crystals.getCrystal({ path: { id: 'amethyst' } });\n * const html = `<roxy-crystal-grid>${roxyDataScript(data)}</roxy-crystal-grid>`;\n * ```\n */\nexport function roxyDataScript(data: unknown): string {\n\treturn `<script type=\"application/json\" class=\"${ROXY_DATA_CLASS}\">${serializeRoxyData(data)}</script>`;\n}\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n"],
|
|
5
|
+
"mappings": "wMAAA,OAAS,OAAAA,EAAK,QAAAC,EAAM,cAAAC,EAAY,WAAAC,MAAe,MAC/C,OAAS,iBAAAC,EAAe,YAAAC,MAAgB,oBC6EjC,IAAMC,EAAc,CAC1B,QACA,SACA,SACA,SACA,MACA,QACA,QACA,UACA,cACA,YACA,WACA,QACD,EAOaC,EAAaD,EAAY,IAAKE,GAC1CA,EAAE,YAAY,CACf,EAkCO,IAAMC,EAA2C,CACvD,WAAY,YACZ,kBAAmB,YACnB,gBAAiB,YACjB,iBAAkB,YAClB,YAAa,YACb,iBAAkB,YAClB,eAAgB,YAChB,kBAAmB,WACpB,EC/IA,OAAS,OAAAC,MAAW,MAMb,IAAMC,EAAaD,myCCqCnB,SAASE,EAAaC,EAAgBC,EAAK,EAAW,CAC5D,OAAI,OAAOD,GAAU,UAAY,CAAC,OAAO,SAASA,CAAK,EAAU,GAC1DA,EAAM,QAAQC,CAAE,EAAE,QAAQ,SAAU,EAAE,CAC9C,CClCA,IAAMC,EAAkB,YAkDxB,SAASC,EAAaC,EAAsB,CAC3C,OACCA,EAAG,WAAa,UAAYA,EAAG,aAAa,MAAM,IAAM,kBAE1D,CA2CO,IAAMC,EAAN,KAAsE,CAG5E,YAAYC,EAAgB,CAC3B,KAAK,KAAOA,EACZA,EAAK,cAAc,IAAI,CACxB,CAEA,eAAgB,CAGf,GAAI,KAAK,KAAK,MAAQ,KAAM,OAE5B,IAAMC,EAAS,KAAK,KAAK,EACrBA,IAAW,SAEf,KAAK,KAAK,KAAOA,EACjB,KAAK,KAAK,cAAc,EACzB,CAKQ,MAAsB,CAC7B,IAAMC,EAAS,KAAK,iBAAiB,EACrC,OAAOA,EAAS,KAAK,MAAMA,EAAO,WAAW,EAAI,MAClD,CAKQ,kBAAmC,CAC1C,QAAWC,KAAS,MAAM,KAAK,KAAK,KAAK,QAAQ,EAChD,GAAIN,EAAaM,CAAK,GAAKA,EAAM,UAAU,SAASC,CAAe,EAClE,OAAOD,EAGT,OAAO,IACR,CAEQ,MAAME,EAAoC,CACjD,GAAKA,GAAM,KAAK,EAChB,GAAI,CACH,OAAO,KAAK,MAAMA,CAAI,CACvB,MAAQ,CAGP,MACD,CACD,CACD,EJvIO,IAAMC,EAAN,cAA4BC,CAAW,CAM7C,aAAc,CACb,MAAM,EAQP,UAA6B,KAG7B,UAA4C,UAP3C,IAAIC,EAAqB,IAAI,CAC9B,CAQA,QAAS,CACR,IAAMC,EAAI,KAAK,KACf,GAAI,CAACA,EACJ,OAAOC,kEACR,IAAMC,EACL,WAAYF,EAAIA,EAAE,OAAS,aAAcA,EAAIA,EAAE,SAAW,CAAC,EAC5D,GAAI,KAAK,OAAS,WAAaE,EAAK,OAAS,EAAG,CAC/C,IAAMC,EAAQ,UAAWH,EAAIA,EAAE,MAAQ,OACjCI,EAAO,SAAUJ,EAAIA,EAAE,KAAO,OACpC,OAAOC,6EAAgFE,GAAS,aAAa,IAAIC,GAAQ,EAAE,sCAAsCF,EAAK,IAAKG,GAAU,KAAK,eAAeA,CAAK,CAAC,CAAC,kBACjN,CACA,MAAM,UAAWL,EACV,KAAK,aAAaA,CAAC,EADEM,CAE7B,CAEQ,aAAaN,EAAgC,CACpD,IAAMO,EAAQC,EAAWR,EAAE,KAAK,EAChC,OAAOC,mHAAsHM,CAAK,iCAAiCP,EAAE,OAAS,MAAM,QAAQA,EAAE,KAAOC,sBAAyBD,EAAE,IAAI,SAAWM,CAAO,kCACnP,OAAON,EAAE,cAAiB,SACvBC,2CAA8CQ,EAAmBT,EAAE,YAAY,CAAC,kBAChFM,CACJ,IACC,OAAON,EAAE,KAAQ,SACdC,kCAAqCS,EAAaV,EAAE,IAAK,CAAC,CAAC,uBAC3DM,CACJ,IACCN,EAAE,KACCC,mCAAsCD,EAAE,IAAI,kBAC5CM,CACJ,IACC,OAAON,EAAE,UAAa,SACnBC,wCAA2CD,EAAE,SAAW,KAAM,QAAQ,CAAC,CAAC,sBACxEM,CACJ,SACAN,EAAE,SAAS,YACRC,uBAA0BD,EAAE,QAAQ,WAAW,OAC/CM,CACJ,IACCN,EAAE,SAAS,UAAU,OAClBC,0BAA6BD,EAAE,QAAQ,SAAS,IAAKW,GAAMV,UAAaU,CAAC,SAAS,CAAC,SACnFL,CACJ,YACF,CAEQ,eAAeM,EAAkB,CACxC,IAAML,EAAQC,EAAWI,EAAE,KAAK,EAChC,OAAOX,oEAAuEM,CAAK,iBAAiBK,EAAE,KAAK,iBAAiBA,EAAE,MAAQ,EAAE,eACzI,CACD,EApEaf,EACL,OAAS,CACfgB,EACAC,8kDACD,EAWAC,EAAA,CADCC,EAAS,CAAE,UAAW,EAAM,CAAC,GAdlBnB,EAeZ,oBAGAkB,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAjB7BnB,EAkBZ,oBAlBYA,EAANkB,EAAA,CADNE,EAAc,iBAAiB,GACnBpB,GAsEb,SAASW,EAAWH,EAAmC,CACtD,OAAKA,EACEa,EAAiBb,EAAM,YAAY,CAAC,GAAK,YAD7B,WAEpB,CAEA,SAASI,EAAmBU,EAAmB,CAC9C,IAAMC,EAAMD,GAAK,EAAIA,EAAI,IAAMA,EAC/B,MAAO,GAAG,KAAK,MAAMC,CAAG,CAAC,GAC1B",
|
|
6
|
+
"names": ["css", "html", "LitElement", "nothing", "customElement", "property", "SIGNS_ORDER", "RASHI_KEYS", "s", "MOON_PHASE_EMOJI", "css", "baseStyles", "formatNumber", "value", "dp", "ROXY_DATA_CLASS", "isJsonScript", "el", "MarkupDataController", "host", "parsed", "inline", "child", "ROXY_DATA_CLASS", "text", "RoxyMoonPhase", "LitElement", "MarkupDataController", "d", "html", "list", "month", "year", "phase", "nothing", "emoji", "phaseEmoji", "formatIllumination", "formatNumber", "k", "p", "baseStyles", "css", "__decorateClass", "property", "customElement", "MOON_PHASE_EMOJI", "v", "pct"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var y=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
var y=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var m=(s,e,r,t)=>{for(var n=t>1?void 0:t?x(e,r):e,l=s.length-1,c;l>=0;l--)(c=s[l])&&(n=(t?c(e,r,n):c(n))||n);return t&&n&&y(e,r,n),n};import{css as v,html as a,LitElement as h,nothing as o}from"lit";import{customElement as b,property as $}from"lit/decorators.js";import{css as f}from"lit";var p=f`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;var u="roxy-data";function g(s){return s.nodeName==="SCRIPT"&&s.getAttribute("type")==="application/json"}var d=class{constructor(e){this.host=e,e.addController(this)}hostConnected(){if(this.host.data!=null)return;let e=this.read();e!==void 0&&(this.host.data=e,this.host.requestUpdate())}read(){let e=this.findInlineScript();return e?this.parse(e.textContent):void 0}findInlineScript(){for(let e of Array.from(this.host.children))if(g(e)&&e.classList.contains(u))return e;return null}parse(e){if(e?.trim())try{return JSON.parse(e)}catch{return}}};var i=class extends h{constructor(){super();this.data=null;new d(this)}render(){if(!this.data)return a`<div class="roxy-empty" role="status">No nakshatra data</div>`;let r=this.data,t=r.remedies;return a`<article class="wrap" aria-label="${`Nakshatra ${r.name}`}"><header class="head"><h2 class="name">${r.name}</h2>${typeof r.number=="number"?a`<span class="number">Nakshatra ${r.number} of 27</span>`:o} ${r.range?a`<span class="range">${r.range}</span>`:o}</header><dl class="facts">${r.lord?a`<div class="fact"><dt>Lord</dt><dd>${r.lord}</dd></div>`:o} ${r.deity?a`<div class="fact"><dt>Deity</dt><dd>${r.deity}</dd></div>`:o} ${r.symbol?a`<div class="fact"><dt>Symbol</dt><dd>${r.symbol}</dd></div>`:o}</dl>${r.characteristics?a`<div class="section"><h3>Characteristics</h3><p>${r.characteristics}</p></div>`:o} ${t?a`<div class="section"><h3>Remedies</h3><div class="remedies">${t.mantras?a`<div class="remedy"><strong>Mantras:</strong> ${t.mantras}</div>`:o} ${t.gemstones?a`<div class="remedy"><strong>Gemstones:</strong> ${t.gemstones}</div>`:o} ${t.rituals?a`<div class="remedy"><strong>Rituals:</strong> ${t.rituals}</div>`:o}</div></div>`:o}</article>`}};i.styles=[p,v`.wrap{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);background:var(--roxy-bg,#fff);padding:var(--roxy-space-md,1rem);gap:var(--roxy-space-md,1rem);box-shadow:var(--roxy-shadow-sm);display:grid}.head{align-items:baseline;gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.name{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.number{color:var(--roxy-accent-ink,#b45309);font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600)}.range{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}.facts{gap:var(--roxy-space-sm,.5rem);grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));display:grid}.fact{gap:2px;display:grid}.fact dt{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);text-transform:uppercase;letter-spacing:.05em}.fact dd{color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-sm,.875rem);margin:0}.section h3{margin:0 0 var(--roxy-space-xs,.25rem);font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.05em}.section p{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a);margin:0;line-height:1.5}.remedies{gap:var(--roxy-space-xs,.25rem);display:grid}.remedy{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a)}.remedy strong{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600)}`],m([$({attribute:!1})],i.prototype,"data",2),i=m([b("roxy-nakshatra-card")],i);export{i as RoxyNakshatraCard};
|
|
2
2
|
//# sourceMappingURL=nakshatra-card.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/nakshatra-card.ts", "../../src/utils/base-styles.ts", "../../src/utils/markup-data.ts"],
|
|
4
|
-
"sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport type { NakshatraResponse } from '../types/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { MarkupDataController } from '../utils/markup-data.js';\n\n/**\n * Nakshatra reference card. Renders /vedic-astrology/nakshatras/{id}: the\n * lunar mansion number, longitude range, ruling planet, presiding deity,\n * symbol, native characteristics, and traditional remedies.\n */\n@customElement('roxy-nakshatra-card')\nexport class RoxyNakshatraCard extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.wrap{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);background:var(--roxy-bg,#fff);padding:var(--roxy-space-md,1rem);gap:var(--roxy-space-md,1rem);box-shadow:var(--roxy-shadow-sm);display:grid}.head{align-items:baseline;gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.name{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.number{color:var(--roxy-accent-ink,#b45309);font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600)}.range{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}.facts{gap:var(--roxy-space-sm,.5rem);grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));display:grid}.fact{gap:2px;display:grid}.fact dt{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);text-transform:uppercase;letter-spacing:.05em}.fact dd{color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-sm,.875rem);margin:0}.section h3{margin:0 0 var(--roxy-space-xs,.25rem);font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.05em}.section p{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a);margin:0;line-height:1.5}.remedies{gap:var(--roxy-space-xs,.25rem);display:grid}.remedy{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a)}.remedy strong{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600)}`,\n\t];\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Enables hydrating `data` from a direct-child\n\t\t// <script type=\"application/json\" class=\"roxy-data\"> for server-rendered\n\t\t// and cached consumers. The JavaScript `data` property still wins.\n\t\tnew MarkupDataController(this);\n\t}\n\n\t@property({ attribute: false })\n\tdata: NakshatraResponse | null = null;\n\n\trender() {\n\t\tif (!this.data)\n\t\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No nakshatra data</div>`;\n\t\tconst n = this.data;\n\t\tconst remedies = n.remedies;\n\n\t\treturn html`<article class=\"wrap\" aria-label=\"${`Nakshatra ${n.name}`}\"><header class=\"head\"><h2 class=\"name\">${n.name}</h2>${\n\t\t\t\t\ttypeof n.number === 'number'\n\t\t\t\t\t\t? html`<span class=\"number\">Nakshatra ${n.number} of 27</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${n.range ? html`<span class=\"range\">${n.range}</span>` : nothing}</header><dl class=\"facts\">${n.lord ? html`<div class=\"fact\"><dt>Lord</dt><dd>${n.lord}</dd></div>` : nothing} ${n.deity ? html`<div class=\"fact\"><dt>Deity</dt><dd>${n.deity}</dd></div>` : nothing} ${n.symbol ? html`<div class=\"fact\"><dt>Symbol</dt><dd>${n.symbol}</dd></div>` : nothing}</dl>${\n\t\t\t\tn.characteristics\n\t\t\t\t\t? html`<div class=\"section\"><h3>Characteristics</h3><p>${n.characteristics}</p></div>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tremedies\n\t\t\t\t\t? html`<div class=\"section\"><h3>Remedies</h3><div class=\"remedies\">${remedies.mantras ? html`<div class=\"remedy\"><strong>Mantras:</strong> ${remedies.mantras}</div>` : nothing} ${remedies.gemstones ? html`<div class=\"remedy\"><strong>Gemstones:</strong> ${remedies.gemstones}</div>` : nothing} ${remedies.rituals ? html`<div class=\"remedy\"><strong>Rituals:</strong> ${remedies.rituals}</div>` : nothing}</div></div>`\n\t\t\t\t\t: nothing\n\t\t\t}</article>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-nakshatra-card': RoxyNakshatraCard;\n\t}\n}\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n"],
|
|
5
|
-
"mappings": "wMAAA,OAAS,OAAAA,EAAK,QAAAC,EAAM,cAAAC,EAAY,WAAAC,MAAe,MAC/C,OAAS,iBAAAC,EAAe,YAAAC,MAAgB,oBCDxC,OAAS,OAAAC,MAAW,MAMb,IAAMC,EAAaD,myCCM1B,IAAME,EAAkB,
|
|
6
|
-
"names": ["css", "html", "LitElement", "nothing", "customElement", "property", "css", "baseStyles", "ROXY_DATA_CLASS", "isJsonScript", "el", "MarkupDataController", "host", "parsed", "inline", "child", "text", "RoxyNakshatraCard", "LitElement", "MarkupDataController", "html", "n", "remedies", "nothing", "baseStyles", "css", "__decorateClass", "property", "customElement"]
|
|
4
|
+
"sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport type { NakshatraResponse } from '../types/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { MarkupDataController } from '../utils/markup-data.js';\n\n/**\n * Nakshatra reference card. Renders /vedic-astrology/nakshatras/{id}: the\n * lunar mansion number, longitude range, ruling planet, presiding deity,\n * symbol, native characteristics, and traditional remedies.\n */\n@customElement('roxy-nakshatra-card')\nexport class RoxyNakshatraCard extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.wrap{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);background:var(--roxy-bg,#fff);padding:var(--roxy-space-md,1rem);gap:var(--roxy-space-md,1rem);box-shadow:var(--roxy-shadow-sm);display:grid}.head{align-items:baseline;gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.name{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.number{color:var(--roxy-accent-ink,#b45309);font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600)}.range{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}.facts{gap:var(--roxy-space-sm,.5rem);grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));display:grid}.fact{gap:2px;display:grid}.fact dt{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);text-transform:uppercase;letter-spacing:.05em}.fact dd{color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-sm,.875rem);margin:0}.section h3{margin:0 0 var(--roxy-space-xs,.25rem);font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.05em}.section p{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a);margin:0;line-height:1.5}.remedies{gap:var(--roxy-space-xs,.25rem);display:grid}.remedy{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a)}.remedy strong{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600)}`,\n\t];\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Enables hydrating `data` from a direct-child\n\t\t// <script type=\"application/json\" class=\"roxy-data\"> for server-rendered\n\t\t// and cached consumers. The JavaScript `data` property still wins.\n\t\tnew MarkupDataController(this);\n\t}\n\n\t@property({ attribute: false })\n\tdata: NakshatraResponse | null = null;\n\n\trender() {\n\t\tif (!this.data)\n\t\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No nakshatra data</div>`;\n\t\tconst n = this.data;\n\t\tconst remedies = n.remedies;\n\n\t\treturn html`<article class=\"wrap\" aria-label=\"${`Nakshatra ${n.name}`}\"><header class=\"head\"><h2 class=\"name\">${n.name}</h2>${\n\t\t\t\t\ttypeof n.number === 'number'\n\t\t\t\t\t\t? html`<span class=\"number\">Nakshatra ${n.number} of 27</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${n.range ? html`<span class=\"range\">${n.range}</span>` : nothing}</header><dl class=\"facts\">${n.lord ? html`<div class=\"fact\"><dt>Lord</dt><dd>${n.lord}</dd></div>` : nothing} ${n.deity ? html`<div class=\"fact\"><dt>Deity</dt><dd>${n.deity}</dd></div>` : nothing} ${n.symbol ? html`<div class=\"fact\"><dt>Symbol</dt><dd>${n.symbol}</dd></div>` : nothing}</dl>${\n\t\t\t\tn.characteristics\n\t\t\t\t\t? html`<div class=\"section\"><h3>Characteristics</h3><p>${n.characteristics}</p></div>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tremedies\n\t\t\t\t\t? html`<div class=\"section\"><h3>Remedies</h3><div class=\"remedies\">${remedies.mantras ? html`<div class=\"remedy\"><strong>Mantras:</strong> ${remedies.mantras}</div>` : nothing} ${remedies.gemstones ? html`<div class=\"remedy\"><strong>Gemstones:</strong> ${remedies.gemstones}</div>` : nothing} ${remedies.rituals ? html`<div class=\"remedy\"><strong>Rituals:</strong> ${remedies.rituals}</div>` : nothing}</div></div>`\n\t\t\t\t\t: nothing\n\t\t\t}</article>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-nakshatra-card': RoxyNakshatraCard;\n\t}\n}\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * Serialize a RoxyAPI response for embedding inside an inline `<script type=\"application/json\" class=\"roxy-data\">`. This is the safe writer counterpart to {@link MarkupDataController}, the reader: server-rendered and cached consumers (WordPress, JSX SSR, static HTML) emit the script with this, and the component hydrates `data` from it on connect.\n *\n * @remarks\n * Use this instead of a bare `JSON.stringify`. A raw stringify of a response that contains the literal text `</script>` (common in long interpretation prose) closes the script element early, corrupting the page and creating an HTML-injection vector. This escapes the script-unsafe characters to their `\\uXXXX` JSON escapes, which `JSON.parse` restores to the original characters, so the value the component receives is identical to the response you passed.\n *\n * `<` is the load-bearing escape (it defeats `</script>` and `<!--`). `>` and `&` are escaped for defence in depth, and U+2028 / U+2029 because they are valid in JSON yet are line terminators in a `<script>` context and break some parsers. The escapes introduce only `\\uXXXX` sequences, so the replacements never feed each other and order is irrelevant.\n *\n * Pass the unwrapped RoxyAPI response, the same shape you would assign to `element.data`. Do not pass the SDK envelope (`{ data, error, request, response }`).\n *\n * @example\n * ```ts\n * import { serializeRoxyData } from '@roxyapi/ui';\n *\n * const { data } = await roxy.dreams.getDreamSymbol({ path: { id: 'water' } });\n * const html = `<roxy-dream-card><script type=\"application/json\" class=\"roxy-data\">${serializeRoxyData(data)}</script></roxy-dream-card>`;\n * ```\n */\nexport function serializeRoxyData(data: unknown): string {\n\treturn JSON.stringify(data)\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/&/g, '\\\\u0026')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n\n/**\n * Build the complete `<script type=\"application/json\" class=\"roxy-data\">\u2026</script>` element a server nests inside a `roxy-*` component for the no-JavaScript hydration path. The payload is escaped via {@link serializeRoxyData}, so it is safe to drop straight into HTML output.\n *\n * @remarks\n * The element carries both `type=\"application/json\"` and `class=\"roxy-data\"` because {@link MarkupDataController} reads only a direct-child script that has both. Emit one of these inside the target component; the JavaScript `data` property still wins if it is later assigned.\n *\n * @example\n * ```ts\n * import { roxyDataScript } from '@roxyapi/ui';\n *\n * const { data } = await roxy.crystals.getCrystal({ path: { id: 'amethyst' } });\n * const html = `<roxy-crystal-grid>${roxyDataScript(data)}</roxy-crystal-grid>`;\n * ```\n */\nexport function roxyDataScript(data: unknown): string {\n\treturn `<script type=\"application/json\" class=\"${ROXY_DATA_CLASS}\">${serializeRoxyData(data)}</script>`;\n}\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n"],
|
|
5
|
+
"mappings": "wMAAA,OAAS,OAAAA,EAAK,QAAAC,EAAM,cAAAC,EAAY,WAAAC,MAAe,MAC/C,OAAS,iBAAAC,EAAe,YAAAC,MAAgB,oBCDxC,OAAS,OAAAC,MAAW,MAMb,IAAMC,EAAaD,myCCM1B,IAAME,EAAkB,YAkDxB,SAASC,EAAaC,EAAsB,CAC3C,OACCA,EAAG,WAAa,UAAYA,EAAG,aAAa,MAAM,IAAM,kBAE1D,CA2CO,IAAMC,EAAN,KAAsE,CAG5E,YAAYC,EAAgB,CAC3B,KAAK,KAAOA,EACZA,EAAK,cAAc,IAAI,CACxB,CAEA,eAAgB,CAGf,GAAI,KAAK,KAAK,MAAQ,KAAM,OAE5B,IAAMC,EAAS,KAAK,KAAK,EACrBA,IAAW,SAEf,KAAK,KAAK,KAAOA,EACjB,KAAK,KAAK,cAAc,EACzB,CAKQ,MAAsB,CAC7B,IAAMC,EAAS,KAAK,iBAAiB,EACrC,OAAOA,EAAS,KAAK,MAAMA,EAAO,WAAW,EAAI,MAClD,CAKQ,kBAAmC,CAC1C,QAAWC,KAAS,MAAM,KAAK,KAAK,KAAK,QAAQ,EAChD,GAAIN,EAAaM,CAAK,GAAKA,EAAM,UAAU,SAASC,CAAe,EAClE,OAAOD,EAGT,OAAO,IACR,CAEQ,MAAME,EAAoC,CACjD,GAAKA,GAAM,KAAK,EAChB,GAAI,CACH,OAAO,KAAK,MAAMA,CAAI,CACvB,MAAQ,CAGP,MACD,CACD,CACD,EFnJO,IAAMC,EAAN,cAAgCC,CAAW,CAMjD,aAAc,CACb,MAAM,EAQP,UAAiC,KAJhC,IAAIC,EAAqB,IAAI,CAC9B,CAKA,QAAS,CACR,GAAI,CAAC,KAAK,KACT,OAAOC,iEACR,IAAMC,EAAI,KAAK,KACTC,EAAWD,EAAE,SAEnB,OAAOD,sCAAyC,aAAaC,EAAE,IAAI,EAAE,2CAA2CA,EAAE,IAAI,QACnH,OAAOA,EAAE,QAAW,SACjBD,mCAAsCC,EAAE,MAAM,gBAC9CE,CACJ,IAAIF,EAAE,MAAQD,wBAA2BC,EAAE,KAAK,UAAYE,CAAO,8BAA8BF,EAAE,KAAOD,uCAA0CC,EAAE,IAAI,cAAgBE,CAAO,IAAIF,EAAE,MAAQD,wCAA2CC,EAAE,KAAK,cAAgBE,CAAO,IAAIF,EAAE,OAASD,yCAA4CC,EAAE,MAAM,cAAgBE,CAAO,QAClWF,EAAE,gBACCD,oDAAuDC,EAAE,eAAe,aACxEE,CACJ,IACCD,EACGF,gEAAmEE,EAAS,QAAUF,kDAAqDE,EAAS,OAAO,SAAWC,CAAO,IAAID,EAAS,UAAYF,oDAAuDE,EAAS,SAAS,SAAWC,CAAO,IAAID,EAAS,QAAUF,kDAAqDE,EAAS,OAAO,SAAWC,CAAO,eAC/YA,CACJ,YACF,CACD,EArCaN,EACL,OAAS,CACfO,EACAC,48CACD,EAWAC,EAAA,CADCC,EAAS,CAAE,UAAW,EAAM,CAAC,GAdlBV,EAeZ,oBAfYA,EAANS,EAAA,CADNE,EAAc,qBAAqB,GACvBX",
|
|
6
|
+
"names": ["css", "html", "LitElement", "nothing", "customElement", "property", "css", "baseStyles", "ROXY_DATA_CLASS", "isJsonScript", "el", "MarkupDataController", "host", "parsed", "inline", "child", "ROXY_DATA_CLASS", "text", "RoxyNakshatraCard", "LitElement", "MarkupDataController", "html", "n", "remedies", "nothing", "baseStyles", "css", "__decorateClass", "property", "customElement"]
|
|
7
7
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var X=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var L=(c,l,r,a)=>{for(var t=a>1?void 0:a?Q(l,r):l,n=c.length-1,e;n>=0;n--)(e=c[n])&&(t=(a?e(l,r,t):e(t))||t);return a&&t&&X(l,r,t),t};import{css as ie,html as d,LitElement as le,nothing as
|
|
1
|
+
var X=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var L=(c,l,r,a)=>{for(var t=a>1?void 0:a?Q(l,r):l,n=c.length-1,e;n>=0;n--)(e=c[n])&&(t=(a?e(l,r,t):e(t))||t);return a&&t&&X(l,r,t),t};import{css as ie,html as d,LitElement as le,nothing as m,svg as h}from"lit";import{customElement as ce,property as J,state as de}from"lit/decorators.js";var $={Sun:"\u2609",Moon:"\u263D",Mercury:"\u263F",Venus:"\u2640",Earth:"\u2641",Mars:"\u2642",Jupiter:"\u2643",Saturn:"\u2644",Uranus:"\u2645",Neptune:"\u2646",Pluto:"\u2647",Rahu:"\u260A",Ketu:"\u260B",Ascendant:"Asc",Lagna:"La",NorthNode:"\u260A",SouthNode:"\u260B","North node":"\u260A","South node":"\u260B",Chiron:"\u26B7",Lilith:"\u26B8","Black moon lilith":"\u26B8"};var j={Aries:"\u2648",Taurus:"\u2649",Gemini:"\u264A",Cancer:"\u264B",Leo:"\u264C",Virgo:"\u264D",Libra:"\u264E",Scorpio:"\u264F",Sagittarius:"\u2650",Capricorn:"\u2651",Aquarius:"\u2652",Pisces:"\u2653"};var k=["Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"],ge=k.map(c=>c.toLowerCase()),R={conjunction:"\u260C",opposition:"\u260D",trine:"\u25B3",square:"\u25A1",sextile:"\u2731",quincunx:"\u22BB",semisextile:"\u22BC"};import{css as ee}from"lit";var q=ee`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;function f(c){let l=c%360;return l<0?l+360:l}function N(c){let l=f(c),r=Math.floor(l/30)%12,a=l%30,t=Math.floor(a),n=(a-t)*60,e=Math.floor(n),o=Math.round((n-e)*60);return{sign:k[r]??"Aries",signIndex:r,degree:t,minute:e,second:o}}function C(c){return f(c+180)}function B(c,l){let r=f(c),a=f(l)-r;return a<0&&(a+=360),f(r+a/2)}function u(c,l,r,a){let t=a*Math.PI/180;return{x:c+r*Math.cos(t),y:l+r*Math.sin(t)}}import{css as te,html as re}from"lit";function F(){return re`<svg class="roxy-chevron" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`}var Y=te`summary{list-style:none}summary::-webkit-details-marker{display:none}.roxy-chevron{aspect-ratio:auto;width:14px;height:14px;color:var(--roxy-muted,#71717a);transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0}details[open]>summary .roxy-chevron{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){.roxy-chevron{transition:none}}`;function E(c,l=1){return typeof c!="number"||!Number.isFinite(c)?"":c.toFixed(l).replace(/\.?0+$/,"")}var z={conjunction:"aspect-conjunction",sextile:"aspect-sextile",square:"aspect-square",trine:"aspect-trine",opposition:"aspect-opposition"};function I(c){return(c.type??"").toLowerCase().replace(/_/g,"-")}var ne="roxy-data";function ae(c){return c.nodeName==="SCRIPT"&&c.getAttribute("type")==="application/json"}var M=class{constructor(l){this.host=l,l.addController(this)}hostConnected(){if(this.host.data!=null)return;let l=this.read();l!==void 0&&(this.host.data=l,this.host.requestUpdate())}read(){let l=this.findInlineScript();return l?this.parse(l.textContent):void 0}findInlineScript(){for(let l of Array.from(this.host.children))if(ae(l)&&l.classList.contains(ne))return l;return null}parse(l){if(l?.trim())try{return JSON.parse(l)}catch{return}}};function y(c){return c?c.charAt(0).toUpperCase()+c.slice(1).toLowerCase():""}import{css as oe,html as U,nothing as se}from"lit";var K=oe`.roxy-tablist{border-bottom:2px solid var(--roxy-border,#e4e4e7);gap:2px;display:flex}.roxy-tab{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-sm,.875rem);cursor:pointer;color:var(--roxy-muted,#71717a);transition:color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);background:0 0;border:none;border-bottom:2px solid #0000;margin-bottom:-2px;font-family:inherit}.roxy-tab[aria-selected=true]{color:var(--roxy-accent-ink,#b45309);border-bottom-color:var(--roxy-accent,#f59e0b);font-weight:var(--roxy-weight-bold,600)}.roxy-tab:hover:not([aria-selected=true]){color:var(--roxy-fg,#0a0a0a)}.roxy-tab:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-radius:4px}`;function V(c){let{items:l,active:r,onSelect:a,label:t,idPrefix:n,controls:e=!1}=c;return U`<div class="roxy-tablist" role="tablist" aria-label="${t}" @keydown="${s=>{if(s.key!=="ArrowRight"&&s.key!=="ArrowLeft")return;s.preventDefault();let p=l.findIndex(w=>w.id===r);if(p===-1)return;let g=s.key==="ArrowRight"?1:-1,x=l[(p+g+l.length)%l.length];if(!x)return;a(x.id);let b=s.currentTarget.getRootNode();requestAnimationFrame(()=>{b.querySelector(`#${n}-tab-${x.id}`)?.focus()})}}">${l.map(s=>U`<button type="button" class="roxy-tab" role="tab" id="${n}-tab-${s.id}" aria-selected="${r===s.id?"true":"false"}" aria-controls="${e&&r===s.id?`${n}-panel-${s.id}`:se}" tabindex="${r===s.id?"0":"-1"}" @click="${()=>a(s.id)}">${s.label}</button>`)}</div>`}var D=420,i=D/2,A=164,_=146,P=120,S=96,pe=178,ue=196,v=class extends le{constructor(){super();this.data=null;this.houseSystem="placidus";this.view="wheel";new M(this)}getPlanets(){return this.data?.planets??[]}getAscendant(){return this.data?.ascendant?.longitude??0}getMidheaven(){let r=this.data?.midheaven?.longitude;return typeof r=="number"?r:null}toAngle(r){return 180+this.getAscendant()-r}render(){if(!this.data)return d`<div class="roxy-empty" role="status">No chart data</div>`;let r=this.getPlanets(),a=this.data.aspects??[],t=this.view;return d`<div class="wrap"><header><h2 class="title">Natal chart</h2>${this.data.birthDetails?d`<div class="meta">${[this.data.birthDetails.date,this.data.birthDetails.time].filter(Boolean).join(" \xB7 ")}</div>`:m}</header>${V({items:[{id:"wheel",label:"Wheel"},{id:"grid",label:"Aspect grid"}],active:t,onSelect:n=>{this.view=n},label:"Natal chart views",idPrefix:"natal",controls:!0})}<div id="natal-panel-${t}" role="tabpanel" aria-labelledby="natal-tab-${t}">${t==="wheel"?this.renderWheel(r,a):this.renderAspectGrid(r,a)}</div><div class="legend"><span>${r.length} planets</span> <span>${a.length} aspects</span> ${this.data.houseSystem?d`<span>${this.data.houseSystem} houses</span>`:m} <span><span class="legend-swatch" style="background:var(--roxy-success)"></span>harmonious</span> <span><span class="legend-swatch" style="background:var(--roxy-danger)"></span>challenging</span></div>${this.renderDetails()} ${this.renderInterpretations()}</div>`}renderWheel(r,a){return d`<svg viewBox="0 0 ${D} ${D}" role="img" aria-label="Natal chart wheel with twelve houses, planets, and aspects"><title>Natal chart wheel</title><desc>Twelve zodiac sign segments around a circular wheel. Planet glyphs are placed at their ecliptic longitudes. Aspect lines connect related planets.</desc><circle class="wheel-line" cx="${i}" cy="${i}" r="${A}" stroke-width="1.5"/><circle class="wheel-line" cx="${i}" cy="${i}" r="${_-14}" stroke-width="0.8"/><circle class="wheel-line" cx="${i}" cy="${i}" r="${P}" stroke-width="1"/><circle class="wheel-line" cx="${i}" cy="${i}" r="${S-16}" stroke-width="0.5"/>${this.renderTicks()} ${this.renderSpokes()} ${this.renderSigns()} ${this.renderHouseNumbers()} ${this.renderCuspDegrees()} ${this.renderAspects(r,a)} ${this.renderPlanets(r)} ${this.renderAngles()}</svg>`}renderAspectGrid(r,a){let t=r.map(e=>y(e.name)),n=new Map;for(let e of a){let o=[y(e.planet1),y(e.planet2)].sort().join("|");n.set(o,e)}return t.length===0?d`<p class="roxy-empty" role="status">No planets to grid</p>`:d`<div class="grid-scroll"><table class="aspect-grid" aria-label="Planet by planet aspect grid"><thead><tr><th></th>${t.slice(0,-1).map(e=>{let o=$[e]??e.slice(0,2);return d`<th scope="col" title="${e}">${o}</th>`})}</tr></thead><tbody>${t.slice(1).map((e,o)=>{let s=$[e]??e.slice(0,2);return d`<tr><th scope="row" title="${e}">${s}</th>${t.slice(0,o+1).map(p=>{let g=n.get([e,p].sort().join("|"));if(!g)return d`<td class="empty"></td>`;let x=I(g),b=R[x]??R[x.replace(/-/g,"")]??x.slice(0,3),w=z[x]??"aspect-other",T=E(g.orb,1);return d`<td class="${`cell ${w}`}" title="${`${e} ${x} ${p}${T?` (orb ${T}\xB0)`:""}`}"><span class="asp">${b}</span></td>`})} ${t.slice(o+1,-1).map(()=>d`<td class="empty"></td>`)}</tr>`})}</tbody></table></div>`}renderAngles(){let r=this.getAscendant(),a=this.getMidheaven(),t=[this.renderAngleMark(r,"ASC"),this.renderAngleMark(C(r),"DSC")];a!==null&&(t.push(this.renderAngleMark(a,"MC")),t.push(this.renderAngleMark(C(a),"IC")));let n=this.data?.partOfFortune?.longitude;typeof n=="number"&&t.push(this.renderAngleMark(f(n),"PoF"));let e=this.data?.vertex?.longitude;return typeof e=="number"&&t.push(this.renderAngleMark(f(e),"Vtx")),t}renderAngleMark(r,a){let t=this.toAngle(r),n=u(i,i,A,t),e=u(i,i,pe,t),o=u(i,i,ue,t);return h`
|
|
2
2
|
<g>
|
|
3
3
|
<line class="angle-tick" x1=${n.x} y1=${n.y} x2=${e.x} y2=${e.y} />
|
|
4
4
|
<text class="angle-marker" x=${o.x} y=${o.y} text-anchor="middle" dominant-baseline="central">${a}</text>
|
|
5
5
|
</g>
|
|
6
|
-
`}renderSpokes(){let r=this.data?.houses??[];return(r.length===12?r.map(t=>t.longitude):Array.from({length:12},(t,n)=>this.getAscendant()+n*30)).map(t=>{let n=this.toAngle(t),e=
|
|
7
|
-
${Z?h`<line class="planet-leader" x1=${w.x} y1=${w.y} x2=${T.x} y2=${T.y} />`:
|
|
6
|
+
`}renderSpokes(){let r=this.data?.houses??[];return(r.length===12?r.map(t=>t.longitude):Array.from({length:12},(t,n)=>this.getAscendant()+n*30)).map(t=>{let n=this.toAngle(t),e=u(i,i,P,n),o=u(i,i,A,n);return h`<line class="wheel-line" x1=${e.x} y1=${e.y} x2=${o.x} y2=${o.y} stroke-width="0.8" />`})}renderSigns(){return k.map((r,a)=>{let t=this.toAngle(a*30+15),n=u(i,i,_,t);return h`<text class="sign-glyph" x=${n.x} y=${n.y} text-anchor="middle" dominant-baseline="central">${j[r]}</text>`})}renderHouseNumbers(){let r=this.data?.houses??[];if(r.length===12)return r.map((t,n)=>{let e=r[(n+1)%12],o=B(t.longitude,e?e.longitude:t.longitude+30),s=u(i,i,P-12,this.toAngle(o));return h`<text class="house-num" x=${s.x} y=${s.y} text-anchor="middle" dominant-baseline="central">${t.number}</text>`});let a=Math.floor(this.getAscendant()/30);return Array.from({length:12},(t,n)=>{let e=this.toAngle(n*30+15),o=u(i,i,P-12,e),s=(n-a+12)%12+1;return h`<text class="house-num" x=${o.x} y=${o.y} text-anchor="middle" dominant-baseline="central">${s}</text>`})}renderTicks(){let r=[];for(let a=0;a<360;a+=5){let t=this.toAngle(a),n=a%30===0,e=n?_-14:A-5,o=u(i,i,e,t),s=u(i,i,A,t);r.push(h`<line class=${n?"tick tick-major":"tick"} x1=${o.x} y1=${o.y} x2=${s.x} y2=${s.y} stroke-width=${n?1:.5} />`)}return r}renderCuspDegrees(){let r=this.data?.houses??[];return r.length!==12?m:r.map(a=>{let t=this.toAngle(a.longitude),n=u(i,i,P+9,t),e=N(a.longitude);return h`<text class="cusp-deg" x=${n.x} y=${n.y} text-anchor="middle" dominant-baseline="central">${e.degree}°${String(e.minute).padStart(2,"0")}'</text>`})}renderPlanets(r){let t=r.filter(e=>Number.isFinite(e.longitude)).map(e=>({p:e,trueLon:f(e.longitude),displayLon:f(e.longitude)})).sort((e,o)=>e.trueLon-o.trueLon);for(let e=1;e<t.length;e++){let o=t[e-1],s=t[e];if(!o||!s)continue;let p=o.displayLon+7;s.displayLon<p&&(s.displayLon=p)}let n=t[t.length-1];if(n&&n.displayLon>360){let e=n.displayLon-360;for(let o of t)o.displayLon-=e}return t.map(({p:e,trueLon:o,displayLon:s})=>{let p=this.toAngle(o),g=this.toAngle(s),x=u(i,i,S,g),b=u(i,i,S-13,g),w=u(i,i,A-4,p),T=u(i,i,S+8,g),W=$[y(e.name)]??e.name.slice(0,2),G=N(e.longitude),H=e.isRetrograde===!0,O=`${G.degree}\xB0${String(G.minute).padStart(2,"0")}'`,Z=Math.abs(s-o)>.5;return h`<g>
|
|
7
|
+
${Z?h`<line class="planet-leader" x1=${w.x} y1=${w.y} x2=${T.x} y2=${T.y} />`:m}
|
|
8
8
|
<text class="planet-glyph" x=${x.x} y=${x.y} text-anchor="middle" dominant-baseline="central"><title>${e.name}${H?" retrograde":""} - ${O} ${e.sign??""}</title>${W}</text>
|
|
9
|
-
<text class="planet-deg" x=${b.x} y=${b.y} text-anchor="middle" dominant-baseline="central">${O}${H?h`<tspan class="retro"> ℞</tspan>`:
|
|
10
|
-
</g>`})}renderDetails(){let r=this.data?.summary,a=this.data?.aspectsInterpretation;if(!r&&!a)return
|
|
9
|
+
<text class="planet-deg" x=${b.x} y=${b.y} text-anchor="middle" dominant-baseline="central">${O}${H?h`<tspan class="retro"> ℞</tspan>`:m}</text>
|
|
10
|
+
</g>`})}renderDetails(){let r=this.data?.summary,a=this.data?.aspectsInterpretation;if(!r&&!a)return m;let t=r?.retrogradePlanets??[];return d`<div class="details">${r?.dominantElement||r?.dominantModality?d`<div class="pill-row">${r.dominantElement?d`<span class="pill">Dominant element: ${r.dominantElement}</span>`:m} ${r.dominantModality?d`<span class="pill">Dominant modality: ${r.dominantModality}</span>`:m}</div>`:m} ${a?d`<div class="pill-row"><span class="pill pill--success">Harmonious ${a.harmonious}</span> <span class="pill pill--danger">Challenging ${a.challenging}</span> <span class="pill pill--muted">Neutral ${a.neutral}</span></div>`:m} ${t.length>0?d`<div class="pill-row">${t.map(n=>{let e=$[n]??n.slice(0,2);return d`<span class="pill pill--muted">${e} ${n} R</span>`})}</div>`:m} ${a?.summary?d`<p class="summary">${a.summary}</p>`:m} ${this.renderElementModalityGrid()}</div>`}renderElementModalityGrid(){let r=this.getPlanets();if(r.length===0)return m;let a=["Fire","Earth","Air","Water"],t=["Cardinal","Fixed","Mutable"],n=k,e={};for(let o of a)e[o]={Cardinal:[],Fixed:[],Mutable:[]};for(let o of r){let s=n.indexOf(y(o.sign??""));if(s<0)continue;let p=a[s%4],g=t[s%3],x=$[y(o.name)]??y(o.name).slice(0,2);e[p]?.[g]?.push(x)}return d`<table class="em-grid" aria-label="Element and modality distribution"><thead><tr><th></th>${t.map(o=>d`<th scope="col">${o.slice(0,3)}</th>`)}<th scope="col">Total</th></tr></thead><tbody>${a.map(o=>{let s=t.reduce((p,g)=>p+(e[o]?.[g]?.length??0),0);return d`<tr><th scope="row">${o}</th>${t.map(p=>d`<td>${(e[o]?.[p]??[]).join(" ")}</td>`)}<td class="em-total">${s}</td></tr>`})}<tr><th scope="row">Total</th>${t.map(o=>d`<td class="em-total">${a.reduce((s,p)=>s+(e[p]?.[o]?.length??0),0)}</td>`)}<td class="em-total">${r.length}</td></tr></tbody></table>`}renderInterpretations(){let r=this.getPlanets().filter(a=>a.interpretation);return r.length===0?m:d`<section class="interpretations"><h3>Planet readings</h3>${r.map((a,t)=>{let n=a.interpretation,e=$[y(a.name)]??"",o=E(a.degree??0,1);return d`<details class="interp-card" name="natal-planet-readings" ?open="${t===0}"><summary><span>${e} ${a.name}</span> <span class="interp-aside"><small>${a.sign??""} ${o}</small> ${F()}</span></summary><div class="interp-body">${n.summary?d`<p class="interp-summary">${n.summary}</p>`:m} ${n.detailed?d`<p class="interp-detail">${n.detailed}</p>`:m} ${n.keywords?.length?d`<div class="interp-keywords">${n.keywords.map(s=>d`<span class="kw">${s}</span>`)}</div>`:m}</div></details>`})}</section>`}renderAspects(r,a){let t=new Map;for(let n of r){if(typeof n.longitude!="number")continue;let e=y(n.name);e&&t.set(e,n.longitude)}return a.map(n=>{let e=t.get(y(n.planet1)),o=t.get(y(n.planet2));if(e===void 0||o===void 0)return m;let s=u(i,i,S-18,this.toAngle(e)),p=u(i,i,S-18,this.toAngle(o)),g=I(n),x=z[g]??"aspect-other",b=E(n.orb,1);return h`<line class=${`aspect ${x}`} x1=${s.x} y1=${s.y} x2=${p.x} y2=${p.y}><title>${n.planet1} ${g||""} ${n.planet2}${b?` (orb ${b}\xB0)`:""}</title></line>`})}};v.styles=[q,K,Y,ie`.wrap{gap:var(--roxy-space-md,1rem);width:100%;display:grid}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-primary,#0f172a);margin:0}.meta{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}svg{aspect-ratio:1;width:100%;max-width:560px;height:auto;margin:0 auto;display:block}.wheel-line{fill:none;stroke:var(--roxy-border,#e4e4e7)}.sign-glyph{fill:var(--roxy-secondary,#475569);font-size:14px;font-family:var(--roxy-font-sans)}.planet-glyph{fill:var(--roxy-accent,#f59e0b);font-size:14px;font-weight:600;font-family:var(--roxy-font-sans)}.planet-deg{fill:var(--roxy-fg,#0a0a0a);font-size:7px;font-family:var(--roxy-font-sans)}@container (width<=480px){.sign-glyph,.planet-glyph{font-size:18px}.planet-deg{font-size:10px}.house-num{font-size:12px}}.planet-deg .retro{fill:var(--roxy-danger,#dc2626)}.planet-leader{stroke:var(--roxy-accent,#f59e0b);stroke-width:.5px;opacity:.55}.house-num{fill:var(--roxy-muted,#71717a);font-size:9px;font-family:var(--roxy-font-sans)}.cusp-deg{fill:var(--roxy-muted,#71717a);font-size:6px;font-family:var(--roxy-font-sans)}.tick{stroke:var(--roxy-border,#e4e4e7)}.tick-major{stroke:var(--roxy-secondary,#475569)}.aspect{stroke-width:.8px;fill:none;opacity:.55}.aspect-trine,.aspect-sextile{stroke:var(--roxy-success,#16a34a)}.aspect-square,.aspect-opposition{stroke:var(--roxy-danger,#dc2626)}.aspect-conjunction{stroke:var(--roxy-accent-ink,#b45309)}.aspect-other{stroke:var(--roxy-muted,#71717a);opacity:.4}.angle-marker{fill:var(--roxy-accent-ink,#b45309);font-size:10px;font-weight:700;font-family:var(--roxy-font-sans);letter-spacing:.04em}.angle-tick{stroke:var(--roxy-accent-ink,#b45309);stroke-width:1.5px}.legend{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);gap:var(--roxy-space-md,1rem);flex-wrap:wrap;display:flex}.legend-swatch{vertical-align:middle;border-radius:50%;width:8px;height:8px;margin-right:4px;display:inline-block}.grid-scroll{-webkit-overflow-scrolling:touch;overflow-x:auto}table.aspect-grid{border-collapse:collapse;font-size:var(--roxy-text-xs,.75rem);margin:0 auto}table.aspect-grid th,table.aspect-grid td{text-align:center;border:1px solid var(--roxy-border,#e4e4e7);width:1.6rem;height:1.6rem;padding:0}table.aspect-grid th{color:var(--roxy-secondary,#475569);font-weight:var(--roxy-weight-bold,600)}table.aspect-grid td.cell{cursor:default}table.aspect-grid td.empty{background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 18%, transparent)}table.aspect-grid td .asp{font-size:.95em;line-height:1}table.aspect-grid td.aspect-trine .asp,table.aspect-grid td.aspect-sextile .asp{color:var(--roxy-success,#16a34a)}table.aspect-grid td.aspect-square .asp,table.aspect-grid td.aspect-opposition .asp{color:var(--roxy-danger,#dc2626)}table.aspect-grid td.aspect-conjunction .asp{color:var(--roxy-accent-ink,#b45309)}table.aspect-grid td.aspect-other .asp{color:var(--roxy-muted,#71717a)}.details{margin-top:var(--roxy-space-md,1rem)}.pill-row{gap:var(--roxy-space-xs,.25rem);margin-bottom:var(--roxy-space-xs,.25rem);flex-wrap:wrap;display:flex}.pill{border-radius:var(--roxy-radius-sm,4px);font-size:var(--roxy-text-xs,.75rem);background:color-mix(in srgb, var(--roxy-fg,#0f172a) 8%, transparent);color:var(--roxy-fg,#0f172a);padding:2px 8px}.pill--success{background:color-mix(in srgb, var(--roxy-success,#16a34a) 15%, transparent);color:var(--roxy-success,#16a34a)}.pill--danger{background:color-mix(in srgb, var(--roxy-danger,#dc2626) 15%, transparent);color:var(--roxy-danger,#dc2626)}.pill--muted{background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent);color:var(--roxy-fg,#0a0a0a)}.summary{color:var(--roxy-fg,#0f172a);font-size:var(--roxy-text-sm,.875rem);margin:var(--roxy-space-md,1rem) 0}.em-grid{border-collapse:collapse;font-size:var(--roxy-text-xs,.75rem);width:100%}.em-grid th,.em-grid td{border:1px solid var(--roxy-border,#e4e4e7);text-align:center;vertical-align:middle;padding:3px 5px}.em-grid th{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:uppercase;letter-spacing:.04em}.em-grid th[scope=row]{text-align:left}.em-grid td{color:var(--roxy-accent,#f59e0b);min-width:1.4rem;font-size:.95em;line-height:1.4}.em-grid .em-total{color:var(--roxy-fg,#0a0a0a);font-weight:var(--roxy-weight-bold,600);background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 25%, transparent)}.interpretations{margin-top:var(--roxy-space-md,1rem)}.interpretations h3{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.06em;margin:0 0 var(--roxy-space-sm,.5rem);font-weight:600}.interp-card{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);margin-bottom:var(--roxy-space-xs,.25rem)}.interp-card summary{cursor:pointer;color:var(--roxy-fg,#0f172a);justify-content:space-between;align-items:center;gap:var(--roxy-space-md,1rem);font-weight:500;display:flex}.interp-aside{align-items:center;gap:.6em;display:inline-flex}.interp-aside small{color:var(--roxy-muted,#71717a);font-weight:400}.interp-body{margin-top:var(--roxy-space-xs,.25rem);color:var(--roxy-fg,#0f172a);font-size:var(--roxy-text-sm,.875rem)}.interp-keywords{flex-wrap:wrap;gap:.25rem;margin-top:.5rem;display:flex}.interp-keywords .kw{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 14%, transparent);color:var(--roxy-accent-ink,#b45309);font-size:var(--roxy-text-xs,.75rem);border-radius:9999px;padding:1px 8px}`],L([J({attribute:!1})],v.prototype,"data",2),L([J({type:String,attribute:"house-system",reflect:!0})],v.prototype,"houseSystem",2),L([de()],v.prototype,"view",2),v=L([ce("roxy-natal-chart")],v);export{v as RoxyNatalChart};
|
|
11
11
|
//# sourceMappingURL=natal-chart.js.map
|