@claudinho/core 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1089,8 +1089,12 @@ interface ShareBracketOptions {
1089
1089
  includeInstallLine?: boolean;
1090
1090
  stage?: Stage;
1091
1091
  locale?: string;
1092
+ tz?: string;
1093
+ style?: ShareStyle;
1092
1094
  }
1093
1095
  /** Plain-text share card for the knockout bracket. */
1094
1096
  declare function formatShareBracket(input: ShareBracketInput, options?: ShareBracketOptions): string;
1097
+ /** Compact one-line-per-match bracket for narrow share contexts. */
1098
+ declare function formatBracketCompactLine(mv: BracketMatchView, opts?: BracketFormatOpts): string;
1095
1099
 
1096
- export { BRACKET_STAGE_ORDER, type BracketFormatOpts, type BracketMatchNode, type BracketMatchView, type BracketResult, type BracketTopology, type BracketView, type BuildSignalInput, DEFAULT_COMPETITION, DEFAULT_FLAVOR, DEFAULT_MAX_AGE_MS, EspnAdapter, type EspnAdapterOptions, FLAVOR_LEVELS, FakeMarketProvider, type FakeMarketProviderOptions, type FavoriteStrength, type FlavorLevel, type FormatOpts, type GroupStandings, LIVE_WINDOW_MS, type Lang, type LedgerRow, type LiveResult, type MapContext, type MarketFavorite, type MarketMapping, type MarketMappingTable, type MarketOutcome, type MarketOutcomeKind, type MarketProvider, type MarketSignal, type MarketSignalOptions, type MarketSignalsResult, type Match, type MatchByIdResult, type MatchEvent, type Outcome, PolymarketProvider, type PolymarketProviderOptions, type ProviderAdapter, type ProviderCapabilities, type PunditPick, type ResolvedParticipant, SHARE_DISCLAIMER, SHARE_HASHTAG, type ShareBracketInput, type ShareBracketOptions, type ShareSnippetInput, type ShareSnippetOptions, type ShareStyle, type ShareTableInput, type SlotRef, type Stage, type StandingRow, type StandingsResult, type Status, type Team, allFixtures, asFlavorLevel, buildBracketTopology, buildBracketView, buildMarketSignal, byKickoff, competitionBase, computeStandings, countdown, currentOrNextFixtureForTeam, deriveFavorite, favoriteStrength, fixturesByDate, fixturesByGroup, fixturesByTeam, fixturesInLiveWindow, flagEmoji, formatBracketList, formatBracketMatchLine, formatBracketTree, formatDate, formatKickoff, formatShareBracket, formatShareSnippet, formatShareTable, formatTime, getBracket, getLiveMatches, getMarketSignal, getMarketSignals, getMatchById, getMatchesForDate, getStandings, groups, hasSaneDistribution, isFinished, isFlavorLevel, isLive, isReliableMarketSignal, isStaleSignal, isValidDate, isValidTimeZone, liveSourceLabel, loadBracketTopology, localDate, makeAdapter, makeMarketProvider, mapEspnEvent, mapsCleanly, marketAttributionText, marketBlock, marketFavoriteText, marketFixtureForTeam, marketLine, marketProbabilityText, marketRelevant, marketSourceLabel, matchFlavor, matchKey, matchLocation, mergeLive, nationToFlag, nationToRegion, nextFixtureForTeam, normalizeLang, normalizeOutcomes, outcomeFromScore, parseStandings, parseTeamSlot, resolveCompetition, resolveMarketSource, resolveTz, sanitizeBundledFixture, scoreline, stageLabel, stageLabelI18n, t };
1100
+ export { BRACKET_STAGE_ORDER, type BracketFormatOpts, type BracketMatchNode, type BracketMatchView, type BracketResult, type BracketTopology, type BracketView, type BuildSignalInput, DEFAULT_COMPETITION, DEFAULT_FLAVOR, DEFAULT_MAX_AGE_MS, EspnAdapter, type EspnAdapterOptions, FLAVOR_LEVELS, FakeMarketProvider, type FakeMarketProviderOptions, type FavoriteStrength, type FlavorLevel, type FormatOpts, type GroupStandings, LIVE_WINDOW_MS, type Lang, type LedgerRow, type LiveResult, type MapContext, type MarketFavorite, type MarketMapping, type MarketMappingTable, type MarketOutcome, type MarketOutcomeKind, type MarketProvider, type MarketSignal, type MarketSignalOptions, type MarketSignalsResult, type Match, type MatchByIdResult, type MatchEvent, type Outcome, PolymarketProvider, type PolymarketProviderOptions, type ProviderAdapter, type ProviderCapabilities, type PunditPick, type ResolvedParticipant, SHARE_DISCLAIMER, SHARE_HASHTAG, type ShareBracketInput, type ShareBracketOptions, type ShareSnippetInput, type ShareSnippetOptions, type ShareStyle, type ShareTableInput, type SlotRef, type Stage, type StandingRow, type StandingsResult, type Status, type Team, allFixtures, asFlavorLevel, buildBracketTopology, buildBracketView, buildMarketSignal, byKickoff, competitionBase, computeStandings, countdown, currentOrNextFixtureForTeam, deriveFavorite, favoriteStrength, fixturesByDate, fixturesByGroup, fixturesByTeam, fixturesInLiveWindow, flagEmoji, formatBracketCompactLine, formatBracketList, formatBracketMatchLine, formatBracketTree, formatDate, formatKickoff, formatShareBracket, formatShareSnippet, formatShareTable, formatTime, getBracket, getLiveMatches, getMarketSignal, getMarketSignals, getMatchById, getMatchesForDate, getStandings, groups, hasSaneDistribution, isFinished, isFlavorLevel, isLive, isReliableMarketSignal, isStaleSignal, isValidDate, isValidTimeZone, liveSourceLabel, loadBracketTopology, localDate, makeAdapter, makeMarketProvider, mapEspnEvent, mapsCleanly, marketAttributionText, marketBlock, marketFavoriteText, marketFixtureForTeam, marketLine, marketProbabilityText, marketRelevant, marketSourceLabel, matchFlavor, matchKey, matchLocation, mergeLive, nationToFlag, nationToRegion, nextFixtureForTeam, normalizeLang, normalizeOutcomes, outcomeFromScore, parseStandings, parseTeamSlot, resolveCompetition, resolveMarketSource, resolveTz, sanitizeBundledFixture, scoreline, stageLabel, stageLabelI18n, t };
package/dist/index.js CHANGED
@@ -4709,11 +4709,14 @@ function formatShareTable(input, options = {}) {
4709
4709
  }
