Skip to content

Commit

Permalink
Refactored entities to better locations. Implemented better support f…
Browse files Browse the repository at this point in the history
…or EntityFactory (e.g. test functions and explain functions).
  • Loading branch information
Jaakko Heusala committed Dec 16, 2023
1 parent 167de8b commit 231e766
Show file tree
Hide file tree
Showing 160 changed files with 4,037 additions and 2,938 deletions.
4 changes: 2 additions & 2 deletions components/HyperComponentCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import { reduce } from "../functions/reduce";
import { uniq } from "../functions/uniq";
import { LogService } from "../LogService";
import { ComponentDTO } from "../dto/ComponentDTO";
import { ComponentDTO } from "../entities/component/ComponentDTO";
import { ComponentFactory } from "../services/ComponentFactory";
import { ComponentFactoryService } from "../services/ComponentFactoryService";
import { ComponentEntity } from "../entities/ComponentEntity";
import { ComponentEntity } from "../entities/component/ComponentEntity";
import { ComponentType } from "../entities/types/ComponentType";
import { registerActionButtonComponent } from "./actionButton/ActionButtonComponent";
import { registerArticleComponent } from "./article/ArticleComponent";
Expand Down
4 changes: 2 additions & 2 deletions components/actionButton/ActionButtonComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const ACTION_BUTTON_COMPONENT_NAME: string = 'ActionButtonComponent';
Expand Down
4 changes: 2 additions & 2 deletions components/actionButton/ActionButtonEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { ReadonlyJsonAny } from "../../Json";
import { isString } from "../../types/String";
import { ComponentEntity } from "../../entities/ComponentEntity";
import { createActionDTO, ActionDTO } from "../../dto/ActionDTO";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { createActionDTO, ActionDTO } from "../../entities/action/ActionDTO";
import { ACTION_BUTTON_COMPONENT_NAME } from "./ActionButtonComponent";

export class ActionButtonEntity extends ComponentEntity {
Expand Down
2 changes: 1 addition & 1 deletion components/article/ArticleComponent.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HyperComponent } from "../../dto/types/HyperComponent";
import { HyperComponent } from "../../entities/types/HyperComponent";
import {ARTICLE_COMPONENT_NAME, ArticleComponent, createArticleComponent} from "./ArticleComponent";

