streetui 1.7.0 → 1.8.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.
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { a as Signal, b as Subscriber, U as Unsubscribe, R as ReadonlySignal, A as ApplicationId, D as DiagnosticCollector, c as ApplicationGraph, G as GraphNode, C as CompiledApplication, d as SemanticNodeType, P as PageDSL, e as ContainerDSL, f as SignalKind } from './compile-Cte0nf06.cjs';
2
- export { g as A11yOptions, h as AppBuilder, i as AppDSL, j as AppOptions, k as ApplicationGraphOptions, B as BaseNode, l as Bindable, m as BindableText, n as BoundInputOptions, o as ButtonOptions, p as CompileOptions, q as ContainerBuilder, r as ContainerBuilderImpl, s as ContainerOptions, t as ContentDSL, u as ControlledInputOptions, v as DerivedSignal, w as Diagnostic, x as DiagnosticError, y as DiagnosticLocation, z as DiagnosticSeverity, E as ErrorBoundaryOptions, F as ErrorFallbackBuilder, H as ErrorSource, I as EventDescriptor, J as FormBuilder, K as FormBuilderImpl, L as FormDSL, M as FormOptions, N as GraphNodeData, O as HandlerFn, Q as HeadingOptions, T as ImageOptions, W as InputOptions, X as InputOptionsBase, Y as LinkOptions, Z as ListBuilder, _ as ListBuilderImpl, $ as ListDSL, a0 as ListOptions, a1 as ListPlanEntry, a2 as NodeId, a3 as NodeMetadata, a4 as OverlayOptions, a5 as PageBuilder, a6 as PageBuilderImpl, a7 as PortalOptions, a8 as PropValue, a9 as Props, aa as ReactiveConsumer, ab as ReactiveSource, ac as SectionBuilder, ad as SectionBuilderImpl, ae as SectionDSL, af as SectionOptions, ag as SerializedGraph, ah as SerializedNode, ai as StateRef, S as StreetApp, aj as StreetUI, ak as TextOptions, al as TextValue, V as VERSION, am as batch, an as compile, ao as compileGraph, ap as createNodeId, aq as derived, ar as effect, as as formatDiagnostic, at as generateApplicationId, au as generateNodeId, av as isBatching, aw as nextId, ax as nodeIdPrefix, ay as observerCount, az as reactiveListItemKey, aA as reactiveListItemSignature, aB as resetIdCounter, aC as signal, aD as signalKind, aE as streetui } from './compile-Cte0nf06.cjs';
3
- import { R as RenderHandle, S as StreetRenderer, a as HydrationDiagnosticSink } from './hydration-diagnostics-zK-fihvd.cjs';
4
- export { H as HydrationDiagnostic, b as HydrationMismatchType, c as consoleHydrationDiagnosticSink, d as createHydrationDiagnosticCollector, f as formatHydrationDiagnostic } from './hydration-diagnostics-zK-fihvd.cjs';
5
- import { D as DOMAdapter } from './server-D4A8eunr.cjs';
6
- export { R as RenderToStringOptions, S as STATE_MARKER_ATTR, a as ServerDOMAdapter, r as readState, b as renderToString, s as serializeState, c as serverDOMAdapter } from './server-D4A8eunr.cjs';
1
+ import { c as Signal, d as Subscriber, U as Unsubscribe, R as ReadonlySignal, A as ApplicationId, D as DiagnosticCollector, e as ApplicationGraph, G as GraphNode, C as CompiledApplication, f as SemanticNodeType, P as PageDSL, g as ContainerDSL, h as SignalKind } from './compile-CJJQYi71.cjs';
2
+ export { i as A11yOptions, j as AppBuilder, k as AppDSL, l as AppOptions, m as ApplicationGraphOptions, B as BaseNode, n as Bindable, o as BindableText, p as BoundInputOptions, q as ButtonOptions, r as CompileOptions, b as ComponentChildren, s as ComponentContext, a as ComponentDefinition, t as ComponentRender, u as ComponentSetup, b as ContainerBuilder, v as ContainerBuilderImpl, w as ContainerOptions, x as ContentDSL, y as ControlledInputOptions, z as DerivedSignal, E as Diagnostic, F as DiagnosticError, H as DiagnosticLocation, I as DiagnosticSeverity, J as ErrorBoundaryOptions, K as ErrorFallbackBuilder, L as ErrorSource, M as EventDescriptor, N as FormBuilder, O as FormBuilderImpl, Q as FormDSL, T as FormOptions, W as GraphNodeData, X as HandlerFn, Y as HeadingOptions, Z as ImageOptions, _ as InputOptions, $ as InputOptionsBase, a0 as LinkOptions, a1 as ListBuilder, a2 as ListBuilderImpl, a3 as ListDSL, a4 as ListOptions, a5 as ListPlanEntry, a6 as NodeId, a7 as NodeMetadata, a8 as OverlayOptions, a9 as PageBuilder, aa as PageBuilderImpl, ab as PortalOptions, ac as PropValue, ad as Props, ae as ReactiveConsumer, af as ReactiveSource, ag as SectionBuilder, ah as SectionBuilderImpl, ai as SectionDSL, aj as SectionOptions, ak as SerializedGraph, al as SerializedNode, am as StateRef, S as StreetApp, an as StreetUI, ao as TextOptions, ap as TextValue, V as VERSION, aq as batch, ar as compile, as as compileGraph, at as component, au as createNodeId, av as derived, aw as effect, ax as formatDiagnostic, ay as generateApplicationId, az as generateNodeId, aA as isBatching, aB as isComponentDefinition, aC as nextId, aD as nodeIdPrefix, aE as observerCount, aF as reactiveListItemKey, aG as reactiveListItemSignature, aH as resetIdCounter, aI as signal, aJ as signalKind, aK as streetui } from './compile-CJJQYi71.cjs';
3
+ import { R as RenderHandle, S as StreetRenderer, a as HydrationDiagnosticSink } from './hydration-diagnostics-BQeehq3i.cjs';
4
+ export { H as HydrationDiagnostic, b as HydrationMismatchType, c as consoleHydrationDiagnosticSink, d as createHydrationDiagnosticCollector, f as formatHydrationDiagnostic } from './hydration-diagnostics-BQeehq3i.cjs';
5
+ import { D as DOMAdapter } from './server-CnLEnlYU.cjs';
6
+ export { R as RenderToStringOptions, S as STATE_MARKER_ATTR, a as ServerDOMAdapter, r as readState, b as renderToString, s as serializeState, c as serverDOMAdapter } from './server-CnLEnlYU.cjs';
7
7
 
