streetui 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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-CTA4MLX6.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 PageBuilder, a5 as PageBuilderImpl, a6 as PropValue, a7 as Props, a8 as ReactiveConsumer, a9 as ReactiveSource, aa as SectionBuilder, ab as SectionBuilderImpl, ac as SectionDSL, ad as SectionOptions, ae as SerializedGraph, af as SerializedNode, ag as StateRef, S as StreetApp, ah as StreetUI, ai as TextOptions, aj as TextValue, V as VERSION, ak as batch, al as compile, am as compileGraph, an as createNodeId, ao as derived, ap as effect, aq as formatDiagnostic, ar as generateApplicationId, as as generateNodeId, at as isBatching, au as nextId, av as nodeIdPrefix, aw as observerCount, ax as reactiveListItemKey, ay as reactiveListItemSignature, az as resetIdCounter, aA as signal, aB as signalKind, aC as streetui } from './compile-CTA4MLX6.cjs';
3
- import { R as RenderHandle, S as StreetRenderer, a as HydrationDiagnosticSink } from './hydration-diagnostics-Cu2ZRxL1.cjs';
4
- export { H as HydrationDiagnostic, b as HydrationMismatchType, c as consoleHydrationDiagnosticSink, d as createHydrationDiagnosticCollector, f as formatHydrationDiagnostic } from './hydration-diagnostics-Cu2ZRxL1.cjs';
5
- import { D as DOMAdapter } from './server-BeFSjxkL.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-BeFSjxkL.cjs';
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-DGHUC0T6.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 PageBuilder, a5 as PageBuilderImpl, a6 as PropValue, a7 as Props, a8 as ReactiveConsumer, a9 as ReactiveSource, aa as SectionBuilder, ab as SectionBuilderImpl, ac as SectionDSL, ad as SectionOptions, ae as SerializedGraph, af as SerializedNode, ag as StateRef, S as StreetApp, ah as StreetUI, ai as TextOptions, aj as TextValue, V as VERSION, ak as batch, al as compile, am as compileGraph, an as createNodeId, ao as derived, ap as effect, aq as formatDiagnostic, ar as generateApplicationId, as as generateNodeId, at as isBatching, au as nextId, av as nodeIdPrefix, aw as observerCount, ax as reactiveListItemKey, ay as reactiveListItemSignature, az as resetIdCounter, aA as signal, aB as signalKind, aC as streetui } from './compile-DGHUC0T6.cjs';
3
+ import { R as RenderHandle, S as StreetRenderer, a as HydrationDiagnosticSink } from './hydration-diagnostics-D9odszLZ.cjs';
4
+ export { H as HydrationDiagnostic, b as HydrationMismatchType, c as consoleHydrationDiagnosticSink, d as createHydrationDiagnosticCollector, f as formatHydrationDiagnostic } from './hydration-diagnostics-D9odszLZ.cjs';
5
+ import { D as DOMAdapter } from './server-CNgoINXH.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-CNgoINXH.cjs';
7
7
 
8
8
  /**
9
9
  * A simple reactive store built on top of signals.
@@ -614,11 +614,14 @@ declare class ServerElement implements ServerNode {
614
614
  parent: ServerParent | null;
615
615
  readonly tagName: string;
616
616
  readonly attributes: Map<string, string>;
617
- /** JS properties set via `setProperty` (e.g. input `value`, `checked`). */
618
- readonly properties: Map<string, unknown>;
619
617
  readonly children: ServerNode[];
620
- readonly style: ServerStyle;
618
+ _properties: Map<string, unknown> | null;
619
+ _style: ServerStyle | null;
621
620
  constructor(tagName: string);
621
+ /** JS properties set via `setProperty` (e.g. input `value`, `checked`). Allocated on first access. */
622
+ get properties(): Map<string, unknown>;
623
+ /** Inline-style holder mirroring `element.style`. Allocated on first access. */
624
+ get style(): ServerStyle;
622
625
  }
623
626
  /** Escape text node content. */
