@bquery/bquery 1.3.0 → 1.5.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 (138) hide show
  1. package/README.md +546 -501
  2. package/dist/component/component.d.ts.map +1 -1
  3. package/dist/component/index.d.ts +2 -0
  4. package/dist/component/index.d.ts.map +1 -1
  5. package/dist/component/library.d.ts +34 -0
  6. package/dist/component/library.d.ts.map +1 -0
  7. package/dist/component/types.d.ts +10 -6
  8. package/dist/component/types.d.ts.map +1 -1
  9. package/dist/component-CY5MVoYN.js +531 -0
  10. package/dist/component-CY5MVoYN.js.map +1 -0
  11. package/dist/component.es.mjs +6 -184
  12. package/dist/config-DRmZZno3.js +40 -0
  13. package/dist/config-DRmZZno3.js.map +1 -0
  14. package/dist/core/collection.d.ts +19 -3
  15. package/dist/core/collection.d.ts.map +1 -1
  16. package/dist/core/element.d.ts +23 -4
  17. package/dist/core/element.d.ts.map +1 -1
  18. package/dist/core/index.d.ts +1 -0
  19. package/dist/core/index.d.ts.map +1 -1
  20. package/dist/core/utils/function.d.ts +21 -4
  21. package/dist/core/utils/function.d.ts.map +1 -1
  22. package/dist/core-CK2Mfpf4.js +648 -0
  23. package/dist/core-CK2Mfpf4.js.map +1 -0
  24. package/dist/core-DPdbItcq.js +112 -0
  25. package/dist/core-DPdbItcq.js.map +1 -0
  26. package/dist/core.es.mjs +45 -1218
  27. package/dist/full.d.ts +6 -6
  28. package/dist/full.d.ts.map +1 -1
  29. package/dist/full.es.mjs +98 -92
  30. package/dist/full.iife.js +173 -3
  31. package/dist/full.iife.js.map +1 -1
  32. package/dist/full.umd.js +173 -3
  33. package/dist/full.umd.js.map +1 -1
  34. package/dist/index.es.mjs +143 -139
  35. package/dist/motion/transition.d.ts +1 -1
  36. package/dist/motion/transition.d.ts.map +1 -1
  37. package/dist/motion/types.d.ts +11 -1
  38. package/dist/motion/types.d.ts.map +1 -1
  39. package/dist/motion-C5DRdPnO.js +415 -0
  40. package/dist/motion-C5DRdPnO.js.map +1 -0
  41. package/dist/motion.es.mjs +25 -361
  42. package/dist/object-qGpWr6-J.js +38 -0
  43. package/dist/object-qGpWr6-J.js.map +1 -0
  44. package/dist/platform/announcer.d.ts +59 -0
  45. package/dist/platform/announcer.d.ts.map +1 -0
  46. package/dist/platform/config.d.ts +92 -0
  47. package/dist/platform/config.d.ts.map +1 -0
  48. package/dist/platform/cookies.d.ts +45 -0
  49. package/dist/platform/cookies.d.ts.map +1 -0
  50. package/dist/platform/index.d.ts +8 -0
  51. package/dist/platform/index.d.ts.map +1 -1
  52. package/dist/platform/meta.d.ts +62 -0
  53. package/dist/platform/meta.d.ts.map +1 -0
  54. package/dist/platform/storage.d.ts.map +1 -1
  55. package/dist/platform-B7JhGBc7.js +361 -0
  56. package/dist/platform-B7JhGBc7.js.map +1 -0
  57. package/dist/platform.es.mjs +11 -243
  58. package/dist/reactive/async-data.d.ts +114 -0
  59. package/dist/reactive/async-data.d.ts.map +1 -0
  60. package/dist/reactive/core.d.ts +12 -0
  61. package/dist/reactive/core.d.ts.map +1 -1
  62. package/dist/reactive/effect.d.ts.map +1 -1
  63. package/dist/reactive/index.d.ts +2 -2
  64. package/dist/reactive/index.d.ts.map +1 -1
  65. package/dist/reactive/internals.d.ts +6 -0
  66. package/dist/reactive/internals.d.ts.map +1 -1
  67. package/dist/reactive/signal.d.ts +2 -0
  68. package/dist/reactive/signal.d.ts.map +1 -1
  69. package/dist/reactive-BDya-ia8.js +253 -0
  70. package/dist/reactive-BDya-ia8.js.map +1 -0
  71. package/dist/reactive.es.mjs +18 -34
  72. package/dist/router-CijiICxt.js +188 -0
  73. package/dist/router-CijiICxt.js.map +1 -0
  74. package/dist/router.es.mjs +11 -200
  75. package/dist/sanitize-jyJ2ryE2.js +302 -0
  76. package/dist/sanitize-jyJ2ryE2.js.map +1 -0
  77. package/dist/security/constants.d.ts.map +1 -1
  78. package/dist/security/sanitize-core.d.ts.map +1 -1
  79. package/dist/security.es.mjs +10 -56
  80. package/dist/store-CPK9E62U.js +262 -0
  81. package/dist/store-CPK9E62U.js.map +1 -0
  82. package/dist/store.es.mjs +12 -25
  83. package/dist/view/evaluate.d.ts.map +1 -1
  84. package/dist/view-Cdi0g-qo.js +396 -0
  85. package/dist/view-Cdi0g-qo.js.map +1 -0
  86. package/dist/view.es.mjs +10 -424
  87. package/package.json +136 -132
  88. package/src/component/component.ts +319 -289
  89. package/src/component/index.ts +42 -40
  90. package/src/component/library.ts +504 -0
  91. package/src/component/types.ts +91 -85
  92. package/src/core/collection.ts +44 -4
  93. package/src/core/element.ts +33 -5
  94. package/src/core/index.ts +1 -0
  95. package/src/core/utils/function.ts +56 -15
  96. package/src/full.ts +223 -187
  97. package/src/motion/transition.ts +97 -51
  98. package/src/motion/types.ts +208 -198
  99. package/src/platform/announcer.ts +208 -0
  100. package/src/platform/config.ts +163 -0
  101. package/src/platform/cookies.ts +165 -0
  102. package/src/platform/index.ts +39 -18
  103. package/src/platform/meta.ts +168 -0
  104. package/src/platform/storage.ts +8 -1
  105. package/src/reactive/async-data.ts +486 -0
  106. package/src/reactive/core.ts +21 -0
  107. package/src/reactive/effect.ts +18 -7
  108. package/src/reactive/index.ts +37 -23
  109. package/src/reactive/internals.ts +18 -1
  110. package/src/reactive/signal.ts +29 -20
  111. package/src/security/constants.ts +211 -209
  112. package/src/security/sanitize-core.ts +22 -1
  113. package/src/view/evaluate.ts +29 -13
  114. package/dist/batch-4LAvfLE7.js +0 -13
  115. package/dist/batch-4LAvfLE7.js.map +0 -1
  116. package/dist/component.es.mjs.map +0 -1
  117. package/dist/core-COenAZjD.js +0 -145
  118. package/dist/core-COenAZjD.js.map +0 -1
  119. package/dist/core.es.mjs.map +0 -1
  120. package/dist/full.es.mjs.map +0 -1
  121. package/dist/index.es.mjs.map +0 -1
  122. package/dist/motion.es.mjs.map +0 -1
  123. package/dist/persisted-Dz_ryNuC.js +0 -278
  124. package/dist/persisted-Dz_ryNuC.js.map +0 -1
  125. package/dist/platform.es.mjs.map +0 -1
  126. package/dist/reactive.es.mjs.map +0 -1
  127. package/dist/router.es.mjs.map +0 -1
  128. package/dist/sanitize-1FBEPAFH.js +0 -272
  129. package/dist/sanitize-1FBEPAFH.js.map +0 -1
  130. package/dist/security.es.mjs.map +0 -1
  131. package/dist/store.es.mjs.map +0 -1
  132. package/dist/type-guards-DRma3-Kc.js +0 -16
  133. package/dist/type-guards-DRma3-Kc.js.map +0 -1
  134. package/dist/untrack-BuEQKH7_.js +0 -6
  135. package/dist/untrack-BuEQKH7_.js.map +0 -1
  136. package/dist/view.es.mjs.map +0 -1
  137. package/dist/watch-CXyaBC_9.js +0 -58
  138. package/dist/watch-CXyaBC_9.js.map +0 -1
