blue-web 1.19.0 → 1.20.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.
@@ -0,0 +1 @@
1
+ (()=>{"use strict";class t extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML='<button part="base" type="button">Hello world</button>'}}customElements.get("bl-button")||customElements.define("bl-button",t)})();
@@ -0,0 +1,6 @@
1
+ declare class Button extends HTMLElement {
2
+ constructor();
3
+ connectedCallback(): void;
4
+ }
5
+ export { Button };
6
+ export default Button;
@@ -0,0 +1,16 @@
1
+ class Button extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ this.attachShadow({
5
+ mode: "open"
6
+ });
7
+ }
8
+ connectedCallback() {
9
+ this.shadowRoot.innerHTML = /* html*/"<button part=\"base\" type=\"button\">Hello world</button>";
10
+ }
11
+ }
12
+ if (!customElements.get("bl-button")) {
13
+ customElements.define("bl-button", Button);
14
+ }
15
+ export { Button };
16
+ export default Button;
@@ -1 +1 @@
1
- (()=>{"use strict";var n={762:(n,e,t)=>{function o(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}t.d(e,{Os:()=>a});const a=()=>o()+o()+"-"+o()+"-"+o()+"-"+o()+"-"+o()+o()+o()},786:(n,e,t)=>{t.d(e,{k:()=>a});const o={Cancel:["Cancel","Abbrechen"],Yes:["Yes","Ja"],No:["No","Nein"],Message:["Message","Nachricht"],"Toggle menu":["Toggle menu","Menü umschalten"],"Close all":["Close all","Alle schließen"],Error:["Error","Fehler"],Information:["Information","Information"]};function a(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return e=e||navigator.language.toLowerCase().indexOf("de")>-1?"de-DE":"en-US",t=t||o,t[n]?e.indexOf("de-")>-1?t[n][1]:t[n][0]:n}}},e={};function t(o){var a=e[o];if(void 0!==a)return a.exports;var l=e[o]={exports:{}};return n[o](l,l.exports,t),l.exports}t.d=(n,e)=>{for(var o in e)t.o(e,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:e[o]})},t.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e);var o=t(762),a=t(786);async function l(n,e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{title:l=(0,a.k)("Message"),icon:c,switchPrimaryBtn:i=!1,acceptBtnText:r=("verify"===n?(0,a.k)("Yes"):"OK"),cancelBtnText:s=("verify"===n?(0,a.k)("No"):(0,a.k)("Cancel")),inputType:d="text",defaultValue:u}="string"==typeof t?JSON.parse(t):t;const m=(0,o.Os)();return document.getElementById(m)||document.body.insertAdjacentHTML("beforeend",'<dialog class="blue-modal modal" id="'.concat(m,'" aria-labelledby="').concat(m,'-label">\n <div class="modal-dialog">\n <div class="modal-content">\n <form>\n <div class="modal-header">\n ').concat(c?'<div class="me-2">'.concat(c,"</div>"):"",'\n <h1 class="modal-title fs-5" id="').concat(m,'-label">').concat(l,'</h1>\n <button\n type="button"\n class="btn-close"\n aria-label="').concat(s,'"\n onclick="document.getElementById(\'').concat(m,'\').close()"\n ></button>\n </div>\n <div class="modal-body">\n ').concat("ask"===n?'<label for="'.concat(m,'-input">').concat(e,'</label>\n <input\n type="').concat(d,'"\n ').concat(void 0!==u?' value="'.concat(u,'"'):"",'\n id="').concat(m,'-input"\n class="form-control mt-3"\n />'):e,'\n </div>\n <div class="modal-footer">\n ').concat("verify"===n||"ask"===n?'<button\n type="button"\n class="btn '.concat(i?"btn-primary":"blue-btn-plain-primary",'"\n onclick="document.getElementById(\'').concat(m,"').close()\"\n >\n ").concat(s,"\n </button>"):"",'\n <button\n type="submit"\n class="btn ').concat(i?"blue-btn-plain-primary":"btn-primary",'"\n >\n ').concat(r,'\n </button>\n </div>\n </form>\n </div>\n </div>\n\n <form method="dialog" class="blue-modal-backdrop">\n <button>').concat(s,"</button>\n </form>\n </dialog>")),new Promise(e=>{var t;const o=document.getElementById(m),a=()=>{const n=document.getElementById(m);n&&n.remove()};null==o||o.showModal(),null==o||o.addEventListener("close",()=>{a(),e(!1)}),null==o||null===(t=o.querySelector(".modal-content > form"))||void 0===t||t.addEventListener("submit",t=>{t.preventDefault(),"ask"===n&&(o.close(),a(),e((null==o?void 0:o.querySelector("input")).value||"")),o.close(),a(),e(!0)})})}window.blueWeb=window.blueWeb||{},window.blueWeb.dialog={ask:async function(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await l("ask",n,e)},tell:async function(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};await l("tell",n,e)},verify:async function(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!0===await l("verify",n,e)}}})();
1
+ (()=>{"use strict";var n={762:(n,e,t)=>{function o(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}t.d(e,{Os:()=>a});const a=()=>o()+o()+"-"+o()+"-"+o()+"-"+o()+"-"+o()+o()+o()},786:(n,e,t)=>{t.d(e,{k:()=>a});const o={Cancel:["Cancel","Abbrechen"],Yes:["Yes","Ja"],No:["No","Nein"],Message:["Message","Nachricht"],"Toggle menu":["Toggle menu","Menü umschalten"],"Close all":["Close all","Alle schließen"],Error:["Error","Fehler"],Information:["Information","Information"],Loading:["Loading","Laden"],Successful:["Successful","Erfolgreich"]};function a(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return e=e||navigator.language.toLowerCase().indexOf("de")>-1?"de-DE":"en-US",t=t||o,t[n]?e.indexOf("de-")>-1?t[n][1]:t[n][0]:n}}},e={};function t(o){var a=e[o];if(void 0!==a)return a.exports;var l=e[o]={exports:{}};return n[o](l,l.exports,t),l.exports}t.d=(n,e)=>{for(var o in e)t.o(e,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:e[o]})},t.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e);var o=t(762),a=t(786);async function l(n,e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{title:l=(0,a.k)("Message"),icon:c,switchPrimaryBtn:i=!1,acceptBtnText:r=("verify"===n?(0,a.k)("Yes"):"OK"),cancelBtnText:s=("verify"===n?(0,a.k)("No"):(0,a.k)("Cancel")),inputType:d="text",defaultValue:u}="string"==typeof t?JSON.parse(t):t;const m=(0,o.Os)();return document.getElementById(m)||document.body.insertAdjacentHTML("beforeend",'<dialog class="blue-modal modal" id="'.concat(m,'" aria-labelledby="').concat(m,'-label">\n <div class="modal-dialog">\n <div class="modal-content">\n <form>\n <div class="modal-header">\n ').concat(c?'<div class="me-2">'.concat(c,"</div>"):"",'\n <h1 class="modal-title fs-5" id="').concat(m,'-label">').concat(l,'</h1>\n <button\n type="button"\n class="btn-close"\n aria-label="').concat(s,'"\n onclick="document.getElementById(\'').concat(m,'\').close()"\n ></button>\n </div>\n <div class="modal-body">\n ').concat("ask"===n?'<label for="'.concat(m,'-input">').concat(e,'</label>\n <input\n type="').concat(d,'"\n ').concat(void 0!==u?' value="'.concat(u,'"'):"",'\n id="').concat(m,'-input"\n class="form-control mt-3"\n />'):e,'\n </div>\n <div class="modal-footer">\n ').concat("verify"===n||"ask"===n?'<button\n type="button"\n class="btn '.concat(i?"btn-primary":"blue-btn-plain-primary",'"\n onclick="document.getElementById(\'').concat(m,"').close()\"\n >\n ").concat(s,"\n </button>"):"",'\n <button\n type="submit"\n class="btn ').concat(i?"blue-btn-plain-primary":"btn-primary",'"\n >\n ').concat(r,'\n </button>\n </div>\n </form>\n </div>\n </div>\n\n <form method="dialog" class="blue-modal-backdrop">\n <button>').concat(s,"</button>\n </form>\n </dialog>")),new Promise(e=>{var t;const o=document.getElementById(m),a=()=>{const n=document.getElementById(m);n&&n.remove()};null==o||o.showModal(),null==o||o.addEventListener("close",()=>{a(),e(!1)}),null==o||null===(t=o.querySelector(".modal-content > form"))||void 0===t||t.addEventListener("submit",t=>{t.preventDefault(),"ask"===n&&(o.close(),a(),e((null==o?void 0:o.querySelector("input")).value||"")),o.close(),a(),e(!0)})})}window.blueWeb=window.blueWeb||{},window.blueWeb.dialog={ask:async function(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await l("ask",n,e)},tell:async function(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};await l("tell",n,e)},verify:async function(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!0===await l("verify",n,e)}}})();
@@ -0,0 +1,129 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { DxfViewer as DxfViewerLib } from "dxf-viewer";
5
+ export class DxfViewer extends HTMLElement {
6
+ constructor() {
7
+ super(...arguments);
8
+ _defineProperty(this, "viewer", null);
9
+ _defineProperty(this, "container", null);
10
+ _defineProperty(this, "resizeObserver", null);
11
+ _defineProperty(this, "THREE", null);
12
+ }
13
+ static get observedAttributes() {
14
+ return ["src", "clear-color", "auto-resize"];
15
+ }
16
+ async connectedCallback() {
17
+ if (!this.THREE) {
18
+ this.THREE = await import("three");
19
+ }
20
+ this.render();
21
+ this.loadDxf();
22
+ }
23
+ disconnectedCallback() {
24
+ this.cleanup();
25
+ }
26
+ attributeChangedCallback(name, oldValue, newValue) {
27
+ if (oldValue === newValue) return;
28
+ if (name === "src") {
29
+ this.loadDxf();
30
+ }
31
+ }
32
+ render() {
33
+ this.container = document.createElement("div");
34
+ this.container.style.width = "100%";
35
+ this.container.style.height = "100%";
36
+ this.container.style.minHeight = "400px";
37
+ this.appendChild(this.container);
38
+ if (this.getAttribute("auto-resize") !== "false") {
39
+ this.resizeObserver = new ResizeObserver(() => {
40
+ if (this.viewer && this.container) {
41
+ this.viewer.SetSize(this.container.clientWidth, this.container.clientHeight);
42
+ }
43
+ });
44
+ this.resizeObserver.observe(this.container);
45
+ }
46
+ }
47
+ async loadDxf() {
48
+ if (!this.container) return;
49
+ const src = this.getAttribute("src");
50
+ if (!src) return;
51
+ try {
52
+ if (this.viewer) {
53
+ this.viewer.Destroy();
54
+ this.viewer = null;
55
+ }
56
+ this.container.innerHTML = "";
57
+ this.viewer = new DxfViewerLib(this.container, {
58
+ clearColor: this.parseClearColor(this.getAttribute("clear-color") || "#ffffff"),
59
+ autoResize: this.getAttribute("auto-resize") !== "false",
60
+ sceneOptions: {
61
+ wireframeMesh: this.getAttribute("wireframe") === "true"
62
+ }
63
+ });
64
+ const fontsAttr = this.getAttribute("fonts");
65
+ const fonts = fontsAttr ? fontsAttr.split(",").map(f => f.trim()) : null;
66
+ await this.viewer.Load({
67
+ url: src,
68
+ fonts: fonts
69
+ });
70
+ this.viewer.Subscribe("loaded", () => {
71
+ this.dispatchEvent(new CustomEvent("dxf-loaded", {
72
+ detail: {
73
+ viewer: this.viewer
74
+ }
75
+ }));
76
+ });
77
+ this.viewer.Subscribe("message", event => {
78
+ console.log("DXF Viewer message:", event.message);
79
+ });
80
+ } catch (error) {
81
+ console.error("Error loading DXF file:", error);
82
+ this.dispatchEvent(new CustomEvent("dxf-error", {
83
+ detail: {
84
+ error
85
+ }
86
+ }));
87
+ }
88
+ }
89
+ parseClearColor(color) {
90
+ if (!this.THREE) return null;
91
+ if (!color) return new this.THREE.Color(0xffffff);
92
+ return new this.THREE.Color(color);
93
+ }
94
+ cleanup() {
95
+ if (this.resizeObserver) {
96
+ this.resizeObserver.disconnect();
97
+ this.resizeObserver = null;
98
+ }
99
+ if (this.viewer) {
100
+ this.viewer.Destroy();
101
+ this.viewer = null;
102
+ }
103
+ }
104
+ getViewer() {
105
+ return this.viewer;
106
+ }
107
+ async reload() {
108
+ await this.loadDxf();
109
+ }
110
+ showLayer(name, show) {
111
+ if (this.viewer) {
112
+ this.viewer.ShowLayer(name, show);
113
+ }
114
+ }
115
+ fitView(minX, maxX, minY, maxY) {
116
+ let padding = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
117
+ if (this.viewer) {
118
+ this.viewer.FitView(minX, maxX, minY, maxY, padding);
119
+ }
120
+ }
121
+ getLayers() {
122
+ return this.viewer ? Array.from(this.viewer.GetLayers()) : [];
123
+ }
124
+ getBounds() {
125
+ var _this$viewer;
126
+ return ((_this$viewer = this.viewer) === null || _this$viewer === void 0 ? void 0 : _this$viewer.GetBounds()) || null;
127
+ }
128
+ }
129
+ customElements.define("dxf-viewer", DxfViewer);
@@ -1 +1 @@
1
- (()=>{"use strict";var t={};t.d=(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class e extends HTMLElement{static get observedAttributes(){return["value"]}constructor(){var t,e,n;super(),t=this,n=!1,(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e="_initialized"))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,this.attachShadow({mode:"open"})}connectedCallback(){this._initialized||(this.setup(),this._initialized=!0,this.updateValue(this.value))}setup(){const t=document.createElement("style");t.textContent="\n :host {\n display: inline-flex;\n min-width: 1em;\n height: 1em;\n text-align: center;\n overflow: hidden;\n line-height: 1em;\n transition: background-color 0.3s;\n }\n .numbers {\n display: flex;\n flex-direction: column;\n transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n .numbers span {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 1em;\n }";const e=document.createElement("span");e.classList.add("numbers"),e.setAttribute("aria-hidden","true");for(let t=0;t<=9;t++){const n=document.createElement("span");n.textContent=String(t),e.appendChild(n)}const n=document.createElement("span");n.textContent="9+",e.appendChild(n),this.shadowRoot.append(t,e),this.wrapper=e}attributeChangedCallback(t,e,n){"value"===t&&n!==e&&this._initialized&&this.updateValue(parseInt(null!=n?n:"0",10))}updateValue(t){const e=t>9?10:Math.max(0,t),n=this.wrapper.getBoundingClientRect().height||16;this.wrapper.style.transform="translateY(-".concat(e*n,"px)");const i=t>9?"9+":"".concat(t);this.setAttribute("aria-label",i)}set value(t){this.value!==t&&(this.setAttribute("value",String(t)),this._initialized&&this.updateValue(t))}get value(){return parseInt(this.getAttribute("value")||"0",10)||0}}customElements.get("bl-odometer")||customElements.define("bl-odometer",e)})();
1
+ (()=>{"use strict";var t={};t.d=(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class e extends HTMLElement{static get observedAttributes(){return["value","max"]}constructor(){var t,e,n;super(),t=this,n=!1,(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e="_initialized"))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,this.attachShadow({mode:"open"})}connectedCallback(){this._initialized||(this.setup(),this._initialized=!0,this.updateValue(this.value))}setup(){const t=document.createElement("style");t.textContent="\n :host {\n display: inline-flex;\n min-width: 1em;\n height: 1em;\n text-align: center;\n overflow: hidden;\n line-height: 1em;\n transition: background-color 0.3s;\n }\n .numbers {\n display: flex;\n flex-direction: column;\n transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n .numbers span {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 1em;\n }";const e=document.createElement("span");e.classList.add("numbers"),e.setAttribute("aria-hidden","true"),this.shadowRoot.append(t,e),this.wrapper=e,this.rebuildNumbers()}rebuildNumbers(){this.wrapper.innerHTML="";const t=this.max;for(let e=0;e<=t;e++){const t=document.createElement("span");t.textContent=String(e),this.wrapper.appendChild(t)}const e=document.createElement("span");e.textContent="".concat(t,"+"),this.wrapper.appendChild(e),this._initialized&&this.updateValue(this.value)}attributeChangedCallback(t,e,n){n!==e&&this._initialized&&("value"===t?this.updateValue(parseInt(null!=n?n:"0",10)):"max"===t&&this.rebuildNumbers())}updateValue(t){const e=this.max,n=t>e?e+1:Math.max(0,t),i=this.wrapper.getBoundingClientRect().height||16;this.wrapper.style.transform="translateY(-".concat(n*i,"px)");const a=t>e?"".concat(e,"+"):"".concat(t);this.setAttribute("aria-label",a)}set value(t){this.value!==t&&(this.setAttribute("value",String(t)),this._initialized&&(this.updateValue(t),this.dispatchEvent(new CustomEvent("change",{detail:{value:t},bubbles:!0,composed:!0}))))}get value(){return parseInt(this.getAttribute("value")||"0",10)||0}set max(t){this.setAttribute("max",String(t))}get max(){return parseInt(this.getAttribute("max")||"9",10)||9}}customElements.get("bl-odometer")||customElements.define("bl-odometer",e)})();
@@ -5,10 +5,13 @@ declare class Odometer extends HTMLElement {
5
5
  constructor();
6
6
  connectedCallback(): void;
7
7
  private setup;
8
+ private rebuildNumbers;
8
9
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
9
10
  private updateValue;
10
11
  set value(value: number);
11
12
  get value(): number;
13
+ set max(value: number);
14
+ get max(): number;
12
15
  }
