@bino-bi/bn-template-engine 1.0.0-alpha.12 → 1.0.0-alpha.13

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 +1 @@
1
- import{r as t,h as s,H as i,g as a}from"./p-B_d-jp99.js";import{w as r}from"./p-DSXNgKLa.js";import{g as e,f as n}from"./p-DHheVOfP.js";import{w as o,a as h}from"./p-B4JfKvVT.js";const c=class{constructor(s){t(this,s),o(this),this.errors=h(this),r(this,(t=>{this.stores||(this.stores=e(this.element));try{const s=n(JSON.parse(t)),i=Object.assign({},this.stores.internationalization.get(this.namespace));i[this.code]=s,this.stores.internationalization.set(this.namespace,i)}catch(t){console.error(t)}}))}render(){return s(i,{key:"dd384ecf77e4fd5d46ed04b04c4395fba8bac4e1"})}get element(){return a(this)}};c.style="bn-internationalization{display:none}";export{c as bn_internationalization}
1
+ import{r as t,h as s,H as i,g as a}from"./p-B_d-jp99.js";import{w as r}from"./p-BjBz5cSL.js";import{g as e,f as n}from"./p-DHheVOfP.js";import{w as o,a as h}from"./p-B4JfKvVT.js";const c=class{constructor(s){t(this,s),o(this),this.errors=h(this),r(this,(t=>{this.stores||(this.stores=e(this.element));try{const s=n(JSON.parse(t)),i=Object.assign({},this.stores.internationalization.get(this.namespace));i[this.code]=s,this.stores.internationalization.set(this.namespace,i)}catch(t){console.error(t)}}))}render(){return s(i,{key:"dd384ecf77e4fd5d46ed04b04c4395fba8bac4e1"})}get element(){return a(this)}};c.style="bn-internationalization{display:none}";export{c as bn_internationalization}
@@ -0,0 +1 @@
1
+ import{g as r}from"./p-B_d-jp99.js";import{r as t}from"./p-B4JfKvVT.js";const o=(o,s)=>{let a;const e=new MutationObserver((()=>{var r;a&&s(null!==(r=a.textContent)&&void 0!==r?r:"")})),i=o.connectedCallback;o.connectedCallback=()=>{var n;a=r(o),e.observe(a,{childList:!0,subtree:!0,characterData:!0}),s(null!==(n=a.textContent)&&void 0!==n?n:""),t(i,o)};const n=o.disconnectedCallback;o.disconnectedCallback=()=>{e.disconnect(),t(n,o)}};export{o as w}
@@ -3,7 +3,7 @@
3
3
  var index = require('./index-CDKG4xmO.js');
4
4
  var withHasError = require('./withHasError-Cl2gTQzA.js');
5
5
  var contextProtocol = require('./context-protocol-Op7uUwN3.js');
6
- var withBodyObserver = require('./withBodyObserver-D7BKWN2N.js');
6
+ var withBodyObserver = require('./withBodyObserver-BKUE_ypL.js');
7
7
  var withStyled = require('./withStyled-C2kmGAK3.js');
8
8
  var scaling = require('./scaling-57N4Cxb_.js');
9
9
 
