Skip to content
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

7.0.0 #46

Merged
merged 4 commits into from
Aug 10, 2024
Merged
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
9 changes: 7 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,18 @@
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
],
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
"rules": {
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ testem.log
.DS_Store
Thumbs.db

# Caches
.angular

.nx/cache
.nx/
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/dist
/coverage

/.nx/cache
/.nx/cache
/.nx/workspace-data
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# berg-layout

Check out the usage and demo [here](https://berglayout.com/).
- Usage and demo [here](https://berglayout.com/).
- @berg-layout/core [here](https://github.com/blidblid/berg-layout/tree/main/libs/core)
- @berg-layout/angular [here](https://github.com/blidblid/berg-layout/tree/main/libs/angular)
- @berg-layout/react [here](https://github.com/blidblid/berg-layout/tree/main/libs/react)
6 changes: 2 additions & 4 deletions apps/demo/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"tags": [],
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"executor": "@angular-devkit/build-angular:application",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/demo",
"index": "apps/demo/src/index.html",
"main": "apps/demo/src/main.ts",
"browser": "apps/demo/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/demo/tsconfig.app.json",
"assets": ["apps/demo/src/favicon.ico", "apps/demo/src/assets"],
Expand All @@ -39,9 +39,7 @@
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
Expand Down
10 changes: 5 additions & 5 deletions apps/demo/src/_app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
@use './lib/components/material-overrides';

@mixin theme($theme) {
$config: mat.get-color-config($theme);
$config: mat.m2-get-color-config($theme);
$primary-palette: map.get($config, 'primary');
$accent-palette: map.get($config, 'accent');
$background-palette: map.get($config, 'background');
$foreground-palette: map.get($config, 'foreground');

$primary-color: mat.get-color-from-palette($primary-palette);
$accent-color: mat.get-color-from-palette($accent-palette);
$divider-color: mat.get-color-from-palette($foreground-palette, divider);
$card-color: mat.get-color-from-palette($background-palette, card);
$primary-color: mat.m2-get-color-from-palette($primary-palette);
$accent-color: mat.m2-get-color-from-palette($accent-palette);
$divider-color: mat.m2-get-color-from-palette($foreground-palette, divider);
$card-color: mat.m2-get-color-from-palette($background-palette, card);

// make a new color map since @angular/material has a tedious API.
$colors: (
Expand Down
20 changes: 7 additions & 13 deletions apps/demo/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
Expand All @@ -7,16 +7,10 @@ import { AppComponent } from './app.component';
import { DemoModule } from './demo';
import { HomeModule } from './home';

@NgModule({
declarations: [AppComponent],
imports: [
AppRoutingModule,
BrowserAnimationsModule,
BrowserModule,
DemoModule,
HomeModule,
HttpClientModule,
],
bootstrap: [AppComponent],
})
@NgModule({ declarations: [AppComponent],
bootstrap: [AppComponent], imports: [AppRoutingModule,
BrowserAnimationsModule,
BrowserModule,
DemoModule,
HomeModule], providers: [provideHttpClient(withInterceptorsFromDi())] })
export class AppModule {}
2 changes: 1 addition & 1 deletion apps/demo/src/app/home/home.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: flex;
flex-direction: column;
align-items: center;
padding-top: 15%;
padding-top: 24vh;
position: fixed;
top: 0;
bottom: 0;
Expand Down
4 changes: 2 additions & 2 deletions apps/demo/src/lib/components/toolbar/toolbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
</div>

<div class="flex">
<a mat-button routerLink="/">
<a mat-icon-button routerLink="/">
<mat-icon svgIcon="home"></mat-icon>
</a>

<button mat-button (click)="toggleRight()">
<button mat-icon-button (click)="toggleRight()">
<mat-icon svgIcon="menu"></mat-icon>
</button>
</div>
Expand Down
10 changes: 5 additions & 5 deletions apps/demo/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
@include layout.core();
@include mat.core();

$primary: mat.define-palette(mat.$blue-palette, A400);
$accent: mat.define-palette(mat.$orange-palette, A400);
$warn: mat.define-palette(mat.$red-palette);
$primary: mat.m2-define-palette(mat.$m2-blue-palette, A400);
$accent: mat.m2-define-palette(mat.$m2-orange-palette, A400);
$warn: mat.m2-define-palette(mat.$m2-red-palette);

$dark-theme: mat.define-dark-theme(
$dark-theme: mat.m2-define-dark-theme(
(
color: (
primary: $primary,
Expand All @@ -25,7 +25,7 @@ $dark-theme: mat.define-dark-theme(
)
);

$light-theme: mat.define-light-theme(
$light-theme: mat.m2-define-light-theme(
(
color: (
primary: $primary,
Expand Down
8 changes: 2 additions & 6 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"hosting": {
"public": "dist/apps/demo",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"public": "dist/apps/demo/browser",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
Expand Down
23 changes: 23 additions & 0 deletions libs/angular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,26 @@ Usage and demo [here](https://berglayout.com/angular).

- Panel inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/panel/panel-model.ts)
- Layout inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/layout/layout-model.ts)

## Styling

Since berg-layout uses web components, the layout styles are encapsulated in the [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM).

You can still style them, but you need to use the pseudo element [::part()](https://developer.mozilla.org/en-US/docs/Web/CSS/::part) to pierce the encapsulation.

### Styling panels

The panels have two `::part()`

- `part="content"` which wraps your content
- `part="overflow"` which handles overflow and wraps `content`

To for example, style `content`, use `::part`

```css
.berg-panel-top {
&::part(content) {
padding: 16px;
}
}
```
2 changes: 1 addition & 1 deletion libs/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@berg-layout/angular",
"version": "6.0.1",
"version": "7.0.0",
"license": "MIT",
"repository": {
"url": "https://github.com/blidblid/berg-layout"
Expand Down
23 changes: 23 additions & 0 deletions libs/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,26 @@ Usage and demo [here](https://berglayout.com/core).

- Panel inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/panel/panel-model.ts)
- Layout inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/layout/layout-model.ts)

## Styling

Since berg-layout uses web components, the layout styles are encapsulated in the [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM).

You can still style them, but you need to use the pseudo element [::part()](https://developer.mozilla.org/en-US/docs/Web/CSS/::part) to pierce the encapsulation.

### Styling panels

The panels have two `::part()`

- `part="content"` which wraps your content
- `part="overflow"` which handles overflow and wraps `content`

To for example, style `content`, use `::part`

```css
.berg-panel-top {
&::part(content) {
padding: 16px;
}
}
```
2 changes: 1 addition & 1 deletion libs/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@berg-layout/core",
"version": "6.0.1",
"version": "7.0.0",
"license": "MIT",
"repository": {
"url": "https://github.com/blidblid/berg-layout"
Expand Down
8 changes: 1 addition & 7 deletions libs/core/src/lib/components/layout/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,6 @@ export class BergLayoutElement extends WebComponent<BergLayoutInputs> {
}
}

try {
if (!customElements.get(BERG_LAYOUT_TAG_NAME)) {
customElements.define(BERG_LAYOUT_TAG_NAME, BergLayoutElement);
} catch (e) {
console.warn(
`${BERG_LAYOUT_TAG_NAME} is already defined as a web component.`
);

throw e;
}
9 changes: 3 additions & 6 deletions libs/core/src/lib/components/panel/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
withLatestFrom,
} from 'rxjs/operators';
import { coerceBooleanProperty, coerceNumberProperty } from '../../util';
import { BergLayoutElement, BERG_LAYOUT_TAG_NAME } from '../layout';
import { BERG_LAYOUT_TAG_NAME, BergLayoutElement } from '../layout';
import {
BERG_LAYOUT_NO_TRANSITION_CLASS,
BERG_LAYOUT_RESIZING_HORIZONTAL_CLASS,
Expand Down Expand Up @@ -621,7 +621,7 @@ export class BergPanelElement extends WebComponent<BergPanelInputs> {
</style>

<div class="berg-panel-overflow" part="overflow">
<div class="berg-panel-content" part="content">
<div part="content">
<slot></slot>
</div>
</div>`;
Expand All @@ -641,9 +641,6 @@ export class BergPanelElement extends WebComponent<BergPanelInputs> {
}
}

try {
if (!window.customElements.get(BERG_PANEL_TAG_NAME)) {
customElements.define(BERG_PANEL_TAG_NAME, BergPanelElement);
} catch (e) {
console.warn(`${BERG_PANEL_TAG_NAME} is already defined as a web component.`);
throw e;
}
23 changes: 23 additions & 0 deletions libs/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,26 @@ Usage and demo [here](https://berglayout.com/react).

- Panel inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/panel/panel-model.ts)
- Layout inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/layout/layout-model.ts)

## Styling

Since berg-layout uses web components, the layout styles are encapsulated in the [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM).

You can still style them, but you need to use the pseudo element [::part()](https://developer.mozilla.org/en-US/docs/Web/CSS/::part) to pierce the encapsulation.

### Styling panels

The panels have two `::part()`

- `part="content"` which wraps your content
- `part="overflow"` which handles overflow and wraps `content`

To for example, style `content`, use `::part`

```css
.berg-panel-top {
&::part(content) {
padding: 16px;
}
}
```
2 changes: 1 addition & 1 deletion libs/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@berg-layout/react",
"version": "6.0.1",
"version": "7.0.0",
"license": "MIT",
"repository": {
"url": "https://github.com/blidblid/berg-layout"
Expand Down
7 changes: 4 additions & 3 deletions libs/react/src/lib/layout/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import '@berg-layout/core';
import {
BergLayoutInputs,
BERG_LAYOUT_DEFAULT_INPUTS,
BergLayoutInputs,
} from '@berg-layout/core';
import { PropsWithChildren } from 'react';
import { HTMLAttributes, PropsWithChildren } from 'react';

export type BergLayoutProps = PropsWithChildren<Partial<BergLayoutInputs>>;
export type BergLayoutProps = PropsWithChildren<Partial<BergLayoutInputs>> &
HTMLAttributes<HTMLDivElement>;

export const BERG_LAYOUT_DEFAULT_PROPS = BERG_LAYOUT_DEFAULT_INPUTS;

Expand Down
15 changes: 12 additions & 3 deletions libs/react/src/lib/panel/panel.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import '@berg-layout/core';
import { BergPanelInputs, BERG_PANEL_DEFAULT_INPUTS } from '@berg-layout/core';
import { PropsWithChildren } from 'react';
import {
BERG_PANEL_DEFAULT_INPUTS,
BergPanelInputs,
BergPanelOutputs,
} from '@berg-layout/core';
import { HTMLAttributes, PropsWithChildren } from 'react';

export type BergPanelProps = PropsWithChildren<Partial<BergPanelInputs>>;
export type BergPanelProps = PropsWithChildren<Partial<BergPanelInputs>> &
HTMLAttributes<HTMLDivElement> & {
[P in keyof BergPanelOutputs as `on${Capitalize<string & P>}`]?: (
event: BergPanelOutputs[P]
) => void;
};

export const BERG_PANEL_DEFAULT_PROPS = BERG_PANEL_DEFAULT_INPUTS;

Expand Down
Loading
Loading