add-to-calendar-button 2.6.4 → 2.6.5

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.
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: 3D
7
7
  *
8
- * Version: 2.6.4
8
+ * Version: 2.6.5
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Date
7
7
  *
8
- * Version: 2.6.4
8
+ * Version: 2.6.5
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Flat
7
7
  *
8
- * Version: 2.6.4
8
+ * Version: 2.6.5
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Neumorphism
7
7
  *
8
- * Version: 2.6.4
8
+ * Version: 2.6.5
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Round
7
7
  *
8
- * Version: 2.6.4
8
+ * Version: 2.6.5
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Text
7
7
  *
8
- * Version: 2.6.4
8
+ * Version: 2.6.5
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Default
7
7
  *
8
- * Version: 2.6.4
8
+ * Version: 2.6.5
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -974,14 +974,14 @@ function tzlib_get_timezones(jsonType = false) {
974
974
  * Add to Calendar Button
975
975
  * ++++++++++++++++++++++
976
976
  *
977
- * Version: 2.6.4
977
+ * Version: 2.6.5
978
978
  * Creator: Jens Kuerschner (https://jekuer.com)
979
979
  * Project: https://github.com/add2cal/add-to-calendar-button
980
980
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
981
981
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
982
982
  *
983
983
  */
984
- const atcbVersion = '2.6.4';
984
+ const atcbVersion = '2.6.5';
985
985
  const atcbCssTemplate = {};
986
986
  const atcbIsBrowser = () => {
987
987
  if (typeof window === 'undefined') {
@@ -4956,6 +4956,7 @@ if (atcbIsBrowser()) {
4956
4956
  class AddToCalendarButton extends HTMLElement {
4957
4957
  constructor() {
4958
4958
  super();
4959
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
4959
4960
  const elem = document.createElement('template');
4960
4961
  elem.innerHTML = template;
4961
4962
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -4969,8 +4970,14 @@ if (atcbIsBrowser()) {
4969
4970
  this.data = {};
4970
4971
  this.error = false;
4971
4972
  }
4972
- async connectedCallback() {
4973
- if (this.state.initializing || this.state.ready) {
4973
+ connectedCallback() {
4974
+ if (!this.initializing) {
4975
+ this.initializing = true;
4976
+ setTimeout(() => this.initializeComponent(), 0);
4977
+ }
4978
+ }
4979
+ async initializeComponent() {
4980
+ if (this.state.ready) {
4974
4981
  return;
4975
4982
  }
4976
4983
  this.state.initializing = true;
@@ -5003,8 +5010,12 @@ if (atcbIsBrowser()) {
5003
5010
  this.state.initializing = false;
5004
5011
  this.state.initialized = true;
5005
5012
  this.state.ready = true;
5013
+ this._initializedResolver();
5006
5014
  return;
5007
5015
  }
5016
+ whenInitialized() {
5017
+ return this._initialized;
5018
+ }
5008
5019
  disconnectedCallback() {
5009
5020
  atcb_cleanup(this.shadowRoot, this.identifier);
5010
5021
  if (this.debug) {
@@ -5030,7 +5041,7 @@ if (atcbIsBrowser()) {
5030
5041
  .concat(observeAdditionally);
5031
5042
  }
5032
5043
  attributeChangedCallback(name, oldValue, newValue) {
5033
- if (this.state.initializing || !this.state.ready) {
5044
+ if (!this.state.ready) {
5034
5045
  return;
5035
5046
  }
5036
5047
  if (this.debug && this.state.initialized) {
@@ -974,14 +974,14 @@ function tzlib_get_timezones(jsonType = false) {
974
974
  * Add to Calendar Button
975
975
  * ++++++++++++++++++++++
976
976
  *
977
- * Version: 2.6.4
977
+ * Version: 2.6.5
978
978
  * Creator: Jens Kuerschner (https://jekuer.com)
979
979
  * Project: https://github.com/add2cal/add-to-calendar-button
980
980
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
981
981
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
982
982
  *
983
983
  */
984
- const atcbVersion = '2.6.4';
984
+ const atcbVersion = '2.6.5';
985
985
  const atcbCssTemplate = {
986
986
  if (typeof window === 'undefined') {
987
987
  return false;
@@ -4955,6 +4955,7 @@ if (atcbIsBrowser()) {
4955
4955
  class AddToCalendarButton extends HTMLElement {
4956
4956
  constructor() {
4957
4957
  super();
4958
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
4958
4959
  const elem = document.createElement('template');
4959
4960
  elem.innerHTML = template;
4960
4961
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -4968,8 +4969,14 @@ if (atcbIsBrowser()) {
4968
4969
  this.data = {};
4969
4970
  this.error = false;
4970
4971
  }
4971
- async connectedCallback() {
4972
- if (this.state.initializing || this.state.ready) {
4972
+ connectedCallback() {
4973
+ if (!this.initializing) {
4974
+ this.initializing = true;
4975
+ setTimeout(() => this.initializeComponent(), 0);
4976
+ }
4977
+ }
4978
+ async initializeComponent() {
4979
+ if (this.state.ready) {
4973
4980
  return;
4974
4981
  }
4975
4982
  this.state.initializing = true;
@@ -5002,8 +5009,12 @@ if (atcbIsBrowser()) {
5002
5009
  this.state.initializing = false;
5003
5010
  this.state.initialized = true;
5004
5011
  this.state.ready = true;
5012
+ this._initializedResolver();
5005
5013
  return;
5006
5014
  }
5015
+ whenInitialized() {
5016
+ return this._initialized;
5017
+ }
5007
5018
  disconnectedCallback() {
5008
5019
  atcb_cleanup(this.shadowRoot, this.identifier);
5009
5020
  if (this.debug) {
@@ -5029,7 +5040,7 @@ if (atcbIsBrowser()) {
5029
5040
  .concat(observeAdditionally);
5030
5041
  }
5031
5042
  attributeChangedCallback(name, oldValue, newValue) {
5032
- if (this.state.initializing || !this.state.ready) {
5043
+ if (!this.state.ready) {
5033
5044
  return;
5034
5045
  }
5035
5046
  if (this.debug && this.state.initialized) {
@@ -974,14 +974,14 @@ function tzlib_get_timezones(jsonType = false) {
974
974
  * Add to Calendar Button
975
975
  * ++++++++++++++++++++++
976
976
  *
977
- * Version: 2.6.4
977
+ * Version: 2.6.5
978
978
  * Creator: Jens Kuerschner (https://jekuer.com)
979
979
  * Project: https://github.com/add2cal/add-to-calendar-button
980
980
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
981
981
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
982
982
  *
983
983
  */
984
- const atcbVersion = '2.6.4';
984
+ const atcbVersion = '2.6.5';
985
985
  const atcbCssTemplate = {};
986
986
  const atcbIsBrowser = () => {
987
987
  if (typeof window === 'undefined') {
@@ -5648,6 +5648,7 @@ if (atcbIsBrowser()) {
5648
5648
  class AddToCalendarButton extends HTMLElement {
5649
5649
  constructor() {
5650
5650
  super();
5651
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
5651
5652
  const elem = document.createElement('template');
5652
5653
  elem.innerHTML = template;
5653
5654
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -5661,8 +5662,14 @@ if (atcbIsBrowser()) {
5661
5662
  this.data = {};
5662
5663
  this.error = false;
5663
5664
  }
5664
- async connectedCallback() {
5665
- if (this.state.initializing || this.state.ready) {
5665
+ connectedCallback() {
5666
+ if (!this.initializing) {
5667
+ this.initializing = true;
5668
+ setTimeout(() => this.initializeComponent(), 0);
5669
+ }
5670
+ }
5671
+ async initializeComponent() {
5672
+ if (this.state.ready) {
5666
5673
  return;
5667
5674
  }
5668
5675
  this.state.initializing = true;
@@ -5695,8 +5702,12 @@ if (atcbIsBrowser()) {
5695
5702
  this.state.initializing = false;
5696
5703
  this.state.initialized = true;
5697
5704
  this.state.ready = true;
5705
+ this._initializedResolver();
5698
5706
  return;
5699
5707
  }
5708
+ whenInitialized() {
5709
+ return this._initialized;
5710
+ }
5700
5711
  disconnectedCallback() {
5701
5712
  atcb_cleanup(this.shadowRoot, this.identifier);
5702
5713
  if (this.debug) {
@@ -5722,7 +5733,7 @@ if (atcbIsBrowser()) {
5722
5733
  .concat(observeAdditionally);
5723
5734
  }
5724
5735
  attributeChangedCallback(name, oldValue, newValue) {
5725
- if (this.state.initializing || !this.state.ready) {
5736
+ if (!this.state.ready) {
5726
5737
  return;
5727
5738
  }
5728
5739
  if (this.debug && this.state.initialized) {
package/dist/atcb.js CHANGED
@@ -974,14 +974,14 @@ function tzlib_get_timezones(jsonType = false) {
974
974
  * Add to Calendar Button
975
975
  * ++++++++++++++++++++++
976
976
  *
977
- * Version: 2.6.4
977
+ * Version: 2.6.5
978
978
  * Creator: Jens Kuerschner (https://jekuer.com)
979
979
  * Project: https://github.com/add2cal/add-to-calendar-button
980
980
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
981
981
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
982
982
  *
983
983
  */
984
- const atcbVersion = '2.6.4';
984
+ const atcbVersion = '2.6.5';
985
985
  const atcbCssTemplate = {
986
986
  if (typeof window === 'undefined') {
987
987
  return false;
@@ -5647,6 +5647,7 @@ if (atcbIsBrowser()) {
5647
5647
  class AddToCalendarButton extends HTMLElement {
5648
5648
  constructor() {
5649
5649
  super();
5650
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
5650
5651
  const elem = document.createElement('template');
5651
5652
  elem.innerHTML = template;
5652
5653
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -5660,8 +5661,14 @@ if (atcbIsBrowser()) {
5660
5661
  this.data = {};
5661
5662
  this.error = false;
5662
5663
  }
5663
- async connectedCallback() {
5664
- if (this.state.initializing || this.state.ready) {
5664
+ connectedCallback() {
5665
+ if (!this.initializing) {
5666
+ this.initializing = true;
5667
+ setTimeout(() => this.initializeComponent(), 0);
5668
+ }
5669
+ }
5670
+ async initializeComponent() {
5671
+ if (this.state.ready) {
5665
5672
  return;
5666
5673
  }
5667
5674
  this.state.initializing = true;
@@ -5694,8 +5701,12 @@ if (atcbIsBrowser()) {
5694
5701
  this.state.initializing = false;
5695
5702
  this.state.initialized = true;
5696
5703
  this.state.ready = true;
5704
+ this._initializedResolver();
5697
5705
  return;
5698
5706
  }
5707
+ whenInitialized() {
5708
+ return this._initialized;
5709
+ }
5699
5710
  disconnectedCallback() {
5700
5711
  atcb_cleanup(this.shadowRoot, this.identifier);
5701
5712
  if (this.debug) {
@@ -5721,7 +5732,7 @@ if (atcbIsBrowser()) {
5721
5732
  .concat(observeAdditionally);
5722
5733
  }
5723
5734
  attributeChangedCallback(name, oldValue, newValue) {
5724
- if (this.state.initializing || !this.state.ready) {
5735
+ if (!this.state.ready) {
5725
5736
  return;
5726
5737
  }
5727
5738
  if (this.debug && this.state.initialized) {
@@ -7,14 +7,14 @@ const tzlibActions = require('timezones-ical-library');
7
7
  * Add to Calendar Button
8
8
  * ++++++++++++++++++++++
9
9
  *
10
- * Version: 2.6.4
10
+ * Version: 2.6.5
11
11
  * Creator: Jens Kuerschner (https://jekuer.com)
12
12
  * Project: https://github.com/add2cal/add-to-calendar-button
13
13
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
14
14
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
15
15
  *
16
16
  */
17
- const atcbVersion = '2.6.4';
17
+ const atcbVersion = '2.6.5';
18
18
  const atcbCssTemplate = {
19
19
  if (typeof window === 'undefined') {
20
20
  return false;
@@ -4680,6 +4680,7 @@ if (atcbIsBrowser()) {
4680
4680
  class AddToCalendarButton extends HTMLElement {
4681
4681
  constructor() {
4682
4682
  super();
4683
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
4683
4684
  const elem = document.createElement('template');
4684
4685
  elem.innerHTML = template;
4685
4686
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -4693,8 +4694,14 @@ if (atcbIsBrowser()) {
4693
4694
  this.data = {};
4694
4695
  this.error = false;
4695
4696
  }
4696
- async connectedCallback() {
4697
- if (this.state.initializing || this.state.ready) {
4697
+ connectedCallback() {
4698
+ if (!this.initializing) {
4699
+ this.initializing = true;
4700
+ setTimeout(() => this.initializeComponent(), 0);
4701
+ }
4702
+ }
4703
+ async initializeComponent() {
4704
+ if (this.state.ready) {
4698
4705
  return;
4699
4706
  }
4700
4707
  this.state.initializing = true;
@@ -4727,8 +4734,12 @@ if (atcbIsBrowser()) {
4727
4734
  this.state.initializing = false;
4728
4735
  this.state.initialized = true;
4729
4736
  this.state.ready = true;
4737
+ this._initializedResolver();
4730
4738
  return;
4731
4739
  }
4740
+ whenInitialized() {
4741
+ return this._initialized;
4742
+ }
4732
4743
  disconnectedCallback() {
4733
4744
  atcb_cleanup(this.shadowRoot, this.identifier);
4734
4745
  if (this.debug) {
@@ -4754,7 +4765,7 @@ if (atcbIsBrowser()) {
4754
4765
  .concat(observeAdditionally);
4755
4766
  }
4756
4767
  attributeChangedCallback(name, oldValue, newValue) {
4757
- if (this.state.initializing || !this.state.ready) {
4768
+ if (!this.state.ready) {
4758
4769
  return;
4759
4770
  }
4760
4771
  if (this.debug && this.state.initialized) {
@@ -7,14 +7,14 @@ const tzlibActions = require('timezones-ical-library');
7
7
  * Add to Calendar Button
8
8
  * ++++++++++++++++++++++
9
9
  *
10
- * Version: 2.6.4
10
+ * Version: 2.6.5
11
11
  * Creator: Jens Kuerschner (https://jekuer.com)
12
12
  * Project: https://github.com/add2cal/add-to-calendar-button
13
13
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
14
14
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
15
15
  *
16
16
  */
17
- const atcbVersion = '2.6.4';
17
+ const atcbVersion = '2.6.5';
18
18
  const atcbCssTemplate = {
19
19
  if (typeof window === 'undefined') {
20
20
  return false;
@@ -3988,6 +3988,7 @@ if (atcbIsBrowser()) {
3988
3988
  class AddToCalendarButton extends HTMLElement {
3989
3989
  constructor() {
3990
3990
  super();
3991
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
3991
3992
  const elem = document.createElement('template');
3992
3993
  elem.innerHTML = template;
3993
3994
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -4001,8 +4002,14 @@ if (atcbIsBrowser()) {
4001
4002
  this.data = {};
4002
4003
  this.error = false;
4003
4004
  }
4004
- async connectedCallback() {
4005
- if (this.state.initializing || this.state.ready) {
4005
+ connectedCallback() {
4006
+ if (!this.initializing) {
4007
+ this.initializing = true;
4008
+ setTimeout(() => this.initializeComponent(), 0);
4009
+ }
4010
+ }
4011
+ async initializeComponent() {
4012
+ if (this.state.ready) {
4006
4013
  return;
4007
4014
  }
4008
4015
  this.state.initializing = true;
@@ -4035,8 +4042,12 @@ if (atcbIsBrowser()) {
4035
4042
  this.state.initializing = false;
4036
4043
  this.state.initialized = true;
4037
4044
  this.state.ready = true;
4045
+ this._initializedResolver();
4038
4046
  return;
4039
4047
  }
4048
+ whenInitialized() {
4049
+ return this._initialized;
4050
+ }
4040
4051
  disconnectedCallback() {
4041
4052
  atcb_cleanup(this.shadowRoot, this.identifier);
4042
4053
  if (this.debug) {
@@ -4062,7 +4073,7 @@ if (atcbIsBrowser()) {
4062
4073
  .concat(observeAdditionally);
4063
4074
  }
4064
4075
  attributeChangedCallback(name, oldValue, newValue) {
4065
- if (this.state.initializing || !this.state.ready) {
4076
+ if (!this.state.ready) {
4066
4077
  return;
4067
4078
  }
4068
4079
  if (this.debug && this.state.initialized) {
@@ -7,14 +7,14 @@ const tzlibActions = require('timezones-ical-library');
7
7
  * Add to Calendar Button
8
8
  * ++++++++++++++++++++++
9
9
  *
10
- * Version: 2.6.4
10
+ * Version: 2.6.5
11
11
  * Creator: Jens Kuerschner (https://jekuer.com)
12
12
  * Project: https://github.com/add2cal/add-to-calendar-button
13
13
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
14
14
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
15
15
  *
16
16
  */
17
- const atcbVersion = '2.6.4';
17
+ const atcbVersion = '2.6.5';
18
18
  const atcbCssTemplate = {};
19
19
  const atcbIsBrowser = () => {
20
20
  if (typeof window === 'undefined') {
@@ -3989,6 +3989,7 @@ if (atcbIsBrowser()) {
3989
3989
  class AddToCalendarButton extends HTMLElement {
3990
3990
  constructor() {
3991
3991
  super();
3992
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
3992
3993
  const elem = document.createElement('template');
3993
3994
  elem.innerHTML = template;
3994
3995
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -4002,8 +4003,14 @@ if (atcbIsBrowser()) {
4002
4003
  this.data = {};
4003
4004
  this.error = false;
4004
4005
  }
4005
- async connectedCallback() {
4006
- if (this.state.initializing || this.state.ready) {
4006
+ connectedCallback() {
4007
+ if (!this.initializing) {
4008
+ this.initializing = true;
4009
+ setTimeout(() => this.initializeComponent(), 0);
4010
+ }
4011
+ }
4012
+ async initializeComponent() {
4013
+ if (this.state.ready) {
4007
4014
  return;
4008
4015
  }
4009
4016
  this.state.initializing = true;
@@ -4036,8 +4043,12 @@ if (atcbIsBrowser()) {
4036
4043
  this.state.initializing = false;
4037
4044
  this.state.initialized = true;
4038
4045
  this.state.ready = true;
4046
+ this._initializedResolver();
4039
4047
  return;
4040
4048
  }
4049
+ whenInitialized() {
4050
+ return this._initialized;
4051
+ }
4041
4052
  disconnectedCallback() {
4042
4053
  atcb_cleanup(this.shadowRoot, this.identifier);
4043
4054
  if (this.debug) {
@@ -4063,7 +4074,7 @@ if (atcbIsBrowser()) {
4063
4074
  .concat(observeAdditionally);
4064
4075
  }
4065
4076
  attributeChangedCallback(name, oldValue, newValue) {
4066
- if (this.state.initializing || !this.state.ready) {
4077
+ if (!this.state.ready) {
4067
4078
  return;
4068
4079
  }
4069
4080
  if (this.debug && this.state.initialized) {
@@ -7,14 +7,14 @@ const tzlibActions = require('timezones-ical-library');
7
7
  * Add to Calendar Button
8
8
  * ++++++++++++++++++++++
9
9
  *
10
- * Version: 2.6.4
10
+ * Version: 2.6.5
11
11
  * Creator: Jens Kuerschner (https://jekuer.com)
12
12
  * Project: https://github.com/add2cal/add-to-calendar-button
13
13
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
14
14
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
15
15
  *
16
16
  */
17
- const atcbVersion = '2.6.4';
17
+ const atcbVersion = '2.6.5';
18
18
  const atcbCssTemplate = {};
19
19
  const atcbIsBrowser = () => {
20
20
  if (typeof window === 'undefined') {
@@ -4681,6 +4681,7 @@ if (atcbIsBrowser()) {
4681
4681
  class AddToCalendarButton extends HTMLElement {
4682
4682
  constructor() {
4683
4683
  super();
4684
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
4684
4685
  const elem = document.createElement('template');
4685
4686
  elem.innerHTML = template;
4686
4687
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -4694,8 +4695,14 @@ if (atcbIsBrowser()) {
4694
4695
  this.data = {};
4695
4696
  this.error = false;
4696
4697
  }
4697
- async connectedCallback() {
4698
- if (this.state.initializing || this.state.ready) {
4698
+ connectedCallback() {
4699
+ if (!this.initializing) {
4700
+ this.initializing = true;
4701
+ setTimeout(() => this.initializeComponent(), 0);
4702
+ }
4703
+ }
4704
+ async initializeComponent() {
4705
+ if (this.state.ready) {
4699
4706
  return;
4700
4707
  }
4701
4708
  this.state.initializing = true;
@@ -4728,8 +4735,12 @@ if (atcbIsBrowser()) {
4728
4735
  this.state.initializing = false;
4729
4736
  this.state.initialized = true;
4730
4737
  this.state.ready = true;
4738
+ this._initializedResolver();
4731
4739
  return;
4732
4740
  }
4741
+ whenInitialized() {
4742
+ return this._initialized;
4743
+ }
4733
4744
  disconnectedCallback() {
4734
4745
  atcb_cleanup(this.shadowRoot, this.identifier);
4735
4746
  if (this.debug) {
@@ -4755,7 +4766,7 @@ if (atcbIsBrowser()) {
4755
4766
  .concat(observeAdditionally);
4756
4767
  }
4757
4768
  attributeChangedCallback(name, oldValue, newValue) {
4758
- if (this.state.initializing || !this.state.ready) {
4769
+ if (!this.state.ready) {
4759
4770
  return;
4760
4771
  }
4761
4772
  if (this.debug && this.state.initialized) {
@@ -6,14 +6,14 @@ import { tzlib_get_ical_block, tzlib_get_offset, tzlib_get_timezones } from 'tim
6
6
  * Add to Calendar Button
7
7
  * ++++++++++++++++++++++
8
8
  *
9
- * Version: 2.6.4
9
+ * Version: 2.6.5
10
10
  * Creator: Jens Kuerschner (https://jekuer.com)
11
11
  * Project: https://github.com/add2cal/add-to-calendar-button
12
12
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
13
13
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
14
14
  *
15
15
  */
16
- const atcbVersion = '2.6.4';
16
+ const atcbVersion = '2.6.5';
17
17
  const atcbCssTemplate = {
18
18
  if (typeof window === 'undefined') {
19
19
  return false;
@@ -4679,6 +4679,7 @@ if (atcbIsBrowser()) {
4679
4679
  class AddToCalendarButton extends HTMLElement {
4680
4680
  constructor() {
4681
4681
  super();
4682
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
4682
4683
  const elem = document.createElement('template');
4683
4684
  elem.innerHTML = template;
4684
4685
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -4692,8 +4693,14 @@ if (atcbIsBrowser()) {
4692
4693
  this.data = {};
4693
4694
  this.error = false;
4694
4695
  }
4695
- async connectedCallback() {
4696
- if (this.state.initializing || this.state.ready) {
4696
+ connectedCallback() {
4697
+ if (!this.initializing) {
4698
+ this.initializing = true;
4699
+ setTimeout(() => this.initializeComponent(), 0);
4700
+ }
4701
+ }
4702
+ async initializeComponent() {
4703
+ if (this.state.ready) {
4697
4704
  return;
4698
4705
  }
4699
4706
  this.state.initializing = true;
@@ -4726,8 +4733,12 @@ if (atcbIsBrowser()) {
4726
4733
  this.state.initializing = false;
4727
4734
  this.state.initialized = true;
4728
4735
  this.state.ready = true;
4736
+ this._initializedResolver();
4729
4737
  return;
4730
4738
  }
4739
+ whenInitialized() {
4740
+ return this._initialized;
4741
+ }
4731
4742
  disconnectedCallback() {
4732
4743
  atcb_cleanup(this.shadowRoot, this.identifier);
4733
4744
  if (this.debug) {
@@ -4753,7 +4764,7 @@ if (atcbIsBrowser()) {
4753
4764
  .concat(observeAdditionally);
4754
4765
  }
4755
4766
  attributeChangedCallback(name, oldValue, newValue) {
4756
- if (this.state.initializing || !this.state.ready) {
4767
+ if (!this.state.ready) {
4757
4768
  return;
4758
4769
  }
4759
4770
  if (this.debug && this.state.initialized) {
@@ -6,14 +6,14 @@ import { tzlib_get_ical_block, tzlib_get_offset, tzlib_get_timezones } from 'tim
6
6
  * Add to Calendar Button
7
7
  * ++++++++++++++++++++++
8
8
  *
9
- * Version: 2.6.4
9
+ * Version: 2.6.5
10
10
  * Creator: Jens Kuerschner (https://jekuer.com)
11
11
  * Project: https://github.com/add2cal/add-to-calendar-button
12
12
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
13
13
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
14
14
  *
15
15
  */
16
- const atcbVersion = '2.6.4';
16
+ const atcbVersion = '2.6.5';
17
17
  const atcbCssTemplate = {
18
18
  if (typeof window === 'undefined') {
19
19
  return false;
@@ -3987,6 +3987,7 @@ if (atcbIsBrowser()) {
3987
3987
  class AddToCalendarButton extends HTMLElement {
3988
3988
  constructor() {
3989
3989
  super();
3990
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
3990
3991
  const elem = document.createElement('template');
3991
3992
  elem.innerHTML = template;
3992
3993
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -4000,8 +4001,14 @@ if (atcbIsBrowser()) {
4000
4001
  this.data = {};
4001
4002
  this.error = false;
4002
4003
  }
4003
- async connectedCallback() {
4004
- if (this.state.initializing || this.state.ready) {
4004
+ connectedCallback() {
4005
+ if (!this.initializing) {
4006
+ this.initializing = true;
4007
+ setTimeout(() => this.initializeComponent(), 0);
4008
+ }
4009
+ }
4010
+ async initializeComponent() {
4011
+ if (this.state.ready) {
4005
4012
  return;
4006
4013
  }
4007
4014
  this.state.initializing = true;
@@ -4034,8 +4041,12 @@ if (atcbIsBrowser()) {
4034
4041
  this.state.initializing = false;
4035
4042
  this.state.initialized = true;
4036
4043
  this.state.ready = true;
4044
+ this._initializedResolver();
4037
4045
  return;
4038
4046
  }
4047
+ whenInitialized() {
4048
+ return this._initialized;
4049
+ }
4039
4050
  disconnectedCallback() {
4040
4051
  atcb_cleanup(this.shadowRoot, this.identifier);
4041
4052
  if (this.debug) {
@@ -4061,7 +4072,7 @@ if (atcbIsBrowser()) {
4061
4072
  .concat(observeAdditionally);
4062
4073
  }
4063
4074
  attributeChangedCallback(name, oldValue, newValue) {
4064
- if (this.state.initializing || !this.state.ready) {
4075
+ if (!this.state.ready) {
4065
4076
  return;
4066
4077
  }
4067
4078
  if (this.debug && this.state.initialized) {
@@ -6,14 +6,14 @@ import { tzlib_get_ical_block, tzlib_get_offset, tzlib_get_timezones } from 'tim
6
6
  * Add to Calendar Button
7
7
  * ++++++++++++++++++++++
8
8
  *
9
- * Version: 2.6.4
9
+ * Version: 2.6.5
10
10
  * Creator: Jens Kuerschner (https://jekuer.com)
11
11
  * Project: https://github.com/add2cal/add-to-calendar-button
12
12
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
13
13
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
14
14
  *
15
15
  */
16
- const atcbVersion = '2.6.4';
16
+ const atcbVersion = '2.6.5';
17
17
  const atcbCssTemplate = {};
18
18
  const atcbIsBrowser = () => {
19
19
  if (typeof window === 'undefined') {
@@ -3988,6 +3988,7 @@ if (atcbIsBrowser()) {
3988
3988
  class AddToCalendarButton extends HTMLElement {
3989
3989
  constructor() {
3990
3990
  super();
3991
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
3991
3992
  const elem = document.createElement('template');
3992
3993
  elem.innerHTML = template;
3993
3994
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -4001,8 +4002,14 @@ if (atcbIsBrowser()) {
4001
4002
  this.data = {};
4002
4003
  this.error = false;
4003
4004
  }
4004
- async connectedCallback() {
4005
- if (this.state.initializing || this.state.ready) {
4005
+ connectedCallback() {
4006
+ if (!this.initializing) {
4007
+ this.initializing = true;
4008
+ setTimeout(() => this.initializeComponent(), 0);
4009
+ }
4010
+ }
4011
+ async initializeComponent() {
4012
+ if (this.state.ready) {
4006
4013
  return;
4007
4014
  }
4008
4015
  this.state.initializing = true;
@@ -4035,8 +4042,12 @@ if (atcbIsBrowser()) {
4035
4042
  this.state.initializing = false;
4036
4043
  this.state.initialized = true;
4037
4044
  this.state.ready = true;
4045
+ this._initializedResolver();
4038
4046
  return;
4039
4047
  }
4048
+ whenInitialized() {
4049
+ return this._initialized;
4050
+ }
4040
4051
  disconnectedCallback() {
4041
4052
  atcb_cleanup(this.shadowRoot, this.identifier);
4042
4053
  if (this.debug) {
@@ -4062,7 +4073,7 @@ if (atcbIsBrowser()) {
4062
4073
  .concat(observeAdditionally);
4063
4074
  }
4064
4075
  attributeChangedCallback(name, oldValue, newValue) {
4065
- if (this.state.initializing || !this.state.ready) {
4076
+ if (!this.state.ready) {
4066
4077
  return;
4067
4078
  }
4068
4079
  if (this.debug && this.state.initialized) {
@@ -6,14 +6,14 @@ import { tzlib_get_ical_block, tzlib_get_offset, tzlib_get_timezones } from 'tim
6
6
  * Add to Calendar Button
7
7
  * ++++++++++++++++++++++
8
8
  *
9
- * Version: 2.6.4
9
+ * Version: 2.6.5
10
10
  * Creator: Jens Kuerschner (https://jekuer.com)
11
11
  * Project: https://github.com/add2cal/add-to-calendar-button
12
12
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
13
13
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
14
14
  *
15
15
  */
16
- const atcbVersion = '2.6.4';
16
+ const atcbVersion = '2.6.5';
17
17
  const atcbCssTemplate = {};
18
18
  const atcbIsBrowser = () => {
19
19
  if (typeof window === 'undefined') {
@@ -4680,6 +4680,7 @@ if (atcbIsBrowser()) {
4680
4680
  class AddToCalendarButton extends HTMLElement {
4681
4681
  constructor() {
4682
4682
  super();
4683
+ this._initialized = new Promise((resolve) => (this._initializedResolver = resolve));
4683
4684
  const elem = document.createElement('template');
4684
4685
  elem.innerHTML = template;
4685
4686
  this.attachShadow({ mode: 'open', delegateFocus: true });
@@ -4693,8 +4694,14 @@ if (atcbIsBrowser()) {
4693
4694
  this.data = {};
4694
4695
  this.error = false;
4695
4696
  }
4696
- async connectedCallback() {
4697
- if (this.state.initializing || this.state.ready) {
4697
+ connectedCallback() {
4698
+ if (!this.initializing) {
4699
+ this.initializing = true;
4700
+ setTimeout(() => this.initializeComponent(), 0);
4701
+ }
4702
+ }
4703
+ async initializeComponent() {
4704
+ if (this.state.ready) {
4698
4705
  return;
4699
4706
  }
4700
4707
  this.state.initializing = true;
@@ -4727,8 +4734,12 @@ if (atcbIsBrowser()) {
4727
4734
  this.state.initializing = false;
4728
4735
  this.state.initialized = true;
4729
4736
  this.state.ready = true;
4737
+ this._initializedResolver();
4730
4738
  return;
4731
4739
  }
4740
+ whenInitialized() {
4741
+ return this._initialized;
4742
+ }
4732
4743
  disconnectedCallback() {
4733
4744
  atcb_cleanup(this.shadowRoot, this.identifier);
4734
4745
  if (this.debug) {
@@ -4754,7 +4765,7 @@ if (atcbIsBrowser()) {
4754
4765
  .concat(observeAdditionally);
4755
4766
  }
4756
4767
  attributeChangedCallback(name, oldValue, newValue) {
4757
- if (this.state.initializing || !this.state.ready) {
4768
+ if (!this.state.ready) {
4758
4769
  return;
4759
4770
  }
4760
4771
  if (this.debug && this.state.initialized) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "add-to-calendar-button",
3
- "version": "2.6.4",
3
+ "version": "2.6.5",
4
4
  "engines": {
5
5
  "node": ">=18.17.0",
6
6
  "npm": ">=9.6.7"
@@ -7,6 +7,7 @@ import '../../dist/module/index.js';
7
7
  describe('add-to-calendar-button renders', () => {
8
8
  it('has a generated button id and shadowDom element', async () => {
9
9
  const el = await fixture(html` <add-to-calendar-button name="test" options='Google' startDate="2050-02-14"></add-to-calendar-button> `);
10
+ await el.whenInitialized(); // Wait for initialization to complete
10
11
  expect(el.getAttribute('atcb-button-id')).to.exist;
11
12
  expect(el.getAttribute('atcb-button-id')).not.equal('');
12
13
  expect(el.shadowRoot.querySelector('.atcb-initialized')).to.exist;