Compare commits
5 commits
dependabot
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| f925d39e74 | |||
|
|
b8de85a4f9 | ||
|
|
f1519e2dc9 | ||
|
|
20be9e90f8 | ||
|
|
da502ed7f5 |
8 changed files with 3413 additions and 3937 deletions
21
.github/workflows/mirror-to-forgejo.yml
vendored
Normal file
21
.github/workflows/mirror-to-forgejo.yml
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
name: Mirror to Forgejo
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["**"]
|
||||||
|
tags: ["**"]
|
||||||
|
delete:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
mirror:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Push to Forgejo
|
||||||
|
run: |
|
||||||
|
git remote add forgejo https://loke:${{ secrets.FORGEJO_TOKEN }}@git.lorenzoiovino.com/loke/ng2-fittext.git
|
||||||
|
git push forgejo --all --force
|
||||||
|
git push forgejo --tags --force
|
||||||
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
|
|
@ -18,4 +18,4 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm run test:headless:singleRun
|
- run: npm run test:headless:singleRun
|
||||||
12
README.md
12
README.md
|
|
@ -5,7 +5,7 @@
|
||||||
<p align="center">An Angular 2+ directive, written in pure TypeScript (without jQuery!), to automatically scale the font size of an element so that it fits within its parent container.</p>
|
<p align="center">An Angular 2+ directive, written in pure TypeScript (without jQuery!), to automatically scale the font size of an element so that it fits within its parent container.</p>
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/ng2-fittext)
|
[](https://www.npmjs.com/package/ng2-fittext)
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
[](https://opensource.org/licenses/MIT)
|
[](https://opensource.org/licenses/MIT)
|
||||||
|
|
@ -18,11 +18,13 @@ Check out the live demo: [ng2-fittext Demo](https://stackblitz.com/edit/stackbli
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Install the library using npm:
|
Install the library using npm according to your angular version (see table below):
|
||||||
|
|
||||||
|
| Angular | ng2-fittext | command |
|
||||||
|
|---------|-------------|-------------------------------|
|
||||||
|
| <= v17 | 1.4.3 | ```npm i ng2-fittext@1.4.3``` |
|
||||||
|
| >= v18 | 2.0.0 | ```npm i ng2-fittext@2.0.0``` |
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install --save ng2-fittext
|
|
||||||
```
|
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
|
|
|
||||||
7271
package-lock.json
generated
7271
package-lock.json
generated
File diff suppressed because it is too large
Load diff
28
package.json
28
package.json
|
|
@ -5,7 +5,7 @@
|
||||||
"ng": "./node_modules/.bin/ng",
|
"ng": "./node_modules/.bin/ng",
|
||||||
"start": "node node_modules/@angular/cli/bin/ng serve",
|
"start": "node node_modules/@angular/cli/bin/ng serve",
|
||||||
"build": "node node_modules/@angular/cli/bin/ng build --configuration production",
|
"build": "node node_modules/@angular/cli/bin/ng build --configuration production",
|
||||||
"test": "node node_modules/@angular/cli/bin/ng test",
|
"test": "node node_modules/@angular/cli/bin/ng test lib",
|
||||||
"test:headless": "node node_modules/@angular/cli/bin/ng test --browsers=ChromeHeadless",
|
"test:headless": "node node_modules/@angular/cli/bin/ng test --browsers=ChromeHeadless",
|
||||||
"test:headless:singleRun": "node node_modules/@angular/cli/bin/ng test --no-watch --no-progress --browsers=ChromeHeadless lib",
|
"test:headless:singleRun": "node node_modules/@angular/cli/bin/ng test --no-watch --no-progress --browsers=ChromeHeadless lib",
|
||||||
"release:minor": "cd ./projects/lib/ && npm version minor",
|
"release:minor": "cd ./projects/lib/ && npm version minor",
|
||||||
|
|
@ -15,22 +15,22 @@
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^17.0.8",
|
"@angular/animations": "^18.0.6",
|
||||||
"@angular/common": "^17.0.8",
|
"@angular/common": "^18.0.6",
|
||||||
"@angular/compiler": "^17.0.8",
|
"@angular/compiler": "^18.0.6",
|
||||||
"@angular/core": "^17.0.8",
|
"@angular/core": "^18.0.6",
|
||||||
"@angular/forms": "^17.0.8",
|
"@angular/forms": "^18.0.6",
|
||||||
"@angular/platform-browser": "^17.0.8",
|
"@angular/platform-browser": "^18.0.6",
|
||||||
"@angular/platform-browser-dynamic": "^17.0.8",
|
"@angular/platform-browser-dynamic": "^18.0.6",
|
||||||
"@angular/router": "^17.0.8",
|
"@angular/router": "^18.0.6",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
"zone.js": "~0.14.2"
|
"zone.js": "~0.14.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "^17.0.8",
|
"@angular-devkit/build-angular": "^18.0.7",
|
||||||
"@angular/cli": "^17.0.8",
|
"@angular/cli": "^18.0.7",
|
||||||
"@angular/compiler-cli": "^17.0.8",
|
"@angular/compiler-cli": "^18.0.6",
|
||||||
"@types/jasmine": "~5.1.0",
|
"@types/jasmine": "~5.1.0",
|
||||||
"@types/jasminewd2": "~2.0.3",
|
"@types/jasminewd2": "~2.0.3",
|
||||||
"@types/node": "^18.18.0",
|
"@types/node": "^18.18.0",
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
"karma-coverage": "~2.2.0",
|
"karma-coverage": "~2.2.0",
|
||||||
"karma-jasmine": "~5.1.0",
|
"karma-jasmine": "~5.1.0",
|
||||||
"karma-jasmine-html-reporter": "~2.1.0",
|
"karma-jasmine-html-reporter": "~2.1.0",
|
||||||
"ng-packagr": "^17.0.0",
|
"ng-packagr": "^18.0.0",
|
||||||
"typescript": "5.2.2"
|
"typescript": "5.4.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "ng2-fittext",
|
"name": "ng2-fittext",
|
||||||
"version": "1.4.3",
|
"version": "2.0.0",
|
||||||
"description": "Ng2-fittext: An Angular2+ directive that change the font size until it fit the upper level container dimension.",
|
"description": "Ng2-fittext: An Angular2+ directive that change the font size until it fit the upper level container dimension.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ng2-fittext",
|
"ng2-fittext",
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
"angular 15",
|
"angular 15",
|
||||||
"angular 16",
|
"angular 16",
|
||||||
"angular 17",
|
"angular 17",
|
||||||
|
"angular 18",
|
||||||
"fit text",
|
"fit text",
|
||||||
"responsive text",
|
"responsive text",
|
||||||
"responsive font size",
|
"responsive font size",
|
||||||
|
|
@ -29,8 +30,8 @@
|
||||||
"author": "Lorenzo Iovino",
|
"author": "Lorenzo Iovino",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/common": "^17.0.0",
|
"@angular/common": ">=18.0.0",
|
||||||
"@angular/core": "^17.0.0"
|
"@angular/core": ">=18.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,13 @@
|
||||||
import { Ng2FittextDirective } from '../../ng2-fittext.directive';
|
import { Ng2FittextDirective } from './ng2-fittext.directive';
|
||||||
import { Renderer2, ElementRef } from '@angular/core';
|
import { Renderer2, ElementRef } from '@angular/core';
|
||||||
|
|
||||||
describe('Class: Ng2FittextDirective', () => {
|
describe('Class: Ng2FittextDirective', () => {
|
||||||
let ng2FittextDirective: Ng2FittextDirective;
|
let ng2FittextDirective: Ng2FittextDirective;
|
||||||
let elMock: ElementRef;
|
let elMock: ElementRef;
|
||||||
let rendererMock: Renderer2;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
elMock = {} as ElementRef;
|
elMock = {} as ElementRef;
|
||||||
rendererMock = {} as Renderer2;
|
ng2FittextDirective = new Ng2FittextDirective(elMock);
|
||||||
ng2FittextDirective = new Ng2FittextDirective(elMock, rendererMock);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Method: setFontSize', () => {
|
describe('Method: setFontSize', () => {
|
||||||
|
|
@ -9,7 +9,6 @@ import {
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
OnChanges,
|
OnChanges,
|
||||||
OnInit,
|
OnInit,
|
||||||
Renderer2,
|
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
|
|
@ -35,7 +34,7 @@ export class Ng2FittextDirective
|
||||||
private speed = 1.05;
|
private speed = 1.05;
|
||||||
private done = false;
|
private done = false;
|
||||||
|
|
||||||
constructor(public el: ElementRef<HTMLElement>, public renderer: Renderer2) {}
|
constructor(public el: ElementRef<HTMLElement>) {}
|
||||||
|
|
||||||
setFontSize(fontSize: number): void {
|
setFontSize(fontSize: number): void {
|
||||||
if (this.isVisible() && !this.isDone()) {
|
if (this.isVisible() && !this.isDone()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue