@ngstarter-ui/components 22.2.3 → 22.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/ai/component-registry.json +22 -0
  2. package/content-editor/BLOCK_FORMAT.md +144 -0
  3. package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-rzZKJ2JH.mjs +35 -0
  4. package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-rzZKJ2JH.mjs.map +1 -0
  5. package/fesm2022/{ngstarter-ui-components-content-editor-callout-block-Jbf8h2yz.mjs → ngstarter-ui-components-content-editor-callout-block-DTdApN0r.mjs} +2 -3
  6. package/fesm2022/{ngstarter-ui-components-content-editor-callout-block-Jbf8h2yz.mjs.map → ngstarter-ui-components-content-editor-callout-block-DTdApN0r.mjs.map} +1 -1
  7. package/fesm2022/{ngstarter-ui-components-content-editor-code-block.component-BizHRPdC.mjs → ngstarter-ui-components-content-editor-code-block.component-DpONkTMU.mjs} +2 -2
  8. package/fesm2022/{ngstarter-ui-components-content-editor-code-block.component-BizHRPdC.mjs.map → ngstarter-ui-components-content-editor-code-block.component-DpONkTMU.mjs.map} +1 -1
  9. package/fesm2022/{ngstarter-ui-components-content-editor-embed-block-BzoaJvai.mjs → ngstarter-ui-components-content-editor-embed-block-CmhzpaRk.mjs} +2 -2
  10. package/fesm2022/{ngstarter-ui-components-content-editor-embed-block-BzoaJvai.mjs.map → ngstarter-ui-components-content-editor-embed-block-CmhzpaRk.mjs.map} +1 -1
  11. package/fesm2022/{ngstarter-ui-components-content-editor-gallery-block-C4p-S0Do.mjs → ngstarter-ui-components-content-editor-gallery-block-gtH7yWd5.mjs} +16 -39
  12. package/fesm2022/ngstarter-ui-components-content-editor-gallery-block-gtH7yWd5.mjs.map +1 -0
  13. package/fesm2022/{ngstarter-ui-components-content-editor-grid-block-Cdq_Dcv2.mjs → ngstarter-ui-components-content-editor-grid-block-Pb-xV7Pw.mjs} +3 -4
  14. package/fesm2022/{ngstarter-ui-components-content-editor-grid-block-Cdq_Dcv2.mjs.map → ngstarter-ui-components-content-editor-grid-block-Pb-xV7Pw.mjs.map} +1 -1
  15. package/fesm2022/{ngstarter-ui-components-content-editor-heading-block.component-CDSt4rXe.mjs → ngstarter-ui-components-content-editor-heading-block.component-BKe9Zy_x.mjs} +2 -2
  16. package/fesm2022/{ngstarter-ui-components-content-editor-heading-block.component-CDSt4rXe.mjs.map → ngstarter-ui-components-content-editor-heading-block.component-BKe9Zy_x.mjs.map} +1 -1
  17. package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-DSpBVTu-.mjs +113 -0
  18. package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-DSpBVTu-.mjs.map +1 -0
  19. package/fesm2022/{ngstarter-ui-components-content-editor-list-block.component-CdQ30RjA.mjs → ngstarter-ui-components-content-editor-list-block.component-BPKPE1uY.mjs} +2 -2
  20. package/fesm2022/{ngstarter-ui-components-content-editor-list-block.component-CdQ30RjA.mjs.map → ngstarter-ui-components-content-editor-list-block.component-BPKPE1uY.mjs.map} +1 -1
  21. package/fesm2022/{ngstarter-ui-components-content-editor-nested-blocks-CbZY0keH.mjs → ngstarter-ui-components-content-editor-nested-blocks-Dh-p3WMp.mjs} +4 -4
  22. package/fesm2022/ngstarter-ui-components-content-editor-nested-blocks-Dh-p3WMp.mjs.map +1 -0
  23. package/fesm2022/{ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CK4ssnlk.mjs → ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs} +2021 -1505
  24. package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs.map +1 -0
  25. package/fesm2022/{ngstarter-ui-components-content-editor-paragraph-block.component-Dd0pQquG.mjs → ngstarter-ui-components-content-editor-paragraph-block.component-D5wS3m6O.mjs} +2 -2
  26. package/fesm2022/{ngstarter-ui-components-content-editor-paragraph-block.component-Dd0pQquG.mjs.map → ngstarter-ui-components-content-editor-paragraph-block.component-D5wS3m6O.mjs.map} +1 -1
  27. package/fesm2022/{ngstarter-ui-components-content-editor-quote-block.component-CUxKoeb_.mjs → ngstarter-ui-components-content-editor-quote-block.component-C3GFAGKF.mjs} +2 -2
  28. package/fesm2022/{ngstarter-ui-components-content-editor-quote-block.component-CUxKoeb_.mjs.map → ngstarter-ui-components-content-editor-quote-block.component-C3GFAGKF.mjs.map} +1 -1
  29. package/fesm2022/{ngstarter-ui-components-content-editor-table-block.component-BTExrXy8.mjs → ngstarter-ui-components-content-editor-table-block.component-DQgs_kyN.mjs} +2 -2
  30. package/fesm2022/{ngstarter-ui-components-content-editor-table-block.component-BTExrXy8.mjs.map → ngstarter-ui-components-content-editor-table-block.component-DQgs_kyN.mjs.map} +1 -1
  31. package/fesm2022/{ngstarter-ui-components-content-editor-toggle-block-B46YeMGQ.mjs → ngstarter-ui-components-content-editor-toggle-block-Cb67ChE8.mjs} +3 -4
  32. package/fesm2022/{ngstarter-ui-components-content-editor-toggle-block-B46YeMGQ.mjs.map → ngstarter-ui-components-content-editor-toggle-block-Cb67ChE8.mjs.map} +1 -1
  33. package/fesm2022/ngstarter-ui-components-content-editor-upload-status-QnKI_Rfz.mjs +19 -0
  34. package/fesm2022/ngstarter-ui-components-content-editor-upload-status-QnKI_Rfz.mjs.map +1 -0
  35. package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-CRa0g9Ez.mjs +134 -0
  36. package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-CRa0g9Ez.mjs.map +1 -0
  37. package/fesm2022/ngstarter-ui-components-content-editor.mjs +1 -1
  38. package/fesm2022/ngstarter-ui-components-headless-editor.mjs +57 -0
  39. package/fesm2022/ngstarter-ui-components-headless-editor.mjs.map +1 -1
  40. package/package.json +1 -1
  41. package/types/ngstarter-ui-components-content-editor.d.ts +205 -10
  42. package/types/ngstarter-ui-components-headless-editor.d.ts +6 -1
  43. package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-DlUkhwCu.mjs +0 -54
  44. package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-DlUkhwCu.mjs.map +0 -1
  45. package/fesm2022/ngstarter-ui-components-content-editor-block-base-C46lyMrp.mjs +0 -47
  46. package/fesm2022/ngstarter-ui-components-content-editor-block-base-C46lyMrp.mjs.map +0 -1
  47. package/fesm2022/ngstarter-ui-components-content-editor-gallery-block-C4p-S0Do.mjs.map +0 -1
  48. package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-LfKZapgv.mjs +0 -169
  49. package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-LfKZapgv.mjs.map +0 -1
  50. package/fesm2022/ngstarter-ui-components-content-editor-nested-blocks-CbZY0keH.mjs.map +0 -1
  51. package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CK4ssnlk.mjs.map +0 -1
  52. package/fesm2022/ngstarter-ui-components-content-editor-upload-block-base-DKqojf--.mjs +0 -29
  53. package/fesm2022/ngstarter-ui-components-content-editor-upload-block-base-DKqojf--.mjs.map +0 -1
  54. package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-hBR5AauH.mjs +0 -201
  55. package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-hBR5AauH.mjs.map +0 -1
