@maggioli-design-system/mds-paginator 2.0.0 → 2.1.1

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.
Files changed (56) hide show
  1. package/dist/cjs/{index-90936275.js → index-0a1b6680.js} +91 -5
  2. package/dist/cjs/loader.cjs.js +3 -2
  3. package/dist/cjs/mds-paginator.cjs.entry.js +5 -3
  4. package/dist/cjs/mds-paginator.cjs.js +6 -2
  5. package/dist/collection/collection-manifest.json +2 -2
  6. package/dist/collection/components/mds-paginator/mds-paginator.js +4 -2
  7. package/dist/components/index.d.ts +9 -0
  8. package/dist/components/index.js +1 -1
  9. package/dist/components/mds-paginator.js +4 -2
  10. package/dist/esm/{index-43f8698e.js → index-af99740b.js} +91 -6
  11. package/dist/esm/loader.js +3 -2
  12. package/dist/esm/mds-paginator.entry.js +5 -3
  13. package/dist/esm/mds-paginator.js +3 -2
  14. package/dist/esm/polyfills/css-shim.js +1 -1
  15. package/dist/esm-es5/index-af99740b.js +2 -0
  16. package/dist/esm-es5/loader.js +1 -1
  17. package/dist/esm-es5/mds-paginator.entry.js +1 -1
  18. package/dist/esm-es5/mds-paginator.js +1 -1
  19. package/dist/mds-paginator/mds-paginator.esm.js +1 -1
  20. package/dist/mds-paginator/mds-paginator.js +1 -1
  21. package/dist/mds-paginator/p-3c5c184f.entry.js +1 -0
  22. package/dist/mds-paginator/{p-b1d06119.system.entry.js → p-4984613d.system.entry.js} +1 -1
  23. package/dist/mds-paginator/p-a53254ac.system.js +2 -0
  24. package/dist/mds-paginator/p-bc44a1b3.js +2 -0
  25. package/dist/mds-paginator/p-d375dd5d.system.js +1 -0
  26. package/dist/stats.json +29 -29
  27. package/dist/types/stencil-public-runtime.d.ts +59 -3
  28. package/dist/types/types/autocomplete.d.ts +2 -2
  29. package/dist/types/types/button.d.ts +4 -4
  30. package/dist/types/types/floating-ui.d.ts +2 -2
  31. package/dist/types/types/form-rel.d.ts +1 -1
  32. package/dist/types/types/input-text-type.d.ts +1 -1
  33. package/dist/types/types/input-value-type.d.ts +1 -1
  34. package/dist/types/types/loading.d.ts +1 -1
  35. package/dist/types/types/typography.d.ts +8 -8
  36. package/dist/types/types/variant.d.ts +10 -10
  37. package/loader/index.d.ts +9 -0
  38. package/package.json +4 -4
  39. package/src/components/mds-paginator/mds-paginator.tsx +4 -2
  40. package/src/components/mds-paginator/test/mds-paginator.e2e.ts +1 -1
  41. package/www/build/mds-paginator.esm.js +1 -1
  42. package/www/build/mds-paginator.js +1 -1
  43. package/www/build/p-3c5c184f.entry.js +1 -0
  44. package/www/build/{p-b1d06119.system.entry.js → p-4984613d.system.entry.js} +1 -1
  45. package/www/build/p-a53254ac.system.js +2 -0
  46. package/www/build/p-bc44a1b3.js +2 -0
  47. package/www/build/p-d375dd5d.system.js +1 -0
  48. package/dist/esm-es5/index-43f8698e.js +0 -2
  49. package/dist/mds-paginator/p-558993d8.system.js +0 -2
  50. package/dist/mds-paginator/p-717879e7.entry.js +0 -1
  51. package/dist/mds-paginator/p-aad97286.js +0 -2
  52. package/dist/mds-paginator/p-d2523a06.system.js +0 -1
  53. package/www/build/p-558993d8.system.js +0 -2
  54. package/www/build/p-717879e7.entry.js +0 -1
  55. package/www/build/p-aad97286.js +0 -2
  56. package/www/build/p-d2523a06.system.js +0 -1
