@editora/ui-editor 0.1.5 → 0.1.7

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.
@@ -0,0 +1,5 @@
1
+ import { ElementBase } from '@editora/ui-core';
2
+ export declare class UIBlockControls extends ElementBase {
3
+ constructor();
4
+ protected render(): void;
5
+ }
@@ -0,0 +1,8 @@
1
+ import { ElementBase } from '@editora/ui-core';
2
+ export declare class UICommandPalette extends ElementBase {
3
+ static get observedAttributes(): string[];
4
+ constructor();
5
+ open(): void;
6
+ close(): void;
7
+ protected render(): void;
8
+ }
@@ -0,0 +1,11 @@
1
+ import { ElementBase } from '@editora/ui-core';
2
+ export declare class UIContextMenu extends ElementBase {
3
+ static get observedAttributes(): string[];
4
+ private _portalEl;
5
+ private _cleanup;
6
+ constructor();
7
+ openFor(anchorId: string): void;
8
+ close(): void;
9
+ openAt(x: number, y: number): void;
10
+ protected render(): void;
11
+ }
@@ -0,0 +1,12 @@
1
+ import { ElementBase } from '@editora/ui-core';
2
+ export declare class UIFloatingToolbar extends ElementBase {
3
+ static get observedAttributes(): string[];
4
+ private _portalEl;
5
+ private _cleanup;
6
+ constructor();
7
+ connectedCallback(): void;
8
+ attributeChangedCallback(): void;
9
+ showForAnchorId(id: string): void;
10
+ hide(): void;
11
+ protected render(): void;
12
+ }
@@ -0,0 +1,8 @@
1
+ import { ElementBase } from '@editora/ui-core';
2
+ export declare class UIPluginPanel extends ElementBase {
3
+ static get observedAttributes(): string[];
4
+ constructor();
5
+ open(): void;
6
+ close(): void;
7
+ protected render(): void;
8
+ }
@@ -0,0 +1,10 @@
1
+ import { ElementBase } from '@editora/ui-core';
2
+ export declare class UISelectionPopup extends ElementBase {
3
+ static get observedAttributes(): string[];
4
+ private _portalEl;
5
+ private _cleanup;
6
+ constructor();
7
+ openFor(anchorId: string): void;
8
+ close(): void;
9
+ protected render(): void;
10
+ }
package/dist/index.cjs.js CHANGED
@@ -2,7 +2,7 @@
2
2
  .palette { width: 520px; max-width: 90vw; background: white; border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,0.12); padding: 8px; }
3
3
  .list { max-height: 300px; overflow: auto; }
4
4
  .item { padding: 8px; cursor: pointer; }
5
- `;class c extends i.ElementBase{static get observedAttributes(){return["open"]}constructor(){super()}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}render(){if(!this.hasAttribute("open")){this.setContent("");return}const s=`<div class="palette" role="dialog" aria-modal="true">
5
+ `;class c extends i.ElementBase{static get observedAttributes(){return["open"]}constructor(){super()}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}render(){if(!this.hasAttribute("open")){this.setContent("");return}this.setContent(`<style>${m}</style><div class="palette" role="dialog" aria-modal="true">
6
6
  <input part="search" placeholder="Type a command..." />
7
7
  <div class="list"><slot></slot></div>
