Skip to content

Commit

Permalink
feat(design)!: shard media gallery component (#2679)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `DaffMediaGalleryModule` has moved to its own package. Update imports to `@daffodil/design/media-gallery`
  • Loading branch information
xelaint committed Dec 20, 2023
1 parent 6d96924 commit bf1a0f6
Show file tree
Hide file tree
Showing 27 changed files with 40 additions and 35 deletions.
2 changes: 1 addition & 1 deletion libs/design/image/src/image/image.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { DomSanitizer } from '@angular/platform-browser';
import {
daffSkeletonableMixin,
DaffSkeletonable,
daffThumbnailCompatToken,
} from '@daffodil/design';
import { daffThumbnailCompatToken } from '@daffodil/design/media-gallery';

const validateProperty = (object: Record<string, any>, prop: string) => {
if (object[prop] === null || object[prop] === undefined || object[prop] === '') {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';

import { DaffMediaGalleryModule } from '@daffodil/design';
import { DaffImageModule } from '@daffodil/design/image';
import { DaffMediaGalleryModule } from '@daffodil/design/media-gallery';

import { BasicMediaGalleryComponent } from './basic-media-gallery.component';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';

import { DaffMediaGalleryModule } from '@daffodil/design';
import { DaffImageModule } from '@daffodil/design/image';
import { DaffMediaGalleryModule } from '@daffodil/design/media-gallery';

import { MismatchedSizesMediaGalleryComponent } from './mismatched-sizes-media-gallery.component';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';

import { DaffMediaGalleryModule } from '@daffodil/design';
import { DaffImageModule } from '@daffodil/design/image';
import { DaffMediaGalleryModule } from '@daffodil/design/media-gallery';

import { SkeletonMediaGalleryComponent } from './skeleton-media-gallery.component';

Expand Down
9 changes: 9 additions & 0 deletions libs/design/media-gallery/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/design/media-gallery",
"deleteDestPath": false,
"lib": {
"entryFile": "src/index.ts",
"styleIncludePaths": ["../src/scss"]
}
}
1 change: 1 addition & 0 deletions libs/design/media-gallery/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './public_api';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use 'sass:map';
@use '../../../scss/theming';
@use '../../../scss/core';
@use '../../scss/theming';
@use '../../scss/core';

@mixin daff-media-gallery-theme($theme) {
$gray: core.daff-map-deep-get($theme, 'core.gray');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

import { DaffMediaGalleryComponent } from './media-gallery.component';
import { DaffMediaGalleryComponent } from './media-gallery/media-gallery.component';
import { DaffMediaRendererComponent } from './media-renderer/media-renderer.component';
import { DaffThumbnailDirective } from './thumbnail/thumbnail.directive';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
@use '../../../scss/state';

:host(.daff-media-gallery) {
// stylelint-disable-next-line scss/comment-no-loud
/* autoprefixer grid: autoplace */
$root: '.daff-media-gallery';
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
import { By } from '@angular/platform-browser';

import { DaffMediaGalleryComponent } from './media-gallery.component';
import { DaffMediaGalleryRegistry } from './registry/media-gallery.registry';
import { daffThumbnailCompatToken } from './thumbnail/thumbnail-compat.token';
import { DaffThumbnailDirective } from './thumbnail/thumbnail.directive';
import { DaffMediaGalleryRegistry } from '../registry/media-gallery.registry';
import { daffThumbnailCompatToken } from '../thumbnail/thumbnail-compat.token';
import { DaffThumbnailDirective } from '../thumbnail/thumbnail.directive';

@Component({
template: `<daff-media-gallery [name]="nameValue" [skeleton]="skeleton">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import {
Renderer2,
} from '@angular/core';

import { DaffMediaGalleryRegistration } from './media-gallery-registration.interface';
import { DAFF_MEDIA_GALLERY_TOKEN } from './media-gallery-token';
import { DaffMediaGalleryRegistry } from './registry/media-gallery.registry';
import { daffArticleEncapsulatedMixin } from '../../core/article-encapsulated/public_api';
import {
daffSkeletonableMixin,
DaffSkeletonable,
} from '../../core/skeletonable/public_api';
daffArticleEncapsulatedMixin,
} from '@daffodil/design';

import { DaffMediaGalleryRegistration } from '../helpers/media-gallery-registration.interface';
import { DAFF_MEDIA_GALLERY_TOKEN } from '../helpers/media-gallery-token';
import { DaffMediaGalleryRegistry } from '../registry/media-gallery.registry';

let uniqueGalleryId = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { BehaviorSubject } from 'rxjs';
import { DaffArticleComponent } from '@daffodil/design/article';

import { DaffMediaRendererComponent } from './media-renderer.component';
import { DaffMediaGalleryRegistration } from '../media-gallery-registration.interface';
import { DAFF_MEDIA_GALLERY_TOKEN } from '../media-gallery-token';
import { DaffMediaGalleryRegistration } from '../helpers/media-gallery-registration.interface';
import { DAFF_MEDIA_GALLERY_TOKEN } from '../helpers/media-gallery-token';
import { DaffMediaGalleryRegistry } from '../registry/media-gallery.registry';
import { daffThumbnailCompatToken } from '../thumbnail/thumbnail-compat.token';
import { DaffThumbnailDirective } from '../thumbnail/thumbnail.directive';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

import { DaffMediaGalleryRegistration } from '../media-gallery-registration.interface';
import { DAFF_MEDIA_GALLERY_TOKEN } from '../media-gallery-token';
import { DaffMediaGalleryRegistration } from '../helpers/media-gallery-registration.interface';
import { DAFF_MEDIA_GALLERY_TOKEN } from '../helpers/media-gallery-token';
import { DaffMediaGalleryRegistry } from '../registry/media-gallery.registry';

/**
Expand All @@ -23,7 +23,7 @@ import { DaffMediaGalleryRegistry } from '../registry/media-gallery.registry';
*/
@Component({
selector: 'daff-media-renderer',
templateUrl: './media-renderer.component.html',
template: '<ng-template></ng-template>',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DaffMediaRendererComponent implements OnInit, OnDestroy {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './media-gallery.component';
export * from './media-gallery/media-gallery.component';
export * from './media-gallery.module';
export * from './thumbnail/thumbnail.directive';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ import {
DaffMediaGallery,
DaffMediaGalleryRegistry,
} from './media-gallery.registry';
import { DaffMediaGalleryRegistration } from '../media-gallery-registration.interface';
import { DaffMediaGalleryRegistration } from '../helpers/media-gallery-registration.interface';
import { DaffThumbnailDirective } from '../thumbnail/thumbnail.directive';

@Component({})
export class FakeComponent {}

export class ChangeDetectorRefMock implements Partial<ChangeDetectorRef> {
markForCheck() {

}
markForCheck() {}
}

describe('DaffMediaGalleryRegistry', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';

import { DaffMediaGalleryRegistration } from '../media-gallery-registration.interface';
import { DaffMediaGalleryRegistration } from '../helpers/media-gallery-registration.interface';
import { DaffThumbnailRegistration } from '../thumbnail/thumbnail-registration.interface';

export interface DaffMediaGalleryDict {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Type } from '@angular/core';

import { DaffMediaGalleryRegistration } from '../media-gallery-registration.interface';
import { DaffMediaGalleryRegistration } from '../helpers/media-gallery-registration.interface';

export interface DaffThumbnailRegistration {
gallery: DaffMediaGalleryRegistration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { By } from '@angular/platform-browser';

import { daffThumbnailCompatToken } from './thumbnail-compat.token';
import { DaffThumbnailDirective } from './thumbnail.directive';
import { DaffMediaGalleryComponent } from '../media-gallery.component';
import { DaffMediaGalleryComponent } from '../media-gallery/media-gallery.component';
import { DaffMediaGalleryRegistry } from '../registry/media-gallery.registry';

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {

import { daffThumbnailCompatToken } from './thumbnail-compat.token';
import { DaffThumbnailRegistration } from './thumbnail-registration.interface';
import { DaffMediaGalleryRegistration } from '../media-gallery-registration.interface';
import { DAFF_MEDIA_GALLERY_TOKEN } from '../media-gallery-token';
import { DaffMediaGalleryRegistration } from '../helpers/media-gallery-registration.interface';
import { DAFF_MEDIA_GALLERY_TOKEN } from '../helpers/media-gallery-token';
import { DaffMediaGalleryRegistry } from '../registry/media-gallery.registry';

/**
Expand Down
2 changes: 1 addition & 1 deletion libs/design/scss/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@use '../card/src/card-theme' as card;
@use '../hero/src/hero-theme' as hero;
@use '../list/src/list-theme' as list;
@use '../src/molecules/media-gallery/media-gallery-theme' as media-gallery;
@use '../media-gallery/src/media-gallery-theme' as media-gallery;
@use '../src/molecules/menu/menu-theme' as menu;
@use '../src/molecules/modal/modal-theme' as modal;
@use '../src/molecules/navbar/navbar-theme' as navbar;
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion libs/design/src/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export * from './molecules/backdrop/public_api';
export * from './molecules/button-set/public_api';
export * from './molecules/image-gallery/public_api';
export * from './molecules/image-list/public_api';
export * from './molecules/media-gallery/public_api';
export * from './molecules/menu/public_api';
export * from './molecules/modal/public_api';
export * from './molecules/navbar/public_api';
Expand Down

0 comments on commit bf1a0f6

Please sign in to comment.