-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use explicit standalone false for v19
- Loading branch information
1 parent
af618c0
commit 2889f91
Showing
10 changed files
with
8,228 additions
and
76 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { PiletApi } from 'piral-core'; | ||
import { Component, ElementRef, Input, Inject, OnChanges } from '@angular/core'; | ||
|
||
const selector = 'extension-component'; | ||
|
||
@Component({ | ||
selector, | ||
standalone: false, | ||
template: '', | ||
}) | ||
export class NgExtension implements OnChanges { | ||
@Input('name') public name: string | undefined; | ||
@Input('params') public params: object | undefined; | ||
|
||
constructor(private elRef: ElementRef<HTMLElement>, @Inject('piral') private piral: PiletApi) {} | ||
|
||
ngOnChanges() { | ||
this.elRef.nativeElement.dispatchEvent( | ||
new CustomEvent('extension-props-changed', { | ||
detail: { | ||
name: this.name, | ||
params: this.params, | ||
}, | ||
}), | ||
); | ||
} | ||
|
||
ngAfterContentInit() { | ||
this.piral.renderHtmlExtension(this.elRef.nativeElement, { | ||
name: this.name, | ||
params: this.params, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { PiletApi } from 'piral-core'; | ||
import { Inject, Pipe, PipeTransform } from '@angular/core'; | ||
|
||
@Pipe({ name: 'resourceUrl', standalone: false }) | ||
export class ResourceUrlPipe implements PipeTransform { | ||
constructor(@Inject('piral') private piral: PiletApi) {} | ||
|
||
transform(value: string): string { | ||
const { basePath = '/' } = this.piral.meta; | ||
return basePath + value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { NgExtension } from './NgExtension'; | ||
import { ResourceUrlPipe } from './ResourceUrlPipe'; | ||
|
||
const declarationsDef = [NgExtension, ResourceUrlPipe]; | ||
const exportsDef = [NgExtension, ResourceUrlPipe]; | ||
const importsDef = [CommonModule]; | ||
|
||
@NgModule({ | ||
declarations: declarationsDef, | ||
providers: [], | ||
imports: importsDef, | ||
exports: exportsDef, | ||
}) | ||
export class SharedModule { | ||
static props = {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './public_api'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
exports.NgExtension = class {}; | ||
exports.SharedModule = class {}; | ||
exports.ResourceUrlPipe = class {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './SharedModule'; | ||
export * from './NgExtension'; | ||
export * from './ResourceUrlPipe'; |