8
8
  /**
9
9
  * A simple reactive store built on top of signals.
@@ -839,6 +839,16 @@ declare function wireReactiveList(ctx: RenderContext, graphNode: GraphNode, inst
839
839
  * focus. All listeners are tracked on the instance and torn down on unmount.
840
840
  */
841
841
  declare function wireOverlayBehavior(ctx: RenderContext, graphNode: GraphNode, instance: NodeInstance, target: Element): void;
842
+ /**
843
+ * Wire a component instance's lifecycle (§9). Reads the optional
844
+ * `__component__<id>` descriptor — an array of teardown callbacks the DSL's
845
+ * `component()` collected from the setup's `ctx.effect`/`ctx.onCleanup` — and
846
+ * routes each into `NodeInstance.trackCleanup`, so they run (children-first)
847
+ * when the component leaves the graph. Shared by the mount and hydrate paths so
848
+ * both attach identical ownership. A `'component'` node with no cleanups (no
849
+ * effects/resources) registers no descriptor and this is a no-op.
850
+ */
851
+ declare function wireComponentBehavior(ctx: RenderContext, graphNode: GraphNode, instance: NodeInstance): void;
842
852
 
843
853
  /**
844
854
  * Patch — targeted DOM updates driven by signal changes.
@@ -1457,6 +1467,29 @@ declare function printGraph(graph: ApplicationGraph): string;
1457
1467
  declare function printDiagnostics(compiled: CompiledApplication): string;
1458
1468
  /** Returns node counts per type. */
1459
1469
  declare function nodeTypeStats(graph: ApplicationGraph): Record<string, number>;
1470
+ /** A single component instance surfaced for DevTools inspection (§21). */
1471
+ interface InspectedComponent {
1472
+ /** The build-order node id (churns across rebuilds — not stable identity). */
1473
+ id: string;
1474
+ /** The stable, author-provided identity key passed at the call site. */
1475
+ key: string | undefined;
1476
+ /** The definition's human-readable name (from `data-streetui-component`). */
1477
+ name: string;
1478
+ /** Depth of the component node in the graph. */
1479
+ depth: number;
1480
+ /** Number of direct child nodes the component rendered. */
1481
+ childCount: number;
1482
+ }
1483
+ /**
1484
+ * List every `component()` instance in the graph, in document order, with its
1485
+ * stable `key`, human-readable `name` and location. Components are ordinary
1486
+ * `'component'` GraphNodes (they flow through `inspectGraph`/`printGraph`
1487
+ * already); this is the first-class, component-aware view for DevTools — it
1488
+ * reads the inspectable `data-streetui-component` name attribute the DSL sets,
1489
+ * never any internal `_`-prefixed metadata. Names/keys are stable across
1490
+ * fine-grained prop updates (which never rebuild the node).
1491
+ */
1492
+ declare function inspectComponents(graph: ApplicationGraph): InspectedComponent[];
1460
1493
 
1461
1494
  /**
1462
1495
  * DevTools foundation (v0.6, Phase 18). A single read-only entry point that
@@ -1890,4 +1923,4 @@ interface ResolvedConfig {
1890
1923
  /** Identity helper that gives `streetui.config.ts` full type-checking + inference. */
1891
1924
  declare function defineConfig(config: StreetUIConfig): StreetUIConfig;
1892
1925
 
