pushfeedback 0.0.1 → 0.0.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.
@@ -2,14 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ecaab1ef.js');
5
+ const index = require('./index-df770657.js');
6
6
 
7
- const feedbackButtonCss = ".feedback-button-content{cursor:pointer;background-color:var(--feedback-button-bg-color);border:1px solid var(--feedback-button-border-color);border-radius:var(--feedback-button-border-radius);color:var(--feedback-button-text-color);cursor:pointer;font-size:var(--feedback-modal-button-font-size);padding:5px 10px}.feedback-button-content:hover{color:var(--feedback-button-text-color-active);background-color:var(--feedback-button-bg-color-active);border:1px solid var(--feedback-button-border-color-active)}";
7
+ const feedbackButtonCss = ".feedback-button-content{cursor:pointer}.feedback-button-content--light{background-color:var(--feedback-button-bg-color);border:1px solid var(--feedback-button-border-color);border-radius:var(--feedback-button-border-radius);color:var(--feedback-button-text-color);padding:5px 10px;font-size:var(--feedback-modal-button-font-size)}.feedback-button-content--light:hover{color:var(--feedback-button-text-color-active);background-color:var(--feedback-button-bg-color-active);border:1px solid var(--feedback-button-border-color-active)}";
8
8
 
9
9
  const FeedbackButton = class {
10
10
  constructor(hostRef) {
11
11
  index.registerInstance(this, hostRef);
12
- this.feedbackModal = undefined;
13
12
  this.modalTitle = 'Share your feedback';
14
13
  this.successModalTitle = 'Thanks for your feedback!';
15
14
  this.errorModalTitle = "Oops! We didn't receive your feedback. Please try again later.";
@@ -21,15 +20,11 @@ const FeedbackButton = class {
21
20
  this.email = '';
22
21
  this.emailPlaceholder = 'Email address (optional)';
23
22
  this.messagePlaceholder = 'How could this page be more helpful?';
23
+ this.buttonStyle = 'default';
24
24
  }
25
- componentDidLoad() {
26
- this.feedbackModal.showModal = false;
27
- }
28
- showModal() {
29
- this.feedbackModal.showModal = true;
30
- }
31
- render() {
32
- const propKeys = [
25
+ connectedCallback() {
26
+ this.feedbackModal = document.createElement('feedback-modal');
27
+ const props = [
33
28
  'modalTitle',
34
29
  'successModalTitle',
35
30
  'errorModalTitle',
@@ -41,13 +36,20 @@ const FeedbackButton = class {
41
36
  'email',
42
37
  'emailPlaceholder',
43
38
  'messagePlaceholder',
44
- 'showModal',
45
39
  ];
46
- let feedbackModalProps = {};
47
- propKeys.forEach((key) => {
48
- feedbackModalProps[key] = this[key];
40
+ props.forEach(prop => {
41
+ this.feedbackModal[prop] = this[prop];
49
42
  });
50
- return (index.h(index.Host, null, index.h("a", { class: "feedback-button-content", onClick: () => this.showModal() }, index.h("slot", null)), index.h("feedback-modal", Object.assign({}, feedbackModalProps, { ref: (el) => this.feedbackModal = el }))));
43
+ document.body.appendChild(this.feedbackModal);
44
+ }
45
+ disconnectedCallback() {
46
+ document.body.removeChild(this.feedbackModal);
47
+ }
48
+ showModal() {
49
+ this.feedbackModal.showModal = true;
50
+ }
51
+ render() {
52
+ return (index.h(index.Host, null, index.h("a", { class: `feedback-button-content feedback-button-content--${this.buttonStyle}`, onClick: () => this.showModal() }, index.h("slot", null))));
51
53
  }
52
54
  };
53
55
  FeedbackButton.style = feedbackButtonCss;
@@ -49,7 +49,6 @@ const uniqueTime = (key, measureText) => {
49
49
  }
50
50
  };
51
51
  const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
52
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
53
52
  /**
54
53
  * Default style mode id
55
54
  */
@@ -69,6 +68,18 @@ const isComplexType = (o) => {
69
68
  o = typeof o;
70
69
  return o === 'object' || o === 'function';
71
70
  };
71
+ /**
72
+ * Helper method for querying a `meta` tag that contains a nonce value
73
+ * out of a DOM's head.
74
+ *
75
+ * @param doc The DOM containing the `head` to query against
76
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
77
+ * exists or the tag has no content.
78
+ */
79
+ function queryNonceMetaTagContent(doc) {
80
+ var _a, _b, _c;
81
+ return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
82
+ }
72
83
  /**
73
84
  * Production h() function based on Preact by
74
85
  * Jason Miller (@developit)
@@ -77,12 +88,10 @@ const isComplexType = (o) => {
77
88
  *
78
89
  * Modified for Stencil's compiler and vdom
79
90
  */
80
- // const stack: any[] = [];
81
91
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
82
92
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
83
93
  const h = (nodeName, vnodeData, ...children) => {
84
94
  let child = null;
85
- let key = null;
86
95
  let simple = false;
87
96
  let lastSimple = false;
88
97
  const vNodeChildren = [];
@@ -110,10 +119,6 @@ const h = (nodeName, vnodeData, ...children) => {
110
119
  };
111
120
  walk(children);
112
121
  if (vnodeData) {
113
- // normalize class / classname attributes
114
- if (vnodeData.key) {
115
- key = vnodeData.key;
116
- }
117
122
  {
118
123
  const classData = vnodeData.className || vnodeData.class;
119
124
  if (classData) {
@@ -131,11 +136,16 @@ const h = (nodeName, vnodeData, ...children) => {
131
136
  if (vNodeChildren.length > 0) {
132
137
  vnode.$children$ = vNodeChildren;
133
138
  }
134
- {
135
- vnode.$key$ = key;
136
- }
137
139
  return vnode;
138
140
  };
141
+ /**
142
+ * A utility function for creating a virtual DOM node from a tag and some
143
+ * possible text content.
144
+ *
145
+ * @param tag the tag for this element
146
+ * @param text possible text content for the node
147
+ * @returns a newly-minted virtual DOM node
148
+ */
139
149
  const newVNode = (tag, text) => {
140
150
  const vnode = {
141
151
  $flags$: 0,
@@ -147,12 +157,15 @@ const newVNode = (tag, text) => {
147
157
  {
148
158
  vnode.$attrs$ = null;
149
159
  }
150
- {
151
- vnode.$key$ = null;
152
- }
153
160
  return vnode;
154
161
  };
155
162
  const Host = {};
163
+ /**
164
+ * Check whether a given node is a Host node or not
165
+ *
166
+ * @param node the virtual DOM node to check
167
+ * @returns whether it's a Host node or not
168
+ */
156
169
  const isHost = (node) => node && node.$tag$ === Host;
157
170
  /**
158
171
  * Parse a new property value for a given property type.
@@ -227,6 +240,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
227
240
  styles.set(scopeId, style);
228
241
  };
229
242
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
243
+ var _a;
230
244
  let scopeId = getScopeId(cmpMeta);
231
245
  const style = styles.get(scopeId);
232
246
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -246,6 +260,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
246
260
  styleElm = doc.createElement('style');
247
261
  styleElm.innerHTML = style;
248
262
  }
263
+ // Apply CSP nonce to the style tag if it exists
264
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
265
+ if (nonce != null) {
266
+ styleElm.setAttribute('nonce', nonce);
267
+ }
249
268
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
250
269
  }
251
270
  if (appliedStyles) {
@@ -298,33 +317,6 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
298
317
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
299
318
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
300
319
  }
301
- else if (memberName === 'style') {
302
- // update style attribute, css properties and values
303
- {
304
- for (const prop in oldValue) {
305
- if (!newValue || newValue[prop] == null) {
306
- if (prop.includes('-')) {
307
- elm.style.removeProperty(prop);
308
- }
309
- else {
310
- elm.style[prop] = '';
311
- }
312
- }
313
- }
314
- }
315
- for (const prop in newValue) {
316
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
317
- if (prop.includes('-')) {
318
- elm.style.setProperty(prop, newValue[prop]);
319
- }
320
- else {
321
- elm.style[prop] = newValue[prop];
322
- }
323
- }
324
- }
325
- }
326
- else if (memberName === 'key')
327
- ;
328
320
  else if (memberName === 'ref') {
329
321
  // minifier will clean this up
330
322
  if (newValue) {
@@ -391,36 +383,16 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
391
383
  }
392
384
  catch (e) { }
393
385
  }
394
- /**
395
- * Need to manually update attribute if:
396
- * - memberName is not an attribute
397
- * - if we are rendering the host element in order to reflect attribute
398
- * - if it's a SVG, since properties might not work in <svg>
399
- * - if the newValue is null/undefined or 'false'.
400
- */
401
- let xlink = false;
402
- {
403
- if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
404
- memberName = ln;
405
- xlink = true;
406
- }
407
- }
408
386
  if (newValue == null || newValue === false) {
409
387
  if (newValue !== false || elm.getAttribute(memberName) === '') {
410
- if (xlink) {
411
- elm.removeAttributeNS(XLINK_NS, memberName);
412
- }
413
- else {
388
+ {
414
389
  elm.removeAttribute(memberName);
415
390
  }
416
391
  }
417
392
  }
418
393
  else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
419
394
  newValue = newValue === true ? '' : newValue;
420
- if (xlink) {
421
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
422
- }
423
- else {
395
+ {
424
396
  elm.setAttribute(memberName, newValue);
425
397
  }
426
398
  }
@@ -514,6 +486,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
514
486
  }
515
487
  return elm;
516
488
  };
489
+ /**
490
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
491
+ * add them to the DOM in the appropriate place.
492
+ *
493
+ * @param parentElm the DOM node which should be used as a parent for the new
494
+ * DOM nodes
495
+ * @param before a child of the `parentElm` which the new children should be
496
+ * inserted before (optional)
497
+ * @param parentVNode the parent virtual DOM node
498
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
499
+ * @param startIdx the index in the child virtual DOM nodes at which to start
500
+ * creating DOM nodes (inclusive)
501
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
502
+ * creating DOM nodes (inclusive)
503
+ */
517
504
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
518
505
  let containerElm = (parentElm);
519
506
  let childNode;
@@ -530,6 +517,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
530
517
  }
531
518
  }
532
519
  };
520
+ /**
521
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
522
+ * This can be used to, for instance, clean up after a list of children which
523
+ * should no longer be shown.
524
+ *
525
+ * This function also handles some of Stencil's slot relocation logic.
526
+ *
527
+ * @param vnodes a list of virtual DOM nodes to remove
528
+ * @param startIdx the index at which to start removing nodes (inclusive)
529
+ * @param endIdx the index at which to stop removing nodes (inclusive)
530
+ * @param vnode a VNode
531
+ * @param elm an element
532
+ */
533
533
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
534
534
  for (; startIdx <= endIdx; ++startIdx) {
535
535
  if ((vnode = vnodes[startIdx])) {
@@ -611,8 +611,6 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
611
611
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
612
612
  let oldStartIdx = 0;
613
613
  let newStartIdx = 0;
614
- let idxInOld = 0;
615
- let i = 0;
616
614
  let oldEndIdx = oldCh.length - 1;
617
615
  let oldStartVnode = oldCh[0];
618
616
  let oldEndVnode = oldCh[oldEndIdx];
@@ -620,7 +618,6 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
620
618
  let newStartVnode = newCh[0];
621
619
  let newEndVnode = newCh[newEndIdx];
622
620
  let node;
623
- let elmToMove;
624
621
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
625
622
  if (oldStartVnode == null) {
626
623
  // VNode might have been moved left
@@ -687,41 +684,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
687
684
  newStartVnode = newCh[++newStartIdx];
688
685
  }
689
686
  else {
690
- // Here we do some checks to match up old and new nodes based on the
691
- // `$key$` attribute, which is set by putting a `key="my-key"` attribute
692
- // in the JSX for a DOM element in the implementation of a Stencil
693
- // component.
694
- //
695
- // First we check to see if there are any nodes in the array of old
696
- // children which have the same key as the first node in the new
697
- // children.
698
- idxInOld = -1;
699
687
  {
700
- for (i = oldStartIdx; i <= oldEndIdx; ++i) {
701
- if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
702
- idxInOld = i;
703
- break;
704
- }
705
- }
706
- }
707
- if (idxInOld >= 0) {
708
- // We found a node in the old children which matches up with the first
709
- // node in the new children! So let's deal with that
710
- elmToMove = oldCh[idxInOld];
711
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
712
- // the tag doesn't match so we'll need a new DOM element
713
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
714
- }
715
- else {
716
- patch(elmToMove, newStartVnode);
717
- // invalidate the matching old node so that we won't try to update it
718
- // again later on
719
- oldCh[idxInOld] = undefined;
720
- node = elmToMove.$elm$;
721
- }
722
- newStartVnode = newCh[++newStartIdx];
723
- }
724
- else {
725
688
  // We either didn't find an element in the old children that matches
726
689
  // the key of the first new child OR the build is not using `key`
727
690
  // attributes at all. In either case we need to create a new element
@@ -759,7 +722,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
759
722
  *
760
723
  * So, in other words, if `key` attrs are not set on VNodes which may be
761
724
  * changing order within a `children` array or something along those lines then
762
- * we could obtain a false positive and then have to do needless re-rendering.
725
+ * we could obtain a false negative and then have to do needless re-rendering
726
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
763
727
  *
764
728
  * @param leftVNode the first VNode to check
765
729
  * @param rightVNode the second VNode to check
@@ -769,10 +733,7 @@ const isSameVnode = (leftVNode, rightVNode) => {
769
733
  // compare if two vnode to see if they're "technically" the same
770
734
  // need to have the same element tag, and same key to be the same
771
735
  if (leftVNode.$tag$ === rightVNode.$tag$) {
772
- // this will be set if components in the build have `key` attrs set on them
773
- {
774
- return leftVNode.$key$ === rightVNode.$key$;
775
- }
736
+ return true;
776
737
  }
777
738
  return false;
778
739
  };
@@ -840,6 +801,18 @@ const callNodeRefs = (vNode) => {
840
801
  vNode.$children$ && vNode.$children$.map(callNodeRefs);
841
802
  }
842
803
  };
804
+ /**
805
+ * The main entry point for Stencil's virtual DOM-based rendering engine
806
+ *
807
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
808
+ * function will handle creating a virtual DOM tree with a single root, patching
809
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
810
+ * relocation, and reflecting attributes.
811
+ *
812
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
813
+ * the DOM node into which it should be rendered.
814
+ * @param renderFnResults the virtual DOM nodes to be rendered
815
+ */
843
816
  const renderVdom = (hostRef, renderFnResults) => {
844
817
  const hostElm = hostRef.$hostElement$;
845
818
  const cmpMeta = hostRef.$cmpMeta$;
@@ -956,7 +929,6 @@ const postUpdateComponent = (hostRef) => {
956
929
  const tagName = hostRef.$cmpMeta$.$tagName$;
957
930
  const elm = hostRef.$hostElement$;
958
931
  const endPostUpdate = createTime('postUpdate', tagName);
959
- const instance = hostRef.$lazyInstance$ ;
960
932
  const ancestorComponent = hostRef.$ancestorComponent$;
961
933
  if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
962
934
  hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
@@ -964,9 +936,6 @@ const postUpdateComponent = (hostRef) => {
964
936
  // DOM WRITE!
965
937
  addHydratedFlag(elm);
966
938
  }
967
- {
968
- safeCall(instance, 'componentDidLoad');
969
- }
970
939
  endPostUpdate();
971
940
  {
972
941
  hostRef.$onReadyResolve$(elm);
@@ -1187,6 +1156,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1187
1156
  hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1188
1157
  }
1189
1158
  endNewInstance();
1159
+ fireConnectedCallback(hostRef.$lazyInstance$);
1190
1160
  }
1191
1161
  if (Cstr.style) {
1192
1162
  // this component has styles but we haven't registered them yet
@@ -1215,6 +1185,11 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1215
1185
  schedule();
1216
1186
  }
1217
1187
  };
1188
+ const fireConnectedCallback = (instance) => {
1189
+ {
1190
+ safeCall(instance, 'connectedCallback');
1191
+ }
1192
+ };
1218
1193
  const connectedCallback = (elm) => {
1219
1194
  if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1220
1195
  const hostRef = getHostRef(elm);
@@ -1253,15 +1228,24 @@ const connectedCallback = (elm) => {
1253
1228
  initializeComponent(elm, hostRef, cmpMeta);
1254
1229
  }
1255
1230
  }
1231
+ else {
1232
+ // fire off connectedCallback() on component instance
1233
+ fireConnectedCallback(hostRef.$lazyInstance$);
1234
+ }
1256
1235
  endConnected();
1257
1236
  }
1258
1237
  };
1259
1238
  const disconnectedCallback = (elm) => {
1260
1239
  if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1261
- getHostRef(elm);
1240
+ const hostRef = getHostRef(elm);
1241
+ const instance = hostRef.$lazyInstance$ ;
1242
+ {
1243
+ safeCall(instance, 'disconnectedCallback');
1244
+ }
1262
1245
  }
1263
1246
  };
1264
1247
  const bootstrapLazy = (lazyBundles, options = {}) => {
1248
+ var _a;
1265
1249
  const endBootstrap = createTime();
1266
1250
  const cmpTags = [];
1267
1251
  const exclude = options.exclude || [];
@@ -1338,6 +1322,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1338
1322
  {
1339
1323
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1340
1324
  visibilityStyle.setAttribute('data-styles', '');
1325
+ // Apply CSP nonce to the style tag if it exists
1326
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1327
+ if (nonce != null) {
1328
+ visibilityStyle.setAttribute('nonce', nonce);
1329
+ }
1341
1330
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1342
1331
  }
1343
1332
  // Process deferred connectedCallbacks now all components have been registered
@@ -1353,6 +1342,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1353
1342
  // Fallback appLoad event
1354
1343
  endBootstrap();
1355
1344
  };
1345
+ /**
1346
+ * Assigns the given value to the nonce property on the runtime platform object.
1347
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1348
+ * @param nonce The value to be assigned to the platform nonce property.
1349
+ * @returns void
1350
+ */
1351
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1356
1352
  const hostRefs = /*@__PURE__*/ new WeakMap();
1357
1353
  const getHostRef = (ref) => hostRefs.get(ref);
1358
1354
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1464,3 +1460,4 @@ exports.bootstrapLazy = bootstrapLazy;
1464
1460
  exports.h = h;
1465
1461
  exports.promiseResolve = promiseResolve;
1466
1462
  exports.registerInstance = registerInstance;
1463
+ exports.setNonce = setNonce;
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ecaab1ef.js');
5
+ const index = require('./index-df770657.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Esm v2.20.0 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Esm v2.22.3 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchEsm = () => {
11
11
  return index.promiseResolve();
@@ -14,8 +14,9 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["feedback-button_2.cjs",[[1,"feedback-button",{"modalTitle":[1,"modal-title"],"successModalTitle":[1,"success-modal-title"],"errorModalTitle":[1,"error-modal-title"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"project":[1],"screenshotButtonTooltipText":[1,"screenshot-button-tooltip-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"email":[1],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"feedbackModal":[32]}],[1,"feedback-modal",{"modalTitle":[1,"modal-title"],"successModalTitle":[1,"success-modal-title"],"errorModalTitle":[1,"error-modal-title"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"project":[1],"screenshotButtonTooltipText":[1,"screenshot-button-tooltip-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"email":[1],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"showModal":[1540,"show-modal"],"showScreenshotMode":[1540,"show-screenshot-mode"],"hasSelectedElement":[1540,"has-selected-element"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formError":[32],"encodedScreenshot":[32]}]]]], options);
17
+ return index.bootstrapLazy([["feedback-button_2.cjs",[[1,"feedback-button",{"modalTitle":[1,"modal-title"],"successModalTitle":[1,"success-modal-title"],"errorModalTitle":[1,"error-modal-title"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"project":[1],"screenshotButtonTooltipText":[1,"screenshot-button-tooltip-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"email":[1],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"buttonStyle":[1,"button-style"]}],[1,"feedback-modal",{"modalTitle":[1,"modal-title"],"successModalTitle":[1,"success-modal-title"],"errorModalTitle":[1,"error-modal-title"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"project":[1],"screenshotButtonTooltipText":[1,"screenshot-button-tooltip-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"email":[1],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"showModal":[1540,"show-modal"],"showScreenshotMode":[1540,"show-screenshot-mode"],"hasSelectedElement":[1540,"has-selected-element"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formError":[32],"encodedScreenshot":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
21
+ exports.setNonce = index.setNonce;
21
22
  exports.defineCustomElements = defineCustomElements;
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-ecaab1ef.js');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-df770657.js');
4
6
 
5
7
  /*
6
- Stencil Client Patch Browser v2.20.0 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Browser v2.22.3 | MIT Licensed | https://stenciljs.com
7
9
  */
8
10
  const patchBrowser = () => {
9
11
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('pushfeedback.cjs.js', document.baseURI).href));
@@ -15,5 +17,7 @@ const patchBrowser = () => {
15
17
  };
16
18
 
17
19
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["feedback-button_2.cjs",[[1,"feedback-button",{"modalTitle":[1,"modal-title"],"successModalTitle":[1,"success-modal-title"],"errorModalTitle":[1,"error-modal-title"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"project":[1],"screenshotButtonTooltipText":[1,"screenshot-button-tooltip-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"email":[1],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"feedbackModal":[32]}],[1,"feedback-modal",{"modalTitle":[1,"modal-title"],"successModalTitle":[1,"success-modal-title"],"errorModalTitle":[1,"error-modal-title"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"project":[1],"screenshotButtonTooltipText":[1,"screenshot-button-tooltip-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"email":[1],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"showModal":[1540,"show-modal"],"showScreenshotMode":[1540,"show-screenshot-mode"],"hasSelectedElement":[1540,"has-selected-element"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formError":[32],"encodedScreenshot":[32]}]]]], options);
20
+ return index.bootstrapLazy([["feedback-button_2.cjs",[[1,"feedback-button",{"modalTitle":[1,"modal-title"],"successModalTitle":[1,"success-modal-title"],"errorModalTitle":[1,"error-modal-title"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"project":[1],"screenshotButtonTooltipText":[1,"screenshot-button-tooltip-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"email":[1],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"buttonStyle":[1,"button-style"]}],[1,"feedback-modal",{"modalTitle":[1,"modal-title"],"successModalTitle":[1,"success-modal-title"],"errorModalTitle":[1,"error-modal-title"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"project":[1],"screenshotButtonTooltipText":[1,"screenshot-button-tooltip-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"email":[1],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"showModal":[1540,"show-modal"],"showScreenshotMode":[1540,"show-screenshot-mode"],"hasSelectedElement":[1540,"has-selected-element"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formError":[32],"encodedScreenshot":[32]}]]]], options);
19
21
  });
22
+
23
+ exports.setNonce = index.setNonce;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "entries": [
3
- "./components/feedback-modal/feedback-modal.js",
4
- "./components/feedback-button/feedback-button.js"
3
+ "./components/feedback-button/feedback-button.js",
4
+ "./components/feedback-modal/feedback-modal.js"
5
5
  ],
6
6
  "compiler": {
7
7
  "name": "@stencil/core",
8
- "version": "2.20.0",
9
- "typescriptVersion": "4.8.4"
8
+ "version": "2.22.3",
9
+ "typescriptVersion": "4.9.4"
10
10
  },
11
11
  "collections": [],
12
12
  "bundles": []
@@ -1,15 +1,17 @@
1
1
  .feedback-button-content {
2
2
  cursor: pointer;
3
+ }
4
+
5
+ .feedback-button-content--light{
3
6
  background-color: var(--feedback-button-bg-color);
4
7
  border: 1px solid var(--feedback-button-border-color);
5
8
  border-radius: var(--feedback-button-border-radius);
6
9
  color: var(--feedback-button-text-color);
7
- cursor: pointer;
8
- font-size: var(--feedback-modal-button-font-size);
9
10
  padding: 5px 10px;
11
+ font-size: var(--feedback-modal-button-font-size);
10
12
  }
11
13
 
12
- .feedback-button-content:hover {
14
+ .feedback-button-content--light:hover {
13
15
  color: var(--feedback-button-text-color-active);
14
16
  background-color: var(--feedback-button-bg-color-active);
15
17
  border: 1px solid var(--feedback-button-border-color-active);
@@ -1,7 +1,6 @@
1
1
  import { Host, h } from '@stencil/core';
2
2
  export class FeedbackButton {
3
3
  constructor() {
4
- this.feedbackModal = undefined;
5
4
  this.modalTitle = 'Share your feedback';
6
5
  this.successModalTitle = 'Thanks for your feedback!';
7
6
  this.errorModalTitle = "Oops! We didn't receive your feedback. Please try again later.";
@@ -13,15 +12,11 @@ export class FeedbackButton {
13
12
  this.email = '';
14
13
  this.emailPlaceholder = 'Email address (optional)';
15
14
  this.messagePlaceholder = 'How could this page be more helpful?';
15
+ this.buttonStyle = 'default';
16
16
  }
17
- componentDidLoad() {
18
- this.feedbackModal.showModal = false;
19
- }
20
- showModal() {
21
- this.feedbackModal.showModal = true;
22
- }
23
- render() {
24
- const propKeys = [
17
+ connectedCallback() {
18
+ this.feedbackModal = document.createElement('feedback-modal');
19
+ const props = [
25
20
  'modalTitle',
26
21
  'successModalTitle',
27
22
  'errorModalTitle',
@@ -33,13 +28,20 @@ export class FeedbackButton {
33
28
  'email',
34
29
  'emailPlaceholder',
35
30
  'messagePlaceholder',
36
- 'showModal',
37
31
  ];
38
- let feedbackModalProps = {};
39
- propKeys.forEach((key) => {
40
- feedbackModalProps[key] = this[key];
32
+ props.forEach(prop => {
33
+ this.feedbackModal[prop] = this[prop];
41
34
  });
42
- return (h(Host, null, h("a", { class: "feedback-button-content", onClick: () => this.showModal() }, h("slot", null)), h("feedback-modal", Object.assign({}, feedbackModalProps, { ref: (el) => this.feedbackModal = el }))));
35
+ document.body.appendChild(this.feedbackModal);
36
+ }
37
+ disconnectedCallback() {
38
+ document.body.removeChild(this.feedbackModal);
39
+ }
40
+ showModal() {
41
+ this.feedbackModal.showModal = true;
42
+ }
43
+ render() {
44
+ return (h(Host, null, h("a", { class: `feedback-button-content feedback-button-content--${this.buttonStyle}`, onClick: () => this.showModal() }, h("slot", null))));
43
45
  }
44
46
  static get is() { return "feedback-button"; }
45
47
  static get encapsulation() { return "shadow"; }
@@ -252,12 +254,25 @@ export class FeedbackButton {
252
254
  "attribute": "message-placeholder",
253
255
  "reflect": false,
254
256
  "defaultValue": "'How could this page be more helpful?'"
257
+ },
258
+ "buttonStyle": {
259
+ "type": "string",
260
+ "mutable": false,
261
+ "complexType": {
262
+ "original": "string",
263
+ "resolved": "string",
264
+ "references": {}
265
+ },
266
+ "required": false,
267
+ "optional": false,
268
+ "docs": {
269
+ "tags": [],
270
+ "text": ""
271
+ },
272
+ "attribute": "button-style",
273
+ "reflect": false,
274
+ "defaultValue": "'default'"
255
275
  }
256
276
  };
257
277
  }
258
- static get states() {
259
- return {
260
- "feedbackModal": {}
261
- };
262
- }
263
278
  }