@spectric/ui 0.0.24 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- spectric-input{--input-color: var(--spectric-input-color, #f4f4f4);--border-radius: var(--spectric-border-radius, .4em);--input-bottom: var(--spectric-input-bottom, var(--spectric-button-primary, #a8a8a8));--input-bottom-focused: var(--primary, #1ea7fd);--text-on-color: var(--spectric-text-on-color, #ffffff);--text-on-color-disabled: var(--spectric-text-on-color-disabled, #8d8d8d);--text-placeholder: rgba(22, 22, 22, .4);--text-primary: var(--spectric-text-primary, #161616);--text-secondary: var(--spectric-text-secondary, #525252)}spectric-input .inputWrapper{color:var(--text-secondary)}spectric-input .inputWrapper input{box-sizing:border-box;margin:0;vertical-align:baseline;font-size:.875rem;font-weight:400;line-height:1.28572;letter-spacing:.16px;outline:transparent solid 2px;outline-offset:-2px;border:none;padding:0 1rem;background-color:var(--input-color);color:var(--text-primary, #161616);font-family:inherit;inline-size:100%;block-size:2.5rem}spectric-input .inputWrapper .inputContainer:active:after,spectric-input .inputContainer:focus-within:after{border-bottom-color:var(--input-bottom-focused);width:calc(100% - 5px);transition:width .4s ease-in-out}spectric-input .inputWrapper input:read-only{background-color:transparent;border-bottom-color:var(--border-disabled)}spectric-input .inputContainer{position:relative;border-radius:var(--border-radius);overflow:hidden}spectric-input .inputContainer:after{content:"";width:0px;transition:background-color .4s cubic-bezier(.2,0,.38,.9),border-bottom-color .4s cubic-bezier(.2,0,.38,.9);border-bottom-color:var(--input-bottom);border-bottom-style:solid;border-bottom-width:1px;position:absolute;left:2.5px;bottom:0}spectric-input #helper-text{height:18px}spectric-input #helper-text.hidden{display:none}spectric-input .input-button-right{position:absolute;right:4px;bottom:3px}spectric-input .checkbox{display:flex;justify-self:center;align-items:center}spectric-input .checkbox spectric-button~span{padding-left:5px}spectric-input spectric-colorpicker{display:block}spectric-input[variant=color] .fieldwrapper{display:inline-block}spectric-query{font-family:monospace}spectric-query .autocomplete{color:var(--spectric-text-primary, #161616);border-radius:0em 0em var(--spectric-border-radius, .4em) var(--spectric-border-radius, .4em);background-color:var(--spectric-background, #ffffff);border:1px solid var(--spectric-background-hover, rgba(141, 141, 141, .12));max-height:300px;border-top:0px;margin:0;position:fixed;top:anchor(bottom);justify-self:anchor-center;text-align:center}spectric-query .autocomplete [popover]{overflow:visible}spectric-query .autocomplete .tooltip-content{width:100%}spectric-query .autocomplete .optiontype{float:left;max-width:10px}spectric-query .autocomplete .label{position:absolute;right:0}spectric-query .autocomplete .option.active,spectric-query .autocomplete .option:hover{background-color:var(--spectric-background-hover, rgba(141, 141, 141, .12));border-bottom:1px solid var(--primary, #1ea7fd)}spectric-query .autocomplete .option{border-bottom:1px solid transparent;padding:8px}.query-bar-date-quick-select{display:flex;justify-content:space-evenly}spectric-query span.field-name{color:#50b8f1}spectric-query span.expression-value{color:#c5937b}spectric-query span.field-numeric{color:#bacdab}spectric-query span.wild-card{color:#a94230}spectric-query span.value-constant{color:#3a7cc5}spectric-query .syntax-highlighter{color:#bc89bd;position:absolute;z-index:100;box-sizing:border-box;font-size:.875rem;letter-spacing:.16px;padding:0 1rem;font-family:inherit;inline-size:100%;block-size:2.5rem;content:no-close-quote;vertical-align:baseline;display:flex;align-items:center;pointer-events:none}spectric-query:focus-within .syntax-highlighter{display:none}spectric-query spectric-input .inputWrapper input{color:transparent}spectric-query:focus-within spectric-input .inputWrapper input{color:initial}spectric-pagination .spectric-pagination-container{display:flex;justify-content:space-between;align-items:center}spectric-pagination .spectric-pagination-text{flex-grow:1;text-align:center}spectric-table{display:flex;flex-direction:column;overflow:hidden;line-height:1}spectric-table .table-wrapper{overflow:auto;flex-grow:1;position:relative}spectric-table tr{text-align:center}spectric-table tr.odd{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 90%)}spectric-table spectric-table-virtual-body tr:hover{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 70%)}spectric-table spectric-table-virtual-body tr{height:var(--rowHeight)}spectric-table td{padding:1px;border:1px solid transparent}spectric-table spectric-table-virtual-body td{height:var(--rowHeight)}spectric-table div[role=table]{display:table;min-width:100%}spectric-table-cell{display:contents;vertical-align:middle}spectric-table-cell td{position:relative}spectric-table td:hover:has(.hasActions){border:1px solid var(--spectric-primary, #1ea7fd)}spectric-table-cell .table-cell-actions{position:absolute;display:flex;width:100%;flex-direction:row-reverse;visibility:hidden;z-index:1}spectric-table-cell .table-cell-actions.tiny{top:-10px}spectric-table-cell .table-cell-actions.xxsmall{top:-16px}spectric-table-cell td:hover .table-cell-actions{visibility:unset}spectric-table .table-checkbox-single spectric-button{--button-border-radius: 50%}spectric-input.table-checkbox-single[checked] spectric-button{--text-on-color: transparent;border-radius:50%;position:relative}spectric-input.table-checkbox-single[checked] spectric-button:before{position:absolute;content:" ";height:50%;width:50%;left:25%;top:25%;border-radius:50%;z-index:1;box-shadow:0 0 0 4px var(--input-color)}spectric-table .cell-contents{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:var(--lineClamp,1);-webkit-box-pack:center;overflow:hidden;text-overflow:ellipsis;font-size:var(--fontSize);line-height:calc(var(--lineClamp) * var(--fontSize));height:var(--rowHeight)}spectric-table-header{display:table-header-group;font-weight:700;position:sticky;top:0;left:0;z-index:1;background:var(--spectric-background, #ffffff)}spectric-table-header td{vertical-align:middle;position:relative}spectric-table-header .header-contents{position:relative}spectric-table-header .header-contents .sort-direction{position:absolute;right:2px;top:calc(50% - 8px)}spectric-table-header .header-contents.sortable{cursor:pointer;padding-right:15px}spectric-table-header .header-contents.resizing{-webkit-user-select:none;user-select:none}spectric-table-header .header-contents.sortable:hover .sort-direction.none:before{content:"⮁"}spectric-table-header td .header-resize-handle{width:2px;position:absolute;right:-1px;top:1px;visibility:hidden;background-color:var(--spectric-primary, #1ea7fd);height:100%;cursor:ew-resize;z-index:1}spectric-table-header td:hover .header-resize-handle{visibility:visible}spectric-table-header td:hover:has(*.header-resize-handle){border-bottom:1px solid var(--spectric-primary, #1ea7fd)}spectric-table-body{display:table-row-group}spectric-table-virtual-body{display:contents}spectric-table-virtual-body .virtual-scroll-spacer td{padding:0;border:0px}.spectric-popover-portal{margin:0;border:0px;padding:0;position:fixed;z-index:9999;background:transparent;pointer-events:all;--spectric-tooltip-background-color: var(--spectric-tooltip-background, var(--spectric-background,#ffffff));--spectric-tooltip-text-color: var(--spectric-tooltip-text, var(--spectric-text-primary, rgb(0, 0, 0)));--spectric-tooltip-accent-color: var(--spectric-tooltip-accent, var(--spectric-primary, #1ea7fd))}.spectric-popover-portal.spectric-tooltip-portal{pointer-events:none}.spectric-popover-portal .tooltip-container{display:flex;justify-content:center;align-items:center}.spectric-popover-portal.top .tooltip-container{flex-direction:column-reverse}.spectric-popover-portal.bottom .tooltip-container{flex-direction:column}.spectric-popover-portal.left .tooltip-container{flex-direction:row-reverse}.spectric-popover-portal .tooltip-content{background:var(--spectric-tooltip-background-color);border-radius:var(--spectric-border-radius,.4em);border:1px solid color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%);box-shadow:0 0 .01em .01em color-mix(in srgb,var(--spectric-tooltip-accent-color) 90%,var(--spectric-text-on-color,#ffffff) 90%);padding:.2em;color:var(--spectric-tooltip-text-color)}.spectric-popover-portal .tooltip-caret{background:color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%)}.spectric-tooltip-portal.top .tooltip-caret,.spectric-tooltip-portal.bottom .tooltip-caret{inline-size:.75rem;block-size:.374rem}.spectric-tooltip-portal.left .tooltip-caret,.spectric-tooltip-portal.right .tooltip-caret{inline-size:.375rem;block-size:.75rem}.spectric-popover-portal.top .tooltip-caret{clip-path:polygon(0 0,50% 100%,100% 0)}.spectric-popover-portal.bottom .tooltip-caret{clip-path:polygon(0 100%,50% 0,100% 100%)}.spectric-popover-portal.left .tooltip-caret{clip-path:polygon(0 0,100% 50%,0 100%)}.spectric-popover-portal.right .tooltip-caret{clip-path:polygon(0 50%,100% 0,100% 100%)}spectric-input.hue-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.hue-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.alpha-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range],spectric-input.hue-gradient input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.color-picker-footer{display:flex;justify-content:space-evenly}.color-picker-saturation-lightness-grid{cursor:crosshair}.color-picker-eyedropper{--button-border-radius:50%}.color-picker-eyedropper.hidden{display:none}spectric-calendar{display:flex;justify-content:center;--default-text-on-color:var(--spectric-text-on-color, #ffffff)}spectric-calendar .header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}spectric-calendar .month-year{display:flex;align-items:center;gap:10px}spectric-calendar select{font-size:14px;padding:2px}spectric-calendar .days{display:grid;grid-template-columns:repeat(7,34px);grid-template-rows:repeat(7,34px);text-align:center;background:radial-gradient(circle at var(--x, 200%) var(--y, 200%),var(--spectric-background-inverse,#ffffff) 0%,var(--spectric-background,#f4f4f4) 25%);transition:background .1s ease;--spectric-text-on-color: var(--spectric-primary,#1ea7fd)}spectric-calendar .day{font-weight:700;padding:5px;background-color:var(--spectric-background)}spectric-calendar .date.active{--spectric-text-on-color: var(--default-text-on-color, #ffffff)}spectric-calendar .date{margin:2px}
1
+ spectric-input{--input-color: var(--spectric-input-color, #f4f4f4);--border-radius: var(--spectric-border-radius, .4em);--input-bottom: var(--spectric-input-bottom, var(--spectric-button-primary, #a8a8a8));--input-bottom-focused: var(--primary, #1ea7fd);--text-on-color: var(--spectric-text-on-color, #ffffff);--text-on-color-disabled: var(--spectric-text-on-color-disabled, #8d8d8d);--text-placeholder: rgba(22, 22, 22, .4);--text-primary: var(--spectric-text-primary, #161616);--text-secondary: var(--spectric-text-secondary, #525252)}spectric-input .inputWrapper{color:var(--text-secondary)}spectric-input .inputWrapper input{box-sizing:border-box;margin:0;vertical-align:baseline;font-size:.875rem;font-weight:400;line-height:1.28572;letter-spacing:.16px;outline:transparent solid 2px;outline-offset:-2px;border:none;padding:0 1rem;background-color:var(--input-color);color:var(--text-primary, #161616);font-family:inherit;inline-size:100%;block-size:2.5rem}spectric-input .inputWrapper .inputContainer:active:after,spectric-input .inputContainer:focus-within:after{border-bottom-color:var(--input-bottom-focused);width:calc(100% - 5px);transition:width .4s ease-in-out}spectric-input .inputWrapper input:read-only{background-color:transparent;border-bottom-color:var(--border-disabled)}spectric-input .inputContainer{position:relative;border-radius:var(--border-radius);overflow:hidden}spectric-input .inputContainer:after{content:"";width:0px;transition:background-color .4s cubic-bezier(.2,0,.38,.9),border-bottom-color .4s cubic-bezier(.2,0,.38,.9);border-bottom-color:var(--input-bottom);border-bottom-style:solid;border-bottom-width:1px;position:absolute;left:2.5px;bottom:0}spectric-input #helper-text{height:18px}spectric-input #helper-text.hidden{display:none}spectric-input .input-button-right{position:absolute;right:4px;bottom:3px}spectric-input .checkbox{display:flex;justify-self:center;align-items:center}spectric-input .checkbox spectric-button~span{padding-left:5px}spectric-input spectric-colorpicker{display:block}spectric-input[variant=color] .fieldwrapper{display:inline-block}spectric-query{font-family:monospace}spectric-query .autocomplete{color:var(--spectric-text-primary, #161616);border-radius:0em 0em var(--spectric-border-radius, .4em) var(--spectric-border-radius, .4em);background-color:var(--spectric-background, #ffffff);border:1px solid var(--spectric-background-hover, rgba(141, 141, 141, .12));max-height:300px;border-top:0px;margin:0;position:fixed;top:anchor(bottom);justify-self:anchor-center;text-align:center}spectric-query .autocomplete [popover]{overflow:visible}spectric-query .autocomplete .tooltip-content{width:100%}spectric-query .autocomplete .optiontype{float:left;max-width:10px}spectric-query .autocomplete .label{position:absolute;right:0}spectric-query .autocomplete .option.active,spectric-query .autocomplete .option:hover{background-color:var(--spectric-background-hover, rgba(141, 141, 141, .12));border-bottom:1px solid var(--primary, #1ea7fd)}spectric-query .autocomplete .option{border-bottom:1px solid transparent;padding:8px}.query-bar-date-quick-select{display:flex;justify-content:space-evenly}spectric-query span.field-name{color:#50b8f1}spectric-query span.expression-value{color:#c5937b}spectric-query span.field-numeric{color:#bacdab}spectric-query span.wild-card{color:#a94230}spectric-query span.value-constant{color:#3a7cc5}spectric-query .syntax-highlighter{color:#bc89bd;position:absolute;z-index:100;font-size:.875rem;letter-spacing:.16px;padding:0 1.7rem 0 1rem;font-family:inherit;inline-size:calc(100% - .5rem);block-size:2.5rem;content:no-close-quote;vertical-align:baseline;display:flex;align-items:center;pointer-events:none;white-space:nowrap;box-sizing:border-box}spectric-query .syntax-highlighter>*{overflow:hidden}spectric-query:focus-within .syntax-highlighter{display:none}spectric-query spectric-input .inputWrapper input{color:transparent}spectric-query:focus-within spectric-input .inputWrapper input{color:unset}spectric-pagination .spectric-pagination-container{display:flex;justify-content:space-between;align-items:center}spectric-pagination .spectric-pagination-text{flex-grow:1;text-align:center}spectric-table{display:flex;flex-direction:column;overflow:hidden;line-height:1}spectric-table .table-wrapper{overflow:auto;flex-grow:1;position:relative}spectric-table tr{text-align:center}spectric-table tr.odd{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 90%)}spectric-table spectric-table-virtual-body tr:hover{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 70%)}spectric-table spectric-table-virtual-body tr.virtual-scroll-spacer:hover{background-color:unset}spectric-table spectric-table-virtual-body tr{height:var(--rowHeight)}spectric-table td{padding:1px;border:1px solid transparent}spectric-table spectric-table-virtual-body td{height:var(--rowHeight)}spectric-table div[role=table]{display:table;min-width:100%}spectric-table-cell{display:contents;vertical-align:middle}spectric-table-cell td{position:relative}spectric-table td:hover:has(.hasActions){border:1px solid var(--spectric-primary, #1ea7fd)}spectric-table-cell .table-cell-actions{position:absolute;display:flex;width:100%;flex-direction:row-reverse;visibility:hidden;z-index:1}spectric-table-cell .table-cell-actions.tiny{top:-10px}spectric-table-cell .table-cell-actions.xxsmall{top:-16px}spectric-table-cell td:hover .table-cell-actions{visibility:unset}spectric-table .table-checkbox-single spectric-button{--button-border-radius: 50%}spectric-input.table-checkbox-single[checked] spectric-button{--text-on-color: transparent;border-radius:50%;position:relative}spectric-input.table-checkbox-single[checked] spectric-button:before{position:absolute;content:" ";height:50%;width:50%;left:25%;top:25%;border-radius:50%;z-index:1;box-shadow:0 0 0 4px var(--input-color)}spectric-table .cell-contents{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:var(--lineClamp, 1);-webkit-box-pack:center;overflow:hidden;text-overflow:ellipsis;font-size:var(--fontSize);line-height:calc(var(--lineClamp) * var(--fontSize));height:var(--rowHeight)}spectric-table-header{display:table-header-group;font-weight:700;position:sticky;top:0;left:0;z-index:1;background:var(--spectric-background, #ffffff)}spectric-table-header td{vertical-align:middle;position:relative}spectric-table-header .header-contents{position:relative}spectric-table-header .header-contents .sort-direction{position:absolute;right:2px;top:calc(50% - 8px)}spectric-table-header .header-contents.sortable{cursor:pointer;padding-right:15px}spectric-table-header .header-contents.resizing{-webkit-user-select:none;user-select:none}spectric-table-header .header-contents.sortable:hover .sort-direction.none:before{content:"⮁"}spectric-table-header td .header-resize-handle{width:2px;position:absolute;right:-1px;top:1px;visibility:hidden;background-color:var(--spectric-primary, #1ea7fd);height:100%;cursor:ew-resize;z-index:1}spectric-table-header td:hover .header-resize-handle{visibility:visible}spectric-table-header td:hover:has(*.header-resize-handle){border-bottom:1px solid var(--spectric-primary, #1ea7fd)}spectric-table-body{display:table-row-group}spectric-table-virtual-body{display:contents}spectric-table-virtual-body .virtual-scroll-spacer td{padding:0;border:0px}.spectric-popover-portal{margin:0;border:0px;padding:0;position:fixed;z-index:9999;background:transparent;pointer-events:all;--spectric-tooltip-background-color: var(--spectric-tooltip-background, var(--spectric-background,#ffffff));--spectric-tooltip-text-color: var(--spectric-tooltip-text, var(--spectric-text-primary, rgb(0, 0, 0)));--spectric-tooltip-accent-color: var(--spectric-tooltip-accent, var(--spectric-primary, #1ea7fd))}.spectric-popover-portal.spectric-tooltip-portal{pointer-events:none}.spectric-popover-portal .tooltip-container{display:flex;justify-content:center;align-items:center}.spectric-popover-portal.top .tooltip-container{flex-direction:column-reverse}.spectric-popover-portal.bottom .tooltip-container{flex-direction:column}.spectric-popover-portal.left .tooltip-container{flex-direction:row-reverse}.spectric-popover-portal .tooltip-content{background:var(--spectric-tooltip-background-color);border-radius:var(--spectric-border-radius,.4em);border:1px solid color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%);box-shadow:0 0 .01em .01em color-mix(in srgb,var(--spectric-tooltip-accent-color) 90%,var(--spectric-text-on-color,#ffffff) 90%);padding:.2em;color:var(--spectric-tooltip-text-color)}.spectric-popover-portal .tooltip-caret{background:color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%)}.spectric-tooltip-portal.top .tooltip-caret,.spectric-tooltip-portal.bottom .tooltip-caret{inline-size:.75rem;block-size:.374rem}.spectric-tooltip-portal.left .tooltip-caret,.spectric-tooltip-portal.right .tooltip-caret{inline-size:.375rem;block-size:.75rem}.spectric-popover-portal.top .tooltip-caret{clip-path:polygon(0 0,50% 100%,100% 0)}.spectric-popover-portal.bottom .tooltip-caret{clip-path:polygon(0 100%,50% 0,100% 100%)}.spectric-popover-portal.left .tooltip-caret{clip-path:polygon(0 0,100% 50%,0 100%)}.spectric-popover-portal.right .tooltip-caret{clip-path:polygon(0 50%,100% 0,100% 100%)}spectric-input.hue-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.hue-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.alpha-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range],spectric-input.hue-gradient input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.color-picker-footer{display:flex;justify-content:space-evenly}.color-picker-saturation-lightness-grid{cursor:crosshair}.color-picker-eyedropper{--button-border-radius:50%}.color-picker-eyedropper.hidden{display:none}spectric-calendar{display:flex;justify-content:center;--default-text-on-color:var(--spectric-text-on-color, #ffffff)}spectric-calendar .header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}spectric-calendar .month-year{display:flex;align-items:center;gap:10px}spectric-calendar select{font-size:14px;padding:2px}spectric-calendar .days{display:grid;grid-template-columns:repeat(7,34px);grid-template-rows:repeat(7,34px);text-align:center;background:radial-gradient(circle at var(--x, 200%) var(--y, 200%),var(--spectric-background-inverse,#ffffff) 0%,var(--spectric-background,#f4f4f4) 25%);transition:background .1s ease;--spectric-text-on-color: var(--spectric-primary,#1ea7fd)}spectric-calendar .day{font-weight:700;padding:5px;background-color:var(--spectric-background)}spectric-calendar .date.active{--spectric-text-on-color: var(--default-text-on-color, #ffffff)}spectric-calendar .date{margin:2px}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectric/ui",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "module": "./dist/index.es.js",
@@ -81,6 +81,8 @@ export interface InputProps {
81
81
  * The sets the autocomplete for the input.
82
82
  */
83
83
  autocomplete?: HTMLInputElement["autocomplete"];
84
+
85
+ spellcheck?: HTMLInputElement["spellcheck"];
84
86
  }
85
87
  @customElement("spectric-input")
86
88
  export class SpectricInput extends LitElement implements InputProps {
@@ -169,6 +171,13 @@ export class SpectricInput extends LitElement implements InputProps {
169
171
  */
170
172
  @property({ reflect: true })
171
173
  autocomplete: HTMLInputElement["autocomplete"] = "off";
174
+
175
+ /**
176
+ * The sets the autocomplete for the input.
177
+ */
178
+ @property({ reflect: true, type: Boolean })
179
+ spellcheck: HTMLInputElement["spellcheck"] = true;
180
+
172
181
  get selectionStart() {
173
182
  if (!this._input) {
174
183
  return null;
@@ -250,7 +259,7 @@ export class SpectricInput extends LitElement implements InputProps {
250
259
  changedProperties.has("checked") &&
251
260
  changedProperties.get("checked") !== undefined
252
261
  ) {
253
- this.dispatchEvent(new Event("change", { bubbles: true }));
262
+ //this.dispatchEvent(new Event("change", { bubbles: true }));
254
263
  }
255
264
  }
256
265
  @eventOptions({ capture: true })
@@ -306,6 +315,7 @@ export class SpectricInput extends LitElement implements InputProps {
306
315
  pattern="${ifNonEmpty(this.pattern)}"
307
316
  placeholder="${ifNonEmpty(this.placeholder)}"
308
317
  autocomplete="${ifNonEmpty(this.autocomplete)}"
318
+ spellcheck=${this.spellcheck}
309
319
  ?readonly="${this.readonly}"
310
320
  ?required="${this.required}"
311
321
  type="${ifNonEmpty(
@@ -404,6 +414,7 @@ export class SpectricInput extends LitElement implements InputProps {
404
414
  @click=${() => {
405
415
  this.checked = !this.checked;
406
416
  this.value = Boolean(this.checked);
417
+ this.dispatchEvent(new Event("change", { bubbles: true }));
407
418
  }} icon size=${this.size || "xxsmall"} variant=${
408
419
  this.checked ? "primary" : "secondary"
409
420
  }>${this.checked ? "✓" : "\u00A0"}</spectric-button>
@@ -1,95 +1,98 @@
1
1
  spectric-query {
2
- font-family: monospace
2
+ font-family: monospace;
3
3
  }
4
4
 
5
-
6
-
7
5
  spectric-query .autocomplete {
8
- color: var(--spectric-text-primary, #161616);
9
- border-radius: .0em 0em var(--spectric-border-radius, .4em) var(--spectric-border-radius, .4em);
10
- background-color: var(--spectric-background, #ffffff);
11
- border: 1px solid var(--spectric-background-hover, rgba(141, 141, 141, 0.12));
12
- max-height: 300px;
13
- border-top: 0px;
14
- margin: 0px;
15
- /*Input helper text is 18px we can cover that with the popover*/
16
- position: fixed;
17
- top: anchor(bottom);
18
- justify-self: anchor-center;
19
- text-align: center;
20
- }
21
- spectric-query .autocomplete [popover]{
22
- overflow: visible;
23
- }
24
- spectric-query .autocomplete .tooltip-content{
25
- width: 100%;
6
+ color: var(--spectric-text-primary, #161616);
7
+ border-radius: 0em 0em var(--spectric-border-radius, 0.4em)
8
+ var(--spectric-border-radius, 0.4em);
9
+ background-color: var(--spectric-background, #ffffff);
10
+ border: 1px solid var(--spectric-background-hover, rgba(141, 141, 141, 0.12));
11
+ max-height: 300px;
12
+ border-top: 0px;
13
+ margin: 0px;
14
+ /*Input helper text is 18px we can cover that with the popover*/
15
+ position: fixed;
16
+ top: anchor(bottom);
17
+ justify-self: anchor-center;
18
+ text-align: center;
19
+ }
20
+ spectric-query .autocomplete [popover] {
21
+ overflow: visible;
22
+ }
23
+ spectric-query .autocomplete .tooltip-content {
24
+ width: 100%;
26
25
  }
27
26
  spectric-query .autocomplete .optiontype {
28
- float: left;
29
- max-width: 10px;
30
- /*todo should we display an icon instead of text?*/
27
+ float: left;
28
+ max-width: 10px;
29
+ /*todo should we display an icon instead of text?*/
31
30
  }
32
31
 
33
32
  spectric-query .autocomplete .label {
34
- position: absolute;
35
- right: 0;
33
+ position: absolute;
34
+ right: 0;
36
35
  }
37
36
 
38
37
  spectric-query .autocomplete .option.active,
39
38
  spectric-query .autocomplete .option:hover {
40
- background-color: var(--spectric-background-hover, rgba(141, 141, 141, 0.12));
41
- border-bottom: 1px solid var(--primary, #1ea7fd);
39
+ background-color: var(--spectric-background-hover, rgba(141, 141, 141, 0.12));
40
+ border-bottom: 1px solid var(--primary, #1ea7fd);
42
41
  }
43
42
 
44
43
  spectric-query .autocomplete .option {
45
- border-bottom: 1px solid transparent;
46
- padding: 8px;
44
+ border-bottom: 1px solid transparent;
45
+ padding: 8px;
47
46
  }
48
47
 
49
48
  .query-bar-date-quick-select {
50
- display: flex;
51
- justify-content: space-evenly;
49
+ display: flex;
50
+ justify-content: space-evenly;
52
51
  }
53
52
  spectric-query span.field-name {
54
- color: #50b8f1;
53
+ color: #50b8f1;
55
54
  }
56
55
 
57
56
  spectric-query span.expression-value {
58
- color: #c5937b;
57
+ color: #c5937b;
59
58
  }
60
59
 
61
60
  spectric-query span.field-numeric {
62
- color: #bacdab;
61
+ color: #bacdab;
63
62
  }
64
63
  spectric-query span.wild-card {
65
- color: #a94230;
64
+ color: #a94230;
66
65
  }
67
66
  spectric-query span.value-constant {
68
- color: #3a7cc5;
69
- }
70
- spectric-query .syntax-highlighter{
71
- color: #bc89bd;
72
- position: absolute;
73
- z-index: 100;
74
- box-sizing: border-box;
75
- font-size: .875rem;
76
- letter-spacing: .16px;
77
- padding: 0 1rem;
78
- font-family: inherit;
79
- inline-size: 100%;
80
- block-size: 2.5rem;
81
- content: no-close-quote;
82
- vertical-align: baseline;
83
- display: flex;
84
- align-items: center;
85
- pointer-events: none;
86
- }
87
- spectric-query:focus-within .syntax-highlighter{
88
- display: none;
89
- }
90
- spectric-query spectric-input .inputWrapper input{
91
- color: transparent;
92
- }
93
- spectric-query:focus-within spectric-input .inputWrapper input{
94
- color: initial;
95
- }
67
+ color: #3a7cc5;
68
+ }
69
+ spectric-query .syntax-highlighter {
70
+ color: #bc89bd;
71
+ position: absolute;
72
+ z-index: 100;
73
+ font-size: 0.875rem;
74
+ letter-spacing: 0.16px;
75
+ padding: 0 1.7rem 0 1rem;
76
+ font-family: inherit;
77
+ inline-size: calc(100% - 0.5rem);
78
+ block-size: 2.5rem;
79
+ content: no-close-quote;
80
+ vertical-align: baseline;
81
+ display: flex;
82
+ align-items: center;
83
+ pointer-events: none;
84
+ white-space: nowrap;
85
+ box-sizing: border-box;
86
+ }
87
+ spectric-query .syntax-highlighter > * {
88
+ overflow: hidden;
89
+ }
90
+ spectric-query:focus-within .syntax-highlighter {
91
+ display: none;
92
+ }
93
+ spectric-query spectric-input .inputWrapper input {
94
+ color: transparent;
95
+ }
96
+ spectric-query:focus-within spectric-input .inputWrapper input {
97
+ color: unset;
98
+ }
@@ -48,7 +48,7 @@ export enum SupportedLanguages {
48
48
  AST = "AST",
49
49
  }
50
50
  type SupportedLanguagesTypes = `${SupportedLanguages}`;
51
- interface QueryEventMap {
51
+ export interface QueryEventMap {
52
52
  change: (event: CustomEvent<string | kuery.KueryNode | JsonObject>) => void;
53
53
  }
54
54
 
@@ -159,13 +159,13 @@ export class SpectricQuery extends LitElement implements IQueryProps {
159
159
  @property({ type: String, reflect: true })
160
160
  value = "";
161
161
  @property({ type: String, reflect: true })
162
- outputLanguage: SupportedLanguagesTypes = "AST";
162
+ outputLanguage?: SupportedLanguagesTypes = "AST";
163
163
  @state()
164
164
  private completions: Completion[] = [];
165
165
  @state()
166
166
  private completionIndex = 0;
167
167
  @property({ type: Array, reflect: true })
168
- fields: FieldTypes[] = [];
168
+ fields?: FieldTypes[] = [];
169
169
 
170
170
  @query(".autocomplete")
171
171
  _autocomplete?: PopoverElement;
@@ -188,6 +188,7 @@ export class SpectricQuery extends LitElement implements IQueryProps {
188
188
  suggestion = this._getSuggestion();
189
189
  } catch (error) {
190
190
  console.log(error);
191
+ this._autocomplete?.hidePopover();
191
192
  }
192
193
  if (!suggestion) {
193
194
  return;
@@ -221,9 +222,8 @@ export class SpectricQuery extends LitElement implements IQueryProps {
221
222
  if (!suggestion || suggestion.start === suggestion.end) {
222
223
  return;
223
224
  }
224
- let field = this.fields.find(
225
- (field) => field.name === suggestion.fieldName
226
- );
225
+ let fields = this.fields || [];
226
+ let field = fields.find((field) => field.name === suggestion.fieldName);
227
227
 
228
228
  if (!field) {
229
229
  return;
@@ -306,11 +306,12 @@ export class SpectricQuery extends LitElement implements IQueryProps {
306
306
  let suggestions = this._getSuggestion();
307
307
  this.autoComplete(suggestions);
308
308
  } catch (error: any) {
309
+ this.completions = [];
310
+ this._autocomplete?.hidePopover();
309
311
  // this.completions = []
310
312
  // this._input.invalid = true;
311
313
  // let [expect, _, arrow] = e.message.split("\n")
312
314
  // this._input.invalidText = html`&#160;&#160;${arrow} ${expect}`;
313
- return;
314
315
  }
315
316
  }
316
317
  try {
@@ -322,13 +323,13 @@ export class SpectricQuery extends LitElement implements IQueryProps {
322
323
  if (this.outputLanguage == "AST") {
323
324
  output = ast;
324
325
  } else {
325
- output = kuery[this.outputLanguage](ast, this.fields);
326
+ output = kuery[this.outputLanguage || "toDSL"](ast, this.fields);
326
327
  }
327
328
  let event = new CustomEvent("change", { detail: output });
328
329
  if (this.value.trim().length) {
329
330
  this.highlightedSyntax = unsafeHTML(kuery.toHTML(ast, this.fields));
330
- }else{
331
- this.highlightedSyntax = ""
331
+ } else {
332
+ this.highlightedSyntax = "";
332
333
  }
333
334
  this.dispatchEvent(event);
334
335
  };
@@ -359,8 +360,9 @@ export class SpectricQuery extends LitElement implements IQueryProps {
359
360
  }))
360
361
  );
361
362
  }
363
+ let fields = this.fields || [];
362
364
  if (type === "field") {
363
- let fieldCompletions = this.fields
365
+ let fieldCompletions = fields
364
366
  .filter(
365
367
  (field) =>
366
368
  field.name.includes(suggestion.fieldName) ||
@@ -373,7 +375,7 @@ export class SpectricQuery extends LitElement implements IQueryProps {
373
375
  completions.push(...fieldCompletions);
374
376
  }
375
377
  if (type === "operator") {
376
- let fieldType = this.fields.find(
378
+ let fieldType = fields.find(
377
379
  (field) => field.name === suggestion.fieldName
378
380
  );
379
381
  if (fieldType) {
@@ -456,7 +458,7 @@ export class SpectricQuery extends LitElement implements IQueryProps {
456
458
  }
457
459
  }
458
460
  if (type === "value") {
459
- let fieldType = this.fields.find(
461
+ let fieldType = (this.fields || []).find(
460
462
  (field) => field.name === suggestion.fieldName
461
463
  );
462
464
  if (
@@ -505,10 +507,14 @@ export class SpectricQuery extends LitElement implements IQueryProps {
505
507
  this._autocomplete?.hidePopover();
506
508
  }
507
509
  }
508
- protected updated(changed: PropertyValues): void {
510
+ protected update(changed: PropertyValues): void {
509
511
  if (changed.has("outputLanguage")) {
510
512
  this._parseQuery();
511
513
  }
514
+ if (changed.has("value")) {
515
+ this._parseQuery();
516
+ }
517
+ super.update(changed);
512
518
  }
513
519
  _selectCompletion = async () => {
514
520
  if (!this.suggestion) {
@@ -595,10 +601,14 @@ export class SpectricQuery extends LitElement implements IQueryProps {
595
601
  .placeholder=${this.placeholder}
596
602
  style=${`anchor-name:--${this.uuid};`}
597
603
  autocomplete="off"
604
+ .spellcheck=${false}
598
605
  @input=${this._parseQuery}
599
606
  @keydown=${this._handleArrows}
600
607
  @change=${(e: Event) => e.stopPropagation()}
601
608
  @click=${this._checkClickLocation}
609
+ @blur=${() => {
610
+ this._autocomplete?.hidePopover();
611
+ }}
602
612
  ></spectric-input>
603
613
  <spectric-popover
604
614
  class="valueHelper"
@@ -0,0 +1,101 @@
1
+ import { test, expect } from "@playwright/test";
2
+ import type {
3
+ SpectricQuery,
4
+ QueryEventMap,
5
+ KueryNode,
6
+ JsonObject,
7
+ } from "../index";
8
+ import type SpectricModule from "../../../index.ts";
9
+ import { SpectricInput } from "../../../index.ts";
10
+ test.beforeEach(async ({ page }) => {
11
+ page.on("console", (msg) => {
12
+ console.log(`Page[${msg.type()}]:` + msg.text());
13
+ });
14
+ await page.addInitScript(() => {
15
+ //@ts-ignore
16
+ window.awaitEvent = function awaitEvent(target, event, trigger) {
17
+ return new Promise((resolve, reject) => {
18
+ let timeout = setTimeout(reject, 400);
19
+ const handleEvent = (...args) => {
20
+ clearTimeout(timeout);
21
+ //@ts-ignore
22
+ target.removeEventListener(event, handleEvent);
23
+ resolve(args);
24
+ };
25
+ //@ts-ignore
26
+ target.addEventListener(event, handleEvent, { once: true });
27
+ trigger();
28
+ });
29
+ };
30
+ });
31
+ });
32
+
33
+ type HighlightResponse = {
34
+ query: string;
35
+ query_ast: KueryNode;
36
+ highlight_ast: KueryNode;
37
+ };
38
+
39
+ test.describe("Spectric Querybar Highlight Tests", () => {
40
+ test("Ensure the highlighted syntax outputs the same AST as the input (except geoqueries those are truncated)", async ({
41
+ page,
42
+ }) => {
43
+ await page.goto(
44
+ "http://localhost:6006/iframe.html?globals=&args=&id=spectric-ui-components-ui-query--basic&viewMode=story"
45
+ );
46
+ let queryBar = page.locator("spectric-query");
47
+ await queryBar.waitFor();
48
+ let responses = await queryBar.evaluate<HighlightResponse[], SpectricQuery>(
49
+ async (queryBar) => {
50
+ queryBar.outputLanguage = "AST";
51
+ const TEST_QUERYS = [
52
+ `test:"test"`,
53
+ `test:("works" or "still works")`,
54
+ `test:("works" and "still works")`,
55
+ `(test:"works" and test_num > 10) or (modulation:("FM" or "AM") and test_num < 5)`,
56
+ `( ("value" OR "value2") AND "value3" )`,
57
+ ];
58
+ const output: HighlightResponse[] = [];
59
+ for (let query of TEST_QUERYS) {
60
+ queryBar.value = "";
61
+ await new Promise((resolve) => setTimeout(resolve, 100));
62
+ let [event] = (await window.awaitEvent<QueryEventMap>(
63
+ queryBar,
64
+ "change",
65
+ () => (queryBar.value = query)
66
+ )) as Parameters<QueryEventMap["change"]>;
67
+ let highlightedSyntax = queryBar.querySelector<HTMLDivElement>(
68
+ ".syntax-highlighter"
69
+ )!.innerText;
70
+ queryBar.value = "";
71
+ await new Promise((resolve) => setTimeout(resolve, 100));
72
+ let [highlightedEvent] = (await window.awaitEvent<QueryEventMap>(
73
+ queryBar,
74
+ "change",
75
+ () => (queryBar.value = highlightedSyntax)
76
+ )) as Parameters<QueryEventMap["change"]>;
77
+ await new Promise((resolve) => setTimeout(resolve, 100));
78
+ output.push({
79
+ query,
80
+ query_ast: event.detail as KueryNode,
81
+ highlight_ast: highlightedEvent.detail as KueryNode,
82
+ });
83
+ }
84
+ return output;
85
+ }
86
+ );
87
+ for (let { query, query_ast, highlight_ast } of responses) {
88
+ expect(highlight_ast, query).toMatchObject(query_ast);
89
+ }
90
+ });
91
+ });
92
+
93
+ declare global {
94
+ interface Window {
95
+ awaitEvent: <EventMap extends Record<string, any>, K = keyof EventMap>(
96
+ target: HTMLElement,
97
+ event: K,
98
+ trigger: () => void
99
+ ) => Parameters<EventMap[keyof EventMap]>;
100
+ }
101
+ }
@@ -266,7 +266,8 @@ function peg$parse(input, options) {
266
266
  rule:"SubQuery"
267
267
  };
268
268
  }
269
- return query;
269
+ group++
270
+ return {...query,group};
270
271
  }
271
272
  function peg$f5(field, query, trailing) {
272
273
  if (query.type === 'cursor') {
@@ -384,7 +385,8 @@ function peg$parse(input, options) {
384
385
  rule:"OrListOfValues"
385
386
  };
386
387
  }
387
- return (field) => buildFunctionNode('or', [partialLeft(field), partialRight(field)]);
388
+ group++
389
+ return (field) => ({...buildFunctionNode('or', [partialLeft(field), partialRight(field)]),group});
388
390
  }
389
391
  function peg$f13(partialLeft, partialRight) {
390
392
  const cursor = [partialLeft, partialRight].find(node => node.type === 'cursor');
@@ -395,7 +397,8 @@ function peg$parse(input, options) {
395
397
  rule:"AndListOfValues"
396
398
  };
397
399
  }
398
- return (field) => buildFunctionNode('and', [partialLeft(field), partialRight(field)]);
400
+ group++
401
+ return (field) => ({...buildFunctionNode('and', [partialLeft(field), partialRight(field)]),group});
399
402
  }
400
403
  function peg$f14(partial) {
401
404
  if (partial.type === 'cursor') {
@@ -2234,6 +2237,7 @@ function peg$parse(input, options) {
2234
2237
  const buildWildcardNode = nodeTypes.wildcard.buildNode;
2235
2238
  const buildNamedArgNode = nodeTypes.namedArg.buildNode;
2236
2239
  const { wildcardSymbol } = nodeTypes.wildcard;
2240
+ var group = 0
2237
2241
 
2238
2242
  peg$result = peg$startRuleFunction();
2239
2243
 
@@ -11,6 +11,7 @@
11
11
  const buildWildcardNode = nodeTypes.wildcard.buildNode;
12
12
  const buildNamedArgNode = nodeTypes.namedArg.buildNode;
13
13
  const { wildcardSymbol } = nodeTypes.wildcard;
14
+ var group = 0
14
15
  }
15
16
 
16
17
  start
@@ -58,7 +59,8 @@ SubQuery
58
59
  rule:"SubQuery"
59
60
  };
60
61
  }
61
- return query;
62
+ group++
63
+ return {...query,group};
62
64
  }
63
65
  / NestedQuery
64
66
 
@@ -203,7 +205,8 @@ OrListOfValues
203
205
  rule:"OrListOfValues"
204
206
  };
205
207
  }
206
- return (field) => buildFunctionNode('or', [partialLeft(field), partialRight(field)]);
208
+ group++
209
+ return (field) => ({...buildFunctionNode('or', [partialLeft(field), partialRight(field)]),group});
207
210
  }
208
211
  / AndListOfValues
209
212
 
@@ -217,7 +220,8 @@ AndListOfValues
217
220
  rule:"AndListOfValues"
218
221
  };
219
222
  }
220
- return (field) => buildFunctionNode('and', [partialLeft(field), partialRight(field)]);
223
+ group++
224
+ return (field) => ({...buildFunctionNode('and', [partialLeft(field), partialRight(field)]),group});
221
225
  }
222
226
  / NotListOfValues
223
227