@luzmo/analytics-components-kit 1.0.1-alpha.44 → 1.0.1-alpha.46
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/components/grid/grid.d.ts +2 -1
- package/components/grid/index.cjs +3 -3
- package/components/grid/index.js +117 -109
- package/custom-elements.json +2 -4
- package/package.json +1 -1
@@ -100,7 +100,7 @@ export declare class LuzmoGrid extends LuzmoElement {
|
|
100
100
|
/**
|
101
101
|
* Grid options configuration
|
102
102
|
*/
|
103
|
-
theme
|
103
|
+
theme?: any;
|
104
104
|
/**
|
105
105
|
* Items to add to the grid
|
106
106
|
*/
|
@@ -118,6 +118,7 @@ export declare class LuzmoGrid extends LuzmoElement {
|
|
118
118
|
private _activeItemActionToggle?;
|
119
119
|
private _focusedItemElement?;
|
120
120
|
private _fullTheme?;
|
121
|
+
private _hasItemAdded;
|
121
122
|
private _loadTheme;
|
122
123
|
firstUpdated(): void;
|
123
124
|
disconnectedCallback(): void;
|
@@ -264,11 +264,11 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
264
264
|
>
|
265
265
|
`:f.x``}willUpdate(e){e.has("language")&&this.language!==ge.getLocale()&&([...ge.targetLocales].includes(this.language??"en")||this.language==="en")&&ge.setLocale(this.language)}render(){const e=this.actions.map(t=>this._generateActionGroup(t));return f.x`
|
266
266
|
<div class="action-buttons" tabindex="0">${e}</div>
|
267
|
-
`}};ti([f.n({type:String,reflect:!0})],exports.LuzmoGridItemActionsMenu.prototype,"placement",2);ti([f.n({type:Array})],exports.LuzmoGridItemActionsMenu.prototype,"actions",2);ti([f.n({type:String})],exports.LuzmoGridItemActionsMenu.prototype,"language",2);exports.LuzmoGridItemActionsMenu=ti([On.localized()],exports.LuzmoGridItemActionsMenu);const ld=':host{display:block;width:100
|
267
|
+
`}};ti([f.n({type:String,reflect:!0})],exports.LuzmoGridItemActionsMenu.prototype,"placement",2);ti([f.n({type:Array})],exports.LuzmoGridItemActionsMenu.prototype,"actions",2);ti([f.n({type:String})],exports.LuzmoGridItemActionsMenu.prototype,"language",2);exports.LuzmoGridItemActionsMenu=ti([On.localized()],exports.LuzmoGridItemActionsMenu);const ld=':host{display:block;width:100%}.grid-stack{width:100%;min-height:var(--luzmo-grid-min-height);position:relative;background:var(--luzmo-grid-background, var(--grid-background, var(--luzmo-background-color)))}.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-stack-item-content,.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-item-actions-popover{opacity:.5}.grid-stack .grid-stack-item[active]>.ui-resizable-handle,.grid-stack .grid-stack-item[active].ui-resizable-autohide>.ui-resizable-handle{display:block}.grid-stack .grid-stack-item.ui-resizable-resizing,.grid-stack .grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{opacity:var(--luzmo-grid-item-resizing-opacity, .8)!important}.grid-item-drag-handle{position:absolute;color:var(--luzmo-grid-item-drag-handle-color, #000);top:var(--luzmo-grid-item-drag-handle-position-top, 0);left:var(--luzmo-grid-item-drag-handle-position-left, 0);right:var(--luzmo-grid-item-drag-handle-position-right, auto);bottom:var(--luzmo-grid-item-drag-handle-position-bottom, auto);padding:var(--luzmo-grid-item-drag-handle-padding, .5rem);z-index:var(--luzmo-grid-item-drag-handle-z-index, 3);cursor:var(--luzmo-grid-item-drag-handle-cursor, move)}.grid-stack[dark-background] .grid-item-drag-handle{color:var(--luzmo-grid-item-drag-handle-color, #fff)}.grid-stack .grid-stack-item .grid-stack-item-content{overflow:hidden;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));background:var(--luzmo-grid-item-background, var(--grid-item-background, transparent));box-shadow:var(--luzmo-grid-item-box-shadow, var(--grid-item-box-shadow, none));border-style:var(--luzmo-grid-item-border-style, none);border-color:var(--luzmo-grid-item-border-color, transparent);-webkit-backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none);backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none)}.grid-stack .grid-stack-item:not(.has-luzmo-viz-item) .grid-stack-item-content{border-style:var(--luzmo-grid-item-border-style, var(--grid-item-border-style, none));border-color:var(--luzmo-grid-item-border-color, var(--grid-item-border-color, transparent));border-width:var(--luzmo-grid-item-border-width, var(--grid-item-border-width, 0));border-top-width:var(--luzmo-grid-item-border-top-width, var(--grid-item-border-top-width, 0));border-right-width:var(--luzmo-grid-item-border-right-width, var(--grid-item-border-right-width, 0));border-bottom-width:var(--luzmo-grid-item-border-bottom-width, var(--grid-item-border-bottom-width, 0));border-left-width:var(--luzmo-grid-item-border-left-width, var(--grid-item-border-left-width, 0))}.grid-stack .grid-stack-placeholder>.placeholder-content{border-radius:var(--grid-item-border-radius, 4px)}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{display:block!important;position:absolute!important;z-index:var(--luzmo-grid-resize-handle-z-index, 100);background:var(--luzmo-grid-resize-handle-background, #fff);border-radius:var(--luzmo-grid-resize-handle-border-radius, 3px);opacity:var(--luzmo-grid-resize-handle-opacity, 0);transition:var(--luzmo-grid-resize-handle-transition, opacity .2s ease);box-shadow:0 0 6px #0000001a,0 0 2px #000000bf}:host .grid-stack[dark-background]>.grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack[dark-background]>.grid-stack-item:hover>.ui-resizable-handle{background:var(--luzmo-grid-resize-handle-background, #333);box-shadow:0 0 6px #ffffff1a,0 0 2px #ffffffbf}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{opacity:var(--luzmo-grid-resize-handle-opacity-hover, 1)}:host .grid-stack-item>.ui-resizable-handle:hover{opacity:var(--luzmo-grid-resize-handle-opacity-active, 1);background:var(--luzmo-grid-resize-handle-background-hover, var(--luzmo-background-color-highlight))}:host .grid-stack-item>.ui-resizable-n,:host .grid-stack-item>.ui-resizable-s{height:var(--luzmo-grid-resize-handle-edge-size, 8px);width:var(--luzmo-grid-resize-handle-side-size, 18px);left:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-n{cursor:n-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-top, 0px))}:host .grid-stack-item>.ui-resizable-s{cursor:s-resize;bottom:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-e,:host .grid-stack-item>.ui-resizable-w{width:var(--luzmo-grid-resize-handle-edge-size, 8px);height:var(--luzmo-grid-resize-handle-side-size, 18px);top:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-e{cursor:e-resize;right:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-w{cursor:w-resize;left:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-ne,:host .grid-stack-item>.ui-resizable-nw,:host .grid-stack-item>.ui-resizable-se,:host .grid-stack-item>.ui-resizable-sw{transform:none;background-image:none;width:var(--luzmo-grid-resize-handle-corner-size, 12px);height:var(--luzmo-grid-resize-handle-corner-size, 12px)}:host .grid-stack-item>.ui-resizable-ne{cursor:ne-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));right:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-nw{cursor:nw-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));left:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-se{cursor:se-resize;right:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-right, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-sw{cursor:sw-resize;left:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-left, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-resizing .ui-resizable-handle{opacity:1!important;background:var(--luzmo-grid-resize-handle-background-active, var(--luzmo-background-color-highlight))}.grid-item-actions-popover{position:absolute;outline:none;border:none;padding:0;margin:0;z-index:2;overflow:visible;background:transparent}luzmo-grid-item-actions-menu{padding:var(--luzmo-grid-item-actions-padding, var(--grid-item-actions-padding))}.dimensions-hint-popover{font-size:var(--luzmo-grid-item-dimensions-hint-font-size, var(--luzmo-font-size-xs, 10px));font-family:var(--luzmo-grid-item-dimensions-hint-font-family, var(--luzmo-font-family, inherit));position:absolute;outline:none;border-width:var(--luzmo-grid-item-dimensions-hint-border-width, var(--luzmo-border-width));border-style:solid;border-color:var(--luzmo-grid-item-dimensions-hint-border-color, var(--luzmo-border-color));border-radius:var(--luzmo-grid-item-dimensions-hint-border-radius, var(--luzmo-border-radius));padding:var(--luzmo-grid-item-dimensions-hint-padding, var(--luzmo-spacing-1) var(--luzmo-spacing-2));margin:0;z-index:3;overflow:visible;background:var(--luzmo-grid-item-dimensions-hint-background, var(--luzmo-background-color));color:var(--luzmo-grid-item-dimensions-hint-color, var(--luzmo-font-color));pointer-events:none}luzmo-grid-item-actions-menu{--grid-item-actions-padding: 0 .75rem}luzmo-grid-item-actions-menu[placement=top-start],luzmo-grid-item-actions-menu[placement=top],luzmo-grid-item-actions-menu[placement=top-end],luzmo-grid-item-actions-menu[placement=bottom-start],luzmo-grid-item-actions-menu[placement=bottom],luzmo-grid-item-actions-menu[placement=bottom-end]{--grid-item-actions-padding: .75rem 0}.grid-stack-item:focus-visible{outline:none}.grid-stack-item:focus-visible .grid-stack-item-content:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;border:var(--luzmo-indicator-width) solid var(--luzmo-indicator-color, var(--luzmo-primary));box-sizing:border-box;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));z-index:2}';var dd=Object.defineProperty,B=(s,e,t,i)=>{for(var r=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=o(e,t,r)||r);return r&&dd(e,t,r),r};class N extends kr.It{constructor(){super(...arguments),this.appServer="https://app.luzmo.com/",this.apiHost="https://api.luzmo.com",this.language="en",this.contentLanguage="en",this.columns=48,this.rowHeight=16,this.viewMode=!1,this.placementItemActionsMenu="right-start",this.items=[],this.renderers={},this._initialized=!1,this.defaultRenderer=(e,t)=>f.x`
|
268
268
|
<div class="grid-item-content">
|
269
269
|
<div class="grid-item-type">${e.type}</div>
|
270
270
|
</div>
|
271
|
-
`,this._handleMouseout=e=>{if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");if(!i)return;const r=e.relatedTarget;r!=null&&r.closest(".grid-item-actions-popover")||i.hasAttribute("active")||this._removeItemActionsMenuPopover(i)},this._handleKeyDown=e=>{if(!this.viewMode){if(e.key==="Delete"&&this._focusedItemElement)this._handleDeleteItem(new Event("delete"));else if(e.key==="Escape"&&this._focusedItemElement)this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus();else if(e.key==="Enter"&&this._focusedItemElement)e.preventDefault(),e.stopPropagation(),this._activeItemElement&&(this._activeItemElement.removeAttribute("active"),this._gridElement.removeAttribute("has-active-item"),this._removeItemActionsMenuPopover(this._activeItemElement),this._activeItemElement=void 0),this._gridElement.querySelectorAll(".grid-stack-item").forEach(t=>{t!==this._focusedItemElement&&this._removeItemActionsMenuPopover(t)}),this._createItemActionsMenuPopover(this._focusedItemElement),requestAnimationFrame(()=>{var i;const t=(i=this._focusedItemElement)==null?void 0:i.querySelector("luzmo-grid-item-actions-menu");t&&t.focus()});else if(this._focusedItemElement&&this._grid&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){e.preventDefault(),e.stopPropagation();const t=this._focusedItemElement.gridstackNode;if(!t)return;const i=this.columns??48,n={ArrowLeft:{move:{x:t.x-1},resize:{x:t.x-1,w:t.w+1},shrink:{w:t.w-1},canMove:t.x>0,canResize:t.x>0,canShrink:t.w>1},ArrowRight:{move:{x:t.x+1},resize:{w:t.w+1},shrink:{x:t.x+1,w:t.w-1},canMove:t.x<i-t.w,canResize:t.x+t.w<i,canShrink:t.w>1},ArrowUp:{move:{y:t.y-1},resize:{y:t.y-1,h:t.h+1},shrink:{h:t.h-1},canMove:t.y>0,canResize:t.y>0,canShrink:t.h>1},ArrowDown:{move:{y:t.y+1},resize:{h:t.h+1},shrink:{y:t.y+1,h:t.h-1},canMove:!0,canResize:!0,canShrink:t.h>1}}[e.key];let o=null;e.shiftKey&&n.canResize?o=n.resize:(e.ctrlKey||e.metaKey)&&n.canShrink?o=n.shrink:n.canMove&&(o=n.move),o&&this._grid.update(this._focusedItemElement,o)}}},this._handleFocus=e=>{const i=e.target.closest(".grid-stack-item");i&&(this._focusedItemElement&&this._focusedItemElement!==i&&(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement)),this._focusedItemElement=i,i.setAttribute("focused","true"))},this._handleBlur=e=>{if(!this._focusedItemElement)return;const t=e.relatedTarget;t!=null&&t.closest("luzmo-grid-item-actions-menu")||(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus())},this._handleDocumentClick=e=>{const t=e.composedPath(),i=this._gridElement.querySelector(".grid-stack-item[active]");if(!i||t.includes(i))return;const r=i.querySelector(".grid-item-actions-popover");r&&t.includes(r)||this._cleanupActiveItem(i)},this._handleAction=e=>{var n,o;const t=e.detail,i=(n=e.target)==null?void 0:n.closest(".grid-stack-item");if(!i)return;const r=i.getAttribute("gs-id");if(t.type==="toggle"&&t.action===this._activeItemActionToggle&&i===this._activeItemElement){this._activeItemElement=void 0,this._activeItemActionToggle=void 0,(o=this._gridElement)==null||o.removeAttribute("has-active-item"),i.removeAttribute("active"),this._cleanupActiveItem(i);return}if(!["delete","clone"].includes(t.action)){this._gridElement.querySelectorAll(".grid-stack-item").forEach(l=>{l!==i&&this._cleanupActiveItem(l)}),t.type==="toggle"&&(this._activeItemElement=i,this._activeItemActionToggle=t.action,this._gridElement.setAttribute("has-active-item","true"),i.setAttribute("active","true"));const a=this.items.find(l=>l.id===r);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,element:i,id:r,type:a==null?void 0:a.type,slots:a==null?void 0:a.slots,options:a==null?void 0:a.options,filters:(a==null?void 0:a.filters)??[]},bubbles:!0,composed:!0,cancelable:!0}))}t.action==="delete"?(this._handleDeleteItem(e),this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,deletedId:r},bubbles:!0,composed:!0,cancelable:!0}))):t.action==="clone"&&this._handleCloneItem(e)},this._handleDeleteItem=e=>{var i;const t=((i=e.target)==null?void 0:i.closest(".grid-stack-item"))||this._focusedItemElement;t&&this.removeGridItemById(t.getAttribute("gs-id")||"")},this._handleCloneItem=e=>{const i=e.target.closest(".grid-stack-item");if(!i||!this._grid)return;const r=i.getAttribute("gs-id");if(!r)return;const n=this.items.find(l=>l.id===r);if(!n)return;const o={...structuredClone(n),id:nt()},a=this.addGridItem(o);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:"clone",items:this.items,originalElement:i,element:a,id:o.id,type:o.type,slots:o.slots,options:o.options,filters:o.filters},bubbles:!0,composed:!0}))}}static get styles(){return[f.r(Zl),f.r(ld)]}async _loadTheme(e){var t,i,r,n,o,a,l;(e==null?void 0:e.type)==="custom"?this._fullTheme=structuredClone(e):e!=null&&e.id&&si.systemThemeIds.includes(e.id)&&((t=this._fullTheme)==null?void 0:t.id)!==e.id?(this._fullTheme=await si.getTheme(e.id),this._fullTheme.id=e.id):e!=null&&e.id&&((i=this._fullTheme)==null?void 0:i.id)!==e.id||!e&&this._fullTheme||(this._fullTheme=await si.getTheme("default")),this._initialized&&this._updateThemeProperties(),!this._initialized&&this._gridElement&&this._initializeGrid(),this._grid&&((l=this._grid)==null||l.margin([(((n=(r=this.theme)==null?void 0:r.margins)==null?void 0:n[0])??16)/2,(((a=(o=this.theme)==null?void 0:o.margins)==null?void 0:a[1])??16)/2].join(" "))),this.requestUpdate()}firstUpdated(){document.addEventListener("click",this._handleDocumentClick),this.addEventListener("keydown",this._handleKeyDown),this._loadTheme(this.theme)}disconnectedCallback(){super.disconnectedCallback(),this._cleanup(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("keydown",this._handleKeyDown)}willUpdate(e){var i,r,n,o,a,l;super.willUpdate(e),e.has("_initialized")&&(this._updateThemeProperties(),this._initialized&&this._grid&&((i=this._fullTheme)!=null&&i.margins)&&((l=this._grid)==null||l.margin([(((n=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:n[0])??16)/2,(((a=(o=this._fullTheme)==null?void 0:o.margins)==null?void 0:a[1])??16)/2].join(" "))))}updated(e){var o,a,l;super.updated(e);const t=e.has("contentLanguage"),i=e.has("viewMode"),r=e.has("items"),n=e.has("theme");this.items.forEach(d=>{d.id=d.id??nt()}),this._initialized&&this._grid&&r&&((o=this._grid)==null||o.setAnimation(!1),(a=this._grid)==null||a.batchUpdate(),(l=this._grid)==null||l.removeAll(!1),this.items.forEach(d=>{var h,u,g,m,b,y,w;const c=[...this._gridItemElements].find(_=>_.getAttribute("luzmo-grid-item-id")===d.id);c&&((b=this._grid)==null||b.makeWidget(c,{x:((h=d==null?void 0:d.position)==null?void 0:h.col)??0,y:((u=d==null?void 0:d.position)==null?void 0:u.row)??0,w:((g=d==null?void 0:d.position)==null?void 0:g.sizeX)??1,h:((m=d==null?void 0:d.position)==null?void 0:m.sizeY)??1,id:d.id}),(y=this._grid)==null||y.batchUpdate(!1),(w=this._grid)==null||w.setAnimation(!0))})),t&&this._updateLuzmoVizItemsLanguage(),this._initialized&&this._grid&&i&&this.viewMode!==e.get("viewMode")&&(this.viewMode?(this._grid.disable(),this._activeItemElement&&(this._cleanupActiveItem(this._activeItemElement),this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item"))):this._grid.enable()),n&&this._loadTheme(this.theme)}_updateLuzmoVizItemsLanguage(){this._gridItemElements.forEach(e=>{const t=e.querySelector("luzmo-embed-viz-item");t&&(t.options={...t.options,locale:this.contentLanguage})})}_handleMouseover(e){if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");i&&this._createItemActionsMenuPopover(i)}_cleanupActiveItem(e){e.removeAttribute("active"),this._activeItemElement===e&&(this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item")),this._removeItemActionsMenuPopover(e)}_cleanup(){for(const e of this._gridItemElements)this._cleanupActiveItem(e);this._grid&&(this._grid.destroy(),this._grid=void 0),this._initialized=!1}_initializeGrid(){var t,i,r,n,o,a,l,d;if(this._initialized||!this._gridElement)return;const e={column:this.columns??48,cellHeight:this.rowHeight??16,marginTop:(((i=(t=this._fullTheme)==null?void 0:t.margins)==null?void 0:i[0])??16)/2,marginLeft:(((n=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:n[1])??16)/2,marginRight:(((a=(o=this._fullTheme)==null?void 0:o.margins)==null?void 0:a[1])??16)/2,marginBottom:(((d=(l=this._fullTheme)==null?void 0:l.margins)==null?void 0:d[0])??16)/2,animate:!0,auto:!1,float:!1,removable:!1,acceptWidgets:!0,disableDrag:this.viewMode,disableResize:this.viewMode,resizable:{handles:["n","ne","e","se","s","sw","w","nw"].join(", ")},handle:".grid-item-drag-handle"};this._grid=z.init(e,this._gridElement),this._grid.batchUpdate(),this._gridItemElements.forEach(c=>{var m,b,y,w,_;const h=c.getAttribute("luzmo-grid-item-id"),u=this.items.find(x=>x.id===h),g={id:h,x:((m=u==null?void 0:u.position)==null?void 0:m.col)??0,y:((b=u==null?void 0:u.position)==null?void 0:b.row)??0,w:((y=u==null?void 0:u.position)==null?void 0:y.sizeX)??1,h:((w=u==null?void 0:u.position)==null?void 0:w.sizeY)??1};(_=this._grid)==null||_.makeWidget(c,g)}),this._grid.batchUpdate(!1),this._initialized=!0,this._grid.on("resizestart",(c,h)=>{const u=h.getAttribute("gs-w")??"",g=h.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(h,u,g)}),this._grid.on("resize",(c,h)=>{const u=h.getAttribute("gs-w")??"",g=h.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(h,u,g)}),this._grid.on("resizestop",(c,h)=>{this._removeDimensionsHint(h)}),this._grid.on("change",(c,h)=>{h.forEach(u=>{if(!(u!=null&&u.id))return;const g=this.items.findIndex(m=>m.id===u.id);g!==-1&&(this.items[g]={...this.items[g],position:{sizeX:u.w??1,sizeY:u.h??1,row:u.y??0,col:u.x??0}})}),this.dispatchEvent(new CustomEvent("grid-changed",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}),this.dispatchEvent(new CustomEvent("grid-ready",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}_createOrUpdateDimensionsHint(e,t,i){var l,d;const r=e.querySelector(".dimensions-hint-popover");if(r){r.style.display=t.length>0&&i.length>0?"block":"none",r.textContent=`${t} × ${i}`;return}const n=document.createElement("div");n.className="dimensions-hint-popover",n.setAttribute("popover","hint"),n.style.display=t.length>0&&i.length>0?"block":"none",n.textContent=`${t} × ${i}`,e.append(n);const o=10-(((d=(l=this.theme)==null?void 0:l.margins)==null?void 0:d[0])??10),a=ts(e,n,async()=>{const{x:c,y:h}=await rs(e,n,{placement:"bottom",middleware:[is(o),ss()]});n.style.left=`${c}px`,n.style.top=`${h}px`});n._cleanup=a,n.matches(":popover-open")||n.showPopover()}_removeDimensionsHint(e){const t=e.querySelector(".dimensions-hint-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}get grid(){return this._grid}get gridItems(){return this.items.map(e=>{var r;const t={item:e,element:this._gridElement.querySelector(`[gs-id="${e.id}"]`)},i=(r=t.element)==null?void 0:r.querySelector("luzmo-embed-viz-item");return i&&(t.luzmoElement=i),t})}registerRenderer(e,t){this.renderers={...this.renderers,[e]:t}}_renderOverlayContent(e){let t=wr(e==null?void 0:e.actionsMenu)??wr(this.defaultItemActionsMenu)??An();const i=Hn.itemTypes.find(r=>r.type===(e==null?void 0:e.type));return!(i!=null&&i.containsData)&&!(e!=null&&e.actionsMenu)&&!this.defaultItemActionsMenu&&(t=t.map(r=>{var n;return{...r,actions:(n=r.actions)==null?void 0:n.filter(o=>o.action!=="edit-data")}})),f.x`
|
271
|
+
`,this._hasItemAdded=!1,this._handleMouseout=e=>{if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");if(!i)return;const r=e.relatedTarget;r!=null&&r.closest(".grid-item-actions-popover")||i.hasAttribute("active")||this._removeItemActionsMenuPopover(i)},this._handleKeyDown=e=>{if(!this.viewMode){if(e.key==="Delete"&&this._focusedItemElement)this._handleDeleteItem(new Event("delete"));else if(e.key==="Escape"&&this._focusedItemElement)this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus();else if(e.key==="Enter"&&this._focusedItemElement)e.preventDefault(),e.stopPropagation(),this._activeItemElement&&(this._activeItemElement.removeAttribute("active"),this._gridElement.removeAttribute("has-active-item"),this._removeItemActionsMenuPopover(this._activeItemElement),this._activeItemElement=void 0),this._gridElement.querySelectorAll(".grid-stack-item").forEach(t=>{t!==this._focusedItemElement&&this._removeItemActionsMenuPopover(t)}),this._createItemActionsMenuPopover(this._focusedItemElement),requestAnimationFrame(()=>{var i;const t=(i=this._focusedItemElement)==null?void 0:i.querySelector("luzmo-grid-item-actions-menu");t&&t.focus()});else if(this._focusedItemElement&&this._grid&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){e.preventDefault(),e.stopPropagation();const t=this._focusedItemElement.gridstackNode;if(!t)return;const i=this.columns??48,n={ArrowLeft:{move:{x:t.x-1},resize:{x:t.x-1,w:t.w+1},shrink:{w:t.w-1},canMove:t.x>0,canResize:t.x>0,canShrink:t.w>1},ArrowRight:{move:{x:t.x+1},resize:{w:t.w+1},shrink:{x:t.x+1,w:t.w-1},canMove:t.x<i-t.w,canResize:t.x+t.w<i,canShrink:t.w>1},ArrowUp:{move:{y:t.y-1},resize:{y:t.y-1,h:t.h+1},shrink:{h:t.h-1},canMove:t.y>0,canResize:t.y>0,canShrink:t.h>1},ArrowDown:{move:{y:t.y+1},resize:{h:t.h+1},shrink:{y:t.y+1,h:t.h-1},canMove:!0,canResize:!0,canShrink:t.h>1}}[e.key];let o=null;e.shiftKey&&n.canResize?o=n.resize:(e.ctrlKey||e.metaKey)&&n.canShrink?o=n.shrink:n.canMove&&(o=n.move),o&&this._grid.update(this._focusedItemElement,o)}}},this._handleFocus=e=>{const i=e.target.closest(".grid-stack-item");i&&(this._focusedItemElement&&this._focusedItemElement!==i&&(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement)),this._focusedItemElement=i,i.setAttribute("focused","true"))},this._handleBlur=e=>{if(!this._focusedItemElement)return;const t=e.relatedTarget;t!=null&&t.closest("luzmo-grid-item-actions-menu")||(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus())},this._handleDocumentClick=e=>{const t=e.composedPath(),i=this._gridElement.querySelector(".grid-stack-item[active]");if(!i||t.includes(i))return;const r=i.querySelector(".grid-item-actions-popover");r&&t.includes(r)||this._cleanupActiveItem(i)},this._handleAction=e=>{var n,o;const t=e.detail,i=(n=e.target)==null?void 0:n.closest(".grid-stack-item");if(!i)return;const r=i.getAttribute("gs-id");if(t.type==="toggle"&&t.action===this._activeItemActionToggle&&i===this._activeItemElement){this._activeItemElement=void 0,this._activeItemActionToggle=void 0,(o=this._gridElement)==null||o.removeAttribute("has-active-item"),i.removeAttribute("active"),this._cleanupActiveItem(i);return}if(!["delete","clone"].includes(t.action)){this._gridElement.querySelectorAll(".grid-stack-item").forEach(l=>{l!==i&&this._cleanupActiveItem(l)}),t.type==="toggle"&&(this._activeItemElement=i,this._activeItemActionToggle=t.action,this._gridElement.setAttribute("has-active-item","true"),i.setAttribute("active","true"));const a=this.items.find(l=>l.id===r);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,element:i,id:r,type:a==null?void 0:a.type,slots:a==null?void 0:a.slots,options:a==null?void 0:a.options,filters:(a==null?void 0:a.filters)??[]},bubbles:!0,composed:!0,cancelable:!0}))}t.action==="delete"?(this._handleDeleteItem(e),this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,deletedId:r},bubbles:!0,composed:!0,cancelable:!0}))):t.action==="clone"&&this._handleCloneItem(e)},this._handleDeleteItem=e=>{var i;const t=((i=e.target)==null?void 0:i.closest(".grid-stack-item"))||this._focusedItemElement;t&&this.removeGridItemById(t.getAttribute("gs-id")||"")},this._handleCloneItem=e=>{const i=e.target.closest(".grid-stack-item");if(!i||!this._grid)return;const r=i.getAttribute("gs-id");if(!r)return;const n=this.items.find(l=>l.id===r);if(!n)return;const o={...structuredClone(n),id:nt()},a=this.addGridItem(o);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:"clone",items:this.items,originalElement:i,element:a,id:o.id,type:o.type,slots:o.slots,options:o.options,filters:o.filters},bubbles:!0,composed:!0}))}}static get styles(){return[f.r(Zl),f.r(ld)]}async _loadTheme(e){var t,i,r,n,o,a,l;(e==null?void 0:e.type)==="custom"?this._fullTheme=structuredClone(e):e!=null&&e.id&&si.systemThemeIds.includes(e.id)&&((t=this._fullTheme)==null?void 0:t.id)!==e.id?(this._fullTheme=await si.getTheme(e.id),this._fullTheme.id=e.id):e!=null&&e.id&&((i=this._fullTheme)==null?void 0:i.id)!==e.id||!e&&this._fullTheme||(this._fullTheme=await si.getTheme("default")),this._initialized&&this._updateThemeProperties(),!this._initialized&&this._gridElement&&await requestAnimationFrame(()=>{this._initializeGrid()}),this._grid&&((l=this._grid)==null||l.margin([(((n=(r=this.theme)==null?void 0:r.margins)==null?void 0:n[0])??16)/2,(((a=(o=this.theme)==null?void 0:o.margins)==null?void 0:a[1])??16)/2].join(" "))),this.requestUpdate()}firstUpdated(){document.addEventListener("click",this._handleDocumentClick),this.addEventListener("keydown",this._handleKeyDown),this._loadTheme(this.theme)}disconnectedCallback(){super.disconnectedCallback(),this._cleanup(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("keydown",this._handleKeyDown)}willUpdate(e){var i,r,n,o,a,l;super.willUpdate(e),e.has("_initialized")&&(this._updateThemeProperties(),this._initialized&&this._grid&&((i=this._fullTheme)!=null&&i.margins)&&((l=this._grid)==null||l.margin([(((n=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:n[0])??16)/2,(((a=(o=this._fullTheme)==null?void 0:o.margins)==null?void 0:a[1])??16)/2].join(" "))))}updated(e){var o,a,l;super.updated(e);const t=e.has("contentLanguage"),i=e.has("viewMode"),r=e.has("items"),n=e.has("theme");this.items.forEach(d=>{d.id=d.id??nt()}),this._initialized&&this._grid&&(r||this._hasItemAdded)&&(this._hasItemAdded&&this._gridItemElements.forEach(d=>{d.hasAttribute("orphan")&&d.remove()}),this._hasItemAdded=!1,(o=this._grid)==null||o.setAnimation(!1),(a=this._grid)==null||a.batchUpdate(),(l=this._grid)==null||l.removeAll(!1),this.items.forEach(d=>{var h,u,g,m,b,y,w;const c=[...this._gridItemElements].find(_=>_.getAttribute("luzmo-grid-item-id")===d.id);c&&((b=this._grid)==null||b.makeWidget(c,{x:((h=d==null?void 0:d.position)==null?void 0:h.col)??0,y:((u=d==null?void 0:d.position)==null?void 0:u.row)??0,w:((g=d==null?void 0:d.position)==null?void 0:g.sizeX)??1,h:((m=d==null?void 0:d.position)==null?void 0:m.sizeY)??1,id:d.id}),(y=this._grid)==null||y.batchUpdate(!1),(w=this._grid)==null||w.setAnimation(!0))})),t&&this._updateLuzmoVizItemsLanguage(),this._initialized&&this._grid&&i&&this.viewMode!==e.get("viewMode")&&(this.viewMode?(this._grid.disable(),this._activeItemElement&&(this._cleanupActiveItem(this._activeItemElement),this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item"))):this._grid.enable()),n&&this._loadTheme(this.theme)}_updateLuzmoVizItemsLanguage(){this._gridItemElements.forEach(e=>{const t=e.querySelector("luzmo-embed-viz-item");t&&(t.options={...t.options,locale:this.contentLanguage})})}_handleMouseover(e){if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");i&&this._createItemActionsMenuPopover(i)}_cleanupActiveItem(e){e.removeAttribute("active"),this._activeItemElement===e&&(this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item")),this._removeItemActionsMenuPopover(e)}_cleanup(){for(const e of this._gridItemElements)this._cleanupActiveItem(e);this._grid&&(this._grid.destroy(),this._grid=void 0),this._initialized=!1}_initializeGrid(){var t,i,r,n,o,a,l,d;if(this._initialized||!this._gridElement)return;const e={column:this.columns??48,cellHeight:this.rowHeight??16,marginTop:(((i=(t=this._fullTheme)==null?void 0:t.margins)==null?void 0:i[0])??16)/2,marginLeft:(((n=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:n[1])??16)/2,marginRight:(((a=(o=this._fullTheme)==null?void 0:o.margins)==null?void 0:a[1])??16)/2,marginBottom:(((d=(l=this._fullTheme)==null?void 0:l.margins)==null?void 0:d[0])??16)/2,animate:!0,auto:!1,float:!1,removable:!1,acceptWidgets:!0,disableDrag:this.viewMode,disableResize:this.viewMode,minRow:1,resizable:{handles:["n","ne","e","se","s","sw","w","nw"].join(", ")},handle:".grid-item-drag-handle"};this._grid=z.init(e,this._gridElement),this._grid.batchUpdate(),this._gridItemElements.forEach(c=>{var m,b,y,w,_;const h=c.getAttribute("luzmo-grid-item-id"),u=this.items.find(x=>x.id===h),g={id:h,x:((m=u==null?void 0:u.position)==null?void 0:m.col)??0,y:((b=u==null?void 0:u.position)==null?void 0:b.row)??0,w:((y=u==null?void 0:u.position)==null?void 0:y.sizeX)??1,h:((w=u==null?void 0:u.position)==null?void 0:w.sizeY)??1};(_=this._grid)==null||_.makeWidget(c,g)}),this._grid.batchUpdate(!1),this._initialized=!0,this._grid.on("resizestart",(c,h)=>{const u=h.getAttribute("gs-w")??"",g=h.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(h,u,g)}),this._grid.on("resize",(c,h)=>{const u=h.getAttribute("gs-w")??"",g=h.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(h,u,g)}),this._grid.on("resizestop",(c,h)=>{this._removeDimensionsHint(h)}),this._grid.on("change",(c,h)=>{h.forEach(u=>{if(!(u!=null&&u.id))return;const g=this.items.findIndex(m=>m.id===u.id);g!==-1&&(this.items[g]={...this.items[g],position:{sizeX:u.w??1,sizeY:u.h??1,row:u.y??0,col:u.x??0}})}),this.dispatchEvent(new CustomEvent("grid-changed",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}),this.dispatchEvent(new CustomEvent("grid-ready",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}_createOrUpdateDimensionsHint(e,t,i){var l,d;const r=e.querySelector(".dimensions-hint-popover");if(r){r.style.display=t.length>0&&i.length>0?"block":"none",r.textContent=`${t} × ${i}`;return}const n=document.createElement("div");n.className="dimensions-hint-popover",n.setAttribute("popover","hint"),n.style.display=t.length>0&&i.length>0?"block":"none",n.textContent=`${t} × ${i}`,e.append(n);const o=10-(((d=(l=this.theme)==null?void 0:l.margins)==null?void 0:d[0])??10),a=ts(e,n,async()=>{const{x:c,y:h}=await rs(e,n,{placement:"bottom",middleware:[is(o),ss()]});n.style.left=`${c}px`,n.style.top=`${h}px`});n._cleanup=a,n.matches(":popover-open")||n.showPopover()}_removeDimensionsHint(e){const t=e.querySelector(".dimensions-hint-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}get grid(){return this._grid}get gridItems(){return this.items.map(e=>{var r;const t={item:e,element:this._gridElement.querySelector(`[gs-id="${e.id}"]`)},i=(r=t.element)==null?void 0:r.querySelector("luzmo-embed-viz-item");return i&&(t.luzmoElement=i),t})}registerRenderer(e,t){this.renderers={...this.renderers,[e]:t}}_renderOverlayContent(e){let t=wr(e==null?void 0:e.actionsMenu)??wr(this.defaultItemActionsMenu)??An();const i=Hn.itemTypes.find(r=>r.type===(e==null?void 0:e.type));return!(i!=null&&i.containsData)&&!(e!=null&&e.actionsMenu)&&!this.defaultItemActionsMenu&&(t=t.map(r=>{var n;return{...r,actions:(n=r.actions)==null?void 0:n.filter(o=>o.action!=="edit-data")}})),f.x`
|
272
272
|
<div class="grid-item-actions-popover" popover="manual">
|
273
273
|
<luzmo-grid-item-actions-menu
|
274
274
|
.actions=${t}
|
@@ -278,7 +278,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
278
278
|
>
|
279
279
|
</luzmo-grid-item-actions-menu>
|
280
280
|
</div>
|
281
|
-
`}_createItemActionsMenuPopover(e){let t=e.querySelector(".grid-item-actions-popover");const i=e.querySelector(".grid-stack-item-content"),r=this.getGridItemById(e.getAttribute("gs-id")??"");if(!t){const o=document.createDocumentFragment();f.B(this._renderOverlayContent(r==null?void 0:r.item),o),t=o.querySelector(".grid-item-actions-popover"),e.append(t)}const n=ts(i,t,async()=>{var l;const{x:o,y:a}=await rs(i,t,{placement:((l=r==null?void 0:r.item)==null?void 0:l.placementActionsMenu)??this.placementItemActionsMenu??"right-start",middleware:[is(0),ss({crossAxis:!1})]});t.style.left=`${o}px`,t.style.top=`${a}px`});t._cleanup=n,t.matches(":popover-open")||t.showPopover()}_removeItemActionsMenuPopover(e){const t=e.querySelector(".grid-item-actions-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}_updateThemeProperties(){var r,n,o,a,l,d,c,h,u,g,m,b,y,w,_,x,R,A,j,W,H;if(!this._fullTheme)return;const e=this._fullTheme.boxShadow;let t="";if(e){const G=new C(e.color),O={r:Math.round(G.srgb.r*255),g:Math.round(G.srgb.g*255),b:Math.round(G.srgb.b*255)},ue=((r=this._fullTheme.margins)==null?void 0:r[0])??16,$=Math.min(ue/10,2),oe=(I,me)=>me>=1?`rgba(${I.r},${I.g},${I.b},1)`:me<=0?`rgba(${I.r},${I.g},${I.b},0)`:`rgba(${I.r},${I.g},${I.b},${me})`;e.size==="none"?t="none":e.size==="S"?t=`0 ${$*2}px ${$*4}px ${oe(O,.16)}, 0 ${$*2}px ${$*4}px ${oe(O,.23)}`:e.size==="M"?t=`0 ${$*8}px ${$*16}px ${oe(O,.19)}, 0 ${$*4}px ${$*4}px ${oe(O,.23)}`:e.size==="L"&&(t=`0 ${$*12}px ${$*24}px ${oe(O,.25)}, 0 ${$*8}px ${$*8}px ${oe(O,.22)}`)}new Map([["--grid-font-family",(o=(n=this._fullTheme)==null?void 0:n.font)==null?void 0:o.fontFamily],["--grid-background",(a=this._fullTheme)==null?void 0:a.background],["--grid-item-box-shadow",t],["--grid-item-background",(l=this._fullTheme)==null?void 0:l.itemsBackground],["--grid-item-border-color",(c=(d=this._fullTheme)==null?void 0:d.borders)==null?void 0:c["border-color"]],["--grid-item-border-style",(u=(h=this._fullTheme)==null?void 0:h.borders)==null?void 0:u["border-style"]],["--grid-item-border-radius",(m=(g=this._fullTheme)==null?void 0:g.borders)==null?void 0:m["border-radius"]],["--grid-item-border-width",`${(y=(b=this._fullTheme)==null?void 0:b.borders)==null?void 0:y["border-top-width"]}`],["--grid-item-border-top-width",(_=(w=this._fullTheme)==null?void 0:w.borders)==null?void 0:_["border-top-width"]],["--grid-item-border-right-width",(R=(x=this._fullTheme)==null?void 0:x.borders)==null?void 0:R["border-right-width"]],["--grid-item-border-bottom-width",(j=(A=this._fullTheme)==null?void 0:A.borders)==null?void 0:j["border-bottom-width"]],["--grid-item-border-left-width",(H=(W=this._fullTheme)==null?void 0:W.borders)==null?void 0:H["border-left-width"]]]).forEach((G,O)=>{G?this.style.setProperty(O,G):this.style.removeProperty(O)})}getGridItemById(e){return this.gridItems.find(t=>t.item.id===e)}addGridItem(e){var a,l,d,c,h;const t={...structuredClone(e),id:nt(),position:structuredClone(e==null?void 0:e.position)??{sizeX:1,sizeY:1,col:0,row:0}};this.items.push(t);const i=this._renderItem(t,this.items.length),r=document.createDocumentFragment();f.B(i,r,{host:this}),this._gridElement.append(r);const n=this._gridElement.querySelector(`[luzmo-grid-item-id="${t.id}"]`),o={x:((a=t.position)==null?void 0:a.col)??0,y:((l=t.position)==null?void 0:l.row)??0,w:((d=t.position)==null?void 0:d.sizeX)??1,h:((c=t.position)==null?void 0:c.sizeY)??1,autoPosition:!0,id:t.id};return(h=this._grid)==null||h.makeWidget(n,o),this._activeItemElement&&this._cleanupActiveItem(this._activeItemElement),requestAnimationFrame(()=>{const u=n.getBoundingClientRect();(u.bottom>window.innerHeight||u.top<0)&&n.scrollIntoView({behavior:"smooth",block:"center"})}),n}removeGridItem(e){this.removeGridItemById((e==null?void 0:e.id)??"")}removeGridItemById(e){var r;if(!e)return;const t=(r=this.getGridItemById(e))==null?void 0:r.element;t&&this._grid&&(this._grid.removeWidget(t),this._focusedItemElement=void 0);const i=this.items.findIndex(n=>n.id===e);i!==-1&&this.items.splice(i,1),this._removeItemActionsMenuPopover(t),t&&this._activeItemElement===t&&this._cleanupActiveItem(t)}_renderItem(e,t){var n;const i={...e.options,locale:this.contentLanguage};i.theme||(i.theme=(n=this._fullTheme)!=null&&n.id?{id:this._fullTheme.id}:structuredClone(this._fullTheme));const r=!this.viewMode;return f.x`
|
281
|
+
`}_createItemActionsMenuPopover(e){let t=e.querySelector(".grid-item-actions-popover");const i=e.querySelector(".grid-stack-item-content"),r=this.getGridItemById(e.getAttribute("gs-id")??"");if(!t){const o=document.createDocumentFragment();f.B(this._renderOverlayContent(r==null?void 0:r.item),o),t=o.querySelector(".grid-item-actions-popover"),e.append(t)}const n=ts(i,t,async()=>{var l;const{x:o,y:a}=await rs(i,t,{placement:((l=r==null?void 0:r.item)==null?void 0:l.placementActionsMenu)??this.placementItemActionsMenu??"right-start",middleware:[is(0),ss({crossAxis:!1})]});t.style.left=`${o}px`,t.style.top=`${a}px`});t._cleanup=n,t.matches(":popover-open")||t.showPopover()}_removeItemActionsMenuPopover(e){const t=e.querySelector(".grid-item-actions-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}_updateThemeProperties(){var r,n,o,a,l,d,c,h,u,g,m,b,y,w,_,x,R,A,j,W,H;if(!this._fullTheme)return;const e=this._fullTheme.boxShadow;let t="";if(e){const G=new C(e.color),O={r:Math.round(G.srgb.r*255),g:Math.round(G.srgb.g*255),b:Math.round(G.srgb.b*255)},ue=((r=this._fullTheme.margins)==null?void 0:r[0])??16,$=Math.min(ue/10,2),oe=(I,me)=>me>=1?`rgba(${I.r},${I.g},${I.b},1)`:me<=0?`rgba(${I.r},${I.g},${I.b},0)`:`rgba(${I.r},${I.g},${I.b},${me})`;e.size==="none"?t="none":e.size==="S"?t=`0 ${$*2}px ${$*4}px ${oe(O,.16)}, 0 ${$*2}px ${$*4}px ${oe(O,.23)}`:e.size==="M"?t=`0 ${$*8}px ${$*16}px ${oe(O,.19)}, 0 ${$*4}px ${$*4}px ${oe(O,.23)}`:e.size==="L"&&(t=`0 ${$*12}px ${$*24}px ${oe(O,.25)}, 0 ${$*8}px ${$*8}px ${oe(O,.22)}`)}new Map([["--grid-font-family",(o=(n=this._fullTheme)==null?void 0:n.font)==null?void 0:o.fontFamily],["--grid-background",(a=this._fullTheme)==null?void 0:a.background],["--grid-item-box-shadow",t],["--grid-item-background",(l=this._fullTheme)==null?void 0:l.itemsBackground],["--grid-item-border-color",(c=(d=this._fullTheme)==null?void 0:d.borders)==null?void 0:c["border-color"]],["--grid-item-border-style",(u=(h=this._fullTheme)==null?void 0:h.borders)==null?void 0:u["border-style"]],["--grid-item-border-radius",(m=(g=this._fullTheme)==null?void 0:g.borders)==null?void 0:m["border-radius"]],["--grid-item-border-width",`${(y=(b=this._fullTheme)==null?void 0:b.borders)==null?void 0:y["border-top-width"]}`],["--grid-item-border-top-width",(_=(w=this._fullTheme)==null?void 0:w.borders)==null?void 0:_["border-top-width"]],["--grid-item-border-right-width",(R=(x=this._fullTheme)==null?void 0:x.borders)==null?void 0:R["border-right-width"]],["--grid-item-border-bottom-width",(j=(A=this._fullTheme)==null?void 0:A.borders)==null?void 0:j["border-bottom-width"]],["--grid-item-border-left-width",(H=(W=this._fullTheme)==null?void 0:W.borders)==null?void 0:H["border-left-width"]]]).forEach((G,O)=>{G?this.style.setProperty(O,G):this.style.removeProperty(O)})}getGridItemById(e){return this.gridItems.find(t=>t.item.id===e)}addGridItem(e){var a,l,d,c,h;!this._initialized&&this._gridElement&&console.warn("Grid is not initialized, wait for grid-ready event");const t={...structuredClone(e),id:nt(),position:structuredClone(e==null?void 0:e.position)??{sizeX:1,sizeY:1,col:0,row:0}};this.items.push(t);const i=this._renderItem(t,this.items.length),r=document.createDocumentFragment();f.B(i,r,{host:this}),this._gridElement.append(r);const n=this._gridElement.querySelector(`[luzmo-grid-item-id="${t.id}"]`);n.setAttribute("orphan","true");const o={x:((a=t.position)==null?void 0:a.col)??0,y:((l=t.position)==null?void 0:l.row)??0,w:((d=t.position)==null?void 0:d.sizeX)??1,h:((c=t.position)==null?void 0:c.sizeY)??1,autoPosition:!0,id:t.id};return(h=this._grid)==null||h.makeWidget(n,o),this._hasItemAdded=!0,this._activeItemElement&&this._cleanupActiveItem(this._activeItemElement),requestAnimationFrame(()=>{const u=n.getBoundingClientRect();(u.bottom>window.innerHeight||u.top<0)&&n.scrollIntoView({behavior:"smooth",block:"center"})}),n}removeGridItem(e){this.removeGridItemById((e==null?void 0:e.id)??"")}removeGridItemById(e){var r;if(!e)return;const t=(r=this.getGridItemById(e))==null?void 0:r.element;t&&this._grid&&(this._grid.removeWidget(t),this._focusedItemElement=void 0);const i=this.items.findIndex(n=>n.id===e);i!==-1&&this.items.splice(i,1),this._removeItemActionsMenuPopover(t),t&&this._activeItemElement===t&&this._cleanupActiveItem(t)}_renderItem(e,t){var n;const i={...e.options,locale:this.contentLanguage};i.theme||(i.theme=(n=this._fullTheme)!=null&&n.id?{id:this._fullTheme.id}:structuredClone(this._fullTheme));const r=!this.viewMode;return f.x`
|
282
282
|
<div
|
283
283
|
class="luzmo-grid-item has-luzmo-viz-item"
|
284
284
|
luzmo-grid-item-id=${e.id??nt()}
|
package/components/grid/index.js
CHANGED
@@ -237,7 +237,7 @@ const bn = async (i, e, t) => {
|
|
237
237
|
x: _,
|
238
238
|
y: z,
|
239
239
|
data: R,
|
240
|
-
reset:
|
240
|
+
reset: A
|
241
241
|
} = await w({
|
242
242
|
x: c,
|
243
243
|
y: h,
|
@@ -258,11 +258,11 @@ const bn = async (i, e, t) => {
|
|
258
258
|
...f[b],
|
259
259
|
...R
|
260
260
|
}
|
261
|
-
},
|
261
|
+
}, A && m <= 50 && (m++, typeof A == "object" && (A.placement && (u = A.placement), A.rects && (d = A.rects === !0 ? await n.getElementRects({
|
262
262
|
reference: i,
|
263
263
|
floating: e,
|
264
264
|
strategy: r
|
265
|
-
}) :
|
265
|
+
}) : A.rects), {
|
266
266
|
x: c,
|
267
267
|
y: h
|
268
268
|
} = is(d, u, l)), p = -1);
|
@@ -307,17 +307,17 @@ async function yn(i, e) {
|
|
307
307
|
} : {
|
308
308
|
x: 1,
|
309
309
|
y: 1
|
310
|
-
},
|
310
|
+
}, A = Ot(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
311
311
|
elements: a,
|
312
312
|
rect: _,
|
313
313
|
offsetParent: z,
|
314
314
|
strategy: l
|
315
315
|
}) : _);
|
316
316
|
return {
|
317
|
-
top: (w.top -
|
318
|
-
bottom: (
|
319
|
-
left: (w.left -
|
320
|
-
right: (
|
317
|
+
top: (w.top - A.top + m.top) / R.y,
|
318
|
+
bottom: (A.bottom - w.bottom + m.bottom) / R.y,
|
319
|
+
left: (w.left - A.left + m.left) / R.x,
|
320
|
+
right: (A.right - w.right + m.right) / R.x
|
321
321
|
};
|
322
322
|
}
|
323
323
|
const vn = function(i) {
|
@@ -344,9 +344,9 @@ const vn = function(i) {
|
|
344
344
|
} = Oi(i, e);
|
345
345
|
if ((t = o.arrow) != null && t.alignmentOffset)
|
346
346
|
return {};
|
347
|
-
const w = Je(r), _ = Oe(a), z = Je(a) === a, R = await (l.isRTL == null ? void 0 : l.isRTL(d.floating)),
|
348
|
-
!u && V &&
|
349
|
-
const F = [a, ...
|
347
|
+
const w = Je(r), _ = Oe(a), z = Je(a) === a, R = await (l.isRTL == null ? void 0 : l.isRTL(d.floating)), A = u || (z || !p ? [Ht(a)] : un(a)), V = m !== "none";
|
348
|
+
!u && V && A.push(...fn(a, p, m, R));
|
349
|
+
const F = [a, ...A], H = await yn(e, b), U = [];
|
350
350
|
let O = ((s = o.flip) == null ? void 0 : s.overflows) || [];
|
351
351
|
if (c && U.push(H[w]), h) {
|
352
352
|
const T = hn(r, n, R);
|
@@ -678,7 +678,7 @@ function Sn(i) {
|
|
678
678
|
y: a
|
679
679
|
};
|
680
680
|
}
|
681
|
-
function
|
681
|
+
function An(i, e) {
|
682
682
|
const t = se(i), s = we(i), r = t.visualViewport;
|
683
683
|
let o = s.clientWidth, n = s.clientHeight, a = 0, l = 0;
|
684
684
|
if (r) {
|
@@ -693,7 +693,7 @@ function Cn(i, e) {
|
|
693
693
|
y: l
|
694
694
|
};
|
695
695
|
}
|
696
|
-
function
|
696
|
+
function Cn(i, e) {
|
697
697
|
const t = $e(i, !0, e === "fixed"), s = t.top + i.clientTop, r = t.left + i.clientLeft, o = ve(i) ? Ve(i) : ye(1), n = i.clientWidth * o.x, a = i.clientHeight * o.y, l = r * o.x, d = s * o.y;
|
698
698
|
return {
|
699
699
|
width: n,
|
@@ -705,11 +705,11 @@ function An(i, e) {
|
|
705
705
|
function rs(i, e, t) {
|
706
706
|
let s;
|
707
707
|
if (e === "viewport")
|
708
|
-
s =
|
708
|
+
s = An(i, t);
|
709
709
|
else if (e === "document")
|
710
710
|
s = Sn(we(i));
|
711
711
|
else if (ce(e))
|
712
|
-
s =
|
712
|
+
s = Cn(e, t);
|
713
713
|
else {
|
714
714
|
const r = Or(i);
|
715
715
|
s = {
|
@@ -871,7 +871,7 @@ function Pn(i, e) {
|
|
871
871
|
threshold: qe(0, zi(1, l)) || 1
|
872
872
|
};
|
873
873
|
let R = !0;
|
874
|
-
function
|
874
|
+
function A(V) {
|
875
875
|
const F = V[0].intersectionRatio;
|
876
876
|
if (F !== l) {
|
877
877
|
if (!R)
|
@@ -883,13 +883,13 @@ function Pn(i, e) {
|
|
883
883
|
F === 1 && !Wr(d, i.getBoundingClientRect()) && n(), R = !1;
|
884
884
|
}
|
885
885
|
try {
|
886
|
-
t = new IntersectionObserver(
|
886
|
+
t = new IntersectionObserver(A, {
|
887
887
|
...z,
|
888
888
|
// Handle <iframe>s
|
889
889
|
root: r.ownerDocument
|
890
890
|
});
|
891
891
|
} catch {
|
892
|
-
t = new IntersectionObserver(
|
892
|
+
t = new IntersectionObserver(A, z);
|
893
893
|
}
|
894
894
|
t.observe(i);
|
895
895
|
}
|
@@ -1081,8 +1081,8 @@ ${i}`, console.warn(t));
|
|
1081
1081
|
const e = Math.random() * 16 | 0;
|
1082
1082
|
return (i == "x" ? e : e & 3 | 8).toString(16);
|
1083
1083
|
}), us = (i) => {
|
1084
|
-
const e = [], { appServer: t, language: s, editorLanguage: r, qeVersion: o, loaderBackground: n, loaderSpinnerColor: a, loaderSpinnerBackground: l, loaderFontColor: d, screenMode: c, key: h, token: u, timezoneId: f, itemEmbedding: m, itemDimensions: p, dashboardId: b, dashboardSlug: w, itemId: _, theme: z, mainColor: R, accentColor:
|
1085
|
-
s && s !== "auto" && e.push(`language=${s}`), r && r !== "auto" && e.push(`editorLanguage=${r}`), o && e.push(`qe_version=${o}`), n && e.push(`ldrbg=${n}`), d && e.push(`ldrftclr=${d}`), a && e.push(`ldrspclr=${a}`), l && e.push(`ldrspbg=${l}`), z && e.push(`theme=${z}`), R && e.push(`mainColor=${R}`),
|
1084
|
+
const e = [], { appServer: t, language: s, editorLanguage: r, qeVersion: o, loaderBackground: n, loaderSpinnerColor: a, loaderSpinnerBackground: l, loaderFontColor: d, screenMode: c, key: h, token: u, timezoneId: f, itemEmbedding: m, itemDimensions: p, dashboardId: b, dashboardSlug: w, itemId: _, theme: z, mainColor: R, accentColor: A, editMode: V } = i.params;
|
1085
|
+
s && s !== "auto" && e.push(`language=${s}`), r && r !== "auto" && e.push(`editorLanguage=${r}`), o && e.push(`qe_version=${o}`), n && e.push(`ldrbg=${n}`), d && e.push(`ldrftclr=${d}`), a && e.push(`ldrspclr=${a}`), l && e.push(`ldrspbg=${l}`), z && e.push(`theme=${z}`), R && e.push(`mainColor=${R}`), A && e.push(`accentColor=${A}`), c && c !== "auto" && e.push("screenMode=&{screenMode}"), f && e.push("timezoneId=" + f), m && p && p.width && e.push("width=" + p.width), m && p && p.height && e.push("height=" + p.height), V && e.push("editMode=" + V);
|
1086
1086
|
const F = h && u ? "#" + h + ":" + u : "";
|
1087
1087
|
e.push("version=" + (i.libVersion || Wn));
|
1088
1088
|
const H = m ? `${t}i/${b || w}/${_}?${encodeURIComponent(e.join("&"))}${F}` : `${t}i/${b || w}?${encodeURIComponent(e.join("&"))}${F}`;
|
@@ -1378,7 +1378,7 @@ const Yn = (i, e) => {
|
|
1378
1378
|
const [w] = e;
|
1379
1379
|
let _ = hs(w);
|
1380
1380
|
for (const z of b) {
|
1381
|
-
const R = e.find((
|
1381
|
+
const R = e.find((A) => A === z);
|
1382
1382
|
R ? _ = hs(R) : i.dimensions[z] = i.dimensions[_];
|
1383
1383
|
}
|
1384
1384
|
}
|
@@ -2763,13 +2763,13 @@ class ba {
|
|
2763
2763
|
});
|
2764
2764
|
}
|
2765
2765
|
}
|
2766
|
-
const
|
2767
|
-
var Sr,
|
2766
|
+
const Ae = new ba();
|
2767
|
+
var Sr, Ar, Cr, re = {
|
2768
2768
|
gamut_mapping: "css",
|
2769
2769
|
precision: 5,
|
2770
2770
|
deltaE: "76",
|
2771
2771
|
// Default deltaE method
|
2772
|
-
verbose: ((
|
2772
|
+
verbose: ((Cr = (Ar = (Sr = globalThis == null ? void 0 : globalThis.process) == null ? void 0 : Sr.env) == null ? void 0 : Ar.NODE_ENV) == null ? void 0 : Cr.toLowerCase()) !== "test",
|
2773
2773
|
warn: function(e) {
|
2774
2774
|
var t, s;
|
2775
2775
|
this.verbose && ((s = (t = globalThis == null ? void 0 : globalThis.console) == null ? void 0 : t.warn) == null || s.call(t, e));
|
@@ -2780,16 +2780,16 @@ const K = {
|
|
2780
2780
|
D50: [0.3457 / 0.3585, 1, (1 - 0.3457 - 0.3585) / 0.3585],
|
2781
2781
|
D65: [0.3127 / 0.329, 1, (1 - 0.3127 - 0.329) / 0.329]
|
2782
2782
|
};
|
2783
|
-
function
|
2783
|
+
function Ai(i) {
|
2784
2784
|
return Array.isArray(i) ? i : K[i];
|
2785
2785
|
}
|
2786
2786
|
function $t(i, e, t, s = {}) {
|
2787
|
-
if (i =
|
2787
|
+
if (i = Ai(i), e = Ai(e), !i || !e)
|
2788
2788
|
throw new TypeError(`Missing white point to convert ${i ? "" : "from"}${!i && !e ? "/" : ""}${e ? "" : "to"}`);
|
2789
2789
|
if (i === e)
|
2790
2790
|
return t;
|
2791
2791
|
let r = { W1: i, W2: e, XYZ: t, options: s };
|
2792
|
-
if (
|
2792
|
+
if (Ae.run("chromatic-adaptation-start", r), r.M || (r.W1 === K.D65 && r.W2 === K.D50 ? r.M = [
|
2793
2793
|
[1.0479297925449969, 0.022946870601609652, -0.05019226628920524],
|
2794
2794
|
[0.02962780877005599, 0.9904344267538799, -0.017073799063418826],
|
2795
2795
|
[-0.009243040646204504, 0.015055191490298152, 0.7518742814281371]
|
@@ -2797,7 +2797,7 @@ function $t(i, e, t, s = {}) {
|
|
2797
2797
|
[0.955473421488075, -0.02309845494876471, 0.06325924320057072],
|
2798
2798
|
[-0.0283697093338637, 1.0099953980813041, 0.021041441191917323],
|
2799
2799
|
[0.012314014864481998, -0.020507649298898964, 1.330365926242124]
|
2800
|
-
])),
|
2800
|
+
])), Ae.run("chromatic-adaptation-end", r), r.M)
|
2801
2801
|
return I(r.M, r.XYZ);
|
2802
2802
|
throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.");
|
2803
2803
|
}
|
@@ -2818,7 +2818,7 @@ function Es(i, e, t, s) {
|
|
2818
2818
|
function Zr(i, { meta: e } = {}) {
|
2819
2819
|
var s, r, o, n;
|
2820
2820
|
let t = { str: (s = String(i)) == null ? void 0 : s.trim() };
|
2821
|
-
if (
|
2821
|
+
if (Ae.run("parse-start", t), t.color)
|
2822
2822
|
return t.color;
|
2823
2823
|
if (t.parsed = qr(t.str), t.parsed) {
|
2824
2824
|
let a = t.parsed.name;
|
@@ -2882,7 +2882,7 @@ const va = 75e-6, J = class J {
|
|
2882
2882
|
"name" in t[o] || (t[o].name = o);
|
2883
2883
|
this.coords = t;
|
2884
2884
|
let s = e.white ?? this.base.white ?? "D65";
|
2885
|
-
this.white =
|
2885
|
+
this.white = Ai(s), this.formats = e.formats ?? {};
|
2886
2886
|
for (let o in this.formats) {
|
2887
2887
|
let n = this.formats[o];
|
2888
2888
|
n.type || (n.type = "function"), n.name || (n.name = o);
|
@@ -2895,7 +2895,7 @@ const va = 75e-6, J = class J {
|
|
2895
2895
|
writable: !1,
|
2896
2896
|
enumerable: !0,
|
2897
2897
|
configurable: !0
|
2898
|
-
}),
|
2898
|
+
}), Ae.run("colorspace-init-end", this);
|
2899
2899
|
}
|
2900
2900
|
inGamut(e, { epsilon: t = va } = {}) {
|
2901
2901
|
if (!this.equals(this.gamutSpace))
|
@@ -3248,7 +3248,7 @@ var ft = new x({
|
|
3248
3248
|
}
|
3249
3249
|
});
|
3250
3250
|
const Rs = 25 ** 7, Bt = Math.PI, Ss = 180 / Bt, Fe = Bt / 180;
|
3251
|
-
function
|
3251
|
+
function As(i) {
|
3252
3252
|
const e = i * i;
|
3253
3253
|
return e * e * e * i;
|
3254
3254
|
}
|
@@ -3256,11 +3256,11 @@ function Qr(i, e, { kL: t = 1, kC: s = 1, kH: r = 1 } = {}) {
|
|
3256
3256
|
[i, e] = S([i, e]);
|
3257
3257
|
let [o, n, a] = ie.from(i), l = ft.from(ie, [o, n, a])[1], [d, c, h] = ie.from(e), u = ft.from(ie, [d, c, h])[1];
|
3258
3258
|
l < 0 && (l = 0), u < 0 && (u = 0);
|
3259
|
-
let f = (l + u) / 2, m =
|
3260
|
-
R < 0 && (R += 2 * Bt),
|
3261
|
-
let V = d - o, F = z - _, H =
|
3259
|
+
let f = (l + u) / 2, m = As(f), p = 0.5 * (1 - Math.sqrt(m / (m + Rs))), b = (1 + p) * n, w = (1 + p) * c, _ = Math.sqrt(b ** 2 + a ** 2), z = Math.sqrt(w ** 2 + h ** 2), R = b === 0 && a === 0 ? 0 : Math.atan2(a, b), A = w === 0 && h === 0 ? 0 : Math.atan2(h, w);
|
3260
|
+
R < 0 && (R += 2 * Bt), A < 0 && (A += 2 * Bt), R *= Ss, A *= Ss;
|
3261
|
+
let V = d - o, F = z - _, H = A - R, U = R + A, O = Math.abs(H), me;
|
3262
3262
|
_ * z === 0 ? me = 0 : O <= 180 ? me = H : H > 180 ? me = H - 360 : H < -180 ? me = H + 360 : re.warn("the unthinkable has happened");
|
3263
|
-
let B = 2 * Math.sqrt(z * _) * Math.sin(me * Fe / 2), ae = (o + d) / 2, T = (_ + z) / 2, fe =
|
3263
|
+
let B = 2 * Math.sqrt(z * _) * Math.sin(me * Fe / 2), ae = (o + d) / 2, T = (_ + z) / 2, fe = As(T), Y;
|
3264
3264
|
_ * z === 0 ? Y = U : O <= 180 ? Y = U / 2 : U < 360 ? Y = (U + 360) / 2 : Y = (U - 360) / 2;
|
3265
3265
|
let ge = (ae - 50) ** 2, Q = 1 + 0.015 * ge / Math.sqrt(20 + ge), le = 1 + 0.045 * T, Le = 1;
|
3266
3266
|
Le -= 0.17 * Math.cos((Y - 30) * Fe), Le += 0.24 * Math.cos(2 * Y * Fe), Le += 0.32 * Math.cos((3 * Y + 6) * Fe), Le -= 0.2 * Math.cos((4 * Y - 63) * Fe);
|
@@ -3316,7 +3316,7 @@ var Qe = new x({
|
|
3316
3316
|
}
|
3317
3317
|
}
|
3318
3318
|
});
|
3319
|
-
function
|
3319
|
+
function Ci(i, e) {
|
3320
3320
|
[i, e] = S([i, e]);
|
3321
3321
|
let [t, s, r] = Qe.from(i), [o, n, a] = Qe.from(e), l = t - o, d = s - n, c = r - a;
|
3322
3322
|
return Math.sqrt(l ** 2 + d ** 2 + c ** 2);
|
@@ -3345,16 +3345,16 @@ function eo(i, e, t = "lab") {
|
|
3345
3345
|
function Sa(i, e) {
|
3346
3346
|
return eo(i, e, "lab");
|
3347
3347
|
}
|
3348
|
-
const
|
3349
|
-
function
|
3348
|
+
const Aa = Math.PI, Cs = Aa / 180;
|
3349
|
+
function Ca(i, e, { l: t = 2, c: s = 1 } = {}) {
|
3350
3350
|
[i, e] = S([i, e]);
|
3351
3351
|
let [r, o, n] = ie.from(i), [, a, l] = ft.from(ie, [r, o, n]), [d, c, h] = ie.from(e), u = ft.from(ie, [d, c, h])[1];
|
3352
3352
|
a < 0 && (a = 0), u < 0 && (u = 0);
|
3353
3353
|
let f = r - d, m = a - u, p = o - c, b = n - h, w = p ** 2 + b ** 2 - m ** 2, _ = 0.511;
|
3354
3354
|
r >= 16 && (_ = 0.040975 * r / (1 + 0.01765 * r));
|
3355
3355
|
let z = 0.0638 * a / (1 + 0.0131 * a) + 0.638, R;
|
3356
|
-
Number.isNaN(l) && (l = 0), l >= 164 && l <= 345 ? R = 0.56 + Math.abs(0.2 * Math.cos((l + 168) *
|
3357
|
-
let
|
3356
|
+
Number.isNaN(l) && (l = 0), l >= 164 && l <= 345 ? R = 0.56 + Math.abs(0.2 * Math.cos((l + 168) * Cs)) : R = 0.36 + Math.abs(0.4 * Math.cos((l + 35) * Cs));
|
3357
|
+
let A = Math.pow(a, 4), V = Math.sqrt(A / (A + 1900)), F = z * (V * R + 1 - V), H = (f / (t * _)) ** 2;
|
3358
3358
|
return H += (m / (s * z)) ** 2, H += w / F ** 2, Math.sqrt(H);
|
3359
3359
|
}
|
3360
3360
|
const Ds = 203;
|
@@ -3388,7 +3388,7 @@ var Vi = new x({
|
|
3388
3388
|
return i.map((e) => Math.max(e / Ds, 0));
|
3389
3389
|
}
|
3390
3390
|
});
|
3391
|
-
const Rt = 1.15, St = 0.66, Ls = 2610 / 2 ** 14, Da = 2 ** 14 / 2610, Is = 3424 / 2 ** 12, Ts = 2413 / 2 ** 7, Ns = 2392 / 2 ** 7, La = 1.7 * 2523 / 2 ** 5, Hs = 2 ** 5 / (1.7 * 2523),
|
3391
|
+
const Rt = 1.15, St = 0.66, Ls = 2610 / 2 ** 14, Da = 2 ** 14 / 2610, Is = 3424 / 2 ** 12, Ts = 2413 / 2 ** 7, Ns = 2392 / 2 ** 7, La = 1.7 * 2523 / 2 ** 5, Hs = 2 ** 5 / (1.7 * 2523), At = -0.56, hi = 16295499532821565e-27, Ia = [
|
3392
3392
|
[0.41478972, 0.579999, 0.014648],
|
3393
3393
|
[-0.20151, 1.120649, 0.0531008],
|
3394
3394
|
[-0.0166008, 0.2648, 0.6684799]
|
@@ -3426,10 +3426,10 @@ var to = new x({
|
|
3426
3426
|
let f = Is + Ts * (u / 1e4) ** Ls, m = 1 + Ns * (u / 1e4) ** Ls;
|
3427
3427
|
return (f / m) ** La;
|
3428
3428
|
}), [l, d, c] = I(Na, a);
|
3429
|
-
return [(1 +
|
3429
|
+
return [(1 + At) * l / (1 + At * l) - hi, d, c];
|
3430
3430
|
},
|
3431
3431
|
toBase(i) {
|
3432
|
-
let [e, t, s] = i, r = (e + hi) / (1 +
|
3432
|
+
let [e, t, s] = i, r = (e + hi) / (1 + At - At * (e + hi)), n = I(Ha, [r, t, s]).map(function(u) {
|
3433
3433
|
let f = Is - u ** Hs, m = Ns * u ** Hs - Ts;
|
3434
3434
|
return 1e4 * (f / m) ** Da;
|
3435
3435
|
}), [a, l, d] = I(Ta, n), c = (a + (Rt - 1) * d) / Rt, h = (l + (St - 1) * c) / St;
|
@@ -3794,11 +3794,11 @@ function ll(i, e) {
|
|
3794
3794
|
}
|
3795
3795
|
var tt = {
|
3796
3796
|
deltaE76: Sa,
|
3797
|
-
deltaECMC:
|
3797
|
+
deltaECMC: Ca,
|
3798
3798
|
deltaE2000: Qr,
|
3799
3799
|
deltaEJz: Oa,
|
3800
3800
|
deltaEITP: qa,
|
3801
|
-
deltaEOK:
|
3801
|
+
deltaEOK: Ci,
|
3802
3802
|
deltaEHCT: ll
|
3803
3803
|
};
|
3804
3804
|
function dl(i) {
|
@@ -3819,7 +3819,7 @@ const Gs = {
|
|
3819
3819
|
blackWhiteClamp: { channel: "hct.t", min: 0, max: 100 }
|
3820
3820
|
}
|
3821
3821
|
};
|
3822
|
-
function
|
3822
|
+
function Ce(i, {
|
3823
3823
|
method: e = re.gamut_mapping,
|
3824
3824
|
space: t = void 0,
|
3825
3825
|
deltaEMethod: s = "",
|
@@ -3842,7 +3842,7 @@ function Ae(i, {
|
|
3842
3842
|
break;
|
3843
3843
|
}
|
3844
3844
|
}
|
3845
|
-
let l =
|
3845
|
+
let l = Ce(L(i, t), { method: "clip", space: t });
|
3846
3846
|
if (a(i, l) > r) {
|
3847
3847
|
if (Object.keys(o).length === 3) {
|
3848
3848
|
let _ = x.resolveCoord(o.channel), z = te(L(i, _.space), _.id);
|
@@ -3858,7 +3858,7 @@ function Ae(i, {
|
|
3858
3858
|
let m = (d.range || d.refRange)[0], p = dl(r), b = m, w = te(u, h);
|
3859
3859
|
for (; w - b > p; ) {
|
3860
3860
|
let _ = et(u);
|
3861
|
-
_ =
|
3861
|
+
_ = Ce(_, { space: t, method: "clip" }), a(u, _) - r < p ? b = te(u, h) : w = te(u, h), Ee(u, h, (b + w) / 2);
|
3862
3862
|
}
|
3863
3863
|
n = L(u, t);
|
3864
3864
|
} else
|
@@ -3875,7 +3875,7 @@ function Ae(i, {
|
|
3875
3875
|
}
|
3876
3876
|
return t !== i.space && (n = L(n, i.space)), i.coords = n.coords, i;
|
3877
3877
|
}
|
3878
|
-
|
3878
|
+
Ce.returns = "color";
|
3879
3879
|
const js = {
|
3880
3880
|
WHITE: { space: Qe, coords: [1, 0, 0] },
|
3881
3881
|
BLACK: { space: Qe, coords: [0, 0, 0] }
|
@@ -3907,14 +3907,14 @@ function cl(i, { space: e } = {}) {
|
|
3907
3907
|
return w;
|
3908
3908
|
}), p;
|
3909
3909
|
}
|
3910
|
-
let l = 0, d = o.coords[1], c = !0, h = et(o), u = a(h), f =
|
3910
|
+
let l = 0, d = o.coords[1], c = !0, h = et(o), u = a(h), f = Ci(u, h);
|
3911
3911
|
if (f < 0.02)
|
3912
3912
|
return u;
|
3913
3913
|
for (; d - l > 1e-4; ) {
|
3914
3914
|
const m = (l + d) / 2;
|
3915
3915
|
if (h.coords[1] = m, c && Pe(h, e, { epsilon: 0 }))
|
3916
3916
|
l = m;
|
3917
|
-
else if (u = a(h), f =
|
3917
|
+
else if (u = a(h), f = Ci(u, h), f < 0.02) {
|
3918
3918
|
if (0.02 - f < 1e-4)
|
3919
3919
|
break;
|
3920
3920
|
c = !1, l = m;
|
@@ -3926,7 +3926,7 @@ function cl(i, { space: e } = {}) {
|
|
3926
3926
|
function L(i, e, { inGamut: t } = {}) {
|
3927
3927
|
i = S(i), e = x.get(e);
|
3928
3928
|
let s = e.from(i), r = { space: e, coords: s, alpha: i.alpha };
|
3929
|
-
return t && (r =
|
3929
|
+
return t && (r = Ce(r, t === !0 ? void 0 : t)), r;
|
3930
3930
|
}
|
3931
3931
|
L.returns = "color";
|
3932
3932
|
function ht(i, {
|
@@ -3941,7 +3941,7 @@ function ht(i, {
|
|
3941
3941
|
let n = t;
|
3942
3942
|
t = i.space.getFormat(t) ?? i.space.getFormat("default") ?? x.DEFAULT_FORMAT;
|
3943
3943
|
let a = i.coords.slice();
|
3944
|
-
if (s || (s = t.toGamut), s && !Pe(i) && (a =
|
3944
|
+
if (s || (s = t.toGamut), s && !Pe(i) && (a = Ce(et(i), s === !0 ? void 0 : s).coords), t.type === "custom")
|
3945
3945
|
if (r.precision = e, t.serialize)
|
3946
3946
|
o = t.serialize(a, i.alpha, r);
|
3947
3947
|
else
|
@@ -3978,7 +3978,7 @@ var ei = new Z({
|
|
3978
3978
|
toXYZ_M: hl,
|
3979
3979
|
fromXYZ_M: ul
|
3980
3980
|
});
|
3981
|
-
const
|
3981
|
+
const Ct = 1.09929682680944, qs = 0.018053968510807;
|
3982
3982
|
var uo = new Z({
|
3983
3983
|
id: "rec2020",
|
3984
3984
|
name: "REC.2020",
|
@@ -3986,12 +3986,12 @@ var uo = new Z({
|
|
3986
3986
|
// Non-linear transfer function from Rec. ITU-R BT.2020-2 table 4
|
3987
3987
|
toBase(i) {
|
3988
3988
|
return i.map(function(e) {
|
3989
|
-
return e < qs * 4.5 ? e / 4.5 : Math.pow((e +
|
3989
|
+
return e < qs * 4.5 ? e / 4.5 : Math.pow((e + Ct - 1) / Ct, 1 / 0.45);
|
3990
3990
|
});
|
3991
3991
|
},
|
3992
3992
|
fromBase(i) {
|
3993
3993
|
return i.map(function(e) {
|
3994
|
-
return e >= qs ?
|
3994
|
+
return e >= qs ? Ct * Math.pow(e, 0.45) - (Ct - 1) : 4.5 * e;
|
3995
3995
|
});
|
3996
3996
|
}
|
3997
3997
|
});
|
@@ -4309,7 +4309,7 @@ function _l(i, e) {
|
|
4309
4309
|
let t = Math.max(De(i), 0), s = Math.max(De(e), 0);
|
4310
4310
|
return s > t && ([t, s] = [s, t]), (t + 0.05) / (s + 0.05);
|
4311
4311
|
}
|
4312
|
-
const zl = 0.56, xl = 0.57, El = 0.62, Ml = 0.65, Ks = 0.022, kl = 1.414, Rl = 0.1, Sl = 5e-4,
|
4312
|
+
const zl = 0.56, xl = 0.57, El = 0.62, Ml = 0.65, Ks = 0.022, kl = 1.414, Rl = 0.1, Sl = 5e-4, Al = 1.14, Js = 0.027, Cl = 1.14;
|
4313
4313
|
function Zs(i) {
|
4314
4314
|
return i >= Ks ? i : i + (Ks - i) ** kl;
|
4315
4315
|
}
|
@@ -4324,7 +4324,7 @@ function Dl(i, e) {
|
|
4324
4324
|
let l = Ue(o) * 0.2126729 + Ue(n) * 0.7151522 + Ue(a) * 0.072175;
|
4325
4325
|
i = L(i, "srgb"), [o, n, a] = i.coords;
|
4326
4326
|
let d = Ue(o) * 0.2126729 + Ue(n) * 0.7151522 + Ue(a) * 0.072175, c = Zs(l), h = Zs(d), u = h > c;
|
4327
|
-
return Math.abs(h - c) < Sl ? s = 0 : u ? (t = h ** zl - c ** xl, s = t *
|
4327
|
+
return Math.abs(h - c) < Sl ? s = 0 : u ? (t = h ** zl - c ** xl, s = t * Al) : (t = h ** Ml - c ** El, s = t * Cl), Math.abs(s) < Rl ? r = 0 : s > 0 ? r = s - Js : r = s + Js, r * 100;
|
4328
4328
|
}
|
4329
4329
|
function Ll(i, e) {
|
4330
4330
|
i = S(i), e = S(e);
|
@@ -4518,7 +4518,7 @@ function zt(i, e, t = {}) {
|
|
4518
4518
|
let { space: s, outputSpace: r, progression: o, premultiplied: n } = t;
|
4519
4519
|
i = S(i), e = S(e), i = et(i), e = et(e);
|
4520
4520
|
let a = { colors: [i, e], options: t };
|
4521
|
-
if (s ? s = x.get(s) : s = x.registry[re.interpolationSpace] || i.space, r = r ? x.get(r) : s, i = L(i, s), e = L(e, s), i =
|
4521
|
+
if (s ? s = x.get(s) : s = x.registry[re.interpolationSpace] || i.space, r = r ? x.get(r) : s, i = L(i, s), e = L(e, s), i = Ce(i), e = Ce(e), s.coords.h && s.coords.h.type === "angle") {
|
4522
4522
|
let l = t.hue = t.hue || "shorter", d = [s, "h"], [c, h] = [te(i, d), te(e, d)];
|
4523
4523
|
isNaN(c) && !isNaN(h) ? c = h : isNaN(h) && !isNaN(c) && (h = c), [c, h] = za(l, [c, h]), Ee(i, d, c), Ee(e, d, h);
|
4524
4524
|
}
|
@@ -5078,10 +5078,10 @@ var cd = new Z({
|
|
5078
5078
|
}
|
5079
5079
|
});
|
5080
5080
|
const ko = {};
|
5081
|
-
|
5081
|
+
Ae.add("chromatic-adaptation-start", (i) => {
|
5082
5082
|
i.options.method && (i.M = Ro(i.W1, i.W2, i.options.method));
|
5083
5083
|
});
|
5084
|
-
|
5084
|
+
Ae.add("chromatic-adaptation-end", (i) => {
|
5085
5085
|
i.M || (i.M = Ro(i.W1, i.W2, i.options.method));
|
5086
5086
|
});
|
5087
5087
|
function ii({ id: i, toCone_M: e, fromCone_M: t }) {
|
@@ -5287,7 +5287,7 @@ var md = new Z({
|
|
5287
5287
|
sRGB: it,
|
5288
5288
|
sRGB_Linear: fo
|
5289
5289
|
});
|
5290
|
-
class
|
5290
|
+
class C {
|
5291
5291
|
/**
|
5292
5292
|
* Creates an instance of Color.
|
5293
5293
|
* Signatures:
|
@@ -5320,7 +5320,7 @@ class A {
|
|
5320
5320
|
return this.space.id;
|
5321
5321
|
}
|
5322
5322
|
clone() {
|
5323
|
-
return new
|
5323
|
+
return new C(this.space, this.coords, this.alpha);
|
5324
5324
|
}
|
5325
5325
|
toJSON() {
|
5326
5326
|
return {
|
@@ -5331,46 +5331,46 @@ class A {
|
|
5331
5331
|
}
|
5332
5332
|
display(...e) {
|
5333
5333
|
let t = bl(this, ...e);
|
5334
|
-
return t.color = new
|
5334
|
+
return t.color = new C(t.color), t;
|
5335
5335
|
}
|
5336
5336
|
/**
|
5337
5337
|
* Get a color from the argument passed
|
5338
5338
|
* Basically gets us the same result as new Color(color) but doesn't clone an existing color object
|
5339
5339
|
*/
|
5340
5340
|
static get(e, ...t) {
|
5341
|
-
return e instanceof
|
5341
|
+
return e instanceof C ? e : new C(e, ...t);
|
5342
5342
|
}
|
5343
5343
|
static defineFunction(e, t, s = t) {
|
5344
5344
|
let { instance: r = !0, returns: o } = s, n = function(...a) {
|
5345
5345
|
let l = t(...a);
|
5346
5346
|
if (o === "color")
|
5347
|
-
l =
|
5347
|
+
l = C.get(l);
|
5348
5348
|
else if (o === "function<color>") {
|
5349
5349
|
let d = l;
|
5350
5350
|
l = function(...c) {
|
5351
5351
|
let h = d(...c);
|
5352
|
-
return
|
5352
|
+
return C.get(h);
|
5353
5353
|
}, Object.assign(l, d);
|
5354
|
-
} else o === "array<color>" && (l = l.map((d) =>
|
5354
|
+
} else o === "array<color>" && (l = l.map((d) => C.get(d)));
|
5355
5355
|
return l;
|
5356
5356
|
};
|
5357
|
-
e in
|
5357
|
+
e in C || (C[e] = n), r && (C.prototype[e] = function(...a) {
|
5358
5358
|
return n(this, ...a);
|
5359
5359
|
});
|
5360
5360
|
}
|
5361
5361
|
static defineFunctions(e) {
|
5362
5362
|
for (let t in e)
|
5363
|
-
|
5363
|
+
C.defineFunction(t, e[t], e[t]);
|
5364
5364
|
}
|
5365
5365
|
static extend(e) {
|
5366
5366
|
if (e.register)
|
5367
|
-
e.register(
|
5367
|
+
e.register(C);
|
5368
5368
|
else
|
5369
5369
|
for (let t in e)
|
5370
|
-
|
5370
|
+
C.defineFunction(t, e[t]);
|
5371
5371
|
}
|
5372
5372
|
}
|
5373
|
-
|
5373
|
+
C.defineFunctions({
|
5374
5374
|
get: te,
|
5375
5375
|
getAll: _t,
|
5376
5376
|
set: Ee,
|
@@ -5378,13 +5378,13 @@ A.defineFunctions({
|
|
5378
5378
|
to: L,
|
5379
5379
|
equals: yl,
|
5380
5380
|
inGamut: Pe,
|
5381
|
-
toGamut:
|
5381
|
+
toGamut: Ce,
|
5382
5382
|
distance: eo,
|
5383
5383
|
toString: ht
|
5384
5384
|
});
|
5385
|
-
Object.assign(
|
5385
|
+
Object.assign(C, {
|
5386
5386
|
util: pa,
|
5387
|
-
hooks:
|
5387
|
+
hooks: Ae,
|
5388
5388
|
WHITES: K,
|
5389
5389
|
Space: x,
|
5390
5390
|
spaces: x.registry,
|
@@ -5396,7 +5396,7 @@ for (let i of Object.keys(wr))
|
|
5396
5396
|
x.register(wr[i]);
|
5397
5397
|
for (let i in x.registry)
|
5398
5398
|
Hi(i, x.registry[i]);
|
5399
|
-
|
5399
|
+
Ae.add("colorspace-init-end", (i) => {
|
5400
5400
|
var e;
|
5401
5401
|
Hi(i.id, i), (e = i.aliases) == null || e.forEach((t) => {
|
5402
5402
|
Hi(t, i);
|
@@ -5404,7 +5404,7 @@ Ce.add("colorspace-init-end", (i) => {
|
|
5404
5404
|
});
|
5405
5405
|
function Hi(i, e) {
|
5406
5406
|
let t = i.replace(/-/g, "_");
|
5407
|
-
Object.defineProperty(
|
5407
|
+
Object.defineProperty(C.prototype, t, {
|
5408
5408
|
// Convert coords to coords in another colorspace and return them
|
5409
5409
|
// Source colorspace: this.spaceId
|
5410
5410
|
// Target colorspace: id
|
@@ -5446,15 +5446,15 @@ function Hi(i, e) {
|
|
5446
5446
|
enumerable: !0
|
5447
5447
|
});
|
5448
5448
|
}
|
5449
|
-
|
5450
|
-
|
5451
|
-
Object.assign(
|
5452
|
-
|
5453
|
-
|
5454
|
-
|
5455
|
-
|
5456
|
-
|
5457
|
-
|
5449
|
+
C.extend(tt);
|
5450
|
+
C.extend({ deltaE: lt });
|
5451
|
+
Object.assign(C, { deltaEMethods: tt });
|
5452
|
+
C.extend(Ul);
|
5453
|
+
C.extend({ contrast: Pl });
|
5454
|
+
C.extend(Bl);
|
5455
|
+
C.extend(wl);
|
5456
|
+
C.extend(jl);
|
5457
|
+
C.extend(Tt);
|
5458
5458
|
function fd(i, e, t, s, r) {
|
5459
5459
|
const o = (...n) => (console.warn("gridstack.js: Function `" + t + "` is deprecated in " + r + " and has been replaced with `" + s + "`. It will be **removed** in a future release"), e.apply(i, n));
|
5460
5460
|
return o.prototype = e.prototype, o;
|
@@ -6280,7 +6280,7 @@ class pe {
|
|
6280
6280
|
function Ft(i, e) {
|
6281
6281
|
i.touches.length > 1 || (i.cancelable && i.preventDefault(), g.simulateMouseEvent(i.changedTouches[0], e));
|
6282
6282
|
}
|
6283
|
-
function
|
6283
|
+
function Ao(i, e) {
|
6284
6284
|
i.cancelable && i.preventDefault(), g.simulateMouseEvent(i, e);
|
6285
6285
|
}
|
6286
6286
|
function Ut(i) {
|
@@ -6300,11 +6300,11 @@ function qt(i) {
|
|
6300
6300
|
i.pointerType !== "mouse" && i.target.releasePointerCapture(i.pointerId);
|
6301
6301
|
}
|
6302
6302
|
function _r(i) {
|
6303
|
-
k.dragElement && i.pointerType !== "mouse" &&
|
6303
|
+
k.dragElement && i.pointerType !== "mouse" && Ao(i, "mouseenter");
|
6304
6304
|
}
|
6305
6305
|
function zr(i) {
|
6306
6306
|
k.dragElement && i.pointerType !== "mouse" && (pe.pointerLeaveTimeout = window.setTimeout(() => {
|
6307
|
-
delete pe.pointerLeaveTimeout,
|
6307
|
+
delete pe.pointerLeaveTimeout, Ao(i, "mouseleave");
|
6308
6308
|
}, 10));
|
6309
6309
|
}
|
6310
6310
|
class si {
|
@@ -8017,8 +8017,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
8017
8017
|
const z = this._extraDragRow;
|
8018
8018
|
if (this.engine.collide(r, a)) {
|
8019
8019
|
const R = this.getRow();
|
8020
|
-
let
|
8021
|
-
this.opts.maxRow && R +
|
8020
|
+
let A = Math.max(0, a.y + r.h - R);
|
8021
|
+
this.opts.maxRow && R + A > this.opts.maxRow && (A = Math.max(0, this.opts.maxRow - R)), this._extraDragRow = A;
|
8022
8022
|
} else
|
8023
8023
|
this._extraDragRow = 0;
|
8024
8024
|
if (this._extraDragRow !== z && this._updateContainerHeight(), r.x === a.x && r.y === a.y)
|
@@ -8113,7 +8113,7 @@ const xd = {
|
|
8113
8113
|
tooltip: "Edit",
|
8114
8114
|
action: "edit",
|
8115
8115
|
type: "toggle"
|
8116
|
-
},
|
8116
|
+
}, Co = {
|
8117
8117
|
icon: Fo,
|
8118
8118
|
label: "Edit data",
|
8119
8119
|
tooltip: "Data",
|
@@ -8165,7 +8165,7 @@ const xd = {
|
|
8165
8165
|
filters: { ...Er },
|
8166
8166
|
clone: { ...Lo },
|
8167
8167
|
edit: { ...Ed },
|
8168
|
-
"edit-data": { ...
|
8168
|
+
"edit-data": { ...Co },
|
8169
8169
|
"edit-options": { ...Do },
|
8170
8170
|
"edit-filters": { ...Er },
|
8171
8171
|
lock: { ...xd }
|
@@ -8178,7 +8178,7 @@ const xd = {
|
|
8178
8178
|
{
|
8179
8179
|
type: "group",
|
8180
8180
|
actions: [
|
8181
|
-
{ ...
|
8181
|
+
{ ...Co },
|
8182
8182
|
{ ...Do },
|
8183
8183
|
{ ...Lo }
|
8184
8184
|
]
|
@@ -8305,19 +8305,19 @@ ri([
|
|
8305
8305
|
st = ri([
|
8306
8306
|
rn()
|
8307
8307
|
], st);
|
8308
|
-
const Sd = ':host{display:block;width:100
|
8309
|
-
var
|
8308
|
+
const Sd = ':host{display:block;width:100%}.grid-stack{width:100%;min-height:var(--luzmo-grid-min-height);position:relative;background:var(--luzmo-grid-background, var(--grid-background, var(--luzmo-background-color)))}.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-stack-item-content,.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-item-actions-popover{opacity:.5}.grid-stack .grid-stack-item[active]>.ui-resizable-handle,.grid-stack .grid-stack-item[active].ui-resizable-autohide>.ui-resizable-handle{display:block}.grid-stack .grid-stack-item.ui-resizable-resizing,.grid-stack .grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{opacity:var(--luzmo-grid-item-resizing-opacity, .8)!important}.grid-item-drag-handle{position:absolute;color:var(--luzmo-grid-item-drag-handle-color, #000);top:var(--luzmo-grid-item-drag-handle-position-top, 0);left:var(--luzmo-grid-item-drag-handle-position-left, 0);right:var(--luzmo-grid-item-drag-handle-position-right, auto);bottom:var(--luzmo-grid-item-drag-handle-position-bottom, auto);padding:var(--luzmo-grid-item-drag-handle-padding, .5rem);z-index:var(--luzmo-grid-item-drag-handle-z-index, 3);cursor:var(--luzmo-grid-item-drag-handle-cursor, move)}.grid-stack[dark-background] .grid-item-drag-handle{color:var(--luzmo-grid-item-drag-handle-color, #fff)}.grid-stack .grid-stack-item .grid-stack-item-content{overflow:hidden;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));background:var(--luzmo-grid-item-background, var(--grid-item-background, transparent));box-shadow:var(--luzmo-grid-item-box-shadow, var(--grid-item-box-shadow, none));border-style:var(--luzmo-grid-item-border-style, none);border-color:var(--luzmo-grid-item-border-color, transparent);-webkit-backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none);backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none)}.grid-stack .grid-stack-item:not(.has-luzmo-viz-item) .grid-stack-item-content{border-style:var(--luzmo-grid-item-border-style, var(--grid-item-border-style, none));border-color:var(--luzmo-grid-item-border-color, var(--grid-item-border-color, transparent));border-width:var(--luzmo-grid-item-border-width, var(--grid-item-border-width, 0));border-top-width:var(--luzmo-grid-item-border-top-width, var(--grid-item-border-top-width, 0));border-right-width:var(--luzmo-grid-item-border-right-width, var(--grid-item-border-right-width, 0));border-bottom-width:var(--luzmo-grid-item-border-bottom-width, var(--grid-item-border-bottom-width, 0));border-left-width:var(--luzmo-grid-item-border-left-width, var(--grid-item-border-left-width, 0))}.grid-stack .grid-stack-placeholder>.placeholder-content{border-radius:var(--grid-item-border-radius, 4px)}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{display:block!important;position:absolute!important;z-index:var(--luzmo-grid-resize-handle-z-index, 100);background:var(--luzmo-grid-resize-handle-background, #fff);border-radius:var(--luzmo-grid-resize-handle-border-radius, 3px);opacity:var(--luzmo-grid-resize-handle-opacity, 0);transition:var(--luzmo-grid-resize-handle-transition, opacity .2s ease);box-shadow:0 0 6px #0000001a,0 0 2px #000000bf}:host .grid-stack[dark-background]>.grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack[dark-background]>.grid-stack-item:hover>.ui-resizable-handle{background:var(--luzmo-grid-resize-handle-background, #333);box-shadow:0 0 6px #ffffff1a,0 0 2px #ffffffbf}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{opacity:var(--luzmo-grid-resize-handle-opacity-hover, 1)}:host .grid-stack-item>.ui-resizable-handle:hover{opacity:var(--luzmo-grid-resize-handle-opacity-active, 1);background:var(--luzmo-grid-resize-handle-background-hover, var(--luzmo-background-color-highlight))}:host .grid-stack-item>.ui-resizable-n,:host .grid-stack-item>.ui-resizable-s{height:var(--luzmo-grid-resize-handle-edge-size, 8px);width:var(--luzmo-grid-resize-handle-side-size, 18px);left:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-n{cursor:n-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-top, 0px))}:host .grid-stack-item>.ui-resizable-s{cursor:s-resize;bottom:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-e,:host .grid-stack-item>.ui-resizable-w{width:var(--luzmo-grid-resize-handle-edge-size, 8px);height:var(--luzmo-grid-resize-handle-side-size, 18px);top:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-e{cursor:e-resize;right:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-w{cursor:w-resize;left:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-ne,:host .grid-stack-item>.ui-resizable-nw,:host .grid-stack-item>.ui-resizable-se,:host .grid-stack-item>.ui-resizable-sw{transform:none;background-image:none;width:var(--luzmo-grid-resize-handle-corner-size, 12px);height:var(--luzmo-grid-resize-handle-corner-size, 12px)}:host .grid-stack-item>.ui-resizable-ne{cursor:ne-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));right:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-nw{cursor:nw-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));left:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-se{cursor:se-resize;right:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-right, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-sw{cursor:sw-resize;left:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-left, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-resizing .ui-resizable-handle{opacity:1!important;background:var(--luzmo-grid-resize-handle-background-active, var(--luzmo-background-color-highlight))}.grid-item-actions-popover{position:absolute;outline:none;border:none;padding:0;margin:0;z-index:2;overflow:visible;background:transparent}luzmo-grid-item-actions-menu{padding:var(--luzmo-grid-item-actions-padding, var(--grid-item-actions-padding))}.dimensions-hint-popover{font-size:var(--luzmo-grid-item-dimensions-hint-font-size, var(--luzmo-font-size-xs, 10px));font-family:var(--luzmo-grid-item-dimensions-hint-font-family, var(--luzmo-font-family, inherit));position:absolute;outline:none;border-width:var(--luzmo-grid-item-dimensions-hint-border-width, var(--luzmo-border-width));border-style:solid;border-color:var(--luzmo-grid-item-dimensions-hint-border-color, var(--luzmo-border-color));border-radius:var(--luzmo-grid-item-dimensions-hint-border-radius, var(--luzmo-border-radius));padding:var(--luzmo-grid-item-dimensions-hint-padding, var(--luzmo-spacing-1) var(--luzmo-spacing-2));margin:0;z-index:3;overflow:visible;background:var(--luzmo-grid-item-dimensions-hint-background, var(--luzmo-background-color));color:var(--luzmo-grid-item-dimensions-hint-color, var(--luzmo-font-color));pointer-events:none}luzmo-grid-item-actions-menu{--grid-item-actions-padding: 0 .75rem}luzmo-grid-item-actions-menu[placement=top-start],luzmo-grid-item-actions-menu[placement=top],luzmo-grid-item-actions-menu[placement=top-end],luzmo-grid-item-actions-menu[placement=bottom-start],luzmo-grid-item-actions-menu[placement=bottom],luzmo-grid-item-actions-menu[placement=bottom-end]{--grid-item-actions-padding: .75rem 0}.grid-stack-item:focus-visible{outline:none}.grid-stack-item:focus-visible .grid-stack-item-content:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;border:var(--luzmo-indicator-width) solid var(--luzmo-indicator-color, var(--luzmo-primary));box-sizing:border-box;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));z-index:2}';
|
8309
|
+
var Ad = Object.defineProperty, W = (i, e, t, s) => {
|
8310
8310
|
for (var r = void 0, o = i.length - 1, n; o >= 0; o--)
|
8311
8311
|
(n = i[o]) && (r = n(e, t, r) || r);
|
8312
|
-
return r &&
|
8312
|
+
return r && Ad(e, t, r), r;
|
8313
8313
|
};
|
8314
8314
|
class $ extends Dr {
|
8315
8315
|
constructor() {
|
8316
|
-
super(...arguments), this.appServer = "https://app.luzmo.com/", this.apiHost = "https://api.luzmo.com", this.language = "en", this.contentLanguage = "en", this.columns = 48, this.rowHeight = 16, this.viewMode = !1, this.placementItemActionsMenu = "right-start", this.
|
8316
|
+
super(...arguments), this.appServer = "https://app.luzmo.com/", this.apiHost = "https://api.luzmo.com", this.language = "en", this.contentLanguage = "en", this.columns = 48, this.rowHeight = 16, this.viewMode = !1, this.placementItemActionsMenu = "right-start", this.items = [], this.renderers = {}, this._initialized = !1, this.defaultRenderer = (e, t) => D`
|
8317
8317
|
<div class="grid-item-content">
|
8318
8318
|
<div class="grid-item-type">${e.type}</div>
|
8319
8319
|
</div>
|
8320
|
-
`, this._handleMouseout = (e) => {
|
8320
|
+
`, this._hasItemAdded = !1, this._handleMouseout = (e) => {
|
8321
8321
|
if (this.viewMode) return;
|
8322
8322
|
const s = e.target.closest(".grid-stack-item");
|
8323
8323
|
if (!s) return;
|
@@ -8483,7 +8483,9 @@ class $ extends Dr {
|
|
8483
8483
|
}
|
8484
8484
|
async _loadTheme(e) {
|
8485
8485
|
var t, s, r, o, n, a, l;
|
8486
|
-
(e == null ? void 0 : e.type) === "custom" ? this._fullTheme = structuredClone(e) : e != null && e.id && Qo.includes(e.id) && ((t = this._fullTheme) == null ? void 0 : t.id) !== e.id ? (this._fullTheme = await ts(e.id), this._fullTheme.id = e.id) : e != null && e.id && ((s = this._fullTheme) == null ? void 0 : s.id) !== e.id || !e && this._fullTheme || (this._fullTheme = await ts("default")), this._initialized && this._updateThemeProperties(), !this._initialized && this._gridElement &&
|
8486
|
+
(e == null ? void 0 : e.type) === "custom" ? this._fullTheme = structuredClone(e) : e != null && e.id && Qo.includes(e.id) && ((t = this._fullTheme) == null ? void 0 : t.id) !== e.id ? (this._fullTheme = await ts(e.id), this._fullTheme.id = e.id) : e != null && e.id && ((s = this._fullTheme) == null ? void 0 : s.id) !== e.id || !e && this._fullTheme || (this._fullTheme = await ts("default")), this._initialized && this._updateThemeProperties(), !this._initialized && this._gridElement && await requestAnimationFrame(() => {
|
8487
|
+
this._initializeGrid();
|
8488
|
+
}), this._grid && ((l = this._grid) == null || l.margin(
|
8487
8489
|
[
|
8488
8490
|
(((o = (r = this.theme) == null ? void 0 : r.margins) == null ? void 0 : o[0]) ?? 16) / 2,
|
8489
8491
|
(((a = (n = this.theme) == null ? void 0 : n.margins) == null ? void 0 : a[1]) ?? 16) / 2
|
@@ -8511,7 +8513,9 @@ class $ extends Dr {
|
|
8511
8513
|
const t = e.has("contentLanguage"), s = e.has("viewMode"), r = e.has("items"), o = e.has("theme");
|
8512
8514
|
this.items.forEach((d) => {
|
8513
8515
|
d.id = d.id ?? nt();
|
8514
|
-
}), this._initialized && this._grid && r
|
8516
|
+
}), this._initialized && this._grid && (r || this._hasItemAdded) && (this._hasItemAdded && this._gridItemElements.forEach((d) => {
|
8517
|
+
d.hasAttribute("orphan") && d.remove();
|
8518
|
+
}), this._hasItemAdded = !1, (n = this._grid) == null || n.setAnimation(!1), (a = this._grid) == null || a.batchUpdate(), (l = this._grid) == null || l.removeAll(!1), this.items.forEach((d) => {
|
8515
8519
|
var h, u, f, m, p, b, w;
|
8516
8520
|
const c = [...this._gridItemElements].find((_) => _.getAttribute("luzmo-grid-item-id") === d.id);
|
8517
8521
|
c && ((p = this._grid) == null || p.makeWidget(c, {
|
@@ -8566,6 +8570,7 @@ class $ extends Dr {
|
|
8566
8570
|
acceptWidgets: !0,
|
8567
8571
|
disableDrag: this.viewMode,
|
8568
8572
|
disableResize: this.viewMode,
|
8573
|
+
minRow: 1,
|
8569
8574
|
resizable: {
|
8570
8575
|
handles: ["n", "ne", "e", "se", "s", "sw", "w", "nw"].join(", ")
|
8571
8576
|
},
|
@@ -8739,12 +8744,12 @@ class $ extends Dr {
|
|
8739
8744
|
t && (t._cleanup && (t._cleanup(), delete t._cleanup), t.matches(":popover-open") && t.hidePopover(), t.remove());
|
8740
8745
|
}
|
8741
8746
|
_updateThemeProperties() {
|
8742
|
-
var r, o, n, a, l, d, c, h, u, f, m, p, b, w, _, z, R,
|
8747
|
+
var r, o, n, a, l, d, c, h, u, f, m, p, b, w, _, z, R, A, V, F, H;
|
8743
8748
|
if (!this._fullTheme) return;
|
8744
8749
|
const e = this._fullTheme.boxShadow;
|
8745
8750
|
let t = "";
|
8746
8751
|
if (e) {
|
8747
|
-
const U = new
|
8752
|
+
const U = new C(e.color), O = {
|
8748
8753
|
r: Math.round(U.srgb.r * 255),
|
8749
8754
|
g: Math.round(U.srgb.g * 255),
|
8750
8755
|
b: Math.round(U.srgb.b * 255)
|
@@ -8776,7 +8781,7 @@ class $ extends Dr {
|
|
8776
8781
|
],
|
8777
8782
|
[
|
8778
8783
|
"--grid-item-border-bottom-width",
|
8779
|
-
(V = (
|
8784
|
+
(V = (A = this._fullTheme) == null ? void 0 : A.borders) == null ? void 0 : V["border-bottom-width"]
|
8780
8785
|
],
|
8781
8786
|
[
|
8782
8787
|
"--grid-item-border-left-width",
|
@@ -8791,6 +8796,7 @@ class $ extends Dr {
|
|
8791
8796
|
}
|
8792
8797
|
addGridItem(e) {
|
8793
8798
|
var a, l, d, c, h;
|
8799
|
+
!this._initialized && this._gridElement && console.warn("Grid is not initialized, wait for grid-ready event");
|
8794
8800
|
const t = {
|
8795
8801
|
...structuredClone(e),
|
8796
8802
|
id: nt(),
|
@@ -8806,7 +8812,9 @@ class $ extends Dr {
|
|
8806
8812
|
es(s, r, { host: this }), this._gridElement.append(r);
|
8807
8813
|
const o = this._gridElement.querySelector(
|
8808
8814
|
`[luzmo-grid-item-id="${t.id}"]`
|
8809
|
-
)
|
8815
|
+
);
|
8816
|
+
o.setAttribute("orphan", "true");
|
8817
|
+
const n = {
|
8810
8818
|
x: ((a = t.position) == null ? void 0 : a.col) ?? 0,
|
8811
8819
|
y: ((l = t.position) == null ? void 0 : l.row) ?? 0,
|
8812
8820
|
w: ((d = t.position) == null ? void 0 : d.sizeX) ?? 1,
|
@@ -8815,7 +8823,7 @@ class $ extends Dr {
|
|
8815
8823
|
autoPosition: !0,
|
8816
8824
|
id: t.id
|
8817
8825
|
};
|
8818
|
-
return (h = this._grid) == null || h.makeWidget(o, n), this._activeItemElement && this._cleanupActiveItem(this._activeItemElement), requestAnimationFrame(() => {
|
8826
|
+
return (h = this._grid) == null || h.makeWidget(o, n), this._hasItemAdded = !0, this._activeItemElement && this._cleanupActiveItem(this._activeItemElement), requestAnimationFrame(() => {
|
8819
8827
|
const u = o.getBoundingClientRect();
|
8820
8828
|
(u.bottom > window.innerHeight || u.top < 0) && o.scrollIntoView({ behavior: "smooth", block: "center" });
|
8821
8829
|
}), o;
|
@@ -8881,7 +8889,7 @@ class $ extends Dr {
|
|
8881
8889
|
var s, r;
|
8882
8890
|
const e = this.items.map((o, n) => (o.id = o.id ?? nt(), this._renderItem(o, n)));
|
8883
8891
|
let t = !1;
|
8884
|
-
return this._initialized && ((s = this._fullTheme) != null && s.itemsBackground || (r = this._fullTheme) != null && r.background) && (t = new
|
8892
|
+
return this._initialized && ((s = this._fullTheme) != null && s.itemsBackground || (r = this._fullTheme) != null && r.background) && (t = new C(
|
8885
8893
|
this._fullTheme.itemsBackground ?? this._fullTheme.background
|
8886
8894
|
).luminance < 0.5), D`
|
8887
8895
|
<div
|
package/custom-elements.json
CHANGED
@@ -5769,9 +5769,8 @@
|
|
5769
5769
|
"kind": "field",
|
5770
5770
|
"name": "theme",
|
5771
5771
|
"type": {
|
5772
|
-
"text": "any"
|
5772
|
+
"text": "any | undefined"
|
5773
5773
|
},
|
5774
|
-
"default": "{}",
|
5775
5774
|
"description": "Grid options configuration",
|
5776
5775
|
"attribute": "theme",
|
5777
5776
|
"reflects": true
|
@@ -5927,9 +5926,8 @@
|
|
5927
5926
|
{
|
5928
5927
|
"name": "theme",
|
5929
5928
|
"type": {
|
5930
|
-
"text": "any"
|
5929
|
+
"text": "any | undefined"
|
5931
5930
|
},
|
5932
|
-
"default": "{}",
|
5933
5931
|
"description": "Grid options configuration",
|
5934
5932
|
"fieldName": "theme"
|
5935
5933
|
},
|