@@ -48,7 +48,7 @@ const uniqueTime = (key, measureText) => {
48
48
  };
49
49
  }
50
50
  };
51
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
51
+ const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
52
52
  /**
53
53
  * Default style mode id
54
54
  */
@@ -63,6 +63,18 @@ const isComplexType = (o) => {
63
63
  o = typeof o;
64
64
  return o === 'object' || o === 'function';
65
65
  };
66
+ /**
67
+ * Helper method for querying a `meta` tag that contains a nonce value
68
+ * out of a DOM's head.
69
+ *
70
+ * @param doc The DOM containing the `head` to query against
71
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
72
+ * exists or the tag has no content.
73
+ */
74
+ function queryNonceMetaTagContent(doc) {
75
+ var _a, _b, _c;
76
+ 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;
77
+ }
66
78
  /**
67
79
  * Production h() function based on Preact by
68
80
  * Jason Miller (@developit)
@@ -71,7 +83,6 @@ const isComplexType = (o) => {
71
83
  *
72
84
  * Modified for Stencil's compiler and vdom
73
85
  */
74
- // const stack: any[] = [];
75
86
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
76
87
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
77
88
  const h = (nodeName, vnodeData, ...children) => {
@@ -130,6 +141,14 @@ const h = (nodeName, vnodeData, ...children) => {
130
141
  }
131
142
  return vnode;
132
143
  };
144
+ /**
145
+ * A utility function for creating a virtual DOM node from a tag and some
146
+ * possible text content.
147
+ *
148
+ * @param tag the tag for this element
149
+ * @param text possible text content for the node
150
+ * @returns a newly-minted virtual DOM node
151
+ */
133
152
  const newVNode = (tag, text) => {
134
153
  const vnode = {
135
154
  $flags$: 0,
@@ -147,6 +166,12 @@ const newVNode = (tag, text) => {
147
166
  return vnode;
148
167
  };
149
168
  const Host = {};
169
+ /**
170
+ * Check whether a given node is a Host node or not
171
+ *
172
+ * @param node the virtual DOM node to check
173
+ * @returns whether it's a Host node or not
174
+ */
150
175
  const isHost = (node) => node && node.$tag$ === Host;
151
176
  /**
152
177
  * Parse a new property value for a given property type.
@@ -229,6 +254,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
229
254
  styles.set(scopeId, style);
230
255
  };
231
256
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
257
+ var _a;
232
258
  let scopeId = getScopeId(cmpMeta);
233
259
  const style = styles.get(scopeId);
234
260
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -248,6 +274,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
248
274
  styleElm = doc.createElement('style');
249
275
  styleElm.innerHTML = style;
250
276
  }
277
+ // Apply CSP nonce to the style tag if it exists
278
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
279
+ if (nonce != null) {
280
+ styleElm.setAttribute('nonce', nonce);
281
+ }
251
282
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
252
283
  }
253
284
  if (appliedStyles) {
@@ -448,6 +479,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
448
479
  }
449
480
  return elm;
450
481
  };
482
+ /**
483
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
484
+ * add them to the DOM in the appropriate place.
485
+ *
486
+ * @param parentElm the DOM node which should be used as a parent for the new
487
+ * DOM nodes
488
+ * @param before a child of the `parentElm` which the new children should be
489
+ * inserted before (optional)
490
+ * @param parentVNode the parent virtual DOM node
491
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
492
+ * @param startIdx the index in the child virtual DOM nodes at which to start
493
+ * creating DOM nodes (inclusive)
494
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
495
+ * creating DOM nodes (inclusive)
496
+ */
451
497
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
452
498
  let containerElm = (parentElm);
453
499
  let childNode;
@@ -464,6 +510,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
464
510
  }
465
511
  }
466
512
  };
