From 2e5d5535b98461b291d166e6d06ae8cf53220dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Heidk=C3=A4mper?= Date: Thu, 16 May 2024 18:19:09 +0000 Subject: [PATCH 01/17] remove pickr package, prepare new structure --- dist/css/addon.css | 1 + dist/css/classic.css | 2 - dist/css/monolith.css | 2 - dist/css/nano.css | 2 - dist/js/addon.js | 1 + dist/js/bard-color-picker.js | 1 - dist/js/bard-color-picker.js.LICENSE.txt | 1 - eslint.config.js | 1 + package.json | 1 - resources/js/ColorPanel.vue | 90 ------------------- .../js/{bard-color-picker.js => addon.js} | 6 +- resources/js/components/ColorPanel.vue | 43 +++++++++ resources/js/helpers.js | 11 +++ resources/js/{Color.js => marks/textColor.js} | 16 +--- resources/scss/addon.scss | 0 resources/scss/classic.scss | 3 - resources/scss/monolith.scss | 3 - resources/scss/nano.scss | 3 - src/Marks/{Color.php => TextColor.php} | 2 +- src/ServiceProvider.php | 15 ++-- tests/Feature/AssetsTest.php | 4 +- webpack.mix.cjs | 6 +- 22 files changed, 75 insertions(+), 139 deletions(-) create mode 100644 dist/css/addon.css delete mode 100644 dist/css/classic.css delete mode 100644 dist/css/monolith.css delete mode 100644 dist/css/nano.css create mode 100644 dist/js/addon.js delete mode 100644 dist/js/bard-color-picker.js delete mode 100644 dist/js/bard-color-picker.js.LICENSE.txt delete mode 100644 resources/js/ColorPanel.vue rename resources/js/{bard-color-picker.js => addon.js} (84%) create mode 100644 resources/js/components/ColorPanel.vue create mode 100644 resources/js/helpers.js rename resources/js/{Color.js => marks/textColor.js} (74%) create mode 100644 resources/scss/addon.scss delete mode 100644 resources/scss/classic.scss delete mode 100644 resources/scss/monolith.scss delete mode 100644 resources/scss/nano.scss rename src/Marks/{Color.php => TextColor.php} (92%) diff --git a/dist/css/addon.css b/dist/css/addon.css new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/dist/css/addon.css @@ -0,0 +1 @@ + diff --git a/dist/css/classic.css b/dist/css/classic.css deleted file mode 100644 index b7362b8..0000000 --- a/dist/css/classic.css +++ /dev/null @@ -1,2 +0,0 @@ -#statamic{ - /*! Pickr 1.9.0 MIT | https://github.com/Simonwep/pickr */}#statamic .pickr{overflow:visible;position:relative;transform:translateY(0)}#statamic .pickr *{-webkit-appearance:none;border:none;box-sizing:border-box;outline:none}#statamic .pickr .pcr-button{background:url('data:image/svg+xml;utf8, ') no-repeat 50%;background-size:0;border-radius:.15em;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;height:2em;padding:.5em;position:relative;transition:all .3s;width:2em}#statamic .pickr .pcr-button:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;z-index:-1;z-index:auto}#statamic .pickr .pcr-button:after,#statamic .pickr .pcr-button:before{border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%}#statamic .pickr .pcr-button:after{background:var(--pcr-color);transition:background .3s}#statamic .pickr .pcr-button.clear{background-size:70%}#statamic .pickr .pcr-button.clear:before{opacity:0}#statamic .pickr .pcr-button.clear:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px var(--pcr-color)}#statamic .pickr .pcr-button.disabled{cursor:not-allowed}#statamic .pcr-app *,#statamic .pickr *{-webkit-appearance:none;border:none;box-sizing:border-box;outline:none}#statamic .pcr-app button.pcr-active,#statamic .pcr-app button:focus,#statamic .pcr-app input.pcr-active,#statamic .pcr-app input:focus,#statamic .pickr button.pcr-active,#statamic .pickr button:focus,#statamic .pickr input.pcr-active,#statamic .pickr input:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px var(--pcr-color)}#statamic .pcr-app .pcr-palette,#statamic .pcr-app .pcr-slider,#statamic .pickr .pcr-palette,#statamic .pickr .pcr-slider{transition:box-shadow .3s}#statamic .pcr-app .pcr-palette:focus,#statamic .pcr-app .pcr-slider:focus,#statamic .pickr .pcr-palette:focus,#statamic .pickr .pcr-slider:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px #00000040}#statamic .pcr-app{background:#fff;border-radius:.1em;box-shadow:0 .15em 1.5em 0 #0000001a,0 0 1em 0 #00000008;display:flex;flex-direction:column;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;left:0;opacity:0;position:fixed;top:0;transition:opacity .3s,visibility 0s .3s;visibility:hidden;z-index:10000}#statamic .pcr-app.visible{opacity:1;transition:opacity .3s;visibility:visible}#statamic .pcr-app .pcr-swatches{display:flex;flex-wrap:wrap;margin-top:.75em}#statamic .pcr-app .pcr-swatches.pcr-last{margin:0}@supports (display:grid){#statamic .pcr-app .pcr-swatches{align-items:center;display:grid;grid-template-columns:repeat(auto-fit,1.75em)}}#statamic .pcr-app .pcr-swatches>button{background:#0000;border-radius:.15em;cursor:pointer;flex-shrink:0;font-size:1em;height:calc(1.75em - 5px);justify-self:center;margin:2.5px;overflow:hidden;position:relative;transition:all .15s;width:calc(1.75em - 5px);z-index:1}#statamic .pcr-app .pcr-swatches>button:before{background:url('data:image/svg+xml;utf8, ');background-size:6px;border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}#statamic .pcr-app .pcr-swatches>button:after{background:var(--pcr-color);border:1px solid #0000000d;border-radius:.15em;box-sizing:border-box;content:"";height:100%;left:0;position:absolute;top:0;width:100%}#statamic .pcr-app .pcr-swatches>button:hover{filter:brightness(1.05)}#statamic .pcr-app .pcr-swatches>button:not(.pcr-active){box-shadow:none}#statamic .pcr-app .pcr-interaction{align-items:center;display:flex;flex-wrap:wrap;margin:0 -.2em}#statamic .pcr-app .pcr-interaction>*{margin:0 .2em}#statamic .pcr-app .pcr-interaction input{background:#f1f3f4;border-radius:.15em;color:#75797e;cursor:pointer;font-size:.75em;letter-spacing:.07em;margin-top:.75em;padding:.45em .5em;text-align:center;transition:all .15s}#statamic .pcr-app .pcr-interaction input:hover{filter:brightness(.975)}#statamic .pcr-app .pcr-interaction input:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px #4285f4bf}#statamic .pcr-app .pcr-interaction .pcr-result{background:#f1f3f4;border-radius:.15em;color:#75797e;cursor:text;flex:1 1 8em;min-width:8em;text-align:left;transition:all .2s}#statamic .pcr-app .pcr-interaction .pcr-result::selection{background:#4285f4;color:#fff}#statamic .pcr-app .pcr-interaction .pcr-type.active{background:#4285f4;color:#fff}#statamic .pcr-app .pcr-interaction .pcr-cancel,#statamic .pcr-app .pcr-interaction .pcr-clear,#statamic .pcr-app .pcr-interaction .pcr-save{color:#fff;width:auto}#statamic .pcr-app .pcr-interaction .pcr-cancel:hover,#statamic .pcr-app .pcr-interaction .pcr-clear:hover,#statamic .pcr-app .pcr-interaction .pcr-save:hover{filter:brightness(.925)}#statamic .pcr-app .pcr-interaction .pcr-save{background:#4285f4}#statamic .pcr-app .pcr-interaction .pcr-cancel,#statamic .pcr-app .pcr-interaction .pcr-clear{background:#f44250}#statamic .pcr-app .pcr-interaction .pcr-cancel:focus,#statamic .pcr-app .pcr-interaction .pcr-clear:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px #f44250bf}#statamic .pcr-app .pcr-selection .pcr-picker{border:2px solid #fff;border-radius:100%;height:18px;position:absolute;-webkit-user-select:none;user-select:none;width:18px}#statamic .pcr-app .pcr-selection .pcr-color-chooser,#statamic .pcr-app .pcr-selection .pcr-color-opacity,#statamic .pcr-app .pcr-selection .pcr-color-palette{cursor:grab;cursor:-webkit-grab;display:flex;flex-direction:column;position:relative;-webkit-user-select:none;user-select:none}#statamic .pcr-app .pcr-selection .pcr-color-chooser:active,#statamic .pcr-app .pcr-selection .pcr-color-opacity:active,#statamic .pcr-app .pcr-selection .pcr-color-palette:active{cursor:grabbing;cursor:-webkit-grabbing}#statamic .pcr-app[data-theme=classic]{max-width:95vw;padding:.8em;width:28.5em}#statamic .pcr-app[data-theme=classic] .pcr-selection{display:flex;flex-grow:1;justify-content:space-between}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview{display:flex;flex-direction:column;justify-content:space-between;margin-right:.75em;position:relative;width:2em;z-index:1}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-last-color{border-radius:.15em .15em 0 0;cursor:pointer;z-index:2}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-current-color{border-radius:0 0 .15em .15em}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-current-color,#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-last-color{background:var(--pcr-color);height:50%;width:100%}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette{height:8em;width:100%;z-index:1}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette .pcr-palette{border-radius:.15em;flex-grow:1}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette .pcr-palette:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser,#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity{margin-left:.75em}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser .pcr-picker,#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity .pcr-picker{left:50%;transform:translateX(-50%)}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser .pcr-slider,#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity .pcr-slider{border-radius:50em;flex-grow:1;width:8px}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser .pcr-slider{background:linear-gradient(180deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}#statamic .pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity .pcr-slider{background:linear-gradient(180deg,#0000,#000),url('data:image/svg+xml;utf8, ');background-size:100%,50%} diff --git a/dist/css/monolith.css b/dist/css/monolith.css deleted file mode 100644 index 169e7cf..0000000 --- a/dist/css/monolith.css +++ /dev/null @@ -1,2 +0,0 @@ -#statamic{ - /*! Pickr 1.9.0 MIT | https://github.com/Simonwep/pickr */}#statamic .pickr{overflow:visible;position:relative;transform:translateY(0)}#statamic .pickr *{-webkit-appearance:none;border:none;box-sizing:border-box;outline:none}#statamic .pickr .pcr-button{background:url('data:image/svg+xml;utf8, ') no-repeat 50%;background-size:0;border-radius:.15em;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;height:2em;padding:.5em;position:relative;transition:all .3s;width:2em}#statamic .pickr .pcr-button:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;z-index:-1;z-index:auto}#statamic .pickr .pcr-button:after,#statamic .pickr .pcr-button:before{border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%}#statamic .pickr .pcr-button:after{background:var(--pcr-color);transition:background .3s}#statamic .pickr .pcr-button.clear{background-size:70%}#statamic .pickr .pcr-button.clear:before{opacity:0}#statamic .pickr .pcr-button.clear:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px var(--pcr-color)}#statamic .pickr .pcr-button.disabled{cursor:not-allowed}#statamic .pcr-app *,#statamic .pickr *{-webkit-appearance:none;border:none;box-sizing:border-box;outline:none}#statamic .pcr-app button.pcr-active,#statamic .pcr-app button:focus,#statamic .pcr-app input.pcr-active,#statamic .pcr-app input:focus,#statamic .pickr button.pcr-active,#statamic .pickr button:focus,#statamic .pickr input.pcr-active,#statamic .pickr input:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px var(--pcr-color)}#statamic .pcr-app .pcr-palette,#statamic .pcr-app .pcr-slider,#statamic .pickr .pcr-palette,#statamic .pickr .pcr-slider{transition:box-shadow .3s}#statamic .pcr-app .pcr-palette:focus,#statamic .pcr-app .pcr-slider:focus,#statamic .pickr .pcr-palette:focus,#statamic .pickr .pcr-slider:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px #00000040}#statamic .pcr-app{background:#fff;border-radius:.1em;box-shadow:0 .15em 1.5em 0 #0000001a,0 0 1em 0 #00000008;display:flex;flex-direction:column;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;left:0;opacity:0;position:fixed;top:0;transition:opacity .3s,visibility 0s .3s;visibility:hidden;z-index:10000}#statamic .pcr-app.visible{opacity:1;transition:opacity .3s;visibility:visible}#statamic .pcr-app .pcr-swatches{display:flex;flex-wrap:wrap;margin-top:.75em}#statamic .pcr-app .pcr-swatches.pcr-last{margin:0}@supports (display:grid){#statamic .pcr-app .pcr-swatches{align-items:center;display:grid;grid-template-columns:repeat(auto-fit,1.75em)}}#statamic .pcr-app .pcr-swatches>button{background:#0000;border-radius:.15em;cursor:pointer;flex-shrink:0;font-size:1em;height:calc(1.75em - 5px);justify-self:center;margin:2.5px;overflow:hidden;position:relative;transition:all .15s;width:calc(1.75em - 5px);z-index:1}#statamic .pcr-app .pcr-swatches>button:before{background:url('data:image/svg+xml;utf8, ');background-size:6px;border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}#statamic .pcr-app .pcr-swatches>button:after{background:var(--pcr-color);border:1px solid #0000000d;border-radius:.15em;box-sizing:border-box;content:"";height:100%;left:0;position:absolute;top:0;width:100%}#statamic .pcr-app .pcr-swatches>button:hover{filter:brightness(1.05)}#statamic .pcr-app .pcr-swatches>button:not(.pcr-active){box-shadow:none}#statamic .pcr-app .pcr-interaction{align-items:center;display:flex;flex-wrap:wrap;margin:0 -.2em}#statamic .pcr-app .pcr-interaction>*{margin:0 .2em}#statamic .pcr-app .pcr-interaction input{background:#f1f3f4;border-radius:.15em;color:#75797e;cursor:pointer;font-size:.75em;letter-spacing:.07em;margin-top:.75em;padding:.45em .5em;text-align:center;transition:all .15s}#statamic .pcr-app .pcr-interaction input:hover{filter:brightness(.975)}#statamic .pcr-app .pcr-interaction input:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px #4285f4bf}#statamic .pcr-app .pcr-interaction .pcr-result{background:#f1f3f4;border-radius:.15em;color:#75797e;cursor:text;flex:1 1 8em;min-width:8em;text-align:left;transition:all .2s}#statamic .pcr-app .pcr-interaction .pcr-result::selection{background:#4285f4;color:#fff}#statamic .pcr-app .pcr-interaction .pcr-type.active{background:#4285f4;color:#fff}#statamic .pcr-app .pcr-interaction .pcr-cancel,#statamic .pcr-app .pcr-interaction .pcr-clear,#statamic .pcr-app .pcr-interaction .pcr-save{color:#fff;width:auto}#statamic .pcr-app .pcr-interaction .pcr-cancel:hover,#statamic .pcr-app .pcr-interaction .pcr-clear:hover,#statamic .pcr-app .pcr-interaction .pcr-save:hover{filter:brightness(.925)}#statamic .pcr-app .pcr-interaction .pcr-save{background:#4285f4}#statamic .pcr-app .pcr-interaction .pcr-cancel,#statamic .pcr-app .pcr-interaction .pcr-clear{background:#f44250}#statamic .pcr-app .pcr-interaction .pcr-cancel:focus,#statamic .pcr-app .pcr-interaction .pcr-clear:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px #f44250bf}#statamic .pcr-app .pcr-selection .pcr-picker{border:2px solid #fff;border-radius:100%;height:18px;position:absolute;-webkit-user-select:none;user-select:none;width:18px}#statamic .pcr-app .pcr-selection .pcr-color-chooser,#statamic .pcr-app .pcr-selection .pcr-color-opacity,#statamic .pcr-app .pcr-selection .pcr-color-palette{cursor:grab;cursor:-webkit-grab;display:flex;flex-direction:column;position:relative;-webkit-user-select:none;user-select:none}#statamic .pcr-app .pcr-selection .pcr-color-chooser:active,#statamic .pcr-app .pcr-selection .pcr-color-opacity:active,#statamic .pcr-app .pcr-selection .pcr-color-palette:active{cursor:grabbing;cursor:-webkit-grabbing}#statamic .pcr-app[data-theme=monolith]{max-width:95vw;padding:.8em;width:14.25em}#statamic .pcr-app[data-theme=monolith] .pcr-selection{display:flex;flex-direction:column;flex-grow:1;justify-content:space-between}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-preview{display:flex;flex-direction:row;height:1em;justify-content:space-between;margin-bottom:.5em;position:relative;width:100%;z-index:1}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-preview:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-preview .pcr-last-color{border-radius:.15em 0 0 .15em;cursor:pointer;transition:background-color .3s,box-shadow .3s;z-index:2}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-preview .pcr-current-color{border-radius:0 .15em .15em 0}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-preview .pcr-current-color,#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-preview .pcr-last-color{background:var(--pcr-color);height:100%;width:50%}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-palette{height:8em;width:100%;z-index:1}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-palette .pcr-palette{border-radius:.15em;height:100%;width:100%}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-palette .pcr-palette:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-chooser,#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-opacity{height:.5em;margin-top:.75em}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-chooser .pcr-picker,#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-opacity .pcr-picker{top:50%;transform:translateY(-50%)}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-chooser .pcr-slider,#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-opacity .pcr-slider{border-radius:50em;flex-grow:1}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-chooser .pcr-slider{background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}#statamic .pcr-app[data-theme=monolith] .pcr-selection .pcr-color-opacity .pcr-slider{background:linear-gradient(90deg,#0000,#000),url('data:image/svg+xml;utf8, ');background-size:100%,.25em} diff --git a/dist/css/nano.css b/dist/css/nano.css deleted file mode 100644 index c834442..0000000 --- a/dist/css/nano.css +++ /dev/null @@ -1,2 +0,0 @@ -#statamic{ - /*! Pickr 1.9.0 MIT | https://github.com/Simonwep/pickr */}#statamic .pickr{overflow:visible;position:relative;transform:translateY(0)}#statamic .pickr *{-webkit-appearance:none;border:none;box-sizing:border-box;outline:none}#statamic .pickr .pcr-button{background:url('data:image/svg+xml;utf8, ') no-repeat 50%;background-size:0;border-radius:.15em;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;height:2em;padding:.5em;position:relative;transition:all .3s;width:2em}#statamic .pickr .pcr-button:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;z-index:-1;z-index:auto}#statamic .pickr .pcr-button:after,#statamic .pickr .pcr-button:before{border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%}#statamic .pickr .pcr-button:after{background:var(--pcr-color);transition:background .3s}#statamic .pickr .pcr-button.clear{background-size:70%}#statamic .pickr .pcr-button.clear:before{opacity:0}#statamic .pickr .pcr-button.clear:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px var(--pcr-color)}#statamic .pickr .pcr-button.disabled{cursor:not-allowed}#statamic .pcr-app *,#statamic .pickr *{-webkit-appearance:none;border:none;box-sizing:border-box;outline:none}#statamic .pcr-app button.pcr-active,#statamic .pcr-app button:focus,#statamic .pcr-app input.pcr-active,#statamic .pcr-app input:focus,#statamic .pickr button.pcr-active,#statamic .pickr button:focus,#statamic .pickr input.pcr-active,#statamic .pickr input:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px var(--pcr-color)}#statamic .pcr-app .pcr-palette,#statamic .pcr-app .pcr-slider,#statamic .pickr .pcr-palette,#statamic .pickr .pcr-slider{transition:box-shadow .3s}#statamic .pcr-app .pcr-palette:focus,#statamic .pcr-app .pcr-slider:focus,#statamic .pickr .pcr-palette:focus,#statamic .pickr .pcr-slider:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px #00000040}#statamic .pcr-app{background:#fff;border-radius:.1em;box-shadow:0 .15em 1.5em 0 #0000001a,0 0 1em 0 #00000008;display:flex;flex-direction:column;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;left:0;opacity:0;position:fixed;top:0;transition:opacity .3s,visibility 0s .3s;visibility:hidden;z-index:10000}#statamic .pcr-app.visible{opacity:1;transition:opacity .3s;visibility:visible}#statamic .pcr-app .pcr-swatches{display:flex;flex-wrap:wrap;margin-top:.75em}#statamic .pcr-app .pcr-swatches.pcr-last{margin:0}@supports (display:grid){#statamic .pcr-app .pcr-swatches{align-items:center;display:grid;grid-template-columns:repeat(auto-fit,1.75em)}}#statamic .pcr-app .pcr-swatches>button{background:#0000;border-radius:.15em;cursor:pointer;flex-shrink:0;font-size:1em;height:calc(1.75em - 5px);justify-self:center;margin:2.5px;overflow:hidden;position:relative;transition:all .15s;width:calc(1.75em - 5px);z-index:1}#statamic .pcr-app .pcr-swatches>button:before{background:url('data:image/svg+xml;utf8, ');background-size:6px;border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}#statamic .pcr-app .pcr-swatches>button:after{background:var(--pcr-color);border:1px solid #0000000d;border-radius:.15em;box-sizing:border-box;content:"";height:100%;left:0;position:absolute;top:0;width:100%}#statamic .pcr-app .pcr-swatches>button:hover{filter:brightness(1.05)}#statamic .pcr-app .pcr-swatches>button:not(.pcr-active){box-shadow:none}#statamic .pcr-app .pcr-interaction{align-items:center;display:flex;flex-wrap:wrap;margin:0 -.2em}#statamic .pcr-app .pcr-interaction>*{margin:0 .2em}#statamic .pcr-app .pcr-interaction input{background:#f1f3f4;border-radius:.15em;color:#75797e;cursor:pointer;font-size:.75em;letter-spacing:.07em;margin-top:.75em;padding:.45em .5em;text-align:center;transition:all .15s}#statamic .pcr-app .pcr-interaction input:hover{filter:brightness(.975)}#statamic .pcr-app .pcr-interaction input:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px #4285f4bf}#statamic .pcr-app .pcr-interaction .pcr-result{background:#f1f3f4;border-radius:.15em;color:#75797e;cursor:text;flex:1 1 8em;min-width:8em;text-align:left;transition:all .2s}#statamic .pcr-app .pcr-interaction .pcr-result::selection{background:#4285f4;color:#fff}#statamic .pcr-app .pcr-interaction .pcr-type.active{background:#4285f4;color:#fff}#statamic .pcr-app .pcr-interaction .pcr-cancel,#statamic .pcr-app .pcr-interaction .pcr-clear,#statamic .pcr-app .pcr-interaction .pcr-save{color:#fff;width:auto}#statamic .pcr-app .pcr-interaction .pcr-cancel:hover,#statamic .pcr-app .pcr-interaction .pcr-clear:hover,#statamic .pcr-app .pcr-interaction .pcr-save:hover{filter:brightness(.925)}#statamic .pcr-app .pcr-interaction .pcr-save{background:#4285f4}#statamic .pcr-app .pcr-interaction .pcr-cancel,#statamic .pcr-app .pcr-interaction .pcr-clear{background:#f44250}#statamic .pcr-app .pcr-interaction .pcr-cancel:focus,#statamic .pcr-app .pcr-interaction .pcr-clear:focus{box-shadow:0 0 0 1px #ffffffd9,0 0 0 3px #f44250bf}#statamic .pcr-app .pcr-selection .pcr-picker{border:2px solid #fff;border-radius:100%;height:18px;position:absolute;-webkit-user-select:none;user-select:none;width:18px}#statamic .pcr-app .pcr-selection .pcr-color-chooser,#statamic .pcr-app .pcr-selection .pcr-color-opacity,#statamic .pcr-app .pcr-selection .pcr-color-palette{cursor:grab;cursor:-webkit-grab;display:flex;flex-direction:column;position:relative;-webkit-user-select:none;user-select:none}#statamic .pcr-app .pcr-selection .pcr-color-chooser:active,#statamic .pcr-app .pcr-selection .pcr-color-opacity:active,#statamic .pcr-app .pcr-selection .pcr-color-palette:active{cursor:grabbing;cursor:-webkit-grabbing}#statamic .pcr-app[data-theme=nano]{max-width:95vw;width:14.25em}#statamic .pcr-app[data-theme=nano] .pcr-swatches{margin-top:.6em;padding:0 .6em}#statamic .pcr-app[data-theme=nano] .pcr-interaction{padding:0 .6em .6em}#statamic .pcr-app[data-theme=nano] .pcr-selection{grid-gap:.6em;align-items:center;align-self:flex-start;display:grid;grid-template-columns:1fr 4fr;grid-template-rows:5fr auto auto;height:10.5em;width:100%}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-preview{display:flex;flex-direction:row;grid-area:2/1/4/1;height:100%;justify-content:center;margin-left:.6em;width:100%}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-preview .pcr-last-color{display:none}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-preview .pcr-current-color{background:var(--pcr-color);border-radius:50em;height:2em;overflow:hidden;position:relative;width:2em}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-preview .pcr-current-color:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-palette{grid-area:1/1/2/3;height:100%;width:100%;z-index:1}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-palette .pcr-palette{border-radius:.15em;height:100%;width:100%}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-palette .pcr-palette:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-chooser{grid-area:2/2/2/2}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-opacity{grid-area:3/2/3/2}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-chooser,#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-opacity{height:.5em;margin:0 .6em}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-chooser .pcr-picker,#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-opacity .pcr-picker{top:50%;transform:translateY(-50%)}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-chooser .pcr-slider,#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-opacity .pcr-slider{border-radius:50em;flex-grow:1}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-chooser .pcr-slider{background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}#statamic .pcr-app[data-theme=nano] .pcr-selection .pcr-color-opacity .pcr-slider{background:linear-gradient(90deg,#0000,#000),url('data:image/svg+xml;utf8, ');background-size:100%,.25em} diff --git a/dist/js/addon.js b/dist/js/addon.js new file mode 100644 index 0000000..aed218b --- /dev/null +++ b/dist/js/addon.js @@ -0,0 +1 @@ +(()=>{"use strict";var t,r={247:()=>{},46:()=>{var t=function(t,r,e,n,a,i,o,s){var u,h="function"==typeof t?t.options:t;if(r&&(h.render=r,h.staticRenderFns=e,h._compiled=!0),n&&(h.functional=!0),i&&(h._scopeId="data-v-"+i),o?(u=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),a&&a.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},h._ssrRegister=u):a&&(u=s?function(){a.call(this,(h.functional?this.parent:this).$root.$options.shadowRoot)}:a),u)if(h.functional){h._injectStyles=u;var f=h.render;h.render=function(t,r){return u.call(r),f(t,r)}}else{var l=h.beforeCreate;h.beforeCreate=l?[].concat(l,u):[u]}return{exports:t,options:h}}({mixins:[BardToolbarButton],data:function(){return{color:"#000",isActive:!1}},computed:{currentColor:function(){var t;return null===(t=this.editor.getAttributes("textColor"))||void 0===t?void 0:t.color}},methods:{toggleActive:function(){this.isActive=!this.isActive},setColor:function(t){this.editor.commands.setColor({color:t})}},mounted:function(){this.config=Statamic.$config.get("bard-color-picker")}},(function(){var t=this,r=t.$createElement;return(t._self._c||r)("button",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.button.text,expression:"button.text"}],staticClass:"bard-toolbar-button",class:{active:t.currentColor},style:"color: "+(t.currentColor?t.currentColor:"inherit")+";",attrs:{"aria-label":t.button.text},domProps:{innerHTML:t._s(t.button.html)},on:{click:t.toggleActive}})}),[],!1,null,null,null);const r=t.exports;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}var n=/^\s+/,a=/\s+$/;function i(t,r){if(r=r||{},(t=t||"")instanceof i)return t;if(!(this instanceof i))return new i(t,r);var o=function(t){var r={r:0,g:0,b:0},i=1,o=null,s=null,u=null,h=!1,f=!1;"string"==typeof t&&(t=function(t){t=t.replace(n,"").replace(a,"").toLowerCase();var r,e=!1;if(A[t])t=A[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(r=N.rgb.exec(t))return{r:r[1],g:r[2],b:r[3]};if(r=N.rgba.exec(t))return{r:r[1],g:r[2],b:r[3],a:r[4]};if(r=N.hsl.exec(t))return{h:r[1],s:r[2],l:r[3]};if(r=N.hsla.exec(t))return{h:r[1],s:r[2],l:r[3],a:r[4]};if(r=N.hsv.exec(t))return{h:r[1],s:r[2],v:r[3]};if(r=N.hsva.exec(t))return{h:r[1],s:r[2],v:r[3],a:r[4]};if(r=N.hex8.exec(t))return{r:R(r[1]),g:R(r[2]),b:R(r[3]),a:T(r[4]),format:e?"name":"hex8"};if(r=N.hex6.exec(t))return{r:R(r[1]),g:R(r[2]),b:R(r[3]),format:e?"name":"hex"};if(r=N.hex4.exec(t))return{r:R(r[1]+""+r[1]),g:R(r[2]+""+r[2]),b:R(r[3]+""+r[3]),a:T(r[4]+""+r[4]),format:e?"name":"hex8"};if(r=N.hex3.exec(t))return{r:R(r[1]+""+r[1]),g:R(r[2]+""+r[2]),b:R(r[3]+""+r[3]),format:e?"name":"hex"};return!1}(t));"object"==e(t)&&(j(t.r)&&j(t.g)&&j(t.b)?(l=t.r,c=t.g,d=t.b,r={r:255*S(l,255),g:255*S(c,255),b:255*S(d,255)},h=!0,f="%"===String(t.r).substr(-1)?"prgb":"rgb"):j(t.h)&&j(t.s)&&j(t.v)?(o=F(t.s),s=F(t.v),r=function(t,r,e){t=6*S(t,360),r=S(r,100),e=S(e,100);var n=Math.floor(t),a=t-n,i=e*(1-r),o=e*(1-a*r),s=e*(1-(1-a)*r),u=n%6,h=[e,o,i,i,s,e][u],f=[s,e,e,o,i,i][u],l=[i,i,s,e,e,o][u];return{r:255*h,g:255*f,b:255*l}}(t.h,o,s),h=!0,f="hsv"):j(t.h)&&j(t.s)&&j(t.l)&&(o=F(t.s),u=F(t.l),r=function(t,r,e){var n,a,i;function o(t,r,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(r-t)*e:e<.5?r:e<2/3?t+(r-t)*(2/3-e)*6:t}if(t=S(t,360),r=S(r,100),e=S(e,100),0===r)n=a=i=e;else{var s=e<.5?e*(1+r):e+r-e*r,u=2*e-s;n=o(u,s,t+1/3),a=o(u,s,t),i=o(u,s,t-1/3)}return{r:255*n,g:255*a,b:255*i}}(t.h,o,u),h=!0,f="hsl"),t.hasOwnProperty("a")&&(i=t.a));var l,c,d;return i=w(i),{ok:h,format:t.format||f,r:Math.min(255,Math.max(r.r,0)),g:Math.min(255,Math.max(r.g,0)),b:Math.min(255,Math.max(r.b,0)),a:i}}(t);this._originalInput=t,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=r.format||o.format,this._gradientType=r.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}function o(t,r,e){t=S(t,255),r=S(r,255),e=S(e,255);var n,a,i=Math.max(t,r,e),o=Math.min(t,r,e),s=(i+o)/2;if(i==o)n=a=0;else{var u=i-o;switch(a=s>.5?u/(2-i-o):u/(i+o),i){case t:n=(r-e)/u+(r>1)+720)%360;--r;)n.h=(n.h+a)%360,o.push(i(n));return o}function x(t,r){r=r||6;for(var e=i(t).toHsv(),n=e.h,a=e.s,o=e.v,s=[],u=1/r;r--;)s.push(i({h:n,s:a,v:o})),o=(o+u)%1;return s}i.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,e,n=this.toRgb();return t=n.r/255,r=n.g/255,e=n.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))},setAlpha:function(t){return this._a=w(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.v);return 1==this._a?"hsv("+r+", "+e+"%, "+n+"%)":"hsva("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.l);return 1==this._a?"hsl("+r+", "+e+"%, "+n+"%)":"hsla("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,r,e,n,a){var i=[H(Math.round(t).toString(16)),H(Math.round(r).toString(16)),H(Math.round(e).toString(16)),H(O(n))];if(a&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1))return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0);return i.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*S(this._r,255))+"%",g:Math.round(100*S(this._g,255))+"%",b:Math.round(100*S(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*S(this._r,255))+"%, "+Math.round(100*S(this._g,255))+"%, "+Math.round(100*S(this._b,255))+"%)":"rgba("+Math.round(100*S(this._r,255))+"%, "+Math.round(100*S(this._g,255))+"%, "+Math.round(100*S(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(k[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var r="#"+h(this._r,this._g,this._b,this._a),e=r,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=i(t);e="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+r+",endColorstr="+e+")"},toString:function(t){var r=!!t;t=t||this._format;var e=!1,n=this._a<1&&this._a>=0;return r||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(e=this.toRgbString()),"prgb"===t&&(e=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(e=this.toHexString()),"hex3"===t&&(e=this.toHexString(!0)),"hex4"===t&&(e=this.toHex8String(!0)),"hex8"===t&&(e=this.toHex8String()),"name"===t&&(e=this.toName()),"hsl"===t&&(e=this.toHslString()),"hsv"===t&&(e=this.toHsvString()),e||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return i(this.toString())},_applyModification:function(t,r){var e=t.apply(null,[this].concat([].slice.call(r)));return this._r=e._r,this._g=e._g,this._b=e._b,this.setAlpha(e._a),this},lighten:function(){return this._applyModification(d,arguments)},brighten:function(){return this._applyModification(g,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(l,arguments)},greyscale:function(){return this._applyModification(c,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(p,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(y,arguments)},triad:function(){return this._applyCombination(v,[3])},tetrad:function(){return this._applyCombination(v,[4])}},i.fromRatio=function(t,r){if("object"==e(t)){var n={};for(var a in t)t.hasOwnProperty(a)&&(n[a]="a"===a?t[a]:F(t[a]));t=n}return i(t,r)},i.equals=function(t,r){return!(!t||!r)&&i(t).toRgbString()==i(r).toRgbString()},i.random=function(){return i.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},i.mix=function(t,r,e){e=0===e?0:e||50;var n=i(t).toRgb(),a=i(r).toRgb(),o=e/100;return i({r:(a.r-n.r)*o+n.r,g:(a.g-n.g)*o+n.g,b:(a.b-n.b)*o+n.b,a:(a.a-n.a)*o+n.a})},i.readability=function(t,r){var e=i(t),n=i(r);return(Math.max(e.getLuminance(),n.getLuminance())+.05)/(Math.min(e.getLuminance(),n.getLuminance())+.05)},i.isReadable=function(t,r,e){var n,a,o=i.readability(t,r);switch(a=!1,(n=function(t){var r,e;r=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),e=(t.size||"small").toLowerCase(),"AA"!==r&&"AAA"!==r&&(r="AA");"small"!==e&&"large"!==e&&(e="small");return{level:r,size:e}}(e)).level+n.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},i.mostReadable=function(t,r,e){var n,a,o,s,u=null,h=0;a=(e=e||{}).includeFallbackColors,o=e.level,s=e.size;for(var f=0;fh&&(h=n,u=i(r[f]));return i.isReadable(t,u,{level:o,size:s})||!a?u:(e.includeFallbackColors=!1,i.mostReadable(t,["#fff","#000"],e))};var A=i.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},k=i.hexNames=function(t){var r={};for(var e in t)t.hasOwnProperty(e)&&(r[t[e]]=e);return r}(A);function w(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function S(t,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var e=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(r,Math.max(0,parseFloat(t))),e&&(t=parseInt(t*r,10)/100),Math.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function C(t){return Math.min(1,Math.max(0,t))}function R(t){return parseInt(t,16)}function H(t){return 1==t.length?"0"+t:""+t}function F(t){return t<=1&&(t=100*t+"%"),t}function O(t){return Math.round(255*parseFloat(t)).toString(16)}function T(t){return R(t)/255}var E,$,L,N=($="[\\s|\\(]+("+(E="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+E+")[,|\\s]+("+E+")\\s*\\)?",L="[\\s|\\(]+("+E+")[,|\\s]+("+E+")[,|\\s]+("+E+")[,|\\s]+("+E+")\\s*\\)?",{CSS_UNIT:new RegExp(E),rgb:new RegExp("rgb"+$),rgba:new RegExp("rgba"+L),hsl:new RegExp("hsl"+$),hsla:new RegExp("hsla"+L),hsv:new RegExp("hsv"+$),hsva:new RegExp("hsva"+L),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function j(t){return!!N.CSS_UNIT.exec(t)}const q=Statamic.$bard.tiptap.core.Mark.create({name:"textColor",addAttributes:function(){return{color:{default:null,parseHTML:function(t){var r;return null===(r=t.style.color)||void 0===r?void 0:r.replace(/['"]+/g,"")}}}},renderHTML:function(t){var r,e,n=t.HTMLAttributes,a="color: ".concat(n.color,";");return r=n.color,(e=i(r)).isValid()&&(e.getBrightness()>175||e.getAlpha()<.25)&&(a+="text-shadow: 0 0 3px rgba(0, 0, 0, .8);"),["span",{style:a},0]},addCommands:function(){var t=this;return{setColor:function(r){return function(e){var n=e.chain;return r.color?n().setMark(t.name,r).run():n().unsetMark(t.name,{extendEmptyMarkRange:!0}).run()}}}}});Statamic.booting((function(){Statamic.$bard.addExtension((function(){return q})),Statamic.$bard.buttons((function(t,e){var n=_.findIndex(t,(function(t){return"color"===t}));t.splice(n+1,0,e({name:"color",text:__("bard-color-picker::general.text_color"),html:'',command:function(t){return t.commands.setColor()},component:r}))}))}))}},e={};function n(t){var a=e[t];if(void 0!==a)return a.exports;var i=e[t]={exports:{}};return r[t](i,i.exports,n),i.exports}n.m=r,t=[],n.O=(r,e,a,i)=>{if(!e){var o=1/0;for(f=0;f=i)&&Object.keys(n.O).every((t=>n.O[t](e[u])))?e.splice(u--,1):(s=!1,i0&&t[f-1][2]>i;f--)t[f]=t[f-1];t[f]=[e,a,i]},n.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),(()=>{var t={59:0,836:0};n.O.j=r=>0===t[r];var r=(r,e)=>{var a,i,[o,s,u]=e,h=0;if(o.some((r=>0!==t[r]))){for(a in s)n.o(s,a)&&(n.m[a]=s[a]);if(u)var f=u(n)}for(r&&r(e);hn(46)));var a=n.O(void 0,[836],(()=>n(247)));a=n.O(a)})(); \ No newline at end of file diff --git a/dist/js/bard-color-picker.js b/dist/js/bard-color-picker.js deleted file mode 100644 index ec8c341..0000000 --- a/dist/js/bard-color-picker.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var t,e={931:t=>{var e;self,e=()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.d(e,{default:()=>S});var n={};function r(t,e,n,r,o={}){e instanceof HTMLCollection||e instanceof NodeList?e=Array.from(e):Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]);for(const i of e)for(const e of n)i[t](e,r,{capture:!1,...o});return Array.prototype.slice.call(arguments,1)}t.r(n),t.d(n,{adjustableInputNumbers:()=>h,createElementFromString:()=>a,createFromTemplate:()=>s,eventPath:()=>l,off:()=>i,on:()=>o,resolveElement:()=>c});const o=r.bind(null,"addEventListener"),i=r.bind(null,"removeEventListener");function a(t){const e=document.createElement("div");return e.innerHTML=t.trim(),e.firstElementChild}function s(t){const e=(t,e)=>{const n=t.getAttribute(e);return t.removeAttribute(e),n},n=(t,r={})=>{const o=e(t,":obj"),i=e(t,":ref"),a=o?r[o]={}:r;i&&(r[i]=t);for(const r of Array.from(t.children)){const t=e(r,":arr"),o=n(r,t?{}:a);t&&(a[t]||(a[t]=[])).push(Object.keys(o).length?o:r)}return r};return n(a(t))}function l(t){let e=t.path||t.composedPath&&t.composedPath();if(e)return e;let n=t.target.parentElement;for(e=[t.target,n];n=n.parentElement;)e.push(n);return e.push(document,window),e}function c(t){return t instanceof Element?t:"string"==typeof t?t.split(/>>/g).reduce(((t,e,n,r)=>(t=t.querySelector(e),nt)){function n(n){const r=[.001,.01,.1][Number(n.shiftKey||2*n.ctrlKey)]*(n.deltaY<0?1:-1);let o=0,i=t.selectionStart;t.value=t.value.replace(/[\d.]+/g,((t,n)=>n<=i&&n+t.length>=i?(i=n,e(Number(t),r,o)):(o++,t))),t.focus(),t.setSelectionRange(i,i),n.preventDefault(),t.dispatchEvent(new Event("input"))}o(t,"focus",(()=>o(window,"wheel",n,{passive:!1}))),o(t,"blur",(()=>i(window,"wheel",n)))}const{min:u,max:p,floor:d,round:f}=Math;function g(t,e,n){e/=100,n/=100;const r=d(t=t/360*6),o=t-r,i=n*(1-e),a=n*(1-o*e),s=n*(1-(1-o)*e),l=r%6;return[255*[n,a,i,i,s,n][l],255*[s,n,n,a,i,i][l],255*[i,i,s,n,n,a][l]]}function b(t,e,n){const r=(2-(e/=100))*(n/=100)/2;return 0!==r&&(e=1===r?0:r<.5?e*n/(2*r):e*n/(2-2*r)),[t,100*e,100*r]}function m(t,e,n){const r=u(t/=255,e/=255,n/=255),o=p(t,e,n),i=o-r;let a,s;if(0===i)a=s=0;else{s=i/o;const r=((o-t)/6+i/2)/i,l=((o-e)/6+i/2)/i,c=((o-n)/6+i/2)/i;t===o?a=c-l:e===o?a=1/3+r-c:n===o&&(a=2/3+l-r),a<0?a+=1:a>1&&(a-=1)}return[360*a,100*s,100*o]}function v(t,e,n,r){return e/=100,n/=100,[...m(255*(1-u(1,(t/=100)*(1-(r/=100))+r)),255*(1-u(1,e*(1-r)+r)),255*(1-u(1,n*(1-r)+r)))]}function _(t,e,n){e/=100;const r=2*(e*=(n/=100)<.5?n:1-n)/(n+e)*100,o=100*(n+e);return[t,isNaN(r)?0:r,o]}function y(t){return m(...t.match(/.{2}/g).map((t=>parseInt(t,16))))}function w(t=0,e=0,n=0,r=1){const o=(t,e)=>(n=-1)=>e(~n?t.map((t=>Number(t.toFixed(n)))):t),i={h:t,s:e,v:n,a:r,toHSVA(){const t=[i.h,i.s,i.v,i.a];return t.toString=o(t,(t=>`hsva(${t[0]}, ${t[1]}%, ${t[2]}%, ${i.a})`)),t},toHSLA(){const t=[...b(i.h,i.s,i.v),i.a];return t.toString=o(t,(t=>`hsla(${t[0]}, ${t[1]}%, ${t[2]}%, ${i.a})`)),t},toRGBA(){const t=[...g(i.h,i.s,i.v),i.a];return t.toString=o(t,(t=>`rgba(${t[0]}, ${t[1]}, ${t[2]}, ${i.a})`)),t},toCMYK(){const t=function(t,e,n){const r=g(t,e,n),o=r[0]/255,i=r[1]/255,a=r[2]/255,s=u(1-o,1-i,1-a);return[100*(1===s?0:(1-o-s)/(1-s)),100*(1===s?0:(1-i-s)/(1-s)),100*(1===s?0:(1-a-s)/(1-s)),100*s]}(i.h,i.s,i.v);return t.toString=o(t,(t=>`cmyk(${t[0]}%, ${t[1]}%, ${t[2]}%, ${t[3]}%)`)),t},toHEXA(){const t=function(t,e,n){return g(t,e,n).map((t=>f(t).toString(16).padStart(2,"0")))}(i.h,i.s,i.v),e=i.a>=1?"":Number((255*i.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return e&&t.push(e),t.toString=()=>`#${t.join("").toUpperCase()}`,t},clone:()=>w(i.h,i.s,i.v,i.a)};return i}const A=t=>Math.max(Math.min(t,1),0);function k(t){const e={options:Object.assign({lock:null,onchange:()=>0,onstop:()=>0},t),_keyboard(t){const{options:n}=e,{type:r,key:o}=t;if(document.activeElement===n.wrapper){const{lock:n}=e.options,i="ArrowUp"===o,a="ArrowRight"===o,s="ArrowDown"===o,l="ArrowLeft"===o;if("keydown"===r&&(i||a||s||l)){let r=0,o=0;"v"===n?r=i||a?1:-1:"h"===n?r=i||a?-1:1:(o=i?-1:s?1:0,r=l?-1:a?1:0),e.update(A(e.cache.x+.01*r),A(e.cache.y+.01*o)),t.preventDefault()}else o.startsWith("Arrow")&&(e.options.onstop(),t.preventDefault())}},_tapstart(t){o(document,["mouseup","touchend","touchcancel"],e._tapstop),o(document,["mousemove","touchmove"],e._tapmove),t.cancelable&&t.preventDefault(),e._tapmove(t)},_tapmove(t){const{options:n,cache:r}=e,{lock:o,element:i,wrapper:a}=n,s=a.getBoundingClientRect();let l=0,c=0;if(t){const e=t&&t.touches&&t.touches[0];l=t?(e||t).clientX:0,c=t?(e||t).clientY:0,ls.left+s.width&&(l=s.left+s.width),cs.top+s.height&&(c=s.top+s.height),l-=s.left,c-=s.top}else r&&(l=r.x*s.width,c=r.y*s.height);"h"!==o&&(i.style.left=`calc(${l/s.width*100}% - ${i.offsetWidth/2}px)`),"v"!==o&&(i.style.top=`calc(${c/s.height*100}% - ${i.offsetHeight/2}px)`),e.cache={x:l/s.width,y:c/s.height};const h=A(l/s.width),u=A(c/s.height);switch(o){case"v":return n.onchange(h);case"h":return n.onchange(u);default:return n.onchange(h,u)}},_tapstop(){e.options.onstop(),i(document,["mouseup","touchend","touchcancel"],e._tapstop),i(document,["mousemove","touchmove"],e._tapmove)},trigger(){e._tapmove()},update(t=0,n=0){const{left:r,top:o,width:i,height:a}=e.options.wrapper.getBoundingClientRect();"h"===e.options.lock&&(n=t),e._tapmove({clientX:r+i*t,clientY:o+a*n})},destroy(){const{options:t,_tapstart:n,_keyboard:r}=e;i(document,["keydown","keyup"],r),i([t.wrapper,t.element],"mousedown",n),i([t.wrapper,t.element],"touchstart",n,{passive:!1})}},{options:n,_tapstart:r,_keyboard:a}=e;return o([n.wrapper,n.element],"mousedown",r),o([n.wrapper,n.element],"touchstart",r,{passive:!1}),o(document,["keydown","keyup"],a),e}function x(t={}){t=Object.assign({onchange:()=>0,className:"",elements:[]},t);const e=o(t.elements,"click",(e=>{t.elements.forEach((n=>n.classList[e.target===n?"add":"remove"](t.className))),t.onchange(e),e.stopPropagation()}));return{destroy:()=>i(...e)}}const C={variantFlipOrder:{start:"sme",middle:"mse",end:"ems"},positionFlipOrder:{top:"tbrl",right:"rltb",bottom:"btrl",left:"lrbt"},position:"bottom",margin:8,padding:0};class S{static utils=n;static version="1.9.0";static I18N_DEFAULTS={"ui:dialog":"color picker dialog","btn:toggle":"toggle color picker dialog","btn:swatch":"color swatch","btn:last-color":"use previous color","btn:save":"Save","btn:cancel":"Cancel","btn:clear":"Clear","aria:btn:save":"save and close","aria:btn:cancel":"cancel and close","aria:btn:clear":"clear and close","aria:input":"color input field","aria:palette":"color selection area","aria:hue":"hue selection slider","aria:opacity":"selection slider"};static DEFAULT_OPTIONS={appClass:null,theme:"classic",useAsButton:!1,padding:8,disabled:!1,comparison:!0,closeOnScroll:!1,outputPrecision:0,lockOpacity:!1,autoReposition:!0,container:"body",components:{interaction:{}},i18n:{},swatches:null,inline:!1,sliders:null,default:"#42445a",defaultRepresentation:null,position:"bottom-middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"};_initializingActive=!0;_recalc=!0;_nanopop=null;_root=null;_color=w();_lastColor=w();_swatchColors=[];_setupAnimationFrame=null;_eventListener={init:[],save:[],hide:[],show:[],clear:[],change:[],changestop:[],cancel:[],swatchselect:[]};constructor(t){this.options=t=Object.assign({...S.DEFAULT_OPTIONS},t);const{swatches:e,components:n,theme:r,sliders:o,lockOpacity:i,padding:a}=t;["nano","monolith"].includes(r)&&!o&&(t.sliders="h"),n.interaction||(n.interaction={});const{preview:s,opacity:l,hue:c,palette:h}=n;n.opacity=!i&&l,n.palette=h||s||l||c,this._preBuild(),this._buildComponents(),this._bindEvents(),this._finalBuild(),e&&e.length&&e.forEach((t=>this.addSwatch(t)));const{button:u,app:p}=this._root;this._nanopop=((t,e,n)=>{const r="object"!=typeof t||t instanceof HTMLElement?{reference:t,popper:e,...n}:t;return{update(t=r){const{reference:e,popper:n}=Object.assign(r,t);if(!n||!e)throw new Error("Popper- or reference-element missing.");return((t,e,n)=>{const{container:r,arrow:o,margin:i,padding:a,position:s,variantFlipOrder:l,positionFlipOrder:c}={container:document.documentElement.getBoundingClientRect(),...C,...n},{left:h,top:u}=e.style;e.style.left="0",e.style.top="0";const p=t.getBoundingClientRect(),d=e.getBoundingClientRect(),f={t:p.top-d.height-i,b:p.bottom+i,r:p.right+i,l:p.left-d.width-i},g={vs:p.left,vm:p.left+p.width/2-d.width/2,ve:p.left+p.width-d.width,hs:p.top,hm:p.bottom-p.height/2-d.height/2,he:p.bottom-d.height},[b,m="middle"]=s.split("-"),v=c[b],_=l[m],{top:y,left:w,bottom:A,right:k}=r;for(const t of v){const n="t"===t||"b"===t;let r=f[t];const[i,s]=n?["top","left"]:["left","top"],[l,c]=n?[d.height,d.width]:[d.width,d.height],[h,u]=n?[A,k]:[k,A],[b,m]=n?[y,w]:[w,y];if(!(rh))for(const h of _){let f=g[(n?"v":"h")+h];if(!(fu)){if(f-=d[s],r-=d[i],e.style[s]=`${f}px`,e.style[i]=`${r}px`,o){const t=n?p.width/2:p.height/2,e=2*tnew S(t);_preBuild(){const{options:t}=this;for(const e of["el","container"])t[e]=c(t[e]);this._root=(t=>{const{components:e,useAsButton:n,inline:r,appClass:o,theme:i,lockOpacity:a}=t.options,l=t=>t?"":'style="display:none" hidden',c=e=>t._t(e),h=s(`\n
\n\n ${n?"":''}\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n \n
\n
\n
\n `),u=h.interaction;return u.options.find((t=>!t.hidden&&!t.classList.add("active"))),u.type=()=>u.options.find((t=>t.classList.contains("active"))),h})(this),t.useAsButton&&(this._root.button=t.el),t.container.appendChild(this._root.root)}_finalBuild(){const t=this.options,e=this._root;if(t.container.removeChild(e.root),t.inline){const n=t.el.parentElement;t.el.nextSibling?n.insertBefore(e.app,t.el.nextSibling):n.appendChild(e.app)}else t.container.appendChild(e.app);t.useAsButton?t.inline&&t.el.remove():t.el.parentNode.replaceChild(e.root,t.el),t.disabled&&this.disable(),t.comparison||(e.button.style.transition="none",t.useAsButton||(e.preview.lastColor.style.transition="none")),this.hide()}_buildComponents(){const t=this,e=this.options.components,n=(t.options.sliders||"v").repeat(2),[r,o]=n.match(/^[vh]+$/g)?n:[],i=()=>this._color||(this._color=this._lastColor.clone()),a={palette:k({element:t._root.palette.picker,wrapper:t._root.palette.palette,onstop:()=>t._emit("changestop","slider",t),onchange(n,r){if(!e.palette)return;const o=i(),{_root:a,options:s}=t,{lastColor:l,currentColor:c}=a.preview;t._recalc&&(o.s=100*n,o.v=100-100*r,o.v<0&&(o.v=0),t._updateOutput("slider"));const h=o.toRGBA().toString(0);this.element.style.background=h,this.wrapper.style.background=`\n linear-gradient(to top, rgba(0, 0, 0, ${o.a}), transparent),\n linear-gradient(to left, hsla(${o.h}, 100%, 50%, ${o.a}), rgba(255, 255, 255, ${o.a}))\n `,s.comparison?s.useAsButton||t._lastColor||l.style.setProperty("--pcr-color",h):(a.button.style.setProperty("--pcr-color",h),a.button.classList.remove("clear"));const u=o.toHEXA().toString();for(const{el:e,color:n}of t._swatchColors)e.classList[u===n.toHEXA().toString()?"add":"remove"]("pcr-active");c.style.setProperty("--pcr-color",h)}}),hue:k({lock:"v"===o?"h":"v",element:t._root.hue.picker,wrapper:t._root.hue.slider,onstop:()=>t._emit("changestop","slider",t),onchange(n){if(!e.hue||!e.palette)return;const r=i();t._recalc&&(r.h=360*n),this.element.style.backgroundColor=`hsl(${r.h}, 100%, 50%)`,a.palette.trigger()}}),opacity:k({lock:"v"===r?"h":"v",element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onstop:()=>t._emit("changestop","slider",t),onchange(n){if(!e.opacity||!e.palette)return;const r=i();t._recalc&&(r.a=Math.round(100*n)/100),this.element.style.background=`rgba(0, 0, 0, ${r.a})`,a.palette.trigger()}}),selectable:x({elements:t._root.interaction.options,className:"active",onchange(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._recalc&&t._updateOutput("swatch")}})};this._components=a}_bindEvents(){const{_root:t,options:e}=this,n=[o(t.interaction.clear,"click",(()=>this._clearColor())),o([t.interaction.cancel,t.preview.lastColor],"click",(()=>{this.setHSVA(...(this._lastColor||this._color).toHSVA(),!0),this._emit("cancel")})),o(t.interaction.save,"click",(()=>{!this.applyColor()&&!e.showAlways&&this.hide()})),o(t.interaction.result,["keyup","input"],(t=>{this.setColor(t.target.value,!0)&&!this._initializingActive&&(this._emit("change",this._color,"input",this),this._emit("changestop","input",this)),t.stopImmediatePropagation()})),o(t.interaction.result,["focus","blur"],(t=>{this._recalc="blur"===t.type,this._recalc&&this._updateOutput(null)})),o([t.palette.palette,t.palette.picker,t.hue.slider,t.hue.picker,t.opacity.slider,t.opacity.picker],["mousedown","touchstart"],(()=>this._recalc=!0),{passive:!0})];if(!e.showAlways){const r=e.closeWithKey;n.push(o(t.button,"click",(()=>this.isOpen()?this.hide():this.show())),o(document,"keyup",(t=>this.isOpen()&&(t.key===r||t.code===r)&&this.hide())),o(document,["touchstart","mousedown"],(e=>{this.isOpen()&&!l(e).some((e=>e===t.app||e===t.button))&&this.hide()}),{capture:!0}))}if(e.adjustableNumbers){const e={rgba:[255,255,255,1],hsva:[360,100,100,1],hsla:[360,100,100,1],cmyk:[100,100,100,100]};h(t.interaction.result,((t,n,r)=>{const o=e[this.getColorRepresentation().toLowerCase()];if(o){const e=o[r],i=t+(e>=100?1e3*n:n);return i<=0?0:Number((i{r.isOpen()&&(e.closeOnScroll&&r.hide(),null===t?(t=setTimeout((()=>t=null),100),requestAnimationFrame((function e(){r._rePositioningPicker(),null!==t&&requestAnimationFrame(e)}))):(clearTimeout(t),t=setTimeout((()=>t=null),100)))}),{capture:!0}))}this._eventBindings=n}_rePositioningPicker(){const{options:t}=this;if(!t.inline&&!this._nanopop.update({container:document.body.getBoundingClientRect(),position:t.position})){const t=this._root.app,e=t.getBoundingClientRect();t.style.top=(window.innerHeight-e.height)/2+"px",t.style.left=(window.innerWidth-e.width)/2+"px"}}_updateOutput(t){const{_root:e,_color:n,options:r}=this;if(e.interaction.type()){const t=`to${e.interaction.type().getAttribute("data-type")}`;e.interaction.result.value="function"==typeof n[t]?n[t]().toString(r.outputPrecision):""}!this._initializingActive&&this._recalc&&this._emit("change",n,t,this)}_clearColor(t=!1){const{_root:e,options:n}=this;n.useAsButton||e.button.style.setProperty("--pcr-color","rgba(0, 0, 0, 0.15)"),e.button.classList.add("clear"),n.showAlways||this.hide(),this._lastColor=null,this._initializingActive||t||(this._emit("save",null),this._emit("clear"))}_parseLocalColor(t){const{values:e,type:n,a:r}=function(t){t=t.match(/^[a-zA-Z]+$/)?function(t){if("black"===t.toLowerCase())return"#000";const e=document.createElement("canvas").getContext("2d");return e.fillStyle=t,"#000"===e.fillStyle?null:e.fillStyle}(t):t;const e={cmyk:/^cmyk\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)/i,rgba:/^rgba?\D+([\d.]+)(%?)\D+([\d.]+)(%?)\D+([\d.]+)(%?)\D*?(([\d.]+)(%?)|$)/i,hsla:/^hsla?\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)\D*?(([\d.]+)(%?)|$)/i,hsva:/^hsva?\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)\D*?(([\d.]+)(%?)|$)/i,hexa:/^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i},n=t=>t.map((t=>/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0));let r;t:for(const o in e)if(r=e[o].exec(t))switch(o){case"cmyk":{const[,t,e,i,a]=n(r);if(t>100||e>100||i>100||a>100)break t;return{values:v(t,e,i,a),type:o}}case"rgba":{let[,t,,e,,i,,,a]=n(r);if(t="%"===r[2]?t/100*255:t,e="%"===r[4]?e/100*255:e,i="%"===r[6]?i/100*255:i,a="%"===r[9]?a/100:a,t>255||e>255||i>255||a<0||a>1)break t;return{values:[...m(t,e,i),a],a,type:o}}case"hexa":{let[,t]=r;4!==t.length&&3!==t.length||(t=t.split("").map((t=>t+t)).join(""));const e=t.substring(0,6);let n=t.substring(6);return n=n?parseInt(n,16)/255:void 0,{values:[...y(e),n],a:n,type:o}}case"hsla":{let[,t,e,i,,a]=n(r);if(a="%"===r[6]?a/100:a,t>360||e>100||i>100||a<0||a>1)break t;return{values:[..._(t,e,i),a],a,type:o}}case"hsva":{let[,t,e,i,,a]=n(r);if(a="%"===r[6]?a/100:a,t>360||e>100||i>100||a<0||a>1)break t;return{values:[t,e,i,a],a,type:o}}}return{values:null,type:null}}(t),{lockOpacity:o}=this.options,i=void 0!==r&&1!==r;return e&&3===e.length&&(e[3]=void 0),{values:!e||o&&i?null:e,type:n}}_t(t){return this.options.i18n[t]||S.I18N_DEFAULTS[t]}_emit(t,...e){this._eventListener[t].forEach((t=>t(...e,this)))}on(t,e){return this._eventListener[t].push(e),this}off(t,e){const n=this._eventListener[t]||[],r=n.indexOf(e);return~r&&n.splice(r,1),this}addSwatch(t){const{values:e}=this._parseLocalColor(t);if(e){const{_swatchColors:t,_root:n}=this,r=w(...e),i=a(` @@ -33,14 +33,15 @@
@@ -48,7 +49,7 @@ @@ -32,7 +32,7 @@ @click="() => customColorFromSwatch(swatch)" :style="{ 'background-color': swatch }" > - + From 0b81e9c3cee94843f8a0b23b108fd66ba4f664b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Heidk=C3=A4mper?= Date: Sat, 8 Jun 2024 15:01:06 +0000 Subject: [PATCH 15/17] update default config --- config/bard-color-picker.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/bard-color-picker.php b/config/bard-color-picker.php index b3c5caf..b376ca1 100644 --- a/config/bard-color-picker.php +++ b/config/bard-color-picker.php @@ -7,7 +7,8 @@ | Color Swatches |-------------------------------------------------------------------------- | - | .. + | Specify an array with predefined colors (swatches). + | The colors should be in HEX format. | */ @@ -21,7 +22,8 @@ | Allow any Color |-------------------------------------------------------------------------- | - | .. + | Set this to false to deactivate the color picker. + | (Swatches only mode) | */ From 3d8038e7f32bc7d316b09c5ec914aedf4ea8b059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Heidk=C3=A4mper?= Date: Sat, 8 Jun 2024 15:20:06 +0000 Subject: [PATCH 16/17] update readme --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 579d789..bd1e7ce 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,23 @@ php artisan vendor:publish --tag=bard-color-picker-config Have a look at the [configuration file](config/bard-color-picker.php) for details. +## Migrate from 1.x + +Instead of the @simonwep/pickr package, this addon uses a native HTML color picker since v2.0. This causes some breaking changes. + +- Statamic 5 is required +- Colors are always saved in HEX format +- The [configuration file](config/bard-color-picker.php) has changed completely + +After updating from v1.x to v2.0 we recommend to republish the addon configuration, overwrite old settings and define new ones: + +``` bash +php artisan vendor:publish --tag=bard-color-picker-config --force +``` + +Alternatively, you could rename the `recommended` item to `swatches` in your configuration. + + ## About us We develop digital solutions for all kinds of disciplines. From the idea and concepts to implementation and operation. From fdb89f8131db920f22f33a5700913df6ea806d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20M=C3=BCsker?= Date: Mon, 10 Jun 2024 06:34:27 +0000 Subject: [PATCH 17/17] fixed the button color style --- dist/js/addon.js | 2 +- resources/js/components/ColorPanel.vue | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dist/js/addon.js b/dist/js/addon.js index c7482b1..b0f94ec 100644 --- a/dist/js/addon.js +++ b/dist/js/addon.js @@ -1 +1 @@ -(()=>{"use strict";var t,r={247:()=>{},723:()=>{function t(r){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(r)}var r=/^\s+/,e=/\s+$/;function n(o,a){if(a=a||{},(o=o||"")instanceof n)return o;if(!(this instanceof n))return new n(o,a);var i=function(n){var o={r:0,g:0,b:0},a=1,i=null,s=null,l=null,u=!1,c=!1;"string"==typeof n&&(n=function(t){t=t.replace(r,"").replace(e,"").toLowerCase();var n,o=!1;if(x[t])t=x[t],o=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(n=F.rgb.exec(t))return{r:n[1],g:n[2],b:n[3]};if(n=F.rgba.exec(t))return{r:n[1],g:n[2],b:n[3],a:n[4]};if(n=F.hsl.exec(t))return{h:n[1],s:n[2],l:n[3]};if(n=F.hsla.exec(t))return{h:n[1],s:n[2],l:n[3],a:n[4]};if(n=F.hsv.exec(t))return{h:n[1],s:n[2],v:n[3]};if(n=F.hsva.exec(t))return{h:n[1],s:n[2],v:n[3],a:n[4]};if(n=F.hex8.exec(t))return{r:S(n[1]),g:S(n[2]),b:S(n[3]),a:j(n[4]),format:o?"name":"hex8"};if(n=F.hex6.exec(t))return{r:S(n[1]),g:S(n[2]),b:S(n[3]),format:o?"name":"hex"};if(n=F.hex4.exec(t))return{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),a:j(n[4]+""+n[4]),format:o?"name":"hex8"};if(n=F.hex3.exec(t))return{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),format:o?"name":"hex"};return!1}(n));"object"==t(n)&&(T(n.r)&&T(n.g)&&T(n.b)?(f=n.r,h=n.g,d=n.b,o={r:255*w(f,255),g:255*w(h,255),b:255*w(d,255)},u=!0,c="%"===String(n.r).substr(-1)?"prgb":"rgb"):T(n.h)&&T(n.s)&&T(n.v)?(i=O(n.s),s=O(n.v),o=function(t,r,e){t=6*w(t,360),r=w(r,100),e=w(e,100);var n=Math.floor(t),o=t-n,a=e*(1-r),i=e*(1-o*r),s=e*(1-(1-o)*r),l=n%6,u=[e,i,a,a,s,e][l],c=[s,e,e,i,a,a][l],f=[a,a,s,e,e,i][l];return{r:255*u,g:255*c,b:255*f}}(n.h,i,s),u=!0,c="hsv"):T(n.h)&&T(n.s)&&T(n.l)&&(i=O(n.s),l=O(n.l),o=function(t,r,e){var n,o,a;function i(t,r,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(r-t)*e:e<.5?r:e<2/3?t+(r-t)*(2/3-e)*6:t}if(t=w(t,360),r=w(r,100),e=w(e,100),0===r)n=o=a=e;else{var s=e<.5?e*(1+r):e+r-e*r,l=2*e-s;n=i(l,s,t+1/3),o=i(l,s,t),a=i(l,s,t-1/3)}return{r:255*n,g:255*o,b:255*a}}(n.h,i,l),u=!0,c="hsl"),n.hasOwnProperty("a")&&(a=n.a));var f,h,d;return a=M(a),{ok:u,format:n.format||c,r:Math.min(255,Math.max(o.r,0)),g:Math.min(255,Math.max(o.g,0)),b:Math.min(255,Math.max(o.b,0)),a}}(o);this._originalInput=o,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=a.format||i.format,this._gradientType=a.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}function o(t,r,e){t=w(t,255),r=w(r,255),e=w(e,255);var n,o,a=Math.max(t,r,e),i=Math.min(t,r,e),s=(a+i)/2;if(a==i)n=o=0;else{var l=a-i;switch(o=s>.5?l/(2-a-i):l/(a+i),a){case t:n=(r-e)/l+(r>1)+720)%360;--r;)o.h=(o.h+a)%360,i.push(n(o));return i}function y(t,r){r=r||6;for(var e=n(t).toHsv(),o=e.h,a=e.s,i=e.v,s=[],l=1/r;r--;)s.push(n({h:o,s:a,v:i})),i=(i+l)%1;return s}n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,e,n=this.toRgb();return t=n.r/255,r=n.g/255,e=n.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))},setAlpha:function(t){return this._a=M(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=a(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=a(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.v);return 1==this._a?"hsv("+r+", "+e+"%, "+n+"%)":"hsva("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.l);return 1==this._a?"hsl("+r+", "+e+"%, "+n+"%)":"hsla("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return i(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,r,e,n,o){var a=[A(Math.round(t).toString(16)),A(Math.round(r).toString(16)),A(Math.round(e).toString(16)),A(P(n))];if(o&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1))return a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0);return a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*w(this._r,255))+"%",g:Math.round(100*w(this._g,255))+"%",b:Math.round(100*w(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*w(this._r,255))+"%, "+Math.round(100*w(this._g,255))+"%, "+Math.round(100*w(this._b,255))+"%)":"rgba("+Math.round(100*w(this._r,255))+"%, "+Math.round(100*w(this._g,255))+"%, "+Math.round(100*w(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(C[i(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var r="#"+s(this._r,this._g,this._b,this._a),e=r,o=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);e="#"+s(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+r+",endColorstr="+e+")"},toString:function(t){var r=!!t;t=t||this._format;var e=!1,n=this._a<1&&this._a>=0;return r||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(e=this.toRgbString()),"prgb"===t&&(e=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(e=this.toHexString()),"hex3"===t&&(e=this.toHexString(!0)),"hex4"===t&&(e=this.toHex8String(!0)),"hex8"===t&&(e=this.toHex8String()),"name"===t&&(e=this.toName()),"hsl"===t&&(e=this.toHslString()),"hsv"===t&&(e=this.toHsvString()),e||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return n(this.toString())},_applyModification:function(t,r){var e=t.apply(null,[this].concat([].slice.call(r)));return this._r=e._r,this._g=e._g,this._b=e._b,this.setAlpha(e._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(h,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(u,arguments)},greyscale:function(){return this._applyModification(c,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(v,arguments)},complement:function(){return this._applyCombination(g,arguments)},monochromatic:function(){return this._applyCombination(y,arguments)},splitcomplement:function(){return this._applyCombination(m,arguments)},triad:function(){return this._applyCombination(p,[3])},tetrad:function(){return this._applyCombination(p,[4])}},n.fromRatio=function(r,e){if("object"==t(r)){var o={};for(var a in r)r.hasOwnProperty(a)&&(o[a]="a"===a?r[a]:O(r[a]));r=o}return n(r,e)},n.equals=function(t,r){return!(!t||!r)&&n(t).toRgbString()==n(r).toRgbString()},n.random=function(){return n.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},n.mix=function(t,r,e){e=0===e?0:e||50;var o=n(t).toRgb(),a=n(r).toRgb(),i=e/100;return n({r:(a.r-o.r)*i+o.r,g:(a.g-o.g)*i+o.g,b:(a.b-o.b)*i+o.b,a:(a.a-o.a)*i+o.a})},n.readability=function(t,r){var e=n(t),o=n(r);return(Math.max(e.getLuminance(),o.getLuminance())+.05)/(Math.min(e.getLuminance(),o.getLuminance())+.05)},n.isReadable=function(t,r,e){var o,a,i=n.readability(t,r);switch(a=!1,(o=function(t){var r,e;r=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),e=(t.size||"small").toLowerCase(),"AA"!==r&&"AAA"!==r&&(r="AA");"small"!==e&&"large"!==e&&(e="small");return{level:r,size:e}}(e)).level+o.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},n.mostReadable=function(t,r,e){var o,a,i,s,l=null,u=0;a=(e=e||{}).includeFallbackColors,i=e.level,s=e.size;for(var c=0;cu&&(u=o,l=n(r[c]));return n.isReadable(t,l,{level:i,size:s})||!a?l:(e.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],e))};var x=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},C=n.hexNames=function(t){var r={};for(var e in t)t.hasOwnProperty(e)&&(r[t[e]]=e);return r}(x);function M(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function w(t,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var e=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(r,Math.max(0,parseFloat(t))),e&&(t=parseInt(t*r,10)/100),Math.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function k(t){return Math.min(1,Math.max(0,t))}function S(t){return parseInt(t,16)}function A(t){return 1==t.length?"0"+t:""+t}function O(t){return t<=1&&(t=100*t+"%"),t}function P(t){return Math.round(255*parseFloat(t)).toString(16)}function j(t){return S(t)/255}var R,L,H,F=(L="[\\s|\\(]+("+(R="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",H="[\\s|\\(]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",{CSS_UNIT:new RegExp(R),rgb:new RegExp("rgb"+L),rgba:new RegExp("rgba"+H),hsl:new RegExp("hsl"+L),hsla:new RegExp("hsla"+H),hsv:new RegExp("hsv"+L),hsva:new RegExp("hsva"+H),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function T(t){return!!F.CSS_UNIT.exec(t)}function E(t){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(t)}function $(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function N(t){for(var r=1;r230||e.getAlpha()<.25}:{isDarkColor:!1,isLightColor:!1}),i=a.isDarkColor,s=a.isLightColor;return["span",V(V({style:"color: ".concat(o.color,";")},i&&{"data-dark-color":!0}),s&&{"data-light-color":!0}),0]},addCommands:function(){var t=this;return{setTextColor:function(r){return function(e){var n=e.chain;return r.color?n().setMark(t.name,r).run():n().unsetMark(t.name,{extendEmptyMarkRange:!0}).run()}}}}});Statamic.booting((function(){Statamic.$bard.addExtension((function(){return Z})),Statamic.$bard.buttons((function(t,r){var e=_.findIndex(t,(function(t){return"color"===t}));t.splice(e+1,0,r({name:"color",text:__("bard-color-picker::general.text_color"),html:'',command:function(t){return t.commands.setColor()},component:I}))}))}))}},e={};function n(t){var o=e[t];if(void 0!==o)return o.exports;var a=e[t]={exports:{}};return r[t](a,a.exports,n),a.exports}n.m=r,t=[],n.O=(r,e,o,a)=>{if(!e){var i=1/0;for(c=0;c=a)&&Object.keys(n.O).every((t=>n.O[t](e[l])))?e.splice(l--,1):(s=!1,a0&&t[c-1][2]>a;c--)t[c]=t[c-1];t[c]=[e,o,a]},n.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),(()=>{var t={59:0,836:0};n.O.j=r=>0===t[r];var r=(r,e)=>{var o,a,[i,s,l]=e,u=0;if(i.some((r=>0!==t[r]))){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);if(l)var c=l(n)}for(r&&r(e);un(723)));var o=n.O(void 0,[836],(()=>n(247)));o=n.O(o)})(); \ No newline at end of file +(()=>{"use strict";var t,r={247:()=>{},702:()=>{function t(r){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(r)}var r=/^\s+/,e=/\s+$/;function n(o,a){if(a=a||{},(o=o||"")instanceof n)return o;if(!(this instanceof n))return new n(o,a);var i=function(n){var o={r:0,g:0,b:0},a=1,i=null,s=null,u=null,l=!1,c=!1;"string"==typeof n&&(n=function(t){t=t.replace(r,"").replace(e,"").toLowerCase();var n,o=!1;if(x[t])t=x[t],o=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(n=F.rgb.exec(t))return{r:n[1],g:n[2],b:n[3]};if(n=F.rgba.exec(t))return{r:n[1],g:n[2],b:n[3],a:n[4]};if(n=F.hsl.exec(t))return{h:n[1],s:n[2],l:n[3]};if(n=F.hsla.exec(t))return{h:n[1],s:n[2],l:n[3],a:n[4]};if(n=F.hsv.exec(t))return{h:n[1],s:n[2],v:n[3]};if(n=F.hsva.exec(t))return{h:n[1],s:n[2],v:n[3],a:n[4]};if(n=F.hex8.exec(t))return{r:S(n[1]),g:S(n[2]),b:S(n[3]),a:j(n[4]),format:o?"name":"hex8"};if(n=F.hex6.exec(t))return{r:S(n[1]),g:S(n[2]),b:S(n[3]),format:o?"name":"hex"};if(n=F.hex4.exec(t))return{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),a:j(n[4]+""+n[4]),format:o?"name":"hex8"};if(n=F.hex3.exec(t))return{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),format:o?"name":"hex"};return!1}(n));"object"==t(n)&&(T(n.r)&&T(n.g)&&T(n.b)?(f=n.r,h=n.g,d=n.b,o={r:255*w(f,255),g:255*w(h,255),b:255*w(d,255)},l=!0,c="%"===String(n.r).substr(-1)?"prgb":"rgb"):T(n.h)&&T(n.s)&&T(n.v)?(i=O(n.s),s=O(n.v),o=function(t,r,e){t=6*w(t,360),r=w(r,100),e=w(e,100);var n=Math.floor(t),o=t-n,a=e*(1-r),i=e*(1-o*r),s=e*(1-(1-o)*r),u=n%6,l=[e,i,a,a,s,e][u],c=[s,e,e,i,a,a][u],f=[a,a,s,e,e,i][u];return{r:255*l,g:255*c,b:255*f}}(n.h,i,s),l=!0,c="hsv"):T(n.h)&&T(n.s)&&T(n.l)&&(i=O(n.s),u=O(n.l),o=function(t,r,e){var n,o,a;function i(t,r,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(r-t)*e:e<.5?r:e<2/3?t+(r-t)*(2/3-e)*6:t}if(t=w(t,360),r=w(r,100),e=w(e,100),0===r)n=o=a=e;else{var s=e<.5?e*(1+r):e+r-e*r,u=2*e-s;n=i(u,s,t+1/3),o=i(u,s,t),a=i(u,s,t-1/3)}return{r:255*n,g:255*o,b:255*a}}(n.h,i,u),l=!0,c="hsl"),n.hasOwnProperty("a")&&(a=n.a));var f,h,d;return a=M(a),{ok:l,format:n.format||c,r:Math.min(255,Math.max(o.r,0)),g:Math.min(255,Math.max(o.g,0)),b:Math.min(255,Math.max(o.b,0)),a}}(o);this._originalInput=o,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=a.format||i.format,this._gradientType=a.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}function o(t,r,e){t=w(t,255),r=w(r,255),e=w(e,255);var n,o,a=Math.max(t,r,e),i=Math.min(t,r,e),s=(a+i)/2;if(a==i)n=o=0;else{var u=a-i;switch(o=s>.5?u/(2-a-i):u/(a+i),a){case t:n=(r-e)/u+(r>1)+720)%360;--r;)o.h=(o.h+a)%360,i.push(n(o));return i}function y(t,r){r=r||6;for(var e=n(t).toHsv(),o=e.h,a=e.s,i=e.v,s=[],u=1/r;r--;)s.push(n({h:o,s:a,v:i})),i=(i+u)%1;return s}n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,e,n=this.toRgb();return t=n.r/255,r=n.g/255,e=n.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))},setAlpha:function(t){return this._a=M(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=a(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=a(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.v);return 1==this._a?"hsv("+r+", "+e+"%, "+n+"%)":"hsva("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.l);return 1==this._a?"hsl("+r+", "+e+"%, "+n+"%)":"hsla("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return i(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,r,e,n,o){var a=[A(Math.round(t).toString(16)),A(Math.round(r).toString(16)),A(Math.round(e).toString(16)),A(P(n))];if(o&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1))return a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0);return a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*w(this._r,255))+"%",g:Math.round(100*w(this._g,255))+"%",b:Math.round(100*w(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*w(this._r,255))+"%, "+Math.round(100*w(this._g,255))+"%, "+Math.round(100*w(this._b,255))+"%)":"rgba("+Math.round(100*w(this._r,255))+"%, "+Math.round(100*w(this._g,255))+"%, "+Math.round(100*w(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(C[i(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var r="#"+s(this._r,this._g,this._b,this._a),e=r,o=this._gradientType?"GradientType = 1, ":"";if(t){var a=n(t);e="#"+s(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+r+",endColorstr="+e+")"},toString:function(t){var r=!!t;t=t||this._format;var e=!1,n=this._a<1&&this._a>=0;return r||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(e=this.toRgbString()),"prgb"===t&&(e=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(e=this.toHexString()),"hex3"===t&&(e=this.toHexString(!0)),"hex4"===t&&(e=this.toHex8String(!0)),"hex8"===t&&(e=this.toHex8String()),"name"===t&&(e=this.toName()),"hsl"===t&&(e=this.toHslString()),"hsv"===t&&(e=this.toHsvString()),e||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return n(this.toString())},_applyModification:function(t,r){var e=t.apply(null,[this].concat([].slice.call(r)));return this._r=e._r,this._g=e._g,this._b=e._b,this.setAlpha(e._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(h,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(l,arguments)},greyscale:function(){return this._applyModification(c,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(v,arguments)},complement:function(){return this._applyCombination(g,arguments)},monochromatic:function(){return this._applyCombination(y,arguments)},splitcomplement:function(){return this._applyCombination(m,arguments)},triad:function(){return this._applyCombination(p,[3])},tetrad:function(){return this._applyCombination(p,[4])}},n.fromRatio=function(r,e){if("object"==t(r)){var o={};for(var a in r)r.hasOwnProperty(a)&&(o[a]="a"===a?r[a]:O(r[a]));r=o}return n(r,e)},n.equals=function(t,r){return!(!t||!r)&&n(t).toRgbString()==n(r).toRgbString()},n.random=function(){return n.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},n.mix=function(t,r,e){e=0===e?0:e||50;var o=n(t).toRgb(),a=n(r).toRgb(),i=e/100;return n({r:(a.r-o.r)*i+o.r,g:(a.g-o.g)*i+o.g,b:(a.b-o.b)*i+o.b,a:(a.a-o.a)*i+o.a})},n.readability=function(t,r){var e=n(t),o=n(r);return(Math.max(e.getLuminance(),o.getLuminance())+.05)/(Math.min(e.getLuminance(),o.getLuminance())+.05)},n.isReadable=function(t,r,e){var o,a,i=n.readability(t,r);switch(a=!1,(o=function(t){var r,e;r=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),e=(t.size||"small").toLowerCase(),"AA"!==r&&"AAA"!==r&&(r="AA");"small"!==e&&"large"!==e&&(e="small");return{level:r,size:e}}(e)).level+o.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},n.mostReadable=function(t,r,e){var o,a,i,s,u=null,l=0;a=(e=e||{}).includeFallbackColors,i=e.level,s=e.size;for(var c=0;cl&&(l=o,u=n(r[c]));return n.isReadable(t,u,{level:i,size:s})||!a?u:(e.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],e))};var x=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},C=n.hexNames=function(t){var r={};for(var e in t)t.hasOwnProperty(e)&&(r[t[e]]=e);return r}(x);function M(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function w(t,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var e=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(r,Math.max(0,parseFloat(t))),e&&(t=parseInt(t*r,10)/100),Math.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function k(t){return Math.min(1,Math.max(0,t))}function S(t){return parseInt(t,16)}function A(t){return 1==t.length?"0"+t:""+t}function O(t){return t<=1&&(t=100*t+"%"),t}function P(t){return Math.round(255*parseFloat(t)).toString(16)}function j(t){return S(t)/255}var R,L,H,F=(L="[\\s|\\(]+("+(R="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",H="[\\s|\\(]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",{CSS_UNIT:new RegExp(R),rgb:new RegExp("rgb"+L),rgba:new RegExp("rgba"+H),hsl:new RegExp("hsl"+L),hsla:new RegExp("hsla"+H),hsv:new RegExp("hsv"+L),hsva:new RegExp("hsva"+H),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function T(t){return!!F.CSS_UNIT.exec(t)}function E(t){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(t)}function $(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function N(t){for(var r=1;r230||e.getAlpha()<.25}:{isDarkColor:!1,isLightColor:!1}),i=a.isDarkColor,s=a.isLightColor;return["span",V(V({style:"color: ".concat(o.color,";")},i&&{"data-dark-color":!0}),s&&{"data-light-color":!0}),0]},addCommands:function(){var t=this;return{setTextColor:function(r){return function(e){var n=e.chain;return r.color?n().setMark(t.name,r).run():n().unsetMark(t.name,{extendEmptyMarkRange:!0}).run()}}}}});Statamic.booting((function(){Statamic.$bard.addExtension((function(){return Z})),Statamic.$bard.buttons((function(t,r){var e=_.findIndex(t,(function(t){return"color"===t}));t.splice(e+1,0,r({name:"color",text:__("bard-color-picker::general.text_color"),html:'',command:function(t){return t.commands.setColor()},component:I}))}))}))}},e={};function n(t){var o=e[t];if(void 0!==o)return o.exports;var a=e[t]={exports:{}};return r[t](a,a.exports,n),a.exports}n.m=r,t=[],n.O=(r,e,o,a)=>{if(!e){var i=1/0;for(c=0;c=a)&&Object.keys(n.O).every((t=>n.O[t](e[u])))?e.splice(u--,1):(s=!1,a0&&t[c-1][2]>a;c--)t[c]=t[c-1];t[c]=[e,o,a]},n.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),(()=>{var t={59:0,836:0};n.O.j=r=>0===t[r];var r=(r,e)=>{var o,a,[i,s,u]=e,l=0;if(i.some((r=>0!==t[r]))){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);if(u)var c=u(n)}for(r&&r(e);ln(702)));var o=n.O(void 0,[836],(()=>n(247)));o=n.O(o)})(); \ No newline at end of file diff --git a/resources/js/components/ColorPanel.vue b/resources/js/components/ColorPanel.vue index 1de66cf..6944dfa 100644 --- a/resources/js/components/ColorPanel.vue +++ b/resources/js/components/ColorPanel.vue @@ -7,7 +7,7 @@ :aria-label="button.text" class="bard-toolbar-button" :class="{ 'active' : currentTextColor }" - :style="`color: ${currentTextColor || 'inherit'};`" + :style="buttonColorStyle" /> @@ -92,6 +92,14 @@ currentTextColor() { return this.editor.getAttributes('textColor')?.color }, + buttonColorStyle() { + if (this.currentTextColor) { + return { + color: this.currentTextColor + } + } + return {} + }, }, methods: {