Fix: Issues #14,#15,#19,#20. Ref: Deleted angular-librarian and added scripts in package.json to manage publishing; Version upgrade
This commit is contained in:
parent
2726231e1a
commit
c1d07a1af1
65 changed files with 22464 additions and 1460 deletions
1
.erector
1
.erector
|
|
@ -1 +0,0 @@
|
|||
[{"name":"name","answer":"ng2-fittext"},{"name":"packageName","answer":"ng2-fittext"},{"name":"readmeTitle","answer":"Ng2 Fittext"},{"name":"repoUrl","answer":"https://github.com/lokenxo/ng2-fittext"},{"name":"git","answer":""},{"name":"moduleName","answer":"Ng2FittextModule"},{"name":"version","answer":"1.0.25"}]
|
||||
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
</project>
|
||||
649
.idea/workspace.xml
generated
649
.idea/workspace.xml
generated
|
|
@ -1,96 +1,265 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="BookmarkManager">
|
||||
<bookmark url="file://$PROJECT_DIR$/examples/dev/src/app/app.component.html" line="0" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="6d9e6998-eced-4f47-8fb4-3257db3e18e7" name="Default" comment="">
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change afterPath="$PROJECT_DIR$/publishPackage.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/distPackage.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.erector" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/DEVELOPMENT.md" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/example.component.html" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/example.component.scss" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/example.component.ts" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/example.main.ts" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/example.module.ts" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/index.html" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/styles.scss" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/karma.conf.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/directives/ng2-fittext.directive.spec.ts" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/directives/ng2-fittext.directive.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/directives/ng2-fittext.directive.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/ng2-fittext.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/ng2-fittext.module.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/test.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/vendor.ts" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tasks/build.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tasks/copy-build.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tasks/copy-globs.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tasks/inline-resources.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tasks/rollup.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tasks/test.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tsconfig.es2015.json" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tsconfig.es5.json" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tsconfig.json" beforeDir="false" afterPath="$PROJECT_DIR$/tsconfig.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tsconfig.test.json" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/webpack/webpack.common.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/webpack/webpack.dev.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/webpack/webpack.test.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/webpack/webpack.utils.js" beforeDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/.tmp/" />
|
||||
<ignored path="$PROJECT_DIR$/temp/" />
|
||||
<ignored path="$PROJECT_DIR$/tmp/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="-1377568461">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="1" />
|
||||
<entry key="project.open.time.1" value="1" />
|
||||
<entry key="project.open.time.8" value="1" />
|
||||
<entry key="project.opened" value="2" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.js.language.service.starts">
|
||||
<counts>
|
||||
<entry key="Angular2LanguageService" value="2" />
|
||||
<entry key="TsLintLanguageService" value="2" />
|
||||
<entry key="TypeScriptServerServiceImpl" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="html" value="215" />
|
||||
<entry key="js" value="4" />
|
||||
<entry key="json" value="374" />
|
||||
<entry key="ts" value="552" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="HTML" value="215" />
|
||||
<entry key="JSON" value="342" />
|
||||
<entry key="JavaScript" value="4" />
|
||||
<entry key="TypeScript" value="552" />
|
||||
<entry key="tsconfig" value="32" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="browserslist" value="1" />
|
||||
<entry key="css" value="2" />
|
||||
<entry key="html" value="2" />
|
||||
<entry key="js" value="5" />
|
||||
<entry key="json" value="16" />
|
||||
<entry key="md" value="1" />
|
||||
<entry key="ts" value="18" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="CSS" value="2" />
|
||||
<entry key="HTML" value="2" />
|
||||
<entry key="JSON" value="13" />
|
||||
<entry key="JavaScript" value="5" />
|
||||
<entry key="PLAIN_TEXT" value="2" />
|
||||
<entry key="TypeScript" value="18" />
|
||||
<entry key="tsconfig" value="3" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="375">
|
||||
<file leaf-file-name="ng2-fittext.directive.ts" pinned="false" current-in-tab="false">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/directives/ng2-fittext.directive.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="108">
|
||||
<caret line="6" column="0" lean-forward="false" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
||||
<folding />
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="32" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="32" />
|
||||
<folding>
|
||||
<element signature="e#0#170#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="README.md" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="2160">
|
||||
<caret line="120" column="9" lean-forward="false" selection-start-line="120" selection-start-column="9" selection-end-line="120" selection-end-column="9" />
|
||||
<folding />
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/app/ng2-fittext.directive.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="32" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="32" />
|
||||
<folding>
|
||||
<element signature="e#0#154#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="package.json" pinned="false" current-in-tab="false">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/ng2-fittext.module.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="272">
|
||||
<caret line="16" column="22" lean-forward="true" selection-start-line="16" selection-start-column="22" selection-end-line="16" selection-end-column="22" />
|
||||
<folding>
|
||||
<element signature="e#0#73#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/package.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="10" column="39" lean-forward="false" selection-start-line="10" selection-start-column="39" selection-end-line="10" selection-end-column="39" />
|
||||
<folding />
|
||||
<state relative-caret-position="306">
|
||||
<caret line="18" column="30" selection-start-line="18" selection-start-column="30" selection-end-line="18" selection-end-column="30" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="tslint.json" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/tslint.json">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/app/app.component.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-1116">
|
||||
<caret line="13" column="22" lean-forward="false" selection-start-line="13" selection-start-column="22" selection-end-line="13" selection-end-column="22" />
|
||||
<folding />
|
||||
<state>
|
||||
<folding>
|
||||
<element signature="n#style#0;n#div#0;n#!!top" expanded="true" />
|
||||
<element signature="n#style#0;n#div#1;n#!!top" expanded="true" />
|
||||
<element signature="n#style#0;n#input#0;n#div#1;n#!!top" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="package.json" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/dist/package.json">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/app/app.component.css">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/distPackage.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="10" column="38" lean-forward="false" selection-start-line="10" selection-start-column="38" selection-end-line="10" selection-end-column="38" />
|
||||
<folding />
|
||||
<state relative-caret-position="459">
|
||||
<caret line="27" column="1" selection-start-line="27" selection-start-column="1" selection-end-line="27" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="tsconfig.json" pinned="false" current-in-tab="false">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/tsconfig.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
<state relative-caret-position="357">
|
||||
<caret line="21" column="24" selection-start-line="21" selection-start-column="24" selection-end-line="21" selection-end-column="24" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/app/app.component.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="136">
|
||||
<caret line="8" column="56" selection-start-line="8" selection-start-column="56" selection-end-line="8" selection-end-column="56" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/app/app.module.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="136">
|
||||
<caret line="8" column="23" lean-forward="true" selection-start-line="8" selection-start-column="23" selection-end-line="8" selection-end-column="23" />
|
||||
<folding>
|
||||
<element signature="e#0#58#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>ng2</find>
|
||||
<find>Ng2</find>
|
||||
<find>NgxFittextD</find>
|
||||
<find>excl</find>
|
||||
<find>rxjs</find>
|
||||
<find>ElementRef</find>
|
||||
<find>rendere</find>
|
||||
<find>typesc</find>
|
||||
<find>modelT</find>
|
||||
<find>inline</find>
|
||||
<find>ngx</find>
|
||||
<find>Ngx</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>Ngx</replace>
|
||||
<replace>Nng2</replace>
|
||||
<replace>ng2</replace>
|
||||
<replace>ngx</replace>
|
||||
</replaceStrings>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/ng2-fittext.module.ts" />
|
||||
<option value="$PROJECT_DIR$/src/directives/ng2-fittext.directive.ts" />
|
||||
<option value="$PROJECT_DIR$/README.md" />
|
||||
<option value="$PROJECT_DIR$/src/directives/ngx-fittext.directive.spec.ts" />
|
||||
<option value="$PROJECT_DIR$/examples/dev/tsconfig.json" />
|
||||
<option value="$PROJECT_DIR$/examples/dev/node_modules/rxjs/internal/types.d.ts" />
|
||||
<option value="$PROJECT_DIR$/examples/dev/package.json" />
|
||||
<option value="$PROJECT_DIR$/src/ngx-fittext.module.ts" />
|
||||
<option value="$PROJECT_DIR$/examples/dev/src/app/app.component.ts" />
|
||||
<option value="$PROJECT_DIR$/tsconfig.json" />
|
||||
<option value="$PROJECT_DIR$/src/directives/ngx-fittext.directive.ts" />
|
||||
<option value="$PROJECT_DIR$/examples/dev/src/app/ngx-fittext.directive.ts" />
|
||||
<option value="$PROJECT_DIR$/rollup.config.js" />
|
||||
<option value="$PROJECT_DIR$/src/distPackage.json" />
|
||||
<option value="$PROJECT_DIR$/publishPackage.json" />
|
||||
<option value="$PROJECT_DIR$/package.json" />
|
||||
<option value="$PROJECT_DIR$/examples/dev/src/app/app.module.ts" />
|
||||
<option value="$PROJECT_DIR$/examples/dev/src/app/ng2-fittext.directive.ts" />
|
||||
<option value="$PROJECT_DIR$/examples/dev/src/app/app.component.html" />
|
||||
<option value="$PROJECT_DIR$/src/directives/ng2-fittext.directive.ts" />
|
||||
<option value="$PROJECT_DIR$/src/ng2-fittext.module.ts" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
|
@ -103,25 +272,23 @@
|
|||
<sorting>DEFINITION_ORDER</sorting>
|
||||
</component>
|
||||
<component name="NodeModulesDirectoryManager">
|
||||
<handled-path value="$PROJECT_DIR$/examples/dev/node_modules" />
|
||||
<handled-path value="$PROJECT_DIR$/node_modules" />
|
||||
</component>
|
||||
<component name="NodePackageJsonFileManager">
|
||||
<packageJsonPaths>
|
||||
<path value="$PROJECT_DIR$/examples/dev/package.json" />
|
||||
<path value="$PROJECT_DIR$/package.json" />
|
||||
</packageJsonPaths>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="285" />
|
||||
<option name="width" value="1598" />
|
||||
<option name="height" value="1038" />
|
||||
<option name="x" value="-1928" />
|
||||
<option name="y" value="-8" />
|
||||
<option name="width" value="1936" />
|
||||
<option name="height" value="1176" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
||||
<flattenPackages />
|
||||
<showMembers />
|
||||
<showModules />
|
||||
<showLibraryContents />
|
||||
<hideEmptyPackages />
|
||||
<abbreviatePackageNames />
|
||||
<autoscrollToSource />
|
||||
<autoscrollFromSource />
|
||||
<sortByType />
|
||||
<manualOrder />
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
|
|
@ -129,31 +296,78 @@
|
|||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="fittext" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="fittext" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="ngx-fittext" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="ngx-fittext" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="fittext" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="fittext" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="dist" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="ngx-fittext" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="ngx-fittext" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="examples" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ngx-fittext" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="ngx-fittext" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="examples" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="dev" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ngx-fittext" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="ngx-fittext" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="examples" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="dev" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ngx-fittext" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="ngx-fittext" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="examples" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="dev" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="app" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ngx-fittext" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="ngx-fittext" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="examples" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="dev" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="assets" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ngx-fittext" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="ngx-fittext" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ngx-fittext" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="ngx-fittext" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="directives" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="Scratches" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="settings.editor.selected.configurable" value="configurable.group.appearance" />
|
||||
<property name="HbShouldOpenHtmlAsHb" value="" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="nodejs_interpreter_path" value="C:/Program Files/nodejs/node" />
|
||||
<property name="HbShouldOpenHtmlAsHb" value="" />
|
||||
<property name="node.js.path.for.package.tslint" value="project" />
|
||||
<property name="node.js.detected.package.tslint" value="true" />
|
||||
<property name="node.js.selected.package.tslint" value="C:\Users\loke\Work\mylib\fittext2\node_modules\tslint" />
|
||||
<property name="node.js.path.for.package.tslint" value="project" />
|
||||
<property name="node.js.selected.package.tslint" value="C:\Users\Lorenzo\work\ngx-fittext\examples\dev\node_modules\tslint" />
|
||||
<property name="nodejs_interpreter_path" value="C:/Program Files/nodejs/node" />
|
||||
<property name="nodejs_package_manager_path" value="npm" />
|
||||
<property name="settings.editor.selected.configurable" value="configurable.group.appearance" />
|
||||
<property name="ts.external.directory.path" value="C:\Users\Lorenzo\work\ngx-fittext\node_modules\typescript\lib" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\Lorenzo\work\ngx-fittext" />
|
||||
<recent name="C:\Users\Lorenzo\work\ngx-fittext\examples\dev\src\app" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
|
|
@ -167,8 +381,8 @@
|
|||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ShelveChangesManager" show_recycled="false">
|
||||
<option name="remove_strategy" value="false" />
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
|
|
@ -180,165 +394,218 @@
|
|||
<workItem from="1510652993603" duration="653000" />
|
||||
<workItem from="1510654264215" duration="30000" />
|
||||
<workItem from="1510654729260" duration="423000" />
|
||||
<workItem from="1549319553054" duration="7284000" />
|
||||
<workItem from="1549327022612" duration="131000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="1106000" />
|
||||
<option name="totallyTimeSpent" value="8521000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-9" y="-9" width="1938" height="1048" extended-state="6" />
|
||||
<frame x="-1928" y="-8" width="1936" height="1176" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.20465362" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32915717" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="TypeScript" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.13277134" />
|
||||
<window_info id="Structure" order="1" weight="0.25" />
|
||||
<window_info id="npm" order="2" side_tool="true" />
|
||||
<window_info id="Favorites" order="3" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32917467" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.077735126" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="bottom" id="TypeScript" order="7" />
|
||||
<window_info anchor="bottom" id="Version Control" order="8" />
|
||||
<window_info anchor="bottom" id="Terminal" order="9" weight="0.22168906" />
|
||||
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Docker" order="11" show_stripe_button="false" />
|
||||
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
<option name="additionalRoots">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/node_modules/@angular/core" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager />
|
||||
<watches-manager />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/src/directives/ng2-fittext.directive.ts">
|
||||
<entry file="file://$PROJECT_DIR$/.erector" />
|
||||
<entry file="file://$PROJECT_DIR$/src/directives/ngx-fittext.directive.spec.ts" />
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/package-lock.json">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/package-lock.json">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/node_modules/rxjs/internal/types.d.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="108">
|
||||
<caret line="6" column="0" lean-forward="false" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
||||
<folding />
|
||||
<state relative-caret-position="671">
|
||||
<caret line="68" column="29" lean-forward="true" selection-start-line="68" selection-start-column="29" selection-end-line="68" selection-end-column="29" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="2160">
|
||||
<caret line="120" column="9" lean-forward="false" selection-start-line="120" selection-start-column="9" selection-end-line="120" selection-end-column="9" />
|
||||
<folding />
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/tsconfig.json">
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/angular.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/package.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="10" column="40" lean-forward="false" selection-start-line="10" selection-start-column="40" selection-end-line="10" selection-end-column="40" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/directives/ng2-fittext.directive.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="108">
|
||||
<caret line="6" column="0" lean-forward="false" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="2160">
|
||||
<caret line="120" column="9" lean-forward="false" selection-start-line="120" selection-start-column="9" selection-end-line="120" selection-end-column="9" />
|
||||
<folding />
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/tsconfig.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/package.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1332">
|
||||
<caret line="74" column="0" lean-forward="true" selection-start-line="74" selection-start-column="0" selection-end-line="74" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/ng2-fittext.module.ts" />
|
||||
<entry file="file://$PROJECT_DIR$/src/directives/ng2-fittext.directive.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="108">
|
||||
<caret line="6" column="0" lean-forward="false" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/tsconfig.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="2160">
|
||||
<caret line="120" column="9" lean-forward="false" selection-start-line="120" selection-start-column="9" selection-end-line="120" selection-end-column="9" />
|
||||
<folding />
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/package.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="10" column="39" lean-forward="false" selection-start-line="10" selection-start-column="39" selection-end-line="10" selection-end-column="39" />
|
||||
<folding />
|
||||
<state relative-caret-position="238">
|
||||
<caret line="26" column="14" selection-start-line="26" selection-start-column="14" selection-end-line="26" selection-end-column="14" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/tslint.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-1116">
|
||||
<caret line="13" column="22" lean-forward="false" selection-start-line="13" selection-start-column="22" selection-end-line="13" selection-end-column="22" />
|
||||
<folding />
|
||||
<state relative-caret-position="51">
|
||||
<caret line="15" column="31" lean-forward="true" selection-start-line="15" selection-start-column="31" selection-end-line="15" selection-end-column="31" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/dist/package.json">
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/tsconfig.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="10" column="38" lean-forward="false" selection-start-line="10" selection-start-column="38" selection-end-line="10" selection-end-column="38" />
|
||||
<folding />
|
||||
<state relative-caret-position="289">
|
||||
<caret line="17" column="5" selection-start-line="17" selection-start-column="5" selection-end-line="17" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/app/app.component.spec.ts" />
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/package.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="272">
|
||||
<caret line="16" column="30" selection-start-line="16" selection-start-column="30" selection-end-line="16" selection-end-column="30" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/browserslist">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/test.js" />
|
||||
<entry file="file://$PROJECT_DIR$/src/vendor.ts" />
|
||||
<entry file="file://$PROJECT_DIR$/src/index.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="17">
|
||||
<caret line="1" selection-start-line="1" selection-end-line="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/tsconfig.test.json" />
|
||||
<entry file="file://$PROJECT_DIR$/tsconfig.es5.json" />
|
||||
<entry file="file://$PROJECT_DIR$/karma.conf.js" />
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-918" />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/index.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="17">
|
||||
<caret line="1" selection-start-line="1" selection-end-line="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/node_modules/typescript/lib/lib.dom.d.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="339">
|
||||
<caret line="2413" column="4" selection-start-line="2413" selection-start-column="4" selection-end-line="2413" selection-end-column="4" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/rollup.config.js" />
|
||||
<entry file="file://$PROJECT_DIR$/dist/directives/ngx-fittext.directive.js" />
|
||||
<entry file="file://$PROJECT_DIR$/dist/package.json" />
|
||||
<entry file="file://$PROJECT_DIR$/publishPackage.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="340">
|
||||
<caret line="20" column="30" selection-start-line="20" selection-start-column="30" selection-end-line="20" selection-end-column="30" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/tsconfig.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="357">
|
||||
<caret line="21" column="24" selection-start-line="21" selection-start-column="24" selection-end-line="21" selection-end-column="24" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/package.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="306">
|
||||
<caret line="18" column="30" selection-start-line="18" selection-start-column="30" selection-end-line="18" selection-end-column="30" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/app/app.component.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="136">
|
||||
<caret line="8" column="56" selection-start-line="8" selection-start-column="56" selection-end-line="8" selection-end-column="56" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/app/app.component.css">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/app/ng2-fittext.directive.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="32" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="32" />
|
||||
<folding>
|
||||
<element signature="e#0#154#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/app/app.module.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="136">
|
||||
<caret line="8" column="23" lean-forward="true" selection-start-line="8" selection-start-column="23" selection-end-line="8" selection-end-column="23" />
|
||||
<folding>
|
||||
<element signature="e#0#58#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/dev/src/app/app.component.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state>
|
||||
<folding>
|
||||
<element signature="n#style#0;n#div#0;n#!!top" expanded="true" />
|
||||
<element signature="n#style#0;n#div#1;n#!!top" expanded="true" />
|
||||
<element signature="n#style#0;n#input#0;n#div#1;n#!!top" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/directives/ng2-fittext.directive.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="32" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="32" />
|
||||
<folding>
|
||||
<element signature="e#0#170#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/distPackage.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="459">
|
||||
<caret line="27" column="1" selection-start-line="27" selection-start-column="1" selection-end-line="27" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/ng2-fittext.module.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="272">
|
||||
<caret line="16" column="22" lean-forward="true" selection-start-line="16" selection-start-column="22" selection-end-line="16" selection-end-column="22" />
|
||||
<folding>
|
||||
<element signature="e#0#73#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
|
|
|||
120
DEVELOPMENT.md
120
DEVELOPMENT.md
|
|
@ -1,120 +0,0 @@
|
|||
# Developing Ng2 Fittext
|
||||
|
||||
## Tasks
|
||||
|
||||
The following commands are available through `npm run` (or, if configured
|
||||
`ngl`):
|
||||
|
||||
Command | Purpose
|
||||
--- | ---
|
||||
build | Runs code through build process via Angular compiler (ngc)
|
||||
g | Generate code files (see above)
|
||||
lint | Verify code matches linting rules
|
||||
start | Run Webpack's dev-server on project (can be run as `npm start`)
|
||||
[test](#unit) | Execute unit tests (can be run as `npm test <type>`)
|
||||
tagVersion | Creates tag for new version and publishes
|
||||
|
||||
## Adding External Scripts
|
||||
|
||||
To add an external script, add it with a `script-loader!` prefix to the
|
||||
`scripts` array of `entry` in `webpack/webpack.dev.js` (for the dev server)
|
||||
and add it to the files array of `karma.conf.js` (for testing).
|
||||
|
||||
An example, adding the file at `node_modules/ext-dep/dist/dep.min.js`:
|
||||
|
||||
```javascript
|
||||
/** webpack.dev.js **/
|
||||
module.exports = {
|
||||
// other config
|
||||
entry: {
|
||||
app: [ path.resolve(rootDir, 'examples', 'example.main') ],
|
||||
scripts: [
|
||||
// this is the external script line
|
||||
'script-loader!' + path.resolve(rootDir, 'node_modules/ext-dep/dep.min')
|
||||
],
|
||||
vendor: [ path.resolve(rootDir, 'src', 'vendor')],
|
||||
styles: [ path.resolve(rootDir, 'examples', 'styles.scss') ]
|
||||
},
|
||||
// rest of config
|
||||
};
|
||||
|
||||
/** karma.conf.js **/
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine'],
|
||||
files: [
|
||||
// this is the external script line
|
||||
'node_modules/hammerjs/hammer.min.js',
|
||||
{ pattern: './src/test.js', watched: false }
|
||||
],
|
||||
// rest of config
|
||||
});
|
||||
};
|
||||
```
|
||||
|
||||
## <a name="unit"></a>Unit Testing
|
||||
|
||||
Unit testing is done using Karma and Webpack. The setup is all done during the `initialize` command.
|
||||
The provided testing commands will watch your files for changes.
|
||||
|
||||
The two following command is provided by default:
|
||||
|
||||
```shell
|
||||
npm test <type>
|
||||
```
|
||||
|
||||
This command calls the script at `tasks/test.js` and runs the Karma test runner to execute the tests.
|
||||
Prior to running Karma, the `test` command looks for a command line argument, if the argument is known,
|
||||
it will run the associated configuration, otherwise it will run the default configuration.
|
||||
|
||||
#### Configurations
|
||||
|
||||
Type | Testing TypeScript
|
||||
--- | ---
|
||||
default | Run through PhantomJS one time with no file watching
|
||||
all | Run through Chrome & PhantomJS with files being watched & tests automatically re-run
|
||||
headless| Run through PhantomJS with files being watched & tests automatically re-run
|
||||
watch | Run through Chrome with files being watched & tests automatically re-run
|
||||
|
||||
Note that Chrome still requires a manual refresh on the Debug tab to see updated test results.
|
||||
|
||||
## <a name="pack"></a>Packaging
|
||||
|
||||
Packaging is as simple as publishing to NPM by doing
|
||||
|
||||
```shell
|
||||
npm run tagVersion
|
||||
```
|
||||
|
||||
To test your packages output before publishing, you can run
|
||||
|
||||
```shell
|
||||
npm pack
|
||||
```
|
||||
|
||||
Which will generate a compressed file containing your library as it will look when packaged up and
|
||||
published to NPM. The basic structure of a published library is:
|
||||
|
||||
```
|
||||
|__bundles/
|
||||
|__ng2-fittext.umd.js
|
||||
|__ng2-fittext.umd.js.map
|
||||
|__ng2-fittext.umd.min.js
|
||||
|__ng2-fittext.bundle.min.js.map
|
||||
|__index.d.ts
|
||||
|__package.json
|
||||
|__README.md
|
||||
|__*.d.ts
|
||||
|__ng2-fittext.d.ts
|
||||
|__ng2-fittext.module.d.ts
|
||||
|__ng2-fittext.es5.js
|
||||
|__ng2-fittext.es5.js.map
|
||||
|__ng2-fittext.js
|
||||
|__ng2-fittext.js.map
|
||||
|__ng2-fittext.metadata.json
|
||||
```
|
||||
|
||||
As you can see, the packaging removes any files specific to developing your
|
||||
library. It, more importantly, creates distribution files for usage with many
|
||||
different module systems.
|
||||
|
|
@ -31,7 +31,7 @@ Import it in your Angular2 project like a module
|
|||
|
||||
```
|
||||
|
||||
2) Use it in your components
|
||||
2) Use it in your componentsgit
|
||||
|
||||
Fit with specified container (can be the parent or a deeper ancestor)
|
||||
```sh
|
||||
|
|
|
|||
13
examples/dev/.editorconfig
Normal file
13
examples/dev/.editorconfig
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Editor configuration, see http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
39
examples/dev/.gitignore
vendored
Normal file
39
examples/dev/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# IDE - VSCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
# misc
|
||||
/.sass-cache
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
27
examples/dev/README.md
Normal file
27
examples/dev/README.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Dev
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.0.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
||||
122
examples/dev/angular.json
Normal file
122
examples/dev/angular.json
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"dev": {
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"projectType": "application",
|
||||
"prefix": "app",
|
||||
"schematics": {},
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "dist/dev",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "src/tsconfig.app.json",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.css"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
],
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"extractCss": true,
|
||||
"namedChunks": false,
|
||||
"aot": true,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false,
|
||||
"buildOptimizer": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"options": {
|
||||
"browserTarget": "dev:build"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "dev:build:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "dev:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "src/test.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "src/tsconfig.spec.json",
|
||||
"karmaConfig": "src/karma.conf.js",
|
||||
"styles": [
|
||||
"styles.css"
|
||||
],
|
||||
"scripts": [],
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"src/tsconfig.app.json",
|
||||
"src/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dev-e2e": {
|
||||
"root": "e2e/",
|
||||
"projectType": "application",
|
||||
"architect": {
|
||||
"e2e": {
|
||||
"builder": "@angular-devkit/build-angular:protractor",
|
||||
"options": {
|
||||
"protractorConfig": "e2e/protractor.conf.js",
|
||||
"devServerTarget": "dev:serve"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": "e2e/tsconfig.e2e.json",
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "dev"
|
||||
}
|
||||
28
examples/dev/e2e/protractor.conf.js
Normal file
28
examples/dev/e2e/protractor.conf.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// Protractor configuration file, see link for more information
|
||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||
|
||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
||||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
specs: [
|
||||
'./src/**/*.e2e-spec.ts'
|
||||
],
|
||||
capabilities: {
|
||||
'browserName': 'chrome'
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:4200/',
|
||||
framework: 'jasmine',
|
||||
jasmineNodeOpts: {
|
||||
showColors: true,
|
||||
defaultTimeoutInterval: 30000,
|
||||
print: function() {}
|
||||
},
|
||||
onPrepare() {
|
||||
require('ts-node').register({
|
||||
project: require('path').join(__dirname, './tsconfig.e2e.json')
|
||||
});
|
||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
||||
}
|
||||
};
|
||||
14
examples/dev/e2e/src/app.e2e-spec.ts
Normal file
14
examples/dev/e2e/src/app.e2e-spec.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { AppPage } from './app.po';
|
||||
|
||||
describe('workspace-project App', () => {
|
||||
let page: AppPage;
|
||||
|
||||
beforeEach(() => {
|
||||
page = new AppPage();
|
||||
});
|
||||
|
||||
it('should display welcome message', () => {
|
||||
page.navigateTo();
|
||||
expect(page.getParagraphText()).toEqual('Welcome to app!');
|
||||
});
|
||||
});
|
||||
11
examples/dev/e2e/src/app.po.ts
Normal file
11
examples/dev/e2e/src/app.po.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { browser, by, element } from 'protractor';
|
||||
|
||||
export class AppPage {
|
||||
navigateTo() {
|
||||
return browser.get('/');
|
||||
}
|
||||
|
||||
getParagraphText() {
|
||||
return element(by.css('app-root h1')).getText();
|
||||
}
|
||||
}
|
||||
13
examples/dev/e2e/tsconfig.e2e.json
Normal file
13
examples/dev/e2e/tsconfig.e2e.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"jasminewd2",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
||||
10491
examples/dev/package-lock.json
generated
Normal file
10491
examples/dev/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
47
examples/dev/package.json
Normal file
47
examples/dev/package.json
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"name": "dev",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^6.0.0",
|
||||
"@angular/common": "^6.0.0",
|
||||
"@angular/compiler": "^6.0.0",
|
||||
"@angular/core": "^6.0.0",
|
||||
"@angular/forms": "^6.0.0",
|
||||
"@angular/http": "^6.0.0",
|
||||
"@angular/platform-browser": "^6.0.0",
|
||||
"@angular/platform-browser-dynamic": "^6.0.0",
|
||||
"@angular/router": "^6.0.0",
|
||||
"core-js": "^2.5.4",
|
||||
"zone.js": "^0.8.26"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/compiler-cli": "^6.0.0",
|
||||
"@angular-devkit/build-angular": "~0.6.0",
|
||||
"typescript": "^2.7.2",
|
||||
"@angular/cli": "~6.0.0",
|
||||
"@angular/language-service": "^6.0.0",
|
||||
"@types/jasmine": "~2.8.6",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
"@types/node": "~8.9.4",
|
||||
"codelyzer": "~4.2.1",
|
||||
"jasmine-core": "~2.99.1",
|
||||
"jasmine-spec-reporter": "~4.2.1",
|
||||
"karma": "~1.7.1",
|
||||
"karma-chrome-launcher": "~2.2.0",
|
||||
"karma-coverage-istanbul-reporter": "~1.4.2",
|
||||
"karma-jasmine": "~1.1.1",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"protractor": "~5.3.0",
|
||||
"ts-node": "~5.0.1",
|
||||
"tslint": "~5.9.1"
|
||||
}
|
||||
}
|
||||
13
examples/dev/src/app/app.component.html
Normal file
13
examples/dev/src/app/app.component.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<div style="border: 2px solid; overflow:hidden; width:100%; height:300px; font-size:520px;">
|
||||
<div [fittext]="true"
|
||||
[modelToWatch]="title"
|
||||
[activateOnResize]="true"
|
||||
[useMaxFontSize]="true">{{title}}</div>
|
||||
</div>
|
||||
|
||||
<button (click)="click('add')"> ADD text</button>
|
||||
<button (click)="click('remove')"> REMOVE text</button>
|
||||
|
||||
<div #cont2 style="border: 2px solid; height:101px; width:20%;">
|
||||
<input [fittext]="true" style="width:100%; height:100px" [activateOnResize]="true" [activateOnInputEvents]="true" [container]="cont2">
|
||||
</div>
|
||||
15
examples/dev/src/app/app.component.ts
Normal file
15
examples/dev/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
examples/dev/src/app/app.module.ts
Normal file
17
examples/dev/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 {Ng2FittextDirective} from './ng2-fittext.directive';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
Ng2FittextDirective
|
||||
],
|
||||
imports: [
|
||||
BrowserModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
155
examples/dev/src/app/ng2-fittext.directive.ts
Normal file
155
examples/dev/src/app/ng2-fittext.directive.ts
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
import {
|
||||
AfterViewChecked,
|
||||
AfterViewInit,
|
||||
Directive,
|
||||
ElementRef, HostListener,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnInit,
|
||||
Renderer2
|
||||
} from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: '[fittext]'
|
||||
})
|
||||
export class Ng2FittextDirective implements AfterViewInit, OnInit, OnChanges, AfterViewChecked {
|
||||
|
||||
@Input('fittext') fittext: any;
|
||||
@Input('activateOnResize') activateOnResize: boolean;
|
||||
@Input('container') container: HTMLElement;
|
||||
@Input('activateOnInputEvents') activateOnInputEvents: boolean;
|
||||
@Input('useMaxFontSize') useMaxFontSize: boolean;
|
||||
@Input('minFontSize') minFontSize = 7;
|
||||
@Input('modelToWatch') modelToWatch: any;
|
||||
private maxFontSize = 1000;
|
||||
private fontSize = 1000;
|
||||
private speed = 1.05;
|
||||
private done = false;
|
||||
|
||||
constructor(public el: ElementRef,
|
||||
public renderer: Renderer2) {}
|
||||
|
||||
setFontSize(fontSize: number) {
|
||||
if (this.isVisible() && !this.done) {
|
||||
if (fontSize < this.minFontSize) {
|
||||
// force that font size will never be lower than minimal allowed font size
|
||||
fontSize = this.minFontSize;
|
||||
}
|
||||
|
||||
this.fontSize = fontSize;
|
||||
return this.el.nativeElement.style.setProperty('font-size', (fontSize).toString() + 'px');
|
||||
}
|
||||
}
|
||||
|
||||
calculateFontSize(fontSize: number, speed: number) {
|
||||
// TODO Do with Gauss
|
||||
return Math.floor(fontSize / speed);
|
||||
}
|
||||
|
||||
checkOverflow(parent: any, children: any) {
|
||||
const overflowX = children.scrollWidth - parent.clientWidth;
|
||||
const overflowY = children.clientHeight - parent.clientHeight;
|
||||
return (overflowX > 1 || overflowY > 1);
|
||||
}
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
onResize() {
|
||||
this.done = false;
|
||||
if (this.activateOnResize && this.fittext) {
|
||||
if (this.activateOnInputEvents && this.fittext) {
|
||||
this.setFontSize(this.getStartFontSizeFromHeight());
|
||||
} else {
|
||||
this.setFontSize(this.getStartFontSizeFromWeight());
|
||||
}
|
||||
|
||||
this.ngAfterViewInit();
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('input', ['$event'])
|
||||
onInputEvents() {
|
||||
this.done = false;
|
||||
if (this.activateOnInputEvents && this.fittext) {
|
||||
this.setFontSize(this.getStartFontSizeFromHeight());
|
||||
this.ngAfterViewInit();
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.done = false;
|
||||
if (this.useMaxFontSize) {
|
||||
const fontSize = this.getComputetStyle().fontSize;
|
||||
if (fontSize) {
|
||||
this.maxFontSize = parseInt(fontSize, undefined);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.fittext) {
|
||||
this.setFontSize(this.maxFontSize);
|
||||
}
|
||||
|
||||
this.el.nativeElement.style.setProperty('will-change', 'content');
|
||||
this.ngAfterViewInit();
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
if (this.isVisible() && !this.done) {
|
||||
if (this.fittext) {
|
||||
const overflow = this.container ? this.checkOverflow(this.container, this.el.nativeElement)
|
||||
: this.checkOverflow(this.el.nativeElement.parentElement, this.el.nativeElement);
|
||||
if (overflow) {
|
||||
if (this.fontSize > this.minFontSize) {
|
||||
// iterate only until font size is bigger than minimal value
|
||||
this.setFontSize(this.calculateFontSize(this.fontSize, this.speed));
|
||||
this.ngAfterViewInit();
|
||||
}
|
||||
} else {
|
||||
if (this.useMaxFontSize) {
|
||||
if (this.fontSize > this.maxFontSize) {
|
||||
const fontSize = this.getComputetStyle().fontSize;
|
||||
if (fontSize) {
|
||||
this.maxFontSize = parseInt(fontSize, undefined);
|
||||
this.setFontSize(this.maxFontSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: any): void {
|
||||
if (changes.modelToWatch) {
|
||||
// change of model to watch - call ngAfterViewInit where is implemented logic to change size
|
||||
setTimeout(() => {
|
||||
this.done = false;
|
||||
this.setFontSize(this.maxFontSize);
|
||||
this.ngAfterViewInit();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewChecked() {
|
||||
if (this.fontSize > this.minFontSize) {
|
||||
this.setFontSize(this.getStartFontSizeFromHeight());
|
||||
this.ngAfterViewInit();
|
||||
}
|
||||
}
|
||||
|
||||
private getComputetStyle(): CSSStyleDeclaration {
|
||||
return window.getComputedStyle(this.container ? this.container : this.el.nativeElement.parentElement);
|
||||
}
|
||||
|
||||
private getStartFontSizeFromHeight(): number {
|
||||
return this.container ? this.container.clientHeight : this.el.nativeElement.parentElement.clientHeight;
|
||||
}
|
||||
|
||||
private getStartFontSizeFromWeight(): number {
|
||||
return this.container ? this.container.clientWidth : this.el.nativeElement.parentElement.clientWidth;
|
||||
}
|
||||
|
||||
private isVisible(): boolean {
|
||||
return this.getStartFontSizeFromHeight() > 0;
|
||||
}
|
||||
}
|
||||
9
examples/dev/src/browserslist
Normal file
9
examples/dev/src/browserslist
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
# For IE 9-11 support, please uncomment the last line of the file and adjust as needed
|
||||
> 0.5%
|
||||
last 2 versions
|
||||
Firefox ESR
|
||||
not dead
|
||||
# IE 9-11
|
||||
3
examples/dev/src/environments/environment.prod.ts
Normal file
3
examples/dev/src/environments/environment.prod.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export const environment = {
|
||||
production: true
|
||||
};
|
||||
15
examples/dev/src/environments/environment.ts
Normal file
15
examples/dev/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
examples/dev/src/favicon.ico
Normal file
BIN
examples/dev/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
14
examples/dev/src/index.html
Normal file
14
examples/dev/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>
|
||||
31
examples/dev/src/karma.conf.js
Normal file
31
examples/dev/src/karma.conf.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client: {
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
dir: require('path').join(__dirname, '../coverage'),
|
||||
reports: ['html', 'lcovonly'],
|
||||
fixWebpackSourcePaths: true
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false
|
||||
});
|
||||
};
|
||||
12
examples/dev/src/main.ts
Normal file
12
examples/dev/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));
|
||||
80
examples/dev/src/polyfills.ts
Normal file
80
examples/dev/src/polyfills.ts
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* 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/docs/ts/latest/guide/browser-support.html
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
||||
// import 'core-js/es6/symbol';
|
||||
// import 'core-js/es6/object';
|
||||
// import 'core-js/es6/function';
|
||||
// import 'core-js/es6/parse-int';
|
||||
// import 'core-js/es6/parse-float';
|
||||
// import 'core-js/es6/number';
|
||||
// import 'core-js/es6/math';
|
||||
// import 'core-js/es6/string';
|
||||
// import 'core-js/es6/date';
|
||||
// import 'core-js/es6/array';
|
||||
// import 'core-js/es6/regexp';
|
||||
// import 'core-js/es6/map';
|
||||
// import 'core-js/es6/weak-map';
|
||||
// import 'core-js/es6/set';
|
||||
|
||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||
|
||||
/** IE10 and IE11 requires the following for the Reflect API. */
|
||||
// import 'core-js/es6/reflect';
|
||||
|
||||
|
||||
/** Evergreen browsers require these. **/
|
||||
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
|
||||
import 'core-js/es7/reflect';
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
// (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__BLACK_LISTED_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
examples/dev/src/styles.css
Normal file
1
examples/dev/src/styles.css
Normal file
|
|
@ -0,0 +1 @@
|
|||
/* You can add global styles to this file, and also import other style files */
|
||||
20
examples/dev/src/test.ts
Normal file
20
examples/dev/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);
|
||||
12
examples/dev/src/tsconfig.app.json
Normal file
12
examples/dev/src/tsconfig.app.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"module": "es2015",
|
||||
"types": []
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
19
examples/dev/src/tsconfig.spec.json
Normal file
19
examples/dev/src/tsconfig.spec.json
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/spec",
|
||||
"module": "commonjs",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"test.ts",
|
||||
"polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
||||
17
examples/dev/src/tslint.json
Normal file
17
examples/dev/src/tslint.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"app",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"app",
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
||||
20
examples/dev/tsconfig.json
Normal file
20
examples/dev/tsconfig.json
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "es5",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
]
|
||||
}
|
||||
}
|
||||
130
examples/dev/tslint.json
Normal file
130
examples/dev/tslint.json
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
{
|
||||
"rulesDirectory": [
|
||||
"node_modules/codelyzer"
|
||||
],
|
||||
"rules": {
|
||||
"arrow-return-shorthand": true,
|
||||
"callable-types": true,
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
"check-space"
|
||||
],
|
||||
"curly": true,
|
||||
"deprecation": {
|
||||
"severity": "warn"
|
||||
},
|
||||
"eofline": true,
|
||||
"forin": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs/Rx"
|
||||
],
|
||||
"import-spacing": true,
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"interface-over-type-literal": true,
|
||||
"label-position": true,
|
||||
"max-line-length": [
|
||||
true,
|
||||
140
|
||||
],
|
||||
"member-access": false,
|
||||
"member-ordering": [
|
||||
true,
|
||||
{
|
||||
"order": [
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"static-method",
|
||||
"instance-method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-arg": true,
|
||||
"no-bitwise": true,
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-construct": true,
|
||||
"no-debugger": true,
|
||||
"no-duplicate-super": true,
|
||||
"no-empty": false,
|
||||
"no-empty-interface": true,
|
||||
"no-eval": true,
|
||||
"no-inferrable-types": [
|
||||
true,
|
||||
"ignore-params"
|
||||
],
|
||||
"no-misused-new": true,
|
||||
"no-non-null-assertion": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-string-literal": false,
|
||||
"no-string-throw": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unnecessary-initializer": true,
|
||||
"no-unused-expression": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-keyword": true,
|
||||
"object-literal-sort-keys": false,
|
||||
"one-line": [
|
||||
true,
|
||||
"check-open-brace",
|
||||
"check-catch",
|
||||
"check-else",
|
||||
"check-whitespace"
|
||||
],
|
||||
"prefer-const": true,
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"radix": true,
|
||||
"semicolon": [
|
||||
true,
|
||||
"always"
|
||||
],
|
||||
"triple-equals": [
|
||||
true,
|
||||
"allow-null-check"
|
||||
],
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}
|
||||
],
|
||||
"unified-signatures": true,
|
||||
"variable-name": false,
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type"
|
||||
],
|
||||
"no-output-on-prefix": true,
|
||||
"use-input-property-decorator": true,
|
||||
"use-output-property-decorator": true,
|
||||
"use-host-property-decorator": true,
|
||||
"no-input-rename": true,
|
||||
"no-output-rename": true,
|
||||
"use-life-cycle-interface": true,
|
||||
"use-pipe-transform-interface": true,
|
||||
"component-class-suffix": true,
|
||||
"directive-class-suffix": true
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'example-root',
|
||||
templateUrl: './example.component.html',
|
||||
styleUrls: []
|
||||
})
|
||||
export class ExampleComponent { }
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { ExampleModule } from './example.module';
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(ExampleModule);
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { ExampleComponent } from './example.component';
|
||||
import { Ng2FittextModule } from '../index';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
ExampleComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
Ng2FittextModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [ExampleComponent]
|
||||
})
|
||||
export class ExampleModule { }
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Ng2FittextModule Tutorial</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<example-root>Loading...</example-root>
|
||||
</body>
|
||||
</html>
|
||||
113
karma.conf.js
113
karma.conf.js
|
|
@ -1,113 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const erectorUtils = require('erector-set/src/utils');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = function (config) {
|
||||
const base = {
|
||||
basePath: '',
|
||||
frameworks: ['jasmine'],
|
||||
files: [
|
||||
{ pattern: './src/test.js', watched: false }
|
||||
],
|
||||
mime: {
|
||||
'text/x-typescript': ['ts','tsx']
|
||||
},
|
||||
plugins: [
|
||||
'karma-chrome-launcher',
|
||||
'karma-jasmine',
|
||||
'karma-phantomjs-launcher',
|
||||
'karma-coverage-istanbul-reporter',
|
||||
'karma-sourcemap-loader',
|
||||
'karma-webpack'
|
||||
],
|
||||
preprocessors: {
|
||||
'./src/test.js': ['webpack', 'sourcemap']
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
dir: './coverage',
|
||||
fixWebpackSourcePaths: true,
|
||||
reports: ['html', 'lcovonly']
|
||||
},
|
||||
reporters: ['progress', 'coverage-istanbul'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome', 'PhantomJS'],
|
||||
singleRun: false,
|
||||
webpackServer: { noInfo: true }
|
||||
};
|
||||
const fullConfig = mergeCustomConfig(base, config);
|
||||
|
||||
config.set(fullConfig);
|
||||
};
|
||||
|
||||
const mergeCustomConfig = (base, karmaConfig) => {
|
||||
const customConfigPath = path.resolve(
|
||||
__dirname,
|
||||
'configs',
|
||||
'karma.conf.js'
|
||||
);
|
||||
let fullConfig = base;
|
||||
|
||||
if (fs.existsSync(customConfigPath)) {
|
||||
fullConfig = mergeConfigs(base, require(customConfigPath), karmaConfig);
|
||||
}
|
||||
|
||||
return fullConfig;
|
||||
};
|
||||
|
||||
const mergeConfigs = (base, custom, karmaConfig) => {
|
||||
let mergedConfig = base;
|
||||
|
||||
if (erectorUtils.checkIsType(custom, 'function')) {
|
||||
custom = custom(karmaConfig);
|
||||
}
|
||||
|
||||
if (custom) {
|
||||
const arrays = mergeConfigArrays(base, custom);
|
||||
const objects = mergeConfigObjects(base, custom);
|
||||
const primitives = mergeConfigPrimitives(base, custom);
|
||||
const customAttributes = Object.assign({}, arrays, objects, primitives);
|
||||
|
||||
mergedConfig = Object.assign(
|
||||
{}, base, customAttributes
|
||||
);
|
||||
}
|
||||
|
||||
return mergedConfig;
|
||||
};
|
||||
|
||||
const mergeConfigArrays = (base, custom) => {
|
||||
const attributes = ['browsers', 'files', 'plugins', 'reporters'];
|
||||
return mergeConfigAttributes(base, custom, attributes, (baseAttribute, customAttribute) =>
|
||||
erectorUtils.mergeDeep(baseAttribute, customAttribute)
|
||||
);
|
||||
};
|
||||
|
||||
const mergeConfigObjects = (base, custom) => {
|
||||
const attributes = ['preprocessors'];
|
||||
return mergeConfigAttributes(base, custom, attributes, (baseAttribute, customAttribute) =>
|
||||
Object.assign(customAttribute, baseAttribute)
|
||||
);
|
||||
};
|
||||
|
||||
const mergeConfigPrimitives = (base, custom) => {
|
||||
const attributes = ['color', 'logLevel', 'port'];
|
||||
|
||||
return mergeConfigAttributes(base, custom, attributes, (baseAttribute, customAttribute) =>
|
||||
customAttribute
|
||||
);
|
||||
};
|
||||
|
||||
const mergeConfigAttributes = (base, custom, attributes, callback) => {
|
||||
return attributes.reduce((config, attribute) => {
|
||||
if (attribute in custom) {
|
||||
config[attribute] = callback(base[attribute], custom[attribute]);
|
||||
}
|
||||
|
||||
return config;
|
||||
}, {});
|
||||
};
|
||||
10484
package-lock.json
generated
Normal file
10484
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
100
package.json
100
package.json
|
|
@ -1,83 +1,49 @@
|
|||
{
|
||||
"name": "ng2-fittext",
|
||||
"version": "1.1.1",
|
||||
"name": "ng-fittext",
|
||||
"version": "1.2.0",
|
||||
"description": "Ng2 Fittext, an Angular library",
|
||||
"main": "./bundles/ng2-fittext.umd.js",
|
||||
"module": "./ng2-fittext.es5.js",
|
||||
"es2015": "./ng2-fittext.js",
|
||||
"typings": "./ng2-fittext.d.ts",
|
||||
"scripts": {
|
||||
"build": "node ./tasks/build",
|
||||
"g": "node ./node_modules/angular-librarian",
|
||||
"lint": "tslint ./src/**/*.ts",
|
||||
"postbuild": "rimraf build",
|
||||
"posttagVersion": "npm run build && npm publish dist",
|
||||
"prebuild": "rimraf dist out-tsc",
|
||||
"start": "webpack-dev-server --open --config ./webpack/webpack.dev.js",
|
||||
"tagVersion": "np --no-publish",
|
||||
"test": "node ./tasks/test"
|
||||
"transpile": "ngc",
|
||||
"build": "npm run transpile",
|
||||
"publish": "npm run build && cp publishPackage.json ./dist/package.json && cd dist && npm publish --access=public"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"author": "Lorenzo Iovino",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@angular/common": ">=4.0.0 || <6.0.0",
|
||||
"@angular/compiler": ">=4.0.0 || <6.0.0",
|
||||
"@angular/core": ">=4.0.0 || <6.0.0",
|
||||
"@angular/platform-browser": ">=4.0.0 || <6.0.0",
|
||||
"@angular/platform-browser-dynamic": ">=4.0.0 || <6.0.0",
|
||||
"@angular/common": "^6.0.0",
|
||||
"@angular/core": "^6.0.0",
|
||||
"@angular/platform-browser": "^6.0.0",
|
||||
"@angular/platform-browser-dynamic": "^6.0.0",
|
||||
"core-js": "^2.4.1",
|
||||
"rxjs": "^5.0.1",
|
||||
"zone.js": "0.8.12"
|
||||
"rxjs": "6.0.0",
|
||||
"zone.js": "0.8.29"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/compiler-cli": ">=4.0.0 || <6.0.0",
|
||||
"@types/jasmine": "2.5.38",
|
||||
"@types/node": "^6.0.42",
|
||||
"angular-librarian": "1.0.0-beta.14",
|
||||
"angular2-template-loader": "0.6.0",
|
||||
"awesome-typescript-loader": "^3.0.0",
|
||||
"codelyzer": "~3.0.0",
|
||||
"css-loader": "^0.26.1",
|
||||
"css-to-string-loader": "^0.1.3",
|
||||
"extract-text-webpack-plugin": "^2.1.0",
|
||||
"file-loader": "^0.8.5",
|
||||
"fs-extra": "^2.1.2",
|
||||
"html-webpack-plugin": "^2.19.0",
|
||||
"istanbul-instrumenter-loader": "^1.2.0",
|
||||
"jasmine-core": "2.5.2",
|
||||
"jasmine-spec-reporter": "2.5.0",
|
||||
"karma": "1.2.0",
|
||||
"karma-chrome-launcher": "^2.0.0",
|
||||
"karma-coverage-istanbul-reporter": "^1.3.0",
|
||||
"karma-jasmine": "^1.0.2",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^2.0.0",
|
||||
"node-sass": "^4.1.1",
|
||||
"np": "^2.12.0",
|
||||
"phantomjs-prebuilt": "^2.1.7",
|
||||
"raw-loader": "^0.5.1",
|
||||
"rimraf": "^2.5.3",
|
||||
"rollup": "0.43.0",
|
||||
"rollup-plugin-commonjs": "^8.0.2",
|
||||
"rollup-plugin-node-resolve": "3.0.0",
|
||||
"rollup-plugin-sourcemaps": "0.4.2",
|
||||
"rollup-plugin-uglify": "2.0.1",
|
||||
"sass-loader": "^4.0.1",
|
||||
"script-loader": "^0.7.0",
|
||||
"semver": "5.3.0",
|
||||
"source-map-loader": "^0.1.5",
|
||||
"style-loader": "^0.13.1",
|
||||
"tslint": "^5.0.0",
|
||||
"tslint-loader": "^3.0.0",
|
||||
"typescript": "~2.2.1",
|
||||
"typings": "^0.8.1",
|
||||
"url-loader": "^0.5.7",
|
||||
"webpack": "^2.2.0",
|
||||
"webpack-dev-server": "^2.2.0",
|
||||
"webpack-merge": "^0.14.0",
|
||||
"webpack-node-externals": "^1.5.4"
|
||||
"@angular-devkit/build-angular": "~0.6.0",
|
||||
"@angular/cli": "~6.0.0",
|
||||
"@angular/compiler": "^6.1.10",
|
||||
"@angular/compiler-cli": "^6.1.10",
|
||||
"@angular/language-service": "^6.0.0",
|
||||
"@types/jasmine": "~2.8.6",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
"@types/node": "~8.9.4",
|
||||
"codelyzer": "~4.2.1",
|
||||
"jasmine-core": "~2.99.1",
|
||||
"jasmine-spec-reporter": "~4.2.1",
|
||||
"karma": "~1.7.1",
|
||||
"karma-chrome-launcher": "~2.2.0",
|
||||
"karma-coverage-istanbul-reporter": "~1.4.2",
|
||||
"karma-jasmine": "~1.1.1",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"protractor": "~5.3.0",
|
||||
"ts-node": "~5.0.1",
|
||||
"tslint": "~5.9.1",
|
||||
"typescript": "^2.9.2"
|
||||
},
|
||||
"repository": {
|
||||
"url": "https://github.com/lokenxo/ng2-fittext.git"
|
||||
|
|
|
|||
23
publishPackage.json
Normal file
23
publishPackage.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "ng2-fittext",
|
||||
"version": "1.2.0",
|
||||
"description": "Ng2 Fittext, an Angular library",
|
||||
"main": "./bundles/ng2-fittext.umd.js",
|
||||
"module": "./ng2-fittext.es5.js",
|
||||
"es2015": "./ng2-fittext.js",
|
||||
"typings": "./ng2-fittext.d.ts",
|
||||
"keywords": [
|
||||
"ng2-fittext",
|
||||
"ng2-fittext",
|
||||
"fittext",
|
||||
"angular",
|
||||
"angular 2",
|
||||
"fit text",
|
||||
"responsive text"
|
||||
],
|
||||
"author": "Lorenzo Iovino",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"url": "https://github.com/lokenxo/ng2-fittext.git"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
/* tslint:disable:no-unused-variable */
|
||||
import {
|
||||
async,
|
||||
TestBed
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { Ng2FittextDirective } from './ng2-fittext.directive';
|
||||
|
||||
describe('Ng2FittextDirective', () => {
|
||||
it('', () => {
|
||||
const directive = new Ng2FittextDirective();
|
||||
|
||||
expect(directive).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -1,4 +1,13 @@
|
|||
import {Directive, ElementRef, Renderer, Input, AfterViewInit, AfterViewChecked, HostListener, OnInit, OnChanges} from '@angular/core';
|
||||
import {
|
||||
AfterViewChecked,
|
||||
AfterViewInit,
|
||||
Directive,
|
||||
ElementRef, HostListener,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnInit,
|
||||
Renderer2
|
||||
} from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: '[fittext]'
|
||||
|
|
@ -7,7 +16,7 @@ export class Ng2FittextDirective implements AfterViewInit, OnInit, OnChanges, Af
|
|||
|
||||
@Input('fittext') fittext: any;
|
||||
@Input('activateOnResize') activateOnResize: boolean;
|
||||
@Input('container') container: any;
|
||||
@Input('container') container: HTMLElement;
|
||||
@Input('activateOnInputEvents') activateOnInputEvents: boolean;
|
||||
@Input('useMaxFontSize') useMaxFontSize: boolean;
|
||||
@Input('minFontSize') minFontSize = 7;
|
||||
|
|
@ -17,10 +26,11 @@ export class Ng2FittextDirective implements AfterViewInit, OnInit, OnChanges, Af
|
|||
private speed = 1.05;
|
||||
private done = false;
|
||||
|
||||
constructor(public el: ElementRef, public renderer: Renderer) { }
|
||||
constructor(public el: ElementRef,
|
||||
public renderer: Renderer2) {}
|
||||
|
||||
setFontSize(fontSize) {
|
||||
if (this.isVisible() && this.done === false) {
|
||||
setFontSize(fontSize: number) {
|
||||
if (this.isVisible() && !this.done) {
|
||||
if (fontSize < this.minFontSize) {
|
||||
// force that font size will never be lower than minimal allowed font size
|
||||
fontSize = this.minFontSize;
|
||||
|
|
@ -31,7 +41,7 @@ export class Ng2FittextDirective implements AfterViewInit, OnInit, OnChanges, Af
|
|||
}
|
||||
}
|
||||
|
||||
calculateFontSize(fontSize, speed) {
|
||||
calculateFontSize(fontSize: number, speed: number) {
|
||||
// TODO Do with Gauss
|
||||
return Math.floor(fontSize / speed);
|
||||
}
|
||||
|
|
@ -68,7 +78,10 @@ export class Ng2FittextDirective implements AfterViewInit, OnInit, OnChanges, Af
|
|||
ngOnInit() {
|
||||
this.done = false;
|
||||
if (this.useMaxFontSize) {
|
||||
this.maxFontSize = parseInt(this.getComputetStyle().fontSize, null);
|
||||
const fontSize = this.getComputetStyle().fontSize;
|
||||
if (fontSize) {
|
||||
this.maxFontSize = parseInt(fontSize, undefined);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.fittext) {
|
||||
|
|
@ -76,10 +89,11 @@ export class Ng2FittextDirective implements AfterViewInit, OnInit, OnChanges, Af
|
|||
}
|
||||
|
||||
this.el.nativeElement.style.setProperty('will-change', 'content');
|
||||
this.ngAfterViewInit();
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
if (this.isVisible() && this.done === false) {
|
||||
if (this.isVisible() && !this.done) {
|
||||
if (this.fittext) {
|
||||
const overflow = this.container ? this.checkOverflow(this.container, this.el.nativeElement)
|
||||
: this.checkOverflow(this.el.nativeElement.parentElement, this.el.nativeElement);
|
||||
|
|
@ -92,10 +106,13 @@ export class Ng2FittextDirective implements AfterViewInit, OnInit, OnChanges, Af
|
|||
} else {
|
||||
if (this.useMaxFontSize) {
|
||||
if (this.fontSize > this.maxFontSize) {
|
||||
this.maxFontSize = parseInt(this.getComputetStyle().fontSize, null);
|
||||
const fontSize = this.getComputetStyle().fontSize;
|
||||
if (fontSize) {
|
||||
this.maxFontSize = parseInt(fontSize, undefined);
|
||||
this.setFontSize(this.maxFontSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.done = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -105,7 +122,11 @@ export class Ng2FittextDirective implements AfterViewInit, OnInit, OnChanges, Af
|
|||
ngOnChanges(changes: any): void {
|
||||
if (changes.modelToWatch) {
|
||||
// change of model to watch - call ngAfterViewInit where is implemented logic to change size
|
||||
setTimeout(_ => this.ngAfterViewInit() );
|
||||
setTimeout(() => {
|
||||
this.done = false;
|
||||
this.setFontSize(this.maxFontSize);
|
||||
this.ngAfterViewInit();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
28
src/distPackage.json
Normal file
28
src/distPackage.json
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "angular-amazing",
|
||||
"version": "1.0.0",
|
||||
"description": "An amazing module for Angular.",
|
||||
"main": "bundles/amazing.umd.js",
|
||||
"module": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
"keywords": [
|
||||
"angular",
|
||||
"angular2",
|
||||
"angular 2",
|
||||
"angular4"
|
||||
],
|
||||
"author": "Your name",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/youraccount/angular-amazing.git"
|
||||
},
|
||||
"homepage": "https://github.com/youraccount/angular-amazing",
|
||||
"bugs": {
|
||||
"url": "https://github.com/youraccount/angular-amazing/issues"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/core": "^2.4.0 || ^4.0.0",
|
||||
"rxjs": "^5.0.1"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Ng2FittextDirective } from './directives/ng2-fittext.directive';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {NgModule} from '@angular/core';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
|
|
|||
24
src/test.js
24
src/test.js
|
|
@ -1,24 +0,0 @@
|
|||
require('core-js/es6');
|
||||
require('core-js/es7');
|
||||
require('zone.js/dist/zone');
|
||||
require('zone.js/dist/long-stack-trace-zone');
|
||||
require('zone.js/dist/async-test');
|
||||
require('zone.js/dist/fake-async-test');
|
||||
require('zone.js/dist/sync-test');
|
||||
require('zone.js/dist/proxy');
|
||||
require('zone.js/dist/jasmine-patch');
|
||||
|
||||
const browserTesting = require('@angular/platform-browser-dynamic/testing');
|
||||
const coreTesting = require('@angular/core/testing');
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
|
||||
Error.stackTraceLimit = Infinity;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 2000;
|
||||
|
||||
coreTesting.TestBed.resetTestEnvironment();
|
||||
coreTesting.TestBed.initTestEnvironment(
|
||||
browserTesting.BrowserDynamicTestingModule,
|
||||
browserTesting.platformBrowserDynamicTesting()
|
||||
);
|
||||
|
||||
context.keys().forEach(context);
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
// polyfills Angular 2 requires to be loaded BEFORE the application
|
||||
// only used in library development--not packaged
|
||||
import 'core-js/es6/symbol';
|
||||
import 'core-js/es6/object';
|
||||
import 'core-js/es6/function';
|
||||
import 'core-js/es6/parse-int';
|
||||
import 'core-js/es6/parse-float';
|
||||
import 'core-js/es6/number';
|
||||
import 'core-js/es6/math';
|
||||
import 'core-js/es6/string';
|
||||
import 'core-js/es6/date';
|
||||
import 'core-js/es6/array';
|
||||
import 'core-js/es6/regexp';
|
||||
import 'core-js/es6/map';
|
||||
import 'core-js/es6/set';
|
||||
import 'core-js/es6/reflect';
|
||||
|
||||
import 'core-js/es7/reflect';
|
||||
import 'zone.js/dist/zone';
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs-extra');
|
||||
const ngc = require('@angular/compiler-cli/src/main').main;
|
||||
const librarianUtils = require('angular-librarian/commands/utilities');
|
||||
const path = require('path');
|
||||
|
||||
const copyGlobs = require('./copy-globs');
|
||||
const copyToBuild = require('./copy-build');
|
||||
const inlineResources = require('./inline-resources');
|
||||
const rollup = require('./rollup');
|
||||
|
||||
const colorize = librarianUtils.colorize;
|
||||
const rootDir = path.resolve(__dirname, '..');
|
||||
const buildDir = path.resolve(rootDir, 'build');
|
||||
const distDir = path.resolve(rootDir, 'dist');
|
||||
const libName = require(path.resolve(rootDir, 'package.json')).name;
|
||||
const srcDir = path.resolve(rootDir, 'src');
|
||||
const tscDir = path.resolve(rootDir, 'out-tsc');
|
||||
const es5Dir = path.resolve(tscDir, 'lib-es5');
|
||||
const es2015Dir = path.resolve(tscDir, 'lib-es2015');
|
||||
|
||||
const runPromise = (message, fn) => {
|
||||
return function() {
|
||||
console.info(colorize.colorize(message, 'cyan'));
|
||||
return fn().then(complete);
|
||||
};
|
||||
};
|
||||
|
||||
const complete = (depth = 0) => {
|
||||
const spaces = ' '.repeat(depth);
|
||||
console.info(colorize.colorize(`${ spaces }> Complete`, 'green'));
|
||||
};
|
||||
const compileCode = () => Promise.all([2015, 5].map((type) =>
|
||||
ngc({ project: path.resolve(rootDir, `tsconfig.es${ type }.json`)})
|
||||
.then((exitCode) =>
|
||||
exitCode === 0 ? Promise.resolve() : Promise.reject()
|
||||
)
|
||||
));
|
||||
const copyMetadata = () =>
|
||||
copyGlobs(['**/*.d.ts', '**/*.metadata.json'], es2015Dir, distDir);
|
||||
const copyPackageFiles = () =>
|
||||
copyGlobs(['.npmignore', 'package.json', 'README.md'], rootDir, distDir)
|
||||
.then(() => {
|
||||
const contents = fs.readFileSync(path.resolve(distDir, 'package.json'), 'utf8');
|
||||
|
||||
return fs.writeFileSync(path.resolve(distDir, 'package.json'), contents.replace('"dependencies":', '"peerDependencies":'));
|
||||
});
|
||||
const copySource = () => copyGlobs('**/*', srcDir, buildDir);
|
||||
const doInlining = () => inlineResources(buildDir, 'src');
|
||||
const rollupBundles = () => rollup(libName, {
|
||||
dist: distDir,
|
||||
es2015: es2015Dir,
|
||||
es5: es5Dir,
|
||||
root: rootDir
|
||||
});
|
||||
|
||||
return Promise.resolve()
|
||||
.then(runPromise('Copying `src` files into `build`', copySource))
|
||||
.then(runPromise('Inlining resources', doInlining))
|
||||
.then(runPromise('Compiling code', compileCode))
|
||||
.then(runPromise('Copying typings + metadata to `dist`', copyMetadata))
|
||||
.then(runPromise('Generating bundles via rollup', rollupBundles))
|
||||
.then(runPromise('Copying package files to `dist`', copyPackageFiles))
|
||||
.catch((error) => {
|
||||
console.error('\x1b[31m%s\x1b[0m', '> Build failed\n');
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs-extra');
|
||||
|
||||
// copy all src files -> build
|
||||
const copyToBuild = (buildDir, sourceDir) => {
|
||||
fs.ensureDirSync(buildDir);
|
||||
fs.emptyDirSync(buildDir);
|
||||
fs.copySync(sourceDir, buildDir);
|
||||
};
|
||||
|
||||
module.exports = copyToBuild;
|
||||
|
||||
if (!module.parent) {
|
||||
copyToBuild('./build', './src');
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs-extra');
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
|
||||
const copy = (globs, from, to) => {
|
||||
if (typeof globs === 'string') {
|
||||
globs = [globs];
|
||||
}
|
||||
|
||||
fs.ensureDir(to);
|
||||
return Promise.all(
|
||||
globs.map((fileGlob) => copyGlob(fileGlob, from, to))
|
||||
);
|
||||
};
|
||||
|
||||
const copyGlob = (fileGlob, from, to) => new Promise((resolve, reject) => {
|
||||
glob(fileGlob, { cwd: from, nodir: true }, (error, files) => {
|
||||
if (error) reject(error);
|
||||
|
||||
files.forEach((file) => {
|
||||
const origin = path.resolve(from, file);
|
||||
const destination = path.resolve(to, file);
|
||||
const contents = fs.readFileSync(origin, 'utf8');
|
||||
|
||||
fs.ensureDirSync(path.dirname(destination));
|
||||
fs.writeFileSync(destination, contents);
|
||||
});
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = copy;
|
||||
|
|
@ -1,186 +0,0 @@
|
|||
'use strict';
|
||||
// original code by the Angular Material 2 team
|
||||
|
||||
const fs = require('fs');
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
const sass = require('node-sass');
|
||||
|
||||
const inlineResources = (globs, sourcePrefix) => {
|
||||
if (typeof globs === 'string') {
|
||||
globs = [globs];
|
||||
}
|
||||
|
||||
return Promise.all(
|
||||
globs.map((pattern) => replaceSource(pattern, sourcePrefix))
|
||||
);
|
||||
};
|
||||
|
||||
const replaceSource = (pattern, sourcePrefix) => {
|
||||
// pattern is a directory
|
||||
if (pattern.indexOf('*') === -1) {
|
||||
pattern = path.join(pattern, '**', '*');
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
glob(pattern, {}, (error, files) => {
|
||||
if (error) reject(Error);
|
||||
|
||||
files.filter((name) => /\.ts$/.test(name)).forEach((filePath) => {
|
||||
try {
|
||||
inlineFileResources(filePath, sourcePrefix);
|
||||
} catch (readError) {
|
||||
reject(readError);
|
||||
}
|
||||
});
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const inlineFileResources = (filePath, sourcePrefix) => {
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
const inlineContents = inlineResourcesFromString(content, sourcePrefix, (url) =>
|
||||
path.join(path.dirname(filePath), url)
|
||||
);
|
||||
|
||||
fs.writeFileSync(filePath, inlineContents);
|
||||
};
|
||||
|
||||
const inlineResourcesFromString = (content, sourcePrefix, callback) => [
|
||||
inlineTemplate, inlineStyle, removeModuleId
|
||||
].reduce((final, method) => method(final, sourcePrefix, callback), content);
|
||||
|
||||
const inlineTemplate = (content, sourcePrefix, callback) =>
|
||||
content.replace(/templateUrl:\s*'([^']+?\.html)'/g, (match, url) => {
|
||||
const mini = getMiniContents(url, sourcePrefix, callback);
|
||||
|
||||
return `template: "${mini}"`;
|
||||
});
|
||||
|
||||
const inlineStyle = (content, sourcePrefix, callback) =>
|
||||
content.replace(/styleUrls:\s*(\[[\s\S]*?\])/gm, (match, styleUrls) => {
|
||||
const urls = eval(styleUrls); // string -> array
|
||||
return 'styles: [' + urls.map((url) => {
|
||||
const mini = getMiniContents(url, sourcePrefix, callback);
|
||||
|
||||
return `"${mini}"`;
|
||||
}).join(',\n') + ']';
|
||||
});
|
||||
|
||||
const getMiniContents = (url, sourcePrefix, callback) => {
|
||||
const srcFile = callback(url);
|
||||
const file = srcFile.replace(/^dist/, sourcePrefix)
|
||||
const srcDir = file.slice(0, file.lastIndexOf(path.sep));
|
||||
let template = '';
|
||||
|
||||
if (file.match(/\.s(a|c)ss$/)) {
|
||||
// convert SASS -> CSS
|
||||
template = sass.renderSync({
|
||||
file,
|
||||
importer: (url) => handleSassImport(url, srcDir)
|
||||
});
|
||||
template = template.css.toString();
|
||||
} else {
|
||||
template = fs.readFileSync(file, 'utf8');
|
||||
}
|
||||
|
||||
return minifyText(template);
|
||||
};
|
||||
|
||||
const handleSassImport = (url, srcDir) => {
|
||||
const fullUrl = getFullSassUrl(url, srcDir);
|
||||
let isPartial = false;
|
||||
let validUrls = getSassUrls(fullUrl);
|
||||
|
||||
// if we can't find the file, try to
|
||||
// see find it as a partial (underscore-prefixed)
|
||||
if (validUrls.length === 0) {
|
||||
validUrls = getSassUrls(fullUrl, true);
|
||||
isPartial = true;
|
||||
}
|
||||
|
||||
const file = getSassImportUrl(validUrls);
|
||||
|
||||
// CSS files don't get compiled in
|
||||
return /\.css$/.test(file) ?
|
||||
{ contents: fs.readFileSync(file, 'utf8') } :
|
||||
{ file };
|
||||
};
|
||||
|
||||
const getSassUrls = (url, partial) => {
|
||||
let extensions = ['sass', 'scss'];
|
||||
|
||||
if (!partial) {
|
||||
extensions = extensions.concat('', 'css');
|
||||
} else {
|
||||
const lastSlash = url.lastIndexOf(path.sep);
|
||||
const urlDir = url.slice(0, lastSlash);
|
||||
const fileName = url.slice(lastSlash + 1);
|
||||
|
||||
if (fileName[0] !== '_') {
|
||||
url = urlDir + path.sep + '_' + fileName;
|
||||
}
|
||||
}
|
||||
|
||||
return extensions.reduce((valid, extension) => {
|
||||
const extensionUrl = verifyUrl(url, extension);
|
||||
|
||||
if (extensionUrl) {
|
||||
valid = valid.concat(extensionUrl);
|
||||
}
|
||||
|
||||
return valid;
|
||||
}, []);
|
||||
};
|
||||
|
||||
const verifyUrl = (url, extension) => {
|
||||
if (extension) {
|
||||
url = url + `.${ extension }`;
|
||||
}
|
||||
|
||||
if (!fs.existsSync(url)) {
|
||||
url = null;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
// convert ~-prefixed filenames to node_modules-prefixed
|
||||
// make all others relative to srcDir
|
||||
const getFullSassUrl = (url, srcDir) =>
|
||||
/^~/.test(url) ?
|
||||
path.resolve('node_modules', url.slice(1)) :
|
||||
path.resolve(srcDir, url);
|
||||
|
||||
const getSassImportUrl = (validUrls) => {
|
||||
if (validUrls.length !== 1) {
|
||||
let error = 'Cannot determine Sass/CSS file to process. ';
|
||||
|
||||
if (validUrls.length === 0) {
|
||||
error = error + `\n There are no files matching ${ url }`;
|
||||
} else {
|
||||
error = error + 'Candidates:\n ' + validUrls.join('\n ')
|
||||
+ '\nPlease delete or rename all but one of these files or specify the extension to use.';
|
||||
}
|
||||
|
||||
throw new Error(error);
|
||||
}
|
||||
|
||||
return validUrls[0];
|
||||
};
|
||||
|
||||
|
||||
const minifyText = (text) => text
|
||||
.replace(/([\n\r]\s*)+/gm, ' ')
|
||||
.replace(/"/g, '\\"');
|
||||
|
||||
const removeModuleId = (content) =>
|
||||
content.replace(/\s*moduleId:\s*module\.id\s*,?\s*/gm, '');
|
||||
|
||||
module.exports = inlineResources;
|
||||
|
||||
if (!module.parent) {
|
||||
inlineResources('./build', 'src');
|
||||
}
|
||||
134
tasks/rollup.js
134
tasks/rollup.js
|
|
@ -1,134 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const erectorUtils = require('erector-set/src/utils');
|
||||
const fs = require('fs-extra');
|
||||
const librarianUtils = require('angular-librarian/commands/utilities');
|
||||
const path = require('path');
|
||||
const rollup = require('rollup');
|
||||
const rollupCommon = require('rollup-plugin-commonjs');
|
||||
const rollupNodeResolve = require('rollup-plugin-node-resolve');
|
||||
const rollupSourcemaps = require('rollup-plugin-sourcemaps');
|
||||
const rollupUglify = require('rollup-plugin-uglify');
|
||||
|
||||
const doRollup = (libName, dirs) => {
|
||||
const nameParts = extractName(libName);
|
||||
const es5Entry = path.resolve(dirs.es5, `${ nameParts.package }.js`);
|
||||
const es2015Entry = path.resolve(dirs.es2015, `${ nameParts.package }.js`);
|
||||
const destinations = generateDestinations(dirs.dist, nameParts);
|
||||
const baseConfig = generateConfig({
|
||||
entry: es5Entry,
|
||||
external: [
|
||||
'@angular/common',
|
||||
'@angular/core'
|
||||
],
|
||||
globals: {
|
||||
'@angular/common': 'ng.common',
|
||||
'@angular/core': 'ng.core'
|
||||
},
|
||||
moduleName: librarianUtils.caseConvert.dashToCamel(nameParts.package),
|
||||
onwarn: function rollupOnWarn(warning) {
|
||||
// keeps TypeScript this errors down
|
||||
if (warning.code !== 'THIS_IS_UNDEFINED') {
|
||||
console.warn(warning.message);
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
rollupNodeResolve({
|
||||
jsnext: true,
|
||||
module: true
|
||||
}),
|
||||
rollupSourcemaps()
|
||||
],
|
||||
sourceMap: true
|
||||
}, dirs.root);
|
||||
const fesm2015Config = Object.assign({}, baseConfig, {
|
||||
entry: es2015Entry,
|
||||
dest: destinations.fesm2015,
|
||||
format: 'es'
|
||||
});
|
||||
const fesm5Config = Object.assign({}, baseConfig, {
|
||||
dest: destinations.fesm5,
|
||||
format: 'es'
|
||||
});
|
||||
const minUmdConfig = Object.assign({}, baseConfig, {
|
||||
dest: destinations.minUmd,
|
||||
format: 'umd',
|
||||
plugins: baseConfig.plugins.concat([rollupUglify({})])
|
||||
});
|
||||
const umdConfig = Object.assign({}, baseConfig, {
|
||||
dest: destinations.umd,
|
||||
format: 'umd'
|
||||
});
|
||||
|
||||
const bundles = [
|
||||
fesm2015Config,
|
||||
fesm5Config,
|
||||
minUmdConfig,
|
||||
umdConfig
|
||||
].map((config) =>
|
||||
rollup.rollup(config).then((bundle) =>
|
||||
bundle.write(config)
|
||||
)
|
||||
);
|
||||
|
||||
return Promise.all(bundles);
|
||||
};
|
||||
|
||||
const extractName = (libName) => {
|
||||
const isScoped = librarianUtils.checkIsScopedName(libName);
|
||||
const nameParts = {
|
||||
package: libName,
|
||||
scope: undefined
|
||||
};
|
||||
|
||||
if (isScoped) {
|
||||
const parts = libName.split('/', 2);
|
||||
|
||||
nameParts.package = parts[1];
|
||||
nameParts.scope = parts[0];
|
||||
}
|
||||
|
||||
return nameParts;
|
||||
};
|
||||
|
||||
const generateDestinations = (dist, nameParts) => {
|
||||
const bundleDest = path.resolve(dist, 'bundles');
|
||||
let fesmDest = path.resolve(dist);
|
||||
|
||||
if (nameParts.scope) {
|
||||
fesmDest = path.resolve(fesmDest, nameParts.scope);
|
||||
fs.ensureDirSync(fesmDest);
|
||||
}
|
||||
|
||||
return Object.freeze({
|
||||
fesm2015: path.resolve(fesmDest,`${ nameParts.package }.js`),
|
||||
fesm5: path.resolve(fesmDest,`${ nameParts.package }.es5.js`),
|
||||
minUmd: path.resolve(bundleDest, `${ nameParts.package }.umd.min.js`),
|
||||
umd: path.resolve(bundleDest, `${ nameParts.package }.umd.js`)
|
||||
});
|
||||
};
|
||||
|
||||
const generateConfig = (base, rootDir) => {
|
||||
let commonjsIncludes = ['node_modules/rxjs/**'];
|
||||
const customLocation = path.resolve(rootDir, 'configs', 'rollup.config.js');
|
||||
|
||||
if (fs.existsSync(customLocation)) {
|
||||
const custom = require(customLocation);
|
||||
const external = (custom.external || []).filter((external) => base.external.indexOf(external) === -1);
|
||||
const includes = (custom.commonjs || []).filter((include) => commonjsIncludes.indexOf(include) === -1);
|
||||
|
||||
base.external = base.external.concat(external);
|
||||
base.globals = erectorUtils.mergeDeep(custom.globals, base.globals);
|
||||
commonjsIncludes = commonjsIncludes.concat(includes);
|
||||
}
|
||||
|
||||
base.plugins.unshift(
|
||||
rollupCommon({
|
||||
include: commonjsIncludes
|
||||
})
|
||||
);
|
||||
|
||||
return base;
|
||||
};
|
||||
|
||||
module.exports = doRollup;
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Server = require('karma').Server;
|
||||
|
||||
function run(type) {
|
||||
const config = getConfig(type);
|
||||
const server = new Server(config, function(exitCode) {
|
||||
process.exit(exitCode);
|
||||
});
|
||||
|
||||
server.start();
|
||||
}
|
||||
|
||||
function getConfig(type) {
|
||||
switch (type) {
|
||||
case 'headless':
|
||||
case 'hl':
|
||||
case 'h':
|
||||
return getHeadlessConfig();
|
||||
case 'all':
|
||||
case 'a':
|
||||
return getAllConfig();
|
||||
case 'watch':
|
||||
case 'w':
|
||||
return getWatchConfig();
|
||||
default:
|
||||
return getSingleConfig();
|
||||
}
|
||||
}
|
||||
|
||||
function getSingleConfig() {
|
||||
let config = getHeadlessConfig();
|
||||
|
||||
config.singleRun = true;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
function getHeadlessConfig() {
|
||||
let config = getAllConfig();
|
||||
|
||||
config.browsers = ['PhantomJS'];
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
function getWatchConfig() {
|
||||
let config = getAllConfig(true);
|
||||
|
||||
config.browsers = ['Chrome'];
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
const getAllConfig = (watch) => ({
|
||||
configFile: path.resolve(__dirname, '..', 'karma.conf.js'),
|
||||
webpack: require(path.resolve(__dirname, '..', 'webpack', 'webpack.test.js'))(watch),
|
||||
});
|
||||
|
||||
module.exports = run;
|
||||
|
||||
if (!module.parent) {
|
||||
run(process.argv[2]);
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"angularCompilerOptions": {
|
||||
"annotateForClosureCompiler": true,
|
||||
"flatModuleId": "ng2-fittext",
|
||||
"flatModuleOutFile": "ng2-fittext.js",
|
||||
"genDir": "../out-tsc/lib-gen-dir/",
|
||||
"strictMetadataEmit": true,
|
||||
"skipTemplateCodegen": true
|
||||
},
|
||||
"compilerOptions": {
|
||||
"baseUrl": "",
|
||||
"declaration": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./out-tsc/lib-es2015/",
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"stripInternal": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"target": "es2015",
|
||||
"typeRoots": [
|
||||
"./node_modules/@types"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"./build/index.ts"
|
||||
],
|
||||
"awesomeTypescriptLoaderOptions": {
|
||||
"forkChecker": true
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"angularCompilerOptions": {
|
||||
"annotateForClosureCompiler": true,
|
||||
"flatModuleId": "ng2-fittext",
|
||||
"flatModuleOutFile": "ng2-fittext.js",
|
||||
"genDir": "../out-tsc/lib-gen-dir/",
|
||||
"strictMetadataEmit": true,
|
||||
"skipTemplateCodegen": true
|
||||
},
|
||||
"compilerOptions": {
|
||||
"baseUrl": "",
|
||||
"declaration": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./out-tsc/lib-es5/",
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"stripInternal": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"target": "es5",
|
||||
"typeRoots": [
|
||||
"./node_modules/@types"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"./build/index.ts"
|
||||
],
|
||||
"awesomeTypescriptLoaderOptions": {
|
||||
"forkChecker": true
|
||||
}
|
||||
}
|
||||
|
|
@ -6,9 +6,14 @@
|
|||
"compilerOptions": {
|
||||
"baseUrl": "",
|
||||
"declaration": true,
|
||||
"stripInternal": true,
|
||||
"strictNullChecks": true,
|
||||
"noImplicitAny": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"inlineSources": true,
|
||||
"rootDir": "./src",
|
||||
"mapRoot": "./",
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
|
|
@ -17,7 +22,10 @@
|
|||
"target": "es5",
|
||||
"typeRoots": [
|
||||
"./node_modules/@types"
|
||||
]
|
||||
],
|
||||
"paths": {
|
||||
"@angular/core": ["./node_modules/@angular/core"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"./src/index.ts"
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"buildOnSave": false,
|
||||
"compilerOptions": {
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"removeComments": false,
|
||||
"sourceMap": true,
|
||||
"target": "es5",
|
||||
"typeRoots": [
|
||||
"./node_modules/@types"
|
||||
]
|
||||
},
|
||||
"compileOnSave": false,
|
||||
"files": [
|
||||
"./src/ng2-fittext.module.ts"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const webpack = require('webpack');
|
||||
const webpackMerge = require('webpack-merge');
|
||||
|
||||
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
const ContextReplacementPlugin = webpack.ContextReplacementPlugin;
|
||||
const LoaderOptionsPlugin = webpack.LoaderOptionsPlugin;
|
||||
|
||||
const webpackUtils = require('./webpack.utils');
|
||||
|
||||
const getCommonConfig = (type) => {
|
||||
const tsconfigType = type !== 'dev' ? `.${ type }` : '';
|
||||
|
||||
return {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
exclude: /node_modules/,
|
||||
test: /\.ts$/,
|
||||
use: [
|
||||
'awesome-typescript-loader?configFileName=' + webpackUtils.rootPath(`tsconfig${ tsconfigType }.json`),
|
||||
'angular2-template-loader?keepUrl=true'
|
||||
]
|
||||
},
|
||||
{ test: /\.html$/, use: 'raw-loader' },
|
||||
{
|
||||
use: ['url-loader?limit=10000'],
|
||||
test: /\.(woff2?|ttf|eot|svg|jpg|jpeg|json|gif|png)(\?v=\d+\.\d+\.\d+)?$/
|
||||
}
|
||||
]
|
||||
},
|
||||
performance: { hints: false },
|
||||
plugins: [
|
||||
new ContextReplacementPlugin(
|
||||
/angular(\\|\/)core(\\|\/)@angular/,
|
||||
__dirname
|
||||
),
|
||||
new LoaderOptionsPlugin({
|
||||
debug: true,
|
||||
options: {
|
||||
emitErrors: true
|
||||
}
|
||||
}),
|
||||
new ExtractTextPlugin("*.css")
|
||||
],
|
||||
resolve: {
|
||||
extensions: [ '.js', '.ts' ],
|
||||
modules: [ webpackUtils.rootPath('node_modules') ]
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = (type, typeConfig) => {
|
||||
const configs = [getCommonConfig(type), typeConfig];
|
||||
const customConfigPath = webpackUtils.rootPath('configs', `webpack.${ type }.js`);
|
||||
|
||||
if (fs.existsSync(customConfigPath)) {
|
||||
let customConfig = require(customConfigPath);
|
||||
|
||||
if (Object.prototype.toString.call(customConfig) === '[object Function]') {
|
||||
customConfig = customConfig();
|
||||
}
|
||||
|
||||
configs.push(customConfig);
|
||||
}
|
||||
|
||||
return webpackMerge.apply(null, configs);
|
||||
};
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const HtmlWebpack = require('html-webpack-plugin');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const ChunkWebpack = webpack.optimize.CommonsChunkPlugin;
|
||||
const webpackCommon = require('./webpack.common');
|
||||
const webpackUtils = require('./webpack.utils');
|
||||
|
||||
const entryPoints = [
|
||||
'vendor',
|
||||
'scripts',
|
||||
'styles',
|
||||
'app'
|
||||
];
|
||||
const examplePath = function examples() {
|
||||
return webpackUtils.relayArguments(
|
||||
webpackUtils.rootPath,
|
||||
'examples',
|
||||
arguments
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = webpackCommon('dev', {
|
||||
devServer: {
|
||||
contentBase: webpackUtils.rootPath('dist'),
|
||||
port: 9000
|
||||
},
|
||||
devtool: 'cheap-module-eval-source-map',
|
||||
entry: {
|
||||
app: [ examplePath('example.main') ],
|
||||
scripts: [],
|
||||
vendor: [ webpackUtils.srcPath('vendor') ],
|
||||
styles: [ examplePath('styles.scss') ]
|
||||
},
|
||||
module: {
|
||||
rules: webpackUtils.buildRules({
|
||||
cssExtract: examplePath(),
|
||||
sassLoader: examplePath('styles.scss')
|
||||
}, {
|
||||
include: examplePath(),
|
||||
test: /styles\.scss$/,
|
||||
use: ['style-loader', 'css-loader', 'sass-loader']
|
||||
})
|
||||
},
|
||||
output: {
|
||||
filename: '[name].bundle.js',
|
||||
path: webpackUtils.rootPath('dist')
|
||||
},
|
||||
plugins: [
|
||||
new ChunkWebpack({
|
||||
filename: 'vendor.bundle.js',
|
||||
minChunks: Infinity,
|
||||
name: 'vendor'
|
||||
}),
|
||||
new HtmlWebpack({
|
||||
// shameless/shamefully stolen from Angular CLI
|
||||
chunksSortMode: function(left, right) {
|
||||
const leftIndex = entryPoints.indexOf(left.names[0]);
|
||||
const rightIndex = entryPoints.indexOf(right.names[0]);
|
||||
let direction = 0;
|
||||
|
||||
if (leftIndex > rightIndex) {
|
||||
direction = 1;
|
||||
} else if (leftIndex < rightIndex) {
|
||||
direction = -1;
|
||||
}
|
||||
|
||||
return direction;
|
||||
},
|
||||
filename: 'index.html',
|
||||
inject: 'body',
|
||||
template: examplePath('index.html')
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const webpack = require('webpack');
|
||||
|
||||
const SourceMapDevToolPlugin = webpack.SourceMapDevToolPlugin;
|
||||
const webpackCommon = require('./webpack.common');
|
||||
const webpackUtils = require('./webpack.utils');
|
||||
|
||||
module.exports = (watch) => {
|
||||
return webpackCommon('test', {
|
||||
devtool: watch ? 'inline-source-map' : 'cheap-module-eval-source-map',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.s?css$/,
|
||||
use: ['raw-loader', 'css-loader', 'sass-loader']
|
||||
},
|
||||
{
|
||||
enforce: 'pre',
|
||||
exclude: /node_modules/,
|
||||
test: /\.ts$/,
|
||||
use: 'tslint-loader'
|
||||
},
|
||||
{
|
||||
enforce: 'post',
|
||||
exclude: [
|
||||
/node_modules/,
|
||||
/\.(e2e|spec\.)ts$/
|
||||
],
|
||||
test: /\.ts$/,
|
||||
use: 'istanbul-instrumenter-loader?esModules=true'
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new SourceMapDevToolPlugin({
|
||||
filename: null,
|
||||
test: /\.ts$/
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
modules: [ webpackUtils.srcPath() ],
|
||||
moduleExtensions: ['-loader']
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const ExtractText = require('extract-text-webpack-plugin');
|
||||
const path = require('path');
|
||||
|
||||
function rootPath() {
|
||||
const rootDir = path.resolve(__dirname, '..');
|
||||
return relayArguments(path.resolve, rootDir, arguments);
|
||||
}
|
||||
exports.rootPath = rootPath;
|
||||
|
||||
function srcPath() {
|
||||
return relayArguments(rootPath, 'src', arguments);
|
||||
};
|
||||
exports.srcPath = srcPath;
|
||||
|
||||
function relayArguments(method, prefix, args) {
|
||||
const fullArguments = [prefix].concat(
|
||||
Array.prototype.slice.apply(args)
|
||||
);
|
||||
|
||||
return method.apply(null, fullArguments);
|
||||
}
|
||||
exports.relayArguments = relayArguments;
|
||||
|
||||
exports.buildRules = (excludes, extraRules) => {
|
||||
let cssExtractExcludes = [srcPath()];
|
||||
let sassLoaderExcludes = [/node_modules/];
|
||||
let rules;
|
||||
|
||||
excludes = excludes || {};
|
||||
if (excludes.cssExtract) {
|
||||
cssExtractExcludes = cssExtractExcludes.concat(excludes.cssExtract);
|
||||
}
|
||||
|
||||
if (excludes.sassLoader) {
|
||||
sassLoaderExcludes = sassLoaderExcludes.concat(excludes.sassLoader);
|
||||
}
|
||||
|
||||
rules = [
|
||||
{
|
||||
exclude: cssExtractExcludes,
|
||||
test: /\.css$/,
|
||||
use: ExtractText.extract({
|
||||
fallback: 'style-loader',
|
||||
use: 'css-loader?sourceMap'
|
||||
})
|
||||
},
|
||||
{
|
||||
exclude: /node_modules/,
|
||||
test: /\.css$/,
|
||||
use: ['css-to-string-loader', 'css-loader']
|
||||
},
|
||||
{
|
||||
exclude: sassLoaderExcludes,
|
||||
use: ['css-to-string-loader', 'css-loader', 'sass-loader'],
|
||||
test: /\.scss$/
|
||||
}
|
||||
];
|
||||
|
||||
if (extraRules) {
|
||||
rules = rules.concat(extraRules);
|
||||
}
|
||||
|
||||
return rules;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue