Skip to content

feat(dgeni): generate color palettes and render in design-land #2912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@
{
"glob": "**/*",
"input": "dist/docs/",
"output": "/assets/"
"output": "/assets/docs/"
}
],
"styles": [
Expand Down
2 changes: 1 addition & 1 deletion apps/daffio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@daffodil/branding": "0.0.0-PLACEHOLDER",
"@daffodil/core": "0.0.0-PLACEHOLDER",
"@daffodil/docs-components": "0.0.0-PLACEHOLDER",
"@daffodil/docs-utils": "0.0.0-PLACEHOLDER",
"@daffodil/documentation": "0.0.0-PLACEHOLDER",
"@daffodil/design": "0.0.0-PLACEHOLDER",
"@daffodil/router": "0.0.0-PLACEHOLDER",
"@daffodil/tools-dgeni": "0.0.0-PLACEHOLDER",
Expand Down
2 changes: 2 additions & 0 deletions apps/daffio/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { DaffioMarketingSidebarContentComponentModule } from './core/sidebar/com
import { DaffioSidebarFooterComponentModule } from './core/sidebar/components/sidebar-footer/sidebar-footer.module';
import { DaffioSidebarHeaderComponentModule } from './core/sidebar/components/sidebar-header/sidebar-header.module';
import { TemplateModule } from './core/template/template.module';
import { provideBrowserDocsPath } from './docs/services/docs-path-browser';
import { environment } from '../environments/environment';

@NgModule({
Expand Down Expand Up @@ -75,6 +76,7 @@ import { environment } from '../environments/environment';
provide: APP_ID,
useValue: 'serverApp',
},
provideBrowserDocsPath(),
],
})
export class AppModule {}
9 changes: 3 additions & 6 deletions apps/daffio/src/app/app.server.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';

import { provideDaffDocsServerFetchAssetService } from '@daffodil/documentation/server';

import { DaffioAppComponent } from './app.component';
import { AppModule } from './app.module';
import { DaffioAssetFetchServerService } from './core/assets/fetch/server.service';
import { DaffioAssetFetchService } from './core/assets/fetch/service.interface';
import { provideServerDocsPath } from './docs/services/docs-path-server';

@NgModule({
Expand All @@ -15,10 +15,7 @@ import { provideServerDocsPath } from './docs/services/docs-path-server';
bootstrap: [DaffioAppComponent],
providers: [
provideServerDocsPath(),
{
provide: DaffioAssetFetchService,
useExisting: DaffioAssetFetchServerService,
},
provideDaffDocsServerFetchAssetService(),
],
})
export class AppServerModule {}
18 changes: 0 additions & 18 deletions apps/daffio/src/app/core/assets/fetch/service.interface.ts

This file was deleted.

4 changes: 2 additions & 2 deletions apps/daffio/src/app/docs/api/api-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
RouterModule,
} from '@angular/router';

import { daffDocsResolve } from '@daffodil/documentation/routing';
import { DaffRouteWithNamedViews } from '@daffodil/router';

import { DaffioApiListPageComponent } from './pages/api-list-page/api-list-page.component';
Expand All @@ -12,7 +13,6 @@ import { DaffioApiListResolver } from './resolvers/api-list-resolver.service';
import { DaffioSimpleFooterComponent } from '../../core/footer/simple-footer/simple-footer.component';
import { DaffioDocsSidebarContentComponent } from '../../core/sidebar/components/docs-sidebar-content/docs-sidebar-content.component';
import { DaffioRouterNamedViewsEnum } from '../../named-views/models/named-views.enum';
import { DocsResolver } from '../resolvers/docs-resolver.service';

export const apiRoutes: Routes = [
<DaffRouteWithNamedViews>{
Expand All @@ -35,7 +35,7 @@ export const apiRoutes: Routes = [
path: '**',
component: DaffioApiPageComponent,
resolve: {
doc: DocsResolver,
doc: daffDocsResolve,
},
},
],
Expand Down
4 changes: 2 additions & 2 deletions apps/daffio/src/app/docs/api/models/api-doc.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DaffioDoc } from '../../models/doc';
import { DaffDoc } from '@daffodil/docs-utils';

/**
* An object for an API document.
*/
export interface DaffioApiDoc extends DaffioDoc {
export interface DaffioApiDoc extends DaffDoc {
docType: string;
docTypeShorthand: string;
}
4 changes: 2 additions & 2 deletions apps/daffio/src/app/docs/api/models/api-reference.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DaffioGenericDocList } from '../../models/doc-list';
import { DaffDocsGenericList } from '@daffodil/docs-utils';