513
+ /**
514
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
515
+ * This can be used to, for instance, clean up after a list of children which
516
+ * should no longer be shown.
517
+ *
518
+ * This function also handles some of Stencil's slot relocation logic.
519
+ *
520
+ * @param vnodes a list of virtual DOM nodes to remove
521
+ * @param startIdx the index at which to start removing nodes (inclusive)
522
+ * @param endIdx the index at which to stop removing nodes (inclusive)
523
+ * @param vnode a VNode
524
+ * @param elm an element
525
+ */
467
526
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
468
527
  for (; startIdx <= endIdx; ++startIdx) {
469
528
  if ((vnode = vnodes[startIdx])) {
@@ -692,7 +751,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
692
751
  *
693
752
  * So, in other words, if `key` attrs are not set on VNodes which may be
694
753
  * changing order within a `children` array or something along those lines then
695
- * we could obtain a false positive and then have to do needless re-rendering.
754
+ * we could obtain a false negative and then have to do needless re-rendering
755
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
696
756
  *
697
757
  * @param leftVNode the first VNode to check
698
758
  * @param rightVNode the second VNode to check
@@ -756,6 +816,18 @@ const patch = (oldVNode, newVNode) => {
756
816
  elm.data = text;
757
817
  }
758
818
  };
819
+ /**
820
+ * The main entry point for Stencil's virtual DOM-based rendering engine
821
+ *
822
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
823
+ * function will handle creating a virtual DOM tree with a single root, patching
824
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
825
+ * relocation, and reflecting attributes.
826
+ *
827
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
828
+ * the DOM node into which it should be rendered.
829
+ * @param renderFnResults the virtual DOM nodes to be rendered
830
+ */
759
831
  const renderVdom = (hostRef, renderFnResults) => {
760
832
  const hostElm = hostRef.$hostElement$;
761
833
  const cmpMeta = hostRef.$cmpMeta$;
@@ -927,8 +999,8 @@ const safeCall = (instance, method, arg) => {
927
999
  const then = (promise, thenFn) => {
928
1000
  return promise && promise.then ? promise.then(thenFn) : thenFn();
929
1001
  };
930
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
931
- ;
1002
+ const addHydratedFlag = (elm) => elm.setAttribute('hydrated', '')
1003
+ ;
932
1004
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
933
1005
  const setValue = (ref, propName, newVal, cmpMeta) => {
934
1006
  // check our new property value against our internal value
@@ -1173,6 +1245,7 @@ const disconnectedCallback = (elm) => {
1173
1245
  }
1174
1246
  };
1175
1247
  const bootstrapLazy = (lazyBundles, options = {}) => {
1248
+ var _a;
1176
1249
  const endBootstrap = createTime();
1177
1250
  const cmpTags = [];
1178
1251
  const exclude = options.exclude || [];
@@ -1249,6 +1322,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1249
1322
  {
1250
1323
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1251
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
+ }
1252
1330
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1253
1331
  }
1254
1332
  // Process deferred connectedCallbacks now all components have been registered
@@ -1264,6 +1342,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1264
1342
  // Fallback appLoad event
1265
1343
  endBootstrap();
1266
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);
1267
1352
  const hostRefs = /*@__PURE__*/ new WeakMap();
1268
1353
  const getHostRef = (ref) => hostRefs.get(ref);
1269
1354
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1377,3 +1462,4 @@ exports.getElement = getElement;
1377
1462
  exports.h = h;
1378
1463
  exports.promiseResolve = promiseResolve;
1379
1464
  exports.registerInstance = registerInstance;
1465
+ exports.setNonce = setNonce;
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-90936275.js');
5
+ const index = require('./index-0a1b6680.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.2 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchEsm = () => {
11
11
  return index.promiseResolve();
@@ -18,4 +18,5 @@ const defineCustomElements = (win, options) => {
18
18
  });
19
19
  };
20
20
 
21
+ exports.setNonce = index.setNonce;
21
22
  exports.defineCustomElements = defineCustomElements;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-90936275.js');
5
+ const index = require('./index-0a1b6680.js');
6
6
 
7
7
  const mdsPaginatorCss = ".fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{--mds-paginator-background:rgb(var(--tone-neutral-09));display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:0.25rem}.pages{margin-left:0.5rem;margin-right:0.5rem;display:-ms-flexbox;display:flex;-ms-flex-negative:1;flex-shrink:1;-ms-flex-align:center;align-items:center;overflow:auto;scroll-behavior:smooth;border-radius:9999px;padding:0.5rem;background-color:var(--mds-paginator-background);gap:2px;}:host() .pages{-ms-overflow-style:none;scrollbar-width:none}.pages::-webkit-scrollbar{display:none}";
8
8
 
@@ -31,7 +31,9 @@ const MdsPaginator = class {
31
31
  return;
32
32
  }
33
33
  this.currentPage = selectedPage;
34
- this.scrollPage();
34
+ if (this.pages > 2) {
35
+ this.scrollPage();
36
+ }
35
37
  this.pageChangedEvent.emit(this.currentPage);
36
38
  };
