SPB Git forge

spb/ka-maps

Public
6commits 1branches 0releases
448.0 KBsize
maindefault branch
29 days agolast push
TypeScript 87.7% CSS 12.3%
4.3 KB · 156 lines typescript
Raw Blame History
1/**2 * Author: Simon-Pierre Boucher3 * Contact: contact@spboucher.ai4 * Project: Groupe Ka / Ka Maps5 *6 * Theme contract. Ka Maps ships the base cartography and behavior; each7 * Groupe Ka app supplies one of these objects to make the map its own.8 */910export type KaMapMode = "light" | "dark";1112/** Marker/label treatment for one item family (sale, rent, valuation…). */13export interface MarkerStyleTokens {14  /** Pill background. */15  background: string;16  /** Pill text. */17  text: string;18  /** Halo/outline behind the pill for map contrast. */19  halo: string;20  /** Background when selected. */21  selectedBackground: string;22  /** Text when selected. */23  selectedText: string;24}2526/** Basemap palette — one per mode, derived from the Ka base cartography. */27export interface BasemapPalette {28  background: string;29  water: string;30  waterway: string;31  park: string;32  wood: string;33  residential: string;34  building: string;35  buildingOutline: string;36  road: string;37  roadCasing: string;38  roadSecondary: string;39  primary: string;40  primaryCasing: string;41  motorway: string;42  motorwayCasing: string;43  boundary: string;44  label: string;45  labelHalo: string;46  cityLabel: string;47  roadLabel: string;48  waterLabel: string;49}5051export interface KaMapTheme {52  /** App identity: "lou-ka" | "immo-ka" | "vrai-prix" | future apps. */53  id: string;54  /** Product name shown in attribution/UI, e.g. "Lou-Ka Maps". */55  productName: string;56  /** Primary accent (controls, selection ring, active states). */57  accent: string;58  /** Text color readable on `accent`. */59  onAccent: string;60  /** UI font stack for controls/popups (CSS font-family). */61  fontFamily: string;62  /** Marker styles per item family. Absent families fall back to `sale`. */63  markers: {64    sale: MarkerStyleTokens;65    rent?: MarkerStyleTokens;66    valuation?: MarkerStyleTokens;67    /** Emphasized items (MapProperty.highlight), e.g. under-valuation deals. */68    highlight?: MarkerStyleTokens;69  };70  /** Cluster bubble styling. */71  cluster: {72    background: string;73    text: string;74    border: string;75    /** Valeur indicative affichée sous la bulle (v2) — défaut : border. */76    valueText?: string;77    /** Halo du texte de valeur (v2) — défaut : blanc translucide. */78    valueHalo?: string;79  };80  /** Optional per-app overrides merged over the Ka base palettes. */81  basemapOverrides?: {82    light?: Partial<BasemapPalette>;83    dark?: Partial<BasemapPalette>;84  };85  /** Whether the app supports dark mode at all. */86  supportsDark: boolean;87}8889/** Ka Light Map — restrained warm-paper cartography for property discovery. */90export const KA_LIGHT_PALETTE: BasemapPalette = {91  background: "#f5f3ee",92  water: "#c9dbe4",93  waterway: "#c2d6e0",94  park: "#dbe7d2",95  wood: "#d3e2ca",96  residential: "#efece5",97  building: "#e6e0d5",98  buildingOutline: "#d9d2c4",99  road: "#ffffff",100  roadCasing: "#e0dacd",101  roadSecondary: "#fdf8ec",102  primary: "#f6d17c",103  primaryCasing: "#cfa14a",104  motorway: "#e0584c",105  motorwayCasing: "#ad342d",106  boundary: "#b3a794",107  label: "#4d473c",108  labelHalo: "rgba(245, 243, 238, 0.9)",109  cityLabel: "#38332a",110  roadLabel: "#7a7364",111  waterLabel: "#5d7f91",112};113114/** Ka Dark Map — purpose-designed night cartography (not an inversion). */115export const KA_DARK_PALETTE: BasemapPalette = {116  background: "#14161a",117  water: "#0b1218",118  waterway: "#0e1620",119  park: "#18211a",120  wood: "#161f18",121  residential: "#171a1f",122  building: "#1d2126",123  buildingOutline: "#242930",124  road: "#242931",125  roadCasing: "#0f1114",126  roadSecondary: "#2a2f37",127  primary: "#3c3a30",128  primaryCasing: "#23211b",129  motorway: "#7e352c",130  motorwayCasing: "#4c1f19",131  boundary: "#4a4f58",132  label: "#b9bec7",133  labelHalo: "rgba(20, 22, 26, 0.9)",134  cityLabel: "#dfe3e9",135  roadLabel: "#8a9099",136  waterLabel: "#5f7f93",137};138139/** Merge app overrides over a base palette. */140export function resolvePalette(141  mode: KaMapMode,142  theme: KaMapTheme,143): BasemapPalette {144  const base = mode === "dark" ? KA_DARK_PALETTE : KA_LIGHT_PALETTE;145  const overrides = theme.basemapOverrides?.[mode];146  return overrides ? { ...base, ...overrides } : base;147}148149/** Marker tokens for an item family, falling back to `sale`. */150export function markerTokens(151  theme: KaMapTheme,152  family: "sale" | "rent" | "valuation" | "highlight",153): MarkerStyleTokens {154  return theme.markers[family] ?? theme.markers.sale;155}156