streetui 2.6.0 → 2.7.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/bin.cjs +1 -1
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/bin.js.map +1 -1
- package/dist/create-bin.cjs +1 -1
- package/dist/create-bin.cjs.map +1 -1
- package/dist/create-bin.js +1 -1
- package/dist/create-bin.js.map +1 -1
- package/dist/{hydration-diagnostics-D1GlzulR.d.cts → hydration-diagnostics-Bh0-5vdC.d.cts} +1 -1
- package/dist/{hydration-diagnostics-D1GlzulR.d.ts → hydration-diagnostics-Bh0-5vdC.d.ts} +1 -1
- package/dist/index.cjs +1391 -207
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1022 -6
- package/dist/index.d.ts +1022 -6
- package/dist/index.js +1325 -207
- package/dist/index.js.map +1 -1
- package/dist/{renderer-interface-CmVlxE95.d.ts → renderer-interface-BOpzkWWQ.d.ts} +1 -1
- package/dist/{renderer-interface-BzLwBsyj.d.cts → renderer-interface-D0021Or5.d.cts} +1 -1
- package/dist/{server-BP651UK6.d.ts → server-CzcNNC9F.d.ts} +1 -1
- package/dist/{server-LJGg4GyH.d.cts → server-cE_Qhu4k.d.cts} +1 -1
- package/dist/server.cjs +8 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +8 -1
- package/dist/server.js.map +1 -1
- package/dist/testing.cjs +190 -183
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +190 -183
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as Signal, d as Subscriber, U as Unsubscribe, R as ReadonlySignal, e as ResourceStatus, f as ResourceOptions, g as Resource, h as ResourceLoaderContext, A as ApplicationId, D as DiagnosticCollector, i as ApplicationGraph, G as GraphNode, C as CompiledApplication, j as HydrationDiagnosticSink, k as SemanticNodeType, P as PageDSL, T as TransitionConfig, l as ContainerDSL, m as SignalKind } from './hydration-diagnostics-
|
|
2
|
-
export { n as A11yOptions, o as AppBuilder, p as AppDSL, q as AppOptions, r as ApplicationGraphOptions, s as AsyncBoundaryBranches, B as BaseNode, t as Bindable, u as BindableString, v as BindableText, w as BoundInputOptions, x as ButtonOptions, y as CodeOptions, z as CompileOptions, b as ComponentChildren, E as ComponentContext, a as ComponentDefinition, F as ComponentRender, I as ComponentSetup, b as ContainerBuilder, J as ContainerBuilderImpl, K as ContainerOptions, L as ContentDSL, M as ControlledInputOptions, N as DerivedSignal, O as Diagnostic, Q as DiagnosticError, W as DiagnosticLocation, X as DiagnosticSeverity, Y as ErrorBoundaryOptions, Z as ErrorFallbackBuilder, _ as ErrorSource, $ as EventDescriptor, a0 as FormBuilder, a1 as FormBuilderImpl, a2 as FormDSL, a3 as FormOptions, a4 as GraphNodeData, a5 as HandlerFn, a6 as HeadContribution, a7 as HeadEntry, a8 as HeadMetadata, a9 as HeadingOptions, H as HydrationDiagnostic, aa as HydrationMismatchType, ab as ImageOptions, ac as InputOptions, ad as InputOptionsBase, ae as LinkDescriptor, af as LinkOptions, ag as ListBuilder, ah as ListBuilderImpl, ai as ListDSL, aj as ListOptions, ak as ListPlanEntry, al as MetaDescriptor, am as NodeId, an as NodeMetadata, ao as OverlayOptions, ap as PageBuilder, aq as PageBuilderImpl, ar as PortalOptions, as as PropValue, at as Props, au as ReactiveConsumer, av as ReactiveSource, aw as ResolvedTransition, ax as ResourceLoader, ay as SectionBuilder, az as SectionBuilderImpl, aA as SectionDSL, aB as SectionOptions, aC as SerializedGraph, aD as SerializedNode, aE as StateRef, S as StreetApp, aF as StreetUI, aG as TextOptions, aH as TextValue, V as VERSION, aI as WhenOptions, aJ as batch, aK as compile, aL as compileGraph, aM as component, aN as consoleHydrationDiagnosticSink, aO as createHydrationDiagnosticCollector, aP as createNodeId, aQ as derived, aR as effect, aS as formatDiagnostic, aT as formatHydrationDiagnostic, aU as generateApplicationId, aV as generateNodeId, aW as isBatching, aX as isComponentDefinition, aY as isHeadContribution, aZ as isTransitionConfig, a_ as nextId, a$ as nodeIdPrefix, b0 as observerCount, b1 as reactiveListItemKey, b2 as reactiveListItemSignature, b3 as resetIdCounter, b4 as resolveHead, b5 as resolveTransition, b6 as resource, b7 as signal, b8 as signalKind, b9 as streetui } from './hydration-diagnostics-
|
|
3
|
-
import { L as Lifecycle, C as CleanupRegistry, D as DOMAdapter, N as NodeInstance, R as RenderContext } from './server-
|
|
4
|
-
export { H as HeadManager, a as LifecycleHook, b as LifecyclePhase, c as RenderToStringOptions, S as STATE_MARKER_ATTR, d as ServerDOMAdapter, e as createRenderContext, r as readState, f as renderHead, g as renderToString, s as serializeState, h as serverDOMAdapter, w as wireHeadBehavior } from './server-
|
|
5
|
-
import { R as RenderHandle, S as StreetRenderer } from './renderer-interface-
|
|
1
|
+
import { c as Signal, d as Subscriber, U as Unsubscribe, R as ReadonlySignal, e as ResourceStatus, f as ResourceOptions, g as Resource, h as ResourceLoaderContext, A as ApplicationId, D as DiagnosticCollector, i as ApplicationGraph, G as GraphNode, C as CompiledApplication, j as HydrationDiagnosticSink, k as SemanticNodeType, P as PageDSL, T as TransitionConfig, l as ContainerDSL, m as SignalKind } from './hydration-diagnostics-Bh0-5vdC.js';
|
|
2
|
+
export { n as A11yOptions, o as AppBuilder, p as AppDSL, q as AppOptions, r as ApplicationGraphOptions, s as AsyncBoundaryBranches, B as BaseNode, t as Bindable, u as BindableString, v as BindableText, w as BoundInputOptions, x as ButtonOptions, y as CodeOptions, z as CompileOptions, b as ComponentChildren, E as ComponentContext, a as ComponentDefinition, F as ComponentRender, I as ComponentSetup, b as ContainerBuilder, J as ContainerBuilderImpl, K as ContainerOptions, L as ContentDSL, M as ControlledInputOptions, N as DerivedSignal, O as Diagnostic, Q as DiagnosticError, W as DiagnosticLocation, X as DiagnosticSeverity, Y as ErrorBoundaryOptions, Z as ErrorFallbackBuilder, _ as ErrorSource, $ as EventDescriptor, a0 as FormBuilder, a1 as FormBuilderImpl, a2 as FormDSL, a3 as FormOptions, a4 as GraphNodeData, a5 as HandlerFn, a6 as HeadContribution, a7 as HeadEntry, a8 as HeadMetadata, a9 as HeadingOptions, H as HydrationDiagnostic, aa as HydrationMismatchType, ab as ImageOptions, ac as InputOptions, ad as InputOptionsBase, ae as LinkDescriptor, af as LinkOptions, ag as ListBuilder, ah as ListBuilderImpl, ai as ListDSL, aj as ListOptions, ak as ListPlanEntry, al as MetaDescriptor, am as NodeId, an as NodeMetadata, ao as OverlayOptions, ap as PageBuilder, aq as PageBuilderImpl, ar as PortalOptions, as as PropValue, at as Props, au as ReactiveConsumer, av as ReactiveSource, aw as ResolvedTransition, ax as ResourceLoader, ay as SectionBuilder, az as SectionBuilderImpl, aA as SectionDSL, aB as SectionOptions, aC as SerializedGraph, aD as SerializedNode, aE as StateRef, S as StreetApp, aF as StreetUI, aG as TextOptions, aH as TextValue, V as VERSION, aI as WhenOptions, aJ as batch, aK as compile, aL as compileGraph, aM as component, aN as consoleHydrationDiagnosticSink, aO as createHydrationDiagnosticCollector, aP as createNodeId, aQ as derived, aR as effect, aS as formatDiagnostic, aT as formatHydrationDiagnostic, aU as generateApplicationId, aV as generateNodeId, aW as isBatching, aX as isComponentDefinition, aY as isHeadContribution, aZ as isTransitionConfig, a_ as nextId, a$ as nodeIdPrefix, b0 as observerCount, b1 as reactiveListItemKey, b2 as reactiveListItemSignature, b3 as resetIdCounter, b4 as resolveHead, b5 as resolveTransition, b6 as resource, b7 as signal, b8 as signalKind, b9 as streetui } from './hydration-diagnostics-Bh0-5vdC.js';
|
|
3
|
+
import { L as Lifecycle, C as CleanupRegistry, D as DOMAdapter, N as NodeInstance, R as RenderContext } from './server-CzcNNC9F.js';
|
|
4
|
+
export { H as HeadManager, a as LifecycleHook, b as LifecyclePhase, c as RenderToStringOptions, S as STATE_MARKER_ATTR, d as ServerDOMAdapter, e as createRenderContext, r as readState, f as renderHead, g as renderToString, s as serializeState, h as serverDOMAdapter, w as wireHeadBehavior } from './server-CzcNNC9F.js';
|
|
5
|
+
import { R as RenderHandle, S as StreetRenderer } from './renderer-interface-BOpzkWWQ.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A simple reactive store built on top of signals.
|
|
@@ -506,6 +506,885 @@ declare function describeError(error: unknown, context?: DiagnosticContext, opti
|
|
|
506
506
|
*/
|
|
507
507
|
declare function reportError(sink: DiagnosticSink | undefined, error: unknown, context?: DiagnosticContext, options?: ErrorReportOptions): ErrorReport;
|
|
508
508
|
|
|
509
|
+
/**
|
|
510
|
+
* StreetUI styling — canonical style model + stable identity.
|
|
511
|
+
*
|
|
512
|
+
* A *style* is pure, serializable data describing appearance (§1 Q1). This module
|
|
513
|
+
* defines the authoring type model and the compile-time canonicalization that
|
|
514
|
+
* turns any `StyleDef` into (a) a deterministic, order-independent canonical form
|
|
515
|
+
* and (b) a stable class identity `s-<hash>`. Identical styles → identical
|
|
516
|
+
* canonical form → identical identity → one shared CSS rule (§18 dedup).
|
|
517
|
+
*
|
|
518
|
+
* This file is pure and DOM-free: it never touches the graph, a signal, or the
|
|
519
|
+
* renderer. It is the foundation the registry (`registry.ts`), CSS generator
|
|
520
|
+
* (`css.ts`) and authoring API (`style.ts`) build on.
|
|
521
|
+
*/
|
|
522
|
+
/** A raw CSS value: a string (`'1px solid'`) or a number (lengths → px). */
|
|
523
|
+
type CSSValue = string | number;
|
|
524
|
+
/** The responsive breakpoint keys, smallest → largest. `base` is unconditional. */
|
|
525
|
+
type Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl';
|
|
526
|
+
/** A value that may vary by breakpoint. A bare value means "all breakpoints". */
|
|
527
|
+
type ResponsiveValue<T> = T | Partial<Record<Breakpoint, T>>;
|
|
528
|
+
/** Native CSS pseudo-states the browser owns (styled via CSS, never JS). */
|
|
529
|
+
type PseudoState = 'hover' | 'focus' | 'focusVisible' | 'focusWithin' | 'active' | 'disabled' | 'checked' | 'firstChild' | 'lastChild';
|
|
530
|
+
/** Reactive component/application states (distinct from native pseudo states). */
|
|
531
|
+
type ComponentState = 'open' | 'closed' | 'active' | 'selected' | 'expanded' | 'collapsed' | 'loading' | 'error' | 'disabled' | 'invalid' | 'busy' | 'current';
|
|
532
|
+
/**
|
|
533
|
+
* A set of CSS declarations. Keys are camelCase CSS property names; values may be
|
|
534
|
+
* responsive. The curated property surface gives autocomplete and rejects unknown
|
|
535
|
+
* keys under strict object-literal checking (§23) without pulling an external
|
|
536
|
+
* `csstype` dependency. Unlisted-but-valid CSS can still be set via the inline
|
|
537
|
+
* `style` prop escape hatch on an element (precedence §5).
|
|
538
|
+
*/
|
|
539
|
+
interface StyleProperties {
|
|
540
|
+
readonly display?: ResponsiveValue<CSSValue>;
|
|
541
|
+
readonly position?: ResponsiveValue<CSSValue>;
|
|
542
|
+
readonly inset?: ResponsiveValue<CSSValue>;
|
|
543
|
+
readonly top?: ResponsiveValue<CSSValue>;
|
|
544
|
+
readonly right?: ResponsiveValue<CSSValue>;
|
|
545
|
+
readonly bottom?: ResponsiveValue<CSSValue>;
|
|
546
|
+
readonly left?: ResponsiveValue<CSSValue>;
|
|
547
|
+
readonly zIndex?: ResponsiveValue<CSSValue>;
|
|
548
|
+
readonly width?: ResponsiveValue<CSSValue>;
|
|
549
|
+
readonly minWidth?: ResponsiveValue<CSSValue>;
|
|
550
|
+
readonly maxWidth?: ResponsiveValue<CSSValue>;
|
|
551
|
+
readonly height?: ResponsiveValue<CSSValue>;
|
|
552
|
+
readonly minHeight?: ResponsiveValue<CSSValue>;
|
|
553
|
+
readonly maxHeight?: ResponsiveValue<CSSValue>;
|
|
554
|
+
readonly margin?: ResponsiveValue<CSSValue>;
|
|
555
|
+
readonly marginTop?: ResponsiveValue<CSSValue>;
|
|
556
|
+
readonly marginRight?: ResponsiveValue<CSSValue>;
|
|
557
|
+
readonly marginBottom?: ResponsiveValue<CSSValue>;
|
|
558
|
+
readonly marginLeft?: ResponsiveValue<CSSValue>;
|
|
559
|
+
readonly padding?: ResponsiveValue<CSSValue>;
|
|
560
|
+
readonly paddingTop?: ResponsiveValue<CSSValue>;
|
|
561
|
+
readonly paddingRight?: ResponsiveValue<CSSValue>;
|
|
562
|
+
readonly paddingBottom?: ResponsiveValue<CSSValue>;
|
|
563
|
+
readonly paddingLeft?: ResponsiveValue<CSSValue>;
|
|
564
|
+
readonly gap?: ResponsiveValue<CSSValue>;
|
|
565
|
+
readonly rowGap?: ResponsiveValue<CSSValue>;
|
|
566
|
+
readonly columnGap?: ResponsiveValue<CSSValue>;
|
|
567
|
+
readonly flex?: ResponsiveValue<CSSValue>;
|
|
568
|
+
readonly flexDirection?: ResponsiveValue<CSSValue>;
|
|
569
|
+
readonly flexWrap?: ResponsiveValue<CSSValue>;
|
|
570
|
+
readonly flexGrow?: ResponsiveValue<CSSValue>;
|
|
571
|
+
readonly flexShrink?: ResponsiveValue<CSSValue>;
|
|
572
|
+
readonly flexBasis?: ResponsiveValue<CSSValue>;
|
|
573
|
+
readonly alignItems?: ResponsiveValue<CSSValue>;
|
|
574
|
+
readonly alignSelf?: ResponsiveValue<CSSValue>;
|
|
575
|
+
readonly justifyContent?: ResponsiveValue<CSSValue>;
|
|
576
|
+
readonly justifySelf?: ResponsiveValue<CSSValue>;
|
|
577
|
+
readonly gridTemplateColumns?: ResponsiveValue<CSSValue>;
|
|
578
|
+
readonly gridTemplateRows?: ResponsiveValue<CSSValue>;
|
|
579
|
+
readonly gridColumn?: ResponsiveValue<CSSValue>;
|
|
580
|
+
readonly gridRow?: ResponsiveValue<CSSValue>;
|
|
581
|
+
readonly placeItems?: ResponsiveValue<CSSValue>;
|
|
582
|
+
readonly color?: ResponsiveValue<CSSValue>;
|
|
583
|
+
readonly background?: ResponsiveValue<CSSValue>;
|
|
584
|
+
readonly backgroundColor?: ResponsiveValue<CSSValue>;
|
|
585
|
+
readonly borderColor?: ResponsiveValue<CSSValue>;
|
|
586
|
+
readonly border?: ResponsiveValue<CSSValue>;
|
|
587
|
+
readonly borderWidth?: ResponsiveValue<CSSValue>;
|
|
588
|
+
readonly borderStyle?: ResponsiveValue<CSSValue>;
|
|
589
|
+
readonly borderRadius?: ResponsiveValue<CSSValue>;
|
|
590
|
+
readonly boxShadow?: ResponsiveValue<CSSValue>;
|
|
591
|
+
readonly outline?: ResponsiveValue<CSSValue>;
|
|
592
|
+
readonly outlineOffset?: ResponsiveValue<CSSValue>;
|
|
593
|
+
readonly opacity?: ResponsiveValue<CSSValue>;
|
|
594
|
+
readonly fontFamily?: ResponsiveValue<CSSValue>;
|
|
595
|
+
readonly fontSize?: ResponsiveValue<CSSValue>;
|
|
596
|
+
readonly fontWeight?: ResponsiveValue<CSSValue>;
|
|
597
|
+
readonly lineHeight?: ResponsiveValue<CSSValue>;
|
|
598
|
+
readonly letterSpacing?: ResponsiveValue<CSSValue>;
|
|
599
|
+
readonly textAlign?: ResponsiveValue<CSSValue>;
|
|
600
|
+
readonly textDecoration?: ResponsiveValue<CSSValue>;
|
|
601
|
+
readonly textTransform?: ResponsiveValue<CSSValue>;
|
|
602
|
+
readonly whiteSpace?: ResponsiveValue<CSSValue>;
|
|
603
|
+
readonly overflow?: ResponsiveValue<CSSValue>;
|
|
604
|
+
readonly overflowX?: ResponsiveValue<CSSValue>;
|
|
605
|
+
readonly overflowY?: ResponsiveValue<CSSValue>;
|
|
606
|
+
readonly clipPath?: ResponsiveValue<CSSValue>;
|
|
607
|
+
readonly cursor?: ResponsiveValue<CSSValue>;
|
|
608
|
+
readonly transition?: ResponsiveValue<CSSValue>;
|
|
609
|
+
readonly transform?: ResponsiveValue<CSSValue>;
|
|
610
|
+
readonly transformOrigin?: ResponsiveValue<CSSValue>;
|
|
611
|
+
readonly animation?: ResponsiveValue<CSSValue>;
|
|
612
|
+
readonly animationName?: ResponsiveValue<CSSValue>;
|
|
613
|
+
readonly animationDuration?: ResponsiveValue<CSSValue>;
|
|
614
|
+
readonly animationTimingFunction?: ResponsiveValue<CSSValue>;
|
|
615
|
+
readonly animationDelay?: ResponsiveValue<CSSValue>;
|
|
616
|
+
readonly animationIterationCount?: ResponsiveValue<CSSValue>;
|
|
617
|
+
readonly animationDirection?: ResponsiveValue<CSSValue>;
|
|
618
|
+
readonly animationFillMode?: ResponsiveValue<CSSValue>;
|
|
619
|
+
readonly animationPlayState?: ResponsiveValue<CSSValue>;
|
|
620
|
+
readonly willChange?: ResponsiveValue<CSSValue>;
|
|
621
|
+
readonly appearance?: ResponsiveValue<CSSValue>;
|
|
622
|
+
readonly userSelect?: ResponsiveValue<CSSValue>;
|
|
623
|
+
readonly pointerEvents?: ResponsiveValue<CSSValue>;
|
|
624
|
+
/** Reactive CSS custom properties (`--name`) — the signal-driven channel (§6). */
|
|
625
|
+
readonly vars?: Readonly<Record<`--${string}`, CSSValue>>;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* A full style definition: base declarations plus optional pseudo-state,
|
|
629
|
+
* component-state and a11y-state overrides. Each override block is itself a set
|
|
630
|
+
* of (non-responsive) declarations.
|
|
631
|
+
*/
|
|
632
|
+
interface StyleDef extends StyleProperties {
|
|
633
|
+
/** Native pseudo-state overrides (`:hover`, `:focus-visible`, …) — §9. */
|
|
634
|
+
readonly on?: Partial<Record<PseudoState, StyleProperties>>;
|
|
635
|
+
/** Component-state overrides → `[data-<state>]` selectors — §10. */
|
|
636
|
+
readonly when?: Partial<Record<ComponentState, StyleProperties>>;
|
|
637
|
+
}
|
|
638
|
+
/** A canonical, order-independent, JSON-serializable form of a `StyleDef`. */
|
|
639
|
+
type CanonicalStyle = string;
|
|
640
|
+
/** camelCase → kebab-case CSS property name (`backgroundColor` → `background-color`). */
|
|
641
|
+
declare function cssPropName(camel: string): string;
|
|
642
|
+
/** Format a CSS value: unitless numbers on length props get `px`; others pass through. */
|
|
643
|
+
declare function cssValue(prop: string, value: CSSValue): string;
|
|
644
|
+
/** Produce the canonical form of a style definition (stable across key order). */
|
|
645
|
+
declare function canonicalize(def: StyleDef): CanonicalStyle;
|
|
646
|
+
/**
|
|
647
|
+
* FNV-1a (two seeds) → a stable, dependency-free class identity. Two 32-bit
|
|
648
|
+
* passes are concatenated in base36 to make collisions between distinct styles
|
|
649
|
+
* astronomically unlikely for realistic app style counts. Deterministic: the
|
|
650
|
+
* same canonical form always yields the same id on server and client (§11/§12).
|
|
651
|
+
*/
|
|
652
|
+
declare function hashIdentity(canonical: CanonicalStyle): string;
|
|
653
|
+
/** Convenience: canonical form + identity in one call. */
|
|
654
|
+
declare function identityOf(def: StyleDef): {
|
|
655
|
+
canonical: CanonicalStyle;
|
|
656
|
+
id: string;
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* StreetUI styling — the deduplicated CSS rule registry (§15/§18).
|
|
661
|
+
*
|
|
662
|
+
* A single module-level registry maps a *style identity* (`s-<hash>`) to the CSS
|
|
663
|
+
* rule text for that style. Registration is idempotent: registering the same
|
|
664
|
+
* identity twice with identical content is a no-op, so 10,000 elements that share
|
|
665
|
+
* a style produce exactly one rule (§18). The registry is keyed by identity —
|
|
666
|
+
* **never** by node or element — so it holds only bounded rule strings and
|
|
667
|
+
* unmounting nodes never strands state in it (§17 memory-leak avoidance).
|
|
668
|
+
*
|
|
669
|
+
* Ordering is deterministic (insertion order within fixed category bands), so
|
|
670
|
+
* serialization is byte-stable across runs (§11/§16). An empty registry
|
|
671
|
+
* serializes to the empty string, mirroring `renderHead` — so a route that
|
|
672
|
+
* declares no styles emits no `<style>` block and stays byte-identical.
|
|
673
|
+
*/
|
|
674
|
+
/** Category bands fix the serialization order regardless of registration order. */
|
|
675
|
+
type StyleBand = 'tokens' | 'base' | 'responsive' | 'state' | 'variant';
|
|
676
|
+
declare class StyleRegistry {
|
|
677
|
+
private readonly _entries;
|
|
678
|
+
private _seq;
|
|
679
|
+
/** True once the registry has adopted a server-emitted stylesheet (§12). */
|
|
680
|
+
private _adopted;
|
|
681
|
+
/**
|
|
682
|
+
* Register (idempotently) the CSS for a style identity. Returns the identity so
|
|
683
|
+
* callers can chain. Re-registering an existing id with the same css is a no-op;
|
|
684
|
+
* with different css it keeps the first registration (identity is content-derived,
|
|
685
|
+
* so this cannot happen for honest input and signals a hash collision if it does).
|
|
686
|
+
*/
|
|
687
|
+
register(id: string, band: StyleBand, css: string): string;
|
|
688
|
+
/** Whether an identity is already present (server-adopted or locally registered). */
|
|
689
|
+
has(id: string): boolean;
|
|
690
|
+
/** Number of distinct rules held (bounded by source diversity, not instances). */
|
|
691
|
+
get size(): number;
|
|
692
|
+
/**
|
|
693
|
+
* Seed the registry from identities a server stylesheet already shipped (§12).
|
|
694
|
+
* We only need the *keys* to avoid re-emitting duplicates; the rule text is
|
|
695
|
+
* already in the adopted `<style>` element, so a placeholder css is stored.
|
|
696
|
+
*/
|
|
697
|
+
adoptServerIdentities(ids: Iterable<string>): void;
|
|
698
|
+
get adopted(): boolean;
|
|
699
|
+
/** Serialize all rules to a single CSS string in deterministic band order. */
|
|
700
|
+
serializeCSS(): string;
|
|
701
|
+
/** The ordered list of identities present (for the `data-streetui-css-keys` attr). */
|
|
702
|
+
identities(): string[];
|
|
703
|
+
/** Clear everything — test isolation and per-process reset only. */
|
|
704
|
+
reset(): void;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* The process-wide registry instance. Because consuming packages (`dsl` authoring
|
|
708
|
+
* and `renderer` SSR) both resolve `streetui` to the *same* module, they
|
|
709
|
+
* share this one instance — the authoring side registers rules and the SSR side
|
|
710
|
+
* serializes them, with no cross-package plumbing.
|
|
711
|
+
*/
|
|
712
|
+
declare const styleRegistry: StyleRegistry;
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* StreetUI styling — compile-time CSS generation (§7-§10, §15).
|
|
716
|
+
*
|
|
717
|
+
* Turns a `StyleDef` + its stable identity into CSS rule text. All generation is
|
|
718
|
+
* pure and happens at author/compile time; nothing here runs per render. Output
|
|
719
|
+
* is deterministic (properties sorted, fixed media order) so identities and bytes
|
|
720
|
+
* are stable across server and client (§11/§16).
|
|
721
|
+
*
|
|
722
|
+
* Property values that are objects of the shape `{ base, sm, md, lg, xl }` expand
|
|
723
|
+
* to a base declaration plus `@media (min-width: …)` blocks (§7). Pseudo states
|
|
724
|
+
* (`on`) become `.id:hover` etc. (§9). Component states (`when`) become
|
|
725
|
+
* `.id[data-<state>]` selectors driven reactively by a data attribute (§10).
|
|
726
|
+
*/
|
|
727
|
+
|
|
728
|
+
/** Default breakpoint minimum widths (px). Mirrors the default token breakpoints. */
|
|
729
|
+
declare const BREAKPOINTS: Readonly<Record<Exclude<Breakpoint, 'base'>, number>>;
|
|
730
|
+
/** `data-<state>` attribute name a component state maps to (§10). */
|
|
731
|
+
declare function stateAttr(state: ComponentState): string;
|
|
732
|
+
interface GeneratedCSS {
|
|
733
|
+
/** Base rule + any responsive `@media` blocks. */
|
|
734
|
+
readonly base: string;
|
|
735
|
+
/** Pseudo-state and component-state rules (empty string when none). */
|
|
736
|
+
readonly state: string;
|
|
737
|
+
/** Whether the style declares any responsive values (for registry banding). */
|
|
738
|
+
readonly hasResponsive: boolean;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Generate the CSS for a style identity. The caller registers `base` under the
|
|
742
|
+
* `base`/`responsive` band and `state` under the `state` band.
|
|
743
|
+
*/
|
|
744
|
+
declare function generateCSS(id: string, def: StyleDef): GeneratedCSS;
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* StreetUI styling — first-class design tokens + theming (§6/§7/§16).
|
|
748
|
+
*
|
|
749
|
+
* Tokens are declared as a nested tree of named values and compiled to CSS custom
|
|
750
|
+
* properties emitted once under `:root`, with dark-mode values emitted under
|
|
751
|
+
* `[data-theme="dark"]`. A token *reference* is the string `var(--name)`, usable
|
|
752
|
+
* anywhere a CSS value is expected inside a `StyleDef`. Dark mode therefore never
|
|
753
|
+
* duplicates a style definition — it only re-points the variables (§7/§16).
|
|
754
|
+
*
|
|
755
|
+
* SSR/hydration safety: the token CSS is registered in the shared style registry
|
|
756
|
+
* (tokens band) and serialized into the single `<style data-streetui-css>` block
|
|
757
|
+
* like any other rule, so the server ships the variables and the client adopts
|
|
758
|
+
* them. Switching theme is a single `data-theme` attribute flip on the root
|
|
759
|
+
* element — no restyle work, no re-render (§16).
|
|
760
|
+
*/
|
|
761
|
+
type TokenLeaf = string | number;
|
|
762
|
+
interface TokenTree {
|
|
763
|
+
readonly [key: string]: TokenLeaf | TokenTree;
|
|
764
|
+
}
|
|
765
|
+
/** The ref tree mirrors the input shape; every leaf becomes a `var(--…)` string. */
|
|
766
|
+
type TokenRefs<T> = {
|
|
767
|
+
readonly [K in keyof T]: T[K] extends TokenLeaf ? string : T[K] extends TokenTree ? TokenRefs<T[K]> : never;
|
|
768
|
+
};
|
|
769
|
+
interface ThemeTokenDef<L extends TokenTree> {
|
|
770
|
+
/** Base (light) token values — required; defines the full token surface. */
|
|
771
|
+
readonly light: L;
|
|
772
|
+
/** Dark overrides — a partial subset; unlisted tokens inherit the light value. */
|
|
773
|
+
readonly dark?: DeepPartial<L>;
|
|
774
|
+
}
|
|
775
|
+
type DeepPartial<T> = {
|
|
776
|
+
[K in keyof T]?: T[K] extends TokenLeaf ? TokenLeaf : T[K] extends TokenTree ? DeepPartial<T[K]> : never;
|
|
777
|
+
};
|
|
778
|
+
interface ThemeTokens<L extends TokenTree> {
|
|
779
|
+
/** Token references (`var(--…)`) mirroring the declared tree. */
|
|
780
|
+
readonly ref: TokenRefs<L>;
|
|
781
|
+
/** The generated CSS for `:root` and `[data-theme="dark"]`. */
|
|
782
|
+
readonly css: string;
|
|
783
|
+
/** The stable identity under which this token block is registered. */
|
|
784
|
+
readonly id: string;
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Declare a set of design tokens. Returns typed references and registers the
|
|
788
|
+
* generated `:root` / `[data-theme="dark"]` CSS in the shared registry (idempotent).
|
|
789
|
+
*/
|
|
790
|
+
declare function createThemeTokens<L extends TokenTree>(def: ThemeTokenDef<L>): ThemeTokens<L>;
|
|
791
|
+
/**
|
|
792
|
+
* The default StreetUI semantic token set (§6/§7). Covers color surfaces, content,
|
|
793
|
+
* borders, accent, focus and danger semantics, plus spacing, radii, typography,
|
|
794
|
+
* shadows, z-index, durations, easings and breakpoints. Dark mode re-points only
|
|
795
|
+
* the color semantics; structural tokens (spacing, radii, …) are theme-invariant.
|
|
796
|
+
*/
|
|
797
|
+
declare const DEFAULT_TOKENS: {
|
|
798
|
+
readonly surface: {
|
|
799
|
+
readonly background: "#ffffff";
|
|
800
|
+
readonly raised: "#f7f7f8";
|
|
801
|
+
readonly sunken: "#eeeef1";
|
|
802
|
+
readonly overlay: "rgba(17,17,20,0.55)";
|
|
803
|
+
};
|
|
804
|
+
readonly content: {
|
|
805
|
+
readonly primary: "#17171a";
|
|
806
|
+
readonly secondary: "#55555f";
|
|
807
|
+
readonly muted: "#666672";
|
|
808
|
+
readonly inverse: "#ffffff";
|
|
809
|
+
};
|
|
810
|
+
readonly border: {
|
|
811
|
+
readonly default: "#e3e3e8";
|
|
812
|
+
readonly strong: "#c9c9d1";
|
|
813
|
+
readonly subtle: "#f0f0f3";
|
|
814
|
+
};
|
|
815
|
+
readonly accent: {
|
|
816
|
+
readonly primary: "#4f46e5";
|
|
817
|
+
readonly hover: "#4338ca";
|
|
818
|
+
readonly contrast: "#ffffff";
|
|
819
|
+
};
|
|
820
|
+
readonly focus: {
|
|
821
|
+
readonly ring: "#6366f1";
|
|
822
|
+
};
|
|
823
|
+
readonly danger: {
|
|
824
|
+
readonly surface: "#fef2f2";
|
|
825
|
+
readonly border: "#fecaca";
|
|
826
|
+
readonly content: "#b91c1c";
|
|
827
|
+
readonly solid: "#dc2626";
|
|
828
|
+
};
|
|
829
|
+
readonly success: {
|
|
830
|
+
readonly content: "#15803d";
|
|
831
|
+
readonly solid: "#16a34a";
|
|
832
|
+
};
|
|
833
|
+
readonly space: {
|
|
834
|
+
readonly '0': "0";
|
|
835
|
+
readonly '1': "4px";
|
|
836
|
+
readonly '2': "8px";
|
|
837
|
+
readonly '3': "12px";
|
|
838
|
+
readonly '4': "16px";
|
|
839
|
+
readonly '5': "24px";
|
|
840
|
+
readonly '6': "32px";
|
|
841
|
+
readonly '8': "48px";
|
|
842
|
+
readonly '10': "64px";
|
|
843
|
+
};
|
|
844
|
+
readonly radius: {
|
|
845
|
+
readonly sm: "4px";
|
|
846
|
+
readonly md: "8px";
|
|
847
|
+
readonly lg: "12px";
|
|
848
|
+
readonly xl: "16px";
|
|
849
|
+
readonly full: "9999px";
|
|
850
|
+
};
|
|
851
|
+
readonly font: {
|
|
852
|
+
readonly sans: "ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif";
|
|
853
|
+
readonly mono: "ui-monospace,SFMono-Regular,Menlo,Consolas,monospace";
|
|
854
|
+
};
|
|
855
|
+
readonly size: {
|
|
856
|
+
readonly xs: "12px";
|
|
857
|
+
readonly sm: "14px";
|
|
858
|
+
readonly md: "16px";
|
|
859
|
+
readonly lg: "18px";
|
|
860
|
+
readonly xl: "24px";
|
|
861
|
+
readonly '2xl': "32px";
|
|
862
|
+
readonly '3xl': "44px";
|
|
863
|
+
};
|
|
864
|
+
readonly weight: {
|
|
865
|
+
readonly normal: "400";
|
|
866
|
+
readonly medium: "500";
|
|
867
|
+
readonly semibold: "600";
|
|
868
|
+
readonly bold: "700";
|
|
869
|
+
};
|
|
870
|
+
readonly leading: {
|
|
871
|
+
readonly tight: "1.2";
|
|
872
|
+
readonly normal: "1.5";
|
|
873
|
+
readonly relaxed: "1.7";
|
|
874
|
+
};
|
|
875
|
+
readonly shadow: {
|
|
876
|
+
readonly sm: "0 1px 2px rgba(17,17,20,0.08)";
|
|
877
|
+
readonly md: "0 4px 12px rgba(17,17,20,0.1)";
|
|
878
|
+
readonly lg: "0 12px 32px rgba(17,17,20,0.16)";
|
|
879
|
+
};
|
|
880
|
+
readonly z: {
|
|
881
|
+
readonly base: "0";
|
|
882
|
+
readonly dropdown: "1000";
|
|
883
|
+
readonly overlay: "1100";
|
|
884
|
+
readonly toast: "1200";
|
|
885
|
+
};
|
|
886
|
+
readonly duration: {
|
|
887
|
+
readonly fast: "120ms";
|
|
888
|
+
readonly base: "200ms";
|
|
889
|
+
readonly slow: "320ms";
|
|
890
|
+
};
|
|
891
|
+
readonly easing: {
|
|
892
|
+
readonly standard: "cubic-bezier(0.2,0,0,1)";
|
|
893
|
+
readonly emphasized: "cubic-bezier(0.3,0,0,1)";
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
/** The ready-to-use default theme tokens, registered on import. */
|
|
897
|
+
declare const tokens: ThemeTokens<{
|
|
898
|
+
readonly surface: {
|
|
899
|
+
readonly background: "#ffffff";
|
|
900
|
+
readonly raised: "#f7f7f8";
|
|
901
|
+
readonly sunken: "#eeeef1";
|
|
902
|
+
readonly overlay: "rgba(17,17,20,0.55)";
|
|
903
|
+
};
|
|
904
|
+
readonly content: {
|
|
905
|
+
readonly primary: "#17171a";
|
|
906
|
+
readonly secondary: "#55555f";
|
|
907
|
+
readonly muted: "#666672";
|
|
908
|
+
readonly inverse: "#ffffff";
|
|
909
|
+
};
|
|
910
|
+
readonly border: {
|
|
911
|
+
readonly default: "#e3e3e8";
|
|
912
|
+
readonly strong: "#c9c9d1";
|
|
913
|
+
readonly subtle: "#f0f0f3";
|
|
914
|
+
};
|
|
915
|
+
readonly accent: {
|
|
916
|
+
readonly primary: "#4f46e5";
|
|
917
|
+
readonly hover: "#4338ca";
|
|
918
|
+
readonly contrast: "#ffffff";
|
|
919
|
+
};
|
|
920
|
+
readonly focus: {
|
|
921
|
+
readonly ring: "#6366f1";
|
|
922
|
+
};
|
|
923
|
+
readonly danger: {
|
|
924
|
+
readonly surface: "#fef2f2";
|
|
925
|
+
readonly border: "#fecaca";
|
|
926
|
+
readonly content: "#b91c1c";
|
|
927
|
+
readonly solid: "#dc2626";
|
|
928
|
+
};
|
|
929
|
+
readonly success: {
|
|
930
|
+
readonly content: "#15803d";
|
|
931
|
+
readonly solid: "#16a34a";
|
|
932
|
+
};
|
|
933
|
+
readonly space: {
|
|
934
|
+
readonly '0': "0";
|
|
935
|
+
readonly '1': "4px";
|
|
936
|
+
readonly '2': "8px";
|
|
937
|
+
readonly '3': "12px";
|
|
938
|
+
readonly '4': "16px";
|
|
939
|
+
readonly '5': "24px";
|
|
940
|
+
readonly '6': "32px";
|
|
941
|
+
readonly '8': "48px";
|
|
942
|
+
readonly '10': "64px";
|
|
943
|
+
};
|
|
944
|
+
readonly radius: {
|
|
945
|
+
readonly sm: "4px";
|
|
946
|
+
readonly md: "8px";
|
|
947
|
+
readonly lg: "12px";
|
|
948
|
+
readonly xl: "16px";
|
|
949
|
+
readonly full: "9999px";
|
|
950
|
+
};
|
|
951
|
+
readonly font: {
|
|
952
|
+
readonly sans: "ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif";
|
|
953
|
+
readonly mono: "ui-monospace,SFMono-Regular,Menlo,Consolas,monospace";
|
|
954
|
+
};
|
|
955
|
+
readonly size: {
|
|
956
|
+
readonly xs: "12px";
|
|
957
|
+
readonly sm: "14px";
|
|
958
|
+
readonly md: "16px";
|
|
959
|
+
readonly lg: "18px";
|
|
960
|
+
readonly xl: "24px";
|
|
961
|
+
readonly '2xl': "32px";
|
|
962
|
+
readonly '3xl': "44px";
|
|
963
|
+
};
|
|
964
|
+
readonly weight: {
|
|
965
|
+
readonly normal: "400";
|
|
966
|
+
readonly medium: "500";
|
|
967
|
+
readonly semibold: "600";
|
|
968
|
+
readonly bold: "700";
|
|
969
|
+
};
|
|
970
|
+
readonly leading: {
|
|
971
|
+
readonly tight: "1.2";
|
|
972
|
+
readonly normal: "1.5";
|
|
973
|
+
readonly relaxed: "1.7";
|
|
974
|
+
};
|
|
975
|
+
readonly shadow: {
|
|
976
|
+
readonly sm: "0 1px 2px rgba(17,17,20,0.08)";
|
|
977
|
+
readonly md: "0 4px 12px rgba(17,17,20,0.1)";
|
|
978
|
+
readonly lg: "0 12px 32px rgba(17,17,20,0.16)";
|
|
979
|
+
};
|
|
980
|
+
readonly z: {
|
|
981
|
+
readonly base: "0";
|
|
982
|
+
readonly dropdown: "1000";
|
|
983
|
+
readonly overlay: "1100";
|
|
984
|
+
readonly toast: "1200";
|
|
985
|
+
};
|
|
986
|
+
readonly duration: {
|
|
987
|
+
readonly fast: "120ms";
|
|
988
|
+
readonly base: "200ms";
|
|
989
|
+
readonly slow: "320ms";
|
|
990
|
+
};
|
|
991
|
+
readonly easing: {
|
|
992
|
+
readonly standard: "cubic-bezier(0.2,0,0,1)";
|
|
993
|
+
readonly emphasized: "cubic-bezier(0.3,0,0,1)";
|
|
994
|
+
};
|
|
995
|
+
}>;
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* StreetUI styling — the public authoring API: `style()` and `styleVariants()`.
|
|
999
|
+
*
|
|
1000
|
+
* `style(def)` canonicalizes a definition, registers its deduplicated CSS once,
|
|
1001
|
+
* and returns the stable class token (a plain string) to spread onto an element's
|
|
1002
|
+
* `class` (§2/§5/§18). Being a plain string makes it trivially composable and
|
|
1003
|
+
* tree-shakeable with no runtime dependency. A *static* `style()` call opens no
|
|
1004
|
+
* signal, no subscription and no effect (§3) — it is pure compile-time data.
|
|
1005
|
+
*
|
|
1006
|
+
* `styleVariants(cfg)` builds a type-safe family of styles. Variant group keys and
|
|
1007
|
+
* values are mapped types, so selecting an unknown group or value is a TypeScript
|
|
1008
|
+
* error (§11/§23) — no stringly-typed variant names. The returned function yields
|
|
1009
|
+
* the merged, deduped class list for a selection.
|
|
1010
|
+
*/
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Register a style definition and return its class token. Idempotent: the same
|
|
1014
|
+
* definition always maps to the same token and a single shared CSS rule.
|
|
1015
|
+
*/
|
|
1016
|
+
declare function style(def: StyleDef): string;
|
|
1017
|
+
/** Join class tokens/strings, dropping falsy entries. `cx('a', cond && 'b')`. */
|
|
1018
|
+
declare function cx(...parts: Array<string | false | null | undefined>): string;
|
|
1019
|
+
type VariantGroups = Record<string, Record<string, StyleDef>>;
|
|
1020
|
+
interface VariantConfig<V extends VariantGroups> {
|
|
1021
|
+
/** Shared declarations applied to every variant combination. */
|
|
1022
|
+
readonly base?: StyleDef;
|
|
1023
|
+
/** Named variant groups; each maps a value name to its own `StyleDef`. */
|
|
1024
|
+
readonly variants: V;
|
|
1025
|
+
/** Default selection used when a group is omitted at call time. */
|
|
1026
|
+
readonly defaultVariants?: {
|
|
1027
|
+
readonly [K in keyof V]?: keyof V[K];
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
/** A selection object: for each group, an optional value from that group. */
|
|
1031
|
+
type VariantSelection<V extends VariantGroups> = {
|
|
1032
|
+
readonly [K in keyof V]?: keyof V[K];
|
|
1033
|
+
};
|
|
1034
|
+
/** The callable produced by `styleVariants` — `button({ intent:'danger' })`. */
|
|
1035
|
+
type VariantFn<V extends VariantGroups> = (selection?: VariantSelection<V>) => string;
|
|
1036
|
+
/**
|
|
1037
|
+
* Build a type-safe variant family. All base and variant-value styles are
|
|
1038
|
+
* registered up front (each as its own deduped identity), so calling the returned
|
|
1039
|
+
* function only *selects* among precompiled classes — no runtime style work (§11).
|
|
1040
|
+
*/
|
|
1041
|
+
declare function styleVariants<V extends VariantGroups>(cfg: VariantConfig<V>): VariantFn<V>;
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* StreetUI styling — reactive scalar styles (§4).
|
|
1045
|
+
*
|
|
1046
|
+
* A reactive scalar style value (a signal) must update **one** property on **one**
|
|
1047
|
+
* element with no class churn and no DOM reconstruction. The mechanism rides the
|
|
1048
|
+
* existing reactive seam exactly: the appearance is a *static*, deduped rule that
|
|
1049
|
+
* reads a **CSS custom property**, and the signal drives only that custom
|
|
1050
|
+
* property via the renderer's existing `style.<prop>` binding path
|
|
1051
|
+
* (`applyProp` → `el.style.setProperty`). One signal → one `setProperty`.
|
|
1052
|
+
*
|
|
1053
|
+
* `styleWithVars(staticDef, reactiveProps)` returns:
|
|
1054
|
+
* • `class` — the static class token for a `StyleDef` whose reactive properties
|
|
1055
|
+
* are rewritten to `var(--s-<prop>)` (so the rule itself never changes), and
|
|
1056
|
+
* • `vars` — the custom-property name per reactive prop (`width` → `--s-width`),
|
|
1057
|
+
* and the `style.<custom-prop>` binding key to attach the signal to.
|
|
1058
|
+
*
|
|
1059
|
+
* This introduces no second reactive system and no runtime style framework: the
|
|
1060
|
+
* returned `class` is a plain string (deduped like any other `style()`), and the
|
|
1061
|
+
* reactive binding is a single `StateRef { propKey: 'style.--s-<prop>' }` wired by
|
|
1062
|
+
* the existing `wireSignalBindings`/`applyProp` pipeline. Core stays free of any
|
|
1063
|
+
* `streetui` dependency — the caller supplies the signal at the DSL layer.
|
|
1064
|
+
*/
|
|
1065
|
+
|
|
1066
|
+
/** The reactive binding surface for one `styleWithVars` call. */
|
|
1067
|
+
interface ReactiveStyle<K extends string> {
|
|
1068
|
+
/** Static, deduped class token; reactive props read `var(--s-<prop>)`. */
|
|
1069
|
+
readonly class: string;
|
|
1070
|
+
/** Per reactive prop: its CSS custom-property name, e.g. `width` → `--s-width`. */
|
|
1071
|
+
readonly vars: Readonly<Record<K, string>>;
|
|
1072
|
+
/** Per reactive prop: the renderer binding key, e.g. `width` → `style.--s-width`. */
|
|
1073
|
+
readonly bind: Readonly<Record<K, string>>;
|
|
1074
|
+
}
|
|
1075
|
+
/** The CSS custom-property name a reactive prop compiles to (`width` → `--s-width`). */
|
|
1076
|
+
declare function reactiveVarName(prop: string): string;
|
|
1077
|
+
/**
|
|
1078
|
+
* Compile a style whose listed properties are driven by signals at runtime. The
|
|
1079
|
+
* rule is static and deduped (reads `var(--s-<prop>)`); the caller binds each
|
|
1080
|
+
* `bind[prop]` key to a signal so one change is one `setProperty` (§4).
|
|
1081
|
+
*/
|
|
1082
|
+
declare function styleWithVars<K extends string>(staticDef: StyleDef, reactiveProps: readonly K[]): ReactiveStyle<K>;
|
|
1083
|
+
/**
|
|
1084
|
+
* Format a reactive scalar for assignment to its custom property, applying the
|
|
1085
|
+
* same unit rule as static values (unitless numbers on length props get `px`).
|
|
1086
|
+
* Use this in the signal/derived that feeds a `styleWithVars` binding so that
|
|
1087
|
+
* `widthSignal.set(240)` yields `--s-width: 240px`.
|
|
1088
|
+
*/
|
|
1089
|
+
declare function reactiveVarValue(prop: string, value: CSSValue): string;
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* StreetUI styling — layout primitives (§12).
|
|
1093
|
+
*
|
|
1094
|
+
* Thin, token-driven `style()` presets — **not** new graph nodes and **not** a
|
|
1095
|
+
* utility-class framework. Each primitive is a function that takes a small, typed
|
|
1096
|
+
* option bag and returns a single deduplicated class string, so composing a layout
|
|
1097
|
+
* is `container()`, `stack({ gap: 4 })`, etc. Because they compile through the same
|
|
1098
|
+
* `style()` registry, identical option bags share one CSS rule (§15/§18), and they
|
|
1099
|
+
* carry no runtime dependency — the return value is a plain class token.
|
|
1100
|
+
*
|
|
1101
|
+
* Spacing/gap options are **space-scale keys** (`'0'`…`'10'`) resolved to the
|
|
1102
|
+
* `--space-*` token variables, so layouts stay on the design system by default and
|
|
1103
|
+
* remain theme-consistent. Raw CSS escape values are still accepted where a bare
|
|
1104
|
+
* `CSSValue` is allowed.
|
|
1105
|
+
*/
|
|
1106
|
+
|
|
1107
|
+
/** A spacing-scale key resolved against the `--space-*` tokens. */
|
|
1108
|
+
type SpaceKey = keyof typeof tokens.ref.space;
|
|
1109
|
+
interface ContainerStyleOptions {
|
|
1110
|
+
/** Max content width (default `1120px`). A number is treated as `px`. */
|
|
1111
|
+
readonly max?: CSSValue;
|
|
1112
|
+
/** Horizontal padding as a space-scale key (default `'4'`). */
|
|
1113
|
+
readonly padX?: SpaceKey;
|
|
1114
|
+
/** Center the container horizontally (default `true`). */
|
|
1115
|
+
readonly center?: boolean;
|
|
1116
|
+
}
|
|
1117
|
+
/** A width-capped, centered content column with symmetric horizontal padding. */
|
|
1118
|
+
declare function container(opts?: ContainerStyleOptions): string;
|
|
1119
|
+
interface StackOptions {
|
|
1120
|
+
/** Gap between children as a space-scale key (default `'4'`). */
|
|
1121
|
+
readonly gap?: SpaceKey;
|
|
1122
|
+
/** Cross-axis alignment (`align-items`). */
|
|
1123
|
+
readonly align?: 'start' | 'center' | 'end' | 'stretch';
|
|
1124
|
+
/** Main-axis distribution (`justify-content`). */
|
|
1125
|
+
readonly justify?: 'start' | 'center' | 'end' | 'between' | 'around';
|
|
1126
|
+
}
|
|
1127
|
+
/** A vertical flex column with a token-scaled gap. */
|
|
1128
|
+
declare function stack(opts?: StackOptions): string;
|
|
1129
|
+
interface RowOptions extends StackOptions {
|
|
1130
|
+
/** Allow children to wrap onto multiple lines (default `false`). */
|
|
1131
|
+
readonly wrap?: boolean;
|
|
1132
|
+
}
|
|
1133
|
+
/** A horizontal flex row with a token-scaled gap. */
|
|
1134
|
+
declare function row(opts?: RowOptions): string;
|
|
1135
|
+
interface GridOptions {
|
|
1136
|
+
/** Fixed column count, or `'auto'` for a responsive auto-fill track. */
|
|
1137
|
+
readonly columns?: number | 'auto';
|
|
1138
|
+
/** Minimum track width for the `'auto'` mode (default `220px`). */
|
|
1139
|
+
readonly min?: CSSValue;
|
|
1140
|
+
/** Gap between cells as a space-scale key (default `'4'`). */
|
|
1141
|
+
readonly gap?: SpaceKey;
|
|
1142
|
+
}
|
|
1143
|
+
/** A CSS grid with either a fixed column count or an auto-fill responsive track. */
|
|
1144
|
+
declare function grid(opts?: GridOptions): string;
|
|
1145
|
+
interface CenterOptions {
|
|
1146
|
+
/** Use inline-flex instead of block flex (default `false`). */
|
|
1147
|
+
readonly inline?: boolean;
|
|
1148
|
+
/** Minimum height of the centering box (e.g. `'100vh'`). */
|
|
1149
|
+
readonly minHeight?: CSSValue;
|
|
1150
|
+
}
|
|
1151
|
+
/** Center a single child on both axes. */
|
|
1152
|
+
declare function center(opts?: CenterOptions): string;
|
|
1153
|
+
interface SpacerOptions {
|
|
1154
|
+
/** Fixed size (both dimensions). When omitted the spacer flexes to fill. */
|
|
1155
|
+
readonly size?: CSSValue;
|
|
1156
|
+
}
|
|
1157
|
+
/** A flexible gap: fills available space, or a fixed box when `size` is given. */
|
|
1158
|
+
declare function spacer(opts?: SpacerOptions): string;
|
|
1159
|
+
/** The layout primitive family (§12), exported as one namespace object. */
|
|
1160
|
+
declare const layout: {
|
|
1161
|
+
readonly container: typeof container;
|
|
1162
|
+
readonly stack: typeof stack;
|
|
1163
|
+
readonly row: typeof row;
|
|
1164
|
+
readonly grid: typeof grid;
|
|
1165
|
+
readonly center: typeof center;
|
|
1166
|
+
readonly spacer: typeof spacer;
|
|
1167
|
+
};
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* StreetUI styling — semantic typography + code/pre primitives (§13/§14).
|
|
1171
|
+
*
|
|
1172
|
+
* Token-driven `style()` presets for text roles. Each returns a deduplicated class
|
|
1173
|
+
* string and reads the `--font-*`, `--size-*`, `--weight-*`, `--leading-*` and
|
|
1174
|
+
* `--content-*` tokens, so typography stays on the design system and re-themes with
|
|
1175
|
+
* no duplicated definitions. `code` and `blockquote` cover the §14 code/pre case:
|
|
1176
|
+
* monospace, token surface, and sensible wrapping without an external prose sheet.
|
|
1177
|
+
*/
|
|
1178
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
1179
|
+
interface HeadingStyleOptions {
|
|
1180
|
+
/** Semantic heading level 1–6 (drives size + weight). Default `2`. */
|
|
1181
|
+
readonly level?: HeadingLevel;
|
|
1182
|
+
}
|
|
1183
|
+
/** A display heading sized from the type scale by level. */
|
|
1184
|
+
declare function heading(opts?: HeadingStyleOptions): string;
|
|
1185
|
+
interface BodyOptions {
|
|
1186
|
+
/** Secondary (muted) body colour instead of primary. Default `false`. */
|
|
1187
|
+
readonly muted?: boolean;
|
|
1188
|
+
/** Line length cap for comfortable reading (e.g. `'65ch'`). */
|
|
1189
|
+
readonly measure?: string;
|
|
1190
|
+
}
|
|
1191
|
+
/** Default running-text body copy. */
|
|
1192
|
+
declare function body(opts?: BodyOptions): string;
|
|
1193
|
+
/** A small, medium-weight form/field label. */
|
|
1194
|
+
declare function label(): string;
|
|
1195
|
+
/** The smallest supporting text (captions, help, metadata). */
|
|
1196
|
+
declare function caption(): string;
|
|
1197
|
+
/** An inline text link with a token accent colour and accessible focus/hover. */
|
|
1198
|
+
declare function link(): string;
|
|
1199
|
+
/** Inline monospace code (§14). */
|
|
1200
|
+
declare function code(): string;
|
|
1201
|
+
/** A fenced code block / `<pre>` surface: monospace, scrollable, token surface (§14). */
|
|
1202
|
+
declare function pre(): string;
|
|
1203
|
+
/** A left-ruled quotation block. */
|
|
1204
|
+
declare function blockquote(): string;
|
|
1205
|
+
/** A vertically-spaced list body. */
|
|
1206
|
+
declare function list(): string;
|
|
1207
|
+
/** The semantic typography family (§13/§14), exported as one namespace object. */
|
|
1208
|
+
declare const text: {
|
|
1209
|
+
readonly heading: typeof heading;
|
|
1210
|
+
readonly body: typeof body;
|
|
1211
|
+
readonly label: typeof label;
|
|
1212
|
+
readonly caption: typeof caption;
|
|
1213
|
+
readonly link: typeof link;
|
|
1214
|
+
readonly code: typeof code;
|
|
1215
|
+
readonly pre: typeof pre;
|
|
1216
|
+
readonly blockquote: typeof blockquote;
|
|
1217
|
+
readonly list: typeof list;
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* StreetUI styling — accessibility styling helpers (§19).
|
|
1222
|
+
*
|
|
1223
|
+
* These presets make the *default* accessible: a strong, token-driven focus ring
|
|
1224
|
+
* that is visible against any surface, and a correct visually-hidden pattern that
|
|
1225
|
+
* still exposes content to assistive technology. They introduce **no** parallel
|
|
1226
|
+
* a11y-state system — focus styling rides the browser's native `:focus-visible`,
|
|
1227
|
+
* and component a11y states remain the ARIA attributes the renderer already sets,
|
|
1228
|
+
* read from CSS via the `when`/attribute selectors (§10/§15).
|
|
1229
|
+
*/
|
|
1230
|
+
interface FocusRingOptions {
|
|
1231
|
+
/** Ring colour (default `--focus-ring` token). */
|
|
1232
|
+
readonly color?: string;
|
|
1233
|
+
/** Ring thickness in px (default `2`). */
|
|
1234
|
+
readonly width?: number;
|
|
1235
|
+
/** Gap between the element and the ring in px (default `2`). */
|
|
1236
|
+
readonly offset?: number;
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* A strong keyboard focus indicator applied via native `:focus-visible` only, so
|
|
1240
|
+
* pointer focus stays quiet while keyboard focus is always clearly visible (§19).
|
|
1241
|
+
* Compose onto any interactive element's class list.
|
|
1242
|
+
*/
|
|
1243
|
+
declare function focusRing(opts?: FocusRingOptions): string;
|
|
1244
|
+
/**
|
|
1245
|
+
* Visually-hidden content that remains available to screen readers (the correct
|
|
1246
|
+
* `sr-only` pattern — not `display:none`, which also hides from AT).
|
|
1247
|
+
*/
|
|
1248
|
+
declare function visuallyHidden(): string;
|
|
1249
|
+
/**
|
|
1250
|
+
* A skip-link style: visually hidden until focused, then revealed as a prominent
|
|
1251
|
+
* on-surface control. Pairs with `visuallyHidden` semantics but becomes visible on
|
|
1252
|
+
* keyboard focus so "skip to content" links work.
|
|
1253
|
+
*/
|
|
1254
|
+
declare function skipLink(): string;
|
|
1255
|
+
/** The accessibility styling family (§19). */
|
|
1256
|
+
declare const a11y: {
|
|
1257
|
+
readonly focusRing: typeof focusRing;
|
|
1258
|
+
readonly visuallyHidden: typeof visuallyHidden;
|
|
1259
|
+
readonly skipLink: typeof skipLink;
|
|
1260
|
+
};
|
|
1261
|
+
|
|
1262
|
+
/**
|
|
1263
|
+
* StreetUI styling — form control styling (§20).
|
|
1264
|
+
*
|
|
1265
|
+
* Token-driven presets for the common form surfaces. Validation styling is read
|
|
1266
|
+
* from the ARIA attribute the renderer already sets (`[aria-invalid="true"]`) via
|
|
1267
|
+
* the `when: { invalid }` → `[data-invalid]` channel *and* a native attribute
|
|
1268
|
+
* selector, so there is no parallel form-state system — the control's accessible
|
|
1269
|
+
* state drives its appearance (§10/§15/§19). Focus uses native `:focus-visible`
|
|
1270
|
+
* with the strong focus-ring token (§19).
|
|
1271
|
+
*/
|
|
1272
|
+
/** A single-line text input / select / textarea surface. */
|
|
1273
|
+
declare function input(): string;
|
|
1274
|
+
/** The vertical field wrapper: label, control and help/error stacked with gap. */
|
|
1275
|
+
declare function field(): string;
|
|
1276
|
+
/** A field label (medium weight, primary content colour). */
|
|
1277
|
+
declare function fieldLabel(): string;
|
|
1278
|
+
/** Supporting help text under a control. */
|
|
1279
|
+
declare function fieldHelp(): string;
|
|
1280
|
+
/** An inline validation error message, coloured with the danger token. */
|
|
1281
|
+
declare function fieldError(): string;
|
|
1282
|
+
/** A primary action button surface with hover/active/disabled and focus ring. */
|
|
1283
|
+
declare function button(): string;
|
|
1284
|
+
/** The form styling family (§20). */
|
|
1285
|
+
declare const form: {
|
|
1286
|
+
readonly field: typeof field;
|
|
1287
|
+
readonly input: typeof input;
|
|
1288
|
+
readonly label: typeof fieldLabel;
|
|
1289
|
+
readonly help: typeof fieldHelp;
|
|
1290
|
+
readonly error: typeof fieldError;
|
|
1291
|
+
readonly button: typeof button;
|
|
1292
|
+
};
|
|
1293
|
+
|
|
1294
|
+
/**
|
|
1295
|
+
* StreetUI styling — overlay surface styling (§21).
|
|
1296
|
+
*
|
|
1297
|
+
* Token-driven presets for the overlay surfaces produced by the overlay runtime
|
|
1298
|
+
* (dialog, popover, tooltip, dropdown, toast + backdrop). Styling here is **only**
|
|
1299
|
+
* appearance (surface colour, elevation, radius, z-index from the `--z-*` tokens);
|
|
1300
|
+
* positioning, focus trapping and open/close lifecycle remain owned by the overlay
|
|
1301
|
+
* runtime and the transition engine (§18/§21). Elevation and z-index come from
|
|
1302
|
+
* tokens so overlays stack predictably and re-theme with the rest of the system.
|
|
1303
|
+
*/
|
|
1304
|
+
/** The dimmed, full-viewport backdrop behind a modal surface. */
|
|
1305
|
+
declare function backdrop(): string;
|
|
1306
|
+
/** A centered modal dialog surface (elevation + radius from tokens). */
|
|
1307
|
+
declare function dialog(): string;
|
|
1308
|
+
/** A small anchored popover panel. */
|
|
1309
|
+
declare function popover(): string;
|
|
1310
|
+
/** A compact, high-contrast tooltip bubble. */
|
|
1311
|
+
declare function tooltip(): string;
|
|
1312
|
+
/** A dropdown menu surface. */
|
|
1313
|
+
declare function dropdown(): string;
|
|
1314
|
+
/** A single dropdown menu item (hover/selected via tokens + attribute state). */
|
|
1315
|
+
declare function dropdownItem(): string;
|
|
1316
|
+
/** A toast notification surface, elevated above overlays on the toast z-band. */
|
|
1317
|
+
declare function toast(): string;
|
|
1318
|
+
/** The overlay styling family (§21). */
|
|
1319
|
+
declare const overlay: {
|
|
1320
|
+
readonly backdrop: typeof backdrop;
|
|
1321
|
+
readonly dialog: typeof dialog;
|
|
1322
|
+
readonly popover: typeof popover;
|
|
1323
|
+
readonly tooltip: typeof tooltip;
|
|
1324
|
+
readonly dropdown: typeof dropdown;
|
|
1325
|
+
readonly dropdownItem: typeof dropdownItem;
|
|
1326
|
+
readonly toast: typeof toast;
|
|
1327
|
+
};
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* StreetUI styling — animation tokens & declarative keyframes (§22).
|
|
1331
|
+
*
|
|
1332
|
+
* Animation is **pure CSS**: duration and easing come from the `--duration-*` /
|
|
1333
|
+
* `--easing-*` design tokens, and named `@keyframes` are registered once in the
|
|
1334
|
+
* shared registry (lazily, only when referenced, so unused animations add zero
|
|
1335
|
+
* bytes and unstyled routes stay byte-identical). There is **no animation
|
|
1336
|
+
* runtime** — StreetUI runs no timers, RAF loops, or JS tweening for these; the
|
|
1337
|
+
* browser owns playback. Enter/leave *lifecycle* animation remains the transition
|
|
1338
|
+
* engine's job (§18); these helpers supply the appearance it toggles.
|
|
1339
|
+
*/
|
|
1340
|
+
|
|
1341
|
+
/** Duration token keys (`--duration-*`). */
|
|
1342
|
+
type DurationKey = keyof typeof tokens.ref.duration;
|
|
1343
|
+
/** Easing token keys (`--easing-*`). */
|
|
1344
|
+
type EasingKey = keyof typeof tokens.ref.easing;
|
|
1345
|
+
/** The built-in keyframe animations and their raw `@keyframes` bodies. */
|
|
1346
|
+
declare const KEYFRAMES: Readonly<Record<string, string>>;
|
|
1347
|
+
/** The animation names available to {@link animate}. */
|
|
1348
|
+
type AnimationName = keyof typeof KEYFRAMES;
|
|
1349
|
+
interface AnimateOptions {
|
|
1350
|
+
/** Duration token key (default `'base'`). */
|
|
1351
|
+
readonly duration?: DurationKey;
|
|
1352
|
+
/** Easing token key (default `'standard'`). */
|
|
1353
|
+
readonly easing?: EasingKey;
|
|
1354
|
+
/** Delay before the animation starts (e.g. `'100ms'`). */
|
|
1355
|
+
readonly delay?: CSSValue;
|
|
1356
|
+
/** Iteration count — a number or `'infinite'` (default `1`). */
|
|
1357
|
+
readonly iterations?: number | 'infinite';
|
|
1358
|
+
/** Fill mode (default `'both'` so the end state persists). */
|
|
1359
|
+
readonly fill?: 'none' | 'forwards' | 'backwards' | 'both';
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* A class that plays a named keyframe animation using token duration/easing. The
|
|
1363
|
+
* keyframe rule is registered on first use. One class → one CSS `animation`; no JS
|
|
1364
|
+
* drives the frames.
|
|
1365
|
+
*/
|
|
1366
|
+
declare function animate(name: AnimationName, opts?: AnimateOptions): string;
|
|
1367
|
+
interface TransitionOptions {
|
|
1368
|
+
/** Duration token key (default `'base'`). */
|
|
1369
|
+
readonly duration?: DurationKey;
|
|
1370
|
+
/** Easing token key (default `'standard'`). */
|
|
1371
|
+
readonly easing?: EasingKey;
|
|
1372
|
+
/** Delay before the transition starts (e.g. `'50ms'`). */
|
|
1373
|
+
readonly delay?: CSSValue;
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Build a CSS `transition` value for one or more properties using token
|
|
1377
|
+
* duration/easing — e.g. `transition(['opacity','transform'])`. Assign the result
|
|
1378
|
+
* to a `transition` style property; the browser performs the interpolation.
|
|
1379
|
+
*/
|
|
1380
|
+
declare function transition(properties: string | readonly string[], opts?: TransitionOptions): string;
|
|
1381
|
+
/** The animation family (§22) — tokens + declarative keyframes, no runtime. */
|
|
1382
|
+
declare const animation: {
|
|
1383
|
+
readonly animate: typeof animate;
|
|
1384
|
+
readonly transition: typeof transition;
|
|
1385
|
+
readonly keyframes: Readonly<Record<string, string>>;
|
|
1386
|
+
};
|
|
1387
|
+
|
|
509
1388
|
/**
|
|
510
1389
|
* Compiler-phase validation of the ApplicationGraph.
|
|
511
1390
|
*
|
|
@@ -1259,6 +2138,143 @@ declare function reconcileChildren(ctx: RenderContext, parentDom: Element, oldIn
|
|
|
1259
2138
|
*/
|
|
1260
2139
|
declare function reconcileChildrenByPlan(ctx: RenderContext, parentDom: Element, oldInstances: NodeInstance[], plan: readonly PlanEntry[], mountFn: MountFn, hooks?: TransitionHooks): ReconcileResult;
|
|
1261
2140
|
|
|
2141
|
+
/**
|
|
2142
|
+
* StreetUI styling — transition engine interop presets (§18).
|
|
2143
|
+
*
|
|
2144
|
+
* These helpers return a {@link ResolvedTransitionLike} — the exact descriptor the
|
|
2145
|
+
* existing transition engine consumes — assembled entirely from token-driven
|
|
2146
|
+
* `style()` classes and the `--duration-*` / `--easing-*` tokens. Styling therefore
|
|
2147
|
+
* *integrates with* the transition engine rather than competing with it: it only
|
|
2148
|
+
* supplies the enter/leave appearance classes the engine toggles; the engine still
|
|
2149
|
+
* owns all lifecycle timing, leave-deferral and keyed-identity reclaim (§18).
|
|
2150
|
+
* StreetUI adds no new timer and no second animation system here — the browser
|
|
2151
|
+
* performs the interpolation via CSS, and the engine's single timeout coordinates
|
|
2152
|
+
* DOM removal.
|
|
2153
|
+
*/
|
|
2154
|
+
|
|
2155
|
+
interface TransitionPresetOptions {
|
|
2156
|
+
/** Duration token key driving both the CSS transition and the engine timeout. */
|
|
2157
|
+
readonly duration?: DurationKey;
|
|
2158
|
+
/** Easing token key for the CSS transition. */
|
|
2159
|
+
readonly easing?: EasingKey;
|
|
2160
|
+
/** Play the enter animation on first mount too (default `false`). */
|
|
2161
|
+
readonly appear?: boolean;
|
|
2162
|
+
}
|
|
2163
|
+
/** A cross-fade enter/leave transition descriptor for the transition engine. */
|
|
2164
|
+
declare function fadeTransition(opts?: TransitionPresetOptions): ResolvedTransitionLike;
|
|
2165
|
+
/** A fade + scale "pop" transition descriptor (opacity and transform). */
|
|
2166
|
+
declare function scaleTransition(opts?: TransitionPresetOptions): ResolvedTransitionLike;
|
|
2167
|
+
/** A fade + vertical-slide transition descriptor (enters from below). */
|
|
2168
|
+
declare function slideTransition(opts?: TransitionPresetOptions): ResolvedTransitionLike;
|
|
2169
|
+
/** The token-driven transition presets (§18), for use with the transition engine. */
|
|
2170
|
+
declare const transitions: {
|
|
2171
|
+
readonly fadeTransition: typeof fadeTransition;
|
|
2172
|
+
readonly scaleTransition: typeof scaleTransition;
|
|
2173
|
+
readonly slideTransition: typeof slideTransition;
|
|
2174
|
+
};
|
|
2175
|
+
|
|
2176
|
+
/**
|
|
2177
|
+
* StreetUI styling — SSR stylesheet emission + hydration adoption (§15–§17).
|
|
2178
|
+
*
|
|
2179
|
+
* This is the exact companion to `renderHead` (head.ts): where the head runtime
|
|
2180
|
+
* serializes merged `head()` contributions into `<head>`, this serializes the
|
|
2181
|
+
* process-wide deduplicated CSS rule registry into a single
|
|
2182
|
+
* `<style data-streetui-css>` block for the caller to place in `<head>`.
|
|
2183
|
+
*
|
|
2184
|
+
* • `renderStyles()` — SERVER. Serializes `styleRegistry` in deterministic band
|
|
2185
|
+
* order (tokens → base → responsive → state → variant) and stamps the block
|
|
2186
|
+
* with `data-streetui-css-keys="<id> <id> …"` so the browser can adopt the
|
|
2187
|
+
* identities on hydration instead of re-emitting duplicate rules (§17).
|
|
2188
|
+
* Returns `''` when the registry is empty — so an app that declares no styles
|
|
2189
|
+
* (and no token block) emits nothing extra and existing SSR output stays
|
|
2190
|
+
* byte-identical (§16, the empty-registry guarantee).
|
|
2191
|
+
*
|
|
2192
|
+
* • `adoptServerStyles(dom, root)` — BROWSER. Finds the server-emitted style
|
|
2193
|
+
* block under `root` (or `document`), reads its identity keys, and seeds the
|
|
2194
|
+
* registry via `adoptServerIdentities` so client-side `style()`/token calls
|
|
2195
|
+
* for the same identities register no duplicate rule (§17).
|
|
2196
|
+
*
|
|
2197
|
+
* CSS is inherently global and cascading, so — unlike head — the stylesheet is
|
|
2198
|
+
* the whole process registry (a deduped superset), not a per-graph walk. The
|
|
2199
|
+
* registry is keyed by content identity and never by node, so it is bounded by
|
|
2200
|
+
* source diversity and strands nothing when nodes unmount (§15, leak-free).
|
|
2201
|
+
*/
|
|
2202
|
+
|
|
2203
|
+
interface RenderStylesOptions {
|
|
2204
|
+
/** Registry to serialize (defaults to the shared process-wide instance). */
|
|
2205
|
+
readonly registry?: StyleRegistry;
|
|
2206
|
+
}
|
|
2207
|
+
/**
|
|
2208
|
+
* Serialize the deduplicated CSS registry to a `<style data-streetui-css>` block
|
|
2209
|
+
* for placement inside `<head>`. Deterministic and byte-stable: an empty registry
|
|
2210
|
+
* yields `''` (§16); otherwise the single block carries every registered rule in
|
|
2211
|
+
* fixed band order plus the identity list for hydration adoption (§17).
|
|
2212
|
+
*/
|
|
2213
|
+
declare function renderStyles(options?: RenderStylesOptions): string;
|
|
2214
|
+
/**
|
|
2215
|
+
* Adopt a server-emitted stylesheet's identities into the registry so the client
|
|
2216
|
+
* does not re-emit duplicate rules for the same styles (§17). Safe to call when
|
|
2217
|
+
* no server block exists (no-op) and idempotent. Returns the number of identities
|
|
2218
|
+
* adopted (0 when there was nothing to adopt).
|
|
2219
|
+
*/
|
|
2220
|
+
declare function adoptServerStyles(dom: DOMAdapter, root: Element | null, options?: RenderStylesOptions): number;
|
|
2221
|
+
|
|
2222
|
+
/**
|
|
2223
|
+
* StreetUI styling — first-class, SSR/hydration-safe theme controller (§7).
|
|
2224
|
+
*
|
|
2225
|
+
* Theme is ordinary StreetUI state: a signal for the user's choice and a derived
|
|
2226
|
+
* signal for the resolved concrete theme. The only browser-specific parts —
|
|
2227
|
+
* reading a stored preference, matching the OS color scheme, and writing the
|
|
2228
|
+
* `data-theme` attribute onto a root element — are isolated behind guards so the
|
|
2229
|
+
* exact same module runs during SSR (no `document`, no `localStorage`) without
|
|
2230
|
+
* throwing. The server renders with the default theme; the client applies the
|
|
2231
|
+
* persisted/system choice on mount, which is a legitimate post-hydration update
|
|
2232
|
+
* rather than a hydration mismatch: the attribute lives on the root element,
|
|
2233
|
+
* outside the hydrated app container, and only re-points token variables (§16).
|
|
2234
|
+
*
|
|
2235
|
+
* This lives in the renderer layer because switching the theme writes to the DOM;
|
|
2236
|
+
* it builds on the DOM-free token system in `streetui` (`createThemeTokens`
|
|
2237
|
+
* emits `:root` + `[data-theme="dark"]` variable blocks), so a theme flip is a
|
|
2238
|
+
* single attribute change with no restyle work and no re-render.
|
|
2239
|
+
*/
|
|
2240
|
+
|
|
2241
|
+
type ThemeChoice = 'light' | 'dark' | 'system';
|
|
2242
|
+
type ResolvedTheme = 'light' | 'dark';
|
|
2243
|
+
/** Minimal persistence seam so tests/SSR can run without a real localStorage. */
|
|
2244
|
+
interface ThemeStorage {
|
|
2245
|
+
read(): ThemeChoice | null;
|
|
2246
|
+
write(choice: ThemeChoice): void;
|
|
2247
|
+
}
|
|
2248
|
+
/** Browser localStorage adapter, guarded; falls back to in-memory elsewhere. */
|
|
2249
|
+
declare function defaultThemeStorage(key?: string): ThemeStorage;
|
|
2250
|
+
interface ThemeController {
|
|
2251
|
+
/** The user's choice: light | dark | system. */
|
|
2252
|
+
readonly choice: Signal<ThemeChoice>;
|
|
2253
|
+
/** The resolved concrete theme after applying `system`. */
|
|
2254
|
+
readonly resolved: ReadonlySignal<ResolvedTheme>;
|
|
2255
|
+
/** Set an explicit choice (persisted). */
|
|
2256
|
+
set(choice: ThemeChoice): void;
|
|
2257
|
+
/** Advance light → dark → system → light (for a single toggle control). */
|
|
2258
|
+
cycle(): void;
|
|
2259
|
+
/** Human label for the current choice (bind to the toggle button). */
|
|
2260
|
+
readonly label: ReadonlySignal<string>;
|
|
2261
|
+
/** Stop applying the theme to the DOM (disposes the effect). */
|
|
2262
|
+
dispose(): void;
|
|
2263
|
+
}
|
|
2264
|
+
interface ThemeOptions {
|
|
2265
|
+
readonly storage?: ThemeStorage;
|
|
2266
|
+
/** Element to receive `data-theme` (defaults to the document root). Omit for SSR. */
|
|
2267
|
+
readonly root?: Element | null;
|
|
2268
|
+
/** Initial choice when nothing is stored (default 'system'). */
|
|
2269
|
+
readonly initial?: ThemeChoice;
|
|
2270
|
+
}
|
|
2271
|
+
/**
|
|
2272
|
+
* Create the theme controller. During SSR pass no `root` (or it will be null);
|
|
2273
|
+
* the signal still works so server markup can read `resolved`, but no DOM write
|
|
2274
|
+
* is attempted. Reactive theme switching is a single `data-theme` flip (§7/§16).
|
|
2275
|
+
*/
|
|
2276
|
+
declare function createTheme(options?: ThemeOptions): ThemeController;
|
|
2277
|
+
|
|
1262
2278
|
/**
|
|
1263
2279
|
* StreetUI Renderer — framework-owned DOM renderer.
|
|
1264
2280
|
*
|
|
@@ -2665,4 +3681,4 @@ interface ResolvedConfig {
|
|
|
2665
3681
|
/** Identity helper that gives `streetui.config.ts` full type-checking + inference. */
|
|
2666
3682
|
declare function defineConfig(config: StreetUIConfig): StreetUIConfig;
|
|
2667
3683
|
|
|
2668
|
-
export { type A11yIds, type Announcer, Application, ApplicationGraph, ApplicationId, type ApplicationIdentity, type ApplicationInspection, type ApplicationOptions, type ApplicationPanel, type AuthSession, type AuthSessionConfig, type AuthStatus, BrowserDOMAdapter, CleanupRegistry, type Client, type ClientConfig, CompiledApplication, ContainerDSL, type Context, type ContextInspection, type ContextLike, DEFAULT_PERF_THRESHOLDS, DEVTOOLS_TABS, DOMAdapter, type DevToolsOptions, type DevToolsSession, type DevToolsSnapshot, type DevToolsSources, DiagnosticCollector, type DiagnosticContext, type DiagnosticSink, type DiagnosticsPanel, type DiagnosticsSummary, type DomBinding, DomEventRegistry, Environment, type EnvironmentCapabilities, type EnvironmentKind, type ErrorReport, type ErrorReportOptions, EventBus, type EventHandler, type EventInspection, FOCUSABLE_SELECTOR, type FetchLike, type Field, type Form, type FormConfig, type FormInspection, type FormLike, type FormValidators, type FormValues, GraphNode, HttpError, type HttpMethod, HydrationDiagnosticSink, type HydrationInspection, type I18n, type I18nConfig, type I18nInspection, type I18nLike, type InspectFormOptions, type InspectI18nOptions, type InspectResourceOptions, type InspectSignalGraphOptions, type InspectSignalOptions, type InspectedComponent, type InspectedEventNode, type InspectedInteractions, type InspectedNode, type InspectedOverlay, type InspectedPage, type InspectedTransition, type InteractiveDevToolsOptions, type InterpolationParams, type IsActiveOptions, type Job, Lifecycle, type LoadUser, type MatchResult, type MessageMap, type MountFn, type MountRouterOptions, type MountedApplication, type MountedRouter, type Mutation, type MutationInspection, type MutationLike, type MutationOptions, type MutationStatus, type Mutator, type NavigateOptions, NodeInstance, type NodeInstanceOptions, PageDSL, type PerfDiagnostic, type PerfDiagnosticCode, type PerfSnapshot, type PerfThresholds, type PerformancePanel, type PlanEntry, type Priority, ROUTER_OUTLET_ID, ROUTER_OUTLET_KEY, ReadonlySignal, type ReconcileResult, RenderContext, RenderHandle, type RequestConfig, type ResolvedConfig, type ResolvedTransitionLike, Resource, type ResourceInspection, type ResourceLike, ResourceLoaderContext, ResourceOptions, 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 SignalGraph, type SignalGraphEdge, type SignalGraphNode, type SignalInspection, SignalKind, type SignalsPanel, Store, type StoreState, type StreetEvent, type StreetEventType, StreetFrameworkError, StreetRenderHandle, StreetRenderer, StreetRendererImpl, type StreetRendererOptions, type StreetUIConfig, type SubmitStatus, Subscriber, TransitionConfig, TransitionController, type TransitionHooks, type TransitionPhase, Unsubscribe, type Validator, a11yIds, applyNodeProps, applyProp, bindDomEvent, browserDOMAdapter, buttonUpdate, consoleDiagnosticSink, containFocus, createAnnouncer, createApplication, createAuthSession, createBrowserHistory, createClient, createContext, createDevTools, createForm, createI18n, createMemoryHistory, createRenderer, createRouter, createRuntime, createStore, createStreetEvent, defineConfig, describeError, diagnosePerformance, email, environment, escapeHtml, escapeHtmlAttr, escapeHtmlText, flushSync, focusById, focusFirst, focusInitial, formatDiagnosticContext, frameworkError, getFocusable, getResolvedTransition, globalEventBus, headingUpdate, hydrateGraph, inputUpdate, inspectApplication, inspectComponents, inspectContext, inspectEvents, inspectForm, inspectGraph, inspectHydration, inspectI18n, inspectInteractions, inspectMutation, inspectResource, inspectRouter, inspectSignal, inspectSignalGraph, interpolate, linkUpdate, matchPattern, matchRoutes, maxLength, minLength, mountGraph, mountNode, mountRouter, mutation, nodeTypeStats, normalizePath, onEscape, patchNode, patchProp, pattern, printDiagnostics, printGraph, reconcileChildren, reconcileChildrenByPlan, renderDevToolsHTML, renderDevToolsReport, renderInteractiveDevTools, reportDiagnostic, reportError, required, resolveTag, restoreFocus, routerOutlet, rovingMenu, runElementTransition, runValidators, saveFocus, scheduleImmediate, scheduleUpdate, scheduler, serializeChildren, serializeServerNode, splitTarget, textUpdate, toIdToken, transformGraph, trapFocus, validateGraph, wireComponentBehavior, wireEvents, wireOverlayBehavior, wireReactiveList, wireSignalBindings };
|
|
3684
|
+
export { type A11yIds, type AnimateOptions, type AnimationName, type Announcer, Application, ApplicationGraph, ApplicationId, type ApplicationIdentity, type ApplicationInspection, type ApplicationOptions, type ApplicationPanel, type AuthSession, type AuthSessionConfig, type AuthStatus, BREAKPOINTS, type BodyOptions, type Breakpoint, BrowserDOMAdapter, type CSSValue, type CanonicalStyle, type CenterOptions, CleanupRegistry, type Client, type ClientConfig, CompiledApplication, type ComponentState, ContainerDSL, type ContainerStyleOptions, type Context, type ContextInspection, type ContextLike, DEFAULT_PERF_THRESHOLDS, DEFAULT_TOKENS, DEVTOOLS_TABS, DOMAdapter, type DeepPartial, type DevToolsOptions, type DevToolsSession, type DevToolsSnapshot, type DevToolsSources, DiagnosticCollector, type DiagnosticContext, type DiagnosticSink, type DiagnosticsPanel, type DiagnosticsSummary, type DomBinding, DomEventRegistry, type DurationKey, type EasingKey, Environment, type EnvironmentCapabilities, type EnvironmentKind, type ErrorReport, type ErrorReportOptions, EventBus, type EventHandler, type EventInspection, FOCUSABLE_SELECTOR, type FetchLike, type Field, type FocusRingOptions, type Form, type FormConfig, type FormInspection, type FormLike, type FormValidators, type FormValues, type GeneratedCSS, GraphNode, type GridOptions, type HeadingLevel, type HeadingStyleOptions, HttpError, type HttpMethod, HydrationDiagnosticSink, type HydrationInspection, type I18n, type I18nConfig, type I18nInspection, type I18nLike, type InspectFormOptions, type InspectI18nOptions, type InspectResourceOptions, type InspectSignalGraphOptions, type InspectSignalOptions, type InspectedComponent, type InspectedEventNode, type InspectedInteractions, type InspectedNode, type InspectedOverlay, type InspectedPage, type InspectedTransition, type InteractiveDevToolsOptions, type InterpolationParams, type IsActiveOptions, type Job, Lifecycle, type LoadUser, type MatchResult, type MessageMap, type MountFn, type MountRouterOptions, type MountedApplication, type MountedRouter, type Mutation, type MutationInspection, type MutationLike, type MutationOptions, type MutationStatus, type Mutator, type NavigateOptions, NodeInstance, type NodeInstanceOptions, PageDSL, type PerfDiagnostic, type PerfDiagnosticCode, type PerfSnapshot, type PerfThresholds, type PerformancePanel, type PlanEntry, type Priority, type PseudoState, ROUTER_OUTLET_ID, ROUTER_OUTLET_KEY, type ReactiveStyle, ReadonlySignal, type ReconcileResult, RenderContext, RenderHandle, type RenderStylesOptions, type RequestConfig, type ResolvedConfig, type ResolvedTheme, type ResolvedTransitionLike, Resource, type ResourceInspection, type ResourceLike, ResourceLoaderContext, ResourceOptions, ResourceStatus, type ResponsiveValue, type RouteBuilder, type RouteContext, type RouteDefinition, type RouteMatch, type RouteMatchLike, type Router, type RouterHistory, type RouterInspection, type RouterLike, type RouterLocation, type RouterOptions, type RowOptions, Runtime, RuntimeNodeInstance, type RuntimeOptions, Scheduler, type SchedulerDiagnostics, SemanticNodeType, ServerComment, ServerElement, ServerFragment, type ServerNode, type ServerNodeKind, type ServerParent, ServerRawHTML, ServerStyle, ServerText, type ShellBuilder, Signal, type SignalGraph, type SignalGraphEdge, type SignalGraphNode, type SignalInspection, SignalKind, type SignalsPanel, type SpaceKey, type SpacerOptions, type StackOptions, Store, type StoreState, type StreetEvent, type StreetEventType, StreetFrameworkError, StreetRenderHandle, StreetRenderer, StreetRendererImpl, type StreetRendererOptions, type StreetUIConfig, type StyleBand, type StyleDef, type StyleProperties, StyleRegistry, type SubmitStatus, Subscriber, type ThemeChoice, type ThemeController, type ThemeOptions, type ThemeStorage, type ThemeTokenDef, type ThemeTokens, type TokenLeaf, type TokenRefs, type TokenTree, TransitionConfig, TransitionController, type TransitionHooks, type TransitionOptions, type TransitionPhase, type TransitionPresetOptions, Unsubscribe, type Validator, type VariantConfig, type VariantFn, type VariantGroups, type VariantSelection, a11y, a11yIds, adoptServerStyles, animate, animation, applyNodeProps, applyProp, backdrop, bindDomEvent, blockquote, body, browserDOMAdapter, button, buttonUpdate, canonicalize, caption, center, code, consoleDiagnosticSink, containFocus, container, createAnnouncer, createApplication, createAuthSession, createBrowserHistory, createClient, createContext, createDevTools, createForm, createI18n, createMemoryHistory, createRenderer, createRouter, createRuntime, createStore, createStreetEvent, createTheme, createThemeTokens, cssPropName, cssValue, cx, defaultThemeStorage, defineConfig, describeError, diagnosePerformance, dialog, dropdown, dropdownItem, email, environment, escapeHtml, escapeHtmlAttr, escapeHtmlText, fadeTransition, field, fieldError, fieldHelp, fieldLabel, flushSync, focusById, focusFirst, focusInitial, focusRing, form, formatDiagnosticContext, frameworkError, generateCSS, getFocusable, getResolvedTransition, globalEventBus, grid, hashIdentity, heading, headingUpdate, hydrateGraph, identityOf, input, inputUpdate, inspectApplication, inspectComponents, inspectContext, inspectEvents, inspectForm, inspectGraph, inspectHydration, inspectI18n, inspectInteractions, inspectMutation, inspectResource, inspectRouter, inspectSignal, inspectSignalGraph, interpolate, label, layout, link, linkUpdate, list, matchPattern, matchRoutes, maxLength, minLength, mountGraph, mountNode, mountRouter, mutation, nodeTypeStats, normalizePath, onEscape, overlay, patchNode, patchProp, pattern, popover, pre, printDiagnostics, printGraph, reactiveVarName, reactiveVarValue, reconcileChildren, reconcileChildrenByPlan, renderDevToolsHTML, renderDevToolsReport, renderInteractiveDevTools, renderStyles, reportDiagnostic, reportError, required, resolveTag, restoreFocus, routerOutlet, rovingMenu, row, runElementTransition, runValidators, saveFocus, scaleTransition, scheduleImmediate, scheduleUpdate, scheduler, serializeChildren, serializeServerNode, skipLink, slideTransition, spacer, splitTarget, stack, stateAttr, style, styleRegistry, styleVariants, styleWithVars, text, textUpdate, toIdToken, toast, tokens, tooltip, transformGraph, transition, transitions, trapFocus, validateGraph, visuallyHidden, wireComponentBehavior, wireEvents, wireOverlayBehavior, wireReactiveList, wireSignalBindings };
|