@telperion/elements 5.4.3 → 6.0.0

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.
Files changed (50) hide show
  1. package/.build-manifest.json +12 -1
  2. package/README.md +37 -0
  3. package/custom-elements.json +863 -0
  4. package/fesm/elements.mjs +474 -1
  5. package/fesm/elements.mjs.map +1 -1
  6. package/iife/elements.js +24 -24
  7. package/iife/elements.js.map +1 -1
  8. package/iife/portal/index.js +2 -0
  9. package/iife/portal/index.js.map +1 -0
  10. package/index.cjs +4 -0
  11. package/index.cjs.map +1 -1
  12. package/index.d.cts +1 -0
  13. package/index.d.ts +1 -0
  14. package/index.js +2 -0
  15. package/index.js.map +1 -1
  16. package/package.json +26 -2
  17. package/portal/dom-ops.cjs +81 -0
  18. package/portal/dom-ops.cjs.map +1 -0
  19. package/portal/dom-ops.js +72 -0
  20. package/portal/dom-ops.js.map +1 -0
  21. package/portal/index.cjs +10 -0
  22. package/portal/index.cjs.map +1 -0
  23. package/portal/index.d.cts +125 -0
  24. package/portal/index.d.ts +125 -0
  25. package/portal/index.js +3 -0
  26. package/portal/index.js.map +1 -0
  27. package/portal/internal-props.cjs +13 -0
  28. package/portal/internal-props.cjs.map +1 -0
  29. package/portal/internal-props.js +9 -0
  30. package/portal/internal-props.js.map +1 -0
  31. package/portal/portal-element.cjs +196 -0
  32. package/portal/portal-element.cjs.map +1 -0
  33. package/portal/portal-element.js +194 -0
  34. package/portal/portal-element.js.map +1 -0
  35. package/portal/portal-outlet-element.cjs +64 -0
  36. package/portal/portal-outlet-element.cjs.map +1 -0
  37. package/portal/portal-outlet-element.js +62 -0
  38. package/portal/portal-outlet-element.js.map +1 -0
  39. package/portal/portal-registry.cjs +61 -0
  40. package/portal/portal-registry.cjs.map +1 -0
  41. package/portal/portal-registry.js +59 -0
  42. package/portal/portal-registry.js.map +1 -0
  43. package/portal/projection.cjs +81 -0
  44. package/portal/projection.cjs.map +1 -0
  45. package/portal/projection.js +79 -0
  46. package/portal/projection.js.map +1 -0
  47. package/portal/styles.cjs +28 -0
  48. package/portal/styles.cjs.map +1 -0
  49. package/portal/styles.js +26 -0
  50. package/portal/styles.js.map +1 -0