1893
- export { type A11yIds, Application, ApplicationGraph, ApplicationId, type ApplicationIdentity, type ApplicationInspection, type ApplicationOptions, type ApplicationPanel, BrowserDOMAdapter, CleanupRegistry, CompiledApplication, ContainerDSL, type Context, type ContextInspection, type ContextLike, DEFAULT_PERF_THRESHOLDS, DOMAdapter, type DevToolsOptions, type DevToolsSession, type DevToolsSnapshot, type DevToolsSources, DiagnosticCollector, type DiagnosticContext, type DiagnosticSink, type DiagnosticsSummary, type DomBinding, DomEventRegistry, Environment, type EnvironmentCapabilities, type EnvironmentKind, EventBus, type EventHandler, FOCUSABLE_SELECTOR, type Field, type Form, type FormConfig, type FormInspection, type FormLike, type FormValidators, type FormValues, GraphNode, HydrationDiagnosticSink, type I18n, type I18nConfig, type I18nInspection, type I18nLike, type InspectFormOptions, type InspectI18nOptions, type InspectResourceOptions, type InspectSignalOptions, type InspectedNode, type InspectedPage, type InterpolationParams, type IsActiveOptions, type Job, Lifecycle, type LifecycleHook, type LifecyclePhase, type MatchResult, type MessageMap, type MountFn, type MountRouterOptions, type MountedApplication, type MountedRouter, type NavigateOptions, NodeInstance, type NodeInstanceOptions, PageDSL, type PerfDiagnostic, type PerfDiagnosticCode, type PerfSnapshot, type PerfThresholds, type PerformancePanel, type PlanEntry, type Priority, ROUTER_OUTLET_ID, ReadonlySignal, type ReconcileResult, type RenderContext, RenderHandle, type ResolvedConfig, type Resource, type ResourceInspection, type ResourceLike, type ResourceLoader, type ResourceLoaderContext, type ResourceOptions, type ResourceStatus, type RouteBuilder, type RouteContext, type RouteDefinition, type RouteMatch, type RouteMatchLike, type Router, type RouterHistory, type RouterInspection, type RouterLike, type RouterLocation, type RouterOptions, Runtime, RuntimeNodeInstance, type RuntimeOptions, Scheduler, type SchedulerDiagnostics, SemanticNodeType, ServerComment, ServerElement, ServerFragment, type ServerNode, type ServerNodeKind, type ServerParent, ServerRawHTML, ServerStyle, ServerText, type ShellBuilder, Signal, type SignalInspection, SignalKind, type SignalsPanel, Store, type StoreState, type StreetEvent, type StreetEventType, StreetFrameworkError, StreetRenderHandle, StreetRenderer, StreetRendererImpl, type StreetRendererOptions, type StreetUIConfig, type SubmitStatus, Subscriber, Unsubscribe, type Validator, a11yIds, applyNodeProps, applyProp, bindDomEvent, browserDOMAdapter, buttonUpdate, consoleDiagnosticSink, containFocus, createApplication, createBrowserHistory, createContext, createDevTools, createForm, createI18n, createMemoryHistory, createRenderContext, createRenderer, createRouter, createRuntime, createStore, createStreetEvent, defineConfig, diagnosePerformance, email, environment, escapeHtmlAttr, escapeHtmlText, flushSync, focusById, focusFirst, focusInitial, formatDiagnosticContext, frameworkError, getFocusable, globalEventBus, headingUpdate, hydrateGraph, inputUpdate, inspectApplication, inspectContext, inspectForm, inspectGraph, inspectI18n, inspectResource, inspectRouter, inspectSignal, interpolate, matchPattern, matchRoutes, maxLength, minLength, mountGraph, mountNode, mountRouter, nodeTypeStats, normalizePath, onEscape, patchNode, patchProp, pattern, printDiagnostics, printGraph, reconcileChildren, reconcileChildrenByPlan, reportDiagnostic, required, resolveTag, resource, restoreFocus, routerOutlet, runValidators, saveFocus, scheduleImmediate, scheduleUpdate, scheduler, serializeChildren, serializeServerNode, splitTarget, textUpdate, toIdToken, transformGraph, trapFocus, validateGraph, wireEvents, wireOverlayBehavior, wireReactiveList, wireSignalBindings };
1926
+ export { type A11yIds, Application, ApplicationGraph, ApplicationId, type ApplicationIdentity, type ApplicationInspection, type ApplicationOptions, type ApplicationPanel, BrowserDOMAdapter, CleanupRegistry, CompiledApplication, ContainerDSL, type Context, type ContextInspection, type ContextLike, DEFAULT_PERF_THRESHOLDS, DOMAdapter, type DevToolsOptions, type DevToolsSession, type DevToolsSnapshot, type DevToolsSources, DiagnosticCollector, type DiagnosticContext, type DiagnosticSink, type DiagnosticsSummary, type DomBinding, DomEventRegistry, Environment, type EnvironmentCapabilities, type EnvironmentKind, EventBus, type EventHandler, FOCUSABLE_SELECTOR, type Field, type Form, type FormConfig, type FormInspection, type FormLike, type FormValidators, type FormValues, GraphNode, HydrationDiagnosticSink, type I18n, type I18nConfig, type I18nInspection, type I18nLike, type InspectFormOptions, type InspectI18nOptions, type InspectResourceOptions, type InspectSignalOptions, type InspectedComponent, type InspectedNode, type InspectedPage, type InterpolationParams, type IsActiveOptions, type Job, Lifecycle, type LifecycleHook, type LifecyclePhase, type MatchResult, type MessageMap, type MountFn, type MountRouterOptions, type MountedApplication, type MountedRouter, type NavigateOptions, NodeInstance, type NodeInstanceOptions, PageDSL, type PerfDiagnostic, type PerfDiagnosticCode, type PerfSnapshot, type PerfThresholds, type PerformancePanel, type PlanEntry, type Priority, ROUTER_OUTLET_ID, ReadonlySignal, type ReconcileResult, type RenderContext, RenderHandle, type ResolvedConfig, type Resource, type ResourceInspection, type ResourceLike, type ResourceLoader, type ResourceLoaderContext, type ResourceOptions, type ResourceStatus, type RouteBuilder, type RouteContext, type RouteDefinition, type RouteMatch, type RouteMatchLike, type Router, type RouterHistory, type RouterInspection, type RouterLike, type RouterLocation, type RouterOptions, Runtime, RuntimeNodeInstance, type RuntimeOptions, Scheduler, type SchedulerDiagnostics, SemanticNodeType, ServerComment, ServerElement, ServerFragment, type ServerNode, type ServerNodeKind, type ServerParent, ServerRawHTML, ServerStyle, ServerText, type ShellBuilder, Signal, type SignalInspection, SignalKind, type SignalsPanel, Store, type StoreState, type StreetEvent, type StreetEventType, StreetFrameworkError, StreetRenderHandle, StreetRenderer, StreetRendererImpl, type StreetRendererOptions, type StreetUIConfig, type SubmitStatus, Subscriber, Unsubscribe, type Validator, a11yIds, applyNodeProps, applyProp, bindDomEvent, browserDOMAdapter, buttonUpdate, consoleDiagnosticSink, containFocus, createApplication, createBrowserHistory, createContext, createDevTools, createForm, createI18n, createMemoryHistory, createRenderContext, createRenderer, createRouter, createRuntime, createStore, createStreetEvent, defineConfig, diagnosePerformance, email, environment, escapeHtmlAttr, escapeHtmlText, flushSync, focusById, focusFirst, focusInitial, formatDiagnosticContext, frameworkError, getFocusable, globalEventBus, headingUpdate, hydrateGraph, inputUpdate, inspectApplication, inspectComponents, inspectContext, inspectForm, inspectGraph, inspectI18n, inspectResource, inspectRouter, inspectSignal, interpolate, matchPattern, matchRoutes, maxLength, minLength, mountGraph, mountNode, mountRouter, nodeTypeStats, normalizePath, onEscape, patchNode, patchProp, pattern, printDiagnostics, printGraph, reconcileChildren, reconcileChildrenByPlan, reportDiagnostic, required, resolveTag, resource, restoreFocus, routerOutlet, runValidators, saveFocus, scheduleImmediate, scheduleUpdate, scheduler, serializeChildren, serializeServerNode, splitTarget, textUpdate, toIdToken, transformGraph, trapFocus, validateGraph, wireComponentBehavior, wireEvents, wireOverlayBehavior, wireReactiveList, wireSignalBindings };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { a as Signal, b as Subscriber, U as Unsubscribe, R as ReadonlySignal, A as ApplicationId, D as DiagnosticCollector, c as ApplicationGraph, G as GraphNode, C as CompiledApplication, d as SemanticNodeType, P as PageDSL, e as ContainerDSL, f as SignalKind } from './compile-Cte0nf06.js';
2
- export { g as A11yOptions, h as AppBuilder, i as AppDSL, j as AppOptions, k as ApplicationGraphOptions, B as BaseNode, l as Bindable, m as BindableText, n as BoundInputOptions, o as ButtonOptions, p as CompileOptions, q as ContainerBuilder, r as ContainerBuilderImpl, s as ContainerOptions, t as ContentDSL, u as ControlledInputOptions, v as DerivedSignal, w as Diagnostic, x as DiagnosticError, y as DiagnosticLocation, z as DiagnosticSeverity, E as ErrorBoundaryOptions, F as ErrorFallbackBuilder, H as ErrorSource, I as EventDescriptor, J as FormBuilder, K as FormBuilderImpl, L as FormDSL, M as FormOptions, N as GraphNodeData, O as HandlerFn, Q as HeadingOptions, T as ImageOptions, W as InputOptions, X as InputOptionsBase, Y as LinkOptions, Z as ListBuilder, _ as ListBuilderImpl, $ as ListDSL, a0 as ListOptions, a1 as ListPlanEntry, a2 as NodeId, a3 as NodeMetadata, a4 as OverlayOptions, a5 as PageBuilder, a6 as PageBuilderImpl, a7 as PortalOptions, a8 as PropValue, a9 as Props, aa as ReactiveConsumer, ab as ReactiveSource, ac as SectionBuilder, ad as SectionBuilderImpl, ae as SectionDSL, af as SectionOptions, ag as SerializedGraph, ah as SerializedNode, ai as StateRef, S as StreetApp, aj as StreetUI, ak as TextOptions, al as TextValue, V as VERSION, am as batch, an as compile, ao as compileGraph, ap as createNodeId, aq as derived, ar as effect, as as formatDiagnostic, at as generateApplicationId, au as generateNodeId, av as isBatching, aw as nextId, ax as nodeIdPrefix, ay as observerCount, az as reactiveListItemKey, aA as reactiveListItemSignature, aB as resetIdCounter, aC as signal, aD as signalKind, aE as streetui } from './compile-Cte0nf06.js';
3
- import { R as RenderHandle, S as StreetRenderer, a as HydrationDiagnosticSink } from './hydration-diagnostics-Ddgs3Puu.js';
4
- export { H as HydrationDiagnostic, b as HydrationMismatchType, c as consoleHydrationDiagnosticSink, d as createHydrationDiagnosticCollector, f as formatHydrationDiagnostic } from './hydration-diagnostics-Ddgs3Puu.js';
5
- import { D as DOMAdapter } from './server-cgmCiPsz.js';
6
- export { R as RenderToStringOptions, S as STATE_MARKER_ATTR, a as ServerDOMAdapter, r as readState, b as renderToString, s as serializeState, c as serverDOMAdapter } from './server-cgmCiPsz.js';
1
+ import { c as Signal, d as Subscriber, U as Unsubscribe, R as ReadonlySignal, A as ApplicationId, D as DiagnosticCollector, e as ApplicationGraph, G as GraphNode, C as CompiledApplication, f as SemanticNodeType, P as PageDSL, g as ContainerDSL, h as SignalKind } from './compile-CJJQYi71.js';
2
+ export { i as A11yOptions, j as AppBuilder, k as AppDSL, l as AppOptions, m as ApplicationGraphOptions, B as BaseNode, n as Bindable, o as BindableText, p as BoundInputOptions, q as ButtonOptions, r as CompileOptions, b as ComponentChildren, s as ComponentContext, a as ComponentDefinition, t as ComponentRender, u as ComponentSetup, b as ContainerBuilder, v as ContainerBuilderImpl, w as ContainerOptions, x as ContentDSL, y as ControlledInputOptions, z as DerivedSignal, E as Diagnostic, F as DiagnosticError, H as DiagnosticLocation, I as DiagnosticSeverity, J as ErrorBoundaryOptions, K as ErrorFallbackBuilder, L as ErrorSource, M as EventDescriptor, N as FormBuilder, O as FormBuilderImpl, Q as FormDSL, T as FormOptions, W as GraphNodeData, X as HandlerFn, Y as HeadingOptions, Z as ImageOptions, _ as InputOptions, $ as InputOptionsBase, a0 as LinkOptions, a1 as ListBuilder, a2 as ListBuilderImpl, a3 as ListDSL, a4 as ListOptions, a5 as ListPlanEntry, a6 as NodeId, a7 as NodeMetadata, a8 as OverlayOptions, a9 as PageBuilder, aa as PageBuilderImpl, ab as PortalOptions, ac as PropValue, ad as Props, ae as ReactiveConsumer, af as ReactiveSource, ag as SectionBuilder, ah as SectionBuilderImpl, ai as SectionDSL, aj as SectionOptions, ak as SerializedGraph, al as SerializedNode, am as StateRef, S as StreetApp, an as StreetUI, ao as TextOptions, ap as TextValue, V as VERSION, aq as batch, ar as compile, as as compileGraph, at as component, au as createNodeId, av as derived, aw as effect, ax as formatDiagnostic, ay as generateApplicationId, az as generateNodeId, aA as isBatching, aB as isComponentDefinition, aC as nextId, aD as nodeIdPrefix, aE as observerCount, aF as reactiveListItemKey, aG as reactiveListItemSignature, aH as resetIdCounter, aI as signal, aJ as signalKind, aK as streetui } from './compile-CJJQYi71.js';
3
+ import { R as RenderHandle, S as StreetRenderer, a as HydrationDiagnosticSink } from './hydration-diagnostics-DNAJumYF.js';
4
+ export { H as HydrationDiagnostic, b as HydrationMismatchType, c as consoleHydrationDiagnosticSink, d as createHydrationDiagnosticCollector, f as formatHydrationDiagnostic } from './hydration-diagnostics-DNAJumYF.js';
5
+ import { D as DOMAdapter } from './server-DNlg7ou2.js';
6
+ export { R as RenderToStringOptions, S as STATE_MARKER_ATTR, a as ServerDOMAdapter, r as readState, b as renderToString, s as serializeState, c as serverDOMAdapter } from './server-DNlg7ou2.js';
7
7
 
