@micazoyolli/foundation 0.1.2

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/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # @micazoyolli/foundation
2
+
3
+ Paquete público de fundamentos compartidos no visuales para los proyectos de Micazoyolli. Centraliza utilidades pequeñas y estables para mantener consistencia entre repos independientes sin introducir componentes visuales ni decisiones de marca.
4
+
5
+ ## Características
6
+
7
+ - Tokens SCSS base para spacing, radius, z-index y motion
8
+ - Breakpoints y mixins responsive reutilizables
9
+ - Helper `cx` para composición segura de clases
10
+ - Guards TypeScript pequeños para validaciones comunes
11
+ - Utilidades básicas de accesibilidad y protección selectiva de media
12
+ - Exports separados para TypeScript y SCSS
13
+ - Consumo desde npm sin credenciales especiales
14
+
15
+ ## Tecnologías
16
+
17
+ - TypeScript
18
+ - SCSS
19
+ - Yarn 1
20
+ - npm
21
+
22
+ ## Estructura
23
+
24
+ ```txt
25
+ src/
26
+ ├── a11y/
27
+ ├── scss/
28
+ │ ├── mixins/
29
+ │ └── tokens/
30
+ ├── utils/
31
+ └── index.ts
32
+
33
+ examples/
34
+ dist/
35
+ ```
36
+
37
+ ## Scripts
38
+
39
+ ```bash
40
+ yarn install
41
+ yarn build
42
+ yarn clean
43
+ yarn prepack
44
+ ```
45
+
46
+ ## Instalación
47
+
48
+ ```bash
49
+ yarn add @micazoyolli/foundation
50
+ ```
51
+
52
+ ## Uso
53
+
54
+ TypeScript:
55
+
56
+ ```ts
57
+ import { cx, isElement } from '@micazoyolli/foundation';
58
+
59
+ const className = cx('button', isActive && 'button--active');
60
+
61
+ if (isElement(event.target)) {
62
+ event.target.closest('[data-protected-media]');
63
+ }
64
+ ```
65
+
66
+ SCSS:
67
+
68
+ ```scss
69
+ @use '@micazoyolli/foundation/scss' as foundation;
70
+
71
+ .section {
72
+ padding: foundation.$space-6;
73
+ border-radius: foundation.$radius-md;
74
+
75
+ @include foundation.down(foundation.$breakpoint-md) {
76
+ padding: foundation.$space-4;
77
+ }
78
+ }
79
+ ```
80
+
81
+ ## Buenas prácticas
82
+
83
+ - Mantener el paquete pequeño y estrictamente no visual
84
+ - Evitar tokens de marca, layouts, componentes React, SEO o tipografías finales
85
+ - Publicar cambios mediante versiones semánticas
86
+ - Exportar solo utilidades compartibles entre repos independientes
87
+ - Evitar dependencias UI pesadas
88
+ - Adoptar el paquete gradualmente en cada proyecto
89
+
90
+ ## Autora
91
+
92
+ Una creación de [`<micazoyolli />✨`](https://nadia.dev)
@@ -0,0 +1,3 @@
1
+ export { isElement, isHTMLElement } from './targets';
2
+ export { KEYBOARD_KEYS, isKeyboardActivation } from './keyboard';
3
+ export { PROTECTED_MEDIA_SELECTOR, isProtectedMediaTarget, } from './protectedMedia';
@@ -0,0 +1,3 @@
1
+ export { isElement, isHTMLElement } from './targets';
2
+ export { KEYBOARD_KEYS, isKeyboardActivation } from './keyboard';
3
+ export { PROTECTED_MEDIA_SELECTOR, isProtectedMediaTarget, } from './protectedMedia';
@@ -0,0 +1,6 @@
1
+ export declare const KEYBOARD_KEYS: {
2
+ readonly enter: "Enter";
3
+ readonly space: " ";
4
+ readonly escape: "Escape";
5
+ };
6
+ export declare const isKeyboardActivation: (event: Pick<KeyboardEvent, "key">) => boolean;
@@ -0,0 +1,6 @@
1
+ export const KEYBOARD_KEYS = {
2
+ enter: 'Enter',
3
+ space: ' ',
4
+ escape: 'Escape',
5
+ };
6
+ export const isKeyboardActivation = (event) => event.key === KEYBOARD_KEYS.enter || event.key === KEYBOARD_KEYS.space;
@@ -0,0 +1,2 @@
1
+ export declare const PROTECTED_MEDIA_SELECTOR: string;
2
+ export declare const isProtectedMediaTarget: (target: EventTarget | null) => boolean;
@@ -0,0 +1,9 @@
1
+ import { isElement } from './targets';
2
+ export const PROTECTED_MEDIA_SELECTOR = [
3
+ 'img',
4
+ 'svg',
5
+ 'canvas',
6
+ 'video',
7
+ '[data-protected-media]',
8
+ ].join(',');
9
+ export const isProtectedMediaTarget = (target) => isElement(target) && Boolean(target.closest(PROTECTED_MEDIA_SELECTOR));
@@ -0,0 +1,2 @@
1
+ export declare const isElement: (target: EventTarget | null) => target is Element;
2
+ export declare const isHTMLElement: (target: EventTarget | null) => target is HTMLElement;
@@ -0,0 +1,2 @@
1
+ export const isElement = (target) => target instanceof Element;
2
+ export const isHTMLElement = (target) => target instanceof HTMLElement;
@@ -0,0 +1,4 @@
1
+ export { KEYBOARD_KEYS, PROTECTED_MEDIA_SELECTOR, isElement, isHTMLElement, isKeyboardActivation, isProtectedMediaTarget, } from './a11y';
2
+ export { cx } from './utils/cx';
3
+ export type { ClassValue } from './utils/cx';
4
+ export { isNonEmptyString } from './utils/guards';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { KEYBOARD_KEYS, PROTECTED_MEDIA_SELECTOR, isElement, isHTMLElement, isKeyboardActivation, isProtectedMediaTarget, } from './a11y';
2
+ export { cx } from './utils/cx';
3
+ export { isNonEmptyString } from './utils/guards';
@@ -0,0 +1,6 @@
1
+ @forward 'mixins/responsive';
2
+ @forward 'tokens/breakpoints';
3
+ @forward 'tokens/motion';
4
+ @forward 'tokens/radius';
5
+ @forward 'tokens/spacing';
6
+ @forward 'tokens/z-index';
@@ -0,0 +1,17 @@
1
+ @mixin down($breakpoint) {
2
+ @media (max-width: $breakpoint) {
3
+ @content;
4
+ }
5
+ }
6
+
7
+ @mixin up($breakpoint) {
8
+ @media (min-width: $breakpoint) {
9
+ @content;
10
+ }
11
+ }
12
+
13
+ @mixin between($min-breakpoint, $max-breakpoint) {
14
+ @media (min-width: $min-breakpoint) and (max-width: $max-breakpoint) {
15
+ @content;
16
+ }
17
+ }
@@ -0,0 +1,5 @@
1
+ $breakpoint-xs: 320px;
2
+ $breakpoint-sm: 425px;
3
+ $breakpoint-md: 768px;
4
+ $breakpoint-lg: 1024px;
5
+ $breakpoint-xl: 1280px;
@@ -0,0 +1,14 @@
1
+ $duration-instant: 75ms;
2
+ $duration-fast: 150ms;
3
+ $duration-base: 250ms;
4
+ $duration-slow: 400ms;
5
+
6
+ $ease-standard: cubic-bezier(0.2, 0, 0, 1);
7
+ $ease-enter: cubic-bezier(0, 0, 0.2, 1);
8
+ $ease-exit: cubic-bezier(0.4, 0, 1, 1);
9
+
10
+ @mixin reduced-motion {
11
+ @media (prefers-reduced-motion: reduce) {
12
+ @content;
13
+ }
14
+ }
@@ -0,0 +1,7 @@
1
+ $radius-none: 0;
2
+ $radius-xs: 4px;
3
+ $radius-sm: 6px;
4
+ $radius-md: 8px;
5
+ $radius-lg: 12px;
6
+ $radius-xl: 16px;
7
+ $radius-pill: 999px;
@@ -0,0 +1,11 @@
1
+ $space-0: 0;
2
+ $space-1: 0.25rem;
3
+ $space-2: 0.5rem;
4
+ $space-3: 0.75rem;
5
+ $space-4: 1rem;
6
+ $space-5: 1.5rem;
7
+ $space-6: 2rem;
8
+ $space-7: 3rem;
9
+ $space-8: 4rem;
10
+ $space-9: 6rem;
11
+ $space-10: 8rem;
@@ -0,0 +1,7 @@
1
+ $z-base: 0;
2
+ $z-raised: 1;
3
+ $z-sticky: 10;
4
+ $z-header: 100;
5
+ $z-overlay: 1000;
6
+ $z-modal: 1100;
7
+ $z-toast: 1200;
@@ -0,0 +1,2 @@
1
+ export type ClassValue = string | false | null | undefined;
2
+ export declare const cx: (...classes: ClassValue[]) => string;
@@ -0,0 +1 @@
1
+ export const cx = (...classes) => classes.filter(Boolean).join(' ');
@@ -0,0 +1 @@
1
+ export declare const isNonEmptyString: (value: unknown) => value is string;
@@ -0,0 +1 @@
1
+ export const isNonEmptyString = (value) => typeof value === 'string' && value.trim().length > 0;
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@micazoyolli/foundation",
3
+ "version": "0.1.2",
4
+ "description": "Fundamentos compartidos no visuales para los proyectos de Micazoyolli.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./scss": {
15
+ "sass": "./dist/scss/index.scss"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "scripts": {
25
+ "build": "tsc -p tsconfig.json && yarn copy-scss",
26
+ "clean": "rm -rf dist",
27
+ "copy-scss": "rsync -av --include='*/' --include='*.scss' --exclude='*' src/scss/ dist/scss/",
28
+ "prepack": "yarn build"
29
+ },
30
+ "devDependencies": {
31
+ "typescript": "6.0.3"
32
+ },
33
+ "packageManager": "yarn@1.22.22"
34
+ }