Ref: changed file and folder organization
This commit is contained in:
parent
dcca18224b
commit
d8fafd9e94
49 changed files with 874 additions and 14455 deletions
0
src/app/app.component.css
Normal file
0
src/app/app.component.css
Normal file
30
src/app/app.component.html
Normal file
30
src/app/app.component.html
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<h2>Add text or remove text from div (max and min font size)</h2>
|
||||
<div style="border: 2px solid; overflow:hidden; width:100%; height:300px; font-size:520px;">
|
||||
<div [fittext]="true"
|
||||
[modelToWatch]="title"
|
||||
[maxFontSize]="50"
|
||||
[minFontSize]="30"
|
||||
[activateOnResize]="true">{{title}}</div>
|
||||
</div>
|
||||
|
||||
|
||||
<h2>Add text or remove text from div (no max and no min font size)</h2>
|
||||
<div style="border: 2px solid; overflow:hidden; width:100%; height:300px; font-size:520px;">
|
||||
<div [fittext]="true"
|
||||
[modelToWatch]="title"
|
||||
[activateOnResize]="true">{{title}}</div>
|
||||
</div>
|
||||
|
||||
<button (click)="click('add')"> ADD text</button>
|
||||
<button (click)="click('remove')"> REMOVE text</button>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<h2>Write text in input box (text fit inside without overflowing)</h2>
|
||||
<div #cont2 style="border: 2px solid; height:101px; width:300px;">
|
||||
<input [fittext]="true"
|
||||
style="width:100%; height:100px"
|
||||
[activateOnResize]="true"
|
||||
[activateOnInputEvents]="true"
|
||||
[container]="cont2">
|
||||
</div>
|
||||
15
src/app/app.component.ts
Normal file
15
src/app/app.component.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.css']
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'sdf fsd fsd fsdfsdfsdfsdfsfdf sdfsdf sdfs df fsdfsdfsdfsdfsfdf fsdfsdfsdfsdfsfdf fsdfsdfsdfsdfsfdf ' +
|
||||
'fsdfsdfsdfsdfsfdf fsdfsdfsdfsdfsfdf';
|
||||
|
||||
click(par: string) {
|
||||
this.title = par === 'add' ? (this.title + this.title) : (this.title.substring(0, this.title.length / 2 + 10));
|
||||
}
|
||||
}
|
||||
17
src/app/app.module.ts
Normal file
17
src/app/app.module.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { AppComponent } from './app.component';
|
||||
import {Ng2FittextModule} from '../lib/ng2-fittext.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
Ng2FittextModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
0
src/assets/.gitkeep
Normal file
0
src/assets/.gitkeep
Normal file
3
src/environments/environment.prod.ts
Normal file
3
src/environments/environment.prod.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export const environment = {
|
||||
production: true
|
||||
};
|
||||
15
src/environments/environment.ts
Normal file
15
src/environments/environment.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// This file can be replaced during build by using the `fileReplacements` array.
|
||||
// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false
|
||||
};
|
||||
|
||||
/*
|
||||
* In development mode, to ignore zone related error stack frames such as
|
||||
* `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
|
||||
* import the following file, but please comment it out in production mode
|
||||
* because it will have performance impact when throw error
|
||||
*/
|
||||
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
||||
BIN
src/favicon.ico
Normal file
BIN
src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
14
src/index.html
Normal file
14
src/index.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Dev</title>
|
||||
<base href="/">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1 +0,0 @@
|
|||
export * from './directives/ng2-fittext.directive';
|
||||
6
src/lib/.gitignore
vendored
Normal file
6
src/lib/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
build
|
||||
coverage
|
||||
dist
|
||||
debug.log
|
||||
node_modules
|
||||
out-tsc
|
||||
23
src/lib/.npmignore
Normal file
23
src/lib/.npmignore
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
*.spec.ts
|
||||
*.tgz
|
||||
.erector
|
||||
.gitignore
|
||||
.npmignore
|
||||
.vscode
|
||||
build
|
||||
coverage
|
||||
debug.log
|
||||
DEVELOPMENT.md
|
||||
dist
|
||||
karma.conf.js
|
||||
node_modules
|
||||
out-tsc
|
||||
src
|
||||
tasks
|
||||
test.ts
|
||||
tsconfig.*json
|
||||
tslint.json
|
||||
typings
|
||||
typings.json
|
||||
vendor.ts
|
||||
webpack
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ng2-fittext",
|
||||
"version": "1.2.10",
|
||||
"version": "1.2.11",
|
||||
"description": "Ng2-fittext: An Angular2+ directive that change the font size until it fit the upper level container dimension.",
|
||||
"keywords": [
|
||||
"ng2-fittext",
|
||||
|
|
@ -21,16 +21,7 @@
|
|||
"entryFile": "./ng2-fittext.module.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"transpile": "ngc",
|
||||
"build": "../node_modules/.bin/ng-packagr -p package.json",
|
||||
"prepublish": "npm run test",
|
||||
"publish": "npm run build && npm publish dist --access=public"
|
||||
},
|
||||
"repository": {
|
||||
"url": "https://github.com/lokenxo/ng2-fittext.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^1.19.1"
|
||||
}
|
||||
}
|
||||
35
src/lib/tsconfig.json
Normal file
35
src/lib/tsconfig.json
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"angularCompilerOptions": {
|
||||
"strictMetadataEmit": true,
|
||||
"skipTemplateCodegen": true
|
||||
},
|
||||
"compilerOptions": {
|
||||
"baseUrl": "tsconfig",
|
||||
"declaration": true,
|
||||
"stripInternal": true,
|
||||
"strictNullChecks": true,
|
||||
"noImplicitAny": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"lib": ["es2015", "dom", "es5"],
|
||||
"inlineSources": true,
|
||||
"rootDir": "./src",
|
||||
"mapRoot": "./",
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./dist",
|
||||
"sourceMap": true,
|
||||
"target": "es5",
|
||||
"typeRoots": [
|
||||
"./node_modules/@types"
|
||||
],
|
||||
"paths": {
|
||||
"@angular/core": ["./node_modules/@angular/core"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
],
|
||||
"awesomeTypescriptLoaderOptions": {
|
||||
"forkChecker": true
|
||||
}
|
||||
}
|
||||
12
src/main.ts
Normal file
12
src/main.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.log(err));
|
||||
14
src/package-lock.json
generated
14
src/package-lock.json
generated
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"name": "ng2-fittext",
|
||||
"version": "1.2.10",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"prettier": {
|
||||
"version": "1.19.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
|
||||
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
||||
63
src/polyfills.ts
Normal file
63
src/polyfills.ts
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/guide/browser-support
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||
|
||||
/**
|
||||
* Web Animations `@angular/platform-browser/animations`
|
||||
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
||||
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
||||
*/
|
||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||
|
||||
/**
|
||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
* because those flags need to be set before `zone.js` being loaded, and webpack
|
||||
* will put import in the top of bundle, so user need to create a separate file
|
||||
* in this directory (for example: zone-flags.ts), and put the following flags
|
||||
* into that file, and then add the following code before importing zone.js.
|
||||
* import './zone-flags.ts';
|
||||
*
|
||||
* The flags allowed in zone-flags.ts are listed here.
|
||||
*
|
||||
* The following flags will work for all browsers.
|
||||
*
|
||||
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*
|
||||
* (window as any).__Zone_enable_cross_context_check = true;
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
||||
1
src/styles.css
Normal file
1
src/styles.css
Normal file
|
|
@ -0,0 +1 @@
|
|||
/* You can add global styles to this file, and also import other style files */
|
||||
20
src/test.ts
Normal file
20
src/test.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: any;
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
Loading…
Add table
Add a link
Reference in a new issue