@xaendar/core 0.7.6 → 0.7.8

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.
@@ -149,12 +149,15 @@ export declare class Context {
149
149
  * detach event listeners, and dispose signal effect subscriptions.
150
150
  */
151
151
  private _unwatchFns;
152
+ private _namespace;
153
+ get namespace(): 'svg' | undefined;
154
+ set namespace(value: 'svg');
152
155
  /**
153
156
  * Creates a new scope context.
154
157
  *
155
158
  * @param _root - Web component reference used to resolve property and method bindings.
156
159
  */
157
- constructor(_root: BaseWebComponent, _parent: Context);
160
+ constructor(_root: BaseWebComponent, _parent: Context | undefined, namespace: 'svg' | undefined);
158
161
  /**
159
162
  * Registers a new identifier name in this scope.
160
163
  *
@@ -464,7 +467,7 @@ declare type IterationVariablesHandle = {
464
467
  * @param referenceNode - The node to insert relative to (same semantics
465
468
  * as `Node.insertBefore`). If `null`, the node is appended at the end of `parentNode`.
466
469
  */
467
- export declare function mountNode(node: Node, parentNode: HTMLElement, context: Context, referenceNode?: Comment | null): void;
470
+ export declare function mountNode(node: Node, parentNode: Element, context: Context, referenceNode?: Comment | null): void;
468
471
 
469
472
  /**
470
473
  * Represents the output type returned by an `@Event` decorator in a web component.
@@ -555,7 +558,7 @@ declare type PropertyDecoratorOptionsWithRequired<ActualValue = unknown, Incomin
555
558
  * @param events - List of event listener descriptors to attach to the element.
556
559
  * @returns The newly created HTML element.
557
560
  */
558
- export declare function _renderElement(parentNode: HTMLElement, context: Context, anchor: Comment | null, tagName: string, attributes: RenderElementAttribute[], events: RenderElementEvent[]): HTMLElement;
561
+ export declare function _renderElement(parentNode: Element, context: Context, anchor: Comment | null, tagName: string, attributes: RenderElementAttribute[], events: RenderElementEvent[]): Element;
559
562
 
560
563
  /**
561
564
  * Describes a single HTML attribute to be applied to a rendered DOM element.
@@ -60,6 +60,7 @@ function Event(options) {
60
60
  * @internal
61
61
  */
62
62
  var INTERNAL_OBSERVED_ATTRIBUTES = `observedAttributes`;
63
+ var SVG_NS = "http://www.w3.org/2000/svg";
63
64
  //#endregion
64
65
  //#region ../packages/core/src/signals/input/input-instance.symbol.ts
65
66
  /**
@@ -526,14 +527,22 @@ var Context = class {
526
527
  * detach event listeners, and dispose signal effect subscriptions.
527
528
  */
528
529
  _unwatchFns = new Array();
530
+ _namespace;
531
+ get namespace() {
532
+ return this._namespace;
533
+ }
534
+ set namespace(value) {
535
+ this._namespace = value;
536
+ }
529
537
  /**
530
538
  * Creates a new scope context.
531
539
  *
532
540
  * @param _root - Web component reference used to resolve property and method bindings.
533
541
  */
534
- constructor(_root, _parent) {
542
+ constructor(_root, _parent, namespace) {
535
543
  this._root = _root;
536
544
  this._parent = _parent;
545
+ this._namespace = this._parent?.namespace ?? namespace;
537
546
  }
538
547
  /**
539
548
  * Registers a new identifier name in this scope.
@@ -935,7 +944,7 @@ function teardown(parentContext, state) {
935
944
  * @returns The newly created HTML element.
936
945
  */
937
946
  function _renderElement(parentNode, context, anchor, tagName, attributes, events) {
938
- const element = document.createElement(tagName);
947
+ const element = context.namespace === "svg" || tagName === "svg" ? document.createElementNS(SVG_NS, tagName) : document.createElement(tagName);
939
948
  mountNode(element, parentNode, context, anchor);
940
949
  attributes.forEach(({ name, value, literal }) => {
941
950
  literal ? element.setAttribute(name, String(value())) : context.listen(effect(() => element.setAttribute(name, String(value()))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaendar/core",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
4
4
  "description": "A library containing core utils such as webcomponent base classes and theming support",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -16,7 +16,7 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
- "@xaendar/signals": "0.7.6",
20
- "@xaendar/types": "0.7.6"
19
+ "@xaendar/signals": "0.7.8",
20
+ "@xaendar/types": "0.7.8"
21
21
  }
22
22
  }