@jumpgroup/jump-design-system 0.2.2 → 0.2.4

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 (158) hide show
  1. package/dist/cjs/{index-79e97f36.js → index-41aaa52a.js} +181 -11
  2. package/dist/cjs/index-41aaa52a.js.map +1 -0
  3. package/dist/cjs/jump-badge.cjs.entry.js +6 -6
  4. package/dist/cjs/jump-badge.cjs.entry.js.map +1 -1
  5. package/dist/cjs/jump-button.cjs.entry.js +10 -6
  6. package/dist/cjs/jump-button.cjs.entry.js.map +1 -1
  7. package/dist/cjs/jump-card.cjs.entry.js +4 -4
  8. package/dist/cjs/jump-card.cjs.entry.js.map +1 -1
  9. package/dist/cjs/jump-design-system.cjs.js +3 -3
  10. package/dist/cjs/jump-design-system.cjs.js.map +1 -1
  11. package/dist/cjs/jump-icon.cjs.entry.js +5 -5
  12. package/dist/cjs/jump-icon.cjs.entry.js.map +1 -1
  13. package/dist/cjs/jump-pagination.cjs.entry.js +32 -10
  14. package/dist/cjs/jump-pagination.cjs.entry.js.map +1 -1
  15. package/dist/cjs/jump-tab.cjs.entry.js +29 -0
  16. package/dist/cjs/jump-tab.cjs.entry.js.map +1 -0
  17. package/dist/cjs/loader.cjs.js +2 -2
  18. package/dist/collection/collection-manifest.json +5 -4
  19. package/dist/collection/components/jump-badge/jump-badge.css +1 -1
  20. package/dist/collection/components/jump-badge/jump-badge.js +4 -4
  21. package/dist/collection/components/jump-badge/jump-badge.js.map +1 -1
  22. package/dist/collection/components/jump-badge/test/jump-badge.spec.js +2 -2
  23. package/dist/collection/components/jump-badge/test/jump-badge.spec.js.map +1 -1
  24. package/dist/collection/components/jump-button/jump-button-anchor.stories.js +87 -0
  25. package/dist/collection/components/jump-button/jump-button-anchor.stories.js.map +1 -0
  26. package/dist/collection/components/jump-button/jump-button-dimension.stories.js +74 -0
  27. package/dist/collection/components/jump-button/jump-button-dimension.stories.js.map +1 -0
  28. package/dist/collection/components/jump-button/jump-button-filled.stories.js +14 -482
  29. package/dist/collection/components/jump-button/jump-button-filled.stories.js.map +1 -1
  30. package/dist/collection/components/jump-button/jump-button-only-icon.stories.js +109 -0
  31. package/dist/collection/components/jump-button/jump-button-only-icon.stories.js.map +1 -0
  32. package/dist/collection/components/jump-button/jump-button-outline.stories.js +20 -285
  33. package/dist/collection/components/jump-button/jump-button-outline.stories.js.map +1 -1
  34. package/dist/collection/components/jump-button/jump-button-text.stories.js +83 -0
  35. package/dist/collection/components/jump-button/jump-button-text.stories.js.map +1 -0
  36. package/dist/collection/components/jump-button/jump-button.css +103 -50
  37. package/dist/collection/components/jump-button/jump-button.js +41 -19
  38. package/dist/collection/components/jump-button/jump-button.js.map +1 -1
  39. package/dist/collection/components/jump-button/test/jump-button.spec.js +2 -2
  40. package/dist/collection/components/jump-button/test/jump-button.spec.js.map +1 -1
  41. package/dist/collection/components/jump-card/jump-card-border-radius.stories.js +2 -14
  42. package/dist/collection/components/jump-card/jump-card-border-radius.stories.js.map +1 -1
  43. package/dist/collection/components/jump-card/jump-card-top-border-content-radius.stories.js +1 -2
  44. package/dist/collection/components/jump-card/jump-card-top-border-content-radius.stories.js.map +1 -1
  45. package/dist/collection/components/jump-card/jump-card.css +50 -1
  46. package/dist/collection/components/jump-card/jump-card.js +13 -13
  47. package/dist/collection/components/jump-card/jump-card.js.map +1 -1
  48. package/dist/collection/components/{app-icon → jump-icon}/jump-icon.js +2 -2
  49. package/dist/collection/components/jump-icon/jump-icon.js.map +1 -0
  50. package/dist/collection/components/{app-icon → jump-icon}/jump-icon.stories.js +1 -1
  51. package/dist/collection/components/jump-icon/jump-icon.stories.js.map +1 -0
  52. package/dist/collection/components/jump-icon/test/jump-icon.e2e.js.map +1 -0
  53. package/dist/collection/components/{app-icon → jump-icon}/test/jump-icon.spec.js +2 -2
  54. package/dist/collection/components/jump-icon/test/jump-icon.spec.js.map +1 -0
  55. package/dist/collection/components/jump-pagination/jump-pagination-pages.stories.js +41 -24
  56. package/dist/collection/components/jump-pagination/jump-pagination-pages.stories.js.map +1 -1
  57. package/dist/collection/components/jump-pagination/jump-pagination-products.stories.js +19 -40
  58. package/dist/collection/components/jump-pagination/jump-pagination-products.stories.js.map +1 -1
  59. package/dist/collection/components/jump-pagination/jump-pagination.css +13 -0
  60. package/dist/collection/components/jump-pagination/jump-pagination.js +64 -31
  61. package/dist/collection/components/jump-pagination/jump-pagination.js.map +1 -1
  62. package/dist/collection/components/jump-tab/jump-tab-inline.stories.js +28 -0
  63. package/dist/collection/components/jump-tab/jump-tab-inline.stories.js.map +1 -0
  64. package/dist/collection/components/jump-tab/jump-tab.css +3 -0
  65. package/dist/collection/components/jump-tab/jump-tab.js +71 -0
  66. package/dist/collection/components/jump-tab/jump-tab.js.map +1 -0
  67. package/dist/collection/components/jump-tab/test/jump-tab.e2e.js +10 -0
  68. package/dist/collection/components/jump-tab/test/jump-tab.e2e.js.map +1 -0
  69. package/dist/collection/components/jump-tab/test/jump-tab.spec.js +18 -0
  70. package/dist/collection/components/jump-tab/test/jump-tab.spec.js.map +1 -0
  71. package/dist/collection/utils/utils.js +29 -3
  72. package/dist/collection/utils/utils.js.map +1 -1
  73. package/dist/components/jump-badge.js +7 -7
  74. package/dist/components/jump-badge.js.map +1 -1
  75. package/dist/components/jump-button.js +26 -20
  76. package/dist/components/jump-button.js.map +1 -1
  77. package/dist/components/jump-card.js +14 -14
  78. package/dist/components/jump-card.js.map +1 -1
  79. package/dist/components/jump-icon.js +2 -2
  80. package/dist/components/jump-icon2.js +4 -4
  81. package/dist/components/jump-icon2.js.map +1 -1
  82. package/dist/components/jump-pagination.js +38 -13
  83. package/dist/components/jump-pagination.js.map +1 -1
  84. package/dist/components/jump-tab.d.ts +11 -0
  85. package/dist/components/jump-tab.js +46 -0
  86. package/dist/components/jump-tab.js.map +1 -0
  87. package/dist/esm/{index-7feee8ea.js → index-192aeaf1.js} +181 -12
  88. package/dist/esm/index-192aeaf1.js.map +1 -0
  89. package/dist/esm/jump-badge.entry.js +6 -6
  90. package/dist/esm/jump-badge.entry.js.map +1 -1
  91. package/dist/esm/jump-button.entry.js +10 -6
  92. package/dist/esm/jump-button.entry.js.map +1 -1
  93. package/dist/esm/jump-card.entry.js +4 -4
  94. package/dist/esm/jump-card.entry.js.map +1 -1
  95. package/dist/esm/jump-design-system.js +4 -4
  96. package/dist/esm/jump-design-system.js.map +1 -1
  97. package/dist/esm/jump-icon.entry.js +5 -5
  98. package/dist/esm/jump-icon.entry.js.map +1 -1
  99. package/dist/esm/jump-pagination.entry.js +32 -10
  100. package/dist/esm/jump-pagination.entry.js.map +1 -1
  101. package/dist/esm/jump-tab.entry.js +25 -0
  102. package/dist/esm/jump-tab.entry.js.map +1 -0
  103. package/dist/esm/loader.js +3 -3
  104. package/dist/jump-design-system/jump-design-system.esm.js +1 -1
  105. package/dist/jump-design-system/jump-design-system.esm.js.map +1 -1
  106. package/dist/jump-design-system/p-20ceb40c.js +3 -0
  107. package/dist/jump-design-system/p-20ceb40c.js.map +1 -0
  108. package/dist/jump-design-system/{p-bc02e346.entry.js → p-511d4425.entry.js} +3 -3
  109. package/dist/jump-design-system/p-511d4425.entry.js.map +1 -0
  110. package/dist/jump-design-system/p-61729377.entry.js +2 -0
  111. package/dist/jump-design-system/p-61729377.entry.js.map +1 -0
  112. package/dist/jump-design-system/p-700b96b4.entry.js +2 -0
  113. package/dist/jump-design-system/p-700b96b4.entry.js.map +1 -0
  114. package/dist/jump-design-system/p-87256ed6.entry.js +2 -0
  115. package/dist/jump-design-system/p-87256ed6.entry.js.map +1 -0
  116. package/dist/jump-design-system/{p-99238e3f.entry.js → p-8f5caf32.entry.js} +2 -2
  117. package/dist/jump-design-system/p-8f5caf32.entry.js.map +1 -0
  118. package/dist/jump-design-system/p-9e47f451.entry.js +2 -0
  119. package/dist/jump-design-system/p-9e47f451.entry.js.map +1 -0
  120. package/dist/jump-design-system-elements.json +20 -7
  121. package/dist/types/components/jump-badge/jump-badge.d.ts +1 -1
  122. package/dist/types/components/jump-button/jump-button-anchor.stories.d.ts +44 -0
  123. package/dist/types/components/jump-button/jump-button-dimension.stories.d.ts +43 -0
  124. package/dist/types/components/jump-button/jump-button-filled.stories.d.ts +1 -120
  125. package/dist/types/components/jump-button/jump-button-only-icon.stories.d.ts +53 -0
  126. package/dist/types/components/jump-button/jump-button-outline.stories.d.ts +4 -112
  127. package/dist/types/components/jump-button/jump-button-text.stories.d.ts +40 -0
  128. package/dist/types/components/jump-button/jump-button.d.ts +7 -2
  129. package/dist/types/components/{app-icon → jump-icon}/jump-icon.d.ts +1 -1
  130. package/dist/types/components/jump-pagination/jump-pagination-pages.stories.d.ts +2 -1
  131. package/dist/types/components/jump-pagination/jump-pagination-products.stories.d.ts +2 -2
  132. package/dist/types/components/jump-pagination/jump-pagination.d.ts +10 -8
  133. package/dist/types/components/jump-tab/jump-tab-inline.stories.d.ts +18 -0
  134. package/dist/types/components/jump-tab/jump-tab.d.ts +6 -0
  135. package/dist/types/components.d.ts +47 -14
  136. package/dist/types/utils/utils.d.ts +2 -1
  137. package/package.json +3 -2
  138. package/dist/cjs/index-79e97f36.js.map +0 -1
  139. package/dist/collection/components/app-icon/jump-icon.js.map +0 -1
  140. package/dist/collection/components/app-icon/jump-icon.stories.js.map +0 -1
  141. package/dist/collection/components/app-icon/test/jump-icon.e2e.js.map +0 -1
  142. package/dist/collection/components/app-icon/test/jump-icon.spec.js.map +0 -1
  143. package/dist/collection/utils/utils.spec.js +0 -16
  144. package/dist/collection/utils/utils.spec.js.map +0 -1
  145. package/dist/esm/index-7feee8ea.js.map +0 -1
  146. package/dist/jump-design-system/p-7cfed9c6.entry.js +0 -2
  147. package/dist/jump-design-system/p-7cfed9c6.entry.js.map +0 -1
  148. package/dist/jump-design-system/p-99238e3f.entry.js.map +0 -1
  149. package/dist/jump-design-system/p-9fd6e0a0.entry.js +0 -2
  150. package/dist/jump-design-system/p-9fd6e0a0.entry.js.map +0 -1
  151. package/dist/jump-design-system/p-bc02e346.entry.js.map +0 -1
  152. package/dist/jump-design-system/p-c560071a.js +0 -3
  153. package/dist/jump-design-system/p-c560071a.js.map +0 -1
  154. package/dist/jump-design-system/p-ddb6c98c.entry.js +0 -2
  155. package/dist/jump-design-system/p-ddb6c98c.entry.js.map +0 -1
  156. /package/dist/collection/components/{app-icon → jump-icon}/jump-icon.css +0 -0
  157. /package/dist/collection/components/{app-icon → jump-icon}/test/jump-icon.e2e.js +0 -0
  158. /package/dist/types/components/{app-icon → jump-icon}/jump-icon.stories.d.ts +0 -0