8
- </div>`;this.setContent(`<style>${m}</style>${s}`),Array.from(this.querySelectorAll('[slot="command"]')).forEach((e,n)=>{e.addEventListener("click",()=>this.dispatchEvent(new CustomEvent("select",{detail:{index:n}})))})}}typeof customElements<"u"&&!customElements.get("ui-command-palette")&&customElements.define("ui-command-palette",c);class a extends i.ElementBase{constructor(){super(),this._portalEl=null,this._cleanup=void 0}static get observedAttributes(){return["anchor-id","open"]}openFor(t){this.setAttribute("anchor-id",t),this.setAttribute("open","")}close(){this.removeAttribute("open")}openAt(t,s){const o={getBoundingClientRect:()=>({top:s,bottom:s,left:t,right:t,width:0,height:0})};this.setAttribute("open",""),this._portalEl||(this._portalEl=document.createElement("div")),this._portalEl.innerHTML="";const e=document.createElement("div");e.className="context-menu";const n=this.querySelector('[slot="content"]');n&&e.appendChild(n.cloneNode(!0)),this._portalEl.appendChild(e),this._cleanup=i.showPortalFor(o,this._portalEl,{placement:"bottom",shift:!0})}render(){const t=this.getAttribute("anchor-id"),s=this.hasAttribute("open");if(this.setContent("<slot></slot>"),s&&t){const o=document.getElementById(t);if(!o){if(this._cleanup){try{this._cleanup()}catch{}this._cleanup=void 0}this._portalEl=null;return}this._portalEl||(this._portalEl=document.createElement("div")),this._portalEl.innerHTML="";const e=document.createElement("div");e.className="context-menu";const n=this.querySelector('[slot="content"]');n&&e.appendChild(n.cloneNode(!0)),this._portalEl.appendChild(e),this._cleanup=i.showPortalFor(o,this._portalEl,"bottom")}else this._cleanup&&(this._cleanup(),this._cleanup=void 0),this._portalEl=null}}typeof customElements<"u"&&!customElements.get("ui-context-menu")&&customElements.define("ui-context-menu",a);class u extends i.ElementBase{static get observedAttributes(){return["open","position"]}constructor(){super()}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}render(){const t=this.hasAttribute("open"),s=this.getAttribute("position")||"right";if(!t){this.setContent("");return}const o=`<div class="panel panel-${s}"><slot></slot></div>`;this.setContent(o)}}typeof customElements<"u"&&!customElements.get("ui-plugin-panel")&&customElements.define("ui-plugin-panel",u);class p extends i.ElementBase{constructor(){super()}render(){this.setContent('<div class="block-controls"><slot></slot></div>')}}typeof customElements<"u"&&!customElements.get("ui-block-controls")&&customElements.define("ui-block-controls",p);class h extends i.ElementBase{constructor(){super(),this._portalEl=null,this._cleanup=void 0}static get observedAttributes(){return["anchor-id","open"]}openFor(t){this.setAttribute("anchor-id",t),this.setAttribute("open","")}close(){this.removeAttribute("open")}render(){const t=this.getAttribute("anchor-id"),s=this.hasAttribute("open");if(this.setContent("<slot></slot>"),s&&t){const o=document.getElementById(t);if(!o)return;this._portalEl||(this._portalEl=document.createElement("div")),this._portalEl.innerHTML="";const e=document.createElement("div");e.className="selection-popup";const n=this.querySelector('[slot="content"]');n&&e.appendChild(n.cloneNode(!0)),this._portalEl.appendChild(e),this._cleanup=i.showPortalFor(o,this._portalEl,"top")}else this._cleanup&&(this._cleanup(),this._cleanup=void 0),this._portalEl=null}}typeof customElements<"u"&&!customElements.get("ui-selection-popup")&&customElements.define("ui-selection-popup",h);exports.UIBlockControls=p;exports.UICommandPalette=c;exports.UIContextMenu=a;exports.UIFloatingToolbar=r;exports.UIPluginPanel=u;exports.UISelectionPopup=h;
8
+ </div>`),Array.from(this.querySelectorAll('[slot="command"]')).forEach((e,n)=>{e.addEventListener("click",()=>this.dispatchEvent(new CustomEvent("select",{detail:{index:n}})))})}}typeof customElements<"u"&&!customElements.get("ui-command-palette")&&customElements.define("ui-command-palette",c);class a extends i.ElementBase{constructor(){super(),this._portalEl=null,this._cleanup=void 0}static get observedAttributes(){return["anchor-id","open"]}openFor(t){this.setAttribute("anchor-id",t),this.setAttribute("open","")}close(){this.removeAttribute("open")}openAt(t,s){const o={getBoundingClientRect:()=>({top:s,bottom:s,left:t,right:t,width:0,height:0})};this.setAttribute("open",""),this._portalEl||(this._portalEl=document.createElement("div")),this._portalEl.innerHTML="";const e=document.createElement("div");e.className="context-menu";const n=this.querySelector('[slot="content"]');n&&e.appendChild(n.cloneNode(!0)),this._portalEl.appendChild(e),this._cleanup=i.showPortalFor(o,this._portalEl,{placement:"bottom",shift:!0})}render(){const t=this.getAttribute("anchor-id"),s=this.hasAttribute("open");if(this.setContent("<slot></slot>"),s&&t){const o=document.getElementById(t);if(!o){if(this._cleanup){try{this._cleanup()}catch{}this._cleanup=void 0}this._portalEl=null;return}this._portalEl||(this._portalEl=document.createElement("div")),this._portalEl.innerHTML="";const e=document.createElement("div");e.className="context-menu";const n=this.querySelector('[slot="content"]');n&&e.appendChild(n.cloneNode(!0)),this._portalEl.appendChild(e),this._cleanup=i.showPortalFor(o,this._portalEl,"bottom")}else this._cleanup&&(this._cleanup(),this._cleanup=void 0),this._portalEl=null}}typeof customElements<"u"&&!customElements.get("ui-context-menu")&&customElements.define("ui-context-menu",a);class u extends i.ElementBase{static get observedAttributes(){return["open","position"]}constructor(){super()}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}render(){const t=this.hasAttribute("open"),s=this.getAttribute("position")||"right";if(!t){this.setContent("");return}const o=`<div class="panel panel-${s}"><slot></slot></div>`;this.setContent(o)}}typeof customElements<"u"&&!customElements.get("ui-plugin-panel")&&customElements.define("ui-plugin-panel",u);class p extends i.ElementBase{constructor(){super()}render(){this.setContent('<div class="block-controls"><slot></slot></div>')}}typeof customElements<"u"&&!customElements.get("ui-block-controls")&&customElements.define("ui-block-controls",p);class h extends i.ElementBase{constructor(){super(),this._portalEl=null,this._cleanup=void 0}static get observedAttributes(){return["anchor-id","open"]}openFor(t){this.setAttribute("anchor-id",t),this.setAttribute("open","")}close(){this.removeAttribute("open")}render(){const t=this.getAttribute("anchor-id"),s=this.hasAttribute("open");if(this.setContent("<slot></slot>"),s&&t){const o=document.getElementById(t);if(!o)return;this._portalEl||(this._portalEl=document.createElement("div")),this._portalEl.innerHTML="";const e=document.createElement("div");e.className="selection-popup";const n=this.querySelector('[slot="content"]');n&&e.appendChild(n.cloneNode(!0)),this._portalEl.appendChild(e),this._cleanup=i.showPortalFor(o,this._portalEl,"top")}else this._cleanup&&(this._cleanup(),this._cleanup=void 0),this._portalEl=null}}typeof customElements<"u"&&!customElements.get("ui-selection-popup")&&customElements.define("ui-selection-popup",h);exports.UIBlockControls=p;exports.UICommandPalette=c;exports.UIContextMenu=a;exports.UIFloatingToolbar=r;exports.UIPluginPanel=u;exports.UISelectionPopup=h;
@@ -0,0 +1,6 @@
1
+ export * from './components/ui-floating-toolbar';
2
+ export * from './components/ui-command-palette';
3
+ export * from './components/ui-context-menu';
4
+ export * from './components/ui-plugin-panel';
5
+ export * from './components/ui-block-controls';
6
+ export * from './components/ui-selection-popup';
package/dist/index.esm.js CHANGED
@@ -66,11 +66,10 @@ class u extends i {
66
66
  this.setContent("");
67
67
  return;
68
68
  }
