@ecopages/browser-router 0.2.0-beta.9 → 0.2.0-rc.1

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 (43) hide show
  1. package/README.md +12 -4
  2. package/package.json +6 -6
  3. package/src/client/document-element-sync.d.ts +0 -7
  4. package/src/client/document-element-sync.js +28 -18
  5. package/src/client/dom/body-morpher.d.ts +24 -0
  6. package/src/client/dom/body-morpher.js +143 -0
  7. package/src/client/dom/dom-swapper.d.ts +30 -0
  8. package/src/client/dom/dom-swapper.js +52 -0
  9. package/src/client/dom/head-updater.d.ts +42 -0
  10. package/src/client/dom/head-updater.js +194 -0
  11. package/src/client/dom/html-parser.d.ts +4 -0
  12. package/src/client/dom/html-parser.js +8 -0
  13. package/src/client/dom/stylesheet-discovery.d.ts +12 -0
  14. package/src/client/dom/stylesheet-discovery.js +24 -0
  15. package/src/client/dom/stylesheet-preloader.d.ts +10 -0
  16. package/src/client/dom/stylesheet-preloader.js +44 -0
  17. package/src/client/eco-router.d.ts +2 -31
  18. package/src/client/eco-router.js +337 -443
  19. package/src/client/index.d.ts +3 -0
  20. package/src/client/index.js +3 -0
  21. package/src/client/navigation-commit.d.ts +22 -0
  22. package/src/client/navigation-commit.js +104 -0
  23. package/src/client/navigation-fetch.d.ts +8 -0
  24. package/src/client/navigation-fetch.js +24 -0
  25. package/src/client/services/prefetch-manager.d.ts +2 -14
  26. package/src/client/services/prefetch-manager.js +378 -370
  27. package/src/client/services/view-transition-manager.d.ts +6 -2
  28. package/src/client/services/view-transition-manager.js +76 -52
  29. package/src/client/types.d.ts +6 -13
  30. package/src/client/types.js +19 -20
  31. package/src/index.d.ts +3 -5
  32. package/src/index.js +8 -18
  33. package/src/client/services/dom-swapper.d.ts +0 -168
  34. package/src/client/services/dom-swapper.js +0 -529
  35. package/src/client/services/index.d.ts +0 -8
  36. package/src/client/services/index.js +0 -10
  37. package/src/client/services/scroll-manager.d.ts +0 -19
  38. package/src/client/services/scroll-manager.js +0 -36
  39. package/src/client/view-transition-utils.d.ts +0 -14
  40. package/src/client/view-transition-utils.js +0 -60
  41. package/src/styles.css +0 -218
  42. package/src/types.d.ts +0 -15
  43. package/src/types.js +0 -5