@@ -0,0 +1,2 @@
1
+ this.TelperionElements=this.TelperionElements||{},function(t){"use strict";const e=Node.prototype.insertBefore,n=Node.prototype.removeChild,i=Node.prototype.replaceChild,r=Element.prototype.moveBefore;function o(t,n,i){e.call(t,n,i)}function s(t){t.parentNode&&n.call(t.parentNode,t)}function l(t,n,i,o=!0){if(o&&r&&n.isConnected&&t.isConnected)try{return void r.call(t,n,i)}catch{}e.call(t,n,i)}const c={"&":"&amp;","<":"&lt;",">":"&gt;"," ":"&nbsp;"};const a=Symbol("portal:sync"),h=Symbol("portal-outlet:attach"),p=Symbol("portal-outlet:detach");const u=new class{#t=new Map;#e=new Map;outletFor(t){const e=this.#t.get(t);return e?.[e.length-1]??null}addOutlet(t,e){const n=this.#t.get(t)??[];n.includes(e)||n.push(e),this.#t.set(t,n),this.#n(t)}removeOutlet(t,e){const n=this.#t.get(t);if(!n)return;const i=n.indexOf(e);-1!==i&&(n.splice(i,1),n.length||this.#t.delete(t),this.#n(t))}addPortal(t,e){const n=this.#e.get(t)??new Set;n.add(e),this.#e.set(t,n),e[a]()}removePortal(t,e){const n=this.#e.get(t);n&&(n.delete(e),n.size||this.#e.delete(t))}#n(t){for(const e of[...this.#e.get(t)??[]])e[a]()}};class d{#i=document.createComment("tp-portal");#r=document.createComment("/tp-portal");#o=null;get container(){return this.#o}get active(){return null!==this.#o}nodes(){return this.#o?function(t,e){const n=[];if(!t.parentNode||t.parentNode!==e.parentNode)return n;for(let i=t.nextSibling;i&&i!==e;i=i.nextSibling)n.push(i);return n}(this.#i,this.#r):[]}owns(t){return null===t||null!==this.#o&&t.parentNode===this.#o}open(t,e){this.#o=t,o(t,this.#i,null),o(t,this.#r,null),this.pull(e)}pull(t){if(this.#o)for(const e of Array.from(t.childNodes))l(this.#o,e,this.#r)}close(t){if(!this.#o)return;const e=this.nodes();this.#o=null;for(const n of e)l(t,n,null);s(this.#i),s(this.#r)}insert(t,e){o(this.#o,t,e??this.#r)}prepend(t){o(this.#o,t,this.#i.nextSibling)}remove(t){s(t)}replace(t,e){!function(t,e,n){i.call(t,e,n)}(this.#o,t,e)}clear(){for(const t of this.nodes())s(t)}refFor(t){return t??this.#r}}let m=!1;function g(){if(!m&&"undefined"!=typeof document){m=!0;try{const t=new CSSStyleSheet;t.replaceSync("\n :where(tp-portal) { display: none; }\n :where(tp-portal-outlet) { display: contents; }\n "),document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}catch{}}}class f extends HTMLElement{static{this.observedAttributes=["name"]}#s=new d;#l=new MutationObserver(()=>this.#s.pull(this));#c=null;#a=null;get name(){return this.getAttribute("name")??""}set name(t){this.setAttribute("name",t)}get outlet(){return this.#c}get projectedNodes(){return this.#s.active?this.#s.nodes():Array.from(this.childNodes)}connectedCallback(){g(),this.#l.observe(this,{childList:!0}),this.#h()}disconnectedCallback(){this.#p(),this.#l.disconnect()}attributeChangedCallback(){this.isConnected&&(this.#p(),this.#h())}[a](){const t=null===this.#a?null:u.outletFor(this.#a);t!==this.#c&&(this.#u(),t&&!this.contains(t)&&this.#d(t))}#h(){const t=this.name;t&&(this.#a=t,u.addPortal(t,this))}#p(){null!==this.#a&&(u.removePortal(this.#a,this),this.#a=null),this.#u()}#d(t){this.#c=t,this.#s.open(t,this),t[h](this),this.toggleAttribute("projected",!0)}#u(){const t=this.#c;t&&(this.#c=null,this.#s.close(this),t[p](this),this.toggleAttribute("projected",!1))}appendChild(t){return this.#s.active?(this.#s.insert(t,null),t):super.appendChild(t)}insertBefore(t,e){return this.#s.active&&this.#s.owns(e)?(this.#s.insert(t,e),t):super.insertBefore(t,e)}removeChild(t){return this.#s.active&&this.#s.owns(t)?(this.#s.remove(t),t):super.removeChild(t)}replaceChild(t,e){return this.#s.active&&this.#s.owns(e)?(this.#s.replace(t,e),e):super.replaceChild(t,e)}static{void 0!==r&&Object.defineProperty(this.prototype,"moveBefore",{configurable:!0,writable:!0,value(t,e){const n=this.#s.active&&this.#s.owns(e);!function(t,e,n){if(!r)throw new DOMException("moveBefore is not supported","NotSupportedError");r.call(t,e,n)}(n?this.#s.container:this,t,n?this.#s.refFor(e):e)}})}append(...t){if(!this.#s.active)return super.append(...t);for(const e of j(t))this.#s.insert(e,null)}prepend(...t){if(!this.#s.active)return super.prepend(...t);for(const e of j(t).reverse())this.#s.prepend(e)}replaceChildren(...t){if(!this.#s.active)return super.replaceChildren(...t);this.#s.clear(),this.append(...t)}get textContent(){return this.#s.active?this.#s.nodes().map(t=>t.nodeType===Node.COMMENT_NODE?"":t.textContent??"").join(""):super.textContent}set textContent(t){this.#s.active?(this.#s.clear(),t&&this.#s.insert(document.createTextNode(t),null)):super.textContent=t}get innerHTML(){return this.#s.active?this.#s.nodes().map(t=>t instanceof Element?t.outerHTML:t.nodeType===Node.TEXT_NODE?(t.nodeValue??"").replace(/[&<> ]/g,t=>c[t]??t):t.nodeType===Node.COMMENT_NODE?`\x3c!--${t.nodeValue??""}--\x3e`:"").join(""):super.innerHTML}set innerHTML(t){this.#s.active?(this.#s.clear(),super.innerHTML=t,this.#s.pull(this)):super.innerHTML=t}}function j(t){return t.map(t=>"string"==typeof t?document.createTextNode(t):t)}customElements.get("tp-portal")||customElements.define("tp-portal",f);class v extends HTMLElement{static{this.observedAttributes=["name"]}#e=new Set;#a=null;get name(){return this.getAttribute("name")??""}set name(t){this.setAttribute("name",t)}get portals(){return[...this.#e]}connectedCallback(){g(),this.#h()}disconnectedCallback(){this.#p()}attributeChangedCallback(){this.isConnected&&(this.#p(),this.#h())}[h](t){this.#e.add(t),this.toggleAttribute("active",!0)}[p](t){this.#e.delete(t),this.toggleAttribute("active",this.#e.size>0)}#h(){const t=this.name;t&&(this.#a=t,u.addOutlet(t,this))}#p(){if(null===this.#a)return;const t=this.#a;this.#a=null,u.removeOutlet(t,this)}}customElements.get("tp-portal-outlet")||customElements.define("tp-portal-outlet",v),t.PortalElement=f,t.PortalOutletElement=v}(this.TelperionElements.Portal=this.TelperionElements.Portal||{});
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../libs/elements/src/portal/dom-ops.ts","../../../../../libs/elements/src/portal/internal-props.ts","../../../../../libs/elements/src/portal/portal-registry.ts","../../../../../libs/elements/src/portal/projection.ts","../../../../../libs/elements/src/portal/styles.ts","../../../../../libs/elements/src/portal/portal-element.ts","../../../../../libs/elements/src/portal/portal-outlet-element.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":["nativeInsertBefore","Node","prototype","insertBefore","nativeRemoveChild","removeChild","nativeReplaceChild","replaceChild","nativeMoveBefore","Element","moveBefore","insertNode","parent","node","ref","call","removeNode","parentNode","moveNode","preferMove","isConnected","ESCAPES","SYNC_PORTAL","Symbol","ATTACH_PORTAL","DETACH_PORTAL","portalRegistry","outlets","Map","portals","outletFor","name","stack","this","get","length","addOutlet","outlet","includes","push","set","sync","removeOutlet","index","indexOf","splice","delete","addPortal","portal","Set","add","removePortal","size","Projection","start","document","createComment","end","container","active","nodes","n","nextSibling","nodesBetween","owns","open","source","pull","Array","from","childNodes","close","target","insert","prepend","remove","replace","next","prev","replaceNode","clear","refFor","injected","injectPortalStyles","sheet","CSSStyleSheet","replaceSync","adoptedStyleSheets","PortalElement","HTMLElement","observedAttributes","projection","observer","MutationObserver","registeredName","getAttribute","value","setAttribute","projectedNodes","connectedCallback","observe","childList","register","disconnectedCallback","unregister","disconnect","attributeChangedCallback","detach","contains","attach","toggleAttribute","appendChild","super","child","undefined","Object","defineProperty","configurable","writable","projected","DOMException","nativeMove","append","toNodes","reverse","replaceChildren","textContent","map","nodeType","COMMENT_NODE","join","createTextNode","innerHTML","outerHTML","TEXT_NODE","nodeValue","c","customElements","define","PortalOutletElement"],"mappings":"2EAQA,MAAMA,EAAqBC,KAAKC,UAAUC,aACpCC,EAAoBH,KAAKC,UA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AAOmD,UAA4BlD,mBACvBxD,KAAAyD,mBAAqB,CAAC,OAAQ,CAErC7D,GAAW,IAAIoB,IACxB6C,GAAiC,KAGjC,QAAI/D,GACF,OAAOE,KAAK8D,aAAa,SAAW,EACtC,CAEA,QAAIhE,CAAKiE,GACP/D,KAAKgE,aAAa,OAAQD,EAC5B,CAGA,WAAInE,GACF,MAAO,IAAII,MAAKJ,EAClB,CAEA,iBAAAsE,GACEhB,IACAlD,MAAKqE,GACP,CAEA,oBAAAC,GACEtE,MAAKuE,GACP,CAEA,wBAAAE,GACOzE,KAAKb,cACVa,MAAKuE,IACLvE,MAAKqE,IACP,CAGA,CAAC9E,GAAewB,GACdf,MAAKJ,EAASqB,IAAIF,GAClBf,KAAK6E,gBAAgB,UAAU,EACjC,CAGA,CAACrF,GAAeuB,GACdf,MAAKJ,EAASiB,OAAOE,GACrBf,KAAK6E,gBAAgB,SAAU7E,MAAKJ,EAASuB,KAAO,EACtD,CAEA,EAAAkD,GACE,MAAMvE,EAAOE,KAAKF,KACbA,IACLE,MAAK6D,EAAkB/D,EACvBL,EAAeU,UAAUL,EAAME,MACjC,CAEA,EAAAuE,GACE,GAA6B,OAAzBvE,MAAK6D,EAA0B,OACnC,MAAM/D,EAAOE,MAAK6D,EAClB7D,MAAK6D,EAAkB,KACvBpE,EAAegB,aAAaX,EAAME,KACpC,EAGGwG,eAAevG,IAAI,qBAAqBuG,eAAeC,OAAO,mBAAoBC"}
package/index.cjs CHANGED
@@ -17,6 +17,8 @@ var option_element = require('./select/option.element.cjs');
17
17
  var selectedContent_element = require('./select/selected-content.element.cjs');
18
18
  var selectChangeEvent = require('./select/select-change-event.cjs');
19
19
  var button_element = require('./button/button.element.cjs');
20
+ var portalElement = require('./portal/portal-element.cjs');
21
+ var portalOutletElement = require('./portal/portal-outlet-element.cjs');
20
22
 
21
23
 
22
24
 
@@ -82,4 +84,6 @@ Object.defineProperty(exports, "ButtonElement", {
82
84
  enumerable: true,
83
85
  get: function () { return button_element.ButtonElement; }
84
86
  });
87
+ exports.PortalElement = portalElement.PortalElement;
88
+ exports.PortalOutletElement = portalOutletElement.PortalOutletElement;
85
89
  //# sourceMappingURL=index.cjs.map
package/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/index.d.cts CHANGED
@@ -4,6 +4,7 @@ export { DetailsSetElement } from './details-set/index.cjs';
4
4
  export { PopoverElement } from './popover/index.cjs';
5
5
  export { OptionElement, SelectChangeEvent, SelectElement, SelectedContentElement } from './select/index.cjs';
6
6
  export { ButtonElement, ButtonType, ButtonVariant } from './button/index.cjs';
7
+ export { PortalElement, PortalOutletElement } from './portal/index.cjs';
7
8
  import './_chunks/signal-watcher-lit-element-B5xCaa26.cjs';
8
9
  import 'lit';
9
10
  import './_chunks/shade-mixer-lit-element-sw8t_VC5.cjs';
package/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { DetailsSetElement } from './details-set/index.js';
4
4
  export { PopoverElement } from './popover/index.js';
5
5
  export { OptionElement, SelectChangeEvent, SelectElement, SelectedContentElement } from './select/index.js';
6
6
  export { ButtonElement, ButtonType, ButtonVariant } from './button/index.js';
7
+ export { PortalElement, PortalOutletElement } from './portal/index.js';
7
8
  import './_chunks/signal-watcher-lit-element-B-vV0yNG.js';
8
9
  import 'lit';
9
10
  import './_chunks/shade-mixer-lit-element-sw8t_VC5.js';
package/index.js CHANGED
@@ -15,4 +15,6 @@ export { OptionElement } from './select/option.element.js';
15
15
  export { SelectedContentElement } from './select/selected-content.element.js';
16
16
  export { SelectChangeEvent } from './select/select-change-event.js';
17
17
  export { ButtonElement } from './button/button.element.js';
18
+ export { PortalElement } from './portal/portal-element.js';
19
+ export { PortalOutletElement } from './portal/portal-outlet-element.js';
18
20
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@telperion/elements",
3
- "version": "5.4.3",
4
- "description": "Framework-agnostic web components built with Lit: Material Symbols / Simple Icons / theSVG icons, declarative client-side router, drag-and-drop primitives, details accordion with FIFO open caps, a CSS-anchored popover, a form-associated selectbox with single/multi-select, and a form-associated button.",
3
+ "version": "6.0.0",
4
+ "description": "Framework-agnostic web components built with Lit: Material Symbols / Simple Icons / theSVG icons, declarative client-side router, drag-and-drop primitives, details accordion with FIFO open caps, a CSS-anchored popover, a form-associated selectbox with single/multi-select, a form-associated button, and portals that render content into named outlets elsewhere in the document.",
5
5
  "keywords": [
6
6
  "web-components",
7
7
  "custom-elements",
@@ -28,6 +28,8 @@
28
28
  "multi-select",
29
29
  "button",
30
30
  "form-associated",
31
+ "portal",
32
+ "teleport",
31
33
  "themeable"
32
34
  ],
33
35
  "homepage": "https://open-source.telperion.tr/elements",
@@ -214,6 +216,28 @@
214
216
  "script": "./iife/button/index.js",
215
217
  "default": "./button/index.js"
216
218
  },
219
+ "./portal/index": {
220
+ "types": {
221
+ "import": "./portal/index.d.ts",
222
+ "require": "./portal/index.d.cts"
223
+ },
224
+ "import": "./portal/index.js",
225
+ "require": "./portal/index.cjs",
226
+ "node": "./portal/index.cjs",
227
+ "script": "./iife/portal/index.js",
228
+ "default": "./portal/index.js"
229
+ },
230
+ "./portal": {
231
+ "types": {
232
+ "import": "./portal/index.d.ts",
233
+ "require": "./portal/index.d.cts"
234
+ },
235
+ "import": "./portal/index.js",
236
+ "require": "./portal/index.cjs",
237
+ "node": "./portal/index.cjs",
238
+ "script": "./iife/portal/index.js",
239
+ "default": "./portal/index.js"
240
+ },
217
241
  "./icon/material-symbols.css": "./icon/material-symbols.css"
218
242
  },