@@ -2450,6 +2450,7 @@
2450
2450
  "ngs-content-editor-table-renderer",
2451
2451
  "ngs-content-editor-toggle-block",
2452
2452
  "ngs-content-editor-toggle-renderer",
2453
+ "ngs-content-editor-upload-status",
2453
2454
  "ngs-content-editor-video-renderer",
2454
2455
  "ngs-divider-block",
2455
2456
  "ngs-draggable-table",
@@ -2481,12 +2482,14 @@
2481
2482
  "CONTENT_EDITOR_BLOCK_RENDERERS",
2482
2483
  "CONTENT_EDITOR_CALLOUT_HTML_STYLES",
2483
2484
  "CONTENT_EDITOR_CONFIG",
2485
+ "CONTENT_EDITOR_CONVERTIBLE_BLOCKS",
2484
2486
  "CONTENT_EDITOR_DEFAULT_HTML_CONVERTERS",
2485
2487
  "CONTENT_EDITOR_DEFAULT_RENDERERS",
2486
2488
  "CONTENT_EDITOR_EXTRA_BLOCK_DEFS",
2487
2489
  "CONTENT_EDITOR_EXTRA_SUGGESTIONS",
2488
2490
  "CONTENT_EDITOR_GALLERY_HTML_STYLES",
2489
2491
  "CONTENT_EDITOR_GRID_HTML_STYLES",
2492
+ "CONTENT_EDITOR_RENDER_CONFIG",
2490
2493
  "ContentBuilderComponent",
2491
2494
  "ContentBuilderStore",
2492
2495
  "ContentChangesObserverDirective",
@@ -2506,6 +2509,7 @@
2506
2509
  "ContentEditorBlockRendererDef",
2507
2510
  "ContentEditorBlockRendererInputs",
2508
2511
  "ContentEditorBlockRendererInputSignals",
2512
+ "contentEditorBlockScope",
2509
2513
  "ContentEditorBlockScope",
2510
2514
  "contentEditorBlockToHtml",
2511
2515
  "contentEditorBlockView",
@@ -2525,11 +2529,18 @@
2525
2529
  "contentEditorCollection",
2526
2530
  "ContentEditorConfig",
2527
2531
  "ContentEditorContentEditableDirective",
2532
+ "contentEditorConvertBlock",
2533
+ "ContentEditorConvertibleBlockType",
2534
+ "contentEditorCopyBlocks",
2528
2535
  "ContentEditorDataBlock",
2529
2536
  "ContentEditorDimension",
2530
2537
  "ContentEditorDividerRenderer",
2531
2538
  "contentEditorDividerToHtml",
2532
2539
  "ContentEditorDocument",
2540
+ "ContentEditorDraftConfig",
2541
+ "ContentEditorDraftController",
2542
+ "ContentEditorDraftStatus",
2543
+ "ContentEditorDraftStorage",
2533
2544
  "ContentEditorEmbedBlockSettings",
2534
2545
  "ContentEditorEmbedContent",
2535
2546
  "ContentEditorEmbedRenderer",
@@ -2563,10 +2574,12 @@
2563
2574
  "ContentEditorImageContent",
2564
2575
  "ContentEditorImageRenderer",
2565
2576
  "contentEditorImageToHtml",
2577
+ "contentEditorImportedText",
2566
2578
  "ContentEditorImporter",
2567
2579
  "ContentEditorImportError",
2568
2580
  "ContentEditorImportMarkDefinition",
2569
2581
  "ContentEditorImportOptions",
2582
+ "ContentEditorImportPlacement",
2570
2583
  "ContentEditorItemProperty",
2571
2584
  "ContentEditorListItem",
2572
2585
  "ContentEditorListRenderer",
@@ -2588,6 +2601,7 @@
2588
2601
  "ContentEditorRenderer",
2589
2602
  "ContentEditorRendererBase",
2590
2603
  "contentEditorResourceUrl",
2604
+ "contentEditorSliceText",
2591
2605
  "ContentEditorSuggestionHeading",
2592
2606
  "ContentEditorSuggestionItem",
2593
2607
  "ContentEditorTableAttributes",
@@ -2606,7 +2620,12 @@
2606
2620
  "contentEditorToggleToHtml",
2607
2621
  "contentEditorToHtml",
2608
2622
  "ContentEditorUploadBlockBase",
2623
+ "ContentEditorUploadContext",
2624
+ "ContentEditorUploadedFile",
2609
2625
  "ContentEditorUploadFn",
2626
+ "ContentEditorUploadRequest",
2627
+ "ContentEditorUploadStatus",
2628
+ "ContentEditorUploadTask",
2610
2629
  "ContentEditorVideoBlockSettings",
2611
2630
  "ContentEditorVideoContent",
2612
2631
  "ContentEditorVideoRenderer",
@@ -2680,6 +2699,8 @@
2680
2699
  "contentChangedDelay",
2681
2700
  "detectAddedNode",
2682
2701
  "disabled",
2702
+ "documentId",
2703
+ "draftDebounceMs",
2683
2704
  "id",
2684
2705
  "ignoreClasses",
2685
2706
  "index",
@@ -2705,6 +2726,7 @@
2705
2726
  "stopTimeout",
2706
2727
  "suggestions",
2707
2728
  "targetComponent",
2729
+ "task",
2708
2730
  "textColors",
2709
2731
  "type"
2710
2732
  ],