package/src/styles.css DELETED
@@ -1,218 +0,0 @@
1
- /**
2
- * Default View Transition CSS for EcoPages transitions
3
- *
4
- * NOTE: This file is not exported from the package.
5
- * JSR does not support CSS exports yet: https://github.com/jsr-io/jsr/issues/293
6
- *
7
- * Use the ecopages npm package instead:
8
- * @import 'ecopages/css/view-transitions.css';
9
- */
10
-
11
- /* Disable root animation to prevent full page flash during transitions */
12
- ::view-transition-old(root),
13
- ::view-transition-new(root) {
14
- animation: none;
15
- }
16
-
17
- /* Shared element transitions animate position/size smoothly */
18
- ::view-transition-group(*) {
19
- animation-duration: 180ms;
20
- animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
21
- }
22
-
23
- /* Prevent transitioning elements from affecting layout of non-transitioning elements */
24
- ::view-transition-image-pair(*) {
25
- isolation: isolate;
26
- }
27
-
28
- /* Respect reduced motion preference */
29
- @media (prefers-reduced-motion: reduce) {
30
- ::view-transition-group(*),
31
- ::view-transition-old(*),
32
- ::view-transition-new(*) {
33
- animation: none !important;
34
- }
35
- }
36
-
37
- @keyframes eco-fade-out {
38
- from {
39
- opacity: 1;
40
- }
41
- to {
42
- opacity: 0;
43
- }
44
- }
45
-
46
- @keyframes eco-fade-in {
47
- from {
48
- opacity: 0;
49
- }
50
- to {
51
- opacity: 1;
52
- }
53
- }
54
-
55
- /* Slide transition for elements with view-transition-name: eco-slide */
56
- ::view-transition-image-pair(eco-slide) {
57
- isolation: isolate;
58
- }
59
-
60
- ::view-transition-old(eco-slide),
61
- ::view-transition-new(eco-slide) {
62
- animation-duration: 180ms;
63
- animation-timing-function: ease-out;
64
- mix-blend-mode: normal;
65
- }
66
-
67
- ::view-transition-old(eco-slide) {
68
- animation-name: eco-slide-out;
69
- }
70
-
71
- ::view-transition-new(eco-slide) {
72
- animation-name: eco-slide-in;
73
- }
74
-
75
- @keyframes eco-slide-out {
76
- from {
77
- opacity: 1;
78
- transform: translateX(0);
79
- }
80
- to {
81
- opacity: 0;
82
- transform: translateX(-30px);
83
- }
84
- }
85
-
86
- @keyframes eco-slide-in {
87
- from {
88
- opacity: 0;
89
- transform: translateX(30px);
90
- }
91
- to {
92
- opacity: 1;
93
- transform: translateX(0);
94
- }
95
- }
96
-
97
- /* Persistent elements should not animate */
98
- [data-eco-persist] {
99
- view-transition-name: none;
100
- }
101
-
102
- /* Declarative transition attributes */
103
- [data-eco-transition='slide'] {
104
- view-transition-name: eco-slide;
105
- }
106
- [data-eco-transition='fade'] {
107
- view-transition-name: eco-fade;
108
- }
109
- [data-eco-transition='zoom'] {
110
- view-transition-name: eco-zoom;
111
- }
112
- [data-eco-transition='slide-up'] {
113
- view-transition-name: eco-slide-up;
114
- }
115
- [data-eco-transition='slide-down'] {
116
- view-transition-name: eco-slide-down;
117
- }
118
-
119
- /* FADE */
120
- ::view-transition-old(eco-fade) {
121
- animation: eco-fade-out 180ms ease-out both;
122
- }
123
- ::view-transition-new(eco-fade) {
124
- animation: eco-fade-in 180ms ease-out both;
125
- }
126
-
127
- /* ZOOM */
128
- ::view-transition-image-pair(eco-zoom) {
129
- isolation: isolate;
130
- }
131
- ::view-transition-old(eco-zoom) {
132
- animation: eco-zoom-out 180ms ease-in both;
133
- }
134
- ::view-transition-new(eco-zoom) {
135
- animation: eco-zoom-in 180ms ease-out both;
136
- }
137
- @keyframes eco-zoom-out {
138
- from {
139
- opacity: 1;
140
- transform: scale(1);
141
- }
142
- to {
143
- opacity: 0;
144
- transform: scale(0.9);
145
- }
146
- }
147
- @keyframes eco-zoom-in {
148
- from {
149
- opacity: 0;
150
- transform: scale(0.9);
151
- }
152
- to {
153
- opacity: 1;
154
- transform: scale(1);
155
- }
156
- }
157
-
158
- /* SLIDE UP */
159
- ::view-transition-image-pair(eco-slide-up) {
160
- isolation: isolate;
161
- }
162
- ::view-transition-old(eco-slide-up) {
163
- animation: eco-slide-up-out 180ms ease-in both;
164
- }
165
- ::view-transition-new(eco-slide-up) {
166
- animation: eco-slide-up-in 180ms ease-out both;
167
- }
168
- @keyframes eco-slide-up-out {
169
- from {
170
- opacity: 1;
171
- transform: translateY(0);
172
- }
173
- to {
174
- opacity: 0;
175
- transform: translateY(-30px);
176
- }
177
- }
178
- @keyframes eco-slide-up-in {
179
- from {
180
- opacity: 0;
181
- transform: translateY(30px);
182
- }
183
- to {
184
- opacity: 1;
185
- transform: translateY(0);
186
- }
187
- }
188
-
189
- /* SLIDE DOWN */
190
- ::view-transition-image-pair(eco-slide-down) {
191
- isolation: isolate;
192
- }
193
- ::view-transition-old(eco-slide-down) {
194
- animation: eco-slide-down-out 180ms ease-in both;
195
- }
196
- ::view-transition-new(eco-slide-down) {
197
- animation: eco-slide-down-in 180ms ease-out both;
198
- }
199
- @keyframes eco-slide-down-out {
200
- from {
201
- opacity: 1;
202
- transform: translateY(0);
203
- }
204
- to {
205
- opacity: 0;
206
- transform: translateY(30px);
207
- }
208
- }
209
- @keyframes eco-slide-down-in {
210
- from {
211
- opacity: 0;
212
- transform: translateY(-30px);
213
- }
214
- to {
215
- opacity: 1;
216
- transform: translateY(0);
217
- }
218
- }
package/src/types.d.ts DELETED
@@ -1,15 +0,0 @@
1
- /**
2
- * Types for the @ecopages/browser-router package
3
- * @module
4
- */
5
- import type { EcoNavigationEvent, EcoBeforeSwapEvent, EcoAfterSwapEvent } from './client/types';
6
- export type { EcoRouterOptions, EcoNavigationEvent, EcoBeforeSwapEvent, EcoAfterSwapEvent } from './client/types';
7
- export { DEFAULT_DOCUMENT_ELEMENT_ATTRIBUTES_TO_SYNC, DEFAULT_OPTIONS } from './client/types';
8
- /**
9
- * Custom event map for navigation lifecycle
10
- */
11
- export interface EcoRouterEventMap {
12
- 'eco:before-swap': CustomEvent<EcoBeforeSwapEvent>;
13
- 'eco:after-swap': CustomEvent<EcoAfterSwapEvent>;
14
- 'eco:page-load': CustomEvent<EcoNavigationEvent>;
15
- }
package/src/types.js DELETED
@@ -1,5 +0,0 @@
1
- import { DEFAULT_DOCUMENT_ELEMENT_ATTRIBUTES_TO_SYNC, DEFAULT_OPTIONS } from "./client/types";
2
- export {
3
- DEFAULT_DOCUMENT_ELEMENT_ATTRIBUTES_TO_SYNC,
4
- DEFAULT_OPTIONS
5
- };