@xaendar/core 0.6.16 → 0.6.18
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.d.ts +16 -5
- package/dist/xaendar-core.es.js +10 -10
- package/package.json +3 -3
|
@@ -10,6 +10,7 @@ import { NoArgsVoidFunction as NoArgsVoidFunction_2 } from '@xaendar/types';
|
|
|
10
10
|
import { RequireOne } from '@xaendar/types';
|
|
11
11
|
import { SignalOptions } from '@xaendar/signals';
|
|
12
12
|
import { VoidFunction as VoidFunction_2 } from '@xaendar/types';
|
|
13
|
+
import { VoidFunction as VoidFunction_3 } from '@xaendar/types';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Base class for all web components in the framework.
|
|
@@ -153,7 +154,7 @@ export declare class Context {
|
|
|
153
154
|
* @param handler - The name of the method on the root component to retrieve.
|
|
154
155
|
* @returns The handler function, bound to the root component so `this` is correct.
|
|
155
156
|
*/
|
|
156
|
-
getEventHandler(handler: string):
|
|
157
|
+
getEventHandler(handler: string): VoidFunction_2;
|
|
157
158
|
/**
|
|
158
159
|
* Registers a child context as a nested scope of this context.
|
|
159
160
|
*
|
|
@@ -369,11 +370,17 @@ export declare type InputSignalOptions<ActualValue = unknown, IncomingValue = Ac
|
|
|
369
370
|
*
|
|
370
371
|
* @param items - The full array being iterated.
|
|
371
372
|
* @param index - The current iteration index.
|
|
372
|
-
* @param
|
|
373
|
-
* @param
|
|
373
|
+
* @param itemName - The identifier to reference the i-th item during iteration
|
|
374
|
+
* @param aliases - Aliases for implicit variables defined in the `{@for} loop`
|
|
374
375
|
* @returns A record mapping alias names and built-in variables to their values.
|
|
375
376
|
*/
|
|
376
|
-
export declare function _iterationVariables(items: unknown[], index: number,
|
|
377
|
+
export declare function _iterationVariables(items: unknown[], index: number, itemName: string, aliases: {
|
|
378
|
+
$index: string;
|
|
379
|
+
$first: string;
|
|
380
|
+
$last: string;
|
|
381
|
+
$even: string;
|
|
382
|
+
$odd: string;
|
|
383
|
+
}): Record<string, unknown>;
|
|
377
384
|
|
|
378
385
|
/**
|
|
379
386
|
* Represents the output type returned by an `@Event` decorator in a web component.
|
|
@@ -385,7 +392,7 @@ export declare function _iterationVariables(items: unknown[], index: number, ite
|
|
|
385
392
|
* @template Value - The type of the value to emit as the event detail. Defaults to `void`.
|
|
386
393
|
*/
|
|
387
394
|
export declare type Output<Value = void> = {
|
|
388
|
-
emit:
|
|
395
|
+
emit: VoidFunction_3<Value extends void ? ([EventOptions] | []) : ([Value, EventOptions] | [Value])>;
|
|
389
396
|
};
|
|
390
397
|
|
|
391
398
|
/**
|
|
@@ -500,6 +507,10 @@ declare type RenderElementEvent = {
|
|
|
500
507
|
* The name of the handler method on the component class to invoke when the event fires.
|
|
501
508
|
*/
|
|
502
509
|
handler: string;
|
|
510
|
+
/**
|
|
511
|
+
* Event Parameters
|
|
512
|
+
*/
|
|
513
|
+
parameters: NoArgsFunction<unknown>[];
|
|
503
514
|
};
|
|
504
515
|
|
|
505
516
|
/**
|
package/dist/xaendar-core.es.js
CHANGED
|
@@ -622,19 +622,19 @@ function _for(parentNode, parentContext, condition, forFn) {
|
|
|
622
622
|
*
|
|
623
623
|
* @param items - The full array being iterated.
|
|
624
624
|
* @param index - The current iteration index.
|
|
625
|
-
* @param
|
|
626
|
-
* @param
|
|
625
|
+
* @param itemName - The identifier to reference the i-th item during iteration
|
|
626
|
+
* @param aliases - Aliases for implicit variables defined in the `{@for} loop`
|
|
627
627
|
* @returns A record mapping alias names and built-in variables to their values.
|
|
628
628
|
*/
|
|
629
|
-
function _iterationVariables(items, index,
|
|
629
|
+
function _iterationVariables(items, index, itemName, aliases) {
|
|
630
630
|
const even = index % 2 === 0;
|
|
631
631
|
return {
|
|
632
|
-
[
|
|
633
|
-
[
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
632
|
+
[itemName]: items[index],
|
|
633
|
+
[aliases.$index]: index,
|
|
634
|
+
[aliases.$first]: index === 0,
|
|
635
|
+
[aliases.$last]: index === items.length - 1,
|
|
636
|
+
[aliases.$even]: even,
|
|
637
|
+
[aliases.$odd]: !even
|
|
638
638
|
};
|
|
639
639
|
}
|
|
640
640
|
//#endregion
|
|
@@ -838,7 +838,7 @@ function _renderElement(parentNode, context, tagName, attributes, events) {
|
|
|
838
838
|
literal ? element.setAttribute(name, String(value())) : context.listen(effect(() => element.setAttribute(name, String(value()))));
|
|
839
839
|
});
|
|
840
840
|
events.forEach((event) => {
|
|
841
|
-
const handler = ($event) => context.getEventHandler(event.handler)();
|
|
841
|
+
const handler = ($event) => context.getEventHandler(event.handler)(...event.parameters.map((event) => event()));
|
|
842
842
|
const name = event.name;
|
|
843
843
|
element.addEventListener(name, handler);
|
|
844
844
|
context.listen(() => element.removeEventListener(name, handler));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaendar/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.18",
|
|
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.6.
|
|
20
|
-
"@xaendar/types": "0.6.
|
|
19
|
+
"@xaendar/signals": "0.6.18",
|
|
20
|
+
"@xaendar/types": "0.6.18"
|
|
21
21
|
}
|
|
22
22
|
}
|