69
- const s = `<div class="palette" role="dialog" aria-modal="true">
69
+ this.setContent(`<style>${p}</style><div class="palette" role="dialog" aria-modal="true">
70
70
  <input part="search" placeholder="Type a command..." />
71
71
  <div class="list"><slot></slot></div>
72
- </div>`;
73
- this.setContent(`<style>${p}</style>${s}`), Array.from(this.querySelectorAll('[slot="command"]')).forEach((e, n) => {
72
+ </div>`), Array.from(this.querySelectorAll('[slot="command"]')).forEach((e, n) => {
74
73
  e.addEventListener("click", () => this.dispatchEvent(new CustomEvent("select", { detail: { index: n } })));
75
74
  });
76
75
  }
@@ -175,8 +174,7 @@ class E extends i {
175
174
  const t = this.getAttribute("anchor-id"), s = this.hasAttribute("open");
176
175
  if (this.setContent("<slot></slot>"), s && t) {
177
176
  const o = document.getElementById(t);
178
- if (!o)
179
- return;
177
+ if (!o) return;
180
178
  this._portalEl || (this._portalEl = document.createElement("div")), this._portalEl.innerHTML = "";
181
179
  const e = document.createElement("div");
182
180
  e.className = "selection-popup";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editora/ui-editor",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Editor-focused UI extensions for Editora (floating toolbar, command palette, context menus)",
5
5
  "author": "Ajay Kumar <ajaykr089@gmail.com>",
6
6
  "license": "MIT",
@@ -21,7 +21,7 @@
21
21
  "src"
22
22
  ],
23
23
  "scripts": {
24
- "build": "vite build",
24
+ "build": "vite build && node ../../scripts/generate-plugin-typings.js --own-only",
25
25
  "dev": "vite build --watch",
26
26
  "prepare": "npm run build"
27
27
  },
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "typescript": "^5.0.0",
36
- "vite": "^4.5.14"
36
+ "vite": "^7.3.1"
37
37
  },
38
38
  "exports": {
39
39
  ".": {
@@ -43,5 +43,5 @@
43
43
  "default": "./dist/index.esm.js"
44
44
  }
45
45
  },
46
- "gitHead": "e19160591d822f5ecf242658d6db63959371838e"
46
+ "gitHead": "7883627e823aa99dd5ecb66a5201116df972f88b"
47
47
  }