@@ -21,7 +21,7 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'jump-design-system';
24
- const BUILD = /* jump-design-system */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: false, slot: true, slotChildNodesFix: false, slotRelocation: true, state: false, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: false };
24
+ const BUILD = /* jump-design-system */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: true };
25
25
 
26
26
  /**
27
27
  * Virtual DOM patching algorithm based on Snabbdom by
@@ -31,6 +31,7 @@ const BUILD = /* jump-design-system */ { allRenderFn: true, appendChildSlotFix:
31
31
  *
32
32
  * Modified for Stencil's renderer and slot projection
33
33
  */
34
+ let scopeId;
34
35
  let contentRef;
35
36
  let hostTagName;
36
37
  let useNativeShadowDom = false;
@@ -68,6 +69,7 @@ const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
68
69
  * Don't add values to these!!
69
70
  */
70
71
  const EMPTY_OBJ = {};
72
+ const isDef = (v) => v != null;
71
73
  /**
72
74
  * Check whether a value is a 'complex type', defined here as an object or a
73
75
  * function.
@@ -247,6 +249,20 @@ const parsePropertyValue = (propValue, propType) => {
247
249
  // so no need to change to a different type
248
250
  return propValue;
249
251
  };
252
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
253
+ const createEvent = (ref, name, flags) => {
254
+ const elm = getElement(ref);
255
+ return {
256
+ emit: (detail) => {
257
+ return emitEvent(elm, name, {
258
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
259
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
260
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
261
+ detail,
262
+ });
263
+ },
264
+ };
265
+ };
250
266
  /**
251
267
  * Helper function to create & dispatch a custom Event on a provided target
252
268
  * @param elm the target of the Event
@@ -320,8 +336,20 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
320
336
  const attachStyles = (hostRef) => {
321
337
  const cmpMeta = hostRef.$cmpMeta$;
322
338
  const elm = hostRef.$hostElement$;
339
+ const flags = cmpMeta.$flags$;
323
340
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
324
- addStyle(elm.getRootNode(), cmpMeta);
341
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
342
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
343
+ // only required when we're NOT using native shadow dom (slot)
344
+ // or this browser doesn't support native shadow dom
345
+ // and this host element was NOT created with SSR
346
+ // let's pick out the inner content for slot projection
347
+ // create a node to represent where the original
348
+ // content was first placed, which is useful later on
349
+ // DOM WRITE!!
350
+ elm['s-sc'] = scopeId;
351
+ elm.classList.add(scopeId + '-h');
352
+ }
325
353
  endAttachStyles();
326
354
  };
327
355
  const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
@@ -351,7 +379,7 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
351
379
  const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
352
380
  if (oldValue !== newValue) {
353
381
  let isProp = isMemberInElement(elm, memberName);
354
- memberName.toLowerCase();
382
+ let ln = memberName.toLowerCase();
355
383
  if (memberName === 'class') {
356
384
  const classList = elm.classList;
357
385
  const oldClasses = parseClassList(oldValue);
@@ -361,6 +389,53 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
361
389
  }
362
390
  else if (memberName === 'key')
363
391
  ;
392
+ else if ((!isProp ) &&
393
+ memberName[0] === 'o' &&
394
+ memberName[1] === 'n') {
395
+ // Event Handlers
396
+ // so if the member name starts with "on" and the 3rd characters is
397
+ // a capital letter, and it's not already a member on the element,
398
+ // then we're assuming it's an event listener
399
+ if (memberName[2] === '-') {
400
+ // on- prefixed events
401
+ // allows to be explicit about the dom event to listen without any magic
402
+ // under the hood:
403
+ // <my-cmp on-click> // listens for "click"
404
+ // <my-cmp on-Click> // listens for "Click"
405
+ // <my-cmp on-ionChange> // listens for "ionChange"
406
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
407
+ memberName = memberName.slice(3);
408
+ }
409
+ else if (isMemberInElement(win, ln)) {
410
+ // standard event
411
+ // the JSX attribute could have been "onMouseOver" and the
412
+ // member name "onmouseover" is on the window's prototype
413
+ // so let's add the listener "mouseover", which is all lowercased
414
+ memberName = ln.slice(2);
415
+ }
416
+ else {
417
+ // custom event
418
+ // the JSX attribute could have been "onMyCustomEvent"
419
+ // so let's trim off the "on" prefix and lowercase the first character
420
+ // and add the listener "myCustomEvent"
421
+ // except for the first character, we keep the event name case
422
+ memberName = ln[2] + memberName.slice(3);
423
+ }
424
+ if (oldValue || newValue) {
425
+ // Need to account for "capture" events.
426
+ // If the event name ends with "Capture", we'll update the name to remove
427
+ // the "Capture" suffix and make sure the event listener is setup to handle the capture event.
428
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
429
+ // Make sure we only replace the last instance of "Capture"
430
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, '');
431
+ if (oldValue) {
432
+ plt.rel(elm, memberName, oldValue, capture);
433
+ }
434
+ if (newValue) {
435
+ plt.ael(elm, memberName, newValue, capture);
436
+ }
437
+ }
438
+ }
364
439
  else {
365
440
  // Set property if it exists and it's not a SVG
366
441
  const isComplex = isComplexType(newValue);
@@ -409,6 +484,8 @@ const parseClassListRegex = /\s/;
409
484
  * @returns list of classes, e.g. ["foo", "bar", "baz"]
410
485
  */
411
486
  const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
487
+ const CAPTURE_EVENT_SUFFIX = 'Capture';
488
+ const CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + '$');
412
489
  const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
