@nanoporetech-digital/components 3.5.1 → 3.7.0

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 (226) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/{date-utils-c581f187.js → date-utils-42fbcb42.js} +5 -3
  3. package/dist/cjs/date-utils-42fbcb42.js.map +1 -0
  4. package/dist/cjs/index-41582c2a.js +2 -6
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/nano-components.cjs.js +1 -1
  7. package/dist/cjs/nano-datalist_3.cjs.entry.js +10 -5
  8. package/dist/cjs/nano-datalist_3.cjs.entry.js.map +1 -1
  9. package/dist/cjs/nano-date-input.cjs.entry.js +1 -1
  10. package/dist/cjs/nano-date-picker.cjs.entry.js +1 -1
  11. package/dist/cjs/nano-demo.cjs.entry.js +3 -2
  12. package/dist/cjs/nano-demo.cjs.entry.js.map +1 -1
  13. package/dist/cjs/nano-dropdown.cjs.entry.js +5 -2
  14. package/dist/cjs/nano-dropdown.cjs.entry.js.map +1 -1
  15. package/dist/cjs/nano-file-upload.cjs.entry.js +4 -0
  16. package/dist/cjs/nano-file-upload.cjs.entry.js.map +1 -1
  17. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +1 -2
  18. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
  19. package/dist/cjs/nano-icon-button.cjs.entry.js +1 -1
  20. package/dist/cjs/nano-icon-button.cjs.entry.js.map +1 -1
  21. package/dist/cjs/nano-icon.cjs.entry.js.map +1 -1
  22. package/dist/cjs/{nano-tooltip.cjs.entry.js → nano-progress-bar_2.cjs.entry.js} +28 -4
  23. package/dist/cjs/nano-progress-bar_2.cjs.entry.js.map +1 -0
  24. package/dist/cjs/nano-resize-observe_2.cjs.entry.js +74 -12
  25. package/dist/cjs/nano-resize-observe_2.cjs.entry.js.map +1 -1
  26. package/dist/cjs/nano-sticker.cjs.entry.js +2 -0
  27. package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
  28. package/dist/cjs/nano-tab-group.cjs.entry.js +1 -1
  29. package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
  30. package/dist/cjs/{nano-table-067e0c12.js → nano-table-56eb29c1.js} +172 -88
  31. package/dist/cjs/nano-table-56eb29c1.js.map +1 -0
  32. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  33. package/dist/cjs/{table.worker-a4d75c46.js → table.worker-b1c53001.js} +3 -3
  34. package/dist/cjs/table.worker-b1c53001.js.map +1 -0
  35. package/dist/{esm/table.worker-e9fb087e.js → cjs/table.worker-e2f9ccfa.js} +1 -1
  36. package/dist/collection/components/datalist/datalist.js +3 -3
  37. package/dist/collection/components/datalist/datalist.js.map +1 -1
  38. package/dist/collection/components/demo/demo.js +3 -2
  39. package/dist/collection/components/demo/demo.js.map +1 -1
  40. package/dist/collection/components/dropdown/dropdown.js +5 -2
  41. package/dist/collection/components/dropdown/dropdown.js.map +1 -1
  42. package/dist/collection/components/file-upload/file-upload.js +4 -0
  43. package/dist/collection/components/file-upload/file-upload.js.map +1 -1
  44. package/dist/collection/components/icon/icon.js +1 -1
  45. package/dist/collection/components/icon/icon.js.map +1 -1
  46. package/dist/collection/components/icon-button/icon-button.js +1 -1
  47. package/dist/collection/components/icon-button/icon-button.js.map +1 -1
  48. package/dist/collection/components/menu/menu.js +8 -3
  49. package/dist/collection/components/menu/menu.js.map +1 -1
  50. package/dist/collection/components/nav-item/nav-item.js +1 -2
  51. package/dist/collection/components/nav-item/nav-item.js.map +1 -1
  52. package/dist/collection/components/resize-observe/resize-observe.js +118 -14
  53. package/dist/collection/components/resize-observe/resize-observe.js.map +1 -1
  54. package/dist/collection/components/sticker/sticker.js +2 -0
  55. package/dist/collection/components/sticker/sticker.js.map +1 -1
  56. package/dist/collection/components/table/table-interface.js.map +1 -1
  57. package/dist/collection/components/table/table.cell.js +10 -5
  58. package/dist/collection/components/table/table.cell.js.map +1 -1
  59. package/dist/collection/components/table/table.css +9 -23
  60. package/dist/collection/components/table/table.js +236 -93
  61. package/dist/collection/components/table/table.js.map +1 -1
  62. package/dist/collection/components/table/table.row.js +19 -12
  63. package/dist/collection/components/table/table.row.js.map +1 -1
  64. package/dist/collection/components/table/table.store.js +1 -1
  65. package/dist/collection/components/table/table.store.js.map +1 -1
  66. package/dist/collection/components/table/table.utils.js +4 -4
  67. package/dist/collection/components/table/table.utils.js.map +1 -1
  68. package/dist/collection/components/table/table.worker.js +8 -0
  69. package/dist/collection/components/table/table.worker.js.map +1 -1
  70. package/dist/collection/components/tabs/tab-group.js +1 -1
  71. package/dist/collection/components/tabs/tab-group.js.map +1 -1
  72. package/dist/collection/components/tooltip/tooltip.js +25 -3
  73. package/dist/collection/components/tooltip/tooltip.js.map +1 -1
  74. package/dist/collection/utils/date-utils.js +4 -2
  75. package/dist/collection/utils/date-utils.js.map +1 -1
  76. package/dist/collection/utils/testing/index.js +15 -8
  77. package/dist/collection/utils/testing/index.js.map +1 -1
  78. package/dist/components/datalist.js +3 -3
  79. package/dist/components/datalist.js.map +1 -1
  80. package/dist/components/date-picker.js +4 -2
  81. package/dist/components/date-picker.js.map +1 -1
  82. package/dist/components/dropdown.js +5 -2
  83. package/dist/components/dropdown.js.map +1 -1
  84. package/dist/components/icon-button.js +1 -1
  85. package/dist/components/icon-button.js.map +1 -1
  86. package/dist/components/icon.js.map +1 -1
  87. package/dist/components/menu.js +8 -3
  88. package/dist/components/menu.js.map +1 -1
  89. package/dist/components/nano-demo.js +21 -14
  90. package/dist/components/nano-demo.js.map +1 -1
  91. package/dist/components/nano-file-upload.js +4 -0
  92. package/dist/components/nano-file-upload.js.map +1 -1
  93. package/dist/components/nano-tab-group.js +1 -1
  94. package/dist/components/nano-tab-group.js.map +1 -1
  95. package/dist/components/nav-item.js +1 -2
  96. package/dist/components/nav-item.js.map +1 -1
  97. package/dist/components/resize-observe.js +80 -14
  98. package/dist/components/resize-observe.js.map +1 -1
  99. package/dist/components/sticker.js +2 -0
  100. package/dist/components/sticker.js.map +1 -1
  101. package/dist/components/table.js +196 -103
  102. package/dist/components/table.js.map +1 -1
  103. package/dist/components/table.worker.js +1 -1
  104. package/dist/components/tooltip.js +6 -3
  105. package/dist/components/tooltip.js.map +1 -1
  106. package/dist/custom-elements/index.js +285 -120
  107. package/dist/custom-elements/index.js.map +1 -1
  108. package/dist/esm/{date-utils-bb82b123.js → date-utils-6b7a6e1f.js} +5 -3
  109. package/dist/esm/date-utils-6b7a6e1f.js.map +1 -0
  110. package/dist/esm/index-3c280603.js +2 -6
  111. package/dist/esm/loader.js +1 -1
  112. package/dist/esm/nano-components.js +1 -1
  113. package/dist/esm/nano-datalist_3.entry.js +10 -5
  114. package/dist/esm/nano-datalist_3.entry.js.map +1 -1
  115. package/dist/esm/nano-date-input.entry.js +1 -1
  116. package/dist/esm/nano-date-picker.entry.js +1 -1
  117. package/dist/esm/nano-demo.entry.js +3 -2
  118. package/dist/esm/nano-demo.entry.js.map +1 -1
  119. package/dist/esm/nano-dropdown.entry.js +5 -2
  120. package/dist/esm/nano-dropdown.entry.js.map +1 -1
  121. package/dist/esm/nano-file-upload.entry.js +4 -0
  122. package/dist/esm/nano-file-upload.entry.js.map +1 -1
  123. package/dist/esm/nano-global-nav-user-profile_3.entry.js +1 -2
  124. package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
  125. package/dist/esm/nano-icon-button.entry.js +1 -1
  126. package/dist/esm/nano-icon-button.entry.js.map +1 -1
  127. package/dist/esm/nano-icon.entry.js.map +1 -1
  128. package/dist/esm/{nano-tooltip.entry.js → nano-progress-bar_2.entry.js} +29 -6
  129. package/dist/esm/nano-progress-bar_2.entry.js.map +1 -0
  130. package/dist/esm/nano-resize-observe_2.entry.js +74 -12
  131. package/dist/esm/nano-resize-observe_2.entry.js.map +1 -1
  132. package/dist/esm/nano-sticker.entry.js +2 -0
  133. package/dist/esm/nano-sticker.entry.js.map +1 -1
  134. package/dist/esm/nano-tab-group.entry.js +1 -1
  135. package/dist/esm/nano-tab-group.entry.js.map +1 -1
  136. package/dist/esm/{nano-table-95921f46.js → nano-table-38f3c797.js} +172 -88
  137. package/dist/esm/nano-table-38f3c797.js.map +1 -0
  138. package/dist/esm/nano-table.entry.js +1 -1
  139. package/dist/{nano-components/p-e9fb087e.js → esm/table.worker-e2f9ccfa.js} +1 -1
  140. package/dist/esm/{table.worker-769f1441.js → table.worker-e57fffd8.js} +3 -3
  141. package/dist/esm/table.worker-e57fffd8.js.map +1 -0
  142. package/dist/nano-components/nano-components.esm.js +1 -1
  143. package/dist/nano-components/nano-components.esm.js.map +1 -1
  144. package/dist/nano-components/p-0b29b22c.js +5 -0
  145. package/dist/nano-components/{p-26905bca.js.map → p-0b29b22c.js.map} +0 -0
  146. package/dist/nano-components/p-135fed16.entry.js +5 -0
  147. package/dist/nano-components/p-135fed16.entry.js.map +1 -0
  148. package/dist/nano-components/{p-2cb4615b.entry.js → p-2a97ef51.entry.js} +2 -2
  149. package/dist/nano-components/{p-2cb4615b.entry.js.map → p-2a97ef51.entry.js.map} +0 -0
  150. package/dist/nano-components/{p-751927d1.entry.js → p-3f25fc76.entry.js} +2 -2
  151. package/dist/nano-components/p-3f25fc76.entry.js.map +1 -0
  152. package/dist/nano-components/p-5d149792.entry.js +5 -0
  153. package/dist/nano-components/p-5d149792.entry.js.map +1 -0
  154. package/dist/nano-components/p-69e5a37d.entry.js.map +1 -1
  155. package/dist/nano-components/p-6ad194e4.entry.js +5 -0
  156. package/dist/nano-components/p-6ad194e4.entry.js.map +1 -0
  157. package/dist/nano-components/{p-46b348b7.entry.js → p-6cb77d5c.entry.js} +2 -2
  158. package/dist/nano-components/{p-46b348b7.entry.js.map → p-6cb77d5c.entry.js.map} +0 -0
  159. package/dist/nano-components/{p-85cfb0af.entry.js → p-9a4297e1.entry.js} +2 -2
  160. package/dist/nano-components/p-9a4297e1.entry.js.map +1 -0
  161. package/dist/nano-components/{p-d1c8eca4.entry.js → p-b55ffa92.entry.js} +2 -2
  162. package/dist/nano-components/p-b55ffa92.entry.js.map +1 -0
  163. package/dist/nano-components/{p-fb12a45d.entry.js → p-ba9cd047.entry.js} +2 -2
  164. package/dist/nano-components/{p-fb12a45d.entry.js.map → p-ba9cd047.entry.js.map} +0 -0
  165. package/dist/nano-components/p-cc5e7acb.entry.js +5 -0
  166. package/dist/nano-components/p-cc5e7acb.entry.js.map +1 -0
  167. package/dist/nano-components/p-cecb9af1.js +5 -0
  168. package/dist/nano-components/p-cecb9af1.js.map +1 -0
  169. package/dist/nano-components/p-d26b97d1.js +5 -0
  170. package/dist/nano-components/p-d26b97d1.js.map +1 -0
  171. package/dist/nano-components/{p-601e18d5.entry.js → p-d5303933.entry.js} +2 -2
  172. package/dist/nano-components/p-d5303933.entry.js.map +1 -0
  173. package/dist/nano-components/{p-4f0e14b5.entry.js → p-d565991d.entry.js} +2 -2
  174. package/dist/nano-components/p-d565991d.entry.js.map +1 -0
  175. package/dist/nano-components/{p-244223f0.entry.js → p-dc50b93c.entry.js} +2 -2
  176. package/dist/nano-components/p-dc50b93c.entry.js.map +1 -0
  177. package/dist/{cjs/table.worker-e9fb087e.js → nano-components/p-e2f9ccfa.js} +1 -1
  178. package/dist/types/components/icon/icon.d.ts +1 -1
  179. package/dist/types/components/menu/menu.d.ts +1 -0
  180. package/dist/types/components/resize-observe/resize-observe.d.ts +20 -1
  181. package/dist/types/components/table/table-interface.d.ts +35 -24
  182. package/dist/types/components/table/table.cell.d.ts +1 -1
  183. package/dist/types/components/table/table.d.ts +49 -15
  184. package/dist/types/components/table/table.row.d.ts +1 -1
  185. package/dist/types/components/table/table.store.d.ts +1 -1
  186. package/dist/types/components/table/table.utils.d.ts +1 -1
  187. package/dist/types/components/table/table.worker.d.ts +3 -3
  188. package/dist/types/components/tooltip/tooltip.d.ts +5 -0
  189. package/dist/types/components.d.ts +59 -14
  190. package/dist/types/utils/date-utils.d.ts +1 -1
  191. package/docs-json.json +179 -31
  192. package/docs-vscode.json +26 -3
  193. package/package.json +2 -2
  194. package/dist/cjs/date-utils-c581f187.js.map +0 -1
  195. package/dist/cjs/nano-progress-bar.cjs.entry.js +0 -33
  196. package/dist/cjs/nano-progress-bar.cjs.entry.js.map +0 -1
  197. package/dist/cjs/nano-table-067e0c12.js.map +0 -1
  198. package/dist/cjs/nano-tooltip.cjs.entry.js.map +0 -1
  199. package/dist/cjs/table.worker-a4d75c46.js.map +0 -1
  200. package/dist/esm/date-utils-bb82b123.js.map +0 -1
  201. package/dist/esm/nano-progress-bar.entry.js +0 -29
  202. package/dist/esm/nano-progress-bar.entry.js.map +0 -1
  203. package/dist/esm/nano-table-95921f46.js.map +0 -1
  204. package/dist/esm/nano-tooltip.entry.js.map +0 -1
  205. package/dist/esm/table.worker-769f1441.js.map +0 -1
  206. package/dist/nano-components/p-15a60f7e.js +0 -5
  207. package/dist/nano-components/p-15a60f7e.js.map +0 -1
  208. package/dist/nano-components/p-244223f0.entry.js.map +0 -1
  209. package/dist/nano-components/p-26905bca.js +0 -5
  210. package/dist/nano-components/p-4f0e14b5.entry.js.map +0 -1
  211. package/dist/nano-components/p-601e18d5.entry.js.map +0 -1
  212. package/dist/nano-components/p-751927d1.entry.js.map +0 -1
  213. package/dist/nano-components/p-85cfb0af.entry.js.map +0 -1
  214. package/dist/nano-components/p-8fc2a38d.js +0 -5
  215. package/dist/nano-components/p-8fc2a38d.js.map +0 -1
  216. package/dist/nano-components/p-9e8c9bac.entry.js +0 -5
  217. package/dist/nano-components/p-9e8c9bac.entry.js.map +0 -1
  218. package/dist/nano-components/p-a2e38472.entry.js +0 -5
  219. package/dist/nano-components/p-a2e38472.entry.js.map +0 -1
  220. package/dist/nano-components/p-b9c8b99f.entry.js +0 -5
  221. package/dist/nano-components/p-b9c8b99f.entry.js.map +0 -1
  222. package/dist/nano-components/p-d1c8eca4.entry.js.map +0 -1
  223. package/dist/nano-components/p-f43d1d8e.entry.js +0 -5
  224. package/dist/nano-components/p-f43d1d8e.entry.js.map +0 -1
  225. package/dist/nano-components/p-feb9f164.entry.js +0 -5
  226. package/dist/nano-components/p-feb9f164.entry.js.map +0 -1
