@askrjs/askr 0.0.36 → 0.0.37

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 (96) hide show
  1. package/README.md +17 -9
  2. package/dist/bench/components/benchmark-table.js +1 -1
  3. package/dist/bench/components/benchmark-table.js.map +1 -1
  4. package/dist/benchmark.js +3 -3
  5. package/dist/boot/index.d.ts +1 -7
  6. package/dist/boot/index.d.ts.map +1 -1
  7. package/dist/boot/index.js +22 -13
  8. package/dist/boot/index.js.map +1 -1
  9. package/dist/components/index.d.ts +2 -0
  10. package/dist/components/index.js +2 -0
  11. package/dist/components/link.d.ts +4 -5
  12. package/dist/components/link.d.ts.map +1 -1
  13. package/dist/components/link.js +2 -1
  14. package/dist/components/link.js.map +1 -1
  15. package/dist/foundations/icon/icon.d.ts.map +1 -1
  16. package/dist/foundations/icon/icon.js.map +1 -1
  17. package/dist/foundations/icon/icon.types.d.ts +2 -1
  18. package/dist/foundations/icon/icon.types.d.ts.map +1 -1
  19. package/dist/foundations/icon/index.d.ts +3 -0
  20. package/dist/foundations/icon/index.js +2 -0
  21. package/dist/foundations/index.d.ts +1 -18
  22. package/dist/foundations/index.js +2 -18
  23. package/dist/foundations/interactions/index.d.ts +7 -0
  24. package/dist/foundations/interactions/index.js +7 -0
  25. package/dist/foundations/interactions/interaction-policy.js +2 -2
  26. package/dist/foundations/state/index.d.ts +2 -0
  27. package/dist/foundations/state/index.js +2 -0
  28. package/dist/foundations/structures/index.d.ts +8 -0
  29. package/dist/foundations/structures/index.js +7 -0
  30. package/dist/foundations/utilities/index.d.ts +7 -0
  31. package/dist/foundations/utilities/index.js +6 -0
  32. package/dist/index.d.ts +2 -16
  33. package/dist/index.js +1 -17
  34. package/dist/index.js.map +1 -1
  35. package/dist/jsx-dev-runtime.d.ts +1 -1
  36. package/dist/jsx-dev-runtime.js.map +1 -1
  37. package/dist/jsx-runtime.d.ts +1 -1
  38. package/dist/jsx-runtime.js.map +1 -1
  39. package/dist/renderer/dom.js +26 -366
  40. package/dist/renderer/dom.js.map +1 -1
  41. package/dist/renderer/evaluate.js.map +1 -1
  42. package/dist/renderer/fastpath.js +20 -18
  43. package/dist/renderer/fastpath.js.map +1 -1
  44. package/dist/renderer/for-commit.js +486 -0
  45. package/dist/renderer/for-commit.js.map +1 -0
  46. package/dist/renderer/index.js.map +1 -1
  47. package/dist/renderer/keyed.js +84 -23
  48. package/dist/renderer/keyed.js.map +1 -1
  49. package/dist/renderer/reconcile.js +11 -18
  50. package/dist/renderer/reconcile.js.map +1 -1
  51. package/dist/renderer/utils.js +5 -1
  52. package/dist/renderer/utils.js.map +1 -1
  53. package/dist/resources/index.d.ts +1 -2
  54. package/dist/resources/index.js +1 -2
  55. package/dist/router/route.js +1 -1
  56. package/dist/runtime/for.d.ts.map +1 -1
  57. package/dist/runtime/for.js +33 -21
  58. package/dist/runtime/for.js.map +1 -1
  59. package/dist/runtime/operations.js +1 -1
  60. package/dist/runtime/selector.d.ts.map +1 -1
  61. package/dist/runtime/selector.js +180 -103
  62. package/dist/runtime/selector.js.map +1 -1
  63. package/dist/ssg/index.d.ts +1 -6
  64. package/dist/ssg/index.js +1 -6
  65. package/dist/ssr/context.d.ts +2 -1
  66. package/dist/ssr/context.d.ts.map +1 -1
  67. package/dist/ssr/context.js +28 -11
  68. package/dist/ssr/context.js.map +1 -1
  69. package/dist/ssr/index.d.ts +2 -31
  70. package/dist/ssr/index.d.ts.map +1 -1
  71. package/dist/ssr/index.js +4 -46
  72. package/dist/ssr/index.js.map +1 -1
  73. package/dist/ssr/render-keys.js +1 -12
  74. package/dist/ssr/render-keys.js.map +1 -1
  75. package/dist/ssr/verify-hydration.js +25 -0
  76. package/dist/ssr/verify-hydration.js.map +1 -0
  77. package/package.json +39 -16
  78. package/dist/_virtual/_rolldown/runtime.js +0 -7
  79. package/dist/foundations/core.d.ts +0 -15
  80. package/dist/foundations/core.js +0 -13
  81. package/dist/foundations/structures.d.ts +0 -7
  82. package/dist/foundations/structures.js +0 -6
  83. package/dist/ssg/batch-render.d.ts +0 -16
  84. package/dist/ssg/batch-render.d.ts.map +0 -1
  85. package/dist/ssg/generate-metadata.d.ts +0 -24
  86. package/dist/ssg/generate-metadata.d.ts.map +0 -1
  87. package/dist/ssg/resolve-ssg-data.d.ts +0 -23
  88. package/dist/ssg/resolve-ssg-data.d.ts.map +0 -1
  89. package/dist/ssg/route-utils.d.ts +0 -16
  90. package/dist/ssg/route-utils.d.ts.map +0 -1
  91. package/dist/ssg/write-static-files.d.ts +0 -15
  92. package/dist/ssg/write-static-files.d.ts.map +0 -1
  93. package/dist/ssr/render-keys.d.ts +0 -37
  94. package/dist/ssr/render-keys.d.ts.map +0 -1
  95. package/dist/ssr/stream-render.js +0 -88
  96. package/dist/ssr/stream-render.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { pressable } from "./pressable.js";
2
1
  import { composeHandlers } from "../utilities/compose-handlers.js";
3
- import { composeRefs } from "../utilities/compose-ref.js";
4
2
  import { mergeProps } from "../utilities/merge-props.js";
3
+ import { composeRefs } from "../utilities/compose-ref.js";
4
+ import { pressable } from "./pressable.js";
5
5
  //#region src/foundations/interactions/interaction-policy.ts