219
243
  "bugs": "https://github.com/telperiontech/telperion/issues",
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Native DOM operations captured before `<tp-portal>` overrides them, so the
5
+ * element can still reach its *own* light DOM while forwarding framework
6
+ * mutations to its outlet.
7
+ */
8
+ const nativeInsertBefore = Node.prototype.insertBefore;
9
+ const nativeRemoveChild = Node.prototype.removeChild;
10
+ const nativeReplaceChild = Node.prototype.replaceChild;
11
+ const nativeMoveBefore = Element.prototype.moveBefore;
12
+ function insertNode(parent, node, ref) {
13
+ nativeInsertBefore.call(parent, node, ref);
14
+ }
15
+ function removeNode(node) {
16
+ if (node.parentNode)
17
+ nativeRemoveChild.call(node.parentNode, node);
18
+ }
19
+ function replaceNode(parent, next, prev) {
20
+ nativeReplaceChild.call(parent, next, prev);
21
+ }
22
+ /**
23
+ * Moves `node` into `parent` before `ref`. Prefers the state-preserving
24
+ * `moveBefore()` (focus, iframes, animations, no disconnect/connect
25
+ * reactions) and falls back to a plain insertion where it is unsupported or
26
+ * not allowed (e.g. one side is disconnected).
27
+ */
28
+ function moveNode(parent, node, ref, preferMove = true) {
29
+ if (preferMove && nativeMoveBefore && node.isConnected && parent.isConnected) {
30
+ try {
31
+ nativeMoveBefore.call(parent, node, ref);
32
+ return;
33
+ }
34
+ catch {
35
+ /* fall back to insertBefore */
36
+ }
37
+ }
38
+ nativeInsertBefore.call(parent, node, ref);
39
+ }
40
+ function hasNativeMoveBefore() {
41
+ return nativeMoveBefore !== undefined;
42
+ }
43
+ function nativeMove(parent, node, ref) {
44
+ if (!nativeMoveBefore)
45
+ throw new DOMException("moveBefore is not supported", "NotSupportedError");
46
+ nativeMoveBefore.call(parent, node, ref);
47
+ }
48
+ /** Nodes strictly between two sibling markers (empty when the markers were torn out). */
49
+ function nodesBetween(start, end) {
50
+ const nodes = [];
51
+ if (!start.parentNode || start.parentNode !== end.parentNode)
52
+ return nodes;
53
+ for (let n = start.nextSibling; n && n !== end; n = n.nextSibling)
54
+ nodes.push(n);
55
+ return nodes;
56
+ }
57
+ const ESCAPES = { "&": "&amp;", "<": "&lt;", ">": "&gt;", " ": "&nbsp;" };
58
+ /** Minimal HTML serialization of a node list (used for `innerHTML` while projected). */
59
+ function serializeNodes(nodes) {
60
+ return nodes
61
+ .map((n) => {
62
+ if (n instanceof Element)
63
+ return n.outerHTML;
64
+ if (n.nodeType === Node.TEXT_NODE)
65
+ return (n.nodeValue ?? "").replace(/[&<> ]/g, (c) => ESCAPES[c] ?? c);
66
+ if (n.nodeType === Node.COMMENT_NODE)
67
+ return `<!--${n.nodeValue ?? ""}-->`;
68
+ return "";
69
+ })
70
+ .join("");
71
+ }
72
+
73
+ exports.hasNativeMoveBefore = hasNativeMoveBefore;
74
+ exports.insertNode = insertNode;
75
+ exports.moveNode = moveNode;
76
+ exports.nativeMove = nativeMove;
77
+ exports.nodesBetween = nodesBetween;
78
+ exports.removeNode = removeNode;
79
+ exports.replaceNode = replaceNode;
80
+ exports.serializeNodes = serializeNodes;
81
+ //# sourceMappingURL=dom-ops.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-ops.cjs","sources":["../../../../libs/elements/src/portal/dom-ops.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;AAIG;AAIH,MAAM,kBAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY;AACtD,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW;AACpD,MAAM,kBAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY;AACtD,MAAM,gBAAgB,GAAI,OAAO,CAAC,SAAoD,CAAC,UAAU;SAEjF,UAAU,CAA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AC,UAAU;AAAE,QAAA,OAAO,KAAK;AAC1E,IAAA,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,WAAW;AAAE,QAAA,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAChF,IAAA,OAAO,KAAK;AACd;AAEA,MAAM,OAAO,GAA2B,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE;AAEjG;AACM,SAAU,cAAc,CAAC,KAAa,EAAA;AAC1C,IAAA,OAAO;AACJ,SAAA,GAAG,CAAC,CAAC,CAAC,KAAI;QACT,IAAI,CAAC,YAAY,OAAO;YAAE,OAAO,CAAC,CAAC,SAAS;AAC5C,QAAA,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS;YAAE,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACxG,QAAA,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;AAAE,YAAA,OAAO,OAAO,CAAC,CAAC,SAAS,IAAI,EAAE,KAAK;AAC1E,QAAA,OAAO,EAAE;AACX,IAAA,CAAC;SACA,IAAI,CAAC,EAAE,CAAC;AACb;;;;;;;;;;;"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Native DOM operations captured before `<tp-portal>` overrides them, so the
3
+ * element can still reach its *own* light DOM while forwarding framework
4
+ * mutations to its outlet.
5
+ */
6
+ const nativeInsertBefore = Node.prototype.insertBefore;
7
+ const nativeRemoveChild = Node.prototype.removeChild;
8
+ const nativeReplaceChild = Node.prototype.replaceChild;
9
+ const nativeMoveBefore = Element.prototype.moveBefore;
10
+ function insertNode(parent, node, ref) {
11
+ nativeInsertBefore.call(parent, node, ref);
12
+ }
13
+ function removeNode(node) {
14
+ if (node.parentNode)
15
+ nativeRemoveChild.call(node.parentNode, node);
16
+ }
17
+ function replaceNode(parent, next, prev) {
18
+ nativeReplaceChild.call(parent, next, prev);
19
+ }
20
+ /**
21
+ * Moves `node` into `parent` before `ref`. Prefers the state-preserving
22
+ * `moveBefore()` (focus, iframes, animations, no disconnect/connect
23
+ * reactions) and falls back to a plain insertion where it is unsupported or
24
+ * not allowed (e.g. one side is disconnected).
25
+ */
26
+ function moveNode(parent, node, ref, preferMove = true) {
27
+ if (preferMove && nativeMoveBefore && node.isConnected && parent.isConnected) {
28
+ try {
29
+ nativeMoveBefore.call(parent, node, ref);
30
+ return;
31
+ }
32
+ catch {
33
+ /* fall back to insertBefore */
34
+ }
35
+ }
36
+ nativeInsertBefore.call(parent, node, ref);
37
+ }
38
+ function hasNativeMoveBefore() {
39
+ return nativeMoveBefore !== undefined;
40
+ }
41
+ function nativeMove(parent, node, ref) {
42
+ if (!nativeMoveBefore)
43
+ throw new DOMException("moveBefore is not supported", "NotSupportedError");
44
+ nativeMoveBefore.call(parent, node, ref);
45
+ }
46
+ /** Nodes strictly between two sibling markers (empty when the markers were torn out). */
47
+ function nodesBetween(start, end) {
48
+ const nodes = [];
49
+ if (!start.parentNode || start.parentNode !== end.parentNode)
50
+ return nodes;
51
+ for (let n = start.nextSibling; n && n !== end; n = n.nextSibling)
52
+ nodes.push(n);
53
+ return nodes;
54
+ }
55
+ const ESCAPES = { "&": "&amp;", "<": "&lt;", ">": "&gt;", " ": "&nbsp;" };
56
+ /** Minimal HTML serialization of a node list (used for `innerHTML` while projected). */
57
+ function serializeNodes(nodes) {
58
+ return nodes
59
+ .map((n) => {
60
+ if (n instanceof Element)
61
+ return n.outerHTML;
62
+ if (n.nodeType === Node.TEXT_NODE)
63
+ return (n.nodeValue ?? "").replace(/[&<> ]/g, (c) => ESCAPES[c] ?? c);
64
+ if (n.nodeType === Node.COMMENT_NODE)
65
+ return `<!--${n.nodeValue ?? ""}-->`;
66
+ return "";
67
+ })
68
+ .join("");
69
+ }
70
+
71
+ export { hasNativeMoveBefore, insertNode, moveNode, nativeMove, nodesBetween, removeNode, replaceNode, serializeNodes };
72
+ //# sourceMappingURL=dom-ops.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-ops.js","sources":["../../../../libs/elements/src/portal/dom-ops.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;AAIG;AAIH,MAAM,kBAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY;AACtD,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW;AACpD,MAAM,kBAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY;AACtD,MAAM,gBAAgB,GAAI,OAAO,CAAC,SAAoD,CAAC,UAAU;SAEjF,UAAU,CAAC,MAAY,EAAE,IAAU,EAAE,GAAgB,EAAA;IACnE,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC;AAC5C;AAEM,SAAU,UAAU,CAAC,IAAU,EAAA;IACnC,IAAI,IAAI,CAAC,UAAU;QAAE,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC;AACpE;SAEgB,WAAW,CAAC,MAAY,EAAE,IAAU,EAAE,IAAU,EAAA;IAC9D,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;AAC7C;AAEA;;;;;AAKG;AACG,SAAU,QAAQ,CAAC,MAAY,EAAE,IAAU,EAAE,GAAgB,EAAE,UAAU,GAAG,IAAI,EAAA;AACpF,IAAA,IAAI,UAAU,IAAI,gBAAgB,IAAI,IAAI,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,EAAE;AAC5E,QAAA,IAAI;YACF,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC;YACxC;QACF;AAAE,QAA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AO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACxG,QAAA,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;AAAE,YAAA,OAAO,OAAO,CAAC,CAAC,SAAS,IAAI,EAAE,KAAK;AAC1E,QAAA,OAAO,EAAE;AACX,IAAA,CAAC;SACA,IAAI,CAAC,EAAE,CAAC;AACb;;;;"}
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var portalElement = require('./portal-element.cjs');
4
+ var portalOutletElement = require('./portal-outlet-element.cjs');
5
+
6
+
7
+
8
+ exports.PortalElement = portalElement.PortalElement;
9
+ exports.PortalOutletElement = portalOutletElement.PortalOutletElement;
10
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -0,0 +1,125 @@
1
+ /** Registry → portal: re-resolve the active outlet and (re)project into it. */
2
+ declare const SYNC_PORTAL: unique symbol;
3
+ /** Portal → outlet: a portal started projecting into the outlet. */
4
+ declare const ATTACH_PORTAL: unique symbol;
5
+ /** Portal → outlet: a portal stopped projecting into the outlet. */
6
+ declare const DETACH_PORTAL: unique symbol;
7
+
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ /**
11
+ * Render target for `<tp-portal>` elements with the same `name`.
12
+ *
13
+ * Content of every matching portal is appended after the outlet's own
14
+ * children, in the order the portals connected. When several outlets share
15
+ * a name, the most recently connected one is active; if it disconnects,
16
+ * the previous one takes over and the content moves there.
17
+ *
18
+ * The outlet is `display: contents` by default, so projected content lays
19
+ * out as if it were a child of the outlet's parent.
20
+ *
21
+ * @example
22
+ * ```html
23
+ * <tp-portal-outlet name="toolbar"></tp-portal-outlet>
24
+ * ```
25
+ *
26
+ * @attr name - Name that `<tp-portal>` elements target.
27
+ * @attr active - Reflected (read-only) while at least one portal projects here.
28
+ */
29
+ "tp-portal-outlet": PortalOutletElement;
30
+ }
31
+ }
32
+ declare class PortalOutletElement extends HTMLElement {
33
+ #private;
34
+ static readonly observedAttributes: string[];
35
+ /** Name that `<tp-portal>` elements target. */
36
+ get name(): string;
37
+ set name(value: string);
38
+ /** Portals currently projecting into this outlet, in projection order. */
39
+ get portals(): readonly PortalElement[];
40
+ connectedCallback(): void;
41
+ disconnectedCallback(): void;
42
+ attributeChangedCallback(): void;
43
+ /** @internal */
44
+ [ATTACH_PORTAL](portal: PortalElement): void;
45
+ /** @internal */
46
+ [DETACH_PORTAL](portal: PortalElement): void;
47
+ }
48
+
49
+ declare global {
50
+ interface HTMLElementTagNameMap {
51
+ /**
52
+ * Renders its children inside the `<tp-portal-outlet>` with the same
53
+ * `name`, wherever that outlet is in the document.
54
+ *
55
+ * The child **nodes themselves** are moved (not cloned), so event
56
+ * listeners, element state and framework bindings stay intact. While no
57
+ * matching outlet is connected the children stay inside the portal, which
58
+ * is `display: none` by default.
59
+ *
60
+ * Framework-safe: frameworks (React, Angular, Vue, Lit, …) keep calling
61
+ * `appendChild` / `insertBefore` / `removeChild` / `replaceChild` /
62
+ * `textContent` / `innerHTML` on the portal; while projected, those calls
63
+ * are forwarded to the outlet, so no "node is not a child of this node"
64
+ * errors are thrown.
65
+ *
66
+ * Uses the state-preserving `moveBefore()` when the browser supports it
67
+ * (focus, iframes, CSS animations survive projection).
68
+ *
69
+ * @example
70
+ * ```html
71
+ * <tp-portal name="toolbar">
72
+ * <button>Save</button>
73
+ * </tp-portal>
74
+ *
75
+ * <header>
76
+ * <tp-portal-outlet name="toolbar"></tp-portal-outlet>
77
+ * </header>
78
+ * ```
79
+ *
80
+ * @attr name - Outlet name to project into.
81
+ * @attr projected - Reflected (read-only) while the content is in an outlet.
82
+ */
83
+ "tp-portal": PortalElement;
84
+ }
85
+ }
86
+ declare class PortalElement extends HTMLElement {
87
+ #private;
88
+ static readonly observedAttributes: string[];
89
+ /** Outlet name to project into. */
90
+ get name(): string;
91
+ set name(value: string);
92
+ /** The outlet currently hosting this portal's content, if any. */
93
+ get outlet(): PortalOutletElement | null;
94
+ /** The portal's content nodes, wherever they currently live. */
95
+ get projectedNodes(): Node[];
96
+ connectedCallback(): void;
97
+ disconnectedCallback(): void;
98
+ attributeChangedCallback(): void;
99
+ /** @internal */
100
+ [SYNC_PORTAL](): void;
101
+ /** @internal Forwarded to the outlet while projected. */
102
+ appendChild<T extends Node>(node: T): T;
103
+ /** @internal Forwarded to the outlet while projected. */
104
+ insertBefore<T extends Node>(node: T, ref: Node | null): T;
105
+ /** @internal Forwarded to the outlet while projected. */
106
+ removeChild<T extends Node>(child: T): T;
107
+ /** @internal Forwarded to the outlet while projected. */
108
+ replaceChild<T extends Node>(next: Node, prev: T): T;
109
+ /** @internal Forwarded to the outlet while projected. */
110
+ append(...nodes: Array<Node | string>): void;
111
+ /** @internal Forwarded to the outlet while projected. */
112
+ prepend(...nodes: Array<Node | string>): void;
113
+ /** @internal Forwarded to the outlet while projected. */
114
+ replaceChildren(...nodes: Array<Node | string>): void;
115
+ /** @internal Forwarded to the outlet while projected. */
116
+ get textContent(): string;
117
+ /** @internal */
118
+ set textContent(value: string | null);
119
+ /** @internal Forwarded to the outlet while projected. */
120
+ get innerHTML(): string;
121
+ /** @internal */
122
+ set innerHTML(value: string);
123
+ }
124
+
125
+ export { PortalElement, PortalOutletElement };
@@ -0,0 +1,125 @@
1
+ /** Registry → portal: re-resolve the active outlet and (re)project into it. */
2
+ declare const SYNC_PORTAL: unique symbol;
3
+ /** Portal → outlet: a portal started projecting into the outlet. */
4
+ declare const ATTACH_PORTAL: unique symbol;
5
+ /** Portal → outlet: a portal stopped projecting into the outlet. */
6
+ declare const DETACH_PORTAL: unique symbol;
7
+
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ /**
11
+ * Render target for `<tp-portal>` elements with the same `name`.
12
+ *
13
+ * Content of every matching portal is appended after the outlet's own
14
+ * children, in the order the portals connected. When several outlets share
15
+ * a name, the most recently connected one is active; if it disconnects,
16
+ * the previous one takes over and the content moves there.
17
+ *
18
+ * The outlet is `display: contents` by default, so projected content lays
19
+ * out as if it were a child of the outlet's parent.
20
+ *
21
+ * @example
22
+ * ```html
23
+ * <tp-portal-outlet name="toolbar"></tp-portal-outlet>
24
+ * ```
25
+ *
26
+ * @attr name - Name that `<tp-portal>` elements target.
27
+ * @attr active - Reflected (read-only) while at least one portal projects here.
28
+ */
29
+ "tp-portal-outlet": PortalOutletElement;
30
+ }
31
+ }
32
+ declare class PortalOutletElement extends HTMLElement {
33
+ #private;
34
+ static readonly observedAttributes: string[];
35
+ /** Name that `<tp-portal>` elements target. */
36
+ get name(): string;
37
+ set name(value: string);
38
+ /** Portals currently projecting into this outlet, in projection order. */
39
+ get portals(): readonly PortalElement[];
40
+ connectedCallback(): void;
41
+ disconnectedCallback(): void;
42
+ attributeChangedCallback(): void;
43
+ /** @internal */
44
+ [ATTACH_PORTAL](portal: PortalElement): void;
45
+ /** @internal */
46
+ [DETACH_PORTAL](portal: PortalElement): void;
47
+ }
48
+
49
+ declare global {
50
+ interface HTMLElementTagNameMap {
51
+ /**
52
+ * Renders its children inside the `<tp-portal-outlet>` with the same
53
+ * `name`, wherever that outlet is in the document.
54
+ *
55
+ * The child **nodes themselves** are moved (not cloned), so event
56
+ * listeners, element state and framework bindings stay intact. While no
57
+ * matching outlet is connected the children stay inside the portal, which
58
+ * is `display: none` by default.
59
+ *
60
+ * Framework-safe: frameworks (React, Angular, Vue, Lit, …) keep calling
61
+ * `appendChild` / `insertBefore` / `removeChild` / `replaceChild` /
62
+ * `textContent` / `innerHTML` on the portal; while projected, those calls
63
+ * are forwarded to the outlet, so no "node is not a child of this node"
64
+ * errors are thrown.
65
+ *
66
+ * Uses the state-preserving `moveBefore()` when the browser supports it
67
+ * (focus, iframes, CSS animations survive projection).
68
+ *
69
+ * @example
70
+ * ```html
71
+ * <tp-portal name="toolbar">
72
+ * <button>Save</button>
73
+ * </tp-portal>
74
+ *
75
+ * <header>
76
+ * <tp-portal-outlet name="toolbar"></tp-portal-outlet>
77
+ * </header>
78
+ * ```
79
+ *
80
+ * @attr name - Outlet name to project into.
81
+ * @attr projected - Reflected (read-only) while the content is in an outlet.
82
+ */
83
+ "tp-portal": PortalElement;
84
+ }
85
+ }
86
+ declare class PortalElement extends HTMLElement {
87
+ #private;
88
+ static readonly observedAttributes: string[];
89
+ /** Outlet name to project into. */
90
+ get name(): string;
91
+ set name(value: string);
92
+ /** The outlet currently hosting this portal's content, if any. */
93
+ get outlet(): PortalOutletElement | null;
94
+ /** The portal's content nodes, wherever they currently live. */
95
+ get projectedNodes(): Node[];
96
+ connectedCallback(): void;
97
+ disconnectedCallback(): void;
98
+ attributeChangedCallback(): void;
99
+ /** @internal */
100
+ [SYNC_PORTAL](): void;
101
+ /** @internal Forwarded to the outlet while projected. */
102
+ appendChild<T extends Node>(node: T): T;
103
+ /** @internal Forwarded to the outlet while projected. */
104
+ insertBefore<T extends Node>(node: T, ref: Node | null): T;
105
+ /** @internal Forwarded to the outlet while projected. */
106
+ removeChild<T extends Node>(child: T): T;
107
+ /** @internal Forwarded to the outlet while projected. */
108
+ replaceChild<T extends Node>(next: Node, prev: T): T;
109
+ /** @internal Forwarded to the outlet while projected. */
110
+ append(...nodes: Array<Node | string>): void;
111
+ /** @internal Forwarded to the outlet while projected. */
112
+ prepend(...nodes: Array<Node | string>): void;
113
+ /** @internal Forwarded to the outlet while projected. */
114
+ replaceChildren(...nodes: Array<Node | string>): void;
115
+ /** @internal Forwarded to the outlet while projected. */
116
+ get textContent(): string;
117
+ /** @internal */
118
+ set textContent(value: string | null);
119
+ /** @internal Forwarded to the outlet while projected. */
120
+ get innerHTML(): string;
121
+ /** @internal */
122
+ set innerHTML(value: string);
123
+ }
124
+
125
+ export { PortalElement, PortalOutletElement };
@@ -0,0 +1,3 @@
1
+ export { PortalElement } from './portal-element.js';
2
+ export { PortalOutletElement } from './portal-outlet-element.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ /** Registry → portal: re-resolve the active outlet and (re)project into it. */
4
+ const SYNC_PORTAL = Symbol("portal:sync");
5
+ /** Portal → outlet: a portal started projecting into the outlet. */
6
+ const ATTACH_PORTAL = Symbol("portal-outlet:attach");
7
+ /** Portal → outlet: a portal stopped projecting into the outlet. */
8
+ const DETACH_PORTAL = Symbol("portal-outlet:detach");
9
+
10
+ exports.ATTACH_PORTAL = ATTACH_PORTAL;
11
+ exports.DETACH_PORTAL = DETACH_PORTAL;
12
+ exports.SYNC_PORTAL = SYNC_PORTAL;
13
+ //# sourceMappingURL=internal-props.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-props.cjs","sources":["../../../../libs/elements/src/portal/internal-props.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;MACa,WAAW,GAAG,MAAM,CAAC,aAAa;AAC/C;MACa,aAAa,GAAG,MAAM,CAAC,sBAAsB;AAC1D;MACa,aAAa,GAAG,MAAM,CAAC,sBAAsB;;;;;;"}
@@ -0,0 +1,9 @@
1
+ /** Registry → portal: re-resolve the active outlet and (re)project into it. */
2
+ const SYNC_PORTAL = Symbol("portal:sync");
3
+ /** Portal → outlet: a portal started projecting into the outlet. */
4
+ const ATTACH_PORTAL = Symbol("portal-outlet:attach");
5
+ /** Portal → outlet: a portal stopped projecting into the outlet. */
6
+ const DETACH_PORTAL = Symbol("portal-outlet:detach");
7
+
8
+ export { ATTACH_PORTAL, DETACH_PORTAL, SYNC_PORTAL };
9
+ //# sourceMappingURL=internal-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-props.js","sources":["../../../../libs/elements/src/portal/internal-props.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;MACa,WAAW,GAAG,MAAM,CAAC,aAAa;AAC/C;MACa,aAAa,GAAG,MAAM,CAAC,sBAAsB;AAC1D;MACa,aAAa,GAAG,MAAM,CAAC,sBAAsB;;;;"}