@webtides/element-js 1.0.0-alpha.1 → 1.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9,9 +9,9 @@ var __publicField = (obj, key, value) => {
9
9
  function isObjectLike(value) {
10
10
  return typeof value == "object" && value !== null;
11
11
  }
12
- function isJSON(str) {
12
+ function isJSON(value) {
13
13
  try {
14
- return JSON.parse(str) && !!str;
14
+ return JSON.parse(value) && !!value;
15
15
  } catch (e) {
16
16
  return false;
17
17
  }
@@ -86,8 +86,22 @@ function getShadowParentOrBody(element) {
86
86
  }
87
87
  return document.body;
88
88
  }
89
- var supportsAdoptingStyleSheets = () => "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
90
- var supportsAppendingStyleSheets = !window.ShadyDOM;
89
+ function getAllElementChildren(domNode, instanceOfFilter = HTMLElement) {
90
+ const nodeIterator = document.createNodeIterator(
91
+ domNode,
92
+ NodeFilter.SHOW_ELEMENT,
93
+ (node) => node.nodeName.includes("-") && node instanceof instanceOfFilter ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
94
+ );
95
+ const customElements2 = [];
96
+ let currentNode;
97
+ while (currentNode = nodeIterator.nextNode()) {
98
+ customElements2.push(currentNode);
99
+ }
100
+ return customElements2;
101
+ }
102
+ var supportsAdoptingStyleSheets = () => {
103
+ return "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
104
+ };
91
105
  var convertStringToTemplate = (string) => {
92
106
  var _a;
93
107
  const template = (_a = globalThis.document) == null ? void 0 : _a.createElement("template");
@@ -95,16 +109,101 @@ var convertStringToTemplate = (string) => {
95
109
  return template.content;
96
110
  };
97
111
 
112
+ // src/util/SerializeStateHelper.js
113
+ var serializableObjectsCache = /* @__PURE__ */ new Map();
114
+ var globalElementJsState;
115
+ function initGlobalStateObject() {
116
+ if (!globalElementJsState) {
117
+ globalElementJsState = Array.from(globalThis.document.scripts).find((script) => script.type === "ejs/json");
118
+ if (!globalElementJsState) {
119
+ const script = document.createElement("script");
120
+ script.setAttribute("type", "ejs/json");
121
+ script.textContent = "{}";
122
+ document.body.appendChild(script);
123
+ globalElementJsState = script;
124
+ }
125
+ }
126
+ }
127
+ function serializeState(serializableObject) {
128
+ var _a;
129
+ if (!((_a = globalThis.elementJsConfig) == null ? void 0 : _a.serializeState))
130
+ return;
131
+ if (!serializableObject._serializationKey && !serializableObject.serializeState) {
132
+ throw new Error("serializableObject does not implement the Serializable interface");
133
+ }
134
+ initGlobalStateObject();
135
+ const currentState = JSON.parse(globalElementJsState.textContent);
136
+ currentState[serializableObject._serializationKey] = serializableObject.serializeState();
137
+ globalElementJsState.textContent = JSON.stringify(currentState, (key, value) => {
138
+ if (value instanceof Store) {
139
+ return "Store/" + value._serializationKey;
140
+ } else {
141
+ return value;
142
+ }
143
+ });
144
+ }
145
+ function deserializeState(serializableObject, serializedState) {
146
+ var _a;
147
+ if (!((_a = globalThis.elementJsConfig) == null ? void 0 : _a.serializeState))
148
+ return;
149
+ if (!serializableObject._serializationKey && !serializableObject.restoreState) {
150
+ throw new Error("serializableObject does not implement the Serializable interface");
151
+ }
152
+ if (serializedState) {
153
+ serializableObject.restoreState(serializedState);
154
+ return;
155
+ }
156
+ initGlobalStateObject();
157
+ const unresolvedState = JSON.parse(globalElementJsState.textContent);
158
+ const currentState = JSON.parse(globalElementJsState.textContent, (key, value) => {
159
+ if (typeof value === "string" && value.startsWith("Store/")) {
160
+ const [_, storeUuid] = value.split("/");
161
+ const serializedState2 = unresolvedState[storeUuid];
162
+ return new Store(serializedState2, { key: storeUuid, serializedState: serializedState2 });
163
+ } else {
164
+ return value;
165
+ }
166
+ });
167
+ serializableObject.restoreState(currentState[serializableObject._serializationKey]);
168
+ }
169
+ function hasSerializedState(key) {
170
+ var _a;
171
+ if (!((_a = globalThis.elementJsConfig) == null ? void 0 : _a.serializeState))
172
+ return false;
173
+ initGlobalStateObject();
174
+ const serializedState = JSON.parse(globalElementJsState.textContent);
175
+ return serializedState.hasOwnProperty(key);
176
+ }
177
+
98
178
  // src/util/Store.js
99
179
  var Store = class {
100
- constructor(value) {
101
- __publicField(this, "_observer", /* @__PURE__ */ new Set());
180
+ constructor(value, options) {
181
+ __publicField(this, "_serializationKey");
182
+ __publicField(this, "_observer", /* @__PURE__ */ new Set([]));
102
183
  __publicField(this, "_singlePropertyMode", false);
103
184
  __publicField(this, "_state", {});
185
+ if ((options == null ? void 0 : options.key) && serializableObjectsCache.has(options == null ? void 0 : options.key)) {
186
+ return serializableObjectsCache.get(options == null ? void 0 : options.key);
187
+ }
104
188
  this._singlePropertyMode = arguments.length > 0 && !isObjectLike(value);
189
+ if (options == null ? void 0 : options.key) {
190
+ this._serializationKey = options == null ? void 0 : options.key;
191
+ } else {
192
+ this._serializationKey = globalThis.crypto.randomUUID();
193
+ }
194
+ if (options == null ? void 0 : options.serializedState) {
195
+ deserializeState(this, options.serializedState);
196
+ } else if (hasSerializedState(this._serializationKey)) {
197
+ deserializeState(this);
198
+ }
105
199
  const specificValues = this._singlePropertyMode ? { value } : value;
106
- this._state = { ...!this._singlePropertyMode && this.properties(), ...specificValues };
107
- Object.entries(this._state).map(([key, value2]) => {
200
+ const properties = { ...!this._singlePropertyMode && this.properties(), ...specificValues };
201
+ const serializationKeys = Object.keys(this.serializeState());
202
+ Object.entries(properties).map(([key, value2]) => {
203
+ this._state[key] = hasSerializedState(this._serializationKey) && serializationKeys.includes(key) ? this[key] : value2;
204
+ if (value2 instanceof Store) {
205
+ value2.subscribe(this);
206
+ }
108
207
  Object.defineProperty(this, key, {
109
208
  get: () => {
110
209
  return this._state[key];
@@ -112,6 +211,10 @@ var Store = class {
112
211
  set: (newValue) => {
113
212
  const oldValue = this._state[key];
114
213
  this._state[key] = newValue;
214
+ if (value2 instanceof Store) {
215
+ value2.subscribe(this);
216
+ }
217
+ serializeState(this);
115
218
  if (!deepEquals(newValue, oldValue)) {
116
219
  const watch = this.watch();
117
220
  if (watch.hasOwnProperty(key) && typeof watch[key] === "function") {
@@ -122,6 +225,7 @@ var Store = class {
122
225
  }
123
226
  });
124
227
  });
228
+ serializableObjectsCache.set(this._serializationKey, this);
125
229
  }
126
230
  properties() {
127
231
  return {};
@@ -143,15 +247,21 @@ var Store = class {
143
247
  }
144
248
  requestUpdate() {
145
249
  this._observer.forEach(async (observer) => {
146
- var _a, _b;
147
- if (observer instanceof BaseElement) {
148
- await observer.requestUpdate();
149
- if (Object.keys((_a = observer.watch()) != null ? _a : {}).length > 0) {
150
- const properties = observer.properties();
151
- Object.keys((_b = observer.watch()) != null ? _b : {}).forEach((key) => {
250
+ var _a, _b, _c;
251
+ if (observer instanceof BaseElement || observer instanceof Store) {
252
+ if (((_a = observer == null ? void 0 : observer._options) == null ? void 0 : _a.autoUpdate) !== false) {
253
+ await observer.requestUpdate();
254
+ }
255
+ if (Object.keys((_b = observer.watch()) != null ? _b : {}).length > 0) {
256
+ Object.keys((_c = observer.watch()) != null ? _c : {}).forEach((key) => {
257
+ var _a2;
152
258
  if (observer._state[key] === this) {
153
- observer.callPropertyWatcher(key, this, this);
154
- observer.notifyPropertyChange(key, this);
259
+ if (observer instanceof Store) {
260
+ (_a2 = observer.watch) == null ? void 0 : _a2.call(observer)[key](this, this);
261
+ } else {
262
+ observer.callPropertyWatcher(key, this, this);
263
+ observer.notifyPropertyChange(key, this);
264
+ }
155
265
  }
156
266
  });
157
267
  }
@@ -162,6 +272,13 @@ var Store = class {
162
272
  }
163
273
  });
164
274
  }
275
+ serializeState() {
276
+ const keys = Object.keys(this.properties());
277
+ return Object.fromEntries(keys.map((key) => [key, this[key]]));
278
+ }
279
+ restoreState(serializedState) {
280
+ Object.assign(this, serializedState);
281
+ }
165
282
  };
166
283
 
167
284
  // src/util/defineElement.js
@@ -185,6 +302,7 @@ function toString(value) {
185
302
  var BaseElement = class extends HTMLElement {
186
303
  constructor(options = {}) {
187
304
  super();
305
+ __publicField(this, "_serializationKey");
188
306
  this.$refs = {};
189
307
  this._state = {};
190
308
  this._mutationObserver = null;
@@ -194,6 +312,7 @@ var BaseElement = class extends HTMLElement {
194
312
  this._options = {
195
313
  autoUpdate: true,
196
314
  deferUpdate: true,
315
+ deferConnected: false,
197
316
  mutationObserverOptions: {
198
317
  attributes: true,
199
318
  childList: true,
@@ -203,8 +322,28 @@ var BaseElement = class extends HTMLElement {
203
322
  propertyOptions: {},
204
323
  ...options
205
324
  };
325
+ if (this.hasAttribute("defer-update")) {
326
+ this._options.deferUpdate = true;
327
+ }
328
+ if (this.hasAttribute("defer-connected")) {
329
+ this._options.deferConnected = true;
330
+ }
206
331
  }
207
332
  connectedCallback() {
333
+ var _a;
334
+ if (this._options.deferConnected) {
335
+ this._options.deferConnected = false;
336
+ return;
337
+ }
338
+ if (this.hasAttribute("ejs:key")) {
339
+ this._serializationKey = this.getAttribute("ejs:key");
340
+ deserializeState(this);
341
+ } else {
342
+ this._serializationKey = globalThis.crypto.randomUUID();
343
+ if ((_a = globalThis.elementJsConfig) == null ? void 0 : _a.serializeState) {
344
+ this.setAttribute("ejs:key", this._serializationKey);
345
+ }
346
+ }
208
347
  this.defineAttributesAsProperties();
209
348
  this.defineProperties();
210
349
  this.definePropertyInjection();
@@ -308,10 +447,7 @@ var BaseElement = class extends HTMLElement {
308
447
  });
309
448
  }
310
449
  defineProperty(property, value, reflectAttribute = false) {
311
- var _a, _b;
312
- if (value instanceof Store) {
313
- value.subscribe(this);
314
- }
450
+ var _a, _b, _c;
315
451
  if (this._state.hasOwnProperty(property)) {
316
452
  return;
317
453
  }
@@ -321,7 +457,13 @@ var BaseElement = class extends HTMLElement {
321
457
  if (((_b = this._options.propertyOptions[property]) == null ? void 0 : _b.reflect) === false) {
322
458
  this.removeAttribute(camelToDash(property));
323
459
  }
460
+ if (hasSerializedState(this._serializationKey) && ((_c = Object.keys(this.serializeState())) == null ? void 0 : _c.includes(property))) {
461
+ value = this[property];
462
+ }
324
463
  this._state[property] = value;
464
+ if (this._state[property] instanceof Store) {
465
+ this._state[property].subscribe(this);
466
+ }
325
467
  Object.defineProperty(this, property, {
326
468
  get: () => {
327
469
  return this._state[property];
@@ -332,6 +474,7 @@ var BaseElement = class extends HTMLElement {
332
474
  const newValueString = JSON.stringify(newValue);
333
475
  if (JSON.stringify(oldValue) !== newValueString) {
334
476
  this._state[property] = newValue;
477
+ serializeState(this);
335
478
  if (newValue instanceof Store) {
336
479
  newValue.subscribe(this);
337
480
  }
@@ -393,16 +536,25 @@ var BaseElement = class extends HTMLElement {
393
536
  Object.entries(this.injectProperties()).forEach(([key, value]) => {
394
537
  this.requestContext(key, value);
395
538
  });
396
- if (Object.keys(this.provideProperties()).length > 0) {
539
+ const providedKeys = Object.keys(this.provideProperties());
540
+ if (providedKeys.length > 0) {
397
541
  this.addEventListener("request-context", this.onRequestContext);
542
+ getAllElementChildren(this.getRoot(), BaseElement).forEach((customChild) => {
543
+ var _a, _b;
544
+ const requestedProperties = (_b = (_a = customChild.injectProperties) == null ? void 0 : _a.call(customChild)) != null ? _b : {};
545
+ Object.entries(requestedProperties).forEach(([key, value]) => {
546
+ if (providedKeys.includes(key)) {
547
+ customChild.requestContext(key, value);
548
+ }
549
+ });
550
+ });
398
551
  }
399
552
  }
400
553
  requestContext(propertyName, valueOrCallback) {
401
- this.dispatch("request-context", { [propertyName]: valueOrCallback }, true);
554
+ this.dispatch("request-context", { [propertyName]: valueOrCallback }, true, true, true);
402
555
  }
403
556
  onRequestContext(event) {
404
557
  var _a;
405
- const properties = this.properties();
406
558
  const provideProperties = this.provideProperties();
407
559
  Object.entries((_a = event.detail) != null ? _a : {}).forEach(([key, valueOrCallback]) => {
408
560
  if (key in provideProperties) {
@@ -411,7 +563,9 @@ var BaseElement = class extends HTMLElement {
411
563
  if (typeof valueOrCallback === "function") {
412
564
  valueOrCallback(providedValue);
413
565
  } else {
414
- event.target[key] = providedValue;
566
+ const eventPath = event.composedPath();
567
+ const target = eventPath[0] || event.target;
568
+ target[key] = providedValue;
415
569
  }
416
570
  }
417
571
  });
@@ -492,44 +646,99 @@ var BaseElement = class extends HTMLElement {
492
646
  });
493
647
  this.$refs = refsMap;
494
648
  }
495
- dispatch(name, data, bubble = false, cancelable = false, composed = false) {
496
- const event = new CustomEvent(name, {
497
- bubbles: bubble,
498
- cancelable,
499
- composed,
500
- detail: data
501
- });
649
+ dispatch(name, data, options, cancelable = false, composed = false) {
650
+ let eventInit = {};
651
+ if (options !== void 0 && typeof options === "boolean") {
652
+ eventInit["bubbles"] = options;
653
+ eventInit["cancelable"] = cancelable;
654
+ eventInit["composed"] = composed;
655
+ eventInit["detail"] = data;
656
+ console.warn(
657
+ `[${this.localName}] Using the old parameter options for the event is deprecated and will be removed in v2.0! Please use the new options object that is in line with the "CustomEventInit" options`
658
+ );
659
+ } else {
660
+ eventInit = {
661
+ bubbles: true,
662
+ cancelable: true,
663
+ composed: true,
664
+ detail: data,
665
+ ...options
666
+ };
667
+ }
668
+ const event = new CustomEvent(name, eventInit);
502
669
  this.dispatchEvent(event);
503
670
  }
504
671
  getRoot() {
505
672
  return this;
506
673
  }
674
+ serializeState() {
675
+ const keys = Object.keys(this.properties());
676
+ return Object.fromEntries(keys.map((key) => [key, this[key]]));
677
+ }
678
+ restoreState(serializedState) {
679
+ Object.assign(this, serializedState);
680
+ }
507
681
  };
508
682
 
509
- // src/util/i18n.js
510
- function i18n(key, fallback) {
511
- try {
512
- const translations = window.elementjs.i18n();
513
- if (translations[key] === void 0) {
514
- throw "Translation Missing";
683
+ // src/util/GlobalStylesStore.js
684
+ var GlobalStylesStore = class extends Store {
685
+ constructor() {
686
+ var _a;
687
+ super();
688
+ __publicField(this, "globalStyleSheetsCache", /* @__PURE__ */ new WeakMap());
689
+ if ((_a = globalThis.elementJsConfig) == null ? void 0 : _a.observeGlobalStyles) {
690
+ const mutationObserver = new MutationObserver((mutationRecord) => {
691
+ if (!mutationRecord[0])
692
+ return;
693
+ const filteredNodes = Array.from(mutationRecord[0].addedNodes).filter(
694
+ (node) => node.tagName === "STYLE" || node.tagName === "LINK"
695
+ );
696
+ if (filteredNodes && filteredNodes[0] && filteredNodes[0].tagName === "LINK") {
697
+ filteredNodes[0].onload = () => {
698
+ this.requestUpdate();
699
+ };
700
+ } else if (filteredNodes && filteredNodes[0] && filteredNodes[0].tagName === "STYLE") {
701
+ this.requestUpdate();
702
+ }
703
+ });
704
+ mutationObserver.observe(globalThis.document, { subtree: true, childList: true });
515
705
  }
516
- return translations[key];
517
- } catch (err) {
518
- if (fallback)
519
- return fallback;
520
- else
521
- return key;
522
706
  }
523
- }
524
-
525
- // src/StyledElement.js
526
- var _StyledElement = class extends BaseElement {
527
- static updateGlobalStyles() {
528
- _StyledElement.globalStyles = document.getElementById("globalStyles");
529
- if (_StyledElement.globalStyles && _StyledElement["globalStyleSheet"]) {
530
- _StyledElement["globalStyleSheet"].replaceSync(_StyledElement.globalStyles.textContent);
707
+ getGlobalStyleSheets(selector) {
708
+ var _a, _b;
709
+ const cssStyleSheets = [];
710
+ if (selector === false)
711
+ return cssStyleSheets;
712
+ if (typeof selector === "string") {
713
+ selector = [selector];
531
714
  }
715
+ if (selector === true || selector.includes("document")) {
716
+ cssStyleSheets.push(...(_a = globalThis.document) == null ? void 0 : _a.adoptedStyleSheets);
717
+ }
718
+ Array.from((_b = globalThis.document) == null ? void 0 : _b.styleSheets).map((styleSheet) => {
719
+ if (Array.isArray(selector) && !selector.some((cssSelector) => styleSheet.ownerNode.matches(cssSelector))) {
720
+ return;
721
+ }
722
+ let cssStyleSheet = this.globalStyleSheetsCache.get(styleSheet.ownerNode);
723
+ if (!cssStyleSheet) {
724
+ cssStyleSheet = new CSSStyleSheet();
725
+ let cssText = "";
726
+ if (styleSheet.ownerNode.tagName === "STYLE") {
727
+ cssText = styleSheet.ownerNode.textContent;
728
+ } else if (styleSheet.ownerNode.tagName === "LINK") {
729
+ cssText = Array.from(styleSheet.cssRules).map((rule) => rule.cssText).join("");
730
+ }
731
+ cssStyleSheet.replaceSync(cssText);
732
+ }
733
+ cssStyleSheets.push(cssStyleSheet);
734
+ });
735
+ return cssStyleSheets;
532
736
  }
737
+ };
738
+ var globalStylesStore = new GlobalStylesStore();
739
+
740
+ // src/StyledElement.js
741
+ var StyledElement = class extends BaseElement {
533
742
  constructor(options) {
534
743
  super({
535
744
  deferUpdate: false,
@@ -542,60 +751,58 @@ var _StyledElement = class extends BaseElement {
542
751
  }
543
752
  connectedCallback() {
544
753
  super.connectedCallback();
754
+ if (!this.constructor["elementStyleSheets"]) {
755
+ this.constructor["elementStyleSheets"] = this._styles.map((style) => {
756
+ const cssStyleSheet = new CSSStyleSheet();
757
+ cssStyleSheet.replaceSync(style);
758
+ return cssStyleSheet;
759
+ });
760
+ }
545
761
  if (supportsAdoptingStyleSheets() && this._options.shadowRender) {
546
762
  this.adoptStyleSheets();
763
+ if (this._options.adoptGlobalStyles !== false) {
764
+ globalStylesStore.subscribe(() => {
765
+ this.adoptStyleSheets();
766
+ });
767
+ }
547
768
  }
548
769
  }
549
770
  styles() {
550
771
  return [];
551
772
  }
552
773
  update(options) {
553
- var _a, _b;
554
774
  if (!supportsAdoptingStyleSheets() || this._options.shadowRender === false) {
555
- const appendableStyles = [...this._styles];
556
- if (this._options.shadowRender && this._options.adoptGlobalStyles) {
557
- appendableStyles.unshift((_b = (_a = _StyledElement.globalStyles) == null ? void 0 : _a.textContent) != null ? _b : "");
558
- }
559
- this.appendStyleSheets(appendableStyles);
775
+ this.appendStyleSheets();
560
776
  }
561
777
  super.update(options);
562
778
  }
563
779
  adoptStyleSheets() {
564
- if (!this.constructor["cssStyleSheets"]) {
565
- this.constructor["cssStyleSheets"] = this._styles.map((style) => {
566
- const sheet = new CSSStyleSheet();
567
- if (sheet && sheet.cssRules.length === 0) {
568
- sheet.replaceSync(style);
569
- }
570
- return sheet;
571
- });
572
- }
573
- if (_StyledElement.globalStyles && !_StyledElement["globalStyleSheet"]) {
574
- _StyledElement["globalStyleSheet"] = new CSSStyleSheet();
575
- _StyledElement["globalStyleSheet"].replaceSync(_StyledElement.globalStyles.textContent);
576
- }
780
+ const adoptGlobalStyleSheets = this._options.shadowRender && this._options.adoptGlobalStyles !== false;
577
781
  this.getRoot().adoptedStyleSheets = [
578
- ...this._options.shadowRender && this._options.adoptGlobalStyles && _StyledElement["globalStyleSheet"] ? [_StyledElement["globalStyleSheet"]] : [],
579
- ...this.constructor["cssStyleSheets"]
782
+ ...adoptGlobalStyleSheets ? globalStylesStore.getGlobalStyleSheets(this._options.adoptGlobalStyles) : [],
783
+ ...this.constructor["elementStyleSheets"]
580
784
  ];
581
785
  }
582
- appendStyleSheets(styles) {
786
+ appendStyleSheets() {
583
787
  const parentDocument = getShadowParentOrBody(this.getRoot());
584
- styles.forEach((style, index) => {
788
+ const adoptGlobalStyleSheets = this._options.shadowRender && this._options.adoptGlobalStyles !== false && parentDocument !== document.body;
789
+ const appendableStyles = [
790
+ ...adoptGlobalStyleSheets ? globalStylesStore.getGlobalStyleSheets(this._options.adoptGlobalStyles) : [],
791
+ ...this.constructor["elementStyleSheets"]
792
+ ];
793
+ appendableStyles.forEach((styleSheet, index) => {
794
+ var _a;
585
795
  const identifier = this.tagName + index;
586
796
  if (!parentDocument.querySelector(`#${identifier}`)) {
587
- const styleElement = document.createElement("style");
797
+ const styleElement = (_a = globalThis.document) == null ? void 0 : _a.createElement("style");
588
798
  styleElement.id = identifier;
589
799
  styleElement.style.display = "none";
590
- styleElement.textContent = style;
800
+ styleElement.textContent = Array.from(styleSheet.cssRules).map((rule) => rule.cssText).join("");
591
801
  parentDocument.appendChild(styleElement);
592
802
  }
593
803
  });
594
804
  }
595
805
  };
596
- var StyledElement = _StyledElement;
597
- __publicField(StyledElement, "globalStyles", null);
598
- StyledElement.updateGlobalStyles();
599
806
 
600
807
  // src/dom-parts/Part.js
601
808
  var Part = class {
@@ -1184,6 +1391,8 @@ var TemplateResult = class {
1184
1391
  parts.push((value) => {
1185
1392
  let result = pre;
1186
1393
  if (isObjectLike(value) && value.directiveClass) {
1394
+ const directive = new value.directiveClass();
1395
+ result += directive.stringify(...value.values);
1187
1396
  } else if (value != null) {
1188
1397
  result += encodeAttribute(isObjectLike(value) ? JSON.stringify(value) : value);
1189
1398
  }
@@ -1317,14 +1526,27 @@ var TemplateElement = class extends StyledElement {
1317
1526
  return this.shadowRoot !== null ? this.shadowRoot : this;
1318
1527
  }
1319
1528
  };
1529
+
1530
+ // src/util/Directive.js
1531
+ var Directive = class {
1532
+ constructor(node) {
1533
+ __publicField(this, "node");
1534
+ this.node = node;
1535
+ }
1536
+ update() {
1537
+ }
1538
+ stringify(...values) {
1539
+ return "";
1540
+ }
1541
+ };
1320
1542
  export {
1321
1543
  BaseElement,
1544
+ Directive,
1322
1545
  Store,
1323
1546
  StyledElement,
1324
1547
  TemplateElement,
1325
1548
  defineElement,
1326
1549
  html,
1327
- i18n,
1328
1550
  toString
1329
1551
  };
1330
1552
  //# sourceMappingURL=index.js.map