@ngstarter-ui/components 22.2.2 → 22.2.4
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/ai/component-registry.json +37 -0
- package/content-editor/BLOCK_FORMAT.md +861 -0
- package/content-editor/document.schema.json +1598 -0
- package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-rzZKJ2JH.mjs +35 -0
- package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-rzZKJ2JH.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-callout-block-Cnga7Z-6.mjs → ngstarter-ui-components-content-editor-callout-block-DTdApN0r.mjs} +2 -3
- package/fesm2022/{ngstarter-ui-components-content-editor-callout-block-Cnga7Z-6.mjs.map → ngstarter-ui-components-content-editor-callout-block-DTdApN0r.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-code-block.component-DSdVOJtH.mjs → ngstarter-ui-components-content-editor-code-block.component-DpONkTMU.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-code-block.component-DSdVOJtH.mjs.map → ngstarter-ui-components-content-editor-code-block.component-DpONkTMU.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-embed-block-DhFxtMQS.mjs → ngstarter-ui-components-content-editor-embed-block-CmhzpaRk.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-embed-block-DhFxtMQS.mjs.map → ngstarter-ui-components-content-editor-embed-block-CmhzpaRk.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-gallery-block-cEy-dCMa.mjs → ngstarter-ui-components-content-editor-gallery-block-gtH7yWd5.mjs} +16 -39
- package/fesm2022/ngstarter-ui-components-content-editor-gallery-block-gtH7yWd5.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-grid-block-DFLGRFiO.mjs → ngstarter-ui-components-content-editor-grid-block-Pb-xV7Pw.mjs} +3 -4
- package/fesm2022/{ngstarter-ui-components-content-editor-grid-block-DFLGRFiO.mjs.map → ngstarter-ui-components-content-editor-grid-block-Pb-xV7Pw.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-heading-block.component-BYpctSPe.mjs → ngstarter-ui-components-content-editor-heading-block.component-BKe9Zy_x.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-heading-block.component-BYpctSPe.mjs.map → ngstarter-ui-components-content-editor-heading-block.component-BKe9Zy_x.mjs.map} +1 -1
- package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-DSpBVTu-.mjs +113 -0
- package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-DSpBVTu-.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-list-block.component-6SMBxIl4.mjs → ngstarter-ui-components-content-editor-list-block.component-BPKPE1uY.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-list-block.component-6SMBxIl4.mjs.map → ngstarter-ui-components-content-editor-list-block.component-BPKPE1uY.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-nested-blocks-DSY7xfzf.mjs → ngstarter-ui-components-content-editor-nested-blocks-Dh-p3WMp.mjs} +4 -4
- package/fesm2022/ngstarter-ui-components-content-editor-nested-blocks-Dh-p3WMp.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor--rb3-UuO.mjs → ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs} +2058 -983
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-paragraph-block.component-JVxf_Cdx.mjs → ngstarter-ui-components-content-editor-paragraph-block.component-D5wS3m6O.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-paragraph-block.component-JVxf_Cdx.mjs.map → ngstarter-ui-components-content-editor-paragraph-block.component-D5wS3m6O.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-quote-block.component-7EO7z7Sr.mjs → ngstarter-ui-components-content-editor-quote-block.component-C3GFAGKF.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-quote-block.component-7EO7z7Sr.mjs.map → ngstarter-ui-components-content-editor-quote-block.component-C3GFAGKF.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-table-block.component-CJS-IBHw.mjs → ngstarter-ui-components-content-editor-table-block.component-DQgs_kyN.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-table-block.component-CJS-IBHw.mjs.map → ngstarter-ui-components-content-editor-table-block.component-DQgs_kyN.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-toggle-block-B01lhY_V.mjs → ngstarter-ui-components-content-editor-toggle-block-Cb67ChE8.mjs} +3 -4
- package/fesm2022/{ngstarter-ui-components-content-editor-toggle-block-B01lhY_V.mjs.map → ngstarter-ui-components-content-editor-toggle-block-Cb67ChE8.mjs.map} +1 -1
- package/fesm2022/ngstarter-ui-components-content-editor-upload-status-QnKI_Rfz.mjs +19 -0
- package/fesm2022/ngstarter-ui-components-content-editor-upload-status-QnKI_Rfz.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-CRa0g9Ez.mjs +134 -0
- package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-CRa0g9Ez.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-content-editor.mjs +1 -1
- package/fesm2022/ngstarter-ui-components-headless-editor.mjs +57 -0
- package/fesm2022/ngstarter-ui-components-headless-editor.mjs.map +1 -1
- package/package.json +3 -1
- package/types/ngstarter-ui-components-content-editor.d.ts +302 -18
- package/types/ngstarter-ui-components-headless-editor.d.ts +6 -1
- package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-B2GUlWO2.mjs +0 -54
- package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-B2GUlWO2.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-block-base-BHAxKEOT.mjs +0 -47
- package/fesm2022/ngstarter-ui-components-content-editor-block-base-BHAxKEOT.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-gallery-block-cEy-dCMa.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-B3MnANpi.mjs +0 -169
- package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-B3MnANpi.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-nested-blocks-DSY7xfzf.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor--rb3-UuO.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-upload-block-base-D9ELpJr-.mjs +0 -29
- package/fesm2022/ngstarter-ui-components-content-editor-upload-block-base-D9ELpJr-.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-DQUPVDwV.mjs +0 -201
- package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-DQUPVDwV.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-gallery-block-gtH7yWd5.mjs","sources":["../../../projects/components/content-editor/src/_builder/gallery-block/gallery-block.ts","../../../projects/components/content-editor/src/_builder/gallery-block/gallery-block.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, linkedSignal, signal } from '@angular/core';\nimport { CdkDrag, CdkDragDrop, CdkDragHandle, CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';\nimport { createNgsHeadlessEditorId, createNgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { UploadArea, UploadTriggerDirective, UploadFileSelectedEvent } from '@ngstarter-ui/components/upload';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport { FormField, Hint, Label } from '@ngstarter-ui/components/form-field';\nimport { Input } from '@ngstarter-ui/components/input';\nimport { Menu, MenuDivider, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';\nimport { ImageViewerDirective, ImageViewerPictureDirective } from '@ngstarter-ui/components/image-viewer';\nimport { ContentEditorUploadBlockBase } from '../upload-block-base';\nimport { ContentEditorGalleryContent, ContentEditorGalleryImage } from '../../types';\nimport { contentEditorText } from '../../document';\nimport { ContentEditorUploadStatus } from '../upload-status/upload-status';\n\n@Component({\n selector: 'ngs-content-editor-gallery-block',\n imports: [ContentEditorUploadStatus, UploadArea, UploadTriggerDirective, Button, Icon, FormField, Hint, Label, Input,\n CdkDrag, CdkDragHandle, CdkDropList, Menu, MenuDivider, MenuItem, MenuTrigger, ImageViewerDirective, ImageViewerPictureDirective],\n templateUrl: './gallery-block.html', styleUrl: './gallery-block.scss', changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentEditorGalleryBlock extends ContentEditorUploadBlockBase<ContentEditorGalleryContent> {\n readonly images = computed(() => this.content().images);\n readonly selectedId = linkedSignal<readonly ContentEditorGalleryImage[], string | null>({\n source: this.images,\n computation: (images, previous) => {\n if (images.some(image => image.id === previous?.value)) return previous!.value;\n const previousIndex = previous?.source.findIndex(image => image.id === previous.value) ?? 0;\n return images[Math.min(Math.max(previousIndex, 0), images.length - 1)]?.id ?? null;\n }\n });\n readonly selectedIndex = computed(() => this.images().findIndex(image => image.id === this.selectedId()));\n readonly selectedImage = computed(() => this.images()[this.selectedIndex()] ?? null);\n readonly replacementId = signal<string | null>(null);\n readonly captionText = contentEditorText;\n\n selectImage(id: string): void { this.selectedId.set(id); }\n previousImage(): void { const image = this.images()[this.selectedIndex() - 1]; if (image) this.selectImage(image.id); }\n nextImage(): void { const image = this.images()[this.selectedIndex() + 1]; if (image) this.selectImage(image.id); }\n changeAlt(id: string, event: Event): void { this.changeImage(id, { alt: (event.target as HTMLInputElement).value }); }\n changeCaption(id: string, caption: string): void { this.changeImage(id, { caption: [createNgsHeadlessEditorText(caption)] }); }\n private changeImage(id: string, data: Partial<ContentEditorGalleryImage>): void {\n this.save({ images: this.latestContent().images.map(image => image.id === id ? { ...image, ...data } : image) });\n }\n removeImage(id: string): void { this.save({ images: this.latestContent().images.filter(image => image.id !== id) }); }\n moveImage(index: number, direction: number): void { this.reorderImage(index, index + direction); }\n dropImage(event: CdkDragDrop<readonly ContentEditorGalleryImage[]>): void {\n this.reorderImage(event.previousIndex, event.currentIndex);\n }\n private reorderImage(from: number, to: number): void {\n const images = [...this.latestContent().images];\n if (from < 0 || to < 0 || from >= images.length || to >= images.length || from === to) return;\n moveItemInArray(images, from, to);\n this.save({ images });\n }\n requestReplacement(id: string, trigger: UploadTriggerDirective): void {\n this.replacementId.set(id);\n trigger._handleClick();\n }\n async upload(event: UploadFileSelectedEvent, replaceId: string | null = null): Promise<void> {\n const files = replaceId ? event.files.slice(0, 1) : event.files;\n await this.uploadFiles('gallery', { files, accept: file => file.type.startsWith('image/'), apply: results => {\n const images = results.map(({ url, file }) => ({ id: createNgsHeadlessEditorId('image'), src: url, alt: file.name, caption: [] } satisfies ContentEditorGalleryImage));\n if (replaceId) this.changeImage(replaceId, { src: images[0].src });\n else { this.save({ images: [...this.latestContent().images, ...images] }); this.selectImage(images[0].id); }\n } });\n }\n}\n","<div class=\"flex min-w-0 flex-col gap-4 p-3 sm:p-4\">\n <div class=\"flex flex-wrap items-center gap-3\">\n <span class=\"text-base font-semibold\">Carousel</span>\n <span class=\"text-sm text-on-surface-variant\">{{ images().length }} {{ images().length === 1 ? 'image' : 'images' }}</span>\n </div>\n @if (selectedImage(); as image) {\n <div class=\"gallery-preview relative overflow-hidden rounded-lg\" ngsImageViewer>\n <button ngsButton class=\"gallery-picture block w-full\" [fullWidth]=\"true\" ngsImageViewerPicture [sourceUrl]=\"image.src\" [caption]=\"captionText(image.caption)\" [attr.aria-label]=\"image.alt || 'View image'\">\n <img class=\"block aspect-video w-full object-cover\" [src]=\"image.src\" [alt]=\"image.alt\" draggable=\"false\">\n </button>\n <button ngsIconButton class=\"preview-action image-actions absolute right-3 top-3\" aria-label=\"Image actions\" [ngsMenuTriggerFor]=\"imageMenu\"><ngs-icon name=\"fluent:more-horizontal-24-regular\"/></button>\n @if (images().length > 1) {\n <button ngsIconButton class=\"preview-action absolute left-3 top-1/2 -translate-y-1/2\" aria-label=\"Previous image\" [disabled]=\"selectedIndex() === 0\" (click)=\"previousImage()\"><ngs-icon name=\"fluent:chevron-left-24-regular\"/></button>\n <button ngsIconButton class=\"preview-action absolute right-3 top-1/2 -translate-y-1/2\" aria-label=\"Next image\" [disabled]=\"selectedIndex() === images().length - 1\" (click)=\"nextImage()\"><ngs-icon name=\"fluent:chevron-right-24-regular\"/></button>\n }\n <span class=\"image-counter absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full px-3 py-1 text-sm\" aria-live=\"polite\">{{ selectedIndex() + 1 }} / {{ images().length }}</span>\n </div>\n <div class=\"flex min-w-0 flex-col gap-2\">\n <span class=\"flex items-center gap-2 text-xs text-on-surface-variant\"><ngs-icon name=\"fluent:re-order-24-regular\" class=\"size-4\"/>Drag to reorder</span>\n <div class=\"thumbnail-strip flex min-w-0 gap-3 overflow-x-auto pb-2\">\n <div cdkDropList cdkDropListOrientation=\"horizontal\" [cdkDropListData]=\"images()\" (cdkDropListDropped)=\"dropImage($event)\" class=\"flex shrink-0 gap-3\">\n @for (thumbnail of images(); track thumbnail.id) {\n <div cdkDrag [cdkDragData]=\"thumbnail.id\" class=\"gallery-thumbnail flex shrink-0 items-center gap-1 rounded-lg p-1\" [attr.data-image-id]=\"thumbnail.id\">\n <div cdkDragHandle class=\"thumbnail-handle flex w-5 shrink-0 self-stretch items-center justify-center select-none touch-none\" [attr.title]=\"'Drag to reorder image ' + ($index + 1)\"><ngs-icon name=\"fluent:re-order-dots-vertical-24-regular\"/></div>\n <button ngsButton class=\"thumbnail-picture\" [class.is-selected]=\"selectedId() === thumbnail.id\" [attr.aria-label]=\"'Select image ' + ($index + 1)\" [attr.aria-pressed]=\"selectedId() === thumbnail.id\" (click)=\"selectImage(thumbnail.id)\">\n <img class=\"block h-18 w-32 rounded-md object-cover\" [src]=\"thumbnail.src\" [alt]=\"thumbnail.alt\" draggable=\"false\" loading=\"lazy\">\n </button>\n </div>\n }\n </div>\n <button ngsButton class=\"add-image-tile flex shrink-0 flex-col justify-center gap-1 rounded-lg\" ngsUploadTrigger accept=\"image/*\" [multiple]=\"true\" [disabled]=\"uploading()\" (fileSelected)=\"upload($event)\"><ngs-icon name=\"fluent:add-24-regular\"/>Add images</button>\n </div>\n </div>\n <div class=\"flex flex-col gap-3\">\n <ngs-form-field labelMode=\"external\" subscriptHiddenIfEmpty class=\"gallery-field\">\n <ngs-label>Caption</ngs-label>\n <input ngsInput [value]=\"captionText(image.caption)\" placeholder=\"Add a caption\" (input)=\"changeCaption(image.id, $any($event.target).value)\">\n </ngs-form-field>\n <ngs-form-field labelMode=\"external\" class=\"gallery-field\">\n <ngs-label>Alt text</ngs-label>\n <input ngsInput [value]=\"image.alt\" placeholder=\"Describe this image\" (input)=\"changeAlt(image.id, $event)\">\n <ngs-hint>Describe the image for screen readers</ngs-hint>\n </ngs-form-field>\n </div>\n <ngs-menu #imageMenu>\n <button ngs-menu-item [disabled]=\"uploading()\" (click)=\"requestReplacement(image.id, replaceUpload)\">Replace image</button>\n <button ngs-menu-item [disabled]=\"selectedIndex() === 0\" (click)=\"moveImage(selectedIndex(), -1)\">Move image earlier</button>\n <button ngs-menu-item [disabled]=\"selectedIndex() === images().length - 1\" (click)=\"moveImage(selectedIndex(), 1)\">Move image later</button>\n <ngs-menu-divider/>\n <button ngs-menu-item (click)=\"removeImage(image.id)\">Remove image</button>\n </ngs-menu>\n } @else {\n <ngs-upload-area ngsUploadTrigger accept=\"image/*\" [multiple]=\"true\" (fileSelected)=\"!uploading() && upload($event)\">\n <div class=\"flex flex-col items-center gap-2 py-8\"><ngs-icon name=\"fluent:image-multiple-24-regular\" class=\"size-8\"/><span>Add images to your carousel</span><span class=\"text-xs text-on-surface-variant\">Click or drop images here</span></div>\n </ngs-upload-area>\n }\n <button ngsButton hidden ngsUploadTrigger accept=\"image/*\" #replaceUpload=\"ngsUploadTrigger\" (fileSelected)=\"upload($event, replacementId())\" aria-label=\"Replace selected image\"></button>\n <ngs-content-editor-upload-status [task]=\"uploadTask\"/>\n</div>\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAqBM,MAAO,yBAA0B,SAAQ,4BAAyD,CAAA;IAC7F,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM;+EAAC;AAC9C,IAAA,UAAU,GAAG,YAAY,CAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,YAAA,EAAA,8BAAA,EAAA,CAAA,EAChC,MAAM,EAAE,IAAI,CAAC,MAAM;AACnB,QAAA,WAAW,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAI;AAChC,YAAA,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,EAAE,KAAK,QAAQ,EAAE,KAAK,CAAC;gBAAE,OAAO,QAAS,CAAC,KAAK;YAC9E,MAAM,aAAa,GAAG,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;YAC3F,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,IAAI;AACpF,QAAA,CAAC,GACD;IACO,aAAa,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;sFAAC;AAChG,IAAA,aAAa,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,aA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AAA,MAAA,EAAA,CAAA,mBAAA,EAAA,oBAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,WAAA,EAAA,4BAAA,CAAA,EAAA,OAAA,EAAA,CAAA,YAAA,EAAA,YAAA,CAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,oBAAoB,2FAAE,2BAA2B,EAAA,QAAA,EAAA,yBAAA,EAAA,MAAA,EAAA,CAAA,WAAA,EAAA,SAAA,EAAA,OAAA,EAAA,aAAA,CAAA,EAAA,QAAA,EAAA,CAAA,uBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAGvH,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBANrC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,kCAAkC,WACnC,CAAC,yBAAyB,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK;wBAClH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE,2BAA2B,CAAC,EAAA,eAAA,EAC3C,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,y5KAAA,EAAA,MAAA,EAAA,CAAA,23DAAA,CAAA,EAAA;;;;;"}
|
|
@@ -5,14 +5,13 @@ import { Button } from '@ngstarter-ui/components/button';
|
|
|
5
5
|
import { Icon } from '@ngstarter-ui/components/icon';
|
|
6
6
|
import { Popover, PopoverTriggerForDirective } from '@ngstarter-ui/components/popover';
|
|
7
7
|
import { Menu, MenuDivider, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';
|
|
8
|
-
import {
|
|
9
|
-
import { C as ContentEditorNestedBlocks } from './ngstarter-ui-components-content-editor-nested-blocks-
|
|
8
|
+
import { g as ContentEditorBlockBase, j as contentEditorGridSettings, k as findContentEditorBlock, l as emptyGridCell } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs';
|
|
9
|
+
import { C as ContentEditorNestedBlocks } from './ngstarter-ui-components-content-editor-nested-blocks-Dh-p3WMp.mjs';
|
|
10
10
|
import { Segmented, SegmentedButton } from '@ngstarter-ui/components/segmented';
|
|
11
11
|
import { FormField, Label } from '@ngstarter-ui/components/form-field';
|
|
12
12
|
import { Select, Option } from '@ngstarter-ui/components/select';
|
|
13
13
|
import { SlideToggle } from '@ngstarter-ui/components/slide-toggle';
|
|
14
14
|
import { Divider } from '@ngstarter-ui/components/divider';
|
|
15
|
-
import { i as contentEditorGridSettings, h as findContentEditorBlock, j as emptyGridCell } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor--rb3-UuO.mjs';
|
|
16
15
|
|
|
17
16
|
class ContentEditorGridSettingsPanel {
|
|
18
17
|
settings = input.required(/* @ts-ignore */
|
|
@@ -63,4 +62,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
63
62
|
}] });
|
|
64
63
|
|
|
65
64
|
export { ContentEditorGridBlock };
|
|
66
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-grid-block-
|
|
65
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-grid-block-Pb-xV7Pw.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-content-editor-grid-block-DFLGRFiO.mjs","sources":["../../../projects/components/content-editor/src/_builder/grid-settings-panel/grid-settings-panel.ts","../../../projects/components/content-editor/src/_builder/grid-settings-panel/grid-settings-panel.html","../../../projects/components/content-editor/src/_builder/grid-block/grid-block.ts","../../../projects/components/content-editor/src/_builder/grid-block/grid-block.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport { Segmented, SegmentedButton } from '@ngstarter-ui/components/segmented';\nimport { FormField, Label } from '@ngstarter-ui/components/form-field';\nimport { Select, Option } from '@ngstarter-ui/components/select';\nimport { SlideToggle } from '@ngstarter-ui/components/slide-toggle';\nimport { Divider } from '@ngstarter-ui/components/divider';\nimport { ContentEditorGridSettings } from '../../types';\n\n@Component({\n selector: 'ngs-content-editor-grid-settings-panel',\n imports: [Button, Icon, Segmented, SegmentedButton, FormField, Label, Select, Option, SlideToggle, Divider],\n templateUrl: './grid-settings-panel.html', styleUrl: './grid-settings-panel.scss', changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentEditorGridSettingsPanel {\n readonly settings = input.required<ContentEditorGridSettings>();\n readonly settingsChanged = output<Partial<ContentEditorGridSettings>>();\n readonly cellAdded = output<void>();\n}\n","<div class=\"flex w-64 max-w-[calc(100vw-48px)] flex-col gap-5 p-4\" role=\"group\" aria-label=\"Grid settings\">\n <span class=\"text-base font-semibold\">Grid settings</span>\n <div class=\"flex flex-col gap-2\">\n <span class=\"text-sm\">Columns</span>\n <ngs-segmented class=\"w-full!\" [value]=\"settings().columns\" (valueChange)=\"settingsChanged.emit({columns: $event})\" aria-label=\"Grid columns\">\n @for (count of [2, 3, 4]; track count) { <button ngs-segmented-button class=\"flex-1\" [value]=\"count\" [attr.aria-label]=\"count + ' columns'\">{{count}}</button> }\n </ngs-segmented>\n </div>\n <ngs-form-field labelMode=\"external\" subscriptHiddenIfEmpty>\n <ngs-label>Gap</ngs-label>\n <ngs-select [value]=\"settings().gap\" (valueChange)=\"settingsChanged.emit({gap: $event})\" aria-label=\"Grid gap\">\n <ngs-option value=\"small\">Small</ngs-option><ngs-option value=\"medium\">Medium</ngs-option><ngs-option value=\"large\">Large</ngs-option>\n </ngs-select>\n </ngs-form-field>\n <div class=\"flex flex-col gap-2\">\n <ngs-slide-toggle [checked]=\"settings().stackOnMobile\" labelPosition=\"before\" (change)=\"settingsChanged.emit({stackOnMobile: $event.checked})\">Stack on mobile</ngs-slide-toggle>\n <p class=\"text-xs text-on-surface-variant\">Cells stack vertically on smaller screens in reading order.</p>\n </div>\n <ngs-divider/>\n <button ngsButton class=\"add-cell\" (click)=\"cellAdded.emit()\"><ngs-icon name=\"fluent:add-24-regular\"/>Add cell</button>\n</div>\n","import { ChangeDetectionStrategy, Component, computed } from '@angular/core';\nimport { CdkDrag, CdkDragDrop, CdkDragHandle, CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport { Popover, PopoverTriggerForDirective } from '@ngstarter-ui/components/popover';\nimport { Menu, MenuDivider, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';\nimport { ContentEditorBlockBase } from '../block-base';\nimport { ContentEditorNestedBlocks } from '../nested-blocks/nested-blocks';\nimport { ContentEditorGridSettingsPanel } from '../grid-settings-panel/grid-settings-panel';\nimport { ContentEditorGridContent, ContentEditorGridSettings } from '../../types';\nimport { emptyGridCell } from '../../extra-block-defs';\nimport { contentEditorGridSettings } from '../../grid-settings';\nimport { findContentEditorBlock } from '../../document';\n\n@Component({\n selector: 'ngs-content-editor-grid-block',\n imports: [Button, Icon, Popover, PopoverTriggerForDirective, Menu, MenuDivider, MenuItem, MenuTrigger,\n ContentEditorNestedBlocks, ContentEditorGridSettingsPanel, CdkDrag, CdkDragHandle, CdkDropList],\n templateUrl: './grid-block.html', styleUrls: ['../../grid-layout.scss', './grid-block.scss'], changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentEditorGridBlock extends ContentEditorBlockBase<ContentEditorGridContent, ContentEditorGridSettings> {\n readonly layout = computed(() => contentEditorGridSettings(this.settings()));\n\n changeSettings(change: Partial<ContentEditorGridSettings>): void {\n const settings = findContentEditorBlock(this.store.editor.document().blocks, this.id())?.attrs?.['settings'] ?? this.settings();\n this.save(this.latestContent(), contentEditorGridSettings({ ...settings, ...change }));\n }\n addCell(): void {\n const cell = emptyGridCell();\n this.store.updateBlock(this.id(), { content: { cells: [...this.latestContent().cells, cell] } });\n this.store.setFocusedBlockId(cell.blocks[0].id);\n }\n removeCell(id: string): void {\n const cells = this.latestContent().cells;\n if (cells.length <= 1) return;\n this.store.updateBlock(this.id(), { content: { cells: cells.filter(cell => cell.id !== id) } });\n }\n moveCell(from: number, to: number): void {\n const cells = [...this.latestContent().cells];\n if (from === to || from < 0 || to < 0 || from >= cells.length || to >= cells.length) return;\n moveItemInArray(cells, from, to);\n this.store.updateBlock(this.id(), { content: { cells } });\n }\n dropCell(event: CdkDragDrop<ContentEditorGridContent>): void { this.moveCell(event.previousIndex, event.currentIndex); }\n}\n","<div class=\"grid-tools mb-2 flex items-center justify-end gap-1\" [class.is-open]=\"settingsTrigger.isOpen()\">\n <span class=\"grid-label rounded-md px-2 py-1 text-xs\">Grid</span>\n <button ngsIconButton #settingsTrigger=\"ngsPopoverTriggerFor\" [ngsPopoverTriggerFor]=\"settingsPopover\"\n position=\"after-start\" aria-label=\"Grid settings\" [attr.aria-expanded]=\"settingsTrigger.isOpen()\">\n <ngs-icon name=\"fluent:more-horizontal-24-regular\"/>\n </button>\n</div>\n<div cdkDropList cdkDropListOrientation=\"mixed\" [cdkDropListData]=\"content()\" (cdkDropListDropped)=\"dropCell($event)\"\n class=\"grid-cells\" [class.columns-3]=\"layout().columns === 3\" [class.columns-4]=\"layout().columns === 4\"\n [class.gap-small]=\"layout().gap === 'small'\" [class.gap-large]=\"layout().gap === 'large'\" [class.stack-on-mobile]=\"layout().stackOnMobile\">\n @for (cell of content().cells; track cell.id) {\n <div cdkDrag [cdkDragData]=\"cell.id\" class=\"grid-cell relative flex min-w-0 flex-col rounded-lg p-4\" [attr.data-cell-id]=\"cell.id\"\n [class.actions-open]=\"cellActions.menuOpen()\">\n <div cdkDragHandle class=\"cell-grip absolute top-3 flex w-4 items-center justify-center select-none touch-none\"\n [attr.title]=\"'Drag to reorder cell ' + ($index + 1)\"><ngs-icon name=\"fluent:re-order-dots-vertical-24-regular\"/></div>\n <button ngsIconButton class=\"cell-actions absolute right-1 top-1\" [ngsMenuTriggerFor]=\"cellMenu\" #cellActions=\"ngsMenuTrigger\"\n [attr.aria-label]=\"'Cell ' + ($index + 1) + ' actions'\"><ngs-icon name=\"fluent:more-horizontal-24-regular\"/></button>\n <ngs-content-editor-nested-blocks class=\"flex-1\" [scope]=\"{parentId: id(), cellId: cell.id}\"/>\n <ngs-menu #cellMenu>\n <button ngs-menu-item [disabled]=\"$first\" (click)=\"moveCell($index, $index - 1)\">Move cell earlier</button>\n <button ngs-menu-item [disabled]=\"$last\" (click)=\"moveCell($index, $index + 1)\">Move cell later</button>\n <ngs-menu-divider/>\n <button ngs-menu-item [disabled]=\"content().cells.length === 1\" (click)=\"removeCell(cell.id)\">Delete cell</button>\n </ngs-menu>\n </div>\n }\n</div>\n<ngs-popover #settingsPopover=\"ngsPopover\">\n <ngs-content-editor-grid-settings-panel [settings]=\"layout()\" (settingsChanged)=\"changeSettings($event)\"\n (cellAdded)=\"settingsTrigger.close(); addCell()\"/>\n</ngs-popover>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;MAea,8BAA8B,CAAA;IAChC,QAAQ,GAAG,KAAK,CAAC,QAAQ;iFAA6B;IACtD,eAAe,GAAG,MAAM,EAAsC;IAC9D,SAAS,GAAG,MAAM,EAAQ;uGAHxB,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAA9B,8BAA8B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,wCAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EA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8BAA8B,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,EAAA,eAAA,EACc,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,y5EAAA,EAAA,MAAA,EAAA,CAAA,imBAAA,EAAA,4vDAAA,CAAA,EAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-grid-block-Pb-xV7Pw.mjs","sources":["../../../projects/components/content-editor/src/_builder/grid-settings-panel/grid-settings-panel.ts","../../../projects/components/content-editor/src/_builder/grid-settings-panel/grid-settings-panel.html","../../../projects/components/content-editor/src/_builder/grid-block/grid-block.ts","../../../projects/components/content-editor/src/_builder/grid-block/grid-block.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport { Segmented, SegmentedButton } from '@ngstarter-ui/components/segmented';\nimport { FormField, Label } from '@ngstarter-ui/components/form-field';\nimport { Select, Option } from '@ngstarter-ui/components/select';\nimport { SlideToggle } from '@ngstarter-ui/components/slide-toggle';\nimport { Divider } from '@ngstarter-ui/components/divider';\nimport { ContentEditorGridSettings } from '../../types';\n\n@Component({\n selector: 'ngs-content-editor-grid-settings-panel',\n imports: [Button, Icon, Segmented, SegmentedButton, FormField, Label, Select, Option, SlideToggle, Divider],\n templateUrl: './grid-settings-panel.html', styleUrl: './grid-settings-panel.scss', changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentEditorGridSettingsPanel {\n readonly settings = input.required<ContentEditorGridSettings>();\n readonly settingsChanged = output<Partial<ContentEditorGridSettings>>();\n readonly cellAdded = output<void>();\n}\n","<div class=\"flex w-64 max-w-[calc(100vw-48px)] flex-col gap-5 p-4\" role=\"group\" aria-label=\"Grid settings\">\n <span class=\"text-base font-semibold\">Grid settings</span>\n <div class=\"flex flex-col gap-2\">\n <span class=\"text-sm\">Columns</span>\n <ngs-segmented class=\"w-full!\" [value]=\"settings().columns\" (valueChange)=\"settingsChanged.emit({columns: $event})\" aria-label=\"Grid columns\">\n @for (count of [2, 3, 4]; track count) { <button ngs-segmented-button class=\"flex-1\" [value]=\"count\" [attr.aria-label]=\"count + ' columns'\">{{count}}</button> }\n </ngs-segmented>\n </div>\n <ngs-form-field labelMode=\"external\" subscriptHiddenIfEmpty>\n <ngs-label>Gap</ngs-label>\n <ngs-select [value]=\"settings().gap\" (valueChange)=\"settingsChanged.emit({gap: $event})\" aria-label=\"Grid gap\">\n <ngs-option value=\"small\">Small</ngs-option><ngs-option value=\"medium\">Medium</ngs-option><ngs-option value=\"large\">Large</ngs-option>\n </ngs-select>\n </ngs-form-field>\n <div class=\"flex flex-col gap-2\">\n <ngs-slide-toggle [checked]=\"settings().stackOnMobile\" labelPosition=\"before\" (change)=\"settingsChanged.emit({stackOnMobile: $event.checked})\">Stack on mobile</ngs-slide-toggle>\n <p class=\"text-xs text-on-surface-variant\">Cells stack vertically on smaller screens in reading order.</p>\n </div>\n <ngs-divider/>\n <button ngsButton class=\"add-cell\" (click)=\"cellAdded.emit()\"><ngs-icon name=\"fluent:add-24-regular\"/>Add cell</button>\n</div>\n","import { ChangeDetectionStrategy, Component, computed } from '@angular/core';\nimport { CdkDrag, CdkDragDrop, CdkDragHandle, CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport { Popover, PopoverTriggerForDirective } from '@ngstarter-ui/components/popover';\nimport { Menu, MenuDivider, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';\nimport { ContentEditorBlockBase } from '../block-base';\nimport { ContentEditorNestedBlocks } from '../nested-blocks/nested-blocks';\nimport { ContentEditorGridSettingsPanel } from '../grid-settings-panel/grid-settings-panel';\nimport { ContentEditorGridContent, ContentEditorGridSettings } from '../../types';\nimport { emptyGridCell } from '../../extra-block-defs';\nimport { contentEditorGridSettings } from '../../grid-settings';\nimport { findContentEditorBlock } from '../../document';\n\n@Component({\n selector: 'ngs-content-editor-grid-block',\n imports: [Button, Icon, Popover, PopoverTriggerForDirective, Menu, MenuDivider, MenuItem, MenuTrigger,\n ContentEditorNestedBlocks, ContentEditorGridSettingsPanel, CdkDrag, CdkDragHandle, CdkDropList],\n templateUrl: './grid-block.html', styleUrls: ['../../grid-layout.scss', './grid-block.scss'], changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentEditorGridBlock extends ContentEditorBlockBase<ContentEditorGridContent, ContentEditorGridSettings> {\n readonly layout = computed(() => contentEditorGridSettings(this.settings()));\n\n changeSettings(change: Partial<ContentEditorGridSettings>): void {\n const settings = findContentEditorBlock(this.store.editor.document().blocks, this.id())?.attrs?.['settings'] ?? this.settings();\n this.save(this.latestContent(), contentEditorGridSettings({ ...settings, ...change }));\n }\n addCell(): void {\n const cell = emptyGridCell();\n this.store.updateBlock(this.id(), { content: { cells: [...this.latestContent().cells, cell] } });\n this.store.setFocusedBlockId(cell.blocks[0].id);\n }\n removeCell(id: string): void {\n const cells = this.latestContent().cells;\n if (cells.length <= 1) return;\n this.store.updateBlock(this.id(), { content: { cells: cells.filter(cell => cell.id !== id) } });\n }\n moveCell(from: number, to: number): void {\n const cells = [...this.latestContent().cells];\n if (from === to || from < 0 || to < 0 || from >= cells.length || to >= cells.length) return;\n moveItemInArray(cells, from, to);\n this.store.updateBlock(this.id(), { content: { cells } });\n }\n dropCell(event: CdkDragDrop<ContentEditorGridContent>): void { this.moveCell(event.previousIndex, event.currentIndex); }\n}\n","<div class=\"grid-tools mb-2 flex items-center justify-end gap-1\" [class.is-open]=\"settingsTrigger.isOpen()\">\n <span class=\"grid-label rounded-md px-2 py-1 text-xs\">Grid</span>\n <button ngsIconButton #settingsTrigger=\"ngsPopoverTriggerFor\" [ngsPopoverTriggerFor]=\"settingsPopover\"\n position=\"after-start\" aria-label=\"Grid settings\" [attr.aria-expanded]=\"settingsTrigger.isOpen()\">\n <ngs-icon name=\"fluent:more-horizontal-24-regular\"/>\n </button>\n</div>\n<div cdkDropList cdkDropListOrientation=\"mixed\" [cdkDropListData]=\"content()\" (cdkDropListDropped)=\"dropCell($event)\"\n class=\"grid-cells\" [class.columns-3]=\"layout().columns === 3\" [class.columns-4]=\"layout().columns === 4\"\n [class.gap-small]=\"layout().gap === 'small'\" [class.gap-large]=\"layout().gap === 'large'\" [class.stack-on-mobile]=\"layout().stackOnMobile\">\n @for (cell of content().cells; track cell.id) {\n <div cdkDrag [cdkDragData]=\"cell.id\" class=\"grid-cell relative flex min-w-0 flex-col rounded-lg p-4\" [attr.data-cell-id]=\"cell.id\"\n [class.actions-open]=\"cellActions.menuOpen()\">\n <div cdkDragHandle class=\"cell-grip absolute top-3 flex w-4 items-center justify-center select-none touch-none\"\n [attr.title]=\"'Drag to reorder cell ' + ($index + 1)\"><ngs-icon name=\"fluent:re-order-dots-vertical-24-regular\"/></div>\n <button ngsIconButton class=\"cell-actions absolute right-1 top-1\" [ngsMenuTriggerFor]=\"cellMenu\" #cellActions=\"ngsMenuTrigger\"\n [attr.aria-label]=\"'Cell ' + ($index + 1) + ' actions'\"><ngs-icon name=\"fluent:more-horizontal-24-regular\"/></button>\n <ngs-content-editor-nested-blocks class=\"flex-1\" [scope]=\"{parentId: id(), cellId: cell.id}\"/>\n <ngs-menu #cellMenu>\n <button ngs-menu-item [disabled]=\"$first\" (click)=\"moveCell($index, $index - 1)\">Move cell earlier</button>\n <button ngs-menu-item [disabled]=\"$last\" (click)=\"moveCell($index, $index + 1)\">Move cell later</button>\n <ngs-menu-divider/>\n <button ngs-menu-item [disabled]=\"content().cells.length === 1\" (click)=\"removeCell(cell.id)\">Delete cell</button>\n </ngs-menu>\n </div>\n }\n</div>\n<ngs-popover #settingsPopover=\"ngsPopover\">\n <ngs-content-editor-grid-settings-panel [settings]=\"layout()\" (settingsChanged)=\"changeSettings($event)\"\n (cellAdded)=\"settingsTrigger.close(); addCell()\"/>\n</ngs-popover>\n"],"names":[],"mappings":";;;;;;;;;;;;;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,+BAAA,EAAA,2BAAA,EAAA,6BAAA,EAAA,sBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,oBAAA,EAAA,oBAAA,EAAA,mBAAA,EAAA,mBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,aAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAGrF,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBANlC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,+BAA+B,WAChC,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,0BAA0B,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW;AACnG,wBAAA,yBAAyB,EAAE,8BAA8B,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,EAAA,eAAA,EACc,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,y5EAAA,EAAA,MAAA,EAAA,CAAA,imBAAA,EAAA,4vDAAA,CAAA,EAAA;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ContentBuilderStore, a as CONTENT_BUILDER, c as cloneContentEditorValue, b as contentEditorText, d as ContentEditorContentEditableDirective, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor
|
|
1
|
+
import { C as ContentBuilderStore, a as CONTENT_BUILDER, c as cloneContentEditorValue, b as contentEditorText, d as ContentEditorContentEditableDirective, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, DestroyRef, viewChild, input, signal, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -131,4 +131,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
131
131
|
}], ctorParameters: () => [], propDecorators: { _contentRef: [{ type: i0.ViewChild, args: ['contentRef', { isSignal: true }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: true }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }] } });
|
|
132
132
|
|
|
133
133
|
export { HeadingBlockComponent };
|
|
134
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-heading-block.component-
|
|
134
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-heading-block.component-BKe9Zy_x.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-content-editor-heading-block.component-BYpctSPe.mjs","sources":["../../../projects/components/content-editor/src/_builder/heading-block/heading-block.component.ts","../../../projects/components/content-editor/src/_builder/heading-block/heading-block.component.html"],"sourcesContent":["import { NgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { contentEditorText, cloneContentEditorValue } from '../../document';\nimport {\n ChangeDetectionStrategy,\n Component, effect, untracked,\n DestroyRef,\n ElementRef,\n inject,\n input,\n OnInit,\n signal,\n viewChild\n} from '@angular/core';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport {\n CONTENT_BUILDER,\n CONTENT_EDITOR_BLOCK,\n ContentEditorDataBlock,\n ContentEditorHeadingBlockSettings,\n ContentEditorItemProperty\n} from '../../types';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\nimport { CursorController } from '../../utils/cursor-controller';\n\n@Component({\n selector: 'ngs-heading-block',\n imports: [\n ContentEditorContentEditableDirective\n ],\n templateUrl: './heading-block.component.html',\n styleUrl: './heading-block.component.scss',\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: HeadingBlockComponent,\n multi: true\n }\n ],\n host: {\n '[class.is-empty]': '_isEmpty()',\n '[class.level-1]': 'settings().level === 1',\n '[class.level-2]': 'settings().level === 2',\n '[class.level-3]': 'settings().level === 3',\n },\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class HeadingBlockComponent implements OnInit, ContentEditorDataBlock {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n private _destroyRef = inject(DestroyRef);\n\n private _contentRef = viewChild.required<ElementRef<HTMLParagraphElement>>('contentRef');\n\n id = input.required<string>();\n content = input.required<readonly NgsHeadlessEditorText[]>();\n settings = input.required<ContentEditorHeadingBlockSettings>();\n props = input<ContentEditorItemProperty[]>([]);\n index = input.required<number>();\n placeholder = input('Heading');\n\n protected _content = signal<readonly NgsHeadlessEditorText[]>([])\n protected _isEmpty = signal<boolean>(true);\n protected _props = signal<ContentEditorItemProperty[]>([]);\n readonly initialized = signal(false);\n\n constructor() {\n effect(() => {\n const content = this.content();\n const props = this.props();\n untracked(() => {\n this._content.set(content);\n this._props.set(cloneContentEditorValue(props));\n this._isEmpty.set(!contentEditorText(content).trim());\n });\n });\n }\n\n ngOnInit() {\n this._content.set(this.content());\n this._props.set(this.props());\n this._isEmpty.set(!contentEditorText(this.content()).trim());\n this._contentBuilder\n .focusChanged\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n });\n }\n\n focus() {\n const element = this._contentRef().nativeElement;\n const cursorController = new CursorController(element);\n cursorController.setToEnd();\n }\n\n onPropsChanged(props: ContentEditorItemProperty[]) {\n this._props.set(props);\n this.update();\n }\n\n getData(): any {\n return {\n content: this._content(),\n props: this._props(),\n settings: {\n ...this.settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n return !contentEditorText(this._content()).trim();\n }\n\n protected onContentChanged(content: readonly NgsHeadlessEditorText[]) {\n if (!this.initialized()) {\n return;\n }\n\n this._content.set(content);\n this._isEmpty.set(!contentEditorText(content).trim());\n\n this.update();\n }\n\n protected onPressedEnter(event: KeyboardEvent) {\n event.preventDefault();\n event.stopPropagation();\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n\n protected onContentEditableInitialized() {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n\n this.initialized.set(true);\n }\n\n protected _onKeyDown(event: KeyboardEvent) {\n if (event.key === 'Backspace' && !contentEditorText(this._content())) {\n this._contentBuilder.deleteBlock(this.id());\n }\n }\n\n private update() {\n this._store.updateBlock(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","<div #contentRef\n class=\"content\"\n [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"_content()\"\n [props]=\"props()\"\n (propsChanged)=\"onPropsChanged($event)\"\n [attr.data-empty-placeholder]=\"placeholder()\"\n (contentChanged)=\"onContentChanged($event)\"\n (pressedEnter)=\"onPressedEnter($event)\"\n (keydown)=\"_onKeyDown($event)\"\n (initialized)=\"onContentEditableInitialized()\"></div>\n"],"names":[],"mappings":";;;;;;MAgDa,qBAAqB,CAAA;AACxB,IAAA,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACpC,IAAA,eAAe,GAAG,MAAM,CAA0B,eAAe,CAAC;AAClE,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAEhC,IAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAmC,YAAY;oFAAC;IAExF,EAAE,GAAG,KAAK,CAAC,QAAQ;2EAAU;IAC7B,OAAO,GAAG,KAAK,CAAC,QAAQ;gFAAoC;IAC5D,QAAQ,GAAG,KAAK,CAAC,QAAQ;iFAAqC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AAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,aAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-heading-block.component-BKe9Zy_x.mjs","sources":["../../../projects/components/content-editor/src/_builder/heading-block/heading-block.component.ts","../../../projects/components/content-editor/src/_builder/heading-block/heading-block.component.html"],"sourcesContent":["import { NgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { contentEditorText, cloneContentEditorValue } from '../../document';\nimport {\n ChangeDetectionStrategy,\n Component, effect, untracked,\n DestroyRef,\n ElementRef,\n inject,\n input,\n OnInit,\n signal,\n viewChild\n} from '@angular/core';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport {\n CONTENT_BUILDER,\n CONTENT_EDITOR_BLOCK,\n ContentEditorDataBlock,\n ContentEditorHeadingBlockSettings,\n ContentEditorItemProperty\n} from '../../types';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\nimport { CursorController } from '../../utils/cursor-controller';\n\n@Component({\n selector: 'ngs-heading-block',\n imports: [\n ContentEditorContentEditableDirective\n ],\n templateUrl: './heading-block.component.html',\n styleUrl: './heading-block.component.scss',\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: HeadingBlockComponent,\n multi: true\n }\n ],\n host: {\n '[class.is-empty]': '_isEmpty()',\n '[class.level-1]': 'settings().level === 1',\n '[class.level-2]': 'settings().level === 2',\n '[class.level-3]': 'settings().level === 3',\n },\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class HeadingBlockComponent implements OnInit, ContentEditorDataBlock {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n private _destroyRef = inject(DestroyRef);\n\n private _contentRef = viewChild.required<ElementRef<HTMLParagraphElement>>('contentRef');\n\n id = input.required<string>();\n content = input.required<readonly NgsHeadlessEditorText[]>();\n settings = input.required<ContentEditorHeadingBlockSettings>();\n props = input<ContentEditorItemProperty[]>([]);\n index = input.required<number>();\n placeholder = input('Heading');\n\n protected _content = signal<readonly NgsHeadlessEditorText[]>([])\n protected _isEmpty = signal<boolean>(true);\n protected _props = signal<ContentEditorItemProperty[]>([]);\n readonly initialized = signal(false);\n\n constructor() {\n effect(() => {\n const content = this.content();\n const props = this.props();\n untracked(() => {\n this._content.set(content);\n this._props.set(cloneContentEditorValue(props));\n this._isEmpty.set(!contentEditorText(content).trim());\n });\n });\n }\n\n ngOnInit() {\n this._content.set(this.content());\n this._props.set(this.props());\n this._isEmpty.set(!contentEditorText(this.content()).trim());\n this._contentBuilder\n .focusChanged\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n });\n }\n\n focus() {\n const element = this._contentRef().nativeElement;\n const cursorController = new CursorController(element);\n cursorController.setToEnd();\n }\n\n onPropsChanged(props: ContentEditorItemProperty[]) {\n this._props.set(props);\n this.update();\n }\n\n getData(): any {\n return {\n content: this._content(),\n props: this._props(),\n settings: {\n ...this.settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n return !contentEditorText(this._content()).trim();\n }\n\n protected onContentChanged(content: readonly NgsHeadlessEditorText[]) {\n if (!this.initialized()) {\n return;\n }\n\n this._content.set(content);\n this._isEmpty.set(!contentEditorText(content).trim());\n\n this.update();\n }\n\n protected onPressedEnter(event: KeyboardEvent) {\n event.preventDefault();\n event.stopPropagation();\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n\n protected onContentEditableInitialized() {\n if (this._store.focusedBlockId() === this.id()) {\n this.focus();\n }\n\n this.initialized.set(true);\n }\n\n protected _onKeyDown(event: KeyboardEvent) {\n if (event.key === 'Backspace' && !contentEditorText(this._content())) {\n this._contentBuilder.deleteBlock(this.id());\n }\n }\n\n private update() {\n this._store.updateBlock(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","<div #contentRef\n class=\"content\"\n [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"_content()\"\n [props]=\"props()\"\n (propsChanged)=\"onPropsChanged($event)\"\n [attr.data-empty-placeholder]=\"placeholder()\"\n (contentChanged)=\"onContentChanged($event)\"\n (pressedEnter)=\"onPressedEnter($event)\"\n (keydown)=\"_onKeyDown($event)\"\n (initialized)=\"onContentEditableInitialized()\"></div>\n"],"names":[],"mappings":";;;;;;MAgDa,qBAAqB,CAAA;AACxB,IAAA,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACpC,IAAA,eAAe,GAAG,MAAM,CAA0B,eAAe,CAAC;AAClE,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAEhC,IAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAmC,YAAY;oFAAC;IAExF,EAAE,GAAG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EAAA,IAAA,EAAA,KAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,aAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { f as ContentEditorUploadBlockBase, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs';
|
|
2
|
+
import { C as ContentEditorUploadStatus } from './ngstarter-ui-components-content-editor-upload-status-QnKI_Rfz.mjs';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { signal, model, effect, untracked, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
|
+
import { UploadArea, UploadTriggerDirective } from '@ngstarter-ui/components/upload';
|
|
6
|
+
import { ImageResizer, ImageResizerImageDirective } from '@ngstarter-ui/components/image-resizer';
|
|
7
|
+
import { FormField, Label } from '@ngstarter-ui/components/form-field';
|
|
8
|
+
import { Input } from '@ngstarter-ui/components/input';
|
|
9
|
+
import * as i1 from '@angular/forms';
|
|
10
|
+
import { FormsModule } from '@angular/forms';
|
|
11
|
+
|
|
12
|
+
class ImageBlockComponent extends ContentEditorUploadBlockBase {
|
|
13
|
+
_src = signal('', /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "_src" }] : /* istanbul ignore next */ []));
|
|
15
|
+
_alt = model('', /* @ts-ignore */
|
|
16
|
+
...(ngDevMode ? [{ debugName: "_alt" }] : /* istanbul ignore next */ []));
|
|
17
|
+
_settings = model({}, /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "_settings" }] : /* istanbul ignore next */ []));
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
effect(() => {
|
|
22
|
+
const content = this.content();
|
|
23
|
+
const settings = this.settings();
|
|
24
|
+
untracked(() => {
|
|
25
|
+
this._src.set(content.src);
|
|
26
|
+
this._alt.set(content.alt);
|
|
27
|
+
this._settings.set({ ...settings });
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
ngOnInit() {
|
|
32
|
+
this._src.set(this.content().src);
|
|
33
|
+
this._alt.set(this.content().alt);
|
|
34
|
+
this._settings.set(this.settings() || {});
|
|
35
|
+
}
|
|
36
|
+
focus() {
|
|
37
|
+
if (this._src()) {
|
|
38
|
+
this.builder.focusBlock(this.id());
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
getData() {
|
|
42
|
+
return {
|
|
43
|
+
content: {
|
|
44
|
+
src: this._src(),
|
|
45
|
+
alt: this._alt()
|
|
46
|
+
},
|
|
47
|
+
settings: {
|
|
48
|
+
...this._settings(),
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
isEmpty() {
|
|
53
|
+
const src = this.getData().content.src;
|
|
54
|
+
return typeof src === 'string' ? src.trim().length === 0 : !src;
|
|
55
|
+
}
|
|
56
|
+
onFileSelected(event) {
|
|
57
|
+
return this.uploadFiles('image', { files: event.files.slice(0, 1), accept: file => file.type.startsWith('image/'), apply: results => {
|
|
58
|
+
this._src.set(results[0].url);
|
|
59
|
+
this.update();
|
|
60
|
+
} });
|
|
61
|
+
}
|
|
62
|
+
_onAltChange() {
|
|
63
|
+
this.update();
|
|
64
|
+
}
|
|
65
|
+
_onImageResized(options) {
|
|
66
|
+
this._settings.set(options);
|
|
67
|
+
this.update();
|
|
68
|
+
}
|
|
69
|
+
handleKeyPress(event) {
|
|
70
|
+
if (event.key === 'Enter') {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
event.stopPropagation();
|
|
73
|
+
this.builder.insertEmptyBlock(this.index());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
update() {
|
|
77
|
+
this.store.updateBlock(this.id(), { ...this.getData(), isEmpty: this.isEmpty() });
|
|
78
|
+
this.builder.emitContentChangeEvent();
|
|
79
|
+
}
|
|
80
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ImageBlockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
81
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ImageBlockComponent, isStandalone: true, selector: "ngs-image-block", inputs: { _alt: { classPropertyName: "_alt", publicName: "_alt", isSignal: true, isRequired: false, transformFunction: null }, _settings: { classPropertyName: "_settings", publicName: "_settings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { _alt: "_altChange", _settings: "_settingsChange" }, host: { listeners: { "keypress": "handleKeyPress($event)" } }, providers: [
|
|
82
|
+
{
|
|
83
|
+
provide: CONTENT_EDITOR_BLOCK,
|
|
84
|
+
useExisting: forwardRef(() => ImageBlockComponent),
|
|
85
|
+
multi: true
|
|
86
|
+
}
|
|
87
|
+
], usesInheritance: true, ngImport: i0, template: "<ngs-content-editor-upload-status [task]=\"uploadTask\"/>\n@if (_src()) {\n <div class=\"uploaded-image\">\n <ngs-image-resizer (imageResized)=\"_onImageResized($event)\" [imageMaxWidth]=\"704\">\n <img [src]=\"_src()\" [alt]=\"_alt()\" ngsImageResizerImage [style.width.px]=\"_settings().width || null\">\n </ngs-image-resizer>\n </div>\n <ngs-form-field class=\"w-full mt-5\">\n <ngs-label>Alt text</ngs-label>\n <input ngsInput [(ngModel)]=\"_alt\" (ngModelChange)=\"_onAltChange()\">\n </ngs-form-field>\n} @else if (!uploading()) {\n <ngs-upload-area #uploadArea=\"ngsUploadArea\"\n ngsUploadTrigger accept=\"image/*\"\n (fileSelected)=\"onFileSelected($event)\"\n multiple=\"false\" class=\"upload-area\">\n @if (!uploadArea.api.isDropActive) {\n Drag & drop image here or click to upload\n } @else {\n <div class=\"font-medium\">Drop image here</div>\n }\n </ngs-upload-area>\n}\n", styles: ["@layer properties;:host{display:block;min-width:0}:host ngs-upload-area{--ngs-upload-area-padding: calc(var(--spacing, .25rem) * 6) calc(var(--spacing, .25rem) * 10)}:host img{max-width:100%}:host .upload-container{position:relative}:host .upload-overlay{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:#fffc}:host .progress-bar{position:absolute;inset-inline-start:calc(var(--spacing, .25rem) * 0);inset-inline-end:calc(var(--spacing, .25rem) * 0);top:0}:host .uploaded-image{display:flex;width:100%;max-width:704px;align-items:center;justify-content:center}:host .upload-overlay-text{background:#fff;border-radius:var(--radius-lg, .5rem);padding-inline:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 1.5);font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)))}:host .remove-button{position:absolute;inset-inline-end:calc(var(--spacing, .25rem) * 2);top:calc(var(--spacing, .25rem) * 4);z-index:1;width:max-content}:host .upload-area{cursor:pointer}:host .upload-area:hover{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--ngs-color-primary)}@property --tw-outline-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-outline-style: solid}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: ContentEditorUploadStatus, selector: "ngs-content-editor-upload-status", inputs: ["task"] }, { kind: "component", type: UploadArea, selector: "ngs-upload-area", inputs: ["accept", "allowHover", "multiple"], outputs: ["fileSelected"], exportAs: ["ngsUploadArea"] }, { kind: "directive", type: UploadTriggerDirective, selector: "[ngsUploadTrigger]", inputs: ["accept", "multiple"], outputs: ["fileSelected"], exportAs: ["ngsUploadTrigger"] }, { kind: "component", type: ImageResizer, selector: "ngs-image-resizer", inputs: ["imageMaxWidth", "imageMinWidth"], outputs: ["imageResized"], exportAs: ["ngsImageResizer"] }, { kind: "component", type: FormField, selector: "ngs-form-field", inputs: ["labelMode", "subscriptHiddenIfEmpty", "sameHeightAsButton"], exportAs: ["ngsFormField"] }, { kind: "directive", type: Input, selector: "input[ngsInput], textarea[ngsInput]", inputs: ["id", "placeholder", "required", "disabled", "readonly", "errorStateMatcher"], exportAs: ["ngsInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ImageResizerImageDirective, selector: "[ngsImageResizerImage]", exportAs: ["ngsImageResizerImage"] }, { kind: "component", type: Label, selector: "ngs-label" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
88
|
+
}
|
|
89
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ImageBlockComponent, decorators: [{
|
|
90
|
+
type: Component,
|
|
91
|
+
args: [{ selector: 'ngs-image-block', imports: [
|
|
92
|
+
ContentEditorUploadStatus,
|
|
93
|
+
UploadArea,
|
|
94
|
+
UploadTriggerDirective,
|
|
95
|
+
ImageResizer,
|
|
96
|
+
FormField,
|
|
97
|
+
Input,
|
|
98
|
+
FormsModule,
|
|
99
|
+
ImageResizerImageDirective,
|
|
100
|
+
Label
|
|
101
|
+
], providers: [
|
|
102
|
+
{
|
|
103
|
+
provide: CONTENT_EDITOR_BLOCK,
|
|
104
|
+
useExisting: forwardRef(() => ImageBlockComponent),
|
|
105
|
+
multi: true
|
|
106
|
+
}
|
|
107
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
108
|
+
'(keypress)': 'handleKeyPress($event)',
|
|
109
|
+
}, template: "<ngs-content-editor-upload-status [task]=\"uploadTask\"/>\n@if (_src()) {\n <div class=\"uploaded-image\">\n <ngs-image-resizer (imageResized)=\"_onImageResized($event)\" [imageMaxWidth]=\"704\">\n <img [src]=\"_src()\" [alt]=\"_alt()\" ngsImageResizerImage [style.width.px]=\"_settings().width || null\">\n </ngs-image-resizer>\n </div>\n <ngs-form-field class=\"w-full mt-5\">\n <ngs-label>Alt text</ngs-label>\n <input ngsInput [(ngModel)]=\"_alt\" (ngModelChange)=\"_onAltChange()\">\n </ngs-form-field>\n} @else if (!uploading()) {\n <ngs-upload-area #uploadArea=\"ngsUploadArea\"\n ngsUploadTrigger accept=\"image/*\"\n (fileSelected)=\"onFileSelected($event)\"\n multiple=\"false\" class=\"upload-area\">\n @if (!uploadArea.api.isDropActive) {\n Drag & drop image here or click to upload\n } @else {\n <div class=\"font-medium\">Drop image here</div>\n }\n </ngs-upload-area>\n}\n", styles: ["@layer properties;:host{display:block;min-width:0}:host ngs-upload-area{--ngs-upload-area-padding: calc(var(--spacing, .25rem) * 6) calc(var(--spacing, .25rem) * 10)}:host img{max-width:100%}:host .upload-container{position:relative}:host .upload-overlay{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:#fffc}:host .progress-bar{position:absolute;inset-inline-start:calc(var(--spacing, .25rem) * 0);inset-inline-end:calc(var(--spacing, .25rem) * 0);top:0}:host .uploaded-image{display:flex;width:100%;max-width:704px;align-items:center;justify-content:center}:host .upload-overlay-text{background:#fff;border-radius:var(--radius-lg, .5rem);padding-inline:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 1.5);font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)))}:host .remove-button{position:absolute;inset-inline-end:calc(var(--spacing, .25rem) * 2);top:calc(var(--spacing, .25rem) * 4);z-index:1;width:max-content}:host .upload-area{cursor:pointer}:host .upload-area:hover{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--ngs-color-primary)}@property --tw-outline-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-outline-style: solid}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
110
|
+
}], ctorParameters: () => [], propDecorators: { _alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "_alt", required: false }] }, { type: i0.Output, args: ["_altChange"] }], _settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "_settings", required: false }] }, { type: i0.Output, args: ["_settingsChange"] }] } });
|
|
111
|
+
|
|
112
|
+
export { ImageBlockComponent };
|
|
113
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-image-block.component-DSpBVTu-.mjs.map
|
package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-DSpBVTu-.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-image-block.component-DSpBVTu-.mjs","sources":["../../../projects/components/content-editor/src/_builder/image-block/image-block.component.ts","../../../projects/components/content-editor/src/_builder/image-block/image-block.component.html"],"sourcesContent":["import { ContentEditorUploadBlockBase } from '../upload-block-base';\nimport { ContentEditorUploadStatus } from '../upload-status/upload-status';\nimport { ChangeDetectionStrategy, Component, effect, untracked, forwardRef, model, OnInit, signal } from '@angular/core';\nimport { UploadArea, UploadFileSelectedEvent, UploadTriggerDirective } from '@ngstarter-ui/components/upload';\nimport {\n CONTENT_EDITOR_BLOCK,\n ContentEditorImageBlockSettings,\n ContentEditorImageContent\n} from '../../types';\nimport { ImageResizer, ImageResizerImageDirective } from '@ngstarter-ui/components/image-resizer';\nimport { FormField, Label } from '@ngstarter-ui/components/form-field';\nimport { Input } from '@ngstarter-ui/components/input';\nimport { FormsModule } from '@angular/forms';\n\n@Component({\n selector: 'ngs-image-block',\n imports: [\n ContentEditorUploadStatus,\n UploadArea,\n UploadTriggerDirective,\n ImageResizer,\n FormField,\n Input,\n FormsModule,\n ImageResizerImageDirective,\n Label\n ],\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: forwardRef(() => ImageBlockComponent),\n multi: true\n }\n ],\n templateUrl: './image-block.component.html',\n styleUrl: './image-block.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '(keypress)': 'handleKeyPress($event)',\n }\n})\nexport class ImageBlockComponent extends ContentEditorUploadBlockBase<ContentEditorImageContent, ContentEditorImageBlockSettings> implements OnInit {\n\n protected _src = signal<string>('');\n protected _alt = model<string>('');\n protected _settings = model<ContentEditorImageBlockSettings>({});\n\n constructor() {\n super();\n effect(() => {\n const content = this.content();\n const settings = this.settings();\n untracked(() => {\n this._src.set(content.src);\n this._alt.set(content.alt);\n this._settings.set({ ...settings });\n });\n });\n }\n\n ngOnInit() {\n this._src.set(this.content().src);\n this._alt.set(this.content().alt);\n this._settings.set(this.settings() || {});\n }\n\n override focus() {\n if (this._src()) {\n this.builder.focusBlock(this.id());\n }\n }\n\n override getData(): any {\n return {\n content: {\n src: this._src(),\n alt: this._alt()\n },\n settings: {\n ...this._settings(),\n }\n };\n }\n\n override isEmpty(): boolean {\n const src = this.getData().content.src;\n return typeof src === 'string' ? src.trim().length === 0 : !src;\n }\n\n protected onFileSelected(event: UploadFileSelectedEvent): Promise<void> {\n return this.uploadFiles('image', { files: event.files.slice(0, 1), accept: file => file.type.startsWith('image/'), apply: results => {\n this._src.set(results[0].url);\n this.update();\n } });\n }\n\n protected _onAltChange() {\n this.update();\n }\n\n protected _onImageResized(options: any) {\n this._settings.set(options);\n this.update();\n }\n\n protected handleKeyPress(event: KeyboardEvent) {\n if (event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n this.builder.insertEmptyBlock(this.index());\n }\n }\n\n private update() {\n this.store.updateBlock(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this.builder.emitContentChangeEvent();\n }\n}\n","<ngs-content-editor-upload-status [task]=\"uploadTask\"/>\n@if (_src()) {\n <div class=\"uploaded-image\">\n <ngs-image-resizer (imageResized)=\"_onImageResized($event)\" [imageMaxWidth]=\"704\">\n <img [src]=\"_src()\" [alt]=\"_alt()\" ngsImageResizerImage [style.width.px]=\"_settings().width || null\">\n </ngs-image-resizer>\n </div>\n <ngs-form-field class=\"w-full mt-5\">\n <ngs-label>Alt text</ngs-label>\n <input ngsInput [(ngModel)]=\"_alt\" (ngModelChange)=\"_onAltChange()\">\n </ngs-form-field>\n} @else if (!uploading()) {\n <ngs-upload-area #uploadArea=\"ngsUploadArea\"\n ngsUploadTrigger accept=\"image/*\"\n (fileSelected)=\"onFileSelected($event)\"\n multiple=\"false\" class=\"upload-area\">\n @if (!uploadArea.api.isDropActive) {\n Drag & drop image here or click to upload\n } @else {\n <div class=\"font-medium\">Drop image here</div>\n }\n </ngs-upload-area>\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAyCM,MAAO,mBAAoB,SAAQ,4BAAwF,CAAA;IAErH,IAAI,GAAG,MAAM,CAAS,EAAE;6EAAC;IACzB,IAAI,GAAG,KAAK,CAAS,EAAE;6EAAC;IACxB,SAAS,GAAG,KAAK,CAAkC,EAAE;kFAAC;AAEhE,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;QACP,MAAM,CAAC,MAAK;AACV,YAAA,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE;AAC9B,YAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE;YAChC,SAAS,CAAC,MAAK;gBACb,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;gBAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;gBAC1B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC;AACrC,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;IACJ;IAEA,QAAQ,GAAA;AACN,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC;AACjC,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC;AACjC,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C;IAES,KAAK,GAAA;AACZ,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE;YACf,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACpC;IACF;IAES,OAAO,GA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EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,qDAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,UAAA,EAAA,SAAA,EAAA,gBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACX,0BAA0B,uGAC1B,KAAK,EAAA,QAAA,EAAA,WAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAgBI,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBA3B/B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,OAAA,EAClB;wBACP,yBAAyB;wBACzB,UAAU;wBACV,sBAAsB;wBACtB,YAAY;wBACZ,SAAS;wBACT,KAAK;wBACL,WAAW;wBACX,0BAA0B;wBAC1B;qBACD,EAAA,SAAA,EACU;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,oBAAoB;AAC7B,4BAAA,WAAW,EAAE,UAAU,CAAC,yBAAyB,CAAC;AAClD,4BAAA,KAAK,EAAE;AACR;qBACF,EAAA,eAAA,EAGgB,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,YAAY,EAAE,wBAAwB;AACvC,qBAAA,EAAA,QAAA,EAAA,y9BAAA,EAAA,MAAA,EAAA,CAAA,oiDAAA,CAAA,EAAA;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ContentBuilderStore, a as CONTENT_BUILDER, c as cloneContentEditorValue, b as contentEditorText, d as ContentEditorContentEditableDirective, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor
|
|
1
|
+
import { C as ContentBuilderStore, a as CONTENT_BUILDER, c as cloneContentEditorValue, b as contentEditorText, d as ContentEditorContentEditableDirective, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, PLATFORM_ID, ElementRef, input, output, Directive, signal, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
4
|
import { isPlatformServer, NgTemplateOutlet } from '@angular/common';
|
|
@@ -232,4 +232,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
232
232
|
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: true }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
|
|
233
233
|
|
|
234
234
|
export { ListBlockComponent };
|
|
235
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-list-block.component-
|
|
235
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-list-block.component-BPKPE1uY.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-content-editor-list-block.component-6SMBxIl4.mjs","sources":["../../../projects/components/content-editor/src/content-observer.directive.ts","../../../projects/components/content-editor/src/_builder/list-block/list-block.component.ts","../../../projects/components/content-editor/src/_builder/list-block/list-block.component.html"],"sourcesContent":["import { Directive, ElementRef, inject, input, OnDestroy, OnInit, output, PLATFORM_ID } from '@angular/core';\nimport { isPlatformServer } from '@angular/common';\n\n@Directive({\n selector: '[ngsContentObserver]'\n})\nexport class ContentObserverDirective implements OnInit, OnDestroy {\n private _platformId = inject(PLATFORM_ID);\n private _elementRef = inject(ElementRef);\n private _observer!: MutationObserver;\n\n detectAddedNode = input.required();\n\n readonly nodeAdded = output<HTMLElement>();\n\n ngOnInit() {\n if (isPlatformServer(this._platformId)) {\n return;\n }\n\n const config = { attributes: false, childList: true, subtree: false };\n const callback = (mutationList: any, observer: any) => {\n for (const mutation of mutationList) {\n if (mutation.type === 'childList') {\n const addedNode = mutation.addedNodes[0];\n\n if (addedNode && addedNode.tagName && addedNode.classList.contains(this.detectAddedNode())) {\n this.nodeAdded.emit(addedNode);\n }\n }\n }\n };\n this._observer = new MutationObserver(callback);\n this._observer.observe(this._elementRef.nativeElement, config);\n }\n\n ngOnDestroy() {\n this._observer?.disconnect();\n }\n}\n","import { NgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { contentEditorText, cloneContentEditorValue } from '../../document';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component, effect, untracked,\n DestroyRef,\n ElementRef,\n inject,\n input,\n OnInit,\n signal\n} from '@angular/core';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport {\n CONTENT_BUILDER, CONTENT_EDITOR_BLOCK,\n ContentEditorDataBlock,\n ContentEditorItemProperty,\n ContentEditorListItem,\n ContentEditorListSettings\n} from '../../types';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { ContentObserverDirective } from '../../content-observer.directive';\nimport { CursorController } from '../../utils/cursor-controller';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\n\n@Component({\n selector: 'ngs-list-block',\n exportAs: 'ngsListBlock',\n imports: [\n ContentEditorContentEditableDirective,\n NgTemplateOutlet,\n ContentObserverDirective\n ],\n templateUrl: './list-block.component.html',\n styleUrl: './list-block.component.scss',\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: ListBlockComponent,\n multi: true\n }\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.list-bullet]': \"_listStyle() === 'bullet'\",\n '[class.list-ordered]': \"_listStyle() === 'ordered'\",\n }\n})\nexport class ListBlockComponent implements OnInit, ContentEditorDataBlock, AfterViewInit {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n\n id = input.required<string>();\n content = input.required<ContentEditorListItem[]>();\n settings = input.required<ContentEditorListSettings>();\n index = input.required<number>();\n props = input<ContentEditorItemProperty[]>([]);\n\n protected _placeholder = signal<string>('List item');\n protected _content = signal<ContentEditorListItem[]>([\n {\n content: [],\n props: [],\n children: []\n }\n ]);\n protected _listStyle = signal('');\n readonly initialized = signal(false);\n\n constructor() {\n effect(() => {\n const content = this.content();\n const settings = this.settings();\n untracked(() => {\n this._content.set(cloneContentEditorValue(content.length ? content : [{ content: [], props: [], children: [] }]));\n this._listStyle.set(settings.listStyle);\n });\n });\n }\n\n ngOnInit() {\n this._listStyle.set(this.settings().listStyle);\n\n if (this.content().length !== 0) {\n this._content.set(cloneContentEditorValue(this.content()));\n }\n }\n\n ngAfterViewInit() {\n this.initialized.set(true);\n }\n\n focus() {\n }\n\n protected onContentChanged(content: readonly NgsHeadlessEditorText[], list: ContentEditorListItem[], index: number) {\n if (!list[index]) {\n return;\n }\n\n list[index].content = content;\n this.update();\n }\n\n protected onPressedEnter(\n event: KeyboardEvent,\n contentEditable: ContentEditorContentEditableDirective,\n list: ContentEditorListItem[],\n index: number,\n level: number,\n parentItem: ContentEditorListItem | null,\n parentList: ContentEditorListItem[]\n ) {\n event.preventDefault();\n event.stopPropagation();\n\n if (level === 0) {\n const content = contentEditable.getContent();\n\n if (contentEditorText(content)) {\n list.splice(index + 1, 0, {\n content: [],\n props: [],\n styles: {},\n children: []\n });\n } else {\n list.splice(index, 1);\n\n if (list.length === 0) {\n this._contentBuilder.deleteBlock(this.id());\n }\n\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n } else {\n if (list[index] && !contentEditorText(list[index].content)) {\n list.splice(index, 1);\n const parentIndex = parentList.findIndex(item => item === parentItem);\n parentList.splice(parentIndex + 1, 0, {\n content: [],\n props: [],\n children: []\n });\n } else {\n list.splice(index + 1, 0, {\n content: [],\n props: [],\n styles: {},\n children: []\n });\n }\n }\n\n this.update();\n }\n\n getId(level: number, index: number): string {\n return 'item-level-' + (level + index + 2).toString();\n }\n\n getData(): any {\n return {\n content: this._content(),\n settings: {\n ...this.settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n return !this._content().some(item => contentEditorText(item.content).trim() || item.children.length > 0);\n }\n\n protected _onNodeAdded(node: HTMLElement) {\n this._focusItem(node.querySelector('.list-item-content') as HTMLElement);\n }\n\n protected _focusItem(element: HTMLElement) {\n const cursorController = new CursorController(element);\n cursorController.setToEnd();\n }\n\n protected _onKeyDown(\n event: KeyboardEvent,\n contentEditable: ContentEditorContentEditableDirective,\n list: ContentEditorListItem[],\n index: number,\n level: number,\n parentItem: ContentEditorListItem | null,\n parentList: ContentEditorListItem[],\n listItem: HTMLElement\n ) {\n if (event.key === 'Backspace' && !contentEditorText(contentEditable.getContent())) {\n const latestElementInParentList = (listItem.closest('.list') as HTMLElement)?.parentNode;\n list.splice(index, 1);\n const prevElement = listItem.previousSibling as HTMLElement;\n\n if (prevElement) {\n this._focusItem(prevElement.querySelector('.list-item-content') as HTMLElement);\n } else {\n if (latestElementInParentList) {\n this._focusItem(latestElementInParentList.querySelector('.list-item-content') as HTMLElement);\n }\n }\n } else if (event.key === 'Tab') {\n event.preventDefault();\n event.stopPropagation();\n\n if (event.shiftKey && parentItem) {\n const cached = JSON.parse(JSON.stringify(list[index]));\n list.splice(index, 1);\n const parentIndex = parentList.findIndex(item => item === parentItem);\n parentList.splice(parentIndex + 1, 0, cached);\n } else {\n if (list[index - 1]) {\n const cached = JSON.parse(JSON.stringify(list[index]));\n list.splice(index, 1);\n list[index - 1].children.push(cached);\n }\n }\n }\n\n if (level === 0 && list.length === 0) {\n this._contentBuilder.deleteBlock(this.id());\n }\n\n this.update();\n }\n\n onPropsChanged(props: ContentEditorItemProperty[], item: any) {\n item.props = props;\n this.update();\n }\n\n private update() {\n this._store.updateBlock(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","<ul class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: _content(), level: 0, parentItem: null, parentList: [] }\"/>\n</ul>\n\n<ng-template #listTpl let-list let-level=\"level\" let-parentItem=\"parentItem\" let-parentList=\"parentList\">\n @for (item of list; track $index; let index = $index) {\n <li #listItem class=\"list-item\" [attr.id]=\"getId(level, index)\">\n <div [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"item.content\"\n [props]=\"item.props\"\n (propsChanged)=\"onPropsChanged($event, item)\"\n #contentEditable=\"ngsContentEditorContentEditable\"\n class=\"list-item-content\"\n (contentChanged)=\"onContentChanged($event, list, index)\"\n (pressedEnter)=\"onPressedEnter($event, contentEditable, list, index, level, parentItem, parentList)\"\n (keydown)=\"_onKeyDown($event, contentEditable, list, index, level, parentItem, parentList, listItem)\"\n [attr.data-empty-placeholder]=\"_placeholder()\"></div>\n @if (item.children.length > 0) {\n <ol class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: item.children, level: level + 1, parentItem: item, parentList: list }\"/>\n </ol>\n }\n </li>\n }\n</ng-template>\n"],"names":[],"mappings":";;;;;;MAMa,wBAAwB,CAAA;AAC3B,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AACjC,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,SAAS;IAEjB,eAAe,GAAG,KAAK,CAAC,QAAQ;wFAAE;IAEzB,SAAS,GAAG,MAAM,EAAe;IAE1C,QAAQ,GAAA;AACN,QAAA,IAA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J,wBAAA,qBAAqB,EAAE,2BAA2B;AAClD,wBAAA,sBAAsB,EAAE,4BAA4B;AACrD,qBAAA,EAAA,QAAA,EAAA,2nDAAA,EAAA,MAAA,EAAA,CAAA,koBAAA,CAAA,EAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-list-block.component-BPKPE1uY.mjs","sources":["../../../projects/components/content-editor/src/content-observer.directive.ts","../../../projects/components/content-editor/src/_builder/list-block/list-block.component.ts","../../../projects/components/content-editor/src/_builder/list-block/list-block.component.html"],"sourcesContent":["import { Directive, ElementRef, inject, input, OnDestroy, OnInit, output, PLATFORM_ID } from '@angular/core';\nimport { isPlatformServer } from '@angular/common';\n\n@Directive({\n selector: '[ngsContentObserver]'\n})\nexport class ContentObserverDirective implements OnInit, OnDestroy {\n private _platformId = inject(PLATFORM_ID);\n private _elementRef = inject(ElementRef);\n private _observer!: MutationObserver;\n\n detectAddedNode = input.required();\n\n readonly nodeAdded = output<HTMLElement>();\n\n ngOnInit() {\n if (isPlatformServer(this._platformId)) {\n return;\n }\n\n const config = { attributes: false, childList: true, subtree: false };\n const callback = (mutationList: any, observer: any) => {\n for (const mutation of mutationList) {\n if (mutation.type === 'childList') {\n const addedNode = mutation.addedNodes[0];\n\n if (addedNode && addedNode.tagName && addedNode.classList.contains(this.detectAddedNode())) {\n this.nodeAdded.emit(addedNode);\n }\n }\n }\n };\n this._observer = new MutationObserver(callback);\n this._observer.observe(this._elementRef.nativeElement, config);\n }\n\n ngOnDestroy() {\n this._observer?.disconnect();\n }\n}\n","import { NgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { contentEditorText, cloneContentEditorValue } from '../../document';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component, effect, untracked,\n DestroyRef,\n ElementRef,\n inject,\n input,\n OnInit,\n signal\n} from '@angular/core';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport {\n CONTENT_BUILDER, CONTENT_EDITOR_BLOCK,\n ContentEditorDataBlock,\n ContentEditorItemProperty,\n ContentEditorListItem,\n ContentEditorListSettings\n} from '../../types';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { ContentObserverDirective } from '../../content-observer.directive';\nimport { CursorController } from '../../utils/cursor-controller';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\n\n@Component({\n selector: 'ngs-list-block',\n exportAs: 'ngsListBlock',\n imports: [\n ContentEditorContentEditableDirective,\n NgTemplateOutlet,\n ContentObserverDirective\n ],\n templateUrl: './list-block.component.html',\n styleUrl: './list-block.component.scss',\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: ListBlockComponent,\n multi: true\n }\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.list-bullet]': \"_listStyle() === 'bullet'\",\n '[class.list-ordered]': \"_listStyle() === 'ordered'\",\n }\n})\nexport class ListBlockComponent implements OnInit, ContentEditorDataBlock, AfterViewInit {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n\n id = input.required<string>();\n content = input.required<ContentEditorListItem[]>();\n settings = input.required<ContentEditorListSettings>();\n index = input.required<number>();\n props = input<ContentEditorItemProperty[]>([]);\n\n protected _placeholder = signal<string>('List item');\n protected _content = signal<ContentEditorListItem[]>([\n {\n content: [],\n props: [],\n children: []\n }\n ]);\n protected _listStyle = signal('');\n readonly initialized = signal(false);\n\n constructor() {\n effect(() => {\n const content = this.content();\n const settings = this.settings();\n untracked(() => {\n this._content.set(cloneContentEditorValue(content.length ? content : [{ content: [], props: [], children: [] }]));\n this._listStyle.set(settings.listStyle);\n });\n });\n }\n\n ngOnInit() {\n this._listStyle.set(this.settings().listStyle);\n\n if (this.content().length !== 0) {\n this._content.set(cloneContentEditorValue(this.content()));\n }\n }\n\n ngAfterViewInit() {\n this.initialized.set(true);\n }\n\n focus() {\n }\n\n protected onContentChanged(content: readonly NgsHeadlessEditorText[], list: ContentEditorListItem[], index: number) {\n if (!list[index]) {\n return;\n }\n\n list[index].content = content;\n this.update();\n }\n\n protected onPressedEnter(\n event: KeyboardEvent,\n contentEditable: ContentEditorContentEditableDirective,\n list: ContentEditorListItem[],\n index: number,\n level: number,\n parentItem: ContentEditorListItem | null,\n parentList: ContentEditorListItem[]\n ) {\n event.preventDefault();\n event.stopPropagation();\n\n if (level === 0) {\n const content = contentEditable.getContent();\n\n if (contentEditorText(content)) {\n list.splice(index + 1, 0, {\n content: [],\n props: [],\n styles: {},\n children: []\n });\n } else {\n list.splice(index, 1);\n\n if (list.length === 0) {\n this._contentBuilder.deleteBlock(this.id());\n }\n\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n } else {\n if (list[index] && !contentEditorText(list[index].content)) {\n list.splice(index, 1);\n const parentIndex = parentList.findIndex(item => item === parentItem);\n parentList.splice(parentIndex + 1, 0, {\n content: [],\n props: [],\n children: []\n });\n } else {\n list.splice(index + 1, 0, {\n content: [],\n props: [],\n styles: {},\n children: []\n });\n }\n }\n\n this.update();\n }\n\n getId(level: number, index: number): string {\n return 'item-level-' + (level + index + 2).toString();\n }\n\n getData(): any {\n return {\n content: this._content(),\n settings: {\n ...this.settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n return !this._content().some(item => contentEditorText(item.content).trim() || item.children.length > 0);\n }\n\n protected _onNodeAdded(node: HTMLElement) {\n this._focusItem(node.querySelector('.list-item-content') as HTMLElement);\n }\n\n protected _focusItem(element: HTMLElement) {\n const cursorController = new CursorController(element);\n cursorController.setToEnd();\n }\n\n protected _onKeyDown(\n event: KeyboardEvent,\n contentEditable: ContentEditorContentEditableDirective,\n list: ContentEditorListItem[],\n index: number,\n level: number,\n parentItem: ContentEditorListItem | null,\n parentList: ContentEditorListItem[],\n listItem: HTMLElement\n ) {\n if (event.key === 'Backspace' && !contentEditorText(contentEditable.getContent())) {\n const latestElementInParentList = (listItem.closest('.list') as HTMLElement)?.parentNode;\n list.splice(index, 1);\n const prevElement = listItem.previousSibling as HTMLElement;\n\n if (prevElement) {\n this._focusItem(prevElement.querySelector('.list-item-content') as HTMLElement);\n } else {\n if (latestElementInParentList) {\n this._focusItem(latestElementInParentList.querySelector('.list-item-content') as HTMLElement);\n }\n }\n } else if (event.key === 'Tab') {\n event.preventDefault();\n event.stopPropagation();\n\n if (event.shiftKey && parentItem) {\n const cached = JSON.parse(JSON.stringify(list[index]));\n list.splice(index, 1);\n const parentIndex = parentList.findIndex(item => item === parentItem);\n parentList.splice(parentIndex + 1, 0, cached);\n } else {\n if (list[index - 1]) {\n const cached = JSON.parse(JSON.stringify(list[index]));\n list.splice(index, 1);\n list[index - 1].children.push(cached);\n }\n }\n }\n\n if (level === 0 && list.length === 0) {\n this._contentBuilder.deleteBlock(this.id());\n }\n\n this.update();\n }\n\n onPropsChanged(props: ContentEditorItemProperty[], item: any) {\n item.props = props;\n this.update();\n }\n\n private update() {\n this._store.updateBlock(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","<ul class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: _content(), level: 0, parentItem: null, parentList: [] }\"/>\n</ul>\n\n<ng-template #listTpl let-list let-level=\"level\" let-parentItem=\"parentItem\" let-parentList=\"parentList\">\n @for (item of list; track $index; let index = $index) {\n <li #listItem class=\"list-item\" [attr.id]=\"getId(level, index)\">\n <div [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"item.content\"\n [props]=\"item.props\"\n (propsChanged)=\"onPropsChanged($event, item)\"\n #contentEditable=\"ngsContentEditorContentEditable\"\n class=\"list-item-content\"\n (contentChanged)=\"onContentChanged($event, list, index)\"\n (pressedEnter)=\"onPressedEnter($event, contentEditable, list, index, level, parentItem, parentList)\"\n (keydown)=\"_onKeyDown($event, contentEditable, list, index, level, parentItem, parentList, listItem)\"\n [attr.data-empty-placeholder]=\"_placeholder()\"></div>\n @if (item.children.length > 0) {\n <ol class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: item.children, level: level + 1, parentItem: item, parentList: list }\"/>\n </ol>\n }\n </li>\n }\n</ng-template>\n"],"names":[],"mappings":";;;;;;MAMa,wBAAwB,CAAA;AAC3B,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AACjC,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,SAAS;IAEjB,eAAe,GAAG,KAAK,CAAC,QAAQ;wFAAE;IAEzB,SAAS,GAAG,MAAM,EAAe;IAE1C,QAAQ,GAAA;AACN,QAAA,IAAI,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YACtC;QACF;AAEA,QAAA,MAAM,MAAM,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;AACrE,QAAA,MAAM,QAAQ,GAAG,CAAC,YAAiB,EAAE,QAAa,KAAI;AACpD,YAAA,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE;AACnC,gBAAA,IAAI,QAAQ,CAAC,IAAI,KAAK,WAAW,EAAE;oBACjC,MAAM,SAAS,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;AAExC,oBAAA,IAAI,SAAS,IAAI,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE;AAC1F,wBAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC;oBAChC;gBACF;YACF;AACF,QAAA,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,IAAI,gB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,WAAA,EAAA,IAAA,EACrC,gBAAgB,oJAChB,wBAAwB,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,WAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAiBf,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAvB9B,SAAS;+BACE,gBAAgB,EAAA,QAAA,EAChB,cAAc,EAAA,OAAA,EACf;wBACP,qCAAqC;wBACrC,gBAAgB;wBAChB;qBACD,EAAA,SAAA,EAGU;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,oBAAoB;AAC7B,4BAAA,WAAW,EAAA,kBAAoB;AAC/B,4BAAA,KAAK,EAAE;AACR;qBACF,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,qBAAqB,EAAE,2BAA2B;AAClD,wBAAA,sBAAsB,EAAE,4BAA4B;AACrD,qBAAA,EAAA,QAAA,EAAA,2nDAAA,EAAA,MAAA,EAAA,CAAA,koBAAA,CAAA,EAAA;;;;;"}
|
|
@@ -5,7 +5,7 @@ import { CdkDropList, CdkDrag, CdkDragHandle } from '@angular/cdk/drag-drop';
|
|
|
5
5
|
import { Button } from '@ngstarter-ui/components/button';
|
|
6
6
|
import { Icon } from '@ngstarter-ui/components/icon';
|
|
7
7
|
import { Menu, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';
|
|
8
|
-
import { a as CONTENT_BUILDER, C as ContentBuilderStore,
|
|
8
|
+
import { a as CONTENT_BUILDER, C as ContentBuilderStore, m as contentEditorCollection, n as contentEditorBlockView, c as cloneContentEditorValue, o as contentEditorChildCollections, k as findContentEditorBlock } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs';
|
|
9
9
|
import { createNgsHeadlessEditorId } from '@ngstarter-ui/components/headless-editor';
|
|
10
10
|
|
|
11
11
|
class ContentEditorNestedBlocks {
|
|
@@ -106,12 +106,12 @@ class ContentEditorNestedBlocks {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorNestedBlocks, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
109
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ContentEditorNestedBlocks, isStandalone: true, selector: "ngs-content-editor-nested-blocks", inputs: { scope: { classPropertyName: "scope", publicName: "scope", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "keydown": "onKeyDown($event)" } }, providers: [{ provide: CONTENT_BUILDER, useExisting: forwardRef(() => ContentEditorNestedBlocks) }], viewQueries: [{ propertyName: "dropList", first: true, predicate: CdkDropList, descendants: true, isSignal: true }], ngImport: i0, template: "<div cdkDropList [cdkDropListData]=\"scope()\" [cdkDropListConnectedTo]=\"connectedDropLists()\" [cdkDropListEnterPredicate]=\"canEnter\" (cdkDropListDropped)=\"drop($event)\" class=\"min-h-12\">\n @for (block of renderedBlocks(); track block.id) {\n <div cdkDrag [cdkDragData]=\"block.id\" (cdkDragStarted)=\"onDragStarted()\" (cdkDragEnded)=\"onDragEnded()\" class=\"nested-block relative min-w-0 py-2\" [attr.data-block-id]=\"block.id\">\n <div class=\"nested-controls block-controls absolute top-1/2 z-10 flex -translate-y-1/2 items-center\"\n [class.is-menu-open]=\"addTrigger.menuOpen() || actionsTrigger.menuOpen()\">\n <button ngsIconButton aria-label=\"Add block\" #addTrigger=\"ngsMenuTrigger\"\n [ngsMenuTriggerFor]=\"rootBuilder.blockMenu()\" [ngsMenuTriggerRestoreFocus]=\"false\"\n [ngsMenuTriggerData]=\"{target: {scope: scope(), afterId: block.id}}\">\n <ngs-icon name=\"fluent:add-24-regular\"/>\n </button>\n <button ngsIconButton cdkDragHandle [ngsMenuTriggerFor]=\"blockMenu\"\n #actionsTrigger=\"ngsMenuTrigger\" aria-label=\"Move block\"><ngs-icon name=\"fluent:re-order-dots-vertical-24-regular\"/></button>\n <ngs-menu #blockMenu>\n <button ngs-menu-item (click)=\"duplicateBlock(block.id)\">Duplicate</button>\n <button ngs-menu-item (click)=\"deleteBlock(block.id)\">Delete</button>\n </ngs-menu>\n </div>\n <div class=\"min-w-0\">\n <ng-container [ngComponentOutlet]=\"getBlockComponent(block.type) | async\"\n [ngComponentOutletInputs]=\"{id: block.id, content: block.content, settings: block.settings, props: block.props, index: $index}\"/>\n </div>\n </div>\n }\n</div>\n", styles: [":host{--ngs-content-editor-nested-controls-offset: 0px;display:block;min-width:0}:host .nested-controls{--ngs-button-height: calc(var(--spacing, .25rem) * 7);right:100%;width:calc(calc(var(--spacing, .25rem) * 18) + var(--ngs-content-editor-nested-controls-offset));padding-left:calc(var(--spacing, .25rem) * 2);padding-right:calc(calc(var(--spacing, .25rem) * 2) + var(--ngs-content-editor-nested-controls-offset));opacity:0;pointer-events:none}:host .nested-controls.is-menu-open{opacity:1;pointer-events:auto}:host .nested-block:hover .nested-controls,:host .nested-block:focus-within .nested-controls{opacity:1;pointer-events:auto}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "component", type: Button, selector: " button[ngsButton], button[ngsIconButton], a[ngsButton], a[ngsIconButton] ", inputs: ["ngsButton", "ngsIconButton", "loading", "disabled", "disabledInteractive", "disableRipple", "reverse", "fullWidth", "hideTextOnMobile"], exportAs: ["ngsButton"] }, { kind: "component", type: Icon, selector: "ngs-icon", inputs: ["name"], exportAs: ["ngsIcon"] }, { kind: "component", type: Menu, selector: "ngs-menu", inputs: ["role", "classList", "xPosition", "yPosition", "pushIntoViewport"], outputs: ["closed"], exportAs: ["ngsMenu"] }, { kind: "component", type: MenuItem, selector: "ngs-menu-item, [ngs-menu-item]", inputs: ["disabled", "role", "selected"], outputs: ["_triggered"], exportAs: ["ngsMenuItem"] }, { kind: "directive", type: MenuTrigger, selector: "[ngsMenuTriggerFor]", inputs: ["ngsMenuTriggerFor", "ngsMenuTriggerData", "ngsMenuDisabled", "xPosition", "yPosition", "ngsMenuTriggerRestoreFocus"], outputs: ["menuOpened", "menuClosed"], exportAs: ["ngsMenuTrigger"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
109
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ContentEditorNestedBlocks, isStandalone: true, selector: "ngs-content-editor-nested-blocks", inputs: { scope: { classPropertyName: "scope", publicName: "scope", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "keydown": "onKeyDown($event)" } }, providers: [{ provide: CONTENT_BUILDER, useExisting: forwardRef(() => ContentEditorNestedBlocks) }], viewQueries: [{ propertyName: "dropList", first: true, predicate: CdkDropList, descendants: true, isSignal: true }], ngImport: i0, template: "<div cdkDropList [cdkDropListData]=\"scope()\" [cdkDropListConnectedTo]=\"connectedDropLists()\" [cdkDropListEnterPredicate]=\"canEnter\" (cdkDropListDropped)=\"drop($event)\" class=\"min-h-12\">\n @for (block of renderedBlocks(); track block.id) {\n <div cdkDrag [cdkDragData]=\"block.id\" (cdkDragStarted)=\"onDragStarted()\" (cdkDragEnded)=\"onDragEnded()\" class=\"nested-block relative min-w-0 py-2\" [attr.data-block-id]=\"block.id\">\n <div class=\"nested-controls block-controls absolute top-1/2 z-10 flex -translate-y-1/2 items-center\"\n [class.is-menu-open]=\"addTrigger.menuOpen() || actionsTrigger.menuOpen()\">\n <button ngsIconButton aria-label=\"Add block\" #addTrigger=\"ngsMenuTrigger\"\n [ngsMenuTriggerFor]=\"rootBuilder.blockMenu()\" [ngsMenuTriggerRestoreFocus]=\"false\"\n [ngsMenuTriggerData]=\"{target: {scope: scope(), afterId: block.id}}\">\n <ngs-icon name=\"fluent:add-24-regular\"/>\n </button>\n <button ngsIconButton cdkDragHandle [ngsMenuTriggerFor]=\"blockMenu\"\n #actionsTrigger=\"ngsMenuTrigger\" aria-label=\"Move block\"><ngs-icon name=\"fluent:re-order-dots-vertical-24-regular\"/></button>\n <ngs-menu #blockMenu>\n @if (rootBuilder.canConvertBlock(block.id)) {\n <button ngs-menu-item [ngsMenuTriggerFor]=\"rootBuilder.conversionMenu()\" [ngsMenuTriggerData]=\"{blockId: block.id}\" [ngsMenuTriggerRestoreFocus]=\"false\">Turn into</button>\n }\n <button ngs-menu-item (click)=\"duplicateBlock(block.id)\">Duplicate</button>\n <button ngs-menu-item (click)=\"deleteBlock(block.id)\">Delete</button>\n </ngs-menu>\n </div>\n <div class=\"min-w-0\">\n <ng-container [ngComponentOutlet]=\"getBlockComponent(block.type) | async\"\n [ngComponentOutletInputs]=\"{id: block.id, content: block.content, settings: block.settings, props: block.props, index: $index}\"/>\n </div>\n </div>\n }\n</div>\n", styles: [":host{--ngs-content-editor-nested-controls-offset: 0px;display:block;min-width:0}:host .nested-controls{--ngs-button-height: calc(var(--spacing, .25rem) * 7);right:100%;width:calc(calc(var(--spacing, .25rem) * 18) + var(--ngs-content-editor-nested-controls-offset));padding-left:calc(var(--spacing, .25rem) * 2);padding-right:calc(calc(var(--spacing, .25rem) * 2) + var(--ngs-content-editor-nested-controls-offset));opacity:0;pointer-events:none}:host .nested-controls.is-menu-open{opacity:1;pointer-events:auto}:host .nested-block:hover .nested-controls,:host .nested-block:focus-within .nested-controls{opacity:1;pointer-events:auto}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "component", type: Button, selector: " button[ngsButton], button[ngsIconButton], a[ngsButton], a[ngsIconButton] ", inputs: ["ngsButton", "ngsIconButton", "loading", "disabled", "disabledInteractive", "disableRipple", "reverse", "fullWidth", "hideTextOnMobile"], exportAs: ["ngsButton"] }, { kind: "component", type: Icon, selector: "ngs-icon", inputs: ["name"], exportAs: ["ngsIcon"] }, { kind: "component", type: Menu, selector: "ngs-menu", inputs: ["role", "classList", "xPosition", "yPosition", "pushIntoViewport"], outputs: ["closed"], exportAs: ["ngsMenu"] }, { kind: "component", type: MenuItem, selector: "ngs-menu-item, [ngs-menu-item]", inputs: ["disabled", "role", "selected"], outputs: ["_triggered"], exportAs: ["ngsMenuItem"] }, { kind: "directive", type: MenuTrigger, selector: "[ngsMenuTriggerFor]", inputs: ["ngsMenuTriggerFor", "ngsMenuTriggerData", "ngsMenuDisabled", "xPosition", "yPosition", "ngsMenuTriggerRestoreFocus"], outputs: ["menuOpened", "menuClosed"], exportAs: ["ngsMenuTrigger"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
110
110
|
}
|
|
111
111
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorNestedBlocks, decorators: [{
|
|
112
112
|
type: Component,
|
|
113
|
-
args: [{ selector: 'ngs-content-editor-nested-blocks', imports: [AsyncPipe, NgComponentOutlet, CdkDrag, CdkDragHandle, CdkDropList, Button, Icon, Menu, MenuItem, MenuTrigger], providers: [{ provide: CONTENT_BUILDER, useExisting: forwardRef(() => ContentEditorNestedBlocks) }], changeDetection: ChangeDetectionStrategy.OnPush, host: { '(keydown)': 'onKeyDown($event)' }, template: "<div cdkDropList [cdkDropListData]=\"scope()\" [cdkDropListConnectedTo]=\"connectedDropLists()\" [cdkDropListEnterPredicate]=\"canEnter\" (cdkDropListDropped)=\"drop($event)\" class=\"min-h-12\">\n @for (block of renderedBlocks(); track block.id) {\n <div cdkDrag [cdkDragData]=\"block.id\" (cdkDragStarted)=\"onDragStarted()\" (cdkDragEnded)=\"onDragEnded()\" class=\"nested-block relative min-w-0 py-2\" [attr.data-block-id]=\"block.id\">\n <div class=\"nested-controls block-controls absolute top-1/2 z-10 flex -translate-y-1/2 items-center\"\n [class.is-menu-open]=\"addTrigger.menuOpen() || actionsTrigger.menuOpen()\">\n <button ngsIconButton aria-label=\"Add block\" #addTrigger=\"ngsMenuTrigger\"\n [ngsMenuTriggerFor]=\"rootBuilder.blockMenu()\" [ngsMenuTriggerRestoreFocus]=\"false\"\n [ngsMenuTriggerData]=\"{target: {scope: scope(), afterId: block.id}}\">\n <ngs-icon name=\"fluent:add-24-regular\"/>\n </button>\n <button ngsIconButton cdkDragHandle [ngsMenuTriggerFor]=\"blockMenu\"\n #actionsTrigger=\"ngsMenuTrigger\" aria-label=\"Move block\"><ngs-icon name=\"fluent:re-order-dots-vertical-24-regular\"/></button>\n <ngs-menu #blockMenu>\n <button ngs-menu-item (click)=\"duplicateBlock(block.id)\">Duplicate</button>\n <button ngs-menu-item (click)=\"deleteBlock(block.id)\">Delete</button>\n </ngs-menu>\n </div>\n <div class=\"min-w-0\">\n <ng-container [ngComponentOutlet]=\"getBlockComponent(block.type) | async\"\n [ngComponentOutletInputs]=\"{id: block.id, content: block.content, settings: block.settings, props: block.props, index: $index}\"/>\n </div>\n </div>\n }\n</div>\n", styles: [":host{--ngs-content-editor-nested-controls-offset: 0px;display:block;min-width:0}:host .nested-controls{--ngs-button-height: calc(var(--spacing, .25rem) * 7);right:100%;width:calc(calc(var(--spacing, .25rem) * 18) + var(--ngs-content-editor-nested-controls-offset));padding-left:calc(var(--spacing, .25rem) * 2);padding-right:calc(calc(var(--spacing, .25rem) * 2) + var(--ngs-content-editor-nested-controls-offset));opacity:0;pointer-events:none}:host .nested-controls.is-menu-open{opacity:1;pointer-events:auto}:host .nested-block:hover .nested-controls,:host .nested-block:focus-within .nested-controls{opacity:1;pointer-events:auto}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
113
|
+
args: [{ selector: 'ngs-content-editor-nested-blocks', imports: [AsyncPipe, NgComponentOutlet, CdkDrag, CdkDragHandle, CdkDropList, Button, Icon, Menu, MenuItem, MenuTrigger], providers: [{ provide: CONTENT_BUILDER, useExisting: forwardRef(() => ContentEditorNestedBlocks) }], changeDetection: ChangeDetectionStrategy.OnPush, host: { '(keydown)': 'onKeyDown($event)' }, template: "<div cdkDropList [cdkDropListData]=\"scope()\" [cdkDropListConnectedTo]=\"connectedDropLists()\" [cdkDropListEnterPredicate]=\"canEnter\" (cdkDropListDropped)=\"drop($event)\" class=\"min-h-12\">\n @for (block of renderedBlocks(); track block.id) {\n <div cdkDrag [cdkDragData]=\"block.id\" (cdkDragStarted)=\"onDragStarted()\" (cdkDragEnded)=\"onDragEnded()\" class=\"nested-block relative min-w-0 py-2\" [attr.data-block-id]=\"block.id\">\n <div class=\"nested-controls block-controls absolute top-1/2 z-10 flex -translate-y-1/2 items-center\"\n [class.is-menu-open]=\"addTrigger.menuOpen() || actionsTrigger.menuOpen()\">\n <button ngsIconButton aria-label=\"Add block\" #addTrigger=\"ngsMenuTrigger\"\n [ngsMenuTriggerFor]=\"rootBuilder.blockMenu()\" [ngsMenuTriggerRestoreFocus]=\"false\"\n [ngsMenuTriggerData]=\"{target: {scope: scope(), afterId: block.id}}\">\n <ngs-icon name=\"fluent:add-24-regular\"/>\n </button>\n <button ngsIconButton cdkDragHandle [ngsMenuTriggerFor]=\"blockMenu\"\n #actionsTrigger=\"ngsMenuTrigger\" aria-label=\"Move block\"><ngs-icon name=\"fluent:re-order-dots-vertical-24-regular\"/></button>\n <ngs-menu #blockMenu>\n @if (rootBuilder.canConvertBlock(block.id)) {\n <button ngs-menu-item [ngsMenuTriggerFor]=\"rootBuilder.conversionMenu()\" [ngsMenuTriggerData]=\"{blockId: block.id}\" [ngsMenuTriggerRestoreFocus]=\"false\">Turn into</button>\n }\n <button ngs-menu-item (click)=\"duplicateBlock(block.id)\">Duplicate</button>\n <button ngs-menu-item (click)=\"deleteBlock(block.id)\">Delete</button>\n </ngs-menu>\n </div>\n <div class=\"min-w-0\">\n <ng-container [ngComponentOutlet]=\"getBlockComponent(block.type) | async\"\n [ngComponentOutletInputs]=\"{id: block.id, content: block.content, settings: block.settings, props: block.props, index: $index}\"/>\n </div>\n </div>\n }\n</div>\n", styles: [":host{--ngs-content-editor-nested-controls-offset: 0px;display:block;min-width:0}:host .nested-controls{--ngs-button-height: calc(var(--spacing, .25rem) * 7);right:100%;width:calc(calc(var(--spacing, .25rem) * 18) + var(--ngs-content-editor-nested-controls-offset));padding-left:calc(var(--spacing, .25rem) * 2);padding-right:calc(calc(var(--spacing, .25rem) * 2) + var(--ngs-content-editor-nested-controls-offset));opacity:0;pointer-events:none}:host .nested-controls.is-menu-open{opacity:1;pointer-events:auto}:host .nested-block:hover .nested-controls,:host .nested-block:focus-within .nested-controls{opacity:1;pointer-events:auto}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
114
114
|
}], ctorParameters: () => [], propDecorators: { dropList: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkDropList), { isSignal: true }] }], scope: [{ type: i0.Input, args: [{ isSignal: true, alias: "scope", required: true }] }] } });
|
|
115
115
|
|
|
116
116
|
export { ContentEditorNestedBlocks as C };
|
|
117
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-nested-blocks-
|
|
117
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-nested-blocks-Dh-p3WMp.mjs.map
|