@nuraly/lumenui 0.2.2 → 0.3.3

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 (41) hide show
  1. package/dist/cdn.js +1 -0
  2. package/dist/nuralyui.bundle.js +2467 -1857
  3. package/dist/nuralyui.bundle.js.gz +0 -0
  4. package/dist/src/components/canvas/bundle.js +569 -204
  5. package/dist/src/components/canvas/bundle.js.gz +0 -0
  6. package/dist/src/components/canvas/canvas.constants.d.ts +1 -1
  7. package/dist/src/components/canvas/canvas.constants.js +1 -1
  8. package/dist/src/components/canvas/workflow-canvas.component.d.ts +7 -0
  9. package/dist/src/components/canvas/workflow-canvas.component.js +46 -2
  10. package/dist/src/components/canvas/workflow-canvas.types.d.ts +8 -1
  11. package/dist/src/components/canvas/workflow-canvas.types.js +157 -0
  12. package/dist/src/components/chat-panel/bundle.js +216 -0
  13. package/dist/src/components/chat-panel/bundle.js.gz +0 -0
  14. package/dist/src/components/chat-panel/chat-panel.component.d.ts +85 -0
  15. package/dist/src/components/chat-panel/chat-panel.component.js +510 -0
  16. package/dist/src/components/chat-panel/chat-panel.style.d.ts +2 -0
  17. package/dist/src/components/chat-panel/chat-panel.style.js +127 -0
  18. package/dist/src/components/chat-panel/chat-panel.types.d.ts +54 -0
  19. package/dist/src/components/chat-panel/chat-panel.types.js +2 -0
  20. package/dist/src/components/chat-panel/index.d.ts +3 -0
  21. package/dist/src/components/chat-panel/index.js +2 -0
  22. package/dist/src/components/chatbot/bundle.js +1 -1
  23. package/dist/src/components/chatbot/bundle.js.gz +0 -0
  24. package/dist/src/components/chatbot/providers/workflow-socket-provider.js +1 -1
  25. package/dist/src/components/presence/bundle.js +69 -42
  26. package/dist/src/components/presence/bundle.js.gz +0 -0
  27. package/dist/src/components/presence/presence-chat.component.d.ts +2 -0
  28. package/dist/src/components/presence/presence-chat.component.js +12 -2
  29. package/dist/src/components/presence/presence.component.d.ts +30 -6
  30. package/dist/src/components/presence/presence.component.js +277 -30
  31. package/dist/src/components/presence/presence.types.d.ts +2 -0
  32. package/dist/src/components/toast/bundle.js +11 -9
  33. package/dist/src/components/toast/bundle.js.gz +0 -0
  34. package/dist/src/components/toast/toast.component.d.ts +8 -0
  35. package/dist/src/components/toast/toast.component.js +17 -7
  36. package/dist/src/components/video/bundle.js +13 -12
  37. package/dist/src/components/video/bundle.js.gz +0 -0
  38. package/dist/src/components/video/video.component.d.ts +15 -1
  39. package/dist/src/components/video/video.component.js +131 -3
  40. package/package.json +5 -10
  41. package/packages/common/dist/VERSIONS.md +1 -1
@@ -1,9 +1,9 @@
1
- import{css as e,html as t,LitElement as i}from"lit";import{property as o,state as s,customElement as r}from"lit/decorators.js";import{classMap as n}from"lit/directives/class-map.js";import{styleMap as a}from"lit/directives/style-map.js";
1
+ import{css as t,html as e,LitElement as i}from"lit";import{property as s,state as o,customElement as r}from"lit/decorators.js";import{classMap as n}from"lit/directives/class-map.js";import{styleMap as a}from"lit/directives/style-map.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2023 Nuraly, Laabidi Aymen
5
5
  * SPDX-License-Identifier: MIT