@@ -3350,12 +3350,26 @@ const Dataset = class {
3350
3350
  // query text changes; otherwise we just re-materialize so upstream data updates
3351
3351
  // flow through.
3352
3352
  if (this.lastViewQuery !== this.query) {
3353
+ // alasql tracks names in BOTH `db.tables` and `db.views`, and its
3354
+ // CREATE-conflict check looks at `db.tables`. Clean both locations
3355
+ // before creating so devtools "Edit as HTML" (which destroys the old
3356
+ // element and creates a new one without giving us a clean slate)
3357
+ // doesn't trip the "already exists" guard.
3358
+ try {
3359
+ db.exec(`DROP VIEW \`${this.name}\``);
3360
+ }
3361
+ catch (_e) {
3362
+ /* not registered as a view — fine */
3363
+ }
3364
+ if (db.tables[this.name] != null) {
3365
+ delete db.tables[this.name];
3366
+ }
3367
+ // @ts-ignore - views typing is loose
3368
+ if (db.views && db.views[this.name] != null) {
3369
+ // @ts-ignore
3370
+ delete db.views[this.name];
3371
+ }
3353
3372
  try {
3354
- // alasql stores views in `db.views` keyed by name; drop any prior version.
3355
- // @ts-ignore - views typing is loose
3356
- if (db.views && db.views[this.name] != null) {
3357
- db.exec(`DROP VIEW \`${this.name}\``);
3358
- }
3359
3373
  db.exec(`CREATE VIEW \`${this.name}\` AS ${this.query}`);
3360
3374
  this.lastViewQuery = this.query;
3361
3375
  }
@@ -3370,9 +3384,12 @@ const Dataset = class {
3370
3384
  try {
3371
3385
  result = db.exec(`SELECT * FROM \`${this.name}\``);
3372
3386
  }
3373
- catch (e) {
3374
- console.error("bn-dataset: SQL execution failed", e, this.query);
3375
- result = [];
3387
+ catch (_e) {
3388
+ // Most common cause: an upstream datasource referenced by the view hasn't
3389
+ // been registered yet (HTML parse/connectedCallback race). `withDatasource`
3390
+ // re-fires executeQuery on every upstream notify, so we'll retry then.
3391
+ // Skip publish so we don't clobber datasetsMeta with empty data.
3392
+ return;
3376
3393
  }
3377
3394
  }
3378
3395
  this.publish(result);
@@ -3404,17 +3421,19 @@ const Dataset = class {
3404
3421
  if (((_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db) && this.name) {
3405
3422
  const db = this.stores.db.db;
3406
3423
  try {
3407
- // @ts-ignore - views typing is loose
3408
- if (db.views && db.views[this.name] != null) {
3409
- db.exec(`DROP VIEW \`${this.name}\``);
3410
- }
3424
+ db.exec(`DROP VIEW \`${this.name}\``);
3411
3425
  }
3412
3426
  catch (_e) {
3413
- // ignore; view may not exist
3427
+ // not registered as a view — fine
3414
3428
  }
3415
3429
  if (db.tables[this.name] != null) {
3416
3430
  delete db.tables[this.name];
3417
3431
  }
3432
+ // @ts-ignore - views typing is loose
3433
+ if (db.views && db.views[this.name] != null) {
3434
+ // @ts-ignore
3435
+ delete db.views[this.name];
3436
+ }
3418
3437
  this.stores.db.notify(this.name);
3419
3438
  }
3420
3439
  }
@@ -3474,7 +3493,7 @@ const Dataset = class {
3474
3493
  }
3475
3494
  }
3476
3495
  render() {
3477
- return index.h(index.Host, { key: 'd8f90bd66e8d9aafc83c0818cc0e6573a3186568' });
3496
+ return index.h(index.Host, { key: 'fa02248ff99fc299f0ed7c7feae63063d071685a' });
3478
3497
  }
3479
3498
  get element() { return index.getElement(this); }
3480
3499
  static get watchers() { return {
@@ -3574,10 +3593,18 @@ const Datasource = class {
3574
3593
  }
3575
3594
  }
3576
3595
  disconnectedCallback() {
3577
- var _a, _b, _c, _d;
3596
+ var _a, _b;
3578
3597
  this.clearPolling();
3579
- if ((_d = (_c = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db) === null || _c === void 0 ? void 0 : _c.tables) === null || _d === void 0 ? void 0 : _d[this.name]) {
3580
- delete this.stores.db.db.tables[this.name];
3598
+ const db = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db;
3599
+ if (db && this.name) {
3600
+ if (db.tables[this.name] != null) {
3601
+ delete db.tables[this.name];
3602
+ }
3603
+ // @ts-ignore - views typing is loose
3604
+ if (db.views && db.views[this.name] != null) {
3605
+ // @ts-ignore
3606
+ delete db.views[this.name];
3607
+ }
3581
3608
  this.stores.db.notify(this.name);
3582
3609
  }
3583
3610
  }
@@ -3631,7 +3658,7 @@ const Datasource = class {
3631
3658
  }
3632
3659
  }
3633
3660
  render() {
3634
- return index.h(index.Host, { key: '541bcc84a90dc736d62f1c596e0b9e3e5a54ebf3' });
3661
+ return index.h(index.Host, { key: '4c79b32d893865fe7c62118d4186b8175294636f' });
3635
3662
  }
3636
3663
  get element() { return index.getElement(this); }
3637
3664
  static get watchers() { return {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-CDKG4xmO.js');
4
- var withBodyObserver = require('./withBodyObserver-D7BKWN2N.js');
4
+ var withBodyObserver = require('./withBodyObserver-BKUE_ypL.js');
5
5
  var contextProtocol = require('./context-protocol-Op7uUwN3.js');
6
6
  var withHasError = require('./withHasError-Cl2gTQzA.js');
7
7
 
@@ -17,16 +17,21 @@ var withHasError = require('./withHasError-Cl2gTQzA.js');
17
17
  */
18
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
19
  const withBodyObserver = (component, onUpdate) => {
20
- const observer = new MutationObserver((mutations) => {
21
- mutations.forEach((mutation) => {
22
- onUpdate(mutation.target.textContent);
23
- });
20
+ let hostElement;
21
+ // Coalesce bursts of mutations (e.g. devtools "Edit as HTML" fires childList +
22
+ // characterData in quick succession) and always read the *host* textContent so
23
+ // we deliver the complete body, not the individual text node that mutated.
24
+ const observer = new MutationObserver(() => {
25
+ var _a;
26
+ if (hostElement)
27
+ onUpdate((_a = hostElement.textContent) !== null && _a !== void 0 ? _a : "");
24
28
  });
25
29
  const connectedCallback = component["connectedCallback"];
26
30
  component["connectedCallback"] = () => {
27
- const element = index.getElement(component);
28
- observer.observe(element, { childList: true, subtree: true, characterData: true });
29
- onUpdate(element.textContent);
31
+ var _a;
32
+ hostElement = index.getElement(component);
33
+ observer.observe(hostElement, { childList: true, subtree: true, characterData: true });
34
+ onUpdate((_a = hostElement.textContent) !== null && _a !== void 0 ? _a : "");
30
35
  withHasError.runIfExisits(connectedCallback, component);
31
36
  };
32
37
  const disconnectedCallback = component["disconnectedCallback"];
@@ -125,12 +125,26 @@ export class Dataset {
125
125
  // query text changes; otherwise we just re-materialize so upstream data updates
126
126
  // flow through.
127
127
  if (this.lastViewQuery !== this.query) {
128
+ // alasql tracks names in BOTH `db.tables` and `db.views`, and its
129
+ // CREATE-conflict check looks at `db.tables`. Clean both locations
130
+ // before creating so devtools "Edit as HTML" (which destroys the old
131
+ // element and creates a new one without giving us a clean slate)
132
+ // doesn't trip the "already exists" guard.
133
+ try {
134
+ db.exec(`DROP VIEW \`${this.name}\``);
135
+ }
136
+ catch (_e) {
137
+ /* not registered as a view — fine */
138
+ }
139
+ if (db.tables[this.name] != null) {
140
+ delete db.tables[this.name];
141
+ }
142
+ // @ts-ignore - views typing is loose
143
+ if (db.views && db.views[this.name] != null) {
144
+ // @ts-ignore
145
+ delete db.views[this.name];
146
+ }
128
147
  try {
129
- // alasql stores views in `db.views` keyed by name; drop any prior version.
130
- // @ts-ignore - views typing is loose
131
- if (db.views && db.views[this.name] != null) {
132
- db.exec(`DROP VIEW \`${this.name}\``);
133
- }
134
148
  db.exec(`CREATE VIEW \`${this.name}\` AS ${this.query}`);
135
149
  this.lastViewQuery = this.query;
136
150
  }
@@ -145,9 +159,12 @@ export class Dataset {
145
159
  try {
146
160
  result = db.exec(`SELECT * FROM \`${this.name}\``);
147
161
  }
148
- catch (e) {
149
- console.error("bn-dataset: SQL execution failed", e, this.query);
150
- result = [];
162
+ catch (_e) {
163
+ // Most common cause: an upstream datasource referenced by the view hasn't
164
+ // been registered yet (HTML parse/connectedCallback race). `withDatasource`
165
+ // re-fires executeQuery on every upstream notify, so we'll retry then.
166
+ // Skip publish so we don't clobber datasetsMeta with empty data.
167
+ return;
151
168
  }
152
169
  }
153
170
  this.publish(result);
@@ -179,17 +196,19 @@ export class Dataset {
179
196
  if (((_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db) && this.name) {
180
197
  const db = this.stores.db.db;
181
198
  try {
182
- // @ts-ignore - views typing is loose
183
- if (db.views && db.views[this.name] != null) {
184
- db.exec(`DROP VIEW \`${this.name}\``);
185
- }
199
+ db.exec(`DROP VIEW \`${this.name}\``);
186
200
  }
187
201
  catch (_e) {
188
- // ignore; view may not exist
202
+ // not registered as a view — fine
189
203
  }
190
204
  if (db.tables[this.name] != null) {
191
205
  delete db.tables[this.name];
192
206
  }
207
+ // @ts-ignore - views typing is loose
208
+ if (db.views && db.views[this.name] != null) {
209
+ // @ts-ignore
210
+ delete db.views[this.name];
211
+ }
193
212
  this.stores.db.notify(this.name);
194
213
  }
195
214
  }
@@ -249,7 +268,7 @@ export class Dataset {
249
268
  }
250
269
  }
251
270
  render() {
252
- return h(Host, { key: 'd8f90bd66e8d9aafc83c0818cc0e6573a3186568' });
271
+ return h(Host, { key: 'fa02248ff99fc299f0ed7c7feae63063d071685a' });
253
272
  }
254
273
  static get is() { return "bn-dataset"; }
255
274
  static get originalStyleUrls() {
@@ -102,10 +102,18 @@ export class Datasource {
102
102
  }
103
103
  }
104
104
  disconnectedCallback() {
105
- var _a, _b, _c, _d;
105
+ var _a, _b;
106
106
  this.clearPolling();
107
- if ((_d = (_c = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db) === null || _c === void 0 ? void 0 : _c.tables) === null || _d === void 0 ? void 0 : _d[this.name]) {
108
- delete this.stores.db.db.tables[this.name];
107
+ const db = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db;
108
+ if (db && this.name) {
109
+ if (db.tables[this.name] != null) {
110
+ delete db.tables[this.name];
111
+ }
112
+ // @ts-ignore - views typing is loose
113
+ if (db.views && db.views[this.name] != null) {
114
+ // @ts-ignore
115
+ delete db.views[this.name];
116
+ }
109
117
  this.stores.db.notify(this.name);
110
118
  }
111
119
  }
@@ -159,7 +167,7 @@ export class Datasource {
159
167
  }
160
168
  }
161
169
  render() {
162
- return h(Host, { key: '541bcc84a90dc736d62f1c596e0b9e3e5a54ebf3' });
170
+ return h(Host, { key: '4c79b32d893865fe7c62118d4186b8175294636f' });
163
171
  }
164
172
  static get is() { return "bn-datasource"; }
165
173
  static get originalStyleUrls() {
@@ -14,16 +14,21 @@ import { runIfExisits } from "./utils";
14
14
  */
15
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
16
  const withBodyObserver = (component, onUpdate) => {
17
- const observer = new MutationObserver((mutations) => {
18
- mutations.forEach((mutation) => {
19
- onUpdate(mutation.target.textContent);
20
- });
17
+ let hostElement;
18
+ // Coalesce bursts of mutations (e.g. devtools "Edit as HTML" fires childList +
19
+ // characterData in quick succession) and always read the *host* textContent so
20
+ // we deliver the complete body, not the individual text node that mutated.
21
+ const observer = new MutationObserver(() => {
22
+ var _a;
23
+ if (hostElement)
24
+ onUpdate((_a = hostElement.textContent) !== null && _a !== void 0 ? _a : "");
21
25
  });
22
26
  const connectedCallback = component["connectedCallback"];
23
27
  component["connectedCallback"] = () => {
24
- const element = getElement(component);
25
- observer.observe(element, { childList: true, subtree: true, characterData: true });
26
- onUpdate(element.textContent);
28
+ var _a;
29
+ hostElement = getElement(component);
30
+ observer.observe(hostElement, { childList: true, subtree: true, characterData: true });
31
+ onUpdate((_a = hostElement.textContent) !== null && _a !== void 0 ? _a : "");
27
32
  runIfExisits(connectedCallback, component);
28
33
  };
29
34
  const disconnectedCallback = component["disconnectedCallback"];
@@ -1 +1 @@
1
- import{getElement as t,proxyCustomElement as s,HTMLElement as i,h as e,Host as n,transformTag as a}from"@stencil/core/internal/client";import{g as r,c as o}from"./context-protocol.js";import{r as l}from"./utils.js";import{w as h}from"./withBodyObserver.js";import{w as c,a as u}from"./withHasError.js";import{d,c as f}from"./contentDecoder.js";const p=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"],m=["rowGroup","category","subCategory","columnGroup","columnSubGroup"];function g(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function v(t){const s=Array.from(t);return{distinctValues:s,count:s.length,hasData:s.length>0}}const y=s(class extends i{constructor(s){super(),!1!==s&&this.__registerHost(),this.datasources="",this.static=!1,this.raw=!0,this.interval=0,this.lastBodyHash=null,this.lastViewQuery=null,this.currentUrl=null,this.pollTimerId=null,this.abortController=null,c(this),this.errors=u(this),((s,i)=>{let e,n=[],a=[];const h=t=>{let s;try{s=e.db.db.exec(`SELECT * FROM \`${t}\``)}catch(t){s=[]}i()},c=()=>{n.forEach((t=>t())),n=[],a.forEach((t=>{t&&(n.push(e.db.subscribe(t,(()=>h(t)))),h(t))}))},u=new MutationObserver((i=>{i.forEach((i=>{"datasources"===i.attributeName&&(a=(t(s).getAttribute("datasources")||"").split(","),c())}))})),d=s.connectedCallback;s.connectedCallback=()=>{const i=t(s);e=r(i),a=(i.getAttribute("datasources")||"").split(","),c(),u.observe(i,{attributes:!0,attributeFilter:["datasources"]}),l(d,s)};const f=s.disconnectedCallback;s.disconnectedCallback=()=>{u.disconnect(),n.forEach((t=>t())),n=[],o(t(s)),l(f,s)}})(this,(()=>{this.executeQuery()})),h(this,(t=>{const s=t.trim();if(this.isUrl(s)){if(s===this.currentUrl)return;return this.currentUrl=s,this.lastBodyHash=null,this.fetchAndStore(s),void this.startPolling()}let i,e;if(null!==this.currentUrl&&(this.clearPolling(),this.currentUrl=null),!this.raw&&this.static)try{const s=d(t);i=s.hash,e=s.json}catch(s){return void console.error("Error decoding compressed dataset",s,(t+"").slice(0,200))}else i=f(t),e=t;i!==this.lastBodyHash&&(this.lastBodyHash=i,this.query=e,this.executeQuery())}))}executeQuery(){if(this.stores||(this.stores=r(this.element)),!this.query||!this.name)return;const t=this.stores.db.db;let s;if(this.static){try{s=JSON.parse(this.query)}catch(t){console.error("Failed to parse static dataset",t),s=[]}t.tables[this.name]={data:Array.isArray(s)?s:[]},this.lastViewQuery=null}else{if(this.lastViewQuery!==this.query)try{t.views&&null!=t.views[this.name]&&t.exec(`DROP VIEW \`${this.name}\``),t.exec(`CREATE VIEW \`${this.name}\` AS ${this.query}`),this.lastViewQuery=this.query}catch(t){return console.error("bn-dataset: failed to register SQL view",t,this.query),this.lastViewQuery=null,s=[],void this.publish(s)}try{s=t.exec(`SELECT * FROM \`${this.name}\``)}catch(t){console.error("bn-dataset: SQL execution failed",t,this.query),s=[]}}this.publish(s)}publish(t){this.latestResult!==t?(this.latestResult=t,this.stores.db.notify(this.name),this.stores.datasetsMeta.set(this.name,function(t){const s={};for(const t of m)s[t]=new Set;const i={};for(const t of p)i[t]={hasData:!1,min:null,max:null};const e=new Set;let n=null,a=null;const r=Array.isArray(t)?t:[];for(let t=0;t<r.length;t++){const o=r[t];if(null==o)continue;for(const t of m){const i=o[t];null!=i&&""!==i&&s[t].add(i+"")}for(const t of p){const s=o[t];if(g(s)){const e=i[t];e.hasData=!0,(null===e.min||s<e.min)&&(e.min=s),(null===e.max||s>e.max)&&(e.max=s)}}const l=o.date;if(null!=l&&""!==l){const t=l+"";e.add(t),(null===n||t<n)&&(n=t),(null===a||t>a)&&(a=t)}}const o=p.map((t=>({key:t,hasData:i[t].hasData,min:i[t].min,max:i[t].max}))),l=o.filter((t=>t.hasData)).map((t=>t.key)),h=v(s.rowGroup),c=v(s.category),u=v(s.subCategory),d=v(s.columnGroup),f=v(s.columnSubGroup),y={min:n,max:a,hasData:e.size>0,distinctCount:e.size};let b="category";return u.hasData?b="subCategory":c.hasData?b="category":h.hasData&&(b="rowGroup"),{rowCount:r.length,scenarios:o,availableScenarios:l,rowGroup:h,category:c,subCategory:u,columnGroup:d,columnSubGroup:f,dateRange:y,suggestedLevel:b,suggestedOrder:b,suggestedDateInterval:y.hasData?"auto":null,calculatedAt:Date.now()}}(t))):this.stores.db.notify(this.name)}nameUpdated(){this.executeQuery()}onIntervalChange(){this.currentUrl&&this.startPolling()}disconnectedCallback(){var t,s;if(this.clearPolling(),(null===(s=null===(t=this.stores)||void 0===t?void 0:t.db)||void 0===s?void 0:s.db)&&this.name){const t=this.stores.db.db;try{t.views&&null!=t.views[this.name]&&t.exec(`DROP VIEW \`${this.name}\``)}catch(t){}null!=t.tables[this.name]&&delete t.tables[this.name],this.stores.db.notify(this.name)}}isUrl(t){return t.startsWith("http://")||t.startsWith("https://")}async fetchAndStore(t){var s;null===(s=this.abortController)||void 0===s||s.abort(),this.abortController=new AbortController,this.stores||(this.stores=r(this.element));try{const s=await fetch(t,{signal:this.abortController.signal}),i=await s.json();this.stores.db.db.tables[this.name]={data:Array.isArray(i)?i:[]},this.lastViewQuery=null,this.publish(i)}catch(s){if(s instanceof DOMException&&"AbortError"===s.name)return;console.error("bn-dataset: error fetching URL",s,t),this.stores.db.db.tables[this.name]={data:[]},this.lastViewQuery=null,this.publish([])}}clearPolling(){var t;null!==this.pollTimerId&&(clearInterval(this.pollTimerId),this.pollTimerId=null),null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=null}startPolling(){this.clearPolling(),this.currentUrl&&this.interval>0&&(this.pollTimerId=setInterval((()=>{this.currentUrl&&this.fetchAndStore(this.currentUrl)}),1e3*this.interval))}render(){return e(n,{key:"d8f90bd66e8d9aafc83c0818cc0e6573a3186568"})}get element(){return this}static get watchers(){return{name:[{nameUpdated:0}],interval:[{onIntervalChange:0}]}}static get style(){return"bn-dataset{display:none}"}},[0,"bn-dataset",{name:[1],datasources:[1],static:[4],raw:[4],interval:[2]},void 0,{name:[{nameUpdated:0}],interval:[{onIntervalChange:0}]}]),b=y,w=function(){"undefined"!=typeof customElements&&["bn-dataset"].forEach((t=>{"bn-dataset"===t&&(customElements.get(a(t))||customElements.define(a(t),y))}))};export{b as BnDataset,w as defineCustomElement}
1
+ import{getElement as t,proxyCustomElement as s,HTMLElement as i,h as e,Host as n,transformTag as r}from"@stencil/core/internal/client";import{g as a,c as o}from"./context-protocol.js";import{r as l}from"./utils.js";import{w as h}from"./withBodyObserver.js";import{w as c,a as u}from"./withHasError.js";import{d,c as f}from"./contentDecoder.js";const p=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"],m=["rowGroup","category","subCategory","columnGroup","columnSubGroup"];function y(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function g(t){const s=Array.from(t);return{distinctValues:s,count:s.length,hasData:s.length>0}}const v=s(class extends i{constructor(s){super(),!1!==s&&this.__registerHost(),this.datasources="",this.static=!1,this.raw=!0,this.interval=0,this.lastBodyHash=null,this.lastViewQuery=null,this.currentUrl=null,this.pollTimerId=null,this.abortController=null,c(this),this.errors=u(this),((s,i)=>{let e,n=[],r=[];const h=t=>{let s;try{s=e.db.db.exec(`SELECT * FROM \`${t}\``)}catch(t){s=[]}i()},c=()=>{n.forEach((t=>t())),n=[],r.forEach((t=>{t&&(n.push(e.db.subscribe(t,(()=>h(t)))),h(t))}))},u=new MutationObserver((i=>{i.forEach((i=>{"datasources"===i.attributeName&&(r=(t(s).getAttribute("datasources")||"").split(","),c())}))})),d=s.connectedCallback;s.connectedCallback=()=>{const i=t(s);e=a(i),r=(i.getAttribute("datasources")||"").split(","),c(),u.observe(i,{attributes:!0,attributeFilter:["datasources"]}),l(d,s)};const f=s.disconnectedCallback;s.disconnectedCallback=()=>{u.disconnect(),n.forEach((t=>t())),n=[],o(t(s)),l(f,s)}})(this,(()=>{this.executeQuery()})),h(this,(t=>{const s=t.trim();if(this.isUrl(s)){if(s===this.currentUrl)return;return this.currentUrl=s,this.lastBodyHash=null,this.fetchAndStore(s),void this.startPolling()}let i,e;if(null!==this.currentUrl&&(this.clearPolling(),this.currentUrl=null),!this.raw&&this.static)try{const s=d(t);i=s.hash,e=s.json}catch(s){return void console.error("Error decoding compressed dataset",s,(t+"").slice(0,200))}else i=f(t),e=t;i!==this.lastBodyHash&&(this.lastBodyHash=i,this.query=e,this.executeQuery())}))}executeQuery(){if(this.stores||(this.stores=a(this.element)),!this.query||!this.name)return;const t=this.stores.db.db;let s;if(this.static){try{s=JSON.parse(this.query)}catch(t){console.error("Failed to parse static dataset",t),s=[]}t.tables[this.name]={data:Array.isArray(s)?s:[]},this.lastViewQuery=null}else{if(this.lastViewQuery!==this.query){try{t.exec(`DROP VIEW \`${this.name}\``)}catch(t){}null!=t.tables[this.name]&&delete t.tables[this.name],t.views&&null!=t.views[this.name]&&delete t.views[this.name];try{t.exec(`CREATE VIEW \`${this.name}\` AS ${this.query}`),this.lastViewQuery=this.query}catch(t){return console.error("bn-dataset: failed to register SQL view",t,this.query),this.lastViewQuery=null,s=[],void this.publish(s)}}try{s=t.exec(`SELECT * FROM \`${this.name}\``)}catch(t){return}}this.publish(s)}publish(t){this.latestResult!==t?(this.latestResult=t,this.stores.db.notify(this.name),this.stores.datasetsMeta.set(this.name,function(t){const s={};for(const t of m)s[t]=new Set;const i={};for(const t of p)i[t]={hasData:!1,min:null,max:null};const e=new Set;let n=null,r=null;const a=Array.isArray(t)?t:[];for(let t=0;t<a.length;t++){const o=a[t];if(null==o)continue;for(const t of m){const i=o[t];null!=i&&""!==i&&s[t].add(i+"")}for(const t of p){const s=o[t];if(y(s)){const e=i[t];e.hasData=!0,(null===e.min||s<e.min)&&(e.min=s),(null===e.max||s>e.max)&&(e.max=s)}}const l=o.date;if(null!=l&&""!==l){const t=l+"";e.add(t),(null===n||t<n)&&(n=t),(null===r||t>r)&&(r=t)}}const o=p.map((t=>({key:t,hasData:i[t].hasData,min:i[t].min,max:i[t].max}))),l=o.filter((t=>t.hasData)).map((t=>t.key)),h=g(s.rowGroup),c=g(s.category),u=g(s.subCategory),d=g(s.columnGroup),f=g(s.columnSubGroup),v={min:n,max:r,hasData:e.size>0,distinctCount:e.size};let b="category";return u.hasData?b="subCategory":c.hasData?b="category":h.hasData&&(b="rowGroup"),{rowCount:a.length,scenarios:o,availableScenarios:l,rowGroup:h,category:c,subCategory:u,columnGroup:d,columnSubGroup:f,dateRange:v,suggestedLevel:b,suggestedOrder:b,suggestedDateInterval:v.hasData?"auto":null,calculatedAt:Date.now()}}(t))):this.stores.db.notify(this.name)}nameUpdated(){this.executeQuery()}onIntervalChange(){this.currentUrl&&this.startPolling()}disconnectedCallback(){var t,s;if(this.clearPolling(),(null===(s=null===(t=this.stores)||void 0===t?void 0:t.db)||void 0===s?void 0:s.db)&&this.name){const t=this.stores.db.db;try{t.exec(`DROP VIEW \`${this.name}\``)}catch(t){}null!=t.tables[this.name]&&delete t.tables[this.name],t.views&&null!=t.views[this.name]&&delete t.views[this.name],this.stores.db.notify(this.name)}}isUrl(t){return t.startsWith("http://")||t.startsWith("https://")}async fetchAndStore(t){var s;null===(s=this.abortController)||void 0===s||s.abort(),this.abortController=new AbortController,this.stores||(this.stores=a(this.element));try{const s=await fetch(t,{signal:this.abortController.signal}),i=await s.json();this.stores.db.db.tables[this.name]={data:Array.isArray(i)?i:[]},this.lastViewQuery=null,this.publish(i)}catch(s){if(s instanceof DOMException&&"AbortError"===s.name)return;console.error("bn-dataset: error fetching URL",s,t),this.stores.db.db.tables[this.name]={data:[]},this.lastViewQuery=null,this.publish([])}}clearPolling(){var t;null!==this.pollTimerId&&(clearInterval(this.pollTimerId),this.pollTimerId=null),null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=null}startPolling(){this.clearPolling(),this.currentUrl&&this.interval>0&&(this.pollTimerId=setInterval((()=>{this.currentUrl&&this.fetchAndStore(this.currentUrl)}),1e3*this.interval))}render(){return e(n,{key:"fa02248ff99fc299f0ed7c7feae63063d071685a"})}get element(){return this}static get watchers(){return{name:[{nameUpdated:0}],interval:[{onIntervalChange:0}]}}static get style(){return"bn-dataset{display:none}"}},[0,"bn-dataset",{name:[1],datasources:[1],static:[4],raw:[4],interval:[2]},void 0,{name:[{nameUpdated:0}],interval:[{onIntervalChange:0}]}]),b=v,w=function(){"undefined"!=typeof customElements&&["bn-dataset"].forEach((t=>{"bn-dataset"===t&&(customElements.get(r(t))||customElements.define(r(t),v))}))};export{b as BnDataset,w as defineCustomElement}
@@ -1 +1 @@
1
- import{proxyCustomElement as t,HTMLElement as s,h as i,Host as e,transformTag as n}from"@stencil/core/internal/client";import{w as r}from"./withBodyObserver.js";import{g as h}from"./context-protocol.js";import{w as o,a as l}from"./withHasError.js";import{c as a,d as c}from"./contentDecoder.js";const u=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.raw=!0,this.interval=0,this.lastHash=null,this.currentUrl=null,this.pollTimerId=null,this.abortController=null,o(this),this.errors=l(this),r(this,(t=>{this.stores||(this.stores=h(this.element));const s=t.trim();if(this.isUrl(s)){if(s===this.currentUrl)return;return this.currentUrl=s,this.lastHash=null,this.fetchAndStore(s),void this.startPolling()}null!==this.currentUrl&&(this.clearPolling(),this.currentUrl=null);try{let s,i;if(this.raw)s=a(t),i=t;else{const e=c(t);s=e.hash,i=e.json}if(s===this.lastHash)return;this.lastHash=s;const e=JSON.parse(i);this.publish(e)}catch(s){console.error("Error parsing datasource",s,(t+"").slice(0,200)),this.publish([])}}))}publish(t){this.stores.db.db.tables[this.name]={data:Array.isArray(t)?t:[]},this.stores.db.notify(this.name)}onIntervalChange(){this.currentUrl&&this.startPolling()}disconnectedCallback(){var t,s,i,e;this.clearPolling(),(null===(e=null===(i=null===(s=null===(t=this.stores)||void 0===t?void 0:t.db)||void 0===s?void 0:s.db)||void 0===i?void 0:i.tables)||void 0===e?void 0:e[this.name])&&(delete this.stores.db.db.tables[this.name],this.stores.db.notify(this.name))}isUrl(t){return t.startsWith("http://")||t.startsWith("https://")}async fetchAndStore(t){var s;null===(s=this.abortController)||void 0===s||s.abort(),this.abortController=new AbortController,this.stores||(this.stores=h(this.element));try{const s=await fetch(t,{signal:this.abortController.signal}),i=await s.json();this.publish(i)}catch(s){if(s instanceof DOMException&&"AbortError"===s.name)return;console.error("bn-datasource: error fetching URL",s,t),this.publish([])}}clearPolling(){var t;null!==this.pollTimerId&&(clearInterval(this.pollTimerId),this.pollTimerId=null),null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=null}startPolling(){this.clearPolling(),this.currentUrl&&this.interval>0&&(this.pollTimerId=setInterval((()=>{this.currentUrl&&this.fetchAndStore(this.currentUrl)}),1e3*this.interval))}render(){return i(e,{key:"541bcc84a90dc736d62f1c596e0b9e3e5a54ebf3"})}get element(){return this}static get watchers(){return{interval:[{onIntervalChange:0}]}}static get style(){return"bn-datasource{display:none}"}},[0,"bn-datasource",{name:[1],raw:[4],interval:[2]},void 0,{interval:[{onIntervalChange:0}]}]),d=u,v=function(){"undefined"!=typeof customElements&&["bn-datasource"].forEach((t=>{"bn-datasource"===t&&(customElements.get(n(t))||customElements.define(n(t),u))}))};export{d as BnDatasource,v as defineCustomElement}
1
+ import{proxyCustomElement as t,HTMLElement as s,h as i,Host as e,transformTag as n}from"@stencil/core/internal/client";import{w as r}from"./withBodyObserver.js";import{g as h}from"./context-protocol.js";import{w as l,a as o}from"./withHasError.js";import{c as a,d as c}from"./contentDecoder.js";const u=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.raw=!0,this.interval=0,this.lastHash=null,this.currentUrl=null,this.pollTimerId=null,this.abortController=null,l(this),this.errors=o(this),r(this,(t=>{this.stores||(this.stores=h(this.element));const s=t.trim();if(this.isUrl(s)){if(s===this.currentUrl)return;return this.currentUrl=s,this.lastHash=null,this.fetchAndStore(s),void this.startPolling()}null!==this.currentUrl&&(this.clearPolling(),this.currentUrl=null);try{let s,i;if(this.raw)s=a(t),i=t;else{const e=c(t);s=e.hash,i=e.json}if(s===this.lastHash)return;this.lastHash=s;const e=JSON.parse(i);this.publish(e)}catch(s){console.error("Error parsing datasource",s,(t+"").slice(0,200)),this.publish([])}}))}publish(t){this.stores.db.db.tables[this.name]={data:Array.isArray(t)?t:[]},this.stores.db.notify(this.name)}onIntervalChange(){this.currentUrl&&this.startPolling()}disconnectedCallback(){var t,s;this.clearPolling();const i=null===(s=null===(t=this.stores)||void 0===t?void 0:t.db)||void 0===s?void 0:s.db;i&&this.name&&(null!=i.tables[this.name]&&delete i.tables[this.name],i.views&&null!=i.views[this.name]&&delete i.views[this.name],this.stores.db.notify(this.name))}isUrl(t){return t.startsWith("http://")||t.startsWith("https://")}async fetchAndStore(t){var s;null===(s=this.abortController)||void 0===s||s.abort(),this.abortController=new AbortController,this.stores||(this.stores=h(this.element));try{const s=await fetch(t,{signal:this.abortController.signal}),i=await s.json();this.publish(i)}catch(s){if(s instanceof DOMException&&"AbortError"===s.name)return;console.error("bn-datasource: error fetching URL",s,t),this.publish([])}}clearPolling(){var t;null!==this.pollTimerId&&(clearInterval(this.pollTimerId),this.pollTimerId=null),null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=null}startPolling(){this.clearPolling(),this.currentUrl&&this.interval>0&&(this.pollTimerId=setInterval((()=>{this.currentUrl&&this.fetchAndStore(this.currentUrl)}),1e3*this.interval))}render(){return i(e,{key:"4c79b32d893865fe7c62118d4186b8175294636f"})}get element(){return this}static get watchers(){return{interval:[{onIntervalChange:0}]}}static get style(){return"bn-datasource{display:none}"}},[0,"bn-datasource",{name:[1],raw:[4],interval:[2]},void 0,{interval:[{onIntervalChange:0}]}]),d=u,v=function(){"undefined"!=typeof customElements&&["bn-datasource"].forEach((t=>{"bn-datasource"===t&&(customElements.get(n(t))||customElements.define(n(t),u))}))};export{d as BnDatasource,v as defineCustomElement}
@@ -1 +1 @@
1
- import{getElement as t}from"@stencil/core/internal/client";import{r}from"./utils.js";const s=(s,e)=>{const o=new MutationObserver((t=>{t.forEach((t=>{e(t.target.textContent)}))})),c=s.connectedCallback;s.connectedCallback=()=>{const n=t(s);o.observe(n,{childList:!0,subtree:!0,characterData:!0}),e(n.textContent),r(c,s)};const n=s.disconnectedCallback;s.disconnectedCallback=()=>{o.disconnect(),r(n,s)}};export{s as w}
1
+ import{getElement as t}from"@stencil/core/internal/client";import{r}from"./utils.js";const e=(e,o)=>{let i;const n=new MutationObserver((()=>{var t;i&&o(null!==(t=i.textContent)&&void 0!==t?t:"")})),s=e.connectedCallback;e.connectedCallback=()=>{var a;i=t(e),n.observe(i,{childList:!0,subtree:!0,characterData:!0}),o(null!==(a=i.textContent)&&void 0!==a?a:""),r(s,e)};const a=e.disconnectedCallback;e.disconnectedCallback=()=>{n.disconnect(),r(a,e)}};export{e as w}
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement, f as forceUpdate, d as writeTask, e as getAssetPath, F as Fragment$1 } from './index-B_d-jp99.js';
2
2
  import { w as withComponentStatus, a as withHasError, r as runIfExisits } from './withHasError-DW_vMDUp.js';
3
3
  import { g as getStores, c as clearStoresCache, a as globalLabelKeys, b as getDefaultExportFromCjs, d as getOrCreateStores, D as DateTime, e as buildFromExpr } from './context-protocol-BDhzNbeD.js';
4
- import { w as withBodyObserver } from './withBodyObserver-AFk2wwHT.js';
4
+ import { w as withBodyObserver } from './withBodyObserver-IokS6fHD.js';
5
5
  import { a as withComponentStyle, v as validateScenarioList, c as validateVariancesList, b as isValidNumber, d as isValidLevel, e as validateOrderList, f as isValidDirection, g as isValidInteger, i as isValidBoolean, h as isValidMeasureScale, j as validateStackConfig, w as withStyled, k as isBlankInput, A as AggregationLevel$1, O as OrderDirection$1, l as OrderColumn, S as StackBy, m as StackOrder, n as StackMode, o as isValidDateFormat, p as isValidAxisLabelsMode, D as DateDistance, q as AxisLabelsMode, C as ChartMode, r as murmur2, s as isTableBarColumnWidth, t as isValidDataFormat, u as isValidTableType, x as validateThereOfJsonStr, y as validatePartOfJsonStr, z as isValidMeasureType, B as isTableCategoryWidth, E as validateColumnThereOfJsonStr, F as DataFormat, I as I18nMode, T as TableCategoryWidth, M as MeasureType, G as BAR_COLUMN_WIDTH_EM, H as TableBarColumnWidth, J as validateMeasureList, K as isValidDate, L as isValidDateLink, N as DateLink, P as AdapterUtils, Q as CompareUtil, R as OrderAdapter, U as DateStringFactory } from './withStyled-Bl9cSoRW.js';
6
6
  import { a as withDataset, w as withTranslation, g as getParentDimensions, p as parseScaling } from './scaling-La1Ow72h.js';
7
7
 
@@ -3348,12 +3348,26 @@ const Dataset = class {
3348
3348
  // query text changes; otherwise we just re-materialize so upstream data updates
3349
3349
  // flow through.
3350
3350
  if (this.lastViewQuery !== this.query) {
3351
+ // alasql tracks names in BOTH `db.tables` and `db.views`, and its
3352
+ // CREATE-conflict check looks at `db.tables`. Clean both locations
3353
+ // before creating so devtools "Edit as HTML" (which destroys the old
3354
+ // element and creates a new one without giving us a clean slate)
3355
+ // doesn't trip the "already exists" guard.
3356
+ try {
3357
+ db.exec(`DROP VIEW \`${this.name}\``);
3358
+ }
3359
+ catch (_e) {
3360
+ /* not registered as a view — fine */
3361
+ }
3362
+ if (db.tables[this.name] != null) {
3363
+ delete db.tables[this.name];
3364
+ }
3365
+ // @ts-ignore - views typing is loose
3366
+ if (db.views && db.views[this.name] != null) {
3367
+ // @ts-ignore
3368
+ delete db.views[this.name];
3369
+ }
3351
3370
  try {
3352
- // alasql stores views in `db.views` keyed by name; drop any prior version.
3353
- // @ts-ignore - views typing is loose
3354
- if (db.views && db.views[this.name] != null) {
3355
- db.exec(`DROP VIEW \`${this.name}\``);
3356
- }
3357
3371
  db.exec(`CREATE VIEW \`${this.name}\` AS ${this.query}`);
3358
3372
  this.lastViewQuery = this.query;
3359
3373
  }
@@ -3368,9 +3382,12 @@ const Dataset = class {
3368
3382
  try {
3369
3383
  result = db.exec(`SELECT * FROM \`${this.name}\``);
3370
3384
  }
3371
- catch (e) {
3372
- console.error("bn-dataset: SQL execution failed", e, this.query);
3373
- result = [];
3385
+ catch (_e) {
3386
+ // Most common cause: an upstream datasource referenced by the view hasn't
3387
+ // been registered yet (HTML parse/connectedCallback race). `withDatasource`
3388
+ // re-fires executeQuery on every upstream notify, so we'll retry then.
3389
+ // Skip publish so we don't clobber datasetsMeta with empty data.
3390
+ return;
3374
3391
  }
3375
3392
  }
3376
3393
  this.publish(result);
@@ -3402,17 +3419,19 @@ const Dataset = class {
3402
3419
  if (((_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db) && this.name) {
3403
3420
  const db = this.stores.db.db;
3404
3421
  try {
3405
- // @ts-ignore - views typing is loose
3406
- if (db.views && db.views[this.name] != null) {
3407
- db.exec(`DROP VIEW \`${this.name}\``);
3408
- }
3422
+ db.exec(`DROP VIEW \`${this.name}\``);
3409
3423
  }
3410
3424
  catch (_e) {
3411
- // ignore; view may not exist
3425
+ // not registered as a view — fine
3412
3426
  }
3413
3427
  if (db.tables[this.name] != null) {
3414
3428
  delete db.tables[this.name];
3415
3429
  }
3430
+ // @ts-ignore - views typing is loose
3431
+ if (db.views && db.views[this.name] != null) {
3432
+ // @ts-ignore
3433
+ delete db.views[this.name];
3434
+ }
3416
3435
  this.stores.db.notify(this.name);
3417
3436
  }
3418
3437
  }
@@ -3472,7 +3491,7 @@ const Dataset = class {
3472
3491
  }
3473
3492
  }
3474
3493
  render() {
3475
- return h(Host, { key: 'd8f90bd66e8d9aafc83c0818cc0e6573a3186568' });
3494
+ return h(Host, { key: 'fa02248ff99fc299f0ed7c7feae63063d071685a' });
3476
3495
  }
3477
3496
  get element() { return getElement(this); }
3478
3497
  static get watchers() { return {
@@ -3572,10 +3591,18 @@ const Datasource = class {
3572
3591
  }
3573
3592
  }
3574
3593
  disconnectedCallback() {
3575
- var _a, _b, _c, _d;
3594
+ var _a, _b;
3576
3595
  this.clearPolling();
3577
- if ((_d = (_c = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db) === null || _c === void 0 ? void 0 : _c.tables) === null || _d === void 0 ? void 0 : _d[this.name]) {
3578
- delete this.stores.db.db.tables[this.name];
3596
+ const db = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db;
3597
+ if (db && this.name) {
3598
+ if (db.tables[this.name] != null) {
3599
+ delete db.tables[this.name];
3600
+ }
3601
+ // @ts-ignore - views typing is loose
3602
+ if (db.views && db.views[this.name] != null) {
3603
+ // @ts-ignore
3604
+ delete db.views[this.name];
3605
+ }
3579
3606
  this.stores.db.notify(this.name);
3580
3607
  }
3581
3608
  }
@@ -3629,7 +3656,7 @@ const Datasource = class {
3629
3656
  }
3630
3657
  }
3631
3658
  render() {
3632
- return h(Host, { key: '541bcc84a90dc736d62f1c596e0b9e3e5a54ebf3' });
3659
+ return h(Host, { key: '4c79b32d893865fe7c62118d4186b8175294636f' });
3633
3660
  }
3634
3661
  get element() { return getElement(this); }
3635
3662
  static get watchers() { return {
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement } from './index-B_d-jp99.js';
2
- import { w as withBodyObserver } from './withBodyObserver-AFk2wwHT.js';
2
+ import { w as withBodyObserver } from './withBodyObserver-IokS6fHD.js';
3
3
  import { g as getStores, f as flattenObject } from './context-protocol-BDhzNbeD.js';
4
4
  import { w as withComponentStatus, a as withHasError } from './withHasError-DW_vMDUp.js';
5
5
 
@@ -15,16 +15,21 @@ import { r as runIfExisits } from './withHasError-DW_vMDUp.js';
15
15
  */
16
16
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
17
  const withBodyObserver = (component, onUpdate) => {
18
- const observer = new MutationObserver((mutations) => {
19
- mutations.forEach((mutation) => {
20
- onUpdate(mutation.target.textContent);
21
- });
18
+ let hostElement;
19
+ // Coalesce bursts of mutations (e.g. devtools "Edit as HTML" fires childList +
20
+ // characterData in quick succession) and always read the *host* textContent so
21
+ // we deliver the complete body, not the individual text node that mutated.
22
+ const observer = new MutationObserver(() => {
23
+ var _a;
24
+ if (hostElement)
25
+ onUpdate((_a = hostElement.textContent) !== null && _a !== void 0 ? _a : "");
22
26
  });
23
27
  const connectedCallback = component["connectedCallback"];
24
28
  component["connectedCallback"] = () => {
25
- const element = getElement(component);
26
- observer.observe(element, { childList: true, subtree: true, characterData: true });
27
- onUpdate(element.textContent);
29
+ var _a;
30
+ hostElement = getElement(component);
31
+ observer.observe(hostElement, { childList: true, subtree: true, characterData: true });
32
+ onUpdate((_a = hostElement.textContent) !== null && _a !== void 0 ? _a : "");
28
33
  runIfExisits(connectedCallback, component);
29
34
  };
30
35
  const disconnectedCallback = component["disconnectedCallback"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bino-bi/bn-template-engine",
3
- "version": "1.0.0-alpha.12",
3
+ "version": "1.0.0-alpha.13",
4
4
  "description": "IBCS-compliant web components for business intelligence tables and charts",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",