smoothly 0.1.114 → 0.1.117

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 (257) hide show
  1. package/dist/cjs/{Notice-9c2b52b7.js → Notice-839702d8.js} +34 -26
  2. package/dist/cjs/{Trigger-74bd1ee8.js → Trigger-cf376531.js} +55 -146
  3. package/dist/cjs/{index-41a36ce2.js → index-1c61bdd3.js} +27 -1
  4. package/dist/cjs/index.cjs.js +20 -8
  5. package/dist/cjs/loader.cjs.js +3 -19
  6. package/dist/cjs/{smoothly-accordion_50.cjs.entry.js → smoothly-accordion_51.cjs.entry.js} +7694 -1488
  7. package/dist/cjs/smoothly-google-font.cjs.entry.js +2 -2
  8. package/dist/cjs/smoothly-radio-group.cjs.entry.js +2 -2
  9. package/dist/cjs/smoothly-reorder.cjs.entry.js +2 -2
  10. package/dist/cjs/smoothly-trigger-sink.cjs.entry.js +5 -5
  11. package/dist/cjs/smoothly-trigger-source.cjs.entry.js +5 -5
  12. package/dist/cjs/smoothly.cjs.js +5 -113
  13. package/dist/collection/collection-manifest.json +5 -4
  14. package/dist/collection/components/app/style.css +6 -7
  15. package/dist/collection/components/app-demo/index.js +6 -1
  16. package/dist/collection/components/button/index.js +168 -0
  17. package/dist/collection/components/button/style.css +49 -0
  18. package/dist/collection/components/menu-options/style.css +2 -2
  19. package/dist/collection/components/picker/index.js +10 -6
  20. package/dist/collection/components/picker/style.css +14 -14
  21. package/dist/collection/components/selector/style.css +3 -3
  22. package/dist/collection/components/tab/style.css +3 -3
  23. package/dist/collection/components/table/{exandable → expandable}/cell/index.js +0 -0
  24. package/dist/collection/components/table/{exandable → expandable}/cell/style.css +0 -0
  25. package/dist/collection/components/table/{exandable → expandable}/row/index.js +0 -0
  26. package/dist/collection/components/table/{exandable → expandable}/row/style.css +0 -0
  27. package/dist/collection/components/table/header/style.css +5 -5
  28. package/dist/collection/components/trigger/style.css +3 -3
  29. package/dist/custom-elements/index.d.ts +6 -0
  30. package/dist/custom-elements/index.js +7781 -2971
  31. package/dist/esm/{Notice-4131b4e0.js → Notice-608b552c.js} +34 -26
  32. package/dist/esm/{Trigger-d7b181ec.js → Trigger-365408f0.js} +55 -146
  33. package/dist/esm/{index-dcb2b612.js → index-a3737440.js} +27 -1
  34. package/dist/esm/index.js +17 -4
  35. package/dist/esm/loader.js +3 -19
  36. package/dist/esm/polyfills/css-shim.js +1 -1
  37. package/dist/esm/{smoothly-accordion_50.entry.js → smoothly-accordion_51.entry.js} +7694 -1489
  38. package/dist/esm/smoothly-google-font.entry.js +2 -2
  39. package/dist/esm/smoothly-radio-group.entry.js +2 -2
  40. package/dist/esm/smoothly-reorder.entry.js +2 -2
  41. package/dist/esm/smoothly-trigger-sink.entry.js +3 -3
  42. package/dist/esm/smoothly-trigger-source.entry.js +3 -3
  43. package/dist/esm/smoothly.js +5 -113
  44. package/dist/smoothly/index.esm.js +1 -376
  45. package/dist/smoothly/p-0215b4da.entry.js +1 -0
  46. package/dist/smoothly/{p-074a0448.js → p-0cba3e3d.js} +1 -1
  47. package/dist/smoothly/p-4fa231df.entry.js +1 -0
  48. package/dist/smoothly/p-6ca0d36c.js +1 -0
  49. package/dist/smoothly/p-6f009ac9.entry.js +1 -0
  50. package/dist/smoothly/p-7a30d9b8.js +1 -0
  51. package/dist/smoothly/p-8ae38136.entry.js +1 -0
  52. package/dist/smoothly/p-993534fa.entry.js +1 -0
  53. package/dist/smoothly/p-eec1c703.entry.js +1 -0
  54. package/dist/smoothly/smoothly.esm.js +1 -125
  55. package/dist/types/components/button/index.d.ts +11 -0
  56. package/dist/types/components/table/{exandable → expandable}/cell/index.d.ts +0 -0
  57. package/dist/types/components/table/{exandable → expandable}/row/index.d.ts +0 -0
  58. package/dist/types/components.d.ts +27 -0
  59. package/dist/types/stencil-public-runtime.d.ts +6 -4
  60. package/package.json +17 -17
  61. package/dist/cjs/App-339acc9b.js +0 -647
  62. package/dist/cjs/_commonjsHelpers-10109b76.js +0 -48
  63. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  64. package/dist/cjs/css-shim-88cc6900.js +0 -6
  65. package/dist/cjs/dom-95afd968.js +0 -75
  66. package/dist/cjs/generate-f9a36f25.js +0 -66
  67. package/dist/cjs/index-138c41c2.js +0 -3066
  68. package/dist/cjs/index-36da3c23.js +0 -1673
  69. package/dist/cjs/index-40d009d5.js +0 -1354
  70. package/dist/cjs/index-ac32385c.js +0 -18850
  71. package/dist/cjs/shadow-css-71d0f821.js +0 -391
  72. package/dist/cjs/smoothly-accordion-item.cjs.entry.js +0 -54
  73. package/dist/cjs/smoothly-accordion.cjs.entry.js +0 -55
  74. package/dist/cjs/smoothly-app-demo.cjs.entry.js +0 -29
  75. package/dist/cjs/smoothly-app.cjs.entry.js +0 -19
  76. package/dist/cjs/smoothly-backtotop.cjs.entry.js +0 -37
  77. package/dist/cjs/smoothly-calendar.cjs.entry.js +0 -95
  78. package/dist/cjs/smoothly-checkbox.cjs.entry.js +0 -18671
  79. package/dist/cjs/smoothly-dialog-demo.cjs.entry.js +0 -16
  80. package/dist/cjs/smoothly-dialog.cjs.entry.js +0 -38
  81. package/dist/cjs/smoothly-display-amount.cjs.entry.js +0 -59
  82. package/dist/cjs/smoothly-display-date-time.cjs.entry.js +0 -20
  83. package/dist/cjs/smoothly-display-demo.cjs.entry.js +0 -25
  84. package/dist/cjs/smoothly-display.cjs.entry.js +0 -41
  85. package/dist/cjs/smoothly-frame.cjs.entry.js +0 -50
  86. package/dist/cjs/smoothly-icon-demo.cjs.entry.js +0 -491
  87. package/dist/cjs/smoothly-icon.cjs.entry.js +0 -52
  88. package/dist/cjs/smoothly-input-date-range.cjs.entry.js +0 -50
  89. package/dist/cjs/smoothly-input-date.cjs.entry.js +0 -44
  90. package/dist/cjs/smoothly-input-demo.cjs.entry.js +0 -19
  91. package/dist/cjs/smoothly-input-month.cjs.entry.js +0 -41
  92. package/dist/cjs/smoothly-input.cjs.entry.js +0 -202
  93. package/dist/cjs/smoothly-item.cjs.entry.js +0 -43
  94. package/dist/cjs/smoothly-menu-options.cjs.entry.js +0 -108
  95. package/dist/cjs/smoothly-notification.cjs.entry.js +0 -67
  96. package/dist/cjs/smoothly-notifier.cjs.entry.js +0 -29
  97. package/dist/cjs/smoothly-option.cjs.entry.js +0 -33
  98. package/dist/cjs/smoothly-picker.cjs.entry.js +0 -151
  99. package/dist/cjs/smoothly-popup.cjs.entry.js +0 -38
  100. package/dist/cjs/smoothly-quiet.cjs.entry.js +0 -19
  101. package/dist/cjs/smoothly-radio.cjs.entry.js +0 -28
  102. package/dist/cjs/smoothly-room.cjs.entry.js +0 -16
  103. package/dist/cjs/smoothly-select-demo.cjs.entry.js +0 -86
  104. package/dist/cjs/smoothly-select.cjs.entry.js +0 -31
  105. package/dist/cjs/smoothly-selector.cjs.entry.js +0 -119
  106. package/dist/cjs/smoothly-skeleton.cjs.entry.js +0 -27
  107. package/dist/cjs/smoothly-spinner.cjs.entry.js +0 -24
  108. package/dist/cjs/smoothly-submit.cjs.entry.js +0 -60
  109. package/dist/cjs/smoothly-svg.cjs.entry.js +0 -41
  110. package/dist/cjs/smoothly-tab-switch.cjs.entry.js +0 -32
  111. package/dist/cjs/smoothly-tab.cjs.entry.js +0 -37
  112. package/dist/cjs/smoothly-table-cell.cjs.entry.js +0 -19
  113. package/dist/cjs/smoothly-table-demo.cjs.entry.js +0 -22
  114. package/dist/cjs/smoothly-table-expandable-cell.cjs.entry.js +0 -45
  115. package/dist/cjs/smoothly-table-expandable-row.cjs.entry.js +0 -32
  116. package/dist/cjs/smoothly-table-header.cjs.entry.js +0 -41
  117. package/dist/cjs/smoothly-table-row.cjs.entry.js +0 -38
  118. package/dist/cjs/smoothly-table.cjs.entry.js +0 -26
  119. package/dist/cjs/smoothly-trigger.cjs.entry.js +0 -36
  120. package/dist/cjs/smoothly-tuple.cjs.entry.js +0 -16
  121. package/dist/cjs/smoothly-urlencoded.cjs.entry.js +0 -19
  122. package/dist/esm/App-22187759.js +0 -645
  123. package/dist/esm/_commonjsHelpers-8fe71198.js +0 -44
  124. package/dist/esm/app-globals-0f993ce5.js +0 -3
  125. package/dist/esm/css-shim-c64026cd.js +0 -4
  126. package/dist/esm/dom-a712b575.js +0 -73
  127. package/dist/esm/generate-50b98474.js +0 -61
  128. package/dist/esm/index-02a70ac1.js +0 -3027
  129. package/dist/esm/index-a5a08f46.js +0 -18848
  130. package/dist/esm/index-c8b5d468.js +0 -1349
  131. package/dist/esm/index-d1360bcf.js +0 -1671
  132. package/dist/esm/shadow-css-1e16431b.js +0 -389
  133. package/dist/esm/smoothly-accordion-item.entry.js +0 -50
  134. package/dist/esm/smoothly-accordion.entry.js +0 -51
  135. package/dist/esm/smoothly-app-demo.entry.js +0 -25
  136. package/dist/esm/smoothly-app.entry.js +0 -15
  137. package/dist/esm/smoothly-backtotop.entry.js +0 -33
  138. package/dist/esm/smoothly-calendar.entry.js +0 -91
  139. package/dist/esm/smoothly-checkbox.entry.js +0 -18667
  140. package/dist/esm/smoothly-dialog-demo.entry.js +0 -12
  141. package/dist/esm/smoothly-dialog.entry.js +0 -34
  142. package/dist/esm/smoothly-display-amount.entry.js +0 -55
  143. package/dist/esm/smoothly-display-date-time.entry.js +0 -16
  144. package/dist/esm/smoothly-display-demo.entry.js +0 -21
  145. package/dist/esm/smoothly-display.entry.js +0 -37
  146. package/dist/esm/smoothly-frame.entry.js +0 -46
  147. package/dist/esm/smoothly-icon-demo.entry.js +0 -487
  148. package/dist/esm/smoothly-icon.entry.js +0 -48
  149. package/dist/esm/smoothly-input-date-range.entry.js +0 -46
  150. package/dist/esm/smoothly-input-date.entry.js +0 -40
  151. package/dist/esm/smoothly-input-demo.entry.js +0 -15
  152. package/dist/esm/smoothly-input-month.entry.js +0 -37
  153. package/dist/esm/smoothly-input.entry.js +0 -198
  154. package/dist/esm/smoothly-item.entry.js +0 -39
  155. package/dist/esm/smoothly-menu-options.entry.js +0 -104
  156. package/dist/esm/smoothly-notification.entry.js +0 -63
  157. package/dist/esm/smoothly-notifier.entry.js +0 -25
  158. package/dist/esm/smoothly-option.entry.js +0 -29
  159. package/dist/esm/smoothly-picker.entry.js +0 -147
  160. package/dist/esm/smoothly-popup.entry.js +0 -34
  161. package/dist/esm/smoothly-quiet.entry.js +0 -15
  162. package/dist/esm/smoothly-radio.entry.js +0 -24
  163. package/dist/esm/smoothly-room.entry.js +0 -12
  164. package/dist/esm/smoothly-select-demo.entry.js +0 -82
  165. package/dist/esm/smoothly-select.entry.js +0 -27
  166. package/dist/esm/smoothly-selector.entry.js +0 -115
  167. package/dist/esm/smoothly-skeleton.entry.js +0 -23
  168. package/dist/esm/smoothly-spinner.entry.js +0 -20
  169. package/dist/esm/smoothly-submit.entry.js +0 -56
  170. package/dist/esm/smoothly-svg.entry.js +0 -37
  171. package/dist/esm/smoothly-tab-switch.entry.js +0 -28
  172. package/dist/esm/smoothly-tab.entry.js +0 -33
  173. package/dist/esm/smoothly-table-cell.entry.js +0 -15
  174. package/dist/esm/smoothly-table-demo.entry.js +0 -18
  175. package/dist/esm/smoothly-table-expandable-cell.entry.js +0 -41
  176. package/dist/esm/smoothly-table-expandable-row.entry.js +0 -28
  177. package/dist/esm/smoothly-table-header.entry.js +0 -37
  178. package/dist/esm/smoothly-table-row.entry.js +0 -34
  179. package/dist/esm/smoothly-table.entry.js +0 -22
  180. package/dist/esm/smoothly-trigger.entry.js +0 -32
  181. package/dist/esm/smoothly-tuple.entry.js +0 -12
  182. package/dist/esm/smoothly-urlencoded.entry.js +0 -15
  183. package/dist/smoothly/App-22187759.js +0 -645
  184. package/dist/smoothly/GoogleFont-8474516b.js +0 -21
  185. package/dist/smoothly/_commonjsHelpers-8fe71198.js +0 -44
  186. package/dist/smoothly/app-globals-0f993ce5.js +0 -3
  187. package/dist/smoothly/css-shim-c64026cd.js +0 -4
  188. package/dist/smoothly/dom-a712b575.js +0 -73
  189. package/dist/smoothly/generate-50b98474.js +0 -61
  190. package/dist/smoothly/index-02a70ac1.js +0 -3027
  191. package/dist/smoothly/index-a5a08f46.js +0 -18848
  192. package/dist/smoothly/index-c8b5d468.js +0 -1349
  193. package/dist/smoothly/index-d1360bcf.js +0 -1671
  194. package/dist/smoothly/p-0bad2c46.entry.js +0 -1
  195. package/dist/smoothly/p-0c1e9588.entry.js +0 -1
  196. package/dist/smoothly/p-14232157.entry.js +0 -1
  197. package/dist/smoothly/p-19518931.js +0 -1
  198. package/dist/smoothly/p-22d4d5a7.entry.js +0 -1
  199. package/dist/smoothly/p-2cda1784.js +0 -1
  200. package/dist/smoothly/p-9fa3ab06.entry.js +0 -1
  201. package/dist/smoothly/p-b8a3e273.entry.js +0 -1
  202. package/dist/smoothly/shadow-css-1e16431b.js +0 -389
  203. package/dist/smoothly/smoothly-accordion-item.entry.js +0 -50
  204. package/dist/smoothly/smoothly-accordion.entry.js +0 -51
  205. package/dist/smoothly/smoothly-app-demo.entry.js +0 -25
  206. package/dist/smoothly/smoothly-app.entry.js +0 -15
  207. package/dist/smoothly/smoothly-backtotop.entry.js +0 -33
  208. package/dist/smoothly/smoothly-calendar.entry.js +0 -91
  209. package/dist/smoothly/smoothly-checkbox.entry.js +0 -18667
  210. package/dist/smoothly/smoothly-dialog-demo.entry.js +0 -12
  211. package/dist/smoothly/smoothly-dialog.entry.js +0 -34
  212. package/dist/smoothly/smoothly-display-amount.entry.js +0 -55
  213. package/dist/smoothly/smoothly-display-date-time.entry.js +0 -16
  214. package/dist/smoothly/smoothly-display-demo.entry.js +0 -21
  215. package/dist/smoothly/smoothly-display.entry.js +0 -37
  216. package/dist/smoothly/smoothly-frame.entry.js +0 -46
  217. package/dist/smoothly/smoothly-google-font.entry.js +0 -13
  218. package/dist/smoothly/smoothly-icon-demo.entry.js +0 -487
  219. package/dist/smoothly/smoothly-icon.entry.js +0 -48
  220. package/dist/smoothly/smoothly-input-date-range.entry.js +0 -46
  221. package/dist/smoothly/smoothly-input-date.entry.js +0 -40
  222. package/dist/smoothly/smoothly-input-demo.entry.js +0 -15
  223. package/dist/smoothly/smoothly-input-month.entry.js +0 -37
  224. package/dist/smoothly/smoothly-input.entry.js +0 -198
  225. package/dist/smoothly/smoothly-item.entry.js +0 -39
  226. package/dist/smoothly/smoothly-menu-options.entry.js +0 -104
  227. package/dist/smoothly/smoothly-notification.entry.js +0 -63
  228. package/dist/smoothly/smoothly-notifier.entry.js +0 -25
  229. package/dist/smoothly/smoothly-option.entry.js +0 -29
  230. package/dist/smoothly/smoothly-picker.entry.js +0 -147
  231. package/dist/smoothly/smoothly-popup.entry.js +0 -34
  232. package/dist/smoothly/smoothly-quiet.entry.js +0 -15
  233. package/dist/smoothly/smoothly-radio-group.entry.js +0 -16
  234. package/dist/smoothly/smoothly-radio.entry.js +0 -24
  235. package/dist/smoothly/smoothly-reorder.entry.js +0 -99
  236. package/dist/smoothly/smoothly-room.entry.js +0 -12
  237. package/dist/smoothly/smoothly-select-demo.entry.js +0 -82
  238. package/dist/smoothly/smoothly-select.entry.js +0 -27
  239. package/dist/smoothly/smoothly-selector.entry.js +0 -115
  240. package/dist/smoothly/smoothly-skeleton.entry.js +0 -23
  241. package/dist/smoothly/smoothly-spinner.entry.js +0 -20
  242. package/dist/smoothly/smoothly-submit.entry.js +0 -56
  243. package/dist/smoothly/smoothly-svg.entry.js +0 -37
  244. package/dist/smoothly/smoothly-tab-switch.entry.js +0 -28
  245. package/dist/smoothly/smoothly-tab.entry.js +0 -33
  246. package/dist/smoothly/smoothly-table-cell.entry.js +0 -15
  247. package/dist/smoothly/smoothly-table-demo.entry.js +0 -18
  248. package/dist/smoothly/smoothly-table-expandable-cell.entry.js +0 -41
  249. package/dist/smoothly/smoothly-table-expandable-row.entry.js +0 -28
  250. package/dist/smoothly/smoothly-table-header.entry.js +0 -37
  251. package/dist/smoothly/smoothly-table-row.entry.js +0 -34
  252. package/dist/smoothly/smoothly-table.entry.js +0 -22
  253. package/dist/smoothly/smoothly-trigger-sink.entry.js +0 -29
  254. package/dist/smoothly/smoothly-trigger-source.entry.js +0 -28
  255. package/dist/smoothly/smoothly-trigger.entry.js +0 -32
  256. package/dist/smoothly/smoothly-tuple.entry.js +0 -12
  257. package/dist/smoothly/smoothly-urlencoded.entry.js +0 -15
