From 97cc70d749dbca3251e3efc18920ada8b4cbdfee Mon Sep 17 00:00:00 2001 From: Vivin Krishna <123377523+vivinkrishna-ni@users.noreply.github.com> Date: Thu, 7 Sep 2023 01:47:05 +0530 Subject: [PATCH] Revamp rich text components folder structure (#1472) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request ## ๐Ÿคจ Rationale Reorganize the folder structure of the `nimble-rich-text-editor` and `nimble-rich-text-viewer` to share the common functionalities between components. Part of https://github.com/ni/nimble/issues/1447 ## ๐Ÿ‘ฉโ€๐Ÿ’ป Implementation Revamped folder structure in nimble-components: ``` /rich-text /editor editor component files... /viewer viewer component files... /specs README.md (common spec file for both editor and viewer) ``` Revamped folder structure in nimble-angular: ``` /rich-text /editor editor component files... /viewer viewer component files... ``` Related discussion: https://github.com/ni/nimble/pull/1424#discussion_r1290998178 ## ๐Ÿงช Testing - Manually tested the components in the local storybook build. ## โœ… Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --- .../example-client-app/src/app/app.module.ts | 4 ++-- .../src/app/customapp/customapp.component.ts | 2 +- .../rich-text-editor/ng-package.json | 6 ------ .../rich-text-viewer/ng-package.json | 6 ------ .../editor}/ng-package.json | 0 .../nimble-rich-text-editor.directive.ts | 2 +- .../editor}/nimble-rich-text-editor.module.ts | 2 +- .../editor}/public-api.ts | 0 .../rich-text/editor/testing/ng-package.json | 6 ++++++ .../editor}/testing/public-api.ts | 0 .../testing/rich-text-editor.pageobject.ts | 4 ++-- .../nimble-rich-text-editor.directive.spec.ts | 0 .../viewer}/ng-package.json | 0 .../nimble-rich-text-viewer.directive.ts | 2 +- .../viewer}/nimble-rich-text-viewer.module.ts | 2 +- .../viewer}/public-api.ts | 0 .../rich-text/viewer/testing/ng-package.json | 6 ++++++ .../viewer}/testing/public-api.ts | 0 .../testing/rich-text-viewer.pageobject.ts | 2 +- .../nimble-rich-text-viewer.directive.spec.ts | 0 ...-3a7f08ef-dd7e-4bae-8b30-937d3830d563.json | 7 +++++++ ...-c9aef77f-1a41-4240-b114-67fc1d5c6c2f.json | 7 +++++++ .../nimble-components/src/all-components.ts | 4 ++-- .../src/rich-text-viewer/specs/README.md | 3 --- .../editor}/index.ts | 4 ++-- .../editor}/styles.ts | 4 ++-- .../editor}/template.ts | 18 +++++++++--------- .../testing/rich-text-editor.pageobject.ts | 4 ++-- .../editor}/testing/types.ts | 0 .../tests/rich-text-editor-labels.spec.ts | 10 +++++----- .../tests/rich-text-editor-matrix.stories.ts | 14 +++++++------- .../editor}/tests/rich-text-editor.spec.ts | 12 ++++++------ .../editor}/tests/rich-text-editor.stories.ts | 8 ++++---- .../editor}/tests/types.spec.ts | 0 .../editor}/types.ts | 0 .../specs/README.md | 0 .../specs/spec-images/button-state.png | Bin .../specs/spec-images/editor-sample.png | Bin .../specs/spec-images/viewer-sample.png | Bin .../viewer}/index.ts | 0 .../viewer}/styles.ts | 2 +- .../viewer}/template.ts | 0 .../testing/rich-text-viewer.pageobject.ts | 0 .../tests/rich-text-viewer-matrix.stories.ts | 12 ++++++------ .../viewer}/tests/rich-text-viewer.spec.ts | 6 +++--- .../viewer}/tests/rich-text-viewer.stories.ts | 4 ++-- 46 files changed, 87 insertions(+), 76 deletions(-) delete mode 100644 angular-workspace/projects/ni/nimble-angular/rich-text-editor/ng-package.json delete mode 100644 angular-workspace/projects/ni/nimble-angular/rich-text-viewer/ng-package.json rename angular-workspace/projects/ni/nimble-angular/{rich-text-editor/testing => rich-text/editor}/ng-package.json (100%) rename angular-workspace/projects/ni/nimble-angular/{rich-text-editor => rich-text/editor}/nimble-rich-text-editor.directive.ts (99%) rename angular-workspace/projects/ni/nimble-angular/{rich-text-editor => rich-text/editor}/nimble-rich-text-editor.module.ts (86%) rename angular-workspace/projects/ni/nimble-angular/{rich-text-editor => rich-text/editor}/public-api.ts (100%) create mode 100644 angular-workspace/projects/ni/nimble-angular/rich-text/editor/testing/ng-package.json rename angular-workspace/projects/ni/nimble-angular/{rich-text-editor => rich-text/editor}/testing/public-api.ts (100%) rename angular-workspace/projects/ni/nimble-angular/{rich-text-editor => rich-text/editor}/testing/rich-text-editor.pageobject.ts (66%) rename angular-workspace/projects/ni/nimble-angular/{rich-text-editor => rich-text/editor}/tests/nimble-rich-text-editor.directive.spec.ts (100%) rename angular-workspace/projects/ni/nimble-angular/{rich-text-viewer/testing => rich-text/viewer}/ng-package.json (100%) rename angular-workspace/projects/ni/nimble-angular/{rich-text-viewer => rich-text/viewer}/nimble-rich-text-viewer.directive.ts (96%) rename angular-workspace/projects/ni/nimble-angular/{rich-text-viewer => rich-text/viewer}/nimble-rich-text-viewer.module.ts (86%) rename angular-workspace/projects/ni/nimble-angular/{rich-text-viewer => rich-text/viewer}/public-api.ts (100%) create mode 100644 angular-workspace/projects/ni/nimble-angular/rich-text/viewer/testing/ng-package.json rename angular-workspace/projects/ni/nimble-angular/{rich-text-viewer => rich-text/viewer}/testing/public-api.ts (100%) rename angular-workspace/projects/ni/nimble-angular/{rich-text-viewer => rich-text/viewer}/testing/rich-text-viewer.pageobject.ts (61%) rename angular-workspace/projects/ni/nimble-angular/{rich-text-viewer => rich-text/viewer}/tests/nimble-rich-text-viewer.directive.spec.ts (100%) create mode 100644 change/@ni-nimble-angular-3a7f08ef-dd7e-4bae-8b30-937d3830d563.json create mode 100644 change/@ni-nimble-components-c9aef77f-1a41-4240-b114-67fc1d5c6c2f.json delete mode 100644 packages/nimble-components/src/rich-text-viewer/specs/README.md rename packages/nimble-components/src/{rich-text-editor => rich-text/editor}/index.ts (99%) rename packages/nimble-components/src/{rich-text-editor => rich-text/editor}/styles.ts (98%) rename packages/nimble-components/src/{rich-text-editor => rich-text/editor}/template.ts (89%) rename packages/nimble-components/src/{rich-text-editor => rich-text/editor}/testing/rich-text-editor.pageobject.ts (98%) rename packages/nimble-components/src/{rich-text-editor => rich-text/editor}/testing/types.ts (100%) rename packages/nimble-components/src/{rich-text-editor => rich-text/editor}/tests/rich-text-editor-labels.spec.ts (89%) rename packages/nimble-components/src/{rich-text-editor => rich-text/editor}/tests/rich-text-editor-matrix.stories.ts (94%) rename packages/nimble-components/src/{rich-text-editor => rich-text/editor}/tests/rich-text-editor.spec.ts (99%) rename packages/nimble-components/src/{rich-text-editor => rich-text/editor}/tests/rich-text-editor.stories.ts (96%) rename packages/nimble-components/src/{rich-text-editor => rich-text/editor}/tests/types.spec.ts (100%) rename packages/nimble-components/src/{rich-text-editor => rich-text/editor}/types.ts (100%) rename packages/nimble-components/src/{rich-text-editor => rich-text}/specs/README.md (100%) rename packages/nimble-components/src/{rich-text-editor => rich-text}/specs/spec-images/button-state.png (100%) rename packages/nimble-components/src/{rich-text-editor => rich-text}/specs/spec-images/editor-sample.png (100%) rename packages/nimble-components/src/{rich-text-editor => rich-text}/specs/spec-images/viewer-sample.png (100%) rename packages/nimble-components/src/{rich-text-viewer => rich-text/viewer}/index.ts (100%) rename packages/nimble-components/src/{rich-text-viewer => rich-text/viewer}/styles.ts (96%) rename packages/nimble-components/src/{rich-text-viewer => rich-text/viewer}/template.ts (100%) rename packages/nimble-components/src/{rich-text-viewer => rich-text/viewer}/testing/rich-text-viewer.pageobject.ts (100%) rename packages/nimble-components/src/{rich-text-viewer => rich-text/viewer}/tests/rich-text-viewer-matrix.stories.ts (91%) rename packages/nimble-components/src/{rich-text-viewer => rich-text/viewer}/tests/rich-text-viewer.spec.ts (99%) rename packages/nimble-components/src/{rich-text-viewer => rich-text/viewer}/tests/rich-text-viewer.stories.ts (92%) diff --git a/angular-workspace/projects/example-client-app/src/app/app.module.ts b/angular-workspace/projects/example-client-app/src/app/app.module.ts index a90069d4ec..ef38b840f1 100644 --- a/angular-workspace/projects/example-client-app/src/app/app.module.ts +++ b/angular-workspace/projects/example-client-app/src/app/app.module.ts @@ -23,8 +23,8 @@ import { NimbleTableColumnDateTextModule } from '@ni/nimble-angular/table-column import { NimbleTableColumnEnumTextModule } from '@ni/nimble-angular/table-column/enum-text'; import { NimbleTableColumnIconModule } from '@ni/nimble-angular/table-column/icon'; import { NimbleTableColumnNumberTextModule } from '@ni/nimble-angular/table-column/number-text'; -import { NimbleRichTextViewerModule } from '@ni/nimble-angular/rich-text-viewer'; -import { NimbleRichTextEditorModule } from '@ni/nimble-angular/rich-text-editor'; +import { NimbleRichTextViewerModule } from '@ni/nimble-angular/rich-text/viewer'; +import { NimbleRichTextEditorModule } from '@ni/nimble-angular/rich-text/editor'; import { AppComponent } from './app.component'; import { CustomAppComponent } from './customapp/customapp.component'; import { HeaderComponent } from './header/header.component'; diff --git a/angular-workspace/projects/example-client-app/src/app/customapp/customapp.component.ts b/angular-workspace/projects/example-client-app/src/app/customapp/customapp.component.ts index 21c3a5c6a0..62455a4309 100644 --- a/angular-workspace/projects/example-client-app/src/app/customapp/customapp.component.ts +++ b/angular-workspace/projects/example-client-app/src/app/customapp/customapp.component.ts @@ -3,7 +3,7 @@ import { Component, Inject, ViewChild } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { DrawerLocation, MenuItem, NimbleDialogDirective, NimbleDrawerDirective, OptionNotFound, OPTION_NOT_FOUND, UserDismissed } from '@ni/nimble-angular'; import type { TableRecord } from '@ni/nimble-angular/table'; -import { NimbleRichTextEditorDirective } from '@ni/nimble-angular/rich-text-editor'; +import { NimbleRichTextEditorDirective } from '@ni/nimble-angular/rich-text/editor'; import { BehaviorSubject, Observable } from 'rxjs'; interface ComboboxItem { diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/ng-package.json b/angular-workspace/projects/ni/nimble-angular/rich-text-editor/ng-package.json deleted file mode 100644 index 7945e60e70..0000000000 --- a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/ng-package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "../../../../../node_modules/ng-packagr/ng-package.schema.json", - "lib": { - "entryFile": "public-api.ts" - } -} \ No newline at end of file diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/ng-package.json b/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/ng-package.json deleted file mode 100644 index 7945e60e70..0000000000 --- a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/ng-package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "../../../../../node_modules/ng-packagr/ng-package.schema.json", - "lib": { - "entryFile": "public-api.ts" - } -} \ No newline at end of file diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/testing/ng-package.json b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/ng-package.json similarity index 100% rename from angular-workspace/projects/ni/nimble-angular/rich-text-editor/testing/ng-package.json rename to angular-workspace/projects/ni/nimble-angular/rich-text/editor/ng-package.json diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/nimble-rich-text-editor.directive.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/nimble-rich-text-editor.directive.ts similarity index 99% rename from angular-workspace/projects/ni/nimble-angular/rich-text-editor/nimble-rich-text-editor.directive.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/editor/nimble-rich-text-editor.directive.ts index abd5a2a0a8..865b5f0439 100644 --- a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/nimble-rich-text-editor.directive.ts +++ b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/nimble-rich-text-editor.directive.ts @@ -1,5 +1,5 @@ import { Directive, ElementRef, EventEmitter, HostListener, Input, Output, Renderer2 } from '@angular/core'; -import type { RichTextEditor } from '@ni/nimble-components/dist/esm/rich-text-editor'; +import type { RichTextEditor } from '@ni/nimble-components/dist/esm/rich-text/editor'; import { BooleanValueOrAttribute, toBooleanProperty } from '@ni/nimble-angular/internal-utilities'; export type { RichTextEditor }; diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/nimble-rich-text-editor.module.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/nimble-rich-text-editor.module.ts similarity index 86% rename from angular-workspace/projects/ni/nimble-angular/rich-text-editor/nimble-rich-text-editor.module.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/editor/nimble-rich-text-editor.module.ts index 0c6c57ce98..4164c9f09b 100644 --- a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/nimble-rich-text-editor.module.ts +++ b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/nimble-rich-text-editor.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { NimbleRichTextEditorDirective } from './nimble-rich-text-editor.directive'; -import '@ni/nimble-components/dist/esm/rich-text-editor'; +import '@ni/nimble-components/dist/esm/rich-text/editor'; @NgModule({ declarations: [NimbleRichTextEditorDirective], diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/public-api.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/public-api.ts similarity index 100% rename from angular-workspace/projects/ni/nimble-angular/rich-text-editor/public-api.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/editor/public-api.ts diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text/editor/testing/ng-package.json b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/testing/ng-package.json new file mode 100644 index 0000000000..55f020bdfb --- /dev/null +++ b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/testing/ng-package.json @@ -0,0 +1,6 @@ +{ + "$schema": "../../../../../../../node_modules/ng-packagr/ng-package.schema.json", + "lib": { + "entryFile": "public-api.ts" + } +} \ No newline at end of file diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/testing/public-api.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/testing/public-api.ts similarity index 100% rename from angular-workspace/projects/ni/nimble-angular/rich-text-editor/testing/public-api.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/editor/testing/public-api.ts diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/testing/rich-text-editor.pageobject.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/testing/rich-text-editor.pageobject.ts similarity index 66% rename from angular-workspace/projects/ni/nimble-angular/rich-text-editor/testing/rich-text-editor.pageobject.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/editor/testing/rich-text-editor.pageobject.ts index 075882fc1b..3047e7e51a 100644 --- a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/testing/rich-text-editor.pageobject.ts +++ b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/testing/rich-text-editor.pageobject.ts @@ -1,5 +1,5 @@ -import { RichTextEditorPageObject } from '@ni/nimble-components/dist/esm/rich-text-editor/testing/rich-text-editor.pageobject'; -import type { ToolbarButton } from '@ni/nimble-components/dist/esm/rich-text-editor/testing/types'; +import { RichTextEditorPageObject } from '@ni/nimble-components/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject'; +import type { ToolbarButton } from '@ni/nimble-components/dist/esm/rich-text/editor/testing/types'; export { RichTextEditorPageObject }; export type { ToolbarButton }; \ No newline at end of file diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-editor/tests/nimble-rich-text-editor.directive.spec.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/editor/tests/nimble-rich-text-editor.directive.spec.ts similarity index 100% rename from angular-workspace/projects/ni/nimble-angular/rich-text-editor/tests/nimble-rich-text-editor.directive.spec.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/editor/tests/nimble-rich-text-editor.directive.spec.ts diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/testing/ng-package.json b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/ng-package.json similarity index 100% rename from angular-workspace/projects/ni/nimble-angular/rich-text-viewer/testing/ng-package.json rename to angular-workspace/projects/ni/nimble-angular/rich-text/viewer/ng-package.json diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/nimble-rich-text-viewer.directive.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/nimble-rich-text-viewer.directive.ts similarity index 96% rename from angular-workspace/projects/ni/nimble-angular/rich-text-viewer/nimble-rich-text-viewer.directive.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/viewer/nimble-rich-text-viewer.directive.ts index 1440b0d0c0..7609f35d8d 100644 --- a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/nimble-rich-text-viewer.directive.ts +++ b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/nimble-rich-text-viewer.directive.ts @@ -1,5 +1,5 @@ import { Directive, ElementRef, Input, Renderer2 } from '@angular/core'; -import type { RichTextViewer } from '@ni/nimble-components/dist/esm/rich-text-viewer'; +import type { RichTextViewer } from '@ni/nimble-components/dist/esm/rich-text/viewer'; export type { RichTextViewer }; diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/nimble-rich-text-viewer.module.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/nimble-rich-text-viewer.module.ts similarity index 86% rename from angular-workspace/projects/ni/nimble-angular/rich-text-viewer/nimble-rich-text-viewer.module.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/viewer/nimble-rich-text-viewer.module.ts index c94455a3a8..d3bc69cf06 100644 --- a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/nimble-rich-text-viewer.module.ts +++ b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/nimble-rich-text-viewer.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { NimbleRichTextViewerDirective } from './nimble-rich-text-viewer.directive'; -import '@ni/nimble-components/dist/esm/rich-text-viewer'; +import '@ni/nimble-components/dist/esm/rich-text/viewer'; @NgModule({ declarations: [NimbleRichTextViewerDirective], diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/public-api.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/public-api.ts similarity index 100% rename from angular-workspace/projects/ni/nimble-angular/rich-text-viewer/public-api.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/viewer/public-api.ts diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/testing/ng-package.json b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/testing/ng-package.json new file mode 100644 index 0000000000..55f020bdfb --- /dev/null +++ b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/testing/ng-package.json @@ -0,0 +1,6 @@ +{ + "$schema": "../../../../../../../node_modules/ng-packagr/ng-package.schema.json", + "lib": { + "entryFile": "public-api.ts" + } +} \ No newline at end of file diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/testing/public-api.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/testing/public-api.ts similarity index 100% rename from angular-workspace/projects/ni/nimble-angular/rich-text-viewer/testing/public-api.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/viewer/testing/public-api.ts diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/testing/rich-text-viewer.pageobject.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/testing/rich-text-viewer.pageobject.ts similarity index 61% rename from angular-workspace/projects/ni/nimble-angular/rich-text-viewer/testing/rich-text-viewer.pageobject.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/viewer/testing/rich-text-viewer.pageobject.ts index 0deb789be0..84b9fedbbb 100644 --- a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/testing/rich-text-viewer.pageobject.ts +++ b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/testing/rich-text-viewer.pageobject.ts @@ -1,3 +1,3 @@ -import { RichTextViewerPageObject } from '@ni/nimble-components/dist/esm/rich-text-viewer/testing/rich-text-viewer.pageobject'; +import { RichTextViewerPageObject } from '@ni/nimble-components/dist/esm/rich-text/viewer/testing/rich-text-viewer.pageobject'; export { RichTextViewerPageObject }; \ No newline at end of file diff --git a/angular-workspace/projects/ni/nimble-angular/rich-text-viewer/tests/nimble-rich-text-viewer.directive.spec.ts b/angular-workspace/projects/ni/nimble-angular/rich-text/viewer/tests/nimble-rich-text-viewer.directive.spec.ts similarity index 100% rename from angular-workspace/projects/ni/nimble-angular/rich-text-viewer/tests/nimble-rich-text-viewer.directive.spec.ts rename to angular-workspace/projects/ni/nimble-angular/rich-text/viewer/tests/nimble-rich-text-viewer.directive.spec.ts diff --git a/change/@ni-nimble-angular-3a7f08ef-dd7e-4bae-8b30-937d3830d563.json b/change/@ni-nimble-angular-3a7f08ef-dd7e-4bae-8b30-937d3830d563.json new file mode 100644 index 0000000000..5681985229 --- /dev/null +++ b/change/@ni-nimble-angular-3a7f08ef-dd7e-4bae-8b30-937d3830d563.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Revamp folder structure for rich text components", + "packageName": "@ni/nimble-angular", + "email": "123377523+vivinkrishna-ni@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/change/@ni-nimble-components-c9aef77f-1a41-4240-b114-67fc1d5c6c2f.json b/change/@ni-nimble-components-c9aef77f-1a41-4240-b114-67fc1d5c6c2f.json new file mode 100644 index 0000000000..a6bf4a46e8 --- /dev/null +++ b/change/@ni-nimble-components-c9aef77f-1a41-4240-b114-67fc1d5c6c2f.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Revamp folder structure for rich text components", + "packageName": "@ni/nimble-components", + "email": "123377523+vivinkrishna-ni@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/packages/nimble-components/src/all-components.ts b/packages/nimble-components/src/all-components.ts index 4ed75dd127..db13e259ad 100644 --- a/packages/nimble-components/src/all-components.ts +++ b/packages/nimble-components/src/all-components.ts @@ -33,8 +33,8 @@ import './menu-item'; import './number-field'; import './radio'; import './radio-group'; -import './rich-text-editor'; -import './rich-text-viewer'; +import './rich-text/editor'; +import './rich-text/viewer'; import './select'; import './spinner'; import './switch'; diff --git a/packages/nimble-components/src/rich-text-viewer/specs/README.md b/packages/nimble-components/src/rich-text-viewer/specs/README.md deleted file mode 100644 index 2af2ffa797..0000000000 --- a/packages/nimble-components/src/rich-text-viewer/specs/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Nimble Rich Text Viewer - -The spec of this component is added as part of the [`/rich-text-editor/specs/README.md`](../../rich-text-editor/specs/README.md) diff --git a/packages/nimble-components/src/rich-text-editor/index.ts b/packages/nimble-components/src/rich-text/editor/index.ts similarity index 99% rename from packages/nimble-components/src/rich-text-editor/index.ts rename to packages/nimble-components/src/rich-text/editor/index.ts index cad41fbc04..6a5b0cad63 100644 --- a/packages/nimble-components/src/rich-text-editor/index.ts +++ b/packages/nimble-components/src/rich-text/editor/index.ts @@ -35,9 +35,9 @@ import type { PlaceholderOptions } from '@tiptap/extension-placeholder'; import Text from '@tiptap/extension-text'; import { template } from './template'; import { styles } from './styles'; -import type { ToggleButton } from '../toggle-button'; +import type { ToggleButton } from '../../toggle-button'; import { TipTapNodeName } from './types'; -import type { ErrorPattern } from '../patterns/error/types'; +import type { ErrorPattern } from '../../patterns/error/types'; declare global { interface HTMLElementTagNameMap { diff --git a/packages/nimble-components/src/rich-text-editor/styles.ts b/packages/nimble-components/src/rich-text/editor/styles.ts similarity index 98% rename from packages/nimble-components/src/rich-text-editor/styles.ts rename to packages/nimble-components/src/rich-text/editor/styles.ts index c9d818ce64..2af9ce8127 100644 --- a/packages/nimble-components/src/rich-text-editor/styles.ts +++ b/packages/nimble-components/src/rich-text/editor/styles.ts @@ -13,8 +13,8 @@ import { iconSize, smallDelay, standardPadding -} from '../theme-provider/design-tokens'; -import { styles as errorStyles } from '../patterns/error/styles'; +} from '../../theme-provider/design-tokens'; +import { styles as errorStyles } from '../../patterns/error/styles'; export const styles = css` ${display('inline-flex')} diff --git a/packages/nimble-components/src/rich-text-editor/template.ts b/packages/nimble-components/src/rich-text/editor/template.ts similarity index 89% rename from packages/nimble-components/src/rich-text-editor/template.ts rename to packages/nimble-components/src/rich-text/editor/template.ts index c9457a24fc..9d94d21edb 100644 --- a/packages/nimble-components/src/rich-text-editor/template.ts +++ b/packages/nimble-components/src/rich-text/editor/template.ts @@ -1,19 +1,19 @@ import { html, ref } from '@microsoft/fast-element'; import type { RichTextEditor } from '.'; -import { toolbarTag } from '../toolbar'; -import { toggleButtonTag } from '../toggle-button'; -import { iconBoldBTag } from '../icons/bold-b'; -import { iconItalicITag } from '../icons/italic-i'; -import { iconListTag } from '../icons/list'; -import { iconNumberListTag } from '../icons/number-list'; +import { toolbarTag } from '../../toolbar'; +import { toggleButtonTag } from '../../toggle-button'; +import { iconBoldBTag } from '../../icons/bold-b'; +import { iconItalicITag } from '../../icons/italic-i'; +import { iconListTag } from '../../icons/list'; +import { iconNumberListTag } from '../../icons/number-list'; import { richTextToggleBoldLabel, richTextToggleItalicsLabel, richTextToggleBulletedListLabel, richTextToggleNumberedListLabel -} from '../label-provider/rich-text/label-tokens'; -import { errorTextTemplate } from '../patterns/error/template'; -import { iconExclamationMarkTag } from '../icons/exclamation-mark'; +} from '../../label-provider/rich-text/label-tokens'; +import { errorTextTemplate } from '../../patterns/error/template'; +import { iconExclamationMarkTag } from '../../icons/exclamation-mark'; // prettier-ignore export const template = html` diff --git a/packages/nimble-components/src/rich-text-editor/testing/rich-text-editor.pageobject.ts b/packages/nimble-components/src/rich-text/editor/testing/rich-text-editor.pageobject.ts similarity index 98% rename from packages/nimble-components/src/rich-text-editor/testing/rich-text-editor.pageobject.ts rename to packages/nimble-components/src/rich-text/editor/testing/rich-text-editor.pageobject.ts index 48b036a388..aa639921b6 100644 --- a/packages/nimble-components/src/rich-text-editor/testing/rich-text-editor.pageobject.ts +++ b/packages/nimble-components/src/rich-text/editor/testing/rich-text-editor.pageobject.ts @@ -1,7 +1,7 @@ import { keySpace, keyEnter, keyTab } from '@microsoft/fast-web-utilities'; import type { RichTextEditor } from '..'; -import { waitForUpdatesAsync } from '../../testing/async-helpers'; -import type { ToggleButton } from '../../toggle-button'; +import { waitForUpdatesAsync } from '../../../testing/async-helpers'; +import type { ToggleButton } from '../../../toggle-button'; import type { ToolbarButton } from './types'; /** diff --git a/packages/nimble-components/src/rich-text-editor/testing/types.ts b/packages/nimble-components/src/rich-text/editor/testing/types.ts similarity index 100% rename from packages/nimble-components/src/rich-text-editor/testing/types.ts rename to packages/nimble-components/src/rich-text/editor/testing/types.ts diff --git a/packages/nimble-components/src/rich-text-editor/tests/rich-text-editor-labels.spec.ts b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor-labels.spec.ts similarity index 89% rename from packages/nimble-components/src/rich-text-editor/tests/rich-text-editor-labels.spec.ts rename to packages/nimble-components/src/rich-text/editor/tests/rich-text-editor-labels.spec.ts index 8bcd734c6b..78178af003 100644 --- a/packages/nimble-components/src/rich-text-editor/tests/rich-text-editor-labels.spec.ts +++ b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor-labels.spec.ts @@ -1,15 +1,15 @@ import { html } from '@microsoft/fast-element'; import { richTextEditorTag, type RichTextEditor } from '..'; -import { type Fixture, fixture } from '../../utilities/tests/fixture'; -import { themeProviderTag, type ThemeProvider } from '../../theme-provider'; +import { type Fixture, fixture } from '../../../utilities/tests/fixture'; +import { themeProviderTag, type ThemeProvider } from '../../../theme-provider'; import { LabelProviderRichText, labelProviderRichTextTag -} from '../../label-provider/rich-text'; +} from '../../../label-provider/rich-text'; import { RichTextEditorPageObject } from '../testing/rich-text-editor.pageobject'; import { LabelProvider, ToolbarButton } from '../testing/types'; -import { getSpecTypeByNamedList } from '../../utilities/tests/parameterized'; -import { waitForUpdatesAsync } from '../../testing/async-helpers'; +import { getSpecTypeByNamedList } from '../../../utilities/tests/parameterized'; +import { waitForUpdatesAsync } from '../../../testing/async-helpers'; async function setup(): Promise> { return fixture( diff --git a/packages/nimble-components/src/rich-text-editor/tests/rich-text-editor-matrix.stories.ts b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor-matrix.stories.ts similarity index 94% rename from packages/nimble-components/src/rich-text-editor/tests/rich-text-editor-matrix.stories.ts rename to packages/nimble-components/src/rich-text/editor/tests/rich-text-editor-matrix.stories.ts index 4503e28c77..f942be18b2 100644 --- a/packages/nimble-components/src/rich-text-editor/tests/rich-text-editor-matrix.stories.ts +++ b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor-matrix.stories.ts @@ -3,25 +3,25 @@ import { html, ViewTemplate } from '@microsoft/fast-element'; import { createMatrixThemeStory, createStory -} from '../../utilities/tests/storybook'; +} from '../../../utilities/tests/storybook'; import { createMatrix, sharedMatrixParameters -} from '../../utilities/tests/matrix'; -import { hiddenWrapper } from '../../utilities/tests/hidden'; +} from '../../../utilities/tests/matrix'; +import { hiddenWrapper } from '../../../utilities/tests/hidden'; import { richTextEditorTag } from '..'; import { cssPropertyFromTokenName, tokenNames -} from '../../theme-provider/design-token-names'; -import { buttonTag } from '../../button'; -import { loremIpsum } from '../../utilities/tests/lorem-ipsum'; +} from '../../../theme-provider/design-token-names'; +import { buttonTag } from '../../../button'; +import { loremIpsum } from '../../../utilities/tests/lorem-ipsum'; import { DisabledState, ErrorState, disabledStates, errorStates -} from '../../utilities/tests/states'; +} from '../../../utilities/tests/states'; const metadata: Meta = { title: 'Tests/Rich Text Editor', diff --git a/packages/nimble-components/src/rich-text-editor/tests/rich-text-editor.spec.ts b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor.spec.ts similarity index 99% rename from packages/nimble-components/src/rich-text-editor/tests/rich-text-editor.spec.ts rename to packages/nimble-components/src/rich-text/editor/tests/rich-text-editor.spec.ts index 123a74be19..4c486996a0 100644 --- a/packages/nimble-components/src/rich-text-editor/tests/rich-text-editor.spec.ts +++ b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor.spec.ts @@ -1,13 +1,13 @@ import { html } from '@microsoft/fast-element'; import { richTextEditorTag, RichTextEditor } from '..'; -import { type Fixture, fixture } from '../../utilities/tests/fixture'; -import { getSpecTypeByNamedList } from '../../utilities/tests/parameterized'; +import { type Fixture, fixture } from '../../../utilities/tests/fixture'; +import { getSpecTypeByNamedList } from '../../../utilities/tests/parameterized'; import { RichTextEditorPageObject } from '../testing/rich-text-editor.pageobject'; -import { wackyStrings } from '../../utilities/tests/wacky-strings'; -import type { Button } from '../../button'; -import type { ToggleButton } from '../../toggle-button'; +import { wackyStrings } from '../../../utilities/tests/wacky-strings'; +import type { Button } from '../../../button'; +import type { ToggleButton } from '../../../toggle-button'; import { ToolbarButton } from '../testing/types'; -import { createEventListener } from '../../utilities/tests/component'; +import { createEventListener } from '../../../utilities/tests/component'; async function setup(): Promise> { return fixture( diff --git a/packages/nimble-components/src/rich-text-editor/tests/rich-text-editor.stories.ts b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor.stories.ts similarity index 96% rename from packages/nimble-components/src/rich-text-editor/tests/rich-text-editor.stories.ts rename to packages/nimble-components/src/rich-text/editor/tests/rich-text-editor.stories.ts index d160283532..a1a34763fa 100644 --- a/packages/nimble-components/src/rich-text-editor/tests/rich-text-editor.stories.ts +++ b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor.stories.ts @@ -4,14 +4,14 @@ import { withActions } from '@storybook/addon-actions/decorator'; import { createUserSelectedThemeStory, incubatingWarning -} from '../../utilities/tests/storybook'; +} from '../../../utilities/tests/storybook'; import { RichTextEditor, richTextEditorTag } from '..'; -import { buttonTag } from '../../button'; +import { buttonTag } from '../../../button'; import { addLabelUseMetadata, type LabelUserArgs -} from '../../label-provider/base/tests/label-user-stories-utils'; -import { labelProviderRichTextTag } from '../../label-provider/rich-text'; +} from '../../../label-provider/base/tests/label-user-stories-utils'; +import { labelProviderRichTextTag } from '../../../label-provider/rich-text'; // eslint-disable-next-line @typescript-eslint/no-empty-interface interface RichTextEditorArgs extends LabelUserArgs { diff --git a/packages/nimble-components/src/rich-text-editor/tests/types.spec.ts b/packages/nimble-components/src/rich-text/editor/tests/types.spec.ts similarity index 100% rename from packages/nimble-components/src/rich-text-editor/tests/types.spec.ts rename to packages/nimble-components/src/rich-text/editor/tests/types.spec.ts diff --git a/packages/nimble-components/src/rich-text-editor/types.ts b/packages/nimble-components/src/rich-text/editor/types.ts similarity index 100% rename from packages/nimble-components/src/rich-text-editor/types.ts rename to packages/nimble-components/src/rich-text/editor/types.ts diff --git a/packages/nimble-components/src/rich-text-editor/specs/README.md b/packages/nimble-components/src/rich-text/specs/README.md similarity index 100% rename from packages/nimble-components/src/rich-text-editor/specs/README.md rename to packages/nimble-components/src/rich-text/specs/README.md diff --git a/packages/nimble-components/src/rich-text-editor/specs/spec-images/button-state.png b/packages/nimble-components/src/rich-text/specs/spec-images/button-state.png similarity index 100% rename from packages/nimble-components/src/rich-text-editor/specs/spec-images/button-state.png rename to packages/nimble-components/src/rich-text/specs/spec-images/button-state.png diff --git a/packages/nimble-components/src/rich-text-editor/specs/spec-images/editor-sample.png b/packages/nimble-components/src/rich-text/specs/spec-images/editor-sample.png similarity index 100% rename from packages/nimble-components/src/rich-text-editor/specs/spec-images/editor-sample.png rename to packages/nimble-components/src/rich-text/specs/spec-images/editor-sample.png diff --git a/packages/nimble-components/src/rich-text-editor/specs/spec-images/viewer-sample.png b/packages/nimble-components/src/rich-text/specs/spec-images/viewer-sample.png similarity index 100% rename from packages/nimble-components/src/rich-text-editor/specs/spec-images/viewer-sample.png rename to packages/nimble-components/src/rich-text/specs/spec-images/viewer-sample.png diff --git a/packages/nimble-components/src/rich-text-viewer/index.ts b/packages/nimble-components/src/rich-text/viewer/index.ts similarity index 100% rename from packages/nimble-components/src/rich-text-viewer/index.ts rename to packages/nimble-components/src/rich-text/viewer/index.ts diff --git a/packages/nimble-components/src/rich-text-viewer/styles.ts b/packages/nimble-components/src/rich-text/viewer/styles.ts similarity index 96% rename from packages/nimble-components/src/rich-text-viewer/styles.ts rename to packages/nimble-components/src/rich-text/viewer/styles.ts index f40f0522c6..0d9d8fcbfa 100644 --- a/packages/nimble-components/src/rich-text-viewer/styles.ts +++ b/packages/nimble-components/src/rich-text/viewer/styles.ts @@ -5,7 +5,7 @@ import { bodyFontColor, linkActiveFontColor, linkFontColor -} from '../theme-provider/design-tokens'; +} from '../../theme-provider/design-tokens'; export const styles = css` ${display('flex')} diff --git a/packages/nimble-components/src/rich-text-viewer/template.ts b/packages/nimble-components/src/rich-text/viewer/template.ts similarity index 100% rename from packages/nimble-components/src/rich-text-viewer/template.ts rename to packages/nimble-components/src/rich-text/viewer/template.ts diff --git a/packages/nimble-components/src/rich-text-viewer/testing/rich-text-viewer.pageobject.ts b/packages/nimble-components/src/rich-text/viewer/testing/rich-text-viewer.pageobject.ts similarity index 100% rename from packages/nimble-components/src/rich-text-viewer/testing/rich-text-viewer.pageobject.ts rename to packages/nimble-components/src/rich-text/viewer/testing/rich-text-viewer.pageobject.ts diff --git a/packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer-matrix.stories.ts b/packages/nimble-components/src/rich-text/viewer/tests/rich-text-viewer-matrix.stories.ts similarity index 91% rename from packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer-matrix.stories.ts rename to packages/nimble-components/src/rich-text/viewer/tests/rich-text-viewer-matrix.stories.ts index 7c91e47565..8e4f36ff3d 100644 --- a/packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer-matrix.stories.ts +++ b/packages/nimble-components/src/rich-text/viewer/tests/rich-text-viewer-matrix.stories.ts @@ -3,19 +3,19 @@ import { html, ViewTemplate } from '@microsoft/fast-element'; import { createMatrixThemeStory, createStory -} from '../../utilities/tests/storybook'; +} from '../../../utilities/tests/storybook'; import { createMatrix, sharedMatrixParameters -} from '../../utilities/tests/matrix'; -import { hiddenWrapper } from '../../utilities/tests/hidden'; +} from '../../../utilities/tests/matrix'; +import { hiddenWrapper } from '../../../utilities/tests/hidden'; import { richTextViewerTag } from '..'; -import { richTextMarkdownString } from '../../utilities/tests/rich-text-markdown-string'; -import { loremIpsum } from '../../utilities/tests/lorem-ipsum'; +import { richTextMarkdownString } from '../../../utilities/tests/rich-text-markdown-string'; +import { loremIpsum } from '../../../utilities/tests/lorem-ipsum'; import { cssPropertyFromTokenName, tokenNames -} from '../../theme-provider/design-token-names'; +} from '../../../theme-provider/design-token-names'; const metadata: Meta = { title: 'Tests/Rich Text Viewer', diff --git a/packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer.spec.ts b/packages/nimble-components/src/rich-text/viewer/tests/rich-text-viewer.spec.ts similarity index 99% rename from packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer.spec.ts rename to packages/nimble-components/src/rich-text/viewer/tests/rich-text-viewer.spec.ts index 1235e90ba1..7246dcecc4 100644 --- a/packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer.spec.ts +++ b/packages/nimble-components/src/rich-text/viewer/tests/rich-text-viewer.spec.ts @@ -1,9 +1,9 @@ import { html } from '@microsoft/fast-element'; import { RichTextViewer, richTextViewerTag } from '..'; -import { fixture, type Fixture } from '../../utilities/tests/fixture'; +import { fixture, type Fixture } from '../../../utilities/tests/fixture'; import { RichTextViewerPageObject } from '../testing/rich-text-viewer.pageobject'; -import { wackyStrings } from '../../utilities/tests/wacky-strings'; -import { getSpecTypeByNamedList } from '../../utilities/tests/parameterized'; +import { wackyStrings } from '../../../utilities/tests/wacky-strings'; +import { getSpecTypeByNamedList } from '../../../utilities/tests/parameterized'; async function setup(): Promise> { return fixture( diff --git a/packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer.stories.ts b/packages/nimble-components/src/rich-text/viewer/tests/rich-text-viewer.stories.ts similarity index 92% rename from packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer.stories.ts rename to packages/nimble-components/src/rich-text/viewer/tests/rich-text-viewer.stories.ts index cf1e2f14ac..25dfe832e5 100644 --- a/packages/nimble-components/src/rich-text-viewer/tests/rich-text-viewer.stories.ts +++ b/packages/nimble-components/src/rich-text/viewer/tests/rich-text-viewer.stories.ts @@ -3,9 +3,9 @@ import type { Meta, StoryObj } from '@storybook/html'; import { createUserSelectedThemeStory, incubatingWarning -} from '../../utilities/tests/storybook'; +} from '../../../utilities/tests/storybook'; import { richTextViewerTag } from '..'; -import { richTextMarkdownString } from '../../utilities/tests/rich-text-markdown-string'; +import { richTextMarkdownString } from '../../../utilities/tests/rich-text-markdown-string'; interface RichTextViewerArgs { markdown: string;