8
8
  /**
9
9
  * A simple reactive store built on top of signals.
@@ -839,6 +839,16 @@ declare function wireReactiveList(ctx: RenderContext, graphNode: GraphNode, inst
839
839
  * focus. All listeners are tracked on the instance and torn down on unmount.
840
840
  */
841
841
  declare function wireOverlayBehavior(ctx: RenderContext, graphNode: GraphNode, instance: NodeInstance, target: Element): void;
842
+ /**
843
+ * Wire a component instance's lifecycle (§9). Reads the optional
844
+ * `__component__<id>` descriptor — an array of teardown callbacks the DSL's
845
+ * `component()` collected from the setup's `ctx.effect`/`ctx.onCleanup` — and
846
+ * routes each into `NodeInstance.trackCleanup`, so they run (children-first)
847
+ * when the component leaves the graph. Shared by the mount and hydrate paths so
848
+ * both attach identical ownership. A `'component'` node with no cleanups (no
849
+ * effects/resources) registers no descriptor and this is a no-op.
850
+ */
851
+ declare function wireComponentBehavior(ctx: RenderContext, graphNode: GraphNode, instance: NodeInstance): void;
842
852
 
843
853
  /**
844
854
  * Patch — targeted DOM updates driven by signal changes.
@@ -1457,6 +1467,29 @@ declare function printGraph(graph: ApplicationGraph): string;
1457
1467
  declare function printDiagnostics(compiled: CompiledApplication): string;
1458
1468
  /** Returns node counts per type. */