/**
* An object for a reference to an API document.
*/
export interface DaffioApiReference extends DaffioGenericDocList<DaffioApiReference> {
export interface DaffioApiReference extends DaffDocsGenericList<DaffioApiReference> {
docType: string;
docTypeShorthand: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ import { RouterTestingModule } from '@angular/router/testing';
import { cold } from 'jasmine-marbles';
import { BehaviorSubject } from 'rxjs';

import { DaffDoc } from '@daffodil/docs-utils';
import { DaffDocsFactory } from '@daffodil/documentation/testing';

import { DaffioApiPageComponent } from './api-page.component';
import { DaffioDoc } from '../../../models/doc';
import { DaffioDocsFactory } from '../../../testing/factories/docs.factory';

@Component({ selector: 'daffio-doc-viewer', template: '' })
class MockDaffioDocViewerComponent {
@Input() doc: DaffioDoc;
@Input() doc: DaffDoc;
}

describe('DaffioApiPageComponent', () => {
let component: DaffioApiPageComponent;
let fixture: ComponentFixture<DaffioApiPageComponent>;
const doc: DaffioDoc = new DaffioDocsFactory().create();
const doc: DaffDoc = new DaffDocsFactory().create();
const stubActivatedRoute = {
data: new BehaviorSubject({}),
};
Expand Down
17 changes: 10 additions & 7 deletions apps/daffio/src/app/docs/api/services/api.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import { TestBed } from '@angular/core/testing';
import { of } from 'rxjs';

import { DaffioApiService } from './api.service';
import {
DaffioAssetFetchServiceInterface,
DaffioAssetFetchService,
} from '../../../core/assets/fetch/service.interface';
DaffDocsAssetFetchServiceInterface,
DaffDocsAssetFetchService,
} from '@daffodil/documentation';

import { DaffioApiService } from './api.service';
import { provideBrowserDocsPath } from '../../services/docs-path-browser';

describe('DaffioApiService', () => {
let fetchAssetServiceSpy: jasmine.SpyObj<DaffioAssetFetchServiceInterface>;
let fetchAssetServiceSpy: jasmine.SpyObj<DaffDocsAssetFetchServiceInterface>;
let service: DaffioApiService;

beforeEach(() => {
fetchAssetServiceSpy = jasmine.createSpyObj('DaffioAssetFetchService', ['fetch']);
fetchAssetServiceSpy = jasmine.createSpyObj('DaffDocsAssetFetchService', ['fetch']);

TestBed.configureTestingModule({
providers: [
provideBrowserDocsPath(),
{
provide: DaffioAssetFetchService,
provide: DaffDocsAssetFetchService,
useValue: fetchAssetServiceSpy,
},
],
Expand Down
15 changes: 8 additions & 7 deletions apps/daffio/src/app/docs/api/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ import {
} from '@angular/core';
import { Observable } from 'rxjs';

import { DaffioApiServiceInterface } from './api-service.interface';
import {
DaffioAssetFetchService,
DaffioAssetFetchServiceInterface,
} from '../../../core/assets/fetch/service.interface';
import { DAFFIO_DOCS_PATH_TOKEN } from '../../services/docs-path.token';
DaffDocsAssetFetchService,
DaffDocsAssetFetchServiceInterface,
DAFF_DOCS_ASSET_PATH_TOKEN,
} from '@daffodil/documentation';

import { DaffioApiServiceInterface } from './api-service.interface';
import { DaffioApiReference } from '../models/api-reference';

@Injectable({ providedIn: 'root' })
export class DaffioApiService implements DaffioApiServiceInterface {

constructor(
@Inject(DaffioAssetFetchService) private fetchAsset: DaffioAssetFetchServiceInterface,
@Inject(DAFFIO_DOCS_PATH_TOKEN) private docsPath: string,
@Inject(DaffDocsAssetFetchService) private fetchAsset: DaffDocsAssetFetchServiceInterface,
@Inject(DAFF_DOCS_ASSET_PATH_TOKEN) private docsPath: string,
) {}

list(): Observable<DaffioApiReference[]> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ import { RouterTestingModule } from '@angular/router/testing';
import { provideMockStore } from '@ngrx/store/testing';

import { DaffArticleModule } from '@daffodil/design/article';
import { DaffDoc } from '@daffodil/docs-utils';
import { DaffDocsFactory } from '@daffodil/documentation/testing';

import { DaffioDocViewerComponent } from './doc-viewer.component';
import { DaffioDoc } from '../../models/doc';
import { DaffioDocsFactory } from '../../testing/factories/docs.factory';
import { DaffioDocsTableOfContentsModule } from '../table-of-contents/table-of-contents.module';

@Component({
template: `<daffio-doc-viewer [doc]="doc"></daffio-doc-viewer>`,
})
class WrapperComponent {
doc: DaffioDoc;
doc: DaffDoc;
}

describe('DaffioDocViewerComponent', () => {
let fixture: ComponentFixture<WrapperComponent>;
let wrapper: WrapperComponent;
const docFactory = new DaffioDocsFactory();
const docFactory = new DaffDocsFactory();

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import {
import { faBars } from '@fortawesome/free-solid-svg-icons';
import { Store } from '@ngrx/store';

import { DaffDoc } from '@daffodil/docs-utils';

import { ToggleSidebar } from '../../../core/sidebar/actions/sidebar.actions';
import { DAFFIO_DOCS_CONTENT_SIDEBAR_KIND } from '../../../core/sidebar/containers/docs-sidebar/docs-sidebar.component';
import { DaffioDoc } from '../../models/doc';

@Component({
selector: 'daffio-doc-viewer',
Expand All @@ -29,7 +30,7 @@ export class DaffioDocViewerComponent implements OnChanges {
/**
* The doc to render
*/
@Input() doc: DaffioDoc;
@Input() doc: DaffDoc;

sanitizedContent: SafeHtml;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ import {
DaffTreeModule,
daffTransformTree,
} from '@daffodil/design/tree';
import { DaffDocsList } from '@daffodil/docs-utils';

import { DaffioDocList } from '../../models/doc-list';

const visit = (guide: DaffioDocList): DaffTreeData<unknown> => ({
const visit = (guide: DaffDocsList): DaffTreeData<unknown> => ({
id: guide.id,
title: guide.title,
url: guide.path || '',
Expand All @@ -45,13 +44,13 @@ const visit = (guide: DaffioDocList): DaffTreeData<unknown> => ({
],
})
export class DaffioDocsListComponent implements OnInit {
private _list$ = new BehaviorSubject<DaffioDocList>(null);
private _list$ = new BehaviorSubject<DaffDocsList>(null);

/**
* The guide list to render
*/
@Input()
set list(val: DaffioDocList) {
set list(val: DaffDocsList) {
this._list$.next(val);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { By } from '@angular/platform-browser';
import { RouterTestingModule } from '@angular/router/testing';

import { DaffLinkSetModule } from '@daffodil/design/link-set';
import { DaffDoc } from '@daffodil/docs-utils';
import { DaffDocsFactory } from '@daffodil/documentation/testing';

import { DaffioDocsTableOfContentsComponent } from './table-of-contents.component';
import { DaffioDoc } from '../../models/doc';
import { DaffioDocsFactory } from '../../testing/factories/docs.factory';

describe('DaffioDocsTableOfContentsComponent', () => {
let component: DaffioDocsTableOfContentsComponent;
let fixture: ComponentFixture<DaffioDocsTableOfContentsComponent>;
let stubDaffioDoc: DaffioDoc;
let stubDaffioDoc: DaffDoc;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
Expand All @@ -31,7 +31,7 @@ describe('DaffioDocsTableOfContentsComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(DaffioDocsTableOfContentsComponent);
component = fixture.componentInstance;
stubDaffioDoc = new DaffioDocsFactory().create();
stubDaffioDoc = new DaffDocsFactory().create();
component.tableOfContents = stubDaffioDoc.tableOfContents.json;
fixture.detectChanges();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Input,
} from '@angular/core';

import { DaffioDoc } from '../../models/doc';
import { DaffDoc } from '@daffodil/docs-utils';

@Component({
selector: 'daffio-docs-table-of-contents',
Expand All @@ -16,5 +16,5 @@ export class DaffioDocsTableOfContentsComponent {
/**
* The doc to render
*/
@Input() tableOfContents: DaffioDoc['tableOfContents']['json'];
@Input() tableOfContents: DaffDoc['tableOfContents']['json'];
}
4 changes: 2 additions & 2 deletions apps/daffio/src/app/docs/docs.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DaffContainerModule } from '@daffodil/design/container';
import { DaffHeroModule } from '@daffodil/design/hero';
import {
provideDaffDocsDesignExamples,
provideDaffDocsLocation,
provideDaffDocsColorPalettesComponentCustomElement,
} from '@daffodil/docs-components';

import { DaffioDocViewerModule } from './components/doc-viewer/doc-viewer.module';
Expand All @@ -26,7 +26,7 @@ import { DaffioDocsPageComponent } from './pages/docs-page/docs-page.component';
],
providers: [
provideDaffDocsDesignExamples(),
provideDaffDocsLocation('/assets/daffio/docs/'),
provideDaffDocsColorPalettesComponentCustomElement(),
],
})
export class DaffioDocsModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import {
} from '@angular/core';
import { Observable } from 'rxjs';

import {
DaffDoc,
DaffDocsList,
} from '@daffodil/docs-utils';
import { DaffDocsAssetService } from '@daffodil/documentation';

import { DaffioDocsListComponent } from '../../../components/docs-list/docs-list.component';
import { DaffioDoc } from '../../../models/doc';
import { DaffioDocList } from '../../../models/doc-list';
import { DaffioDocsService } from '../../../services/docs.service';


@Component({
Expand All @@ -23,10 +26,10 @@ import { DaffioDocsService } from '../../../services/docs.service';
],
})
export class DaffioDocsGuidesListContainer implements OnInit {
guidesList$: Observable<DaffioDocList>;
guidesList$: Observable<DaffDocsList>;

constructor(
private docService: DaffioDocsService<DaffioDoc, DaffioDocList>,
private docService: DaffDocsAssetService<DaffDoc, DaffDocsList>,
) {}

ngOnInit() {
Expand Down
Loading
Loading