@@ -715,3 +715,147 @@ Use `config.importMarks` for additional HTML mark definitions (type, tagName, pa
715
715
  4. Include all required media fields, including empty strings/arrays if unfilled, and attachment byte count/MIME type. Use persistent URLs for production assets. Runtime uploadFn callbacks do not belong in JSON.
716
716
  5. Validate against document.schema.json, then use contentEditorFromJson for semantic ID, URL and limit checks before storing/importing.
717
717
  6. Use native JSON for exact re-import. Treat HTML as an interoperable display/import representation with the documented metadata limitations.
718
+
719
+ ## Editing, insertion and application-defined blocks
720
+
721
+ Builder import defaults to replacement. Insert mode copies the entire imported tree with fresh
722
+ block, grid-cell and gallery-image IDs, leaving the source object untouched. A destination is a
723
+ root collection, Toggle body, or Grid cell. Capture the destination before opening an overlay:
724
+
725
+ ```ts
726
+ const target = builder.getInsertionTarget();
727
+ // Root: { scope: {}, afterId: 'paragraph-id' }
728
+ // Toggle: { scope: { parentId: 'toggle-id' }, afterId: 'child-id' }
729
+ // Grid: { scope: { parentId: 'grid-id', cellId: 'cell-id' }, afterId: 'child-id' }
730
+ builder.importHtml(html, {}, { mode: 'insert', target });
731
+ builder.importJson(json, {}, { mode: 'insert', target });
732
+ // Omit afterId to append to the collection; omit target to use the active destination.
733
+ ```
734
+
735
+ The destination must still exist when importing. An invalid parent, cell, or `afterId` raises
736
+ `ContentEditorImportError` without changing the document. Import remains one Undo/Redo operation.
737
+ Paste uses the same HTML importer and configuration. Paragraph/Heading fields split around the current selection when pasting structured blocks, retaining lists/tables and surrounding marked text. Other inline text fields flatten supported HTML structure to text lines while retaining supported marks; code fields retain literal text.
738
+
739
+ `builder.convertBlock(id, type, settings?)` converts `paragraph`, `heading`, `quote` and `callout`,
740
+ including nested blocks. It retains ID, rich text, custom attrs and alignment. Quote attribution
741
+ becomes a final text line when converting to another type. Unsupported source types return `false`.
742
+ Use the block action menu's **Turn into** action. The heading default is level 2; callout defaults
743
+ to `note`. Conversion is a single history operation and restores the active text range.
744
+
745
+ ### A single block registration
746
+
747
+ Each `ContentEditorConfig.blocks[type]` entry may define all block behaviour:
748
+
749
+ | Field | Contract |
750
+ | --- | --- |
751
+ | `editor` | Standalone Angular component with the standard editor inputs. |
752
+ | `loadEditor` | `() => Promise<Type<unknown>>`; takes precedence over `editor`. |
753
+ | `renderer` | Standalone preview component with the standard renderer inputs. |
754
+ | `create` | `() => { content, attrs? }`; the builder supplies the new ID and type. |
755
+ | `menu` | `{ title, description?, iconName?, settings? }`; registers a global menu item. |
756
+ | `options` | Runtime editor options, including upload callbacks and maximum file size. |
757
+ | `toHtml` | HTML converter; use `ctx.escape()` and `ctx.safeUrl()` for dynamic values. |
758
+ | `fromHtml` | `{ selector, parse(element, context) }` importer. |
759
+ | `validateImport` | Return an error string to reject imported block data; otherwise return `undefined`. |
760
+
761
+ Provide the configuration globally with `provideContentEditorConfig(config)` or pass `[config]`
762
+ to a builder/renderer. Nested editing uses the root builder's definitions. Nested preview renderers
763
+ inherit instance configuration, so a custom block inside Grid/Toggle needs no additional provider.
764
+ Environment defaults are merged first, then instance overrides; block fields and options merge
765
+ individually. Legacy renderer providers remain supported; `blocks[type].renderer` takes precedence.
766
+
767
+ ```ts
768
+ import { ContentEditorConfig, provideContentEditorConfig }
769
+ from '@ngstarter-ui/components/content-editor';
770
+
771
+ const config: ContentEditorConfig = {
772
+ blocks: {
773
+ product: {
774
+ editor: ProductEditor,
775
+ renderer: ProductPreview,
776
+ create: () => ({ content: { productId: '' } }),
777
+ menu: { title: 'Product', description: 'A product card' },
778
+ validateImport: block =>
779
+ typeof (block.content as { productId?: unknown })?.productId === 'string'
780
+ ? undefined : 'productId must be a string',
781
+ fromHtml: {
782
+ selector: '[data-product-id]',
783
+ parse: (element, ctx) => ctx.createBlock('product', {
784
+ productId: element.getAttribute('data-product-id') ?? ''
785
+ })
786
+ },
787
+ toHtml: (block, ctx) =>
788
+ `<div data-product-id="${ctx.escape((block.content as { productId: string }).productId)}"></div>`
789
+ }
790
+ }
791
+ };
792
+ // Application/route providers: [provideContentEditorConfig(config)]
793
+ // Or: <ngs-content-editor-builder [config]="config" ... />
794
+ // And: <ngs-content-editor-renderer [config]="config" ... />
795
+ ```
796
+
797
+ `ContentEditorBlockBase<TContent, TSettings>` supplies `id`, `content`, `settings`, `props`, `index`,
798
+ `initialized`, focus and history integration. Extend it in an editor and call protected
799
+ `save(nextContent, nextSettings?)`. `latestContent()` reads the current native value for edits that
800
+ may race with another field. `ContentEditorRendererBase<TContent, TSettings>` supplies preview
801
+ inputs, including the native `block`. Import both through the public `content-editor` entry point.
802
+ The docs builder includes a working Bookmark registration using these APIs.
803
+
804
+ A custom block entry explicitly permits its type during JSON import, and its `validateImport`
805
+ checks its content. Extend the supplied built-in JSON Schema with your own block shape when external
806
+ systems also validate custom documents. Unknown types without an explicit entry are rejected by
807
+ default. Runtime components/callbacks never belong in the saved JSON.
808
+
809
+ ## Media upload contract
810
+
811
+ Image, Video, Gallery and Attachment share progress, cancellation, visible errors and retry.
812
+ Configure `options.uploadFn` and optionally `options.maxFileSize` (bytes) in their block entry:
813
+
814
+ ```ts
815
+ import { ContentEditorUploadFn } from '@ngstarter-ui/components/content-editor';
816
+
817
+ const uploadFn: ContentEditorUploadFn = async (file, dataUrl, context) => {
818
+ const form = new FormData();
819
+ form.append('file', file);
820
+ const response = await fetch('/api/uploads', { method: 'POST', body: form, signal: context.signal });
821
+ if (!response.ok) throw new Error('Upload failed');
822
+ const result = await response.json() as { url: string };
823
+ return result.url;
824
+ };
825
+ // For a transport supporting progress, call context.onProgress(percent), from 0 to 100.
826
+ // Existing callbacks taking (file, dataUrl) continue to work.
827
+ provideContentEditorConfig({ blocks: { image: { options: { uploadFn, maxFileSize: 10 * 1024 * 1024 } } } });
828
+ ```
829
+
830
+ Cancellation aborts file reading and signals the transport. Late results never update a cancelled,
831
+ removed, replaced or read-only block. Consumers must pass `context.signal` to their transport to
832
+ stop its network request. Gallery keeps successful files and retry resends only failed files.
833
+ MIME/size rejection requires choosing another file and is not automatically retried.
834
+ Without transport progress the indicator is indeterminate. A successful upload returns a supported
835
+ resource URL; callbacks must reject on failure. Default callbacks use data URLs.
836
+
837
+ ## Draft persistence
838
+
839
+ Use a stable document ID for multiple editors or multiple documents on the same route:
840
+
841
+ ```html
842
+ <ngs-content-editor-builder documentId="article-42" [content]="document"
843
+ [persistDraft]="true" [draftDebounceMs]="500" />
844
+ ```
845
+
846
+ `persistDraft` defaults to true. Saves are delayed by 500ms by default and flushed on component
847
+ destruction or document switch. `documentId` identifies the storage entry; when omitted, the
848
+ existing route + element-ID storage key remains in use. Provide distinct IDs for independent editors.
849
+ Drafts are validated with the same JSON importer and custom configuration before restoration.
850
+ Malformed data falls back to the supplied document and exposes the error; it is not silently removed.
851
+
852
+ The builder exposes `draftStatus` (`disabled`, `idle`, `saving`, `saved`, `error`), `draftError`,
853
+ `draftSavedAt`, `saveDraftNow()` and `clearDraft()`. Status signals can drive an `aria-live` indicator
854
+ and a retry action. `clearDraft()` removes persisted state without altering the current document.
855
+ Storage/quota failures remain visible. No draft storage runs during SSR.
856
+
857
+ Environment or instance config can set `draft.debounceMs` and `draft.storage`. A storage adapter
858
+ implements synchronous `getItem(key): string | null`, `setItem(key, value): void`, and
859
+ `removeItem(key): void`; it stores serialized native JSON. The default is browser `localStorage`.
860
+ `[draftDebounceMs]` overrides the configured delay. Use `contentChanged` for asynchronous server
861
+ persistence.
@@ -0,0 +1,35 @@
1
+ import * as i0 from '@angular/core';
2
+ import { computed, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { UploadArea, UploadTriggerDirective } from '@ngstarter-ui/components/upload';
4
+ import { Button } from '@ngstarter-ui/components/button';
5
+ import { Icon } from '@ngstarter-ui/components/icon';
6
+ import { FormField, Label } from '@ngstarter-ui/components/form-field';
7
+ import { Input } from '@ngstarter-ui/components/input';
8
+ import { f as ContentEditorUploadBlockBase, h as contentEditorFileSize, i as contentEditorResourceUrl } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs';
9
+ import { C as ContentEditorUploadStatus } from './ngstarter-ui-components-content-editor-upload-status-QnKI_Rfz.mjs';
10
+
11
+ class ContentEditorAttachmentBlock extends ContentEditorUploadBlockBase {
12
+ sizeLabel = computed(() => contentEditorFileSize(this.content().size), /* @ts-ignore */
13
+ ...(ngDevMode ? [{ debugName: "sizeLabel" }] : /* istanbul ignore next */ []));
14
+ href = computed(() => contentEditorResourceUrl(this.content().url), /* @ts-ignore */
15
+ ...(ngDevMode ? [{ debugName: "href" }] : /* istanbul ignore next */ []));
16
+ changeName(event) { this.save({ ...this.latestContent(), name: event.target.value }); }
17
+ async upload(event) {
18
+ const file = event.files[0];
19
+ if (!file)
20
+ return;
21
+ await this.uploadFiles('attachment', { files: [file], apply: results => {
22
+ const { url, file } = results[0];
23
+ this.save({ url, name: file.name, size: file.size, mimeType: file.type });
24
+ } });
25
+ }
26
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorAttachmentBlock, deps: null, target: i0.ɵɵFactoryTarget.Component });
27
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ContentEditorAttachmentBlock, isStandalone: true, selector: "ngs-content-editor-attachment-block", usesInheritance: true, ngImport: i0, template: "<div class=\"flex flex-col gap-3\">\n @if (href()) {\n <div class=\"flex items-center gap-3\">\n <ngs-icon name=\"fluent:document-24-regular\"/>\n <div class=\"min-w-0 flex-1\"><div class=\"truncate\">{{content().name}}</div><div class=\"text-xs\">{{sizeLabel()}} \u00B7 {{content().mimeType}}</div></div>\n <a ngsButton [href]=\"href()\" [attr.download]=\"content().name\" target=\"_blank\" rel=\"noopener noreferrer\">Download</a>\n </div>\n <ngs-form-field><ngs-label>File name</ngs-label><input ngsInput [value]=\"content().name\" (input)=\"changeName($event)\"></ngs-form-field>\n }\n <ngs-content-editor-upload-status [task]=\"uploadTask\"/>\n @if (!uploading()) {\n <ngs-upload-area ngsUploadTrigger [multiple]=\"false\" (fileSelected)=\"upload($event)\">\n {{href() ? 'Click or drop a file to replace it' : 'Click or drop a file to attach it'}}\n </ngs-upload-area>\n }\n</div>\n", dependencies: [{ kind: "component", type: ContentEditorUploadStatus, selector: "ngs-content-editor-upload-status", inputs: ["task"] }, { kind: "component", type: UploadArea, selector: "ngs-upload-area", inputs: ["accept", "allowHover", "multiple"], outputs: ["fileSelected"], exportAs: ["ngsUploadArea"] }, { kind: "directive", type: UploadTriggerDirective, selector: "[ngsUploadTrigger]", inputs: ["accept", "multiple"], outputs: ["fileSelected"], exportAs: ["ngsUploadTrigger"] }, { kind: "component", type: 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: Label, selector: "ngs-label" }, { kind: "directive", type: Input, selector: "input[ngsInput], textarea[ngsInput]", inputs: ["id", "placeholder", "required", "disabled", "readonly", "errorStateMatcher"], exportAs: ["ngsInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
28
+ }
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ContentEditorAttachmentBlock, decorators: [{
30
+ type: Component,
31
+ args: [{ selector: 'ngs-content-editor-attachment-block', imports: [ContentEditorUploadStatus, UploadArea, UploadTriggerDirective, Button, Icon, FormField, Label, Input], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-3\">\n @if (href()) {\n <div class=\"flex items-center gap-3\">\n <ngs-icon name=\"fluent:document-24-regular\"/>\n <div class=\"min-w-0 flex-1\"><div class=\"truncate\">{{content().name}}</div><div class=\"text-xs\">{{sizeLabel()}} \u00B7 {{content().mimeType}}</div></div>\n <a ngsButton [href]=\"href()\" [attr.download]=\"content().name\" target=\"_blank\" rel=\"noopener noreferrer\">Download</a>\n </div>\n <ngs-form-field><ngs-label>File name</ngs-label><input ngsInput [value]=\"content().name\" (input)=\"changeName($event)\"></ngs-form-field>\n }\n <ngs-content-editor-upload-status [task]=\"uploadTask\"/>\n @if (!uploading()) {\n <ngs-upload-area ngsUploadTrigger [multiple]=\"false\" (fileSelected)=\"upload($event)\">\n {{href() ? 'Click or drop a file to replace it' : 'Click or drop a file to attach it'}}\n </ngs-upload-area>\n }\n</div>\n" }]
32
+ }] });
33
+
34
+ export { ContentEditorAttachmentBlock };
35
+ //# sourceMappingURL=ngstarter-ui-components-content-editor-attachment-block-rzZKJ2JH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngstarter-ui-components-content-editor-attachment-block-rzZKJ2JH.mjs","sources":["../../../projects/components/content-editor/src/_builder/attachment-block/attachment-block.ts","../../../projects/components/content-editor/src/_builder/attachment-block/attachment-block.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed } from '@angular/core';\nimport { UploadArea, UploadTriggerDirective, UploadFileSelectedEvent } from '@ngstarter-ui/components/upload';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport { FormField, Label } from '@ngstarter-ui/components/form-field';\nimport { Input } from '@ngstarter-ui/components/input';\nimport { ContentEditorUploadBlockBase } from '../upload-block-base';\nimport { ContentEditorAttachmentContent } from '../../types';\nimport { ContentEditorUploadStatus } from '../upload-status/upload-status';\nimport { contentEditorFileSize, contentEditorResourceUrl } from '../../upload';\n\n@Component({\n selector: 'ngs-content-editor-attachment-block',\n imports: [ContentEditorUploadStatus, UploadArea, UploadTriggerDirective, Button, Icon, FormField, Label, Input],\n templateUrl: './attachment-block.html', changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentEditorAttachmentBlock extends ContentEditorUploadBlockBase<ContentEditorAttachmentContent> {\n readonly sizeLabel = computed(() => contentEditorFileSize(this.content().size));\n readonly href = computed(() => contentEditorResourceUrl(this.content().url));\n changeName(event: Event): void { this.save({ ...this.latestContent(), name: (event.target as HTMLInputElement).value }); }\n async upload(event: UploadFileSelectedEvent): Promise<void> {\n const file = event.files[0];\n if (!file) return;\n await this.uploadFiles('attachment', { files: [file], apply: results => {\n const { url, file } = results[0];\n this.save({ url, name: file.name, size: file.size, mimeType: file.type });\n } });\n }\n}\n","<div class=\"flex flex-col gap-3\">\n @if (href()) {\n <div class=\"flex items-center gap-3\">\n <ngs-icon name=\"fluent:document-24-regular\"/>\n <div class=\"min-w-0 flex-1\"><div class=\"truncate\">{{content().name}}</div><div class=\"text-xs\">{{sizeLabel()}} · {{content().mimeType}}</div></div>\n <a ngsButton [href]=\"href()\" [attr.download]=\"content().name\" target=\"_blank\" rel=\"noopener noreferrer\">Download</a>\n </div>\n <ngs-form-field><ngs-label>File name</ngs-label><input ngsInput [value]=\"content().name\" (input)=\"changeName($event)\"></ngs-form-field>\n }\n <ngs-content-editor-upload-status [task]=\"uploadTask\"/>\n @if (!uploading()) {\n <ngs-upload-area ngsUploadTrigger [multiple]=\"false\" (fileSelected)=\"upload($event)\">\n {{href() ? 'Click or drop a file to replace it' : 'Click or drop a file to attach it'}}\n </ngs-upload-area>\n }\n</div>\n"],"names":[],"mappings":";;;;;;;;;;AAgBM,MAAO,4BAA6B,SAAQ,4BAA4D,CAAA;AACnG,IAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,qBAAqB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;kFAAC;AACtE,IAAA,IAAI,GAAG,QAAQ,CAAC,MAAM,wBAAwB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC;6EAAC;IAC5E,UAAU,CAAC,KAAY,EAAA,EAAU,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAG,KAAK,CAAC,MAA2B,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACzH,MAAM,MAAM,CAAC,KAA8B,EAAA;QACzC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3B,QAAA,IAAI,CAAC,IAAI;YAAE;AACX,QAAA,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,IAAG;gBACrE,MAAM,EAAE,GAAG,EAAE,IAAI,E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AA,EAAA,WAAA,EAAA,IAAA,EAAE,SAAS,EAAA,QAAA,EAAA,gBAAA,EAAA,MAAA,EAAA,CAAA,WAAA,EAAA,wBAAA,EAAA,oBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,cAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,KAAK,sDAAE,KAAK,EAAA,QAAA,EAAA,qCAAA,EAAA,MAAA,EAAA,CAAA,IAAA,EAAA,aAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,mBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAGnG,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBALxC,SAAS;+BACE,qCAAqC,EAAA,OAAA,EACtC,CAAC,yBAAyB,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,EAAA,eAAA,EACtD,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,i6BAAA,EAAA;;;;;"}
@@ -4,8 +4,7 @@ import { Alert, AlertIconDirective, AlertActionDirective } from '@ngstarter-ui/c
4
4
  import { Icon } from '@ngstarter-ui/components/icon';
5
5
  import { Button } from '@ngstarter-ui/components/button';
6
6
  import { Menu, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';
7
- import { C as ContentEditorBlockBase } from './ngstarter-ui-components-content-editor-block-base-C46lyMrp.mjs';
8
- import { d as ContentEditorContentEditableDirective } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CK4ssnlk.mjs';
7
+ import { g as ContentEditorBlockBase, d as ContentEditorContentEditableDirective } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs';
9
8
 
10
9
  class ContentEditorCalloutBlock extends ContentEditorBlockBase {
11
10
  variants = ['note', 'tip', 'warning', 'danger'];
@@ -24,4 +23,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
24
23
  }] });