1459
1469
  declare function nodeTypeStats(graph: ApplicationGraph): Record<string, number>;
1470
+ /** A single component instance surfaced for DevTools inspection (§21). */
1471
+ interface InspectedComponent {
1472
+ /** The build-order node id (churns across rebuilds — not stable identity). */
1473
+ id: string;
1474
+ /** The stable, author-provided identity key passed at the call site. */
1475
+ key: string | undefined;
1476
+ /** The definition's human-readable name (from `data-streetui-component`). */
1477
+ name: string;
1478
+ /** Depth of the component node in the graph. */
1479
+ depth: number;
1480
+ /** Number of direct child nodes the component rendered. */
1481
+ childCount: number;
1482
+ }
1483
+ /**
1484
+ * List every `component()` instance in the graph, in document order, with its
1485
+ * stable `key`, human-readable `name` and location. Components are ordinary
1486
+ * `'component'` GraphNodes (they flow through `inspectGraph`/`printGraph`
1487
+ * already); this is the first-class, component-aware view for DevTools — it
1488
+ * reads the inspectable `data-streetui-component` name attribute the DSL sets,
1489
+ * never any internal `_`-prefixed metadata. Names/keys are stable across
1490
+ * fine-grained prop updates (which never rebuild the node).
1491
+ */
1492
+ declare function inspectComponents(graph: ApplicationGraph): InspectedComponent[];
1460
1493
 
1461
1494
  /**
1462
1495
  * DevTools foundation (v0.6, Phase 18). A single read-only entry point that
@@ -1890,4 +1923,4 @@ interface ResolvedConfig {
1890
1923
  /** Identity helper that gives `streetui.config.ts` full type-checking + inference. */
1891
1924
  declare function defineConfig(config: StreetUIConfig): StreetUIConfig;
1892
1925
 