@@ -1,645 +0,0 @@
1
- import { g as getRenderingRef, f as forceUpdate, e as Build, h } from './index-02a70ac1.js';
2
-
3
- const appendToMap = (map, propName, value) => {
4
- const items = map.get(propName);
5
- if (!items) {
6
- map.set(propName, [value]);
7
- }
8
- else if (!items.includes(value)) {
9
- items.push(value);
10
- }
11
- };
12
- const debounce = (fn, ms) => {
13
- let timeoutId;
14
- return (...args) => {
15
- if (timeoutId) {
16
- clearTimeout(timeoutId);
17
- }
18
- timeoutId = setTimeout(() => {
19
- timeoutId = 0;
20
- fn(...args);
21
- }, ms);
22
- };
23
- };
24
-
25
- /**
26
- * Check if a possible element isConnected.
27
- * The property might not be there, so we check for it.
28
- *
29
- * We want it to return true if isConnected is not a property,
30
- * otherwise we would remove these elements and would not update.
31
- *
32
- * Better leak in Edge than to be useless.
33
- */
34
- const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
35
- const cleanupElements = debounce((map) => {
36
- for (let key of map.keys()) {
37
- map.set(key, map.get(key).filter(isConnected));
38
- }
39
- }, 2000);
40
- const stencilSubscription = ({ on }) => {
41
- const elmsToUpdate = new Map();
42
- if (typeof getRenderingRef === 'function') {
43
- // If we are not in a stencil project, we do nothing.
44
- // This function is not really exported by @stencil/core.
45
- on('dispose', () => {
46
- elmsToUpdate.clear();
47
- });
48
- on('get', (propName) => {
49
- const elm = getRenderingRef();
50
- if (elm) {
51
- appendToMap(elmsToUpdate, propName, elm);
52
- }
53
- });
54
- on('set', (propName) => {
55
- const elements = elmsToUpdate.get(propName);
56
- if (elements) {
57
- elmsToUpdate.set(propName, elements.filter(forceUpdate));
58
- }
59
- cleanupElements(elmsToUpdate);
60
- });
61
- on('reset', () => {
62
- elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
63
- cleanupElements(elmsToUpdate);
64
- });
65
- }
66
- };
67
-
68
- const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
69
- let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
70
- const handlers = {
71
- dispose: [],
72
- get: [],
73
- set: [],
74
- reset: [],
75
- };
76
- const reset = () => {
77
- states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
78
- handlers.reset.forEach((cb) => cb());
79
- };
80
- const dispose = () => {
81
- // Call first dispose as resetting the state would
82
- // cause less updates ;)
83
- handlers.dispose.forEach((cb) => cb());
84
- reset();
85
- };
86
- const get = (propName) => {
87
- handlers.get.forEach((cb) => cb(propName));
88
- return states.get(propName);
89
- };
90
- const set = (propName, value) => {
91
- const oldValue = states.get(propName);
92
- if (shouldUpdate(value, oldValue, propName)) {
93
- states.set(propName, value);
94
- handlers.set.forEach((cb) => cb(propName, value, oldValue));
95
- }
96
- };
97
- const state = (typeof Proxy === 'undefined'
98
- ? {}
99
- : new Proxy(defaultState, {
100
- get(_, propName) {
101
- return get(propName);
102
- },
103
- ownKeys(_) {
104
- return Array.from(states.keys());
105
- },
106
- getOwnPropertyDescriptor() {
107
- return {
108
- enumerable: true,
109
- configurable: true,
110
- };
111
- },
112
- has(_, propName) {
113
- return states.has(propName);
114
- },
115
- set(_, propName, value) {
116
- set(propName, value);
117
- return true;
118
- },
119
- }));
120
- const on = (eventName, callback) => {
121
- handlers[eventName].push(callback);
122
- return () => {
123
- removeFromArray(handlers[eventName], callback);
124
- };
125
- };
126
- const onChange = (propName, cb) => {
127
- const unSet = on('set', (key, newValue) => {
128
- if (key === propName) {
129
- cb(newValue);
130
- }
131
- });
132
- const unReset = on('reset', () => cb(defaultState[propName]));
133
- return () => {
134
- unSet();
135
- unReset();
136
- };
137
- };
138
- const use = (...subscriptions) => subscriptions.forEach((subscription) => {
139
- if (subscription.set) {
140
- on('set', subscription.set);
141
- }
142
- if (subscription.get) {
143
- on('get', subscription.get);
144
- }
145
- if (subscription.reset) {
146
- on('reset', subscription.reset);
147
- }
148
- });
149
- const forceUpdate = (key) => {
150
- const oldValue = states.get(key);
151
- handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
152
- };
153
- return {
154
- state,
155
- get,
156
- set,
157
- on,
158
- onChange,
159
- use,
160
- dispose,
161
- reset,
162
- forceUpdate,
163
- };
164
- };
165
- const removeFromArray = (array, item) => {
166
- const index = array.indexOf(item);
167
- if (index >= 0) {
168
- array[index] = array[array.length - 1];
169
- array.length--;
170
- }
171
- };
172
-
173
- const createStore = (defaultState, shouldUpdate) => {
174
- const map = createObservableMap(defaultState, shouldUpdate);
175
- stencilSubscription(map);
176
- return map;
177
- };
178
-
179
- let defaultRouter;
180
- const createRouter = (opts) => {
181
- var _a;
182
- const win = window;
183
- const url = new URL(win.location.href);
184
- const parseURL = (_a = opts === null || opts === void 0 ? void 0 : opts.parseURL) !== null && _a !== void 0 ? _a : DEFAULT_PARSE_URL;
185
- const { state, onChange, dispose } = createStore({
186
- url,
187
- activePath: parseURL(url)
188
- }, (newV, oldV, prop) => {
189
- if (prop === 'url') {
190
- return newV.href !== oldV.href;
191
- }
192
- return newV !== oldV;
193
- });
194
- const push = (href) => {
195
- history.pushState(null, null, href);
196
- const url = new URL(href, document.baseURI);
197
- state.url = url;
198
- state.activePath = parseURL(url);
199
- };
200
- const match = (routes) => {
201
- const { activePath } = state;
202
- for (let route of routes) {
203
- const params = matchPath(activePath, route.path);
204
- if (params) {
205
- if (route.to != null) {
206
- const to = (typeof route.to === 'string')
207
- ? route.to
208
- : route.to(activePath);
209
- push(to);
210
- return match(routes);
211
- }
212
- else {
213
- return { params, route };
214
- }
215
- }
216
- }
217
- return undefined;
218
- };
219
- const navigationChanged = () => {
220
- const url = new URL(win.location.href);
221
- state.url = url;
222
- state.activePath = parseURL(url);
223
- };
224
- const Switch = (_, childrenRoutes) => {
225
- const result = match(childrenRoutes);
226
- if (result) {
227
- if (typeof result.route.jsx === 'function') {
228
- return result.route.jsx(result.params);
229
- }
230
- else {
231
- return result.route.jsx;
232
- }
233
- }
234
- };
235
- const disposeRouter = () => {
236
- defaultRouter = undefined;
237
- win.removeEventListener('popstate', navigationChanged);
238
- dispose();
239
- };
240
- const router = defaultRouter = {
241
- Switch,
242
- get url() {
243
- return state.url;
244
- },
245
- get activePath() {
246
- return state.activePath;
247
- },
248
- push,
249
- onChange: onChange,
250
- dispose: disposeRouter,
251
- };
252
- // Initial update
253
- navigationChanged();
254
- // Listen URL changes
255
- win.addEventListener('popstate', navigationChanged);
256
- return router;
257
- };
258
- const Route = (props, children) => {
259
- var _a;
260
- if ('to' in props) {
261
- return {
262
- path: props.path,
263
- to: props.to,
264
- };
265
- }
266
- if (Build.isDev && props.render && children.length > 0) {
267
- console.warn('Route: if `render` is provided, the component should not have any children');
268
- }
269
- return {
270
- path: props.path,
271
- id: props.id,
272
- jsx: (_a = props.render) !== null && _a !== void 0 ? _a : children,
273
- };
274
- };
275
- const href = (href, router = defaultRouter) => {
276
- if (Build.isDev && !router) {
277
- throw new Error('Router must be defined in href');
278
- }
279
- return {
280
- href,
281
- onClick: (ev) => {
282
- if (ev.metaKey || ev.ctrlKey) {
283
- return;
284
- }
285
- if (ev.which == 2 || ev.button == 1) {
286
- return;
287
- }
288
- ev.preventDefault();
289
- router.push(href);
290
- },
291
- };
292
- };
293
- const matchPath = (pathname, path) => {
294
- if (typeof path === 'string') {
295
- if (path === pathname) {
296
- return {};
297
- }
298
- }
299
- else if (typeof path === 'function') {
300
- const params = path(pathname);
301
- if (params) {
302
- return params === true
303
- ? {}
304
- : { ...params };
305
- }
306
- }
307
- else {
308
- const results = path.exec(pathname);
309
- if (results) {
310
- path.lastIndex = 0;
311
- return { ...results };
312
- }
313
- }
314
- return undefined;
315
- };
316
- const DEFAULT_PARSE_URL = (url) => {
317
- return url.pathname.toLowerCase();
318
- };
319
- const NotFound = () => ({});
320
-
321
- /**
322
- * TS adaption of https://github.com/pillarjs/path-to-regexp/blob/master/index.js
323
- */
324
- /**
325
- * Default configs.
326
- */
327
- const DEFAULT_DELIMITER = '/';
328
- const DEFAULT_DELIMITERS = './';
329
- /**
330
- * The main path matching regexp utility.
331
- */
332
- const PATH_REGEXP = new RegExp([
333
- // Match escaped characters that would otherwise appear in future matches.
334
- // This allows the user to escape special characters that won't transform.
335
- '(\\\\.)',
336
- // Match Express-style parameters and un-named parameters with a prefix
337
- // and optional suffixes. Matches appear as:
338
- //
339
- // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?"]
340
- // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined]
341
- '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'
342
- ].join('|'), 'g');
343
- /**
344
- * Parse a string for the raw tokens.
345
- */
346
- const parse = (str, options) => {
347
- var tokens = [];
348
- var key = 0;
349
- var index = 0;
350
- var path = '';
351
- var defaultDelimiter = (options && options.delimiter) || DEFAULT_DELIMITER;
352
- var delimiters = (options && options.delimiters) || DEFAULT_DELIMITERS;
353
- var pathEscaped = false;
354
- var res;
355
- while ((res = PATH_REGEXP.exec(str)) !== null) {
356
- var m = res[0];
357
- var escaped = res[1];
358
- var offset = res.index;
359
- path += str.slice(index, offset);
360
- index = offset + m.length;
361
- // Ignore already escaped sequences.
362
- if (escaped) {
363
- path += escaped[1];
364
- pathEscaped = true;
365
- continue;
366
- }
367
- var prev = '';
368
- var next = str[index];
369
- var name = res[2];
370
- var capture = res[3];
371
- var group = res[4];
372
- var modifier = res[5];
373
- if (!pathEscaped && path.length) {
374
- var k = path.length - 1;
375
- if (delimiters.indexOf(path[k]) > -1) {
376
- prev = path[k];
377
- path = path.slice(0, k);
378
- }
379
- }
380
- // Push the current path onto the tokens.
381
- if (path) {
382
- tokens.push(path);
383
- path = '';
384
- pathEscaped = false;
385
- }
386
- var partial = prev !== '' && next !== undefined && next !== prev;
387
- var repeat = modifier === '+' || modifier === '*';
388
- var optional = modifier === '?' || modifier === '*';
389
- var delimiter = prev || defaultDelimiter;
390
- var pattern = capture || group;
391
- tokens.push({
392
- name: name || key++,
393
- prefix: prev,
394
- delimiter: delimiter,
395
- optional: optional,
396
- repeat: repeat,
397
- partial: partial,
398
- pattern: pattern ? escapeGroup(pattern) : '[^' + escapeString(delimiter) + ']+?'
399
- });
400
- }
401
- // Push any remaining characters.
402
- if (path || index < str.length) {
403
- tokens.push(path + str.substr(index));
404
- }
405
- return tokens;
406
- };
407
- /**
408
- * Escape a regular expression string.
409
- */
410
- const escapeString = (str) => {
411
- return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1');
412
- };
413
- /**
414
- * Escape the capturing group by escaping special characters and meaning.
415
- */
416
- const escapeGroup = (group) => {
417
- return group.replace(/([=!:$/()])/g, '\\$1');
418
- };
419
- /**
420
- * Get the flags for a regexp from the options.
421
- */
422
- const flags = (options) => {
423
- return options && options.sensitive ? '' : 'i';
424
- };
425
- /**
426
- * Pull out keys from a regexp.
427
- */
428
- const regexpToRegexp = (path, keys) => {
429
- if (!keys)
430
- return path;
431
- // Use a negative lookahead to match only capturing groups.
432
- var groups = path.source.match(/\((?!\?)/g);
433
- if (groups) {
434
- for (var i = 0; i < groups.length; i++) {
435
- keys.push({
436
- name: i,
437
- prefix: null,
438
- delimiter: null,
439
- optional: false,
440
- repeat: false,
441
- partial: false,
442
- pattern: null
443
- });
444
- }
445
- }
446
- return path;
447
- };
448
- /**
449
- * Transform an array into a regexp.
450
- */
451
- const arrayToRegexp = (path, keys, options) => {
452
- var parts = [];
453
- for (var i = 0; i < path.length; i++) {
454
- parts.push(pathToRegexp(path[i], keys, options).source);
455
- }
456
- return new RegExp('(?:' + parts.join('|') + ')', flags(options));
457
- };
458
- /**
459
- * Create a path regexp from string input.
460
- */
461
- const stringToRegexp = (path, keys, options) => {
462
- return tokensToRegExp(parse(path, options), keys, options);
463
- };
464
- /**
465
- * Expose a function for taking tokens and returning a RegExp.
466
- */
467
- const tokensToRegExp = (tokens, keys, options) => {
468
- options = options || {};
469
- var strict = options.strict;
470
- var end = options.end !== false;
471
- var delimiter = escapeString(options.delimiter || DEFAULT_DELIMITER);
472
- var delimiters = options.delimiters || DEFAULT_DELIMITERS;
473
- var endsWith = [].concat(options.endsWith || []).map(escapeString).concat('$').join('|');
474
- var route = '';
475
- var isEndDelimited = false;
476
- // Iterate over the tokens and create our regexp string.
477
- for (var i = 0; i < tokens.length; i++) {
478
- var token = tokens[i];
479
- if (typeof token === 'string') {
480
- route += escapeString(token);
481
- isEndDelimited = i === tokens.length - 1 && delimiters.indexOf(token[token.length - 1]) > -1;
482
- }
483
- else {
484
- var prefix = escapeString(token.prefix || '');
485
- var capture = token.repeat
486
- ? '(?:' + token.pattern + ')(?:' + prefix + '(?:' + token.pattern + '))*'
487
- : token.pattern;
488
- if (keys)
489
- keys.push(token);
490
- if (token.optional) {
491
- if (token.partial) {
492
- route += prefix + '(' + capture + ')?';
493
- }
494
- else {
495
- route += '(?:' + prefix + '(' + capture + '))?';
496
- }
497
- }
498
- else {
499
- route += prefix + '(' + capture + ')';
500
- }
501
- }
502
- }
503
- if (end) {
504
- if (!strict)
505
- route += '(?:' + delimiter + ')?';
506
- route += endsWith === '$' ? '$' : '(?=' + endsWith + ')';
507
- }
508
- else {
509
- if (!strict)
510
- route += '(?:' + delimiter + '(?=' + endsWith + '))?';
511
- if (!isEndDelimited)
512
- route += '(?=' + delimiter + '|' + endsWith + ')';
513
- }
514
- return new RegExp('^' + route, flags(options));
515
- };
516
- /**
517
- * Normalize the given path string, returning a regular expression.
518
- *
519
- * An empty array can be passed in for the keys, which will hold the
520
- * placeholder key descriptions. For example, using `/user/:id`, `keys` will
521
- * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
522
- */
523
- const pathToRegexp = (path, keys, options) => {
524
- if (path instanceof RegExp) {
525
- return regexpToRegexp(path, keys);
526
- }
527
- if (Array.isArray(path)) {
528
- return arrayToRegexp(path, keys, options);
529
- }
530
- return stringToRegexp(path, keys, options);
531
- };
532
-
533
- let cacheCount = 0;
534
- const patternCache = {};
535
- const cacheLimit = 10000;
536
- // Memoized function for creating the path match regex
537
- const compilePath = (pattern, options) => {
538
- const cacheKey = `${options.end}${options.strict}`;
539
- const cache = patternCache[cacheKey] || (patternCache[cacheKey] = {});
540
- const cachePattern = JSON.stringify(pattern);
541
- if (cache[cachePattern]) {
542
- return cache[cachePattern];
543
- }
544
- const keys = [];
545
- const re = pathToRegexp(pattern, keys, options);
546
- const compiledPattern = { re, keys };
547
- if (cacheCount < cacheLimit) {
548
- cache[cachePattern] = compiledPattern;
549
- cacheCount += 1;
550
- }
551
- return compiledPattern;
552
- };
553
- const match = (pathname, options = {}) => {
554
- const { exact = false, strict = false } = options;
555
- const { re, keys } = compilePath(pathname, { end: exact, strict });
556
- return (path) => {
557
- const match = re.exec(path);
558
- if (!match) {
559
- return undefined;
560
- }
561
- const [url, ...values] = match;
562
- const isExact = path === url;
563
- if (exact && !isExact) {
564
- return undefined;
565
- }
566
- return keys.reduce((memo, key, index) => {
567
- memo[key.name] = values[index];
568
- return memo;
569
- }, {});
570
- };
571
- };
572
-
573
- const Router = createRouter();
574
- const App = (attributes, nodes, utils) => {
575
- var _a;
576
- const emptyNode = Object.entries(nodes[0]).reduce((r, entry) => {
577
- r[entry[0]] = null;
578
- return r;
579
- }, {});
580
- const emptyChild = nodeToChild(emptyNode);
581
- function nodeToChild(node) {
582
- let result;
583
- utils.forEach([node], child => (result = child));
584
- return result !== null && result !== void 0 ? result : emptyChild;
585
- }
586
- function childToNode(child) {
587
- return utils.map([emptyNode], c => (Object.assign(Object.assign({}, c), child)))[0];
588
- }
589
- const children = nodes.map((node, index) => (Object.assign(Object.assign({}, nodeToChild(node)), { node })));
590
- return (h("smoothly-app", null,
591
- h("header", null,
592
- h("h1", null,
593
- h("a", Object.assign({}, href((_a = resolve("")) !== null && _a !== void 0 ? _a : "/")), attributes.label)),
594
- h("nav", null,
595
- h("ul", null, utils
596
- .map([
597
- ...children.filter(child => { var _a; return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.slot) == "nav-start"; }),
598
- ...children.filter(child => { var _a, _b; return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.label) && ((_b = child.vattrs) === null || _b === void 0 ? void 0 : _b.path); }),
599
- ...children.filter(child => { var _a; return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.slot) == "nav-end"; }),
600
- ].map(child => child.node), child => {
601
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
602
- if (((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.label) && ((_b = child.vattrs) === null || _b === void 0 ? void 0 : _b.path))
603
- child = Object.assign(Object.assign({}, emptyChild), { vtag: "a", vattrs: { href: (_c = child.vattrs) === null || _c === void 0 ? void 0 : _c.path }, vchildren: [
604
- ((_d = child.vattrs) === null || _d === void 0 ? void 0 : _d.icon)
605
- ? childToNode({
606
- vtag: "smoothly-icon",
607
- vattrs: {
608
- toolTip: (_e = child.vattrs) === null || _e === void 0 ? void 0 : _e.label,
609
- name: (_f = child.vattrs) === null || _f === void 0 ? void 0 : _f.icon,
610
- size: "medium",
611
- },
612
- })
613
- : childToNode({ vtext: (_g = child.vattrs) === null || _g === void 0 ? void 0 : _g.label }),
614
- ] });
615
- const url = resolve((_h = child.vattrs) === null || _h === void 0 ? void 0 : _h.href);
616
- return child.vtag != "a"
617
- ? child
618
- : url
619
- ? Object.assign(Object.assign({}, child), { vattrs: Object.assign(Object.assign({}, child.vattrs), { class: [(_j = child.vattrs) === null || _j === void 0 ? void 0 : _j.class, Router.activePath == url ? "active" : ""].join(" ") || undefined, href: url }) }) : Object.assign(Object.assign({}, child), { vattrs: Object.assign(Object.assign({}, child.vattrs), { target: "new" }) });
620
- })
621
- .map(node => {
622
- var _a, _b;
623
- const child = nodeToChild(node);
624
- return child.vtag == "a" && !((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.target) ? (h("a", Object.assign({}, child.vattrs, href((_b = child.vattrs) === null || _b === void 0 ? void 0 : _b.href)), child.vchildren)) : (node);
625
- })
626
- .map(child => (h("li", null, child))))),
627
- children.filter(child => { var _a; return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.slot) == "header"; }).map(child => child.node)),
628
- h("main", null,
629
- h(Router.Switch, null, children
630
- .filter(child => { var _a; return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.path) != undefined; })
631
- .map(child => {
632
- var _a, _b, _c, _d, _e, _f, _g, _h;
633
- return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.to) ? (h(Route, { path: (_c = resolve((_b = child.vattrs) === null || _b === void 0 ? void 0 : _b.path)) !== null && _c !== void 0 ? _c : (_d = child.vattrs) === null || _d === void 0 ? void 0 : _d.path, to: (_e = child.vattrs) === null || _e === void 0 ? void 0 : _e.to })) : (h(Route, { path: (_g = resolve((_f = child.vattrs) === null || _f === void 0 ? void 0 : _f.path)) !== null && _g !== void 0 ? _g : (_h = child.vattrs) === null || _h === void 0 ? void 0 : _h.path }, child.node));
634
- })))));
635
- };
636
- function resolve(url) {
637
- const u = new URL(url, document.baseURI);
638
- return url == ""
639
- ? new URL(document.baseURI).pathname
640
- : u.toString().startsWith(document.baseURI)
641
- ? u.pathname
642
- : undefined;
643
- }
644
-
645
- export { App as A };
@@ -1,44 +0,0 @@
1
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
-
3
- function getDefaultExportFromCjs (x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
- }
6
-
7
- function createCommonjsModule(fn, basedir, module) {
8
- return module = {
9
- path: basedir,
10
- exports: {},
11
- require: function (path, base) {
12
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
13
- }
14
- }, fn(module, module.exports), module.exports;
15
- }
16
-
17
- function getDefaultExportFromNamespaceIfPresent (n) {
18
- return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
19
- }
20
-
21
- function getDefaultExportFromNamespaceIfNotNamed (n) {
22
- return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
23
- }
24
-
25
- function getAugmentedNamespace(n) {
26
- if (n.__esModule) return n;
27
- var a = Object.defineProperty({}, '__esModule', {value: true});
28
- Object.keys(n).forEach(function (k) {
29
- var d = Object.getOwnPropertyDescriptor(n, k);
30
- Object.defineProperty(a, k, d.get ? d : {
31
- enumerable: true,
32
- get: function () {
33
- return n[k];
34
- }
35
- });
36
- });
37
- return a;
38
- }
39
-
40
- function commonjsRequire () {
41
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
42
- }
43
-
44
- export { commonjsGlobal as a, createCommonjsModule as c, getDefaultExportFromCjs as g };
@@ -1,3 +0,0 @@
1
- const globalScripts = () => {};
2
-
3
- export { globalScripts as g };