37
39
  this.pages = 0;
@@ -44,7 +46,7 @@ const MdsPaginator = class {
44
46
  }
45
47
  render() {
46
48
  return (index.h(index.Host, null, index.h("mds-paginator-item", { icon: "mi/baseline/arrow-back", disabled: this.currentPage === 1, onClick: () => this.goToPage(this.currentPage - 1) }), this.pages > 0 && index.h("mds-paginator-item", { active: this.currentPage === 1, onClick: () => this.goToPage(1) }, "1"), this.pages > 2 &&
47
- index.h("div", { class: "pages" }, Array.from(Array(this.pages - 2).keys()).map(i => index.h("mds-paginator-item", { key: i, active: this.currentPage === i + 2, onClick: () => this.goToPage(i + 2) }, i + 2))), this.pages && index.h("mds-paginator-item", { active: this.currentPage === this.pages, onClick: () => this.goToPage(this.pages) }, this.pages), index.h("mds-paginator-item", { icon: "mi/baseline/arrow-forward", disabled: this.currentPage === this.pages, onClick: () => this.goToPage(this.currentPage + 1) })));
49
+ index.h("div", { class: "pages" }, Array.from(Array(this.pages - 2).keys()).map(i => index.h("mds-paginator-item", { key: i, active: this.currentPage === i + 2, onClick: () => this.goToPage(i + 2) }, i + 2))), this.pages > 1 && index.h("mds-paginator-item", { active: this.currentPage === this.pages, onClick: () => this.goToPage(this.pages) }, this.pages), index.h("mds-paginator-item", { icon: "mi/baseline/arrow-forward", disabled: this.currentPage === this.pages, onClick: () => this.goToPage(this.currentPage + 1) })));
48
50
  }
49
51
  get element() { return index.getElement(this); }
50
52
  };
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-90936275.js');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-0a1b6680.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.2 | 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('mds-paginator.cjs.js', document.baseURI).href));
@@ -17,3 +19,5 @@ const patchBrowser = () => {
17
19
  patchBrowser().then(options => {
18
20
  return index.bootstrapLazy([["mds-paginator.cjs",[[1,"mds-paginator",{"pages":[2],"currentPage":[1538,"current-page"]}]]]], options);
19
21
  });
22
+
23
+ exports.setNonce = index.setNonce;
@@ -4,8 +4,8 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "2.20.0",
8
- "typescriptVersion": "4.8.4"
7
+ "version": "2.22.2",
8
+ "typescriptVersion": "4.9.4"
9
9
  },
10
10
  "collections": [],
11
11
  "bundles": []
@@ -22,7 +22,9 @@ export class MdsPaginator {
22
22
  return;
23
23
  }
24
24
  this.currentPage = selectedPage;
25
- this.scrollPage();
25
+ if (this.pages > 2) {
26
+ this.scrollPage();
27
+ }
26
28
  this.pageChangedEvent.emit(this.currentPage);
27
29
  };
28
30
  this.pages = 0;
