streetui 2.5.0 → 2.6.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.
@@ -1,6 +1,6 @@
1
- import { S as StreetApp, H as HydrationDiagnostic, a as ComponentDefinition, b as ContainerBuilder } from './hydration-diagnostics-j2ged4cF.cjs';
2
- export { V as VERSION } from './hydration-diagnostics-j2ged4cF.cjs';
3
- import { R as RenderHandle } from './renderer-interface-hcqzG-N6.cjs';
1
+ import { S as StreetApp, H as HydrationDiagnostic, a as ComponentDefinition, b as ContainerBuilder } from './hydration-diagnostics-D1GlzulR.cjs';
2
+ export { V as VERSION } from './hydration-diagnostics-D1GlzulR.cjs';
3
+ import { R as RenderHandle } from './renderer-interface-BzLwBsyj.cjs';
4
4
  export * from 'streetui/diagnostics';
5
5
 
6
6
  /**
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { S as StreetApp, H as HydrationDiagnostic, a as ComponentDefinition, b as ContainerBuilder } from './hydration-diagnostics-j2ged4cF.js';
2
- export { V as VERSION } from './hydration-diagnostics-j2ged4cF.js';
3
- import { R as RenderHandle } from './renderer-interface-DngAhfHx.js';
1
+ import { S as StreetApp, H as HydrationDiagnostic, a as ComponentDefinition, b as ContainerBuilder } from './hydration-diagnostics-D1GlzulR.js';
2
+ export { V as VERSION } from './hydration-diagnostics-D1GlzulR.js';
3
+ import { R as RenderHandle } from './renderer-interface-CmVlxE95.js';
4
4
  export * from 'streetui/diagnostics';
5
5
 
6
6
  /**
package/dist/testing.js CHANGED
@@ -971,6 +971,11 @@ var TAG_MAP = {
971
971
  "list-item": "li",
972
972
  image: "img",
973
973
  link: "a",
974
+ // A `code()` node renders as a semantic `<pre>` outer element; the mount/
975
+ // hydrate branches add a single inner `<code>` holding the escaped source
976
+ // (mirrors how `text` renders `<span>` + an inner text node). One graph
977
+ // node → one outer element preserves positional hydration.
978
+ code: "pre",
974
979
  component: "div",
975
980
  slot: "div",
976
981
  fragment: "div",
@@ -1689,6 +1694,23 @@ function mountNode(ctx, graphNode, parentDom) {
1689
1694
  dom.appendChild(parentDom, el2);
1690
1695
  return instance2;
1691
1696
  }
1697
+ if (graphNode.type === "code") {
1698
+ const source = String(graphNode.getProp("text") ?? "");
1699
+ const pre = dom.createElement("pre");
1700
+ const codeEl = dom.createElement("code");
1701
+ const textNode = dom.createTextNode(source);
1702
+ dom.appendChild(codeEl, textNode);
1703
+ dom.appendChild(pre, codeEl);
1704
+ applyNodeProps(ctx, graphNode, pre);
1705
+ const instance2 = new NodeInstance(graphNode, pre);
1706
+ ctx.instances.set(graphNode.id, instance2);
1707
+ wireEvents(dom, graph, graphNode, pre, instance2);
1708
+ if (graphNode.stateRefs.length !== 0) {
1709
+ wireSignalBindings(ctx, graphNode, instance2, textUpdate(dom, pre, textNode));
1710
+ }
1711
+ dom.appendChild(parentDom, pre);
1712
+ return instance2;
1713
+ }
1692
1714
  if (graphNode.type === "link") {
1693
1715
  const el2 = dom.createElement("a");
1694
1716
  const href = graphNode.getProp("href");
@@ -2070,6 +2092,27 @@ function hydrateNode(ctx, graphNode, domNode, path) {
2070
2092
  }
2071
2093
  return instance;
2072
2094
  }
2095
+ case "code": {
2096
+ let codeEl = dom.firstChild(domNode);
2097
+ if (codeEl === null || dom.isTextNode(codeEl)) {
2098
+ const createdCode = dom.createElement("code");
2099
+ dom.appendChild(domNode, createdCode);
2100
+ codeEl = createdCode;
2101
+ }
2102
+ let textNode = dom.firstChild(codeEl);
2103
+ if (textNode === null || !dom.isTextNode(textNode)) {
2104
+ const created = dom.createTextNode(String(graphNode.getProp("text") ?? ""));
2105
+ dom.appendChild(codeEl, created);
2106
+ textNode = created;
2107
+ }
2108
+ const instance = new NodeInstance(graphNode, domNode);
2109
+ ctx.instances.set(graphNode.id, instance);
2110
+ wireEvents(dom, graph, graphNode, domNode, instance);
2111
+ if (graphNode.stateRefs.length !== 0) {
2112
+ wireSignalBindings(ctx, graphNode, instance, textUpdate(dom, domNode, textNode));
2113
+ }
2114
+ return instance;
2115
+ }
2073
2116
  case "image":
2074
2117
  case "link": {
2075
2118
  const instance = new NodeInstance(graphNode, domNode);
@@ -2221,6 +2264,8 @@ function expectedTag(ctx, graphNode) {
2221
2264
  return "img";
2222
2265
  case "link":
2223
2266
  return "a";
2267
+ case "code":
2268
+ return "pre";
2224
2269
  case "button":
2225
2270
  return "button";
2226
2271
  default:
@@ -3336,6 +3381,16 @@ var ContentBuilderBase = class {
3336
3381
  node.addEvent({ type: "click", handlerKey });
3337
3382
  }
3338
3383
  }
3384
+ code(source, options = {}) {
3385
+ const props = {};
3386
+ if (options.language !== void 0) props["data-language"] = options.language;
3387
+ if (options.class !== void 0) props["class"] = options.class;
3388
+ if (options.id !== void 0) props["id"] = options.id;
3389
+ applyA11yProps(props, options);
3390
+ const node = this._graph.createNode("code", { parent: this._node, props });
3391
+ const resolved = bindValue(this._graph, node, "text", source);
3392
+ node.setProp("text", resolved);
3393
+ }
3339
3394
  };
3340
3395
  var ContainerBuilderBase = class extends ContentBuilderBase {
3341
3396
  section(key, builder, options = {}) {
@@ -4072,7 +4127,7 @@ function trigger(el, type, init = {}) {
4072
4127
  }
4073
4128
 
4074
4129
  // src/version.ts
4075
- var VERSION = "2.5.0";
4130
+ var VERSION = "2.6.0";
4076
4131
  export {
4077
4132
  VERSION,
4078
4133
  analyzeGraph,