@xaendar/core 0.6.15 → 0.6.17

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.
@@ -274,7 +274,7 @@ export declare type EventOptions = Beautify<RequireOne<Omit<CustomEventInit, 'de
274
274
  * @param condition - A reactive function that returns the array of items to iterate over.
275
275
  * @param forFn - A callback invoked for each item, receiving the parent node, the item, and its index. Must return an array of cleanup functions.
276
276
  */
277
- export declare function _for(parentNode: HTMLElement, parentContext: Context, condition: () => unknown[], forFn: Function_2<[parentNode: HTMLElement, context: Context, item: unknown, index: number], Context>): void;
277
+ export declare function _for(parentNode: HTMLElement, parentContext: Context, condition: () => unknown[], forFn: Function_2<[parentNode: HTMLElement, context: Context, items: unknown[], index: number], Context>): void;
278
278
 
279
279
  /**
280
280
  * Creates a reactive conditional structure from a list of branches.
@@ -369,11 +369,17 @@ export declare type InputSignalOptions<ActualValue = unknown, IncomingValue = Ac
369
369
  *
370
370
  * @param items - The full array being iterated.
371
371
  * @param index - The current iteration index.
372
- * @param itemAlias - The template alias name for the current item.
373
- * @param indexAlias - The template alias name for the current index.
372
+ * @param itemName - The identifier to reference the i-th item during iteration
373
+ * @param aliases - Aliases for implicit variables defined in the `{@for} loop`
374
374
  * @returns A record mapping alias names and built-in variables to their values.
375
375
  */
376
- export declare function _iterationVariables(items: unknown[], index: number, itemAlias: string, indexAlias: string): Record<string, unknown>;
376
+ export declare function _iterationVariables(items: unknown[], index: number, itemName: string, aliases: {
377
+ $index: string;
378
+ $first: string;
379
+ $last: string;
380
+ $even: string;
381
+ $odd: string;
382
+ }): Record<string, unknown>;
377
383
 
378
384
  /**
379
385
  * Represents the output type returned by an `@Event` decorator in a web component.
@@ -608,7 +608,7 @@ function _for(parentNode, parentContext, condition, forFn) {
608
608
  const items = condition();
609
609
  Signal.subtle.untrack(() => {
610
610
  for (let i = 0; i < items.length; i++) {
611
- const context = forFn(parentNode, parentContext, items[i], i);
611
+ const context = forFn(parentNode, parentContext, items, i);
612
612
  contexts.push(context);
613
613
  parentContext.addChild(context);
614
614
  }
@@ -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 itemAlias - The template alias name for the current item.
626
- * @param indexAlias - The template alias name for the current index.
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, itemAlias, indexAlias) {
629
+ function _iterationVariables(items, index, itemName, aliases) {
630
630
  const even = index % 2 === 0;
631
631
  return {
632
- [itemAlias]: items[index],
633
- [indexAlias]: index,
634
- $first: index === 0,
635
- $last: index === items.length - 1,
636
- $even: even,
637
- $odd: !even
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaendar/core",
3
- "version": "0.6.15",
3
+ "version": "0.6.17",
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.15",
20
- "@xaendar/types": "0.6.15"
19
+ "@xaendar/signals": "0.6.17",
20
+ "@xaendar/types": "0.6.17"
21
21
  }
22
22
  }