ngx-color 7.1.0 → 7.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alpha/alpha-picker.component.d.ts +8 -0
- package/alpha/ngx-color-alpha.d.ts +2 -1
- package/alpha/package.json +6 -10
- package/alpha/public_api.d.ts +1 -0
- package/alpha.component.d.ts +9 -0
- package/block/block-swatches.component.d.ts +13 -8
- package/block/block.component.d.ts +9 -0
- package/block/ngx-color-block.d.ts +2 -2
- package/block/package.json +6 -10
- package/block/public_api.d.ts +2 -0
- package/checkboard.component.d.ts +7 -0
- package/chrome/chrome-fields.component.d.ts +3 -0
- package/chrome/chrome.component.d.ts +9 -0
- package/chrome/ngx-color-chrome.d.ts +2 -2
- package/chrome/package.json +6 -10
- package/chrome/public_api.d.ts +2 -0
- package/circle/circle-swatch.component.d.ts +3 -0
- package/circle/circle.component.d.ts +9 -0
- package/circle/ngx-color-circle.d.ts +2 -2
- package/circle/package.json +9 -10
- package/circle/public_api.d.ts +2 -0
- package/color-wrap.component.d.ts +7 -0
- package/compact/compact-color.component.d.ts +3 -0
- package/compact/compact-fields.component.d.ts +3 -0
- package/compact/compact.component.d.ts +10 -0
- package/compact/ngx-color-compact.d.ts +2 -3
- package/compact/package.json +6 -10
- package/compact/public_api.d.ts +3 -0
- package/coordinates.directive.d.ts +6 -0
- package/editable-input.component.d.ts +7 -0
- package/esm2020/alpha/alpha-picker.component.mjs +116 -0
- package/esm2020/alpha/ngx-color-alpha.mjs +5 -0
- package/esm2020/alpha/public_api.mjs +2 -0
- package/esm2020/alpha.component.mjs +186 -0
- package/esm2020/block/block-swatches.component.mjs +74 -0
- package/esm2020/block/block.component.mjs +199 -0
- package/esm2020/block/ngx-color-block.mjs +5 -0
- package/esm2020/block/public_api.mjs +3 -0
- package/esm2020/checkboard.component.mjs +66 -0
- package/esm2020/chrome/chrome-fields.component.mjs +356 -0
- package/esm2020/chrome/chrome.component.mjs +249 -0
- package/esm2020/chrome/ngx-color-chrome.mjs +5 -0
- package/esm2020/chrome/public_api.mjs +3 -0
- package/esm2020/circle/circle-swatch.component.mjs +85 -0
- package/esm2020/circle/circle.component.mjs +148 -0
- package/esm2020/circle/ngx-color-circle.mjs +5 -0
- package/esm2020/circle/public_api.mjs +3 -0
- package/esm2020/color-wrap.component.mjs +163 -0
- package/esm2020/compact/compact-color.component.mjs +91 -0
- package/esm2020/compact/compact-fields.component.mjs +186 -0
- package/esm2020/compact/compact.component.mjs +177 -0
- package/esm2020/compact/ngx-color-compact.mjs +5 -0
- package/esm2020/compact/public_api.mjs +4 -0
- package/esm2020/coordinates.directive.mjs +104 -0
- package/esm2020/editable-input.component.mjs +217 -0
- package/esm2020/github/github-swatch.component.mjs +67 -0
- package/esm2020/github/github.component.mjs +179 -0
- package/esm2020/github/ngx-color-github.mjs +5 -0
- package/esm2020/github/public_api.mjs +3 -0
- package/esm2020/helpers/checkboard.mjs +33 -0
- package/esm2020/helpers/color.interfaces.mjs +2 -0
- package/esm2020/helpers/color.mjs +60 -0
- package/esm2020/hue/hue-picker.component.mjs +113 -0
- package/esm2020/hue/ngx-color-hue.mjs +5 -0
- package/esm2020/hue/public_api.mjs +2 -0
- package/esm2020/hue.component.mjs +165 -0
- package/esm2020/material/material.component.mjs +211 -0
- package/esm2020/material/ngx-color-material.mjs +5 -0
- package/esm2020/material/public_api.mjs +2 -0
- package/esm2020/ngx-color.mjs +5 -0
- package/esm2020/photoshop/ngx-color-photoshop.mjs +5 -0
- package/esm2020/photoshop/photoshop-button.component.mjs +63 -0
- package/esm2020/photoshop/photoshop-fields.component.mjs +241 -0
- package/esm2020/photoshop/photoshop-previews.component.mjs +68 -0
- package/esm2020/photoshop/photoshop.component.mjs +258 -0
- package/esm2020/photoshop/public_api.mjs +5 -0
- package/esm2020/public_api.mjs +14 -0
- package/esm2020/raised.component.mjs +89 -0
- package/esm2020/saturation.component.mjs +136 -0
- package/esm2020/shade/ngx-color-shade.mjs +5 -0
- package/esm2020/shade/public_api.mjs +2 -0
- package/esm2020/shade/shade-picker.component.mjs +105 -0
- package/esm2020/shade.component.mjs +165 -0
- package/esm2020/sketch/ngx-color-sketch.mjs +5 -0
- package/esm2020/sketch/public_api.mjs +4 -0
- package/esm2020/sketch/sketch-fields.component.mjs +243 -0
- package/esm2020/sketch/sketch-preset-colors.component.mjs +98 -0
- package/esm2020/sketch/sketch.component.mjs +283 -0
- package/esm2020/slider/ngx-color-slider.mjs +5 -0
- package/esm2020/slider/public_api.mjs +4 -0
- package/esm2020/slider/slider-swatch.component.mjs +80 -0
- package/esm2020/slider/slider-swatches.component.mjs +135 -0
- package/esm2020/slider/slider.component.mjs +116 -0
- package/esm2020/swatch.component.mjs +125 -0
- package/esm2020/swatches/ngx-color-swatches.mjs +5 -0
- package/esm2020/swatches/public_api.mjs +4 -0
- package/esm2020/swatches/swatches-color.component.mjs +123 -0
- package/esm2020/swatches/swatches-group.component.mjs +64 -0
- package/esm2020/swatches/swatches.component.mjs +258 -0
- package/esm2020/twitter/ngx-color-twitter.mjs +5 -0
- package/esm2020/twitter/public_api.mjs +2 -0
- package/esm2020/twitter/twitter.component.mjs +255 -0
- package/fesm2015/ngx-color-alpha.mjs +123 -0
- package/fesm2015/ngx-color-alpha.mjs.map +1 -0
- package/fesm2015/ngx-color-block.mjs +275 -0
- package/fesm2015/ngx-color-block.mjs.map +1 -0
- package/fesm2015/ngx-color-chrome.mjs +606 -0
- package/fesm2015/ngx-color-chrome.mjs.map +1 -0
- package/fesm2015/ngx-color-circle.mjs +237 -0
- package/fesm2015/ngx-color-circle.mjs.map +1 -0
- package/fesm2015/ngx-color-compact.mjs +451 -0
- package/fesm2015/ngx-color-compact.mjs.map +1 -0
- package/fesm2015/ngx-color-github.mjs +250 -0
- package/fesm2015/ngx-color-github.mjs.map +1 -0
- package/fesm2015/ngx-color-hue.mjs +120 -0
- package/fesm2015/ngx-color-hue.mjs.map +1 -0
- package/fesm2015/ngx-color-material.mjs +218 -0
- package/fesm2015/ngx-color-material.mjs.map +1 -0
- package/fesm2015/ngx-color-photoshop.mjs +626 -0
- package/fesm2015/ngx-color-photoshop.mjs.map +1 -0
- package/fesm2015/ngx-color-shade.mjs +112 -0
- package/fesm2015/ngx-color-shade.mjs.map +1 -0
- package/fesm2015/ngx-color-sketch.mjs +620 -0
- package/fesm2015/ngx-color-sketch.mjs.map +1 -0
- package/fesm2015/ngx-color-slider.mjs +331 -0
- package/fesm2015/ngx-color-slider.mjs.map +1 -0
- package/fesm2015/ngx-color-swatches.mjs +441 -0
- package/fesm2015/ngx-color-swatches.mjs.map +1 -0
- package/fesm2015/ngx-color-twitter.mjs +262 -0
- package/fesm2015/ngx-color-twitter.mjs.map +1 -0
- package/fesm2015/ngx-color.mjs +1461 -0
- package/fesm2015/ngx-color.mjs.map +1 -0
- package/fesm2020/ngx-color-alpha.mjs +123 -0
- package/fesm2020/ngx-color-alpha.mjs.map +1 -0
- package/fesm2020/ngx-color-block.mjs +275 -0
- package/fesm2020/ngx-color-block.mjs.map +1 -0
- package/fesm2020/ngx-color-chrome.mjs +606 -0
- package/fesm2020/ngx-color-chrome.mjs.map +1 -0
- package/fesm2020/ngx-color-circle.mjs +237 -0
- package/fesm2020/ngx-color-circle.mjs.map +1 -0
- package/fesm2020/ngx-color-compact.mjs +451 -0
- package/fesm2020/ngx-color-compact.mjs.map +1 -0
- package/fesm2020/ngx-color-github.mjs +250 -0
- package/fesm2020/ngx-color-github.mjs.map +1 -0
- package/fesm2020/ngx-color-hue.mjs +120 -0
- package/fesm2020/ngx-color-hue.mjs.map +1 -0
- package/fesm2020/ngx-color-material.mjs +218 -0
- package/fesm2020/ngx-color-material.mjs.map +1 -0
- package/fesm2020/ngx-color-photoshop.mjs +626 -0
- package/fesm2020/ngx-color-photoshop.mjs.map +1 -0
- package/fesm2020/ngx-color-shade.mjs +112 -0
- package/fesm2020/ngx-color-shade.mjs.map +1 -0
- package/fesm2020/ngx-color-sketch.mjs +620 -0
- package/fesm2020/ngx-color-sketch.mjs.map +1 -0
- package/fesm2020/ngx-color-slider.mjs +331 -0
- package/fesm2020/ngx-color-slider.mjs.map +1 -0
- package/fesm2020/ngx-color-swatches.mjs +441 -0
- package/fesm2020/ngx-color-swatches.mjs.map +1 -0
- package/fesm2020/ngx-color-twitter.mjs +262 -0
- package/fesm2020/ngx-color-twitter.mjs.map +1 -0
- package/fesm2020/ngx-color.mjs +1466 -0
- package/fesm2020/ngx-color.mjs.map +1 -0
- package/github/github-swatch.component.d.ts +3 -0
- package/github/github.component.d.ts +9 -0
- package/github/ngx-color-github.d.ts +2 -2
- package/github/package.json +6 -10
- package/github/public_api.d.ts +2 -0
- package/hue/hue-picker.component.d.ts +8 -0
- package/hue/ngx-color-hue.d.ts +2 -1
- package/hue/package.json +6 -10
- package/hue/public_api.d.ts +1 -0
- package/hue.component.d.ts +8 -0
- package/material/material.component.d.ts +8 -0
- package/material/ngx-color-material.d.ts +2 -1
- package/material/package.json +6 -10
- package/material/public_api.d.ts +1 -0
- package/ngx-color.d.ts +1 -0
- package/package.json +132 -9
- package/photoshop/ngx-color-photoshop.d.ts +2 -4
- package/photoshop/package.json +6 -10
- package/photoshop/photoshop-button.component.d.ts +3 -0
- package/photoshop/photoshop-fields.component.d.ts +3 -0
- package/photoshop/photoshop-previews.component.d.ts +3 -0
- package/photoshop/photoshop.component.d.ts +11 -0
- package/photoshop/public_api.d.ts +4 -0
- package/raised.component.d.ts +7 -0
- package/saturation.component.d.ts +8 -0
- package/shade/ngx-color-shade.d.ts +2 -1
- package/shade/package.json +6 -10
- package/shade/public_api.d.ts +1 -0
- package/shade/shade-picker.component.d.ts +8 -0
- package/shade.component.d.ts +8 -0
- package/sketch/ngx-color-sketch.d.ts +2 -3
- package/sketch/package.json +6 -10
- package/sketch/public_api.d.ts +3 -0
- package/sketch/sketch-fields.component.d.ts +3 -0
- package/sketch/sketch-preset-colors.component.d.ts +3 -0
- package/sketch/sketch.component.d.ts +10 -0
- package/slider/ngx-color-slider.d.ts +2 -3
- package/slider/package.json +6 -10
- package/slider/public_api.d.ts +3 -0
- package/slider/slider-swatch.component.d.ts +3 -0
- package/slider/slider-swatches.component.d.ts +3 -0
- package/slider/slider.component.d.ts +10 -0
- package/swatch.component.d.ts +8 -0
- package/swatches/ngx-color-swatches.d.ts +2 -3
- package/swatches/package.json +9 -10
- package/swatches/public_api.d.ts +3 -0
- package/swatches/swatches-color.component.d.ts +3 -0
- package/swatches/swatches-group.component.d.ts +3 -0
- package/swatches/swatches.component.d.ts +10 -0
- package/twitter/ngx-color-twitter.d.ts +2 -1
- package/twitter/package.json +6 -10
- package/twitter/public_api.d.ts +1 -0
- package/twitter/twitter.component.d.ts +8 -0
- package/alpha/bundles/ngx-color-alpha.umd.js +0 -400
- package/alpha/bundles/ngx-color-alpha.umd.js.map +0 -1
- package/alpha/esm2015/alpha-picker.component.js +0 -80
- package/alpha/esm2015/ngx-color-alpha.js +0 -5
- package/alpha/fesm2015/ngx-color-alpha.js +0 -87
- package/alpha/fesm2015/ngx-color-alpha.js.map +0 -1
- package/alpha/ngx-color-alpha.metadata.json +0 -1
- package/block/bundles/ngx-color-block.umd.js +0 -468
- package/block/bundles/ngx-color-block.umd.js.map +0 -1
- package/block/esm2015/block-swatches.component.js +0 -58
- package/block/esm2015/block.component.js +0 -147
- package/block/esm2015/ngx-color-block.js +0 -6
- package/block/fesm2015/ngx-color-block.js +0 -210
- package/block/fesm2015/ngx-color-block.js.map +0 -1
- package/block/ngx-color-block.metadata.json +0 -1
- package/bundles/ngx-color.umd.js +0 -1014
- package/bundles/ngx-color.umd.js.map +0 -1
- package/chrome/bundles/ngx-color-chrome.umd.js +0 -539
- package/chrome/bundles/ngx-color-chrome.umd.js.map +0 -1
- package/chrome/esm2015/chrome-fields.component.js +0 -255
- package/chrome/esm2015/chrome.component.js +0 -169
- package/chrome/esm2015/ngx-color-chrome.js +0 -6
- package/chrome/fesm2015/ngx-color-chrome.js +0 -428
- package/chrome/fesm2015/ngx-color-chrome.js.map +0 -1
- package/chrome/ngx-color-chrome.metadata.json +0 -1
- package/circle/bundles/ngx-color-circle.umd.js +0 -465
- package/circle/bundles/ngx-color-circle.umd.js.map +0 -1
- package/circle/esm2015/circle-swatch.component.js +0 -63
- package/circle/esm2015/circle.component.js +0 -105
- package/circle/esm2015/ngx-color-circle.js +0 -6
- package/circle/fesm2015/ngx-color-circle.js +0 -173
- package/circle/fesm2015/ngx-color-circle.js.map +0 -1
- package/circle/ngx-color-circle.metadata.json +0 -1
- package/compact/bundles/ngx-color-compact.umd.js +0 -575
- package/compact/bundles/ngx-color-compact.umd.js.map +0 -1
- package/compact/esm2015/compact-color.component.js +0 -70
- package/compact/esm2015/compact-fields.component.js +0 -142
- package/compact/esm2015/compact.component.js +0 -131
- package/compact/esm2015/ngx-color-compact.js +0 -7
- package/compact/fesm2015/ngx-color-compact.js +0 -344
- package/compact/fesm2015/ngx-color-compact.js.map +0 -1
- package/compact/ngx-color-compact.metadata.json +0 -1
- package/esm2015/alpha.component.js +0 -156
- package/esm2015/checkboard.component.js +0 -52
- package/esm2015/color-wrap.component.js +0 -145
- package/esm2015/coordinates.directive.js +0 -85
- package/esm2015/editable-input.component.js +0 -183
- package/esm2015/helpers/checkboard.js +0 -33
- package/esm2015/helpers/color.interfaces.js +0 -2
- package/esm2015/helpers/color.js +0 -60
- package/esm2015/hue.component.js +0 -140
- package/esm2015/ngx-color.js +0 -5
- package/esm2015/public_api.js +0 -14
- package/esm2015/raised.component.js +0 -73
- package/esm2015/saturation.component.js +0 -111
- package/esm2015/shade.component.js +0 -127
- package/esm2015/swatch.component.js +0 -85
- package/fesm2015/ngx-color.js +0 -1228
- package/fesm2015/ngx-color.js.map +0 -1
- package/github/bundles/ngx-color-github.umd.js +0 -443
- package/github/bundles/ngx-color-github.umd.js.map +0 -1
- package/github/esm2015/github-swatch.component.js +0 -48
- package/github/esm2015/github.component.js +0 -142
- package/github/esm2015/ngx-color-github.js +0 -6
- package/github/fesm2015/ngx-color-github.js +0 -195
- package/github/fesm2015/ngx-color-github.js.map +0 -1
- package/github/ngx-color-github.metadata.json +0 -1
- package/hue/bundles/ngx-color-hue.umd.js +0 -403
- package/hue/bundles/ngx-color-hue.umd.js.map +0 -1
- package/hue/esm2015/hue-picker.component.js +0 -78
- package/hue/esm2015/ngx-color-hue.js +0 -5
- package/hue/fesm2015/ngx-color-hue.js +0 -85
- package/hue/fesm2015/ngx-color-hue.js.map +0 -1
- package/hue/ngx-color-hue.metadata.json +0 -1
- package/material/bundles/ngx-color-material.umd.js +0 -451
- package/material/bundles/ngx-color-material.umd.js.map +0 -1
- package/material/esm2015/material.component.js +0 -157
- package/material/esm2015/ngx-color-material.js +0 -5
- package/material/fesm2015/ngx-color-material.js +0 -164
- package/material/fesm2015/ngx-color-material.js.map +0 -1
- package/material/ngx-color-material.metadata.json +0 -1
- package/ngx-color.metadata.json +0 -1
- package/photoshop/bundles/ngx-color-photoshop.umd.js +0 -567
- package/photoshop/bundles/ngx-color-photoshop.umd.js.map +0 -1
- package/photoshop/esm2015/ngx-color-photoshop.js +0 -8
- package/photoshop/esm2015/photoshop-button.component.js +0 -50
- package/photoshop/esm2015/photoshop-fields.component.js +0 -180
- package/photoshop/esm2015/photoshop-previews.component.js +0 -53
- package/photoshop/esm2015/photoshop.component.js +0 -177
- package/photoshop/fesm2015/ngx-color-photoshop.js +0 -460
- package/photoshop/fesm2015/ngx-color-photoshop.js.map +0 -1
- package/photoshop/ngx-color-photoshop.metadata.json +0 -1
- package/shade/bundles/ngx-color-shade.umd.js +0 -395
- package/shade/bundles/ngx-color-shade.umd.js.map +0 -1
- package/shade/esm2015/ngx-color-shade.js +0 -5
- package/shade/esm2015/shade-picker.component.js +0 -71
- package/shade/fesm2015/ngx-color-shade.js +0 -78
- package/shade/fesm2015/ngx-color-shade.js.map +0 -1
- package/shade/ngx-color-shade.metadata.json +0 -1
- package/sketch/bundles/ngx-color-sketch.umd.js +0 -581
- package/sketch/bundles/ngx-color-sketch.umd.js.map +0 -1
- package/sketch/esm2015/ngx-color-sketch.js +0 -7
- package/sketch/esm2015/sketch-fields.component.js +0 -181
- package/sketch/esm2015/sketch-preset-colors.component.js +0 -76
- package/sketch/esm2015/sketch.component.js +0 -199
- package/sketch/fesm2015/ngx-color-sketch.js +0 -458
- package/sketch/fesm2015/ngx-color-sketch.js.map +0 -1
- package/sketch/ngx-color-sketch.metadata.json +0 -1
- package/slider/bundles/ngx-color-slider.umd.js +0 -466
- package/slider/bundles/ngx-color-slider.umd.js.map +0 -1
- package/slider/esm2015/ngx-color-slider.js +0 -7
- package/slider/esm2015/slider-swatch.component.js +0 -65
- package/slider/esm2015/slider-swatches.component.js +0 -84
- package/slider/esm2015/slider.component.js +0 -77
- package/slider/fesm2015/ngx-color-slider.js +0 -229
- package/slider/fesm2015/ngx-color-slider.js.map +0 -1
- package/slider/ngx-color-slider.metadata.json +0 -1
- package/swatches/bundles/ngx-color-swatches.umd.js +0 -608
- package/swatches/bundles/ngx-color-swatches.umd.js.map +0 -1
- package/swatches/esm2015/ngx-color-swatches.js +0 -7
- package/swatches/esm2015/swatches-color.component.js +0 -90
- package/swatches/esm2015/swatches-group.component.js +0 -42
- package/swatches/esm2015/swatches.component.js +0 -213
- package/swatches/fesm2015/ngx-color-swatches.js +0 -347
- package/swatches/fesm2015/ngx-color-swatches.js.map +0 -1
- package/swatches/ngx-color-swatches.metadata.json +0 -1
- package/twitter/bundles/ngx-color-twitter.umd.js +0 -429
- package/twitter/bundles/ngx-color-twitter.umd.js.map +0 -1
- package/twitter/esm2015/ngx-color-twitter.js +0 -5
- package/twitter/esm2015/twitter.component.js +0 -203
- package/twitter/fesm2015/ngx-color-twitter.js +0 -210
- package/twitter/fesm2015/ngx-color-twitter.js.map +0 -1
- package/twitter/ngx-color-twitter.metadata.json +0 -1
package/fesm2015/ngx-color.js
DELETED
@@ -1,1228 +0,0 @@
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
2
|
-
import { Component, ChangeDetectionStrategy, Input, NgModule, Directive, ElementRef, Output, HostListener, EventEmitter, isDevMode, forwardRef } from '@angular/core';
|
3
|
-
import { Subject, Subscription, fromEvent } from 'rxjs';
|
4
|
-
import { distinctUntilChanged, debounceTime, tap } from 'rxjs/operators';
|
5
|
-
import { TinyColor } from '@ctrl/tinycolor';
|
6
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
7
|
-
|
8
|
-
const checkboardCache = {};
|
9
|
-
function render(c1, c2, size) {
|
10
|
-
if (typeof document === 'undefined') {
|
11
|
-
return null;
|
12
|
-
}
|
13
|
-
const canvas = document.createElement('canvas');
|
14
|
-
canvas.width = size * 2;
|
15
|
-
canvas.height = size * 2;
|
16
|
-
const ctx = canvas.getContext('2d');
|
17
|
-
if (!ctx) {
|
18
|
-
return null;
|
19
|
-
} // If no context can be found, return early.
|
20
|
-
ctx.fillStyle = c1;
|
21
|
-
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
22
|
-
ctx.fillStyle = c2;
|
23
|
-
ctx.fillRect(0, 0, size, size);
|
24
|
-
ctx.translate(size, size);
|
25
|
-
ctx.fillRect(0, 0, size, size);
|
26
|
-
return canvas.toDataURL();
|
27
|
-
}
|
28
|
-
function getCheckerboard(c1, c2, size) {
|
29
|
-
const key = `${c1}-${c2}-${size}`;
|
30
|
-
if (checkboardCache[key]) {
|
31
|
-
return checkboardCache[key];
|
32
|
-
}
|
33
|
-
const checkboard = render(c1, c2, size);
|
34
|
-
if (!checkboard) {
|
35
|
-
return null;
|
36
|
-
}
|
37
|
-
checkboardCache[key] = checkboard;
|
38
|
-
return checkboard;
|
39
|
-
}
|
40
|
-
|
41
|
-
class CheckboardComponent {
|
42
|
-
constructor() {
|
43
|
-
this.white = 'transparent';
|
44
|
-
this.size = 8;
|
45
|
-
this.grey = 'rgba(0,0,0,.08)';
|
46
|
-
}
|
47
|
-
ngOnInit() {
|
48
|
-
const background = getCheckerboard(this.white, this.grey, this.size);
|
49
|
-
this.gridStyles = {
|
50
|
-
borderRadius: this.borderRadius,
|
51
|
-
boxShadow: this.boxShadow,
|
52
|
-
background: `url(${background}) center left`,
|
53
|
-
};
|
54
|
-
}
|
55
|
-
}
|
56
|
-
CheckboardComponent.decorators = [
|
57
|
-
{ type: Component, args: [{
|
58
|
-
selector: 'color-checkboard',
|
59
|
-
template: `<div class="grid" [ngStyle]="gridStyles"></div>`,
|
60
|
-
preserveWhitespaces: false,
|
61
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
62
|
-
styles: [`
|
63
|
-
.grid {
|
64
|
-
top: 0px;
|
65
|
-
right: 0px;
|
66
|
-
bottom: 0px;
|
67
|
-
left: 0px;
|
68
|
-
position: absolute;
|
69
|
-
}
|
70
|
-
`]
|
71
|
-
},] }
|
72
|
-
];
|
73
|
-
CheckboardComponent.propDecorators = {
|
74
|
-
white: [{ type: Input }],
|
75
|
-
size: [{ type: Input }],
|
76
|
-
grey: [{ type: Input }],
|
77
|
-
boxShadow: [{ type: Input }],
|
78
|
-
borderRadius: [{ type: Input }]
|
79
|
-
};
|
80
|
-
class CheckboardModule {
|
81
|
-
}
|
82
|
-
CheckboardModule.decorators = [
|
83
|
-
{ type: NgModule, args: [{
|
84
|
-
declarations: [CheckboardComponent],
|
85
|
-
exports: [CheckboardComponent],
|
86
|
-
imports: [CommonModule],
|
87
|
-
},] }
|
88
|
-
];
|
89
|
-
|
90
|
-
class CoordinatesDirective {
|
91
|
-
constructor(el) {
|
92
|
-
this.el = el;
|
93
|
-
this.coordinatesChange = new Subject();
|
94
|
-
this.mousechange = new Subject();
|
95
|
-
this.mouseListening = false;
|
96
|
-
}
|
97
|
-
mousemove($event, x, y, isTouch = false) {
|
98
|
-
if (this.mouseListening) {
|
99
|
-
$event.preventDefault();
|
100
|
-
this.mousechange.next({ $event, x, y, isTouch });
|
101
|
-
}
|
102
|
-
}
|
103
|
-
mouseup() {
|
104
|
-
this.mouseListening = false;
|
105
|
-
}
|
106
|
-
mousedown($event, x, y, isTouch = false) {
|
107
|
-
$event.preventDefault();
|
108
|
-
this.mouseListening = true;
|
109
|
-
this.mousechange.next({ $event, x, y, isTouch });
|
110
|
-
}
|
111
|
-
ngOnInit() {
|
112
|
-
this.sub = this.mousechange
|
113
|
-
.pipe(
|
114
|
-
// limit times it is updated for the same area
|
115
|
-
distinctUntilChanged((p, q) => p.x === q.x && p.y === q.y))
|
116
|
-
.subscribe(n => this.handleChange(n.x, n.y, n.$event, n.isTouch));
|
117
|
-
}
|
118
|
-
ngOnDestroy() {
|
119
|
-
this.sub.unsubscribe();
|
120
|
-
}
|
121
|
-
handleChange(x, y, $event, isTouch) {
|
122
|
-
const containerWidth = this.el.nativeElement.clientWidth;
|
123
|
-
const containerHeight = this.el.nativeElement.clientHeight;
|
124
|
-
const left = x -
|
125
|
-
(this.el.nativeElement.getBoundingClientRect().left + window.pageXOffset);
|
126
|
-
let top = y - this.el.nativeElement.getBoundingClientRect().top;
|
127
|
-
if (!isTouch) {
|
128
|
-
top = top - window.pageYOffset;
|
129
|
-
}
|
130
|
-
this.coordinatesChange.next({
|
131
|
-
x,
|
132
|
-
y,
|
133
|
-
top,
|
134
|
-
left,
|
135
|
-
containerWidth,
|
136
|
-
containerHeight,
|
137
|
-
$event,
|
138
|
-
});
|
139
|
-
}
|
140
|
-
}
|
141
|
-
CoordinatesDirective.decorators = [
|
142
|
-
{ type: Directive, args: [{ selector: '[ngx-color-coordinates]' },] }
|
143
|
-
];
|
144
|
-
CoordinatesDirective.ctorParameters = () => [
|
145
|
-
{ type: ElementRef }
|
146
|
-
];
|
147
|
-
CoordinatesDirective.propDecorators = {
|
148
|
-
coordinatesChange: [{ type: Output }],
|
149
|
-
mousemove: [{ type: HostListener, args: ['window:mousemove', ['$event', '$event.pageX', '$event.pageY'],] }, { type: HostListener, args: ['window:touchmove', [
|
150
|
-
'$event',
|
151
|
-
'$event.touches[0].clientX',
|
152
|
-
'$event.touches[0].clientY',
|
153
|
-
'true',
|
154
|
-
],] }],
|
155
|
-
mouseup: [{ type: HostListener, args: ['window:mouseup',] }, { type: HostListener, args: ['window:touchend',] }],
|
156
|
-
mousedown: [{ type: HostListener, args: ['mousedown', ['$event', '$event.pageX', '$event.pageY'],] }, { type: HostListener, args: ['touchstart', [
|
157
|
-
'$event',
|
158
|
-
'$event.touches[0].clientX',
|
159
|
-
'$event.touches[0].clientY',
|
160
|
-
'true',
|
161
|
-
],] }]
|
162
|
-
};
|
163
|
-
class CoordinatesModule {
|
164
|
-
}
|
165
|
-
CoordinatesModule.decorators = [
|
166
|
-
{ type: NgModule, args: [{
|
167
|
-
declarations: [CoordinatesDirective],
|
168
|
-
exports: [CoordinatesDirective],
|
169
|
-
},] }
|
170
|
-
];
|
171
|
-
|
172
|
-
class AlphaComponent {
|
173
|
-
constructor() {
|
174
|
-
this.direction = 'horizontal';
|
175
|
-
this.onChange = new EventEmitter();
|
176
|
-
}
|
177
|
-
ngOnChanges() {
|
178
|
-
if (this.direction === 'vertical') {
|
179
|
-
this.pointerLeft = 0;
|
180
|
-
this.pointerTop = this.rgb.a * 100;
|
181
|
-
this.gradient = {
|
182
|
-
background: `linear-gradient(to bottom, rgba(${this.rgb.r},${this.rgb.g},${this.rgb.b}, 0) 0%,
|
183
|
-
rgba(${this.rgb.r},${this.rgb.g},${this.rgb.b}, 1) 100%)`,
|
184
|
-
};
|
185
|
-
}
|
186
|
-
else {
|
187
|
-
this.gradient = {
|
188
|
-
background: `linear-gradient(to right, rgba(${this.rgb.r},${this.rgb.g},${this.rgb.b}, 0) 0%,
|
189
|
-
rgba(${this.rgb.r},${this.rgb.g},${this.rgb.b}, 1) 100%)`,
|
190
|
-
};
|
191
|
-
this.pointerLeft = this.rgb.a * 100;
|
192
|
-
}
|
193
|
-
}
|
194
|
-
handleChange({ top, left, containerHeight, containerWidth, $event }) {
|
195
|
-
let data;
|
196
|
-
if (this.direction === 'vertical') {
|
197
|
-
let a;
|
198
|
-
if (top < 0) {
|
199
|
-
a = 0;
|
200
|
-
}
|
201
|
-
else if (top > containerHeight) {
|
202
|
-
a = 1;
|
203
|
-
}
|
204
|
-
else {
|
205
|
-
a = Math.round(top * 100 / containerHeight) / 100;
|
206
|
-
}
|
207
|
-
if (this.hsl.a !== a) {
|
208
|
-
data = {
|
209
|
-
h: this.hsl.h,
|
210
|
-
s: this.hsl.s,
|
211
|
-
l: this.hsl.l,
|
212
|
-
a,
|
213
|
-
source: 'rgb',
|
214
|
-
};
|
215
|
-
}
|
216
|
-
}
|
217
|
-
else {
|
218
|
-
let a;
|
219
|
-
if (left < 0) {
|
220
|
-
a = 0;
|
221
|
-
}
|
222
|
-
else if (left > containerWidth) {
|
223
|
-
a = 1;
|
224
|
-
}
|
225
|
-
else {
|
226
|
-
a = Math.round(left * 100 / containerWidth) / 100;
|
227
|
-
}
|
228
|
-
if (this.hsl.a !== a) {
|
229
|
-
data = {
|
230
|
-
h: this.hsl.h,
|
231
|
-
s: this.hsl.s,
|
232
|
-
l: this.hsl.l,
|
233
|
-
a,
|
234
|
-
source: 'rgb',
|
235
|
-
};
|
236
|
-
}
|
237
|
-
}
|
238
|
-
if (!data) {
|
239
|
-
return;
|
240
|
-
}
|
241
|
-
this.onChange.emit({ data, $event });
|
242
|
-
}
|
243
|
-
}
|
244
|
-
AlphaComponent.decorators = [
|
245
|
-
{ type: Component, args: [{
|
246
|
-
selector: 'color-alpha',
|
247
|
-
template: `
|
248
|
-
<div class="alpha" [style.border-radius]="radius">
|
249
|
-
<div class="alpha-checkboard">
|
250
|
-
<color-checkboard></color-checkboard>
|
251
|
-
</div>
|
252
|
-
<div class="alpha-gradient" [ngStyle]="gradient" [style.box-shadow]="shadow" [style.border-radius]="radius"></div>
|
253
|
-
<div ngx-color-coordinates (coordinatesChange)="handleChange($event)" class="alpha-container color-alpha-{{direction}}">
|
254
|
-
<div class="alpha-pointer" [style.left.%]="pointerLeft" [style.top.%]="pointerTop">
|
255
|
-
<div class="alpha-slider" [ngStyle]="pointer"></div>
|
256
|
-
</div>
|
257
|
-
</div>
|
258
|
-
</div>
|
259
|
-
`,
|
260
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
261
|
-
preserveWhitespaces: false,
|
262
|
-
styles: [`
|
263
|
-
.alpha {
|
264
|
-
position: absolute;
|
265
|
-
top: 0;
|
266
|
-
bottom: 0;
|
267
|
-
left: 0;
|
268
|
-
right: 0;
|
269
|
-
}
|
270
|
-
.alpha-checkboard {
|
271
|
-
position: absolute;
|
272
|
-
top: 0;
|
273
|
-
bottom: 0;
|
274
|
-
left: 0;
|
275
|
-
right: 0;
|
276
|
-
overflow: hidden;
|
277
|
-
}
|
278
|
-
.alpha-gradient {
|
279
|
-
position: absolute;
|
280
|
-
top: 0;
|
281
|
-
bottom: 0;
|
282
|
-
left: 0;
|
283
|
-
right: 0;
|
284
|
-
}
|
285
|
-
.alpha-container {
|
286
|
-
position: relative;
|
287
|
-
height: 100%;
|
288
|
-
margin: 0 3px;
|
289
|
-
}
|
290
|
-
.alpha-pointer {
|
291
|
-
position: absolute;
|
292
|
-
}
|
293
|
-
.alpha-slider {
|
294
|
-
width: 4px;
|
295
|
-
border-radius: 1px;
|
296
|
-
height: 8px;
|
297
|
-
box-shadow: 0 0 2px rgba(0, 0, 0, .6);
|
298
|
-
background: #fff;
|
299
|
-
margin-top: 1px;
|
300
|
-
transform: translateX(-2px);
|
301
|
-
}
|
302
|
-
`]
|
303
|
-
},] }
|
304
|
-
];
|
305
|
-
AlphaComponent.propDecorators = {
|
306
|
-
hsl: [{ type: Input }],
|
307
|
-
rgb: [{ type: Input }],
|
308
|
-
pointer: [{ type: Input }],
|
309
|
-
shadow: [{ type: Input }],
|
310
|
-
radius: [{ type: Input }],
|
311
|
-
direction: [{ type: Input }],
|
312
|
-
onChange: [{ type: Output }]
|
313
|
-
};
|
314
|
-
class AlphaModule {
|
315
|
-
}
|
316
|
-
AlphaModule.decorators = [
|
317
|
-
{ type: NgModule, args: [{
|
318
|
-
declarations: [AlphaComponent],
|
319
|
-
exports: [AlphaComponent],
|
320
|
-
imports: [CommonModule, CheckboardModule, CoordinatesModule],
|
321
|
-
},] }
|
322
|
-
];
|
323
|
-
|
324
|
-
function simpleCheckForValidColor(data) {
|
325
|
-
const keysToCheck = ['r', 'g', 'b', 'a', 'h', 's', 'l', 'v'];
|
326
|
-
let checked = 0;
|
327
|
-
let passed = 0;
|
328
|
-
keysToCheck.forEach(letter => {
|
329
|
-
if (!data[letter]) {
|
330
|
-
return;
|
331
|
-
}
|
332
|
-
checked += 1;
|
333
|
-
if (!isNaN(data[letter])) {
|
334
|
-
passed += 1;
|
335
|
-
}
|
336
|
-
if (letter === 's' || letter === 'l') {
|
337
|
-
const percentPatt = /^\d+%$/;
|
338
|
-
if (percentPatt.test(data[letter])) {
|
339
|
-
passed += 1;
|
340
|
-
}
|
341
|
-
}
|
342
|
-
});
|
343
|
-
return checked === passed ? data : false;
|
344
|
-
}
|
345
|
-
function toState(data, oldHue, disableAlpha) {
|
346
|
-
const color = data.hex ? new TinyColor(data.hex) : new TinyColor(data);
|
347
|
-
if (disableAlpha) {
|
348
|
-
color.setAlpha(1);
|
349
|
-
}
|
350
|
-
const hsl = color.toHsl();
|
351
|
-
const hsv = color.toHsv();
|
352
|
-
const rgb = color.toRgb();
|
353
|
-
const hex = color.toHex();
|
354
|
-
if (hsl.s === 0) {
|
355
|
-
hsl.h = oldHue || 0;
|
356
|
-
hsv.h = oldHue || 0;
|
357
|
-
}
|
358
|
-
const transparent = hex === '000000' && rgb.a === 0;
|
359
|
-
return {
|
360
|
-
hsl,
|
361
|
-
hex: transparent ? 'transparent' : color.toHexString(),
|
362
|
-
rgb,
|
363
|
-
hsv,
|
364
|
-
oldHue: data.h || oldHue || hsl.h,
|
365
|
-
source: data.source,
|
366
|
-
};
|
367
|
-
}
|
368
|
-
function isValidHex(hex) {
|
369
|
-
return new TinyColor(hex).isValid;
|
370
|
-
}
|
371
|
-
function getContrastingColor(data) {
|
372
|
-
if (!data) {
|
373
|
-
return '#fff';
|
374
|
-
}
|
375
|
-
const col = toState(data);
|
376
|
-
if (col.hex === 'transparent') {
|
377
|
-
return 'rgba(0,0,0,0.4)';
|
378
|
-
}
|
379
|
-
const yiq = (col.rgb.r * 299 + col.rgb.g * 587 + col.rgb.b * 114) / 1000;
|
380
|
-
return yiq >= 128 ? '#000' : '#fff';
|
381
|
-
}
|
382
|
-
|
383
|
-
var ColorMode;
|
384
|
-
(function (ColorMode) {
|
385
|
-
ColorMode["HEX"] = "hex";
|
386
|
-
ColorMode["HSL"] = "hsl";
|
387
|
-
ColorMode["HSV"] = "hsv";
|
388
|
-
ColorMode["RGB"] = "rgb";
|
389
|
-
})(ColorMode || (ColorMode = {}));
|
390
|
-
class ColorWrap {
|
391
|
-
constructor() {
|
392
|
-
/**
|
393
|
-
* Descriptors the return color format if the component is used with two-way binding
|
394
|
-
*/
|
395
|
-
this.mode = ColorMode.HEX;
|
396
|
-
this.color = {
|
397
|
-
h: 250,
|
398
|
-
s: 0.5,
|
399
|
-
l: 0.2,
|
400
|
-
a: 1,
|
401
|
-
};
|
402
|
-
this.colorChange = new EventEmitter();
|
403
|
-
this.onChange = new EventEmitter();
|
404
|
-
this.onChangeComplete = new EventEmitter();
|
405
|
-
this.onSwatchHover = new EventEmitter();
|
406
|
-
this._onChangeCompleteSubscription = new Subscription();
|
407
|
-
this._onSwatchHoverSubscription = new Subscription();
|
408
|
-
}
|
409
|
-
ngOnInit() {
|
410
|
-
this.changes = this.onChange
|
411
|
-
.pipe(debounceTime(100), tap(event => {
|
412
|
-
this.onChangeComplete.emit(event);
|
413
|
-
switch (this.mode) {
|
414
|
-
case ColorMode.HEX:
|
415
|
-
this.colorChange.emit(event.color.hex);
|
416
|
-
break;
|
417
|
-
case ColorMode.HSL:
|
418
|
-
this.colorChange.emit(event.color.hsl);
|
419
|
-
break;
|
420
|
-
case ColorMode.HSV:
|
421
|
-
this.colorChange.emit(event.color.hsv);
|
422
|
-
break;
|
423
|
-
case ColorMode.RGB:
|
424
|
-
this.colorChange.emit(event.color.rgb);
|
425
|
-
break;
|
426
|
-
default:
|
427
|
-
const msg = `The mode '${this.mode}' is not supported`;
|
428
|
-
if (isDevMode()) {
|
429
|
-
throw new Error(msg);
|
430
|
-
}
|
431
|
-
else {
|
432
|
-
console.warn(msg);
|
433
|
-
}
|
434
|
-
break;
|
435
|
-
}
|
436
|
-
}))
|
437
|
-
.subscribe();
|
438
|
-
this.setState(toState(this.color, 0));
|
439
|
-
this.currentColor = this.hex;
|
440
|
-
}
|
441
|
-
ngOnChanges() {
|
442
|
-
this.setState(toState(this.color, this.oldHue));
|
443
|
-
}
|
444
|
-
ngOnDestroy() {
|
445
|
-
var _a;
|
446
|
-
(_a = this.changes) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
447
|
-
this._onChangeCompleteSubscription.unsubscribe();
|
448
|
-
this._onSwatchHoverSubscription.unsubscribe();
|
449
|
-
}
|
450
|
-
setState(data) {
|
451
|
-
this.oldHue = data.oldHue;
|
452
|
-
this.hsl = data.hsl;
|
453
|
-
this.hsv = data.hsv;
|
454
|
-
this.rgb = data.rgb;
|
455
|
-
this.hex = data.hex;
|
456
|
-
this.source = data.source;
|
457
|
-
this.afterValidChange();
|
458
|
-
}
|
459
|
-
handleChange(data, $event) {
|
460
|
-
const isValidColor = simpleCheckForValidColor(data);
|
461
|
-
if (isValidColor) {
|
462
|
-
const color = toState(data, data.h || this.oldHue, this.disableAlpha);
|
463
|
-
this.setState(color);
|
464
|
-
this.onChange.emit({ color, $event });
|
465
|
-
this.afterValidChange();
|
466
|
-
}
|
467
|
-
}
|
468
|
-
/** hook for components after a complete change */
|
469
|
-
afterValidChange() { }
|
470
|
-
handleSwatchHover(data, $event) {
|
471
|
-
const isValidColor = simpleCheckForValidColor(data);
|
472
|
-
if (isValidColor) {
|
473
|
-
const color = toState(data, data.h || this.oldHue);
|
474
|
-
this.setState(color);
|
475
|
-
this.onSwatchHover.emit({ color, $event });
|
476
|
-
}
|
477
|
-
}
|
478
|
-
registerOnChange(fn) {
|
479
|
-
this._onChangeCompleteSubscription.add(this.onChangeComplete.pipe(tap(event => fn(event.color.hex))).subscribe());
|
480
|
-
}
|
481
|
-
registerOnTouched(fn) {
|
482
|
-
this._onSwatchHoverSubscription.add(this.onSwatchHover.pipe(tap(() => fn())).subscribe());
|
483
|
-
}
|
484
|
-
setDisabledState(isDisabled) { }
|
485
|
-
writeValue(hex) {
|
486
|
-
this.color = hex;
|
487
|
-
}
|
488
|
-
}
|
489
|
-
ColorWrap.decorators = [
|
490
|
-
{ type: Component, args: [{
|
491
|
-
// create seletor base for test override property
|
492
|
-
selector: 'color-wrap',
|
493
|
-
template: ``,
|
494
|
-
providers: [
|
495
|
-
{
|
496
|
-
provide: NG_VALUE_ACCESSOR,
|
497
|
-
useExisting: forwardRef(() => ColorWrap),
|
498
|
-
multi: true,
|
499
|
-
}
|
500
|
-
]
|
501
|
-
},] }
|
502
|
-
];
|
503
|
-
ColorWrap.propDecorators = {
|
504
|
-
className: [{ type: Input }],
|
505
|
-
mode: [{ type: Input }],
|
506
|
-
color: [{ type: Input }],
|
507
|
-
colorChange: [{ type: Output }],
|
508
|
-
onChange: [{ type: Output }],
|
509
|
-
onChangeComplete: [{ type: Output }],
|
510
|
-
onSwatchHover: [{ type: Output }]
|
511
|
-
};
|
512
|
-
class ColorWrapModule {
|
513
|
-
}
|
514
|
-
ColorWrapModule.decorators = [
|
515
|
-
{ type: NgModule, args: [{
|
516
|
-
declarations: [ColorWrap],
|
517
|
-
exports: [ColorWrap],
|
518
|
-
imports: [CommonModule],
|
519
|
-
},] }
|
520
|
-
];
|
521
|
-
|
522
|
-
let nextUniqueId = 0;
|
523
|
-
class EditableInputComponent {
|
524
|
-
constructor() {
|
525
|
-
this.placeholder = '';
|
526
|
-
this.onChange = new EventEmitter();
|
527
|
-
this.focus = false;
|
528
|
-
this.uniqueId = `editableInput-${++nextUniqueId}`;
|
529
|
-
}
|
530
|
-
ngOnInit() {
|
531
|
-
this.wrapStyle = this.style && this.style.wrap ? this.style.wrap : {};
|
532
|
-
this.inputStyle = this.style && this.style.input ? this.style.input : {};
|
533
|
-
this.labelStyle = this.style && this.style.label ? this.style.label : {};
|
534
|
-
if (this.dragLabel) {
|
535
|
-
this.labelStyle.cursor = 'ew-resize';
|
536
|
-
}
|
537
|
-
}
|
538
|
-
handleFocus($event) {
|
539
|
-
this.focus = true;
|
540
|
-
}
|
541
|
-
handleFocusOut($event) {
|
542
|
-
this.focus = false;
|
543
|
-
this.currentValue = this.blurValue;
|
544
|
-
}
|
545
|
-
handleKeydown($event) {
|
546
|
-
// In case `e.target.value` is a percentage remove the `%` character
|
547
|
-
// and update accordingly with a percentage
|
548
|
-
// https://github.com/casesandberg/react-color/issues/383
|
549
|
-
const stringValue = String($event.target.value);
|
550
|
-
const isPercentage = stringValue.indexOf('%') > -1;
|
551
|
-
const num = Number(stringValue.replace(/%/g, ''));
|
552
|
-
if (isNaN(num)) {
|
553
|
-
return;
|
554
|
-
}
|
555
|
-
const amount = this.arrowOffset || 1;
|
556
|
-
// Up
|
557
|
-
if ($event.keyCode === 38) {
|
558
|
-
if (this.label) {
|
559
|
-
this.onChange.emit({
|
560
|
-
data: { [this.label]: num + amount },
|
561
|
-
$event,
|
562
|
-
});
|
563
|
-
}
|
564
|
-
else {
|
565
|
-
this.onChange.emit({ data: num + amount, $event });
|
566
|
-
}
|
567
|
-
if (isPercentage) {
|
568
|
-
this.currentValue = `${num + amount}%`;
|
569
|
-
}
|
570
|
-
else {
|
571
|
-
this.currentValue = num + amount;
|
572
|
-
}
|
573
|
-
}
|
574
|
-
// Down
|
575
|
-
if ($event.keyCode === 40) {
|
576
|
-
if (this.label) {
|
577
|
-
this.onChange.emit({
|
578
|
-
data: { [this.label]: num - amount },
|
579
|
-
$event,
|
580
|
-
});
|
581
|
-
}
|
582
|
-
else {
|
583
|
-
this.onChange.emit({ data: num - amount, $event });
|
584
|
-
}
|
585
|
-
if (isPercentage) {
|
586
|
-
this.currentValue = `${num - amount}%`;
|
587
|
-
}
|
588
|
-
else {
|
589
|
-
this.currentValue = num - amount;
|
590
|
-
}
|
591
|
-
}
|
592
|
-
}
|
593
|
-
handleKeyup($event) {
|
594
|
-
if ($event.keyCode === 40 || $event.keyCode === 38) {
|
595
|
-
return;
|
596
|
-
}
|
597
|
-
if (`${this.currentValue}` === $event.target.value) {
|
598
|
-
return;
|
599
|
-
}
|
600
|
-
if (this.label) {
|
601
|
-
this.onChange.emit({
|
602
|
-
data: { [this.label]: $event.target.value },
|
603
|
-
$event,
|
604
|
-
});
|
605
|
-
}
|
606
|
-
else {
|
607
|
-
this.onChange.emit({ data: $event.target.value, $event });
|
608
|
-
}
|
609
|
-
}
|
610
|
-
ngOnChanges() {
|
611
|
-
if (!this.focus) {
|
612
|
-
this.currentValue = String(this.value).toUpperCase();
|
613
|
-
this.blurValue = String(this.value).toUpperCase();
|
614
|
-
}
|
615
|
-
else {
|
616
|
-
this.blurValue = String(this.value).toUpperCase();
|
617
|
-
}
|
618
|
-
}
|
619
|
-
ngOnDestroy() {
|
620
|
-
this.unsubscribe();
|
621
|
-
}
|
622
|
-
subscribe() {
|
623
|
-
this.mousemove = fromEvent(document, 'mousemove').subscribe((ev) => this.handleDrag(ev));
|
624
|
-
this.mouseup = fromEvent(document, 'mouseup').subscribe(() => this.unsubscribe());
|
625
|
-
}
|
626
|
-
unsubscribe() {
|
627
|
-
if (this.mousemove) {
|
628
|
-
this.mousemove.unsubscribe();
|
629
|
-
}
|
630
|
-
if (this.mouseup) {
|
631
|
-
this.mouseup.unsubscribe();
|
632
|
-
}
|
633
|
-
}
|
634
|
-
handleMousedown($event) {
|
635
|
-
if (this.dragLabel) {
|
636
|
-
$event.preventDefault();
|
637
|
-
this.handleDrag($event);
|
638
|
-
this.subscribe();
|
639
|
-
}
|
640
|
-
}
|
641
|
-
handleDrag($event) {
|
642
|
-
if (this.dragLabel) {
|
643
|
-
const newValue = Math.round(this.value + $event.movementX);
|
644
|
-
if (newValue >= 0 && newValue <= this.dragMax) {
|
645
|
-
this.onChange.emit({ data: { [this.label]: newValue }, $event });
|
646
|
-
}
|
647
|
-
}
|
648
|
-
}
|
649
|
-
}
|
650
|
-
EditableInputComponent.decorators = [
|
651
|
-
{ type: Component, args: [{
|
652
|
-
selector: 'color-editable-input',
|
653
|
-
template: `
|
654
|
-
<div class="wrap" [ngStyle]="wrapStyle">
|
655
|
-
<input
|
656
|
-
[ngStyle]="inputStyle"
|
657
|
-
spellCheck="false"
|
658
|
-
[value]="currentValue"
|
659
|
-
[placeholder]="placeholder"
|
660
|
-
(keydown)="handleKeydown($event)"
|
661
|
-
(keyup)="handleKeyup($event)"
|
662
|
-
(focus)="handleFocus($event)"
|
663
|
-
(focusout)="handleFocusOut($event)"
|
664
|
-
[attr.aria-labelledby]="uniqueId"
|
665
|
-
/>
|
666
|
-
<span [id]="uniqueId" *ngIf="label" [ngStyle]="labelStyle" (mousedown)="handleMousedown($event)">
|
667
|
-
{{ label }}
|
668
|
-
</span>
|
669
|
-
</div>
|
670
|
-
`,
|
671
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
672
|
-
styles: [`
|
673
|
-
:host {
|
674
|
-
display: flex;
|
675
|
-
}
|
676
|
-
.wrap {
|
677
|
-
position: relative;
|
678
|
-
}
|
679
|
-
`]
|
680
|
-
},] }
|
681
|
-
];
|
682
|
-
EditableInputComponent.propDecorators = {
|
683
|
-
style: [{ type: Input }],
|
684
|
-
label: [{ type: Input }],
|
685
|
-
value: [{ type: Input }],
|
686
|
-
arrowOffset: [{ type: Input }],
|
687
|
-
dragLabel: [{ type: Input }],
|
688
|
-
dragMax: [{ type: Input }],
|
689
|
-
placeholder: [{ type: Input }],
|
690
|
-
onChange: [{ type: Output }]
|
691
|
-
};
|
692
|
-
class EditableInputModule {
|
693
|
-
}
|
694
|
-
EditableInputModule.decorators = [
|
695
|
-
{ type: NgModule, args: [{
|
696
|
-
declarations: [EditableInputComponent],
|
697
|
-
exports: [EditableInputComponent],
|
698
|
-
imports: [CommonModule],
|
699
|
-
},] }
|
700
|
-
];
|
701
|
-
|
702
|
-
class HueComponent {
|
703
|
-
constructor() {
|
704
|
-
this.hidePointer = false;
|
705
|
-
this.direction = 'horizontal';
|
706
|
-
this.onChange = new EventEmitter();
|
707
|
-
this.left = '0px';
|
708
|
-
this.top = '';
|
709
|
-
}
|
710
|
-
ngOnChanges() {
|
711
|
-
if (this.direction === 'horizontal') {
|
712
|
-
this.left = `${this.hsl.h * 100 / 360}%`;
|
713
|
-
}
|
714
|
-
else {
|
715
|
-
this.top = `${-(this.hsl.h * 100 / 360) + 100}%`;
|
716
|
-
}
|
717
|
-
}
|
718
|
-
handleChange({ top, left, containerHeight, containerWidth, $event }) {
|
719
|
-
let data;
|
720
|
-
if (this.direction === 'vertical') {
|
721
|
-
let h;
|
722
|
-
if (top < 0) {
|
723
|
-
h = 359;
|
724
|
-
}
|
725
|
-
else if (top > containerHeight) {
|
726
|
-
h = 0;
|
727
|
-
}
|
728
|
-
else {
|
729
|
-
const percent = -(top * 100 / containerHeight) + 100;
|
730
|
-
h = 360 * percent / 100;
|
731
|
-
}
|
732
|
-
if (this.hsl.h !== h) {
|
733
|
-
data = {
|
734
|
-
h,
|
735
|
-
s: this.hsl.s,
|
736
|
-
l: this.hsl.l,
|
737
|
-
a: this.hsl.a,
|
738
|
-
source: 'rgb',
|
739
|
-
};
|
740
|
-
}
|
741
|
-
}
|
742
|
-
else {
|
743
|
-
let h;
|
744
|
-
if (left < 0) {
|
745
|
-
h = 0;
|
746
|
-
}
|
747
|
-
else if (left > containerWidth) {
|
748
|
-
h = 359;
|
749
|
-
}
|
750
|
-
else {
|
751
|
-
const percent = left * 100 / containerWidth;
|
752
|
-
h = 360 * percent / 100;
|
753
|
-
}
|
754
|
-
if (this.hsl.h !== h) {
|
755
|
-
data = {
|
756
|
-
h,
|
757
|
-
s: this.hsl.s,
|
758
|
-
l: this.hsl.l,
|
759
|
-
a: this.hsl.a,
|
760
|
-
source: 'rgb',
|
761
|
-
};
|
762
|
-
}
|
763
|
-
}
|
764
|
-
if (!data) {
|
765
|
-
return;
|
766
|
-
}
|
767
|
-
this.onChange.emit({ data, $event });
|
768
|
-
}
|
769
|
-
}
|
770
|
-
HueComponent.decorators = [
|
771
|
-
{ type: Component, args: [{
|
772
|
-
selector: 'color-hue',
|
773
|
-
template: `
|
774
|
-
<div class="color-hue color-hue-{{direction}}" [style.border-radius.px]="radius" [style.box-shadow]="shadow">
|
775
|
-
<div ngx-color-coordinates (coordinatesChange)="handleChange($event)" class="color-hue-container">
|
776
|
-
<div class="color-hue-pointer" [style.left]="left" [style.top]="top" *ngIf="!hidePointer">
|
777
|
-
<div class="color-hue-slider" [ngStyle]="pointer"></div>
|
778
|
-
</div>
|
779
|
-
</div>
|
780
|
-
</div>
|
781
|
-
`,
|
782
|
-
preserveWhitespaces: false,
|
783
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
784
|
-
styles: [`
|
785
|
-
.color-hue {
|
786
|
-
position: absolute;
|
787
|
-
top: 0;
|
788
|
-
bottom: 0;
|
789
|
-
left: 0;
|
790
|
-
right: 0;
|
791
|
-
}
|
792
|
-
.color-hue-container {
|
793
|
-
margin: 0 2px;
|
794
|
-
position: relative;
|
795
|
-
height: 100%;
|
796
|
-
}
|
797
|
-
.color-hue-pointer {
|
798
|
-
position: absolute;
|
799
|
-
}
|
800
|
-
.color-hue-slider {
|
801
|
-
margin-top: 1px;
|
802
|
-
width: 4px;
|
803
|
-
border-radius: 1px;
|
804
|
-
height: 8px;
|
805
|
-
box-shadow: 0 0 2px rgba(0, 0, 0, .6);
|
806
|
-
background: #fff;
|
807
|
-
transform: translateX(-2px);
|
808
|
-
}
|
809
|
-
.color-hue-horizontal {
|
810
|
-
background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0
|
811
|
-
33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
|
812
|
-
}
|
813
|
-
.color-hue-vertical {
|
814
|
-
background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%,
|
815
|
-
#0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
|
816
|
-
}
|
817
|
-
`]
|
818
|
-
},] }
|
819
|
-
];
|
820
|
-
HueComponent.propDecorators = {
|
821
|
-
hsl: [{ type: Input }],
|
822
|
-
pointer: [{ type: Input }],
|
823
|
-
radius: [{ type: Input }],
|
824
|
-
shadow: [{ type: Input }],
|
825
|
-
hidePointer: [{ type: Input }],
|
826
|
-
direction: [{ type: Input }],
|
827
|
-
onChange: [{ type: Output }]
|
828
|
-
};
|
829
|
-
class HueModule {
|
830
|
-
}
|
831
|
-
HueModule.decorators = [
|
832
|
-
{ type: NgModule, args: [{
|
833
|
-
declarations: [HueComponent],
|
834
|
-
exports: [HueComponent],
|
835
|
-
imports: [CommonModule, CoordinatesModule],
|
836
|
-
},] }
|
837
|
-
];
|
838
|
-
|
839
|
-
class RaisedComponent {
|
840
|
-
constructor() {
|
841
|
-
this.zDepth = 1;
|
842
|
-
this.radius = 1;
|
843
|
-
this.background = '#fff';
|
844
|
-
}
|
845
|
-
}
|
846
|
-
RaisedComponent.decorators = [
|
847
|
-
{ type: Component, args: [{
|
848
|
-
selector: 'color-raised',
|
849
|
-
template: `
|
850
|
-
<div class="raised-wrap">
|
851
|
-
<div class="raised-bg zDepth-{{zDepth}}" [style.background]="background"></div>
|
852
|
-
<div class="raised-content">
|
853
|
-
<ng-content></ng-content>
|
854
|
-
</div>
|
855
|
-
</div>
|
856
|
-
`,
|
857
|
-
preserveWhitespaces: false,
|
858
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
859
|
-
styles: [`
|
860
|
-
.raised-wrap {
|
861
|
-
position: relative;
|
862
|
-
display: inline-block;
|
863
|
-
}
|
864
|
-
.raised-bg {
|
865
|
-
position: absolute;
|
866
|
-
top: 0px;
|
867
|
-
right: 0px;
|
868
|
-
bottom: 0px;
|
869
|
-
left: 0px;
|
870
|
-
}
|
871
|
-
.raised-content {
|
872
|
-
position: relative;
|
873
|
-
}
|
874
|
-
.zDepth-0 {
|
875
|
-
box-shadow: none;
|
876
|
-
}
|
877
|
-
.zDepth-1 {
|
878
|
-
box-shadow: 0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16);
|
879
|
-
}
|
880
|
-
.zDepth-2 {
|
881
|
-
box-shadow: 0 6px 20px rgba(0,0,0,.19), 0 8px 17px rgba(0,0,0,.2);
|
882
|
-
}
|
883
|
-
.zDepth-3 {
|
884
|
-
box-shadow: 0 17px 50px rgba(0,0,0,.19), 0 12px 15px rgba(0,0,0,.24);
|
885
|
-
}
|
886
|
-
.zDepth-4 {
|
887
|
-
box-shadow: 0 25px 55px rgba(0,0,0,.21), 0 16px 28px rgba(0,0,0,.22);
|
888
|
-
}
|
889
|
-
.zDepth-5 {
|
890
|
-
box-shadow: 0 40px 77px rgba(0,0,0,.22), 0 27px 24px rgba(0,0,0,.2);
|
891
|
-
}
|
892
|
-
`]
|
893
|
-
},] }
|
894
|
-
];
|
895
|
-
RaisedComponent.propDecorators = {
|
896
|
-
zDepth: [{ type: Input }],
|
897
|
-
radius: [{ type: Input }],
|
898
|
-
background: [{ type: Input }]
|
899
|
-
};
|
900
|
-
class RaisedModule {
|
901
|
-
}
|
902
|
-
RaisedModule.decorators = [
|
903
|
-
{ type: NgModule, args: [{
|
904
|
-
declarations: [RaisedComponent],
|
905
|
-
exports: [RaisedComponent],
|
906
|
-
imports: [CommonModule],
|
907
|
-
},] }
|
908
|
-
];
|
909
|
-
|
910
|
-
class SaturationComponent {
|
911
|
-
constructor() {
|
912
|
-
this.onChange = new EventEmitter();
|
913
|
-
}
|
914
|
-
ngOnChanges() {
|
915
|
-
this.background = `hsl(${this.hsl.h}, 100%, 50%)`;
|
916
|
-
this.pointerTop = -(this.hsv.v * 100) + 1 + 100 + '%';
|
917
|
-
this.pointerLeft = this.hsv.s * 100 + '%';
|
918
|
-
}
|
919
|
-
handleChange({ top, left, containerHeight, containerWidth, $event }) {
|
920
|
-
if (left < 0) {
|
921
|
-
left = 0;
|
922
|
-
}
|
923
|
-
else if (left > containerWidth) {
|
924
|
-
left = containerWidth;
|
925
|
-
}
|
926
|
-
else if (top < 0) {
|
927
|
-
top = 0;
|
928
|
-
}
|
929
|
-
else if (top > containerHeight) {
|
930
|
-
top = containerHeight;
|
931
|
-
}
|
932
|
-
const saturation = left / containerWidth;
|
933
|
-
let bright = -(top / containerHeight) + 1;
|
934
|
-
bright = bright > 0 ? bright : 0;
|
935
|
-
bright = bright > 1 ? 1 : bright;
|
936
|
-
const data = {
|
937
|
-
h: this.hsl.h,
|
938
|
-
s: saturation,
|
939
|
-
v: bright,
|
940
|
-
a: this.hsl.a,
|
941
|
-
source: 'hsva',
|
942
|
-
};
|
943
|
-
this.onChange.emit({ data, $event });
|
944
|
-
}
|
945
|
-
}
|
946
|
-
SaturationComponent.decorators = [
|
947
|
-
{ type: Component, args: [{
|
948
|
-
selector: 'color-saturation',
|
949
|
-
template: `
|
950
|
-
<div class="color-saturation" ngx-color-coordinates (coordinatesChange)="handleChange($event)" [style.background]="background">
|
951
|
-
<div class="saturation-white">
|
952
|
-
<div class="saturation-black"></div>
|
953
|
-
<div class="saturation-pointer" [ngStyle]="pointer" [style.top]="pointerTop" [style.left]="pointerLeft">
|
954
|
-
<div class="saturation-circle" [ngStyle]="circle"></div>
|
955
|
-
</div>
|
956
|
-
</div>
|
957
|
-
</div>
|
958
|
-
`,
|
959
|
-
preserveWhitespaces: false,
|
960
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
961
|
-
styles: [`
|
962
|
-
.saturation-white {
|
963
|
-
background: linear-gradient(to right, #fff, rgba(255,255,255,0));
|
964
|
-
position: absolute;
|
965
|
-
top: 0;
|
966
|
-
bottom: 0;
|
967
|
-
left: 0;
|
968
|
-
right: 0;
|
969
|
-
}
|
970
|
-
.saturation-black {
|
971
|
-
background: linear-gradient(to top, #000, rgba(0,0,0,0));
|
972
|
-
position: absolute;
|
973
|
-
top: 0;
|
974
|
-
bottom: 0;
|
975
|
-
left: 0;
|
976
|
-
right: 0;
|
977
|
-
}
|
978
|
-
.color-saturation {
|
979
|
-
position: absolute;
|
980
|
-
top: 0;
|
981
|
-
bottom: 0;
|
982
|
-
left: 0;
|
983
|
-
right: 0;
|
984
|
-
}
|
985
|
-
.saturation-pointer {
|
986
|
-
position: absolute;
|
987
|
-
cursor: default;
|
988
|
-
}
|
989
|
-
.saturation-circle {
|
990
|
-
width: 4px;
|
991
|
-
height: 4px;
|
992
|
-
box-shadow: 0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3), 0 0 1px 2px rgba(0,0,0,.4);
|
993
|
-
border-radius: 50%;
|
994
|
-
cursor: hand;
|
995
|
-
transform: translate(-2px, -4px);
|
996
|
-
}
|
997
|
-
`]
|
998
|
-
},] }
|
999
|
-
];
|
1000
|
-
SaturationComponent.propDecorators = {
|
1001
|
-
hsl: [{ type: Input }],
|
1002
|
-
hsv: [{ type: Input }],
|
1003
|
-
radius: [{ type: Input }],
|
1004
|
-
pointer: [{ type: Input }],
|
1005
|
-
circle: [{ type: Input }],
|
1006
|
-
onChange: [{ type: Output }]
|
1007
|
-
};
|
1008
|
-
class SaturationModule {
|
1009
|
-
}
|
1010
|
-
SaturationModule.decorators = [
|
1011
|
-
{ type: NgModule, args: [{
|
1012
|
-
declarations: [SaturationComponent],
|
1013
|
-
exports: [SaturationComponent],
|
1014
|
-
imports: [CommonModule, CoordinatesModule],
|
1015
|
-
},] }
|
1016
|
-
];
|
1017
|
-
|
1018
|
-
class SwatchComponent {
|
1019
|
-
constructor() {
|
1020
|
-
this.style = {};
|
1021
|
-
this.focusStyle = {};
|
1022
|
-
this.onClick = new EventEmitter();
|
1023
|
-
this.onHover = new EventEmitter();
|
1024
|
-
this.divStyles = {};
|
1025
|
-
this.focusStyles = {};
|
1026
|
-
this.inFocus = false;
|
1027
|
-
}
|
1028
|
-
ngOnInit() {
|
1029
|
-
this.divStyles = Object.assign({ background: this.color }, this.style);
|
1030
|
-
}
|
1031
|
-
currentStyles() {
|
1032
|
-
this.focusStyles = Object.assign(Object.assign({}, this.divStyles), this.focusStyle);
|
1033
|
-
return this.focus || this.inFocus ? this.focusStyles : this.divStyles;
|
1034
|
-
}
|
1035
|
-
handleFocusOut() {
|
1036
|
-
this.inFocus = false;
|
1037
|
-
}
|
1038
|
-
handleFocus() {
|
1039
|
-
this.inFocus = true;
|
1040
|
-
}
|
1041
|
-
handleHover(hex, $event) {
|
1042
|
-
this.onHover.emit({ hex, $event });
|
1043
|
-
}
|
1044
|
-
handleClick(hex, $event) {
|
1045
|
-
this.onClick.emit({ hex, $event });
|
1046
|
-
}
|
1047
|
-
}
|
1048
|
-
SwatchComponent.decorators = [
|
1049
|
-
{ type: Component, args: [{
|
1050
|
-
selector: 'color-swatch',
|
1051
|
-
template: `
|
1052
|
-
<div
|
1053
|
-
class="swatch"
|
1054
|
-
[ngStyle]="currentStyles()"
|
1055
|
-
[attr.title]="color"
|
1056
|
-
(click)="handleClick(color, $event)"
|
1057
|
-
(keydown.enter)="handleClick(color, $event)"
|
1058
|
-
(focus)="handleFocus()"
|
1059
|
-
(blur)="handleFocusOut()"
|
1060
|
-
(mouseover)="handleHover(color, $event)"
|
1061
|
-
tabindex="0"
|
1062
|
-
>
|
1063
|
-
<ng-content></ng-content>
|
1064
|
-
<color-checkboard
|
1065
|
-
*ngIf="color === 'transparent'"
|
1066
|
-
boxShadow="inset 0 0 0 1px rgba(0,0,0,0.1)"
|
1067
|
-
></color-checkboard>
|
1068
|
-
</div>
|
1069
|
-
`,
|
1070
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
1071
|
-
styles: [`
|
1072
|
-
.swatch {
|
1073
|
-
outline: none;
|
1074
|
-
height: 100%;
|
1075
|
-
width: 100%;
|
1076
|
-
cursor: pointer;
|
1077
|
-
position: relative;
|
1078
|
-
}
|
1079
|
-
`]
|
1080
|
-
},] }
|
1081
|
-
];
|
1082
|
-
SwatchComponent.propDecorators = {
|
1083
|
-
color: [{ type: Input }],
|
1084
|
-
style: [{ type: Input }],
|
1085
|
-
focusStyle: [{ type: Input }],
|
1086
|
-
focus: [{ type: Input }],
|
1087
|
-
onClick: [{ type: Output }],
|
1088
|
-
onHover: [{ type: Output }]
|
1089
|
-
};
|
1090
|
-
class SwatchModule {
|
1091
|
-
}
|
1092
|
-
SwatchModule.decorators = [
|
1093
|
-
{ type: NgModule, args: [{
|
1094
|
-
declarations: [SwatchComponent],
|
1095
|
-
exports: [SwatchComponent],
|
1096
|
-
imports: [CommonModule, CheckboardModule],
|
1097
|
-
},] }
|
1098
|
-
];
|
1099
|
-
|
1100
|
-
class ShadeComponent {
|
1101
|
-
constructor() {
|
1102
|
-
this.onChange = new EventEmitter();
|
1103
|
-
}
|
1104
|
-
ngOnChanges() {
|
1105
|
-
this.gradient = {
|
1106
|
-
background: `linear-gradient(to right,
|
1107
|
-
hsl(${this.hsl.h}, 90%, 55%),
|
1108
|
-
#000)`,
|
1109
|
-
};
|
1110
|
-
const hsv = new TinyColor(this.hsl).toHsv();
|
1111
|
-
this.pointerLeft = 100 - (hsv.v * 100);
|
1112
|
-
}
|
1113
|
-
handleChange({ left, containerWidth, $event }) {
|
1114
|
-
let data;
|
1115
|
-
let v;
|
1116
|
-
if (left < 0) {
|
1117
|
-
v = 0;
|
1118
|
-
}
|
1119
|
-
else if (left > containerWidth) {
|
1120
|
-
v = 1;
|
1121
|
-
}
|
1122
|
-
else {
|
1123
|
-
v = Math.round((left * 100) / containerWidth) / 100;
|
1124
|
-
}
|
1125
|
-
const hsv = new TinyColor(this.hsl).toHsv();
|
1126
|
-
if (hsv.v !== v) {
|
1127
|
-
data = {
|
1128
|
-
h: this.hsl.h,
|
1129
|
-
s: 100,
|
1130
|
-
v: 1 - v,
|
1131
|
-
l: this.hsl.l,
|
1132
|
-
a: this.hsl.a,
|
1133
|
-
source: 'rgb',
|
1134
|
-
};
|
1135
|
-
}
|
1136
|
-
if (!data) {
|
1137
|
-
return;
|
1138
|
-
}
|
1139
|
-
this.onChange.emit({ data, $event });
|
1140
|
-
}
|
1141
|
-
}
|
1142
|
-
ShadeComponent.decorators = [
|
1143
|
-
{ type: Component, args: [{
|
1144
|
-
selector: 'color-shade',
|
1145
|
-
template: `
|
1146
|
-
<div class="shade" [style.border-radius]="radius">
|
1147
|
-
<div
|
1148
|
-
class="shade-gradient"
|
1149
|
-
[ngStyle]="gradient"
|
1150
|
-
[style.box-shadow]="shadow"
|
1151
|
-
[style.border-radius]="radius"
|
1152
|
-
></div>
|
1153
|
-
<div
|
1154
|
-
ngx-color-coordinates
|
1155
|
-
(coordinatesChange)="handleChange($event)"
|
1156
|
-
class="shade-container"
|
1157
|
-
>
|
1158
|
-
<div
|
1159
|
-
class="shade-pointer"
|
1160
|
-
[style.left.%]="pointerLeft"
|
1161
|
-
[style.top.%]="pointerTop"
|
1162
|
-
>
|
1163
|
-
<div class="shade-slider" [ngStyle]="pointer"></div>
|
1164
|
-
</div>
|
1165
|
-
</div>
|
1166
|
-
</div>
|
1167
|
-
`,
|
1168
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
1169
|
-
preserveWhitespaces: false,
|
1170
|
-
styles: [`
|
1171
|
-
.shade {
|
1172
|
-
position: absolute;
|
1173
|
-
top: 0;
|
1174
|
-
bottom: 0;
|
1175
|
-
left: 0;
|
1176
|
-
right: 0;
|
1177
|
-
}
|
1178
|
-
.shade-gradient {
|
1179
|
-
position: absolute;
|
1180
|
-
top: 0;
|
1181
|
-
bottom: 0;
|
1182
|
-
left: 0;
|
1183
|
-
right: 0;
|
1184
|
-
}
|
1185
|
-
.shade-container {
|
1186
|
-
position: relative;
|
1187
|
-
height: 100%;
|
1188
|
-
margin: 0 3px;
|
1189
|
-
}
|
1190
|
-
.shade-pointer {
|
1191
|
-
position: absolute;
|
1192
|
-
}
|
1193
|
-
.shade-slider {
|
1194
|
-
width: 4px;
|
1195
|
-
border-radius: 1px;
|
1196
|
-
height: 8px;
|
1197
|
-
box-shadow: 0 0 2px rgba(0, 0, 0, .6);
|
1198
|
-
background: #fff;
|
1199
|
-
margin-top: 1px;
|
1200
|
-
transform: translateX(-2px);
|
1201
|
-
}
|
1202
|
-
`]
|
1203
|
-
},] }
|
1204
|
-
];
|
1205
|
-
ShadeComponent.propDecorators = {
|
1206
|
-
hsl: [{ type: Input }],
|
1207
|
-
rgb: [{ type: Input }],
|
1208
|
-
pointer: [{ type: Input }],
|
1209
|
-
shadow: [{ type: Input }],
|
1210
|
-
radius: [{ type: Input }],
|
1211
|
-
onChange: [{ type: Output }]
|
1212
|
-
};
|
1213
|
-
class ShadeModule {
|
1214
|
-
}
|
1215
|
-
ShadeModule.decorators = [
|
1216
|
-
{ type: NgModule, args: [{
|
1217
|
-
declarations: [ShadeComponent],
|
1218
|
-
exports: [ShadeComponent],
|
1219
|
-
imports: [CommonModule, CoordinatesModule],
|
1220
|
-
},] }
|
1221
|
-
];
|
1222
|
-
|
1223
|
-
/**
|
1224
|
-
* Generated bundle index. Do not edit.
|
1225
|
-
*/
|
1226
|
-
|
1227
|
-
export { AlphaComponent, AlphaModule, CheckboardComponent, CheckboardModule, ColorMode, ColorWrap, ColorWrapModule, CoordinatesDirective, CoordinatesModule, EditableInputComponent, EditableInputModule, HueComponent, HueModule, RaisedComponent, RaisedModule, SaturationComponent, SaturationModule, ShadeComponent, ShadeModule, SwatchComponent, SwatchModule, getCheckerboard, getContrastingColor, isValidHex, render, simpleCheckForValidColor, toState };
|
1228
|
-
//# sourceMappingURL=ngx-color.js.map
|