413
490
  // if the element passed in is a shadow root, which is a document fragment
414
491
  // then we want to be adding attrs/props to the shadow root's "host" element
@@ -420,17 +497,35 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
420
497
  const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
421
498
  {
422
499
  // remove attributes no longer present on the vnode by setting them to undefined
423
- for (memberName in oldVnodeAttrs) {
500
+ for (memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
424
501
  if (!(memberName in newVnodeAttrs)) {
425
502
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
426
503
  }
427
504
  }
428
505
  }
429
506
  // add new & update changed attributes
430
- for (memberName in newVnodeAttrs) {
507
+ for (memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
431
508
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
432
509
  }
433
510
  };
511
+ /**
512
+ * Sort a list of attribute names to ensure that all the attribute names which
513
+ * are _not_ `"ref"` come before `"ref"`. Preserve the order of the non-ref
514
+ * attributes.
515
+ *
516
+ * **Note**: if the supplied attributes do not include `'ref'` then the same
517
+ * (by reference) array will be returned without modification.
518
+ *
519
+ * @param attrNames attribute names to sort
520
+ * @returns a list of attribute names, sorted if they include `"ref"`
521
+ */
522
+ function sortedAttrNames(attrNames) {
523
+ return attrNames.includes('ref')
524
+ ? // we need to sort these to ensure that `'ref'` is the last attr
525
+ [...attrNames.filter((attr) => attr !== 'ref'), 'ref']
526
+ : // no need to sort, return the original array
527
+ attrNames;
528
+ }
434
529
  /**
435
530
  * Create a DOM Node corresponding to one of the children of a given VNode.
436
531
  *
@@ -453,6 +548,10 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
453
548
  // remember for later we need to check to relocate nodes
454
549
  checkSlotRelocate = true;
455
550
  if (newVNode.$tag$ === 'slot') {
551
+ if (scopeId) {
552
+ // scoped css needs to add its scoped id to the parent element
553
+ parentElm.classList.add(scopeId + '-s');
554
+ }
456
555
  newVNode.$flags$ |= newVNode.$children$
457
556
  ? // slot element has fallback content
458
557
  2 /* VNODE_FLAGS.isSlotFallback */
@@ -478,10 +577,15 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
478
577
  {
479
578
  updateElement(null, newVNode, isSvgMode);
480
579
  }
580
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
581
+ // if there is a scopeId and this is the initial render
582
+ // then let's add the scopeId as a css class
583
+ elm.classList.add((elm['s-si'] = scopeId));
584
+ }
481
585
  if (newVNode.$children$) {
482
586
  for (i = 0; i < newVNode.$children$.length; ++i) {
483
587
  // create the node
484
- childNode = createElm(oldParentVNode, newVNode, i);
588
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
485
589
  // return node could have been null
486
590
  if (childNode) {
487
591
  // append our new node
@@ -565,9 +669,12 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
565
669
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
566
670
  let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
567
671
  let childNode;
672
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
673
+ containerElm = containerElm.shadowRoot;
674
+ }
568
675
  for (; startIdx <= endIdx; ++startIdx) {
569
676
  if (vnodes[startIdx]) {
570
- childNode = createElm(null, parentVNode, startIdx);
677
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
571
678
  if (childNode) {
572
679
  vnodes[startIdx].$elm$ = childNode;
573
680
  containerElm.insertBefore(childNode, referenceNode(before) );
@@ -818,7 +925,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
818
925
  elmToMove = oldCh[idxInOld];
819
926
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
820
927
  // the tag doesn't match so we'll need a new DOM element
821
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
928
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
822
929
  }
823
930
  else {
824
931
  patch(elmToMove, newStartVnode, isInitialRender);
@@ -834,7 +941,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
834
941
  // the key of the first new child OR the build is not using `key`
835
942
  // attributes at all. In either case we need to create a new element
836
943
  // for the new node.
837
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
944
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
838
945
  newStartVnode = newCh[++newStartIdx];
839
946
  }
840
947
  if (node) {
@@ -1187,7 +1294,10 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1187
1294
  rootVnode.$tag$ = null;
1188
1295
  rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1189
1296
  hostRef.$vnode$ = rootVnode;
1190
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
1297
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1298
+ {
1299
+ scopeId = hostElm['s-sc'];
1300
+ }
1191
1301
  useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1192
1302
  {
1193
1303
  contentRef = hostElm['s-cr'];
@@ -1237,6 +1347,11 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1237
1347
  let refNode = (_b = orgLocationNode['s-nr']) !== null && _b !== void 0 ? _b : null;
1238
1348
  if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1239
1349
  refNode = refNode.nextSibling;
1350
+ // If the refNode is the same node to be relocated or another element's slot reference, keep searching to find the
1351
+ // correct relocation target
1352
+ while (refNode === nodeToRelocate || (refNode === null || refNode === void 0 ? void 0 : refNode['s-sr'])) {
1353
+ refNode = refNode === null || refNode === void 0 ? void 0 : refNode.nextSibling;
1354
+ }
1240
1355
  if (!refNode || !refNode['s-nr']) {
1241
1356
  insertBeforeNode = refNode;
1242
1357
  break;
@@ -1342,6 +1457,16 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
1342
1457
  // 2. If all functions added to the queue are asynchronous they'll all be
1343
1458
  // called in order after `dispatchHooks` exits.
1344
1459
  let maybePromise;
1460
+ if (isInitialLoad) {
1461
+ {
1462
+ // If `componentWillLoad` returns a `Promise` then we want to wait on
1463
+ // whatever's going on in that `Promise` before we launch into
1464
+ // rendering the component, doing other lifecycle stuff, etc. So
1465
+ // in that case we assign the returned promise to the variable we
1466
+ // declared above to hold a possible 'queueing' Promise
1467
+ maybePromise = safeCall(instance, 'componentWillLoad');
1468
+ }
1469
+ }
1345
1470
  endSchedule();
1346
1471
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1347
1472
  };
@@ -1537,6 +1662,7 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
1537
1662
  const setValue = (ref, propName, newVal, cmpMeta) => {
1538
1663
  // check our new property value against our internal value
1539
1664
  const hostRef = getHostRef(ref);
1665
+ const elm = hostRef.$hostElement$ ;
1540
1666
  const oldVal = hostRef.$instanceValues$.get(propName);
1541
1667
  const flags = hostRef.$flags$;
1542
1668
  const instance = hostRef.$lazyInstance$ ;
@@ -1549,6 +1675,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1549
1675
  // set our new value!
1550
1676
  hostRef.$instanceValues$.set(propName, newVal);
1551
1677
  if (instance) {
1678
+ // get an array of method names of watch functions to call
1679
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1680
+ const watchMethods = cmpMeta.$watchers$[propName];
1681
+ if (watchMethods) {
1682
+ // this instance is watching for when this property changed
1683
+ watchMethods.map((watchMethodName) => {
1684
+ try {
1685
+ // fire off each of the watch methods that are watching this property
1686
+ instance[watchMethodName](newVal, oldVal, propName);
1687
+ }
1688
+ catch (e) {
1689
+ consoleError(e, elm);
1690
+ }
1691
+ });
1692
+ }
1693
+ }
1552
1694
  if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1553
1695
  // looks like this value actually changed, so we've got work to do!
1554
1696
  // but only if we've already rendered, otherwise just chill out
@@ -1573,6 +1715,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1573
1715
  var _a;
1574
1716
  const prototype = Cstr.prototype;
1575
1717
  if (cmpMeta.$members$) {
1718
+ if (Cstr.watchers) {
1719
+ cmpMeta.$watchers$ = Cstr.watchers;
1720
+ }
1576
1721
  // It's better to have a const than two Object.entries()
1577
1722
  const members = Object.entries(cmpMeta.$members$);
1578
1723
  members.map(([memberName, [memberFlags]]) => {
@@ -1722,6 +1867,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1722
1867
  endLoad();
1723
1868
  }
1724
1869
  if (!Cstr.isProxied) {
1870
+ // we've never proxied this Constructor before
1871
+ // let's add the getters/setters to its prototype before
1872
+ // the first time we create an instance of the implementation
1873
+ {
1874
+ cmpMeta.$watchers$ = Cstr.watchers;
1875
+ }
1725
1876
  proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1726
1877
  Cstr.isProxied = true;
1727
1878
  }
@@ -1745,6 +1896,9 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1745
1896
  {
1746
1897
  hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1747
1898
  }
1899
+ {
1900
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1901
+ }
1748
1902
  endNewInstance();
1749
1903
  }
1750
1904
  else {
@@ -1881,6 +2035,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1881
2035
  let hasSlotRelocation = false;
1882
2036
  lazyBundles.map((lazyBundle) => {
1883
2037
  lazyBundle[1].map((compactMeta) => {
2038
+ var _a;
1884
2039
  const cmpMeta = {
1885
2040
  $flags$: compactMeta[0],
1886
2041
  $tagName$: compactMeta[1],
@@ -1898,6 +2053,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1898
2053
  {
1899
2054
  cmpMeta.$attrsToReflect$ = [];
1900
2055
  }
2056
+ {
2057
+ cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
2058
+ }
1901
2059
  const tagName = cmpMeta.$tagName$;
1902
2060
  const HostElement = class extends HTMLElement {
1903
2061
  // StencilLazyHost
@@ -1906,6 +2064,17 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1906
2064
  super(self);
1907
2065
  self = this;
1908
2066
  registerHost(self, cmpMeta);
2067
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2068
+ // this component is using shadow dom
2069
+ // and this browser supports shadow dom
2070
+ // add the read-only property "shadowRoot" to the host element
2071
+ // adding the shadow root build conditionals to minimize runtime
2072
+ {
2073
+ {
2074
+ self.attachShadow({ mode: 'open' });
2075
+ }
2076
+ }
2077
+ }
1909
2078
  }
1910
2079
  connectedCallback() {
1911
2080
  if (appLoadFallback) {
@@ -2124,9 +2293,10 @@ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2124
2293
 
2125
2294
  exports.Host = Host;
2126
2295
  exports.bootstrapLazy = bootstrapLazy;
2296
+ exports.createEvent = createEvent;
2127
2297
  exports.h = h;
2128
2298
  exports.promiseResolve = promiseResolve;
2129
2299
  exports.registerInstance = registerInstance;
2130
2300
  exports.setNonce = setNonce;
2131
2301
 
2132
- //# sourceMappingURL=index-79e97f36.js.map
2302
+ //# sourceMappingURL=index-41aaa52a.js.map