@@ -35,7 +37,7 @@ export class MdsPaginator {
35
37
  }
36
38
  render() {
37
39
  return (h(Host, null, h("mds-paginator-item", { icon: "mi/baseline/arrow-back", disabled: this.currentPage === 1, onClick: () => this.goToPage(this.currentPage - 1) }), this.pages > 0 && h("mds-paginator-item", { active: this.currentPage === 1, onClick: () => this.goToPage(1) }, "1"), this.pages > 2 &&
38
- h("div", { class: "pages" }, Array.from(Array(this.pages - 2).keys()).map(i => h("mds-paginator-item", { key: i, active: this.currentPage === i + 2, onClick: () => this.goToPage(i + 2) }, i + 2))), this.pages && h("mds-paginator-item", { active: this.currentPage === this.pages, onClick: () => this.goToPage(this.pages) }, this.pages), h("mds-paginator-item", { icon: "mi/baseline/arrow-forward", disabled: this.currentPage === this.pages, onClick: () => this.goToPage(this.currentPage + 1) })));
40
+ h("div", { class: "pages" }, Array.from(Array(this.pages - 2).keys()).map(i => h("mds-paginator-item", { key: i, active: this.currentPage === i + 2, onClick: () => this.goToPage(i + 2) }, i + 2))), this.pages > 1 && h("mds-paginator-item", { active: this.currentPage === this.pages, onClick: () => this.goToPage(this.pages) }, this.pages), h("mds-paginator-item", { icon: "mi/baseline/arrow-forward", disabled: this.currentPage === this.pages, onClick: () => this.goToPage(this.currentPage + 1) })));
39
41
  }
40
42
  static get is() { return "mds-paginator"; }
41
43
  static get encapsulation() { return "shadow"; }
@@ -13,6 +13,15 @@ export { MdsPaginator as MdsPaginator } from '../types/components/mds-paginator/
13
13
  */
14
14
  export declare const setAssetPath: (path: string) => void;
15
15
 
16
+ /**
17
+ * Used to specify a nonce value that corresponds with an application's CSP.
18
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
19
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
20
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
21
+ * will result in the same behavior.
22
+ */
23
+ export declare const setNonce: (nonce: string) => void
24
+
16
25
  export interface SetPlatformOptions {
17
26
  raf?: (c: FrameRequestCallback) => number;
18
27
  ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
@@ -1,2 +1,2 @@
1
- export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
1
+ export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
2
2
  export { MdsPaginator, defineCustomElement as defineCustomElementMdsPaginator } from './mds-paginator.js';
@@ -29,7 +29,9 @@ const MdsPaginator$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
29
29
  return;
30
30
  }
31
31
  this.currentPage = selectedPage;
32
- this.scrollPage();
32
+ if (this.pages > 2) {
33
+ this.scrollPage();
34
+ }
33
35
  this.pageChangedEvent.emit(this.currentPage);
34
36
  };
35
37
  this.pages = 0;
@@ -42,7 +44,7 @@ const MdsPaginator$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
42
44
  }
43
45
  render() {
44
46
  return (h(Host, null, h("mds-paginator-item", { icon: "mi/baseline/arrow-back", disabled: this.currentPage === 1, onClick: () => this.goToPage(this.currentPage - 1) }), this.pages > 0 && h("mds-paginator-item", { active: this.currentPage === 1, onClick: () => this.goToPage(1) }, "1"), this.pages > 2 &&
45
- h("div", { class: "pages" }, Array.from(Array(this.pages - 2).keys()).map(i => h("mds-paginator-item", { key: i, active: this.currentPage === i + 2, onClick: () => this.goToPage(i + 2) }, i + 2))), this.pages && h("mds-paginator-item", { active: this.currentPage === this.pages, onClick: () => this.goToPage(this.pages) }, this.pages), h("mds-paginator-item", { icon: "mi/baseline/arrow-forward", disabled: this.currentPage === this.pages, onClick: () => this.goToPage(this.currentPage + 1) })));
47
+ h("div", { class: "pages" }, Array.from(Array(this.pages - 2).keys()).map(i => h("mds-paginator-item", { key: i, active: this.currentPage === i + 2, onClick: () => this.goToPage(i + 2) }, i + 2))), this.pages > 1 && h("mds-paginator-item", { active: this.currentPage === this.pages, onClick: () => this.goToPage(this.pages) }, this.pages), h("mds-paginator-item", { icon: "mi/baseline/arrow-forward", disabled: this.currentPage === this.pages, onClick: () => this.goToPage(this.currentPage + 1) })));
46
48
  }
