@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.
Files changed (65) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +331 -77
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/adapters/react.d.ts +139 -0
  5. package/dist/adapters/react.esm.js +848 -0
  6. package/dist/adapters/react.esm.js.map +1 -0
  7. package/dist/adapters/svelte.d.ts +181 -0
  8. package/dist/adapters/svelte.esm.js +908 -0
  9. package/dist/adapters/svelte.esm.js.map +1 -0
  10. package/dist/adapters/vue.d.ts +205 -0
  11. package/dist/adapters/vue.esm.js +872 -0
  12. package/dist/adapters/vue.esm.js.map +1 -0
  13. package/dist/modules/a11y-audit.d.ts +39 -0
  14. package/dist/modules/a11y-audit.esm.js +509 -0
  15. package/dist/modules/a11y-audit.esm.js.map +1 -0
  16. package/dist/modules/a11y-primitives.d.ts +69 -0
  17. package/dist/modules/a11y-primitives.esm.js +445 -0
  18. package/dist/modules/a11y-primitives.esm.js.map +1 -0
  19. package/dist/modules/anchor.d.ts +29 -0
  20. package/dist/modules/anchor.esm.js +218 -0
  21. package/dist/modules/anchor.esm.js.map +1 -0
  22. package/dist/modules/container.d.ts +60 -0
  23. package/dist/modules/container.esm.js +194 -0
  24. package/dist/modules/container.esm.js.map +1 -0
  25. package/dist/modules/perf.d.ts +82 -0
  26. package/dist/modules/perf.esm.js +257 -0
  27. package/dist/modules/perf.esm.js.map +1 -0
  28. package/dist/modules/popover.d.ts +33 -0
  29. package/dist/modules/popover.esm.js +191 -0
  30. package/dist/modules/popover.esm.js.map +1 -0
  31. package/dist/modules/scroll.d.ts +43 -0
  32. package/dist/modules/scroll.esm.js +195 -0
  33. package/dist/modules/scroll.esm.js.map +1 -0
  34. package/dist/modules/transitions.d.ts +35 -0
  35. package/dist/modules/transitions.esm.js +120 -0
  36. package/dist/modules/transitions.esm.js.map +1 -0
  37. package/dist/modules/typography.d.ts +72 -0
  38. package/dist/modules/typography.esm.js +168 -0
  39. package/dist/modules/typography.esm.js.map +1 -0
  40. package/dist/proteus.cjs.js +2332 -12
  41. package/dist/proteus.cjs.js.map +1 -1
  42. package/dist/proteus.d.ts +561 -12
  43. package/dist/proteus.esm.js +2323 -12
  44. package/dist/proteus.esm.js.map +1 -1
  45. package/dist/proteus.esm.min.js +3 -3
  46. package/dist/proteus.esm.min.js.map +1 -1
  47. package/dist/proteus.js +2332 -12
  48. package/dist/proteus.js.map +1 -1
  49. package/dist/proteus.min.js +3 -3
  50. package/dist/proteus.min.js.map +1 -1
  51. package/package.json +61 -4
  52. package/src/adapters/react.ts +264 -0
  53. package/src/adapters/svelte.ts +321 -0
  54. package/src/adapters/vue.ts +268 -0
  55. package/src/index.ts +33 -6
  56. package/src/modules/a11y-audit/index.ts +608 -0
  57. package/src/modules/a11y-primitives/index.ts +554 -0
  58. package/src/modules/anchor/index.ts +257 -0
  59. package/src/modules/container/index.ts +230 -0
  60. package/src/modules/perf/index.ts +291 -0
  61. package/src/modules/popover/index.ts +238 -0
  62. package/src/modules/scroll/index.ts +251 -0
  63. package/src/modules/transitions/index.ts +145 -0
  64. package/src/modules/typography/index.ts +239 -0
  65. package/src/utils/version.ts +1 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 sc4rfurry
3
+ Copyright (c) 2025 sc4rfurry
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  <div align="center">
2
2
 
3
- # ๐ŸŒŠ ProteusJS
3
+ # ๐ŸŒŠ ProteusJS v1.1.0
4
4
 
5
- **The Modern Web Development Framework for Accessible, Responsive, and High-Performance Applications**
5
+ **Native-first web development primitives that adapt like the sea god himself**
6
6
 
7
- *Shape-shifting responsive design that adapts like the sea god himself*
7
+ *Lightweight, framework-agnostic utilities for modern, accessible, high-performance web applications*
8
8
 
