valtech-components 2.0.772 → 2.0.773
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/esm2022/lib/components/atoms/pattern/motifs.mjs +132 -0
- package/esm2022/lib/components/atoms/pattern/pattern.component.mjs +131 -0
- package/esm2022/lib/components/atoms/pattern/types.mjs +2 -0
- package/esm2022/lib/version.mjs +2 -2
- package/esm2022/public-api.mjs +4 -1
- package/fesm2022/valtech-components.mjs +261 -4
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/atoms/pattern/motifs.d.ts +54 -0
- package/lib/components/atoms/pattern/pattern.component.d.ts +56 -0
- package/lib/components/atoms/pattern/types.d.ts +47 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Valtech Pattern System — motifs + palettes.
|
|
3
|
+
*
|
|
4
|
+
* Pure data + helpers, sin dependencias Angular. Reusable desde Node/scripts
|
|
5
|
+
* (e.g., generate static thumbnails) o desde el componente `val-pattern`.
|
|
6
|
+
*
|
|
7
|
+
* Original spec: `assets/Valtech Pattern System.html` (single-page demo).
|
|
8
|
+
* Cada motif es función `(fill: string) => string` que devuelve SVG inner
|
|
9
|
+
* markup. Tile es 100×100 unidades; el motif se renderiza dentro de un `<g
|
|
10
|
+
* transform="translate(col*100 row*100)">` con un `<rect width=100 height=100
|
|
11
|
+
* fill=bg/>` de fondo.
|
|
12
|
+
*/
|
|
13
|
+
export type PatternMotifKey = 'chev-r' | 'chev-l' | 'chev-d' | 'chev-u' | 'tri-tl' | 'tri-tr' | 'tri-bl' | 'tri-br' | 'solid' | 'diamond' | 'small-r' | 'small-l' | 'arrow-r' | 'arrow-l' | 'house-d' | 'half-l' | 'half-t';
|
|
14
|
+
export declare const PATTERN_MOTIFS: Record<PatternMotifKey, (fg: string) => string>;
|
|
15
|
+
export declare const MOTIF_KEYS: PatternMotifKey[];
|
|
16
|
+
/** Chevron family — orientations + size variants + arrows. */
|
|
17
|
+
export declare const CHEV_KEYS: PatternMotifKey[];
|
|
18
|
+
/** Triangle / half-fill family. */
|
|
19
|
+
export declare const TRI_KEYS: PatternMotifKey[];
|
|
20
|
+
/** Center shape family (currently solo diamond). */
|
|
21
|
+
export declare const SHAPE_KEYS: PatternMotifKey[];
|
|
22
|
+
/** No-foreground tiles — solo el rect de fondo. */
|
|
23
|
+
export declare const SOLID_KEYS: PatternMotifKey[];
|
|
24
|
+
/** Built-in palettes — dark → light (8 colors). */
|
|
25
|
+
export type PatternPaletteKey = 'purple' | 'ink' | 'lavender';
|
|
26
|
+
export declare const PATTERN_PALETTES: Record<PatternPaletteKey, string[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Mulberry32 seeded RNG — devuelve función `()=>[0,1)`.
|
|
29
|
+
* Deterministic: mismo seed → misma secuencia. Útil para patrones reproducibles.
|
|
30
|
+
*/
|
|
31
|
+
export declare function mulberry32(seed: number): () => number;
|
|
32
|
+
/**
|
|
33
|
+
* Densidad de chevrons (0..1). El resto se reparte entre solid (20%), shape
|
|
34
|
+
* (15%) y tri (resto), proporcional al gap left después del threshold.
|
|
35
|
+
*/
|
|
36
|
+
export interface PatternGenConfig {
|
|
37
|
+
cols: number;
|
|
38
|
+
rows: number;
|
|
39
|
+
seed: number;
|
|
40
|
+
palette: string[];
|
|
41
|
+
chevronDensity?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface PatternTile {
|
|
44
|
+
motif: PatternMotifKey;
|
|
45
|
+
bg: string;
|
|
46
|
+
fg: string;
|
|
47
|
+
}
|
|
48
|
+
/** Genera matriz de tiles aplicando densidades + reglas de contraste. */
|
|
49
|
+
export declare function generatePatternTiles(cfg: PatternGenConfig): PatternTile[];
|
|
50
|
+
/**
|
|
51
|
+
* Renderiza el inner SVG (sin el `<svg>` root) para una matriz de tiles.
|
|
52
|
+
* Caller wraps en `<svg viewBox="0 0 {cols*100} {rows*100}" preserveAspectRatio="xMidYMid slice">`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function renderPatternSvgInner(tiles: PatternTile[], cols: number, baseColor: string): string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import { SafeHtml } from '@angular/platform-browser';
|
|
3
|
+
import { PatternMetadata } from './types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* `val-pattern`
|
|
7
|
+
*
|
|
8
|
+
* Componente de fondo geométrico inspirado en el sistema Valtech. Renderiza un
|
|
9
|
+
* grid de tiles 100×100 con motifs (chevrons, triangles, diamonds, arrows) en
|
|
10
|
+
* un SVG inline. Determinista vía `seed` o animado vía `reshuffle`.
|
|
11
|
+
*
|
|
12
|
+
* Cero dependencias externas — todo SVG.
|
|
13
|
+
*
|
|
14
|
+
* @example Como fondo de card (CSS absolute):
|
|
15
|
+
* ```scss
|
|
16
|
+
* .card { position: relative; overflow: hidden; }
|
|
17
|
+
* .card val-pattern { position: absolute; inset: 0; z-index: 0; opacity: 0.4; }
|
|
18
|
+
* .card .content { position: relative; z-index: 1; }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* ```html
|
|
22
|
+
* <div class="card">
|
|
23
|
+
* <val-pattern [props]="{ palette: 'purple', cols: 6, rows: 3, seed: 42 }" />
|
|
24
|
+
* <div class="content">Tu contenido aquí</div>
|
|
25
|
+
* </div>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example Como background animado (hero/login):
|
|
29
|
+
* ```html
|
|
30
|
+
* <val-pattern [props]="{ palette: 'lavender', cols: 16, rows: 8, animated: true }" />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class PatternComponent implements OnDestroy {
|
|
34
|
+
private sanitizer;
|
|
35
|
+
private readonly cols;
|
|
36
|
+
private readonly rows;
|
|
37
|
+
private readonly seed;
|
|
38
|
+
private readonly paletteRef;
|
|
39
|
+
private readonly chevronDensity;
|
|
40
|
+
private readonly preserveAspect;
|
|
41
|
+
private readonly animated;
|
|
42
|
+
private readonly reshuffleInterval;
|
|
43
|
+
private timer?;
|
|
44
|
+
/** Object-first input. Cambios disparan re-render por signals. */
|
|
45
|
+
set props(value: PatternMetadata | undefined);
|
|
46
|
+
/** Tiles computed — se regenera cuando cambia seed/cols/rows/palette/density. */
|
|
47
|
+
private readonly tiles;
|
|
48
|
+
/** SVG completo como string sanitized para `[innerHTML]`. */
|
|
49
|
+
readonly svgHtml: import("@angular/core").Signal<SafeHtml>;
|
|
50
|
+
constructor();
|
|
51
|
+
ngOnDestroy(): void;
|
|
52
|
+
private resolvePalette;
|
|
53
|
+
private randomSeed;
|
|
54
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PatternComponent, never>;
|
|
55
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PatternComponent, "val-pattern", never, { "props": { "alias": "props"; "required": false; }; }, {}, never, never, true, never>;
|
|
56
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PatternPaletteKey } from './motifs';
|
|
2
|
+
/**
|
|
3
|
+
* Configuración del componente `val-pattern`.
|
|
4
|
+
*
|
|
5
|
+
* @example Static (seed fijo, reproducible):
|
|
6
|
+
* ```html
|
|
7
|
+
* <val-pattern [props]="{ palette: 'purple', cols: 12, rows: 4, seed: 42 }" />
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @example Animated (reshuffle cada 8s):
|
|
11
|
+
* ```html
|
|
12
|
+
* <val-pattern [props]="{ palette: 'ink', cols: 16, rows: 8, animated: true }" />
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export interface PatternMetadata {
|
|
16
|
+
/**
|
|
17
|
+
* Palette built-in (`'purple' | 'ink' | 'lavender'`) o array custom de 8
|
|
18
|
+
* colores dark → light. Default: `'purple'`.
|
|
19
|
+
*/
|
|
20
|
+
palette?: PatternPaletteKey | string[];
|
|
21
|
+
/** Columnas del grid. Default: 12. */
|
|
22
|
+
cols?: number;
|
|
23
|
+
/** Filas del grid. Default: 4. */
|
|
24
|
+
rows?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Seed para Mulberry32 — determina el patrón. Si no se pasa, genera uno random
|
|
27
|
+
* al mount y queda fijo (a menos que `animated: true`).
|
|
28
|
+
*/
|
|
29
|
+
seed?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Densidad de chevrons (0..1). El resto se reparte entre solid/shape/tri.
|
|
32
|
+
* Default: `0.55`.
|
|
33
|
+
*/
|
|
34
|
+
chevronDensity?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Si `true`, el patrón se reshuffles automáticamente con fade entre seeds.
|
|
37
|
+
* Default: `false`.
|
|
38
|
+
*/
|
|
39
|
+
animated?: boolean;
|
|
40
|
+
/** Intervalo en ms entre reshuffles (solo si `animated: true`). Default: `8000`. */
|
|
41
|
+
reshuffleInterval?: number;
|
|
42
|
+
/**
|
|
43
|
+
* `slice` (default) — el patrón cubre todo el contenedor manteniendo aspect,
|
|
44
|
+
* cropeando si necesario. `meet` — fit completo sin crop, deja espacio.
|
|
45
|
+
*/
|
|
46
|
+
preserveAspect?: 'slice' | 'meet';
|
|
47
|
+
}
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -41,6 +41,9 @@ export * from './lib/components/atoms/horizontal-scroll/horizontal-scroll.compon
|
|
|
41
41
|
export * from './lib/components/atoms/horizontal-scroll/types';
|
|
42
42
|
export * from './lib/components/atoms/rights-footer/rights-footer.component';
|
|
43
43
|
export * from './lib/components/atoms/rights-footer/types';
|
|
44
|
+
export * from './lib/components/atoms/pattern/pattern.component';
|
|
45
|
+
export * from './lib/components/atoms/pattern/types';
|
|
46
|
+
export * from './lib/components/atoms/pattern/motifs';
|
|
44
47
|
export * from './lib/components/molecules/alert-box/alert-box.component';
|
|
45
48
|
export * from './lib/components/molecules/alert-box/types';
|
|
46
49
|
export * from './lib/components/molecules/button-group/button-group.component';
|