47
49
  get element() { return this; }
48
50
  static get style() { return mdsPaginatorCss; }
@@ -26,7 +26,7 @@ const uniqueTime = (key, measureText) => {
26
26
  };
27
27
  }
28
28
  };
29
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
29
+ const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
30
30
  /**
31
31
  * Default style mode id
32
32
  */
@@ -41,6 +41,18 @@ const isComplexType = (o) => {
41
41
  o = typeof o;
42
42
  return o === 'object' || o === 'function';
43
43
  };
44
+ /**
45
+ * Helper method for querying a `meta` tag that contains a nonce value
46
+ * out of a DOM's head.
47
+ *
48
+ * @param doc The DOM containing the `head` to query against
49
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
50
+ * exists or the tag has no content.
51
+ */
52
+ function queryNonceMetaTagContent(doc) {
53
+ var _a, _b, _c;
54
+ 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;
55
+ }
44
56
  /**
45
57
  * Production h() function based on Preact by
46
58
  * Jason Miller (@developit)
@@ -49,7 +61,6 @@ const isComplexType = (o) => {
49
61
  *
50
62
  * Modified for Stencil's compiler and vdom
51
63
  */
52
- // const stack: any[] = [];
53
64
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
54
65
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
55
66
  const h = (nodeName, vnodeData, ...children) => {
@@ -108,6 +119,14 @@ const h = (nodeName, vnodeData, ...children) => {
108
119
  }
109
120
  return vnode;
110
121
  };
122
+ /**
123
+ * A utility function for creating a virtual DOM node from a tag and some
124
+ * possible text content.
125
+ *
126
+ * @param tag the tag for this element
127
+ * @param text possible text content for the node
128
+ * @returns a newly-minted virtual DOM node
129
+ */
111
130
  const newVNode = (tag, text) => {
112
131
  const vnode = {
113
132
  $flags$: 0,
@@ -125,6 +144,12 @@ const newVNode = (tag, text) => {
125
144
  return vnode;
126
145
  };
127
146
  const Host = {};
147
+ /**
148
+ * Check whether a given node is a Host node or not
149
+ *
150
+ * @param node the virtual DOM node to check
151
+ * @returns whether it's a Host node or not
152
+ */
128
153
  const isHost = (node) => node && node.$tag$ === Host;
129
154
  /**
130
155
  * Parse a new property value for a given property type.
@@ -207,6 +232,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
207
232
  styles.set(scopeId, style);
208
233
  };
209
234
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
235
+ var _a;
210
236
  let scopeId = getScopeId(cmpMeta);
211
237
  const style = styles.get(scopeId);
212
238
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -226,6 +252,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
226
252
  styleElm = doc.createElement('style');
227
253
  styleElm.innerHTML = style;
228
254
  }
255
+ // Apply CSP nonce to the style tag if it exists
256
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
257
+ if (nonce != null) {
258
+ styleElm.setAttribute('nonce', nonce);
259
+ }
229
260
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
230
261
  }
231
262
  if (appliedStyles) {
@@ -426,6 +457,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
426
457
  }
427
458
  return elm;
428
459
  };
460
+ /**
461
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
462
+ * add them to the DOM in the appropriate place.
463
+ *
464
+ * @param parentElm the DOM node which should be used as a parent for the new
465
+ * DOM nodes
466
+ * @param before a child of the `parentElm` which the new children should be
467
+ * inserted before (optional)
468
+ * @param parentVNode the parent virtual DOM node
469
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
470
+ * @param startIdx the index in the child virtual DOM nodes at which to start
471
+ * creating DOM nodes (inclusive)
472
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
473
+ * creating DOM nodes (inclusive)
474
+ */
429
475
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
430
476
  let containerElm = (parentElm);
431
477
  let childNode;
@@ -442,6 +488,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
442
488
  }
443
489
  }
