@helvetia-design/core 0.0.2 → 0.0.4

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.
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * (C) Helvetia Design System https://helvetia-design.vercel.app/ - Apache License 2.0
3
3
  */
4
- import{d as t,f as s}from"./p-ZM4hf44X.js";import{c as e,a as i,o as n,p as a}from"./p-EjCh38Af.js";import{i as o}from"./p-D-l3znnD.js";import{d}from"./p-CKMUtsmn.js";const r=["ds-accordion","ds-alert-container","ds-app-footer","ds-app-navbar","ds-badge","ds-brand-icon","ds-button","ds-button-group","ds-card","ds-card-actions","ds-card-content","ds-card-header","ds-card-subtitle","ds-card-title","ds-carousel","ds-carousel-item","ds-checkbox","ds-checkbox-group","ds-close","ds-content","ds-counter","ds-data","ds-data-item","ds-data-label","ds-data-value","ds-datepicker","ds-divider","ds-drawer","ds-file-upload","ds-heading","ds-hint","ds-hint-text","ds-hint-title","ds-icon","ds-input","ds-item","ds-label","ds-list","ds-logo","ds-modal","ds-modal-body","ds-modal-header","ds-notification","ds-number-input","ds-pagination","ds-phone-input","ds-popup","ds-progress-bar","ds-radio","ds-radio-group","ds-root","ds-segment","ds-segment-item","ds-select","ds-select-optgroup","ds-select-option","ds-shape","ds-sheet","ds-slider","ds-snackbar","ds-spinner","ds-stack","ds-step","ds-step-panel","ds-steps","ds-tab","ds-tab-panel","ds-tabs","ds-tag","ds-tag-group","ds-text","ds-textarea","ds-toast","ds-toggle","ds-tooltip"],c={brand:(t,s)=>t.brand=s,region:(t,s)=>t.region=s,language:(t,s)=>t.language=s,fallbackLanguage:(t,s)=>t.fallbackLanguage=s,allowedLanguages:(t,s)=>t.allowedLanguages=s.split(",").map((t=>t.trim())),animated:(t,s)=>t.animated="false"!==s};class h{constructor(){this._componentObservers=[],this._observers=[],this._config=d}get brand(){return this._config.brand}set brand(t){t!==this._config.brand&&(this._config.brand=t,this._notify())}get locale(){return`${this._config.language}-${this._config.region}`}get region(){return this._config.region}set region(t){t!==this._config.region&&(this._config.region=t,this._notify())}get language(){return this._config.language}set language(t){t!==this._config.language&&(this._config.language=this._config.allowedLanguages.includes(t)?t:this._config.fallbackLanguage,this._notify())}get allowedLanguages(){return this._config.allowedLanguages}set allowedLanguages(t){t!==this._config.allowedLanguages&&(this._config.allowedLanguages=t,this._notify())}get fallbackLanguage(){return this._config.fallbackLanguage}set fallbackLanguage(t){t!==this._config.fallbackLanguage&&(this._config.fallbackLanguage=t,this._notify())}get icons(){return this._config.icons}set icons(t){const s=Object.assign(Object.assign({},this._config.icons),t);o(s,this._config.icons)||(this._config.icons=s,this._notify())}get logger(){return this._config.logger}set logger(t){this._config.logger=Object.assign({},t),this._notify()}get animated(){return this._config.animated}set animated(t){this._config.animated=t,this._notify()}get legalLinks(){return this._config.legalLinks}set legalLinks(t){const s=Object.assign(Object.assign({},this._config.legalLinks),t);o(s,this._config.legalLinks)||(this._config.legalLinks=s,this._notify())}get legalText(){return this._config.legalText}set legalText(t){const s=Object.assign(Object.assign({},this._config.legalText),t);o(s,this._config.legalText)||(this._config.legalText=s,this._notify())}get socialLinks(){return this._config.socialLinks}set socialLinks(t){const s=Object.assign(Object.assign({},this._config.socialLinks),t);o(s,this._config.socialLinks)||(this._config.socialLinks=s,this._notify())}attach(t){if(this._observers.includes(t))return console.log("Subject: Observer has been attached already.");this._observers.push(t),t.configChanged(this._config)}detach(t){const s=this._observers.indexOf(t);if(-1===s)return console.log("Subject: Nonexistent observer.");this._observers.splice(s,1)}attachComponent(t){if(this._componentObservers.includes(t))return console.log("Subject: Observer has been attached already.");this._componentObservers.push(t),t.configChanged(this._config)}detachComponent(t){const s=this._componentObservers.indexOf(t);if(-1===s)return console.log("Subject: Nonexistent observer.");this._componentObservers.splice(s,1)}toString(){return JSON.stringify(this._config)}reset(t){this._config=Object.assign(Object.assign(Object.assign({},this._config),t),{icons:Object.assign(Object.assign({},this._config.icons),t.icons)}),this._notify(!1)}_notify(t=!0){for(const t of this._componentObservers)t.configChanged(this._config);if(t)for(const t of this._observers)t.configChanged(this._config)}}const l=new h,u=t=>{try{const s=JSON.parse(t.localStorage.getItem("ds-animated")||"true");return null!==s?{animated:s}:{}}catch(t){return{}}},b=t=>{try{const s=t.document;if(!s)return{};const e=s.querySelector('meta[name="design-system-config"]');if(!e)return{};const i={};for(const[t,s]of Object.entries(c)){const n=e.dataset[t];void 0!==n&&s(i,n)}return i}catch(t){return{}}},g=(s={},e={})=>{0===Object.keys(e).length&&t.hasWindow&&(e=window),e.DesignSystem=e.DesignSystem||{},l.reset(Object.assign(Object.assign(Object.assign(Object.assign({},b(e)),u(e)),s),{icons:Object.assign({},s.icons)})),e.DesignSystem.config=l};class p{constructor(t){this.type=t,this.container=null}async create(t){var s;return this.setupContainer(t),null===(s=this.container)||void 0===s?void 0:s.addAlert(t)}async remove(t){var s;await(null===(s=this.container)||void 0===s?void 0:s.removeAlert(t))}async removeAll(){var t;await(null===(t=this.container)||void 0===t?void 0:t.removeAll())}setupContainer(t){const s=`ds-${this.type}-container`;this.container=document.getElementById(s),this.container||this.container||(this.container=document.createElement("ds-alert-container"),this.container.id=s,this.container.setAttribute("type",this.type),i(document).appendChild(this.container))}}const m=t=>new p(t),f=m("toast"),j=m("snackbar"),y=new class{async create(t={}){const s=document.createElement("ds-modal");let o;void 0!==t.modalWidth&&(s.modalWidth=t.modalWidth),void 0!==t.closable&&(s.closable=t.closable),void 0!==t.fullscreen&&(s.fullscreen=t.fullscreen),void 0!==t.label&&(s.label=t.label),i(document).appendChild(s);try{void 0!==t.component&&(o=await(async(t,s,i,n,a)=>{if(t)return t.attachViewToDom(s,i,a,n);if("string"!=typeof i&&!(i instanceof HTMLElement))throw new Error("framework delegate is missing");const o="string"==typeof i?s.ownerDocument&&s.ownerDocument.createElement(i):i;return n&&n.forEach((t=>o.classList.add(t))),a&&Object.assign(o,a),o.slot="body",s.appendChild(o),await new Promise((t=>e(o,t))),o})(t.delegate,s,t.component,[],t.componentProps))}catch(t){throw s.remove(),t}const d=()=>((t,s)=>{if(s){if(t)return t.removeViewFromDom(s.parentElement,s);s.remove()}return Promise.resolve()})(t.delegate,o).finally((()=>{void 0!==o&&s.remove()})),r=t=>{t.target===s&&(a(s,"dsDidDismiss",r),d())};n(s,"dsDidDismiss",r);try{await s.present()}catch(t){throw await d().catch((()=>{})),t}return s}async dismiss(s,e,i){if(!t.hasDocument)return;const n=s?`ds-modal#${CSS.escape(s)}`:"ds-modal[open]",a=document.querySelector(n);await(null==a?void 0:a.dismiss(e,i))}async dismissAll(){if(!t.hasDocument)return;const s=Array.from(document.querySelectorAll("ds-modal[open]"));await Promise.all(s.map((t=>t.dismiss())))}},O=(e={},i,n={})=>{0===Object.keys(n).length&&t.hasWindow&&(n=window),n.DesignSystem=n.DesignSystem||{},i&&s(i),g(Object.assign(Object.assign({},e),i),n),n.DesignSystem.toastController=f,n.DesignSystem.snackbarController=j,n.DesignSystem.modalController=y,n.DesignSystem.initialize=()=>g(n.DesignSystem.config,n),n.DesignSystem.version="0.0.2",e._generateHydrateForCustomElementsOutput&&v(r)},v=(t=[])=>{const s="undefined"!=typeof window?window:{};if(!s.document)return void console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");const e=s.document.head,i=e.querySelector("meta[charset]"),n=s.document.createElement("style");t.length>0&&(n.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}",n.textContent+=t.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",n.innerHTML.length&&(n.setAttribute("data-styles",""),e.insertBefore(n,i?i.nextSibling:e.firstChild)))};export{h as C,u as a,b,l as c,y as d,f as e,j as f,O as i,g as s}
4
+ import{d as t,f as s}from"./p-ZM4hf44X.js";import{c as e,a as i,o as n,p as a}from"./p-EjCh38Af.js";import{i as o}from"./p-D-l3znnD.js";import{d}from"./p-CKMUtsmn.js";const r=["ds-accordion","ds-alert-container","ds-app-footer","ds-app-navbar","ds-badge","ds-brand-icon","ds-button","ds-button-group","ds-card","ds-card-actions","ds-card-content","ds-card-header","ds-card-subtitle","ds-card-title","ds-carousel","ds-carousel-item","ds-checkbox","ds-checkbox-group","ds-close","ds-content","ds-counter","ds-data","ds-data-item","ds-data-label","ds-data-value","ds-datepicker","ds-divider","ds-drawer","ds-file-upload","ds-heading","ds-hint","ds-hint-text","ds-hint-title","ds-icon","ds-input","ds-item","ds-label","ds-list","ds-logo","ds-modal","ds-modal-body","ds-modal-header","ds-notification","ds-number-input","ds-pagination","ds-phone-input","ds-popup","ds-progress-bar","ds-radio","ds-radio-group","ds-root","ds-segment","ds-segment-item","ds-select","ds-select-optgroup","ds-select-option","ds-shape","ds-sheet","ds-slider","ds-snackbar","ds-spinner","ds-stack","ds-step","ds-step-panel","ds-steps","ds-tab","ds-tab-panel","ds-tabs","ds-tag","ds-tag-group","ds-text","ds-textarea","ds-toast","ds-toggle","ds-tooltip"],c={brand:(t,s)=>t.brand=s,region:(t,s)=>t.region=s,language:(t,s)=>t.language=s,fallbackLanguage:(t,s)=>t.fallbackLanguage=s,allowedLanguages:(t,s)=>t.allowedLanguages=s.split(",").map((t=>t.trim())),animated:(t,s)=>t.animated="false"!==s};class h{constructor(){this._componentObservers=[],this._observers=[],this._config=d}get brand(){return this._config.brand}set brand(t){t!==this._config.brand&&(this._config.brand=t,this._notify())}get locale(){return`${this._config.language}-${this._config.region}`}get region(){return this._config.region}set region(t){t!==this._config.region&&(this._config.region=t,this._notify())}get language(){return this._config.language}set language(t){t!==this._config.language&&(this._config.language=this._config.allowedLanguages.includes(t)?t:this._config.fallbackLanguage,this._notify())}get allowedLanguages(){return this._config.allowedLanguages}set allowedLanguages(t){t!==this._config.allowedLanguages&&(this._config.allowedLanguages=t,this._notify())}get fallbackLanguage(){return this._config.fallbackLanguage}set fallbackLanguage(t){t!==this._config.fallbackLanguage&&(this._config.fallbackLanguage=t,this._notify())}get icons(){return this._config.icons}set icons(t){const s=Object.assign(Object.assign({},this._config.icons),t);o(s,this._config.icons)||(this._config.icons=s,this._notify())}get logger(){return this._config.logger}set logger(t){this._config.logger=Object.assign({},t),this._notify()}get animated(){return this._config.animated}set animated(t){this._config.animated=t,this._notify()}get legalLinks(){return this._config.legalLinks}set legalLinks(t){const s=Object.assign(Object.assign({},this._config.legalLinks),t);o(s,this._config.legalLinks)||(this._config.legalLinks=s,this._notify())}get legalText(){return this._config.legalText}set legalText(t){const s=Object.assign(Object.assign({},this._config.legalText),t);o(s,this._config.legalText)||(this._config.legalText=s,this._notify())}get socialLinks(){return this._config.socialLinks}set socialLinks(t){const s=Object.assign(Object.assign({},this._config.socialLinks),t);o(s,this._config.socialLinks)||(this._config.socialLinks=s,this._notify())}attach(t){if(this._observers.includes(t))return console.log("Subject: Observer has been attached already.");this._observers.push(t),t.configChanged(this._config)}detach(t){const s=this._observers.indexOf(t);if(-1===s)return console.log("Subject: Nonexistent observer.");this._observers.splice(s,1)}attachComponent(t){if(this._componentObservers.includes(t))return console.log("Subject: Observer has been attached already.");this._componentObservers.push(t),t.configChanged(this._config)}detachComponent(t){const s=this._componentObservers.indexOf(t);if(-1===s)return console.log("Subject: Nonexistent observer.");this._componentObservers.splice(s,1)}toString(){return JSON.stringify(this._config)}reset(t){this._config=Object.assign(Object.assign(Object.assign({},this._config),t),{icons:Object.assign(Object.assign({},this._config.icons),t.icons)}),this._notify(!1)}_notify(t=!0){for(const t of this._componentObservers)t.configChanged(this._config);if(t)for(const t of this._observers)t.configChanged(this._config)}}const l=new h,u=t=>{try{const s=JSON.parse(t.localStorage.getItem("ds-animated")||"true");return null!==s?{animated:s}:{}}catch(t){return{}}},b=t=>{try{const s=t.document;if(!s)return{};const e=s.querySelector('meta[name="design-system-config"]');if(!e)return{};const i={};for(const[t,s]of Object.entries(c)){const n=e.dataset[t];void 0!==n&&s(i,n)}return i}catch(t){return{}}},g=(s={},e={})=>{0===Object.keys(e).length&&t.hasWindow&&(e=window),e.DesignSystem=e.DesignSystem||{},l.reset(Object.assign(Object.assign(Object.assign(Object.assign({},b(e)),u(e)),s),{icons:Object.assign({},s.icons)})),e.DesignSystem.config=l};class p{constructor(t){this.type=t,this.container=null}async create(t){var s;return this.setupContainer(t),null===(s=this.container)||void 0===s?void 0:s.addAlert(t)}async remove(t){var s;await(null===(s=this.container)||void 0===s?void 0:s.removeAlert(t))}async removeAll(){var t;await(null===(t=this.container)||void 0===t?void 0:t.removeAll())}setupContainer(t){const s=`ds-${this.type}-container`;this.container=document.getElementById(s),this.container||this.container||(this.container=document.createElement("ds-alert-container"),this.container.id=s,this.container.setAttribute("type",this.type),i(document).appendChild(this.container))}}const m=t=>new p(t),f=m("toast"),j=m("snackbar"),y=new class{async create(t={}){const s=document.createElement("ds-modal");let o;void 0!==t.modalWidth&&(s.modalWidth=t.modalWidth),void 0!==t.closable&&(s.closable=t.closable),void 0!==t.fullscreen&&(s.fullscreen=t.fullscreen),void 0!==t.label&&(s.label=t.label),i(document).appendChild(s);try{void 0!==t.component&&(o=await(async(t,s,i,n,a)=>{if(t)return t.attachViewToDom(s,i,a,n);if("string"!=typeof i&&!(i instanceof HTMLElement))throw new Error("framework delegate is missing");const o="string"==typeof i?s.ownerDocument&&s.ownerDocument.createElement(i):i;return n&&n.forEach((t=>o.classList.add(t))),a&&Object.assign(o,a),o.slot="body",s.appendChild(o),await new Promise((t=>e(o,t))),o})(t.delegate,s,t.component,[],t.componentProps))}catch(t){throw s.remove(),t}const d=()=>((t,s)=>{if(s){if(t)return t.removeViewFromDom(s.parentElement,s);s.remove()}return Promise.resolve()})(t.delegate,o).finally((()=>{void 0!==o&&s.remove()})),r=t=>{t.target===s&&(a(s,"dsDidDismiss",r),d())};n(s,"dsDidDismiss",r);try{await s.present()}catch(t){throw await d().catch((()=>{})),t}return s}async dismiss(s,e,i){if(!t.hasDocument)return;const n=s?`ds-modal#${CSS.escape(s)}`:"ds-modal[open]",a=document.querySelector(n);await(null==a?void 0:a.dismiss(e,i))}async dismissAll(){if(!t.hasDocument)return;const s=Array.from(document.querySelectorAll("ds-modal[open]"));await Promise.all(s.map((t=>t.dismiss())))}},O=(e={},i,n={})=>{0===Object.keys(n).length&&t.hasWindow&&(n=window),n.DesignSystem=n.DesignSystem||{},i&&s(i),g(Object.assign(Object.assign({},e),i),n),n.DesignSystem.toastController=f,n.DesignSystem.snackbarController=j,n.DesignSystem.modalController=y,n.DesignSystem.initialize=()=>g(n.DesignSystem.config,n),n.DesignSystem.version="0.0.4",e._generateHydrateForCustomElementsOutput&&v(r)},v=(t=[])=>{const s="undefined"!=typeof window?window:{};if(!s.document)return void console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");const e=s.document.head,i=e.querySelector("meta[charset]"),n=s.document.createElement("style");t.length>0&&(n.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}",n.textContent+=t.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",n.innerHTML.length&&(n.setAttribute("data-styles",""),e.insertBefore(n,i?i.nextSibling:e.firstChild)))};export{h as C,u as a,b,l as c,y as d,f as e,j as f,O as i,g as s}
@@ -4067,7 +4067,7 @@ const setupDsConfig = (userConfig = {}, win = {}) => {
4067
4067
  };
4068
4068
 
4069
4069
  // generated by .build/version.js
4070
- const VERSION = '0.0.2';
4070
+ const VERSION = '0.0.4';
4071
4071
 
4072
4072
  class AlertControllerImpl {
4073
4073
  constructor(type) {
@@ -2,4 +2,4 @@
2
2
  * (C) Helvetia Design System https://helvetia-design.vercel.app/ - Apache License 2.0
3
3
  */
4
4
  // generated by .build/version.js
5
- export const VERSION = '0.0.2';
5
+ export const VERSION = '0.0.4';