1893
- export { type A11yIds, Application, ApplicationGraph, ApplicationId, type ApplicationIdentity, type ApplicationInspection, type ApplicationOptions, type ApplicationPanel, BrowserDOMAdapter, CleanupRegistry, CompiledApplication, ContainerDSL, type Context, type ContextInspection, type ContextLike, DEFAULT_PERF_THRESHOLDS, DOMAdapter, type DevToolsOptions, type DevToolsSession, type DevToolsSnapshot, type DevToolsSources, DiagnosticCollector, type DiagnosticContext, type DiagnosticSink, type DiagnosticsSummary, type DomBinding, DomEventRegistry, Environment, type EnvironmentCapabilities, type EnvironmentKind, EventBus, type EventHandler, FOCUSABLE_SELECTOR, type Field, type Form, type FormConfig, type FormInspection, type FormLike, type FormValidators, type FormValues, GraphNode, HydrationDiagnosticSink, type I18n, type I18nConfig, type I18nInspection, type I18nLike, type InspectFormOptions, type InspectI18nOptions, type InspectResourceOptions, type InspectSignalOptions, type InspectedNode, type InspectedPage, type InterpolationParams, type IsActiveOptions, type Job, Lifecycle, type LifecycleHook, type LifecyclePhase, type MatchResult, type MessageMap, type MountFn, type MountRouterOptions, type MountedApplication, type MountedRouter, type NavigateOptions, NodeInstance, type NodeInstanceOptions, PageDSL, type PerfDiagnostic, type PerfDiagnosticCode, type PerfSnapshot, type PerfThresholds, type PerformancePanel, type PlanEntry, type Priority, ROUTER_OUTLET_ID, ReadonlySignal, type ReconcileResult, type RenderContext, RenderHandle, type ResolvedConfig, type Resource, type ResourceInspection, type ResourceLike, type ResourceLoader, type ResourceLoaderContext, type ResourceOptions, type ResourceStatus, type RouteBuilder, type RouteContext, type RouteDefinition, type RouteMatch, type RouteMatchLike, type Router, type RouterHistory, type RouterInspection, type RouterLike, type RouterLocation, type RouterOptions, Runtime, RuntimeNodeInstance, type RuntimeOptions, Scheduler, type SchedulerDiagnostics, SemanticNodeType, ServerComment, ServerElement, ServerFragment, type ServerNode, type ServerNodeKind, type ServerParent, ServerRawHTML, ServerStyle, ServerText, type ShellBuilder, Signal, type SignalInspection, SignalKind, type SignalsPanel, Store, type StoreState, type StreetEvent, type StreetEventType, StreetFrameworkError, StreetRenderHandle, StreetRenderer, StreetRendererImpl, type StreetRendererOptions, type StreetUIConfig, type SubmitStatus, Subscriber, Unsubscribe, type Validator, a11yIds, applyNodeProps, applyProp, bindDomEvent, browserDOMAdapter, buttonUpdate, consoleDiagnosticSink, containFocus, createApplication, createBrowserHistory, createContext, createDevTools, createForm, createI18n, createMemoryHistory, createRenderContext, createRenderer, createRouter, createRuntime, createStore, createStreetEvent, defineConfig, diagnosePerformance, email, environment, escapeHtmlAttr, escapeHtmlText, flushSync, focusById, focusFirst, focusInitial, formatDiagnosticContext, frameworkError, getFocusable, globalEventBus, headingUpdate, hydrateGraph, inputUpdate, inspectApplication, inspectContext, inspectForm, inspectGraph, inspectI18n, inspectResource, inspectRouter, inspectSignal, interpolate, matchPattern, matchRoutes, maxLength, minLength, mountGraph, mountNode, mountRouter, nodeTypeStats, normalizePath, onEscape, patchNode, patchProp, pattern, printDiagnostics, printGraph, reconcileChildren, reconcileChildrenByPlan, reportDiagnostic, required, resolveTag, resource, restoreFocus, routerOutlet, runValidators, saveFocus, scheduleImmediate, scheduleUpdate, scheduler, serializeChildren, serializeServerNode, splitTarget, textUpdate, toIdToken, transformGraph, trapFocus, validateGraph, wireEvents, wireOverlayBehavior, wireReactiveList, wireSignalBindings };
1926
+ export { type A11yIds, Application, ApplicationGraph, ApplicationId, type ApplicationIdentity, type ApplicationInspection, type ApplicationOptions, type ApplicationPanel, BrowserDOMAdapter, CleanupRegistry, CompiledApplication, ContainerDSL, type Context, type ContextInspection, type ContextLike, DEFAULT_PERF_THRESHOLDS, DOMAdapter, type DevToolsOptions, type DevToolsSession, type DevToolsSnapshot, type DevToolsSources, DiagnosticCollector, type DiagnosticContext, type DiagnosticSink, type DiagnosticsSummary, type DomBinding, DomEventRegistry, Environment, type EnvironmentCapabilities, type EnvironmentKind, EventBus, type EventHandler, FOCUSABLE_SELECTOR, type Field, type Form, type FormConfig, type FormInspection, type FormLike, type FormValidators, type FormValues, GraphNode, HydrationDiagnosticSink, type I18n, type I18nConfig, type I18nInspection, type I18nLike, type InspectFormOptions, type InspectI18nOptions, type InspectResourceOptions, type InspectSignalOptions, type InspectedComponent, type InspectedNode, type InspectedPage, type InterpolationParams, type IsActiveOptions, type Job, Lifecycle, type LifecycleHook, type LifecyclePhase, type MatchResult, type MessageMap, type MountFn, type MountRouterOptions, type MountedApplication, type MountedRouter, type NavigateOptions, NodeInstance, type NodeInstanceOptions, PageDSL, type PerfDiagnostic, type PerfDiagnosticCode, type PerfSnapshot, type PerfThresholds, type PerformancePanel, type PlanEntry, type Priority, ROUTER_OUTLET_ID, ReadonlySignal, type ReconcileResult, type RenderContext, RenderHandle, type ResolvedConfig, type Resource, type ResourceInspection, type ResourceLike, type ResourceLoader, type ResourceLoaderContext, type ResourceOptions, type ResourceStatus, type RouteBuilder, type RouteContext, type RouteDefinition, type RouteMatch, type RouteMatchLike, type Router, type RouterHistory, type RouterInspection, type RouterLike, type RouterLocation, type RouterOptions, Runtime, RuntimeNodeInstance, type RuntimeOptions, Scheduler, type SchedulerDiagnostics, SemanticNodeType, ServerComment, ServerElement, ServerFragment, type ServerNode, type ServerNodeKind, type ServerParent, ServerRawHTML, ServerStyle, ServerText, type ShellBuilder, Signal, type SignalInspection, SignalKind, type SignalsPanel, Store, type StoreState, type StreetEvent, type StreetEventType, StreetFrameworkError, StreetRenderHandle, StreetRenderer, StreetRendererImpl, type StreetRendererOptions, type StreetUIConfig, type SubmitStatus, Subscriber, Unsubscribe, type Validator, a11yIds, applyNodeProps, applyProp, bindDomEvent, browserDOMAdapter, buttonUpdate, consoleDiagnosticSink, containFocus, createApplication, createBrowserHistory, createContext, createDevTools, createForm, createI18n, createMemoryHistory, createRenderContext, createRenderer, createRouter, createRuntime, createStore, createStreetEvent, defineConfig, diagnosePerformance, email, environment, escapeHtmlAttr, escapeHtmlText, flushSync, focusById, focusFirst, focusInitial, formatDiagnosticContext, frameworkError, getFocusable, globalEventBus, headingUpdate, hydrateGraph, inputUpdate, inspectApplication, inspectComponents, inspectContext, inspectForm, inspectGraph, inspectI18n, inspectResource, inspectRouter, inspectSignal, interpolate, matchPattern, matchRoutes, maxLength, minLength, mountGraph, mountNode, mountRouter, nodeTypeStats, normalizePath, onEscape, patchNode, patchProp, pattern, printDiagnostics, printGraph, reconcileChildren, reconcileChildrenByPlan, reportDiagnostic, required, resolveTag, resource, restoreFocus, routerOutlet, runValidators, saveFocus, scheduleImmediate, scheduleUpdate, scheduler, serializeChildren, serializeServerNode, splitTarget, textUpdate, toIdToken, transformGraph, trapFocus, validateGraph, wireComponentBehavior, wireEvents, wireOverlayBehavior, wireReactiveList, wireSignalBindings };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "1.7.0";
2
+ var VERSION = "1.8.0";
3
3
 