13
16
  export { Odometer };
14
17
  export default Odometer;
@@ -3,7 +3,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  class Odometer extends HTMLElement {
5
5
  static get observedAttributes() {
6
- return ["value"];
6
+ return ["value", "max"];
7
7
  }
8
8
  constructor() {
9
9
  super();
@@ -26,27 +26,42 @@ class Odometer extends HTMLElement {
26
26
  const wrapper = document.createElement("span");
27
27
  wrapper.classList.add("numbers");
28
28
  wrapper.setAttribute("aria-hidden", "true");
29
- for (let i = 0; i <= 9; i++) {
29
+ this.shadowRoot.append(style, wrapper);
30
+ this.wrapper = wrapper;
31
+ this.rebuildNumbers();
32
+ }
33
+ rebuildNumbers() {
34
+ this.wrapper.innerHTML = "";
35
+ const max = this.max;
36
+ for (let i = 0; i <= max; i++) {
30
37
  const s = document.createElement("span");
31
38
  s.textContent = String(i);
32
- wrapper.appendChild(s);
39
+ this.wrapper.appendChild(s);
33
40
  }
34
41
  const plus = document.createElement("span");
35
- plus.textContent = "9+";
36
- wrapper.appendChild(plus);
37
- this.shadowRoot.append(style, wrapper);
38
- this.wrapper = wrapper;
42
+ plus.textContent = "".concat(max, "+");
43
+ this.wrapper.appendChild(plus);
44
+
45
+ // Aktuellen Wert neu anwenden
46
+ if (this._initialized) {
47
+ this.updateValue(this.value);
48
+ }
39
49
  }
40
50
  attributeChangedCallback(name, oldValue, newValue) {
41
- if (name === "value" && newValue !== oldValue && this._initialized) {
42
- this.updateValue(parseInt(newValue !== null && newValue !== void 0 ? newValue : "0", 10));
51
+ if (newValue !== oldValue && this._initialized) {
52
+ if (name === "value") {
53
+ this.updateValue(parseInt(newValue !== null && newValue !== void 0 ? newValue : "0", 10));
54
+ } else if (name === "max") {
55
+ this.rebuildNumbers();
56
+ }
43
57
  }
44
58
  }
45
59
  updateValue(value) {
46
- const index = value > 9 ? 10 : Math.max(0, value);
60
+ const max = this.max;
61
+ const index = value > max ? max + 1 : Math.max(0, value);
47
62
  const height = this.wrapper.getBoundingClientRect().height || 16;
48
63
  this.wrapper.style.transform = "translateY(-".concat(index * height, "px)");
49
- const displayValue = value > 9 ? "9+" : "".concat(value);
64
+ const displayValue = value > max ? "".concat(max, "+") : "".concat(value);
50
65
  this.setAttribute("aria-label", displayValue);
51
66
  }
52
67
  set value(value) {
@@ -55,12 +70,25 @@ class Odometer extends HTMLElement {
55
70
  this.setAttribute("value", String(value));
56
71
  if (this._initialized) {
57
72
  this.updateValue(value);
73
+ this.dispatchEvent(new CustomEvent("change", {
74
+ detail: {
75
+ value
76
+ },
77
+ bubbles: true,
78
+ composed: true
79
+ }));
58
80
  }
59
81
  }
60
82
  }
61
83
  get value() {
62
84
  return parseInt(this.getAttribute("value") || "0", 10) || 0;
63
85
  }
86
+ set max(value) {
87
+ this.setAttribute("max", String(value));
88
+ }
89
+ get max() {
90
+ return parseInt(this.getAttribute("max") || "9", 10) || 9;
91
+ }
64
92
  }
65
93
  if (!customElements.get("bl-odometer")) {
66
94
  customElements.define("bl-odometer", Odometer);
package/dist/js/shared.js CHANGED
@@ -6,7 +6,9 @@ const phrases = {
6
6
  "Toggle menu": ["Toggle menu", "Menü umschalten"],
7
7
  "Close all": ["Close all", "Alle schließen"],
8
8
  Error: ["Error", "Fehler"],
9
- Information: ["Information", "Information"]
9
+ Information: ["Information", "Information"],
10
+ Loading: ["Loading", "Laden"],
11
+ Successful: ["Successful", "Erfolgreich"]
10
12
  };
11
13
  export function getPhrase(keyword) {
12
14
  let countryCode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;