624
627
  declare function escapeHtmlText(value: string): string;
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-CTA4MLX6.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 PageBuilder, a5 as PageBuilderImpl, a6 as PropValue, a7 as Props, a8 as ReactiveConsumer, a9 as ReactiveSource, aa as SectionBuilder, ab as SectionBuilderImpl, ac as SectionDSL, ad as SectionOptions, ae as SerializedGraph, af as SerializedNode, ag as StateRef, S as StreetApp, ah as StreetUI, ai as TextOptions, aj as TextValue, V as VERSION, ak as batch, al as compile, am as compileGraph, an as createNodeId, ao as derived, ap as effect, aq as formatDiagnostic, ar as generateApplicationId, as as generateNodeId, at as isBatching, au as nextId, av as nodeIdPrefix, aw as observerCount, ax as reactiveListItemKey, ay as reactiveListItemSignature, az as resetIdCounter, aA as signal, aB as signalKind, aC as streetui } from './compile-CTA4MLX6.js';
3
- import { R as RenderHandle, S as StreetRenderer, a as HydrationDiagnosticSink } from './hydration-diagnostics-DqkNk4EU.js';
4
- export { H as HydrationDiagnostic, b as HydrationMismatchType, c as consoleHydrationDiagnosticSink, d as createHydrationDiagnosticCollector, f as formatHydrationDiagnostic } from './hydration-diagnostics-DqkNk4EU.js';
5
- import { D as DOMAdapter } from './server-CtHBgrxf.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-CtHBgrxf.js';
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-DGHUC0T6.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 PageBuilder, a5 as PageBuilderImpl, a6 as PropValue, a7 as Props, a8 as ReactiveConsumer, a9 as ReactiveSource, aa as SectionBuilder, ab as SectionBuilderImpl, ac as SectionDSL, ad as SectionOptions, ae as SerializedGraph, af as SerializedNode, ag as StateRef, S as StreetApp, ah as StreetUI, ai as TextOptions, aj as TextValue, V as VERSION, ak as batch, al as compile, am as compileGraph, an as createNodeId, ao as derived, ap as effect, aq as formatDiagnostic, ar as generateApplicationId, as as generateNodeId, at as isBatching, au as nextId, av as nodeIdPrefix, aw as observerCount, ax as reactiveListItemKey, ay as reactiveListItemSignature, az as resetIdCounter, aA as signal, aB as signalKind, aC as streetui } from './compile-DGHUC0T6.js';
3
+ import { R as RenderHandle, S as StreetRenderer, a as HydrationDiagnosticSink } from './hydration-diagnostics-Cv0Bi9Aj.js';
4
+ export { H as HydrationDiagnostic, b as HydrationMismatchType, c as consoleHydrationDiagnosticSink, d as createHydrationDiagnosticCollector, f as formatHydrationDiagnostic } from './hydration-diagnostics-Cv0Bi9Aj.js';
5
+ import { D as DOMAdapter } from './server-CHT2bFkR.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-CHT2bFkR.js';
7
7
 
8
8
  /**
9
9
  * A simple reactive store built on top of signals.
@@ -614,11 +614,14 @@ declare class ServerElement implements ServerNode {
614
614
  parent: ServerParent | null;
615
615
  readonly tagName: string;
616
616
  readonly attributes: Map<string, string>;
617
- /** JS properties set via `setProperty` (e.g. input `value`, `checked`). */
618
- readonly properties: Map<string, unknown>;
619
617
  readonly children: ServerNode[];
620
- readonly style: ServerStyle;
618
+ _properties: Map<string, unknown> | null;
619
+ _style: ServerStyle | null;
621
620
  constructor(tagName: string);
621
+ /** JS properties set via `setProperty` (e.g. input `value`, `checked`). Allocated on first access. */
622
+ get properties(): Map<string, unknown>;
623
+ /** Inline-style holder mirroring `element.style`. Allocated on first access. */
624
+ get style(): ServerStyle;
622
625
  }
623
626
  /** Escape text node content. */
624
627
  declare function escapeHtmlText(value: string): string;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "1.3.0";
2
+ var VERSION = "1.5.0";
3
3
 
4
4
  // ../state/src/signal.ts
5
5
  var _activeConsumer = null;
@@ -1841,7 +1841,7 @@ var BrowserDOMAdapter = class {
1841
1841
  return Array.from(node.childNodes);
1842
1842
  }
1843
1843
  };
1844
- var browserDOMAdapter = new BrowserDOMAdapter();
1844
+ var browserDOMAdapter = /* @__PURE__ */ new BrowserDOMAdapter();
1845
1845
 
1846
1846
  // ../dom/src/server-node.ts