4
4
  // ../state/src/signal.ts
5
5
  var _activeConsumer = null;
@@ -803,6 +803,7 @@ var ApplicationGraph = class {
803
803
  this.handlers.delete(`__listbuild__${node.id}`);
804
804
  this.handlers.delete(`__listplan__${node.id}`);
805
805
  this.handlers.delete(`__overlay__${node.id}`);
806
+ this.handlers.delete(`__component__${node.id}`);
806
807
  }
807
808
  // ── Handler registry ──────────────────────────────────────────────────────
808
809
  registerHandler(key, fn) {
@@ -1332,6 +1333,63 @@ var ContainerBuilderBase = class extends ContentBuilderBase {
1332
1333
  toast(key, options, builder) {
1333
1334
  this._overlay(OVERLAY_KINDS.toast, key, options, builder);
1334
1335
  }
1336
+ // ── Components ────────────────────────────────────────────────────────────
1337
+ /**
1338
+ * Instantiate a reusable component (§3–§9). Creates a `'component'` node
1339
+ * (rendered as a `<div>` wrapper — preserves the one-node/one-element
1340
+ * positional-hydration invariant), then runs `def.setup(props, ctx)`
1341
+ * synchronously to obtain the render function and fills the component's own
1342
+ * container scope with it — structurally identical to `container`/
1343
+ * `errorBoundary`. Cleanups the setup registers via `ctx.effect`/
1344
+ * `ctx.onCleanup` are collected into a closure and exposed to the renderer
1345
+ * through a `__component__<id>` handler (mirroring `__overlay__`); the mount/
1346
+ * hydrate paths read it and route each into `NodeInstance.trackCleanup`, so
1347
+ * teardown runs (children-first) when the component leaves the graph.
1348
+ *
1349
+ * `setup` runs once per instance here at build time. When this component sits
1350
+ * inside a keyed list / conditional, a rebuild disposes the old instance
1351
+ * (running its cleanups + pruning its `__component__` entry) and re-runs this
1352
+ * method for the new node — so re-invocation is safe and leak-free.
1353
+ */
1354
+ component(key, def, props, children) {
1355
+ const graph = this._graph;
1356
+ const node = graph.createNode("component", {
1357
+ key,
1358
+ parent: this._node,
1359
+ // `data-streetui-component` is a non-underscore prop, so it reaches the
1360
+ // DOM as an attribute and is visible to DevTools (§21) — unlike the
1361
+ // internal `_`-prefixed metadata the renderer hides.
1362
+ props: { key, "data-streetui-component": def.name }
1363
+ });
1364
+ const cleanups = [];
1365
+ const ctx = {
1366
+ key,
1367
+ onCleanup(fn) {
1368
+ cleanups.push(fn);
1369
+ },
1370
+ effect(fn) {
1371
+ cleanups.push(effect(fn));
1372
+ },
1373
+ renderChildren(content) {
1374
+ if (children !== void 0) children(content);
1375
+ }
1376
+ };
1377
+ let render;
1378
+ try {
1379
+ render = def.setup(props, ctx);
1380
+ render(new ContainerBuilderImpl(node, graph));
1381
+ } catch (err) {
1382
+ queueMicrotask(() => {
1383
+ throw err;
1384
+ });
1385
+ }
1386
+ if (cleanups.length > 0) {
1387
+ graph.registerHandler(
1388
+ `__component__${node.id}`,
1389
+ () => cleanups
1390
+ );
1391
+ }
1392
+ }
1335
1393
  };
1336
1394
  var SectionBuilderImpl = class extends ContainerBuilderBase {
1337
1395
  };
@@ -1365,6 +1423,18 @@ var AppBuilder = class {
1365
1423
  }
1366
1424
  };