@@ -4,8 +4,14 @@
4
4
  import { h, Host, readTask, } from '@stencil/core';
5
5
  /**
6
6
  * A Resize-Observer utility component.
7
- * Takes a string list of sizes and optional class-names. Adds class-names and fires `nanoResizeStateChange` events when the component reaches those sizes.
7
+ * Takes a string list of sizes and optional class-names.
8
+ * Adds class-names and fires `nanoResizeStateChange` events when the component reaches those sizes.
9
+ * Additionally, can fire events when content no-longer fits within the element.
8
10
  * @slot - Main slot for any content.
11
+ * @slot content-fit-x - optional slot (when `notifyContentFit` is set). Shows when content fits / doesn't get cut off
12
+ * @slot content-nofit-x - optional slot (when `notifyContentFit` is set). Shows when content doesn't get cut off
13
+ * @slot content-fit-y - optional slot (when `notifyContentFit` is set). Shows when content fits / doesn't get cut off
14
+ * @slot content-nofit-y - optional slot (when `notifyContentFit` is set). Shows when content doesn't get cut off
9
15
  */
10
16
  export class ResizeObserve {
11
17
  constructor() {
@@ -13,6 +19,9 @@ export class ResizeObserve {
13
19
  this.assessChanges = () => {
14
20
  if (!this.currentWidth && !this.currentHeight)
15
21
  return;
22
+ readTask(() => this.assesContentFit());
23
+ if (!this.states || !this.appliedStates)
24
+ return;
16
25
  const changedStates = { h: new Map(), w: new Map() };
17
26
  let hasChanged = false;
18
27
  Object.keys(this.appliedStates).forEach((dimType) => {
@@ -42,6 +51,9 @@ export class ResizeObserve {
42
51
  this.currentWidth = undefined;
43
52
  this.currentHeight = undefined;
44
53
  this.classNames = [];
54
+ this.contentFitX = null;
55
+ this.contentFitY = null;
56
+ this.notifyContentFit = undefined;
45
57
  this.states = undefined;
46
58
  }
47
59
  classNameChange() {
@@ -57,8 +69,6 @@ export class ResizeObserve {
57
69
  statesChanged() {
58
70
  if (!this.states)
59
71
  return;
60
- if (!this.ro)
61
- this.attachRO();
62
72
  const toBpDir = (bpDir) => {
63
73
  const bpDirSpl = bpDir.split(/(\d+)/).filter((bs) => bs.length);
64
74
  return { bp: parseInt(bpDirSpl[0]), dir: bpDirSpl[1] };
@@ -81,7 +91,59 @@ export class ResizeObserve {
81
91
  }
82
92
  });
83
93
  }
94
+ assesContentFit() {
95
+ if (!this.notifyContentFit)
96
+ return;
97
+ const findNonContentsEle = (ele) => {
98
+ if (window.getComputedStyle(ele).display !== 'contents')
99
+ return ele;
100
+ const recurse = (e) => {
101
+ return Array.from(e.children).find((cEle) => {
102
+ if (window.getComputedStyle(cEle).display !== 'contents')
103
+ return cEle;
104
+ recurse(cEle);
105
+ });
106
+ };
107
+ return recurse(ele);
108
+ };
109
+ let didChange = false;
110
+ const measureEle = findNonContentsEle(this.host.firstElementChild);
111
+ if (measureEle) {
112
+ if (this.notifyContentFit?.includes('x')) {
113
+ if (this.currentWidth < measureEle.scrollWidth &&
114
+ this.contentFitX !== false) {
115
+ didChange = true;
116
+ this.contentFitX = false;
117
+ }
118
+ else if (this.currentWidth >= measureEle.scrollWidth &&
119
+ this.contentFitX !== true) {
120
+ didChange = true;
121
+ this.contentFitX = true;
122
+ }
123
+ }
124
+ if (this.notifyContentFit?.includes('y')) {
125
+ if (this.currentHeight < measureEle.scrollHeight &&
126
+ this.contentFitY !== false) {
127
+ didChange = true;
128
+ this.contentFitY = false;
129
+ }
130
+ else if (this.currentHeight >= measureEle.scrollHeight &&
131
+ this.contentFitY !== true) {
132
+ didChange = true;
133
+ this.contentFitY = true;
134
+ }
135
+ }
136
+ if (didChange) {
137
+ this.nanoResizeContentFitChange.emit({
138
+ x: this.contentFitX,
139
+ y: this.contentFitY,
140
+ });
141
+ }
142
+ }
143
+ }
84
144
  applyChanges(changes) {
145
+ if (!this.states)
146
+ return;
85
147
  let classNames = [...this.classNames];
86
148
  Object.keys(changes).forEach((dimType) => {
87
149
  changes[dimType].forEach((state) => {
@@ -112,40 +174,65 @@ export class ResizeObserve {
112
174
  return retObj;
113
175
  }
114
176
  attachRO() {
115
- this.ro = new ResizeObserver((entries) => {
116
- for (const entry of entries) {
117
- this.currentWidth = entry.contentRect.width;
118
- this.currentHeight = entry.contentRect.height;
119
- }
177
+ this.ro = new ResizeObserver(() => {
178
+ const { width, height } = this.host.getBoundingClientRect();
179
+ this.currentWidth = Math.ceil(width);
180
+ this.currentHeight = Math.ceil(height);
120
181
  });
121
182
  this.ro.observe(this.host);
122
183
  }
123
184
  componentWillLoad() {
124
185
  this.classNames = Array.from(this.host.classList);
125
- if (!this.states)
126
- return;
127
186
  if (!this.currentWidth || !this.currentHeight) {
128
187
  readTask(() => {
129
188
  const { width, height } = this.host.getBoundingClientRect();
130
- this.currentWidth = width;
131
- this.currentHeight = height;
189
+ this.currentWidth = Math.ceil(width);
190
+ this.currentHeight = Math.ceil(height);
132
191
  });
133
192
  }
134
193
  this.statesChanged();
135
194
  // set all class as 'not-' by deafult
136
195
  this.applyChanges(this.appliedStates);
137
196
  }
197
+ connectedCallback() {
198
+ if (!this.ro)
199
+ this.attachRO();
200
+ }
138
201
  disconnectedCallback() {
139
202
  if (this.ro)
140
203
  this.ro.disconnect();
141
204
  }
142
205
  render() {
143
- return (h(Host, null, h("slot", null)));
206
+ return (h(Host, null, h("slot", null), !!this.notifyContentFit &&
207
+ (this.contentFitX !== null || this.contentFitY !== null) && [
208
+ !!this.contentFitX ? (h("slot", { name: "content-fit-x" })) : (h("slot", { name: "content-nofit-x" })),
209
+ !!this.contentFitY ? (h("slot", { name: "content-fit-y" })) : (h("slot", { name: "content-nofit-y" })),
210
+ ]));
144
211
  }
145
212
  static get is() { return "nano-resize-observe"; }
213
+ static get encapsulation() { return "shadow"; }
146
214
  static get styles() { return "nano-resize-observe { display: block }"; }
147
215
  static get properties() {
148
216
  return {
217
+ "notifyContentFit": {
218
+ "type": "string",
219
+ "mutable": false,
220
+ "complexType": {
221
+ "original": "'x' | 'y' | 'xy'",
222
+ "resolved": "\"x\" | \"xy\" | \"y\"",
223
+ "references": {}
224
+ },
225
+ "required": false,
226
+ "optional": false,
227
+ "docs": {
228
+ "tags": [],
229
+ "text": "Fire `nanoResizeContentFitChange` events notifying\nwhether content currently fits or does not on the x, y or both axis'.\nAlso makes the `content-fit-...` slots available"
230
+ },
231
+ "getter": false,
232
+ "setter": false,
233
+ "attribute": "notify-content-fit",
234
+ "reflect": false
235
+ },
149
236
  "states": {
150
237
  "type": "string",
151
238
  "mutable": false,
@@ -171,7 +258,9 @@ export class ResizeObserve {
171
258
  return {
172
259
  "currentWidth": {},
173
260
  "currentHeight": {},
174
- "classNames": {}
261
+ "classNames": {},
262
+ "contentFitX": {},
263
+ "contentFitY": {}
175
264
  };
176
265
  }
177
266
  static get events() {
@@ -210,6 +299,21 @@ export class ResizeObserve {
210
299
  "resolved": "void",
211
300
  "references": {}
212
301
  }
302
+ }, {
303
+ "method": "nanoResizeContentFitChange",
304
+ "name": "nanoResizeContentFitChange",
305
+ "bubbles": true,
306
+ "cancelable": true,
307
+ "composed": true,
308
+ "docs": {
309
+ "tags": [],
310
+ "text": "Fires when the content either begins or stops to fit. Will only work when `notifyContentFit` is set."
311
+ },
312
+ "complexType": {
313
+ "original": "{\n x: boolean;\n y: boolean;\n }",
314
+ "resolved": "{ x: boolean; y: boolean; }",
315
+ "references": {}
316
+ }
213
317
  }];
214
318
  }
215
319
  static get elementRef() { return "host"; }
@@ -1 +1 @@
1
- {"version":3,"file":"resize-observe.js","sourceRoot":"","sources":["../../../src/components/resize-observe/resize-observe.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,CAAC,EACD,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,KAAK,EACL,KAAK,EAEL,KAAK,EAEL,QAAQ,GACT,MAAM,eAAe,CAAC;AAUvB;;;;GAIG;AAKH,MAAM,OAAO,aAAa;;IAGhB,YAAO,GAAG,KAAK,CAAC;IA4DhB,kBAAa,GAAG,GAAG,EAAE;MAC3B,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,aAAa;QAAE,OAAO;MACtD,MAAM,aAAa,GAAc,EAAE,CAAC,EA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AM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC5D,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;MAC9B,CAAC,CAAC,CAAC;KACJ;IACD,IAAI,CAAC,aAAa,EAAE,CAAC;IACrB,qCAAqC;IACrC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;EACxC,CAAC;EAED,oBAAoB;IAClB,IAAI,IAAI,CAAC,EAAE;MAAE,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;EACpC,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI;MACH,eAAQ,CACH,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n h,\n Prop,\n Element,\n Host,\n State,\n Watch,\n ComponentInterface,\n Event,\n EventEmitter,\n readTask,\n} from '@stencil/core';\n// import { debounce } from '../../utils/throttle';\nimport type { ResizeStateChangeEventDetail } from '../../interface';\n\ntype ResizeObserverState = { states?: string[]; applied?: boolean };\ninterface StateMaps {\n h: Map<number, ResizeObserverState>;\n w: Map<number, ResizeObserverState>;\n}\n\n/**\n * A Resize-Observer utility component.\n * Takes a string list of sizes and optional class-names. Adds class-names and fires `nanoResizeStateChange` events when the component reaches those sizes.\n * @slot - Main slot for any content.\n */\n@Component({\n tag: 'nano-resize-observe',\n styles: `nano-resize-observe { display: block }`,\n})\nexport class ResizeObserve implements ComponentInterface {\n private ro: ResizeObserver;\n private appliedStates: StateMaps;\n private isReady = false;\n\n @Element() host: HTMLNanoResizeObserveElement;\n @State() currentWidth: number;\n @State() currentHeight: number;\n @State() classNames: string[] = [];\n\n @Watch('classNames')\n classNameChange() {\n this.host.className = this.classNames.join(' ');\n if (!this.isReady && this.classNames.includes('is-ready')) {\n this.isReady = true;\n this.nanoResizeObserverReady.emit();\n }\n }\n\n /** string list of sizes and optional class-names. Adds class-names and fires nanoResizeStateChange events. Upon hitting breakpoints.\n * Format: `states=\"800w, 300h class1 class2\"` */\n @Prop() states: string;\n\n /** A resize break point is switched on or off */\n @Event() nanoResizeStateChange!: EventEmitter<ResizeStateChangeEventDetail>;\n\n /** Fires after the initial loading and assessment */\n @Event() nanoResizeObserverReady!: EventEmitter<void>;\n\n @Watch('currentHeight')\n @Watch('currentWidth')\n dimensionChanged() {\n this.assessChanges();\n }\n\n @Watch('states')\n statesChanged() {\n if (!this.states) return;\n if (!this.ro) this.attachRO();\n\n const toBpDir = (bpDir: string) => {\n const bpDirSpl = bpDir.split(/(\\d+)/).filter((bs) => bs.length);\n return { bp: parseInt(bpDirSpl[0]), dir: bpDirSpl[1] };\n };\n this.appliedStates = { h: new Map(), w: new Map() };\n\n // parse state string\n this.states.split(',').map((st) => {\n st = st.trim();\n if (st.includes(' ')) {\n const [key, ...classes] = st.split(' ');\n const { bp, dir } = toBpDir(key);\n this.appliedStates[dir as keyof StateMaps].set(bp, {\n states: classes,\n applied: false,\n });\n } else {\n const { bp, dir } = toBpDir(st);\n this.appliedStates[dir as keyof StateMaps].set(bp, { applied: false });\n }\n });\n }\n\n private assessChanges = () => {\n if (!this.currentWidth && !this.currentHeight) return;\n const changedStates: StateMaps = { h: new Map(), w: new Map() };\n let hasChanged = false;\n\n Object.keys(this.appliedStates).forEach((dimType) => {\n let dim: number;\n if (dimType === 'h') dim = this.currentHeight;\n else dim = this.currentWidth;\n\n this.appliedStates[dimType].forEach(\n (state: ResizeObserverState, bp: number) => {\n if (dim >= bp && state.applied === false) {\n state.applied = true;\n changedStates[dimType].set(bp, state);\n hasChanged = true;\n } else if (dim < bp && state.applied === true) {\n state.applied = false;\n changedStates[dimType].set(bp, state);\n hasChanged = true;\n }\n }\n );\n });\n if (hasChanged) this.applyChanges(changedStates);\n else if (!this.classNames.includes('is-ready'))\n this.classNames = ['is-ready'];\n };\n\n private applyChanges(changes: StateMaps) {\n let classNames = [...this.classNames];\n Object.keys(changes).forEach((dimType: keyof StateMaps) => {\n changes[dimType].forEach((state) => {\n if (!state.states) return;\n state.states.map((st) => {\n if (state.applied) {\n classNames.push(st);\n classNames = classNames.filter((cl) => cl !== 'not-' + st);\n } else {\n classNames.push('not-' + st);\n classNames = classNames.filter((cl) => cl !== st);\n }\n });\n });\n });\n this.classNames = ['is-ready', ...classNames];\n this.nanoResizeStateChange.emit(this.toSimpleObj(changes));\n }\n\n private toSimpleObj(stateMaps: StateMaps) {\n const retObj = {};\n Object.keys(stateMaps).forEach((dimType: keyof StateMaps) => {\n stateMaps[dimType].forEach((state: ResizeObserverState, bp: number) => {\n retObj[bp + dimType] = state.applied;\n });\n });\n return retObj;\n }\n\n private attachRO() {\n this.ro = new ResizeObserver((entries) => {\n for (const entry of entries) {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n });\n this.ro.observe(this.host);\n }\n\n componentWillLoad() {\n this.classNames = Array.from(this.host.classList);\n if (!this.states) return;\n\n if (!this.currentWidth || !this.currentHeight) {\n readTask(() => {\n const { width, height } = this.host.getBoundingClientRect();\n this.currentWidth = width;\n this.currentHeight = height;\n });\n }\n this.statesChanged();\n // set all class as 'not-' by deafult\n this.applyChanges(this.appliedStates);\n }\n\n disconnectedCallback() {\n if (this.ro) this.ro.disconnect();\n }\n\n render() {\n return (\n <Host>\n <slot />\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"resize-observe.js","sourceRoot":"","sources":["../../../src/components/resize-observe/resize-observe.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,CAAC,EACD,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,KAAK,EACL,KAAK,EAEL,KAAK,EAEL,QAAQ,GACT,MAAM,eAAe,CAAC;AASvB;;;;;;;;;;GAUG;AAMH,MAAM,OAAO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C,aAAa,CAAC,CAAC;EACxC,CAAC;EAED,iBAAiB;IACf,IAAI,CAAC,IAAI,CAAC,EAAE;MAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;EAChC,CAAC;EAED,oBAAoB;IAClB,IAAI,IAAI,CAAC,EAAE;MAAE,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;EACpC,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI;MACH,eAAQ;MACP,CAAC,CAAC,IAAI,CAAC,gBAAgB;QACtB,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,IAAI;QAC1D,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CACnB,YAAM,IAAI,EAAC,eAAe,GAAG,CAC9B,CAAC,CAAC,CAAC,CACF,YAAM,IAAI,EAAC,iBAAiB,GAAG,CAChC;QACD,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CACnB,YAAM,IAAI,EAAC,eAAe,GAAG,CAC9B,CAAC,CAAC,CAAC,CACF,YAAM,IAAI,EAAC,iBAAiB,GAAG,CAChC;OACF,CACE,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n h,\n Prop,\n Element,\n Host,\n State,\n Watch,\n ComponentInterface,\n Event,\n EventEmitter,\n readTask,\n} from '@stencil/core';\nimport type { ResizeStateChangeEventDetail } from '../../interface';\n\ntype ResizeObserverState = { states?: string[]; applied?: boolean };\ninterface StateMaps {\n h: Map<number, ResizeObserverState>;\n w: Map<number, ResizeObserverState>;\n}\n\n/**\n * A Resize-Observer utility component.\n * Takes a string list of sizes and optional class-names.\n * Adds class-names and fires `nanoResizeStateChange` events when the component reaches those sizes.\n * Additionally, can fire events when content no-longer fits within the element.\n * @slot - Main slot for any content.\n * @slot content-fit-x - optional slot (when `notifyContentFit` is set). Shows when content fits / doesn't get cut off\n * @slot content-nofit-x - optional slot (when `notifyContentFit` is set). Shows when content doesn't get cut off\n * @slot content-fit-y - optional slot (when `notifyContentFit` is set). Shows when content fits / doesn't get cut off\n * @slot content-nofit-y - optional slot (when `notifyContentFit` is set). Shows when content doesn't get cut off\n */\n@Component({\n tag: 'nano-resize-observe',\n styles: `nano-resize-observe { display: block }`,\n shadow: true,\n})\nexport class ResizeObserve implements ComponentInterface {\n private ro: ResizeObserver;\n private appliedStates: StateMaps;\n private isReady = false;\n\n @Element() host: HTMLNanoResizeObserveElement;\n @State() currentWidth: number;\n @State() currentHeight: number;\n @State() classNames: string[] = [];\n @State() contentFitX = null;\n @State() contentFitY = null;\n\n @Watch('classNames')\n classNameChange() {\n this.host.className = this.classNames.join(' ');\n if (!this.isReady && this.classNames.includes('is-ready')) {\n this.isReady = true;\n this.nanoResizeObserverReady.emit();\n }\n }\n\n /** Fire `nanoResizeContentFitChange` events notifying\n * whether content currently fits or does not on the x, y or both axis'.\n * Also makes the `content-fit-...` slots available */\n @Prop() notifyContentFit: 'x' | 'y' | 'xy';\n\n /** string list of sizes and optional class-names. Adds class-names and fires nanoResizeStateChange events. Upon hitting breakpoints.\n * Format: `states=\"800w, 300h class1 class2\"` */\n @Prop() states: string;\n\n /** A resize break point is switched on or off */\n @Event() nanoResizeStateChange!: EventEmitter<ResizeStateChangeEventDetail>;\n\n /** Fires after the initial loading and assessment */\n @Event() nanoResizeObserverReady!: EventEmitter<void>;\n\n /** Fires when the content either begins or stops to fit. Will only work when `notifyContentFit` is set. */\n @Event() nanoResizeContentFitChange!: EventEmitter<{\n x: boolean;\n y: boolean;\n }>;\n\n @Watch('currentHeight')\n @Watch('currentWidth')\n dimensionChanged() {\n this.assessChanges();\n }\n\n @Watch('states')\n statesChanged() {\n if (!this.states) return;\n\n const toBpDir = (bpDir: string) => {\n const bpDirSpl = bpDir.split(/(\\d+)/).filter((bs) => bs.length);\n return { bp: parseInt(bpDirSpl[0]), dir: bpDirSpl[1] };\n };\n this.appliedStates = { h: new Map(), w: new Map() };\n\n // parse state string\n this.states.split(',').map((st) => {\n st = st.trim();\n if (st.includes(' ')) {\n const [key, ...classes] = st.split(' ');\n const { bp, dir } = toBpDir(key);\n this.appliedStates[dir as keyof StateMaps].set(bp, {\n states: classes,\n applied: false,\n });\n } else {\n const { bp, dir } = toBpDir(st);\n this.appliedStates[dir as keyof StateMaps].set(bp, { applied: false });\n }\n });\n }\n\n private assesContentFit() {\n if (!this.notifyContentFit) return;\n\n const findNonContentsEle = (ele: Element) => {\n if (window.getComputedStyle(ele).display !== 'contents') return ele;\n\n const recurse = (e: Element): Element | null => {\n return Array.from(e.children).find((cEle: HTMLElement) => {\n if (window.getComputedStyle(cEle).display !== 'contents') return cEle;\n recurse(cEle);\n });\n };\n return recurse(ele);\n };\n\n let didChange = false;\n const measureEle = findNonContentsEle(this.host.firstElementChild);\n\n if (measureEle) {\n if (this.notifyContentFit?.includes('x')) {\n if (\n this.currentWidth < measureEle.scrollWidth &&\n this.contentFitX !== false\n ) {\n didChange = true;\n this.contentFitX = false;\n } else if (\n this.currentWidth >= measureEle.scrollWidth &&\n this.contentFitX !== true\n ) {\n didChange = true;\n this.contentFitX = true;\n }\n }\n\n if (this.notifyContentFit?.includes('y')) {\n if (\n this.currentHeight < measureEle.scrollHeight &&\n this.contentFitY !== false\n ) {\n didChange = true;\n this.contentFitY = false;\n } else if (\n this.currentHeight >= measureEle.scrollHeight &&\n this.contentFitY !== true\n ) {\n didChange = true;\n this.contentFitY = true;\n }\n }\n\n if (didChange) {\n this.nanoResizeContentFitChange.emit({\n x: this.contentFitX,\n y: this.contentFitY,\n });\n }\n }\n }\n\n private assessChanges = () => {\n if (!this.currentWidth && !this.currentHeight) return;\n readTask(() => this.assesContentFit());\n\n if (!this.states || !this.appliedStates) return;\n\n const changedStates: StateMaps = { h: new Map(), w: new Map() };\n let hasChanged = false;\n\n Object.keys(this.appliedStates).forEach((dimType) => {\n let dim: number;\n if (dimType === 'h') dim = this.currentHeight;\n else dim = this.currentWidth;\n\n this.appliedStates[dimType].forEach(\n (state: ResizeObserverState, bp: number) => {\n if (dim >= bp && state.applied === false) {\n state.applied = true;\n changedStates[dimType].set(bp, state);\n hasChanged = true;\n } else if (dim < bp && state.applied === true) {\n state.applied = false;\n changedStates[dimType].set(bp, state);\n hasChanged = true;\n }\n }\n );\n });\n if (hasChanged) this.applyChanges(changedStates);\n else if (!this.classNames.includes('is-ready'))\n this.classNames = ['is-ready'];\n };\n\n private applyChanges(changes: StateMaps) {\n if (!this.states) return;\n\n let classNames = [...this.classNames];\n Object.keys(changes).forEach((dimType: keyof StateMaps) => {\n changes[dimType].forEach((state) => {\n if (!state.states) return;\n state.states.map((st) => {\n if (state.applied) {\n classNames.push(st);\n classNames = classNames.filter((cl) => cl !== 'not-' + st);\n } else {\n classNames.push('not-' + st);\n classNames = classNames.filter((cl) => cl !== st);\n }\n });\n });\n });\n this.classNames = ['is-ready', ...classNames];\n this.nanoResizeStateChange.emit(this.toSimpleObj(changes));\n }\n\n private toSimpleObj(stateMaps: StateMaps) {\n const retObj = {};\n Object.keys(stateMaps).forEach((dimType: keyof StateMaps) => {\n stateMaps[dimType].forEach((state: ResizeObserverState, bp: number) => {\n retObj[bp + dimType] = state.applied;\n });\n });\n return retObj;\n }\n\n private attachRO() {\n this.ro = new ResizeObserver(() => {\n const { width, height } = this.host.getBoundingClientRect();\n this.currentWidth = Math.ceil(width);\n this.currentHeight = Math.ceil(height);\n });\n this.ro.observe(this.host);\n }\n\n componentWillLoad() {\n this.classNames = Array.from(this.host.classList);\n\n if (!this.currentWidth || !this.currentHeight) {\n readTask(() => {\n const { width, height } = this.host.getBoundingClientRect();\n this.currentWidth = Math.ceil(width);\n this.currentHeight = Math.ceil(height);\n });\n }\n this.statesChanged();\n // set all class as 'not-' by deafult\n this.applyChanges(this.appliedStates);\n }\n\n connectedCallback() {\n if (!this.ro) this.attachRO();\n }\n\n disconnectedCallback() {\n if (this.ro) this.ro.disconnect();\n }\n\n render() {\n return (\n <Host>\n <slot />\n {!!this.notifyContentFit &&\n (this.contentFitX !== null || this.contentFitY !== null) && [\n !!this.contentFitX ? (\n <slot name=\"content-fit-x\" />\n ) : (\n <slot name=\"content-nofit-x\" />\n ),\n !!this.contentFitY ? (\n <slot name=\"content-fit-y\" />\n ) : (\n <slot name=\"content-nofit-y\" />\n ),\n ]}\n </Host>\n );\n }\n}\n"]}
@@ -236,6 +236,8 @@ export class Sticker {
236
236
  /** A root sticker is a fixed element Or this sticker is sticking to another.
237
237
  * We need a content resize watcher to make sure we maintain a correct placeholder size in the body */
238
238
  stickerResizeListener() {
239
+ if (!this.content)
240
+ return;
239
241
  if (this.contentSizeObserver) {
240
242
  this.contentSizeObserver.disconnect();
241
243
  this.contentSizeObserver = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"sticker.js","sourceRoot":"","sources":["../../../src/components/sticker/sticker.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,OAAO,EACP,KAAK,EAEL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,SAAS,aAAa,CAAC,GAA2B;EAChD,OAAO,GAAG,YAAY,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;AACtE,CAAC;AAED,SAAS,UAAU,CAAC,GAAgB,EAAE,MAA8B;EAClE,MAAM,SAAS,GACb,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC;EACjE,OAA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UACb,MAAM,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ;UAC3C,KAAK,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ;UAC1D,IAAI,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO;SACtD,EACD,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QAElC,WAAK,KAAK,EAAC,iBAAiB,EAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;UAC7D,eAAQ,CACJ,CACF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n ComponentInterface,\n h,\n Host,\n Prop,\n State,\n Watch,\n Element,\n Event,\n EventEmitter,\n Method,\n} from '@stencil/core';\nimport { getOffset } from '../../utils/dom';\nimport { debounce } from '../../utils/throttle';\n\nfunction _getScrollTop(ele: HTMLElement | Document) {\n return ele instanceof Document ? window.pageYOffset : ele.scrollTop;\n}\n\nfunction _getOffset(ele: HTMLElement, parent: HTMLElement | Document) {\n const parentEle =\n parent instanceof Document ? document.documentElement : parent;\n return getOffset(ele, parentEle);\n}\n\ntype Positions = 'top' | 'bottom' | 'start' | 'end';\n\n/**\n * The Sticker component is a toolbox for 'sticking' items to scrolling containers.\n *\n */\n@Component({\n tag: 'nano-sticker',\n styleUrl: 'sticker.scss',\n shadow: true,\n})\nexport class Sticker implements ComponentInterface {\n private isRtl: boolean = false;\n private io: IntersectionObserver;\n private contentSizeObserver: ResizeObserver;\n private parentSizeObserver: ResizeObserver;\n private sticker: HTMLDivElement;\n private content: HTMLDivElement;\n private scrollPosCache = 0;\n private scrollPosThresholdCache = 0;\n private cacheOffset: number | { v: number; h: number } = 0;\n private slottedContent: Element[];\n private pauseResizeWatcher = false;\n private listenForScrollParent = false;\n private stickToEleInitSize?: DOMRect;\n private positions: Positions[] = [];\n private pauseHide: boolean = false;\n private hasBootstrapped = false;\n\n @Element() host: HTMLNanoStickerElement;\n\n // Internal State\n\n @State() isStuck = false;\n @State() isRootSticker = true;\n @State() hide = false;\n @State() scrollHide = false;\n @State() multiStickerHide = false;\n @State() scrollingTo = false;\n @State() quietModeIsOn = false;\n @State() stuckCounter = 0;\n @State() stickerIndex = 0;\n @State() stickToEle?: HTMLNanoStickerElement;\n @State() triggerPos: { top: number; left: number };\n @State() trigger: HTMLDivElement;\n @State() _offset: number | { v: number; h: number } = 0;\n\n // Public API\n\n /** Only applicable to root stickers. When applied the sticker will grow or shrink to the scrollParent size */\n @Prop() autoResize = true;\n\n /** Manually enable / disabled sticky behaviour */\n @Prop({ mutable: true }) isSticky = true;\n\n /** Distance the item should be stuck from the sticky edge. */\n @Prop({ mutable: true }) offset: number | { v: number; h: number } = 0;\n\n /** The edge of the scroll-parent to stick to */\n @Prop() position: 'top' | 'bottom' = 'top';\n // other opts I'd like one day. 'start' | 'end' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end'\n\n /** When applied, the sticker will hide when the scroll-parent\n * is scrolling away from the sticker's stuck position and show when scrolling toward it.\n * By default this will apply when the parent is below either the h or w dimensions */\n @Prop() quietMode: 'on' | 'off' | { h: number; w: number } = {\n h: 600,\n w: 600,\n };\n\n /** When applied stickers will hide upon new stickers being stuck to the same position */\n @Prop() hideOnNewStickers = true;\n\n /** The max width of the item to implement sticky behaviour. */\n @Prop() breakPointMax: null | number = null;\n\n /** The min width of the item to implement sticky behaviour. */\n @Prop() breakPointMin: null | number = null;\n\n /** Define which scroll element to listen & stick to.\n * By default, it will find traverse the DOM to find the closest. */\n @Prop({ mutable: true }) scrollParent?: HTMLElement | Document;\n\n /** Upon being stuck, attach the sticker to another sticker element.\n * A JS query selector that returns a <nano-sticker> */\n @Prop() stickTo: string;\n\n // Broadcasted Events\n\n /** Emitted when a sticker is stuck */\n @Event() nanoStuck!: EventEmitter<{ sticker: HTMLNanoStickerElement }>;\n\n /** Emitted when a sticker is unstuck */\n @Event() nanoUnstuck!: EventEmitter<{ sticker: HTMLNanoStickerElement }>;\n\n /** Emitted when a sticker is hidden */\n @Event() nanoHide!: EventEmitter<{ sticker: HTMLNanoStickerElement }>;\n\n /** Emitted when a sticker is showing */\n @Event() nanoShow!: EventEmitter<{ sticker: HTMLNanoStickerElement }>;\n\n // Public methods\n\n /**\n * Method to return the visibility status of the sticker\n * @returns boolean\n */\n @Method()\n async isHiding() {\n return this.hide;\n }\n\n /**\n * Method to return the stuck status of the sticker\n * @returns boolean\n */\n @Method()\n async isSticking() {\n this.shouldStick();\n return this.isStuck;\n }\n\n /** @internal */\n @Method()\n async setTriggerPos(offset: number | { v: number; h: number }) {\n return (this._offset = offset);\n }\n\n /** @internal */\n @Method()\n async getTriggerPos() {\n return this.triggerPos;\n }\n\n /** @internal */\n @Method()\n async pauseHiding(pause: boolean) {\n return (this.pauseHide = pause);\n }\n\n // Watchers\n\n /** Keep a note of trigger position. Need this to track sticker order in the DOM */\n @Watch('trigger')\n @Watch('scrollParent')\n updateTriggerOffset() {\n if (!this.trigger || !this.scrollParent || !this.listenForScrollParent)\n return;\n this.triggerPos = _getOffset(this.trigger, this.scrollParent);\n }\n\n /** A root sticker is a fixed element Or this sticker is sticking to another.\n * We need a content resize watcher to make sure we maintain a correct placeholder size in the body */\n @Watch('position')\n stickerResizeListener() {\n if (this.contentSizeObserver) {\n this.contentSizeObserver.disconnect();\n this.contentSizeObserver = undefined;\n }\n\n this.contentSizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n if (this.pauseResizeWatcher) return;\n\n if (entry.contentRect.height) {\n if (this.position === 'top')\n this.host.style.height = entry.contentRect.height + 'px';\n if (this.position === 'bottom')\n this.host.style.minHeight = entry.contentRect.height + 'px';\n }\n }\n });\n this.contentSizeObserver.observe(this.content);\n }\n\n @Watch('quietMode')\n quietModeChange() {\n if (this.quietMode === 'on')\n requestAnimationFrame(() => (this.quietModeIsOn = true));\n else if (this.quietMode === 'off')\n requestAnimationFrame(() => (this.quietModeIsOn = false));\n }\n\n /** offset is part of the public API but we also use it to manipulate trigger points */\n @Watch('offset')\n @Watch('_offset')\n setOffset() {\n this.trigger.setAttribute('style', '');\n let v: number, h: number, _v: number, _h: number;\n const sticker: HTMLElement =\n this.isRootSticker || this.stickToEle ? this.sticker : this.host;\n\n if (!sticker) return;\n\n if (typeof this.offset === 'object') ({ v, h } = this.offset);\n else v = h = this.offset;\n\n if (typeof this._offset === 'object') ({ v = _v, h = _h } = this._offset);\n else _v = _h = this._offset;\n\n const setPos = (pos: 'top' | 'bottom' | 'left' | 'right') => {\n const u = pos.match(/(top|bottom)/) ? v : h;\n setTriggetPos(pos);\n sticker.style[pos] = u + 'px';\n if (u)\n this.host.style.setProperty(\n '--hide-transform-amount',\n `(110% + ${u}px)`\n );\n else this.host.style.setProperty('--hide-transform-amount', null);\n };\n\n const setTriggetPos = (pos: 'top' | 'bottom' | 'left' | 'right') => {\n const u = pos.match(/(top|bottom)/) ? v + _v : h + _h;\n this.trigger.style[pos] = u * -1 + 'px';\n this.trigger.style.position = 'relative';\n this.trigger.style.height = '1px';\n };\n\n if (\n (this.positions.includes('start') && this.isRtl) ||\n (this.positions.includes('end') && !this.isRtl)\n )\n setPos('right');\n\n if (\n (this.positions.includes('end') && this.isRtl) ||\n (this.positions.includes('start') && !this.isRtl)\n )\n setPos('left');\n\n if (this.positions.includes('top')) setPos('top');\n if (this.positions.includes('bottom')) setPos('bottom');\n }\n\n @Watch('position')\n positionChange() {\n this.positions = this.position.split('-') as Positions[];\n this.setOffset();\n }\n\n /** If this sticker is attached to a 'master' sticker (stickToEle),\n * here we move the content of this sticker in and out accordingly */\n @Watch('isStuck')\n async stuckChange() {\n if (this.isStuck) {\n if (this.stickToEle) {\n const content = this.host.children;\n this.slottedContent = Array.from(content);\n\n this.slottedContent.forEach((child: HTMLElement) => {\n this.stickToEle.appendChild(child);\n child.style.order = this.stickerIndex + '';\n });\n\n this.nanoStuck.emit({ sticker: this.stickToEle });\n } else this.nanoStuck.emit({ sticker: this.host });\n } else {\n this.scrollHide = false;\n\n if (this.stickToEle) {\n this.slottedContent.forEach((child: HTMLElement) => {\n this.host.appendChild(child);\n child.style.order = '';\n });\n this.nanoUnstuck.emit({ sticker: this.stickToEle });\n } else this.nanoUnstuck.emit({ sticker: this.host });\n }\n }\n\n /** attach scroll listener. 'hides' stickers when scrolling away from trigger and 'shows' when scrolling toward */\n @Watch('quietModeIsOn')\n attachScrollListeners() {\n if (this.quietModeIsOn)\n this.scrollParent.addEventListener('scroll', this.onScroll, {\n passive: true,\n capture: false,\n });\n else if (this.scrollParent) {\n this.scrollParent.removeEventListener('scroll', this.onScroll);\n this.moveTrigger(true);\n }\n }\n\n /** Add / remove parent scrolling listeners. If there's stickToEle we need to remove them */\n @Watch('scrollParent')\n @Watch('stickToEle')\n handleParentEvents(_, oldParent: null | HTMLElement = null) {\n if (!this.listenForScrollParent) return;\n if (oldParent) this.manageListenersOnParent(false, oldParent);\n if (this.scrollParent) this.manageListenersOnParent(!this.stickToEle);\n }\n\n /** Add remove specific listeners if we're sticking to a sticker.\n * We need to adjust triggers according to the status of the 'master' */\n @Watch('stickToEle')\n stickToEleChange(_, oldEle: null | HTMLNanoStickerElement) {\n if (this.stickToEle) {\n this.stickToEle.addEventListener('nanoHide', this.onStickToDisplayEvent);\n this.stickToEle.addEventListener('nanoShow', this.onStickToDisplayEvent);\n this.stickToEle.addEventListener('nanoStuck', this.onStickToDisplayEvent);\n this.stickToEle.addEventListener(\n 'nanoUnstuck',\n this.onStickToDisplayEvent\n );\n }\n if (oldEle) {\n oldEle.removeEventListener('nanoHide', this.onStickToDisplayEvent);\n oldEle.removeEventListener('nanoShow', this.onStickToDisplayEvent);\n oldEle.removeEventListener('nanoStuck', this.onStickToDisplayEvent);\n oldEle.removeEventListener('nanoUnstuck', this.onStickToDisplayEvent);\n }\n }\n\n /** Find and set the stickToEle from the public, selector string */\n @Watch('stickTo')\n stickToChange() {\n if (this.stickTo)\n this.stickToEle = this.scrollParent.querySelector(this.stickTo);\n else this.stickToEle = undefined;\n }\n\n /** 2 potential criteria for hiding. Multi-stickers or quietmode. */\n @Watch('multiStickerHide')\n @Watch('scrollHide')\n visibilityDecisionHandler() {\n if (this.multiStickerHide || this.scrollHide) this.hide = true;\n else this.hide = false;\n }\n\n @Watch('hide')\n handleHideChange() {\n if (this.hide) this.nanoHide.emit({ sticker: this.host });\n else this.nanoShow.emit({ sticker: this.host });\n }\n\n @Watch('scrollParent')\n setupIO() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n if (!this.scrollParent || !this.hasBootstrapped || !this.trigger) return;\n\n this.isRootSticker = this.scrollParent instanceof Document;\n let root = this.scrollParent;\n if (this.scrollParent instanceof Document) root = null;\n\n this.io = new window.IntersectionObserver(\n (_) => {\n if (this.pauseResizeWatcher || !this.isSticky) return;\n this.shouldStick(_.slice(-1)[0]);\n },\n { root: root as HTMLElement }\n );\n\n this.io.observe(this.trigger);\n }\n\n // Private methods / handlers\n\n /** Assesses the public API quitemode and works out if it should be applied atm.\n * If 'smallscreen', or there is a breakpointmax / min it will add a resizeobserver to conditionally add behaviour */\n private setupParentResizeListener = () => {\n if (this.parentSizeObserver) {\n this.parentSizeObserver.disconnect();\n this.parentSizeObserver = undefined;\n }\n\n this.parentSizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n let height: number, width: number;\n if (entry.contentRect.height) height = entry.contentRect.height;\n if (entry.contentRect.width) width = entry.contentRect.width;\n\n if (typeof this.quietMode === 'object') {\n if (width < this.quietMode.w || height < this.quietMode.h)\n this.quietModeIsOn = true;\n else this.quietModeIsOn = false;\n }\n\n if (this.breakPointMin) {\n if (width > this.breakPointMin) this.isSticky = true;\n else this.isSticky = false;\n }\n\n if (this.breakPointMax) {\n if (width < this.breakPointMax) this.isSticky = true;\n else this.isSticky = false;\n }\n\n if (this.isRootSticker && this.sticker && this.autoResize)\n this.sticker.style.width = this.host.scrollWidth + 'px';\n }\n });\n\n const toWatch =\n this.scrollParent instanceof Document\n ? this.scrollParent.documentElement\n : this.scrollParent;\n if (toWatch) this.parentSizeObserver.observe(toWatch);\n };\n\n /** For stickTo stickers. We listen to the events from the 'master' sticker to ammend the hide/show trigger\n * Main diffs from rootstickers / non is height being on 'master' */\n private onStickToDisplayEvent = (\n e: CustomEvent<{ sticker: HTMLNanoStickerElement }>\n ) => {\n if (e.detail.sticker !== this.stickToEle) return;\n\n switch (e.type) {\n case 'nanoHide':\n this._offset = 0;\n this.cacheOffset = this.offset;\n this.offset = 0;\n /** trigger moves down, underneath sticker if the main sticker hides */\n if (!this.isStuck) this.moveTrigger(false);\n\n /** If it's an actual 'position: sticky' element, we need to give the sticker an appropriate height.\n * This minimises content jumping around as items are added */\n if (!this.isRootSticker && this.quietModeIsOn) {\n requestAnimationFrame(() => {\n this.stickToEle.style.minHeight =\n this.stickToEleInitSize.height +\n (this.host.scrollHeight +\n (typeof this.cacheOffset === 'object'\n ? this.cacheOffset.v\n : this.cacheOffset)) +\n 'px';\n this.stickToEle.setTriggerPos(this.stickToEleInitSize.height * -1);\n });\n }\n break;\n case 'nanoShow':\n this._offset = this.stickToEleInitSize.height;\n this.offset = this.cacheOffset;\n this.moveTrigger(true);\n\n /** reset master sticker size */\n if (!this.isRootSticker && this.quietModeIsOn) {\n requestAnimationFrame(() => {\n this.stickToEle.style.minHeight = '';\n this.stickToEle.setTriggerPos(0);\n });\n }\n break;\n case 'nanoStuck':\n this.stickToEleInitSize = this.stickToEle.getBoundingClientRect();\n this._offset = this.stickToEleInitSize.height;\n break;\n }\n };\n\n /** Add or removes event listeners / observers on scrolling parent\n * for when the scrolling parent changes, or, this sticker is sticking to another */\n private manageListenersOnParent(\n addEvents: boolean,\n ele?: HTMLElement | Document\n ) {\n const scrollParent = ele || this.scrollParent;\n\n if (!scrollParent) return;\n\n if (!addEvents) {\n try {\n if (this.quietModeIsOn)\n scrollParent.removeEventListener('scroll', this.onScroll);\n scrollParent.removeEventListener('nanoStuck', this.onStickEvent);\n scrollParent.removeEventListener('nanoUnstuck', this.onStickEvent);\n } catch (e) {\n console.error('Events haven`t been added');\n }\n } else {\n scrollParent.addEventListener('nanoStuck', this.onStickEvent);\n scrollParent.addEventListener('nanoUnstuck', this.onStickEvent);\n\n if (this.quietModeIsOn) this.attachScrollListeners();\n }\n this.setupParentResizeListener();\n }\n\n /** Handler applied to scrolling parent. When 'hideOnNewStickers' is true, hide this sticker on subsequent stuck stickers. */\n private onStickEvent = async (\n e: CustomEvent<{ sticker: HTMLNanoStickerElement }>\n ) => {\n const sticker = e.detail ? e.detail.sticker : null;\n if (!sticker || sticker.position !== this.position) return;\n\n const incomingTriggerPos = await sticker.getTriggerPos();\n\n if (\n e.type === 'nanoStuck' &&\n sticker !== this.host &&\n sticker.scrollParent === this.host.scrollParent\n ) {\n this.stickerIndex++;\n\n if (!this.hideOnNewStickers) return;\n\n if (\n (this.positions.includes('top') &&\n this.triggerPos.top < incomingTriggerPos.top) ||\n (this.positions.includes('bottom') &&\n this.triggerPos.top > incomingTriggerPos.top)\n ) {\n this.multiStickerHide = true;\n this.stuckCounter++;\n }\n }\n\n if (\n e.type === 'nanoUnstuck' &&\n sticker !== this.host &&\n sticker.scrollParent === this.host.scrollParent\n ) {\n this.stickerIndex--;\n\n if (!this.hideOnNewStickers) return;\n\n if (\n (this.positions.includes('top') &&\n this.triggerPos.top < incomingTriggerPos.top) ||\n (this.positions.includes('bottom') &&\n this.triggerPos.top > incomingTriggerPos.top)\n ) {\n this.stuckCounter--;\n if (this.stuckCounter < 1) this.multiStickerHide = false;\n }\n }\n };\n\n /** Scroll handler applied to scrolling parent. Only applied when quietmode is on.\n * 'hides' stickers when scrolling over 100px away from trigger and 'shows' when scrolling toward */\n private onScroll = () => {\n const y: number = _getScrollTop(this.scrollParent);\n\n // scrolling up\n if (y < this.scrollPosCache) {\n if (!this.positions.includes('bottom')) this.handleScrollTo();\n else this.handleScrollAway(y);\n }\n\n // scrolling down\n if (y > this.scrollPosCache) {\n if (!this.positions.includes('bottom')) this.handleScrollAway(y);\n else this.handleScrollTo();\n }\n this.scrollPosCache = y;\n };\n\n /** Watch for scroll direction. Only applies when quietmode is on.\n * We need to addjust the position of the trigger when the sticker is hidden */\n private handleScrollTo() {\n this.scrollPosThresholdCache = null;\n if (!this.scrollHide) return;\n\n if (this.scrollingTo !== true) {\n this._offset = this.cacheOffset || this._offset;\n }\n this.scrollingTo = true;\n this.scrollHide = false;\n }\n\n private handleScrollAway(currScroll: number) {\n if (this.scrollHide) return;\n\n if (!this.isStuck) return;\n\n if (this.scrollingTo !== false) {\n this.cacheOffset = this._offset;\n this._offset = 0;\n }\n this.scrollingTo = false;\n\n if (!this.scrollPosThresholdCache)\n this.scrollPosThresholdCache = currScroll;\n else if (\n !this.pauseHide &&\n Math.abs(currScroll - this.scrollPosThresholdCache) > 100\n )\n this.scrollHide = true;\n }\n\n private moveTrigger(toInitial?: boolean) {\n if (\n (this.positions.includes('bottom') && !toInitial) ||\n (!this.positions.includes('bottom') && toInitial)\n ) {\n this.host.parentNode.insertBefore(this.trigger, this.host);\n } else\n this.host.parentNode.insertBefore(this.trigger, this.host.nextSibling);\n }\n\n /**\n * Gets the 'closest' scrolling parent\n * @returns either an element with `overflow: scroll | auto` or the parent Document\n */\n private getScrollParent(): HTMLElement | Document {\n const regex = /(auto|scroll)/;\n const parents = (_node: Node, ps: Node[]) => {\n if (_node.parentNode === null) {\n return ps;\n }\n return parents(_node.parentNode, ps.concat([_node]));\n };\n const style = (_node, prop) =>\n getComputedStyle(_node, null).getPropertyValue(prop);\n const overflow = (_node) =>\n style(_node, 'overflow') +\n style(_node, 'overflow-y') +\n style(_node, 'overflow-x');\n const scroll = (_node) => regex.test(overflow(_node));\n const docHeight = document.documentElement.getBoundingClientRect().height;\n\n const scrollParent = (_node: HTMLElement) => {\n if (!(_node instanceof HTMLElement)) return;\n\n const ps = parents(_node, []);\n return (\n ps.find(\n (ele) =>\n scroll(ele) && ele.getBoundingClientRect().height !== docHeight\n ) || document\n );\n };\n\n return scrollParent(this.host);\n }\n\n private shouldStick(data?: IntersectionObserverEntry) {\n let scrollAmt: number;\n\n if (this.positions.includes('top')) {\n if (!this.isRootSticker)\n scrollAmt = _getOffset(this.trigger, this.scrollParent).top;\n else scrollAmt = this.trigger.getBoundingClientRect().top;\n this.isStuck = scrollAmt < -1;\n } else if (this.positions.includes('bottom')) {\n scrollAmt = this.trigger.getBoundingClientRect().top;\n const parentBounding =\n data && data.rootBounds\n ? data.rootBounds\n : (this.scrollParent instanceof Document\n ? document.documentElement\n : this.scrollParent\n ).getBoundingClientRect();\n this.isStuck = scrollAmt > parentBounding.height + parentBounding.top;\n }\n }\n\n private bootstrapGurantor() {\n this.hasBootstrapped = true;\n\n this.scrollParent = this.scrollParent || this.getScrollParent();\n this.isRootSticker = this.scrollParent instanceof Document;\n\n this.trigger = this.trigger || document.createElement('div');\n this.trigger.classList.add('sticker-trigger');\n\n this.positionChange();\n this.moveTrigger(true);\n this.quietModeChange();\n\n this.listenForScrollParent = true;\n this.handleParentEvents(true);\n\n this.stickerIndex = Array.from(\n this.scrollParent.querySelectorAll('nano-sticker')\n )\n .filter(\n (sticker: HTMLNanoStickerElement) => sticker.position === this.position\n )\n .findIndex((sticker) => sticker === this.host);\n\n this.setOffset();\n this.stickerResizeListener();\n this.setupParentResizeListener();\n\n // bit of a hack ... add default 'order'. Required for 'stickTo' elements.\n this.slottedContent = Array.from(this.host.children);\n this.slottedContent.forEach((child: HTMLElement) => {\n child.style.order = this.stickerIndex + '';\n });\n\n this.updateTriggerOffset();\n this.stickToChange();\n this.setupIO();\n this.onStickToDisplayEvent = debounce(this.onStickToDisplayEvent, 50);\n }\n\n // Stencil metthods\n\n connectedCallback() {\n this.isRtl =\n this.host.dir === 'rtl' ||\n (this.host.ownerDocument as Document).dir === 'rtl';\n\n // this is all horrible.... shrug\n document.documentElement.addEventListener('nanoComponentsReady', () => {\n setTimeout((_) => this.bootstrapGurantor(), 200);\n });\n setTimeout((_) => {\n if (!this.hasBootstrapped) this.bootstrapGurantor();\n }, 1000);\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n\n if (this.parentSizeObserver) {\n this.parentSizeObserver.disconnect();\n this.parentSizeObserver = undefined;\n }\n\n this.scrollParent = null;\n this.hasBootstrapped = false;\n }\n\n render() {\n return (\n <Host\n sticky={!this.isRootSticker && !this.stickToEle && this.isSticky}\n hide={this.hide && this.isStuck}\n siblings={this.stuckCounter}\n index={this.stickerIndex}\n stuck={this.isStuck && this.isSticky}\n placed-bottom={this.positions.includes('bottom')}\n placed-top={this.positions.includes('top')}\n placed-end={this.positions.includes('end')}\n placed-start={this.positions.includes('start')}\n >\n <div\n class={{\n sticker: true,\n sticky: this.isRootSticker && this.isSticky,\n stuck: this.isStuck && this.isRootSticker && this.isSticky,\n hide: this.isRootSticker && this.hide && this.isStuck,\n }}\n ref={(div) => (this.sticker = div)}\n >\n <div class=\"sticker-content\" ref={(div) => (this.content = div)}>\n <slot />\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"sticker.js","sourceRoot":"","sources":["../../../src/components/sticker/sticker.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,OAAO,EACP,KAAK,EAEL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,SAAS,aAAa,CAAC,GAA2B;EAChD,OAAO,GAAG,YAAY,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;AACtE,CAAC;AAED,SAAS,UAAU,CAAC,GAAgB,EAAE,MAA8B;EAClE,MAAM,SAAS,GACb,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC;EACjE,OAAO,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AACnC,CAAC;AAID;;;GAGG;AAMH,MAAM,OAAO,OAAO;;IACV,UAAK,GAAY,KAAK,CAAC;IAMvB,mBAAc,GAAG,CAAC,CAAC;IACnB,4BAAuB,GAAG,CAAC,CAAC;IAC5B,gBAAW,GAAsC,CAAC,CAAC;IAEnD,uBAAkB,GAAG,KAAK,CAAC;IAC3B,0BAAqB,GAAG,KAAK,CAAC;IAE9B,cAAS,GAAgB,EAAE,CAAC;IAC5B,cAAS,GAAY,KAAK,CAAC;IAC3B,oBAAe,GAAG,KAAK,CAAC;IA8UhC,6BAA6B;IAE7B;yHACqH;IAC7G,8BAAyB,GAAG,GAAG,EAAE;MACvC,IAAI,IAAI,CAAC,kBAAkB,EAAE;QAC3B,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,CAAC;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ACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n ComponentInterface,\n h,\n Host,\n Prop,\n State,\n Watch,\n Element,\n Event,\n EventEmitter,\n Method,\n} from '@stencil/core';\nimport { getOffset } from '../../utils/dom';\nimport { debounce } from '../../utils/throttle';\n\nfunction _getScrollTop(ele: HTMLElement | Document) {\n return ele instanceof Document ? window.pageYOffset : ele.scrollTop;\n}\n\nfunction _getOffset(ele: HTMLElement, parent: HTMLElement | Document) {\n const parentEle =\n parent instanceof Document ? document.documentElement : parent;\n return getOffset(ele, parentEle);\n}\n\ntype Positions = 'top' | 'bottom' | 'start' | 'end';\n\n/**\n * The Sticker component is a toolbox for 'sticking' items to scrolling containers.\n *\n */\n@Component({\n tag: 'nano-sticker',\n styleUrl: 'sticker.scss',\n shadow: true,\n})\nexport class Sticker implements ComponentInterface {\n private isRtl: boolean = false;\n private io: IntersectionObserver;\n private contentSizeObserver: ResizeObserver;\n private parentSizeObserver: ResizeObserver;\n private sticker: HTMLDivElement;\n private content: HTMLDivElement;\n private scrollPosCache = 0;\n private scrollPosThresholdCache = 0;\n private cacheOffset: number | { v: number; h: number } = 0;\n private slottedContent: Element[];\n private pauseResizeWatcher = false;\n private listenForScrollParent = false;\n private stickToEleInitSize?: DOMRect;\n private positions: Positions[] = [];\n private pauseHide: boolean = false;\n private hasBootstrapped = false;\n\n @Element() host: HTMLNanoStickerElement;\n\n // Internal State\n\n @State() isStuck = false;\n @State() isRootSticker = true;\n @State() hide = false;\n @State() scrollHide = false;\n @State() multiStickerHide = false;\n @State() scrollingTo = false;\n @State() quietModeIsOn = false;\n @State() stuckCounter = 0;\n @State() stickerIndex = 0;\n @State() stickToEle?: HTMLNanoStickerElement;\n @State() triggerPos: { top: number; left: number };\n @State() trigger: HTMLDivElement;\n @State() _offset: number | { v: number; h: number } = 0;\n\n // Public API\n\n /** Only applicable to root stickers. When applied the sticker will grow or shrink to the scrollParent size */\n @Prop() autoResize = true;\n\n /** Manually enable / disabled sticky behaviour */\n @Prop({ mutable: true }) isSticky = true;\n\n /** Distance the item should be stuck from the sticky edge. */\n @Prop({ mutable: true }) offset: number | { v: number; h: number } = 0;\n\n /** The edge of the scroll-parent to stick to */\n @Prop() position: 'top' | 'bottom' = 'top';\n // other opts I'd like one day. 'start' | 'end' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end'\n\n /** When applied, the sticker will hide when the scroll-parent\n * is scrolling away from the sticker's stuck position and show when scrolling toward it.\n * By default this will apply when the parent is below either the h or w dimensions */\n @Prop() quietMode: 'on' | 'off' | { h: number; w: number } = {\n h: 600,\n w: 600,\n };\n\n /** When applied stickers will hide upon new stickers being stuck to the same position */\n @Prop() hideOnNewStickers = true;\n\n /** The max width of the item to implement sticky behaviour. */\n @Prop() breakPointMax: null | number = null;\n\n /** The min width of the item to implement sticky behaviour. */\n @Prop() breakPointMin: null | number = null;\n\n /** Define which scroll element to listen & stick to.\n * By default, it will find traverse the DOM to find the closest. */\n @Prop({ mutable: true }) scrollParent?: HTMLElement | Document;\n\n /** Upon being stuck, attach the sticker to another sticker element.\n * A JS query selector that returns a <nano-sticker> */\n @Prop() stickTo: string;\n\n // Broadcasted Events\n\n /** Emitted when a sticker is stuck */\n @Event() nanoStuck!: EventEmitter<{ sticker: HTMLNanoStickerElement }>;\n\n /** Emitted when a sticker is unstuck */\n @Event() nanoUnstuck!: EventEmitter<{ sticker: HTMLNanoStickerElement }>;\n\n /** Emitted when a sticker is hidden */\n @Event() nanoHide!: EventEmitter<{ sticker: HTMLNanoStickerElement }>;\n\n /** Emitted when a sticker is showing */\n @Event() nanoShow!: EventEmitter<{ sticker: HTMLNanoStickerElement }>;\n\n // Public methods\n\n /**\n * Method to return the visibility status of the sticker\n * @returns boolean\n */\n @Method()\n async isHiding() {\n return this.hide;\n }\n\n /**\n * Method to return the stuck status of the sticker\n * @returns boolean\n */\n @Method()\n async isSticking() {\n this.shouldStick();\n return this.isStuck;\n }\n\n /** @internal */\n @Method()\n async setTriggerPos(offset: number | { v: number; h: number }) {\n return (this._offset = offset);\n }\n\n /** @internal */\n @Method()\n async getTriggerPos() {\n return this.triggerPos;\n }\n\n /** @internal */\n @Method()\n async pauseHiding(pause: boolean) {\n return (this.pauseHide = pause);\n }\n\n // Watchers\n\n /** Keep a note of trigger position. Need this to track sticker order in the DOM */\n @Watch('trigger')\n @Watch('scrollParent')\n updateTriggerOffset() {\n if (!this.trigger || !this.scrollParent || !this.listenForScrollParent)\n return;\n this.triggerPos = _getOffset(this.trigger, this.scrollParent);\n }\n\n /** A root sticker is a fixed element Or this sticker is sticking to another.\n * We need a content resize watcher to make sure we maintain a correct placeholder size in the body */\n @Watch('position')\n stickerResizeListener() {\n if (!this.content) return;\n\n if (this.contentSizeObserver) {\n this.contentSizeObserver.disconnect();\n this.contentSizeObserver = undefined;\n }\n\n this.contentSizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n if (this.pauseResizeWatcher) return;\n\n if (entry.contentRect.height) {\n if (this.position === 'top')\n this.host.style.height = entry.contentRect.height + 'px';\n if (this.position === 'bottom')\n this.host.style.minHeight = entry.contentRect.height + 'px';\n }\n }\n });\n this.contentSizeObserver.observe(this.content);\n }\n\n @Watch('quietMode')\n quietModeChange() {\n if (this.quietMode === 'on')\n requestAnimationFrame(() => (this.quietModeIsOn = true));\n else if (this.quietMode === 'off')\n requestAnimationFrame(() => (this.quietModeIsOn = false));\n }\n\n /** offset is part of the public API but we also use it to manipulate trigger points */\n @Watch('offset')\n @Watch('_offset')\n setOffset() {\n this.trigger.setAttribute('style', '');\n let v: number, h: number, _v: number, _h: number;\n const sticker: HTMLElement =\n this.isRootSticker || this.stickToEle ? this.sticker : this.host;\n\n if (!sticker) return;\n\n if (typeof this.offset === 'object') ({ v, h } = this.offset);\n else v = h = this.offset;\n\n if (typeof this._offset === 'object') ({ v = _v, h = _h } = this._offset);\n else _v = _h = this._offset;\n\n const setPos = (pos: 'top' | 'bottom' | 'left' | 'right') => {\n const u = pos.match(/(top|bottom)/) ? v : h;\n setTriggetPos(pos);\n sticker.style[pos] = u + 'px';\n if (u)\n this.host.style.setProperty(\n '--hide-transform-amount',\n `(110% + ${u}px)`\n );\n else this.host.style.setProperty('--hide-transform-amount', null);\n };\n\n const setTriggetPos = (pos: 'top' | 'bottom' | 'left' | 'right') => {\n const u = pos.match(/(top|bottom)/) ? v + _v : h + _h;\n this.trigger.style[pos] = u * -1 + 'px';\n this.trigger.style.position = 'relative';\n this.trigger.style.height = '1px';\n };\n\n if (\n (this.positions.includes('start') && this.isRtl) ||\n (this.positions.includes('end') && !this.isRtl)\n )\n setPos('right');\n\n if (\n (this.positions.includes('end') && this.isRtl) ||\n (this.positions.includes('start') && !this.isRtl)\n )\n setPos('left');\n\n if (this.positions.includes('top')) setPos('top');\n if (this.positions.includes('bottom')) setPos('bottom');\n }\n\n @Watch('position')\n positionChange() {\n this.positions = this.position.split('-') as Positions[];\n this.setOffset();\n }\n\n /** If this sticker is attached to a 'master' sticker (stickToEle),\n * here we move the content of this sticker in and out accordingly */\n @Watch('isStuck')\n async stuckChange() {\n if (this.isStuck) {\n if (this.stickToEle) {\n const content = this.host.children;\n this.slottedContent = Array.from(content);\n\n this.slottedContent.forEach((child: HTMLElement) => {\n this.stickToEle.appendChild(child);\n child.style.order = this.stickerIndex + '';\n });\n\n this.nanoStuck.emit({ sticker: this.stickToEle });\n } else this.nanoStuck.emit({ sticker: this.host });\n } else {\n this.scrollHide = false;\n\n if (this.stickToEle) {\n this.slottedContent.forEach((child: HTMLElement) => {\n this.host.appendChild(child);\n child.style.order = '';\n });\n this.nanoUnstuck.emit({ sticker: this.stickToEle });\n } else this.nanoUnstuck.emit({ sticker: this.host });\n }\n }\n\n /** attach scroll listener. 'hides' stickers when scrolling away from trigger and 'shows' when scrolling toward */\n @Watch('quietModeIsOn')\n attachScrollListeners() {\n if (this.quietModeIsOn)\n this.scrollParent.addEventListener('scroll', this.onScroll, {\n passive: true,\n capture: false,\n });\n else if (this.scrollParent) {\n this.scrollParent.removeEventListener('scroll', this.onScroll);\n this.moveTrigger(true);\n }\n }\n\n /** Add / remove parent scrolling listeners. If there's stickToEle we need to remove them */\n @Watch('scrollParent')\n @Watch('stickToEle')\n handleParentEvents(_, oldParent: null | HTMLElement = null) {\n if (!this.listenForScrollParent) return;\n if (oldParent) this.manageListenersOnParent(false, oldParent);\n if (this.scrollParent) this.manageListenersOnParent(!this.stickToEle);\n }\n\n /** Add remove specific listeners if we're sticking to a sticker.\n * We need to adjust triggers according to the status of the 'master' */\n @Watch('stickToEle')\n stickToEleChange(_, oldEle: null | HTMLNanoStickerElement) {\n if (this.stickToEle) {\n this.stickToEle.addEventListener('nanoHide', this.onStickToDisplayEvent);\n this.stickToEle.addEventListener('nanoShow', this.onStickToDisplayEvent);\n this.stickToEle.addEventListener('nanoStuck', this.onStickToDisplayEvent);\n this.stickToEle.addEventListener(\n 'nanoUnstuck',\n this.onStickToDisplayEvent\n );\n }\n if (oldEle) {\n oldEle.removeEventListener('nanoHide', this.onStickToDisplayEvent);\n oldEle.removeEventListener('nanoShow', this.onStickToDisplayEvent);\n oldEle.removeEventListener('nanoStuck', this.onStickToDisplayEvent);\n oldEle.removeEventListener('nanoUnstuck', this.onStickToDisplayEvent);\n }\n }\n\n /** Find and set the stickToEle from the public, selector string */\n @Watch('stickTo')\n stickToChange() {\n if (this.stickTo)\n this.stickToEle = this.scrollParent.querySelector(this.stickTo);\n else this.stickToEle = undefined;\n }\n\n /** 2 potential criteria for hiding. Multi-stickers or quietmode. */\n @Watch('multiStickerHide')\n @Watch('scrollHide')\n visibilityDecisionHandler() {\n if (this.multiStickerHide || this.scrollHide) this.hide = true;\n else this.hide = false;\n }\n\n @Watch('hide')\n handleHideChange() {\n if (this.hide) this.nanoHide.emit({ sticker: this.host });\n else this.nanoShow.emit({ sticker: this.host });\n }\n\n @Watch('scrollParent')\n setupIO() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n if (!this.scrollParent || !this.hasBootstrapped || !this.trigger) return;\n\n this.isRootSticker = this.scrollParent instanceof Document;\n let root = this.scrollParent;\n if (this.scrollParent instanceof Document) root = null;\n\n this.io = new window.IntersectionObserver(\n (_) => {\n if (this.pauseResizeWatcher || !this.isSticky) return;\n this.shouldStick(_.slice(-1)[0]);\n },\n { root: root as HTMLElement }\n );\n\n this.io.observe(this.trigger);\n }\n\n // Private methods / handlers\n\n /** Assesses the public API quitemode and works out if it should be applied atm.\n * If 'smallscreen', or there is a breakpointmax / min it will add a resizeobserver to conditionally add behaviour */\n private setupParentResizeListener = () => {\n if (this.parentSizeObserver) {\n this.parentSizeObserver.disconnect();\n this.parentSizeObserver = undefined;\n }\n\n this.parentSizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n let height: number, width: number;\n if (entry.contentRect.height) height = entry.contentRect.height;\n if (entry.contentRect.width) width = entry.contentRect.width;\n\n if (typeof this.quietMode === 'object') {\n if (width < this.quietMode.w || height < this.quietMode.h)\n this.quietModeIsOn = true;\n else this.quietModeIsOn = false;\n }\n\n if (this.breakPointMin) {\n if (width > this.breakPointMin) this.isSticky = true;\n else this.isSticky = false;\n }\n\n if (this.breakPointMax) {\n if (width < this.breakPointMax) this.isSticky = true;\n else this.isSticky = false;\n }\n\n if (this.isRootSticker && this.sticker && this.autoResize)\n this.sticker.style.width = this.host.scrollWidth + 'px';\n }\n });\n\n const toWatch =\n this.scrollParent instanceof Document\n ? this.scrollParent.documentElement\n : this.scrollParent;\n if (toWatch) this.parentSizeObserver.observe(toWatch);\n };\n\n /** For stickTo stickers. We listen to the events from the 'master' sticker to ammend the hide/show trigger\n * Main diffs from rootstickers / non is height being on 'master' */\n private onStickToDisplayEvent = (\n e: CustomEvent<{ sticker: HTMLNanoStickerElement }>\n ) => {\n if (e.detail.sticker !== this.stickToEle) return;\n\n switch (e.type) {\n case 'nanoHide':\n this._offset = 0;\n this.cacheOffset = this.offset;\n this.offset = 0;\n /** trigger moves down, underneath sticker if the main sticker hides */\n if (!this.isStuck) this.moveTrigger(false);\n\n /** If it's an actual 'position: sticky' element, we need to give the sticker an appropriate height.\n * This minimises content jumping around as items are added */\n if (!this.isRootSticker && this.quietModeIsOn) {\n requestAnimationFrame(() => {\n this.stickToEle.style.minHeight =\n this.stickToEleInitSize.height +\n (this.host.scrollHeight +\n (typeof this.cacheOffset === 'object'\n ? this.cacheOffset.v\n : this.cacheOffset)) +\n 'px';\n this.stickToEle.setTriggerPos(this.stickToEleInitSize.height * -1);\n });\n }\n break;\n case 'nanoShow':\n this._offset = this.stickToEleInitSize.height;\n this.offset = this.cacheOffset;\n this.moveTrigger(true);\n\n /** reset master sticker size */\n if (!this.isRootSticker && this.quietModeIsOn) {\n requestAnimationFrame(() => {\n this.stickToEle.style.minHeight = '';\n this.stickToEle.setTriggerPos(0);\n });\n }\n break;\n case 'nanoStuck':\n this.stickToEleInitSize = this.stickToEle.getBoundingClientRect();\n this._offset = this.stickToEleInitSize.height;\n break;\n }\n };\n\n /** Add or removes event listeners / observers on scrolling parent\n * for when the scrolling parent changes, or, this sticker is sticking to another */\n private manageListenersOnParent(\n addEvents: boolean,\n ele?: HTMLElement | Document\n ) {\n const scrollParent = ele || this.scrollParent;\n\n if (!scrollParent) return;\n\n if (!addEvents) {\n try {\n if (this.quietModeIsOn)\n scrollParent.removeEventListener('scroll', this.onScroll);\n scrollParent.removeEventListener('nanoStuck', this.onStickEvent);\n scrollParent.removeEventListener('nanoUnstuck', this.onStickEvent);\n } catch (e) {\n console.error('Events haven`t been added');\n }\n } else {\n scrollParent.addEventListener('nanoStuck', this.onStickEvent);\n scrollParent.addEventListener('nanoUnstuck', this.onStickEvent);\n\n if (this.quietModeIsOn) this.attachScrollListeners();\n }\n this.setupParentResizeListener();\n }\n\n /** Handler applied to scrolling parent. When 'hideOnNewStickers' is true, hide this sticker on subsequent stuck stickers. */\n private onStickEvent = async (\n e: CustomEvent<{ sticker: HTMLNanoStickerElement }>\n ) => {\n const sticker = e.detail ? e.detail.sticker : null;\n if (!sticker || sticker.position !== this.position) return;\n\n const incomingTriggerPos = await sticker.getTriggerPos();\n\n if (\n e.type === 'nanoStuck' &&\n sticker !== this.host &&\n sticker.scrollParent === this.host.scrollParent\n ) {\n this.stickerIndex++;\n\n if (!this.hideOnNewStickers) return;\n\n if (\n (this.positions.includes('top') &&\n this.triggerPos.top < incomingTriggerPos.top) ||\n (this.positions.includes('bottom') &&\n this.triggerPos.top > incomingTriggerPos.top)\n ) {\n this.multiStickerHide = true;\n this.stuckCounter++;\n }\n }\n\n if (\n e.type === 'nanoUnstuck' &&\n sticker !== this.host &&\n sticker.scrollParent === this.host.scrollParent\n ) {\n this.stickerIndex--;\n\n if (!this.hideOnNewStickers) return;\n\n if (\n (this.positions.includes('top') &&\n this.triggerPos.top < incomingTriggerPos.top) ||\n (this.positions.includes('bottom') &&\n this.triggerPos.top > incomingTriggerPos.top)\n ) {\n this.stuckCounter--;\n if (this.stuckCounter < 1) this.multiStickerHide = false;\n }\n }\n };\n\n /** Scroll handler applied to scrolling parent. Only applied when quietmode is on.\n * 'hides' stickers when scrolling over 100px away from trigger and 'shows' when scrolling toward */\n private onScroll = () => {\n const y: number = _getScrollTop(this.scrollParent);\n\n // scrolling up\n if (y < this.scrollPosCache) {\n if (!this.positions.includes('bottom')) this.handleScrollTo();\n else this.handleScrollAway(y);\n }\n\n // scrolling down\n if (y > this.scrollPosCache) {\n if (!this.positions.includes('bottom')) this.handleScrollAway(y);\n else this.handleScrollTo();\n }\n this.scrollPosCache = y;\n };\n\n /** Watch for scroll direction. Only applies when quietmode is on.\n * We need to addjust the position of the trigger when the sticker is hidden */\n private handleScrollTo() {\n this.scrollPosThresholdCache = null;\n if (!this.scrollHide) return;\n\n if (this.scrollingTo !== true) {\n this._offset = this.cacheOffset || this._offset;\n }\n this.scrollingTo = true;\n this.scrollHide = false;\n }\n\n private handleScrollAway(currScroll: number) {\n if (this.scrollHide) return;\n\n if (!this.isStuck) return;\n\n if (this.scrollingTo !== false) {\n this.cacheOffset = this._offset;\n this._offset = 0;\n }\n this.scrollingTo = false;\n\n if (!this.scrollPosThresholdCache)\n this.scrollPosThresholdCache = currScroll;\n else if (\n !this.pauseHide &&\n Math.abs(currScroll - this.scrollPosThresholdCache) > 100\n )\n this.scrollHide = true;\n }\n\n private moveTrigger(toInitial?: boolean) {\n if (\n (this.positions.includes('bottom') && !toInitial) ||\n (!this.positions.includes('bottom') && toInitial)\n ) {\n this.host.parentNode.insertBefore(this.trigger, this.host);\n } else\n this.host.parentNode.insertBefore(this.trigger, this.host.nextSibling);\n }\n\n /**\n * Gets the 'closest' scrolling parent\n * @returns either an element with `overflow: scroll | auto` or the parent Document\n */\n private getScrollParent(): HTMLElement | Document {\n const regex = /(auto|scroll)/;\n const parents = (_node: Node, ps: Node[]) => {\n if (_node.parentNode === null) {\n return ps;\n }\n return parents(_node.parentNode, ps.concat([_node]));\n };\n const style = (_node, prop) =>\n getComputedStyle(_node, null).getPropertyValue(prop);\n const overflow = (_node) =>\n style(_node, 'overflow') +\n style(_node, 'overflow-y') +\n style(_node, 'overflow-x');\n const scroll = (_node) => regex.test(overflow(_node));\n const docHeight = document.documentElement.getBoundingClientRect().height;\n\n const scrollParent = (_node: HTMLElement) => {\n if (!(_node instanceof HTMLElement)) return;\n\n const ps = parents(_node, []);\n return (\n ps.find(\n (ele) =>\n scroll(ele) && ele.getBoundingClientRect().height !== docHeight\n ) || document\n );\n };\n\n return scrollParent(this.host);\n }\n\n private shouldStick(data?: IntersectionObserverEntry) {\n let scrollAmt: number;\n\n if (this.positions.includes('top')) {\n if (!this.isRootSticker)\n scrollAmt = _getOffset(this.trigger, this.scrollParent).top;\n else scrollAmt = this.trigger.getBoundingClientRect().top;\n this.isStuck = scrollAmt < -1;\n } else if (this.positions.includes('bottom')) {\n scrollAmt = this.trigger.getBoundingClientRect().top;\n const parentBounding =\n data && data.rootBounds\n ? data.rootBounds\n : (this.scrollParent instanceof Document\n ? document.documentElement\n : this.scrollParent\n ).getBoundingClientRect();\n this.isStuck = scrollAmt > parentBounding.height + parentBounding.top;\n }\n }\n\n private bootstrapGurantor() {\n this.hasBootstrapped = true;\n\n this.scrollParent = this.scrollParent || this.getScrollParent();\n this.isRootSticker = this.scrollParent instanceof Document;\n\n this.trigger = this.trigger || document.createElement('div');\n this.trigger.classList.add('sticker-trigger');\n\n this.positionChange();\n this.moveTrigger(true);\n this.quietModeChange();\n\n this.listenForScrollParent = true;\n this.handleParentEvents(true);\n\n this.stickerIndex = Array.from(\n this.scrollParent.querySelectorAll('nano-sticker')\n )\n .filter(\n (sticker: HTMLNanoStickerElement) => sticker.position === this.position\n )\n .findIndex((sticker) => sticker === this.host);\n\n this.setOffset();\n this.stickerResizeListener();\n this.setupParentResizeListener();\n\n // bit of a hack ... add default 'order'. Required for 'stickTo' elements.\n this.slottedContent = Array.from(this.host.children);\n this.slottedContent.forEach((child: HTMLElement) => {\n child.style.order = this.stickerIndex + '';\n });\n\n this.updateTriggerOffset();\n this.stickToChange();\n this.setupIO();\n this.onStickToDisplayEvent = debounce(this.onStickToDisplayEvent, 50);\n }\n\n // Stencil metthods\n\n connectedCallback() {\n this.isRtl =\n this.host.dir === 'rtl' ||\n (this.host.ownerDocument as Document).dir === 'rtl';\n\n // this is all horrible.... shrug\n document.documentElement.addEventListener('nanoComponentsReady', () => {\n setTimeout((_) => this.bootstrapGurantor(), 200);\n });\n setTimeout((_) => {\n if (!this.hasBootstrapped) this.bootstrapGurantor();\n }, 1000);\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n\n if (this.parentSizeObserver) {\n this.parentSizeObserver.disconnect();\n this.parentSizeObserver = undefined;\n }\n\n this.scrollParent = null;\n this.hasBootstrapped = false;\n }\n\n render() {\n return (\n <Host\n sticky={!this.isRootSticker && !this.stickToEle && this.isSticky}\n hide={this.hide && this.isStuck}\n siblings={this.stuckCounter}\n index={this.stickerIndex}\n stuck={this.isStuck && this.isSticky}\n placed-bottom={this.positions.includes('bottom')}\n placed-top={this.positions.includes('top')}\n placed-end={this.positions.includes('end')}\n placed-start={this.positions.includes('start')}\n >\n <div\n class={{\n sticker: true,\n sticky: this.isRootSticker && this.isSticky,\n stuck: this.isStuck && this.isRootSticker && this.isSticky,\n hide: this.isRootSticker && this.hide && this.isStuck,\n }}\n ref={(div) => (this.sticker = div)}\n >\n <div class=\"sticker-content\" ref={(div) => (this.content = div)}>\n <slot />\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"table-interface.js","sourceRoot":"","sources":["../../../src/components/table/table-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type { JSXBase } from '@stencil/core/internal';\nimport type { VNode, FunctionalComponent } from '@stencil/core';\n\nexport declare namespace TableTypes {\n /** The column property */\n type ColumnProp = string | number;\n\n /** Possible positions. Horizontally means l/r. Vertically means top/bottom */\n type Position = 'start' | 'end' | 'top' | 'bottom';\n\n /** A function to assess whether a rendered row will be pinned to the top or bottom */\n type PinFunc = (props?: RowDataSchemaModel) => Position;\n\n /** Function called, via intersection observer, when an element's pinned status changes */\n type PinnedCb = (positions: { [key in Position]?: boolean }) => void;\n\n /** Potential column ordering options */\n type Order = 'asc' | 'desc' | undefined;\n\n /** Column filtering */\n interface Filter {\n prop: TableTypes.Prop;\n filter: string;\n }\n\n /** Column sorting */\n interface Sort {\n prop: TableTypes.Prop;\n order: TableTypes.Order;\n }\n\n /** Potential html properties which can be passed to a cell or column */\n type CellProps = JSXBase.ThHTMLAttributes<HTMLTableCellElement>;\n\n /** Potential html properties which can be passed to a row */\n type RowProps = JSXBase.HTMLAttributes<HTMLTableRowElement>;\n\n /** data model passed to cell rendering functions */\n interface ColumnDataSchemaModel {\n /** The column property being iterated over */\n prop: ColumnProp;\n /** The data for this cell */\n cellModel: any;\n /** The column config object */\n column: ColumnConfig;\n /** The row index currently being iterated over */\n rowIndex: number;\n /** The row model currently being iterated over */\n rowModel: any;\n }\n\n /** data model passed to row rendering functions */\n interface RowDataSchemaModel {\n /** the current data row model being iterated over */\n row?: RowData;\n /** the current data row index */\n rowIndex?: number;\n /** The row being rendered. You *must* nest this in your render function otherwise it will not be shown */\n renderedRow?: VNode;\n }\n\n /** A JSX `createElement` function passed to rendering functions.\n * You can use this to create markup outside of JSX environments\n * e.g. https://reactjs.org/docs/react-without-jsx.html */\n interface HFunc<T> {\n (tag: any): T;\n }\n interface HFunc<T> {\n (tag: any, data: any): T;\n }\n interface HFunc<T> {\n (tag: any, text: string): T;\n }\n interface HFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n }\n interface HFunc<T> {\n (sel: any, data: any, text: string): T;\n }\n interface HFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n }\n interface HFunc<T> {\n (sel: any, data: any, children: T): T;\n }\n\n /**\n * A row render function, called during a any row's render to the dom.\n * It can be used to add extra markup around any given table row\n **/\n type RowTemplateFunc<T> = (\n /** use this to create markup outside of JSX environments\n * e.g. https://reactjs.org/docs/react-without-jsx.html */\n createElement: HFunc<T>,\n /** data passed to each template */\n props: RowDataSchemaModel,\n /** a helper template to minimise boilerplate.\n * A shortcut for `<td><div class=\"nano-tbl__cell-content\"></div></td>` */\n TableCell: FunctionalComponent<{ header?: boolean }>\n ) => T | undefined;\n\n /**\n * A cell render function, called during any cell's render to the dom.\n * It can be used to add any markup within a table cell.\n */\n type CellTemplateFunc<T> = (\n createElement: HFunc<T>,\n props: ColumnDataSchemaModel\n ) => T | string | undefined;\n\n /**\n * A table header render function, called during any column's render to the dom.\n * It can be used to add any markup within a table header `th`.\n */\n type ColumnTemplateFunc<T> = (\n createElement: HFunc<T>,\n col: ColumnConfig\n ) => T | string | undefined;\n\n /** A function used to assess the order of any given column.\n * e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort\n */\n type ColSortComparator = (\n prop: keyof RowData,\n order: Order\n ) => (a: RowData, b: RowData) => number;\n\n /** A function which can be used to apply any html attribute/s onto a table cell `td` */\n type PropertiesFunc = (\n props: ColumnDataSchemaModel\n ) => CellProps | void | undefined;\n\n /** A function which can be used to apply any html attribute/s onto a table head `th` */\n type ColPropertiesFunc = (\n props: ColumnConfig\n ) => CellProps | void | undefined;\n\n /** A function which can be used to apply any html attribute/s onto a table row `tr` */\n type RowPropertiesFunc = (\n props: RowDataSchemaModel\n ) => RowProps | void | undefined;\n\n /** An individual table cell's data */\n type RowData = {\n [key: string | number]: any;\n __uuid?: string | number;\n __index?: number;\n };\n\n /** A data property */\n type Prop = keyof TableTypes.RowData;\n\n /** Valid column data types */\n type ColumnType = 'text' | 'string' | 'number' | 'date' | 'unknown';\n\n /**\n * A table column's configuration\n */\n interface ColumnConfig<T = RowData> {\n /** The title of the column. Displayed in the table header `th` */\n title: string;\n /** The row's data property to retrieve per cell render */\n prop: keyof T;\n /** The type of data. Will affect how it is sorted and the available\n * filter operations ('text' uses browser locale to compare).\n * If none supplied, it will be derived by default using the first row of data retrieved. */\n type?: ColumnType;\n /** Whether this column is horizontally pinned to viewport */\n pinned?: Position;\n /** Whether this column is a row header; the cell will render a `th` not a `td` */\n rowHeader?: boolean;\n /** Whether this column can be sorted. Defaults to true */\n sortable?: boolean;\n /** Current order of this column */\n order?: Order;\n /** Whether to include this column when doing a general search. Defaults to true */\n searchable?: boolean;\n /** Current filters applied to this column */\n filter?: string;\n /** Whether this column can be dragged to change column order */\n draggable?: boolean;\n /**\n * A cell render function, called during any cell's render to the dom.\n * It can be used to add any markup within a table cell.\n */\n cellTemplate?: CellTemplateFunc<VNode | VNode[]>;\n /** A function which can be used to apply any html attribute/s onto a table cell `td` */\n cellProperties?: PropertiesFunc;\n /**\n * A table header render function, called during any column's render to the dom.\n * It can be used to add any markup within a table header `th`.\n */\n colTemplate?: ColumnTemplateFunc<VNode | VNode[]>;\n /** A function which can be used to apply any html attribute/s onto a table head `th` */\n columnProperties?: ColPropertiesFunc;\n /** A custom sorting comparator function - assess the order of any given column.\n * e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort */\n sortCompareFn?: ColSortComparator | string;\n }\n\n /**\n * Row renderer property. Called during the rendering of any table row\n * controlling it's visual state.\n */\n interface RowRenderer {\n /** Function to decide whether the row is vertically pinned. */\n pinned?: PinFunc;\n /**\n * A row render function, called during a any row's render to the dom.\n * It can be used to add extra markup around any given table row\n **/\n template?: RowTemplateFunc<VNode | VNode[]>;\n /** A function which can be used to apply any html attribute/s onto a table row `tr` */\n rowProperties?: RowPropertiesFunc;\n }\n\n /**\n * Row renderer property. Called during the rendering of a tables head and foot\n * controlling their visual state.\n */\n interface HeadFootRenderer {\n /** Function to decide whether the row is vertically pinned. Defaults to `start` for the header and `end` the footer */\n pinned: Position;\n /**\n * A row render function, called during a any row's render to the dom.\n * It can be used to add extra markup around any given table row.\n * If used, and you want to see the rendered row, you *must* nest it within your\n * jsx function e.g. `(h, props) => { return [props.renderedRow, <tr><td>Custom thing</td></tr>]}`\n **/\n template?: RowTemplateFunc<VNode | VNode[]>;\n /** A function which can be used to apply any html attribute/s onto a table row `tr` */\n rowProperties?: () => RowProps | void | undefined;\n }\n\n type TBody = {\n rows: TableTypes.NanoTable['rows'];\n __uuid: string | number;\n };\n\n class NanoTable<T = RowData> {\n rows: T[];\n columns: ColumnConfig<T>[];\n }\n}\n"]}
1
+ {"version":3,"file":"table-interface.js","sourceRoot":"","sources":["../../../src/components/table/table-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type { JSXBase } from '@stencil/core/internal';\nimport type { VNode, FunctionalComponent } from '@stencil/core';\n\nexport declare namespace TableTypes {\n /** The column property */\n type ColumnProp = string | number;\n\n /** Possible positions. Horizontally means l/r. Vertically means top/bottom */\n type Position = 'start' | 'end' | 'top' | 'bottom';\n\n /** A function to assess whether a rendered row will be pinned to the top or bottom */\n type PinFunc = (props?: RowDataSchemaModel) => Position;\n\n /** Function called, via intersection observer, when an element's pinned status changes */\n type PinnedCb = (positions: { [key in Position]?: boolean }) => void;\n\n /** Potential column ordering options */\n type Order = 'asc' | 'desc' | undefined;\n\n /** Column filtering */\n interface Filter {\n prop: TableTypes.Prop;\n filter: string;\n }\n\n /** Column sorting */\n interface Sort {\n prop: TableTypes.Prop;\n order: TableTypes.Order;\n }\n\n /** Potential html properties which can be passed to a cell or column */\n type CellProps = JSXBase.ThHTMLAttributes<HTMLTableCellElement>;\n\n /** Potential html properties which can be passed to a row */\n type RowProps = JSXBase.HTMLAttributes<HTMLTableRowElement>;\n\n /** data model passed to cell rendering functions */\n interface RenderModel<T = RowGeneric> {\n /** The column property being iterated over */\n prop: keyof T;\n /** The data for this cell */\n cellModel: any;\n /** The column config object */\n column: ColumnConfig<T>;\n /** The row index currently being iterated over */\n rowIndex: number;\n /** The row model currently being iterated over */\n rowModel: RowData<T>;\n }\n\n /** data model passed to row rendering functions */\n interface RowDataSchemaModel<T = RowGeneric> {\n /** the current data row model being iterated over */\n rowModel?: RowData<T>;\n /** the current data row index */\n rowIndex?: number;\n /** The row being rendered. You *must* nest this in your render function otherwise it will not be shown */\n renderedRow?: VNode;\n }\n\n /** A JSX `createElement` function passed to rendering functions.\n * You can use this to create markup outside of JSX environments\n * e.g. https://reactjs.org/docs/react-without-jsx.html */\n interface HFunc<T> {\n (tag: any): T;\n }\n interface HFunc<T> {\n (tag: any, data: any): T;\n }\n interface HFunc<T> {\n (tag: any, text: string): T;\n }\n interface HFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n }\n interface HFunc<T> {\n (sel: any, data: any, text: string): T;\n }\n interface HFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n }\n interface HFunc<T> {\n (sel: any, data: any, children: T): T;\n }\n\n /**\n * A row render function, called during a any row's render to the dom.\n * It can be used to add extra markup around any given table row\n **/\n type RowTemplateFunc<T, P> = (\n /** use this to create markup outside of JSX environments\n * e.g. https://reactjs.org/docs/react-without-jsx.html */\n createElement: HFunc<T>,\n /** data passed to each template */\n props: RowDataSchemaModel<P>,\n /** a helper template to minimise boilerplate.\n * A shortcut for `<td><div class=\"nano-tbl__cell-content\"></div></td>` */\n TableCell: FunctionalComponent<{ header?: boolean }>\n ) => T | undefined;\n\n /**\n * A cell render function, called during any cell's render to the dom.\n * It can be used to add any markup within a table cell.\n */\n type CellTemplateFunc<T, P> = (\n createElement: HFunc<T>,\n props: RenderModel<P>\n ) => T | string | undefined;\n\n /**\n * A table header render function, called during any column's render to the dom.\n * It can be used to add any markup within a table header `th`.\n */\n type ColumnTemplateFunc<T, P> = (\n createElement: HFunc<T>,\n col: ColumnConfig<P>\n ) => T | string | undefined;\n\n /** A function used to assess the order of any given column.\n * e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort\n */\n type ColSortComparator = (\n prop: keyof RowData,\n order: Order\n ) => (a: RowData, b: RowData) => number;\n\n /** A function which can be used to apply any html attribute/s onto a table cell `td` */\n type PropertiesFunc = (props: RenderModel) => CellProps | void | undefined;\n\n /** A function which can be used to apply any html attribute/s onto a table head `th` */\n type ColPropertiesFunc<T> = (\n props: ColumnConfig<T>\n ) => CellProps | void | undefined;\n\n /** A function which can be used to apply any html attribute/s onto a table row `tr` */\n type RowPropertiesFunc<T> = (\n props: RowDataSchemaModel<T>\n ) => RowProps | void | undefined;\n\n type RowGeneric = { [key: string | number]: any };\n\n /** An individual table cell's data */\n type RowData<T = RowGeneric> = T & {\n __uuid?: string | number;\n __index?: number;\n };\n\n /** A data property */\n type Prop = keyof RowData;\n\n /** Valid column data types */\n type ColumnType = 'text' | 'string' | 'number' | 'date' | 'unknown';\n\n /**\n * A table column's configuration\n */\n interface ColumnConfig<T = RowData> {\n /** The title of the column. Displayed in the table header `th` */\n title: string;\n /** The row's data property to retrieve per cell render */\n prop: keyof T;\n /** The type of data. Will affect how it is sorted and the available\n * filter operations ('text' uses browser locale to compare).\n * If none supplied, it will be derived by default using the first row of data retrieved. */\n type?: ColumnType;\n /** Whether this column is horizontally pinned to viewport */\n pinned?: Position;\n /** By default cell content too wide for the cell will not wrap,\n * but rather be trimmed with '...'.\n * *Note* 'wrap' is mutually-exclusive from `autoTooltip` */\n wrap?: boolean;\n /** Setting this to true, will automatically watch content that\n * doesn't fit and duplicate it to show in a tooltip.\n * *Note* 'autoTooltip' is mutually-exclusive from `wrap` */\n autoTooltip?: boolean;\n /** Whether this column is a row header; the cell will render a `th` not a `td` */\n rowHeader?: boolean;\n /** Whether this column can be sorted. Defaults to true */\n sortable?: boolean;\n /** Current order of this column */\n order?: Order;\n /** Whether to include this column when doing a general search. Defaults to true */\n searchable?: boolean;\n /** Current filters applied to this column */\n filter?: string;\n /** Whether this column can be dragged to change column order */\n draggable?: boolean;\n /**\n * A cell render function, called during any cell's render to the dom.\n * It can be used to add any markup within a table cell.\n */\n cellTemplate?: CellTemplateFunc<VNode | VNode[], T>;\n /** A function which can be used to apply any html attribute/s onto a table cell `td` */\n cellProperties?: PropertiesFunc;\n /**\n * A table header render function, called during any column's render to the dom.\n * It can be used to add any markup within a table header `th`.\n */\n columnTemplate?: ColumnTemplateFunc<VNode | VNode[], T>;\n /** A function which can be used to apply any html attribute/s onto a table head `th` */\n columnProperties?: ColPropertiesFunc<T>;\n /** A custom sorting comparator function - assess the order of any given column.\n * e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort */\n sortCompareFn?: ColSortComparator | string;\n }\n\n /**\n * Row renderer property. Called during the rendering of any table row\n * controlling it's visual state.\n */\n interface RowRenderer<T = RowData> {\n /** Function to decide whether the row is vertically pinned. */\n pinned?: PinFunc;\n /**\n * A row render function, called during a any row's render to the dom.\n * It can be used to add extra markup around any given table row\n **/\n template?: RowTemplateFunc<VNode | VNode[], T>;\n /** A function which can be used to apply any html attribute/s onto a table row `tr` */\n rowProperties?: RowPropertiesFunc<T>;\n }\n\n /**\n * Row renderer property. Called during the rendering of a tables head and foot\n * controlling their visual state.\n */\n interface HeadFootRenderer {\n /** Function to decide whether the row is vertically pinned. Defaults to `start` for the header and `end` the footer */\n pinned: Position;\n /**\n * A row render function, called during a any row's render to the dom.\n * It can be used to add extra markup around any given table row.\n * If used, and you want to see the rendered row, you *must* nest it within your\n * jsx function e.g. `(h, props) => { return [props.renderedRow, <tr><td>Custom thing</td></tr>]}`\n **/\n template?: RowTemplateFunc<VNode | VNode[], null>;\n /** A function which can be used to apply any html attribute/s onto a table row `tr` */\n rowProperties?: () => RowProps | void | undefined;\n }\n\n type TBody = {\n rows: TableTypes.NanoTable['rows'];\n __uuid: string | number;\n };\n\n class NanoTable<T = RowGeneric> {\n rows: T[];\n columns: ColumnConfig<T>[];\n }\n\n type Falsy = false | 0 | '' | null | undefined;\n}\n"]}
@@ -25,7 +25,7 @@ export function cellRender(rowIndex, colIndex) {
25
25
  : d;
26
26
  }
27
27
  }
28
- return tpl ? (tpl(h, model)) : (h(Fragment, null, model.cellModel?.toString()));
28
+ return tpl ? (tpl(h, model)) : model.cellModel ? (h(Fragment, null, model.cellModel?.toString())) : ('');
29
29
  }
30
30
  export const baseCellClasses = (colIndex, toString = false) => {
31
31
  const store = fetchStores();
@@ -42,9 +42,9 @@ export const baseCellClasses = (colIndex, toString = false) => {
42
42
  return classes;
43
43
  };
44
44
  export const TableCell = ({ rowIndex, colIndex, nestedContent, }) => {
45
- const content = nestedContent || cellRender(rowIndex, colIndex);
46
- if (!content)
47
- return h(Fragment, null);
45
+ const Content = () => nestedContent
46
+ ? nestedContent()
47
+ : cellRender(rowIndex, colIndex) || (h("span", { class: "placeholder" }, "\u00A0"));
48
48
  let CellType = 'td';
49
49
  const store = fetchStores();
50
50
  const column = store.config.state.columns[colIndex];
@@ -58,8 +58,13 @@ export const TableCell = ({ rowIndex, colIndex, nestedContent, }) => {
58
58
  : { ...props, scope: 'row' };
59
59
  CellType = 'th';
60
60
  }
61
+ const ContentWrap = (props) => (h("div", { ...props, class: {
62
+ [`${CSSNAMESPACE}__cell-content`]: true,
63
+ [`${CSSNAMESPACE}__cell-content--wrap`]: !!column.wrap,
64
+ } }, h(Content, null)));
61
65
  return (h(CellType
62
66
  // role="gridcell"
63
- , { ...props }, h("div", { class: `${CSSNAMESPACE}__cell-content` }, content)));
67
+ , { ...props }, column.autoTooltip && !column.wrap ? (h("nano-resize-observe", { notifyContentFit: "x", onNanoResizeContentFitChange: (e) => (e.target.firstElementChild.disabled =
68
+ e.detail.x) }, h("nano-tooltip", { disabled: true, hoist: true }, h(ContentWrap, null), h("span", { slot: "content" }, h(Content, null))))) : (h(ContentWrap, null))));
64
69
  };
65
70
  //# sourceMappingURL=table.cell.js.map