1847
1847
  var ServerStyle = class {
@@ -1882,13 +1882,30 @@ var ServerElement = class {
1882
1882
  parent = null;
1883
1883
  tagName;
1884
1884
  attributes = /* @__PURE__ */ new Map();
1885
- /** JS properties set via `setProperty` (e.g. input `value`, `checked`). */
1886
- properties = /* @__PURE__ */ new Map();
1887
1885
  children = [];
1888
- style = new ServerStyle();
1886
+ // Lazily-allocated stores. On the 10k-row SSR corpus ~0% of elements carry JS
1887
+ // properties or inline styles (measured, §5: 1 of 80,029 elements uses
1888
+ // `properties`, 0 use `style`), so eagerly allocating a `properties` Map plus
1889
+ // a `ServerStyle` (which itself holds a Map) per element wasted ~240k
1890
+ // allocations per /users render — all in the dominant mount phase. These are
1891
+ // created on first WRITE via the `properties`/`style` getters; the serializer
1892
+ // reads the raw `_properties`/`_style` fields so a READ never forces an
1893
+ // allocation. Output is byte-identical: an unset store previously serialized
1894
+ // to nothing (empty `properties.has(...)` / `style.isEmpty`), and a null store
1895
+ // is skipped the same way.
1896
+ _properties = null;
1897
+ _style = null;
1889
1898
  constructor(tagName) {
1890
1899
  this.tagName = tagName.toLowerCase();
1891
1900
  }
1901
+ /** JS properties set via `setProperty` (e.g. input `value`, `checked`). Allocated on first access. */
1902
+ get properties() {
1903
+ return this._properties ??= /* @__PURE__ */ new Map();
1904
+ }
1905
+ /** Inline-style holder mirroring `element.style`. Allocated on first access. */
1906
+ get style() {
1907
+ return this._style ??= new ServerStyle();
1908
+ }
1892
1909
  };
1893
1910
  var VOID_ELEMENTS = /* @__PURE__ */ new Set([
1894
1911
  "area",
@@ -1911,11 +1928,66 @@ var SERIALIZED_PROPERTIES = {
1911
1928
  checked: "boolean",
1912
1929
  selected: "boolean"
1913
1930
  };
1931
+ var SERIALIZED_PROPERTY_ENTRIES = Object.entries(SERIALIZED_PROPERTIES);
1932
+ var TEXT_SPECIAL = /[&<>]/;
1933
+ var ATTR_SPECIAL = /[&<>"]/;
1914
1934
  function escapeHtmlText(value) {
1915
- return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1935
+ if (!TEXT_SPECIAL.test(value)) return value;
1936
+ let out = "";
1937
+ let last = 0;
1938
+ for (let i = 0; i < value.length; i++) {
1939
+ let esc;
1940
+ switch (value.charCodeAt(i)) {
1941
+ case 38:
1942
+ esc = "&amp;";
1943
+ break;
1944
+ // &
1945
+ case 60:
1946
+ esc = "&lt;";
1947
+ break;
1948
+ // <
1949
+ case 62:
1950
+ esc = "&gt;";
1951
+ break;
1952
+ // >
1953
+ default:
1954
+ continue;
1955
+ }
1956
+ out += value.slice(last, i) + esc;
1957
+ last = i + 1;
1958
+ }
1959
+ return out + value.slice(last);
1916
1960
  }
1917
1961
  function escapeHtmlAttr(value) {
1918
- return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1962
+ if (!ATTR_SPECIAL.test(value)) return value;
1963
+ let out = "";
1964
+ let last = 0;
1965
+ for (let i = 0; i < value.length; i++) {
1966
+ let esc;
1967
+ switch (value.charCodeAt(i)) {
1968
+ case 38:
1969
+ esc = "&amp;";
1970
+ break;
1971
+ // &
1972
+ case 60:
1973
+ esc = "&lt;";
1974
+ break;
1975
+ // <
1976
+ case 62:
1977
+ esc = "&gt;";
1978
+ break;
1979
+ // >
1980
+ case 34:
1981
+ esc = "&quot;";
1982
+ break;
1983
+ // "
1984
+ default:
1985
+ continue;
1986
+ }
1987
+ out += value.slice(last, i) + esc;
1988
+ last = i + 1;
1989
+ }
1990
+ return out + value.slice(last);
1919
1991
  }
1920
1992
  function serializeAttributes(el) {
1921
1993
  const parts = [];
@@ -1926,20 +1998,24 @@ function serializeAttributes(el) {
1926
1998
  parts.push(` ${name}="${escapeHtmlAttr(value)}"`);
1927
1999
  }
1928
2000
  }
1929
- for (const [name, kind] of Object.entries(SERIALIZED_PROPERTIES)) {
1930
- if (!el.properties.has(name)) continue;
1931
- if (el.attributes.has(name)) continue;
1932
- const raw = el.properties.get(name);
1933
- if (kind === "boolean") {
1934
- if (raw === true) parts.push(` ${name}`);
1935
- } else {
1936
- if (raw !== void 0 && raw !== null) {
1937
- parts.push(` ${name}="${escapeHtmlAttr(String(raw))}"`);
2001
+ const props = el._properties;
2002
+ if (props !== null) {
2003
+ for (const [name, kind] of SERIALIZED_PROPERTY_ENTRIES) {
2004
+ if (!props.has(name)) continue;
2005
+ if (el.attributes.has(name)) continue;
2006
+ const raw = props.get(name);
2007
+ if (kind === "boolean") {
2008
+ if (raw === true) parts.push(` ${name}`);
2009
+ } else {
2010
+ if (raw !== void 0 && raw !== null) {
2011
+ parts.push(` ${name}="${escapeHtmlAttr(String(raw))}"`);
2012
+ }
1938
2013
  }
1939
2014
  }
1940
2015
  }
1941
- if (!el.style.isEmpty && !el.attributes.has("style")) {
1942
- parts.push(` style="${escapeHtmlAttr(el.style.toCss())}"`);
2016
+ const style = el._style;
2017
+ if (style !== null && !style.isEmpty && !el.attributes.has("style")) {
2018
+ parts.push(` style="${escapeHtmlAttr(style.toCss())}"`);
1943
2019
  }
1944
2020
  return parts.join("");
1945
2021
  }
@@ -2140,7 +2216,7 @@ var ServerDOMAdapter = class {
2140
2216
  return serializeServerNode(asServer(node));
2141
2217
  }
2142
2218
  };
2143
- var serverDOMAdapter = new ServerDOMAdapter();
2219
+ var serverDOMAdapter = /* @__PURE__ */ new ServerDOMAdapter();
2144
2220
 
2145
2221
  // ../dom/src/focus.ts
2146
2222
  var FOCUSABLE_SELECTOR = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';