kritzel-stencil 0.3.11 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/kritzel-active-users_42.cjs.entry.js +214 -50
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{schema.constants-BNMNpzvA.js → schema.constants-CzfoUWxF.js} +4 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/objects/shape.class.js +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +96 -7
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +302 -35
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +27 -6
- package/dist/collection/configs/default-brush-tool.config.js +1 -0
- package/dist/collection/configs/default-line-tool.config.js +1 -0
- package/dist/collection/configs/default-shape-tool.config.js +1 -0
- package/dist/collection/configs/default-text-tool.config.js +1 -0
- package/dist/collection/constants/version.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-editor.js +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-settings.js +1 -1
- package/dist/components/kritzel-tool-config.js +1 -1
- package/dist/components/{p-D15NO5kE.js → p-DIiGd0LS.js} +1 -1
- package/dist/components/{p-DLlIaDNn.js → p-DLh8x1jK.js} +2 -2
- package/dist/components/p-Do4UlU4e.js +1 -0
- package/dist/components/{p-BFgWBbpu.js → p-Dqjil3Hm.js} +1 -1
- package/dist/components/{p-B0VnbmWu.js → p-EFyZdR89.js} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/kritzel-active-users_42.entry.js +214 -50
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{schema.constants-CqBoZbmA.js → schema.constants-BcT1vV4J.js} +4 -1
- package/dist/esm/stencil.js +1 -1
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-0c95e585.entry.js +9 -0
- package/dist/stencil/{p-CqBoZbmA.js → p-BcT1vV4J.js} +1 -1
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/objects/base-object.class.d.ts +1 -1
- package/dist/types/classes/objects/shape.class.d.ts +1 -1
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +3 -0
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +32 -0
- package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +1 -0
- package/dist/types/components.d.ts +43 -0
- package/dist/types/constants/version.d.ts +1 -1
- package/dist/types/interfaces/object.interface.d.ts +1 -1
- package/dist/types/interfaces/toolbar-control.interface.d.ts +4 -0
- package/package.json +1 -1
- package/dist/components/p-CB7ynHtI.js +0 -1
- package/dist/stencil/p-94992a11.entry.js +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,H as t,c as s,h as i,d as o,t as n}from"./p-BWj1eE2b.js";import{a,C as l}from"./p-CW-VyJgK.js";import{d as r}from"./p-BTSOqHMI.js";import{d as c}from"./p-C8ggg-5h.js";import{d as h}from"./p-CJERvHdy.js";import{d}from"./p-DfH7YY2C.js";import{d as g}from"./p-CWgI1dA0.js";import{d as p}from"./p-DgtrNOWm.js";const u=-1/0,m=1/0,b=-1/0,f=1/0,v={showViewportInfo:!1,showObjectInfo:!1,showSyncProviderInfo:!0,showMigrationInfo:!0},w=[{id:"general",label:"General",icon:"settings"},{id:"viewport",label:"Viewport",icon:"viewport"},{id:"shortcuts",label:"Keyboard Shortcuts",icon:"command"},{id:"developer",label:"Developer Options",icon:"braces"},{id:"about",label:"About",icon:"info"}],y=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.settingsChange=s(this,"settingsChange")}get host(){return this}availableThemes=["light","dark"];shortcuts=[];settings;onSettingsPropChange(e){e&&this.applySettings(e)}isDialogOpen=!1;selectedCategoryId=w[0].id;scaleMin=1e-4;scaleMax=1e3;lockDrawingScale=!0;theme="light";viewportBoundaryLeft=u;viewportBoundaryRight=m;viewportBoundaryTop=b;viewportBoundaryBottom=f;debugInfo={...v};settingsChange;componentWillLoad(){this.settings&&this.applySettings(this.settings)}applySettings(e){"number"==typeof e.scaleMin&&(this.scaleMin=e.scaleMin),"number"==typeof e.scaleMax&&(this.scaleMax=e.scaleMax),"boolean"==typeof e.lockDrawingScale&&(this.lockDrawingScale=e.lockDrawingScale),"string"==typeof e.theme&&(this.theme=e.theme),"number"==typeof e.viewportBoundaryLeft&&(this.viewportBoundaryLeft=e.viewportBoundaryLeft),"number"==typeof e.viewportBoundaryRight&&(this.viewportBoundaryRight=e.viewportBoundaryRight),"number"==typeof e.viewportBoundaryTop&&(this.viewportBoundaryTop=e.viewportBoundaryTop),"number"==typeof e.viewportBoundaryBottom&&(this.viewportBoundaryBottom=e.viewportBoundaryBottom),e.debugInfo&&(this.debugInfo={...v,...e.debugInfo})}emitSettings(){this.settingsChange.emit({scaleMin:this.scaleMin,scaleMax:this.scaleMax,lockDrawingScale:this.lockDrawingScale,theme:this.theme,viewportBoundaryLeft:this.viewportBoundaryLeft,viewportBoundaryRight:this.viewportBoundaryRight,viewportBoundaryTop:this.viewportBoundaryTop,viewportBoundaryBottom:this.viewportBoundaryBottom,debugInfo:this.debugInfo})}handleScaleMinChange=e=>{this.scaleMin=e.detail,this.emitSettings()};handleScaleMaxChange=e=>{this.scaleMax=e.detail,this.emitSettings()};handleLockDrawingScaleChange=e=>{this.lockDrawingScale=e.detail,this.emitSettings()};handleThemeChange=e=>{this.theme=e.detail,this.emitSettings()};handleViewportBoundaryLeftChange=e=>{this.viewportBoundaryLeft=e.detail??u,this.emitSettings()};handleViewportBoundaryRightChange=e=>{this.viewportBoundaryRight=e.detail??m,this.emitSettings()};handleViewportBoundaryTopChange=e=>{this.viewportBoundaryTop=e.detail??b,this.emitSettings()};handleViewportBoundaryBottomChange=e=>{this.viewportBoundaryBottom=e.detail??f,this.emitSettings()};handleDebugInfoChange=e=>t=>{this.debugInfo={...this.debugInfo,[e]:t.detail},this.emitSettings()};async open(){this.isDialogOpen=!0}closeDialog=()=>{this.isDialogOpen=!1};handleCategorySelect=e=>{this.selectedCategoryId=e.detail.item.id};formatKeyCombo(e){const t=[];return e.ctrl&&t.push("Ctrl"),e.shift&&t.push("Shift"),t.push(this.formatKey(e.key)),t.join("+")}formatKey(e){return{Escape:"Esc",Delete:"Del"," ":"Space"}[e]??e.toUpperCase()}groupShortcutsByCategory(){const e=new Map;for(const t of this.shortcuts){const s=e.get(t.category)||[];s.push(t),e.set(t.category,s)}return e}renderCategoryContent(){switch(this.selectedCategoryId){case"general":return i("div",{class:"settings-content"},i("h3",null,"General Settings"),i("div",{class:"settings-group"},i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Theme"),i("p",{class:"settings-description"},"Select a registered color theme for the editor interface."),i("kritzel-dropdown",{options:this.availableThemes.map((e=>({value:e,label:e}))),value:this.theme,onValueChanged:this.handleThemeChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Lock Drawing Scale"),i("p",{class:"settings-description"},"When enabled, drawn objects maintain a fixed visual size regardless of the current zoom level."),i("kritzel-slide-toggle",{checked:this.lockDrawingScale,label:"Lock Drawing Scale",onCheckedChange:this.handleLockDrawingScaleChange}))));case"viewport":return i("div",{class:"settings-content"},i("h3",null,"Viewport Settings"),i("div",{class:"settings-group"},i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Minimum Zoom Level"),i("p",{class:"settings-description"},"Sets the minimum zoom level. Lower values allow zooming out further to see more of the canvas."),i("kritzel-numeric-input",{value:this.scaleMin,min:1e-4,max:1,step:1e-4,onValueChange:this.handleScaleMinChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Maximum Zoom Level"),i("p",{class:"settings-description"},"Sets the maximum zoom level. Higher values allow zooming in closer for detailed work."),i("kritzel-numeric-input",{value:this.scaleMax,min:1,max:1e3,step:1,onValueChange:this.handleScaleMaxChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Viewport Boundary Left"),i("p",{class:"settings-description"},"Left boundary in world coordinates. Set to limit how far left the viewport can pan."),i("kritzel-numeric-input",{value:this.viewportBoundaryLeft,step:100,placeholder:"Infinite",onValueChange:this.handleViewportBoundaryLeftChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Viewport Boundary Right"),i("p",{class:"settings-description"},"Right boundary in world coordinates. Set to limit how far right the viewport can pan."),i("kritzel-numeric-input",{value:this.viewportBoundaryRight,step:100,placeholder:"Infinite",onValueChange:this.handleViewportBoundaryRightChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Viewport Boundary Top"),i("p",{class:"settings-description"},"Top boundary in world coordinates. Set to limit how far up the viewport can pan."),i("kritzel-numeric-input",{value:this.viewportBoundaryTop,step:100,placeholder:"Infinite",onValueChange:this.handleViewportBoundaryTopChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Viewport Boundary Bottom"),i("p",{class:"settings-description"},"Bottom boundary in world coordinates. Set to limit how far down the viewport can pan."),i("kritzel-numeric-input",{value:this.viewportBoundaryBottom,step:100,placeholder:"Infinite",onValueChange:this.handleViewportBoundaryBottomChange}))));case"shortcuts":return i("div",{class:"settings-content"},i("h3",null,"Keyboard Shortcuts"),i("div",{class:"shortcuts-list"},Array.from(this.groupShortcutsByCategory()).map((([e,t])=>i("div",{class:"shortcuts-category",key:e},i("h4",{class:"shortcuts-category-title"},e),i("div",{class:"shortcuts-group"},t.map((e=>i("div",{class:"shortcut-item",key:e.key+e.label},i("span",{class:"shortcut-label"},e.label),i("kbd",{class:"shortcut-key"},this.formatKeyCombo(e)))))))))));case"developer":return i("div",{class:"settings-content"},i("h3",null,"Developer Options"),i("div",{class:"settings-group"},i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Show Viewport Info"),i("p",{class:"settings-description"},"Display viewport debug information such as position, zoom level, and boundaries."),i("kritzel-slide-toggle",{checked:this.debugInfo.showViewportInfo,label:"Show Viewport Info",onCheckedChange:this.handleDebugInfoChange("showViewportInfo")})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Show Object Info"),i("p",{class:"settings-description"},"Display debug information about objects on the canvas."),i("kritzel-slide-toggle",{checked:this.debugInfo.showObjectInfo,label:"Show Object Info",onCheckedChange:this.handleDebugInfoChange("showObjectInfo")})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Show Sync Provider Info"),i("p",{class:"settings-description"},"Display debug information about the sync provider connection status."),i("kritzel-slide-toggle",{checked:this.debugInfo.showSyncProviderInfo,label:"Show Sync Provider Info",onCheckedChange:this.handleDebugInfoChange("showSyncProviderInfo")})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Show Migration Info"),i("p",{class:"settings-description"},"Display debug information about data migrations."),i("kritzel-slide-toggle",{checked:this.debugInfo.showMigrationInfo,label:"Show Migration Info",onCheckedChange:this.handleDebugInfoChange("showMigrationInfo")}))));case"about":return i("div",{class:"settings-content"},i("h3",null,"About"),i("p",null,"Kritzel - A drawing application"),i("p",{class:"version-info"},"Version ","0.3.11"),i("p",{class:"version-info"},"App-State Schema v",l),i("p",{class:"version-info"},"Workspace Schema v",a));default:return null}}render(){return i(o,{key:"46c6792ae9cdd932d3dc71526862c9281c0cefc1"},i("kritzel-dialog",{key:"1cd288cdf8b26bea378665c54bfc14577597fe49",isOpen:this.isDialogOpen,dialogTitle:"Settings",size:"large",contained:!0,onDialogClose:this.closeDialog},i("kritzel-master-detail",{key:"4d07e94ebb09035807356bab4bc7eaca57c36c6c",items:w,selectedItemId:this.selectedCategoryId,onItemSelect:this.handleCategorySelect},this.renderCategoryContent())))}static get watchers(){return{settings:[{onSettingsPropChange:0}]}}static get style(){return":host{display:contents}kritzel-dialog{--kritzel-dialog-body-padding:0;--kritzel-dialog-width-large:800px;--kritzel-dialog-height-large:500px}.footer-button{padding:8px 16px;border-radius:6px;cursor:pointer;font-size:14px}.cancel-button{border:1px solid #ebebeb;background:#fff;color:inherit}.cancel-button:hover{background:#f5f5f5}.settings-content{padding:0}.settings-content h3{margin:0 0 16px 0;font-size:18px;font-weight:600;color:var(--kritzel-settings-content-heading-color, #333333)}.settings-content p{margin:0;font-size:14px;color:var(--kritzel-settings-content-text-color, #666666);line-height:1.5}.settings-group{display:flex;flex-direction:column;gap:24px}.settings-item{display:flex;flex-direction:column;gap:8px}.settings-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.settings-label{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.settings-description{font-size:12px;color:var(--kritzel-settings-description-color, #888888);margin:0;line-height:1.4}.shortcuts-list{display:flex;flex-direction:column;gap:24px}.shortcuts-category{display:flex;flex-direction:column;gap:8px}.shortcuts-category-title{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.shortcuts-group{display:flex;flex-direction:column;gap:4px}.shortcut-item{display:flex;justify-content:space-between;align-items:center;padding:6px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-item-bg, rgba(0, 0, 0, 0.02))}.shortcut-label{font-size:14px;color:var(--kritzel-settings-content-text-color, #666666)}.shortcut-key{font-family:monospace;font-size:12px;padding:2px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-key-bg, #f0f0f0);color:var(--kritzel-settings-shortcut-key-color, #333333);border:1px solid var(--kritzel-settings-shortcut-key-border, #ddd)}"}},[513,"kritzel-settings",{availableThemes:[16],shortcuts:[16],settings:[16],isDialogOpen:[32],selectedCategoryId:[32],scaleMin:[32],scaleMax:[32],lockDrawingScale:[32],theme:[32],viewportBoundaryLeft:[32],viewportBoundaryRight:[32],viewportBoundaryTop:[32],viewportBoundaryBottom:[32],debugInfo:[32],open:[64]},void 0,{settings:[{onSettingsPropChange:0}]}]);function k(){"undefined"!=typeof customElements&&["kritzel-settings","kritzel-dialog","kritzel-dropdown","kritzel-icon","kritzel-master-detail","kritzel-numeric-input","kritzel-slide-toggle"].forEach((e=>{switch(e){case"kritzel-settings":customElements.get(n(e))||customElements.define(n(e),y);break;case"kritzel-dialog":customElements.get(n(e))||r();break;case"kritzel-dropdown":customElements.get(n(e))||c();break;case"kritzel-icon":customElements.get(n(e))||h();break;case"kritzel-master-detail":customElements.get(n(e))||d();break;case"kritzel-numeric-input":customElements.get(n(e))||g();break;case"kritzel-slide-toggle":customElements.get(n(e))||p()}}))}export{y as K,k as d}
|
|
1
|
+
import{p as e,H as t,c as s,h as i,d as o,t as n}from"./p-BWj1eE2b.js";import{a,C as l}from"./p-CW-VyJgK.js";import{d as r}from"./p-BTSOqHMI.js";import{d as c}from"./p-C8ggg-5h.js";import{d as h}from"./p-CJERvHdy.js";import{d}from"./p-DfH7YY2C.js";import{d as g}from"./p-CWgI1dA0.js";import{d as p}from"./p-DgtrNOWm.js";const u=-1/0,m=1/0,b=-1/0,f=1/0,v={showViewportInfo:!1,showObjectInfo:!1,showSyncProviderInfo:!0,showMigrationInfo:!0},w=[{id:"general",label:"General",icon:"settings"},{id:"viewport",label:"Viewport",icon:"viewport"},{id:"shortcuts",label:"Keyboard Shortcuts",icon:"command"},{id:"developer",label:"Developer Options",icon:"braces"},{id:"about",label:"About",icon:"info"}],y=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.settingsChange=s(this,"settingsChange")}get host(){return this}availableThemes=["light","dark"];shortcuts=[];settings;onSettingsPropChange(e){e&&this.applySettings(e)}isDialogOpen=!1;selectedCategoryId=w[0].id;scaleMin=1e-4;scaleMax=1e3;lockDrawingScale=!0;theme="light";viewportBoundaryLeft=u;viewportBoundaryRight=m;viewportBoundaryTop=b;viewportBoundaryBottom=f;debugInfo={...v};settingsChange;componentWillLoad(){this.settings&&this.applySettings(this.settings)}applySettings(e){"number"==typeof e.scaleMin&&(this.scaleMin=e.scaleMin),"number"==typeof e.scaleMax&&(this.scaleMax=e.scaleMax),"boolean"==typeof e.lockDrawingScale&&(this.lockDrawingScale=e.lockDrawingScale),"string"==typeof e.theme&&(this.theme=e.theme),"number"==typeof e.viewportBoundaryLeft&&(this.viewportBoundaryLeft=e.viewportBoundaryLeft),"number"==typeof e.viewportBoundaryRight&&(this.viewportBoundaryRight=e.viewportBoundaryRight),"number"==typeof e.viewportBoundaryTop&&(this.viewportBoundaryTop=e.viewportBoundaryTop),"number"==typeof e.viewportBoundaryBottom&&(this.viewportBoundaryBottom=e.viewportBoundaryBottom),e.debugInfo&&(this.debugInfo={...v,...e.debugInfo})}emitSettings(){this.settingsChange.emit({scaleMin:this.scaleMin,scaleMax:this.scaleMax,lockDrawingScale:this.lockDrawingScale,theme:this.theme,viewportBoundaryLeft:this.viewportBoundaryLeft,viewportBoundaryRight:this.viewportBoundaryRight,viewportBoundaryTop:this.viewportBoundaryTop,viewportBoundaryBottom:this.viewportBoundaryBottom,debugInfo:this.debugInfo})}handleScaleMinChange=e=>{this.scaleMin=e.detail,this.emitSettings()};handleScaleMaxChange=e=>{this.scaleMax=e.detail,this.emitSettings()};handleLockDrawingScaleChange=e=>{this.lockDrawingScale=e.detail,this.emitSettings()};handleThemeChange=e=>{this.theme=e.detail,this.emitSettings()};handleViewportBoundaryLeftChange=e=>{this.viewportBoundaryLeft=e.detail??u,this.emitSettings()};handleViewportBoundaryRightChange=e=>{this.viewportBoundaryRight=e.detail??m,this.emitSettings()};handleViewportBoundaryTopChange=e=>{this.viewportBoundaryTop=e.detail??b,this.emitSettings()};handleViewportBoundaryBottomChange=e=>{this.viewportBoundaryBottom=e.detail??f,this.emitSettings()};handleDebugInfoChange=e=>t=>{this.debugInfo={...this.debugInfo,[e]:t.detail},this.emitSettings()};async open(){this.isDialogOpen=!0}closeDialog=()=>{this.isDialogOpen=!1};handleCategorySelect=e=>{this.selectedCategoryId=e.detail.item.id};formatKeyCombo(e){const t=[];return e.ctrl&&t.push("Ctrl"),e.shift&&t.push("Shift"),t.push(this.formatKey(e.key)),t.join("+")}formatKey(e){return{Escape:"Esc",Delete:"Del"," ":"Space"}[e]??e.toUpperCase()}groupShortcutsByCategory(){const e=new Map;for(const t of this.shortcuts){const s=e.get(t.category)||[];s.push(t),e.set(t.category,s)}return e}renderCategoryContent(){switch(this.selectedCategoryId){case"general":return i("div",{class:"settings-content"},i("h3",null,"General Settings"),i("div",{class:"settings-group"},i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Theme"),i("p",{class:"settings-description"},"Select a registered color theme for the editor interface."),i("kritzel-dropdown",{options:this.availableThemes.map((e=>({value:e,label:e}))),value:this.theme,onValueChanged:this.handleThemeChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Lock Drawing Scale"),i("p",{class:"settings-description"},"When enabled, drawn objects maintain a fixed visual size regardless of the current zoom level."),i("kritzel-slide-toggle",{checked:this.lockDrawingScale,label:"Lock Drawing Scale",onCheckedChange:this.handleLockDrawingScaleChange}))));case"viewport":return i("div",{class:"settings-content"},i("h3",null,"Viewport Settings"),i("div",{class:"settings-group"},i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Minimum Zoom Level"),i("p",{class:"settings-description"},"Sets the minimum zoom level. Lower values allow zooming out further to see more of the canvas."),i("kritzel-numeric-input",{value:this.scaleMin,min:1e-4,max:1,step:1e-4,onValueChange:this.handleScaleMinChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Maximum Zoom Level"),i("p",{class:"settings-description"},"Sets the maximum zoom level. Higher values allow zooming in closer for detailed work."),i("kritzel-numeric-input",{value:this.scaleMax,min:1,max:1e3,step:1,onValueChange:this.handleScaleMaxChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Viewport Boundary Left"),i("p",{class:"settings-description"},"Left boundary in world coordinates. Set to limit how far left the viewport can pan."),i("kritzel-numeric-input",{value:this.viewportBoundaryLeft,step:100,placeholder:"Infinite",onValueChange:this.handleViewportBoundaryLeftChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Viewport Boundary Right"),i("p",{class:"settings-description"},"Right boundary in world coordinates. Set to limit how far right the viewport can pan."),i("kritzel-numeric-input",{value:this.viewportBoundaryRight,step:100,placeholder:"Infinite",onValueChange:this.handleViewportBoundaryRightChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Viewport Boundary Top"),i("p",{class:"settings-description"},"Top boundary in world coordinates. Set to limit how far up the viewport can pan."),i("kritzel-numeric-input",{value:this.viewportBoundaryTop,step:100,placeholder:"Infinite",onValueChange:this.handleViewportBoundaryTopChange})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Viewport Boundary Bottom"),i("p",{class:"settings-description"},"Bottom boundary in world coordinates. Set to limit how far down the viewport can pan."),i("kritzel-numeric-input",{value:this.viewportBoundaryBottom,step:100,placeholder:"Infinite",onValueChange:this.handleViewportBoundaryBottomChange}))));case"shortcuts":return i("div",{class:"settings-content"},i("h3",null,"Keyboard Shortcuts"),i("div",{class:"shortcuts-list"},Array.from(this.groupShortcutsByCategory()).map((([e,t])=>i("div",{class:"shortcuts-category",key:e},i("h4",{class:"shortcuts-category-title"},e),i("div",{class:"shortcuts-group"},t.map((e=>i("div",{class:"shortcut-item",key:e.key+e.label},i("span",{class:"shortcut-label"},e.label),i("kbd",{class:"shortcut-key"},this.formatKeyCombo(e)))))))))));case"developer":return i("div",{class:"settings-content"},i("h3",null,"Developer Options"),i("div",{class:"settings-group"},i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Show Viewport Info"),i("p",{class:"settings-description"},"Display viewport debug information such as position, zoom level, and boundaries."),i("kritzel-slide-toggle",{checked:this.debugInfo.showViewportInfo,label:"Show Viewport Info",onCheckedChange:this.handleDebugInfoChange("showViewportInfo")})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Show Object Info"),i("p",{class:"settings-description"},"Display debug information about objects on the canvas."),i("kritzel-slide-toggle",{checked:this.debugInfo.showObjectInfo,label:"Show Object Info",onCheckedChange:this.handleDebugInfoChange("showObjectInfo")})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Show Sync Provider Info"),i("p",{class:"settings-description"},"Display debug information about the sync provider connection status."),i("kritzel-slide-toggle",{checked:this.debugInfo.showSyncProviderInfo,label:"Show Sync Provider Info",onCheckedChange:this.handleDebugInfoChange("showSyncProviderInfo")})),i("div",{class:"settings-item"},i("label",{class:"settings-label"},"Show Migration Info"),i("p",{class:"settings-description"},"Display debug information about data migrations."),i("kritzel-slide-toggle",{checked:this.debugInfo.showMigrationInfo,label:"Show Migration Info",onCheckedChange:this.handleDebugInfoChange("showMigrationInfo")}))));case"about":return i("div",{class:"settings-content"},i("h3",null,"About"),i("p",null,"Kritzel - A drawing application"),i("p",{class:"version-info"},"Version ","0.3.12"),i("p",{class:"version-info"},"App-State Schema v",l),i("p",{class:"version-info"},"Workspace Schema v",a));default:return null}}render(){return i(o,{key:"46c6792ae9cdd932d3dc71526862c9281c0cefc1"},i("kritzel-dialog",{key:"1cd288cdf8b26bea378665c54bfc14577597fe49",isOpen:this.isDialogOpen,dialogTitle:"Settings",size:"large",contained:!0,onDialogClose:this.closeDialog},i("kritzel-master-detail",{key:"4d07e94ebb09035807356bab4bc7eaca57c36c6c",items:w,selectedItemId:this.selectedCategoryId,onItemSelect:this.handleCategorySelect},this.renderCategoryContent())))}static get watchers(){return{settings:[{onSettingsPropChange:0}]}}static get style(){return":host{display:contents}kritzel-dialog{--kritzel-dialog-body-padding:0;--kritzel-dialog-width-large:800px;--kritzel-dialog-height-large:500px}.footer-button{padding:8px 16px;border-radius:6px;cursor:pointer;font-size:14px}.cancel-button{border:1px solid #ebebeb;background:#fff;color:inherit}.cancel-button:hover{background:#f5f5f5}.settings-content{padding:0}.settings-content h3{margin:0 0 16px 0;font-size:18px;font-weight:600;color:var(--kritzel-settings-content-heading-color, #333333)}.settings-content p{margin:0;font-size:14px;color:var(--kritzel-settings-content-text-color, #666666);line-height:1.5}.settings-group{display:flex;flex-direction:column;gap:24px}.settings-item{display:flex;flex-direction:column;gap:8px}.settings-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.settings-label{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.settings-description{font-size:12px;color:var(--kritzel-settings-description-color, #888888);margin:0;line-height:1.4}.shortcuts-list{display:flex;flex-direction:column;gap:24px}.shortcuts-category{display:flex;flex-direction:column;gap:8px}.shortcuts-category-title{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.shortcuts-group{display:flex;flex-direction:column;gap:4px}.shortcut-item{display:flex;justify-content:space-between;align-items:center;padding:6px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-item-bg, rgba(0, 0, 0, 0.02))}.shortcut-label{font-size:14px;color:var(--kritzel-settings-content-text-color, #666666)}.shortcut-key{font-family:monospace;font-size:12px;padding:2px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-key-bg, #f0f0f0);color:var(--kritzel-settings-shortcut-key-color, #333333);border:1px solid var(--kritzel-settings-shortcut-key-border, #ddd)}"}},[513,"kritzel-settings",{availableThemes:[16],shortcuts:[16],settings:[16],isDialogOpen:[32],selectedCategoryId:[32],scaleMin:[32],scaleMax:[32],lockDrawingScale:[32],theme:[32],viewportBoundaryLeft:[32],viewportBoundaryRight:[32],viewportBoundaryTop:[32],viewportBoundaryBottom:[32],debugInfo:[32],open:[64]},void 0,{settings:[{onSettingsPropChange:0}]}]);function k(){"undefined"!=typeof customElements&&["kritzel-settings","kritzel-dialog","kritzel-dropdown","kritzel-icon","kritzel-master-detail","kritzel-numeric-input","kritzel-slide-toggle"].forEach((e=>{switch(e){case"kritzel-settings":customElements.get(n(e))||customElements.define(n(e),y);break;case"kritzel-dialog":customElements.get(n(e))||r();break;case"kritzel-dropdown":customElements.get(n(e))||c();break;case"kritzel-icon":customElements.get(n(e))||h();break;case"kritzel-master-detail":customElements.get(n(e))||d();break;case"kritzel-numeric-input":customElements.get(n(e))||g();break;case"kritzel-slide-toggle":customElements.get(n(e))||p()}}))}export{y as K,k as d}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HocuspocusProvider, a as HocuspocusProviderWebsocket } from './schema.constants-
|
|
2
|
-
export { C as APP_STATE_MIGRATIONS, A as AssetNotFoundError, F as CURRENT_APP_STATE_SCHEMA_VERSION, G as CURRENT_WORKSPACE_SCHEMA_VERSION, w as DEFAULT_ASSET_STORAGE_CONFIG, D as DEFAULT_BRUSH_CONFIG, v as DEFAULT_LINE_TOOL_CONFIG, u as DEFAULT_TEXT_CONFIG, q as IndexedDBAssetProvider, I as IndexedDBSyncProvider, z as KritzelAlignment, s as KritzelAnchorManager, p as KritzelAssetResolver, K as KritzelBaseObject, h as KritzelBrushTool, n as KritzelCursorHelper, j as KritzelEraserTool, f as KritzelGroup, d as KritzelImage, k as KritzelImageTool, e as KritzelLine, i as KritzelLineTool, c as KritzelPath, o as KritzelSelectionTool, g as KritzelShape, m as KritzelShapeTool, b as KritzelText, l as KritzelTextTool, t as KritzelThemeManager, r as KritzelWorkspace, S as ShapeType, W as WORKSPACE_EXPORT_VERSION, E as WORKSPACE_MIGRATIONS, y as darkTheme, x as lightTheme, B as runMigrations } from './schema.constants-
|
|
1
|
+
import { H as HocuspocusProvider, a as HocuspocusProviderWebsocket } from './schema.constants-BcT1vV4J.js';
|
|
2
|
+
export { C as APP_STATE_MIGRATIONS, A as AssetNotFoundError, F as CURRENT_APP_STATE_SCHEMA_VERSION, G as CURRENT_WORKSPACE_SCHEMA_VERSION, w as DEFAULT_ASSET_STORAGE_CONFIG, D as DEFAULT_BRUSH_CONFIG, v as DEFAULT_LINE_TOOL_CONFIG, u as DEFAULT_TEXT_CONFIG, q as IndexedDBAssetProvider, I as IndexedDBSyncProvider, z as KritzelAlignment, s as KritzelAnchorManager, p as KritzelAssetResolver, K as KritzelBaseObject, h as KritzelBrushTool, n as KritzelCursorHelper, j as KritzelEraserTool, f as KritzelGroup, d as KritzelImage, k as KritzelImageTool, e as KritzelLine, i as KritzelLineTool, c as KritzelPath, o as KritzelSelectionTool, g as KritzelShape, m as KritzelShapeTool, b as KritzelText, l as KritzelTextTool, t as KritzelThemeManager, r as KritzelWorkspace, S as ShapeType, W as WORKSPACE_EXPORT_VERSION, E as WORKSPACE_MIGRATIONS, y as darkTheme, x as lightTheme, B as runMigrations } from './schema.constants-BcT1vV4J.js';
|
|
3
3
|
import * as Y from 'yjs';
|
|
4
4
|
import { WebsocketProvider } from 'y-websocket';
|
|
5
5
|
import 'y-indexeddb';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-D9HaikfQ.js';
|
|
2
|
-
import { c as KritzelPath, e as KritzelLine, J as KritzelColorHelper, o as KritzelSelectionTool, h as KritzelBrushTool, i as KritzelLineTool, m as KritzelShapeTool, l as KritzelTextTool, L as KritzelDevicesHelper, M as KritzelMouseButton, N as DEFAULT_STROKE_SIZES, O as DEFAULT_COLOR_PALETTE, S as ShapeType, I as IndexedDBSyncProvider, D as DEFAULT_BRUSH_CONFIG, j as KritzelEraserTool, v as DEFAULT_LINE_TOOL_CONFIG, u as DEFAULT_TEXT_CONFIG, k as KritzelImageTool, z as KritzelAlignment, w as DEFAULT_ASSET_STORAGE_CONFIG, T as ThemeHelper, y as darkTheme, x as lightTheme, P as KritzelSelectionGroup, Q as KritzelSelectionBox, R as KritzelIconRegistry, U as KritzelKeyboardHelper, V as KritzelBaseHandler, K as KritzelBaseObject, r as KritzelWorkspace, f as KritzelGroup, d as KritzelImage, g as KritzelShape, b as KritzelText, B as runMigrations, G as CURRENT_WORKSPACE_SCHEMA_VERSION, E as WORKSPACE_MIGRATIONS, F as CURRENT_APP_STATE_SCHEMA_VERSION, C as APP_STATE_MIGRATIONS, X as ObjectHelper, n as KritzelCursorHelper, s as KritzelAnchorManager, t as KritzelThemeManager, p as KritzelAssetResolver, Y as KritzelClassHelper, Z as KritzelEventHelper, W as WORKSPACE_EXPORT_VERSION } from './schema.constants-
|
|
2
|
+
import { c as KritzelPath, e as KritzelLine, J as KritzelColorHelper, o as KritzelSelectionTool, h as KritzelBrushTool, i as KritzelLineTool, m as KritzelShapeTool, l as KritzelTextTool, L as KritzelDevicesHelper, M as KritzelMouseButton, N as DEFAULT_STROKE_SIZES, O as DEFAULT_COLOR_PALETTE, S as ShapeType, I as IndexedDBSyncProvider, D as DEFAULT_BRUSH_CONFIG, j as KritzelEraserTool, v as DEFAULT_LINE_TOOL_CONFIG, u as DEFAULT_TEXT_CONFIG, k as KritzelImageTool, z as KritzelAlignment, w as DEFAULT_ASSET_STORAGE_CONFIG, T as ThemeHelper, y as darkTheme, x as lightTheme, P as KritzelSelectionGroup, Q as KritzelSelectionBox, R as KritzelIconRegistry, U as KritzelKeyboardHelper, V as KritzelBaseHandler, K as KritzelBaseObject, r as KritzelWorkspace, f as KritzelGroup, d as KritzelImage, g as KritzelShape, b as KritzelText, B as runMigrations, G as CURRENT_WORKSPACE_SCHEMA_VERSION, E as WORKSPACE_MIGRATIONS, F as CURRENT_APP_STATE_SCHEMA_VERSION, C as APP_STATE_MIGRATIONS, X as ObjectHelper, n as KritzelCursorHelper, s as KritzelAnchorManager, t as KritzelThemeManager, p as KritzelAssetResolver, Y as KritzelClassHelper, Z as KritzelEventHelper, W as WORKSPACE_EXPORT_VERSION } from './schema.constants-BcT1vV4J.js';
|
|
3
3
|
import * as Y from 'yjs';
|
|
4
4
|
import 'y-indexeddb';
|
|
5
5
|
import 'y-websocket';
|
|
@@ -929,6 +929,7 @@ const KritzelControls = class {
|
|
|
929
929
|
this.isControlsReady = createEvent(this, "isControlsReady");
|
|
930
930
|
}
|
|
931
931
|
get host() { return getElement(this); }
|
|
932
|
+
visible = true;
|
|
932
933
|
controls = [];
|
|
933
934
|
activeControl = null;
|
|
934
935
|
isUtilityPanelVisible = true;
|
|
@@ -1153,13 +1154,13 @@ const KritzelControls = class {
|
|
|
1153
1154
|
// Separate tool controls from config control
|
|
1154
1155
|
const toolControls = this.internalControls.filter(c => c.type === 'tool' || c.type === 'separator');
|
|
1155
1156
|
const configControl = this.internalControls.find(c => c.type === 'config' && c.name === this.firstConfig?.name);
|
|
1156
|
-
return (h(Host, { key: '
|
|
1157
|
+
return (h(Host, { key: '0f40a136a6a9556080d922d346318045794421a8', style: { display: this.visible ? '' : 'none' }, class: {
|
|
1157
1158
|
mobile: this.isTouchDevice,
|
|
1158
|
-
} }, this.isUtilityPanelVisible && (h("kritzel-utility-panel", { key: '
|
|
1159
|
+
} }, this.isUtilityPanelVisible && (h("kritzel-utility-panel", { key: 'd543e7575cb30e54d9362eddf7c7221fb8cce5f5', style: {
|
|
1159
1160
|
position: 'absolute',
|
|
1160
1161
|
bottom: '56px',
|
|
1161
1162
|
left: '12px',
|
|
1162
|
-
}, undoState: this.undoState, onUndo: () => this.kritzelEngine?.undo(), onRedo: () => this.kritzelEngine?.redo(), onDelete: () => this.kritzelEngine?.delete() })), h("div", { key: '
|
|
1163
|
+
}, undoState: this.undoState, onUndo: () => this.kritzelEngine?.undo(), onRedo: () => this.kritzelEngine?.redo(), onDelete: () => this.kritzelEngine?.delete() })), h("div", { key: '1083380152e9d1b51c35da335533c20ca2ca8fcc', class: "kritzel-controls" }, h("div", { key: '11ef0fb76c30ffda0e30f01d43229ca2142a5854', class: { 'scroll-indicator-left': true, 'visible': this.canScrollLeft } }), h("div", { key: '269924a8859aece37ff31202307d4feaecbbde86', class: "kritzel-tools-scroll", ref: el => (this.toolsScrollRef = el), onScroll: this.handleToolsScroll }, toolControls.map(control => {
|
|
1163
1164
|
// Check if this control has sub-options (split-button)
|
|
1164
1165
|
if (control.subOptions?.length) {
|
|
1165
1166
|
const selectedSubOption = this.getSelectedSubOption(control);
|
|
@@ -1189,10 +1190,10 @@ const KritzelControls = class {
|
|
|
1189
1190
|
'kritzel-control': true,
|
|
1190
1191
|
'selected': this.activeControl?.name === control?.name,
|
|
1191
1192
|
}, key: control.name, "data-testid": `tool-${control.name}`, onClick: _event => this.handleControlClick?.(control), "aria-label": control.name.charAt(0).toUpperCase() + control.name.slice(1) }, h("kritzel-icon", { name: control.icon })));
|
|
1192
|
-
})), h("div", { key: '
|
|
1193
|
+
})), h("div", { key: '8b97a5bba3ac4992482e8f433d7ba6197918a914', class: { 'scroll-indicator-right': true, 'visible': this.canScrollRight && !(configControl && this.activeControl && hasConfigUI) } }), configControl && this.activeControl && (h("div", { class: {
|
|
1193
1194
|
'kritzel-config-container': true,
|
|
1194
1195
|
'visible': hasConfigUI,
|
|
1195
|
-
}, key: configControl.name }, h("div", { key: '
|
|
1196
|
+
}, key: configControl.name }, h("div", { key: 'd9adef8c2acc8d9b9d745174050ce78960b89b58', class: { 'config-gradient-left': true, 'visible': this.needsScrolling } }), h("kritzel-tooltip", { key: '7605bbd2b6335c89c57aa68952293f26efad6b4b', anchorElement: this.host.shadowRoot?.querySelector('.kritzel-config-container'), triggerElement: this.configTriggerRef }, h("kritzel-tool-config", { key: '27b0f41442215e78b692fa44bb665444a4993b89', tool: this.activeControl.tool, theme: this.theme, engine: this.kritzelEngine, onToolChange: event => this.handleToolChange?.(event), onDisplayValuesChange: this.handleDisplayValuesChange, style: { width: '100%', height: '100%' } })), h("div", { key: '1fb5979b1c531593acf5086861b22b7d78d03e8d', tabIndex: hasConfigUI ? 0 : -1, class: "kritzel-config", "data-testid": "tool-config", ref: el => {
|
|
1196
1197
|
if (el)
|
|
1197
1198
|
this.configTriggerRef = el;
|
|
1198
1199
|
}, onKeyDown: event => {
|
|
@@ -1201,7 +1202,7 @@ const KritzelControls = class {
|
|
|
1201
1202
|
}
|
|
1202
1203
|
}, style: {
|
|
1203
1204
|
cursor: 'pointer',
|
|
1204
|
-
} }, this.displayValues && (h("div", { key: '
|
|
1205
|
+
} }, this.displayValues && (h("div", { key: '3713ef344630f6b4d88df2e83992018859ddb18c', class: "color-container" }, h("kritzel-color", { key: 'c2679f68efae77c6daeb98be9e03d5320d51a73a', value: this.displayValues.color, theme: this.theme, size: 18, style: {
|
|
1205
1206
|
borderRadius: '50%',
|
|
1206
1207
|
border: 'none',
|
|
1207
1208
|
} })))))))));
|
|
@@ -2140,6 +2141,7 @@ const DEFAULT_SHAPE_CONFIG = {
|
|
|
2140
2141
|
fillColor: { light: 'transparent', dark: 'transparent' },
|
|
2141
2142
|
strokeColor: DEFAULT_COLOR_PALETTE[0],
|
|
2142
2143
|
strokeWidth: 4,
|
|
2144
|
+
opacity: 1,
|
|
2143
2145
|
fontColor: DEFAULT_COLOR_PALETTE[0],
|
|
2144
2146
|
fontSize: 16,
|
|
2145
2147
|
fontFamily: 'Arial',
|
|
@@ -2342,6 +2344,7 @@ const KritzelEditor = class {
|
|
|
2342
2344
|
isUtilityPanelVisible = true;
|
|
2343
2345
|
isWorkspaceManagerVisible = true;
|
|
2344
2346
|
isMoreMenuVisible = true;
|
|
2347
|
+
isObjectDistanceFadingActive = false;
|
|
2345
2348
|
syncConfig = DEFAULT_SYNC_CONFIG;
|
|
2346
2349
|
assetStorageConfig = DEFAULT_ASSET_STORAGE_CONFIG;
|
|
2347
2350
|
/** The element to use as the target for the cursor. Defaults to the editor container if not set. */
|
|
@@ -2457,12 +2460,18 @@ const KritzelEditor = class {
|
|
|
2457
2460
|
async addObject(object) {
|
|
2458
2461
|
return this.engineRef.addObject(object);
|
|
2459
2462
|
}
|
|
2463
|
+
async addObjects(objects) {
|
|
2464
|
+
return this.engineRef.addObjects(objects);
|
|
2465
|
+
}
|
|
2460
2466
|
async updateObject(object, updatedProperties) {
|
|
2461
2467
|
return this.engineRef.updateObject(object, updatedProperties);
|
|
2462
2468
|
}
|
|
2463
2469
|
async removeObject(object) {
|
|
2464
2470
|
return this.engineRef.removeObject(object);
|
|
2465
2471
|
}
|
|
2472
|
+
async removeObjects(objects) {
|
|
2473
|
+
return this.engineRef.removeObjects(objects);
|
|
2474
|
+
}
|
|
2466
2475
|
async getSelectedObjects() {
|
|
2467
2476
|
return this.engineRef.getSelectedObjects();
|
|
2468
2477
|
}
|
|
@@ -2937,31 +2946,31 @@ const KritzelEditor = class {
|
|
|
2937
2946
|
const isLoggedIn = this.isLoggedIn;
|
|
2938
2947
|
const shouldShowCurrentUser = isLoggedIn;
|
|
2939
2948
|
const shouldShowLoginButton = this.isReady && !!this.loginConfig && !isLoggedIn;
|
|
2940
|
-
return (h(Host, { key: '
|
|
2949
|
+
return (h(Host, { key: '440621eb23598732c63d4be92ae16785d84b3d6f', style: {
|
|
2941
2950
|
opacity: this.isEditorVisible ? '1' : '0',
|
|
2942
2951
|
visibility: this.isEditorVisible ? 'visible' : 'hidden',
|
|
2943
2952
|
transition: 'opacity 0.2s ease-in-out, visibility 0.2s ease-in-out',
|
|
2944
|
-
} }, h("div", { key: '
|
|
2953
|
+
} }, h("div", { key: 'b20c930c8094f7ab9db8fdb09428cf34a2cab024', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: 'a6ff7e54fb3d45f4a3b1d009b12d2f6229d14d87', visible: this.isWorkspaceManagerVisible, workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), h("kritzel-back-to-content", { key: 'a3cbb86082c2f0768b7457ec25740d27200e287b', visible: this.isBackToContentButtonVisible, onBackToContent: () => this.backToContent() })), h("kritzel-engine", { key: '82e611de33c40997943e1fd702f0b601fadbf591', ref: el => {
|
|
2945
2954
|
if (el) {
|
|
2946
2955
|
this.engineRef = el;
|
|
2947
2956
|
}
|
|
2948
|
-
}, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.theme, themes: this.themes, debugInfo: this.debugInfo, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.handleWorkspacesChange(event), onActiveWorkspaceChange: event => this.handleActiveWorkspaceChange(event), onObjectsChange: event => this.handleObjectsChange(event), onObjectsAdded: event => this.handleObjectsAdded(event), onObjectsRemoved: event => this.handleObjectsRemoved(event), onObjectsUpdated: event => this.handleObjectsUpdated(event), onUndoStateChange: event => this.handleUndoStateChange(event), onObjectsInViewportChange: event => this.handleObjectsInViewportChange(event), onViewportChange: event => this.handleViewportChange(event), onAwarenessChange: event => this.handleAwarenessChange(event) }), h("kritzel-controls", { key: '
|
|
2957
|
+
}, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, isObjectDistanceFadingActive: this.isObjectDistanceFadingActive, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.theme, themes: this.themes, debugInfo: this.debugInfo, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.handleWorkspacesChange(event), onActiveWorkspaceChange: event => this.handleActiveWorkspaceChange(event), onObjectsChange: event => this.handleObjectsChange(event), onObjectsAdded: event => this.handleObjectsAdded(event), onObjectsRemoved: event => this.handleObjectsRemoved(event), onObjectsUpdated: event => this.handleObjectsUpdated(event), onUndoStateChange: event => this.handleUndoStateChange(event), onObjectsInViewportChange: event => this.handleObjectsInViewportChange(event), onViewportChange: event => this.handleViewportChange(event), onAwarenessChange: event => this.handleAwarenessChange(event) }), h("kritzel-controls", { key: 'eb48df395318bde3fc0bc48784510bf5139bc9e8', visible: this.isControlsVisible, class: { 'keyboard-open': this.isVirtualKeyboardOpen }, ref: el => {
|
|
2949
2958
|
if (el) {
|
|
2950
2959
|
this.controlsRef = el;
|
|
2951
2960
|
}
|
|
2952
|
-
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: '
|
|
2961
|
+
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: '1259089ca70c634621f7e2db274868b12a3e5e8a', class: "top-right-buttons" }, h("kritzel-settings", { key: 'b38b01040714827a5d824694b481edb8094eafd8', ref: el => {
|
|
2953
2962
|
if (el) {
|
|
2954
2963
|
this.settingsRef = el;
|
|
2955
2964
|
}
|
|
2956
|
-
}, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], settings: this.currentSettingsConfig, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: '
|
|
2965
|
+
}, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], settings: this.currentSettingsConfig, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: 'a678999cac4f3618c44d1340b6905ec2f3061dd5', ref: el => {
|
|
2957
2966
|
if (el) {
|
|
2958
2967
|
this.exportRef = el;
|
|
2959
2968
|
}
|
|
2960
|
-
}, workspaceName: this.activeWorkspace?.name || 'workspace', onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: '
|
|
2969
|
+
}, workspaceName: this.activeWorkspace?.name || 'workspace', onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: '7d0b70c7347e7fda4e96a59b27b8fb6c2eb77f49', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: 'ed364648df937fb1e84d850953fee51f6e54e95e', user: this.user }), shouldShowLoginButton && (h("kritzel-button", { key: 'dd24afa0746a311ac4a27000281fef28bddf844a', onButtonClick: () => this.loginDialogRef?.open() }, "Sign in")), h("kritzel-more-menu", { key: '713da1a5313809083470a8a23c0531e9e198c4bd', items: this.moreMenuItems, visible: this.isMoreMenuVisible }), h("kritzel-share-dialog", { key: '37f80fdb7b1087926b72ece7693f816c9f85f746', ref: el => {
|
|
2961
2970
|
if (el) {
|
|
2962
2971
|
this.shareDialogRef = el;
|
|
2963
2972
|
}
|
|
2964
|
-
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: '
|
|
2973
|
+
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: 'f5b59522082824bc236784a9083f1d425852d487', ref: el => {
|
|
2965
2974
|
if (el) {
|
|
2966
2975
|
this.loginDialogRef = el;
|
|
2967
2976
|
}
|
|
@@ -26502,6 +26511,11 @@ const KritzelEngine = class {
|
|
|
26502
26511
|
onLockDrawingScaleChange(newValue) {
|
|
26503
26512
|
this.core.store.state.lockDrawingScale = newValue;
|
|
26504
26513
|
}
|
|
26514
|
+
/** When true, objects fade based on distance to the viewport center. */
|
|
26515
|
+
isObjectDistanceFadingActive = false;
|
|
26516
|
+
onIsObjectDistanceFadingActiveChange() {
|
|
26517
|
+
this.core.rerender();
|
|
26518
|
+
}
|
|
26505
26519
|
/** The current theme to apply to the editor */
|
|
26506
26520
|
theme = 'light';
|
|
26507
26521
|
onThemeChange(newValue) {
|
|
@@ -26936,7 +26950,7 @@ const KritzelEngine = class {
|
|
|
26936
26950
|
this.core.deselectAllObjects();
|
|
26937
26951
|
object.id = object.generateId();
|
|
26938
26952
|
object._core = this.core;
|
|
26939
|
-
object.scale = this.core.store.state.scale;
|
|
26953
|
+
object.scale = object.scale ?? this.core.store.state.scale;
|
|
26940
26954
|
object.zIndex = this.core.store.currentZIndex;
|
|
26941
26955
|
object.workspaceId = this.core.store.state.activeWorkspace.id;
|
|
26942
26956
|
// Handle KritzelText: recreate the editor now that _core is available
|
|
@@ -26965,7 +26979,7 @@ const KritzelEngine = class {
|
|
|
26965
26979
|
const oldId = child.id;
|
|
26966
26980
|
child.id = child.generateId();
|
|
26967
26981
|
child._core = this.core;
|
|
26968
|
-
child.scale = this.core.store.state.scale;
|
|
26982
|
+
child.scale = child.scale ?? this.core.store.state.scale;
|
|
26969
26983
|
child.zIndex = this.core.store.currentZIndex;
|
|
26970
26984
|
child.workspaceId = this.core.store.state.activeWorkspace.id;
|
|
26971
26985
|
idRemapping.set(oldId, child.id);
|
|
@@ -27011,6 +27025,82 @@ const KritzelEngine = class {
|
|
|
27011
27025
|
this.emitObjectsAdded([object]);
|
|
27012
27026
|
return object;
|
|
27013
27027
|
}
|
|
27028
|
+
/**
|
|
27029
|
+
* Adds multiple objects to the canvas in a single batch operation.
|
|
27030
|
+
* All objects are inserted within one Yjs transaction (single undo step),
|
|
27031
|
+
* triggering only one rerender cycle. Intended for programmatic streaming
|
|
27032
|
+
* scenarios where per-object overhead would cause stutter.
|
|
27033
|
+
* @param objects - The object instances to add.
|
|
27034
|
+
* @returns The added objects.
|
|
27035
|
+
*/
|
|
27036
|
+
async addObjects(objects) {
|
|
27037
|
+
if (objects.length === 0) {
|
|
27038
|
+
return [];
|
|
27039
|
+
}
|
|
27040
|
+
this.core.store.objects.transaction(() => {
|
|
27041
|
+
for (const object of objects) {
|
|
27042
|
+
object.id = object.generateId();
|
|
27043
|
+
object._core = this.core;
|
|
27044
|
+
object.zIndex = this.core.store.currentZIndex;
|
|
27045
|
+
object.workspaceId = this.core.store.state.activeWorkspace.id;
|
|
27046
|
+
if (KritzelClassHelper.isInstanceOf(object, 'KritzelText')) {
|
|
27047
|
+
const pendingContent = object.content;
|
|
27048
|
+
object.editor = object.createEditor();
|
|
27049
|
+
if (pendingContent) {
|
|
27050
|
+
object.setContent(pendingContent);
|
|
27051
|
+
}
|
|
27052
|
+
}
|
|
27053
|
+
if (KritzelClassHelper.isInstanceOf(object, 'KritzelGroup') && object._pendingChildren.length > 0) {
|
|
27054
|
+
const idRemapping = new Map();
|
|
27055
|
+
const allFlushedChildren = [];
|
|
27056
|
+
const flushGroup = (group) => {
|
|
27057
|
+
if (group._pendingChildren.length === 0) {
|
|
27058
|
+
return;
|
|
27059
|
+
}
|
|
27060
|
+
const pending = group._pendingChildren;
|
|
27061
|
+
group._pendingChildren = [];
|
|
27062
|
+
group.childIds = [];
|
|
27063
|
+
pending.forEach(child => {
|
|
27064
|
+
const oldId = child.id;
|
|
27065
|
+
child.id = child.generateId();
|
|
27066
|
+
child._core = this.core;
|
|
27067
|
+
child.zIndex = this.core.store.currentZIndex;
|
|
27068
|
+
child.workspaceId = this.core.store.state.activeWorkspace.id;
|
|
27069
|
+
idRemapping.set(oldId, child.id);
|
|
27070
|
+
group.childIds.push(child.id);
|
|
27071
|
+
allFlushedChildren.push(child);
|
|
27072
|
+
if (KritzelClassHelper.isInstanceOf(child, 'KritzelGroup')) {
|
|
27073
|
+
flushGroup(child);
|
|
27074
|
+
}
|
|
27075
|
+
});
|
|
27076
|
+
};
|
|
27077
|
+
flushGroup(object);
|
|
27078
|
+
allFlushedChildren.forEach(child => {
|
|
27079
|
+
if (KritzelClassHelper.isInstanceOf(child, 'KritzelLine')) {
|
|
27080
|
+
if (child.startAnchor && idRemapping.has(child.startAnchor.objectId)) {
|
|
27081
|
+
child.startAnchor = { objectId: idRemapping.get(child.startAnchor.objectId) };
|
|
27082
|
+
}
|
|
27083
|
+
if (child.endAnchor && idRemapping.has(child.endAnchor.objectId)) {
|
|
27084
|
+
child.endAnchor = { objectId: idRemapping.get(child.endAnchor.objectId) };
|
|
27085
|
+
}
|
|
27086
|
+
}
|
|
27087
|
+
});
|
|
27088
|
+
allFlushedChildren.forEach(child => {
|
|
27089
|
+
this.core.addObject(child);
|
|
27090
|
+
});
|
|
27091
|
+
object.finalize();
|
|
27092
|
+
this.core.anchorManager.rebuildIndex();
|
|
27093
|
+
}
|
|
27094
|
+
this.core.addObject(object);
|
|
27095
|
+
}
|
|
27096
|
+
});
|
|
27097
|
+
this.core.rerender();
|
|
27098
|
+
await new Promise(resolve => {
|
|
27099
|
+
requestAnimationFrame(() => requestAnimationFrame(() => resolve()));
|
|
27100
|
+
});
|
|
27101
|
+
this.emitObjectsAdded(objects);
|
|
27102
|
+
return objects;
|
|
27103
|
+
}
|
|
27014
27104
|
/**
|
|
27015
27105
|
* Updates properties of an existing canvas object.
|
|
27016
27106
|
* @param object - The object to update.
|
|
@@ -27040,6 +27130,28 @@ const KritzelEngine = class {
|
|
|
27040
27130
|
this.emitObjectsRemoved([object]);
|
|
27041
27131
|
return object;
|
|
27042
27132
|
}
|
|
27133
|
+
/**
|
|
27134
|
+
* Removes multiple objects from the canvas in a single batch operation.
|
|
27135
|
+
* All removals happen within one Yjs transaction (single undo step),
|
|
27136
|
+
* triggering only one rerender cycle. Intended for programmatic streaming
|
|
27137
|
+
* scenarios where per-object overhead would cause stutter.
|
|
27138
|
+
* @param objects - The objects to remove.
|
|
27139
|
+
* @returns The removed objects.
|
|
27140
|
+
*/
|
|
27141
|
+
async removeObjects(objects) {
|
|
27142
|
+
const objectsMap = this.core.store.objects;
|
|
27143
|
+
if (!objectsMap || objects.length === 0) {
|
|
27144
|
+
return [];
|
|
27145
|
+
}
|
|
27146
|
+
objectsMap.transaction(() => {
|
|
27147
|
+
for (const object of objects) {
|
|
27148
|
+
this.core.removeObject(object);
|
|
27149
|
+
}
|
|
27150
|
+
});
|
|
27151
|
+
this.core.rerender();
|
|
27152
|
+
this.emitObjectsRemoved(objects);
|
|
27153
|
+
return objects;
|
|
27154
|
+
}
|
|
27043
27155
|
/** Returns the currently selected objects. Returns an empty array if nothing is selected. */
|
|
27044
27156
|
async getSelectedObjects() {
|
|
27045
27157
|
const selectionGroup = this.core.store.selectionGroup;
|
|
@@ -27694,6 +27806,12 @@ const KritzelEngine = class {
|
|
|
27694
27806
|
undoStackSize: 0,
|
|
27695
27807
|
redoStackSize: 0,
|
|
27696
27808
|
};
|
|
27809
|
+
_objectDistanceFadeNearScale = 1;
|
|
27810
|
+
_objectDistanceFadeFarScale = 0.15;
|
|
27811
|
+
_objectDistanceFadeMinOpacity = 0;
|
|
27812
|
+
_objectDistanceFadeCloseStartScale = 2;
|
|
27813
|
+
_objectDistanceFadeCloseMaxScale = 4;
|
|
27814
|
+
_objectDistanceFadeCloseMinOpacity = 0;
|
|
27697
27815
|
syncLoadingState() {
|
|
27698
27816
|
this.core.store.state.isLoading = this._isWorkspaceLoading || this.isLoading;
|
|
27699
27817
|
}
|
|
@@ -28017,6 +28135,54 @@ const KritzelEngine = class {
|
|
|
28017
28135
|
KritzelKeyboardHelper.forceHideKeyboard();
|
|
28018
28136
|
this.core.rerender();
|
|
28019
28137
|
}
|
|
28138
|
+
getObjectDistanceFadeMultiplier(objectScale, viewportScale) {
|
|
28139
|
+
if (!this.isObjectDistanceFadingActive) {
|
|
28140
|
+
return 1;
|
|
28141
|
+
}
|
|
28142
|
+
const safeViewportScale = Math.max(Number.isFinite(viewportScale) ? viewportScale : 1, Number.EPSILON);
|
|
28143
|
+
const safeObjectScale = Math.max(Number.isFinite(objectScale) ? objectScale : 1, Number.EPSILON);
|
|
28144
|
+
const normalizedScale = safeViewportScale / safeObjectScale;
|
|
28145
|
+
const farFadeMultiplier = this.getFarDistanceFadeMultiplier(normalizedScale);
|
|
28146
|
+
const closeFadeMultiplier = this.getCloseDistanceFadeMultiplier(normalizedScale);
|
|
28147
|
+
return Math.min(farFadeMultiplier, closeFadeMultiplier);
|
|
28148
|
+
}
|
|
28149
|
+
getFarDistanceFadeMultiplier(normalizedScale) {
|
|
28150
|
+
if (normalizedScale >= this._objectDistanceFadeNearScale) {
|
|
28151
|
+
return 1;
|
|
28152
|
+
}
|
|
28153
|
+
if (normalizedScale <= this._objectDistanceFadeFarScale) {
|
|
28154
|
+
return this._objectDistanceFadeMinOpacity;
|
|
28155
|
+
}
|
|
28156
|
+
const progress = (this._objectDistanceFadeNearScale - normalizedScale) /
|
|
28157
|
+
(this._objectDistanceFadeNearScale - this._objectDistanceFadeFarScale);
|
|
28158
|
+
const smooth = progress * progress * (3 - 2 * progress);
|
|
28159
|
+
return 1 - smooth * (1 - this._objectDistanceFadeMinOpacity);
|
|
28160
|
+
}
|
|
28161
|
+
getCloseDistanceFadeMultiplier(normalizedScale) {
|
|
28162
|
+
if (normalizedScale <= this._objectDistanceFadeCloseStartScale) {
|
|
28163
|
+
return 1;
|
|
28164
|
+
}
|
|
28165
|
+
if (normalizedScale >= this._objectDistanceFadeCloseMaxScale) {
|
|
28166
|
+
return this._objectDistanceFadeCloseMinOpacity;
|
|
28167
|
+
}
|
|
28168
|
+
const progress = (normalizedScale - this._objectDistanceFadeCloseStartScale) /
|
|
28169
|
+
(this._objectDistanceFadeCloseMaxScale - this._objectDistanceFadeCloseStartScale);
|
|
28170
|
+
const smooth = progress * progress * (3 - 2 * progress);
|
|
28171
|
+
return 1 - smooth * (1 - this._objectDistanceFadeCloseMinOpacity);
|
|
28172
|
+
}
|
|
28173
|
+
shouldApplyDistanceFade(object) {
|
|
28174
|
+
return (!KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup') &&
|
|
28175
|
+
!KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionBox'));
|
|
28176
|
+
}
|
|
28177
|
+
getObjectEffectiveOpacity(object, viewportScale) {
|
|
28178
|
+
const safeObjectOpacity = Number.isFinite(object.opacity) ? object.opacity : 1;
|
|
28179
|
+
const distanceFadeMultiplier = this.shouldApplyDistanceFade(object)
|
|
28180
|
+
? this.getObjectDistanceFadeMultiplier(object.scale, viewportScale)
|
|
28181
|
+
: 1;
|
|
28182
|
+
const multiplied = (object.markedForRemoval ? 0.5 : 1) * safeObjectOpacity * distanceFadeMultiplier;
|
|
28183
|
+
const overridden = ((object.markedForRemoval ? 0.5 : safeObjectOpacity) * distanceFadeMultiplier).toString();
|
|
28184
|
+
return { multiplied, overridden };
|
|
28185
|
+
}
|
|
28020
28186
|
render() {
|
|
28021
28187
|
if (!this.viewport) {
|
|
28022
28188
|
return (h(Host, null, this.core.store.state.isLoading && (h("div", { class: "workspace-loading-overlay" }, h("span", { class: "workspace-loading-spinner" }), "Loading..."))));
|
|
@@ -28026,6 +28192,7 @@ const KritzelEngine = class {
|
|
|
28026
28192
|
const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
|
|
28027
28193
|
const baseHandleSize = parseFloat(baseHandleSizePx);
|
|
28028
28194
|
const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
|
|
28195
|
+
const viewportScale = this.core.store.state.scale;
|
|
28029
28196
|
const viewportCenterX = this.core.store.state.viewportWidth / 2 + this.core.store.state.translateX;
|
|
28030
28197
|
const viewportCenterY = this.core.store.state.viewportHeight / 2 + this.core.store.state.translateY;
|
|
28031
28198
|
const visibleObjects = this.core.store.objectsInViewport;
|
|
@@ -28039,39 +28206,34 @@ const KritzelEngine = class {
|
|
|
28039
28206
|
return (h(Host, null, this.core.store.state.isLoading && (h("div", { class: "workspace-loading-overlay" }, h("span", { class: "workspace-loading-spinner" }), "Loading...")), this.core.store.state.debugInfo.showViewportInfo && (h("div", { class: "debug-panel" }, h("div", null, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), h("div", null, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), h("div", null, "TranslateX: ", this.core.store.state?.translateX), h("div", null, "TranslateY: ", this.core.store.state?.translateY), h("div", null, "ViewportWidth: ", this.core.store.state?.viewportWidth), h("div", null, "ViewportHeight: ", this.core.store.state?.viewportHeight), h("div", null, "PointerCount: ", this.core.store.state.pointers.size), h("div", null, "Scale: ", this.core.store.state?.scale), h("div", null, "ActiveTool: ", this.core.store.state?.activeTool?.name), h("div", null, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), h("div", null, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), h("div", null, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), h("div", null, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), h("div", null, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", null, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", null, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", null, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", null, "IsRotationHandleHovered: ", this.core.store.state.isRotationHandleHovered ? 'true' : 'false'), h("div", null, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), h("div", null, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), h("div", null, "IsPointerDown: ", this.core.store.isPointerDown ? 'true' : 'false'), h("div", null, "PointerX: ", this.core.store.state?.pointerX), h("div", null, "PointerY: ", this.core.store.state?.pointerY), h("div", null, "TotalObjects: ", this.core.store.totalObjectCount), h("div", null, "ObjectsInViewport: ", this.core.store.objectsInViewport.length), h("div", null, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), h("div", null, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")"))), h("div", { id: "origin", class: "origin", style: {
|
|
28040
28207
|
transform: `matrix(${this.core.store.state?.scale}, 0, 0, ${this.core.store.state?.scale}, ${this.core.store.state?.translateX}, ${this.core.store.state?.translateY})`,
|
|
28041
28208
|
} }, visibleObjects?.map(object => {
|
|
28209
|
+
const { multiplied: effectiveOpacity, overridden: effectiveOpacityString } = this.getObjectEffectiveOpacity(object, viewportScale);
|
|
28042
28210
|
return (h("div", { key: object.id, id: object.id, class: "object", style: {
|
|
28043
28211
|
transform: object?.transformationMatrix,
|
|
28044
28212
|
transformOrigin: 'top left',
|
|
28045
28213
|
position: 'absolute',
|
|
28046
28214
|
zIndex: object.zIndex.toString(),
|
|
28047
28215
|
pointerEvents: this.core.store.state.isScaling ? 'none' : 'auto',
|
|
28048
|
-
} }, KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && ((
|
|
28049
|
-
|
|
28050
|
-
|
|
28051
|
-
|
|
28052
|
-
|
|
28053
|
-
|
|
28054
|
-
|
|
28055
|
-
|
|
28056
|
-
|
|
28057
|
-
|
|
28058
|
-
|
|
28059
|
-
|
|
28060
|
-
|
|
28061
|
-
|
|
28062
|
-
|
|
28063
|
-
|
|
28064
|
-
|
|
28065
|
-
|
|
28066
|
-
|
|
28067
|
-
|
|
28068
|
-
|
|
28069
|
-
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28070
|
-
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28071
|
-
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28072
|
-
overflow: 'visible',
|
|
28073
|
-
}, viewBox: object?.viewBox }, (object.hasStartArrow || object.hasEndArrow) && (h("defs", null, object.hasStartArrow && (h("marker", { id: object.startMarkerId, markerWidth: object.getArrowSize('start'), markerHeight: object.getArrowSize('start'), refX: 0, refY: object.getArrowSize('start') / 2, orient: "auto-start-reverse", markerUnits: "userSpaceOnUse" }, h("path", { d: object.getArrowPath(object.arrows?.start?.style), fill: KritzelColorHelper.applyOpacity(object.getArrowFill('start'), effectiveOpacity), transform: `scale(${object.getArrowSize('start') / 10})` }))), object.hasEndArrow && (h("marker", { id: object.endMarkerId, markerWidth: object.getArrowSize('end'), markerHeight: object.getArrowSize('end'), refX: 0, refY: object.getArrowSize('end') / 2, orient: "auto", markerUnits: "userSpaceOnUse" }, h("path", { d: object.getArrowPath(object.arrows?.end?.style), fill: KritzelColorHelper.applyOpacity(object.getArrowFill('end'), effectiveOpacity), transform: `scale(${object.getArrowSize('end') / 10})` }))))), h("path", { d: this.core.anchorManager.computeClippedLinePath(object), fill: "none", stroke: "transparent", "stroke-width": Math.max(object?.strokeWidth || 0, 10), "stroke-linecap": "round" }), h("path", { d: this.core.anchorManager.computeClippedLinePath(object), fill: "none", stroke: KritzelColorHelper.applyOpacity(object?.stroke, effectiveOpacity, currentTheme), "stroke-width": object?.strokeWidth, "stroke-linecap": "round", "marker-start": object.hasStartArrow ? `url(#${object.startMarkerId})` : undefined, "marker-end": object.hasEndArrow ? `url(#${object.endMarkerId})` : undefined })));
|
|
28074
|
-
})(), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && object.loadState === 'ready' && (h("img", { ref: el => el && object.mount(el), src: object.resolvedSrc || object.src, style: {
|
|
28216
|
+
} }, KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (h("svg", { ref: el => el && object.mount(el), xmlns: "http://www.w3.org/2000/svg", style: {
|
|
28217
|
+
height: object?.totalHeight + 'px',
|
|
28218
|
+
width: object?.totalWidth + 'px',
|
|
28219
|
+
left: '0',
|
|
28220
|
+
top: '0',
|
|
28221
|
+
position: 'absolute',
|
|
28222
|
+
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28223
|
+
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28224
|
+
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28225
|
+
overflow: 'visible',
|
|
28226
|
+
}, viewBox: object?.viewBox }, h("path", { d: object?.d, fill: KritzelColorHelper.applyOpacity(object.fill, effectiveOpacity, currentTheme), stroke: KritzelColorHelper.applyOpacity(object?.stroke, effectiveOpacity, currentTheme), "shape-rendering": object.isLowRes() ? 'optimizeSpeed' : 'auto' }))), KritzelClassHelper.isInstanceOf(object, 'KritzelLine') && (h("svg", { ref: el => el && object.mount(el), xmlns: "http://www.w3.org/2000/svg", style: {
|
|
28227
|
+
height: object?.totalHeight + 'px',
|
|
28228
|
+
width: object?.totalWidth + 'px',
|
|
28229
|
+
left: '0',
|
|
28230
|
+
top: '0',
|
|
28231
|
+
position: 'absolute',
|
|
28232
|
+
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28233
|
+
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28234
|
+
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28235
|
+
overflow: 'visible',
|
|
28236
|
+
}, viewBox: object?.viewBox }, (object.hasStartArrow || object.hasEndArrow) && (h("defs", null, object.hasStartArrow && (h("marker", { id: object.startMarkerId, markerWidth: object.getArrowSize('start'), markerHeight: object.getArrowSize('start'), refX: 0, refY: object.getArrowSize('start') / 2, orient: "auto-start-reverse", markerUnits: "userSpaceOnUse" }, h("path", { d: object.getArrowPath(object.arrows?.start?.style), fill: KritzelColorHelper.applyOpacity(object.getArrowFill('start'), effectiveOpacity), transform: `scale(${object.getArrowSize('start') / 10})` }))), object.hasEndArrow && (h("marker", { id: object.endMarkerId, markerWidth: object.getArrowSize('end'), markerHeight: object.getArrowSize('end'), refX: 0, refY: object.getArrowSize('end') / 2, orient: "auto", markerUnits: "userSpaceOnUse" }, h("path", { d: object.getArrowPath(object.arrows?.end?.style), fill: KritzelColorHelper.applyOpacity(object.getArrowFill('end'), effectiveOpacity), transform: `scale(${object.getArrowSize('end') / 10})` }))))), h("path", { d: this.core.anchorManager.computeClippedLinePath(object), fill: "none", stroke: "transparent", "stroke-width": Math.max(object?.strokeWidth || 0, 10), "stroke-linecap": "round" }), h("path", { d: this.core.anchorManager.computeClippedLinePath(object), fill: "none", stroke: KritzelColorHelper.applyOpacity(object?.stroke, effectiveOpacity, currentTheme), "stroke-width": object?.strokeWidth, "stroke-linecap": "round", "marker-start": object.hasStartArrow ? `url(#${object.startMarkerId})` : undefined, "marker-end": object.hasEndArrow ? `url(#${object.endMarkerId})` : undefined }))), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && object.loadState === 'ready' && (h("img", { ref: el => el && object.mount(el), src: object.resolvedSrc || object.src, style: {
|
|
28075
28237
|
position: 'absolute',
|
|
28076
28238
|
left: '0',
|
|
28077
28239
|
top: '0',
|
|
@@ -28079,7 +28241,7 @@ const KritzelEngine = class {
|
|
|
28079
28241
|
height: object.totalHeight + 'px',
|
|
28080
28242
|
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28081
28243
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28082
|
-
opacity:
|
|
28244
|
+
opacity: effectiveOpacityString,
|
|
28083
28245
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28084
28246
|
backgroundColor: KritzelColorHelper.resolveThemeColor(object.backgroundColor, currentTheme),
|
|
28085
28247
|
borderColor: KritzelColorHelper.resolveThemeColor(object.borderColor, currentTheme),
|
|
@@ -28097,7 +28259,7 @@ const KritzelEngine = class {
|
|
|
28097
28259
|
height: object.totalHeight + 'px',
|
|
28098
28260
|
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28099
28261
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28100
|
-
opacity:
|
|
28262
|
+
opacity: effectiveOpacityString,
|
|
28101
28263
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28102
28264
|
backgroundColor: KritzelColorHelper.resolveThemeColor({ light: '#e5e7eb', dark: '#2a2a2a' }, currentTheme),
|
|
28103
28265
|
borderColor: object.loadState === 'error'
|
|
@@ -28121,7 +28283,7 @@ const KritzelEngine = class {
|
|
|
28121
28283
|
height: object.totalHeight + 'px',
|
|
28122
28284
|
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28123
28285
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28124
|
-
opacity:
|
|
28286
|
+
opacity: effectiveOpacityString,
|
|
28125
28287
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28126
28288
|
backgroundColor: KritzelColorHelper.resolveThemeColor(object.backgroundColor, currentTheme),
|
|
28127
28289
|
borderColor: KritzelColorHelper.resolveThemeColor(object.borderColor, currentTheme),
|
|
@@ -28162,7 +28324,7 @@ const KritzelEngine = class {
|
|
|
28162
28324
|
height: object.totalHeight + 'px',
|
|
28163
28325
|
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28164
28326
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28165
|
-
opacity:
|
|
28327
|
+
opacity: effectiveOpacityString,
|
|
28166
28328
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28167
28329
|
} }, h("div", { id: "text-object", ref: el => el && object.mount(el), onPointerDown: e => object.handlePointerDown(e), onPointerMove: e => object.handlePointerMove(e), onPointerUp: e => object.handlePointerUp(e), style: {
|
|
28168
28330
|
minWidth: object.initialWidth + 'px',
|
|
@@ -28175,7 +28337,6 @@ const KritzelEngine = class {
|
|
|
28175
28337
|
backgroundColor: KritzelColorHelper.resolveThemeColor(object.backgroundColor, currentTheme),
|
|
28176
28338
|
overflow: 'visible',
|
|
28177
28339
|
} }))), KritzelClassHelper.isInstanceOf(object, 'KritzelShape') && (() => {
|
|
28178
|
-
const effectiveOpacity = (object.markedForRemoval ? 0.5 : 1) * object.opacity;
|
|
28179
28340
|
const fillResolved = KritzelColorHelper.resolveThemeColor(object.fillColor, currentTheme);
|
|
28180
28341
|
const strokeResolved = KritzelColorHelper.resolveThemeColor(object.strokeColor, currentTheme);
|
|
28181
28342
|
const isFilled = !!fillResolved && fillResolved !== 'transparent';
|
|
@@ -28217,7 +28378,7 @@ const KritzelEngine = class {
|
|
|
28217
28378
|
left: `${object.totalWidth}px`,
|
|
28218
28379
|
top: '0',
|
|
28219
28380
|
zIndex: (object.zIndex + 2).toString(),
|
|
28220
|
-
} }, h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "Id: ", object.id), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "userId: ", object.userId), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "width: ", object.width), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "height: ", object.height), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "translateX: ", object.translateX), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "translateY: ", object.translateY), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "rotationDegrees: ", object.rotationDegrees), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "zIndex: ", object.zIndex), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (h("div", null, h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "assetId: ", object.assetId), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "mimeType: ", object.mimeType))))), (this.core.displaySelectionGroupUI(object) || this.core.displaySelectionLineUI(object)) &&
|
|
28381
|
+
} }, h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "Id: ", object.id), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "userId: ", object.userId), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "width: ", object.width), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "height: ", object.height), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "translateX: ", object.translateX), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "translateY: ", object.translateY), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "scale: ", object.scale), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "rotationDegrees: ", object.rotationDegrees), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "zIndex: ", object.zIndex), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (h("div", null, h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "assetId: ", object.assetId), h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "mimeType: ", object.mimeType))))), (this.core.displaySelectionGroupUI(object) || this.core.displaySelectionLineUI(object)) &&
|
|
28221
28382
|
(() => {
|
|
28222
28383
|
const isSelectionGroup = KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup');
|
|
28223
28384
|
const localClientId = this.core.store.objects?.localClientId;
|
|
@@ -28492,6 +28653,9 @@ const KritzelEngine = class {
|
|
|
28492
28653
|
"lockDrawingScale": [{
|
|
28493
28654
|
"onLockDrawingScaleChange": 0
|
|
28494
28655
|
}],
|
|
28656
|
+
"isObjectDistanceFadingActive": [{
|
|
28657
|
+
"onIsObjectDistanceFadingActiveChange": 0
|
|
28658
|
+
}],
|
|
28495
28659
|
"theme": [{
|
|
28496
28660
|
"onThemeChange": 0
|
|
28497
28661
|
}],
|
|
@@ -29763,7 +29927,7 @@ const KritzelPortal = class {
|
|
|
29763
29927
|
* This file is auto-generated by the version bump scripts.
|
|
29764
29928
|
* Do not modify manually.
|
|
29765
29929
|
*/
|
|
29766
|
-
const KRITZEL_VERSION = '0.3.
|
|
29930
|
+
const KRITZEL_VERSION = '0.3.12';
|
|
29767
29931
|
|
|
29768
29932
|
const kritzelSettingsCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-body-padding:0;--kritzel-dialog-width-large:800px;--kritzel-dialog-height-large:500px}.footer-button{padding:8px 16px;border-radius:6px;cursor:pointer;font-size:14px}.cancel-button{border:1px solid #ebebeb;background:#fff;color:inherit}.cancel-button:hover{background:#f5f5f5}.settings-content{padding:0}.settings-content h3{margin:0 0 16px 0;font-size:18px;font-weight:600;color:var(--kritzel-settings-content-heading-color, #333333)}.settings-content p{margin:0;font-size:14px;color:var(--kritzel-settings-content-text-color, #666666);line-height:1.5}.settings-group{display:flex;flex-direction:column;gap:24px}.settings-item{display:flex;flex-direction:column;gap:8px}.settings-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.settings-label{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.settings-description{font-size:12px;color:var(--kritzel-settings-description-color, #888888);margin:0;line-height:1.4}.shortcuts-list{display:flex;flex-direction:column;gap:24px}.shortcuts-category{display:flex;flex-direction:column;gap:8px}.shortcuts-category-title{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.shortcuts-group{display:flex;flex-direction:column;gap:4px}.shortcut-item{display:flex;justify-content:space-between;align-items:center;padding:6px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-item-bg, rgba(0, 0, 0, 0.02))}.shortcut-label{font-size:14px;color:var(--kritzel-settings-content-text-color, #666666)}.shortcut-key{font-family:monospace;font-size:12px;padding:2px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-key-bg, #f0f0f0);color:var(--kritzel-settings-shortcut-key-color, #333333);border:1px solid var(--kritzel-settings-shortcut-key-border, #ddd)}`;
|
|
29769
29933
|
|