Compare commits

..

1 commit

Author SHA1 Message Date
dependabot[bot]
fad3cf57db
Build(deps-dev): Bump express from 4.18.2 to 4.19.2
Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.18.2...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-29 15:40:09 +00:00
8 changed files with 3854 additions and 3330 deletions

View file

@ -1,21 +0,0 @@
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

View file

@ -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>
[![Download via NPM](https://img.shields.io/npm/v/ng2-fittext.svg)](https://www.npmjs.com/package/ng2-fittext) [![Download via NPM](https://img.shields.io/npm/v/ng2-fittext.svg)](https://www.npmjs.com/package/ng2-fittext)
![Angular](https://img.shields.io/badge/Angular-18-green.svg) ![Angular](https://img.shields.io/badge/Angular-17-green.svg)
![Build Status](https://github.com/thisloke/ng2-fittext/actions/workflows/tests.yml/badge.svg) ![Build Status](https://github.com/thisloke/ng2-fittext/actions/workflows/tests.yml/badge.svg)
![Contributions welcome](https://img.shields.io/badge/contributions-welcome-green.svg) ![Contributions welcome](https://img.shields.io/badge/contributions-welcome-green.svg)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
@ -18,13 +18,11 @@ Check out the live demo: [ng2-fittext Demo](https://stackblitz.com/edit/stackbli
## Installation ## Installation
Install the library using npm according to your angular version (see table below): Install the library using npm:
| 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

7105
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -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 lib", "test": "node node_modules/@angular/cli/bin/ng test",
"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": "^18.0.6", "@angular/animations": "^17.0.8",
"@angular/common": "^18.0.6", "@angular/common": "^17.0.8",
"@angular/compiler": "^18.0.6", "@angular/compiler": "^17.0.8",
"@angular/core": "^18.0.6", "@angular/core": "^17.0.8",
"@angular/forms": "^18.0.6", "@angular/forms": "^17.0.8",
"@angular/platform-browser": "^18.0.6", "@angular/platform-browser": "^17.0.8",
"@angular/platform-browser-dynamic": "^18.0.6", "@angular/platform-browser-dynamic": "^17.0.8",
"@angular/router": "^18.0.6", "@angular/router": "^17.0.8",
"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": "^18.0.7", "@angular-devkit/build-angular": "^17.0.8",
"@angular/cli": "^18.0.7", "@angular/cli": "^17.0.8",
"@angular/compiler-cli": "^18.0.6", "@angular/compiler-cli": "^17.0.8",
"@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": "^18.0.0", "ng-packagr": "^17.0.0",
"typescript": "5.4.5" "typescript": "5.2.2"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "ng2-fittext", "name": "ng2-fittext",
"version": "2.0.0", "version": "1.4.3",
"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,7 +21,6 @@
"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",
@ -30,8 +29,8 @@
"author": "Lorenzo Iovino", "author": "Lorenzo Iovino",
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"@angular/common": ">=18.0.0", "@angular/common": "^17.0.0",
"@angular/core": ">=18.0.0" "@angular/core": "^17.0.0"
}, },
"dependencies": { "dependencies": {
"tslib": "^2.3.0" "tslib": "^2.3.0"

View file

@ -1,13 +1,15 @@
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;
ng2FittextDirective = new Ng2FittextDirective(elMock); rendererMock = {} as Renderer2;
ng2FittextDirective = new Ng2FittextDirective(elMock, rendererMock);
}); });
describe('Method: setFontSize', () => { describe('Method: setFontSize', () => {

View file

@ -9,6 +9,7 @@ import {
EventEmitter, EventEmitter,
OnChanges, OnChanges,
OnInit, OnInit,
Renderer2,
} from '@angular/core'; } from '@angular/core';
@Directive({ @Directive({
@ -34,7 +35,7 @@ export class Ng2FittextDirective
private speed = 1.05; private speed = 1.05;
private done = false; private done = false;
constructor(public el: ElementRef<HTMLElement>) {} constructor(public el: ElementRef<HTMLElement>, public renderer: Renderer2) {}
setFontSize(fontSize: number): void { setFontSize(fontSize: number): void {
if (this.isVisible() && !this.isDone()) { if (this.isVisible() && !this.isDone()) {