TypeScript 87.7%
CSS 12.3%
1/**2 * Author: Simon-Pierre Boucher3 * Contact: contact@spboucher.ai4 * Project: Groupe Ka / Ka Maps5 *6 * Per-app layer registry. The framework defines the vocabulary of layers7 * (groups + ids); each app registers only what its data actually supports.8 * Unsupported layers stay declared-but-hidden so future datasets plug in9 * without touching the framework.10 */1112import type { KaLayerDefinition } from "../types/index.js";1314export const LAYER_GROUPS = {15 property: "Propriétés",16 market: "Marché",17 land: "Territoire",18 lifestyle: "Milieu de vie",19 investment: "Investissement",20} as const;2122/** The full Ka Maps layer vocabulary. Apps pick from (or extend) this. */23export const KNOWN_LAYERS: KaLayerDefinition[] = [24 { id: "for-sale", group: "property", label: "À vendre", supported: false },25 { id: "for-rent", group: "property", label: "À louer", supported: false },26 { id: "recently-sold", group: "property", label: "Vendues récemment", supported: false },27 { id: "estimated-values", group: "property", label: "Valeurs estimées", supported: false },28 { id: "median-price", group: "market", label: "Prix médian", supported: false },29 { id: "price-per-sqft", group: "market", label: "Prix / pi²", supported: false },30 { id: "yoy-change", group: "market", label: "Variation annuelle", supported: false },31 { id: "inventory", group: "market", label: "Inventaire", supported: false },32 { id: "days-on-market", group: "market", label: "Jours sur le marché", supported: false },33 { id: "price-cuts", group: "market", label: "Baisses de prix", supported: false },34 { id: "buildings", group: "land", label: "Bâtiments", supported: false },35 { id: "lots", group: "land", label: "Lots", supported: false },36 { id: "zoning", group: "land", label: "Zonage", supported: false },37 { id: "admin-boundaries", group: "land", label: "Limites administratives", supported: false },38 { id: "schools", group: "lifestyle", label: "Écoles", supported: false },39 { id: "transit", group: "lifestyle", label: "Transport en commun", supported: false },40 { id: "grocery", group: "lifestyle", label: "Épiceries", supported: false },41 { id: "parks", group: "lifestyle", label: "Parcs", supported: false },42 { id: "est-yield", group: "investment", label: "Rendement estimé", supported: false },43 { id: "est-rent", group: "investment", label: "Loyer estimé", supported: false },44 { id: "est-cashflow", group: "investment", label: "Flux de trésorerie estimé", supported: false },45];4647/**48 * Build an app's registry: mark the layers it supports (and optionally49 * activates by default); everything else stays declared but unsupported.50 */51export function buildLayerRegistry(52 supported: { id: string; defaultActive?: boolean }[],53): KaLayerDefinition[] {54 const byId = new Map(supported.map((s) => [s.id, s]));55 return KNOWN_LAYERS.map((layer) => {56 const s = byId.get(layer.id);57 return s58 ? { ...layer, supported: true, defaultActive: s.defaultActive ?? false }59 : { ...layer };60 });61}62