@sc4rfurryx/proteusjs 1.0.0 → 1.1.0
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/LICENSE +1 -1
- package/README.md +331 -77
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapters/react.d.ts +139 -0
- package/dist/adapters/react.esm.js +848 -0
- package/dist/adapters/react.esm.js.map +1 -0
- package/dist/adapters/svelte.d.ts +181 -0
- package/dist/adapters/svelte.esm.js +908 -0
- package/dist/adapters/svelte.esm.js.map +1 -0
- package/dist/adapters/vue.d.ts +205 -0
- package/dist/adapters/vue.esm.js +872 -0
- package/dist/adapters/vue.esm.js.map +1 -0
- package/dist/modules/a11y-audit.d.ts +39 -0
- package/dist/modules/a11y-audit.esm.js +509 -0
- package/dist/modules/a11y-audit.esm.js.map +1 -0
- package/dist/modules/a11y-primitives.d.ts +69 -0
- package/dist/modules/a11y-primitives.esm.js +445 -0
- package/dist/modules/a11y-primitives.esm.js.map +1 -0
- package/dist/modules/anchor.d.ts +29 -0
- package/dist/modules/anchor.esm.js +218 -0
- package/dist/modules/anchor.esm.js.map +1 -0
- package/dist/modules/container.d.ts +60 -0
- package/dist/modules/container.esm.js +194 -0
- package/dist/modules/container.esm.js.map +1 -0
- package/dist/modules/perf.d.ts +82 -0
- package/dist/modules/perf.esm.js +257 -0
- package/dist/modules/perf.esm.js.map +1 -0
- package/dist/modules/popover.d.ts +33 -0
- package/dist/modules/popover.esm.js +191 -0
- package/dist/modules/popover.esm.js.map +1 -0
- package/dist/modules/scroll.d.ts +43 -0
- package/dist/modules/scroll.esm.js +195 -0
- package/dist/modules/scroll.esm.js.map +1 -0
- package/dist/modules/transitions.d.ts +35 -0
- package/dist/modules/transitions.esm.js +120 -0
- package/dist/modules/transitions.esm.js.map +1 -0
- package/dist/modules/typography.d.ts +72 -0
- package/dist/modules/typography.esm.js +168 -0
- package/dist/modules/typography.esm.js.map +1 -0
- package/dist/proteus.cjs.js +2332 -12
- package/dist/proteus.cjs.js.map +1 -1
- package/dist/proteus.d.ts +561 -12
- package/dist/proteus.esm.js +2323 -12
- package/dist/proteus.esm.js.map +1 -1
- package/dist/proteus.esm.min.js +3 -3
- package/dist/proteus.esm.min.js.map +1 -1
- package/dist/proteus.js +2332 -12
- package/dist/proteus.js.map +1 -1
- package/dist/proteus.min.js +3 -3
- package/dist/proteus.min.js.map +1 -1
- package/package.json +61 -4
- package/src/adapters/react.ts +264 -0
- package/src/adapters/svelte.ts +321 -0
- package/src/adapters/vue.ts +268 -0
- package/src/index.ts +33 -6
- package/src/modules/a11y-audit/index.ts +608 -0
- package/src/modules/a11y-primitives/index.ts +554 -0
- package/src/modules/anchor/index.ts +257 -0
- package/src/modules/container/index.ts +230 -0
- package/src/modules/perf/index.ts +291 -0
- package/src/modules/popover/index.ts +238 -0
- package/src/modules/scroll/index.ts +251 -0
- package/src/modules/transitions/index.ts +145 -0
- package/src/modules/typography/index.ts +239 -0
- package/src/utils/version.ts +1 -1
@@ -0,0 +1,195 @@
|
|
1
|
+
/*!
|
2
|
+
* ProteusJS v1.1.0
|
3
|
+
* Shape-shifting responsive design that adapts like the sea god himself
|
4
|
+
* (c) 2025 sc4rfurry
|
5
|
+
* Released under the MIT License
|
6
|
+
*/
|
7
|
+
/**
|
8
|
+
* @sc4rfurryx/proteusjs/scroll
|
9
|
+
* Scroll-driven animations with CSS Scroll-Linked Animations
|
10
|
+
*
|
11
|
+
* @version 1.1.0
|
12
|
+
* @author sc4rfurry
|
13
|
+
* @license MIT
|
14
|
+
*/
|
15
|
+
/**
|
16
|
+
* Zero-boilerplate setup for CSS Scroll-Linked Animations with fallbacks
|
17
|
+
*/
|
18
|
+
function scrollAnimate(target, opts) {
|
19
|
+
const targetEl = typeof target === 'string' ? document.querySelector(target) : target;
|
20
|
+
if (!targetEl) {
|
21
|
+
throw new Error('Target element not found');
|
22
|
+
}
|
23
|
+
const { keyframes, range = ['0%', '100%'], timeline = {}, fallback = 'io' } = opts;
|
24
|
+
const { axis = 'block', start = '0%', end = '100%' } = timeline;
|
25
|
+
// Check for CSS Scroll-Linked Animations support
|
26
|
+
const hasScrollTimeline = 'CSS' in window && CSS.supports('animation-timeline', 'scroll()');
|
27
|
+
// Check for reduced motion preference
|
28
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
29
|
+
if (prefersReducedMotion) {
|
30
|
+
// Respect user preference - either disable or reduce animation
|
31
|
+
if (fallback === false)
|
32
|
+
return;
|
33
|
+
// Apply only the end state for reduced motion
|
34
|
+
const endKeyframe = keyframes[keyframes.length - 1];
|
35
|
+
Object.assign(targetEl.style, endKeyframe);
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
if (hasScrollTimeline) {
|
39
|
+
// Use native CSS Scroll-Linked Animations
|
40
|
+
const timelineName = `scroll-timeline-${Math.random().toString(36).substr(2, 9)}`;
|
41
|
+
// Create scroll timeline
|
42
|
+
const style = document.createElement('style');
|
43
|
+
style.textContent = `
|
44
|
+
@scroll-timeline ${timelineName} {
|
45
|
+
source: nearest;
|
46
|
+
orientation: ${axis};
|
47
|
+
scroll-offsets: ${start}, ${end};
|
48
|
+
}
|
49
|
+
|
50
|
+
.scroll-animate-${timelineName} {
|
51
|
+
animation-timeline: ${timelineName};
|
52
|
+
animation-duration: 1ms; /* Required but ignored */
|
53
|
+
animation-fill-mode: both;
|
54
|
+
}
|
55
|
+
`;
|
56
|
+
document.head.appendChild(style);
|
57
|
+
// Apply animation class
|
58
|
+
targetEl.classList.add(`scroll-animate-${timelineName}`);
|
59
|
+
// Create Web Animations API animation
|
60
|
+
const animation = targetEl.animate(keyframes, {
|
61
|
+
duration: 1, // Required but ignored with scroll timeline
|
62
|
+
fill: 'both'
|
63
|
+
});
|
64
|
+
// Set scroll timeline (when supported)
|
65
|
+
if ('timeline' in animation) {
|
66
|
+
animation.timeline = new window.ScrollTimeline({
|
67
|
+
source: document.scrollingElement,
|
68
|
+
orientation: axis,
|
69
|
+
scrollOffsets: [
|
70
|
+
{ target: targetEl, edge: 'start', threshold: parseFloat(start) / 100 },
|
71
|
+
{ target: targetEl, edge: 'end', threshold: parseFloat(end) / 100 }
|
72
|
+
]
|
73
|
+
});
|
74
|
+
}
|
75
|
+
}
|
76
|
+
else if (fallback === 'io') {
|
77
|
+
// Fallback using Intersection Observer
|
78
|
+
let animation = null;
|
79
|
+
const observer = new IntersectionObserver((entries) => {
|
80
|
+
entries.forEach(entry => {
|
81
|
+
const progress = Math.max(0, Math.min(1, entry.intersectionRatio));
|
82
|
+
if (!animation) {
|
83
|
+
animation = targetEl.animate(keyframes, {
|
84
|
+
duration: 1000,
|
85
|
+
fill: 'both'
|
86
|
+
});
|
87
|
+
animation.pause();
|
88
|
+
}
|
89
|
+
// Update animation progress based on intersection
|
90
|
+
animation.currentTime = progress * 1000;
|
91
|
+
});
|
92
|
+
}, {
|
93
|
+
threshold: Array.from({ length: 101 }, (_, i) => i / 100) // 0 to 1 in 0.01 steps
|
94
|
+
});
|
95
|
+
observer.observe(targetEl);
|
96
|
+
// Store cleanup function
|
97
|
+
targetEl._scrollAnimateCleanup = () => {
|
98
|
+
observer.disconnect();
|
99
|
+
if (animation) {
|
100
|
+
animation.cancel();
|
101
|
+
}
|
102
|
+
};
|
103
|
+
}
|
104
|
+
}
|
105
|
+
/**
|
106
|
+
* Create a scroll-triggered animation that plays once when element enters viewport
|
107
|
+
*/
|
108
|
+
function scrollTrigger(target, keyframes, options = {}) {
|
109
|
+
const targetEl = typeof target === 'string' ? document.querySelector(target) : target;
|
110
|
+
if (!targetEl) {
|
111
|
+
throw new Error('Target element not found');
|
112
|
+
}
|
113
|
+
// Check for reduced motion preference
|
114
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
115
|
+
if (prefersReducedMotion) {
|
116
|
+
// Apply end state immediately
|
117
|
+
const endKeyframe = keyframes[keyframes.length - 1];
|
118
|
+
Object.assign(targetEl.style, endKeyframe);
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
const observer = new IntersectionObserver((entries) => {
|
122
|
+
entries.forEach(entry => {
|
123
|
+
if (entry.isIntersecting) {
|
124
|
+
// Play animation
|
125
|
+
targetEl.animate(keyframes, {
|
126
|
+
duration: 600,
|
127
|
+
easing: 'ease-out',
|
128
|
+
fill: 'forwards',
|
129
|
+
...options
|
130
|
+
});
|
131
|
+
// Disconnect observer after first trigger
|
132
|
+
observer.disconnect();
|
133
|
+
}
|
134
|
+
});
|
135
|
+
}, {
|
136
|
+
threshold: 0.1,
|
137
|
+
rootMargin: '0px 0px -10% 0px'
|
138
|
+
});
|
139
|
+
observer.observe(targetEl);
|
140
|
+
}
|
141
|
+
/**
|
142
|
+
* Parallax effect using scroll-driven animations
|
143
|
+
*/
|
144
|
+
function parallax(target, speed = 0.5) {
|
145
|
+
const targetEl = typeof target === 'string' ? document.querySelector(target) : target;
|
146
|
+
if (!targetEl) {
|
147
|
+
throw new Error('Target element not found');
|
148
|
+
}
|
149
|
+
// Check for reduced motion preference
|
150
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
151
|
+
if (prefersReducedMotion)
|
152
|
+
return;
|
153
|
+
const keyframes = [
|
154
|
+
{ transform: `translateY(${ -100 * speed}px)` },
|
155
|
+
{ transform: `translateY(${100 * speed}px)` }
|
156
|
+
];
|
157
|
+
scrollAnimate(targetEl, {
|
158
|
+
keyframes,
|
159
|
+
range: ['0%', '100%'],
|
160
|
+
timeline: { axis: 'block' },
|
161
|
+
fallback: 'io'
|
162
|
+
});
|
163
|
+
}
|
164
|
+
/**
|
165
|
+
* Cleanup function to remove scroll animations
|
166
|
+
*/
|
167
|
+
function cleanup(target) {
|
168
|
+
const targetEl = typeof target === 'string' ? document.querySelector(target) : target;
|
169
|
+
if (!targetEl)
|
170
|
+
return;
|
171
|
+
// Call stored cleanup function if it exists
|
172
|
+
if (targetEl._scrollAnimateCleanup) {
|
173
|
+
targetEl._scrollAnimateCleanup();
|
174
|
+
delete targetEl._scrollAnimateCleanup;
|
175
|
+
}
|
176
|
+
// Remove animation classes
|
177
|
+
targetEl.classList.forEach(className => {
|
178
|
+
if (className.startsWith('scroll-animate-')) {
|
179
|
+
targetEl.classList.remove(className);
|
180
|
+
}
|
181
|
+
});
|
182
|
+
// Cancel any running animations
|
183
|
+
const animations = targetEl.getAnimations();
|
184
|
+
animations.forEach(animation => animation.cancel());
|
185
|
+
}
|
186
|
+
// Export default object for convenience
|
187
|
+
var index = {
|
188
|
+
scrollAnimate,
|
189
|
+
scrollTrigger,
|
190
|
+
parallax,
|
191
|
+
cleanup
|
192
|
+
};
|
193
|
+
|
194
|
+
export { cleanup, index as default, parallax, scrollAnimate, scrollTrigger };
|
195
|
+
//# sourceMappingURL=scroll.esm.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"scroll.esm.js","sources":["../../src/modules/scroll/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAAA;;;;;;;AAOG;AAaH;;AAEG;AACG,SAAU,aAAa,CAC3B,MAAwB,EACxB,IAA0B,EAAA;AAE1B,IAAA,MAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM;IACrF,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC;IAC7C;IAEA,MAAM,EACJ,SAAS,EACT,KAAK,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,EACtB,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,IAAI,EAChB,GAAG,IAAI;AAER,IAAA,MAAM,EACJ,IAAI,GAAG,OAAO,EACd,KAAK,GAAG,IAAI,EACZ,GAAG,GAAG,MAAM,EACb,GAAG,QAAQ;;AAGZ,IAAA,MAAM,iBAAiB,GAAG,KAAK,IAAI,MAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,oBAAoB,EAAE,UAAU,CAAC;;IAG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AAU,CAAC,OAAO,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;AACrD;AAEA;AACA,YAAe;IACb,aAAa;IACb,aAAa;IACb,QAAQ;IACR;CACD;;;;"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/**
|
2
|
+
* @sc4rfurryx/proteusjs/transitions
|
3
|
+
* View Transitions API wrapper with safe fallbacks
|
4
|
+
*
|
5
|
+
* @version 1.1.0
|
6
|
+
* @author sc4rfurry
|
7
|
+
* @license MIT
|
8
|
+
*/
|
9
|
+
interface TransitionOptions {
|
10
|
+
name?: string;
|
11
|
+
duration?: number;
|
12
|
+
onBefore?: () => void;
|
13
|
+
onAfter?: () => void;
|
14
|
+
allowInterrupt?: boolean;
|
15
|
+
}
|
16
|
+
interface NavigateOptions {
|
17
|
+
name?: string;
|
18
|
+
prerender?: boolean;
|
19
|
+
}
|
20
|
+
/**
|
21
|
+
* One API for animating DOM state changes and cross-document navigations
|
22
|
+
* using the View Transitions API with safe fallbacks.
|
23
|
+
*/
|
24
|
+
declare function transition(run: () => Promise<any> | any, opts?: TransitionOptions): Promise<void>;
|
25
|
+
/**
|
26
|
+
* MPA-friendly navigation with view transitions when supported
|
27
|
+
*/
|
28
|
+
declare function navigate(url: string, opts?: NavigateOptions): Promise<void>;
|
29
|
+
declare const _default: {
|
30
|
+
transition: typeof transition;
|
31
|
+
navigate: typeof navigate;
|
32
|
+
};
|
33
|
+
|
34
|
+
export { _default as default, navigate, transition };
|
35
|
+
export type { NavigateOptions, TransitionOptions };
|
@@ -0,0 +1,120 @@
|
|
1
|
+
/*!
|
2
|
+
* ProteusJS v1.1.0
|
3
|
+
* Shape-shifting responsive design that adapts like the sea god himself
|
4
|
+
* (c) 2025 sc4rfurry
|
5
|
+
* Released under the MIT License
|
6
|
+
*/
|
7
|
+
/**
|
8
|
+
* @sc4rfurryx/proteusjs/transitions
|
9
|
+
* View Transitions API wrapper with safe fallbacks
|
10
|
+
*
|
11
|
+
* @version 1.1.0
|
12
|
+
* @author sc4rfurry
|
13
|
+
* @license MIT
|
14
|
+
*/
|
15
|
+
/**
|
16
|
+
* One API for animating DOM state changes and cross-document navigations
|
17
|
+
* using the View Transitions API with safe fallbacks.
|
18
|
+
*/
|
19
|
+
async function transition(run, opts = {}) {
|
20
|
+
const { name, duration = 300, onBefore, onAfter, allowInterrupt = true } = opts;
|
21
|
+
// Check for View Transitions API support
|
22
|
+
const hasViewTransitions = 'startViewTransition' in document;
|
23
|
+
if (onBefore) {
|
24
|
+
onBefore();
|
25
|
+
}
|
26
|
+
if (!hasViewTransitions) {
|
27
|
+
// Fallback: run immediately without transitions
|
28
|
+
try {
|
29
|
+
await run();
|
30
|
+
}
|
31
|
+
finally {
|
32
|
+
if (onAfter) {
|
33
|
+
onAfter();
|
34
|
+
}
|
35
|
+
}
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
// Use native View Transitions API
|
39
|
+
try {
|
40
|
+
const viewTransition = document.startViewTransition(async () => {
|
41
|
+
await run();
|
42
|
+
});
|
43
|
+
// Add CSS view-transition-name if name provided
|
44
|
+
if (name) {
|
45
|
+
const style = document.createElement('style');
|
46
|
+
style.textContent = `
|
47
|
+
::view-transition-old(${name}),
|
48
|
+
::view-transition-new(${name}) {
|
49
|
+
animation-duration: ${duration}ms;
|
50
|
+
}
|
51
|
+
`;
|
52
|
+
document.head.appendChild(style);
|
53
|
+
// Clean up style after transition
|
54
|
+
viewTransition.finished.finally(() => {
|
55
|
+
style.remove();
|
56
|
+
});
|
57
|
+
}
|
58
|
+
await viewTransition.finished;
|
59
|
+
}
|
60
|
+
catch (error) {
|
61
|
+
console.warn('View transition failed, falling back to immediate execution:', error);
|
62
|
+
await run();
|
63
|
+
}
|
64
|
+
finally {
|
65
|
+
if (onAfter) {
|
66
|
+
onAfter();
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* MPA-friendly navigation with view transitions when supported
|
72
|
+
*/
|
73
|
+
async function navigate(url, opts = {}) {
|
74
|
+
const { name, prerender = false } = opts;
|
75
|
+
// Optional prerender hint (basic implementation)
|
76
|
+
if (prerender && 'speculation' in HTMLScriptElement.prototype) {
|
77
|
+
const script = document.createElement('script');
|
78
|
+
script.type = 'speculationrules';
|
79
|
+
script.textContent = JSON.stringify({
|
80
|
+
prerender: [{ where: { href_matches: url } }]
|
81
|
+
});
|
82
|
+
document.head.appendChild(script);
|
83
|
+
}
|
84
|
+
// Check for View Transitions API support
|
85
|
+
const hasViewTransitions = 'startViewTransition' in document;
|
86
|
+
if (!hasViewTransitions) {
|
87
|
+
// Fallback: normal navigation
|
88
|
+
window.location.href = url;
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
try {
|
92
|
+
// Use view transitions for navigation
|
93
|
+
const viewTransition = document.startViewTransition(() => {
|
94
|
+
window.location.href = url;
|
95
|
+
});
|
96
|
+
if (name) {
|
97
|
+
const style = document.createElement('style');
|
98
|
+
style.textContent = `
|
99
|
+
::view-transition-old(${name}),
|
100
|
+
::view-transition-new(${name}) {
|
101
|
+
animation-duration: 300ms;
|
102
|
+
}
|
103
|
+
`;
|
104
|
+
document.head.appendChild(style);
|
105
|
+
}
|
106
|
+
await viewTransition.finished;
|
107
|
+
}
|
108
|
+
catch (error) {
|
109
|
+
console.warn('View transition navigation failed, falling back to normal navigation:', error);
|
110
|
+
window.location.href = url;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
// Export default object for convenience
|
114
|
+
var index = {
|
115
|
+
transition,
|
116
|
+
navigate
|
117
|
+
};
|
118
|
+
|
119
|
+
export { index as default, navigate, transition };
|
120
|
+
//# sourceMappingURL=transitions.esm.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"transitions.esm.js","sources":["../../src/modules/transitions/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAAA;;;;;;;AAOG;AAeH;;;AAGG;AACI,eAAe,UAAU,CAC9B,GAA6B,EAC7B,OAA0B,EAAE,EAAA;AAE5B,IA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teusjs/typography
|
3
|
+
* Fluid typography with CSS-first approach
|
4
|
+
*
|
5
|
+
* @version 1.1.0
|
6
|
+
* @author sc4rfurry
|
7
|
+
* @license MIT
|
8
|
+
*/
|
9
|
+
interface FluidTypeOptions {
|
10
|
+
minViewportPx?: number;
|
11
|
+
maxViewportPx?: number;
|
12
|
+
lineHeight?: number;
|
13
|
+
containerUnits?: boolean;
|
14
|
+
}
|
15
|
+
interface FluidTypeResult {
|
16
|
+
css: string;
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Generate pure-CSS clamp() rules for fluid typography
|
20
|
+
*/
|
21
|
+
declare function fluidType(minRem: number, maxRem: number, options?: FluidTypeOptions): FluidTypeResult;
|
22
|
+
/**
|
23
|
+
* Apply fluid typography to elements
|
24
|
+
*/
|
25
|
+
declare function applyFluidType(selector: string, minRem: number, maxRem: number, options?: FluidTypeOptions): void;
|
26
|
+
/**
|
27
|
+
* Create a complete typographic scale
|
28
|
+
*/
|
29
|
+
declare function createTypographicScale(baseSize?: number, ratio?: number, steps?: number, options?: FluidTypeOptions): Record<string, FluidTypeResult>;
|
30
|
+
/**
|
31
|
+
* Generate CSS custom properties for a typographic scale
|
32
|
+
*/
|
33
|
+
declare function generateScaleCSS(scale: Record<string, FluidTypeResult>, prefix?: string): string;
|
34
|
+
/**
|
35
|
+
* Optimize line height for readability
|
36
|
+
*/
|
37
|
+
declare function optimizeLineHeight(fontSize: number, measure?: number): number;
|
38
|
+
/**
|
39
|
+
* Calculate optimal font size for container width
|
40
|
+
*/
|
41
|
+
declare function calculateOptimalSize(containerWidth: number, targetCharacters?: number, baseCharWidth?: number): number;
|
42
|
+
/**
|
43
|
+
* Apply responsive typography to an element
|
44
|
+
*/
|
45
|
+
declare function makeResponsive(target: Element | string, options?: {
|
46
|
+
minSize?: number;
|
47
|
+
maxSize?: number;
|
48
|
+
targetCharacters?: number;
|
49
|
+
autoLineHeight?: boolean;
|
50
|
+
}): void;
|
51
|
+
/**
|
52
|
+
* Remove applied typography styles
|
53
|
+
*/
|
54
|
+
declare function cleanup(target?: Element | string): void;
|
55
|
+
/**
|
56
|
+
* Check if container query units are supported
|
57
|
+
*/
|
58
|
+
declare function supportsContainerUnits(): boolean;
|
59
|
+
declare const _default: {
|
60
|
+
fluidType: typeof fluidType;
|
61
|
+
applyFluidType: typeof applyFluidType;
|
62
|
+
createTypographicScale: typeof createTypographicScale;
|
63
|
+
generateScaleCSS: typeof generateScaleCSS;
|
64
|
+
optimizeLineHeight: typeof optimizeLineHeight;
|
65
|
+
calculateOptimalSize: typeof calculateOptimalSize;
|
66
|
+
makeResponsive: typeof makeResponsive;
|
67
|
+
cleanup: typeof cleanup;
|
68
|
+
supportsContainerUnits: typeof supportsContainerUnits;
|
69
|
+
};
|
70
|
+
|
71
|
+
export { applyFluidType, calculateOptimalSize, cleanup, createTypographicScale, _default as default, fluidType, generateScaleCSS, makeResponsive, optimizeLineHeight, supportsContainerUnits };
|
72
|
+
export type { FluidTypeOptions, FluidTypeResult };
|
@@ -0,0 +1,168 @@
|
|
1
|
+
/*!
|
2
|
+
* ProteusJS v1.1.0
|
3
|
+
* Shape-shifting responsive design that adapts like the sea god himself
|
4
|
+
* (c) 2025 sc4rfurry
|
5
|
+
* Released under the MIT License
|
6
|
+
*/
|
7
|
+
/**
|
8
|
+
* @sc4rfurryx/proteusjs/typography
|
9
|
+
* Fluid typography with CSS-first approach
|
10
|
+
*
|
11
|
+
* @version 1.1.0
|
12
|
+
* @author sc4rfurry
|
13
|
+
* @license MIT
|
14
|
+
*/
|
15
|
+
/**
|
16
|
+
* Generate pure-CSS clamp() rules for fluid typography
|
17
|
+
*/
|
18
|
+
function fluidType(minRem, maxRem, options = {}) {
|
19
|
+
const { minViewportPx = 320, maxViewportPx = 1200, lineHeight, containerUnits = false } = options;
|
20
|
+
// Convert rem to px for calculations (assuming 16px base)
|
21
|
+
const minPx = minRem * 16;
|
22
|
+
const maxPx = maxRem * 16;
|
23
|
+
// Calculate slope and y-intercept for linear interpolation
|
24
|
+
const slope = (maxPx - minPx) / (maxViewportPx - minViewportPx);
|
25
|
+
const yIntercept = minPx - slope * minViewportPx;
|
26
|
+
// Generate clamp() function
|
27
|
+
const viewportUnit = containerUnits ? 'cqw' : 'vw';
|
28
|
+
const clampValue = `clamp(${minRem}rem, ${yIntercept / 16}rem + ${slope * 100}${viewportUnit}, ${maxRem}rem)`;
|
29
|
+
let css = `font-size: ${clampValue};`;
|
30
|
+
// Add line-height if specified
|
31
|
+
if (lineHeight) {
|
32
|
+
css += `\nline-height: ${lineHeight};`;
|
33
|
+
}
|
34
|
+
return { css };
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* Apply fluid typography to elements
|
38
|
+
*/
|
39
|
+
function applyFluidType(selector, minRem, maxRem, options = {}) {
|
40
|
+
const { css } = fluidType(minRem, maxRem, options);
|
41
|
+
const styleElement = document.createElement('style');
|
42
|
+
styleElement.textContent = `${selector} {\n ${css.replace(/\n/g, '\n ')}\n}`;
|
43
|
+
styleElement.setAttribute('data-proteus-typography', selector);
|
44
|
+
document.head.appendChild(styleElement);
|
45
|
+
}
|
46
|
+
/**
|
47
|
+
* Create a complete typographic scale
|
48
|
+
*/
|
49
|
+
function createTypographicScale(baseSize = 1, ratio = 1.25, steps = 6, options = {}) {
|
50
|
+
const scale = {};
|
51
|
+
for (let i = -2; i <= steps - 3; i++) {
|
52
|
+
const size = baseSize * Math.pow(ratio, i);
|
53
|
+
const minSize = size * 0.8; // 20% smaller at min viewport
|
54
|
+
const maxSize = size * 1.2; // 20% larger at max viewport
|
55
|
+
const stepName = i <= 0 ? `small${Math.abs(i)}` : `large${i}`;
|
56
|
+
scale[stepName] = fluidType(minSize, maxSize, options);
|
57
|
+
}
|
58
|
+
return scale;
|
59
|
+
}
|
60
|
+
/**
|
61
|
+
* Generate CSS custom properties for a typographic scale
|
62
|
+
*/
|
63
|
+
function generateScaleCSS(scale, prefix = '--font-size') {
|
64
|
+
const cssVars = Object.entries(scale)
|
65
|
+
.map(([name, result]) => ` ${prefix}-${name}: ${result.css.replace('font-size: ', '').replace(';', '')};`)
|
66
|
+
.join('\n');
|
67
|
+
return `:root {\n${cssVars}\n}`;
|
68
|
+
}
|
69
|
+
/**
|
70
|
+
* Optimize line height for readability
|
71
|
+
*/
|
72
|
+
function optimizeLineHeight(fontSize, measure = 65) {
|
73
|
+
// Optimal line height based on font size and measure (characters per line)
|
74
|
+
// Smaller fonts need more line height, larger fonts need less
|
75
|
+
const baseLineHeight = 1.4;
|
76
|
+
const sizeAdjustment = Math.max(0.1, Math.min(0.3, (1 - fontSize) * 0.5));
|
77
|
+
const measureAdjustment = Math.max(-0.1, Math.min(0.1, (65 - measure) * 0.002));
|
78
|
+
return baseLineHeight + sizeAdjustment + measureAdjustment;
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* Calculate optimal font size for container width
|
82
|
+
*/
|
83
|
+
function calculateOptimalSize(containerWidth, targetCharacters = 65, baseCharWidth = 0.5) {
|
84
|
+
// Calculate font size to achieve target characters per line
|
85
|
+
const optimalFontSize = containerWidth / (targetCharacters * baseCharWidth);
|
86
|
+
// Clamp to reasonable bounds (12px to 24px)
|
87
|
+
return Math.max(0.75, Math.min(1.5, optimalFontSize));
|
88
|
+
}
|
89
|
+
/**
|
90
|
+
* Apply responsive typography to an element
|
91
|
+
*/
|
92
|
+
function makeResponsive(target, options = {}) {
|
93
|
+
const targetEl = typeof target === 'string' ? document.querySelector(target) : target;
|
94
|
+
if (!targetEl) {
|
95
|
+
throw new Error('Target element not found');
|
96
|
+
}
|
97
|
+
const { minSize = 0.875, maxSize = 1.25, targetCharacters = 65, autoLineHeight = true } = options;
|
98
|
+
// Apply fluid typography
|
99
|
+
const { css } = fluidType(minSize, maxSize);
|
100
|
+
const element = targetEl;
|
101
|
+
// Parse and apply CSS
|
102
|
+
const styles = css.split(';').filter(Boolean);
|
103
|
+
styles.forEach(style => {
|
104
|
+
const [property, value] = style.split(':').map(s => s.trim());
|
105
|
+
if (property && value) {
|
106
|
+
element.style.setProperty(property, value);
|
107
|
+
}
|
108
|
+
});
|
109
|
+
// Auto line height if enabled
|
110
|
+
if (autoLineHeight) {
|
111
|
+
const updateLineHeight = () => {
|
112
|
+
const computedStyle = getComputedStyle(element);
|
113
|
+
const fontSize = parseFloat(computedStyle.fontSize);
|
114
|
+
const containerWidth = element.getBoundingClientRect().width;
|
115
|
+
const charactersPerLine = containerWidth / (fontSize * 0.5);
|
116
|
+
const optimalLineHeight = optimizeLineHeight(fontSize / 16, charactersPerLine);
|
117
|
+
element.style.lineHeight = optimalLineHeight.toString();
|
118
|
+
};
|
119
|
+
updateLineHeight();
|
120
|
+
// Update on resize
|
121
|
+
if ('ResizeObserver' in window) {
|
122
|
+
const resizeObserver = new ResizeObserver(updateLineHeight);
|
123
|
+
resizeObserver.observe(element);
|
124
|
+
// Store cleanup function
|
125
|
+
element._proteusTypographyCleanup = () => {
|
126
|
+
resizeObserver.disconnect();
|
127
|
+
};
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
/**
|
132
|
+
* Remove applied typography styles
|
133
|
+
*/
|
134
|
+
function cleanup(target) {
|
135
|
+
if (target) {
|
136
|
+
const targetEl = typeof target === 'string' ? document.querySelector(target) : target;
|
137
|
+
if (targetEl && targetEl._proteusTypographyCleanup) {
|
138
|
+
targetEl._proteusTypographyCleanup();
|
139
|
+
delete targetEl._proteusTypographyCleanup;
|
140
|
+
}
|
141
|
+
}
|
142
|
+
else {
|
143
|
+
// Remove all typography style elements
|
144
|
+
const styleElements = document.querySelectorAll('style[data-proteus-typography]');
|
145
|
+
styleElements.forEach(element => element.remove());
|
146
|
+
}
|
147
|
+
}
|
148
|
+
/**
|
149
|
+
* Check if container query units are supported
|
150
|
+
*/
|
151
|
+
function supportsContainerUnits() {
|
152
|
+
return CSS.supports('width', '1cqw');
|
153
|
+
}
|
154
|
+
// Export default object for convenience
|
155
|
+
var index = {
|
156
|
+
fluidType,
|
157
|
+
applyFluidType,
|
158
|
+
createTypographicScale,
|
159
|
+
generateScaleCSS,
|
160
|
+
optimizeLineHeight,
|
161
|
+
calculateOptimalSize,
|
162
|
+
makeResponsive,
|
163
|
+
cleanup,
|
164
|
+
supportsContainerUnits
|
165
|
+
};
|
166
|
+
|
167
|
+
export { applyFluidType, calculateOptimalSize, cleanup, createTypographicScale, index as default, fluidType, generateScaleCSS, makeResponsive, optimizeLineHeight, supportsContainerUnits };
|
168
|
+
//# sourceMappingURL=typography.esm.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"typography.esm.js","sources":["../../src/modules/typography/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAAA;;;;;;;AAOG;AAaH;;AAEG;AACG,SAAU,SAAS,CACvB,MAAc,EACd,MAAc,EACd,UAA4B,EAAE,EAAA;AAE9B,IAAA,MAAM,EACJ,aAAa,GAAG,GAAG,EACnB,aAAa,GAAG,IAAI,EACpB,UAAU,EACV,cAAc,GAAG,KAAK,EACvB,GAAG,OAAO;;AAGX,IAAA,MAAM,KAAK,GAAG,MAAM,GAAG,EAAE;AACzB,IAAA,MAAM,KAAK,GAAG,MAAM,GAAG,EAAE;;AAGzB,IAAA,MAAM,KAAK,GAAG,CAAC,KAAK,GAAG,KAAK,KAAK,aAAa,GAAG,aAAa,CAAC;AAC/D,IAAA,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,aAAa;;IAGhD,MAAM,YAAY,GAAG,cAAc,GAAG,KAAK,GAAG,IAAI;AAClD,IAAA,MAAM,UAAU,GAAG,CAAA,MAAA,EAAS,MAAM,CAAA,KAAA,EAAQ,UAAU,GAAG,EAAE,CAAA,MAAA,EAAS,KAAK,GAAG,GAAG,CAAA,EAAG,YAAY,CAAA,EAAA,EAAK,MAAM,MAAM;AAE7G,IAAA,IAAI,GAAG,GAAG,CAAA,WAAA,EAAc,UAAU,GAAG;;IAGrC,IAAI,UAAU,EAAE;AACd,QAAA,GAAG,IAAI,CAAA,eAAA,EAAkB,UAAU,CAAA,CAA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