6
6
  /**
7
7
  * INTERACTION POLICY (FRAMEWORK LAW)
@@ -0,0 +1,2 @@
1
+ import { ControllableState, controllableState, isControlled, makeControllable, resolveControllable } from "./controllable.js";
2
+ export { type ControllableState, controllableState, isControlled, makeControllable, resolveControllable };
@@ -0,0 +1,2 @@
1
+ import { controllableState, isControlled, makeControllable, resolveControllable } from "./controllable.js";
2
+ export { controllableState, isControlled, makeControllable, resolveControllable };
@@ -0,0 +1,8 @@
1
+ import { JSXElement } from "../../common/jsx.js";
2
+ import { LayoutComponent, layout } from "./layout.js";
3
+ import { Slot, SlotProps } from "./slot.js";
4
+ import { Presence, PresenceProps } from "./presence.js";
5
+ import { DefaultPortal, Portal, PortalProps, definePortal } from "./portal.js";
6
+ import { Collection, CollectionItem, createCollection } from "./collection.js";
7
+ import { Layer, LayerManager, LayerOptions, createLayer } from "./layer.js";
8
+ export { type Collection, type CollectionItem, DefaultPortal, type JSXElement, type Layer, type LayerManager, type LayerOptions, type LayoutComponent, Portal, type PortalProps, Presence, type PresenceProps, Slot, type SlotProps, createCollection, createLayer, definePortal, layout };
@@ -0,0 +1,7 @@
1
+ import { DefaultPortal, Portal, definePortal } from "./portal.js";
2
+ import { layout } from "./layout.js";
3
+ import { Slot } from "./slot.js";
4
+ import { Presence } from "./presence.js";
5
+ import { createCollection } from "./collection.js";
6
+ import { createLayer } from "./layer.js";
7
+ export { DefaultPortal, Portal, Presence, Slot, createCollection, createLayer, definePortal, layout };
@@ -0,0 +1,7 @@
1
+ import { Ref, composeRefs, setRef } from "./compose-ref.js";
2
+ import { DefaultPreventable, FocusLikeEvent, KeyboardLikeEvent, PointerLikeEvent, PropagationStoppable } from "./event-types.js";
3
+ import { ComposeHandlersOptions, composeHandlers } from "./compose-handlers.js";
4
+ import { mergeProps } from "./merge-props.js";
5
+ import { ariaDisabled, ariaExpanded, ariaSelected } from "./aria.js";
6
+ import { FormatIdOptions, formatId } from "./use-id.js";
7
+ export { type ComposeHandlersOptions, type DefaultPreventable, type FocusLikeEvent, type FormatIdOptions, type KeyboardLikeEvent, type PointerLikeEvent, type PropagationStoppable, type Ref, ariaDisabled, ariaExpanded, ariaSelected, composeHandlers, composeRefs, formatId, mergeProps, setRef };
@@ -0,0 +1,6 @@
1
+ import { composeHandlers } from "./compose-handlers.js";
2
+ import { mergeProps } from "./merge-props.js";
3
+ import { ariaDisabled, ariaExpanded, ariaSelected } from "./aria.js";
4
+ import { composeRefs, setRef } from "./compose-ref.js";
5
+ import { formatId } from "./use-id.js";
6
+ export { ariaDisabled, ariaExpanded, ariaSelected, composeHandlers, composeRefs, formatId, mergeProps, setRef };
package/dist/index.d.ts CHANGED
@@ -3,21 +3,7 @@ import { Fragment } from "./common/jsx.js";
3
3
  import { State, state } from "./runtime/state.js";
4
4
  import { Context, defineContext, readContext } from "./runtime/context.js";
5
5
  import { getSignal } from "./runtime/component.js";
6
- import { For, ForProps } from "./control/for.js";
7
- import { AccessDecision, AccessDenyDecision, AccessRedirectDecision, GroupHelperOptions, PageHelperOptions, PageScopeRecord, RegisterRoutesOptions, RouteAuthMode, RouteAuthOptions, RouteAuthResolver, RouteAuthState, RouteComponent, RouteContext, RouteDefinition, RouteManifest, RouteMatch, RouteMode, RouteOptions, RoutePolicy, RouteRecord, RouteRenderResult, RouteRequestOptions, RouteRequestResult, RouteSnapshot } from "./common/router.js";
8
- import { HistoryScrollBehavior, NavigateOptions, NavigationScrollBehavior, ScrollRestorationOptions, navigate } from "./router/navigate.js";
9
- import { HydrateSPAConfig, IslandConfig, IslandsConfig, SPAConfig, cleanupApp, createIsland, createIslands, createSPA, hasApp, hydrateSPA } from "./boot/index.js";
10
- import { Show, ShowProps } from "./control/show.js";
11
- import { Case, CaseProps, Match, MatchProps } from "./control/case.js";
12
- import { jsx, jsxs } from "./jsx-runtime.js";
13
- import { Slot, SlotProps } from "./foundations/structures/slot.js";
14
- import { DefaultPortal, Portal, PortalProps, definePortal } from "./foundations/structures/portal.js";
15
6
  import { Derived, derive } from "./runtime/derive.js";
16
7
  import { Selector, selector } from "./runtime/selector.js";
17
- import { ResourceResult, resource } from "./runtime/operations.js";
18
- import { Mutation, Query, QueryConsistency, createMutation, createQuery, invalidate } from "./data/index.js";
19
- import { Outlet, currentRoute, fallback, group, index, lazy, page, registerRoutes, route } from "./router/route.js";
20
- import { allow, deny, forbidden, notFound, redirect, requireAuth, requirePermission, requireRole, unauthorized } from "./router/policy.js";
21
- import { Link, LinkProps } from "./components/link.js";
22
- import { ErrorBoundary, ErrorBoundaryFallbackRender, ErrorBoundaryProps } from "./components/error-boundary.js";
23
- export { type AccessDecision, type AccessDenyDecision, type AccessRedirectDecision, Case, type CaseProps, type Context, DefaultPortal, type Derived, ErrorBoundary, type ErrorBoundaryFallbackRender, type ErrorBoundaryProps, For, type ForProps, Fragment, type GroupHelperOptions, type HistoryScrollBehavior, type HydrateSPAConfig, type IslandConfig, type IslandsConfig, Link, type LinkProps, Match, type MatchProps, type Mutation, type NavigateOptions, type NavigationScrollBehavior, Outlet, type PageHelperOptions, type PageScopeRecord, Portal, type PortalProps, type Props, type Query, type QueryConsistency, type RegisterRoutesOptions, type ResourceResult, type RouteAuthMode, type RouteAuthOptions, type RouteAuthResolver, type RouteAuthState, type RouteComponent, type RouteContext, type RouteDefinition, type RouteManifest, type RouteMatch, type RouteMode, type RouteOptions, type RoutePolicy, type RouteRecord, type RouteRenderResult, type RouteRequestOptions, type RouteRequestResult, type RouteSnapshot, type SPAConfig, type ScrollRestorationOptions, type Selector, Show, type ShowProps, Slot, type SlotProps, type State, allow, cleanupApp, createIsland, createIslands, createMutation, createQuery, createSPA, currentRoute, defineContext, definePortal, deny, derive, fallback, forbidden, getSignal, group, hasApp, hydrateSPA, index, invalidate, jsx, jsxs, lazy, navigate, notFound, page, readContext, redirect, registerRoutes, requireAuth, requirePermission, requireRole, resource, route, selector, state, unauthorized };
8
+ import { jsx, jsxs } from "./jsx-runtime.js";
9
+ export { type Context, type Derived, Fragment, type Props, type Selector, type State, defineContext, derive, getSignal, jsx, jsxs, readContext, selector, state };
package/dist/index.js CHANGED
@@ -2,27 +2,11 @@ import { Fragment } from "./common/jsx.js";
2
2
  import { defineContext, readContext } from "./runtime/context.js";
3
3
  import { getSignal } from "./runtime/component.js";
4
4
  import { jsx, jsxs } from "./jsx-runtime.js";
5
- import { ErrorBoundary } from "./components/error-boundary.js";
6
5
  import { installRendererBridge } from "./renderer/index.js";
7
6
  import { state } from "./runtime/state.js";
8
7
  import { derive } from "./runtime/derive.js";
9
8
  import { selector } from "./runtime/selector.js";
10
- import { resource } from "./runtime/operations.js";
11
- import { createMutation, createQuery, invalidate } from "./data/index.js";
12
- import { allow, deny, forbidden, notFound, redirect, requireAuth, requirePermission, requireRole, unauthorized } from "./router/policy.js";
13
- import { Outlet, currentRoute, fallback, group, index, lazy, page, registerRoutes, route } from "./router/route.js";
14
- import { DefaultPortal, Portal, definePortal } from "./foundations/structures/portal.js";
15
- import { navigate } from "./router/navigate.js";
16
- import { cleanupApp, createIsland, createIslands, createSPA, hasApp, hydrateSPA } from "./boot/index.js";
17
9
  import "./jsx-runtime2.js";
18
- import { Link } from "./components/link.js";
19
- import "./router/index.js";
20
- import { For } from "./control/for.js";
21
- import { Show } from "./control/show.js";
22
- import { Case, Match } from "./control/case.js";
23
- import "./control/index.js";
24
- import { Slot } from "./foundations/structures/slot.js";
25
- import "./foundations/structures.js";
26
10
  //#region src/index.ts
27
11
  /**
28
12
  * Askr: Actor-backed deterministic UI framework
@@ -31,6 +15,6 @@ import "./foundations/structures.js";
31
15
  */