25
24
 
26
25
  export { ContentEditorCalloutBlock };
27
- //# sourceMappingURL=ngstarter-ui-components-content-editor-callout-block-Jbf8h2yz.mjs.map
26
+ //# sourceMappingURL=ngstarter-ui-components-content-editor-callout-block-DTdApN0r.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngstarter-ui-components-content-editor-callout-block-Jbf8h2yz.mjs","sources":["../../../projects/components/content-editor/src/_builder/callout-block/callout-block.ts","../../../projects/components/content-editor/src/_builder/callout-block/callout-block.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed } from '@angular/core';\nimport { Alert, AlertIconDirective, AlertActionDirective } from '@ngstarter-ui/components/alert';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Menu, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';\nimport { ContentEditorBlockBase } from '../block-base';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { ContentEditorCalloutSettings, ContentEditorCalloutVariant, ContentEditorText } from '../../types';\n\n@Component({\n selector: 'ngs-content-editor-callout-block',\n imports: [Alert, AlertIconDirective, AlertActionDirective, Icon, Button, Menu, MenuItem, MenuTrigger, ContentEditorContentEditableDirective],\n templateUrl: './callout-block.html', styleUrl: './callout-block.scss', changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentEditorCalloutBlock extends ContentEditorBlockBase<ContentEditorText, ContentEditorCalloutSettings> {\n readonly variants: ContentEditorCalloutVariant[] = ['note', 'tip', 'warning', 'danger'];\n readonly appearance = computed(() => ({ note: 'informative', tip: 'positive', warning: 'notice', danger: 'negative' })[this.settings().variant] ?? 'informative');\n readonly icon = computed(() => ({ note: 'fluent:info-24-regular', tip: 'fluent:lightbulb-24-regular', warning: 'fluent:warning-24-regular', danger: 'fluent:error-circle-24-regular' })[this.settings().variant] ?? 'fluent:info-24-regular');\n changeVariant(variant: ContentEditorCalloutVariant): void { this.save(this.content(), { ...this.settings(), variant }); }\n changeText(content: ContentEditorText): void { this.save(content); }\n}\n","<ngs-alert [variant]=\"appearance()\" [class.settings-open]=\"settingsTrigger.menuOpen()\">\n <ng-template ngsAlertIcon><ngs-icon [name]=\"icon()\"/></ng-template>\n <div class=\"min-w-0 break-words outline-none\" [ngsContentEditorContentEditable]=\"content()\" [props]=\"props()\"\n (propsChanged)=\"store.updateBlock(id(), {props: $event})\" (contentChanged)=\"changeText($event)\" data-empty-placeholder=\"Write a note…\"></div>\n <button ngsIconButton ngsAlertAction [ngsMenuTriggerFor]=\"variantMenu\" #settingsTrigger=\"ngsMenuTrigger\"\n aria-label=\"Callout style\"><ngs-icon name=\"fluent:more-horizontal-24-regular\"/></button>\n</ngs-alert>\n<ngs-menu #variantMenu>\n @for (variant of variants; track variant) { <button ngs-menu-item (click)=\"changeVariant(variant)\">{{variant}}</button> }\n</ngs-menu>\n"],"names":[],"mappings":";;;;;;;;;AAcM,MAAO,yBAA0B,SAAQ,sBAAuE,CAAA;IAC3G,QAAQ,GAAkC,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC;AAC9E,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,aAAa;mFAAC;AACxJ,IAAA,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,wBAAwB,EAAE,GAAG,EAAE,6BAA6B,EAAE,OAAO,EAAE,2BAA2B,EAAE,MAAM,EAAE,gCAAgC,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IA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A,EAAA,WAAA,EAAA,kBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,QAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,QAAQ,EAAA,QAAA,EAAA,gCAAA,EAAA,MAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,UAAA,CAAA,EAAA,OAAA,EAAA,CAAA,YAAA,CAAA,EAAA,QAAA,EAAA,CAAA,aAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,WAAW,qQAAE,qCAAqC,EAAA,QAAA,EAAA,mCAAA,EAAA,MAAA,EAAA,CAAA,iCAAA,EAAA,UAAA,EAAA,OAAA,EAAA,YAAA,CAAA,EAAA,OAAA,EAAA,CAAA,gBAAA,EAAA,cAAA,EAAA,cAAA,EAAA,aAAA,CAAA,EAAA,QAAA,EAAA,CAAA,iCAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAGhI,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBALrC,SAAS;+BACE,kCAAkC,EAAA,OAAA,EACnC,CAAC,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,CAAC,EAAA,eAAA,EACpD,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,k0BAAA,EAAA,MAAA,EAAA,CAAA,ikBAAA,CAAA,EAAA;;;;;"}
1
+ {"version":3,"file":"ngstarter-ui-components-content-editor-callout-block-DTdApN0r.mjs","sources":["../../../projects/components/content-editor/src/_builder/callout-block/callout-block.ts","../../../projects/components/content-editor/src/_builder/callout-block/callout-block.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed } from '@angular/core';\nimport { Alert, AlertIconDirective, AlertActionDirective } from '@ngstarter-ui/components/alert';\nimport { Icon } from '@ngstarter-ui/components/icon';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { Menu, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';\nimport { ContentEditorBlockBase } from '../block-base';\nimport { ContentEditorContentEditableDirective } from '../../content-editor-content-editable.directive';\nimport { ContentEditorCalloutSettings, ContentEditorCalloutVariant, ContentEditorText } from '../../types';\n\n@Component({\n selector: 'ngs-content-editor-callout-block',\n imports: [Alert, AlertIconDirective, AlertActionDirective, Icon, Button, Menu, MenuItem, MenuTrigger, ContentEditorContentEditableDirective],\n templateUrl: './callout-block.html', styleUrl: './callout-block.scss', changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentEditorCalloutBlock extends ContentEditorBlockBase<ContentEditorText, ContentEditorCalloutSettings> {\n readonly variants: ContentEditorCalloutVariant[] = ['note', 'tip', 'warning', 'danger'];\n readonly appearance = computed(() => ({ note: 'informative', tip: 'positive', warning: 'notice', danger: 'negative' })[this.settings().variant] ?? 'informative');\n readonly icon = computed(() => ({ note: 'fluent:info-24-regular', tip: 'fluent:lightbulb-24-regular', warning: 'fluent:warning-24-regular', danger: 'fluent:error-circle-24-regular' })[this.settings().variant] ?? 'fluent:info-24-regular');\n changeVariant(variant: ContentEditorCalloutVariant): void { this.save(this.content(), { ...this.settings(), variant }); }\n changeText(content: ContentEditorText): void { this.save(content); }\n}\n","<ngs-alert [variant]=\"appearance()\" [class.settings-open]=\"settingsTrigger.menuOpen()\">\n <ng-template ngsAlertIcon><ngs-icon [name]=\"icon()\"/></ng-template>\n <div class=\"min-w-0 break-words outline-none\" [ngsContentEditorContentEditable]=\"content()\" [props]=\"props()\"\n (propsChanged)=\"store.updateBlock(id(), {props: $event})\" (contentChanged)=\"changeText($event)\" data-empty-placeholder=\"Write a note…\"></div>\n <button ngsIconButton ngsAlertAction [ngsMenuTriggerFor]=\"variantMenu\" #settingsTrigger=\"ngsMenuTrigger\"\n aria-label=\"Callout style\"><ngs-icon name=\"fluent:more-horizontal-24-regular\"/></button>\n</ngs-alert>\n<ngs-menu #variantMenu>\n @for (variant of variants; track variant) { <button ngs-menu-item (click)=\"changeVariant(variant)\">{{variant}}</button> }\n</ngs-menu>\n"],"names":[],"mappings":";;;;;;;;AAcM,MAAO,yBAA0B,SAAQ,sBAAuE,CAAA;IAC3G,QAAQ,GAAkC,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC;AAC9E,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,aAAa;mFAAC;AACxJ,IAAA,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,wBAAwB,EAAE,GAAG,EAAE,6BAA6B,EAAE,OAAO,EAAE,2BAA2B,EAAE,MAAM,EAAE,gCAAgC,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,wBAAwB;6EAAC;IAC7O,aAAa,CAAC,OAAoC,EAAA,EAAU,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IACxH,UAAU,CAAC,OAA0B,EAAA,EAAU,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;uGALxD,yBAAyB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAzB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,yBAAyB,mHCdtC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A,EAAA,CAAA,gBAAA,EAAA,cAAA,EAAA,cAAA,EAAA,aAAA,CAAA,EAAA,QAAA,EAAA,CAAA,iCAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAGhI,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBALrC,SAAS;+BACE,kCAAkC,EAAA,OAAA,EACnC,CAAC,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,CAAC,EAAA,eAAA,EACpD,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,k0BAAA,EAAA,MAAA,EAAA,CAAA,ikBAAA,CAAA,EAAA;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { createNgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';
2
- import { C as ContentBuilderStore, a as CONTENT_BUILDER, b as contentEditorText, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CK4ssnlk.mjs';
2
+ import { C as ContentBuilderStore, a as CONTENT_BUILDER, b as contentEditorText, e as CONTENT_EDITOR_BLOCK } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs';
3
3
  import * as i0 from '@angular/core';
4
4
  import { inject, DestroyRef, viewChild, input, signal, effect, untracked, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
5
5
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -215,4 +215,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
215
215
  }], 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 }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }] } });