4710
4710
 
4711
4711
  // src/bracket/format.ts
4712
- function formatParticipant(p, flags, locale) {
4712
+ function formatParticipant(p, side, flags, locale) {
4713
4713
  const suffix = p.status === "projected" ? ` ${t(locale, "bracket.projected")}` : "";
4714
- if (flags && p.flag !== "\u{1F3F3}\uFE0F") return `${p.flag} ${p.label}${suffix}`;
4715
- if (p.code) return `${p.code}${suffix}`;
4716
- return `${p.label}${suffix}`;
4714
+ if (!flags || p.flag === "\u{1F3F3}\uFE0F") {
4715
+ if (p.code && p.code !== "TBD") return `${p.code}${suffix}`;
4716
+ return `${p.label}${suffix}`;
4717
+ }
4718
+ if (side === "home") return `${p.flag} ${p.label}${suffix}`;
4719
+ return `${p.label}${suffix} ${p.flag}`;
4717
4720
  }
4718
4721
  function statusTail2(m) {
4719
4722
  if (m.status === "LIVE" && m.minute) return ` ${m.minute}'`;
@@ -4724,8 +4727,8 @@ function statusTail2(m) {
4724
4727
  }
4725
4728
  function formatBracketMatchLine(mv, opts = {}) {
4726
4729
  const flags = opts.flags !== false;
4727
- const home = formatParticipant(mv.home, flags, opts.locale);
4728
- const away = formatParticipant(mv.away, flags, opts.locale);
4730
+ const home = formatParticipant(mv.home, "home", flags, opts.locale);
4731
+ const away = formatParticipant(mv.away, "away", flags, opts.locale);
4729
4732
  const m = mv.match;
4730
4733
  if (isFinished(m.status) || isLive(m.status)) {
4731
4734
  return ` ${home} ${scoreline(m)} ${away}${statusTail2(m)}`;
@@ -4790,8 +4793,19 @@ function formatShareBracket(input, options = {}) {
4790
4793
  const blocks = [t(locale, "bracket.shareTitle"), ""];
4791
4794
  if (input.view.stages.length === 0) {
4792
4795
  blocks.push(input.emptyNote ?? t(locale, "bracket.empty"));
4796
+ } else if ((options.style ?? "social") === "compact") {
4797
+ const fmtOpts = { locale, tz: options.tz };
4798
+ const lines = input.view.stages.flatMap(
4799
+ (stage) => stage.matches.map((mv) => formatBracketCompactLine(mv, fmtOpts))
4800
+ );
4801
+ blocks.push(lines.join("\n"));
4802
+ if (input.view.degraded) {
4803
+ blocks.push(`(${t(locale, "bracket.degraded")})`);
4804
+ } else if (input.view.standingsDegraded) {
4805
+ blocks.push(`(${t(locale, "bracket.standingsDegraded")})`);
4806
+ }
4793
4807
  } else {
4794
- blocks.push(formatBracketList(input.view, { footer: false, locale }));
4808
+ blocks.push(formatBracketList(input.view, { footer: false, locale, tz: options.tz }));
4795
4809
  if (input.view.degraded) {
4796
4810
  blocks.push(`(${t(locale, "bracket.degraded")})`);
4797
4811
  } else if (input.view.standingsDegraded) {
@@ -4810,6 +4824,15 @@ function formatShareBracket(input, options = {}) {
4810
4824
  blocks.push("", footer.join("\n"));
4811
4825
  return blocks.join("\n");
4812
4826
  }
4827
+ function formatBracketCompactLine(mv, opts = {}) {
4828
+ const flags = opts.flags !== false;
4829
+ const home = formatParticipant(mv.home, "home", flags, opts.locale);
4830
+ const away = formatParticipant(mv.away, "away", flags, opts.locale);
4831
+ const m = mv.match;
4832
+ const mid2 = isFinished(m.status) || isLive(m.status) ? scoreline(m) : "vs";
4833
+ const tail = m.status === "SCHEDULED" && mv.kickoff ? ` \xB7 ${formatKickoff(mv.kickoff, { tz: opts.tz, locale: opts.locale })}` : statusTail2(m);
4834
+ return `${stageLabelI18n(opts.locale, mv.stage)} \xB7 ${home} ${mid2} ${away}${tail}`;
4835
+ }
4813
4836
  export {
4814
4837
  BRACKET_STAGE_ORDER,
4815
4838
  DEFAULT_COMPETITION,
@@ -4839,6 +4862,7 @@ export {
4839
4862
  fixturesByTeam,
4840
4863
  fixturesInLiveWindow,
4841
4864
  flagEmoji,
4865
+ formatBracketCompactLine,
4842
4866
  formatBracketList,
4843
4867
  formatBracketMatchLine,
4844
4868
  formatBracketTree,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudinho/core",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Domain model, provider adapters (ESPN), standings, bundled schedule, and the read-only Polymarket market-signal sidecar powering Claudinho. Not affiliated with FIFA or Anthropic.",
5
5
  "type": "module",
6
6
  "license": "MIT",