444
490
  };
491
+ /**
492
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
493
+ * This can be used to, for instance, clean up after a list of children which
494
+ * should no longer be shown.
495
+ *
496
+ * This function also handles some of Stencil's slot relocation logic.
497
+ *
498
+ * @param vnodes a list of virtual DOM nodes to remove
499
+ * @param startIdx the index at which to start removing nodes (inclusive)
500
+ * @param endIdx the index at which to stop removing nodes (inclusive)
501
+ * @param vnode a VNode
502
+ * @param elm an element
503
+ */
445
504
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
446
505
  for (; startIdx <= endIdx; ++startIdx) {
447
506
  if ((vnode = vnodes[startIdx])) {
@@ -670,7 +729,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
670
729
  *
671
730
  * So, in other words, if `key` attrs are not set on VNodes which may be
672
731
  * changing order within a `children` array or something along those lines then
673
- * we could obtain a false positive and then have to do needless re-rendering.
732
+ * we could obtain a false negative and then have to do needless re-rendering
733
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
674
734
  *
675
735
  * @param leftVNode the first VNode to check
676
736
  * @param rightVNode the second VNode to check
@@ -734,6 +794,18 @@ const patch = (oldVNode, newVNode) => {
734
794
  elm.data = text;
735
795
  }
736
796
  };
797
+ /**
798
+ * The main entry point for Stencil's virtual DOM-based rendering engine
799
+ *
800
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
801
+ * function will handle creating a virtual DOM tree with a single root, patching
802
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
803
+ * relocation, and reflecting attributes.
804
+ *
805
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
806
+ * the DOM node into which it should be rendered.
807
+ * @param renderFnResults the virtual DOM nodes to be rendered
808
+ */
737
809
  const renderVdom = (hostRef, renderFnResults) => {
738
810
  const hostElm = hostRef.$hostElement$;
739
811
  const cmpMeta = hostRef.$cmpMeta$;
@@ -905,8 +977,8 @@ const safeCall = (instance, method, arg) => {
905
977
  const then = (promise, thenFn) => {
906
978
  return promise && promise.then ? promise.then(thenFn) : thenFn();
907
979
  };
908
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
909
- ;
980
+ const addHydratedFlag = (elm) => elm.setAttribute('hydrated', '')
981
+ ;
910
982
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
911
983
  const setValue = (ref, propName, newVal, cmpMeta) => {
912
984
  // check our new property value against our internal value
@@ -1151,6 +1223,7 @@ const disconnectedCallback = (elm) => {
1151
1223
  }
1152
1224
  };
1153
1225
  const bootstrapLazy = (lazyBundles, options = {}) => {
1226
+ var _a;
1154
1227
  const endBootstrap = createTime();
1155
1228
  const cmpTags = [];
1156
1229
  const exclude = options.exclude || [];
@@ -1227,6 +1300,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1227
1300
  {
1228
1301
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1229
1302
  visibilityStyle.setAttribute('data-styles', '');
1303
+ // Apply CSP nonce to the style tag if it exists
1304
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1305
+ if (nonce != null) {
1306
+ visibilityStyle.setAttribute('nonce', nonce);
1307
+ }
1230
1308
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1231
1309
  }
1232
1310
  // Process deferred connectedCallbacks now all components have been registered
@@ -1242,6 +1320,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1242
1320
  // Fallback appLoad event
1243
1321
  endBootstrap();
1244
1322
  };
1323
+ /**
1324
+ * Assigns the given value to the nonce property on the runtime platform object.
1325
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1326
+ * @param nonce The value to be assigned to the platform nonce property.
1327
+ * @returns void
1328
+ */
1329
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1245
1330
  const hostRefs = /*@__PURE__*/ new WeakMap();
1246
1331
  const getHostRef = (ref) => hostRefs.get(ref);
1247
1332
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1348,4 +1433,4 @@ const flush = () => {
1348
1433
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1349
1434
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1350
1435
 
1351
- export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };
1436
+ export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
@@ -1,7 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-43f8698e.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-af99740b.js';
2
+ export { s as setNonce } from './index-af99740b.js';
2
3
 
3
4
  /*
4
- Stencil Client Patch Esm v2.20.0 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Patch Esm v2.22.2 | MIT Licensed | https://stenciljs.com
5
6
  */
6
7
  const patchEsm = () => {
7
8
  return promiseResolve();
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-43f8698e.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-af99740b.js';
2
2
 
3
3
  const mdsPaginatorCss = ".fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{--mds-paginator-background:rgb(var(--tone-neutral-09));display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:0.25rem}.pages{margin-left:0.5rem;margin-right:0.5rem;display:-ms-flexbox;display:flex;-ms-flex-negative:1;flex-shrink:1;-ms-flex-align:center;align-items:center;overflow:auto;scroll-behavior:smooth;border-radius:9999px;padding:0.5rem;background-color:var(--mds-paginator-background);gap:2px;}:host() .pages{-ms-overflow-style:none;scrollbar-width:none}.pages::-webkit-scrollbar{display:none}";
4
4
 
@@ -27,7 +27,9 @@ const MdsPaginator = class {
27
27
  return;
28
28
  }
29
29
  this.currentPage = selectedPage;
30
- this.scrollPage();
30
+ if (this.pages > 2) {
31
+ this.scrollPage();
32
+ }
31
33
  this.pageChangedEvent.emit(this.currentPage);
32
34
  };
33
35
  this.pages = 0;
@@ -40,7 +42,7 @@ const MdsPaginator = class {
40
42
  }
41
43
  render() {
42
44
  return (h(Host, null, h("mds-paginator-item", { icon: "mi/baseline/arrow-back", disabled: this.currentPage === 1, onClick: () => this.goToPage(this.currentPage - 1) }), this.pages > 0 && h("mds-paginator-item", { active: this.currentPage === 1, onClick: () => this.goToPage(1) }, "1"), this.pages > 2 &&
43
- h("div", { class: "pages" }, Array.from(Array(this.pages - 2).keys()).map(i => h("mds-paginator-item", { key: i, active: this.currentPage === i + 2, onClick: () => this.goToPage(i + 2) }, i + 2))), this.pages && h("mds-paginator-item", { active: this.currentPage === this.pages, onClick: () => this.goToPage(this.pages) }, this.pages), h("mds-paginator-item", { icon: "mi/baseline/arrow-forward", disabled: this.currentPage === this.pages, onClick: () => this.goToPage(this.currentPage + 1) })));
45
+ h("div", { class: "pages" }, Array.from(Array(this.pages - 2).keys()).map(i => h("mds-paginator-item", { key: i, active: this.currentPage === i + 2, onClick: () => this.goToPage(i + 2) }, i + 2))), this.pages > 1 && h("mds-paginator-item", { active: this.currentPage === this.pages, onClick: () => this.goToPage(this.pages) }, this.pages), h("mds-paginator-item", { icon: "mi/baseline/arrow-forward", disabled: this.currentPage === this.pages, onClick: () => this.goToPage(this.currentPage + 1) })));
44
46
  }
45
47
  get element() { return getElement(this); }
46
48
  };
@@ -1,7 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-43f8698e.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-af99740b.js';
2
+ export { s as setNonce } from './index-af99740b.js';
2
3
 
3
4
  /*
4
- Stencil Client Patch Browser v2.20.0 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Patch Browser v2.22.2 | MIT Licensed | https://stenciljs.com
5
6
  */
6
7
  const patchBrowser = () => {
7
8
  const importMeta = import.meta.url;