kiru 1.0.1 → 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 (145) hide show
  1. package/dist/appHandle.js +2 -2
  2. package/dist/appHandle.js.map +1 -1
  3. package/dist/components/lazy.d.ts.map +1 -1
  4. package/dist/components/lazy.js +2 -2
  5. package/dist/components/lazy.js.map +1 -1
  6. package/dist/components/transition.js +1 -5
  7. package/dist/components/transition.js.map +1 -1
  8. package/dist/devtools.d.ts.map +1 -1
  9. package/dist/devtools.js +6 -2
  10. package/dist/devtools.js.map +1 -1
  11. package/dist/dom/commit.d.ts +5 -0
  12. package/dist/dom/commit.d.ts.map +1 -0
  13. package/dist/dom/commit.js +94 -0
  14. package/dist/dom/commit.js.map +1 -0
  15. package/dist/dom/focus.d.ts +4 -0
  16. package/dist/dom/focus.d.ts.map +1 -0
  17. package/dist/dom/focus.js +32 -0
  18. package/dist/dom/focus.js.map +1 -0
  19. package/dist/dom/index.d.ts +4 -0
  20. package/dist/dom/index.d.ts.map +1 -0
  21. package/dist/dom/index.js +4 -0
  22. package/dist/dom/index.js.map +1 -0
  23. package/dist/dom/nodes.d.ts +12 -0
  24. package/dist/dom/nodes.d.ts.map +1 -0
  25. package/dist/dom/nodes.js +165 -0
  26. package/dist/dom/nodes.js.map +1 -0
  27. package/dist/dom/props.d.ts +8 -0
  28. package/dist/dom/props.d.ts.map +1 -0
  29. package/dist/dom/props.js +675 -0
  30. package/dist/dom/props.js.map +1 -0
  31. package/dist/env.d.ts +2 -0
  32. package/dist/env.d.ts.map +1 -1
  33. package/dist/env.js +2 -0
  34. package/dist/env.js.map +1 -1
  35. package/dist/globalContext.d.ts +3 -8
  36. package/dist/globalContext.d.ts.map +1 -1
  37. package/dist/globalContext.js +4 -16
  38. package/dist/globalContext.js.map +1 -1
  39. package/dist/globals.d.ts +21 -1
  40. package/dist/globals.d.ts.map +1 -1
  41. package/dist/globals.js +22 -2
  42. package/dist/globals.js.map +1 -1
  43. package/dist/hmr.d.ts +17 -2
  44. package/dist/hmr.d.ts.map +1 -1
  45. package/dist/hmr.js +31 -5
  46. package/dist/hmr.js.map +1 -1
  47. package/dist/hooks/index.d.ts +1 -0
  48. package/dist/hooks/index.d.ts.map +1 -1
  49. package/dist/hooks/index.js +1 -0
  50. package/dist/hooks/index.js.map +1 -1
  51. package/dist/hooks/onBeforeMount.d.ts +1 -1
  52. package/dist/hooks/onBeforeMount.d.ts.map +1 -1
  53. package/dist/hooks/onBeforeMount.js +10 -3
  54. package/dist/hooks/onBeforeMount.js.map +1 -1
  55. package/dist/hooks/onCleanup.d.ts +1 -1
  56. package/dist/hooks/onCleanup.d.ts.map +1 -1
  57. package/dist/hooks/onCleanup.js +7 -4
  58. package/dist/hooks/onCleanup.js.map +1 -1
  59. package/dist/hooks/onMount.d.ts +2 -2
  60. package/dist/hooks/onMount.d.ts.map +1 -1
  61. package/dist/hooks/onMount.js +11 -4
  62. package/dist/hooks/onMount.js.map +1 -1
  63. package/dist/hooks/setup.d.ts +13 -0
  64. package/dist/hooks/setup.d.ts.map +1 -0
  65. package/dist/hooks/setup.js +54 -0
  66. package/dist/hooks/setup.js.map +1 -0
  67. package/dist/hooks/utils.d.ts +2 -3
  68. package/dist/hooks/utils.d.ts.map +1 -1
  69. package/dist/hooks/utils.js +9 -14
  70. package/dist/hooks/utils.js.map +1 -1
  71. package/dist/index.d.ts +1 -0
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +4 -3
  74. package/dist/index.js.map +1 -1
  75. package/dist/reconciler.js +3 -3
  76. package/dist/reconciler.js.map +1 -1
  77. package/dist/router/head.js +2 -2
  78. package/dist/router/head.js.map +1 -1
  79. package/dist/router/pageConfig.js +2 -2
  80. package/dist/router/pageConfig.js.map +1 -1
  81. package/dist/scheduler.js +62 -57
  82. package/dist/scheduler.js.map +1 -1
  83. package/dist/signals/base.js +3 -3
  84. package/dist/signals/base.js.map +1 -1
  85. package/dist/signals/effect.d.ts.map +1 -1
  86. package/dist/signals/effect.js +6 -6
  87. package/dist/signals/effect.js.map +1 -1
  88. package/dist/signals/tracking.d.ts +3 -2
  89. package/dist/signals/tracking.d.ts.map +1 -1
  90. package/dist/signals/tracking.js.map +1 -1
  91. package/dist/statefulPromise.js +2 -2
  92. package/dist/statefulPromise.js.map +1 -1
  93. package/dist/types.d.ts +5 -1
  94. package/dist/types.d.ts.map +1 -1
  95. package/dist/types.dom.d.ts +1 -1
  96. package/dist/types.dom.d.ts.map +1 -1
  97. package/dist/utils/format.d.ts.map +1 -1
  98. package/dist/utils/format.js +4 -1
  99. package/dist/utils/format.js.map +1 -1
  100. package/dist/utils/vdom.d.ts +2 -2
  101. package/dist/utils/vdom.d.ts.map +1 -1
  102. package/dist/utils/vdom.js +2 -2
  103. package/dist/utils/vdom.js.map +1 -1
  104. package/dist/viewTransitions.d.ts.map +1 -1
  105. package/dist/viewTransitions.js +2 -1
  106. package/dist/viewTransitions.js.map +1 -1
  107. package/package.json +1 -1
  108. package/src/appHandle.ts +2 -2
  109. package/src/components/lazy.ts +5 -6
  110. package/src/components/transition.ts +2 -6
  111. package/src/devtools.ts +4 -2
  112. package/src/dom/commit.ts +133 -0
  113. package/src/dom/focus.ts +34 -0
  114. package/src/dom/index.ts +3 -0
  115. package/src/dom/nodes.ts +204 -0
  116. package/src/dom/props.ts +818 -0
  117. package/src/env.ts +3 -0
  118. package/src/globalContext.ts +7 -24
  119. package/src/globals.ts +25 -2
  120. package/src/hmr.ts +32 -5
  121. package/src/hooks/index.ts +1 -0
  122. package/src/hooks/onBeforeMount.ts +9 -3
  123. package/src/hooks/onCleanup.ts +10 -4
  124. package/src/hooks/onMount.ts +10 -4
  125. package/src/hooks/setup.ts +70 -0
  126. package/src/hooks/utils.ts +14 -19
  127. package/src/index.ts +4 -2
  128. package/src/reconciler.ts +3 -3
  129. package/src/router/head.ts +2 -2
  130. package/src/router/pageConfig.ts +2 -2
  131. package/src/scheduler.ts +79 -64
  132. package/src/signals/base.ts +3 -3
  133. package/src/signals/effect.ts +5 -7
  134. package/src/signals/tracking.ts +3 -2
  135. package/src/statefulPromise.ts +2 -2
  136. package/src/types.dom.ts +2 -2
  137. package/src/types.ts +7 -1
  138. package/src/utils/format.ts +3 -1
  139. package/src/utils/vdom.ts +2 -2
  140. package/src/viewTransitions.ts +2 -1
  141. package/dist/dom.d.ts +0 -10
  142. package/dist/dom.d.ts.map +0 -1
  143. package/dist/dom.js +0 -601
  144. package/dist/dom.js.map +0 -1
  145. package/src/dom.ts +0 -775
