@xaendar/core 0.7.18 → 0.7.20
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/xaendar-core.es.js +61 -61
- package/package.json +3 -3
package/dist/xaendar-core.es.js
CHANGED
|
@@ -496,66 +496,6 @@ function signal(value, options) {
|
|
|
496
496
|
*/
|
|
497
497
|
var untracked = Signal.subtle.untrack;
|
|
498
498
|
//#endregion
|
|
499
|
-
//#region ../packages/core/src/utils/render-element.util.ts
|
|
500
|
-
/**
|
|
501
|
-
* Creates a DOM element, applies attributes and event listeners, appends it
|
|
502
|
-
* to the parent, and registers cleanup functions in the current context.
|
|
503
|
-
*
|
|
504
|
-
* Static (literal) attribute values are set once via `setAttribute`. Dynamic
|
|
505
|
-
* attribute values are wrapped in a reactive `effect` so they update
|
|
506
|
-
* automatically whenever the underlying signal changes. Event listeners are
|
|
507
|
-
* attached with `addEventListener` and the corresponding `removeEventListener`
|
|
508
|
-
* is registered as a cleanup function.
|
|
509
|
-
*
|
|
510
|
-
* @param parentNode - The parent HTML element to append the new element to.
|
|
511
|
-
* @param context - The current template execution scope.
|
|
512
|
-
* @param tagName - The HTML tag name of the element to create.
|
|
513
|
-
* @param attributes - List of attribute descriptors to apply to the element.
|
|
514
|
-
* @param events - List of event listener descriptors to attach to the element.
|
|
515
|
-
* @returns The newly created HTML element.
|
|
516
|
-
*/
|
|
517
|
-
function _renderElement(parentNode, context, anchor, tagName, attributes, events) {
|
|
518
|
-
const element = context.createElement(tagName);
|
|
519
|
-
mountNode(element, parentNode, context, anchor);
|
|
520
|
-
attributes.forEach(({ name, value, literal }) => {
|
|
521
|
-
literal ? element.setAttribute(name, String(value())) : context.listen(effect(() => element.setAttribute(name, String(value()))));
|
|
522
|
-
});
|
|
523
|
-
events.forEach((event) => {
|
|
524
|
-
const handler = ($event) => context.getEventHandler(event.handler)(...event.parameters.map((event) => event($event)));
|
|
525
|
-
const name = event.name;
|
|
526
|
-
element.addEventListener(name, handler);
|
|
527
|
-
context.listen(() => element.removeEventListener(name, handler));
|
|
528
|
-
});
|
|
529
|
-
return element;
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* Creates an HTML element with the specified tag name.
|
|
533
|
-
*
|
|
534
|
-
* @param tagName - The HTML tag name of the element to create.
|
|
535
|
-
* @returns The newly created HTML element.
|
|
536
|
-
*/
|
|
537
|
-
function createElement(tagName) {
|
|
538
|
-
return document.createElement(tagName);
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* Creates an SVG element with the specified tag name using the SVG namespace.
|
|
542
|
-
*
|
|
543
|
-
* @param tagName - The SVG tag name of the element to create.
|
|
544
|
-
* @returns The newly created SVG element.
|
|
545
|
-
*/
|
|
546
|
-
function createSVGElement(tagName) {
|
|
547
|
-
return document.createElementNS(SVG_NS, tagName);
|
|
548
|
-
}
|
|
549
|
-
/**
|
|
550
|
-
* Creates a MathML element with the specified tag name using the MathML namespace.
|
|
551
|
-
*
|
|
552
|
-
* @param tagName - The MathML tag name of the element to create.
|
|
553
|
-
* @returns The newly created MathML element.
|
|
554
|
-
*/
|
|
555
|
-
function createMATHMLElement(tagName) {
|
|
556
|
-
return document.createElementNS(MATHML_NS, tagName);
|
|
557
|
-
}
|
|
558
|
-
//#endregion
|
|
559
499
|
//#region ../packages/core/src/utils/context.util.ts
|
|
560
500
|
/**
|
|
561
501
|
* Tracks identifier scope during run time template function execution
|
|
@@ -600,7 +540,7 @@ var Context = class {
|
|
|
600
540
|
constructor(_root, _parent) {
|
|
601
541
|
this._root = _root;
|
|
602
542
|
this._parent = _parent;
|
|
603
|
-
this.createElement = createElement;
|
|
543
|
+
this.createElement = this._parent.createElement;
|
|
604
544
|
}
|
|
605
545
|
/**
|
|
606
546
|
* Registers a new identifier name in this scope.
|
|
@@ -983,6 +923,66 @@ function teardown(parentContext, state) {
|
|
|
983
923
|
}
|
|
984
924
|
}
|
|
985
925
|
//#endregion
|
|
926
|
+
//#region ../packages/core/src/utils/render-element.util.ts
|
|
927
|
+
/**
|
|
928
|
+
* Creates a DOM element, applies attributes and event listeners, appends it
|
|
929
|
+
* to the parent, and registers cleanup functions in the current context.
|
|
930
|
+
*
|
|
931
|
+
* Static (literal) attribute values are set once via `setAttribute`. Dynamic
|
|
932
|
+
* attribute values are wrapped in a reactive `effect` so they update
|
|
933
|
+
* automatically whenever the underlying signal changes. Event listeners are
|
|
934
|
+
* attached with `addEventListener` and the corresponding `removeEventListener`
|
|
935
|
+
* is registered as a cleanup function.
|
|
936
|
+
*
|
|
937
|
+
* @param parentNode - The parent HTML element to append the new element to.
|
|
938
|
+
* @param context - The current template execution scope.
|
|
939
|
+
* @param tagName - The HTML tag name of the element to create.
|
|
940
|
+
* @param attributes - List of attribute descriptors to apply to the element.
|
|
941
|
+
* @param events - List of event listener descriptors to attach to the element.
|
|
942
|
+
* @returns The newly created HTML element.
|
|
943
|
+
*/
|
|
944
|
+
function _renderElement(parentNode, context, anchor, tagName, attributes, events) {
|
|
945
|
+
const element = context.createElement(tagName);
|
|
946
|
+
mountNode(element, parentNode, context, anchor);
|
|
947
|
+
attributes.forEach(({ name, value, literal }) => {
|
|
948
|
+
literal ? element.setAttribute(name, String(value())) : context.listen(effect(() => element.setAttribute(name, String(value()))));
|
|
949
|
+
});
|
|
950
|
+
events.forEach((event) => {
|
|
951
|
+
const handler = ($event) => context.getEventHandler(event.handler)(...event.parameters.map((event) => event($event)));
|
|
952
|
+
const name = event.name;
|
|
953
|
+
element.addEventListener(name, handler);
|
|
954
|
+
context.listen(() => element.removeEventListener(name, handler));
|
|
955
|
+
});
|
|
956
|
+
return element;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Creates an HTML element with the specified tag name.
|
|
960
|
+
*
|
|
961
|
+
* @param tagName - The HTML tag name of the element to create.
|
|
962
|
+
* @returns The newly created HTML element.
|
|
963
|
+
*/
|
|
964
|
+
function createElement(tagName) {
|
|
965
|
+
return document.createElement(tagName);
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Creates an SVG element with the specified tag name using the SVG namespace.
|
|
969
|
+
*
|
|
970
|
+
* @param tagName - The SVG tag name of the element to create.
|
|
971
|
+
* @returns The newly created SVG element.
|
|
972
|
+
*/
|
|
973
|
+
function createSVGElement(tagName) {
|
|
974
|
+
return document.createElementNS(SVG_NS, tagName);
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Creates a MathML element with the specified tag name using the MathML namespace.
|
|
978
|
+
*
|
|
979
|
+
* @param tagName - The MathML tag name of the element to create.
|
|
980
|
+
* @returns The newly created MathML element.
|
|
981
|
+
*/
|
|
982
|
+
function createMATHMLElement(tagName) {
|
|
983
|
+
return document.createElementNS(MATHML_NS, tagName);
|
|
984
|
+
}
|
|
985
|
+
//#endregion
|
|
986
986
|
//#region ../packages/core/src/utils/render-text.util.ts
|
|
987
987
|
/**
|
|
988
988
|
* Creates a reactive text node bound to a named identifier in the current scope.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaendar/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.20",
|
|
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.
|
|
20
|
-
"@xaendar/types": "0.7.
|
|
19
|
+
"@xaendar/signals": "0.7.20",
|
|
20
|
+
"@xaendar/types": "0.7.20"
|
|
21
21
|
}
|
|
22
22
|
}
|