32
16
  installRendererBridge();
33
17
  //#endregion
34
- export { Case, DefaultPortal, ErrorBoundary, For, Fragment, Link, Match, Outlet, Portal, Show, Slot, allow, cleanupApp, createIsland, createIslands, createMutation, createQuery, createSPA, currentRoute, defineContext, definePortal, deny, derive, fallback, forbidden, getSignal, group, hasApp, hydrateSPA, index, invalidate, jsx, jsxs, lazy, navigate, notFound, page, readContext, redirect, registerRoutes, requireAuth, requirePermission, requireRole, resource, route, selector, state, unauthorized };
18
+ export { Fragment, defineContext, derive, getSignal, jsx, jsxs, readContext, selector, state };
35
19
 
36
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Askr: Actor-backed deterministic UI framework\n *\n * Public API surface — only users should import from here\n */\n\nimport { installRendererBridge } from './renderer';\n\ninstallRendererBridge();\n\n// Runtime primitives\nexport { state } from './runtime/state';\nexport type { State } from './runtime/state';\nexport { derive } from './runtime/derive';\nexport type { Derived } from './runtime/derive';\nexport { getSignal } from './runtime/component';\nexport { selector } from './runtime/selector';\nexport type { Selector } from './runtime/selector';\n\n// Context\nexport { defineContext, readContext } from './runtime/context';\nexport type { Context } from './runtime/context';\n\n// Resources\nexport { resource } from './runtime/operations';\nexport type { ResourceResult } from './runtime/operations';\n\n// Data\nexport { createQuery, createMutation, invalidate } from './data';\nexport type { Query, Mutation, QueryConsistency } from './data';\n\n// App bootstrap\nexport {\n createIsland,\n createIslands,\n createSPA,\n hydrateSPA,\n cleanupApp,\n hasApp,\n} from './boot';\nexport type {\n IslandConfig,\n IslandsConfig,\n SPAConfig,\n HydrateSPAConfig,\n} from './boot';\n\n// Routing\nexport {\n registerRoutes,\n route,\n page,\n index,\n Outlet,\n currentRoute,\n group,\n fallback,\n lazy,\n allow,\n redirect,\n deny,\n unauthorized,\n forbidden,\n notFound,\n requireAuth,\n requireRole,\n requirePermission,\n type RouteSnapshot,\n type RouteMatch,\n type RouteComponent,\n type RouteMode,\n type RouteAuthMode,\n type RouteContext,\n type RoutePolicy,\n type RouteOptions,\n type RouteRecord,\n type RouteManifest,\n type PageScopeRecord,\n type AccessDecision,\n type AccessDenyDecision,\n type AccessRedirectDecision,\n type GroupHelperOptions,\n type PageHelperOptions,\n type RegisterRoutesOptions,\n type RouteDefinition,\n type RouteAuthOptions,\n type RouteAuthResolver,\n type RouteAuthState,\n type RouteRenderResult,\n type RouteRequestOptions,\n type RouteRequestResult,\n} from './router';\nexport { navigate } from './router/navigate';\nexport type {\n NavigateOptions,\n NavigationScrollBehavior,\n HistoryScrollBehavior,\n ScrollRestorationOptions,\n} from './router/navigate';\n\n// Components\nexport { Link } from './components/link';\nexport type { LinkProps } from './components/link';\nexport { ErrorBoundary } from './components/error-boundary';\nexport type {\n ErrorBoundaryProps,\n ErrorBoundaryFallbackRender,\n} from './components/error-boundary';\nexport { Case, For, Match, Show } from './control';\nexport type { CaseProps, ForProps, MatchProps, ShowProps } from './control';\nexport {\n Slot,\n definePortal,\n DefaultPortal,\n Portal,\n} from './foundations/structures';\nexport type { SlotProps, PortalProps } from './foundations/structures';\n\n// Re-export JSX runtime for tsconfig jsxImportSource\nexport { jsx, jsxs, Fragment } from './jsx-runtime';\n\n// Public types\nexport type { Props } from './common/props';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,uBAAuB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Askr: Actor-backed deterministic UI framework\n *\n * Public API surface — only users should import from here\n */\n\nimport { installRendererBridge } from './renderer';\n\ninstallRendererBridge();\n\n// Runtime primitives\nexport { state } from './runtime/state';\nexport type { State } from './runtime/state';\nexport { derive } from './runtime/derive';\nexport type { Derived } from './runtime/derive';\nexport { getSignal } from './runtime/component';\nexport { selector } from './runtime/selector';\nexport type { Selector } from './runtime/selector';\n\n// Context\nexport { defineContext, readContext } from './runtime/context';\nexport type { Context } from './runtime/context';\n\n// Re-export JSX runtime for tsconfig jsxImportSource\nexport { jsx, jsxs, Fragment } from './jsx-runtime';\n\n// Public types\nexport type { Props } from './common/props';\n"],"mappings":";;;;;;;;;;;;;;;AAQA,uBAAuB"}
@@ -4,5 +4,5 @@ import { EagerControlPrimitive } from "./common/control.js";
4
4
  declare function jsxDEV(type: EagerControlPrimitive, props: Record<string, unknown> | null, key?: string | number, isStaticChildren?: boolean): unknown;
5
5
  declare function jsxDEV(type: unknown, props: Record<string, unknown> | null, key?: string | number, isStaticChildren?: boolean): JSXElement;
6
6
  //#endregion
