{"version":3,"file":"taiga-ui-editor-components-editor-resizable.mjs","sources":["../../../projects/editor/components/editor-resizable/editor-resizable.abstract.ts","../../../projects/editor/components/editor-resizable/editor-resizable.component.ts","../../../projects/editor/components/editor-resizable/editor-resizable.component.html","../../../projects/editor/components/editor-resizable/taiga-ui-editor-components-editor-resizable.ts"],"sourcesContent":["import {type ChangeDetectorRef, Directive} from '@angular/core';\nimport {TuiNodeViewNg} from '@taiga-ui/editor/extensions/tiptap-node-view';\nimport {type NodeViewProps} from '@tiptap/core';\n\nexport interface TuiEditorResizableContainer {\n    height?: number | string | null;\n    width?: number | string | null;\n}\n\n@Directive()\nexport abstract class AbstractTuiEditorResizable<\n    T extends TuiEditorResizableContainer,\n> extends TuiNodeViewNg {\n    protected abstract readonly changeDetector: ChangeDetectorRef;\n    private localNode!: NodeViewProps['node'];\n    protected currentHeight = 0;\n    protected currentWidth = 0;\n\n    public abstract updateSize([width, height]: readonly [\n        width: number,\n        height: number,\n    ]): void;\n\n    public get node(): NodeViewProps['node'] {\n        return this.localNode;\n    }\n\n    public set node(value: NodeViewProps['node']) {\n        this.localNode = value;\n        this.changeDetector.detectChanges();\n    }\n\n    protected get attrs(): T {\n        return (this.node.attrs as T | undefined) ?? ({src: ''} as unknown as T);\n    }\n\n    protected get width(): number | string | null {\n        return (this.currentWidth || this.attrs.width) ?? null;\n    }\n\n    protected get height(): number | string | null {\n        return (this.currentHeight || this.attrs.height) ?? null;\n    }\n}\n","import {NgIf} from '@angular/common';\nimport {\n    ChangeDetectionStrategy,\n    Component,\n    type ElementRef,\n    EventEmitter,\n    Input,\n    Output,\n    ViewChild,\n} from '@angular/core';\nimport {tuiIsNumber, tuiPx, TuiResizable, TuiResizer} from '@taiga-ui/cdk';\n\n@Component({\n    standalone: true,\n    selector: 'tui-editor-resizable',\n    imports: [NgIf, TuiResizable, TuiResizer],\n    templateUrl: './editor-resizable.component.html',\n    styleUrls: ['./editor-resizable.component.less'],\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    host: {\n        '[style.width]': 'hostWidth',\n        '[style.height]': 'hostHeight',\n    },\n})\nexport class TuiEditorResizable {\n    @ViewChild('container', {static: true})\n    public container?: ElementRef<HTMLDivElement>;\n\n    @Input()\n    public isEditable = false;\n\n    @Input()\n    public autoHeight = false;\n\n    @Input()\n    public width: number | string | null = null;\n\n    @Input()\n    public height: number | string | null = null;\n\n    @Output()\n    public readonly sizeChange = new EventEmitter<\n        readonly [width: number, height: number]\n    >();\n\n    protected get hostWidth(): number | string | null {\n        return tuiIsNumber(this.width) ? tuiPx(this.width) : this.width;\n    }\n\n    protected get hostHeight(): number | string | null {\n        if (this.autoHeight) {\n            return null;\n        }\n\n        return tuiIsNumber(this.height) ? tuiPx(this.height) : this.height;\n    }\n}\n","<div\n    #container\n    tuiResizable\n    class=\"t-resizable\"\n    [class.t-resizable-auto-height]=\"autoHeight\"\n>\n    <ng-content />\n\n    <ng-container *ngIf=\"isEditable\">\n        <div\n            class=\"t-handle t-handle-left-side\"\n            [tuiResizer]=\"[-1, 0]\"\n            (tuiSizeChange)=\"sizeChange.emit($event)\"\n        ></div>\n\n        <div\n            *ngIf=\"!autoHeight\"\n            class=\"t-handle t-handle-bottom-side\"\n            [tuiResizer]=\"[0, 1]\"\n            (tuiSizeChange)=\"sizeChange.emit($event)\"\n        ></div>\n\n        <div\n            class=\"t-handle t-handle-right-side\"\n            [tuiResizer]=\"[1, 0]\"\n            (tuiSizeChange)=\"sizeChange.emit($event)\"\n        ></div>\n    </ng-container>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AASA,MACsB,0BAEpB,SAAQ,aAAa,CAAA;AAHvB,IAAA,WAAA,GAAA;;QAMc,IAAa,CAAA,aAAA,GAAG,CAAC,CAAC;QAClB,IAAY,CAAA,YAAA,GAAG,CAAC,CAAC;AA2B9B,KAAA;AApBG,IAAA,IAAW,IAAI,GAAA;QACX,OAAO,IAAI,CAAC,SAAS,CAAC;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