@ngstarter-ui/components 22.1.3 → 22.2.1
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/README.md +133 -13
- package/ai/component-registry.json +140 -9
- package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-B2GUlWO2.mjs +54 -0
- package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-B2GUlWO2.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-content-editor-block-base-BHAxKEOT.mjs +47 -0
- package/fesm2022/ngstarter-ui-components-content-editor-block-base-BHAxKEOT.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-content-editor-callout-block-Cnga7Z-6.mjs +27 -0
- package/fesm2022/ngstarter-ui-components-content-editor-callout-block-Cnga7Z-6.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-code-block.component-BbK5fCoE.mjs → ngstarter-ui-components-content-editor-code-block.component-DSdVOJtH.mjs} +49 -15
- package/fesm2022/ngstarter-ui-components-content-editor-code-block.component-DSdVOJtH.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-divider-block.component-B5wyMHjr.mjs → ngstarter-ui-components-content-editor-divider-block.component-D1nXMRXD.mjs} +5 -3
- package/fesm2022/{ngstarter-ui-components-content-editor-divider-block.component-B5wyMHjr.mjs.map → ngstarter-ui-components-content-editor-divider-block.component-D1nXMRXD.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-embed-block-DGqupBLe.mjs → ngstarter-ui-components-content-editor-embed-block-DhFxtMQS.mjs} +16 -4
- package/fesm2022/ngstarter-ui-components-content-editor-embed-block-DhFxtMQS.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-content-editor-gallery-block-cEy-dCMa.mjs +103 -0
- package/fesm2022/ngstarter-ui-components-content-editor-gallery-block-cEy-dCMa.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-content-editor-grid-block-DFLGRFiO.mjs +66 -0
- package/fesm2022/ngstarter-ui-components-content-editor-grid-block-DFLGRFiO.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-heading-block.component-D1s2yalT.mjs → ngstarter-ui-components-content-editor-heading-block.component-BYpctSPe.mjs} +23 -14
- package/fesm2022/ngstarter-ui-components-content-editor-heading-block.component-BYpctSPe.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-image-block.component-D75DrPNq.mjs → ngstarter-ui-components-content-editor-image-block.component-B3MnANpi.mjs} +20 -7
- package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-B3MnANpi.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-list-block.component-B7pDlrQ_.mjs → ngstarter-ui-components-content-editor-list-block.component-6SMBxIl4.mjs} +28 -17
- package/fesm2022/ngstarter-ui-components-content-editor-list-block.component-6SMBxIl4.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-content-editor-nested-blocks-DSY7xfzf.mjs +117 -0
- package/fesm2022/ngstarter-ui-components-content-editor-nested-blocks-DSY7xfzf.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor--rb3-UuO.mjs +3310 -0
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor--rb3-UuO.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-paragraph-block.component-CVV2f-ON.mjs → ngstarter-ui-components-content-editor-paragraph-block.component-JVxf_Cdx.mjs} +25 -14
- package/fesm2022/ngstarter-ui-components-content-editor-paragraph-block.component-JVxf_Cdx.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-quote-block.component-CVb-bkJw.mjs → ngstarter-ui-components-content-editor-quote-block.component-7EO7z7Sr.mjs} +29 -16
- package/fesm2022/ngstarter-ui-components-content-editor-quote-block.component-7EO7z7Sr.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-table-block.component-DSpLBC4V.mjs → ngstarter-ui-components-content-editor-table-block.component-CJS-IBHw.mjs} +28 -13
- package/fesm2022/ngstarter-ui-components-content-editor-table-block.component-CJS-IBHw.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-content-editor-toggle-block-B01lhY_V.mjs +21 -0
- package/fesm2022/ngstarter-ui-components-content-editor-toggle-block-B01lhY_V.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-content-editor-upload-block-base-D9ELpJr-.mjs +29 -0
- package/fesm2022/ngstarter-ui-components-content-editor-upload-block-base-D9ELpJr-.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-video-block.component-D3U8uXIy.mjs → ngstarter-ui-components-content-editor-video-block.component-DQUPVDwV.mjs} +19 -5
- package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-DQUPVDwV.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-content-editor.mjs +1 -1
- package/fesm2022/ngstarter-ui-components-data-view.mjs +2 -2
- package/fesm2022/ngstarter-ui-components-data-view.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-filter-builder.mjs +1 -1
- package/fesm2022/ngstarter-ui-components-filter-builder.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-headless-editor.mjs +90 -12
- package/fesm2022/ngstarter-ui-components-headless-editor.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-image-designer.mjs +1 -1
- package/fesm2022/ngstarter-ui-components-image-designer.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-kanban-board.mjs +1 -1
- package/fesm2022/ngstarter-ui-components-kanban-board.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-menu.mjs +9 -5
- package/fesm2022/ngstarter-ui-components-menu.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-pdf-builder.mjs +1 -1
- package/fesm2022/ngstarter-ui-components-pdf-builder.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-pdf-viewer.mjs +1 -1
- package/fesm2022/ngstarter-ui-components-pdf-viewer.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-phone-input.mjs +1 -1
- package/fesm2022/ngstarter-ui-components-phone-input.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-signature-pad.mjs +1 -1
- package/fesm2022/ngstarter-ui-components-signature-pad.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-upload.mjs +2 -2
- package/fesm2022/ngstarter-ui-components-upload.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngstarter-ui-components-content-editor.d.ts +303 -83
- package/types/ngstarter-ui-components-headless-editor.d.ts +17 -2
- package/types/ngstarter-ui-components-menu.d.ts +3 -1
- package/fesm2022/ngstarter-ui-components-content-editor-code-block.component-BbK5fCoE.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-content-editor-content-editable.directive-BOXOHcSo.mjs +0 -127
- package/fesm2022/ngstarter-ui-components-content-editor-content-editor-content-editable.directive-BOXOHcSo.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-embed-block-DGqupBLe.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-heading-block.component-D1s2yalT.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-D75DrPNq.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-list-block.component-B7pDlrQ_.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CV959OGj.mjs +0 -3102
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CV959OGj.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-paragraph-block.component-CVV2f-ON.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-quote-block.component-CVb-bkJw.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-table-block.component-DSpLBC4V.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-D3U8uXIy.mjs.map +0 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { computed, linkedSignal, signal, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { moveItemInArray, CdkDrag, CdkDragHandle, CdkDropList } from '@angular/cdk/drag-drop';
|
|
4
|
+
import { createNgsHeadlessEditorText, createNgsHeadlessEditorId } from '@ngstarter-ui/components/headless-editor';
|
|
5
|
+
import { UploadArea, UploadTriggerDirective } from '@ngstarter-ui/components/upload';
|
|
6
|
+
import { ProgressBar } from '@ngstarter-ui/components/progress-bar';
|
|
7
|
+
import { Alert } from '@ngstarter-ui/components/alert';
|
|
8
|
+
import { Button } from '@ngstarter-ui/components/button';
|
|
9
|
+
import { Icon } from '@ngstarter-ui/components/icon';
|
|
10
|
+
import { FormField, Hint, Label } from '@ngstarter-ui/components/form-field';
|
|
11
|
+
import { Input } from '@ngstarter-ui/components/input';
|
|
12
|
+
import { Menu, MenuDivider, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';
|
|
13
|
+
import { ImageViewerDirective, ImageViewerPictureDirective } from '@ngstarter-ui/components/image-viewer';
|
|
14
|
+
import { C as ContentEditorUploadBlockBase } from './ngstarter-ui-components-content-editor-upload-block-base-D9ELpJr-.mjs';
|
|
15
|
+
import { b as contentEditorText, r as readContentEditorFile, g as contentEditorResourceUrl } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor--rb3-UuO.mjs';
|
|
16
|
+
|
|
17
|
+
class ContentEditorGalleryBlock extends ContentEditorUploadBlockBase {
|
|
18
|
+
images = computed(() => this.content().images, /* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "images" }] : /* istanbul ignore next */ []));
|
|
20
|
+
selectedId = linkedSignal({ ...(ngDevMode ? { debugName: "selectedId" } : /* istanbul ignore next */ {}), source: this.images,
|
|
21
|
+
computation: (images, previous) => {
|
|
22
|
+
if (images.some(image => image.id === previous?.value))
|
|
23
|
+
return previous.value;
|
|
24
|
+
const previousIndex = previous?.source.findIndex(image => image.id === previous.value) ?? 0;
|
|
25
|
+
return images[Math.min(Math.max(previousIndex, 0), images.length - 1)]?.id ?? null;
|
|
26
|
+
} });
|
|
27
|
+
selectedIndex = computed(() => this.images().findIndex(image => image.id === this.selectedId()), /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "selectedIndex" }] : /* istanbul ignore next */ []));
|
|
29
|
+
selectedImage = computed(() => this.images()[this.selectedIndex()] ?? null, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "selectedImage" }] : /* istanbul ignore next */ []));
|
|
31
|
+
replacementId = signal(null, /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "replacementId" }] : /* istanbul ignore next */ []));
|
|
33
|
+
captionText = contentEditorText;
|
|
34
|
+
selectImage(id) { this.selectedId.set(id); }
|
|
35
|
+
previousImage() { const image = this.images()[this.selectedIndex() - 1]; if (image)
|
|
36
|
+
this.selectImage(image.id); }
|
|
37
|
+
nextImage() { const image = this.images()[this.selectedIndex() + 1]; if (image)
|
|
38
|
+
this.selectImage(image.id); }
|
|
39
|
+
changeAlt(id, event) { this.changeImage(id, { alt: event.target.value }); }
|
|
40
|
+
changeCaption(id, caption) { this.changeImage(id, { caption: [createNgsHeadlessEditorText(caption)] }); }
|
|
41
|
+
changeImage(id, data) {
|
|
42
|
+
this.save({ images: this.latestContent().images.map(image => image.id === id ? { ...image, ...data } : image) });
|
|
43
|
+
}
|
|
44
|
+
removeImage(id) { this.save({ images: this.latestContent().images.filter(image => image.id !== id) }); }
|
|
45
|
+
moveImage(index, direction) { this.reorderImage(index, index + direction); }
|
|
46
|
+
dropImage(event) {
|
|
47
|
+
this.reorderImage(event.previousIndex, event.currentIndex);
|
|
48
|
+
}
|
|
49
|
+
reorderImage(from, to) {
|
|
50
|
+
const images = [...this.latestContent().images];
|
|
51
|
+
if (from < 0 || to < 0 || from >= images.length || to >= images.length || from === to)
|
|
52
|
+
return;
|
|
53
|
+
moveItemInArray(images, from, to);
|
|
54
|
+
this.save({ images });
|
|
55
|
+
}
|
|
56
|
+
requestReplacement(id, trigger) {
|
|
57
|
+
this.replacementId.set(id);
|
|
58
|
+
trigger._handleClick();
|
|
59
|
+
}
|
|
60
|
+
async upload(event, replaceId = null) {
|
|
61
|
+
const candidates = event.files.filter(file => file.type.startsWith('image/'));
|
|
62
|
+
const files = replaceId ? candidates.slice(0, 1) : candidates;
|
|
63
|
+
if (!files.length) {
|
|
64
|
+
this.error.set('Choose image files.');
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const request = this.beginUpload();
|
|
68
|
+
const uploadFn = this.builder.getBlockDefOption('gallery', 'uploadFn');
|
|
69
|
+
const results = await Promise.allSettled(files.map(async (file) => {
|
|
70
|
+
const dataUrl = await readContentEditorFile(file);
|
|
71
|
+
if (!this.isCurrentUpload(request))
|
|
72
|
+
throw new Error('Cancelled');
|
|
73
|
+
const src = await uploadFn(file, dataUrl);
|
|
74
|
+
if (typeof src !== 'string' || !contentEditorResourceUrl(src))
|
|
75
|
+
throw new Error('Invalid image URL');
|
|
76
|
+
return { id: createNgsHeadlessEditorId('image'), src, alt: file.name, caption: [] };
|
|
77
|
+
}));
|
|
78
|
+
if (!this.isCurrentUpload(request))
|
|
79
|
+
return;
|
|
80
|
+
const images = results.flatMap(result => result.status === 'fulfilled' ? [result.value] : []);
|
|
81
|
+
if (images.length) {
|
|
82
|
+
if (replaceId)
|
|
83
|
+
this.changeImage(replaceId, { src: images[0].src });
|
|
84
|
+
else {
|
|
85
|
+
this.save({ images: [...this.latestContent().images, ...images] });
|
|
86
|
+
this.selectImage(images[0].id);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (images.length !== files.length)
|
|
90
|
+
this.error.set(replaceId ? 'Could not replace the image. Please try again.' : 'Some images could not be uploaded. Please try again.');
|
|
91
|
+
this.uploading.set(false);
|
|
92
|
+
}
|
|
93
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorGalleryBlock, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
94
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ContentEditorGalleryBlock, isStandalone: true, selector: "ngs-content-editor-gallery-block", usesInheritance: true, ngImport: i0, template: "<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 @if (uploading()) {\n <ngs-progress-bar mode=\"indeterminate\"/><button ngsButton (click)=\"cancelUpload()\">Cancel upload</button>\n }\n @if (error()) { <ngs-alert variant=\"negative\">{{error()}}</ngs-alert> }\n</div>\n", styles: [":host{display:block;min-width:0;background:var(--ngs-color-surface);border:1px solid var(--ngs-color-outline-variant);border-radius:var(--ngs-radius-lg)}:host button[hidden]{display:none}:host .gallery-picture,:host .thumbnail-picture{--ngs-button-height: auto;--ngs-button-padding: 0;--ngs-button-content-gap: 0}:host .gallery-picture ::ng-deep .content,:host .thumbnail-picture ::ng-deep .content{display:block;width:100%}:host .preview-action{position:absolute;--ngs-button-height: calc(var(--spacing, .25rem) * 8);background:var(--ngs-color-surface);color:var(--ngs-color-on-surface);box-shadow:var(--ngs-shadow-sm);border-radius:var(--ngs-radius-full)}:host .preview-action.image-actions{border-radius:var(--ngs-radius-lg)}:host .image-counter{background:var(--ngs-color-black);color:var(--ngs-color-white)}:host .gallery-thumbnail{background:var(--ngs-color-surface-container-low)}:host .thumbnail-handle{cursor:grab}:host .thumbnail-handle:active{cursor:grabbing}:host .thumbnail-picture{border-radius:var(--ngs-radius-md)}:host .thumbnail-picture.is-selected{outline:2px solid var(--ngs-color-primary);outline-offset:1px}:host .add-image-tile{--ngs-button-height: auto;--ngs-button-padding: calc(var(--spacing, .25rem) * 3);--ngs-button-content-gap: var(--spacing, .25rem);width:calc(var(--spacing, .25rem) * 36);border:1px dashed var(--ngs-color-outline-variant)}:host .add-image-tile ::ng-deep .icon{left:auto;right:auto}:host .add-image-tile ::ng-deep .content{line-height:normal}:host ngs-form-field{--ngs-form-field-border-width: 1px;--ngs-form-field-border-color: var(--ngs-color-outline-variant);--ngs-form-field-container-min-height: calc(var(--spacing, .25rem) * 9);--ngs-form-field-input-height: calc(var(--spacing, .25rem) * 9)}:host .cdk-drag-placeholder{opacity:.25}:host .cdk-drag-animating{transition:transform .18s ease}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ 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: ProgressBar, selector: "ngs-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["ngsProgressBar"] }, { kind: "component", type: Alert, selector: "ngs-alert", inputs: ["autoClose", "bordered", "variant"], outputs: ["closed"], exportAs: ["ngsAlert"] }, { 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: FormField, selector: "ngs-form-field", inputs: ["labelMode", "subscriptHiddenIfEmpty", "sameHeightAsButton"], exportAs: ["ngsFormField"] }, { kind: "component", type: Hint, selector: "ngs-hint", inputs: ["align"], exportAs: ["ngsHint"] }, { kind: "component", type: Label, selector: "ngs-label" }, { kind: "directive", type: Input, selector: "input[ngsInput], textarea[ngsInput]", inputs: ["id", "placeholder", "required", "disabled", "readonly", "errorStateMatcher"], exportAs: ["ngsInput"] }, { 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: Menu, selector: "ngs-menu", inputs: ["role", "classList", "xPosition", "yPosition", "pushIntoViewport"], outputs: ["closed"], exportAs: ["ngsMenu"] }, { kind: "component", type: MenuDivider, selector: "ngs-menu-divider" }, { 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: "directive", type: ImageViewerDirective, selector: "[ngsImageViewer]", exportAs: ["ngsImageViewer"] }, { kind: "directive", type: ImageViewerPictureDirective, selector: "[ngsImageViewerPicture]", inputs: ["sourceUrl", "caption", "title", "description"], exportAs: ["ngsImageViewerPicture"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
95
|
+
}
|
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorGalleryBlock, decorators: [{
|
|
97
|
+
type: Component,
|
|
98
|
+
args: [{ selector: 'ngs-content-editor-gallery-block', imports: [UploadArea, UploadTriggerDirective, ProgressBar, Alert, Button, Icon, FormField, Hint, Label, Input,
|
|
99
|
+
CdkDrag, CdkDragHandle, CdkDropList, Menu, MenuDivider, MenuItem, MenuTrigger, ImageViewerDirective, ImageViewerPictureDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<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 @if (uploading()) {\n <ngs-progress-bar mode=\"indeterminate\"/><button ngsButton (click)=\"cancelUpload()\">Cancel upload</button>\n }\n @if (error()) { <ngs-alert variant=\"negative\">{{error()}}</ngs-alert> }\n</div>\n", styles: [":host{display:block;min-width:0;background:var(--ngs-color-surface);border:1px solid var(--ngs-color-outline-variant);border-radius:var(--ngs-radius-lg)}:host button[hidden]{display:none}:host .gallery-picture,:host .thumbnail-picture{--ngs-button-height: auto;--ngs-button-padding: 0;--ngs-button-content-gap: 0}:host .gallery-picture ::ng-deep .content,:host .thumbnail-picture ::ng-deep .content{display:block;width:100%}:host .preview-action{position:absolute;--ngs-button-height: calc(var(--spacing, .25rem) * 8);background:var(--ngs-color-surface);color:var(--ngs-color-on-surface);box-shadow:var(--ngs-shadow-sm);border-radius:var(--ngs-radius-full)}:host .preview-action.image-actions{border-radius:var(--ngs-radius-lg)}:host .image-counter{background:var(--ngs-color-black);color:var(--ngs-color-white)}:host .gallery-thumbnail{background:var(--ngs-color-surface-container-low)}:host .thumbnail-handle{cursor:grab}:host .thumbnail-handle:active{cursor:grabbing}:host .thumbnail-picture{border-radius:var(--ngs-radius-md)}:host .thumbnail-picture.is-selected{outline:2px solid var(--ngs-color-primary);outline-offset:1px}:host .add-image-tile{--ngs-button-height: auto;--ngs-button-padding: calc(var(--spacing, .25rem) * 3);--ngs-button-content-gap: var(--spacing, .25rem);width:calc(var(--spacing, .25rem) * 36);border:1px dashed var(--ngs-color-outline-variant)}:host .add-image-tile ::ng-deep .icon{left:auto;right:auto}:host .add-image-tile ::ng-deep .content{line-height:normal}:host ngs-form-field{--ngs-form-field-border-width: 1px;--ngs-form-field-border-color: var(--ngs-color-outline-variant);--ngs-form-field-container-min-height: calc(var(--spacing, .25rem) * 9);--ngs-form-field-input-height: calc(var(--spacing, .25rem) * 9)}:host .cdk-drag-placeholder{opacity:.25}:host .cdk-drag-animating{transition:transform .18s ease}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
100
|
+
}] });
|
|
101
|
+
|
|
102
|
+
export { ContentEditorGalleryBlock };
|
|
103
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-gallery-block-cEy-dCMa.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-gallery-block-cEy-dCMa.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 { ProgressBar } from '@ngstarter-ui/components/progress-bar';\nimport { Alert } from '@ngstarter-ui/components/alert';\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, ContentEditorUploadFn } from '../../types';\nimport { contentEditorText } from '../../document';\nimport { contentEditorResourceUrl, readContentEditorFile } from '../../upload';\n\n@Component({\n selector: 'ngs-content-editor-gallery-block',\n imports: [UploadArea, UploadTriggerDirective, ProgressBar, Alert, 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 candidates = event.files.filter(file => file.type.startsWith('image/'));\n const files = replaceId ? candidates.slice(0, 1) : candidates;\n if (!files.length) { this.error.set('Choose image files.'); return; }\n const request = this.beginUpload();\n const uploadFn: ContentEditorUploadFn = this.builder.getBlockDefOption('gallery', 'uploadFn');\n const results = await Promise.allSettled(files.map(async file => {\n const dataUrl = await readContentEditorFile(file);\n if (!this.isCurrentUpload(request)) throw new Error('Cancelled');\n const src = await uploadFn(file, dataUrl);\n if (typeof src !== 'string' || !contentEditorResourceUrl(src)) throw new Error('Invalid image URL');\n return { id: createNgsHeadlessEditorId('image'), src, alt: file.name, caption: [] } satisfies ContentEditorGalleryImage;\n }));\n if (!this.isCurrentUpload(request)) return;\n const images = results.flatMap(result => result.status === 'fulfilled' ? [result.value] : []);\n if (images.length) {\n if (replaceId) this.changeImage(replaceId, { src: images[0].src });\n else {\n this.save({ images: [...this.latestContent().images, ...images] });\n this.selectImage(images[0].id);\n }\n }\n if (images.length !== files.length) this.error.set(replaceId ? 'Could not replace the image. Please try again.' : 'Some images could not be uploaded. Please try again.');\n this.uploading.set(false);\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 @if (uploading()) {\n <ngs-progress-bar mode=\"indeterminate\"/><button ngsButton (click)=\"cancelUpload()\">Cancel upload</button>\n }\n @if (error()) { <ngs-alert variant=\"negative\">{{error()}}</ngs-alert> }\n</div>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuBM,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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
|
2
|
+
import { input, output, ChangeDetectionStrategy, Component, computed } from '@angular/core';
|
|
3
|
+
import { moveItemInArray, CdkDrag, CdkDragHandle, CdkDropList } from '@angular/cdk/drag-drop';
|
|
4
|
+
import { Button } from '@ngstarter-ui/components/button';
|
|
5
|
+
import { Icon } from '@ngstarter-ui/components/icon';
|
|
6
|
+
import { Popover, PopoverTriggerForDirective } from '@ngstarter-ui/components/popover';
|
|
7
|
+
import { Menu, MenuDivider, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';
|
|
8
|
+
import { C as ContentEditorBlockBase } from './ngstarter-ui-components-content-editor-block-base-BHAxKEOT.mjs';
|
|
9
|
+
import { C as ContentEditorNestedBlocks } from './ngstarter-ui-components-content-editor-nested-blocks-DSY7xfzf.mjs';
|
|
10
|
+
import { Segmented, SegmentedButton } from '@ngstarter-ui/components/segmented';
|
|
11
|
+
import { FormField, Label } from '@ngstarter-ui/components/form-field';
|
|
12
|
+
import { Select, Option } from '@ngstarter-ui/components/select';
|
|
13
|
+
import { SlideToggle } from '@ngstarter-ui/components/slide-toggle';
|
|
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
|
+
|
|
17
|
+
class ContentEditorGridSettingsPanel {
|
|
18
|
+
settings = input.required(/* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []));
|
|
20
|
+
settingsChanged = output();
|
|
21
|
+
cellAdded = output();
|
|
22
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorGridSettingsPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
23
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ContentEditorGridSettingsPanel, isStandalone: true, selector: "ngs-content-editor-grid-settings-panel", inputs: { settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { settingsChanged: "settingsChanged", cellAdded: "cellAdded" }, ngImport: i0, template: "<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", styles: [":host{display:block}:host ngs-segmented{--ngs-segmented-button-selected-bg: var(--ngs-color-primary);--ngs-segmented-button-selected-color: var(--ngs-color-on-primary)}:host ngs-segmented ::ng-deep .ngs-segmented-thumb{display:none}:host ngs-segmented button[ngs-segmented-button]{flex:1}:host ngs-segmented button[ngs-segmented-button].is-selected{background:var(--ngs-color-primary)}:host ngs-slide-toggle{display:block}:host ngs-slide-toggle ::ng-deep .ngs-slide-toggle-content{flex:1}:host .add-cell{justify-content:flex-start}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ 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: Segmented, selector: "ngs-segmented", inputs: ["value", "disabled", "size"], outputs: ["valueChange"], exportAs: ["ngsSegmented"] }, { kind: "component", type: SegmentedButton, selector: "ngs-segmented-button,[ngs-segmented-button]", inputs: ["value", "disabled", "iconOnly"], exportAs: ["ngsSegmentedButton"] }, { kind: "component", type: FormField, selector: "ngs-form-field", inputs: ["labelMode", "subscriptHiddenIfEmpty", "sameHeightAsButton"], exportAs: ["ngsFormField"] }, { kind: "component", type: Label, selector: "ngs-label" }, { kind: "component", type: Select, selector: "ngs-select", inputs: ["id", "placeholder", "disabled", "required", "multiple", "hideCheckIcon", "clearable", "dataSource", "pageSize", "searchable", "searchDebounce", "minSearchLength", "loadOnOpen", "aria-label", "tabIndex", "aria-describedby", "value"], outputs: ["selectionChange", "opened", "closed", "valueChange"], exportAs: ["ngsSelect"] }, { kind: "component", type: Option, selector: "ngs-option", inputs: ["value", "data", "disabled", "selected"], outputs: ["onSelectionChange"], exportAs: ["ngsOption"] }, { kind: "component", type: SlideToggle, selector: "ngs-slide-toggle", inputs: ["id", "name", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "disabled", "disableRipple", "tabIndex", "hideIcon", "color", "checked"], outputs: ["disabledChange", "checkedChange", "change", "toggleChange"], exportAs: ["ngsSlideToggle"] }, { kind: "component", type: Divider, selector: "ngs-divider", inputs: ["vertical", "inset", "fixedHeight"], exportAs: ["ngsDivider"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
24
|
+
}
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorGridSettingsPanel, decorators: [{
|
|
26
|
+
type: Component,
|
|
27
|
+
args: [{ selector: 'ngs-content-editor-grid-settings-panel', imports: [Button, Icon, Segmented, SegmentedButton, FormField, Label, Select, Option, SlideToggle, Divider], changeDetection: ChangeDetectionStrategy.OnPush, template: "<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", styles: [":host{display:block}:host ngs-segmented{--ngs-segmented-button-selected-bg: var(--ngs-color-primary);--ngs-segmented-button-selected-color: var(--ngs-color-on-primary)}:host ngs-segmented ::ng-deep .ngs-segmented-thumb{display:none}:host ngs-segmented button[ngs-segmented-button]{flex:1}:host ngs-segmented button[ngs-segmented-button].is-selected{background:var(--ngs-color-primary)}:host ngs-slide-toggle{display:block}:host ngs-slide-toggle ::ng-deep .ngs-slide-toggle-content{flex:1}:host .add-cell{justify-content:flex-start}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
28
|
+
}], propDecorators: { settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: true }] }], settingsChanged: [{ type: i0.Output, args: ["settingsChanged"] }], cellAdded: [{ type: i0.Output, args: ["cellAdded"] }] } });
|
|
29
|
+
|
|
30
|
+
class ContentEditorGridBlock extends ContentEditorBlockBase {
|
|
31
|
+
layout = computed(() => contentEditorGridSettings(this.settings()), /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
|
|
33
|
+
changeSettings(change) {
|
|
34
|
+
const settings = findContentEditorBlock(this.store.editor.document().blocks, this.id())?.attrs?.['settings'] ?? this.settings();
|
|
35
|
+
this.save(this.latestContent(), contentEditorGridSettings({ ...settings, ...change }));
|
|
36
|
+
}
|
|
37
|
+
addCell() {
|
|
38
|
+
const cell = emptyGridCell();
|
|
39
|
+
this.store.updateBlock(this.id(), { content: { cells: [...this.latestContent().cells, cell] } });
|
|
40
|
+
this.store.setFocusedBlockId(cell.blocks[0].id);
|
|
41
|
+
}
|
|
42
|
+
removeCell(id) {
|
|
43
|
+
const cells = this.latestContent().cells;
|
|
44
|
+
if (cells.length <= 1)
|
|
45
|
+
return;
|
|
46
|
+
this.store.updateBlock(this.id(), { content: { cells: cells.filter(cell => cell.id !== id) } });
|
|
47
|
+
}
|
|
48
|
+
moveCell(from, to) {
|
|
49
|
+
const cells = [...this.latestContent().cells];
|
|
50
|
+
if (from === to || from < 0 || to < 0 || from >= cells.length || to >= cells.length)
|
|
51
|
+
return;
|
|
52
|
+
moveItemInArray(cells, from, to);
|
|
53
|
+
this.store.updateBlock(this.id(), { content: { cells } });
|
|
54
|
+
}
|
|
55
|
+
dropCell(event) { this.moveCell(event.previousIndex, event.currentIndex); }
|
|
56
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorGridBlock, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
57
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ContentEditorGridBlock, isStandalone: true, selector: "ngs-content-editor-grid-block", usesInheritance: true, ngImport: i0, template: "<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", styles: [":host{container-type:inline-size}:host .grid-cells{display:grid;min-width:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:calc(var(--spacing, .25rem) * 6)}:host .grid-cells.columns-3{grid-template-columns:repeat(3,minmax(0,1fr))}:host .grid-cells.columns-4{grid-template-columns:repeat(4,minmax(0,1fr))}:host .grid-cells.gap-small{gap:calc(var(--spacing, .25rem) * 3)}:host .grid-cells.gap-large{gap:calc(var(--spacing, .25rem) * 9)}@container (max-width: 480px){:host .grid-cells.stack-on-mobile{grid-template-columns:minmax(0,1fr)}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n", ":host{display:block;min-width:0}:host .grid-tools{opacity:0;pointer-events:none;transition:opacity .12s;--ngs-button-height: calc(var(--spacing, .25rem) * 8)}:host .grid-tools.is-open{opacity:1;pointer-events:auto}:host:hover .grid-tools,:host:focus-within .grid-tools{opacity:1;pointer-events:auto}:host .grid-label{background:var(--ngs-color-surface-container);color:var(--ngs-color-on-surface-variant)}:host .grid-cell{min-height:calc(var(--spacing, .25rem) * 40);outline:1px dashed var(--ngs-color-outline-variant);outline-offset:-1px}:host .grid-cell:focus-within{outline:2px solid var(--ngs-color-primary)}:host .grid-cell:hover .cell-actions,:host .grid-cell:hover .cell-grip,:host .grid-cell:focus-within .cell-actions,:host .grid-cell:focus-within .cell-grip,:host .grid-cell.actions-open .cell-actions,:host .grid-cell.actions-open .cell-grip{opacity:1;pointer-events:auto}:host .cell-actions,:host .cell-grip{opacity:0;pointer-events:none}:host .cell-actions{position:absolute;right:var(--spacing, .25rem);top:var(--spacing, .25rem);--ngs-button-height: calc(var(--spacing, .25rem) * 7);z-index:11}:host .cell-grip{top:calc(-1 * calc(var(--spacing, .25rem) * 5));left:0;z-index:12;color:var(--ngs-color-on-surface-variant);cursor:grab}:host .cdk-drag-placeholder{opacity:.25}:host ngs-content-editor-nested-blocks{--ngs-content-editor-nested-controls-offset: calc(var(--spacing, .25rem) * 4)}:host ngs-content-editor-nested-blocks ::ng-deep .cdk-drop-list{min-height:calc(var(--spacing, .25rem) * 32)}:host ngs-content-editor-nested-blocks ::ng-deep .nested-controls{width:calc(var(--spacing, .25rem) * 7);right:calc(100% + var(--ngs-content-editor-nested-controls-offset));padding:0;flex-direction:column}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ 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: Popover, selector: "ngs-popover", exportAs: ["ngsPopover"] }, { kind: "directive", type: PopoverTriggerForDirective, selector: "[ngsPopoverTriggerFor]", inputs: ["ngsPopoverTriggerFor", "ngsPopoverContext", "trigger", "position", "delay", "origin", "closeOnOriginClick", "closeOnOriginMouseLeave", "hasBackdrop"], outputs: ["opened", "closed"], exportAs: ["ngsPopoverTriggerFor"] }, { kind: "component", type: Menu, selector: "ngs-menu", inputs: ["role", "classList", "xPosition", "yPosition", "pushIntoViewport"], outputs: ["closed"], exportAs: ["ngsMenu"] }, { kind: "component", type: MenuDivider, selector: "ngs-menu-divider" }, { 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: "component", type: ContentEditorNestedBlocks, selector: "ngs-content-editor-nested-blocks", inputs: ["scope"] }, { kind: "component", type: ContentEditorGridSettingsPanel, selector: "ngs-content-editor-grid-settings-panel", inputs: ["settings"], outputs: ["settingsChanged", "cellAdded"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
58
|
+
}
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorGridBlock, decorators: [{
|
|
60
|
+
type: Component,
|
|
61
|
+
args: [{ selector: 'ngs-content-editor-grid-block', imports: [Button, Icon, Popover, PopoverTriggerForDirective, Menu, MenuDivider, MenuItem, MenuTrigger,
|
|
62
|
+
ContentEditorNestedBlocks, ContentEditorGridSettingsPanel, CdkDrag, CdkDragHandle, CdkDropList], changeDetection: ChangeDetectionStrategy.OnPush, template: "<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", styles: [":host{container-type:inline-size}:host .grid-cells{display:grid;min-width:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:calc(var(--spacing, .25rem) * 6)}:host .grid-cells.columns-3{grid-template-columns:repeat(3,minmax(0,1fr))}:host .grid-cells.columns-4{grid-template-columns:repeat(4,minmax(0,1fr))}:host .grid-cells.gap-small{gap:calc(var(--spacing, .25rem) * 3)}:host .grid-cells.gap-large{gap:calc(var(--spacing, .25rem) * 9)}@container (max-width: 480px){:host .grid-cells.stack-on-mobile{grid-template-columns:minmax(0,1fr)}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n", ":host{display:block;min-width:0}:host .grid-tools{opacity:0;pointer-events:none;transition:opacity .12s;--ngs-button-height: calc(var(--spacing, .25rem) * 8)}:host .grid-tools.is-open{opacity:1;pointer-events:auto}:host:hover .grid-tools,:host:focus-within .grid-tools{opacity:1;pointer-events:auto}:host .grid-label{background:var(--ngs-color-surface-container);color:var(--ngs-color-on-surface-variant)}:host .grid-cell{min-height:calc(var(--spacing, .25rem) * 40);outline:1px dashed var(--ngs-color-outline-variant);outline-offset:-1px}:host .grid-cell:focus-within{outline:2px solid var(--ngs-color-primary)}:host .grid-cell:hover .cell-actions,:host .grid-cell:hover .cell-grip,:host .grid-cell:focus-within .cell-actions,:host .grid-cell:focus-within .cell-grip,:host .grid-cell.actions-open .cell-actions,:host .grid-cell.actions-open .cell-grip{opacity:1;pointer-events:auto}:host .cell-actions,:host .cell-grip{opacity:0;pointer-events:none}:host .cell-actions{position:absolute;right:var(--spacing, .25rem);top:var(--spacing, .25rem);--ngs-button-height: calc(var(--spacing, .25rem) * 7);z-index:11}:host .cell-grip{top:calc(-1 * calc(var(--spacing, .25rem) * 5));left:0;z-index:12;color:var(--ngs-color-on-surface-variant);cursor:grab}:host .cdk-drag-placeholder{opacity:.25}:host ngs-content-editor-nested-blocks{--ngs-content-editor-nested-controls-offset: calc(var(--spacing, .25rem) * 4)}:host ngs-content-editor-nested-blocks ::ng-deep .cdk-drop-list{min-height:calc(var(--spacing, .25rem) * 32)}:host ngs-content-editor-nested-blocks ::ng-deep .nested-controls{width:calc(var(--spacing, .25rem) * 7);right:calc(100% + var(--ngs-content-editor-nested-controls-offset));padding:0;flex-direction:column}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
63
|
+
}] });
|
|
64
|
+
|
|
65
|
+
export { ContentEditorGridBlock };
|
|
66
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-grid-block-DFLGRFiO.mjs.map
|
|
@@ -0,0 +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,EA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AA,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,7 +1,6 @@
|
|
|
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--rb3-UuO.mjs';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, DestroyRef, viewChild, input, signal, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { C as ContentBuilderStore, a as CONTENT_BUILDER, b as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CV959OGj.mjs';
|
|
4
|
-
import { C as ContentEditorContentEditableDirective } from './ngstarter-ui-components-content-editor-content-editor-content-editable.directive-BOXOHcSo.mjs';
|
|
3
|
+
import { inject, DestroyRef, viewChild, input, signal, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
5
|
import { C as CursorController } from './ngstarter-ui-components-content-editor-cursor-controller-4Ak8VqGX.mjs';
|
|
7
6
|
|
|
@@ -23,7 +22,7 @@ class HeadingBlockComponent {
|
|
|
23
22
|
...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
24
23
|
placeholder = input('Heading', /* @ts-ignore */
|
|
25
24
|
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
26
|
-
_content = signal(
|
|
25
|
+
_content = signal([], /* @ts-ignore */
|
|
27
26
|
...(ngDevMode ? [{ debugName: "_content" }] : /* istanbul ignore next */ []));
|
|
28
27
|
_isEmpty = signal(true, /* @ts-ignore */
|
|
29
28
|
...(ngDevMode ? [{ debugName: "_isEmpty" }] : /* istanbul ignore next */ []));
|
|
@@ -31,10 +30,21 @@ class HeadingBlockComponent {
|
|
|
31
30
|
...(ngDevMode ? [{ debugName: "_props" }] : /* istanbul ignore next */ []));
|
|
32
31
|
initialized = signal(false, /* @ts-ignore */
|
|
33
32
|
...(ngDevMode ? [{ debugName: "initialized" }] : /* istanbul ignore next */ []));
|
|
33
|
+
constructor() {
|
|
34
|
+
effect(() => {
|
|
35
|
+
const content = this.content();
|
|
36
|
+
const props = this.props();
|
|
37
|
+
untracked(() => {
|
|
38
|
+
this._content.set(content);
|
|
39
|
+
this._props.set(cloneContentEditorValue(props));
|
|
40
|
+
this._isEmpty.set(!contentEditorText(content).trim());
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
34
44
|
ngOnInit() {
|
|
35
45
|
this._content.set(this.content());
|
|
36
46
|
this._props.set(this.props());
|
|
37
|
-
this._isEmpty.set(this.content().
|
|
47
|
+
this._isEmpty.set(!contentEditorText(this.content()).trim());
|
|
38
48
|
this._contentBuilder
|
|
39
49
|
.focusChanged
|
|
40
50
|
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
@@ -50,8 +60,7 @@ class HeadingBlockComponent {
|
|
|
50
60
|
cursorController.setToEnd();
|
|
51
61
|
}
|
|
52
62
|
onPropsChanged(props) {
|
|
53
|
-
this.
|
|
54
|
-
this._store.updateBlock(this.id(), this.getData());
|
|
63
|
+
this._props.set(props);
|
|
55
64
|
this.update();
|
|
56
65
|
}
|
|
57
66
|
getData() {
|
|
@@ -64,14 +73,14 @@ class HeadingBlockComponent {
|
|
|
64
73
|
};
|
|
65
74
|
}
|
|
66
75
|
isEmpty() {
|
|
67
|
-
return this.
|
|
76
|
+
return !contentEditorText(this._content()).trim();
|
|
68
77
|
}
|
|
69
78
|
onContentChanged(content) {
|
|
70
79
|
if (!this.initialized()) {
|
|
71
80
|
return;
|
|
72
81
|
}
|
|
73
82
|
this._content.set(content);
|
|
74
|
-
this._isEmpty.set(content.
|
|
83
|
+
this._isEmpty.set(!contentEditorText(content).trim());
|
|
75
84
|
this.update();
|
|
76
85
|
}
|
|
77
86
|
onPressedEnter(event) {
|
|
@@ -86,7 +95,7 @@ class HeadingBlockComponent {
|
|
|
86
95
|
this.initialized.set(true);
|
|
87
96
|
}
|
|
88
97
|
_onKeyDown(event) {
|
|
89
|
-
if (event.key === 'Backspace' && !this._content()) {
|
|
98
|
+
if (event.key === 'Backspace' && !contentEditorText(this._content())) {
|
|
90
99
|
this._contentBuilder.deleteBlock(this.id());
|
|
91
100
|
}
|
|
92
101
|
}
|
|
@@ -101,7 +110,7 @@ class HeadingBlockComponent {
|
|
|
101
110
|
useExisting: HeadingBlockComponent,
|
|
102
111
|
multi: true
|
|
103
112
|
}
|
|
104
|
-
], viewQueries: [{ propertyName: "_contentRef", first: true, predicate: ["contentRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<div #contentRef\n class=\"content\"\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", styles: [":host{display:block}:host .content{outline:none;font-weight:700}:host .content:empty:before{content:attr(data-empty-placeholder);color:var(--ngs-color-neutral-500)}:host.level-1 .content{font-size:3rem}:host.level-2 .content{font-size:2.25rem}:host.level-3 .content{font-size:1.875rem}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: ContentEditorContentEditableDirective, selector: "[ngsContentEditorContentEditable]", inputs: ["ngsContentEditorContentEditable", "settings", "props"], outputs: ["contentChanged", "
|
|
113
|
+
], viewQueries: [{ propertyName: "_contentRef", first: true, predicate: ["contentRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<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", styles: [":host{display:block}:host .content{outline:none;font-weight:700}:host .content:empty:before{content:attr(data-empty-placeholder);color:var(--ngs-color-neutral-500)}:host.level-1 .content{font-size:3rem}:host.level-2 .content{font-size:2.25rem}:host.level-3 .content{font-size:1.875rem}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: ContentEditorContentEditableDirective, selector: "[ngsContentEditorContentEditable]", inputs: ["ngsContentEditorContentEditable", "settings", "props", "singleLine"], outputs: ["contentChanged", "propsChanged", "pressedEnter", "initialized"], exportAs: ["ngsContentEditorContentEditable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
105
114
|
}
|
|
106
115
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: HeadingBlockComponent, decorators: [{
|
|
107
116
|
type: Component,
|
|
@@ -118,8 +127,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
118
127
|
'[class.level-1]': 'settings().level === 1',
|
|
119
128
|
'[class.level-2]': 'settings().level === 2',
|
|
120
129
|
'[class.level-3]': 'settings().level === 3',
|
|
121
|
-
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #contentRef\n class=\"content\"\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", styles: [":host{display:block}:host .content{outline:none;font-weight:700}:host .content:empty:before{content:attr(data-empty-placeholder);color:var(--ngs-color-neutral-500)}:host.level-1 .content{font-size:3rem}:host.level-2 .content{font-size:2.25rem}:host.level-3 .content{font-size:1.875rem}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
122
|
-
}], 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 }] }] } });
|
|
130
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<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", styles: [":host{display:block}:host .content{outline:none;font-weight:700}:host .content:empty:before{content:attr(data-empty-placeholder);color:var(--ngs-color-neutral-500)}:host.level-1 .content{font-size:3rem}:host.level-2 .content{font-size:2.25rem}:host.level-3 .content{font-size:1.875rem}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
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 }] }] } });
|
|
123
132
|
|
|
124
133
|
export { HeadingBlockComponent };
|
|
125
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-heading-block.component-
|
|
134
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-heading-block.component-BYpctSPe.mjs.map
|
package/fesm2022/ngstarter-ui-components-content-editor-heading-block.component-BYpctSPe.mjs.map
ADDED
|
@@ -0,0 +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,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