7
- export { Fragment, jsxDEV };
7
+ export { Fragment, type JSXElement, jsxDEV };
8
8
  //# sourceMappingURL=jsx-dev-runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-dev-runtime.js","names":[],"sources":["../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * JSX dev runtime factory\n * Same element shape as production runtime, with room for dev warnings.\n */\nimport type { Props } from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime/readable';\n\nfunction annotatePropsUsage(props: Record<string, unknown> | null): Props {\n const normalizedProps = (props ?? {}) as Props;\n\n for (const value of Object.values(normalizedProps)) {\n markReadableUsage(value);\n }\n\n return normalizedProps;\n}\n\nfunction markStaticChildren(props: Props): Props {\n if (Array.isArray(props.children)) {\n Object.defineProperty(props.children, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n\n return props;\n}\n\nexport function jsxDEV(\n type: EagerControlPrimitive,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren?: boolean\n): unknown;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren = false\n): JSXElement | unknown {\n const normalizedProps = annotatePropsUsage(props);\n const preparedProps = isStaticChildren\n ? markStaticChildren(normalizedProps)\n : normalizedProps;\n\n if (isEagerControlPrimitive(type)) {\n return type(preparedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as string | ((props: Props) => unknown) | symbol,\n props: preparedProps,\n key: key ?? null,\n };\n}\n\n// Re-export Fragment for JSX\nexport { Fragment };\n"],"mappings":";;;;;AAiBA,SAAS,mBAAmB,OAA8C;CACxE,MAAM,kBAAmB,SAAS,EAAE;CAEpC,KAAK,MAAM,SAAS,OAAO,OAAO,gBAAgB,EAChD,kBAAkB,MAAM;CAG1B,OAAO;;AAGT,SAAS,mBAAmB,OAAqB;CAC/C,IAAI,MAAM,QAAQ,MAAM,SAAS,EAC/B,OAAO,eAAe,MAAM,UAAU,iBAAiB;EACrD,OAAO;EACP,cAAc;EACf,CAAC;CAGJ,OAAO;;AAeT,SAAgB,OACd,MACA,OACA,KACA,mBAAmB,OACG;CACtB,MAAM,kBAAkB,mBAAmB,MAAM;CACjD,MAAM,gBAAgB,mBAClB,mBAAmB,gBAAgB,GACnC;CAEJ,IAAI,wBAAwB,KAAK,EAC/B,OAAO,KAAK,cAAc;CAG5B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;EACb"}