package/src/full.ts CHANGED
@@ -1,187 +1,223 @@
1
- /**
2
- * bQuery.js — Full Bundle
3
- *
4
- * This is the complete bundle containing all modules for CDN usage.
5
- * Use this when you want all features without tree-shaking concerns.
6
- *
7
- * @module bquery/full
8
- *
9
- * @example CDN Usage (ES Modules)
10
- * ```html
11
- * <script type="module">
12
- * import { $, signal, component } from 'https://unpkg.com/bquery@1/dist/full.es.mjs';
13
- *
14
- * const count = signal(0);
15
- * $('#counter').text(count.value);
16
- * </script>
17
- * ```
18
- *
19
- * @example CDN Usage (UMD/Global)
20
- * ```html
21
- * <script src="https://unpkg.com/bquery@1/dist/full.umd.js"></script>
22
- * <script>
23
- * const { $, signal } = bQuery;
24
- * const count = signal(0);
25
- * </script>
26
- * ```
27
- *
28
- * @example CDN Usage (IIFE)
29
- * ```html
30
- * <script src="https://unpkg.com/bquery@1/dist/full.iife.js"></script>
31
- * <script>
32
- * // bQuery is available as a global variable
33
- * const { $, $$ } = bQuery;
34
- * </script>
35
- * ```
36
- */
37
-
38
- // ============================================================================
39
- // Core Module: Selectors, DOM operations, events, utilities
40
- // ============================================================================
41
- export { $, $$, BQueryCollection, BQueryElement, utils } from './core/index';
42
-
43
- // ============================================================================
44
- // Reactive Module: Signals, computed values, effects, batching
45
- // ============================================================================
46
- export {
47
- Computed,
48
- Signal,
49
- batch,
50
- computed,
51
- effect,
52
- isComputed,
53
- isSignal,
54
- persistedSignal,
55
- readonly,
56
- signal,
57
- untrack,
58
- watch,
59
- } from './reactive/index';
60
- export type { CleanupFn, Observer, ReadonlySignal } from './reactive/index';
61
-
62
- // ============================================================================
63
- // Component Module: Web Components helper with Shadow DOM
64
- // ============================================================================
65
- export { component, html, safeHtml } from './component/index';
66
- export type { ComponentDefinition, PropDefinition } from './component/index';
67
-
68
- // ============================================================================
69
- // Motion Module: View transitions, FLIP animations, springs
70
- // ============================================================================
71
- export {
72
- animate,
73
- capturePosition,
74
- easeInCubic,
75
- easeInOutCubic,
76
- easeInOutQuad,
77
- easeInQuad,
78
- easeOutBack,
79
- easeOutCubic,
80
- easeOutExpo,
81
- easeOutQuad,
82
- easingPresets,
83
- flip,
84
- flipElements,
85
- flipList,
86
- keyframePresets,
87
- linear,
88
- prefersReducedMotion,
89
- scrollAnimate,
90
- sequence,
91
- spring,
92
- springPresets,
93
- stagger,
94
- timeline,
95
- transition,
96
- } from './motion/index';
97
- export type {
98
- AnimateOptions,
99
- EasingFunction,
100
- ElementBounds,
101
- FlipGroupOptions,
102
- FlipOptions,
103
- ScrollAnimateCleanup,
104
- ScrollAnimateOptions,
105
- SequenceOptions,
106
- SequenceStep,
107
- Spring,
108
- SpringConfig,
109
- StaggerFunction,
110
- StaggerOptions,
111
- TimelineConfig,
112
- TimelineControls,
113
- TimelineStep,
114
- TransitionOptions,
115
- } from './motion/index';
116
-
117
- // ============================================================================
118
- // Security Module: Sanitization, CSP compatibility, Trusted Types
119
- // ============================================================================
120
- export {
121
- createTrustedHtml,
122
- escapeHtml,
123
- generateNonce,
124
- getTrustedTypesPolicy,
125
- hasCSPDirective,
126
- isTrustedTypesSupported,
127
- sanitize,
128
- sanitizeHtml,
129
- stripTags,
130
- } from './security/index';
131
- export type { SanitizeOptions } from './security/index';
132
-
133
- // ============================================================================
134
- // Platform Module: Storage, buckets, notifications, cache
135
- // ============================================================================
136
- export { buckets, cache, notifications, storage } from './platform/index';
137
- export type {
138
- Bucket,
139
- CacheHandle,
140
- IndexedDBOptions,
141
- NotificationOptions,
142
- StorageAdapter,
143
- } from './platform/index';
144
-
145
- // ============================================================================
146
- // Router Module: SPA routing, navigation guards, lazy loading
147
- // ============================================================================
148
- export {
149
- back,
150
- createRouter,
151
- currentRoute,
152
- forward,
153
- interceptLinks,
154
- isActive,
155
- isActiveSignal,
156
- link,
157
- navigate,
158
- resolve,
159
- } from './router/index';
160
- export type {
161
- NavigationGuard,
162
- Route,
163
- RouteDefinition,
164
- Router,
165
- RouterOptions,
166
- } from './router/index';
167
-
168
- // ============================================================================
169
- // Store Module: Signal-based state management
170
- // ============================================================================
171
- export {
172
- createPersistedStore,
173
- createStore,
174
- destroyStore,
175
- getStore,
176
- listStores,
177
- mapActions,
178
- mapState,
179
- registerPlugin,
180
- } from './store/index';
181
- export type { StateFactory, Store, StoreDefinition, StorePlugin } from './store/index';
182
-
183
- // ============================================================================
184
- // View Module: Declarative DOM bindings without compiler
185
- // ============================================================================
186
- export { createTemplate, mount } from './view/index';
187
- export type { BindingContext, MountOptions, View } from './view/index';
1
+ /**
2
+ * bQuery.js — Full Bundle
3
+ *
4
+ * This is the complete bundle containing all modules for CDN usage.
5
+ * Use this when you want all features without tree-shaking concerns.
6
+ *
7
+ * @module bquery/full
8
+ *
9
+ * @example CDN Usage (ES Modules)
10
+ * ```html
11
+ * <script type="module">
12
+ * import { $, signal, component } from 'https://unpkg.com/bquery@1/dist/full.es.mjs';
13
+ *
14
+ * const count = signal(0);
15
+ * $('#counter').text(count.value);
16
+ * </script>
17
+ * ```
18
+ *
19
+ * @example CDN Usage (UMD/Global)
20
+ * ```html
21
+ * <script src="https://unpkg.com/bquery@1/dist/full.umd.js"></script>
22
+ * <script>
23
+ * const { $, signal } = bQuery;
24
+ * const count = signal(0);
25
+ * </script>
26
+ * ```
27
+ *
28
+ * @example CDN Usage (IIFE)
29
+ * ```html
30
+ * <script src="https://unpkg.com/bquery@1/dist/full.iife.js"></script>
31
+ * <script>
32
+ * // bQuery is available as a global variable
33
+ * const { $, $$ } = bQuery;
34
+ * </script>
35
+ * ```
36
+ */
37
+
38
+ // ============================================================================
39
+ // Core Module: Selectors, DOM operations, events, utilities
40
+ // ============================================================================
41
+ export { $, $$, BQueryCollection, BQueryElement, utils } from './core/index';
42
+
43
+ // ============================================================================
44
+ // Reactive Module: Signals, computed values, effects, batching
45
+ // ============================================================================
46
+ export {
47
+ Computed,
48
+ Signal,
49
+ batch,
50
+ computed,
51
+ createUseFetch,
52
+ effect,
53
+ isComputed,
54
+ isSignal,
55
+ linkedSignal,
56
+ persistedSignal,
57
+ readonly,
58
+ signal,
59
+ useAsyncData,
60
+ useFetch,
61
+ untrack,
62
+ watch,
63
+ } from './reactive/index';
64
+ export type {
65
+ AsyncDataState,
66
+ AsyncDataStatus,
67
+ AsyncWatchSource,
68
+ CleanupFn,
69
+ FetchInput,
70
+ LinkedSignal,
71
+ Observer,
72
+ ReadonlySignal,
73
+ UseAsyncDataOptions,
74
+ UseFetchOptions,
75
+ } from './reactive/index';
76
+
77
+ // ============================================================================
78
+ // Component Module: Web Components helper with Shadow DOM
79
+ // ============================================================================
80
+ export { component, html, registerDefaultComponents, safeHtml } from './component/index';
81
+ export type {
82
+ ComponentDefinition,
83
+ DefaultComponentLibraryOptions,
84
+ PropDefinition,
85
+ RegisteredDefaultComponents,
86
+ } from './component/index';
87
+
88
+ // ============================================================================
89
+ // Motion Module: View transitions, FLIP animations, springs
90
+ // ============================================================================
91
+ export {
92
+ animate,
93
+ capturePosition,
94
+ easeInCubic,
95
+ easeInOutCubic,
96
+ easeInOutQuad,
97
+ easeInQuad,
98
+ easeOutBack,
99
+ easeOutCubic,
100
+ easeOutExpo,
101
+ easeOutQuad,
102
+ easingPresets,
103
+ flip,
104
+ flipElements,
105
+ flipList,
106
+ keyframePresets,
107
+ linear,
108
+ prefersReducedMotion,
109
+ scrollAnimate,
110
+ sequence,
111
+ spring,
112
+ springPresets,
113
+ stagger,
114
+ timeline,
115
+ transition,
116
+ } from './motion/index';
117
+ export type {
118
+ AnimateOptions,
119
+ EasingFunction,
120
+ ElementBounds,
121
+ FlipGroupOptions,
122
+ FlipOptions,
123
+ ScrollAnimateCleanup,
124
+ ScrollAnimateOptions,
125
+ SequenceOptions,
126
+ SequenceStep,
127
+ Spring,
128
+ SpringConfig,
129
+ StaggerFunction,
130
+ StaggerOptions,
131
+ TimelineConfig,
132
+ TimelineControls,
133
+ TimelineStep,
134
+ TransitionOptions,
135
+ } from './motion/index';
136
+
137
+ // ============================================================================
138
+ // Security Module: Sanitization, CSP compatibility, Trusted Types
139
+ // ============================================================================
140
+ export {
141
+ createTrustedHtml,
142
+ escapeHtml,
143
+ generateNonce,
144
+ getTrustedTypesPolicy,
145
+ hasCSPDirective,
146
+ isTrustedTypesSupported,
147
+ sanitize,
148
+ sanitizeHtml,
149
+ stripTags,
150
+ } from './security/index';
151
+ export type { SanitizeOptions } from './security/index';
152
+
153
+ // ============================================================================
154
+ // Platform Module: Storage, buckets, notifications, cache
155
+ // ============================================================================
156
+ export {
157
+ buckets,
158
+ cache,
159
+ defineBqueryConfig,
160
+ definePageMeta,
161
+ getBqueryConfig,
162
+ notifications,
163
+ storage,
164
+ useAnnouncer,
165
+ useCookie,
166
+ } from './platform/index';
167
+ export type {
168
+ AnnounceOptions,
169
+ AnnouncerHandle,
170
+ Bucket,
171
+ BqueryConfig,
172
+ CacheHandle,
173
+ IndexedDBOptions,
174
+ NotificationOptions,
175
+ PageMetaDefinition,
176
+ StorageAdapter,
177
+ UseAnnouncerOptions,
178
+ UseCookieOptions,
179
+ } from './platform/index';
180
+
181
+ // ============================================================================
182
+ // Router Module: SPA routing, navigation guards, lazy loading
183
+ // ============================================================================
184
+ export {
185
+ back,
186
+ createRouter,
187
+ currentRoute,
188
+ forward,
189
+ interceptLinks,
190
+ isActive,
191
+ isActiveSignal,
192
+ link,
193
+ navigate,
194
+ resolve,
195
+ } from './router/index';
196
+ export type {
197
+ NavigationGuard,
198
+ Route,
199
+ RouteDefinition,
200
+ Router,
201
+ RouterOptions,
202
+ } from './router/index';
203
+
204
+ // ============================================================================
205
+ // Store Module: Signal-based state management
206
+ // ============================================================================
207
+ export {
208
+ createPersistedStore,
209
+ createStore,
210
+ destroyStore,
211
+ getStore,
212
+ listStores,
213
+ mapActions,
214
+ mapState,
215
+ registerPlugin,
216
+ } from './store/index';
217
+ export type { StateFactory, Store, StoreDefinition, StorePlugin } from './store/index';
218
+
219
+ // ============================================================================
220
+ // View Module: Declarative DOM bindings without compiler
221
+ // ============================================================================
222
+ export { createTemplate, mount } from './view/index';
223
+ export type { BindingContext, MountOptions, View } from './view/index';
@@ -1,51 +1,97 @@
1
- /**
2
- * View transition helpers.
3
- *
4
- * @module bquery/motion
5
- */
6
-
7
- import type { TransitionOptions } from './types';
8
-
9
- /** Extended document type with View Transitions API */
10
- type DocumentWithTransition = Document & {
11
- startViewTransition?: (callback: () => void) => {
12
- finished: Promise<void>;
13
- ready: Promise<void>;
14
- updateCallbackDone: Promise<void>;
15
- };
16
- };
17
-
18
- /**
19
- * Execute a DOM update with view transition animation.
20
- * Falls back to immediate update when View Transitions API is unavailable.
21
- *
22
- * @param updateOrOptions - Update function or options object
23
- * @returns Promise that resolves when transition completes
24
- *
25
- * @example
26
- * ```ts
27
- * await transition(() => {
28
- * $('#content').text('Updated');
29
- * });
30
- * ```
31
- */
32
- export const transition = async (
33
- updateOrOptions: (() => void) | TransitionOptions
34
- ): Promise<void> => {
35
- const update = typeof updateOrOptions === 'function' ? updateOrOptions : updateOrOptions.update;
36
-
37
- // SSR/non-DOM environment fallback
38
- if (typeof document === 'undefined') {
39
- update();
40
- return;
41
- }
42
-
43
- const doc = document as DocumentWithTransition;
44
-
45
- if (doc.startViewTransition) {
46
- await doc.startViewTransition(() => update()).finished;
47
- return;
48
- }
49
-
50
- update();
51
- };
1
+ /**
2
+ * View transition helpers.
3
+ *
4
+ * @module bquery/motion
5
+ */
6
+
7
+ import type { TransitionOptions } from './types';
8
+ import { prefersReducedMotion } from './reduced-motion';
9
+ import { getBqueryConfig } from '../platform/config';
10
+
11
+ /** Extended document type with View Transitions API */
12
+ type DocumentWithTransition = Document & {
13
+ startViewTransition?: (callback: () => void | Promise<void>) => {
14
+ finished: Promise<void>;
15
+ ready: Promise<void>;
16
+ updateCallbackDone: Promise<void>;
17
+ skipTransition?: () => void;
18
+ types?: {
19
+ add: (type: string) => void;
20
+ };
21
+ };
22
+ };
23
+
24
+ const sanitizeTokens = (tokens?: string[]): string[] =>
25
+ (tokens ?? []).map((token) => token.trim()).filter((token) => token.length > 0);
26
+
27
+ /**
28
+ * Execute a DOM update with view transition animation.
29
+ * Falls back to immediate update when View Transitions API is unavailable.
30
+ *
31
+ * @param updateOrOptions - Update function or options object
32
+ * @returns Promise that resolves when transition completes
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * await transition(() => {
37
+ * $('#content').text('Updated');
38
+ * });
39
+ * ```
40
+ */
41
+ export const transition = async (
42
+ updateOrOptions: (() => void | Promise<void>) | TransitionOptions
43
+ ): Promise<void> => {
44
+ const config = getBqueryConfig().transitions;
45
+ const options: TransitionOptions =
46
+ typeof updateOrOptions === 'function'
47
+ ? {
48
+ update: updateOrOptions,
49
+ classes: config?.classes,
50
+ types: config?.types,
51
+ skipOnReducedMotion: config?.skipOnReducedMotion,
52
+ }
53
+ : {
54
+ ...updateOrOptions,
55
+ classes: updateOrOptions.classes ?? config?.classes,
56
+ types: updateOrOptions.types ?? config?.types,
57
+ skipOnReducedMotion: updateOrOptions.skipOnReducedMotion ?? config?.skipOnReducedMotion,
58
+ };
59
+ const update = options.update;
60
+
61
+ // SSR/non-DOM environment fallback
62
+ if (typeof document === 'undefined') {
63
+ await update();
64
+ return;
65
+ }
66
+
67
+ const doc = document as DocumentWithTransition;
68
+ const root = document.documentElement;
69
+ const classes = sanitizeTokens(options.classes);
70
+ const types = sanitizeTokens(options.types);
71
+
72
+ if (!doc.startViewTransition || (options.skipOnReducedMotion && prefersReducedMotion())) {
73
+ await update();
74
+ options.onFinish?.();
75
+ return;
76
+ }
77
+
78
+ classes.forEach((className: string) => root.classList.add(className));
79
+
80
+ try {
81
+ const viewTransition = doc.startViewTransition(() => update());
82
+ const transitionTypes = viewTransition.types;
83
+
84
+ if (transitionTypes) {
85
+ for (const type of types) {
86
+ transitionTypes.add(type);
87
+ }
88
+ }
89
+
90
+ await viewTransition.ready;
91
+ options.onReady?.();
92
+ await viewTransition.finished;
93
+ options.onFinish?.();
94
+ } finally {
95
+ classes.forEach((className: string) => root.classList.remove(className));
96
+ }
97
+ };