@dnncommunity/dnn-elements 0.15.0-beta.6 → 0.15.0-beta.9
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/dist/cjs/dnn.cjs.js +4 -116
- package/dist/cjs/dnn.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -18
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/dnn/dnn.esm.js +1 -130
- package/dist/dnn/dnn.esm.js.map +1 -1
- package/dist/dnn/dnn.js +1 -1
- package/dist/dnn/index.esm.js +1 -46
- package/dist/dnn/index.esm.js.map +1 -1
- package/dist/esm/dnn.js +4 -116
- package/dist/esm/dnn.js.map +1 -1
- package/dist/esm/loader.js +2 -18
- package/dist/esm/loader.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/app-globals-3a1e7e63.js +0 -7
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/css-shim-aaf4fec9.js +0 -8
- package/dist/cjs/css-shim-aaf4fec9.js.map +0 -1
- package/dist/cjs/dnn-button.cjs.entry.js +0 -92
- package/dist/cjs/dnn-button.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-checkbox.cjs.entry.js +0 -58
- package/dist/cjs/dnn-checkbox.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-chevron.cjs.entry.js +0 -34
- package/dist/cjs/dnn-chevron.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-collapsible.cjs.entry.js +0 -69
- package/dist/cjs/dnn-collapsible.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-color-picker.cjs.entry.js +0 -508
- package/dist/cjs/dnn-color-picker.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-dropzone.cjs.entry.js +0 -153
- package/dist/cjs/dnn-dropzone.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-image-cropper.cjs.entry.js +0 -408
- package/dist/cjs/dnn-image-cropper.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-modal.cjs.entry.js +0 -65
- package/dist/cjs/dnn-modal.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-permissions-grid.cjs.entry.js +0 -320
- package/dist/cjs/dnn-permissions-grid.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-searchbox.cjs.entry.js +0 -66
- package/dist/cjs/dnn-searchbox.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-sort-icon.cjs.entry.js +0 -43
- package/dist/cjs/dnn-sort-icon.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-tab.cjs.entry.js +0 -31
- package/dist/cjs/dnn-tab.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-tabs.cjs.entry.js +0 -52
- package/dist/cjs/dnn-tabs.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-toggle.cjs.entry.js +0 -37
- package/dist/cjs/dnn-toggle.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-treeview-item.cjs.entry.js +0 -68
- package/dist/cjs/dnn-treeview-item.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-vertical-overflow-menu.cjs.entry.js +0 -124
- package/dist/cjs/dnn-vertical-overflow-menu.cjs.entry.js.map +0 -1
- package/dist/cjs/dnn-vertical-splitview.cjs.entry.js +0 -133
- package/dist/cjs/dnn-vertical-splitview.cjs.entry.js.map +0 -1
- package/dist/cjs/dom-14886762.js +0 -77
- package/dist/cjs/dom-14886762.js.map +0 -1
- package/dist/cjs/index-d53702a3.js +0 -3095
- package/dist/cjs/index-d53702a3.js.map +0 -1
- package/dist/cjs/mouseUtilities-ecd5ecf7.js +0 -25
- package/dist/cjs/mouseUtilities-ecd5ecf7.js.map +0 -1
- package/dist/cjs/shadow-css-c44ea13a.js +0 -392
- package/dist/cjs/shadow-css-c44ea13a.js.map +0 -1
- package/dist/dnn/app-globals-0f993ce5.js +0 -5
- package/dist/dnn/app-globals-0f993ce5.js.map +0 -1
- package/dist/dnn/app-globals-497eb362.system.js +0 -2
- package/dist/dnn/app-globals-497eb362.system.js.map +0 -1
- package/dist/dnn/css-shim-091f949f.js +0 -6
- package/dist/dnn/css-shim-091f949f.js.map +0 -1
- package/dist/dnn/css-shim-c5bffe6b.system.js +0 -2
- package/dist/dnn/css-shim-c5bffe6b.system.js.map +0 -1
- package/dist/dnn/debounce-6be67abd.js +0 -22
- package/dist/dnn/debounce-6be67abd.js.map +0 -1
- package/dist/dnn/debounce-db438a09.system.js +0 -2
- package/dist/dnn/debounce-db438a09.system.js.map +0 -1
- package/dist/dnn/dnn-button.entry.js +0 -88
- package/dist/dnn/dnn-button.entry.js.map +0 -1
- package/dist/dnn/dnn-button.system.entry.js +0 -2
- package/dist/dnn/dnn-button.system.entry.js.map +0 -1
- package/dist/dnn/dnn-checkbox.entry.js +0 -54
- package/dist/dnn/dnn-checkbox.entry.js.map +0 -1
- package/dist/dnn/dnn-checkbox.system.entry.js +0 -2
- package/dist/dnn/dnn-checkbox.system.entry.js.map +0 -1
- package/dist/dnn/dnn-chevron.entry.js +0 -30
- package/dist/dnn/dnn-chevron.entry.js.map +0 -1
- package/dist/dnn/dnn-chevron.system.entry.js +0 -2
- package/dist/dnn/dnn-chevron.system.entry.js.map +0 -1
- package/dist/dnn/dnn-collapsible.entry.js +0 -65
- package/dist/dnn/dnn-collapsible.entry.js.map +0 -1
- package/dist/dnn/dnn-collapsible.system.entry.js +0 -2
- package/dist/dnn/dnn-collapsible.system.entry.js.map +0 -1
- package/dist/dnn/dnn-color-picker.entry.js +0 -504
- package/dist/dnn/dnn-color-picker.entry.js.map +0 -1
- package/dist/dnn/dnn-color-picker.system.entry.js +0 -12
- package/dist/dnn/dnn-color-picker.system.entry.js.map +0 -1
- package/dist/dnn/dnn-dropzone.entry.js +0 -149
- package/dist/dnn/dnn-dropzone.entry.js.map +0 -1
- package/dist/dnn/dnn-dropzone.system.entry.js +0 -2
- package/dist/dnn/dnn-dropzone.system.entry.js.map +0 -1
- package/dist/dnn/dnn-image-cropper.entry.js +0 -404
- package/dist/dnn/dnn-image-cropper.entry.js.map +0 -1
- package/dist/dnn/dnn-image-cropper.system.entry.js +0 -2
- package/dist/dnn/dnn-image-cropper.system.entry.js.map +0 -1
- package/dist/dnn/dnn-modal.entry.js +0 -61
- package/dist/dnn/dnn-modal.entry.js.map +0 -1
- package/dist/dnn/dnn-modal.system.entry.js +0 -2
- package/dist/dnn/dnn-modal.system.entry.js.map +0 -1
- package/dist/dnn/dnn-permissions-grid.entry.js +0 -316
- package/dist/dnn/dnn-permissions-grid.entry.js.map +0 -1
- package/dist/dnn/dnn-permissions-grid.system.entry.js +0 -2
- package/dist/dnn/dnn-permissions-grid.system.entry.js.map +0 -1
- package/dist/dnn/dnn-searchbox.entry.js +0 -62
- package/dist/dnn/dnn-searchbox.entry.js.map +0 -1
- package/dist/dnn/dnn-searchbox.system.entry.js +0 -2
- package/dist/dnn/dnn-searchbox.system.entry.js.map +0 -1
- package/dist/dnn/dnn-sort-icon.entry.js +0 -39
- package/dist/dnn/dnn-sort-icon.entry.js.map +0 -1
- package/dist/dnn/dnn-sort-icon.system.entry.js +0 -2
- package/dist/dnn/dnn-sort-icon.system.entry.js.map +0 -1
- package/dist/dnn/dnn-tab.entry.js +0 -27
- package/dist/dnn/dnn-tab.entry.js.map +0 -1
- package/dist/dnn/dnn-tab.system.entry.js +0 -2
- package/dist/dnn/dnn-tab.system.entry.js.map +0 -1
- package/dist/dnn/dnn-tabs.entry.js +0 -48
- package/dist/dnn/dnn-tabs.entry.js.map +0 -1
- package/dist/dnn/dnn-tabs.system.entry.js +0 -2
- package/dist/dnn/dnn-tabs.system.entry.js.map +0 -1
- package/dist/dnn/dnn-toggle.entry.js +0 -33
- package/dist/dnn/dnn-toggle.entry.js.map +0 -1
- package/dist/dnn/dnn-toggle.system.entry.js +0 -2
- package/dist/dnn/dnn-toggle.system.entry.js.map +0 -1
- package/dist/dnn/dnn-treeview-item.entry.js +0 -64
- package/dist/dnn/dnn-treeview-item.entry.js.map +0 -1
- package/dist/dnn/dnn-treeview-item.system.entry.js +0 -2
- package/dist/dnn/dnn-treeview-item.system.entry.js.map +0 -1
- package/dist/dnn/dnn-vertical-overflow-menu.entry.js +0 -120
- package/dist/dnn/dnn-vertical-overflow-menu.entry.js.map +0 -1
- package/dist/dnn/dnn-vertical-overflow-menu.system.entry.js +0 -2
- package/dist/dnn/dnn-vertical-overflow-menu.system.entry.js.map +0 -1
- package/dist/dnn/dnn-vertical-splitview.entry.js +0 -129
- package/dist/dnn/dnn-vertical-splitview.entry.js.map +0 -1
- package/dist/dnn/dnn-vertical-splitview.system.entry.js +0 -2
- package/dist/dnn/dnn-vertical-splitview.system.entry.js.map +0 -1
- package/dist/dnn/dnn.system.js +0 -2
- package/dist/dnn/dnn.system.js.map +0 -1
- package/dist/dnn/dom-99eb7b76.system.js +0 -22
- package/dist/dnn/dom-99eb7b76.system.js.map +0 -1
- package/dist/dnn/dom-a385e381.js +0 -75
- package/dist/dnn/dom-a385e381.js.map +0 -1
- package/dist/dnn/index-20e42ad7.js +0 -3059
- package/dist/dnn/index-20e42ad7.js.map +0 -1
- package/dist/dnn/index-c3cc3b5b.system.js +0 -2
- package/dist/dnn/index-c3cc3b5b.system.js.map +0 -1
- package/dist/dnn/index.system.js +0 -2
- package/dist/dnn/index.system.js.map +0 -1
- package/dist/dnn/mouseUtilities-233ad7e3.system.js +0 -2
- package/dist/dnn/mouseUtilities-233ad7e3.system.js.map +0 -1
- package/dist/dnn/mouseUtilities-b261ca4f.js +0 -23
- package/dist/dnn/mouseUtilities-b261ca4f.js.map +0 -1
- package/dist/dnn/shadow-css-27708fdd.system.js +0 -14
- package/dist/dnn/shadow-css-27708fdd.system.js.map +0 -1
- package/dist/dnn/shadow-css-ef431969.js +0 -390
- package/dist/dnn/shadow-css-ef431969.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js +0 -5
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/css-shim-091f949f.js +0 -6
- package/dist/esm/css-shim-091f949f.js.map +0 -1
- package/dist/esm/dnn-button.entry.js +0 -88
- package/dist/esm/dnn-button.entry.js.map +0 -1
- package/dist/esm/dnn-checkbox.entry.js +0 -54
- package/dist/esm/dnn-checkbox.entry.js.map +0 -1
- package/dist/esm/dnn-chevron.entry.js +0 -30
- package/dist/esm/dnn-chevron.entry.js.map +0 -1
- package/dist/esm/dnn-collapsible.entry.js +0 -65
- package/dist/esm/dnn-collapsible.entry.js.map +0 -1
- package/dist/esm/dnn-color-picker.entry.js +0 -504
- package/dist/esm/dnn-color-picker.entry.js.map +0 -1
- package/dist/esm/dnn-dropzone.entry.js +0 -149
- package/dist/esm/dnn-dropzone.entry.js.map +0 -1
- package/dist/esm/dnn-image-cropper.entry.js +0 -404
- package/dist/esm/dnn-image-cropper.entry.js.map +0 -1
- package/dist/esm/dnn-modal.entry.js +0 -61
- package/dist/esm/dnn-modal.entry.js.map +0 -1
- package/dist/esm/dnn-permissions-grid.entry.js +0 -316
- package/dist/esm/dnn-permissions-grid.entry.js.map +0 -1
- package/dist/esm/dnn-searchbox.entry.js +0 -62
- package/dist/esm/dnn-searchbox.entry.js.map +0 -1
- package/dist/esm/dnn-sort-icon.entry.js +0 -39
- package/dist/esm/dnn-sort-icon.entry.js.map +0 -1
- package/dist/esm/dnn-tab.entry.js +0 -27
- package/dist/esm/dnn-tab.entry.js.map +0 -1
- package/dist/esm/dnn-tabs.entry.js +0 -48
- package/dist/esm/dnn-tabs.entry.js.map +0 -1
- package/dist/esm/dnn-toggle.entry.js +0 -33
- package/dist/esm/dnn-toggle.entry.js.map +0 -1
- package/dist/esm/dnn-treeview-item.entry.js +0 -64
- package/dist/esm/dnn-treeview-item.entry.js.map +0 -1
- package/dist/esm/dnn-vertical-overflow-menu.entry.js +0 -120
- package/dist/esm/dnn-vertical-overflow-menu.entry.js.map +0 -1
- package/dist/esm/dnn-vertical-splitview.entry.js +0 -129
- package/dist/esm/dnn-vertical-splitview.entry.js.map +0 -1
- package/dist/esm/dom-a385e381.js +0 -75
- package/dist/esm/dom-a385e381.js.map +0 -1
- package/dist/esm/index-20e42ad7.js +0 -3059
- package/dist/esm/index-20e42ad7.js.map +0 -1
- package/dist/esm/mouseUtilities-b261ca4f.js +0 -23
- package/dist/esm/mouseUtilities-b261ca4f.js.map +0 -1
- package/dist/esm/shadow-css-ef431969.js +0 -390
- package/dist/esm/shadow-css-ef431969.js.map +0 -1
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-d53702a3.js');
|
|
6
|
-
|
|
7
|
-
const dnnChevronCss = ":host{display:inline-block}button{border:none;padding:0px;margin:0px;min-width:15px;min-height:15px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;background-color:transparent;outline:none}svg{height:2em;width:2em;-webkit-transition:all 300ms ease-in-out;transition:all 300ms ease-in-out}button:focus svg,button:hover svg{color:var(--dnn-color-primary)}:host([expanded]) svg{-webkit-transform:rotate(90deg);transform:rotate(90deg)}";
|
|
8
|
-
|
|
9
|
-
const DnnChevron = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
index.registerInstance(this, hostRef);
|
|
12
|
-
this.changed = index.createEvent(this, "changed", 7);
|
|
13
|
-
/** Expand text for screen readers */
|
|
14
|
-
this.expandText = "expand";
|
|
15
|
-
/** Collapse text for screen readers */
|
|
16
|
-
this.collapseText = "collapse";
|
|
17
|
-
/** Is the chevron expanded */
|
|
18
|
-
this.expanded = false;
|
|
19
|
-
}
|
|
20
|
-
handleExpandedChanged(newValue) {
|
|
21
|
-
this.changed.emit(newValue);
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
24
|
-
return (index.h(index.Host, null, index.h("button", { "aria-label": this.expanded ? this.collapseText : this.expandText, onClick: () => this.expanded = !this.expanded }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, index.h("path", { d: "M0 0h24v24H0z", fill: "none" }), index.h("path", { d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" })))));
|
|
25
|
-
}
|
|
26
|
-
static get watchers() { return {
|
|
27
|
-
"expanded": ["handleExpandedChanged"]
|
|
28
|
-
}; }
|
|
29
|
-
};
|
|
30
|
-
DnnChevron.style = dnnChevronCss;
|
|
31
|
-
|
|
32
|
-
exports.dnn_chevron = DnnChevron;
|
|
33
|
-
|
|
34
|
-
//# sourceMappingURL=dnn-chevron.cjs.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"dnn-chevron.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,aAAa,GAAG,wfAAwf;;MCSjgB,UAAU;EALvB;;;;IAQU,eAAU,GAAY,QAAQ,CAAC;;IAG/B,iBAAY,GAAY,UAAU,CAAC;;IAGL,aAAQ,GAAa,KAAK,CAAC;GAsBlE;EAhBC,qBAAqB,CAAC,QAAiB;IACrC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;GAC7B;EAED,MAAM;IACJ,QACEA,QAACC,UAAI,QACHD,kCAAoB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,UAAU,EACrE,OAAO,EAAE,MAAM,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,IAE7CA,iBAAK,KAAK,EAAC,4BAA4B,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,IAACA,kBAAM,CAAC,EAAC,eAAe,EAAC,IAAI,EAAC,MAAM,GAAE,EAAAA,kBAAM,CAAC,EAAC,gDAAgD,GAAE,CAAM,CACpM,CACJ,EACP;GACH;;;;;;;;;","names":["h","Host"],"sources":["./src/components/dnn-chevron/dnn-chevron.scss?tag=dnn-chevron&encapsulation=shadow","./src/components/dnn-chevron/dnn-chevron.tsx"],"sourcesContent":[":host {\n display: inline-block;\n}\nbutton{\n border: none;\n padding: 0px;\n margin: 0px;\n min-width: 15px;\n min-height: 15px;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: transparent;\n outline: none;\n}\nsvg{\n height:2em;\n width:2em;\n transition: all 300ms ease-in-out;\n}\n\n// FOCUS\nbutton:focus, button:hover{\n svg{\n color: var(--dnn-color-primary);\n }\n}\n\n// EXPANDED\n:host([expanded]){\n svg{\n transform: rotate(90deg);\n }\n}","import { Component, Host, h, Prop, Event } from '@stencil/core';\nimport { EventEmitter } from '@stencil/core';\nimport { Watch } from '@stencil/core';\n\n@Component({\n tag: 'dnn-chevron',\n styleUrl: 'dnn-chevron.scss',\n shadow: true\n})\nexport class DnnChevron {\n\n /** Expand text for screen readers */\n @Prop() expandText?: string = \"expand\";\n\n /** Collapse text for screen readers */\n @Prop() collapseText?: string = \"collapse\";\n\n /** Is the chevron expanded */\n @Prop({mutable: true, reflect: true}) expanded?: boolean = false;\n\n /** Fires up when the expanded status changes */\n @Event() changed: EventEmitter;\n\n @Watch('expanded')\n handleExpandedChanged(newValue: boolean) {\n this.changed.emit(newValue);\n }\n\n render() {\n return (\n <Host>\n <button aria-label={this.expanded ? this.collapseText : this.expandText}\n onClick={() => this.expanded = !this.expanded}\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"#000000\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"/></svg>\n </button>\n </Host>\n );\n }\n\n}\n"],"version":3}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-d53702a3.js');
|
|
6
|
-
|
|
7
|
-
const dnnCollapsibleCss = ":host{display:block}#container{max-height:0;overflow:hidden;-webkit-transition:max-height 300ms ease-in-out;transition:max-height 300ms ease-in-out}";
|
|
8
|
-
|
|
9
|
-
const DnnCollapsible = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
index.registerInstance(this, hostRef);
|
|
12
|
-
this.dnnCollapsibleHeightChanged = index.createEvent(this, "dnnCollapsibleHeightChanged", 7);
|
|
13
|
-
/** Defines if the panel is expanded or not. */
|
|
14
|
-
this.expanded = false;
|
|
15
|
-
/** Defines the transition time in ms, defaults to 150ms */
|
|
16
|
-
this.transitionDuration = 150;
|
|
17
|
-
}
|
|
18
|
-
handleHeightChanged() {
|
|
19
|
-
requestAnimationFrame(() => {
|
|
20
|
-
this.updateSize();
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Updates the component height, use to update after a slot content changes.
|
|
25
|
-
*/
|
|
26
|
-
async updateSize() {
|
|
27
|
-
if (this.expanded) {
|
|
28
|
-
requestAnimationFrame(() => {
|
|
29
|
-
this.container.style.maxHeight = `${this.container.scrollHeight}px`;
|
|
30
|
-
});
|
|
31
|
-
setTimeout(() => {
|
|
32
|
-
this.container.style.maxHeight = "none";
|
|
33
|
-
}, this.transitionDuration);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
handledExpandedChanged(expanded) {
|
|
37
|
-
if (expanded) {
|
|
38
|
-
this.updateSize();
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
requestAnimationFrame(() => {
|
|
42
|
-
this.container.style.maxHeight = `${this.container.scrollHeight}px`;
|
|
43
|
-
requestAnimationFrame(() => {
|
|
44
|
-
this.container.style.maxHeight = "0px";
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
setTimeout(() => {
|
|
49
|
-
requestAnimationFrame(() => {
|
|
50
|
-
this.dnnCollapsibleHeightChanged.emit();
|
|
51
|
-
});
|
|
52
|
-
}, this.transitionDuration);
|
|
53
|
-
}
|
|
54
|
-
componentDidLoad() {
|
|
55
|
-
this.container.style.transition = `max-height ${this.transitionDuration}ms ease-in-out`;
|
|
56
|
-
}
|
|
57
|
-
render() {
|
|
58
|
-
return (index.h(index.Host, null, index.h("div", { id: "container", class: this.expanded && "expanded", ref: el => this.container = el, style: { transition: `max-height ${this.transitionDuration}ms ease-in-out` } }, index.h("slot", null))));
|
|
59
|
-
}
|
|
60
|
-
get el() { return index.getElement(this); }
|
|
61
|
-
static get watchers() { return {
|
|
62
|
-
"expanded": ["handledExpandedChanged"]
|
|
63
|
-
}; }
|
|
64
|
-
};
|
|
65
|
-
DnnCollapsible.style = dnnCollapsibleCss;
|
|
66
|
-
|
|
67
|
-
exports.dnn_collapsible = DnnCollapsible;
|
|
68
|
-
|
|
69
|
-
//# sourceMappingURL=dnn-collapsible.cjs.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"dnn-collapsible.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,iBAAiB,GAAG,sJAAsJ;;MCOnK,cAAc;EAL3B;;;;IAUyB,aAAQ,GAAY,KAAK,CAAC;;IAGzC,uBAAkB,GAAY,GAAG,CAAC;GAoE3C;EA9DC,mBAAmB;IACjB,qBAAqB,CAAC;MACpB,IAAI,CAAC,UAAU,EAAE,CAAC;KACnB,CAAC,CAAA;GACH;;;;EAMD,MAAM,UAAU;IACd,IAAI,IAAI,CAAC,QAAQ,EAAC;MACd,qBAAqB,CAAC;QACpB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,IAAI,CAAC;OACrE,CAAC,CAAC;MACH,UAAU,CAAC;QACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;OACzC,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;KAC/B;GACF;EAGD,sBAAsB,CAAC,QAAiB;IACtC,IAAI,QAAQ,EAAC;MACX,IAAI,CAAC,UAAU,EAAE,CAAC;KACnB;SACG;MACF,qBAAqB,CAAC;QACpB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,IAAI,CAAC;QACpE,qBAAqB,CAAC;UACpB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;SACxC,CAAC,CAAC;OACJ,CAAC,CAAC;KACJ;IACD,UAAU,CAAC;MACT,qBAAqB,CAAC;QACpB,IAAI,CAAC,2BAA2B,CAAC,IAAI,EAAE,CAAC;OACzC,CAAC,CAAC;KACJ,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;GAC7B;EAID,gBAAgB;IACd,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,GAAG,cAAc,IAAI,CAAC,kBAAkB,gBAAgB,CAAC;GACzF;EAED,MAAM;IACJ,QACEA,QAACC,UAAI,QACHD,iBACE,EAAE,EAAC,WAAW,EACd,KAAK,EAAE,IAAI,CAAC,QAAQ,IAAI,UAAU,EAClC,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,SAAS,GAAG,EAAE,EAC9B,KAAK,EAAE,EAAC,UAAU,EAAE,cAAc,IAAI,CAAC,kBAAkB,gBAAgB,EAAC,IAExEA,qBAAa,CACX,CACD,EACP;GACH;;;;;;;;;;","names":["h","Host"],"sources":["./src/components/dnn-collapsible/dnn-collapsible.scss?tag=dnn-collapsible&encapsulation=shadow","./src/components/dnn-collapsible/dnn-collapsible.tsx"],"sourcesContent":[":host {\n display: block;\n}\n#container{\n max-height:0;\n overflow: hidden;\n transition: max-height 300ms ease-in-out;\n}","import { Component, Host, h, Prop, Element, Event, EventEmitter, Watch, Listen, Method } from '@stencil/core';\n\n@Component({\n tag: \"dnn-collapsible\",\n styleUrl: \"dnn-collapsible.scss\",\n shadow: true\n})\nexport class DnnCollapsible {\n\n @Element() el: HTMLDnnCollapsibleElement;\n\n /** Defines if the panel is expanded or not. */\n @Prop({reflect: true}) expanded: boolean = false;\n\n /** Defines the transition time in ms, defaults to 150ms */\n @Prop() transitionDuration?: number = 150;\n\n /** Fires whenever the collapsible height has changed */\n @Event({bubbles: true, composed: true}) dnnCollapsibleHeightChanged: EventEmitter<void>;\n\n @Listen(\"dnnCollapsibleHeightChanged\")\n handleHeightChanged(){\n requestAnimationFrame(() => {\n this.updateSize();\n })\n }\n\n /**\n * Updates the component height, use to update after a slot content changes.\n */\n @Method()\n async updateSize() {\n if (this.expanded){\n requestAnimationFrame(() => {\n this.container.style.maxHeight = `${this.container.scrollHeight}px`;\n });\n setTimeout(() => {\n this.container.style.maxHeight = \"none\";\n }, this.transitionDuration);\n }\n }\n \n @Watch(\"expanded\")\n handledExpandedChanged(expanded: boolean){\n if (expanded){\n this.updateSize();\n }\n else{\n requestAnimationFrame(() => {\n this.container.style.maxHeight = `${this.container.scrollHeight}px`;\n requestAnimationFrame(() => {\n this.container.style.maxHeight = \"0px\";\n });\n });\n }\n setTimeout(() => {\n requestAnimationFrame(() => {\n this.dnnCollapsibleHeightChanged.emit();\n });\n }, this.transitionDuration);\n }\n \n private container: HTMLDivElement;\n\n componentDidLoad() {\n this.container.style.transition = `max-height ${this.transitionDuration}ms ease-in-out`;\n }\n\n render() {\n return (\n <Host>\n <div\n id=\"container\"\n class={this.expanded && \"expanded\"}\n ref={el => this.container = el}\n style={{transition: `max-height ${this.transitionDuration}ms ease-in-out`}}\n >\n <slot></slot>\n </div>\n </Host>\n );\n }\n\n}\n"],"version":3}
|
|
@@ -1,508 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-d53702a3.js');
|
|
6
|
-
const debounce = require('./debounce-901e1f0c.js');
|
|
7
|
-
|
|
8
|
-
/** Color utility class with hsl and rgb converters
|
|
9
|
-
* based on math at https://en.wikipedia.org/wiki/HSL_and_HSV
|
|
10
|
-
* @copyright Copyright (c) .NET Foundation. All rights reserved.
|
|
11
|
-
* @license MIT
|
|
12
|
-
*/
|
|
13
|
-
class ColorInfo {
|
|
14
|
-
constructor() {
|
|
15
|
-
this._hue = 0;
|
|
16
|
-
this._saturation = 0;
|
|
17
|
-
this._lightness = 0;
|
|
18
|
-
}
|
|
19
|
-
/** gets the color hue
|
|
20
|
-
* @returns a number between 0 and 359, could contain decimals
|
|
21
|
-
*/
|
|
22
|
-
get hue() { return this._hue; }
|
|
23
|
-
set hue(value) {
|
|
24
|
-
if (value < 0) {
|
|
25
|
-
value = 0;
|
|
26
|
-
}
|
|
27
|
-
if (value > 359) {
|
|
28
|
-
value = 359;
|
|
29
|
-
}
|
|
30
|
-
this._hue = value;
|
|
31
|
-
}
|
|
32
|
-
/** gets the color saturation
|
|
33
|
-
* @returns a number between 0 and 1, could contain decimals
|
|
34
|
-
*/
|
|
35
|
-
get saturation() { return this._saturation; }
|
|
36
|
-
set saturation(value) {
|
|
37
|
-
if (value < 0) {
|
|
38
|
-
value = 0;
|
|
39
|
-
}
|
|
40
|
-
if (value > 1) {
|
|
41
|
-
value = 1;
|
|
42
|
-
}
|
|
43
|
-
this._saturation = value;
|
|
44
|
-
}
|
|
45
|
-
/** gets the color lightness
|
|
46
|
-
* @returns a number between 0 and 1, could contain decimals
|
|
47
|
-
*/
|
|
48
|
-
get lightness() { return this._lightness; }
|
|
49
|
-
set lightness(value) {
|
|
50
|
-
if (value < 0) {
|
|
51
|
-
value = 0;
|
|
52
|
-
}
|
|
53
|
-
if (value > 1) {
|
|
54
|
-
value = 1;
|
|
55
|
-
}
|
|
56
|
-
this._lightness = value;
|
|
57
|
-
}
|
|
58
|
-
/** gets or sets the red component
|
|
59
|
-
* @returns an integer between 0 and 255
|
|
60
|
-
*/
|
|
61
|
-
get red() {
|
|
62
|
-
return this.getRGB().red;
|
|
63
|
-
}
|
|
64
|
-
set red(value) {
|
|
65
|
-
this.setHSL(value, this.green, this.blue);
|
|
66
|
-
}
|
|
67
|
-
/** gets or sets the green component
|
|
68
|
-
* @returns an integer between 0 and 255
|
|
69
|
-
*/
|
|
70
|
-
get green() {
|
|
71
|
-
return this.getRGB().green;
|
|
72
|
-
}
|
|
73
|
-
set green(value) {
|
|
74
|
-
this.setHSL(this.red, value, this.blue);
|
|
75
|
-
}
|
|
76
|
-
/** gets or sets the blue component
|
|
77
|
-
* @returns an integer between 0 and 255
|
|
78
|
-
*/
|
|
79
|
-
get blue() {
|
|
80
|
-
return this.getRGB().blue;
|
|
81
|
-
}
|
|
82
|
-
set blue(value) {
|
|
83
|
-
this.setHSL(this.red, this.green, value);
|
|
84
|
-
}
|
|
85
|
-
/** gets or sets the hex color value, expresses as 6 hexadecimal characters.
|
|
86
|
-
* @returns hex representation of the color
|
|
87
|
-
*/
|
|
88
|
-
get hex() {
|
|
89
|
-
var r = this.getHex(this.red);
|
|
90
|
-
var g = this.getHex(this.green);
|
|
91
|
-
var b = this.getHex(this.blue);
|
|
92
|
-
return r + g + b;
|
|
93
|
-
}
|
|
94
|
-
set hex(value) {
|
|
95
|
-
this.red = parseInt(value.substr(0, 2));
|
|
96
|
-
this.green = parseInt(value.substr(2, 2));
|
|
97
|
-
this.blue = parseInt(value.substr(4, 2));
|
|
98
|
-
}
|
|
99
|
-
/** gets white or black color that is a good oposite to the current color
|
|
100
|
-
* @returns - "000000" or "FFFFFF"
|
|
101
|
-
*/
|
|
102
|
-
get contrastColor() {
|
|
103
|
-
const brightness = (this.red * 299 + this.green * 587 + this.blue * 114) / 1000;
|
|
104
|
-
if (brightness > 127) {
|
|
105
|
-
return "000000";
|
|
106
|
-
}
|
|
107
|
-
return "FFFFFF";
|
|
108
|
-
}
|
|
109
|
-
getRGB() {
|
|
110
|
-
const chroma = (1 - Math.abs((2 * this._lightness) - 1)) * this.saturation;
|
|
111
|
-
// find the quandrant of the hue
|
|
112
|
-
const quadrant = this._hue / 60;
|
|
113
|
-
// calculate the offset from the quandrant center
|
|
114
|
-
const offset = chroma * (1 - Math.abs(quadrant % 2 - 1));
|
|
115
|
-
// Apply the chroma to the primary component and the offset to the 2nd most important component
|
|
116
|
-
let r = 0, g = 0, b = 0;
|
|
117
|
-
if (0 <= quadrant && quadrant <= 1) {
|
|
118
|
-
r = chroma;
|
|
119
|
-
g = offset; // red to yellow
|
|
120
|
-
}
|
|
121
|
-
else if (1 <= quadrant && quadrant <= 2) {
|
|
122
|
-
g = chroma;
|
|
123
|
-
r = offset; // yellow to green
|
|
124
|
-
}
|
|
125
|
-
else if (2 <= quadrant && quadrant <= 3) {
|
|
126
|
-
g = chroma;
|
|
127
|
-
b = offset; // green to cyan
|
|
128
|
-
}
|
|
129
|
-
else if (3 <= quadrant && quadrant <= 4) {
|
|
130
|
-
b = chroma;
|
|
131
|
-
g = offset; // cyan to blue
|
|
132
|
-
}
|
|
133
|
-
else if (4 <= quadrant && quadrant <= 5) {
|
|
134
|
-
b = chroma;
|
|
135
|
-
r = offset; // blue to magenta
|
|
136
|
-
}
|
|
137
|
-
else if (5 <= quadrant && quadrant <= 6) {
|
|
138
|
-
r = chroma;
|
|
139
|
-
b = offset; // magenta to red
|
|
140
|
-
}
|
|
141
|
-
// calculate the bias to add to all channels to match the lightness
|
|
142
|
-
const bias = this._lightness - (chroma / 2);
|
|
143
|
-
return {
|
|
144
|
-
red: Math.round((r + bias) * 255),
|
|
145
|
-
green: Math.round((g + bias) * 255),
|
|
146
|
-
blue: Math.round((b + bias) * 255)
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
setHSL(red, green, blue) {
|
|
150
|
-
// GENERAL DATA
|
|
151
|
-
// all math is based on values from 0 to 1
|
|
152
|
-
const r = red / 255, g = green / 255, b = blue / 255;
|
|
153
|
-
// we need to max, min and the difference between them to derive hsl
|
|
154
|
-
const min = Math.min(r, g, b);
|
|
155
|
-
const max = Math.max(r, g, b);
|
|
156
|
-
const diff = max - min;
|
|
157
|
-
let h = 0, s = 0, l = 0;
|
|
158
|
-
// HUE
|
|
159
|
-
if (diff === 0) { // neutral
|
|
160
|
-
h = 0;
|
|
161
|
-
}
|
|
162
|
-
else if (max === r) { // red (magenta to yellow range)
|
|
163
|
-
h = 60 * ((g - b) / diff);
|
|
164
|
-
}
|
|
165
|
-
else if (max === g) { // green (yellow to cyan range)
|
|
166
|
-
h = 60 * (2 + ((b - r) / diff));
|
|
167
|
-
}
|
|
168
|
-
else if (max === b) { // blue (cyan to magenta range)
|
|
169
|
-
h = 60 * (4 + ((r - g) / diff));
|
|
170
|
-
}
|
|
171
|
-
if (h < 0) {
|
|
172
|
-
h = h + 360;
|
|
173
|
-
} // ensures positive hues only
|
|
174
|
-
if (h > 359) {
|
|
175
|
-
h = 359;
|
|
176
|
-
} // ensures we never return 360 for simplicity since it is the same as 0
|
|
177
|
-
// LIGHTNESS
|
|
178
|
-
l = (max + min) / 2;
|
|
179
|
-
// SATURATION
|
|
180
|
-
if (max === 0 || min === 1) { // pure black or white have no saturation
|
|
181
|
-
s = 0;
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
s = (max - l) / (Math.min(l, 1 - l));
|
|
185
|
-
}
|
|
186
|
-
this._hue = h;
|
|
187
|
-
this._saturation = s;
|
|
188
|
-
this._lightness = l;
|
|
189
|
-
}
|
|
190
|
-
getHex(value) {
|
|
191
|
-
var hex = value.toString(16);
|
|
192
|
-
if (hex.length < 2) {
|
|
193
|
-
hex = "0" + hex;
|
|
194
|
-
}
|
|
195
|
-
return hex;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const dnnColorPickerCss = ".dnn-color-picker{padding:15px;max-width:400px}.dnn-color-picker .dnn-color-sliders{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:200px}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b{border:1px solid #ccc;padding-bottom:var(--color-box-height, 50%);position:relative;background-color:red}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;background:-webkit-gradient(linear, left top, right top, from(white), to(red));background:linear-gradient(to right, white, red);mix-blend-mode:saturation}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b:after{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;z-index:2;background:-webkit-gradient(linear, left top, left bottom, from(white), to(black));background:linear-gradient(to bottom, white, black);mix-blend-mode:luminosity}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b button{position:absolute;bottom:calc(50% - 4px);left:calc(50% - 4px);width:8px;height:8px;z-index:3;display:block;background:none;border:none;margin-left:-4px;margin-bottom:-4px;padding:7px;background-color:#fff;border-radius:50%}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b button:before{content:\"\";position:absolute;top:-1px;left:-1px;border-radius:50%}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b button:after{content:\"\";position:absolute;top:0px;left:0px;border-radius:50%;width:10px;height:10px;border:2px solid #ccc}.dnn-color-picker .dnn-color-sliders .dnn-color-bar{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-top:15px}.dnn-color-picker .dnn-color-sliders .dnn-color-bar .dnn-color-result{-ms-flex-direction:column;flex-direction:column;width:50px;height:50px;border-radius:50%;background:red}.dnn-color-picker .dnn-color-sliders .dnn-color-bar .dnn-color-hue{-ms-flex:auto;flex:auto;margin-left:10px;height:16px;border:1px solid #ccc;position:relative;background:-webkit-gradient(linear, left top, right top, color-stop(0, #f00), color-stop(17%, #ff0), color-stop(33%, #0f0), color-stop(50%, #0ff), color-stop(67%, #00f), color-stop(84%, #f0f), to(#f00));background:linear-gradient(to right, #f00 0, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 84%, #f00 100%)}.dnn-color-picker .dnn-color-sliders .dnn-color-bar .dnn-color-hue button{width:10px;height:20px;position:absolute;top:-2px;left:calc(50% - 4px);border:0;padding:0;background-color:transparent;padding-left:-8px}.dnn-color-picker .dnn-color-sliders .dnn-color-bar .dnn-color-hue button:before{content:\"\";position:absolute;top:-2px;left:0px;border-radius:3px;width:100%;height:100%;border:1px solid #ccc;background-color:#fff}.dnn-color-picker .dnn-color-fields{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between}.dnn-color-picker .dnn-color-fields .dnn-color-mode-switch{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;padding:0.5em}.dnn-color-picker .dnn-color-fields .dnn-color-mode-switch button{background-color:transparent;border:none}.dnn-color-picker .dnn-color-fields .dnn-color-mode-switch button svg{width:3em;height:3em;pointer-events:none;outline:none}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields{display:-ms-flexbox;display:flex;-ms-flex-pack:space-evenly;justify-content:space-evenly}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:auto;flex:auto;text-align:center;padding:0.5em}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field label{padding-bottom:0.25em}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field input{border-radius:var(--dnn-button-radius, 3px);border:1px solid #ccc;padding:0.5em;padding-left:1.3em;text-align:center}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field input.red{border-color:red}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field input.green{border-color:green}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field input.blue{border-color:blue}.dnn-color-picker .dnn-color-fields .dnn-hsl-color-fields{display:-ms-flexbox;display:flex;-ms-flex-pack:space-evenly;justify-content:space-evenly}.dnn-color-picker .dnn-color-fields .dnn-hsl-color-fields .dnn-hsl-color-field{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:auto;flex:auto;text-align:center;padding:0.5em}.dnn-color-picker .dnn-color-fields .dnn-hsl-color-fields .dnn-hsl-color-field label{padding-bottom:0.25em}.dnn-color-picker .dnn-color-fields .dnn-hsl-color-fields .dnn-hsl-color-field input{border-radius:var(--dnn-button-radius, 3px);border:1px solid #ccc;padding:0.5em;padding-left:1.3em;text-align:center}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields{display:-ms-flexbox;display:flex;-ms-flex-pack:space-evenly;justify-content:space-evenly}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:auto;flex:auto;text-align:center;padding:0.5em}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field label{padding-bottom:0.25em}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field .hex-input{position:relative;border-radius:var(--dnn-button-radius, 3px);border:1px solid #ccc;padding:0.323em;text-align:center}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field .hex-input input{border:0;padding:0;margin:0;width:100%;height:100%;text-align:center}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field .hex-input button{position:absolute;height:100%;top:0;right:1em;background-color:transparent;border:0;padding:0;margin:0}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field .hex-input button svg{min-width:1em}";
|
|
200
|
-
|
|
201
|
-
/** Reusable DNN UI component to pick a color
|
|
202
|
-
* @copyright Copyright (c) .NET Foundation. All rights reserved.
|
|
203
|
-
* @license MIT
|
|
204
|
-
*/
|
|
205
|
-
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
206
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
207
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
208
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
209
|
-
else
|
|
210
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
211
|
-
if (d = decorators[i])
|
|
212
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
213
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
214
|
-
};
|
|
215
|
-
const DnnColorPicker = class {
|
|
216
|
-
constructor(hostRef) {
|
|
217
|
-
index.registerInstance(this, hostRef);
|
|
218
|
-
this.colorChanged = index.createEvent(this, "colorChanged", 7);
|
|
219
|
-
/** Sets the initial color, must be a valid 8 character hexadecimal string without the # sign. */
|
|
220
|
-
this.color = "FFFFFF";
|
|
221
|
-
/** Sets the width-height ratio of the color picker saturation-lightness box.
|
|
222
|
-
* @example 100% renders a perfect square
|
|
223
|
-
*/
|
|
224
|
-
this.colorBoxHeight = "50%";
|
|
225
|
-
this.rgbDisplay = "flex";
|
|
226
|
-
this.hslDisplay = "none";
|
|
227
|
-
this.hexDisplay = "none";
|
|
228
|
-
this.handleSaturationLightnessMouseDown = (e) => {
|
|
229
|
-
e.preventDefault();
|
|
230
|
-
this.handleDragLightnessSaturation(e);
|
|
231
|
-
window.addEventListener('mousemove', this.handleDragLightnessSaturation);
|
|
232
|
-
window.addEventListener('mouseup', this.handleSaturationLightnessMouseUp);
|
|
233
|
-
};
|
|
234
|
-
this.handleDragLightnessSaturation = (e) => {
|
|
235
|
-
const rect = this.saturationLightnessBox.getBoundingClientRect();
|
|
236
|
-
let x = e.clientX - rect.left;
|
|
237
|
-
if (x < 0) {
|
|
238
|
-
x = 0;
|
|
239
|
-
}
|
|
240
|
-
if (x > rect.width) {
|
|
241
|
-
x = rect.width;
|
|
242
|
-
}
|
|
243
|
-
x = x / rect.width;
|
|
244
|
-
let y = e.clientY - rect.top;
|
|
245
|
-
if (y < 0) {
|
|
246
|
-
y = 0;
|
|
247
|
-
}
|
|
248
|
-
if (y > rect.height) {
|
|
249
|
-
y = rect.height;
|
|
250
|
-
}
|
|
251
|
-
y = 1 - (y / rect.height);
|
|
252
|
-
const newColor = new ColorInfo();
|
|
253
|
-
newColor.hue = this.currentColor.hue;
|
|
254
|
-
newColor.saturation = x;
|
|
255
|
-
newColor.lightness = y;
|
|
256
|
-
this.currentColor = newColor;
|
|
257
|
-
};
|
|
258
|
-
this.handleSaturationLightnessMouseUp = () => {
|
|
259
|
-
window.removeEventListener('mousemove', this.handleDragLightnessSaturation);
|
|
260
|
-
window.removeEventListener('mouseup', this.handleSaturationLightnessMouseUp);
|
|
261
|
-
};
|
|
262
|
-
this.handleHueMouseDown = (e) => {
|
|
263
|
-
e.preventDefault();
|
|
264
|
-
this.handleDragHue(e);
|
|
265
|
-
window.addEventListener('mousemove', this.handleDragHue);
|
|
266
|
-
window.addEventListener('mouseup', this.handleHueMouseUp);
|
|
267
|
-
};
|
|
268
|
-
this.handleHueMouseUp = () => {
|
|
269
|
-
window.removeEventListener('mousemove', this.handleDragHue);
|
|
270
|
-
window.removeEventListener('mouseup', this.handleHueMouseUp);
|
|
271
|
-
};
|
|
272
|
-
this.handleDragHue = (e) => {
|
|
273
|
-
const rect = this.hueRange.getBoundingClientRect();
|
|
274
|
-
let x = e.clientX - rect.left;
|
|
275
|
-
if (x < 0) {
|
|
276
|
-
x = 0;
|
|
277
|
-
}
|
|
278
|
-
if (x > rect.width) {
|
|
279
|
-
x = rect.width;
|
|
280
|
-
}
|
|
281
|
-
x = x / rect.width * 360;
|
|
282
|
-
const newColor = new ColorInfo();
|
|
283
|
-
newColor.hue = x;
|
|
284
|
-
newColor.saturation = this.currentColor.saturation;
|
|
285
|
-
newColor.lightness = this.currentColor.lightness;
|
|
286
|
-
this.currentColor = newColor;
|
|
287
|
-
};
|
|
288
|
-
this.handleComponentValueChange = (e, channel) => {
|
|
289
|
-
let value = parseInt(e.target.value);
|
|
290
|
-
if (isNaN(value)) {
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
const newColor = new ColorInfo();
|
|
294
|
-
if (value < 0) {
|
|
295
|
-
value = 0;
|
|
296
|
-
}
|
|
297
|
-
if (value > 255) {
|
|
298
|
-
value = 255;
|
|
299
|
-
}
|
|
300
|
-
let r = this.currentColor.red;
|
|
301
|
-
let g = this.currentColor.green;
|
|
302
|
-
let b = this.currentColor.blue;
|
|
303
|
-
switch (channel) {
|
|
304
|
-
case 'red':
|
|
305
|
-
r = value;
|
|
306
|
-
break;
|
|
307
|
-
case 'green':
|
|
308
|
-
g = value;
|
|
309
|
-
break;
|
|
310
|
-
case 'blue':
|
|
311
|
-
b = value;
|
|
312
|
-
break;
|
|
313
|
-
default:
|
|
314
|
-
break;
|
|
315
|
-
}
|
|
316
|
-
newColor.green = g;
|
|
317
|
-
newColor.red = r;
|
|
318
|
-
newColor.blue = b;
|
|
319
|
-
this.currentColor = newColor;
|
|
320
|
-
};
|
|
321
|
-
this.handleHSLChange = (e, component) => {
|
|
322
|
-
let value = parseInt(e.target.value);
|
|
323
|
-
if (isNaN(value)) {
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
const newColor = new ColorInfo();
|
|
327
|
-
if (value != null) {
|
|
328
|
-
let h = this.currentColor.hue;
|
|
329
|
-
let s = this.currentColor.saturation;
|
|
330
|
-
let l = this.currentColor.lightness;
|
|
331
|
-
switch (component) {
|
|
332
|
-
case "hue":
|
|
333
|
-
if (value < 0) {
|
|
334
|
-
value = 0;
|
|
335
|
-
}
|
|
336
|
-
if (value > 359) {
|
|
337
|
-
value = 0;
|
|
338
|
-
}
|
|
339
|
-
h = value;
|
|
340
|
-
break;
|
|
341
|
-
case "saturation":
|
|
342
|
-
if (value < 0) {
|
|
343
|
-
value = 0;
|
|
344
|
-
}
|
|
345
|
-
if (value > 100) {
|
|
346
|
-
value = 100;
|
|
347
|
-
}
|
|
348
|
-
s = value / 100;
|
|
349
|
-
break;
|
|
350
|
-
case "lightness":
|
|
351
|
-
if (value < 0) {
|
|
352
|
-
value = 0;
|
|
353
|
-
}
|
|
354
|
-
if (value > 100) {
|
|
355
|
-
value = 100;
|
|
356
|
-
}
|
|
357
|
-
l = value / 100;
|
|
358
|
-
break;
|
|
359
|
-
default:
|
|
360
|
-
break;
|
|
361
|
-
}
|
|
362
|
-
newColor.hue = h;
|
|
363
|
-
newColor.saturation = s;
|
|
364
|
-
newColor.lightness = l;
|
|
365
|
-
this.currentColor = newColor;
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
this.handleSaturationLightnessKeyDown = (e) => {
|
|
369
|
-
let newColor = new ColorInfo();
|
|
370
|
-
newColor.hue = this.currentColor.hue;
|
|
371
|
-
newColor.saturation = this.currentColor.saturation;
|
|
372
|
-
newColor.lightness = this.currentColor.lightness;
|
|
373
|
-
let value = 0.01;
|
|
374
|
-
if (e.shiftKey) {
|
|
375
|
-
value = 0.1;
|
|
376
|
-
}
|
|
377
|
-
switch (e.key) {
|
|
378
|
-
case "ArrowUp":
|
|
379
|
-
newColor.lightness += value;
|
|
380
|
-
break;
|
|
381
|
-
case "ArrowDown":
|
|
382
|
-
newColor.lightness -= value;
|
|
383
|
-
break;
|
|
384
|
-
case "ArrowLeft":
|
|
385
|
-
newColor.saturation -= value;
|
|
386
|
-
break;
|
|
387
|
-
case "ArrowRight":
|
|
388
|
-
newColor.saturation += value;
|
|
389
|
-
default:
|
|
390
|
-
break;
|
|
391
|
-
}
|
|
392
|
-
this.currentColor = newColor;
|
|
393
|
-
};
|
|
394
|
-
this.handleHueKeyDown = (e) => {
|
|
395
|
-
let newColor = new ColorInfo();
|
|
396
|
-
newColor.hue = this.currentColor.hue;
|
|
397
|
-
newColor.saturation = this.currentColor.saturation;
|
|
398
|
-
newColor.lightness = this.currentColor.lightness;
|
|
399
|
-
let value = 1;
|
|
400
|
-
if (e.shiftKey) {
|
|
401
|
-
value = 10;
|
|
402
|
-
}
|
|
403
|
-
switch (e.key) {
|
|
404
|
-
case "ArrowLeft":
|
|
405
|
-
newColor.hue -= value;
|
|
406
|
-
break;
|
|
407
|
-
case "ArrowRight":
|
|
408
|
-
newColor.hue += value;
|
|
409
|
-
default:
|
|
410
|
-
break;
|
|
411
|
-
}
|
|
412
|
-
this.currentColor = newColor;
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
colorChangedHandler(color) {
|
|
416
|
-
this.colorChanged.emit(color);
|
|
417
|
-
}
|
|
418
|
-
handeCurrentColorChanged(newValue) {
|
|
419
|
-
this.colorChangedHandler(newValue);
|
|
420
|
-
}
|
|
421
|
-
componentWillLoad() {
|
|
422
|
-
this.handleHexChange(this.color);
|
|
423
|
-
}
|
|
424
|
-
componentDidLoad() {
|
|
425
|
-
this.el.style.setProperty("--color-box-height", this.colorBoxHeight.toString());
|
|
426
|
-
}
|
|
427
|
-
getHex() {
|
|
428
|
-
return this.getDoublet(this.currentColor.red) + this.getDoublet(this.currentColor.green) + this.getDoublet(this.currentColor.blue);
|
|
429
|
-
}
|
|
430
|
-
getContrast() {
|
|
431
|
-
return this.currentColor.contrastColor;
|
|
432
|
-
}
|
|
433
|
-
getDoublet(value) {
|
|
434
|
-
const valueString = value.toString(16).toUpperCase();
|
|
435
|
-
if (valueString.length === 1) {
|
|
436
|
-
return '0' + valueString;
|
|
437
|
-
}
|
|
438
|
-
return valueString;
|
|
439
|
-
}
|
|
440
|
-
handleHexChange(value) {
|
|
441
|
-
const newColor = new ColorInfo();
|
|
442
|
-
if (value.match(/^(?:[\da-f]{3}|[\da-f]{6})$/i).length > 0) {
|
|
443
|
-
if (value.length === 3) {
|
|
444
|
-
let expanded = value[0] + value[0] + value[1] + value[1] + value[2] + value[2];
|
|
445
|
-
value = expanded;
|
|
446
|
-
}
|
|
447
|
-
newColor.red = parseInt(value.substr(0, 2), 16);
|
|
448
|
-
newColor.green = parseInt(value.substr(2, 2), 16);
|
|
449
|
-
newColor.blue = parseInt(value.substr(4, 2), 16);
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
452
|
-
newColor.red = this.currentColor.red;
|
|
453
|
-
newColor.green = this.currentColor.green;
|
|
454
|
-
newColor.blue = this.currentColor.blue;
|
|
455
|
-
}
|
|
456
|
-
this.currentColor = newColor;
|
|
457
|
-
}
|
|
458
|
-
switchColorMode(e) {
|
|
459
|
-
switch (e.target.id) {
|
|
460
|
-
case "rgb-switch":
|
|
461
|
-
this.rgbDisplay = "none";
|
|
462
|
-
this.hslDisplay = "none";
|
|
463
|
-
this.hexDisplay = "flex";
|
|
464
|
-
break;
|
|
465
|
-
case "hex-switch":
|
|
466
|
-
this.rgbDisplay = "none";
|
|
467
|
-
this.hslDisplay = "flex";
|
|
468
|
-
this.hexDisplay = "none";
|
|
469
|
-
break;
|
|
470
|
-
case "hsl-switch":
|
|
471
|
-
this.rgbDisplay = "flex";
|
|
472
|
-
this.hslDisplay = "none";
|
|
473
|
-
this.hexDisplay = "none";
|
|
474
|
-
break;
|
|
475
|
-
default:
|
|
476
|
-
this.rgbDisplay = "flex";
|
|
477
|
-
this.hslDisplay = "none";
|
|
478
|
-
this.hexDisplay = "none";
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
render() {
|
|
482
|
-
const hue = this.currentColor.hue;
|
|
483
|
-
const saturation = this.currentColor.saturation;
|
|
484
|
-
const lightness = this.currentColor.lightness;
|
|
485
|
-
const red = this.currentColor.red;
|
|
486
|
-
const green = this.currentColor.green;
|
|
487
|
-
const blue = this.currentColor.blue;
|
|
488
|
-
return (index.h("div", { class: "dnn-color-picker" }, index.h("div", { class: "dnn-color-sliders" }, index.h("div", { class: "dnn-color-s-b", ref: (element) => this.saturationLightnessBox = element, style: { backgroundColor: `hsl(${hue},100%,50%)` }, onMouseDown: this.handleSaturationLightnessMouseDown.bind(this) }, index.h("button", { class: "dnn-s-b-picker", "aria-label": "Press up or down to adjust lightness, left or right to adjust saturation, hold shift to move by 10%", role: "slider", "aria-valuemin": "0", "aria-valuemax": "100", "aria-valuetext": `Saturation: ${Math.round(this.currentColor.saturation * 100)}%, Lightness: ${Math.round(this.currentColor.lightness * 100)}%`, style: {
|
|
489
|
-
left: Math.round(saturation * 100) + "%",
|
|
490
|
-
bottom: Math.round(lightness * 100) + "%"
|
|
491
|
-
}, onKeyDown: (e) => this.handleSaturationLightnessKeyDown(e) })), index.h("div", { class: "dnn-color-bar" }, index.h("div", { class: "dnn-color-result", style: {
|
|
492
|
-
backgroundColor: '#' + this.getHex(),
|
|
493
|
-
boxShadow: "0 0 2px 1px " + "#" + this.getContrast()
|
|
494
|
-
} }), index.h("div", { class: "dnn-color-hue", ref: (element) => this.hueRange = element, onMouseDown: this.handleHueMouseDown.bind(this) }, index.h("button", { class: "dnn-hue-picker", "aria-label": "Press left or right to adjust hue, hold shift to move by 10 degrees", role: "slider", "aria-valuemin": "0", "aria-valuemax": "359", "aria-valuenow": Math.round(hue), style: { left: (hue / 359 * 100).toString() + "%" }, onKeyDown: (e) => this.handleHueKeyDown(e) })))), index.h("div", { class: "dnn-color-fields" }, index.h("div", { class: "dnn-rgb-color-fields", style: { display: this.rgbDisplay } }, index.h("div", { class: "dnn-rgb-color-field" }, index.h("label", null, "R"), index.h("input", { type: "number", min: "0", max: "255", step: "1", class: "red", value: red, "aria-label": "red value", onChange: (e) => this.handleComponentValueChange(e, 'red') })), index.h("div", { class: "dnn-rgb-color-field" }, index.h("label", null, "G"), index.h("input", { type: "number", min: "0", max: "255", class: "green", value: green, "aria-label": "green value", onChange: (e) => this.handleComponentValueChange(e, 'green') })), index.h("div", { class: "dnn-rgb-color-field" }, index.h("label", null, "B"), index.h("input", { type: "number", min: "0", max: "255", class: "blue", value: blue, "aria-label": "blue value", onChange: (e) => this.handleComponentValueChange(e, 'blue') })), index.h("div", { class: "dnn-color-mode-switch" }, index.h("button", { id: "rgb-switch", onClick: this.switchColorMode.bind(this), "aria-label": "switch to hexadecimal value entry" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, index.h("path", { d: "M0 0h24v24H0z", fill: "none" }), index.h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))), index.h("div", { class: "dnn-hsl-color-fields", style: { display: this.hslDisplay } }, index.h("div", { class: "dnn-hsl-color-field" }, index.h("label", null, "H"), index.h("input", { type: "number", min: "0", max: "359", step: 1, value: Math.round(hue), "aria-label": "Hue", onChange: (e) => this.handleHSLChange(e, 'hue') })), index.h("div", { class: "dnn-hsl-color-field" }, index.h("label", null, "S"), index.h("input", { type: "number", min: "0", max: "100", step: 1, value: Math.round(saturation * 100), "aria-label": "Saturation", onChange: (e) => this.handleHSLChange(e, 'saturation') })), index.h("div", { class: "dnn-hsl-color-field" }, index.h("label", null, "L"), index.h("input", { type: "number", min: "0", max: "100", step: 1, value: Math.round(lightness * 100), "aria-label": "Lightness", onChange: (e) => this.handleHSLChange(e, 'lightness') })), index.h("div", { class: "dnn-color-mode-switch" }, index.h("button", { id: "hsl-switch", onClick: this.switchColorMode.bind(this), "aria-label": "Switch to red, green, blue entry mode" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, index.h("path", { d: "M0 0h24v24H0z", fill: "none" }), index.h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))), index.h("div", { class: "dnn-hex-color-fields", style: { display: this.hexDisplay } }, index.h("div", { class: "dnn-hex-color-field" }, index.h("label", null, "HEX"), index.h("div", { class: "hex-input" }, index.h("input", { type: "text", "aria-label": "Hexadecimal value", value: this.getHex(), onChange: e => this.handleHexChange(e.target.value) }), index.h("button", { class: "copy", "aria-label": "copy value" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, index.h("path", { d: "M0 0h24v24H0z", fill: "none" }), index.h("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }))))), index.h("div", { class: "dnn-color-mode-switch" }, index.h("button", { id: "hex-switch", onClick: this.switchColorMode.bind(this), "aria-label": "Switch to hue saturation lightness values" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, index.h("path", { d: "M0 0h24v24H0z", fill: "none" }), index.h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))))));
|
|
495
|
-
}
|
|
496
|
-
get el() { return index.getElement(this); }
|
|
497
|
-
static get watchers() { return {
|
|
498
|
-
"currentColor": ["handeCurrentColorChanged"]
|
|
499
|
-
}; }
|
|
500
|
-
};
|
|
501
|
-
__decorate([
|
|
502
|
-
debounce.Debounce(100)
|
|
503
|
-
], DnnColorPicker.prototype, "colorChangedHandler", null);
|
|
504
|
-
DnnColorPicker.style = dnnColorPickerCss;
|
|
505
|
-
|
|
506
|
-
exports.dnn_color_picker = DnnColorPicker;
|
|
507
|
-
|
|
508
|
-
//# sourceMappingURL=dnn-color-picker.cjs.entry.js.map
|