1
+ {"version":3,"file":"jsx-dev-runtime.js","names":[],"sources":["../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * JSX dev runtime factory\n * Same element shape as production runtime, with room for dev warnings.\n */\nimport type { Props } from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime/readable';\n\nfunction annotatePropsUsage(props: Record<string, unknown> | null): Props {\n const normalizedProps = (props ?? {}) as Props;\n\n for (const value of Object.values(normalizedProps)) {\n markReadableUsage(value);\n }\n\n return normalizedProps;\n}\n\nfunction markStaticChildren(props: Props): Props {\n if (Array.isArray(props.children)) {\n Object.defineProperty(props.children, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n\n return props;\n}\n\nexport function jsxDEV(\n type: EagerControlPrimitive,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren?: boolean\n): unknown;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren = false\n): JSXElement | unknown {\n const normalizedProps = annotatePropsUsage(props);\n const preparedProps = isStaticChildren\n ? markStaticChildren(normalizedProps)\n : normalizedProps;\n\n if (isEagerControlPrimitive(type)) {\n return type(preparedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as string | ((props: Props) => unknown) | symbol,\n props: preparedProps,\n key: key ?? null,\n };\n}\n\n// Re-export Fragment for JSX\nexport { Fragment };\nexport type { JSXElement };\n"],"mappings":";;;;;AAiBA,SAAS,mBAAmB,OAA8C;CACxE,MAAM,kBAAmB,SAAS,EAAE;CAEpC,KAAK,MAAM,SAAS,OAAO,OAAO,gBAAgB,EAChD,kBAAkB,MAAM;CAG1B,OAAO;;AAGT,SAAS,mBAAmB,OAAqB;CAC/C,IAAI,MAAM,QAAQ,MAAM,SAAS,EAC/B,OAAO,eAAe,MAAM,UAAU,iBAAiB;EACrD,OAAO;EACP,cAAc;EACf,CAAC;CAGJ,OAAO;;AAeT,SAAgB,OACd,MACA,OACA,KACA,mBAAmB,OACG;CACtB,MAAM,kBAAkB,mBAAmB,MAAM;CACjD,MAAM,gBAAgB,mBAClB,mBAAmB,gBAAgB,GACnC;CAEJ,IAAI,wBAAwB,KAAK,EAC/B,OAAO,KAAK,cAAc;CAG5B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;EACb"}
@@ -8,5 +8,5 @@ declare function jsx(type: unknown, props: Record<string, unknown> | null, key?:
8
8
  declare function jsxs(type: EagerControlPrimitive, props: Record<string, unknown> | null, key?: string | number): unknown;
9
9
  declare function jsxs(type: unknown, props: Record<string, unknown> | null, key?: string | number): JSXElement;
10
10
  //#endregion
11
- export { Fragment, jsx, jsxDEV, jsxs };
11
+ export { Fragment, type JSXElement, jsx, jsxDEV, jsxs };
12
12
  //# sourceMappingURL=jsx-runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.js","names":[],"sources":["../src/jsx/jsx-runtime.ts"],"sourcesContent":["/**\n * JSX runtime factory\n * Same element shape as production runtime.\n */\n\nimport type { Props } from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime/readable';\n\nfunction annotatePropsUsage(props: Record<string, unknown> | null): Props {\n const normalizedProps = (props ?? {}) as Props;\n\n for (const value of Object.values(normalizedProps)) {\n markReadableUsage(value);\n }\n\n return normalizedProps;\n}\n\nfunction markStaticChildren(props: Props): Props {\n if (Array.isArray(props.children)) {\n Object.defineProperty(props.children, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n\n return props;\n}\n\nexport function jsxDEV(\n type: EagerControlPrimitive,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren?: boolean\n): unknown;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren = false\n): JSXElement | unknown {\n const normalizedProps = annotatePropsUsage(props);\n const preparedProps = isStaticChildren\n ? markStaticChildren(normalizedProps)\n : normalizedProps;\n\n if (isEagerControlPrimitive(type)) {\n return type(preparedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as string | ((props: Props) => unknown) | symbol,\n props: preparedProps,\n key: key ?? null,\n };\n}\n\n// Production-style helpers: alias to the DEV factory for now\nexport function jsx(\n type: EagerControlPrimitive,\n props: Record<string, unknown> | null,\n key?: string | number\n): unknown;\nexport function jsx(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n): JSXElement;\nexport function jsx(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n) {\n return jsxDEV(type, props, key);\n}\n\nexport function jsxs(\n type: EagerControlPrimitive,\n props: Record<string, unknown> | null,\n key?: string | number\n): unknown;\nexport function jsxs(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n): JSXElement;\nexport function jsxs(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n) {\n const normalizedProps = markStaticChildren(annotatePropsUsage(props));\n\n if (isEagerControlPrimitive(type)) {\n return type(normalizedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as string | ((props: Props) => unknown) | symbol,\n props: normalizedProps,\n key: key ?? null,\n } as JSXElement;\n}\n\n// Re-export Fragment for JSX.\nexport { Fragment };\n"],"mappings":";;;;;AAkBA,SAAS,mBAAmB,OAA8C;CACxE,MAAM,kBAAmB,SAAS,EAAE;CAEpC,KAAK,MAAM,SAAS,OAAO,OAAO,gBAAgB,EAChD,kBAAkB,MAAM;CAG1B,OAAO;;AAGT,SAAS,mBAAmB,OAAqB;CAC/C,IAAI,MAAM,QAAQ,MAAM,SAAS,EAC/B,OAAO,eAAe,MAAM,UAAU,iBAAiB;EACrD,OAAO;EACP,cAAc;EACf,CAAC;CAGJ,OAAO;;AAeT,SAAgB,OACd,MACA,OACA,KACA,mBAAmB,OACG;CACtB,MAAM,kBAAkB,mBAAmB,MAAM;CACjD,MAAM,gBAAgB,mBAClB,mBAAmB,gBAAgB,GACnC;CAEJ,IAAI,wBAAwB,KAAK,EAC/B,OAAO,KAAK,cAAc;CAG5B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;EACb;;AAcH,SAAgB,IACd,MACA,OACA,KACA;CACA,OAAO,OAAO,MAAM,OAAO,IAAI;;AAajC,SAAgB,KACd,MACA,OACA,KACA;CACA,MAAM,kBAAkB,mBAAmB,mBAAmB,MAAM,CAAC;CAErE,IAAI,wBAAwB,KAAK,EAC/B,OAAO,KAAK,gBAAgB;CAG9B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;EACb"}
1
+ {"version":3,"file":"jsx-runtime.js","names":[],"sources":["../src/jsx/jsx-runtime.ts"],"sourcesContent":["/**\n * JSX runtime factory\n * Same element shape as production runtime.\n */\n\nimport type { Props } from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime/readable';\n\nfunction annotatePropsUsage(props: Record<string, unknown> | null): Props {\n const normalizedProps = (props ?? {}) as Props;\n\n for (const value of Object.values(normalizedProps)) {\n markReadableUsage(value);\n }\n\n return normalizedProps;\n}\n\nfunction markStaticChildren(props: Props): Props {\n if (Array.isArray(props.children)) {\n Object.defineProperty(props.children, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n\n return props;\n}\n\nexport function jsxDEV(\n type: EagerControlPrimitive,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren?: boolean\n): unknown;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren = false\n): JSXElement | unknown {\n const normalizedProps = annotatePropsUsage(props);\n const preparedProps = isStaticChildren\n ? markStaticChildren(normalizedProps)\n : normalizedProps;\n\n if (isEagerControlPrimitive(type)) {\n return type(preparedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as string | ((props: Props) => unknown) | symbol,\n props: preparedProps,\n key: key ?? null,\n };\n}\n\n// Production-style helpers: alias to the DEV factory for now\nexport function jsx(\n type: EagerControlPrimitive,\n props: Record<string, unknown> | null,\n key?: string | number\n): unknown;\nexport function jsx(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n): JSXElement;\nexport function jsx(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n) {\n return jsxDEV(type, props, key);\n}\n\nexport function jsxs(\n type: EagerControlPrimitive,\n props: Record<string, unknown> | null,\n key?: string | number\n): unknown;\nexport function jsxs(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n): JSXElement;\nexport function jsxs(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n) {\n const normalizedProps = markStaticChildren(annotatePropsUsage(props));\n\n if (isEagerControlPrimitive(type)) {\n return type(normalizedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as string | ((props: Props) => unknown) | symbol,\n props: normalizedProps,\n key: key ?? null,\n } as JSXElement;\n}\n\n// Re-export Fragment for JSX.\nexport { Fragment };\nexport type { JSXElement };\n"],"mappings":";;;;;AAkBA,SAAS,mBAAmB,OAA8C;CACxE,MAAM,kBAAmB,SAAS,EAAE;CAEpC,KAAK,MAAM,SAAS,OAAO,OAAO,gBAAgB,EAChD,kBAAkB,MAAM;CAG1B,OAAO;;AAGT,SAAS,mBAAmB,OAAqB;CAC/C,IAAI,MAAM,QAAQ,MAAM,SAAS,EAC/B,OAAO,eAAe,MAAM,UAAU,iBAAiB;EACrD,OAAO;EACP,cAAc;EACf,CAAC;CAGJ,OAAO;;AAeT,SAAgB,OACd,MACA,OACA,KACA,mBAAmB,OACG;CACtB,MAAM,kBAAkB,mBAAmB,MAAM;CACjD,MAAM,gBAAgB,mBAClB,mBAAmB,gBAAgB,GACnC;CAEJ,IAAI,wBAAwB,KAAK,EAC/B,OAAO,KAAK,cAAc;CAG5B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;EACb;;AAcH,SAAgB,IACd,MACA,OACA,KACA;CACA,OAAO,OAAO,MAAM,OAAO,IAAI;;AAajC,SAAgB,KACd,MACA,OACA,KACA;CACA,MAAM,kBAAkB,mBAAmB,mBAAmB,MAAM,CAAC;CAErE,IAAI,wBAAwB,KAAK,EAC/B,OAAO,KAAK,gBAAgB;CAG9B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;EACb"}
@@ -15,9 +15,10 @@ import { addDelegatedListener, getDelegatedHandlerForElement, getDelegatedHandle
15
15
  import { REACTIVE_CHILDREN_KEY, elementListeners, elementReactivePropsCleanup, removeAllListeners, removeElementListeners, removeElementReactiveProps, teardownNodeSubtree } from "./cleanup.js";
16
16
  import "../jsx-runtime.js";
17
17
  import { createChildScope, disposeChildScope, rerenderChildScope } from "../runtime/child-scope.js";
18
- import { isBenchMetricScopeActive, recordBenchCounter, recordBenchEvent, recordBenchTiming, withBenchMetricScope } from "../runtime/for-bench.js";
18
+ import { isBenchMetricScopeActive, recordBenchCounter, recordBenchEvent } from "../runtime/for-bench.js";
19
19
  import { clearForDomUpdateState, evaluateForState } from "../runtime/for.js";
20
20
  import { clearCaseDomUpdateState, clearShowDomUpdateState, evaluateCaseState, evaluateShowState } from "../runtime/control.js";
21
+ import { commitForStateBoundaryChildren } from "./for-commit.js";
21
22
  import { reconcileKeyedChildren } from "./reconcile.js";
22
23
  import { isBulkTextFastPathEligible, performBulkTextReplace } from "./children.js";
23
24
  import { createFineGrainedEffect, markFineGrainedEffectsDirtySource } from "../runtime/effect.js";
@@ -1648,79 +1649,6 @@ function tryPatchStableForDirtyItem(scope) {
1648
1649
  if (didPatch) incDevCounter("stableForPatchHit");
1649
1650
  return didPatch;
1650
1651
  }
1651
- function removeForBoundaryNodes(parent, removedNodes) {
1652
- if (removedNodes.length > 0 && removedNodes.length === parent.childNodes.length) {
1653
- let canBulkClear = true;
1654
- for (let i = 0; i < removedNodes.length; i++) if (removedNodes[i].parentNode !== parent) {
1655
- canBulkClear = false;
1656
- break;
1657
- }
1658
- if (canBulkClear) {
1659
- for (let i = 0; i < removedNodes.length; i++) recordBenchEvent("domRemove");
1660
- withBenchMetricScope("fullClear", () => {
1661
- recordBenchCounter("bulkClearCommits");
1662
- removeAllListeners(parent);
1663
- parent.textContent = "";
1664
- });
1665
- return;
1666
- }
1667
- }
1668
- for (let i = 0; i < removedNodes.length; i++) {
1669
- const node = removedNodes[i];
1670
- if (node.parentNode === parent) {
1671
- recordBenchEvent("domRemove");
1672
- parent.removeChild(node);
1673
- }
1674
- }
1675
- }
1676
- function syncKeyedMapFromForState(parent, forState, strategy, removedNodes) {
1677
- const existing = keyedElements.get(parent);
1678
- const ensureMapEntry = (map, key, element) => {
1679
- map.set(key, element);
1680
- const keyString = String(key);
1681
- map.set(keyString, element);
1682
- const keyNumber = Number(keyString);
1683
- if (!Number.isNaN(keyNumber)) map.set(keyNumber, element);
1684
- };
1685
- if (strategy === "SWAP") {
1686
- if (existing) return;
1687
- }
1688
- if (strategy === "NO_REORDER") {
1689
- if (existing && removedNodes.length === 0) return;
1690
- if (existing) {
1691
- for (const [mapKey, element] of existing) if (element.parentNode !== parent) existing.delete(mapKey);
1692
- if (existing.size > 0) keyedElements.set(parent, existing);
1693
- else keyedElements.delete(parent);
1694
- return;
1695
- }
1696
- }
1697
- if (strategy === "TRUNCATE" && forState.orderedKeys.length === 0) {
1698
- if (existing) existing.clear();
1699
- keyedElements.delete(parent);
1700
- return;
1701
- }
1702
- if (strategy === "APPEND" && existing) {
1703
- for (let i = 0; i < forState.orderedKeys.length; i++) {
1704
- const key = forState.orderedKeys[i];
1705
- if (key === null || existing.has(key)) continue;
1706
- const itemInstance = forState.items.get(key);
1707
- if (itemInstance?.scope.dom instanceof Element) ensureMapEntry(existing, key, itemInstance.scope.dom);
1708
- }
1709
- if (existing.size > 0) keyedElements.set(parent, existing);
1710
- else keyedElements.delete(parent);
1711
- return;
1712
- }
1713
- const nextMap = existing ?? /* @__PURE__ */ new Map();
1714
- nextMap.clear();
1715
- for (let i = 0; i < forState.orderedKeys.length; i++) {
1716
- const key = forState.orderedKeys[i];
1717
- if (key === null) continue;
1718
- const itemInstance = forState.items.get(key);
1719
- if (itemInstance?.scope.dom instanceof Element) ensureMapEntry(nextMap, key, itemInstance.scope.dom);
1720
- }
1721
- if (nextMap.size > 0) keyedElements.set(parent, nextMap);
1722
- else keyedElements.delete(parent);
1723
- }
1724
1652
  function commitForBoundaryChildren(parent, controlState, childrenVNodes) {
1725
1653
  if (controlState.kind !== "for") {
1726
1654
  const activeScope = controlState.activeScope;
@@ -1741,292 +1669,11 @@ function commitForBoundaryChildren(parent, controlState, childrenVNodes) {
1741
1669
  clearControlBoundaryDomUpdateState(controlState);
1742
1670
  return;
1743
1671
  }
1744
- const forState = controlState;
1745
- const domCommitStart = performance.now();
1746
- const hydrateExistingForDom = () => {
1747
- const domKeyMap = getOrBuildDomKeyMap(parent);
1748
- if (!domKeyMap) return;
1749
- for (let i = 0; i < forState.orderedKeys.length; i++) {
1750
- const itemKey = forState.orderedKeys[i];
1751
- const itemInstance = forState.items.get(itemKey);
1752
- if (!itemInstance || itemInstance.scope.dom) continue;
1753
- const existingDom = domKeyMap.get(itemKey);
1754
- if (!existingDom) continue;
1755
- itemInstance.scope.dom = existingDom;
1756
- itemInstance.scope.needsDomUpdate = true;
1757
- }
1758
- };
1759
- if (forState.orderedKeys.length === 0) {
1760
- removeForBoundaryNodes(parent, forState.lastRemovedNodes);
1761
- const fallbackScope = forState.fallbackScope;
1762
- const fallbackVNode = childrenVNodes[0];
1763
- const nextDom = fallbackScope && fallbackVNode !== void 0 ? syncForItemDom(parent, fallbackScope, fallbackVNode) : null;
1764
- if (nextDom) {
1765
- if (parent.childNodes.length !== 1 || parent.firstChild !== nextDom || forState.lastRemovedNodes.length > 0) parent.replaceChildren(nextDom);
1766
- } else if (parent.firstChild) parent.textContent = "";
1767
- keyedElements.delete(parent);
1768
- forState._hasResolvedItemDom = false;
1769
- recordBenchTiming("domCommit", performance.now() - domCommitStart);
1770
- clearForDomUpdateState(forState);
1771
- return;
1772
- }
1773
- if (!forState._hasResolvedItemDom && parent.childNodes.length > 0) hydrateExistingForDom();
1774
- const getDirtyForIndices = () => {
1775
- const pendingDirtyIndices = forState.pendingDirtyIndices;
1776
- if (pendingDirtyIndices && pendingDirtyIndices.length > 0) return pendingDirtyIndices;
1777
- const dirtyIndices = [];
1778
- for (let index = 0; index < forState.orderedKeys.length; index += 1) if (forState.orderedItems[index]?.scope.needsDomUpdate) dirtyIndices.push(index);
1779
- return dirtyIndices;
1780
- };
1781
- let dirtyIndicesCache = null;
1782
- const ensureDirtyIndices = () => {
1783
- if (dirtyIndicesCache) return dirtyIndicesCache;
1784
- dirtyIndicesCache = getDirtyForIndices();
1785
- return dirtyIndicesCache;
1786
- };
1787
- let boundaryChildrenExact = false;
1788
- const commitDirtyNoReorder = (dirtyIndices) => {
1789
- if (dirtyIndices.length === 0) {
1790
- boundaryChildrenExact = true;
1791
- return;
1792
- }
1793
- for (let dirtyIndex = 0; dirtyIndex < dirtyIndices.length; dirtyIndex++) {
1794
- const i = dirtyIndices[dirtyIndex];
1795
- const itemInstance = forState.orderedItems[i];
1796
- if (!itemInstance) continue;
1797
- if (tryPatchStableForDirtyItem(itemInstance.scope)) continue;
1798
- const dom = syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
1799
- if (!dom) continue;
1800
- const anchor = parent.childNodes[i] ?? null;
1801
- if (dom.parentNode !== parent || dom !== anchor) {
1802
- recordBenchEvent("domInsert");
1803
- parent.insertBefore(dom, anchor);
1804
- }
1805
- }
1806
- boundaryChildrenExact = true;
1807
- };
1808
- const commitPositional = () => {
1809
- for (let i = 0; i < forState.orderedKeys.length; i++) {
1810
- const itemInstance = forState.orderedItems[i];
1811
- if (!itemInstance) continue;
1812
- const dom = syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
1813
- if (!dom) continue;
1814
- if (dom.parentNode !== parent) {
1815
- const anchor = parent.childNodes[i] ?? null;
1816
- recordBenchEvent("domInsert");
1817
- parent.insertBefore(dom, anchor);
1818
- }
1819
- }
1820
- boundaryChildrenExact = true;
1821
- };
1822
- const commitAppend = () => {
1823
- if (!forState._hasResolvedItemDom && forState.lastRemovedNodes.length === 0 && parent.childNodes.length === forState.orderedKeys.length) {
1824
- let exactOrder = true;
1825
- let currentNode = parent.firstChild;
1826
- for (let i = 0; i < forState.orderedKeys.length; i++) {
1827
- const itemInstance = forState.orderedItems[i];
1828
- if (!itemInstance) {
1829
- exactOrder = false;
1830
- currentNode = currentNode?.nextSibling ?? null;
1831
- continue;
1832
- }
1833
- if (currentNode !== itemInstance.scope.dom) exactOrder = false;
1834
- const dom = syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
1835
- if (!dom || dom.parentNode !== parent || dom !== currentNode) exactOrder = false;
1836
- currentNode = currentNode?.nextSibling ?? null;
1837
- }
1838
- if (exactOrder) {
1839
- boundaryChildrenExact = true;
1840
- return;
1841
- }
1842
- }
1843
- withBenchMetricScope("coldCreate", () => {
1844
- const fragment = parent.ownerDocument.createDocumentFragment();
1845
- let hasPendingAppend = false;
1846
- for (let i = 0; i < forState.orderedKeys.length; i++) {
1847
- const itemInstance = forState.orderedItems[i];
1848
- if (!itemInstance) continue;
1849
- if (itemInstance.scope.dom?.parentNode === parent && !itemInstance.scope.needsDomUpdate) continue;
1850
- const dom = syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
1851
- if (!dom) continue;
1852
- if (dom.parentNode !== parent) {
1853
- recordBenchEvent("domInsert");
1854
- fragment.appendChild(dom);
1855
- hasPendingAppend = true;
1856
- }
1857
- }
1858
- if (hasPendingAppend) parent.appendChild(fragment);
1859
- });
1860
- boundaryChildrenExact = true;
1861
- };
1862
- const commitSwap = () => {
1863
- const swapIndices = forState.pendingSwapIndices;
1864
- if (!swapIndices) return;
1865
- let [firstIndex, secondIndex] = swapIndices;
1866
- if (firstIndex === secondIndex) return;
1867
- if (firstIndex > secondIndex) [firstIndex, secondIndex] = [secondIndex, firstIndex];
1868
- const firstKey = forState.orderedKeys[firstIndex];
1869
- const secondKey = forState.orderedKeys[secondIndex];
1870
- const firstItem = forState.items.get(firstKey);
1871
- const secondItem = forState.items.get(secondKey);
1872
- if (!firstItem || !secondItem) {
1873
- commitReorder();
1874
- return;
1875
- }
1876
- const firstDom = syncForItemDom(parent, firstItem.scope, childrenVNodes[firstIndex]);
1877
- const secondDom = syncForItemDom(parent, secondItem.scope, childrenVNodes[secondIndex]);
1878
- if (!firstDom || !secondDom) {
1879
- commitReorder();
1880
- return;
1881
- }
1882
- if (firstDom.parentNode !== parent || secondDom.parentNode !== parent) {
1883
- commitReorder();
1884
- return;
1885
- }
1886
- if ((firstDom.compareDocumentPosition(secondDom) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0) {
1887
- boundaryChildrenExact = true;
1888
- return;
1889
- }
1890
- const firstNextSibling = firstDom.nextSibling;
1891
- recordBenchEvent("domMove");
1892
- parent.insertBefore(firstDom, secondDom);
1893
- recordBenchEvent("domMove");
1894
- parent.insertBefore(secondDom, firstNextSibling);
1895
- boundaryChildrenExact = true;
1896
- };
1897
- const commitReorder = () => {
1898
- const items = forState.orderedItems;
1899
- const count = items.length;
1900
- if (forState.pendingMoveOnly && forState.lastRemovedNodes.length === 0) {
1901
- const nodes = [];
1902
- for (let i = 0; i < count; i++) {
1903
- const dom = items[i]?.scope.dom;
1904
- if (!dom) return;
1905
- recordBenchEvent(dom.parentNode === parent ? "domMove" : "domInsert");
1906
- nodes.push(dom);
1907
- }
1908
- parent.replaceChildren(...nodes);
1909
- boundaryChildrenExact = true;
1910
- return;
1911
- }
1912
- let hasExistingChild = false;
1913
- for (let i = 0; i < count; i++) if (items[i]?.scope.dom?.parentNode === parent) {
1914
- hasExistingChild = true;
1915
- break;
1916
- }
1917
- if (!hasExistingChild) {
1918
- withBenchMetricScope("coldCreate", () => {
1919
- const frag = parent.ownerDocument.createDocumentFragment();
1920
- for (let i = 0; i < count; i++) {
1921
- const itemInstance = items[i];
1922
- if (!itemInstance) continue;
1923
- const dom = syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
1924
- if (dom) {
1925
- recordBenchEvent("domInsert");
1926
- frag.appendChild(dom);
1927
- }
1928
- }
1929
- recordBenchCounter("replaceChildrenCommits");
1930
- parent.replaceChildren(frag);
1931
- });
1932
- boundaryChildrenExact = true;
1933
- return;
1934
- }
1935
- if (forState.lastRemovedNodes.length === 0) {
1936
- const frag = parent.ownerDocument.createDocumentFragment();
1937
- for (let i = 0; i < count; i++) {
1938
- const itemInstance = items[i];
1939
- if (!itemInstance) continue;
1940
- const dom = syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
1941
- if (!dom) continue;
1942
- recordBenchEvent(dom.parentNode === parent ? "domMove" : "domInsert");
1943
- frag.appendChild(dom);
1944
- }
1945
- parent.replaceChildren(frag);
1946
- boundaryChildrenExact = true;
1947
- return;
1948
- }
1949
- for (let i = 0; i < count; i++) {
1950
- const itemInstance = items[i];
1951
- if (!itemInstance) continue;
1952
- const dom = syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
1953
- if (!dom) continue;
1954
- const anchor = parent.childNodes[i] ?? null;
1955
- if (dom !== anchor) {
1956
- recordBenchEvent("domMove");
1957
- parent.insertBefore(dom, anchor);
1958
- }
1959
- }
1960
- boundaryChildrenExact = true;
1961
- };
1962
- const isCurrentForDomOrder = () => {
1963
- for (let index = 0; index < forState.orderedKeys.length; index += 1) {
1964
- const itemInstance = forState.orderedItems[index];
1965
- if (!itemInstance?.scope.dom) return false;
1966
- if (parent.childNodes[index] !== itemInstance.scope.dom) return false;
1967
- }
1968
- boundaryChildrenExact = true;
1969
- return true;
1970
- };
1971
- if (forState.lastCommitStrategy === "NO_REORDER" && ensureDirtyIndices().length > 0 && forState.pendingDirtyIndices === null && forState.pendingSwapIndices === null && !forState.pendingMoveOnly && forState.lastRemovedNodes.length === 0 && parent.childNodes.length === forState.orderedKeys.length) {
1972
- if (getRuntimeEnv().NODE_ENV === "production") {
1973
- commitDirtyNoReorder(ensureDirtyIndices());
1974
- syncKeyedMapFromForState(parent, forState, "NO_REORDER", []);
1975
- } else if (isCurrentForDomOrder()) {
1976
- commitDirtyNoReorder(ensureDirtyIndices());
1977
- syncKeyedMapFromForState(parent, forState, "NO_REORDER", []);
1978
- } else {
1979
- commitReorder();
1980
- syncKeyedMapFromForState(parent, forState, "FULL_KEYED", []);
1981
- }
1982
- recordBenchTiming("domCommit", performance.now() - domCommitStart);
1983
- clearForDomUpdateState(forState);
1984
- return;
1985
- }
1986
- switch (forState.lastCommitStrategy) {
1987
- case "NO_REORDER":
1988
- commitDirtyNoReorder(ensureDirtyIndices());
1989
- break;
1990
- case "TRUNCATE":
1991
- commitPositional();
1992
- break;
1993
- case "APPEND":
1994
- commitAppend();
1995
- break;
1996
- case "SWAP":
1997
- commitSwap();
1998
- break;
1999
- default:
2000
- commitReorder();
2001
- break;
2002
- }
2003
- removeForBoundaryNodes(parent, forState.lastRemovedNodes);
2004
- syncKeyedMapFromForState(parent, forState, forState.lastCommitStrategy, forState.lastRemovedNodes);
2005
- const syncExactForBoundaryChildren = () => {
2006
- const expectedNodes = [];
2007
- for (let i = 0; i < forState.orderedKeys.length; i++) {
2008
- const itemInstance = forState.orderedItems[i];
2009
- if (!itemInstance) continue;
2010
- const dom = itemInstance.scope.dom && !itemInstance.scope.needsDomUpdate ? itemInstance.scope.dom : syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
2011
- if (dom) expectedNodes.push(dom);
2012
- }
2013
- const currentNodes = Array.from(parent.childNodes);
2014
- if (currentNodes.length === expectedNodes.length && currentNodes.every((node, index) => node === expectedNodes[index])) return;
2015
- const expectedNodeSet = new Set(expectedNodes);
2016
- for (const currentNode of currentNodes) {
2017
- if (expectedNodeSet.has(currentNode)) continue;
2018
- if (currentNode instanceof Element) teardownNodeSubtree(currentNode);
2019
- if (currentNode.parentNode === parent) {
2020
- recordBenchEvent("domRemove");
2021
- currentNode.remove();
2022
- }
2023
- }
2024
- parent.replaceChildren(...expectedNodes);
2025
- };
2026
- if (!boundaryChildrenExact) syncExactForBoundaryChildren();
2027
- forState._hasResolvedItemDom = true;
2028
- recordBenchTiming("domCommit", performance.now() - domCommitStart);
2029
- clearForDomUpdateState(forState);
1672
+ commitForStateBoundaryChildren(parent, controlState, childrenVNodes, {
1673
+ isProduction: () => getRuntimeEnv().NODE_ENV === "production",
1674
+ syncForItemDom,
1675
+ tryPatchStableForDirtyItem
1676
+ });
2030
1677
  }
2031
1678
  /**
2032
1679
  * Update an existing element's attributes and children from vnode
@@ -2311,6 +1958,11 @@ function tagsEqualIgnoreCase(elementTagName, vnodeType) {
2311
1958
  if (upperCommon !== null && elementTagName === upperCommon) return true;
2312
1959
  return tagNamesEqualIgnoreCase(elementTagName, vnodeType);
2313
1960
  }
1961
+ const STATIC_CHILD_SLOTS_CACHE = Symbol.for("__askrStaticChildSlots");
1962
+ let staticChildSlotsCacheEnabled = true;
1963
+ function setStaticChildSlotsCacheEnabled(enabled) {
1964
+ staticChildSlotsCacheEnabled = enabled;
1965
+ }
2314
1966
  function collectStaticChildSlots(children, slots) {
2315
1967
  if (isFragmentVNode(children)) return collectStaticChildSlots(children.props?.children ?? children.children, slots);
2316
1968
  if (Array.isArray(children)) {
@@ -2334,9 +1986,18 @@ function collectStaticChildSlots(children, slots) {
2334
1986
  }
2335
1987
  return false;
2336
1988
  }
2337
- function getStaticChildSlots(children) {
1989
+ function getStaticChildSlots(vnode) {
1990
+ if (staticChildSlotsCacheEnabled) {
1991
+ const cached = vnode[STATIC_CHILD_SLOTS_CACHE];
1992
+ if (cached !== void 0) return cached;
1993
+ }
2338
1994
  const slots = [];
2339
- return collectStaticChildSlots(children, slots) ? slots : null;
1995
+ const staticSlots = collectStaticChildSlots(vnode.props?.children ?? vnode.children, slots) ? slots : null;
1996
+ if (staticChildSlotsCacheEnabled) {
1997
+ const cacheNode = vnode;
1998
+ if (Object.isExtensible(vnode)) cacheNode[STATIC_CHILD_SLOTS_CACHE] = staticSlots;
1999
+ }
2000
+ return staticSlots;
2340
2001
  }
2341
2002
  function hasMatchingStaticProps(el, props, vnodeType) {
2342
2003
  let staticPropCount = 0;
@@ -2374,9 +2035,8 @@ function hasMatchingStaticProps(el, props, vnodeType) {
2374
2035
  }
2375
2036
  function canReuseStaticSubtree(el, vnode) {
2376
2037
  if (typeof vnode.type !== "string" || !tagsEqualIgnoreCase(el.tagName, vnode.type)) return false;
2377
- const props = vnode.props || {};
2378
- if (!hasMatchingStaticProps(el, props, vnode.type)) return false;
2379
- const slots = getStaticChildSlots(props.children ?? vnode.children);
2038
+ if (!hasMatchingStaticProps(el, vnode.props || {}, vnode.type)) return false;
2039
+ const slots = getStaticChildSlots(vnode);
2380
2040
  if (!slots) return false;
2381
2041
  if (el.childNodes.length !== slots.length) return false;
2382
2042
  for (let index = 0; index < slots.length; index += 1) {
@@ -2554,6 +2214,6 @@ function updateUnkeyedChildren(parent, newChildren, forceUpdate = false) {
2554
2214
  }
2555
2215
  }
2556
2216
  //#endregion
2557
- export { IS_DOM_AVAILABLE, commitForBoundaryChildren, createDOMNode, createForBoundary, markReactivePropsDirtySource, syncComponentElement, tryPatchStableForDirtyItem, updateElementChildren, updateElementFromVnode, updateUnkeyedChildren };
2217
+ export { IS_DOM_AVAILABLE, commitForBoundaryChildren, createDOMNode, createForBoundary, markReactivePropsDirtySource, setStaticChildSlotsCacheEnabled, syncComponentElement, tryPatchStableForDirtyItem, updateElementChildren, updateElementFromVnode, updateUnkeyedChildren };
2558
2218
 
2559
2219
  //# sourceMappingURL=dom.js.map