@codeplex-sac/tema 0.0.14 → 0.0.15

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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),r=require("react"),d=require("@mui/material"),m=r.createContext(void 0),p="codeplex-theme",f=({children:s,temaPorDefecto:a="light"})=>{const[n,c]=r.useState(()=>{if(typeof window<"u"){const o=localStorage.getItem(p);if(o==="light"||o==="dark")return o;if(window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}return a}),e=r.useCallback(o=>{const u=document.documentElement;u.classList.remove("light","dark"),u.classList.add(o),localStorage.setItem(p,o)},[]);r.useEffect(()=>{e(n)},[n,e]);const t=r.useCallback(o=>{c(o)},[]),h=r.useCallback(()=>{c(o=>o==="light"?"dark":"light")},[]);return i.jsx(m.Provider,{value:{tema:n,alternarTema:h,establecerTema:t},children:s})},y=({defaultTheme:s,...a})=>i.jsx(f,{temaPorDefecto:s,...a}),g=m,l=()=>{const s=r.useContext(m);if(!s)throw new Error("usarTema debe ser usado dentro de un CodeplexProveedorTema");return s},x=l,T=({children:s,sobrescrituraTema:a})=>{const{tema:n}=l(),c=r.useMemo(()=>{const e=n==="dark",t={palette:{mode:n,primary:{main:"#3b82f6"},background:{default:e?"#1b2431":"#f9fafb",paper:e?"#273142":"#ffffff"},text:{primary:e?"#ffffff":"#111827",secondary:e?"rgba(255,255,255,0.7)":"#4b5563"}},typography:{fontFamily:'"Poppins", "Inter", "system-ui", "-apple-system", sans-serif',h1:{fontWeight:600},h2:{fontWeight:600},h3:{fontWeight:600},h4:{fontWeight:600},h5:{fontWeight:600},h6:{fontWeight:600},button:{fontWeight:500,textTransform:"none"}},shape:{borderRadius:8},components:{MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}},MuiButton:{styleOverrides:{root:{textTransform:"none",fontWeight:600}}}}};return a?d.createTheme(t,a):d.createTheme(t)},[n,a]);return r.useEffect(()=>{const e=document.documentElement,t=c.palette;e.style.setProperty("--cp-primary-main",t.primary.main),e.style.setProperty("--cp-bg-default",t.background.default),e.style.setProperty("--cp-bg-paper",t.background.paper),e.style.setProperty("--cp-text-primary",t.text.primary),e.style.setProperty("--cp-text-secondary",t.text.secondary),e.style.setProperty("--cp-divider",t.divider)},[c]),r.useEffect(()=>{const e="codeplex-google-resources";if(!document.getElementById(e)){const t=document.createElement("link");t.id=e,t.rel="stylesheet",t.href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200",document.head.appendChild(t)}},[]),i.jsxs(d.ThemeProvider,{theme:c,children:[i.jsx(d.CssBaseline,{}),s]})};function C(){return"tema"}exports.CodeplexProveedorMui=T;exports.CodeplexProveedorTema=f;exports.CodeplexThemeProvider=y;exports.ContextoTema=m;exports.ThemeContext=g;exports.tema=C;exports.usarTema=l;exports.useTheme=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),d=require("react"),c=require("@mui/material"),p=d.createContext(void 0),g="codeplex-theme",h=({children:e,temaPorDefecto:t="light"})=>{const[r,n]=d.useState(()=>{if(typeof window<"u"){const i=localStorage.getItem(g);if(i==="light"||i==="dark")return i;if(window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}return t}),o=d.useCallback(i=>{const f=document.documentElement;f.classList.remove("light","dark"),f.classList.add(i),localStorage.setItem(g,i)},[]);d.useEffect(()=>{o(r)},[r,o]);const a=d.useCallback(i=>{n(i)},[]),l=d.useCallback(()=>{n(i=>i==="light"?"dark":"light")},[]);return s.jsx(p.Provider,{value:{tema:r,alternarTema:l,establecerTema:a},children:e})},E=({defaultTheme:e,...t})=>s.jsx(h,{temaPorDefecto:e,...t}),C=p,u=()=>{const e=d.useContext(p);if(!e)throw new Error("usarTema debe ser usado dentro de un CodeplexProveedorTema");return e},P=u,S=({children:e,sobrescrituraTema:t})=>{const{tema:r}=u(),n=d.useMemo(()=>{const o=r==="dark",a={palette:{mode:r,primary:{main:"#3b82f6"},background:{default:o?"#1b2431":"#f9fafb",paper:o?"#273142":"#ffffff"},text:{primary:o?"#ffffff":"#111827",secondary:o?"rgba(255,255,255,0.7)":"#4b5563"}},typography:{fontFamily:'"Poppins", "Inter", "system-ui", "-apple-system", sans-serif',h1:{fontWeight:600},h2:{fontWeight:600},h3:{fontWeight:600},h4:{fontWeight:600},h5:{fontWeight:600},h6:{fontWeight:600},button:{fontWeight:500,textTransform:"none"}},shape:{borderRadius:8},components:{MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}},MuiButton:{styleOverrides:{root:{textTransform:"none",fontWeight:600}}}}};return t?c.createTheme(a,t):c.createTheme(a)},[r,t]);return d.useEffect(()=>{const o=document.documentElement,a=n.palette;o.style.setProperty("--cp-primary-main",a.primary.main),o.style.setProperty("--cp-bg-default",a.background.default),o.style.setProperty("--cp-bg-paper",a.background.paper),o.style.setProperty("--cp-text-primary",a.text.primary),o.style.setProperty("--cp-text-secondary",a.text.secondary),o.style.setProperty("--cp-divider",a.divider)},[n]),d.useEffect(()=>{const o="codeplex-google-resources";if(!document.getElementById(o)){const a=document.createElement("link");a.id=o,a.rel="stylesheet",a.href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200",document.head.appendChild(a)}},[]),s.jsxs(c.ThemeProvider,{theme:n,children:[s.jsx(c.CssBaseline,{}),e]})};function T(){return"tema"}const x=[{id:"playfair-dm-sans",nombre:"Playfair Display + DM Sans",titular:"Playfair Display",cuerpo:"DM Sans",categoria:"elegante",descripcion:"Serif de alto contraste para titulares con una sans geométrica limpia para el cuerpo."},{id:"cormorant-inter",nombre:"Cormorant Garamond + Inter",titular:"Cormorant Garamond",cuerpo:"Inter",categoria:"editorial",descripcion:"Serif clásica y refinada combinada con una sans neutra muy legible."},{id:"dm-sans-staatliches",nombre:"Staatliches + DM Sans",titular:"Staatliches",cuerpo:"DM Sans",categoria:"moderno",descripcion:"Display condensada de gran impacto para titulares cortos y llamativos."},{id:"bricolage-biorhyme",nombre:"Bricolage Grotesque + BioRhyme",titular:"Bricolage Grotesque",cuerpo:"BioRhyme",categoria:"editorial",descripcion:"Grotesca expresiva con una serif de bloque para un tono editorial contemporáneo."},{id:"eb-garamond-dm-mono",nombre:"EB Garamond + DM Mono",titular:"EB Garamond",cuerpo:"DM Mono",categoria:"tecnico",descripcion:"Serif humanista con una monoespaciada para documentación técnica con carácter."},{id:"poppins-inter",nombre:"Poppins + Inter",titular:"Poppins",cuerpo:"Inter",categoria:"minimalista",descripcion:"Par por defecto del sistema Codeplex: titulares redondeados y cuerpo neutro."},{id:"space-grotesk-ibm-plex",nombre:"Space Grotesk + IBM Plex Sans",titular:"Space Grotesk",cuerpo:"IBM Plex Sans",categoria:"tecnico",descripcion:"Geométrica con detalles técnicos para productos digitales y dashboards."},{id:"fraunces-nunito",nombre:"Fraunces + Nunito Sans",titular:"Fraunces",cuerpo:"Nunito Sans",categoria:"elegante",descripcion:"Serif suave y cálida con una sans amable para marcas cercanas."}];function v(e){return x.find(t=>t.id===e)}function y(e){return`"${e}", "Inter", "system-ui", "-apple-system", "Segoe UI", sans-serif`}function b(e){const t=":wght@300;400;500;600;700";return`https://fonts.googleapis.com/css2?${[e.titular,e.cuerpo].filter((n,o,a)=>a.indexOf(n)===o).map(n=>`family=${n.replace(/ /g,"+")}${t}`).join("&")}&display=swap`}function m(e){const t=y(e.titular),r=y(e.cuerpo);return{fontFamily:r,h1:{fontFamily:t,fontWeight:700},h2:{fontFamily:t,fontWeight:700},h3:{fontFamily:t,fontWeight:600},h4:{fontFamily:t,fontWeight:600},h5:{fontFamily:t,fontWeight:600},h6:{fontFamily:t,fontWeight:600},subtitle1:{fontFamily:r},subtitle2:{fontFamily:r},body1:{fontFamily:r},body2:{fontFamily:r},button:{fontFamily:r,fontWeight:600,textTransform:"none"},caption:{fontFamily:r},overline:{fontFamily:r}}}function D(e){return{typography:m(e)}}function M(e){if(typeof document>"u")return;const t=`codeplex-par-fuentes-${e.id}`;if(document.getElementById(t))return;const r=document.createElement("link");r.id=t,r.rel="stylesheet",r.href=b(e),document.head.appendChild(r)}const F=[{id:"space-vibrante",nombre:"Space Vibrante",titular:"Space Grotesk",cuerpo:"DM Sans",colores:{fondo:"#FFFFFF",texto:"#111111",primario:"#111111",acento:"#FF5B3E",superficie:"#FFD84D"}},{id:"cormorant-noche",nombre:"Cormorant Noche",titular:"Cormorant Garamond",cuerpo:"Inter",colores:{fondo:"#1A2340",texto:"#F4EAD5",primario:"#D4A574",acento:"#E8C77A",superficie:"#243054"}},{id:"playfair-tierra",nombre:"Playfair Tierra",titular:"Playfair Display",cuerpo:"Lora",colores:{fondo:"#EFEAE2",texto:"#2A1F14",primario:"#2A1F14",acento:"#8B6F4E",superficie:"#C9B896"}},{id:"tanker-pop",nombre:"Tanker Pop",titular:"Bricolage Grotesque",cuerpo:"DM Sans",colores:{fondo:"#FFE8F0",texto:"#3D1A2E",primario:"#A855F7",acento:"#FF5BA0",superficie:"#FFF6CC"}},{id:"plex-tecnico",nombre:"Plex Técnico",titular:"Space Grotesk",cuerpo:"IBM Plex Sans",colores:{fondo:"#0B1120",texto:"#E2E8F0",primario:"#38BDF8",acento:"#22D3EE",superficie:"#1E293B"}},{id:"fraunces-calido",nombre:"Fraunces Cálido",titular:"Fraunces",cuerpo:"Nunito Sans",colores:{fondo:"#FFF8F2",texto:"#3B2A22",primario:"#C2410C",acento:"#F59E0B",superficie:"#FCE7D2"}}];function B(e){return F.find(t=>t.id===e)}function A(e){const t={id:e.id,nombre:e.nombre,titular:e.titular,cuerpo:e.cuerpo,descripcion:e.nombre};return{palette:{primary:{main:e.colores.primario},secondary:{main:e.colores.acento},background:{default:e.colores.fondo,paper:e.colores.superficie},text:{primary:e.colores.texto}},typography:m(t)}}function I(e){if(typeof document>"u")return;const t=`codeplex-kit-marca-${e.id}`;if(document.getElementById(t))return;const r=":wght@300;400;500;600;700",n=[e.titular,e.cuerpo].filter((a,l,i)=>i.indexOf(a)===l).map(a=>`family=${a.replace(/ /g,"+")}${r}`).join("&"),o=document.createElement("link");o.id=t,o.rel="stylesheet",o.href=`https://fonts.googleapis.com/css2?${n}&display=swap`,document.head.appendChild(o)}function j(e){const t=e.replace("#",""),r=t.length===3?t.split("").map(l=>l+l).join(""):t,n=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16);return(.299*n+.587*o+.114*a)/255>.6}const w=[{clave:"fondo",etiqueta:"Fondo"},{clave:"texto",etiqueta:"Texto"},{clave:"primario",etiqueta:"Primario"},{clave:"acento",etiqueta:"Acento"},{clave:"superficie",etiqueta:"Superficie"}];function R(e){return`"${e}", system-ui, sans-serif`}const k={borderRadius:3,overflow:"hidden",bgcolor:"background.paper",border:e=>`1px solid ${e.palette.divider}`,transition:"box-shadow 150ms ease, border-color 150ms ease, transform 150ms ease"},G=({kit:e,seleccionado:t=!1,alSeleccionar:r})=>{const n=!!r;return s.jsxs(c.Box,{role:n?"button":void 0,tabIndex:n?0:void 0,"aria-label":n?`Aplicar kit ${e.nombre}`:void 0,onClick:()=>r?.(e),onKeyDown:o=>{n&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),r?.(e))},sx:{...k,cursor:n?"pointer":"default",borderColor:o=>t?o.palette.primary.main:o.palette.divider,boxShadow:t?6:0,"&:hover":n?{boxShadow:4,transform:"translateY(-2px)"}:void 0},children:[s.jsx(c.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",bgcolor:"#16181d"},children:[{tag:"Headline",fuente:e.titular},{tag:"Body",fuente:e.cuerpo}].map(o=>s.jsxs(c.Box,{sx:{p:2.5,borderRight:o.tag==="Headline"?"1px solid rgba(255,255,255,0.08)":"none"},children:[s.jsx(c.Typography,{sx:{color:"rgba(255,255,255,0.5)",fontSize:11,mb:.5},children:o.tag}),s.jsx(c.Typography,{sx:{color:"#fff",fontFamily:R(o.fuente),fontSize:22,fontWeight:600,lineHeight:1.15},children:o.fuente})]},o.tag))}),s.jsx(c.Box,{sx:{p:1.5,display:"flex",flexDirection:"column",gap:1},children:w.map(({clave:o,etiqueta:a})=>{const l=e.colores[o],i=j(l);return s.jsxs(c.Box,{sx:{bgcolor:l,borderRadius:2,px:2,py:1.25,display:"flex",alignItems:"center",justifyContent:"space-between",border:i?"1px solid rgba(0,0,0,0.06)":"none"},children:[s.jsx(c.Typography,{sx:{color:i?"#111":"#fff",fontSize:13,fontWeight:500},children:a}),s.jsx(c.Typography,{sx:{color:i?"rgba(0,0,0,0.55)":"rgba(255,255,255,0.8)",fontSize:12,fontFamily:"monospace"},children:l.toUpperCase()})]},o)})})]})};exports.CODEPLEX_KITS_MARCA=F;exports.CODEPLEX_PARES_FUENTES=x;exports.CodeplexProveedorMui=S;exports.CodeplexProveedorTema=h;exports.CodeplexTarjetaMarca=G;exports.CodeplexThemeProvider=E;exports.ContextoTema=p;exports.ThemeContext=C;exports.cargarKitMarca=I;exports.cargarParFuentes=M;exports.obtenerKitMarca=B;exports.obtenerParFuentes=v;exports.tema=T;exports.temaDesdeKitMarca=A;exports.temaDesdeParFuentes=D;exports.tipografiaDesdeParFuentes=m;exports.urlGoogleFonts=b;exports.usarTema=u;exports.useTheme=P;
package/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './lib/tipos';
2
2
  export * from './lib/proveedor';
3
3
  export * from './lib/tema';
4
+ export * from './lib/pares-fuentes/pares-fuentes';
5
+ export * from './lib/kits-marca/kits-marca';
4
6
  export type { ThemeOptions as OpcionesTema } from '@mui/material';
package/index.js CHANGED
@@ -1,55 +1,55 @@
1
- import { jsx as i, jsxs as y } from "react/jsx-runtime";
2
- import g, { createContext as x, useState as P, useCallback as c, useEffect as d, useMemo as T } from "react";
3
- import { createTheme as p, ThemeProvider as b, CssBaseline as k } from "@mui/material";
4
- const m = x(void 0), f = "codeplex-theme", C = ({
5
- children: r,
6
- temaPorDefecto: n = "light"
1
+ import { jsx as c, jsxs as p } from "react/jsx-runtime";
2
+ import E, { createContext as C, useState as S, useCallback as m, useEffect as u, useMemo as P } from "react";
3
+ import { createTheme as y, ThemeProvider as v, CssBaseline as T, Box as l, Typography as d } from "@mui/material";
4
+ const f = C(void 0), h = "codeplex-theme", D = ({
5
+ children: e,
6
+ temaPorDefecto: t = "light"
7
7
  }) => {
8
- const [s, a] = P(() => {
8
+ const [r, n] = S(() => {
9
9
  if (typeof window < "u") {
10
- const o = localStorage.getItem(f);
11
- if (o === "light" || o === "dark")
12
- return o;
10
+ const i = localStorage.getItem(h);
11
+ if (i === "light" || i === "dark")
12
+ return i;
13
13
  if (window.matchMedia("(prefers-color-scheme: dark)").matches)
14
14
  return "dark";
15
15
  }
16
- return n;
17
- }), e = c((o) => {
18
- const l = document.documentElement;
19
- l.classList.remove("light", "dark"), l.classList.add(o), localStorage.setItem(f, o);
16
+ return t;
17
+ }), o = m((i) => {
18
+ const g = document.documentElement;
19
+ g.classList.remove("light", "dark"), g.classList.add(i), localStorage.setItem(h, i);
20
20
  }, []);
21
- d(() => {
22
- e(s);
23
- }, [s, e]);
24
- const t = c((o) => {
25
- a(o);
26
- }, []), h = c(() => {
27
- a((o) => o === "light" ? "dark" : "light");
21
+ u(() => {
22
+ o(r);
23
+ }, [r, o]);
24
+ const a = m((i) => {
25
+ n(i);
26
+ }, []), s = m(() => {
27
+ n((i) => i === "light" ? "dark" : "light");
28
28
  }, []);
29
- return /* @__PURE__ */ i(m.Provider, { value: { tema: s, alternarTema: h, establecerTema: t }, children: r });
30
- }, w = ({ defaultTheme: r, ...n }) => /* @__PURE__ */ i(C, { temaPorDefecto: r, ...n }), W = m, u = () => {
31
- const r = g.useContext(m);
32
- if (!r)
29
+ return /* @__PURE__ */ c(f.Provider, { value: { tema: r, alternarTema: s, establecerTema: a }, children: e });
30
+ }, O = ({ defaultTheme: e, ...t }) => /* @__PURE__ */ c(D, { temaPorDefecto: e, ...t }), L = f, x = () => {
31
+ const e = E.useContext(f);
32
+ if (!e)
33
33
  throw new Error("usarTema debe ser usado dentro de un CodeplexProveedorTema");
34
- return r;
35
- }, I = u, A = ({
36
- children: r,
37
- sobrescrituraTema: n
34
+ return e;
35
+ }, _ = x, j = ({
36
+ children: e,
37
+ sobrescrituraTema: t
38
38
  }) => {
39
- const { tema: s } = u(), a = T(() => {
40
- const e = s === "dark", t = {
39
+ const { tema: r } = x(), n = P(() => {
40
+ const o = r === "dark", a = {
41
41
  palette: {
42
- mode: s,
42
+ mode: r,
43
43
  primary: {
44
44
  main: "#3b82f6"
45
45
  },
46
46
  background: {
47
- default: e ? "#1b2431" : "#f9fafb",
48
- paper: e ? "#273142" : "#ffffff"
47
+ default: o ? "#1b2431" : "#f9fafb",
48
+ paper: o ? "#273142" : "#ffffff"
49
49
  },
50
50
  text: {
51
- primary: e ? "#ffffff" : "#111827",
52
- secondary: e ? "rgba(255,255,255,0.7)" : "#4b5563"
51
+ primary: o ? "#ffffff" : "#111827",
52
+ secondary: o ? "rgba(255,255,255,0.7)" : "#4b5563"
53
53
  }
54
54
  },
55
55
  typography: {
@@ -83,32 +83,298 @@ const m = x(void 0), f = "codeplex-theme", C = ({
83
83
  }
84
84
  }
85
85
  };
86
- return n ? p(t, n) : p(t);
87
- }, [s, n]);
88
- return d(() => {
89
- const e = document.documentElement, t = a.palette;
90
- e.style.setProperty("--cp-primary-main", t.primary.main), e.style.setProperty("--cp-bg-default", t.background.default), e.style.setProperty("--cp-bg-paper", t.background.paper), e.style.setProperty("--cp-text-primary", t.text.primary), e.style.setProperty("--cp-text-secondary", t.text.secondary), e.style.setProperty("--cp-divider", t.divider);
91
- }, [a]), d(() => {
92
- const e = "codeplex-google-resources";
93
- if (!document.getElementById(e)) {
94
- const t = document.createElement("link");
95
- t.id = e, t.rel = "stylesheet", t.href = "https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200", document.head.appendChild(t);
86
+ return t ? y(a, t) : y(a);
87
+ }, [r, t]);
88
+ return u(() => {
89
+ const o = document.documentElement, a = n.palette;
90
+ o.style.setProperty("--cp-primary-main", a.primary.main), o.style.setProperty("--cp-bg-default", a.background.default), o.style.setProperty("--cp-bg-paper", a.background.paper), o.style.setProperty("--cp-text-primary", a.text.primary), o.style.setProperty("--cp-text-secondary", a.text.secondary), o.style.setProperty("--cp-divider", a.divider);
91
+ }, [n]), u(() => {
92
+ const o = "codeplex-google-resources";
93
+ if (!document.getElementById(o)) {
94
+ const a = document.createElement("link");
95
+ a.id = o, a.rel = "stylesheet", a.href = "https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200", document.head.appendChild(a);
96
96
  }
97
- }, []), /* @__PURE__ */ y(b, { theme: a, children: [
98
- /* @__PURE__ */ i(k, {}),
99
- r
97
+ }, []), /* @__PURE__ */ p(v, { theme: n, children: [
98
+ /* @__PURE__ */ c(T, {}),
99
+ e
100
100
  ] });
101
101
  };
102
- function L() {
102
+ function N() {
103
103
  return "tema";
104
104
  }
105
+ const B = [
106
+ {
107
+ id: "playfair-dm-sans",
108
+ nombre: "Playfair Display + DM Sans",
109
+ titular: "Playfair Display",
110
+ cuerpo: "DM Sans",
111
+ categoria: "elegante",
112
+ descripcion: "Serif de alto contraste para titulares con una sans geométrica limpia para el cuerpo."
113
+ },
114
+ {
115
+ id: "cormorant-inter",
116
+ nombre: "Cormorant Garamond + Inter",
117
+ titular: "Cormorant Garamond",
118
+ cuerpo: "Inter",
119
+ categoria: "editorial",
120
+ descripcion: "Serif clásica y refinada combinada con una sans neutra muy legible."
121
+ },
122
+ {
123
+ id: "dm-sans-staatliches",
124
+ nombre: "Staatliches + DM Sans",
125
+ titular: "Staatliches",
126
+ cuerpo: "DM Sans",
127
+ categoria: "moderno",
128
+ descripcion: "Display condensada de gran impacto para titulares cortos y llamativos."
129
+ },
130
+ {
131
+ id: "bricolage-biorhyme",
132
+ nombre: "Bricolage Grotesque + BioRhyme",
133
+ titular: "Bricolage Grotesque",
134
+ cuerpo: "BioRhyme",
135
+ categoria: "editorial",
136
+ descripcion: "Grotesca expresiva con una serif de bloque para un tono editorial contemporáneo."
137
+ },
138
+ {
139
+ id: "eb-garamond-dm-mono",
140
+ nombre: "EB Garamond + DM Mono",
141
+ titular: "EB Garamond",
142
+ cuerpo: "DM Mono",
143
+ categoria: "tecnico",
144
+ descripcion: "Serif humanista con una monoespaciada para documentación técnica con carácter."
145
+ },
146
+ {
147
+ id: "poppins-inter",
148
+ nombre: "Poppins + Inter",
149
+ titular: "Poppins",
150
+ cuerpo: "Inter",
151
+ categoria: "minimalista",
152
+ descripcion: "Par por defecto del sistema Codeplex: titulares redondeados y cuerpo neutro."
153
+ },
154
+ {
155
+ id: "space-grotesk-ibm-plex",
156
+ nombre: "Space Grotesk + IBM Plex Sans",
157
+ titular: "Space Grotesk",
158
+ cuerpo: "IBM Plex Sans",
159
+ categoria: "tecnico",
160
+ descripcion: "Geométrica con detalles técnicos para productos digitales y dashboards."
161
+ },
162
+ {
163
+ id: "fraunces-nunito",
164
+ nombre: "Fraunces + Nunito Sans",
165
+ titular: "Fraunces",
166
+ cuerpo: "Nunito Sans",
167
+ categoria: "elegante",
168
+ descripcion: "Serif suave y cálida con una sans amable para marcas cercanas."
169
+ }
170
+ ];
171
+ function q(e) {
172
+ return B.find((t) => t.id === e);
173
+ }
174
+ function b(e) {
175
+ return `"${e}", "Inter", "system-ui", "-apple-system", "Segoe UI", sans-serif`;
176
+ }
177
+ function M(e) {
178
+ const t = ":wght@300;400;500;600;700";
179
+ return `https://fonts.googleapis.com/css2?${[e.titular, e.cuerpo].filter((n, o, a) => a.indexOf(n) === o).map((n) => `family=${n.replace(/ /g, "+")}${t}`).join("&")}&display=swap`;
180
+ }
181
+ function F(e) {
182
+ const t = b(e.titular), r = b(e.cuerpo);
183
+ return {
184
+ fontFamily: r,
185
+ h1: { fontFamily: t, fontWeight: 700 },
186
+ h2: { fontFamily: t, fontWeight: 700 },
187
+ h3: { fontFamily: t, fontWeight: 600 },
188
+ h4: { fontFamily: t, fontWeight: 600 },
189
+ h5: { fontFamily: t, fontWeight: 600 },
190
+ h6: { fontFamily: t, fontWeight: 600 },
191
+ subtitle1: { fontFamily: r },
192
+ subtitle2: { fontFamily: r },
193
+ body1: { fontFamily: r },
194
+ body2: { fontFamily: r },
195
+ button: { fontFamily: r, fontWeight: 600, textTransform: "none" },
196
+ caption: { fontFamily: r },
197
+ overline: { fontFamily: r }
198
+ };
199
+ }
200
+ function z(e) {
201
+ return { typography: F(e) };
202
+ }
203
+ function K(e) {
204
+ if (typeof document > "u") return;
205
+ const t = `codeplex-par-fuentes-${e.id}`;
206
+ if (document.getElementById(t)) return;
207
+ const r = document.createElement("link");
208
+ r.id = t, r.rel = "stylesheet", r.href = M(e), document.head.appendChild(r);
209
+ }
210
+ const I = [
211
+ {
212
+ id: "space-vibrante",
213
+ nombre: "Space Vibrante",
214
+ titular: "Space Grotesk",
215
+ cuerpo: "DM Sans",
216
+ colores: { fondo: "#FFFFFF", texto: "#111111", primario: "#111111", acento: "#FF5B3E", superficie: "#FFD84D" }
217
+ },
218
+ {
219
+ id: "cormorant-noche",
220
+ nombre: "Cormorant Noche",
221
+ titular: "Cormorant Garamond",
222
+ cuerpo: "Inter",
223
+ colores: { fondo: "#1A2340", texto: "#F4EAD5", primario: "#D4A574", acento: "#E8C77A", superficie: "#243054" }
224
+ },
225
+ {
226
+ id: "playfair-tierra",
227
+ nombre: "Playfair Tierra",
228
+ titular: "Playfair Display",
229
+ cuerpo: "Lora",
230
+ colores: { fondo: "#EFEAE2", texto: "#2A1F14", primario: "#2A1F14", acento: "#8B6F4E", superficie: "#C9B896" }
231
+ },
232
+ {
233
+ id: "tanker-pop",
234
+ nombre: "Tanker Pop",
235
+ titular: "Bricolage Grotesque",
236
+ cuerpo: "DM Sans",
237
+ colores: { fondo: "#FFE8F0", texto: "#3D1A2E", primario: "#A855F7", acento: "#FF5BA0", superficie: "#FFF6CC" }
238
+ },
239
+ {
240
+ id: "plex-tecnico",
241
+ nombre: "Plex Técnico",
242
+ titular: "Space Grotesk",
243
+ cuerpo: "IBM Plex Sans",
244
+ colores: { fondo: "#0B1120", texto: "#E2E8F0", primario: "#38BDF8", acento: "#22D3EE", superficie: "#1E293B" }
245
+ },
246
+ {
247
+ id: "fraunces-calido",
248
+ nombre: "Fraunces Cálido",
249
+ titular: "Fraunces",
250
+ cuerpo: "Nunito Sans",
251
+ colores: { fondo: "#FFF8F2", texto: "#3B2A22", primario: "#C2410C", acento: "#F59E0B", superficie: "#FCE7D2" }
252
+ }
253
+ ];
254
+ function U(e) {
255
+ return I.find((t) => t.id === e);
256
+ }
257
+ function H(e) {
258
+ const t = {
259
+ id: e.id,
260
+ nombre: e.nombre,
261
+ titular: e.titular,
262
+ cuerpo: e.cuerpo,
263
+ descripcion: e.nombre
264
+ };
265
+ return {
266
+ palette: {
267
+ primary: { main: e.colores.primario },
268
+ secondary: { main: e.colores.acento },
269
+ background: { default: e.colores.fondo, paper: e.colores.superficie },
270
+ text: { primary: e.colores.texto }
271
+ },
272
+ typography: F(t)
273
+ };
274
+ }
275
+ function V(e) {
276
+ if (typeof document > "u") return;
277
+ const t = `codeplex-kit-marca-${e.id}`;
278
+ if (document.getElementById(t)) return;
279
+ const r = ":wght@300;400;500;600;700", n = [e.titular, e.cuerpo].filter((a, s, i) => i.indexOf(a) === s).map((a) => `family=${a.replace(/ /g, "+")}${r}`).join("&"), o = document.createElement("link");
280
+ o.id = t, o.rel = "stylesheet", o.href = `https://fonts.googleapis.com/css2?${n}&display=swap`, document.head.appendChild(o);
281
+ }
282
+ function A(e) {
283
+ const t = e.replace("#", ""), r = t.length === 3 ? t.split("").map((s) => s + s).join("") : t, n = parseInt(r.slice(0, 2), 16), o = parseInt(r.slice(2, 4), 16), a = parseInt(r.slice(4, 6), 16);
284
+ return (0.299 * n + 0.587 * o + 0.114 * a) / 255 > 0.6;
285
+ }
286
+ const w = [
287
+ { clave: "fondo", etiqueta: "Fondo" },
288
+ { clave: "texto", etiqueta: "Texto" },
289
+ { clave: "primario", etiqueta: "Primario" },
290
+ { clave: "acento", etiqueta: "Acento" },
291
+ { clave: "superficie", etiqueta: "Superficie" }
292
+ ];
293
+ function W(e) {
294
+ return `"${e}", system-ui, sans-serif`;
295
+ }
296
+ const G = {
297
+ borderRadius: 3,
298
+ overflow: "hidden",
299
+ bgcolor: "background.paper",
300
+ border: (e) => `1px solid ${e.palette.divider}`,
301
+ transition: "box-shadow 150ms ease, border-color 150ms ease, transform 150ms ease"
302
+ }, X = ({
303
+ kit: e,
304
+ seleccionado: t = !1,
305
+ alSeleccionar: r
306
+ }) => {
307
+ const n = !!r;
308
+ return /* @__PURE__ */ p(
309
+ l,
310
+ {
311
+ role: n ? "button" : void 0,
312
+ tabIndex: n ? 0 : void 0,
313
+ "aria-label": n ? `Aplicar kit ${e.nombre}` : void 0,
314
+ onClick: () => r?.(e),
315
+ onKeyDown: (o) => {
316
+ n && (o.key === "Enter" || o.key === " ") && (o.preventDefault(), r?.(e));
317
+ },
318
+ sx: {
319
+ ...G,
320
+ cursor: n ? "pointer" : "default",
321
+ borderColor: (o) => t ? o.palette.primary.main : o.palette.divider,
322
+ boxShadow: t ? 6 : 0,
323
+ "&:hover": n ? { boxShadow: 4, transform: "translateY(-2px)" } : void 0
324
+ },
325
+ children: [
326
+ /* @__PURE__ */ c(l, { sx: { display: "grid", gridTemplateColumns: "1fr 1fr", bgcolor: "#16181d" }, children: [
327
+ { tag: "Headline", fuente: e.titular },
328
+ { tag: "Body", fuente: e.cuerpo }
329
+ ].map((o) => /* @__PURE__ */ p(l, { sx: { p: 2.5, borderRight: o.tag === "Headline" ? "1px solid rgba(255,255,255,0.08)" : "none" }, children: [
330
+ /* @__PURE__ */ c(d, { sx: { color: "rgba(255,255,255,0.5)", fontSize: 11, mb: 0.5 }, children: o.tag }),
331
+ /* @__PURE__ */ c(d, { sx: { color: "#fff", fontFamily: W(o.fuente), fontSize: 22, fontWeight: 600, lineHeight: 1.15 }, children: o.fuente })
332
+ ] }, o.tag)) }),
333
+ /* @__PURE__ */ c(l, { sx: { p: 1.5, display: "flex", flexDirection: "column", gap: 1 }, children: w.map(({ clave: o, etiqueta: a }) => {
334
+ const s = e.colores[o], i = A(s);
335
+ return /* @__PURE__ */ p(
336
+ l,
337
+ {
338
+ sx: {
339
+ bgcolor: s,
340
+ borderRadius: 2,
341
+ px: 2,
342
+ py: 1.25,
343
+ display: "flex",
344
+ alignItems: "center",
345
+ justifyContent: "space-between",
346
+ border: i ? "1px solid rgba(0,0,0,0.06)" : "none"
347
+ },
348
+ children: [
349
+ /* @__PURE__ */ c(d, { sx: { color: i ? "#111" : "#fff", fontSize: 13, fontWeight: 500 }, children: a }),
350
+ /* @__PURE__ */ c(d, { sx: { color: i ? "rgba(0,0,0,0.55)" : "rgba(255,255,255,0.8)", fontSize: 12, fontFamily: "monospace" }, children: s.toUpperCase() })
351
+ ]
352
+ },
353
+ o
354
+ );
355
+ }) })
356
+ ]
357
+ }
358
+ );
359
+ };
105
360
  export {
106
- A as CodeplexProveedorMui,
107
- C as CodeplexProveedorTema,
108
- w as CodeplexThemeProvider,
109
- m as ContextoTema,
110
- W as ThemeContext,
111
- L as tema,
112
- u as usarTema,
113
- I as useTheme
361
+ I as CODEPLEX_KITS_MARCA,
362
+ B as CODEPLEX_PARES_FUENTES,
363
+ j as CodeplexProveedorMui,
364
+ D as CodeplexProveedorTema,
365
+ X as CodeplexTarjetaMarca,
366
+ O as CodeplexThemeProvider,
367
+ f as ContextoTema,
368
+ L as ThemeContext,
369
+ V as cargarKitMarca,
370
+ K as cargarParFuentes,
371
+ U as obtenerKitMarca,
372
+ q as obtenerParFuentes,
373
+ N as tema,
374
+ H as temaDesdeKitMarca,
375
+ z as temaDesdeParFuentes,
376
+ F as tipografiaDesdeParFuentes,
377
+ M as urlGoogleFonts,
378
+ x as usarTema,
379
+ _ as useTheme
114
380
  };
@@ -0,0 +1,39 @@
1
+ import { default as React } from 'react';
2
+ import { ThemeOptions } from '@mui/material';
3
+ export interface CodeplexColoresMarca {
4
+ /** Color de fondo principal. */
5
+ fondo: string;
6
+ /** Color del texto. */
7
+ texto: string;
8
+ /** Color primario / de acción. */
9
+ primario: string;
10
+ /** Color de acento. */
11
+ acento: string;
12
+ /** Color de superficies (tarjetas, paneles). */
13
+ superficie: string;
14
+ }
15
+ export interface CodeplexKitMarca {
16
+ /** Identificador estable del kit. */
17
+ id: string;
18
+ /** Nombre legible del kit. */
19
+ nombre: string;
20
+ /** Fuente para titulares. */
21
+ titular: string;
22
+ /** Fuente para cuerpo de texto. */
23
+ cuerpo: string;
24
+ /** Paleta de colores del kit. */
25
+ colores: CodeplexColoresMarca;
26
+ }
27
+ export declare const CODEPLEX_KITS_MARCA: CodeplexKitMarca[];
28
+ export declare function obtenerKitMarca(id: string): CodeplexKitMarca | undefined;
29
+ export declare function temaDesdeKitMarca(kit: CodeplexKitMarca): ThemeOptions;
30
+ export declare function cargarKitMarca(kit: CodeplexKitMarca): void;
31
+ export interface CodeplexTarjetaMarcaProps {
32
+ /** Kit de marca a previsualizar. */
33
+ kit: CodeplexKitMarca;
34
+ /** Resalta la tarjeta como seleccionada. */
35
+ seleccionado?: boolean;
36
+ /** Se ejecuta al hacer clic en la tarjeta. */
37
+ alSeleccionar?: (kit: CodeplexKitMarca) => void;
38
+ }
39
+ export declare const CodeplexTarjetaMarca: React.FC<CodeplexTarjetaMarcaProps>;
@@ -0,0 +1,22 @@
1
+ import { ThemeOptions } from '@mui/material';
2
+ export type CodeplexCategoriaFuentes = 'elegante' | 'moderno' | 'editorial' | 'tecnico' | 'minimalista';
3
+ export interface CodeplexParFuentes {
4
+ /** Identificador estable del emparejamiento. */
5
+ id: string;
6
+ /** Nombre legible del emparejamiento. */
7
+ nombre: string;
8
+ /** Fuente para títulos y encabezados. */
9
+ titular: string;
10
+ /** Fuente para cuerpo de texto y párrafos. */
11
+ cuerpo: string;
12
+ /** Clasificación del estilo visual. */
13
+ categoria: CodeplexCategoriaFuentes;
14
+ /** Breve descripción del carácter del emparejamiento. */
15
+ descripcion: string;
16
+ }
17
+ export declare const CODEPLEX_PARES_FUENTES: CodeplexParFuentes[];
18
+ export declare function obtenerParFuentes(id: string): CodeplexParFuentes | undefined;
19
+ export declare function urlGoogleFonts(par: CodeplexParFuentes): string;
20
+ export declare function tipografiaDesdeParFuentes(par: CodeplexParFuentes): NonNullable<ThemeOptions['typography']>;
21
+ export declare function temaDesdeParFuentes(par: CodeplexParFuentes): ThemeOptions;
22
+ export declare function cargarParFuentes(par: CodeplexParFuentes): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeplex-sac/tema",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",