216
216
 
217
217
  export { CodeBlockComponent };
218
- //# sourceMappingURL=ngstarter-ui-components-content-editor-code-block.component-BizHRPdC.mjs.map
218
+ //# sourceMappingURL=ngstarter-ui-components-content-editor-code-block.component-DpONkTMU.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngstarter-ui-components-content-editor-code-block.component-BizHRPdC.mjs","sources":["../../../projects/components/content-editor/src/_builder/code-block/code-block.component.ts","../../../projects/components/content-editor/src/_builder/code-block/code-block.component.html"],"sourcesContent":["import { NgsHeadlessEditorText, createNgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { contentEditorText } from '../../document';\nimport {\n ChangeDetectionStrategy,\n Component, effect, untracked,\n DestroyRef,\n ElementRef, forwardRef,\n inject,\n input, OnDestroy,\n OnInit,\n signal,\n viewChild\n} from '@angular/core';\nimport {\n CONTENT_BUILDER,\n CONTENT_EDITOR_BLOCK,\n ContentEditorDataBlock\n} from '../../types';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { EditorView, keymap, ViewUpdate } from '@codemirror/view';\nimport { basicSetup } from 'codemirror';\nimport { Compartment, Prec } from '@codemirror/state';\nimport { Menu, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { githubLight } from '@uiw/codemirror-theme-github';\nimport { indentWithTab } from \"@codemirror/commands\"\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\nimport { DOCUMENT } from '@angular/common';\n\nexport interface ContentEditorCodeBlockSettings {\n language: string;\n}\n\nexport interface ContentEditorCodeLanguage {\n language: string;\n name: string;\n library: () => Promise<any>;\n}\n\n@Component({\n selector: 'ngs-code-block',\n imports: [\n Menu,\n MenuItem,\n MenuTrigger,\n Button\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './code-block.component.html',\n styleUrl: './code-block.component.scss',\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: forwardRef(() => CodeBlockComponent),\n multi: true\n }\n ],\n host: {\n 'class': 'ngs-code-block',\n }\n})\nexport class CodeBlockComponent implements OnInit, OnDestroy, ContentEditorDataBlock {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n private _destroyRef = inject(DestroyRef);\n private document = inject(DOCUMENT);\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<ContentEditorCodeBlockSettings>();\n index = input.required<number>();\n props = input<unknown[]>([]);\n placeholder = input('Write your code here');\n\n protected _languageList = signal<ContentEditorCodeLanguage[]>([\n {\n language: 'none',\n name: 'None',\n library: () => new Promise(() => {})\n },\n {\n language: 'angular',\n name: 'Angular',\n library: () => import('@codemirror/lang-angular').then(lang => lang.angular())\n },\n {\n language: 'javascript',\n name: 'JavaScript',\n library: () => import('@codemirror/lang-javascript').then(lang => lang.javascript())\n },\n {\n language: 'typescript',\n name: 'TypeScript',\n library: () => import('@codemirror/lang-javascript').then(lang => lang.javascript({ typescript: true }))\n },\n {\n language: 'html',\n name: 'HTML',\n library: () => import('@codemirror/lang-html').then(lang => lang.html())\n },\n {\n language: 'css',\n name: 'CSS',\n library: () => import('@codemirror/lang-css').then(lang => lang.css())\n },\n {\n language: 'sass',\n name: 'Sass',\n library: () => import('@codemirror/lang-sass').then(lang => lang.sass())\n },\n {\n language: 'json',\n name: 'JSON',\n library: () => import('@codemirror/lang-json').then(lang => lang.json())\n }\n ]);\n protected _code = signal<string>('');\n protected _language = signal<ContentEditorCodeLanguage>(this._languageList()[0]);\n protected _isEmpty = signal<boolean>(true);\n\n private _editorView!: EditorView;\n private _editorLanguage = new Compartment();\n readonly initialized = signal(false);\n\n private restoring = false;\n\n constructor() {\n effect(() => {\n const content = this.content();\n const settings = this.settings();\n untracked(() => {\n if (!this._editorView) return;\n const code = contentEditorText(content);\n this.restoring = true;\n try {\n if (this._editorView.state.doc.toString() !== code) {\n this._editorView.dispatch({ changes: { from: 0, to: this._editorView.state.doc.length, insert: code } });\n }\n const language = this._languageList().find(item => item.language === settings.language);\n if (language && this._language().language !== language.language) {\n void this.selectLanguage(language, false);\n }\n } finally { this.restoring = false; }\n });\n });\n }\n\n async ngOnInit() {\n const codeLanguage = this._languageList().find(\n codeLanguage => codeLanguage.language === this.settings().language\n );\n\n if (codeLanguage) {\n this._language.set(codeLanguage);\n }\n\n this._code.set(contentEditorText(this.content()));\n this._isEmpty.set(this._code().trim().length === 0);\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 this._editorView = new EditorView({\n doc: this._code(),\n parent: this._contentRef().nativeElement,\n extensions: [\n basicSetup,\n githubLight,\n Prec.highest(keymap.of([\n { key: 'Mod-z', run: () => this._store.editor.undo() },\n { key: 'Mod-Shift-z', run: () => this._store.editor.redo() },\n { key: 'Mod-y', run: () => this._store.editor.redo() },\n indentWithTab\n ])),\n this._editorLanguage.of([]),\n EditorView.updateListener.of((v: ViewUpdate) => {\n if (v.docChanged && !this.restoring) {\n this._store.withTextEdit('keyboard', `code:${this.id()}`, () => this.update());\n }\n })\n ],\n });\n await this.selectLanguage(this._language(), false);\n this._editorView.contentDOM.style.width = '0';\n this._editorView.focus();\n this.initialized.set(true);\n }\n\n ngOnDestroy() {\n this._editorView.destroy();\n }\n\n focus() {\n this._editorView.focus();\n }\n\n getData(): any {\n return {\n content: [createNgsHeadlessEditorText(this._editorView.state.doc.toString())],\n settings: {\n ...this.settings(),\n language: this._language().language\n }\n };\n }\n\n isEmpty(): boolean {\n return this._editorView.state.doc.toString().trim().length === 0;\n }\n\n protected async selectLanguage(codeLanguage: ContentEditorCodeLanguage, persist = true) {\n this._language.set(codeLanguage);\n\n if (codeLanguage.language === 'none') {\n this._editorView.dispatch({\n effects: this._editorLanguage.reconfigure([])\n });\n } else {\n const language = await this._language().library();\n this._editorView.dispatch({\n effects: this._editorLanguage.reconfigure(language)\n });\n }\n\n if (persist) 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","<div class=\"bg-surface-container rounded-xl\">\n <div class=\"border-b border-b-default h-12 header\">\n <button ngsButton [ngsMenuTriggerFor]=\"languageListMenu\" class=\"-ms-2\">{{ _language().name }}</button>\n </div>\n <div class=\"content\">\n <div class=\"content-code\" #contentRef></div>\n </div>\n</div>\n\n<ngs-menu #languageListMenu=\"ngsMenu\">\n @for (languageItem of _languageList(); track $index) {\n <button ngs-menu-item (click)=\"selectLanguage(languageItem)\"\n class=\"[&.is-active]:!bg-secondary-fixed\"\n [class.is-active]=\"languageItem.language === _language().language\">{{ languageItem.name }}</button>\n }\n</ngs-menu>\n"],"names":[],"mappings":";;;;;;;;;;;;;;MA8Da,kBAAkB,CAAA;AACrB,IAAA,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACpC,IAAA,eAAe,GAAG,MAAM,CAA0B,eAAe,CAAC;AAClE,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAE3B,IAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAmC,YAAY;oFAAC;IAExF,EAAE,GAAG,KAAK,CAAC,QAAQ;2EAAU;IAC7B,OAAO,GAAG,KAAK,CAAC,QAAQ;gFAAoC;IAC5D,QAAQ,GAAG,KAAK,CAAC,QAAQ;iFAAkC;IAC3D,KA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EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,aAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
1
+ {"version":3,"file":"ngstarter-ui-components-content-editor-code-block.component-DpONkTMU.mjs","sources":["../../../projects/components/content-editor/src/_builder/code-block/code-block.component.ts","../../../projects/components/content-editor/src/_builder/code-block/code-block.component.html"],"sourcesContent":["import { NgsHeadlessEditorText, createNgsHeadlessEditorText } from '@ngstarter-ui/components/headless-editor';\nimport { contentEditorText } from '../../document';\nimport {\n ChangeDetectionStrategy,\n Component, effect, untracked,\n DestroyRef,\n ElementRef, forwardRef,\n inject,\n input, OnDestroy,\n OnInit,\n signal,\n viewChild\n} from '@angular/core';\nimport {\n CONTENT_BUILDER,\n CONTENT_EDITOR_BLOCK,\n ContentEditorDataBlock\n} from '../../types';\nimport { ContentBuilderStore } from '../../content-builder.store';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { EditorView, keymap, ViewUpdate } from '@codemirror/view';\nimport { basicSetup } from 'codemirror';\nimport { Compartment, Prec } from '@codemirror/state';\nimport { Menu, MenuItem, MenuTrigger } from '@ngstarter-ui/components/menu';\nimport { Button } from '@ngstarter-ui/components/button';\nimport { githubLight } from '@uiw/codemirror-theme-github';\nimport { indentWithTab } from \"@codemirror/commands\"\nimport { ContentBuilderComponent } from '../../content-builder/content-builder.component';\nimport { DOCUMENT } from '@angular/common';\n\nexport interface ContentEditorCodeBlockSettings {\n language: string;\n}\n\nexport interface ContentEditorCodeLanguage {\n language: string;\n name: string;\n library: () => Promise<any>;\n}\n\n@Component({\n selector: 'ngs-code-block',\n imports: [\n Menu,\n MenuItem,\n MenuTrigger,\n Button\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './code-block.component.html',\n styleUrl: './code-block.component.scss',\n providers: [\n {\n provide: CONTENT_EDITOR_BLOCK,\n useExisting: forwardRef(() => CodeBlockComponent),\n multi: true\n }\n ],\n host: {\n 'class': 'ngs-code-block',\n }\n})\nexport class CodeBlockComponent implements OnInit, OnDestroy, ContentEditorDataBlock {\n private _store = inject(ContentBuilderStore);\n private _contentBuilder = inject<ContentBuilderComponent>(CONTENT_BUILDER);\n private _destroyRef = inject(DestroyRef);\n private document = inject(DOCUMENT);\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<ContentEditorCodeBlockSettings>();\n index = input.required<number>();\n props = input<unknown[]>([]);\n placeholder = input('Write your code here');\n\n protected _languageList = signal<ContentEditorCodeLanguage[]>([\n {\n language: 'none',\n name: 'None',\n library: () => new Promise(() => {})\n },\n {\n language: 'angular',\n name: 'Angular',\n library: () => import('@codemirror/lang-angular').then(lang => lang.angular())\n },\n {\n language: 'javascript',\n name: 'JavaScript',\n library: () => import('@codemirror/lang-javascript').then(lang => lang.javascript())\n },\n {\n language: 'typescript',\n name: 'TypeScript',\n library: () => import('@codemirror/lang-javascript').then(lang => lang.javascript({ typescript: true }))\n },\n {\n language: 'html',\n name: 'HTML',\n library: () => import('@codemirror/lang-html').then(lang => lang.html())\n },\n {\n language: 'css',\n name: 'CSS',\n library: () => import('@codemirror/lang-css').then(lang => lang.css())\n },\n {\n language: 'sass',\n name: 'Sass',\n library: () => import('@codemirror/lang-sass').then(lang => lang.sass())\n },\n {\n language: 'json',\n name: 'JSON',\n library: () => import('@codemirror/lang-json').then(lang => lang.json())\n }\n ]);\n protected _code = signal<string>('');\n protected _language = signal<ContentEditorCodeLanguage>(this._languageList()[0]);\n protected _isEmpty = signal<boolean>(true);\n\n private _editorView!: EditorView;\n private _editorLanguage = new Compartment();\n readonly initialized = signal(false);\n\n private restoring = false;\n\n constructor() {\n effect(() => {\n const content = this.content();\n const settings = this.settings();\n untracked(() => {\n if (!this._editorView) return;\n const code = contentEditorText(content);\n this.restoring = true;\n try {\n if (this._editorView.state.doc.toString() !== code) {\n this._editorView.dispatch({ changes: { from: 0, to: this._editorView.state.doc.length, insert: code } });\n }\n const language = this._languageList().find(item => item.language === settings.language);\n if (language && this._language().language !== language.language) {\n void this.selectLanguage(language, false);\n }\n } finally { this.restoring = false; }\n });\n });\n }\n\n async ngOnInit() {\n const codeLanguage = this._languageList().find(\n codeLanguage => codeLanguage.language === this.settings().language\n );\n\n if (codeLanguage) {\n this._language.set(codeLanguage);\n }\n\n this._code.set(contentEditorText(this.content()));\n this._isEmpty.set(this._code().trim().length === 0);\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 this._editorView = new EditorView({\n doc: this._code(),\n parent: this._contentRef().nativeElement,\n extensions: [\n basicSetup,\n githubLight,\n Prec.highest(keymap.of([\n { key: 'Mod-z', run: () => this._store.editor.undo() },\n { key: 'Mod-Shift-z', run: () => this._store.editor.redo() },\n { key: 'Mod-y', run: () => this._store.editor.redo() },\n indentWithTab\n ])),\n this._editorLanguage.of([]),\n EditorView.updateListener.of((v: ViewUpdate) => {\n if (v.docChanged && !this.restoring) {\n this._store.withTextEdit('keyboard', `code:${this.id()}`, () => this.update());\n }\n })\n ],\n });\n await this.selectLanguage(this._language(), false);\n this._editorView.contentDOM.style.width = '0';\n this._editorView.focus();\n this.initialized.set(true);\n }\n\n ngOnDestroy() {\n this._editorView.destroy();\n }\n\n focus() {\n this._editorView.focus();\n }\n\n getData(): any {\n return {\n content: [createNgsHeadlessEditorText(this._editorView.state.doc.toString())],\n settings: {\n ...this.settings(),\n language: this._language().language\n }\n };\n }\n\n isEmpty(): boolean {\n return this._editorView.state.doc.toString().trim().length === 0;\n }\n\n protected async selectLanguage(codeLanguage: ContentEditorCodeLanguage, persist = true) {\n this._language.set(codeLanguage);\n\n if (codeLanguage.language === 'none') {\n this._editorView.dispatch({\n effects: this._editorLanguage.reconfigure([])\n });\n } else {\n const language = await this._language().library();\n this._editorView.dispatch({\n effects: this._editorLanguage.reconfigure(language)\n });\n }\n\n if (persist) 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","<div class=\"bg-surface-container rounded-xl\">\n <div class=\"border-b border-b-default h-12 header\">\n <button ngsButton [ngsMenuTriggerFor]=\"languageListMenu\" class=\"-ms-2\">{{ _language().name }}</button>\n </div>\n <div class=\"content\">\n <div class=\"content-code\" #contentRef></div>\n </div>\n</div>\n\n<ngs-menu #languageListMenu=\"ngsMenu\">\n @for (languageItem of _languageList(); track $index) {\n <button ngs-menu-item (click)=\"selectLanguage(languageItem)\"\n class=\"[&.is-active]:!bg-secondary-fixed\"\n [class.is-active]=\"languageItem.language === _language().language\">{{ languageItem.name }}</button>\n }\n</ngs-menu>\n"],"names":[],"mappings":";;;;;;;;;;;;;;MA8Da,kBAAkB,CAAA;AACrB,IAAA,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;AAC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AAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,aAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, inject, DestroyRef, input, signal, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
3
- import { C as ContentBuilderStore, a as CONTENT_BUILDER } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CK4ssnlk.mjs';
3
+ import { C as ContentBuilderStore, a as CONTENT_BUILDER } from './ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-CR-NrarE.mjs';
4
4
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
5
  import { Icon } from '@ngstarter-ui/components/icon';
6
6
  import { Popover, PopoverTriggerForDirective } from '@ngstarter-ui/components/popover';
@@ -372,4 +372,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
372
372
  }], 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 }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }] } });
373
373
 
374
374
  export { EmbedBlock };
375
- //# sourceMappingURL=ngstarter-ui-components-content-editor-embed-block-BzoaJvai.mjs.map
375
+ //# sourceMappingURL=ngstarter-ui-components-content-editor-embed-block-CmhzpaRk.mjs.map