@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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, signal, model, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { inject, input, signal, model, effect, untracked, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { UploadArea, UploadTriggerDirective } from '@ngstarter-ui/components/upload';
|
|
4
4
|
import { ProgressBar } from '@ngstarter-ui/components/progress-bar';
|
|
5
5
|
import { Button } from '@ngstarter-ui/components/button';
|
|
6
6
|
import { Icon } from '@ngstarter-ui/components/icon';
|
|
7
|
-
import { C as ContentBuilderStore, a as CONTENT_BUILDER,
|
|
7
|
+
import { C as ContentBuilderStore, a as CONTENT_BUILDER, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor--rb3-UuO.mjs';
|
|
8
8
|
import { ImageResizer, ImageResizerImageDirective } from '@ngstarter-ui/components/image-resizer';
|
|
9
9
|
import { FormField, Label } from '@ngstarter-ui/components/form-field';
|
|
10
10
|
import { Input } from '@ngstarter-ui/components/input';
|
|
@@ -22,6 +22,8 @@ class ImageBlockComponent {
|
|
|
22
22
|
...(ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []));
|
|
23
23
|
index = input.required(/* @ts-ignore */
|
|
24
24
|
...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
25
|
+
props = input([], /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "props" }] : /* istanbul ignore next */ []));
|
|
25
27
|
uploading = signal(false, /* @ts-ignore */
|
|
26
28
|
...(ngDevMode ? [{ debugName: "uploading" }] : /* istanbul ignore next */ []));
|
|
27
29
|
selectedImage = signal('', /* @ts-ignore */
|
|
@@ -34,6 +36,17 @@ class ImageBlockComponent {
|
|
|
34
36
|
...(ngDevMode ? [{ debugName: "_settings" }] : /* istanbul ignore next */ []));
|
|
35
37
|
initialized = signal(false, /* @ts-ignore */
|
|
36
38
|
...(ngDevMode ? [{ debugName: "initialized" }] : /* istanbul ignore next */ []));
|
|
39
|
+
constructor() {
|
|
40
|
+
effect(() => {
|
|
41
|
+
const content = this.content();
|
|
42
|
+
const settings = this.settings();
|
|
43
|
+
untracked(() => {
|
|
44
|
+
this._src.set(content.src);
|
|
45
|
+
this._alt.set(content.alt);
|
|
46
|
+
this._settings.set({ ...settings });
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
37
50
|
ngOnInit() {
|
|
38
51
|
this._src.set(this.content().src);
|
|
39
52
|
this._alt.set(this.content().alt);
|
|
@@ -119,13 +132,13 @@ class ImageBlockComponent {
|
|
|
119
132
|
this._contentBuilder.emitContentChangeEvent();
|
|
120
133
|
}
|
|
121
134
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ImageBlockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
122
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ImageBlockComponent, isStandalone: true, selector: "ngs-image-block", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: true, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null }, _alt: { classPropertyName: "_alt", publicName: "_alt", isSignal: true, isRequired: false, transformFunction: null }, _settings: { classPropertyName: "_settings", publicName: "_settings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { _alt: "_altChange", _settings: "_settingsChange" }, host: { listeners: { "keypress": "handleKeyPress($event)" } }, providers: [
|
|
135
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ImageBlockComponent, isStandalone: true, selector: "ngs-image-block", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: true, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null }, _alt: { classPropertyName: "_alt", publicName: "_alt", isSignal: true, isRequired: false, transformFunction: null }, _settings: { classPropertyName: "_settings", publicName: "_settings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { _alt: "_altChange", _settings: "_settingsChange" }, host: { listeners: { "keypress": "handleKeyPress($event)" } }, providers: [
|
|
123
136
|
{
|
|
124
137
|
provide: CONTENT_EDITOR_BLOCK,
|
|
125
138
|
useExisting: forwardRef(() => ImageBlockComponent),
|
|
126
139
|
multi: true
|
|
127
140
|
}
|
|
128
|
-
], ngImport: i0, template: "@if (uploading()) {\n <div class=\"upload-container\">\n <div class=\"upload-overlay\">\n <ngs-progress-bar mode=\"indeterminate\" class=\"progress-bar\"/>\n <div class=\"remove-button\">\n <button ngsButton (click)=\"cancelUploading()\">\n <ngs-icon name=\"fluent:delete-24-regular\"/>\n </button>\n </div>\n <div class=\"upload-overlay-text\">Loading...</div>\n </div>\n <img [src]=\"selectedImage()\" [alt]=\"_alt()\">\n </div>\n} @else if (_src()) {\n <div class=\"uploaded-image\">\n <ngs-image-resizer (imageResized)=\"_onImageResized($event)\" [imageMaxWidth]=\"704\">\n <img [src]=\"_src()\" [alt]=\"_alt()\" ngsImageResizerImage [style.width.px]=\"_settings().width || null\">\n </ngs-image-resizer>\n </div>\n <ngs-form-field class=\"w-full mt-5\">\n <ngs-label>Alt text</ngs-label>\n <input ngsInput [(ngModel)]=\"_alt\" (ngModelChange)=\"_onAltChange()\">\n </ngs-form-field>\n} @else {\n <ngs-upload-area #uploadArea=\"ngsUploadArea\"\n ngsUploadTrigger accept=\"image/*\"\n (fileSelected)=\"onFileSelected($event)\"\n multiple=\"false\" class=\"upload-area\">\n @if (!uploadArea.api.isDropActive) {\n Drag & drop image here or click to upload\n } @else {\n <div class=\"font-medium\">Drop image here</div>\n }\n </ngs-upload-area>\n}\n", styles: ["@layer properties;:host{display:block}:host ngs-upload-area{--ngs-upload-area-padding: calc(var(--spacing, .25rem) * 6) calc(var(--spacing, .25rem) * 10)}:host img{max-width:100%}:host .upload-container{position:relative}:host .upload-overlay{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:#fffc}:host .progress-bar{position:absolute;inset-inline-start:calc(var(--spacing, .25rem) * 0);inset-inline-end:calc(var(--spacing, .25rem) * 0);top:0}:host .uploaded-image{display:flex;width:704px;align-items:center;justify-content:center}:host .upload-overlay-text{background:#fff;border-radius:var(--radius-lg, .5rem);padding-inline:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 1.5);font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)))}:host .remove-button{position:absolute;inset-inline-end:calc(var(--spacing, .25rem) * 2);top:calc(var(--spacing, .25rem) * 4);z-index:1;width:max-content}:host .upload-area{cursor:pointer}:host .upload-area:hover{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--ngs-color-primary)}@property --tw-outline-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-outline-style: solid}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: 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: 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: ImageResizer, selector: "ngs-image-resizer", inputs: ["imageMaxWidth", "imageMinWidth"], outputs: ["imageResized"], exportAs: ["ngsImageResizer"] }, { kind: "component", type: FormField, selector: "ngs-form-field", inputs: ["labelMode", "subscriptHiddenIfEmpty", "sameHeightAsButton"], exportAs: ["ngsFormField"] }, { kind: "directive", type: Input, selector: "input[ngsInput], textarea[ngsInput]", inputs: ["id", "placeholder", "required", "disabled", "readonly", "errorStateMatcher"], exportAs: ["ngsInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ImageResizerImageDirective, selector: "[ngsImageResizerImage]", exportAs: ["ngsImageResizerImage"] }, { kind: "component", type: Label, selector: "ngs-label" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
141
|
+
], ngImport: i0, template: "@if (uploading()) {\n <div class=\"upload-container\">\n <div class=\"upload-overlay\">\n <ngs-progress-bar mode=\"indeterminate\" class=\"progress-bar\"/>\n <div class=\"remove-button\">\n <button ngsButton (click)=\"cancelUploading()\">\n <ngs-icon name=\"fluent:delete-24-regular\"/>\n </button>\n </div>\n <div class=\"upload-overlay-text\">Loading...</div>\n </div>\n <img [src]=\"selectedImage()\" [alt]=\"_alt()\">\n </div>\n} @else if (_src()) {\n <div class=\"uploaded-image\">\n <ngs-image-resizer (imageResized)=\"_onImageResized($event)\" [imageMaxWidth]=\"704\">\n <img [src]=\"_src()\" [alt]=\"_alt()\" ngsImageResizerImage [style.width.px]=\"_settings().width || null\">\n </ngs-image-resizer>\n </div>\n <ngs-form-field class=\"w-full mt-5\">\n <ngs-label>Alt text</ngs-label>\n <input ngsInput [(ngModel)]=\"_alt\" (ngModelChange)=\"_onAltChange()\">\n </ngs-form-field>\n} @else {\n <ngs-upload-area #uploadArea=\"ngsUploadArea\"\n ngsUploadTrigger accept=\"image/*\"\n (fileSelected)=\"onFileSelected($event)\"\n multiple=\"false\" class=\"upload-area\">\n @if (!uploadArea.api.isDropActive) {\n Drag & drop image here or click to upload\n } @else {\n <div class=\"font-medium\">Drop image here</div>\n }\n </ngs-upload-area>\n}\n", styles: ["@layer properties;:host{display:block;min-width:0}:host ngs-upload-area{--ngs-upload-area-padding: calc(var(--spacing, .25rem) * 6) calc(var(--spacing, .25rem) * 10)}:host img{max-width:100%}:host .upload-container{position:relative}:host .upload-overlay{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:#fffc}:host .progress-bar{position:absolute;inset-inline-start:calc(var(--spacing, .25rem) * 0);inset-inline-end:calc(var(--spacing, .25rem) * 0);top:0}:host .uploaded-image{display:flex;width:100%;max-width:704px;align-items:center;justify-content:center}:host .upload-overlay-text{background:#fff;border-radius:var(--radius-lg, .5rem);padding-inline:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 1.5);font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)))}:host .remove-button{position:absolute;inset-inline-end:calc(var(--spacing, .25rem) * 2);top:calc(var(--spacing, .25rem) * 4);z-index:1;width:max-content}:host .upload-area{cursor:pointer}:host .upload-area:hover{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--ngs-color-primary)}@property --tw-outline-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-outline-style: solid}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: 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: 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: ImageResizer, selector: "ngs-image-resizer", inputs: ["imageMaxWidth", "imageMinWidth"], outputs: ["imageResized"], exportAs: ["ngsImageResizer"] }, { kind: "component", type: FormField, selector: "ngs-form-field", inputs: ["labelMode", "subscriptHiddenIfEmpty", "sameHeightAsButton"], exportAs: ["ngsFormField"] }, { kind: "directive", type: Input, selector: "input[ngsInput], textarea[ngsInput]", inputs: ["id", "placeholder", "required", "disabled", "readonly", "errorStateMatcher"], exportAs: ["ngsInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ImageResizerImageDirective, selector: "[ngsImageResizerImage]", exportAs: ["ngsImageResizerImage"] }, { kind: "component", type: Label, selector: "ngs-label" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
129
142
|
}
|
|
130
143
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ImageBlockComponent, decorators: [{
|
|
131
144
|
type: Component,
|
|
@@ -149,8 +162,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
149
162
|
}
|
|
150
163
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
151
164
|
'(keypress)': 'handleKeyPress($event)',
|
|
152
|
-
}, template: "@if (uploading()) {\n <div class=\"upload-container\">\n <div class=\"upload-overlay\">\n <ngs-progress-bar mode=\"indeterminate\" class=\"progress-bar\"/>\n <div class=\"remove-button\">\n <button ngsButton (click)=\"cancelUploading()\">\n <ngs-icon name=\"fluent:delete-24-regular\"/>\n </button>\n </div>\n <div class=\"upload-overlay-text\">Loading...</div>\n </div>\n <img [src]=\"selectedImage()\" [alt]=\"_alt()\">\n </div>\n} @else if (_src()) {\n <div class=\"uploaded-image\">\n <ngs-image-resizer (imageResized)=\"_onImageResized($event)\" [imageMaxWidth]=\"704\">\n <img [src]=\"_src()\" [alt]=\"_alt()\" ngsImageResizerImage [style.width.px]=\"_settings().width || null\">\n </ngs-image-resizer>\n </div>\n <ngs-form-field class=\"w-full mt-5\">\n <ngs-label>Alt text</ngs-label>\n <input ngsInput [(ngModel)]=\"_alt\" (ngModelChange)=\"_onAltChange()\">\n </ngs-form-field>\n} @else {\n <ngs-upload-area #uploadArea=\"ngsUploadArea\"\n ngsUploadTrigger accept=\"image/*\"\n (fileSelected)=\"onFileSelected($event)\"\n multiple=\"false\" class=\"upload-area\">\n @if (!uploadArea.api.isDropActive) {\n Drag & drop image here or click to upload\n } @else {\n <div class=\"font-medium\">Drop image here</div>\n }\n </ngs-upload-area>\n}\n", styles: ["@layer properties;:host{display:block}:host ngs-upload-area{--ngs-upload-area-padding: calc(var(--spacing, .25rem) * 6) calc(var(--spacing, .25rem) * 10)}:host img{max-width:100%}:host .upload-container{position:relative}:host .upload-overlay{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:#fffc}:host .progress-bar{position:absolute;inset-inline-start:calc(var(--spacing, .25rem) * 0);inset-inline-end:calc(var(--spacing, .25rem) * 0);top:0}:host .uploaded-image{display:flex;width:704px;align-items:center;justify-content:center}:host .upload-overlay-text{background:#fff;border-radius:var(--radius-lg, .5rem);padding-inline:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 1.5);font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)))}:host .remove-button{position:absolute;inset-inline-end:calc(var(--spacing, .25rem) * 2);top:calc(var(--spacing, .25rem) * 4);z-index:1;width:max-content}:host .upload-area{cursor:pointer}:host .upload-area:hover{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--ngs-color-primary)}@property --tw-outline-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-outline-style: solid}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
153
|
-
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: true }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], _alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "_alt", required: false }] }, { type: i0.Output, args: ["_altChange"] }], _settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "_settings", required: false }] }, { type: i0.Output, args: ["_settingsChange"] }] } });
|
|
165
|
+
}, template: "@if (uploading()) {\n <div class=\"upload-container\">\n <div class=\"upload-overlay\">\n <ngs-progress-bar mode=\"indeterminate\" class=\"progress-bar\"/>\n <div class=\"remove-button\">\n <button ngsButton (click)=\"cancelUploading()\">\n <ngs-icon name=\"fluent:delete-24-regular\"/>\n </button>\n </div>\n <div class=\"upload-overlay-text\">Loading...</div>\n </div>\n <img [src]=\"selectedImage()\" [alt]=\"_alt()\">\n </div>\n} @else if (_src()) {\n <div class=\"uploaded-image\">\n <ngs-image-resizer (imageResized)=\"_onImageResized($event)\" [imageMaxWidth]=\"704\">\n <img [src]=\"_src()\" [alt]=\"_alt()\" ngsImageResizerImage [style.width.px]=\"_settings().width || null\">\n </ngs-image-resizer>\n </div>\n <ngs-form-field class=\"w-full mt-5\">\n <ngs-label>Alt text</ngs-label>\n <input ngsInput [(ngModel)]=\"_alt\" (ngModelChange)=\"_onAltChange()\">\n </ngs-form-field>\n} @else {\n <ngs-upload-area #uploadArea=\"ngsUploadArea\"\n ngsUploadTrigger accept=\"image/*\"\n (fileSelected)=\"onFileSelected($event)\"\n multiple=\"false\" class=\"upload-area\">\n @if (!uploadArea.api.isDropActive) {\n Drag & drop image here or click to upload\n } @else {\n <div class=\"font-medium\">Drop image here</div>\n }\n </ngs-upload-area>\n}\n", styles: ["@layer properties;:host{display:block;min-width:0}:host ngs-upload-area{--ngs-upload-area-padding: calc(var(--spacing, .25rem) * 6) calc(var(--spacing, .25rem) * 10)}:host img{max-width:100%}:host .upload-container{position:relative}:host .upload-overlay{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:#fffc}:host .progress-bar{position:absolute;inset-inline-start:calc(var(--spacing, .25rem) * 0);inset-inline-end:calc(var(--spacing, .25rem) * 0);top:0}:host .uploaded-image{display:flex;width:100%;max-width:704px;align-items:center;justify-content:center}:host .upload-overlay-text{background:#fff;border-radius:var(--radius-lg, .5rem);padding-inline:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 1.5);font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)))}:host .remove-button{position:absolute;inset-inline-end:calc(var(--spacing, .25rem) * 2);top:calc(var(--spacing, .25rem) * 4);z-index:1;width:max-content}:host .upload-area{cursor:pointer}:host .upload-area:hover{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--ngs-color-primary)}@property --tw-outline-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-outline-style: solid}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
166
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: true }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], _alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "_alt", required: false }] }, { type: i0.Output, args: ["_altChange"] }], _settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "_settings", required: false }] }, { type: i0.Output, args: ["_settingsChange"] }] } });
|
|
154
167
|
|
|
155
168
|
export { ImageBlockComponent };
|
|
156
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-image-block.component-
|
|
169
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-image-block.component-B3MnANpi.mjs.map
|
package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-B3MnANpi.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-image-block.component-B3MnANpi.mjs","sources":["../../../projects/components/content-editor/src/_builder/image-block/image-block.component.ts","../../../projects/components/content-editor/src/_builder/image-block/image-block.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, effect, untracked, forwardRef, inject, input, model, OnInit, signal } from '@angular/core';\nimport { UploadArea, UploadFileSelectedEvent, UploadTriggerDirective } from '@ngstarter-ui/components/upload';\nimport { ProgressBar } from '@ngstarter-ui/components/progress-bar';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport {\n CONTENT_BUILDER,\n CONTENT_EDITOR_BLOCK, ContentEditorDataBlock,\n ContentEditorImageBlockSettings,\n ContentEditorImageContent\n} from '../../types';\nimport { ImageResizer, ImageResizerImageDirective } from '@ngstarter-ui/components/image-resizer';\nimport { FormField, Label } from '@ngstarter-ui/components/form-field';\nimport { Input } from '@ngstarter-ui/components/input';\nimport { FormsModule } from '@angular/forms';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\n\n@Component({\n selector: 'ngs-image-block',\n imports: [\n UploadArea,\n UploadTriggerDirective,\n ProgressBar,\n Button,\n Icon,\n ImageResizer,\n FormField,\n Input,\n FormsModule,\n ImageResizerImageDirective,\n Label\n ],\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: forwardRef(() => ImageBlockComponent),\n multi: true\n }\n ],\n templateUrl: './image-block.component.html',\n styleUrl: './image-block.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '(keypress)': 'handleKeyPress($event)',\n }\n})\nexport class ImageBlockComponent implements OnInit, ContentEditorDataBlock {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n\n id = input.required<string>();\n content = input.required<ContentEditorImageContent>();\n settings = input.required<ContentEditorImageBlockSettings>();\n index = input.required<number>();\n props = input<unknown[]>([]);\n\n uploading = signal(false);\n selectedImage = signal<string>('');\n\n protected _src = signal<string>('');\n protected _alt = model<string>('');\n protected _settings = model<ContentEditorImageBlockSettings>({});\n readonly initialized = signal(false);\n\n constructor() {\n effect(() => {\n const content = this.content();\n const settings = this.settings();\n untracked(() => {\n this._src.set(content.src);\n this._alt.set(content.alt);\n this._settings.set({ ...settings });\n });\n });\n }\n\n ngOnInit() {\n this._src.set(this.content().src);\n this._alt.set(this.content().alt);\n this._settings.set(this.settings() || {});\n this.initialized.set(true);\n }\n\n focus() {\n if (this._src()) {\n this._contentBuilder.focusBlock(this.id());\n }\n }\n\n getData(): any {\n return {\n content: {\n src: this._src(),\n alt: this._alt()\n },\n settings: {\n ...this._settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n const src = this.getData().content.src;\n return typeof src === 'string' ? src.trim().length === 0 : !src;\n }\n\n protected cancelUploading() {\n this.uploading.set(false);\n }\n\n protected onFileSelected(event: UploadFileSelectedEvent): void {\n this.uploading.set(true);\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n this.selectedImage.set(reader.result as string);\n\n const img = new Image();\n img.onload = () => {\n let width = img.width;\n let height = img.height;\n const aspectRatio = width / height;\n\n if (width > 704) {\n width = 704;\n height = Math.round(width / aspectRatio);\n }\n\n this._settings.update(s => ({\n ...s,\n width,\n height\n }));\n };\n img.src = reader.result as string;\n\n const uploadFn = this._contentBuilder.getBlockDefOption('image', 'uploadFn');\n uploadFn(event.files[0], reader.result)\n .then((url: string) => {\n if (!this.uploading()) {\n this.selectedImage.set('');\n return;\n }\n\n this._src.set(url);\n this.selectedImage.set('');\n this.uploading.set(false);\n this.update();\n this.focus();\n });\n }, false);\n reader.readAsDataURL(event.files[0]);\n }\n\n protected _onAltChange() {\n this.update();\n }\n\n protected _onImageResized(options: any) {\n this._settings.set(options);\n this.update();\n }\n\n protected handleKeyPress(event: KeyboardEvent) {\n if (event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n }\n\n private update() {\n this._store.updateBlock(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","@if (uploading()) {\n <div class=\"upload-container\">\n <div class=\"upload-overlay\">\n <ngs-progress-bar mode=\"indeterminate\" class=\"progress-bar\"/>\n <div class=\"remove-button\">\n <button ngsButton (click)=\"cancelUploading()\">\n <ngs-icon name=\"fluent:delete-24-regular\"/>\n </button>\n </div>\n <div class=\"upload-overlay-text\">Loading...</div>\n </div>\n <img [src]=\"selectedImage()\" [alt]=\"_alt()\">\n </div>\n} @else if (_src()) {\n <div class=\"uploaded-image\">\n <ngs-image-resizer (imageResized)=\"_onImageResized($event)\" [imageMaxWidth]=\"704\">\n <img [src]=\"_src()\" [alt]=\"_alt()\" ngsImageResizerImage [style.width.px]=\"_settings().width || null\">\n </ngs-image-resizer>\n </div>\n <ngs-form-field class=\"w-full mt-5\">\n <ngs-label>Alt text</ngs-label>\n <input ngsInput [(ngModel)]=\"_alt\" (ngModelChange)=\"_onAltChange()\">\n </ngs-form-field>\n} @else {\n <ngs-upload-area #uploadArea=\"ngsUploadArea\"\n ngsUploadTrigger accept=\"image/*\"\n (fileSelected)=\"onFileSelected($event)\"\n multiple=\"false\" class=\"upload-area\">\n @if (!uploadArea.api.isDropActive) {\n Drag & drop image here or click to upload\n } @else {\n <div class=\"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C;AACJ,wBAAA,YAAY,EAAE,wBAAwB;AACvC,qBAAA,EAAA,QAAA,EAAA,y3CAAA,EAAA,MAAA,EAAA,CAAA,oiDAAA,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, PLATFORM_ID, ElementRef, input, output, Directive, 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, PLATFORM_ID, ElementRef, input, output, Directive, signal, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
4
|
import { isPlatformServer, NgTemplateOutlet } from '@angular/common';
|
|
6
5
|
import { C as CursorController } from './ngstarter-ui-components-content-editor-cursor-controller-4Ak8VqGX.mjs';
|
|
7
6
|
|
|
@@ -54,11 +53,13 @@ class ListBlockComponent {
|
|
|
54
53
|
...(ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []));
|
|
55
54
|
index = input.required(/* @ts-ignore */
|
|
56
55
|
...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
56
|
+
props = input([], /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "props" }] : /* istanbul ignore next */ []));
|
|
57
58
|
_placeholder = signal('List item', /* @ts-ignore */
|
|
58
59
|
...(ngDevMode ? [{ debugName: "_placeholder" }] : /* istanbul ignore next */ []));
|
|
59
60
|
_content = signal([
|
|
60
61
|
{
|
|
61
|
-
content:
|
|
62
|
+
content: [],
|
|
62
63
|
props: [],
|
|
63
64
|
children: []
|
|
64
65
|
}
|
|
@@ -68,10 +69,20 @@ class ListBlockComponent {
|
|
|
68
69
|
...(ngDevMode ? [{ debugName: "_listStyle" }] : /* istanbul ignore next */ []));
|
|
69
70
|
initialized = signal(false, /* @ts-ignore */
|
|
70
71
|
...(ngDevMode ? [{ debugName: "initialized" }] : /* istanbul ignore next */ []));
|
|
72
|
+
constructor() {
|
|
73
|
+
effect(() => {
|
|
74
|
+
const content = this.content();
|
|
75
|
+
const settings = this.settings();
|
|
76
|
+
untracked(() => {
|
|
77
|
+
this._content.set(cloneContentEditorValue(content.length ? content : [{ content: [], props: [], children: [] }]));
|
|
78
|
+
this._listStyle.set(settings.listStyle);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
71
82
|
ngOnInit() {
|
|
72
83
|
this._listStyle.set(this.settings().listStyle);
|
|
73
84
|
if (this.content().length !== 0) {
|
|
74
|
-
this._content.set(this.content());
|
|
85
|
+
this._content.set(cloneContentEditorValue(this.content()));
|
|
75
86
|
}
|
|
76
87
|
}
|
|
77
88
|
ngAfterViewInit() {
|
|
@@ -91,9 +102,9 @@ class ListBlockComponent {
|
|
|
91
102
|
event.stopPropagation();
|
|
92
103
|
if (level === 0) {
|
|
93
104
|
const content = contentEditable.getContent();
|
|
94
|
-
if (content) {
|
|
105
|
+
if (contentEditorText(content)) {
|
|
95
106
|
list.splice(index + 1, 0, {
|
|
96
|
-
content:
|
|
107
|
+
content: [],
|
|
97
108
|
props: [],
|
|
98
109
|
styles: {},
|
|
99
110
|
children: []
|
|
@@ -108,18 +119,18 @@ class ListBlockComponent {
|
|
|
108
119
|
}
|
|
109
120
|
}
|
|
110
121
|
else {
|
|
111
|
-
if (list[index] && !list[index].content) {
|
|
122
|
+
if (list[index] && !contentEditorText(list[index].content)) {
|
|
112
123
|
list.splice(index, 1);
|
|
113
124
|
const parentIndex = parentList.findIndex(item => item === parentItem);
|
|
114
125
|
parentList.splice(parentIndex + 1, 0, {
|
|
115
|
-
content:
|
|
126
|
+
content: [],
|
|
116
127
|
props: [],
|
|
117
128
|
children: []
|
|
118
129
|
});
|
|
119
130
|
}
|
|
120
131
|
else {
|
|
121
132
|
list.splice(index + 1, 0, {
|
|
122
|
-
content:
|
|
133
|
+
content: [],
|
|
123
134
|
props: [],
|
|
124
135
|
styles: {},
|
|
125
136
|
children: []
|
|
@@ -140,7 +151,7 @@ class ListBlockComponent {
|
|
|
140
151
|
};
|
|
141
152
|
}
|
|
142
153
|
isEmpty() {
|
|
143
|
-
return this.
|
|
154
|
+
return !this._content().some(item => contentEditorText(item.content).trim() || item.children.length > 0);
|
|
144
155
|
}
|
|
145
156
|
_onNodeAdded(node) {
|
|
146
157
|
this._focusItem(node.querySelector('.list-item-content'));
|
|
@@ -150,7 +161,7 @@ class ListBlockComponent {
|
|
|
150
161
|
cursorController.setToEnd();
|
|
151
162
|
}
|
|
152
163
|
_onKeyDown(event, contentEditable, list, index, level, parentItem, parentList, listItem) {
|
|
153
|
-
if (event.key === 'Backspace' && !contentEditable.getContent()) {
|
|
164
|
+
if (event.key === 'Backspace' && !contentEditorText(contentEditable.getContent())) {
|
|
154
165
|
const latestElementInParentList = listItem.closest('.list')?.parentNode;
|
|
155
166
|
list.splice(index, 1);
|
|
156
167
|
const prevElement = listItem.previousSibling;
|
|
@@ -194,13 +205,13 @@ class ListBlockComponent {
|
|
|
194
205
|
this._contentBuilder.emitContentChangeEvent();
|
|
195
206
|
}
|
|
196
207
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ListBlockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
197
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ListBlockComponent, isStandalone: true, selector: "ngs-list-block", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: true, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.list-bullet": "_listStyle() === 'bullet'", "class.list-ordered": "_listStyle() === 'ordered'" } }, providers: [
|
|
208
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ListBlockComponent, isStandalone: true, selector: "ngs-list-block", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: true, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.list-bullet": "_listStyle() === 'bullet'", "class.list-ordered": "_listStyle() === 'ordered'" } }, providers: [
|
|
198
209
|
{
|
|
199
210
|
provide: CONTENT_EDITOR_BLOCK,
|
|
200
211
|
useExisting: ListBlockComponent,
|
|
201
212
|
multi: true
|
|
202
213
|
}
|
|
203
|
-
], exportAs: ["ngsListBlock"], ngImport: i0, template: "<ul class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: _content(), level: 0, parentItem: null, parentList: [] }\"/>\n</ul>\n\n<ng-template #listTpl let-list let-level=\"level\" let-parentItem=\"parentItem\" let-parentList=\"parentList\">\n @for (item of list; track $index; let index = $index) {\n <li #listItem class=\"list-item\" [attr.id]=\"getId(level, index)\">\n <div [ngsContentEditorContentEditable]=\"item.content\"\n [props]=\"item.props\"\n (propsChanged)=\"onPropsChanged($event, item)\"\n #contentEditable=\"ngsContentEditorContentEditable\"\n class=\"list-item-content\"\n (contentChanged)=\"onContentChanged($event, list, index)\"\n (pressedEnter)=\"onPressedEnter($event, contentEditable, list, index, level, parentItem, parentList)\"\n (keydown)=\"_onKeyDown($event, contentEditable, list, index, level, parentItem, parentList, listItem)\"\n [attr.data-empty-placeholder]=\"_placeholder()\"></div>\n @if (item.children.length > 0) {\n <ol class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: item.children, level: level + 1, parentItem: item, parentList: list }\"/>\n </ol>\n }\n </li>\n }\n</ng-template>\n", styles: [":host .list{display:flex;flex-direction:column;gap:calc(var(--spacing, .25rem) * 2);padding-inline-start:calc(var(--spacing, .25rem) * 4);--tw-outline-style: none;outline-style:none}:host .list .list{margin-top:calc(var(--spacing, .25rem) * 2);padding-inline-start:calc(var(--spacing, .25rem) * 4)}:host.list-ordered .list{list-style-type:decimal}:host.list-bullet .list{list-style-type:disc}:host .list-item-content{--tw-outline-style: none;outline-style:none}:host .list-item-content:empty:before{content:attr(data-empty-placeholder);color:var(--ngs-color-neutral-500)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: ContentEditorContentEditableDirective, selector: "[ngsContentEditorContentEditable]", inputs: ["ngsContentEditorContentEditable", "settings", "props"], outputs: ["contentChanged", "
|
|
214
|
+
], exportAs: ["ngsListBlock"], ngImport: i0, template: "<ul class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: _content(), level: 0, parentItem: null, parentList: [] }\"/>\n</ul>\n\n<ng-template #listTpl let-list let-level=\"level\" let-parentItem=\"parentItem\" let-parentList=\"parentList\">\n @for (item of list; track $index; let index = $index) {\n <li #listItem class=\"list-item\" [attr.id]=\"getId(level, index)\">\n <div [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"item.content\"\n [props]=\"item.props\"\n (propsChanged)=\"onPropsChanged($event, item)\"\n #contentEditable=\"ngsContentEditorContentEditable\"\n class=\"list-item-content\"\n (contentChanged)=\"onContentChanged($event, list, index)\"\n (pressedEnter)=\"onPressedEnter($event, contentEditable, list, index, level, parentItem, parentList)\"\n (keydown)=\"_onKeyDown($event, contentEditable, list, index, level, parentItem, parentList, listItem)\"\n [attr.data-empty-placeholder]=\"_placeholder()\"></div>\n @if (item.children.length > 0) {\n <ol class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: item.children, level: level + 1, parentItem: item, parentList: list }\"/>\n </ol>\n }\n </li>\n }\n</ng-template>\n", styles: [":host .list{display:flex;flex-direction:column;gap:calc(var(--spacing, .25rem) * 2);padding-inline-start:calc(var(--spacing, .25rem) * 4);--tw-outline-style: none;outline-style:none}:host .list .list{margin-top:calc(var(--spacing, .25rem) * 2);padding-inline-start:calc(var(--spacing, .25rem) * 4)}:host.list-ordered .list{list-style-type:decimal}:host.list-bullet .list{list-style-type:disc}:host .list-item-content{--tw-outline-style: none;outline-style:none}:host .list-item-content:empty:before{content:attr(data-empty-placeholder);color:var(--ngs-color-neutral-500)}\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"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ContentObserverDirective, selector: "[ngsContentObserver]", inputs: ["detectAddedNode"], outputs: ["nodeAdded"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
204
215
|
}
|
|
205
216
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ListBlockComponent, decorators: [{
|
|
206
217
|
type: Component,
|
|
@@ -217,8 +228,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
217
228
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
218
229
|
'[class.list-bullet]': "_listStyle() === 'bullet'",
|
|
219
230
|
'[class.list-ordered]': "_listStyle() === 'ordered'",
|
|
220
|
-
}, template: "<ul class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: _content(), level: 0, parentItem: null, parentList: [] }\"/>\n</ul>\n\n<ng-template #listTpl let-list let-level=\"level\" let-parentItem=\"parentItem\" let-parentList=\"parentList\">\n @for (item of list; track $index; let index = $index) {\n <li #listItem class=\"list-item\" [attr.id]=\"getId(level, index)\">\n <div [ngsContentEditorContentEditable]=\"item.content\"\n [props]=\"item.props\"\n (propsChanged)=\"onPropsChanged($event, item)\"\n #contentEditable=\"ngsContentEditorContentEditable\"\n class=\"list-item-content\"\n (contentChanged)=\"onContentChanged($event, list, index)\"\n (pressedEnter)=\"onPressedEnter($event, contentEditable, list, index, level, parentItem, parentList)\"\n (keydown)=\"_onKeyDown($event, contentEditable, list, index, level, parentItem, parentList, listItem)\"\n [attr.data-empty-placeholder]=\"_placeholder()\"></div>\n @if (item.children.length > 0) {\n <ol class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: item.children, level: level + 1, parentItem: item, parentList: list }\"/>\n </ol>\n }\n </li>\n }\n</ng-template>\n", styles: [":host .list{display:flex;flex-direction:column;gap:calc(var(--spacing, .25rem) * 2);padding-inline-start:calc(var(--spacing, .25rem) * 4);--tw-outline-style: none;outline-style:none}:host .list .list{margin-top:calc(var(--spacing, .25rem) * 2);padding-inline-start:calc(var(--spacing, .25rem) * 4)}:host.list-ordered .list{list-style-type:decimal}:host.list-bullet .list{list-style-type:disc}:host .list-item-content{--tw-outline-style: none;outline-style:none}:host .list-item-content:empty:before{content:attr(data-empty-placeholder);color:var(--ngs-color-neutral-500)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
221
|
-
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: true }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }] } });
|
|
231
|
+
}, template: "<ul class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: _content(), level: 0, parentItem: null, parentList: [] }\"/>\n</ul>\n\n<ng-template #listTpl let-list let-level=\"level\" let-parentItem=\"parentItem\" let-parentList=\"parentList\">\n @for (item of list; track $index; let index = $index) {\n <li #listItem class=\"list-item\" [attr.id]=\"getId(level, index)\">\n <div [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"item.content\"\n [props]=\"item.props\"\n (propsChanged)=\"onPropsChanged($event, item)\"\n #contentEditable=\"ngsContentEditorContentEditable\"\n class=\"list-item-content\"\n (contentChanged)=\"onContentChanged($event, list, index)\"\n (pressedEnter)=\"onPressedEnter($event, contentEditable, list, index, level, parentItem, parentList)\"\n (keydown)=\"_onKeyDown($event, contentEditable, list, index, level, parentItem, parentList, listItem)\"\n [attr.data-empty-placeholder]=\"_placeholder()\"></div>\n @if (item.children.length > 0) {\n <ol class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: item.children, level: level + 1, parentItem: item, parentList: list }\"/>\n </ol>\n }\n </li>\n }\n</ng-template>\n", styles: [":host .list{display:flex;flex-direction:column;gap:calc(var(--spacing, .25rem) * 2);padding-inline-start:calc(var(--spacing, .25rem) * 4);--tw-outline-style: none;outline-style:none}:host .list .list{margin-top:calc(var(--spacing, .25rem) * 2);padding-inline-start:calc(var(--spacing, .25rem) * 4)}:host.list-ordered .list{list-style-type:decimal}:host.list-bullet .list{list-style-type:disc}:host .list-item-content{--tw-outline-style: none;outline-style:none}:host .list-item-content:empty:before{content:attr(data-empty-placeholder);color:var(--ngs-color-neutral-500)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
232
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: true }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
|
|
222
233
|
|
|
223
234
|
export { ListBlockComponent };
|
|
224
|
-
//# sourceMappingURL=ngstarter-ui-components-content-editor-list-block.component-
|
|
235
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-list-block.component-6SMBxIl4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-list-block.component-6SMBxIl4.mjs","sources":["../../../projects/components/content-editor/src/content-observer.directive.ts","../../../projects/components/content-editor/src/_builder/list-block/list-block.component.ts","../../../projects/components/content-editor/src/_builder/list-block/list-block.component.html"],"sourcesContent":["import { Directive, ElementRef, inject, input, OnDestroy, OnInit, output, PLATFORM_ID } from '@angular/core';\nimport { isPlatformServer } from '@angular/common';\n\n@Directive({\n selector: '[ngsContentObserver]'\n})\nexport class ContentObserverDirective implements OnInit, OnDestroy {\n private _platformId = inject(PLATFORM_ID);\n private _elementRef = inject(ElementRef);\n private _observer!: MutationObserver;\n\n detectAddedNode = input.required();\n\n readonly nodeAdded = output<HTMLElement>();\n\n ngOnInit() {\n if (isPlatformServer(this._platformId)) {\n return;\n }\n\n const config = { attributes: false, childList: true, subtree: false };\n const callback = (mutationList: any, observer: any) => {\n for (const mutation of mutationList) {\n if (mutation.type === 'childList') {\n const addedNode = mutation.addedNodes[0];\n\n if (addedNode && addedNode.tagName && addedNode.classList.contains(this.detectAddedNode())) {\n this.nodeAdded.emit(addedNode);\n }\n }\n }\n };\n this._observer = new MutationObserver(callback);\n this._observer.observe(this._elementRef.nativeElement, config);\n }\n\n ngOnDestroy() {\n this._observer?.disconnect();\n }\n}\n","import { NgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { contentEditorText, cloneContentEditorValue } from '../../document';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component, effect, untracked,\n DestroyRef,\n ElementRef,\n inject,\n input,\n OnInit,\n signal\n} from '@angular/core';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport {\n CONTENT_BUILDER, CONTENT_EDITOR_BLOCK,\n ContentEditorDataBlock,\n ContentEditorItemProperty,\n ContentEditorListItem,\n ContentEditorListSettings\n} from '../../types';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { ContentObserverDirective } from '../../content-observer.directive';\nimport { CursorController } from '../../utils/cursor-controller';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\n\n@Component({\n selector: 'ngs-list-block',\n exportAs: 'ngsListBlock',\n imports: [\n ContentEditorContentEditableDirective,\n NgTemplateOutlet,\n ContentObserverDirective\n ],\n templateUrl: './list-block.component.html',\n styleUrl: './list-block.component.scss',\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: ListBlockComponent,\n multi: true\n }\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.list-bullet]': \"_listStyle() === 'bullet'\",\n '[class.list-ordered]': \"_listStyle() === 'ordered'\",\n }\n})\nexport class ListBlockComponent implements OnInit, ContentEditorDataBlock, AfterViewInit {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n\n id = input.required<string>();\n content = input.required<ContentEditorListItem[]>();\n settings = input.required<ContentEditorListSettings>();\n index = input.required<number>();\n props = input<ContentEditorItemProperty[]>([]);\n\n protected _placeholder = signal<string>('List item');\n protected _content = signal<ContentEditorListItem[]>([\n {\n content: [],\n props: [],\n children: []\n }\n ]);\n protected _listStyle = signal('');\n readonly initialized = signal(false);\n\n constructor() {\n effect(() => {\n const content = this.content();\n const settings = this.settings();\n untracked(() => {\n this._content.set(cloneContentEditorValue(content.length ? content : [{ content: [], props: [], children: [] }]));\n this._listStyle.set(settings.listStyle);\n });\n });\n }\n\n ngOnInit() {\n this._listStyle.set(this.settings().listStyle);\n\n if (this.content().length !== 0) {\n this._content.set(cloneContentEditorValue(this.content()));\n }\n }\n\n ngAfterViewInit() {\n this.initialized.set(true);\n }\n\n focus() {\n }\n\n protected onContentChanged(content: readonly NgsHeadlessEditorText[], list: ContentEditorListItem[], index: number) {\n if (!list[index]) {\n return;\n }\n\n list[index].content = content;\n this.update();\n }\n\n protected onPressedEnter(\n event: KeyboardEvent,\n contentEditable: ContentEditorContentEditableDirective,\n list: ContentEditorListItem[],\n index: number,\n level: number,\n parentItem: ContentEditorListItem | null,\n parentList: ContentEditorListItem[]\n ) {\n event.preventDefault();\n event.stopPropagation();\n\n if (level === 0) {\n const content = contentEditable.getContent();\n\n if (contentEditorText(content)) {\n list.splice(index + 1, 0, {\n content: [],\n props: [],\n styles: {},\n children: []\n });\n } else {\n list.splice(index, 1);\n\n if (list.length === 0) {\n this._contentBuilder.deleteBlock(this.id());\n }\n\n this._contentBuilder.insertEmptyBlock(this.index());\n }\n } else {\n if (list[index] && !contentEditorText(list[index].content)) {\n list.splice(index, 1);\n const parentIndex = parentList.findIndex(item => item === parentItem);\n parentList.splice(parentIndex + 1, 0, {\n content: [],\n props: [],\n children: []\n });\n } else {\n list.splice(index + 1, 0, {\n content: [],\n props: [],\n styles: {},\n children: []\n });\n }\n }\n\n this.update();\n }\n\n getId(level: number, index: number): string {\n return 'item-level-' + (level + index + 2).toString();\n }\n\n getData(): any {\n return {\n content: this._content(),\n settings: {\n ...this.settings(),\n }\n };\n }\n\n isEmpty(): boolean {\n return !this._content().some(item => contentEditorText(item.content).trim() || item.children.length > 0);\n }\n\n protected _onNodeAdded(node: HTMLElement) {\n this._focusItem(node.querySelector('.list-item-content') as HTMLElement);\n }\n\n protected _focusItem(element: HTMLElement) {\n const cursorController = new CursorController(element);\n cursorController.setToEnd();\n }\n\n protected _onKeyDown(\n event: KeyboardEvent,\n contentEditable: ContentEditorContentEditableDirective,\n list: ContentEditorListItem[],\n index: number,\n level: number,\n parentItem: ContentEditorListItem | null,\n parentList: ContentEditorListItem[],\n listItem: HTMLElement\n ) {\n if (event.key === 'Backspace' && !contentEditorText(contentEditable.getContent())) {\n const latestElementInParentList = (listItem.closest('.list') as HTMLElement)?.parentNode;\n list.splice(index, 1);\n const prevElement = listItem.previousSibling as HTMLElement;\n\n if (prevElement) {\n this._focusItem(prevElement.querySelector('.list-item-content') as HTMLElement);\n } else {\n if (latestElementInParentList) {\n this._focusItem(latestElementInParentList.querySelector('.list-item-content') as HTMLElement);\n }\n }\n } else if (event.key === 'Tab') {\n event.preventDefault();\n event.stopPropagation();\n\n if (event.shiftKey && parentItem) {\n const cached = JSON.parse(JSON.stringify(list[index]));\n list.splice(index, 1);\n const parentIndex = parentList.findIndex(item => item === parentItem);\n parentList.splice(parentIndex + 1, 0, cached);\n } else {\n if (list[index - 1]) {\n const cached = JSON.parse(JSON.stringify(list[index]));\n list.splice(index, 1);\n list[index - 1].children.push(cached);\n }\n }\n }\n\n if (level === 0 && list.length === 0) {\n this._contentBuilder.deleteBlock(this.id());\n }\n\n this.update();\n }\n\n onPropsChanged(props: ContentEditorItemProperty[], item: any) {\n item.props = props;\n this.update();\n }\n\n private update() {\n this._store.updateBlock(this.id(), {...this.getData(), isEmpty: this.isEmpty()});\n this._contentBuilder.emitContentChangeEvent();\n }\n}\n","<ul class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: _content(), level: 0, parentItem: null, parentList: [] }\"/>\n</ul>\n\n<ng-template #listTpl let-list let-level=\"level\" let-parentItem=\"parentItem\" let-parentList=\"parentList\">\n @for (item of list; track $index; let index = $index) {\n <li #listItem class=\"list-item\" [attr.id]=\"getId(level, index)\">\n <div [singleLine]=\"true\"\n [ngsContentEditorContentEditable]=\"item.content\"\n [props]=\"item.props\"\n (propsChanged)=\"onPropsChanged($event, item)\"\n #contentEditable=\"ngsContentEditorContentEditable\"\n class=\"list-item-content\"\n (contentChanged)=\"onContentChanged($event, list, index)\"\n (pressedEnter)=\"onPressedEnter($event, contentEditable, list, index, level, parentItem, parentList)\"\n (keydown)=\"_onKeyDown($event, contentEditable, list, index, level, parentItem, parentList, listItem)\"\n [attr.data-empty-placeholder]=\"_placeholder()\"></div>\n @if (item.children.length > 0) {\n <ol class=\"list\"\n ngsContentObserver\n detectAddedNode=\"list-item\"\n (nodeAdded)=\"_onNodeAdded($event)\">\n <ng-container [ngTemplateOutlet]=\"listTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: item.children, level: level + 1, parentItem: item, parentList: list }\"/>\n </ol>\n }\n </li>\n }\n</ng-template>\n"],"names":[],"mappings":";;;;;;MAMa,wBAAwB,CAAA;AAC3B,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AACjC,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,SAAS;IAEjB,eAAe,GAAG,KAAK,CAAC,QAAQ;wFAAE;IAEzB,SAAS,GAAG,MAAM,EAAe;IAE1C,QAAQ,GAAA;AACN,QAAA,IAAI,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YACtC;QACF;AAEA,QAAA,MAAM,MAAM,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;AACrE,QAAA,MAAM,QAAQ,GAAG,CAAC,YAAiB,EAAE,QAAa,KAAI;AACpD,YAAA,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE;AACnC,gBAAA,IAAI,QAAQ,CAAC,IAAI,KAAK,WAAW,EAAE;oBACjC,MAAM,SAAS,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;AAExC,oBAAA,IAAI,SAAS,IAAI,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE;AAC1F,wBAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC;oBAChC;gBACF;YACF;AACF,QAAA,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC;AAC/C,QAAA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,CAAC;IAChE;IAEA,WAAW,GAAA;AACT,QAAA,IAAI,CAAC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AA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAiBf,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAvB9B,SAAS;+BACE,gBAAgB,EAAA,QAAA,EAChB,cAAc,EAAA,OAAA,EACf;wBACP,qCAAqC;wBACrC,gBAAgB;wBAChB;qBACD,EAAA,SAAA,EAGU;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,oBAAoB;AAC7B,4BAAA,WAAW,EAAA,kBAAoB;AAC/B,4BAAA,KAAK,EAAE;AACR;qBACF,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,qBAAqB,EAAE,2BAA2B;AAClD,wBAAA,sBAAsB,EAAE,4BAA4B;AACrD,qBAAA,EAAA,QAAA,EAAA,2nDAAA,EAAA,MAAA,EAAA,CAAA,koBAAA,CAAA,EAAA;;;;;"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { DOCUMENT, NgComponentOutlet, AsyncPipe } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, viewChild, input, signal, EventEmitter, effect, afterNextRender, DestroyRef, computed, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { CdkDropList, CdkDrag, CdkDragHandle } from '@angular/cdk/drag-drop';
|
|
5
|
+
import { Button } from '@ngstarter-ui/components/button';
|
|
6
|
+
import { Icon } from '@ngstarter-ui/components/icon';
|
|
7
|
+
import { Menu, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';
|
|
8
|
+
import { a as CONTENT_BUILDER, C as ContentBuilderStore, k as contentEditorCollection, l as contentEditorBlockView, c as cloneContentEditorValue, m as contentEditorChildCollections, h as findContentEditorBlock } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor--rb3-UuO.mjs';
|
|
9
|
+
import { createNgsHeadlessEditorId } from '@ngstarter-ui/components/headless-editor';
|
|
10
|
+
|
|
11
|
+
class ContentEditorNestedBlocks {
|
|
12
|
+
parent = inject(CONTENT_BUILDER, { skipSelf: true });
|
|
13
|
+
store = inject(ContentBuilderStore);
|
|
14
|
+
document = inject(DOCUMENT);
|
|
15
|
+
dropList = viewChild.required(CdkDropList, /* @ts-ignore */
|
|
16
|
+
...(ngDevMode ? [{ debugName: "dropList" }] : /* istanbul ignore next */ []));
|
|
17
|
+
connectedDropLists = this.store.dropLists;
|
|
18
|
+
scope = input.required(/* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "scope" }] : /* istanbul ignore next */ []));
|
|
20
|
+
emptyBlock = signal(this.rootBuilder.createBlockView('paragraph'), /* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [{ debugName: "emptyBlock" }] : /* istanbul ignore next */ []));
|
|
22
|
+
focusChanged = new EventEmitter();
|
|
23
|
+
constructor() {
|
|
24
|
+
effect(() => {
|
|
25
|
+
if (this.blocks().some(block => block.id === this.emptyBlock().id))
|
|
26
|
+
this.emptyBlock.set(this.rootBuilder.createBlockView('paragraph'));
|
|
27
|
+
});
|
|
28
|
+
let registered = null;
|
|
29
|
+
afterNextRender(() => { registered = this.dropList(); this.store.registerDropList(registered); });
|
|
30
|
+
inject(DestroyRef).onDestroy(() => { if (registered)
|
|
31
|
+
this.store.unregisterDropList(registered); });
|
|
32
|
+
}
|
|
33
|
+
get rootBuilder() { return this.parent.rootBuilder; }
|
|
34
|
+
blocks = computed(() => contentEditorCollection(this.store.editor.document().blocks, this.scope()).map(contentEditorBlockView), /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "blocks" }] : /* istanbul ignore next */ []));
|
|
36
|
+
renderedBlocks = computed(() => {
|
|
37
|
+
const blocks = this.blocks();
|
|
38
|
+
return blocks.length ? blocks : [this.emptyBlock()];
|
|
39
|
+
}, /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "renderedBlocks" }] : /* istanbul ignore next */ []));
|
|
41
|
+
getBlockComponent(type) { return this.rootBuilder.getBlockComponent(type); }
|
|
42
|
+
getBlockDefOption(type, key) { return this.rootBuilder.getBlockDefOption(type, key); }
|
|
43
|
+
emitContentChangeEvent() { }
|
|
44
|
+
focusBlock(id) { this.store.setFocusedBlockId(id); this.focusChanged.emit(); }
|
|
45
|
+
insertEmptyBlock(index) { this.addBlock('paragraph', {}, index + 1); }
|
|
46
|
+
updateParagraph(id, data) {
|
|
47
|
+
if (this.blocks().some(block => block.id === id))
|
|
48
|
+
this.store.updateBlock(id, data);
|
|
49
|
+
else if (id === this.emptyBlock().id)
|
|
50
|
+
this.store.addBlock({ ...this.emptyBlock(), ...data }, this.blocks().length, this.scope());
|
|
51
|
+
}
|
|
52
|
+
addBlock(type, settings = {}, index = this.blocks().length) {
|
|
53
|
+
const block = this.rootBuilder.createBlockView(type, settings);
|
|
54
|
+
this.store.addBlock(block, index, this.scope());
|
|
55
|
+
this.focusBlock(block.id);
|
|
56
|
+
}
|
|
57
|
+
deleteBlock(id) {
|
|
58
|
+
const index = this.blocks().findIndex(block => block.id === id);
|
|
59
|
+
if (index < 0)
|
|
60
|
+
return;
|
|
61
|
+
this.store.deleteBlock(id, index);
|
|
62
|
+
this.focusBlock(this.blocks()[Math.max(0, index - 1)]?.id ?? null);
|
|
63
|
+
}
|
|
64
|
+
duplicateBlock(id) {
|
|
65
|
+
const index = this.blocks().findIndex(block => block.id === id);
|
|
66
|
+
if (index < 0)
|
|
67
|
+
return;
|
|
68
|
+
const block = cloneContentEditorValue(this.blocks()[index]);
|
|
69
|
+
const reidentify = (item) => {
|
|
70
|
+
item.id = createNgsHeadlessEditorId(item.type);
|
|
71
|
+
for (const children of contentEditorChildCollections(item))
|
|
72
|
+
for (const child of children)
|
|
73
|
+
reidentify(child);
|
|
74
|
+
if (item.type === 'grid')
|
|
75
|
+
for (const cell of item.content.cells)
|
|
76
|
+
cell.id = createNgsHeadlessEditorId('cell');
|
|
77
|
+
if (item.type === 'gallery')
|
|
78
|
+
for (const image of item.content.images)
|
|
79
|
+
image.id = createNgsHeadlessEditorId('image');
|
|
80
|
+
};
|
|
81
|
+
reidentify(block);
|
|
82
|
+
this.store.addBlock(block, index + 1, this.scope());
|
|
83
|
+
}
|
|
84
|
+
drop(event) {
|
|
85
|
+
this.store.moveBetweenCollections(event.previousIndex, event.currentIndex, event.previousContainer.data, event.container.data);
|
|
86
|
+
}
|
|
87
|
+
onDragStarted() { this.store.setDragging(true); }
|
|
88
|
+
onDragEnded() { this.store.setDragging(false); }
|
|
89
|
+
canEnter = (drag, drop) => {
|
|
90
|
+
const pointer = this.store.dragPointer();
|
|
91
|
+
const nearest = pointer ? this.document.elementFromPoint(pointer.x, pointer.y)?.closest('.cdk-drop-list') : null;
|
|
92
|
+
if (nearest && nearest.id !== drop.id)
|
|
93
|
+
return false;
|
|
94
|
+
const parentId = drop.data.parentId;
|
|
95
|
+
const block = findContentEditorBlock(this.store.editor.document().blocks, drag.data);
|
|
96
|
+
return !parentId || !block || !findContentEditorBlock([block], parentId);
|
|
97
|
+
};
|
|
98
|
+
onKeyDown(event) {
|
|
99
|
+
if (event.defaultPrevented)
|
|
100
|
+
return;
|
|
101
|
+
if ((event.ctrlKey || event.metaKey) && ['z', 'y'].includes(event.key.toLowerCase())) {
|
|
102
|
+
const redo = event.key.toLowerCase() === 'y' || event.shiftKey;
|
|
103
|
+
if (redo ? this.store.editor.redo() : this.store.editor.undo())
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
event.stopPropagation();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorNestedBlocks, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
109
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ContentEditorNestedBlocks, isStandalone: true, selector: "ngs-content-editor-nested-blocks", inputs: { scope: { classPropertyName: "scope", publicName: "scope", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "keydown": "onKeyDown($event)" } }, providers: [{ provide: CONTENT_BUILDER, useExisting: forwardRef(() => ContentEditorNestedBlocks) }], viewQueries: [{ propertyName: "dropList", first: true, predicate: CdkDropList, descendants: true, isSignal: true }], ngImport: i0, template: "<div cdkDropList [cdkDropListData]=\"scope()\" [cdkDropListConnectedTo]=\"connectedDropLists()\" [cdkDropListEnterPredicate]=\"canEnter\" (cdkDropListDropped)=\"drop($event)\" class=\"min-h-12\">\n @for (block of renderedBlocks(); track block.id) {\n <div cdkDrag [cdkDragData]=\"block.id\" (cdkDragStarted)=\"onDragStarted()\" (cdkDragEnded)=\"onDragEnded()\" class=\"nested-block relative min-w-0 py-2\" [attr.data-block-id]=\"block.id\">\n <div class=\"nested-controls block-controls absolute top-1/2 z-10 flex -translate-y-1/2 items-center\"\n [class.is-menu-open]=\"addTrigger.menuOpen() || actionsTrigger.menuOpen()\">\n <button ngsIconButton aria-label=\"Add block\" #addTrigger=\"ngsMenuTrigger\"\n [ngsMenuTriggerFor]=\"rootBuilder.blockMenu()\" [ngsMenuTriggerRestoreFocus]=\"false\"\n [ngsMenuTriggerData]=\"{target: {scope: scope(), afterId: block.id}}\">\n <ngs-icon name=\"fluent:add-24-regular\"/>\n </button>\n <button ngsIconButton cdkDragHandle [ngsMenuTriggerFor]=\"blockMenu\"\n #actionsTrigger=\"ngsMenuTrigger\" aria-label=\"Move block\"><ngs-icon name=\"fluent:re-order-dots-vertical-24-regular\"/></button>\n <ngs-menu #blockMenu>\n <button ngs-menu-item (click)=\"duplicateBlock(block.id)\">Duplicate</button>\n <button ngs-menu-item (click)=\"deleteBlock(block.id)\">Delete</button>\n </ngs-menu>\n </div>\n <div class=\"min-w-0\">\n <ng-container [ngComponentOutlet]=\"getBlockComponent(block.type) | async\"\n [ngComponentOutletInputs]=\"{id: block.id, content: block.content, settings: block.settings, props: block.props, index: $index}\"/>\n </div>\n </div>\n }\n</div>\n", styles: [":host{--ngs-content-editor-nested-controls-offset: 0px;display:block;min-width:0}:host .nested-controls{--ngs-button-height: calc(var(--spacing, .25rem) * 7);right:100%;width:calc(calc(var(--spacing, .25rem) * 18) + var(--ngs-content-editor-nested-controls-offset));padding-left:calc(var(--spacing, .25rem) * 2);padding-right:calc(calc(var(--spacing, .25rem) * 2) + var(--ngs-content-editor-nested-controls-offset));opacity:0;pointer-events:none}:host .nested-controls.is-menu-open{opacity:1;pointer-events:auto}:host .nested-block:hover .nested-controls,:host .nested-block:focus-within .nested-controls{opacity:1;pointer-events:auto}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "component", type: Button, selector: " button[ngsButton], button[ngsIconButton], a[ngsButton], a[ngsIconButton] ", inputs: ["ngsButton", "ngsIconButton", "loading", "disabled", "disabledInteractive", "disableRipple", "reverse", "fullWidth", "hideTextOnMobile"], exportAs: ["ngsButton"] }, { kind: "component", type: Icon, selector: "ngs-icon", inputs: ["name"], exportAs: ["ngsIcon"] }, { kind: "component", type: Menu, selector: "ngs-menu", inputs: ["role", "classList", "xPosition", "yPosition", "pushIntoViewport"], outputs: ["closed"], exportAs: ["ngsMenu"] }, { kind: "component", type: MenuItem, selector: "ngs-menu-item, [ngs-menu-item]", inputs: ["disabled", "role", "selected"], outputs: ["_triggered"], exportAs: ["ngsMenuItem"] }, { kind: "directive", type: MenuTrigger, selector: "[ngsMenuTriggerFor]", inputs: ["ngsMenuTriggerFor", "ngsMenuTriggerData", "ngsMenuDisabled", "xPosition", "yPosition", "ngsMenuTriggerRestoreFocus"], outputs: ["menuOpened", "menuClosed"], exportAs: ["ngsMenuTrigger"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
110
|
+
}
|
|
111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorNestedBlocks, decorators: [{
|
|
112
|
+
type: Component,
|
|
113
|
+
args: [{ selector: 'ngs-content-editor-nested-blocks', imports: [AsyncPipe, NgComponentOutlet, CdkDrag, CdkDragHandle, CdkDropList, Button, Icon, Menu, MenuItem, MenuTrigger], providers: [{ provide: CONTENT_BUILDER, useExisting: forwardRef(() => ContentEditorNestedBlocks) }], changeDetection: ChangeDetectionStrategy.OnPush, host: { '(keydown)': 'onKeyDown($event)' }, template: "<div cdkDropList [cdkDropListData]=\"scope()\" [cdkDropListConnectedTo]=\"connectedDropLists()\" [cdkDropListEnterPredicate]=\"canEnter\" (cdkDropListDropped)=\"drop($event)\" class=\"min-h-12\">\n @for (block of renderedBlocks(); track block.id) {\n <div cdkDrag [cdkDragData]=\"block.id\" (cdkDragStarted)=\"onDragStarted()\" (cdkDragEnded)=\"onDragEnded()\" class=\"nested-block relative min-w-0 py-2\" [attr.data-block-id]=\"block.id\">\n <div class=\"nested-controls block-controls absolute top-1/2 z-10 flex -translate-y-1/2 items-center\"\n [class.is-menu-open]=\"addTrigger.menuOpen() || actionsTrigger.menuOpen()\">\n <button ngsIconButton aria-label=\"Add block\" #addTrigger=\"ngsMenuTrigger\"\n [ngsMenuTriggerFor]=\"rootBuilder.blockMenu()\" [ngsMenuTriggerRestoreFocus]=\"false\"\n [ngsMenuTriggerData]=\"{target: {scope: scope(), afterId: block.id}}\">\n <ngs-icon name=\"fluent:add-24-regular\"/>\n </button>\n <button ngsIconButton cdkDragHandle [ngsMenuTriggerFor]=\"blockMenu\"\n #actionsTrigger=\"ngsMenuTrigger\" aria-label=\"Move block\"><ngs-icon name=\"fluent:re-order-dots-vertical-24-regular\"/></button>\n <ngs-menu #blockMenu>\n <button ngs-menu-item (click)=\"duplicateBlock(block.id)\">Duplicate</button>\n <button ngs-menu-item (click)=\"deleteBlock(block.id)\">Delete</button>\n </ngs-menu>\n </div>\n <div class=\"min-w-0\">\n <ng-container [ngComponentOutlet]=\"getBlockComponent(block.type) | async\"\n [ngComponentOutletInputs]=\"{id: block.id, content: block.content, settings: block.settings, props: block.props, index: $index}\"/>\n </div>\n </div>\n }\n</div>\n", styles: [":host{--ngs-content-editor-nested-controls-offset: 0px;display:block;min-width:0}:host .nested-controls{--ngs-button-height: calc(var(--spacing, .25rem) * 7);right:100%;width:calc(calc(var(--spacing, .25rem) * 18) + var(--ngs-content-editor-nested-controls-offset));padding-left:calc(var(--spacing, .25rem) * 2);padding-right:calc(calc(var(--spacing, .25rem) * 2) + var(--ngs-content-editor-nested-controls-offset));opacity:0;pointer-events:none}:host .nested-controls.is-menu-open{opacity:1;pointer-events:auto}:host .nested-block:hover .nested-controls,:host .nested-block:focus-within .nested-controls{opacity:1;pointer-events:auto}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
114
|
+
}], ctorParameters: () => [], propDecorators: { dropList: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkDropList), { isSignal: true }] }], scope: [{ type: i0.Input, args: [{ isSignal: true, alias: "scope", required: true }] }] } });
|
|
115
|
+
|
|
116
|
+
export { ContentEditorNestedBlocks as C };
|
|
117
|
+
//# sourceMappingURL=ngstarter-ui-components-content-editor-nested-blocks-DSY7xfzf.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngstarter-ui-components-content-editor-nested-blocks-DSY7xfzf.mjs","sources":["../../../projects/components/content-editor/src/_builder/nested-blocks/nested-blocks.ts","../../../projects/components/content-editor/src/_builder/nested-blocks/nested-blocks.html"],"sourcesContent":["import { AsyncPipe, DOCUMENT, NgComponentOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, DestroyRef, EventEmitter, afterNextRender, computed, effect, forwardRef, inject, input, signal, viewChild } from '@angular/core';\nimport { CdkDrag, CdkDragDrop, CdkDragHandle, CdkDropList } from '@angular/cdk/drag-drop';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport { Menu, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport { CONTENT_BUILDER, ContentEditorBlockScope, ContentEditorBlockView } from '../../types';\nimport { cloneContentEditorValue, contentEditorBlockView, contentEditorCollection, contentEditorChildCollections, findContentEditorBlock } from '../../document';\nimport { createNgsHeadlessEditorId } from '@ngstarter-ui/components/headless-editor';\n\n@Component({\n selector: 'ngs-content-editor-nested-blocks',\n imports: [AsyncPipe, NgComponentOutlet, CdkDrag, CdkDragHandle, CdkDropList, Button, Icon, Menu, MenuItem, MenuTrigger],\n providers: [{ provide: CONTENT_BUILDER, useExisting: forwardRef(() => ContentEditorNestedBlocks) }],\n templateUrl: './nested-blocks.html', styleUrl: './nested-blocks.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { '(keydown)': 'onKeyDown($event)' }\n})\nexport class ContentEditorNestedBlocks {\n private readonly parent = inject<ContentBuilderComponent>(CONTENT_BUILDER, { skipSelf: true });\n private readonly store = inject(ContentBuilderStore);\n private readonly document = inject(DOCUMENT);\n private readonly dropList = viewChild.required(CdkDropList);\n readonly connectedDropLists = this.store.dropLists;\n readonly scope = input.required<ContentEditorBlockScope>();\n readonly emptyBlock = signal(this.rootBuilder.createBlockView('paragraph'));\n readonly focusChanged = new EventEmitter<void>();\n constructor() {\n effect(() => {\n if (this.blocks().some(block => block.id === this.emptyBlock().id)) this.emptyBlock.set(this.rootBuilder.createBlockView('paragraph'));\n });\n let registered: CdkDropList<ContentEditorBlockScope> | null = null;\n afterNextRender(() => { registered = this.dropList(); this.store.registerDropList(registered); });\n inject(DestroyRef).onDestroy(() => { if (registered) this.store.unregisterDropList(registered); });\n }\n get rootBuilder(): ContentBuilderComponent { return this.parent.rootBuilder; }\n readonly blocks = computed(() => contentEditorCollection(this.store.editor.document().blocks, this.scope()).map(contentEditorBlockView));\n readonly renderedBlocks = computed(() => {\n const blocks = this.blocks();\n return blocks.length ? blocks : [this.emptyBlock()];\n });\n getBlockComponent(type: string): any { return this.rootBuilder.getBlockComponent(type); }\n getBlockDefOption(type: string, key: string): any { return this.rootBuilder.getBlockDefOption(type, key); }\n emitContentChangeEvent(): void {}\n focusBlock(id: string | null): void { this.store.setFocusedBlockId(id); this.focusChanged.emit(); }\n insertEmptyBlock(index: number): void { this.addBlock('paragraph', {}, index + 1); }\n updateParagraph(id: string, data: Partial<ContentEditorBlockView>): void {\n if (this.blocks().some(block => block.id === id)) this.store.updateBlock(id, data);\n else if (id === this.emptyBlock().id) this.store.addBlock({ ...this.emptyBlock(), ...data }, this.blocks().length, this.scope());\n }\n addBlock(type: string, settings = {}, index = this.blocks().length): void {\n const block = this.rootBuilder.createBlockView(type, settings);\n this.store.addBlock(block, index, this.scope());\n this.focusBlock(block.id);\n }\n deleteBlock(id: string): void {\n const index = this.blocks().findIndex(block => block.id === id);\n if (index < 0) return;\n this.store.deleteBlock(id, index);\n this.focusBlock(this.blocks()[Math.max(0, index - 1)]?.id ?? null);\n }\n duplicateBlock(id: string): void {\n const index = this.blocks().findIndex(block => block.id === id);\n if (index < 0) return;\n const block = cloneContentEditorValue(this.blocks()[index]);\n const reidentify = (item: any) => {\n item.id = createNgsHeadlessEditorId(item.type);\n for (const children of contentEditorChildCollections(item)) for (const child of children) reidentify(child);\n if (item.type === 'grid') for (const cell of item.content.cells) cell.id = createNgsHeadlessEditorId('cell');\n if (item.type === 'gallery') for (const image of item.content.images) image.id = createNgsHeadlessEditorId('image');\n };\n reidentify(block);\n this.store.addBlock(block, index + 1, this.scope());\n }\n drop(event: CdkDragDrop<ContentEditorBlockScope>): void {\n this.store.moveBetweenCollections(event.previousIndex, event.currentIndex, event.previousContainer.data, event.container.data);\n }\n onDragStarted(): void { this.store.setDragging(true); }\n onDragEnded(): void { this.store.setDragging(false); }\n readonly canEnter = (drag: CdkDrag<string>, drop: CdkDropList<ContentEditorBlockScope>): boolean => {\n const pointer = this.store.dragPointer();\n const nearest = pointer ? this.document.elementFromPoint(pointer.x, pointer.y)?.closest('.cdk-drop-list') : null;\n if (nearest && nearest.id !== drop.id) return false;\n const parentId = drop.data.parentId;\n const block = findContentEditorBlock(this.store.editor.document().blocks, drag.data);\n return !parentId || !block || !findContentEditorBlock([block], parentId);\n };\n onKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) return;\n if ((event.ctrlKey || event.metaKey) && ['z', 'y'].includes(event.key.toLowerCase())) {\n const redo = event.key.toLowerCase() === 'y' || event.shiftKey;\n if (redo ? this.store.editor.redo() : this.store.editor.undo()) event.preventDefault();\n event.stopPropagation();\n }\n }\n}\n","<div cdkDropList [cdkDropListData]=\"scope()\" [cdkDropListConnectedTo]=\"connectedDropLists()\" [cdkDropListEnterPredicate]=\"canEnter\" (cdkDropListDropped)=\"drop($event)\" class=\"min-h-12\">\n @for (block of renderedBlocks(); track block.id) {\n <div cdkDrag [cdkDragData]=\"block.id\" (cdkDragStarted)=\"onDragStarted()\" (cdkDragEnded)=\"onDragEnded()\" class=\"nested-block relative min-w-0 py-2\" [attr.data-block-id]=\"block.id\">\n <div class=\"nested-controls block-controls absolute top-1/2 z-10 flex -translate-y-1/2 items-center\"\n [class.is-menu-open]=\"addTrigger.menuOpen() || actionsTrigger.menuOpen()\">\n <button ngsIconButton aria-label=\"Add block\" #addTrigger=\"ngsMenuTrigger\"\n [ngsMenuTriggerFor]=\"rootBuilder.blockMenu()\" [ngsMenuTriggerRestoreFocus]=\"false\"\n [ngsMenuTriggerData]=\"{target: {scope: scope(), afterId: block.id}}\">\n <ngs-icon name=\"fluent:add-24-regular\"/>\n </button>\n <button ngsIconButton cdkDragHandle [ngsMenuTriggerFor]=\"blockMenu\"\n #actionsTrigger=\"ngsMenuTrigger\" aria-label=\"Move block\"><ngs-icon name=\"fluent:re-order-dots-vertical-24-regular\"/></button>\n <ngs-menu #blockMenu>\n <button ngs-menu-item (click)=\"duplicateBlock(block.id)\">Duplicate</button>\n <button ngs-menu-item (click)=\"deleteBlock(block.id)\">Delete</button>\n </ngs-menu>\n </div>\n <div class=\"min-w-0\">\n <ng-container [ngComponentOutlet]=\"getBlockComponent(block.type) | async\"\n [ngComponentOutletInputs]=\"{id: block.id, content: block.content, settings: block.settings, props: block.props, index: $index}\"/>\n </div>\n </div>\n }\n</div>\n"],"names":[],"mappings":";;;;;;;;;;MAoBa,yBAAyB,CAAA;IACnB,MAAM,GAAG,MAAM,CAA0B,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC7E,IAAA,KAAK,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACnC,IAAA,QAAQ,GAAG,MAAM,CAAC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