1367
1425
 
1426
+ // ../dsl/src/component.ts
1427
+ function component(setup, options = {}) {
1428
+ return {
1429
+ __streetui_component: true,
1430
+ name: options.name ?? setup.name ?? "Component",
1431
+ setup
1432
+ };
1433
+ }
1434
+ function isComponentDefinition(value) {
1435
+ return value !== null && typeof value === "object" && value.__streetui_component === true;
1436
+ }
1437
+
1368
1438
  // ../dsl/src/dsl.ts
1369
1439
  var StreetApp = class {
1370
1440
  _graph;
@@ -3064,6 +3134,7 @@ function mountNode(ctx, graphNode, parentDom) {
3064
3134
  instance.addChild(childInstance);
3065
3135
  }
3066
3136
  dom.appendChild(parentDom, el);
3137
+ if (graphNode.type === "component") wireComponentBehavior(ctx, graphNode, instance);
3067
3138
  return instance;
3068
3139
  }
3069
3140
  function textUpdate(dom, el, textNode) {
@@ -3232,6 +3303,11 @@ function wireOverlayBehavior(ctx, graphNode, instance, target) {
3232
3303
  instance.trackCleanup(teardown);
3233
3304
  if (openSig.peek() === true) onOpenChange(true);
3234
3305
  }
3306
+ function wireComponentBehavior(ctx, graphNode, instance) {
3307
+ const fn = ctx.graph.getHandler(`__component__${graphNode.id}`);
3308
+ if (fn === void 0) return;
3309
+ for (const cleanup of fn()) instance.trackCleanup(cleanup);
3310
+ }
3235
3311
 
3236
3312
  // ../renderer/src/hydration-diagnostics.ts
3237
3313
  function formatHydrationDiagnostic(d) {
@@ -3363,6 +3439,7 @@ function hydrateNode(ctx, graphNode, domNode, path) {
3363
3439
  return instance;
3364
3440
  }
3365
3441
  hydrateChildren(ctx, graphNode, instance, domNode, path);
3442
+ if (graphNode.type === "component") wireComponentBehavior(ctx, graphNode, instance);
3366
3443
  return instance;
3367
3444
  }
3368
3445
  }
@@ -3597,7 +3674,8 @@ function analyzeGraph(graph) {
3597
3674
  const isList = node.type === "reactive-list";
3598
3675
  const isConditional = node.type === "conditional";
3599
3676
  const isPortal = node.type === "portal";
3600
- const isStatic = node.stateRefs.length === 0 && !hasEvents && !isList && !isConditional && !isPortal;
3677
+ const isComponent = node.type === "component";
3678
+ const isStatic = node.stateRefs.length === 0 && !hasEvents && !isList && !isConditional && !isPortal && !isComponent;
3601
3679
  const isStaticSubtree = isStatic && allChildrenStatic;
3602
3680
  nodes.set(node.id, {
3603
3681
  isStatic,
@@ -4304,6 +4382,21 @@ function nodeTypeStats(graph) {
4304
4382
  });
4305
4383
  return counts;
4306
4384
  }
4385
+ function inspectComponents(graph) {
4386
+ const out = [];
4387
+ graph.walk((node, depth) => {
4388
+ if (node.type !== "component") return;
4389
+ const name = node.props["data-streetui-component"];
4390
+ out.push({
4391
+ id: node.id,
4392
+ key: node.key,
4393
+ name: typeof name === "string" ? name : "Component",
4394
+ depth,
4395
+ childCount: node.children.length
4396
+ });
4397
+ });
4398
+ return out;
4399
+ }
4307
4400
 
4308
4401
  // ../devtools/src/application.ts
4309
4402
  function collectPerf(node, distinctSignals, acc) {
@@ -4687,6 +4780,7 @@ export {
4687
4780
  buttonUpdate,
4688
4781
  compile,
4689
4782
  compileGraph,
4783
+ component,
4690
4784
  consoleDiagnosticSink,
4691
4785
  consoleHydrationDiagnosticSink,
4692
4786
  containFocus,
@@ -4729,6 +4823,7 @@ export {
4729
4823
  hydrateGraph,
4730
4824
  inputUpdate,
4731
4825
  inspectApplication,
4826
+ inspectComponents,
4732
4827
  inspectContext,
4733
4828
  inspectForm,
4734
4829
  inspectGraph,
@@ -4738,6 +4833,7 @@ export {
4738
4833
  inspectSignal,
4739
4834
  interpolate,
4740
4835
  isBatching,
4836
+ isComponentDefinition,
4741
4837
  matchPattern,
4742
4838
  matchRoutes,
4743
4839
  maxLength,
@@ -4787,6 +4883,7 @@ export {
4787
4883
  transformGraph,
4788
4884
  trapFocus,
4789
4885
  validateGraph,
4886
+ wireComponentBehavior,
4790
4887
  wireEvents,
4791
4888
  wireOverlayBehavior,
4792
4889
  wireReactiveList,