@acorex/platform 21.0.0-next.54 → 21.0.0-next.55
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/fesm2022/acorex-platform-common.mjs +79 -1
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-components.mjs +83 -70
- package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
- package/package.json +1 -1
- package/types/acorex-platform-common.d.ts +96 -2
- package/types/acorex-platform-layout-components.d.ts +5 -3
|
@@ -4825,7 +4825,7 @@ class AXPMarkdownTemplateDirective {
|
|
|
4825
4825
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPMarkdownTemplateDirective, decorators: [{
|
|
4826
4826
|
type: Directive,
|
|
4827
4827
|
args: [{
|
|
4828
|
-
selector: 'ng-template[axpMarkdownTemplate]'
|
|
4828
|
+
selector: 'ng-template[axpMarkdownTemplate]',
|
|
4829
4829
|
}]
|
|
4830
4830
|
}], ctorParameters: () => [{ type: i0.TemplateRef }], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "axpMarkdownTemplate", required: true }] }] } });
|
|
4831
4831
|
//#endregion
|
|
@@ -4845,12 +4845,18 @@ class AXPMarkdownViewerComponent {
|
|
|
4845
4845
|
this.codeTemplate = computed(() => this.templates().find((item) => item.type() === 'code')?.template, ...(ngDevMode ? [{ debugName: "codeTemplate" }] : /* istanbul ignore next */ []));
|
|
4846
4846
|
//#endregion
|
|
4847
4847
|
//#region ---- View Model ----
|
|
4848
|
-
this.segments = computed(() => this.parseMarkdown(this.markdown() ?? ''), ...(ngDevMode ? [{ debugName: "segments" }] : /* istanbul ignore next */ []));
|
|
4849
4848
|
this.markdownCompiler = signal(null, ...(ngDevMode ? [{ debugName: "markdownCompiler" }] : /* istanbul ignore next */ []));
|
|
4849
|
+
/** Tracks compiler readiness so parsed HTML refreshes after the lazy chunk loads. */
|
|
4850
|
+
this.segments = computed(() => {
|
|
4851
|
+
this.markdownCompiler();
|
|
4852
|
+
return this.parseMarkdown(this.markdown() ?? '');
|
|
4853
|
+
}, ...(ngDevMode ? [{ debugName: "segments" }] : /* istanbul ignore next */ []));
|
|
4854
|
+
/** Shared in-flight lazy import (bundler emits async chunks from literal specifiers below). */
|
|
4855
|
+
this.micromarkLoadPromise = null;
|
|
4850
4856
|
effect(() => {
|
|
4851
4857
|
const value = this.markdown();
|
|
4852
4858
|
if (value.trim() && !this.markdownCompiler()) {
|
|
4853
|
-
void this.
|
|
4859
|
+
void this.ensureMicromarkCompiler();
|
|
4854
4860
|
}
|
|
4855
4861
|
});
|
|
4856
4862
|
}
|
|
@@ -4928,102 +4934,109 @@ class AXPMarkdownViewerComponent {
|
|
|
4928
4934
|
html: compiler ? compiler(value) : this.escapeHtml(value),
|
|
4929
4935
|
});
|
|
4930
4936
|
}
|
|
4937
|
+
ensureMicromarkCompiler() {
|
|
4938
|
+
if (this.markdownCompiler()) {
|
|
4939
|
+
return Promise.resolve();
|
|
4940
|
+
}
|
|
4941
|
+
if (!this.micromarkLoadPromise) {
|
|
4942
|
+
this.micromarkLoadPromise = this.loadMicromarkCompiler().finally(() => {
|
|
4943
|
+
this.micromarkLoadPromise = null;
|
|
4944
|
+
});
|
|
4945
|
+
}
|
|
4946
|
+
return this.micromarkLoadPromise;
|
|
4947
|
+
}
|
|
4931
4948
|
async loadMicromarkCompiler() {
|
|
4932
4949
|
if (this.markdownCompiler()) {
|
|
4933
4950
|
return;
|
|
4934
4951
|
}
|
|
4935
|
-
const [micromarkModule, gfmModule] = await this.loadMicromarkModules();
|
|
4936
|
-
const compiler = (value) => micromarkModule.micromark(value, {
|
|
4937
|
-
extensions: [gfmModule.gfm()],
|
|
4938
|
-
htmlExtensions: [gfmModule.gfmHtml()],
|
|
4939
|
-
});
|
|
4940
|
-
this.markdownCompiler.set(compiler);
|
|
4941
|
-
}
|
|
4942
|
-
async loadMicromarkModules() {
|
|
4943
|
-
const localMicromarkPath = 'micromark';
|
|
4944
|
-
const localGfmPath = 'micromark-extension-gfm';
|
|
4945
4952
|
try {
|
|
4946
|
-
const [micromarkModule, gfmModule] = await
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4953
|
+
const [micromarkModule, gfmModule] = await loadMicromarkModules();
|
|
4954
|
+
const compiler = (value) => micromarkModule.micromark(value, {
|
|
4955
|
+
extensions: [gfmModule.gfm()],
|
|
4956
|
+
htmlExtensions: [gfmModule.gfmHtml()],
|
|
4957
|
+
});
|
|
4958
|
+
this.markdownCompiler.set(compiler);
|
|
4951
4959
|
}
|
|
4952
|
-
catch {
|
|
4953
|
-
|
|
4954
|
-
this.importModule('https://esm.sh/micromark@4'),
|
|
4955
|
-
this.importModule('https://esm.sh/micromark-extension-gfm@3'),
|
|
4956
|
-
]);
|
|
4957
|
-
return [micromarkModule, gfmModule];
|
|
4960
|
+
catch (error) {
|
|
4961
|
+
console.warn('[AXPMarkdownViewer] Failed to load micromark; showing escaped text.', error);
|
|
4958
4962
|
}
|
|
4959
4963
|
}
|
|
4960
|
-
async importModule(path) {
|
|
4961
|
-
return (await import(/* @vite-ignore */ path));
|
|
4962
|
-
}
|
|
4963
4964
|
escapeHtml(value) {
|
|
4964
4965
|
return value
|
|
4965
4966
|
.replaceAll('&', '&')
|
|
4966
4967
|
.replaceAll('<', '<')
|
|
4967
4968
|
.replaceAll('>', '>')
|
|
4968
4969
|
.replaceAll('"', '"')
|
|
4969
|
-
.replaceAll('
|
|
4970
|
+
.replaceAll("'", ''')
|
|
4970
4971
|
.replaceAll('\n', '<br>');
|
|
4971
4972
|
}
|
|
4972
4973
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPMarkdownViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4973
4974
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPMarkdownViewerComponent, isStandalone: true, selector: "axp-markdown-viewer", inputs: { markdown: { classPropertyName: "markdown", publicName: "markdown", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "templates", predicate: AXPMarkdownTemplateDirective, isSignal: true }], ngImport: i0, template: `
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
<pre class="axp-markdown-viewer__code"><code>{{ segment.code }}</code></pre>
|
|
4984
|
-
}
|
|
4975
|
+
<section class="axp-markdown-viewer">
|
|
4976
|
+
@for (segment of segments(); track $index) {
|
|
4977
|
+
@if (segment.type === 'code') {
|
|
4978
|
+
@if (codeTemplate(); as template) {
|
|
4979
|
+
<ng-container
|
|
4980
|
+
[ngTemplateOutlet]="template"
|
|
4981
|
+
[ngTemplateOutletContext]="{ $implicit: segment, segment: segment }"
|
|
4982
|
+
>
|
|
4983
|
+
</ng-container>
|
|
4985
4984
|
} @else {
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4985
|
+
<pre class="axp-markdown-viewer__code"><code>{{ segment.code }}</code></pre>
|
|
4986
|
+
}
|
|
4987
|
+
} @else {
|
|
4988
|
+
@if (markdownTemplate(); as template) {
|
|
4989
|
+
<ng-container
|
|
4990
|
+
[ngTemplateOutlet]="template"
|
|
4991
|
+
[ngTemplateOutletContext]="{ $implicit: segment, segment: segment }"
|
|
4992
|
+
>
|
|
4993
|
+
</ng-container>
|
|
4994
|
+
} @else {
|
|
4995
|
+
<div class="axp-markdown-viewer__content" [innerHTML]="segment.html"></div>
|
|
4994
4996
|
}
|
|
4995
4997
|
}
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
+
}
|
|
4999
|
+
</section>
|
|
5000
|
+
`, isInline: true, styles: [".axp-markdown-viewer{display:block}.axp-markdown-viewer__content{display:block;font-size:.95rem;line-height:1.75;color:var(--ax-color-text, inherit);word-break:break-word;white-space:nowrap;text-wrap:wrap}.axp-markdown-viewer__content h1,.axp-markdown-viewer__content h2,.axp-markdown-viewer__content h3,.axp-markdown-viewer__content h4,.axp-markdown-viewer__content h5,.axp-markdown-viewer__content h6{display:block;margin:0;line-height:1.35;font-weight:600;letter-spacing:.01em}.axp-markdown-viewer__content h1{font-size:1.7rem!important}.axp-markdown-viewer__content h2{font-size:1.45rem!important}.axp-markdown-viewer__content h3{font-size:1.25rem!important}.axp-markdown-viewer__content h4{font-size:1.1rem!important}.axp-markdown-viewer__content h5{font-size:1rem!important}.axp-markdown-viewer__content h6{font-size:.92rem!important;opacity:.9}.axp-markdown-viewer__content p{margin:0}.axp-markdown-viewer__content ul{margin:0;padding-inline-start:1.25rem;list-style-type:disc;list-style-position:outside}.axp-markdown-viewer__content ol{margin:0;padding-inline-start:1.35rem;list-style-type:decimal;list-style-position:outside}.axp-markdown-viewer__content li{margin:0;line-height:1.75;padding-inline-start:.25rem}.axp-markdown-viewer__content ul ul,.axp-markdown-viewer__content ul ol,.axp-markdown-viewer__content ol ul,.axp-markdown-viewer__content ol ol{margin:0}.axp-markdown-viewer__content ul ul{list-style-type:circle}.axp-markdown-viewer__content blockquote{margin:0;padding:.45rem .65rem;border-inline-start:3px solid rgba(var(--ax-sys-color-primary),.35);background:rgba(var(--ax-sys-color-primary),.06);border-radius:.25rem}.axp-markdown-viewer__content hr{border:0;border-top:1px solid var(--ax-color-ghost, rgba(0, 0, 0, .16));margin:0}.axp-markdown-viewer__content code{font-family:var(--ax-font-mono, monospace);font-size:.9em;padding:.1rem .3rem;border-radius:.25rem;background:var(--ax-color-ghost, rgba(0, 0, 0, .06))}.axp-markdown-viewer__content pre{margin:0}.axp-markdown-viewer__content table{width:100%;border-collapse:collapse;margin:0}.axp-markdown-viewer__content th,.axp-markdown-viewer__content td{border:1px solid var(--ax-color-ghost, rgba(0, 0, 0, .12));padding:.35rem .5rem;text-align:start}.axp-markdown-viewer__content a{text-decoration:underline}.axp-markdown-viewer__content img{max-width:100%;height:auto;border-radius:.35rem}.axp-markdown-viewer__content details{margin:0;padding:.35rem .55rem;border:1px solid var(--ax-color-ghost, rgba(0, 0, 0, .12));border-radius:.35rem}.axp-markdown-viewer__content summary{cursor:pointer;font-weight:600}.axp-markdown-viewer__content sup{line-height:0;font-size:.75em}.axp-markdown-viewer__content .footnotes{margin:0;padding-top:.5rem;border-top:1px dashed var(--ax-color-ghost, rgba(0, 0, 0, .16))}.axp-markdown-viewer__content ul.contains-task-list{list-style:none;padding-inline-start:.2rem}.axp-markdown-viewer__content .task-list-item{list-style:none}.axp-markdown-viewer__content .task-list-item input[type=checkbox]{margin:0;transform:translateY(1px)}.axp-markdown-viewer__code{margin:0;padding:.75rem 1rem;border-radius:.5rem;background-color:var(--ax-surface-secondary, #111827);color:var(--ax-text-on-primary, #f9fafb);overflow:auto}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
4998
5001
|
}
|
|
4999
5002
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPMarkdownViewerComponent, decorators: [{
|
|
5000
5003
|
type: Component,
|
|
5001
5004
|
args: [{ selector: 'axp-markdown-viewer', standalone: true, imports: [CommonModule], template: `
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
<pre class="axp-markdown-viewer__code"><code>{{ segment.code }}</code></pre>
|
|
5012
|
-
}
|
|
5005
|
+
<section class="axp-markdown-viewer">
|
|
5006
|
+
@for (segment of segments(); track $index) {
|
|
5007
|
+
@if (segment.type === 'code') {
|
|
5008
|
+
@if (codeTemplate(); as template) {
|
|
5009
|
+
<ng-container
|
|
5010
|
+
[ngTemplateOutlet]="template"
|
|
5011
|
+
[ngTemplateOutletContext]="{ $implicit: segment, segment: segment }"
|
|
5012
|
+
>
|
|
5013
|
+
</ng-container>
|
|
5013
5014
|
} @else {
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5015
|
+
<pre class="axp-markdown-viewer__code"><code>{{ segment.code }}</code></pre>
|
|
5016
|
+
}
|
|
5017
|
+
} @else {
|
|
5018
|
+
@if (markdownTemplate(); as template) {
|
|
5019
|
+
<ng-container
|
|
5020
|
+
[ngTemplateOutlet]="template"
|
|
5021
|
+
[ngTemplateOutletContext]="{ $implicit: segment, segment: segment }"
|
|
5022
|
+
>
|
|
5023
|
+
</ng-container>
|
|
5024
|
+
} @else {
|
|
5025
|
+
<div class="axp-markdown-viewer__content" [innerHTML]="segment.html"></div>
|
|
5022
5026
|
}
|
|
5023
5027
|
}
|
|
5024
|
-
|
|
5025
|
-
|
|
5028
|
+
}
|
|
5029
|
+
</section>
|
|
5030
|
+
`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".axp-markdown-viewer{display:block}.axp-markdown-viewer__content{display:block;font-size:.95rem;line-height:1.75;color:var(--ax-color-text, inherit);word-break:break-word;white-space:nowrap;text-wrap:wrap}.axp-markdown-viewer__content h1,.axp-markdown-viewer__content h2,.axp-markdown-viewer__content h3,.axp-markdown-viewer__content h4,.axp-markdown-viewer__content h5,.axp-markdown-viewer__content h6{display:block;margin:0;line-height:1.35;font-weight:600;letter-spacing:.01em}.axp-markdown-viewer__content h1{font-size:1.7rem!important}.axp-markdown-viewer__content h2{font-size:1.45rem!important}.axp-markdown-viewer__content h3{font-size:1.25rem!important}.axp-markdown-viewer__content h4{font-size:1.1rem!important}.axp-markdown-viewer__content h5{font-size:1rem!important}.axp-markdown-viewer__content h6{font-size:.92rem!important;opacity:.9}.axp-markdown-viewer__content p{margin:0}.axp-markdown-viewer__content ul{margin:0;padding-inline-start:1.25rem;list-style-type:disc;list-style-position:outside}.axp-markdown-viewer__content ol{margin:0;padding-inline-start:1.35rem;list-style-type:decimal;list-style-position:outside}.axp-markdown-viewer__content li{margin:0;line-height:1.75;padding-inline-start:.25rem}.axp-markdown-viewer__content ul ul,.axp-markdown-viewer__content ul ol,.axp-markdown-viewer__content ol ul,.axp-markdown-viewer__content ol ol{margin:0}.axp-markdown-viewer__content ul ul{list-style-type:circle}.axp-markdown-viewer__content blockquote{margin:0;padding:.45rem .65rem;border-inline-start:3px solid rgba(var(--ax-sys-color-primary),.35);background:rgba(var(--ax-sys-color-primary),.06);border-radius:.25rem}.axp-markdown-viewer__content hr{border:0;border-top:1px solid var(--ax-color-ghost, rgba(0, 0, 0, .16));margin:0}.axp-markdown-viewer__content code{font-family:var(--ax-font-mono, monospace);font-size:.9em;padding:.1rem .3rem;border-radius:.25rem;background:var(--ax-color-ghost, rgba(0, 0, 0, .06))}.axp-markdown-viewer__content pre{margin:0}.axp-markdown-viewer__content table{width:100%;border-collapse:collapse;margin:0}.axp-markdown-viewer__content th,.axp-markdown-viewer__content td{border:1px solid var(--ax-color-ghost, rgba(0, 0, 0, .12));padding:.35rem .5rem;text-align:start}.axp-markdown-viewer__content a{text-decoration:underline}.axp-markdown-viewer__content img{max-width:100%;height:auto;border-radius:.35rem}.axp-markdown-viewer__content details{margin:0;padding:.35rem .55rem;border:1px solid var(--ax-color-ghost, rgba(0, 0, 0, .12));border-radius:.35rem}.axp-markdown-viewer__content summary{cursor:pointer;font-weight:600}.axp-markdown-viewer__content sup{line-height:0;font-size:.75em}.axp-markdown-viewer__content .footnotes{margin:0;padding-top:.5rem;border-top:1px dashed var(--ax-color-ghost, rgba(0, 0, 0, .16))}.axp-markdown-viewer__content ul.contains-task-list{list-style:none;padding-inline-start:.2rem}.axp-markdown-viewer__content .task-list-item{list-style:none}.axp-markdown-viewer__content .task-list-item input[type=checkbox]{margin:0;transform:translateY(1px)}.axp-markdown-viewer__code{margin:0;padding:.75rem 1rem;border-radius:.5rem;background-color:var(--ax-surface-secondary, #111827);color:var(--ax-text-on-primary, #f9fafb);overflow:auto}\n"] }]
|
|
5026
5031
|
}], ctorParameters: () => [], propDecorators: { markdown: [{ type: i0.Input, args: [{ isSignal: true, alias: "markdown", required: false }] }], templates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => AXPMarkdownTemplateDirective), { isSignal: true }] }] } });
|
|
5032
|
+
/**
|
|
5033
|
+
* Lazy-loaded from workspace `node_modules`. Must stay as literal string specifiers (not variables,
|
|
5034
|
+
* not `@vite-ignore`) so Angular/esbuild can emit separate async chunks instead of leaving runtime
|
|
5035
|
+
* bare-specifier imports that fail in the browser and previously triggered esm.sh fallback.
|
|
5036
|
+
*/
|
|
5037
|
+
function loadMicromarkModules() {
|
|
5038
|
+
return Promise.all([import('micromark'), import('micromark-extension-gfm')]);
|
|
5039
|
+
}
|
|
5027
5040
|
|
|
5028
5041
|
//#region ---- Imports ----
|
|
5029
5042
|
//#endregion
|