6
- */const d=e=>class extends e{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var e,t,i;super.disconnectedCallback(),null===(e=this.themeObserver)||void 0===e||e.disconnect(),null===(t=this.designSystemObserver)||void 0===t||t.disconnect(),null===(i=this.mediaQuery)||void 0===i||i.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var e,t;const i=(null===(e=this.closest("[data-theme]"))||void 0===e?void 0:e.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return i||((null===(t=window.matchMedia)||void 0===t?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var e;const t=(null===(e=this.closest("[design-system]"))||void 0===e?void 0:e.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===t?t:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver(()=>{this.requestUpdate()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver(()=>{this.requestUpdate()}),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},l=()=>{var e;return void 0!==globalThis.litElementVersions||"undefined"!=typeof process&&"development"===(null===(e=process.env)||void 0===e?void 0:e.NODE_ENV)||"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)},h=e=>class extends e{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(l())for(const e of this.requiredComponents)if(!this.isComponentAvailable(e))throw new Error(`Required component "${e}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}. Example: import '@nuralyui/${e}';`)}validateDependenciesWithHandler(e){if(!l())return!0;let t=!0;for(const i of this.requiredComponents)if(!this.isComponentAvailable(i)){t=!1;const o=new Error(`Required component "${i}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);e?e(i,o):console.error(o.message)}return t}isComponentAvailable(e){return!!customElements.get(e)}getMissingDependencies(){return this.requiredComponents.filter(e=>!this.isComponentAvailable(e))}areDependenciesAvailable(){return this.requiredComponents.every(e=>this.isComponentAvailable(e))}addRequiredComponent(e){this.requiredComponents.includes(e)||this.requiredComponents.push(e)}removeRequiredComponent(e){const t=this.requiredComponents.indexOf(e);t>-1&&this.requiredComponents.splice(t,1)}},c=e=>class extends e{dispatchCustomEvent(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(e,t){var i;const o=Object.assign(Object.assign({},t),{timestamp:Date.now(),componentName:(null===(i=this.tagName)||void 0===i?void 0:i.toLowerCase())||"unknown"});this.dispatchCustomEvent(e,o)}dispatchInputEvent(e,t){const i=Object.assign({target:t.target||this,value:t.value,originalEvent:t.originalEvent},t);this.dispatchCustomEvent(e,i)}dispatchFocusEvent(e,t){const i=Object.assign({target:t.target||this,value:t.value,focused:t.focused,cursorPosition:t.cursorPosition,selectedText:t.selectedText},t);this.dispatchCustomEvent(e,i)}dispatchValidationEvent(e,t){var i;const o=Object.assign({target:t.target||this,value:t.value,isValid:null!==(i=t.isValid)&&void 0!==i&&i,error:t.error},t);this.dispatchCustomEvent(e,o)}dispatchActionEvent(e,t){const i=Object.assign({target:t.target||this,action:t.action,previousValue:t.previousValue,newValue:t.newValue},t);this.dispatchCustomEvent(e,i)}isReadonlyKeyAllowed(e){if(e.ctrlKey||e.metaKey){return["KeyA","KeyC"].includes(e.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}isActivationKey(e){return"Enter"===e.key||" "===e.key}},p=new Set,u=new Map;
6
+ */const d=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,e,i;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(e=this.designSystemObserver)||void 0===e||e.disconnect(),null===(i=this.mediaQuery)||void 0===i||i.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,e;const i=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return i||((null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const e=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===e?e:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver(()=>{this.requestUpdate()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver(()=>{this.requestUpdate()}),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},h=()=>{var t;return void 0!==globalThis.litElementVersions||"undefined"!=typeof process&&"development"===(null===(t=process.env)||void 0===t?void 0:t.NODE_ENV)||"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)},l=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(h())for(const t of this.requiredComponents)if(!this.isComponentAvailable(t))throw new Error(`Required component "${t}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}. Example: import '@nuralyui/${t}';`)}validateDependenciesWithHandler(t){if(!h())return!0;let e=!0;for(const i of this.requiredComponents)if(!this.isComponentAvailable(i)){e=!1;const s=new Error(`Required component "${i}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(i,s):console.error(s.message)}return e}isComponentAvailable(t){return!!customElements.get(t)}getMissingDependencies(){return this.requiredComponents.filter(t=>!this.isComponentAvailable(t))}areDependenciesAvailable(){return this.requiredComponents.every(t=>this.isComponentAvailable(t))}addRequiredComponent(t){this.requiredComponents.includes(t)||this.requiredComponents.push(t)}removeRequiredComponent(t){const e=this.requiredComponents.indexOf(t);e>-1&&this.requiredComponents.splice(e,1)}},c=t=>class extends t{dispatchCustomEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,e){var i;const s=Object.assign(Object.assign({},e),{timestamp:Date.now(),componentName:(null===(i=this.tagName)||void 0===i?void 0:i.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,s)}dispatchInputEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,originalEvent:e.originalEvent},e);this.dispatchCustomEvent(t,i)}dispatchFocusEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,focused:e.focused,cursorPosition:e.cursorPosition,selectedText:e.selectedText},e);this.dispatchCustomEvent(t,i)}dispatchValidationEvent(t,e){var i;const s=Object.assign({target:e.target||this,value:e.value,isValid:null!==(i=e.isValid)&&void 0!==i&&i,error:e.error},e);this.dispatchCustomEvent(t,s)}dispatchActionEvent(t,e){const i=Object.assign({target:e.target||this,action:e.action,previousValue:e.previousValue,newValue:e.newValue},e);this.dispatchCustomEvent(t,i)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}},p=new Set,u=new Map;
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2023 Nuraly, Laabidi Aymen
@@ -14,7 +14,7 @@ import{css as e,html as t,LitElement as i}from"lit";import{property as o,state a
14
14
  * Copyright 2023 Nuraly, Laabidi Aymen
15
15
  * SPDX-License-Identifier: MIT
16
16
  */
17
- const v=e=>{class t extends e{constructor(){super(...arguments),this.t=null}createRenderRoot(){return this.constructor.useShadowDom?super.createRenderRoot():this}connectedCallback(){const e=this.constructor.useShadowDom;if(!e&&null===this.t)for(this.t=[];this.firstChild;)this.t.push(this.removeChild(this.firstChild));if(super.connectedCallback(),!e){const e=this.constructor,t=this.tagName.toLowerCase(),i=e.styles;if(i){const e=m(i);e&&function(e,t,i){var o;if(!u.has(e)){const i=new CSSStyleSheet;i.replaceSync(t),u.set(e,i)}const s=u.get(e),r=`doc:${e}`;if(p.has(r)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,s],p.add(r)),i){let t=i;for(;t;){const i=t.getRootNode();if(!(i instanceof ShadowRoot))break;{const r=`shadow:${((null===(o=i.host)||void 0===o?void 0:o.tagName)||"").toLowerCase()}:${e}`;p.has(r)||(i.adoptedStyleSheets=[...i.adoptedStyleSheets,s],p.add(r)),t=i.host}}}}(t,e,this)}}}get lightChildren(){return this.t?this.t.filter(e=>!(e instanceof Element&&e.hasAttribute("slot"))):[]}lightChildrenNamed(e){return this.t?this.t.filter(t=>t instanceof Element&&t.getAttribute("slot")===e):[]}}return t.useShadowDom=!1,t};function m(e){return Array.isArray(e)?e.map(e=>m(e)).filter(Boolean).join("\n"):e&&"string"==typeof e.cssText?e.cssText:"string"==typeof e?e:""}var b=e`
17
+ const v=t=>{class e extends t{constructor(){super(...arguments),this.t=null}createRenderRoot(){return this.constructor.useShadowDom?super.createRenderRoot():this}connectedCallback(){const t=this.constructor.useShadowDom;if(!t&&null===this.t)for(this.t=[];this.firstChild;)this.t.push(this.removeChild(this.firstChild));if(super.connectedCallback(),!t){const t=this.constructor,e=this.tagName.toLowerCase(),i=t.styles;if(i){const t=m(i);t&&function(t,e,i){var s;if(!u.has(t)){const i=new CSSStyleSheet;i.replaceSync(e),u.set(t,i)}const o=u.get(t),r=`doc:${t}`;if(p.has(r)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,o],p.add(r)),i){let e=i;for(;e;){const i=e.getRootNode();if(!(i instanceof ShadowRoot))break;{const r=`shadow:${((null===(s=i.host)||void 0===s?void 0:s.tagName)||"").toLowerCase()}:${t}`;p.has(r)||(i.adoptedStyleSheets=[...i.adoptedStyleSheets,o],p.add(r)),e=i.host}}}}(e,t,this)}}}get lightChildren(){return this.t?this.t.filter(t=>!(t instanceof Element&&t.hasAttribute("slot"))):[]}lightChildrenNamed(t){return this.t?this.t.filter(e=>e instanceof Element&&e.getAttribute("slot")===t):[]}}return e.useShadowDom=!1,e};function m(t){return Array.isArray(t)?t.map(t=>m(t)).filter(Boolean).join("\n"):t&&"string"==typeof t.cssText?t.cssText:"string"==typeof t?t:""}var b=t`
18
18
  :host {
19
19
  display: inline-block;
20
20
  box-sizing: border-box;
@@ -129,15 +129,15 @@ const v=e=>{class t extends e{constructor(){super(...arguments),this.t=null}crea
129
129
  from { opacity: 0; }
130
130
  to { opacity: 1; }
131
131
  }
132
- `,g=function(e,t,i,o){for(var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o,a=e.length-1;a>=0;a--)(s=e[a])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};let w=class extends((e=>h(d(c(v(e)))))(i)){constructor(){super(...arguments),this.width="auto",this.height="auto",this.autoplay=!1,this.loop=!1,this.muted=!1,this.controls=!0,this.preload="metadata",this.previewable=!1,this.block=!1,this.showPreview=!1,this.hasError=!1,this.defaultFallback="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDI0MCAxODAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjI0MCIgaGVpZ2h0PSIxODAiIGZpbGw9IiNGM0Y0RjYiLz48cGF0aCBkPSJNMTg4IDY5TDE2OCA4OU0xNjggNjlMMTg4IDg5IiBzdHJva2U9IiM5Q0EzQUYiIHN0cm9rZS13aWR0aD0iNCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PC9zdmc+"}handleError(){this.hasError=!0,this.dispatchEvent(new CustomEvent("nr-video-error",{bubbles:!0,composed:!0,detail:{error:`Error loading video: ${this.src}`,src:this.src}}))}handlePlay(){this.dispatchEvent(new CustomEvent("nr-video-play",{bubbles:!0,composed:!0,detail:{src:this.src}}))}handlePause(){this.dispatchEvent(new CustomEvent("nr-video-pause",{bubbles:!0,composed:!0,detail:{src:this.src}}))}handleEnded(){this.dispatchEvent(new CustomEvent("nr-video-ended",{bubbles:!0,composed:!0,detail:{src:this.src}}))}showPreviewModal(){this.previewable&&!this.hasError&&(this.showPreview=!0,this.dispatchEvent(new CustomEvent("nr-video-preview-open",{bubbles:!0,composed:!0,detail:{src:this.src}})))}closePreviewModal(){this.showPreview=!1,this.dispatchEvent(new CustomEvent("nr-video-preview-close",{bubbles:!0,composed:!0,detail:{src:this.src}}))}render(){const e={"video-container":!0,"video--error":this.hasError},i={width:"number"==typeof this.width?`${this.width}px`:this.width,height:"number"==typeof this.height?`${this.height}px`:this.height};return this.hasError?t`
133
- <div part="container" class=${n(e)}>
132
+ `,g=function(t,e,i,s){for(var o,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,a=t.length-1;a>=0;a--)(o=t[a])&&(n=(r<3?o(n):r>3?o(e,i,n):o(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n},w=function(t,e,i,s){return new(i||(i=Promise))(function(o,r){function n(t){try{d(s.next(t))}catch(t){r(t)}}function a(t){try{d(s.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,a)}d((s=s.apply(t,e||[])).next())})};const f=()=>import("hls.js");let y=class extends((t=>l(d(c(v(t)))))(i)){constructor(){super(...arguments),this.width="auto",this.height="auto",this.autoplay=!1,this.loop=!1,this.muted=!1,this.controls=!0,this.preload="metadata",this.previewable=!1,this.block=!1,this.showPreview=!1,this.hasError=!1,this.defaultFallback="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDI0MCAxODAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjI0MCIgaGVpZ2h0PSIxODAiIGZpbGw9IiNGM0Y0RjYiLz48cGF0aCBkPSJNMTg4IDY5TDE2OCA4OU0xNjggNjlMMTg4IDg5IiBzdHJva2U9IiM5Q0EzQUYiIHN0cm9rZS13aWR0aD0iNCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PC9zdmc+",this.hlsInstance=null,this.previewHlsInstance=null}get isHLS(){return!!this.src&&(this.src.endsWith(".m3u8")||this.src.includes(".m3u8?"))}disconnectedCallback(){super.disconnectedCallback(),this.destroyHls(),this.destroyPreviewHls()}updated(t){super.updated(t),t.has("src")&&this.src&&(this.hasError=!1,this.attachHlsIfNeeded())}destroyHls(){this.hlsInstance&&(this.hlsInstance.destroy(),this.hlsInstance=null)}destroyPreviewHls(){this.previewHlsInstance&&(this.previewHlsInstance.destroy(),this.previewHlsInstance=null)}attachHlsIfNeeded(){return w(this,void 0,void 0,function*(){var t;const e=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector('video[part="video"]');if(e&&this.isHLS)if(e.canPlayType("application/vnd.apple.mpegurl"))e.src=this.src;else try{const{default:t}=yield f();if(!t.isSupported())return void this.handleError();this.destroyHls();const i=new t({enableWorker:!0});this.hlsInstance=i,i.loadSource(this.src),i.attachMedia(e),i.on(t.Events.ERROR,(e,s)=>{if(s.fatal)switch(s.type){case t.ErrorTypes.NETWORK_ERROR:i.startLoad();break;case t.ErrorTypes.MEDIA_ERROR:i.recoverMediaError();break;default:this.handleError()}})}catch(t){e.src=this.src}else this.destroyHls()})}handleError(){this.hasError=!0,this.dispatchEvent(new CustomEvent("nr-video-error",{bubbles:!0,composed:!0,detail:{error:`Error loading video: ${this.src}`,src:this.src}}))}handlePlay(){this.dispatchEvent(new CustomEvent("nr-video-play",{bubbles:!0,composed:!0,detail:{src:this.src}}))}handlePause(){this.dispatchEvent(new CustomEvent("nr-video-pause",{bubbles:!0,composed:!0,detail:{src:this.src}}))}handleEnded(){this.dispatchEvent(new CustomEvent("nr-video-ended",{bubbles:!0,composed:!0,detail:{src:this.src}}))}showPreviewModal(){this.previewable&&!this.hasError&&(this.showPreview=!0,this.dispatchEvent(new CustomEvent("nr-video-preview-open",{bubbles:!0,composed:!0,detail:{src:this.src}})),this.updateComplete.then(()=>this.attachPreviewHls()))}closePreviewModal(){this.showPreview=!1,this.destroyPreviewHls(),this.dispatchEvent(new CustomEvent("nr-video-preview-close",{bubbles:!0,composed:!0,detail:{src:this.src}}))}attachPreviewHls(){return w(this,void 0,void 0,function*(){var t;const e=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector('video[part="preview-video"]');if(e&&this.isHLS)if(e.canPlayType("application/vnd.apple.mpegurl"))e.src=this.src;else try{const{default:t}=yield f();if(!t.isSupported())return;this.destroyPreviewHls();const i=new t({enableWorker:!0});this.previewHlsInstance=i,i.loadSource(this.src),i.attachMedia(e)}catch(t){e.src=this.src}})}firstUpdated(){this.src&&this.attachHlsIfNeeded()}render(){const t={"video-container":!0,"video--error":this.hasError},i={width:"number"==typeof this.width?`${this.width}px`:this.width,height:"number"==typeof this.height?`${this.height}px`:this.height};return this.hasError?e`
133
+ <div part="container" class=${n(t)}>
134
134
  <div part="error-message" class="error-message">
135
135
  <img class="error-icon" src=${this.defaultFallback} alt="Video error" />
136
136
  <p>Unable to load video</p>
137
137
  </div>
138
138
  </div>
139
- `:t`
140
- <div part="container" class=${n(e)}>
139
+ `:e`
140
+ <div part="container" class=${n(t)}>
141
141
  <video
142
142
  part="video"
143
143
  style=${a(i)}
@@ -152,10 +152,10 @@ const v=e=>{class t extends e{constructor(){super(...arguments),this.t=null}crea
152
152
  @pause=${this.handlePause}
153
153
  @ended=${this.handleEnded}
154
154
  >
155
- <source src=${this.src} />
155
+ ${this.isHLS?"":e`<source src=${this.src} />`}
156
156
  Your browser does not support the video tag.
157
157
  </video>
158
- ${this.previewable?t`
158
+ ${this.previewable?e`
159
159
  <button part="preview-button" class="preview-button" @click=${this.showPreviewModal}>
160
160
  <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
161
161
  <path d="M5.5 5.5A.5.5 0 0 1 6 6v3a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0V6z"/>
@@ -164,19 +164,20 @@ const v=e=>{class t extends e{constructor(){super(...arguments),this.t=null}crea
164
164
  Fullscreen
165
165
  </button>
166
166
  `:""}
167
- ${this.showPreview?t`
167
+ ${this.showPreview?e`
168
168
  <div part="preview-modal" class="preview-modal" @click=${this.closePreviewModal}>
169
169
  <button part="preview-close" class="preview-close" @click=${this.closePreviewModal} aria-label="Close preview">×</button>
170
170
  <video
171
+ part="preview-video"
171
172
  ?autoplay=${!0}
172
173
  ?loop=${this.loop}
173
174
  ?muted=${this.muted}
174
175
  controls
175
176
  poster=${this.poster||""}
176
177
  >
177
- <source src=${this.src} />
178
+ ${this.isHLS?"":e`<source src=${this.src} />`}
178
179
  </video>
179
180
  </div>
180
181
  `:""}
181
182
  </div>
182
- `}};w.styles=b,w.useShadowDom=!0,g([o({type:String})],w.prototype,"src",void 0),g([o({type:String})],w.prototype,"poster",void 0),g([o({type:String})],w.prototype,"width",void 0),g([o({type:String})],w.prototype,"height",void 0),g([o({type:Boolean})],w.prototype,"autoplay",void 0),g([o({type:Boolean})],w.prototype,"loop",void 0),g([o({type:Boolean})],w.prototype,"muted",void 0),g([o({type:Boolean})],w.prototype,"controls",void 0),g([o({type:String})],w.prototype,"preload",void 0),g([o({type:Boolean})],w.prototype,"previewable",void 0),g([o({type:Boolean,reflect:!0})],w.prototype,"block",void 0),g([s()],w.prototype,"showPreview",void 0),g([s()],w.prototype,"hasError",void 0),w=g([r("nr-video")],w);export{w as NrVideoElement};
183
+ `}};y.styles=b,y.useShadowDom=!0,g([s({type:String})],y.prototype,"src",void 0),g([s({type:String})],y.prototype,"poster",void 0),g([s({type:String})],y.prototype,"width",void 0),g([s({type:String})],y.prototype,"height",void 0),g([s({type:Boolean})],y.prototype,"autoplay",void 0),g([s({type:Boolean})],y.prototype,"loop",void 0),g([s({type:Boolean})],y.prototype,"muted",void 0),g([s({type:Boolean})],y.prototype,"controls",void 0),g([s({type:String})],y.prototype,"preload",void 0),g([s({type:Boolean})],y.prototype,"previewable",void 0),g([s({type:Boolean,reflect:!0})],y.prototype,"block",void 0),g([o()],y.prototype,"showPreview",void 0),g([o()],y.prototype,"hasError",void 0),y=g([r("nr-video")],y);export{y as NrVideoElement};
@@ -2,7 +2,11 @@ import { LitElement } from "lit";
2
2
  import { VideoPreload } from "./video.types.js";
3
3
  declare const NrVideoElement_base: (new (...args: any[]) => import("@nuralyui/common/mixins").DependencyAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").ThemeAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").EventHandlerCapable) & (new (...args: any[]) => import("packages/common/src/shared/base-mixin.js").LightDomContent) & typeof LitElement;
4
4
  /**
5
- * Video player component with poster, autoplay, loop, and fullscreen preview support.
5
+ * Video player component with poster, autoplay, loop, fullscreen preview, and HLS streaming support.
6
+ *
7
+ * When the `src` is an HLS manifest (.m3u8), the component automatically uses hls.js for
8
+ * adaptive bitrate streaming. Safari uses native HLS support. Falls back to a direct <source>
9
+ * for non-HLS sources.
6
10
  *
7
11
  * @csspart container - The root wrapper div of the video player
8
12
  * @csspart video - The native video element
@@ -28,12 +32,22 @@ export declare class NrVideoElement extends NrVideoElement_base {
28
32
  private showPreview;
29
33
  private hasError;
30
34
  private readonly defaultFallback;
35
+ private hlsInstance;
36
+ private previewHlsInstance;
37
+ private get isHLS();
38
+ disconnectedCallback(): void;
39
+ updated(changed: Map<string, unknown>): void;
40
+ private destroyHls;
41
+ private destroyPreviewHls;
42
+ private attachHlsIfNeeded;
31
43
  private handleError;
32
44
  private handlePlay;
33
45
  private handlePause;
34
46
  private handleEnded;
35
47
  private showPreviewModal;
36
48
  private closePreviewModal;
49
+ private attachPreviewHls;
50
+ firstUpdated(): void;
37
51
  render(): import("lit-html").TemplateResult<1>;
38
52
  }
39
53
  declare global {
@@ -4,14 +4,32 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14
+ });
15
+ };
7
16
  import { html, LitElement } from "lit";
8
17
  import { customElement, property, state } from "lit/decorators.js";
9
18
  import { classMap } from "lit/directives/class-map.js";
10
19
  import { styleMap } from "lit/directives/style-map.js";
11
20
  import { NuralyUIBaseMixin } from '@nuralyui/common/mixins';
12
21
  import styles from "./video.style.js";
22
+ // hls.js module specifier — stored as a variable so bundlers (Vite/Rollup)
23
+ // cannot statically resolve it and fail if the package is not installed.
24
+ // eslint-disable-next-line prefer-const
25
+ let _hlsModule = 'hls.js';
26
+ const importHls = () => import(/* @vite-ignore */ _hlsModule);
13
27
  /**
14
- * Video player component with poster, autoplay, loop, and fullscreen preview support.
28
+ * Video player component with poster, autoplay, loop, fullscreen preview, and HLS streaming support.
29
+ *
30
+ * When the `src` is an HLS manifest (.m3u8), the component automatically uses hls.js for
31
+ * adaptive bitrate streaming. Safari uses native HLS support. Falls back to a direct <source>
32
+ * for non-HLS sources.
15
33
  *
16
34
  * @csspart container - The root wrapper div of the video player
17
35
  * @csspart video - The native video element
@@ -35,6 +53,82 @@ let NrVideoElement = class NrVideoElement extends NuralyUIBaseMixin(LitElement)
35
53
  this.showPreview = false;
36
54
  this.hasError = false;
37
55
  this.defaultFallback = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDI0MCAxODAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjI0MCIgaGVpZ2h0PSIxODAiIGZpbGw9IiNGM0Y0RjYiLz48cGF0aCBkPSJNMTg4IDY5TDE2OCA4OU0xNjggNjlMMTg4IDg5IiBzdHJva2U9IiM5Q0EzQUYiIHN0cm9rZS13aWR0aD0iNCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PC9zdmc+';
56
+ this.hlsInstance = null;
57
+ this.previewHlsInstance = null;
58
+ }
59
+ get isHLS() {
60
+ return !!this.src && (this.src.endsWith('.m3u8') || this.src.includes('.m3u8?'));
61
+ }
62
+ disconnectedCallback() {
63
+ super.disconnectedCallback();
64
+ this.destroyHls();
65
+ this.destroyPreviewHls();
66
+ }
67
+ updated(changed) {
68
+ super.updated(changed);
69
+ if (changed.has('src') && this.src) {
70
+ this.hasError = false;
71
+ this.attachHlsIfNeeded();
72
+ }
73
+ }
74
+ destroyHls() {
75
+ if (this.hlsInstance) {
76
+ this.hlsInstance.destroy();
77
+ this.hlsInstance = null;
78
+ }
79
+ }
80
+ destroyPreviewHls() {
81
+ if (this.previewHlsInstance) {
82
+ this.previewHlsInstance.destroy();
83
+ this.previewHlsInstance = null;
84
+ }
85
+ }
86
+ attachHlsIfNeeded() {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ var _a;
89
+ const video = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector('video[part="video"]');
90
+ if (!video || !this.isHLS) {
91
+ this.destroyHls();
92
+ return;
93
+ }
94
+ // Safari supports HLS natively
95
+ if (video.canPlayType('application/vnd.apple.mpegurl')) {
96
+ video.src = this.src;
97
+ return;
98
+ }
99
+ // Dynamic import of hls.js — it's an optional peer dep
100
+ try {
101
+ const { default: Hls } = yield importHls();
102
+ if (!Hls.isSupported()) {
103
+ this.handleError();
104
+ return;
105
+ }
106
+ this.destroyHls();
107
+ const hls = new Hls({ enableWorker: true });
108
+ this.hlsInstance = hls;
109
+ hls.loadSource(this.src);
110
+ hls.attachMedia(video);
111
+ hls.on(Hls.Events.ERROR, (_event, data) => {
112
+ if (data.fatal) {
113
+ switch (data.type) {
114
+ case Hls.ErrorTypes.NETWORK_ERROR:
115
+ hls.startLoad();
116
+ break;
117
+ case Hls.ErrorTypes.MEDIA_ERROR:
118
+ hls.recoverMediaError();
119
+ break;
120
+ default:
121
+ this.handleError();
122
+ break;
123
+ }
124
+ }
125
+ });
126
+ }
127
+ catch (_b) {
128
+ // hls.js not installed — fall back to direct source (will likely fail for HLS)
129
+ video.src = this.src;
130
+ }
131
+ });
38
132
  }
39
133
  handleError() {
40
134
  this.hasError = true;
@@ -73,16 +167,49 @@ let NrVideoElement = class NrVideoElement extends NuralyUIBaseMixin(LitElement)
73
167
  composed: true,
74
168
  detail: { src: this.src }
75
169
  }));
170
+ // Attach HLS to preview video after render
171
+ this.updateComplete.then(() => this.attachPreviewHls());
76
172
  }
77
173
  }
78
174
  closePreviewModal() {
79
175
  this.showPreview = false;
176
+ this.destroyPreviewHls();
80
177
  this.dispatchEvent(new CustomEvent('nr-video-preview-close', {
81
178
  bubbles: true,
82
179
  composed: true,
83
180
  detail: { src: this.src }
84
181
  }));
85
182
  }
183
+ attachPreviewHls() {
184
+ return __awaiter(this, void 0, void 0, function* () {
185
+ var _a;
186
+ const video = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector('video[part="preview-video"]');
187
+ if (!video || !this.isHLS)
188
+ return;
189
+ if (video.canPlayType('application/vnd.apple.mpegurl')) {
190
+ video.src = this.src;
191
+ return;
192
+ }
193
+ try {
194
+ const { default: Hls } = yield importHls();
195
+ if (!Hls.isSupported())
196
+ return;
197
+ this.destroyPreviewHls();
198
+ const hls = new Hls({ enableWorker: true });
199
+ this.previewHlsInstance = hls;
200
+ hls.loadSource(this.src);
201
+ hls.attachMedia(video);
202
+ }
203
+ catch (_b) {
204
+ video.src = this.src;
205
+ }
206
+ });
207
+ }
208
+ firstUpdated() {
209
+ if (this.src) {
210
+ this.attachHlsIfNeeded();
211
+ }
212
+ }
86
213
  render() {
87
214
  const containerClasses = {
88
215
  'video-container': true,
@@ -118,7 +245,7 @@ let NrVideoElement = class NrVideoElement extends NuralyUIBaseMixin(LitElement)
118
245
  @pause=${this.handlePause}
119
246
  @ended=${this.handleEnded}
120
247
  >
121
- <source src=${this.src} />
248
+ ${!this.isHLS ? html `<source src=${this.src} />` : ''}
122
249
  Your browser does not support the video tag.
123
250
  </video>
124
251
  ${this.previewable ? html `
@@ -134,13 +261,14 @@ let NrVideoElement = class NrVideoElement extends NuralyUIBaseMixin(LitElement)
134
261
  <div part="preview-modal" class="preview-modal" @click=${this.closePreviewModal}>
135
262
  <button part="preview-close" class="preview-close" @click=${this.closePreviewModal} aria-label="Close preview">×</button>
136
263
  <video
264
+ part="preview-video"
137
265
  ?autoplay=${true}
138
266
  ?loop=${this.loop}
139
267
  ?muted=${this.muted}
140
268
  controls
141
269
  poster=${this.poster || ''}
142
270
  >
143
- <source src=${this.src} />
271
+ ${!this.isHLS ? html `<source src=${this.src} />` : ''}
144
272
  </video>
145
273
  </div>
146
274
  ` : ''}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuraly/lumenui",
3
- "version": "0.2.2",
3
+ "version": "0.3.3",
4
4
  "description": "A comprehensive collection of enterprise-class web components built with Lit and TypeScript",
5
5
  "type": "module",
6
6
  "main": "dist/nuralyui.bundle.js",
@@ -12,6 +12,7 @@
12
12
  "./bundle": {
13
13
  "import": "./dist/nuralyui.bundle.js"
14
14
  },
15
+ "./cdn": "./dist/cdn.js",
15
16
  "./common": {
16
17
  "import": "./packages/common/dist/index.js",
17
18
  "types": "./packages/common/dist/index.d.ts"
@@ -78,6 +79,7 @@
78
79
  "files": [
79
80
  "dist/nuralyui.bundle.js",
80
81
  "dist/nuralyui.bundle.js.gz",
82
+ "dist/cdn.js",
81
83
  "dist/src/components/*/index.js",
82
84
  "dist/src/components/*/index.d.ts",
83
85
  "dist/src/components/*/*.js",
@@ -174,24 +176,16 @@
174
176
  "dayjs": "^2.0.0-alpha.4",
175
177
  "highlight.js": "^11.11.1",
176
178
  "lit": "^3.0.0",
177
- "nanostores": "^0.11.4",
178
179
  "mermaid": "^11.0.0",
180
+ "nanostores": "^0.11.4",
179
181
  "vanilla-colorful": "^0.7.2"
180
182
  },
181
183
  "peerDependencies": {
182
184
  "@types/react": "^18.0.0 || ^19.0.0",
183
- "monaco-editor": "^0.55.0",
184
- "monacopilot": "^1.2.0",
185
185
  "react": "^18.0.0 || ^19.0.0",
186
186
  "socket.io-client": "^4.0.0"
187
187
  },
188
188
  "peerDependenciesMeta": {
189
- "monaco-editor": {
190
- "optional": true
191
- },
192
- "monacopilot": {
193
- "optional": true
194
- },
195
189
  "mermaid": {
196
190
  "optional": true
197
191
  },
@@ -211,6 +205,7 @@
211
205
  "@custom-elements-manifest/analyzer": "^0.6.3",
212
206
  "@lit/localize-tools": "^0.8.0",
213
207
  "@open-wc/testing": "^3.1.5",
208
+ "@rollup/plugin-commonjs": "^25.0.8",
214
209
  "@rollup/plugin-dynamic-import-vars": "^2.1.0",
215
210
  "@rollup/plugin-node-resolve": "^13.3.0",
216
211
  "@rollup/plugin-replace": "^5.0.2",
@@ -1,4 +1,4 @@
1
1
  # @nuralyui/common
2
2
 
3
3
  Version: 0.1.5
4
- Build Date: 2026-04-01
4
+ Build Date: 2026-04-14