valtech-components 2.0.877 → 2.0.879
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 +127 -33
- package/esm2022/lib/components/atoms/pattern/pattern.component.mjs +11 -8
- package/esm2022/lib/components/atoms/pattern/types.mjs +1 -1
- package/esm2022/lib/version.mjs +2 -2
- package/fesm2022/valtech-components.mjs +137 -40
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/atoms/pattern/motifs.d.ts +47 -19
- package/lib/components/atoms/pattern/pattern.component.d.ts +1 -3
- package/lib/components/atoms/pattern/types.d.ts +33 -14
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,39 +6,69 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Original spec: `assets/Valtech Pattern System.html` (single-page demo).
|
|
8
8
|
* Cada motif es función `(fill: string) => string` que devuelve SVG inner
|
|
9
|
-
* markup. Tile es
|
|
9
|
+
* markup. Tile es 100x100 unidades; el motif se renderiza dentro de un `<g
|
|
10
10
|
* transform="translate(col*100 row*100)">` con un `<rect width=100 height=100
|
|
11
11
|
* fill=bg/>` de fondo.
|
|
12
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';
|
|
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' | 'circle' | 'circle-sm' | 'dot' | 'cross' | 'x-mark' | 'slash-r' | 'slash-l' | 'corner-tl' | 'corner-tr' | 'corner-bl' | 'corner-br' | 'underscore' | 'num-0' | 'num-1' | 'num-2' | 'num-3' | 'num-4' | 'num-5' | 'num-6' | 'num-7' | 'num-8' | 'num-9';
|
|
14
14
|
export declare const PATTERN_MOTIFS: Record<PatternMotifKey, (fg: string) => string>;
|
|
15
15
|
export declare const MOTIF_KEYS: PatternMotifKey[];
|
|
16
|
-
/** Chevron family —
|
|
16
|
+
/** Chevron family — orientaciones + variantes pequeñas. */
|
|
17
17
|
export declare const CHEV_KEYS: PatternMotifKey[];
|
|
18
|
+
/** Stroke family — líneas, cruces y el guión bajo del logo `>_`. */
|
|
19
|
+
export declare const STROKE_KEYS: PatternMotifKey[];
|
|
20
|
+
/** Numeric family — dígitos 0-9 en monospace bold. */
|
|
21
|
+
export declare const NUM_KEYS: PatternMotifKey[];
|
|
22
|
+
/** Circle / dot family — formas curvas centradas. */
|
|
23
|
+
export declare const CIRCLE_KEYS: PatternMotifKey[];
|
|
24
|
+
/** Diamond solo — forma geométrica angular centrada. */
|
|
25
|
+
export declare const SHAPE_KEYS: PatternMotifKey[];
|
|
18
26
|
/** Triangle / half-fill family. */
|
|
19
27
|
export declare const TRI_KEYS: PatternMotifKey[];
|
|
20
|
-
/**
|
|
21
|
-
export declare const
|
|
22
|
-
/** No-foreground tiles — solo
|
|
28
|
+
/** Corner arc family — mezcla suave con triangles. */
|
|
29
|
+
export declare const CORNER_KEYS: PatternMotifKey[];
|
|
30
|
+
/** No-foreground tiles — solo rect de fondo. */
|
|
23
31
|
export declare const SOLID_KEYS: PatternMotifKey[];
|
|
24
|
-
/** Built-in palettes — dark → light
|
|
25
|
-
export type PatternPaletteKey = 'purple' | 'ink' | 'lavender';
|
|
32
|
+
/** Built-in palettes — 8 colores dark → light. */
|
|
33
|
+
export type PatternPaletteKey = 'purple' | 'ink' | 'lavender' | 'midnight' | 'ember' | 'forest' | 'rose' | 'gold' | 'mono';
|
|
26
34
|
export declare const PATTERN_PALETTES: Record<PatternPaletteKey, string[]>;
|
|
27
35
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
36
|
+
* Preset de composición del patrón. Controla qué familias predominan.
|
|
37
|
+
*
|
|
38
|
+
* - `branded` → Chevrons dominantes (identidad Valtech `>_`). Default.
|
|
39
|
+
* - `geometric` → Triángulos, esquinas y círculos. Más arquitectónico.
|
|
40
|
+
* - `minimal` → Espacios sólidos con trazos sutiles. Limpio, corporativo.
|
|
41
|
+
* - `dense` → Mezcla rica de todas las familias. Máxima textura.
|
|
42
|
+
* - `code` → Números, underscore y chevrons. Look de terminal.
|
|
30
43
|
*/
|
|
31
|
-
export
|
|
44
|
+
export type PatternStyleKey = 'branded' | 'geometric' | 'minimal' | 'dense' | 'code';
|
|
45
|
+
export interface PatternDensityConfig {
|
|
46
|
+
/** Probabilidad de chevron family. */
|
|
47
|
+
chev: number;
|
|
48
|
+
/** Probabilidad de stroke family (cross, x, slash, underscore). */
|
|
49
|
+
stroke: number;
|
|
50
|
+
/** Probabilidad de círculos. */
|
|
51
|
+
circle: number;
|
|
52
|
+
/** Probabilidad de diamond. */
|
|
53
|
+
shape: number;
|
|
54
|
+
/** Probabilidad de solid (espacio vacío). */
|
|
55
|
+
solid: number;
|
|
56
|
+
/** Probabilidad de numeric family (0-9). Default: 0. */
|
|
57
|
+
num?: number;
|
|
58
|
+
}
|
|
59
|
+
export declare const PATTERN_STYLE_CONFIGS: Record<PatternStyleKey, PatternDensityConfig>;
|
|
32
60
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
61
|
+
* Mulberry32 seeded RNG — devuelve función `()=>[0,1)`.
|
|
62
|
+
* Deterministic: mismo seed → misma secuencia.
|
|
35
63
|
*/
|
|
64
|
+
export declare function mulberry32(seed: number): () => number;
|
|
36
65
|
export interface PatternGenConfig {
|
|
37
66
|
cols: number;
|
|
38
67
|
rows: number;
|
|
39
68
|
seed: number;
|
|
40
69
|
palette: string[];
|
|
41
70
|
chevronDensity?: number;
|
|
71
|
+
style?: PatternStyleKey;
|
|
42
72
|
}
|
|
43
73
|
export interface PatternTile {
|
|
44
74
|
motif: PatternMotifKey;
|
|
@@ -46,15 +76,13 @@ export interface PatternTile {
|
|
|
46
76
|
fg: string;
|
|
47
77
|
}
|
|
48
78
|
/**
|
|
49
|
-
* Genera UN tile
|
|
50
|
-
*
|
|
51
|
-
* tiles en `val-pattern` sin regenerar la grid completa.
|
|
79
|
+
* Genera UN tile respetando densidades de familia + contraste de palette.
|
|
80
|
+
* Acepta un config opcional de densidades (de PatternStyleKey o chevronDensity legacy).
|
|
52
81
|
*/
|
|
53
|
-
export declare function generateRandomTile(palette: string[], chevronDensity?: number, rng?: () => number): PatternTile;
|
|
54
|
-
/** Genera matriz de tiles
|
|
82
|
+
export declare function generateRandomTile(palette: string[], chevronDensity?: number, rng?: () => number, densityConfig?: PatternDensityConfig): PatternTile;
|
|
83
|
+
/** Genera matriz completa de tiles. */
|
|
55
84
|
export declare function generatePatternTiles(cfg: PatternGenConfig): PatternTile[];
|
|
56
85
|
/**
|
|
57
86
|
* Renderiza el inner SVG (sin el `<svg>` root) para una matriz de tiles.
|
|
58
|
-
* Caller wraps en `<svg viewBox="0 0 {cols*100} {rows*100}" preserveAspectRatio="xMidYMid slice">`.
|
|
59
87
|
*/
|
|
60
88
|
export declare function renderPatternSvgInner(tiles: PatternTile[], cols: number, baseColor: string): string;
|
|
@@ -37,14 +37,12 @@ export declare class PatternComponent implements OnDestroy {
|
|
|
37
37
|
private readonly seed;
|
|
38
38
|
private readonly paletteRef;
|
|
39
39
|
private readonly chevronDensity;
|
|
40
|
+
private readonly patternStyle;
|
|
40
41
|
private readonly preserveAspect;
|
|
41
42
|
private readonly animated;
|
|
42
|
-
/** ms entre reshuffles (modo animated). Default 8000ms — "de vez en cuando". */
|
|
43
43
|
private readonly reshuffleInterval;
|
|
44
|
-
/** Tiles a cambiar por tick. 0 → reseed grid completo (default). >0 → staggered. */
|
|
45
44
|
private readonly tilesPerTick;
|
|
46
45
|
private timer?;
|
|
47
|
-
/** Object-first input. Cambios disparan re-render por signals. */
|
|
48
46
|
set props(value: PatternMetadata | undefined);
|
|
49
47
|
/**
|
|
50
48
|
* Tiles signal — mutable. Se regenera completa cuando cambia seed/cols/rows/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PatternPaletteKey } from './motifs';
|
|
1
|
+
import { PatternPaletteKey, PatternStyleKey } from './motifs';
|
|
2
2
|
/**
|
|
3
3
|
* Configuración del componente `val-pattern`.
|
|
4
4
|
*
|
|
@@ -7,22 +7,39 @@ import { PatternPaletteKey } from './motifs';
|
|
|
7
7
|
* <val-pattern [props]="{ palette: 'purple', cols: 12, rows: 4, seed: 42 }" />
|
|
8
8
|
* ```
|
|
9
9
|
*
|
|
10
|
-
* @example Animated whole-grid reshuffle (cada
|
|
10
|
+
* @example Animated whole-grid reshuffle (cada 10s):
|
|
11
11
|
* ```html
|
|
12
|
-
* <val-pattern [props]="{ palette: '
|
|
12
|
+
* <val-pattern [props]="{ palette: 'midnight', cols: 14, rows: 5, animated: true, reshuffleInterval: 10000 }" />
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
15
|
* @example Animated staggered (2 tiles cada 800ms — sutil):
|
|
16
16
|
* ```html
|
|
17
17
|
* <val-pattern [props]="{ animated: true, reshuffleInterval: 800, tilesPerTick: 2 }" />
|
|
18
18
|
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example Preset geométrico con paleta ember:
|
|
21
|
+
* ```html
|
|
22
|
+
* <val-pattern [props]="{ palette: 'ember', style: 'geometric', cols: 10, rows: 4 }" />
|
|
23
|
+
* ```
|
|
19
24
|
*/
|
|
20
25
|
export interface PatternMetadata {
|
|
21
26
|
/**
|
|
22
|
-
* Palette built-in
|
|
23
|
-
*
|
|
27
|
+
* Palette built-in o array custom de 8 colores dark → light.
|
|
28
|
+
* Built-ins: `'purple' | 'ink' | 'lavender' | 'midnight' | 'ember' | 'forest' | 'rose' | 'gold' | 'mono'`.
|
|
29
|
+
* Default: `'purple'`.
|
|
24
30
|
*/
|
|
25
31
|
palette?: PatternPaletteKey | string[];
|
|
32
|
+
/**
|
|
33
|
+
* Preset de composición de familias de motifs.
|
|
34
|
+
* - `branded` → Chevrons dominantes (identidad Valtech). Default.
|
|
35
|
+
* - `geometric` → Triángulos, esquinas redondeadas y círculos.
|
|
36
|
+
* - `minimal` → Mayoría sólido con trazos sutiles. Look corporativo limpio.
|
|
37
|
+
* - `dense` → Mezcla rica de todas las familias. Máxima textura.
|
|
38
|
+
* - `code` → Números, underscore `_` y chevrons. Look de terminal/código.
|
|
39
|
+
*
|
|
40
|
+
* Cuando se usa `style`, sobreescribe `chevronDensity`.
|
|
41
|
+
*/
|
|
42
|
+
style?: PatternStyleKey;
|
|
26
43
|
/** Columnas del grid. Default: 12. */
|
|
27
44
|
cols?: number;
|
|
28
45
|
/** Filas del grid. Default: 4. */
|
|
@@ -33,29 +50,31 @@ export interface PatternMetadata {
|
|
|
33
50
|
*/
|
|
34
51
|
seed?: number;
|
|
35
52
|
/**
|
|
36
|
-
* Densidad de chevrons (0..1).
|
|
53
|
+
* Densidad de chevrons (0..1). Ignorado si se pasa `style`.
|
|
37
54
|
* Default: `0.55`.
|
|
38
55
|
*/
|
|
39
56
|
chevronDensity?: number;
|
|
40
57
|
/**
|
|
41
|
-
* Si `true`, el patrón
|
|
42
|
-
*
|
|
58
|
+
* Si `true`, el patrón anima tiles periódicamente.
|
|
59
|
+
* Con `tilesPerTick: 0` (default): reseed completo de la grid.
|
|
60
|
+
* Con `tilesPerTick > 0`: reshuffle parcial (staggered — más sutil).
|
|
43
61
|
* Default: `false`.
|
|
44
62
|
*/
|
|
45
63
|
animated?: boolean;
|
|
46
64
|
/**
|
|
47
|
-
* ms entre updates
|
|
48
|
-
* Default: `
|
|
65
|
+
* ms entre updates (modo animated).
|
|
66
|
+
* Default: `8000`.
|
|
49
67
|
*/
|
|
50
68
|
reshuffleInterval?: number;
|
|
51
69
|
/**
|
|
52
|
-
* Cuántos tiles cambiar por tick (modo animated).
|
|
53
|
-
*
|
|
70
|
+
* Cuántos tiles cambiar por tick (modo animated).
|
|
71
|
+
* `0` → reseed grid completa. `1-N` → staggered sutil.
|
|
72
|
+
* Default: `0`.
|
|
54
73
|
*/
|
|
55
74
|
tilesPerTick?: number;
|
|
56
75
|
/**
|
|
57
|
-
* `slice` (default) —
|
|
58
|
-
*
|
|
76
|
+
* `slice` (default) — cubre todo el contenedor con crop si necesario.
|
|
77
|
+
* `meet` — fit completo sin crop.
|
|
59
78
|
*/
|
|
60
79
|
preserveAspect?: 'slice' | 'meet';
|
|
61
80
|
}
|
package/lib/version.d.ts
CHANGED