{"version":3,"file":"vi5hnuu-ngx-scribbly.mjs","sources":["../../../projects/ngx-scribbly/src/lib/utils/id-generators.ts","../../../projects/ngx-scribbly/src/lib/service/_scribble.service.ts","../../../projects/ngx-scribbly/src/lib/service/scribble.service.ts","../../../projects/ngx-scribbly/src/lib/directive/scribble-directive/scribble.directive.ts","../../../projects/ngx-scribbly/src/public-api.ts","../../../projects/ngx-scribbly/src/vi5hnuu-ngx-scribbly.ts"],"sourcesContent":["export function generateId(prefix: string, totalLength: number): string {\r\n    if (totalLength <= prefix.length) {\r\n        throw new Error('Total length must be greater than prefix length');\r\n    }\r\n\r\n    const lowercase = 'abcdefghijklmnopqrstuvwxyz';\r\n    const uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\r\n    const numbers = '0123456789';\r\n    const specialChars = '!@#$%^&*()-_=+[]{}|;:,.<>?';\r\n\r\n    const allChars = lowercase + uppercase + numbers + specialChars;\r\n\r\n    const randomLength = totalLength - prefix.length;\r\n    let randomPart = '';\r\n\r\n    for (let i = 0; i < randomLength; i++) {\r\n        const randomIndex = Math.floor(Math.random() * allChars.length);\r\n        randomPart += allChars[randomIndex];\r\n    }\r\n    return prefix + randomPart;\r\n}\r\n\r\nexport function generateId32L(prefix: string): string {\r\n    return generateId(prefix,32);\r\n}\r\n","import {ComponentRef, EmbeddedViewRef, Injectable} from '@angular/core';\r\n\r\n@Injectable({providedIn:'root'})\r\nexport class _ScribbleService {\r\n  private generatedElementsRegistry:Map<string,ComponentRef<any>|EmbeddedViewRef<any>> = new Map<string, ComponentRef<any>|EmbeddedViewRef<any>>();\r\n\r\n  constructor() { }\r\n\r\n  public addToRegistry(id:string,type:ComponentRef<any>|EmbeddedViewRef<any>){\r\n    this.generatedElementsRegistry.set(id,type);\r\n  }\r\n\r\n  public deleteFromRegistry(id:string){\r\n    this.generatedElementsRegistry.get(id)?.destroy();\r\n    this.generatedElementsRegistry.delete(id);\r\n  }\r\n}\r\n","import {Injectable, TemplateRef, ViewContainerRef} from '@angular/core';\r\nimport {TypeMapping} from '../model/type-mappings';\r\nimport {_ScribbleService} from './_scribble.service';\r\n\r\n@Injectable({providedIn:'root'})\r\nexport class ScribbleService {\r\n\r\n  constructor(private scribbleService:_ScribbleService) { }\r\n\r\n  public createElement(selectedType:TypeMapping, viewContainerRef:ViewContainerRef){\r\n    const type=selectedType.type;\r\n    const args=selectedType.args;\r\n    if(type instanceof TemplateRef){\r\n      const embeddedRef=viewContainerRef.createEmbeddedView(type!,args ?? {});\r\n      if(embeddedRef.rootNodes.length!=1){\r\n        throw new Error(\"Please make sure your template ref has only single root node\");\r\n      }\r\n      return {\r\n        ref:embeddedRef,\r\n        element:embeddedRef.rootNodes[0]\r\n      }\r\n    }else{\r\n      const componentRef=viewContainerRef.createComponent(type!);\r\n      Object.assign(componentRef.instance,args);\r\n      return {\r\n        ref:componentRef,\r\n        element:componentRef.location.nativeElement\r\n      }\r\n    }\r\n  }\r\n\r\n  public pasteItemsInContainer(items: HTMLElement[], container: HTMLElement) {\r\n    for(const item of items){\r\n      this.pasteItemInContainer(item,container);\r\n    }\r\n  }\r\n\r\n  public async pasteImagesInContainer(images: File[], container: HTMLElement) {\r\n    const failedToDraw:File[]=[];\r\n    for(const file of images){\r\n      await this.pasteImageInContainer(file,container).catch(failedToDraw.push);\r\n    }\r\n    return failedToDraw;\r\n  }\r\n\r\n  public pasteImageInContainer(file: File, container: HTMLElement):Promise<File> {\r\n    const containerRect = container.getBoundingClientRect();\r\n    const maxW = containerRect.width;\r\n    const maxH = containerRect.height;\r\n\r\n    return new Promise((res,rej)=>{\r\n      const reader = new FileReader();\r\n      reader.onload = () => {\r\n        const img = new Image();\r\n        img.onload = () => {\r\n          // ----- Aspect-ratio scaling -----\r\n          const ratio = Math.min(maxW / img.width, maxH / img.height);\r\n\r\n          const finalW = img.width * ratio;\r\n          const finalH = img.height * ratio;\r\n\r\n          // ----- Styling & centering -----\r\n          const wrapper = document.createElement(\"div\");\r\n          wrapper.style.position = \"absolute\";\r\n          wrapper.style.width = `${finalW}px`;\r\n          wrapper.style.height = `${finalH}px`;\r\n          wrapper.style.left = `${(maxW - finalW) / 2}px`;\r\n          wrapper.style.top = `${(maxH - finalH) / 2}px`;\r\n          wrapper.style.display = \"flex\";\r\n          wrapper.style.alignItems = \"center\";\r\n          wrapper.style.justifyContent = \"center\";\r\n          wrapper.style.pointerEvents = \"auto\";\r\n\r\n          img.style.width = \"100%\";\r\n          img.style.height = \"100%\";\r\n          img.style.objectFit = \"contain\";\r\n\r\n          wrapper.appendChild(img);\r\n          container.appendChild(wrapper);\r\n          res(file);\r\n        };\r\n        img.onerror=img.onabort=()=>rej(file);\r\n        img.src = reader.result as string;\r\n      };\r\n      reader.onerror=reader.onabort=()=>rej(file);\r\n\r\n      reader.readAsDataURL(file);\r\n    });\r\n  }\r\n\r\n  public pasteItemInContainer(item: HTMLElement, container: HTMLElement) {\r\n    const itemRect = item.getBoundingClientRect();\r\n    const containerRect = container.getBoundingClientRect();\r\n    const maxW = containerRect.width;\r\n    const maxH = containerRect.height;\r\n\r\n    const ratio = Math.min(maxW / itemRect.width, maxH / itemRect.height);\r\n\r\n    const finalW = itemRect.width * ratio;\r\n    const finalH = itemRect.height * ratio;\r\n\r\n    item.style.position = \"absolute\";\r\n    item.style.width = `${finalW}px`;\r\n    item.style.height = `${finalH}px`;\r\n    item.style.left = `${(maxW - finalW) / 2}px`;\r\n    item.style.top = `${(maxH - finalH) / 2}px`;\r\n    container.appendChild(item);\r\n  }\r\n\r\n  public deleteFromRegistry(id:string){\r\n    this.scribbleService.deleteFromRegistry(id);\r\n  }\r\n}\r\n","import {\r\n  AfterViewInit,\r\n  ComponentRef,\r\n  Directive,\r\n  ElementRef, EmbeddedViewRef,\r\n  EventEmitter,\r\n  HostListener,\r\n  Input, OnChanges, OnDestroy,\r\n  Output,\r\n  Renderer2, SimpleChanges, TemplateRef,\r\n  ViewContainerRef\r\n} from \"@angular/core\";\r\nimport {ScribbleConfig} from '../../model/scribble.config';\r\nimport {ClickCoords} from '../../model/click-coords';\r\nimport {BehaviorSubject, Subscription} from 'rxjs';\r\nimport {ScribbleService} from '../../service/scribble.service';\r\nimport {TypeMappings} from '../../model/type-mappings';\r\nimport {generateId} from '../../utils/id-generators';\r\nimport {GeneratedElement} from '../../model/generated-element';\r\nimport {_ScribbleService} from '../../service/_scribble.service';\r\n\r\n\r\n\r\n@Directive({\r\n  selector: \"[scribble]\",\r\n})\r\nexport class ScribbleDirective implements OnChanges,OnDestroy,AfterViewInit{\r\n  private component?:GeneratedElement;\r\n  private subscription:Subscription[]=[];\r\n  private _initialClick:Readonly<ClickCoords>|null=null;//relative to host\r\n  @Input() typeMapping: TypeMappings ={};\r\n  @Input() selectedMapping: string|null=null;\r\n  @Input() miniSize?:{width:number,height:number};\r\n  @Input() active: boolean=true;\r\n  @Input({required:false}) maintainAspect=(event:MouseEvent):{maintainAspectRatio:boolean|number}=>({maintainAspectRatio:false});//we maintain ratio returned by this function\r\n  @Output() rendered=new EventEmitter<ScribbleConfig>();\r\n  private _isDrawing=new BehaviorSubject<boolean>(false);\r\n  @Output() isDrawing=new EventEmitter<boolean>();\r\n\r\n  private _lockedMapping?:string|null;\r\n  constructor(\r\n    private viewContainerRef: ViewContainerRef,\r\n    private hostElement: ElementRef,\r\n    private renderer: Renderer2,\r\n    private scribbleService:ScribbleService,\r\n    private _scribbleService:_ScribbleService\r\n  ) {\r\n    this.subscription.push(this._isDrawing.subscribe((drawing)=>this.isDrawing.emit(drawing)));\r\n    this.renderer.setStyle(this.el,'position','relative');\r\n  }\r\n\r\n  //TODO:: since drawn elements are added to parent the size of host and parent has to be same.\r\n\r\n  private get el():HTMLElement{//because viewContainer gives parent container -> means all drawn elements are added to parent of host\r\n    return this.hostElement.nativeElement;\r\n  }\r\n\r\n  ngOnChanges(changes: SimpleChanges) {\r\n    if(changes['selectedMapping']?.currentValue!==this._lockedMapping && this.component?.element){\r\n      this.reset({destroyElement:true});\r\n    }\r\n  }\r\n\r\n  ngAfterViewInit() {\r\n    this.renderer.setStyle(this.el,'touch-action','none');\r\n  }\r\n\r\n  private reset(withh?:{destroyElement?:boolean}):void{\r\n    if(withh?.destroyElement){\r\n      this.component?.element.remove();\r\n      this.component?.ref?.destroy();\r\n    }\r\n    delete this.component;\r\n    this._initialClick=null;\r\n    if(this._isDrawing.value)this._isDrawing.next(false);\r\n  }\r\n\r\n  @HostListener(\"pointerdown\",[\"$event\"])\r\n  onMouseDown($event:MouseEvent){\r\n    if(!this.active) return;\r\n    const hostRect = this.el.getBoundingClientRect();\r\n\r\n    this._initialClick={\r\n      left:$event.clientX-hostRect.left,\r\n      top:$event.clientY-hostRect.top,\r\n    };\r\n\r\n    if (!this.selectedMapping) return;\r\n\r\n    //mapping may change during draw so we lock it [rendered will send same mapping as is used while drawing]\r\n    this._lockedMapping=this.selectedMapping;\r\n    const selectedType = this.typeMapping[this._lockedMapping];\r\n    if (!selectedType) {\r\n      console.warn(\"No type mapping found, aborting\");\r\n      return;\r\n    }\r\n    this._isDrawing.next(true);\r\n\r\n    // Dynamically create the component inside the host element\r\n    this.component=this.scribbleService.createElement(selectedType,this.viewContainerRef);\r\n    const element = this.component.element;\r\n\r\n    // Set styles using Renderer2\r\n    this.renderer.setStyle(element, 'position', 'absolute');\r\n    this.renderer.setStyle(element, 'left', `${this._initialClick.left}px`);\r\n    this.renderer.setStyle(element, 'top', `${this._initialClick.top}px`);\r\n    this.renderer.setStyle(element, 'width', `0px`);\r\n    this.renderer.setStyle(element, 'height', `0px`);\r\n    this.renderer.setStyle(element, 'pointer-events', 'none');\r\n    this.renderer.setAttribute(element,'id',generateId('SHAPE',32));\r\n  }\r\n\r\n  @HostListener(\"pointermove\", [\"$event\"])\r\n  onMouseMove($event: MouseEvent) {\r\n    $event.preventDefault();\r\n    if(!this.active) return;\r\n    if (!this.component || !this._initialClick || !this._isDrawing.value) return;\r\n\r\n    const element = this.component.element;\r\n    const hostRect = this.el.getBoundingClientRect();\r\n\r\n    // console.log(`hostwidth : ${hostRect.width},host height: ${hostRect.height},hostleft:${hostRect.left},hostright:${hostRect.right},hosttop:${hostRect.top},clientX:${$event.clientX},clientY:${$event.clientY}`)\r\n    // Check if cursor is within host bounds\r\n    if (\r\n      $event.clientX < hostRect.left ||\r\n      $event.clientX > hostRect.left+hostRect.width ||\r\n      $event.clientY < hostRect.top ||\r\n      $event.clientY > hostRect.top+hostRect.height\r\n    ) {\r\n      return; // Stop updating if outside bounds\r\n    }\r\n\r\n    let width = ($event.clientX-hostRect.left) - (this._initialClick.left);\r\n    let height = ($event.clientY-hostRect.top) - (this._initialClick.top);\r\n    if(width<0 || height<0) return;//no reverse draw\r\n\r\n    //aspect ratio\r\n    const ratioConfig=this.maintainAspect($event);\r\n    if(ratioConfig.maintainAspectRatio){//true or [0>...]\r\n      if(typeof ratioConfig.maintainAspectRatio===\"number\"){\r\n        //ratio might overflow height [we keep width same]\r\n        height=width/ratioConfig.maintainAspectRatio;\r\n        this.renderer.setStyle(element, 'width', `${width}px`);\r\n        this.renderer.setStyle(element, 'height', `${height}px`);\r\n      }\r\n      else{\r\n        this.renderer.setStyle(element, 'width', `${width}px`);\r\n        this.renderer.setStyle(element, 'height', `auto`);\r\n      }\r\n\r\n      //if maintainRatio is number -> height auto might overflow the container [so reduce height width to maintain aspect]\r\n      //if maintainRatio is bool -> width is fixed, height might overflow\r\n      //since we are setting [height auto(in maintainRatio is number),height as per ration(maintainRatio is bool)], width never overflow [because width is what we draw]\r\n      const eleRect = element.getBoundingClientRect();\r\n      if (eleRect.bottom > hostRect.bottom) {\r\n        console.log('Overflow detected');\r\n\r\n        // Calculate how much the element exceeds the host\r\n        const elementExceedPx = eleRect.bottom - hostRect.bottom;\r\n\r\n        // Compute the new height (reduce by the exceeded pixels)\r\n        const newHeight = eleRect.height - elementExceedPx;\r\n\r\n        // Maintain aspect ratio\r\n        const aspectRatio = eleRect.width / eleRect.height;//original ratio\r\n        const newWidth = newHeight * aspectRatio;\r\n\r\n        // Apply scaled dimensions\r\n        this.renderer.setStyle(element, 'width', `${newWidth}px`);\r\n        this.renderer.setStyle(element, 'height', `${newHeight}px`);\r\n      }\r\n    }\r\n    else{\r\n      this.renderer.setStyle(element, 'width', `${width}px`);\r\n      this.renderer.setStyle(element, 'height', `${height}px`);\r\n    }\r\n  }\r\n\r\n  @HostListener(\"document:pointerup\",[\"$event\"])\r\n  @HostListener(\"document:pointercancel\",[\"$event\"])\r\n  onMouseUp($event:MouseEvent) {\r\n    if(!this.active) return;\r\n    const createdEl=this.component?.element;\r\n    if(!this.component?.element || !createdEl) {\r\n      this.reset({destroyElement:true});\r\n      return;\r\n    }\r\n    const createdElBounding=createdEl.getBoundingClientRect();\r\n    const hostElBounding=this.el.getBoundingClientRect();\r\n    const rect={left:createdElBounding.left-hostElBounding.left,top:createdElBounding.top-hostElBounding.top,width:createdEl?.offsetWidth ?? 0,height:createdEl?.offsetHeight ?? 0};\r\n    if(!this._lockedMapping || !this._isDrawing.value || rect.width<=(this.miniSize?.width ?? 0) || rect.height<=(this.miniSize?.height ?? 0)) {\r\n      this.reset({destroyElement:true});\r\n      return;\r\n    }\r\n\r\n    //restore pointer events\r\n    this.renderer.setStyle(createdEl, 'pointer-events', 'auto');\r\n\r\n    this._scribbleService.addToRegistry(this.component!.element.id,this.component!.ref!)\r\n    this.rendered.emit({info:rect ,createdEl:this.component?.element!,mapping:this._lockedMapping,event:$event});\r\n    this.reset();\r\n  }\r\n\r\n  ngOnDestroy() {\r\n    this.subscription.forEach(subscription => subscription.unsubscribe());\r\n    this.reset({destroyElement:true});\r\n  }\r\n}\r\n","/*\r\n * Public API Surface of ngx-scribbly\r\n */\r\n\r\nexport * from './lib/directive/scribble-directive/scribble.directive';\r\nexport * from './lib/service/scribble.service';\r\nexport * from './lib/model/scribble.config';\r\nexport * from './lib/model/type-mappings';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1._ScribbleService","i1.ScribbleService","i2._ScribbleService"],"mappings":";;;;AAAgB,SAA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