@xaendar/core 0.7.9 → 0.7.11

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,15 +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
+ /**
153
+ */
154
+ createElement: Function_2<[string], Element>;
155
155
  /**
156
156
  * Creates a new scope context.
157
157
  *
158
158
  * @param _root - Web component reference used to resolve property and method bindings.
159
159
  */
160
- constructor(_root: BaseWebComponent, _parent: Context | undefined, namespace: 'svg' | undefined);
160
+ constructor(_root: BaseWebComponent, _parent: Context);
161
161
  /**
162
162
  * Registers a new identifier name in this scope.
163
163
  *
@@ -334,7 +334,7 @@ export declare type EventOptions = Beautify<RequireOne<Omit<CustomEventInit, 'de
334
334
  * `update` per aggiornare le variabili implicite in-place quando l'item
335
335
  * viene riusato a un indice diverso.
336
336
  */
337
- export declare function _for(parentNode: HTMLElement, parentContext: Context, condition: () => unknown[], trackExpression: Function_2<[unknown], ForKey>, forFn: Function_2<[HTMLElement, Context, unknown[], number, Node | null], {
337
+ export declare function _for(parentNode: HTMLElement, parentContext: Context, condition: NoArgsFunction<unknown[]>, trackExpression: Function_2<[unknown], ForKey>, forFn: Function_2<[HTMLElement, Context, unknown[], number, Node | null], {
338
338
  context: Context;
339
339
  update?: (newIndex: number, items: unknown[]) => void;
340
340
  }>): void;
@@ -454,6 +454,8 @@ declare type IterationVariablesHandle = {
454
454
  update: (newIndex: number, items: unknown[]) => void;
455
455
  };
456
456
 
457
+ export declare const MATHML_NS = "http://w3.org";
458
+
457
459
  /**
458
460
  * Mounts a node into the DOM and binds it to the context lifecycle.
459
461
  *
@@ -664,6 +666,8 @@ declare type Signal_2<Value = any> = Signal.State<Value> & {
664
666
  };
665
667
  export { Signal_2 as Signal }
666
668
 
669
+ export declare const SVG_NS = "http://www.w3.org/2000/svg";
670
+
667
671
  /**
668
672
  * Creates a reactive switch/case structure by converting it into an if/else-if chain
669
673
  * and delegating to {@link _if}.
@@ -1,3 +1,17 @@
1
+ //#region ../packages/core/src/costants.ts
2
+ /**
3
+ * Metadata key used internally to store the list of observed attribute names
4
+ * on a web component class.
5
+ *
6
+ * Populated by the `@Property` decorator and consumed by `@WebComponent` to
7
+ * define `observedAttributes` on the custom element class.
8
+ *
9
+ * @internal
10
+ */
11
+ var INTERNAL_OBSERVED_ATTRIBUTES = `observedAttributes`;
12
+ var SVG_NS = "http://www.w3.org/2000/svg";
13
+ var MATHML_NS = "http://w3.org";
14
+ //#endregion
1
15
  //#region ../packages/core/src/decorators/event.decorator.ts
2
16
  function isEventOptions(value) {
3
17
  return !!value && typeof value === "object" && ("bubbles" in value || "cancelable" in value || "composed" in value);
@@ -49,19 +63,6 @@ function Event(options) {
49
63
  };
50
64
  }
51
65
  //#endregion
52
- //#region ../packages/core/src/costants.ts
53
- /**
54
- * Metadata key used internally to store the list of observed attribute names
55
- * on a web component class.
56
- *
57
- * Populated by the `@Property` decorator and consumed by `@WebComponent` to
58
- * define `observedAttributes` on the custom element class.
59
- *
60
- * @internal
61
- */
62
- var INTERNAL_OBSERVED_ATTRIBUTES = `observedAttributes`;
63
- var SVG_NS = "http://www.w3.org/2000/svg";
64
- //#endregion
65
66
  //#region ../packages/core/src/signals/input/input-instance.symbol.ts
66
67
  /**
67
68
  * Unique symbol used to mark an object as a valid `InputSignal` instance.
@@ -527,22 +528,18 @@ var Context = class {
527
528
  * detach event listeners, and dispose signal effect subscriptions.
528
529
  */
529
530
  _unwatchFns = new Array();
530
- _namespace;
531
- get namespace() {
532
- return this._namespace;
533
- }
534
- set namespace(value) {
535
- this._namespace = value;
536
- }
531
+ /**
532
+ */
533
+ createElement;
537
534
  /**
538
535
  * Creates a new scope context.
539
536
  *
540
537
  * @param _root - Web component reference used to resolve property and method bindings.
541
538
  */
542
- constructor(_root, _parent, namespace) {
539
+ constructor(_root, _parent) {
543
540
  this._root = _root;
544
541
  this._parent = _parent;
545
- this._namespace = this._parent?.namespace ?? namespace;
542
+ this.createElement = this._parent.createElement;
546
543
  }
547
544
  /**
548
545
  * Registers a new identifier name in this scope.
@@ -944,7 +941,7 @@ function teardown(parentContext, state) {
944
941
  * @returns The newly created HTML element.
945
942
  */
946
943
  function _renderElement(parentNode, context, anchor, tagName, attributes, events) {
947
- const element = context.namespace === "svg" || tagName === "svg" ? document.createElementNS(SVG_NS, tagName) : document.createElement(tagName);
944
+ const element = context.createElement(tagName);
948
945
  mountNode(element, parentNode, context, anchor);
949
946
  attributes.forEach(({ name, value, literal }) => {
950
947
  literal ? element.setAttribute(name, String(value())) : context.listen(effect(() => element.setAttribute(name, String(value()))));
@@ -1021,4 +1018,4 @@ function _switch(parentNode, parentContext, expression, blocks) {
1021
1018
  })));
1022
1019
  }
1023
1020
  //#endregion
1024
- export { BaseWebComponent, Context, Event, Property, WebComponent, _for, _if, _iterationVariables, _renderElement, _renderLiteralText, _renderText, _switch, computed, createAnchor, effect, input, mountNode, signal, untracked };
1021
+ export { BaseWebComponent, Context, Event, MATHML_NS, Property, SVG_NS, WebComponent, _for, _if, _iterationVariables, _renderElement, _renderLiteralText, _renderText, _switch, computed, createAnchor, effect, input, mountNode, signal, untracked };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaendar/core",
3
- "version": "0.7.9",
3
+ "version": "0.7.11",
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.9",
20
- "@xaendar/types": "0.7.9"
19
+ "@xaendar/signals": "0.7.11",
20
+ "@xaendar/types": "0.7.11"
21
21
  }
22
22
  }