@kithinji/orca 1.0.20 → 1.0.21

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.
@@ -2142,7 +2142,7 @@ var kithinjiorca = (() => {
2142
2142
  ], HttpClientModule);
2143
2143
 
2144
2144
  // src/shared/dom/osc.ts
2145
- var OSC = class {
2145
+ var OSC = class _OSC {
2146
2146
  constructor(root) {
2147
2147
  this.root = root;
2148
2148
  this.pendingRefs = /* @__PURE__ */ new Map();
@@ -2150,6 +2150,69 @@ var kithinjiorca = (() => {
2150
2150
  old.replaceWith(nw);
2151
2151
  });
2152
2152
  }
2153
+ static {
2154
+ this.SVG_NAMESPACE = "http://www.w3.org/2000/svg";
2155
+ }
2156
+ static {
2157
+ this.SVG_TAGS = /* @__PURE__ */ new Set([
2158
+ "svg",
2159
+ "circle",
2160
+ "rect",
2161
+ "line",
2162
+ "path",
2163
+ "polygon",
2164
+ "polyline",
2165
+ "ellipse",
2166
+ "text",
2167
+ "tspan",
2168
+ "g",
2169
+ "defs",
2170
+ "use",
2171
+ "symbol",
2172
+ "marker",
2173
+ "clipPath",
2174
+ "mask",
2175
+ "pattern",
2176
+ "linearGradient",
2177
+ "radialGradient",
2178
+ "stop",
2179
+ "animate",
2180
+ "animateTransform",
2181
+ "foreignObject",
2182
+ "image",
2183
+ "textPath",
2184
+ "feBlend",
2185
+ "feColorMatrix",
2186
+ "feComponentTransfer",
2187
+ "feComposite",
2188
+ "feConvolveMatrix",
2189
+ "feDiffuseLighting",
2190
+ "feDisplacementMap",
2191
+ "feDistantLight",
2192
+ "feFlood",
2193
+ "feFuncA",
2194
+ "feFuncB",
2195
+ "feFuncG",
2196
+ "feFuncR",
2197
+ "feGaussianBlur",
2198
+ "feImage",
2199
+ "feMerge",
2200
+ "feMergeNode",
2201
+ "feMorphology",
2202
+ "feOffset",
2203
+ "fePointLight",
2204
+ "feSpecularLighting",
2205
+ "feSpotLight",
2206
+ "feTile",
2207
+ "feTurbulence",
2208
+ "filter",
2209
+ "metadata",
2210
+ "title",
2211
+ "desc",
2212
+ "switch",
2213
+ "view"
2214
+ ]);
2215
+ }
2153
2216
  handleInsert(jsx2) {
2154
2217
  const { domNode, vnode } = this.buildDOM(jsx2, this.tree);
2155
2218
  if (jsx2.id && vnode) {
@@ -2283,9 +2346,13 @@ var kithinjiorca = (() => {
2283
2346
  });
2284
2347
  return { domNode: fragment };
2285
2348
  }
2349
+ isSVGTag(tag) {
2350
+ return _OSC.SVG_TAGS.has(tag);
2351
+ }
2286
2352
  buildIntrinsicElement(jsx2, parent) {
2287
2353
  const tag = jsx2.type;
2288
- const dom = document.createElement(tag);
2354
+ const isSVG = this.isSVGTag(tag);
2355
+ const dom = isSVG ? document.createElementNS(_OSC.SVG_NAMESPACE, tag) : document.createElement(tag);
2289
2356
  const vnode = new VNode(dom, (old, nw) => {
2290
2357
  if (old.parentNode) {
2291
2358
  old.parentNode.replaceChild(nw, old);
@@ -2296,7 +2363,7 @@ var kithinjiorca = (() => {
2296
2363
  vnode.setId(jsx2.id);
2297
2364
  }
2298
2365
  if (jsx2.props) {
2299
- this.buildAttributes(jsx2.props, dom, vnode);
2366
+ this.buildAttributes(jsx2.props, dom, vnode, isSVG);
2300
2367
  }
2301
2368
  if (jsx2.props?.children != null) {
2302
2369
  const { domNode: childDom } = this.buildDOM(jsx2.props.children, vnode);
@@ -2304,7 +2371,7 @@ var kithinjiorca = (() => {
2304
2371
  }
2305
2372
  return { domNode: dom, vnode };
2306
2373
  }
2307
- buildAttributes(props, dom, vnode) {
2374
+ buildAttributes(props, dom, vnode, isSVG = false) {
2308
2375
  for (const [key, value] of Object.entries(props)) {
2309
2376
  if (key === "children" || value == null) {
2310
2377
  continue;
@@ -2315,10 +2382,21 @@ var kithinjiorca = (() => {
2315
2382
  continue;
2316
2383
  }
2317
2384
  if (typeof value === "boolean") {
2318
- this.setBooleanAttribute(attrKey, value, dom);
2385
+ this.setBooleanAttribute(attrKey, value, dom, isSVG);
2319
2386
  continue;
2320
2387
  }
2321
- dom.setAttribute(attrKey, String(value));
2388
+ if (isSVG) {
2389
+ this.setSVGAttribute(attrKey, String(value), dom);
2390
+ } else {
2391
+ dom.setAttribute(attrKey, String(value));
2392
+ }
2393
+ }
2394
+ }
2395
+ setSVGAttribute(key, value, dom) {
2396
+ if (key === "href" || key === "xlink:href") {
2397
+ dom.setAttributeNS("http://www.w3.org/1999/xlink", "href", value);
2398
+ } else {
2399
+ dom.setAttribute(key, value);
2322
2400
  }
2323
2401
  }
2324
2402
  normalizeAttributeKey(key) {
@@ -2333,7 +2411,7 @@ var kithinjiorca = (() => {
2333
2411
  }).join(";");
2334
2412
  dom.setAttribute("style", styleString);
2335
2413
  }
2336
- setBooleanAttribute(key, value, dom) {
2414
+ setBooleanAttribute(key, value, dom, isSVG = false) {
2337
2415
  if (value) {
2338
2416
  dom.setAttribute(key, "");
2339
2417
  } else {