9
9
  [![npm version](https://img.shields.io/npm/v/@sc4rfurryx/proteusjs.svg?style=for-the-badge)](https://www.npmjs.com/package/@sc4rfurryx/proteusjs)
10
10
  [![npm downloads](https://img.shields.io/npm/dm/@sc4rfurryx/proteusjs.svg?style=for-the-badge)](https://www.npmjs.com/package/@sc4rfurryx/proteusjs)
@@ -20,9 +20,18 @@
20
20
 
21
21
  ---
22
22
 
23
- ## ๐Ÿš€ **What is ProteusJS?**
23
+ ## ๐Ÿš€ **What is ProteusJS v1.1.0?**
24
24
 
25
- ProteusJS is a comprehensive TypeScript library that revolutionizes web development with intelligent layout systems, advanced typography, WCAG-compliant accessibility features, and performance optimizations. Built for modern web development, it offers **container queries**, **fluid typography**, **screen reader support**, and **automated accessibility compliance**.
25
+ ProteusJS v1.1.0 is a complete architectural transformation - from a monolithic framework to a collection of **native-first, tree-shakable modules** that wrap modern web platform features with great developer experience. Each module is lightweight (โ‰ค6KB gzipped), framework-agnostic, and designed for **performance**, **accessibility**, and **modern web standards**.
26
+
27
+ ### ๐Ÿ†• **What's New in v1.1.0**
28
+
29
+ - **๐Ÿงฉ Modular Architecture**: Import only what you need with subpath exports
30
+ - **๐ŸŒ Native-First**: Prefer web standards over JavaScript re-implementations
31
+ - **๐ŸŽฏ Tree-Shakable**: Each module is independently optimized
32
+ - **โšก Performance-First**: Built-in Core Web Vitals optimizations
33
+ - **โ™ฟ Accessibility-First**: WCAG compliance baked in, not bolted on
34
+ - **๐Ÿ”ง Framework Adapters**: React, Vue, and Svelte integrations
26
35
 
27
36
  ## โœจ **Key Features**
28
37
 
@@ -80,40 +89,71 @@ pnpm add @sc4rfurryx/proteusjs
80
89
  <script src="https://unpkg.com/@sc4rfurryx/proteusjs@latest/dist/proteus.min.js"></script>
81
90
  ```
82
91
 
83
- ### โšก **Basic Usage**
92
+ ### โšก **Basic Usage (v1.1.0 Modular API)**
84
93
 
85
94
  ```typescript
86
- import { ProteusJS } from '@sc4rfurryx/proteusjs';
87
-
88
- // Initialize ProteusJS
89
- const proteus = new ProteusJS();
90
-
91
- // ๐ŸŽฏ Create responsive container
92
- proteus.container('.hero-section', {
93
- breakpoints: {
94
- sm: '320px',
95
- md: '768px',
96
- lg: '1024px'
97
- }
95
+ // ๐Ÿงฉ Import only what you need (tree-shakable)
96
+ import { transition, navigate } from '@sc4rfurryx/proteusjs/transitions';
97
+ import { tether } from '@sc4rfurryx/proteusjs/anchor';
98
+ import { attach } from '@sc4rfurryx/proteusjs/popover';
99
+ import { boost } from '@sc4rfurryx/proteusjs/perf';
100
+
101
+ // ๐ŸŽฌ View Transitions
102
+ await transition(() => {
103
+ document.body.classList.toggle('dark-mode');
98
104
  });
99
105
 
100
- // ๐Ÿ“ Apply fluid typography
101
- proteus.fluidType('h1, h2, h3', {
102
- minSize: 16,
103
- maxSize: 32,
104
- accessibility: 'AAA'
106
+ // โš“ Anchor Positioning
107
+ const controller = tether(floatingEl, {
108
+ anchor: anchorEl,
109
+ placement: 'bottom',
110
+ align: 'center'
105
111
  });
106
112
 
107
- // โ™ฟ Enable accessibility features
108
- proteus.enableAccessibility(document.body, {
109
- wcagLevel: 'AA',
110
- screenReader: true,
111
- cognitiveAccessibility: true
113
+ // ๐ŸŽญ Popover/Dialog
114
+ const popover = attach(triggerEl, panelEl, {
115
+ type: 'menu',
116
+ trapFocus: true
112
117
  });
118
+
119
+ // โšก Performance Boost
120
+ boost.contentVisibility('.lazy-content');
121
+ boost.speculate({ prerender: ['/next-page'] });
122
+ ```
123
+
124
+ ### ๐Ÿงฉ **All Available Modules**
125
+
126
+ ```typescript
127
+ // ๐ŸŽฌ View Transitions API
128
+ import { transition, navigate } from '@sc4rfurryx/proteusjs/transitions';
129
+
130
+ // ๐Ÿ“œ Scroll-driven Animations
131
+ import { scrollAnimate, scrollTimeline } from '@sc4rfurryx/proteusjs/scroll';
132
+
133
+ // โš“ CSS Anchor Positioning
134
+ import { tether, anchor } from '@sc4rfurryx/proteusjs/anchor';
135
+
136
+ // ๐ŸŽญ HTML Popover API
137
+ import { attach, dialog } from '@sc4rfurryx/proteusjs/popover';
138
+
139
+ // ๐Ÿ“ฆ Container Queries
140
+ import { defineContainer, observe } from '@sc4rfurryx/proteusjs/container';
141
+
142
+ // ๐Ÿ”ค Fluid Typography
143
+ import { fluidType, typeScale } from '@sc4rfurryx/proteusjs/typography';
144
+
145
+ // ๐Ÿ” A11y Auditing (dev-only)
146
+ import { audit } from '@sc4rfurryx/proteusjs/a11y-audit';
147
+
148
+ // โ™ฟ A11y Primitives
149
+ import { dialog, tooltip, combobox, tabs, menu } from '@sc4rfurryx/proteusjs/a11y-primitives';
150
+
151
+ // โšก Performance Guardrails
152
+ import { boost } from '@sc4rfurryx/proteusjs/perf';
113
153
  ```
114
154
 
115
155
  <details>
116
- <summary>๐ŸŽจ <strong>See it in action</strong></summary>
156
+ <summary>๐ŸŽจ <strong>Complete Example</strong></summary>
117
157
 
118
158
  ```html
119
159
  <!DOCTYPE html>
@@ -121,23 +161,41 @@ proteus.enableAccessibility(document.body, {
121
161
  <head>
122
162
  <meta charset="UTF-8">
123
163
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
124
- <title>ProteusJS Demo</title>
164
+ <title>ProteusJS v1.1.0 Demo</title>
125
165
  </head>
126
166
  <body>
127
- <div class="container">
128
- <h1>Responsive Typography</h1>
129
- <p>This content adapts to container size and maintains accessibility.</p>
167
+ <div class="hero-container">
168
+ <h1>Modern Web Development</h1>
169
+ <p>Native-first, accessible, performant.</p>
170
+ <button id="theme-toggle">Toggle Theme</button>
130
171
  </div>
131
172
 
132
173
  <script type="module">
133
- import { ProteusJS } from '@sc4rfurryx/proteusjs';
174
+ import { transition } from '@sc4rfurryx/proteusjs/transitions';
175
+ import { defineContainer } from '@sc4rfurryx/proteusjs/container';
176
+ import { fluidType } from '@sc4rfurryx/proteusjs/typography';
177
+ import { boost } from '@sc4rfurryx/proteusjs/perf';
178
+
179
+ // Container queries
180
+ defineContainer('.hero-container', {
181
+ name: 'hero',
182
+ type: 'inline-size'
183
+ });
184
+
185
+ // Fluid typography
186
+ const { css } = fluidType(1, 2.5, { lineHeight: 1.5 });
187
+ document.head.insertAdjacentHTML('beforeend', `<style>h1 { ${css} }</style>`);
134
188
 
135
- const proteus = new ProteusJS();
136
- proteus.autoOptimize(document.body, {
137
- typography: { accessibility: 'AAA' },
138
- accessibility: { wcagLevel: 'AA' },
139
- container: { breakpoints: { sm: '300px', lg: '800px' } }
189
+ // View transitions
190
+ document.getElementById('theme-toggle').addEventListener('click', () => {
191
+ transition(() => {
192
+ document.body.classList.toggle('dark-theme');
193
+ });
140
194
  });
195
+
196
+ // Performance optimizations
197
+ boost.contentVisibility('.hero-container');
198
+ boost.speculate({ prefetch: ['/about', '/contact'] });
141
199
  </script>
142
200
  </body>
143
201
  </html>
@@ -210,66 +268,262 @@ Experience ProteusJS in action with our comprehensive real-world examples:
210
268
  ## ๐Ÿ“š **API Documentation**
211
269
 
212
270
  <details>
213
- <summary>๐ŸŽฏ <strong>Container Queries API</strong></summary>
271
+ <summary>๐ŸŽฌ <strong>Transitions Module</strong></summary>
214
272
 
215
- ### `container(selector, options)`
216
- Creates responsive containers with element-based breakpoints.
273
+ ### `transition(callback, options?)`
274
+ Wraps View Transitions API with fallbacks.
217
275
 
218
276
  ```typescript
219
- proteus.container('.sidebar', {
220
- breakpoints: {
221
- sm: '200px',
222
- md: '400px',
223
- lg: '600px'
224
- },
225
- containerType: 'inline-size',
226
- announceChanges: true, // Screen reader announcements
227
- callbacks: {
228
- breakpointChange: (breakpoint, active) => {
229
- console.log(`Breakpoint ${breakpoint} is now ${active ? 'active' : 'inactive'}`);
230
- }
231
- }
277
+ import { transition, navigate } from '@sc4rfurryx/proteusjs/transitions';
278
+
279
+ // Basic transition
280
+ await transition(() => {
281
+ document.body.classList.toggle('dark-mode');
282
+ });
283
+
284
+ // Navigation with transition
285
+ await navigate('/new-page', {
286
+ fallback: 'fade',
287
+ duration: 300
232
288
  });
233
289
  ```
234
290
 
235
291
  </details>
236
292
 
237
293
  <details>
238
- <summary>๐Ÿ“ <strong>Typography API</strong></summary>
294
+ <summary>โš“ <strong>Anchor Module</strong></summary>
239
295
 
240
- ### `fluidType(selector, options)`
241
- Applies fluid typography with accessibility compliance.
296
+ ### `tether(floating, options)`
297
+ CSS Anchor Positioning with JS fallback.
242
298
 
243
299
  ```typescript
244
- proteus.fluidType('p, li', {
245
- minSize: 14,
246
- maxSize: 18,
247
- minContainer: 320,
248
- maxContainer: 1200,
249
- accessibility: 'AAA', // Enforces 1.5+ line height
250
- unit: 'rem'
300
+ import { tether } from '@sc4rfurryx/proteusjs/anchor';
301
+
302
+ const controller = tether(floatingEl, {
303
+ anchor: anchorEl,
304
+ placement: 'bottom-start',
305
+ offset: 8,
306
+ flip: true,
307
+ shift: true
251
308
  });
309
+
310
+ // Cleanup
311
+ controller.destroy();
252
312
  ```
253
313
 
254
314
  </details>
255
315
 
256
316
  <details>
257
- <summary>โ™ฟ <strong>Accessibility API</strong></summary>
317
+ <summary>๐ŸŽญ <strong>Popover Module</strong></summary>
258
318
 
259
- ### `enableAccessibility(element, options)`
260
- Enables comprehensive accessibility features.
319
+ ### `attach(trigger, panel, options)`
320
+ HTML Popover API with accessibility.
261
321
 
262
322
  ```typescript
263
- proteus.enableAccessibility(document.main, {
264
- wcagLevel: 'AAA',
265
- screenReader: true,
266
- keyboardNavigation: true,
267
- cognitiveAccessibility: true,
268
- enhanceErrorMessages: true,
269
- showReadingTime: true,
270
- simplifyContent: true,
271
- readingLevel: 'elementary'
323
+ import { attach } from '@sc4rfurryx/proteusjs/popover';
324
+
325
+ const popover = attach(triggerEl, panelEl, {
326
+ type: 'menu',
327
+ trigger: 'click',
328
+ trapFocus: true,
329
+ restoreFocus: true,
330
+ closeOnEscape: true
331
+ });
332
+ ```
333
+
334
+ </details>
335
+
336
+ <details>
337
+ <summary>๐Ÿ“ฆ <strong>Container Module</strong></summary>
338
+
339
+ ### `defineContainer(selector, options)`
340
+ Container queries with dev visualization.
341
+
342
+ ```typescript
343
+ import { defineContainer } from '@sc4rfurryx/proteusjs/container';
344
+
345
+ defineContainer('.sidebar', {
346
+ name: 'sidebar',
347
+ type: 'inline-size'
348
+ });
349
+
350
+ // CSS: @container sidebar (min-width: 300px) { ... }
351
+ ```
352
+
353
+ </details>
354
+
355
+ <details>
356
+ <summary>๐Ÿ”ค <strong>Typography Module</strong></summary>
357
+
358
+ ### `fluidType(minRem, maxRem, options?)`
359
+ Generates CSS clamp() for fluid typography.
360
+
361
+ ```typescript
362
+ import { fluidType } from '@sc4rfurryx/proteusjs/typography';
363
+
364
+ const { css } = fluidType(1, 2.5, {
365
+ minViewportPx: 320,
366
+ maxViewportPx: 1200,
367
+ lineHeight: 1.5
368
+ });
369
+
370
+ // Returns: font-size: clamp(1rem, 4vw + 0.5rem, 2.5rem); line-height: 1.5;
371
+ ```
372
+
373
+ </details>
374
+
375
+ <details>
376
+ <summary>โ™ฟ <strong>A11y Primitives Module</strong></summary>
377
+
378
+ ### Headless accessibility patterns
379
+
380
+ ```typescript
381
+ import { dialog, tooltip, combobox, tabs, menu } from '@sc4rfurryx/proteusjs/a11y-primitives';
382
+
383
+ // Modal dialog
384
+ const dialogController = dialog(dialogEl, {
385
+ modal: true,
386
+ trapFocus: true,
387
+ restoreFocus: true
388
+ });
389
+
390
+ // Accessible tooltip
391
+ const tooltipController = tooltip(triggerEl, tooltipEl, {
392
+ delay: 500,
393
+ placement: 'top'
394
+ });
395
+
396
+ // Keyboard-navigable tabs
397
+ const tabsController = tabs(tabsContainerEl);
398
+ ```
399
+
400
+ </details>
401
+
402
+ <details>
403
+ <summary>โšก <strong>Performance Module</strong></summary>
404
+
405
+ ### `boost` object with performance utilities
406
+
407
+ ```typescript
408
+ import { boost } from '@sc4rfurryx/proteusjs/perf';
409
+
410
+ // Content visibility optimization
411
+ boost.contentVisibility('.lazy-section', 'auto', {
412
+ containIntrinsicSize: '600px 400px'
413
+ });
414
+
415
+ // Resource priority hints
416
+ boost.fetchPriority('img.hero', 'high');
417
+
418
+ // Speculation rules
419
+ boost.speculate({
420
+ prerender: ['/pricing'],
421
+ prefetch: ['/blog'],
422
+ sameOriginOnly: true
423
+ });
424
+
425
+ // Yield to browser
426
+ await boost.yieldToBrowser();
427
+ ```
428
+
429
+ </details>
430
+
431
+ ---
432
+
433
+ ## ๐Ÿ”ง **Framework Adapters**
434
+
435
+ <details>
436
+ <summary>โš›๏ธ <strong>React Adapter</strong></summary>
437
+
438
+ ```typescript
439
+ import { useTransition, usePopover, useAnchor } from '@sc4rfurryx/proteusjs/adapters/react';
440
+
441
+ function MyComponent() {
442
+ const [isTransitioning, startTransition] = useTransition();
443
+
444
+ const { triggerRef, panelRef, isOpen, toggle } = usePopover({
445
+ type: 'menu',
446
+ trapFocus: true
447
+ });
448
+
449
+ const { floatingRef, anchorRef } = useAnchor({
450
+ placement: 'bottom',
451
+ offset: 8
452
+ });
453
+
454
+ return (
455
+ <div>
456
+ <button
457
+ ref={triggerRef}
458
+ onClick={() => startTransition(() => toggle())}
459
+ >
460
+ Toggle Menu
461
+ </button>
462
+ <div ref={panelRef} hidden={!isOpen}>
463
+ Menu content
464
+ </div>
465
+ </div>
466
+ );
467
+ }
468
+ ```
469
+
470
+ </details>
471
+
472
+ <details>
473
+ <summary>๐ŸŸข <strong>Vue Adapter</strong></summary>
474
+
475
+ ```vue
476
+ <template>
477
+ <div>
478
+ <button @click="startTransition(() => toggle())">
479
+ Toggle Menu
480
+ </button>
481
+ <div v-show="isOpen" ref="panelRef">
482
+ Menu content
483
+ </div>
484
+ </div>
485
+ </template>
486
+
487
+ <script setup>
488
+ import { useTransition, usePopover } from '@sc4rfurryx/proteusjs/adapters/vue';
489
+
490
+ const { isTransitioning, startTransition } = useTransition();
491
+ const { triggerRef, panelRef, isOpen, toggle } = usePopover({
492
+ type: 'menu',
493
+ trapFocus: true
272
494
  });
495
+ </script>
496
+ ```
497
+
498
+ </details>
499
+
500
+ <details>
501
+ <summary>๐Ÿงก <strong>Svelte Adapter</strong></summary>
502
+
503
+ ```svelte
504
+ <script>
505
+ import { proteusTransition, proteusPopover } from '@sc4rfurryx/proteusjs/adapters/svelte';
506
+
507
+ let isOpen = false;
508
+ </script>
509
+
510
+ <button
511
+ use:proteusTransition={{
512
+ callback: () => isOpen = !isOpen
513
+ }}
514
+ >
515
+ Toggle Menu
516
+ </button>
517
+
518
+ <div
519
+ use:proteusPopover={{
520
+ type: 'menu',
521
+ isOpen,
522
+ trapFocus: true
523
+ }}
524
+ >
525
+ Menu content
526
+ </div>
273
527
  ```
274
528
 
275
529
  </details>