@uniformdev/transformer 1.1.5 → 1.1.7

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/index.d.ts CHANGED
@@ -201,6 +201,7 @@ declare class ComponentService {
201
201
  addSlot(component: ComponentDefinition, slot: SlotDefinition): ComponentDefinition;
202
202
  updateSlotAllowedComponents(component: ComponentDefinition, slotId: string, allowedComponents: string[], options?: FindOptions$1): ComponentDefinition;
203
203
  removeSlot(component: ComponentDefinition, slotId: string, options?: FindOptions$1): ComponentDefinition;
204
+ generateGroupId(name: string): string;
204
205
  }
205
206
 
206
207
  interface FindOptions {
package/dist/index.js CHANGED
@@ -342,6 +342,16 @@ var ComponentService = class {
342
342
  component.slots = component.slots.filter((s) => !this.compareIds(s.id, slotId, strict));
343
343
  return component;
344
344
  }
345
+ generateGroupId(name) {
346
+ const words = name.replace(/[^a-zA-Z0-9]+/g, " ").trim().split(/\s+/).filter((w) => w.length > 0);
347
+ if (words.length === 0) {
348
+ return "group_";
349
+ }
350
+ const camel = words.map(
351
+ (w, i) => i === 0 ? w.toLowerCase() : w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()
352
+ ).join("");
353
+ return `group_${camel}`;
354
+ }
345
355
  };
346
356
 
347
357
  // src/core/services/composition.service.ts
@@ -546,7 +556,8 @@ var PropertyPropagatorService = class {
546
556
  findOptions
547
557
  );
548
558
  if (notFound.length > 0) {
549
- throw new PropertyNotFoundError(notFound.join(", "), sourceType);
559
+ this.logger.warn(`Property "${notFound.join(", ")}" not found on component "${sourceType}"`);
560
+ continue;
550
561
  }
551
562
  for (const param of sourceParams) {
552
563
  const exists = resolvedParams.some(
@@ -579,17 +590,18 @@ var PropertyPropagatorService = class {
579
590
  }
580
591
  let modifiedComponent = { ...targetComponent };
581
592
  let componentModified = false;
593
+ const groupId = this.componentService.generateGroupId(targetGroup);
582
594
  const existingGroup = this.componentService.findParameter(
583
595
  modifiedComponent,
584
- targetGroup,
596
+ groupId,
585
597
  findOptions
586
598
  );
587
599
  if (!existingGroup) {
588
600
  this.logger.action(whatIf, "CREATE", `Group "${targetGroup}" on ${targetComponentType}`);
589
601
  modifiedComponent = this.componentService.ensureGroupExists(
590
602
  modifiedComponent,
603
+ groupId,
591
604
  targetGroup,
592
- void 0,
593
605
  findOptions
594
606
  );
595
607
  componentModified = true;
@@ -613,7 +625,7 @@ var PropertyPropagatorService = class {
613
625
  );
614
626
  modifiedComponent = this.componentService.addParameterToGroup(
615
627
  modifiedComponent,
616
- targetGroup,
628
+ groupId,
617
629
  param.id,
618
630
  findOptions
619
631
  );
@@ -622,7 +634,7 @@ var PropertyPropagatorService = class {
622
634
  this.logger.info(`Parameter "${param.id}" already exists on ${targetComponentType}`);
623
635
  const group = this.componentService.findParameter(
624
636
  modifiedComponent,
625
- targetGroup,
637
+ groupId,
626
638
  findOptions
627
639
  );
628
640
  if (group && this.componentService.isGroupParameter(group)) {
@@ -632,7 +644,7 @@ var PropertyPropagatorService = class {
632
644
  if (!isInGroup) {
633
645
  modifiedComponent = this.componentService.addParameterToGroup(
634
646
  modifiedComponent,
635
- targetGroup,
647
+ groupId,
636
648
  param.id,
637
649
  findOptions
638
650
  );