describe('createArticleComponent', () => {
Expand Down
4 changes: 2 additions & 2 deletions components/article/ArticleComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const ARTICLE_COMPONENT_NAME: string = 'ArticleComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/article/ArticleEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { ARTICLE_COMPONENT_NAME } from "./ArticleComponent";

export class ArticleEntity extends ComponentEntity {
Expand Down
2 changes: 1 addition & 1 deletion components/button/ButtonComponent.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HyperComponent } from "../../dto/types/HyperComponent";
import { HyperComponent } from "../../entities/types/HyperComponent";
import {BUTTON_COMPONENT_NAME, ButtonComponent, createButtonComponent} from "./ButtonComponent";

describe('createButtonComponent', () => {
Expand Down
4 changes: 2 additions & 2 deletions components/button/ButtonComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const BUTTON_COMPONENT_NAME: string = 'ButtonComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/button/ButtonEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { BUTTON_COMPONENT_NAME } from "./ButtonComponent";

export class ButtonEntity extends ComponentEntity {
Expand Down
4 changes: 2 additions & 2 deletions components/div/DivComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const DIV_COMPONENT_NAME: string = 'DivComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/div/DivEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { DIV_COMPONENT_NAME } from "./DivComponent";

export class DivEntity extends ComponentEntity {
Expand Down
4 changes: 2 additions & 2 deletions components/form/FormComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const FORM_COMPONENT_NAME: string = 'FormComponent';
Expand Down
4 changes: 2 additions & 2 deletions components/form/FormEntity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentContent } from "../../dto/ComponentDTO";
import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentContent } from "../../entities/component/ComponentDTO";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { FORM_COMPONENT_NAME } from "./FormComponent";

export class FormEntity extends ComponentEntity {
Expand Down
4 changes: 2 additions & 2 deletions components/heading/HeadingComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const HEADING_COMPONENT_NAME: string = 'HeadingComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/heading/HeadingEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { HEADING_COMPONENT_NAME } from "./HeadingComponent";

export class HeadingEntity extends ComponentEntity {
Expand Down
4 changes: 2 additions & 2 deletions components/image/ImageComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const IMAGE_COMPONENT_NAME: string = 'ImageComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/image/ImageEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { IMAGE_COMPONENT_NAME } from "./ImageComponent";

const IMAGE_SOURCE_META_KEY : string = "source";
Expand Down
2 changes: 1 addition & 1 deletion components/linkButton/LinkButtonComponent.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HyperComponent } from "../../dto/types/HyperComponent";
import { HyperComponent } from "../../entities/types/HyperComponent";
import {createLinkButtonComponent, LinkButtonComponent, LINK_BUTTON_COMPONENT_NAME} from "./LinkButtonComponent";

describe('createLinkButtonComponent', () => {
Expand Down
10 changes: 5 additions & 5 deletions components/linkButton/LinkButtonComponent.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentDTO, createComponentDTO } from "../../dto/ComponentDTO";
import { BorderStyle } from "../../dto/types/BorderStyle";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { BorderEntity } from "../../entities/BorderEntity";
import { StyleEntity } from "../../entities/StyleEntity";
import { ComponentDTO, createComponentDTO } from "../../entities/component/ComponentDTO";
import { BorderStyle } from "../../entities/types/BorderStyle";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { BorderEntity } from "../../entities/border/BorderEntity";
import { StyleEntity } from "../../entities/style/StyleEntity";
import { ComponentFactory } from "../../services/ComponentFactory";

export const LINK_BUTTON_COMPONENT_NAME: string = 'LinkButtonComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/linkButton/LinkButtonEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { LINK_BUTTON_COMPONENT_NAME } from "./LinkButtonComponent";

export class LinkButtonEntity extends ComponentEntity {
Expand Down
4 changes: 2 additions & 2 deletions components/paragraph/ParagraphComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const PARAGRAPH_COMPONENT_NAME: string = 'ParagraphComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/paragraph/ParagraphEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { PARAGRAPH_COMPONENT_NAME } from "./ParagraphComponent";

export class ParagraphEntity extends ComponentEntity {
Expand Down
4 changes: 2 additions & 2 deletions components/span/SpanComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const SPAN_COMPONENT_NAME: string = 'SpanComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/span/SpanEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { SPAN_COMPONENT_NAME } from "./SpanComponent";

export class SpanEntity extends ComponentEntity {
Expand Down
4 changes: 2 additions & 2 deletions components/subTitle/SubTitleComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const SUB_TITLE_COMPONENT_NAME: string = 'SubTitleComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/subTitle/SubTitleEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { SUB_TITLE_COMPONENT_NAME } from "./SubTitleComponent";

export class SubTitleEntity extends ComponentEntity {
Expand Down
4 changes: 2 additions & 2 deletions components/table/TableComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const TABLE_COMPONENT_NAME: string = 'TableComponent';
Expand Down
4 changes: 2 additions & 2 deletions components/table/TableEntity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentContent } from "../../dto/ComponentDTO";
import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentContent } from "../../entities/component/ComponentDTO";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { TABLE_COMPONENT_NAME } from "./TableComponent";
import { TableRowEntity } from "./row/TableRowEntity";

Expand Down
4 changes: 2 additions & 2 deletions components/table/column/TableColumnComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../../dto/ComponentDTO";
import { HyperComponent } from "../../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../../entities/component/ComponentDTO";
import { HyperComponent } from "../../../entities/types/HyperComponent";
import { ComponentFactory } from "../../../services/ComponentFactory";

export const TABLE_COLUMN_COMPONENT_NAME: string = 'TableColumnComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/table/column/TableColumnEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity, ComponentEntityContent } from "../../../entities/ComponentEntity";
import { ComponentEntity, ComponentEntityContent } from "../../../entities/component/ComponentEntity";
import { TABLE_COLUMN_COMPONENT_NAME } from "./TableColumnComponent";

export class TableColumnEntity extends ComponentEntity {
Expand Down
4 changes: 2 additions & 2 deletions components/table/row/TableRowComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../../dto/ComponentDTO";
import { HyperComponent } from "../../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../../entities/component/ComponentDTO";
import { HyperComponent } from "../../../entities/types/HyperComponent";
import { ComponentFactory } from "../../../services/ComponentFactory";

export const TABLE_ROW_COMPONENT_NAME: string = 'TableRowComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/table/row/TableRowEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity, ComponentEntityContent } from "../../../entities/ComponentEntity";
import { ComponentEntity, ComponentEntityContent } from "../../../entities/component/ComponentEntity";
import { TableColumnEntity } from "../column/TableColumnEntity";
import { TABLE_ROW_COMPONENT_NAME } from "./TableRowComponent";

Expand Down
2 changes: 1 addition & 1 deletion components/title/TitleComponent.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HyperComponent } from "../../dto/types/HyperComponent";
import { HyperComponent } from "../../entities/types/HyperComponent";
import {createTitleComponent, TITLE_COMPONENT_NAME, TitleComponent} from "./TitleComponent";

describe('createTitleTextComponent', () => {
Expand Down
4 changes: 2 additions & 2 deletions components/title/TitleComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { createComponentDTO, ComponentDTO } from "../../dto/ComponentDTO";
import { HyperComponent } from "../../dto/types/HyperComponent";
import { createComponentDTO, ComponentDTO } from "../../entities/component/ComponentDTO";
import { HyperComponent } from "../../entities/types/HyperComponent";
import { ComponentFactory } from "../../services/ComponentFactory";

export const TITLE_COMPONENT_NAME: string = 'TitleComponent';
Expand Down
2 changes: 1 addition & 1 deletion components/title/TitleEntity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2023. Sendanor <info@sendanor.fi>. All rights reserved.

import { ComponentEntity } from "../../entities/ComponentEntity";
import { ComponentEntity } from "../../entities/component/ComponentEntity";
import { TITLE_COMPONENT_NAME } from "./TitleComponent";

export class TitleEntity extends ComponentEntity {
Expand Down
59 changes: 0 additions & 59 deletions dto/ColorDTO.ts

This file was deleted.

Loading

0 comments on commit 231e766

Please sign in to comment.