package/src/scheduler.ts CHANGED
@@ -6,18 +6,13 @@ import {
6
6
  FLAG_DIRTY,
7
7
  } from "./constants.js"
8
8
  import {
9
+ captureFocus,
9
10
  commitDeletion,
10
11
  commitWork,
11
12
  createDom,
12
13
  hydrateDom,
13
- onAfterFlushDomChanges,
14
- onBeforeFlushDomChanges,
15
- } from "./dom.js"
16
- import { __DEV__ } from "./env.js"
17
- import { KiruError } from "./error.js"
18
- import { node, renderMode } from "./globals.js"
19
- import { hydrationStack } from "./hydration.js"
20
- import { reconcileChildren } from "./reconciler.js"
14
+ reinstateFocus,
15
+ } from "./dom/index.js"
21
16
  import {
22
17
  assertValidElementProps,
23
18
  latest,
@@ -28,8 +23,13 @@ import {
28
23
  call,
29
24
  propsChanged,
30
25
  } from "./utils/index.js"
31
- import type { AppHandle } from "./appHandle"
26
+ import { __DEV__ } from "./env.js"
27
+ import { KiruError } from "./error.js"
28
+ import { node, postEffectCleanups, renderMode, setups } from "./globals.js"
29
+ import { hydrationStack } from "./hydration.js"
30
+ import { reconcileChildren } from "./reconciler.js"
32
31
  import { isHmrUpdate } from "./hmr.js"
32
+ import type { AppHandle } from "./appHandle"
33
33
 
34
34
  type VNode = Kiru.VNode
35
35
 
@@ -93,21 +93,8 @@ export function useRequestUpdate(): () => void {
93
93
  return () => requestUpdate(n)
94
94
  }
95
95
 
96
- function queueBeginWork(): void {
97
- if (isRunningOrQueued) return
98
- isRunningOrQueued = true
99
- animationFrameHandle = window.requestAnimationFrame(doWork)
100
- }
101
-
102
- function onWorkFinished(): void {
103
- isRunningOrQueued = false
104
- while (nextIdleEffects.length) {
105
- nextIdleEffects.shift()!()
106
- }
107
- }
108
-
109
96
  function queueUpdate(vNode: VNode): void {
110
- // In immediate effect mode (useLayoutEffect), immediately mark the render as dirty
97
+ // In immediate effect mode (onBeforeMount), immediately mark the render as dirty
111
98
  if (isImmediateEffectsMode) {
112
99
  immediateEffectDirtiedRender = true
113
100
  }
@@ -126,7 +113,12 @@ function queueUpdate(vNode: VNode): void {
126
113
 
127
114
  if (!treesInProgress.length) {
128
115
  treesInProgress.push(vNode)
129
- return queueBeginWork()
116
+
117
+ if (!isRunningOrQueued) {
118
+ isRunningOrQueued = true
119
+ animationFrameHandle = window.requestAnimationFrame(doWork)
120
+ }
121
+ return
130
122
  }
131
123
 
132
124
  treesInProgress.push(vNode)
@@ -154,7 +146,7 @@ function doWork(): void {
154
146
 
155
147
  let len = 1
156
148
 
157
- onBeforeFlushDomChanges()
149
+ captureFocus()
158
150
  while (treesInProgress.length) {
159
151
  if (treesInProgress.length > len) {
160
152
  treesInProgress.sort(depthSort)
@@ -177,7 +169,7 @@ function doWork(): void {
177
169
  currentWorkRoot.flags &= ~FLAG_DIRTY
178
170
  }
179
171
  }
180
- onAfterFlushDomChanges()
172
+ reinstateFocus()
181
173
 
182
174
  isImmediateEffectsMode = true
183
175
  flushEffects(preEffects)
@@ -196,8 +188,14 @@ function doWork(): void {
196
188
  }
197
189
  consecutiveDirtyCount = 0
198
190
 
199
- onWorkFinished()
200
- queueMicrotask(() => flushEffects(postEffects))
191
+ isRunningOrQueued = false
192
+ while (nextIdleEffects.length) {
193
+ nextIdleEffects.shift()!()
194
+ }
195
+ queueMicrotask(() => {
196
+ flushEffects(postEffectCleanups)
197
+ flushEffects(postEffects)
198
+ })
201
199
  if (__DEV__) {
202
200
  window.__kiru.emit("update", app!)
203
201
  window.__kiru.profilingContext?.emit("update", app!)
@@ -324,6 +322,9 @@ function updateExoticComponent(vNode: VNode): VNode | null {
324
322
  function updateFunctionComponent(vNode: FunctionVNode): VNode | null {
325
323
  const { type, props, subs } = vNode
326
324
 
325
+ /** Only sync prop-derived signals when update came from parent (new props), not from internal subscription (e.g. signal). */
326
+ const shouldSyncProps = (vNode.flags & FLAG_DIRTY) === 0
327
+
327
328
  try {
328
329
  node.current = vNode
329
330
  let newChild
@@ -346,34 +347,26 @@ function updateFunctionComponent(vNode: FunctionVNode): VNode | null {
346
347
  subs.clear()
347
348
  }
348
349
 
349
- if (__DEV__) {
350
- if (isHmrUpdate()) {
351
- const { hooks } = vNode
352
- if (vNode.cleanups) {
353
- Object.values(vNode.cleanups).forEach(call)
354
- delete vNode.cleanups
355
- }
356
- if (hooks) {
357
- const { preCleanups, postCleanups } = hooks
358
- preCleanups.forEach(call)
359
- postCleanups.forEach(call)
360
- preCleanups.length = postCleanups.length = 0
361
- }
362
- delete vNode.render
350
+ if (__DEV__ && isHmrUpdate()) {
351
+ const { hooks, cleanups } = vNode
352
+ if (cleanups) {
353
+ Object.values(cleanups).forEach(call)
354
+ delete vNode.cleanups
363
355
  }
364
-
365
- if (vNode.render) {
366
- newChild = vNode.render(props)
367
- } else {
368
- newChild = latest(type)(props)
369
- if (typeof newChild === "function") {
370
- vNode.subs?.forEach(call)
371
- vNode.render = newChild as (props: any) => unknown
372
- newChild = vNode.render(props)
373
- }
356
+ if (hooks) {
357
+ const { preCleanups, postCleanups } = hooks
358
+ preCleanups.forEach(call)
359
+ postCleanups.forEach(call)
360
+ preCleanups.length = postCleanups.length = 0
374
361
  }
362
+ delete vNode.propSyncs
363
+ delete vNode.render
364
+ }
375
365
 
376
- if (++renderTryCount > CONSECUTIVE_DIRTY_LIMIT) {
366
+ newChild = renderFunctionComponent(vNode, type, props, shouldSyncProps)
367
+
368
+ if (++renderTryCount > CONSECUTIVE_DIRTY_LIMIT) {
369
+ if (__DEV__) {
377
370
  throw new KiruError({
378
371
  message:
379
372
  "Too many re-renders. Kiru limits the number of renders to prevent an infinite loop.",
@@ -381,17 +374,7 @@ function updateFunctionComponent(vNode: FunctionVNode): VNode | null {
381
374
  vNode,
382
375
  })
383
376
  }
384
- continue
385
- }
386
-
387
- if (vNode.render) {
388
- newChild = vNode.render(props)
389
- } else {
390
- newChild = type(props)
391
- if (typeof newChild === "function") {
392
- vNode.render = newChild as (props: any) => unknown
393
- newChild = vNode.render(props)
394
- }
377
+ break
395
378
  }
396
379
  } while (isRenderDirtied)
397
380
 
@@ -401,6 +384,38 @@ function updateFunctionComponent(vNode: FunctionVNode): VNode | null {
401
384
  }
402
385
  }
403
386
 
387
+ function renderFunctionComponent(
388
+ vNode: FunctionVNode,
389
+ type: Function,
390
+ props: Record<string, unknown>,
391
+ shouldSyncProps: boolean
392
+ ): unknown {
393
+ const { render, propSyncs } = vNode
394
+
395
+ if (render) {
396
+ if (shouldSyncProps) {
397
+ const p = { ...props }
398
+ propSyncs?.forEach((sync) => sync(p))
399
+ }
400
+ return render(props)
401
+ }
402
+
403
+ let newChild = latest(type)(props)
404
+ if (typeof newChild === "function") {
405
+ vNode.subs?.forEach(call) // unsub from signals observered during setup
406
+ vNode.render = newChild
407
+ if (shouldSyncProps) {
408
+ const p = { ...props }
409
+ propSyncs?.forEach((sync) => sync(p))
410
+ }
411
+ newChild = newChild(props)
412
+ } else if (__DEV__ && setups.has(vNode)) {
413
+ throw new Error("setup() must not be called inside a render function")
414
+ }
415
+
416
+ return newChild
417
+ }
418
+
404
419
  function updateHostComponent(vNode: DomVNode): VNode | null {
405
420
  const { props, type } = vNode
406
421
  if (__DEV__) {
@@ -6,7 +6,7 @@ import {
6
6
  registerVNodeCleanup,
7
7
  } from "../utils/index.js"
8
8
  import { $HMR_ACCEPT, $SIGNAL } from "../constants.js"
9
- import { __DEV__ } from "../env.js"
9
+ import { __DEV__, isBrowser } from "../env.js"
10
10
  import { node } from "../globals.js"
11
11
  import { requestUpdate } from "../scheduler.js"
12
12
  import { signalSubsMap } from "./globals.js"
@@ -39,7 +39,7 @@ export class Signal<T> {
39
39
  return this as Signal<any>
40
40
  },
41
41
  inject: (prev) => {
42
- if ("window" in globalThis) window.__kiru.devtools?.untrack(prev)
42
+ if (isBrowser) window.__kiru.devtools?.untrack(prev)
43
43
  signalSubsMap.get(this.$id)?.clear?.()
44
44
  signalSubsMap.delete(this.$id)
45
45
  this.$id = prev.$id
@@ -201,7 +201,7 @@ export class Signal<T> {
201
201
  signal.$isDisposed = true
202
202
  if (__DEV__) {
203
203
  signalSubsMap.delete(signal.$id)
204
- if ("window" in globalThis) window.__kiru.devtools?.untrack(signal)
204
+ if (isBrowser) window.__kiru.devtools?.untrack(signal)
205
205
  return
206
206
  }
207
207
  signal.$subs!.clear()
@@ -1,4 +1,4 @@
1
- import { __DEV__ } from "../env.js"
1
+ import { __DEV__, isBrowser } from "../env.js"
2
2
  import { effectQueue } from "./globals.js"
3
3
  import { executeWithTracking } from "./tracking.js"
4
4
  import {
@@ -6,6 +6,7 @@ import {
6
6
  generateRandomID,
7
7
  call,
8
8
  registerVNodeCleanup,
9
+ sideEffectsEnabled,
9
10
  } from "../utils/index.js"
10
11
  import type { Signal } from "./base.js"
11
12
  import type { SignalValues } from "./types.js"
@@ -31,11 +32,12 @@ export class Effect<const Deps extends readonly Signal<unknown>[] = []> {
31
32
  this.unsubs = new Map()
32
33
  this.isRunning = false
33
34
  this.cleanup = null
34
- if (__DEV__ && "window" in globalThis) {
35
+ if (__DEV__ && isBrowser) {
35
36
  window.__kiru.HMRContext!.moduleEffects.push(this)
36
37
  }
37
38
  const n = node.current
38
39
  if (n) {
40
+ if (!sideEffectsEnabled()) return // prevent side effects in non-browser environments
39
41
  registerVNodeCleanup(n, this.id, this.stop.bind(this))
40
42
  }
41
43
  this.start()
@@ -49,11 +51,7 @@ export class Effect<const Deps extends readonly Signal<unknown>[] = []> {
49
51
  this.isRunning = true
50
52
 
51
53
  // postpone execution during HMR
52
- if (
53
- __DEV__ &&
54
- "window" in globalThis &&
55
- window.__kiru.HMRContext?.isReplacement()
56
- ) {
54
+ if (__DEV__ && isBrowser && window.__kiru.HMRContext?.isReplacement()) {
57
55
  return queueMicrotask(() => {
58
56
  if (this.isRunning) {
59
57
  Effect.run(this as Effect)
@@ -5,10 +5,11 @@ import { tick } from "./utils.js"
5
5
  import type { Signal } from "./base.js"
6
6
  import type { SignalValues } from "./types.js"
7
7
 
8
+ export type TrackingStackObservations = Map<string, Signal<unknown>>
8
9
  export const tracking = {
9
10
  enabled: true,
10
- stack: new Array<Map<string, Signal<unknown>>>(),
11
- current: function (): Map<string, Signal<unknown>> | undefined {
11
+ stack: new Array<TrackingStackObservations>(),
12
+ current: function (): TrackingStackObservations | undefined {
12
13
  return this.stack[this.stack.length - 1]
13
14
  },
14
15
  }
@@ -1,7 +1,7 @@
1
1
  import { $STREAM_DATA, STREAMED_DATA_EVENT } from "./constants.js"
2
2
  import { hydrationMode, node, renderMode } from "./globals.js"
3
3
  import { Signal, signal } from "./signals/base.js"
4
- import { getVNodeId } from "./utils/vdom.js"
4
+ import { createVNodeId } from "./utils/vdom.js"
5
5
  import { onCleanup } from "./hooks/onCleanup.js"
6
6
 
7
7
  export interface StreamDataThrowValue {
@@ -42,7 +42,7 @@ export function statefulPromise<T>(
42
42
  if (!vNode) {
43
43
  throw new Error("statefulPromise must be called inside a Kiru component")
44
44
  }
45
- const id = getVNodeId(vNode)
45
+ const id = createVNodeId(vNode)
46
46
  const isPending = signal(true)
47
47
 
48
48
  isPending.value = true
package/src/types.dom.ts CHANGED
@@ -153,8 +153,8 @@ type AllStyleRules = Omit<
153
153
  type StyleObject = Prettify<
154
154
  Partial<{
155
155
  [Key in keyof AllStyleRules & string]: Key extends NumericStyleKeys
156
- ? number | string
157
- : AllStyleRules[Key]
156
+ ? Signalable<number | string | undefined>
157
+ : Signalable<AllStyleRules[Key] | undefined>
158
158
  }>
159
159
  >
160
160
 
package/src/types.ts CHANGED
@@ -162,7 +162,11 @@ declare global {
162
162
  | typeof $ERROR_BOUNDARY
163
163
 
164
164
  interface Element {
165
- type: Function | ExoticSymbol | "#text" | (string & {})
165
+ type:
166
+ | (Function & { displayName?: string })
167
+ | ExoticSymbol
168
+ | "#text"
169
+ | (string & {})
166
170
  key: JSX.ElementKey | null
167
171
  props: {
168
172
  [key: string]: any
@@ -193,6 +197,8 @@ declare global {
193
197
  post: LifecycleHookCallback[]
194
198
  postCleanups: (() => void)[]
195
199
  }
200
+ /** Run before each render with current props to sync prop-derived signals */
201
+ propSyncs?: ((props: VNode["props"]) => void)[]
196
202
  render?: (props: VNode["props"]) => unknown
197
203
  }
198
204
  interface VNodeSnapshot {
@@ -84,8 +84,10 @@ function propToHtmlAttr(key: string): string {
84
84
  function styleObjectToString(obj: Partial<CSSStyleDeclaration>): string {
85
85
  let cssString = ""
86
86
  for (const key in obj) {
87
+ const val = unwrap((obj as Record<string, unknown>)[key])
88
+ if (val === null || val === undefined) continue
87
89
  const cssKey = key.replace(REGEX_ALPHA_UPPER, "-$&").toLowerCase()
88
- cssString += `${cssKey}:${obj[key]};`
90
+ cssString += `${cssKey}:${val};`
89
91
  }
90
92
  return cssString
91
93
  }
package/src/utils/vdom.ts CHANGED
@@ -31,7 +31,7 @@ export {
31
31
  findParentErrorBoundary,
32
32
  assertValidElementProps,
33
33
  normalizeElementKey,
34
- getVNodeId,
34
+ createVNodeId,
35
35
  registerVNodeCleanup,
36
36
  propsChanged,
37
37
  }
@@ -186,7 +186,7 @@ function normalizeElementKey(thing: unknown): JSX.ElementKey | null {
186
186
  return null
187
187
  }
188
188
 
189
- function getVNodeId(vNode: Kiru.VNode): string {
189
+ function createVNodeId(vNode: Kiru.VNode): string {
190
190
  const accumulator: number[] = []
191
191
  let n: Kiru.VNode | null = vNode
192
192
  while (n) {
@@ -1,4 +1,5 @@
1
1
  import { flushSync } from "./scheduler.js"
2
+ import { isBrowser } from "./env.js"
2
3
 
3
4
  export namespace ViewTransitions {
4
5
  type ViewTransitionJob = () => Promise<void>
@@ -8,7 +9,7 @@ export namespace ViewTransitions {
8
9
  let scheduled = false
9
10
  let transition: ViewTransition | null = null
10
11
  const supported =
11
- "window" in globalThis && typeof document.startViewTransition === "function"
12
+ isBrowser && typeof document.startViewTransition === "function"
12
13
 
13
14
  export function run<T>(
14
15
  callback: () => T | Promise<T>,
package/dist/dom.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import type { DomVNode, SomeDom } from "./types.utils";
2
- export { commitWork, onBeforeFlushDomChanges, onAfterFlushDomChanges, commitDeletion, createDom, hydrateDom, };
3
- type VNode = Kiru.VNode;
4
- declare function onBeforeFlushDomChanges(): void;
5
- declare function onAfterFlushDomChanges(): void;
6
- declare function createDom(vNode: DomVNode): SomeDom;
7
- declare function hydrateDom(vNode: VNode): void;
8
- declare function commitWork(vNode: VNode): void;
9
- declare function commitDeletion(vNode: VNode): void;
10
- //# sourceMappingURL=dom.d.ts.map
package/dist/dom.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,QAAQ,EAGR,OAAO,EAER,MAAM,eAAe,CAAA;AAGtB,OAAO,EACL,UAAU,EACV,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACd,SAAS,EACT,UAAU,GACX,CAAA;AAED,KAAK,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;AAiBvB,iBAAS,uBAAuB,SAM/B;AAED,iBAAS,sBAAsB,SAa9B;AAED,iBAAS,SAAS,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAU3C;AA0TD,iBAAS,UAAU,CAAC,KAAK,EAAE,KAAK,QA+C/B;AAuND,iBAAS,UAAU,CAAC,KAAK,EAAE,KAAK,QAa/B;AA6CD,iBAAS,cAAc,CAAC,KAAK,EAAE,KAAK,QA8CnC"}