@telperion/elements 7.0.0 → 8.0.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 (152) hide show
  1. package/.build-manifest.json +12 -1
  2. package/README.md +36 -5
  3. package/custom-elements.json +4182 -2038
  4. package/date/date-element.cjs +231 -0
  5. package/date/date-element.cjs.map +1 -0
  6. package/date/date-element.js +229 -0
  7. package/date/date-element.js.map +1 -0
  8. package/date/format-pattern.cjs +49 -0
  9. package/date/format-pattern.cjs.map +1 -0
  10. package/date/format-pattern.js +47 -0
  11. package/date/format-pattern.js.map +1 -0
  12. package/date/format.cjs +57 -0
  13. package/date/format.cjs.map +1 -0
  14. package/date/format.js +51 -0
  15. package/date/format.js.map +1 -0
  16. package/date/index.cjs +17 -0
  17. package/date/index.cjs.map +1 -0
  18. package/date/index.d.cts +171 -0
  19. package/date/index.d.ts +171 -0
  20. package/date/index.js +6 -0
  21. package/date/index.js.map +1 -0
  22. package/date/intl.cjs +36 -0
  23. package/date/intl.cjs.map +1 -0
  24. package/date/intl.js +32 -0
  25. package/date/intl.js.map +1 -0
  26. package/date/locale.cjs +36 -0
  27. package/date/locale.cjs.map +1 -0
  28. package/date/locale.js +34 -0
  29. package/date/locale.js.map +1 -0
  30. package/date/names.cjs +41 -0
  31. package/date/names.cjs.map +1 -0
  32. package/date/names.js +37 -0
  33. package/date/names.js.map +1 -0
  34. package/date/parse-fields.cjs +80 -0
  35. package/date/parse-fields.cjs.map +1 -0
  36. package/date/parse-fields.js +75 -0
  37. package/date/parse-fields.js.map +1 -0
  38. package/date/parse-iso.cjs +41 -0
  39. package/date/parse-iso.cjs.map +1 -0
  40. package/date/parse-iso.js +39 -0
  41. package/date/parse-iso.js.map +1 -0
  42. package/date/parse-numeric.cjs +53 -0
  43. package/date/parse-numeric.cjs.map +1 -0
  44. package/date/parse-numeric.js +50 -0
  45. package/date/parse-numeric.js.map +1 -0
  46. package/date/parse-pattern.cjs +123 -0
  47. package/date/parse-pattern.cjs.map +1 -0
  48. package/date/parse-pattern.js +121 -0
  49. package/date/parse-pattern.js.map +1 -0
  50. package/date/parse.cjs +35 -0
  51. package/date/parse.cjs.map +1 -0
  52. package/date/parse.js +33 -0
  53. package/date/parse.js.map +1 -0
  54. package/date/relative.cjs +47 -0
  55. package/date/relative.cjs.map +1 -0
  56. package/date/relative.js +44 -0
  57. package/date/relative.js.map +1 -0
  58. package/date/resolution.cjs +62 -0
  59. package/date/resolution.cjs.map +1 -0
  60. package/date/resolution.js +59 -0
  61. package/date/resolution.js.map +1 -0
  62. package/date/styles.cjs +21 -0
  63. package/date/styles.cjs.map +1 -0
  64. package/date/styles.js +19 -0
  65. package/date/styles.js.map +1 -0
  66. package/date/ticker.cjs +71 -0
  67. package/date/ticker.cjs.map +1 -0
  68. package/date/ticker.js +69 -0
  69. package/date/ticker.js.map +1 -0
  70. package/date/tokens.cjs +94 -0
  71. package/date/tokens.cjs.map +1 -0
  72. package/date/tokens.js +91 -0
  73. package/date/tokens.js.map +1 -0
  74. package/date/zone.cjs +110 -0
  75. package/date/zone.cjs.map +1 -0
  76. package/date/zone.js +101 -0
  77. package/date/zone.js.map +1 -0
  78. package/fesm/elements.mjs +1553 -217
  79. package/fesm/elements.mjs.map +1 -1
  80. package/iife/date/index.js +53 -0
  81. package/iife/date/index.js.map +1 -0
  82. package/iife/elements.js +59 -41
  83. package/iife/elements.js.map +1 -1
  84. package/iife/router/index.js +23 -23
  85. package/iife/router/index.js.map +1 -1
  86. package/index.cjs +34 -18
  87. package/index.cjs.map +1 -1
  88. package/index.d.cts +2 -1
  89. package/index.d.ts +2 -1
  90. package/index.js +13 -6
  91. package/index.js.map +1 -1
  92. package/package.json +31 -3
  93. package/router/history-managed.cjs +1 -1
  94. package/router/history-managed.cjs.map +1 -1
  95. package/router/history-managed.js +1 -1
  96. package/router/history-managed.js.map +1 -1
  97. package/router/index.cjs +23 -18
  98. package/router/index.cjs.map +1 -1
  99. package/router/index.d.cts +273 -168
  100. package/router/index.d.ts +273 -168
  101. package/router/index.js +8 -6
  102. package/router/index.js.map +1 -1
  103. package/router/route-element.cjs +244 -0
  104. package/router/route-element.cjs.map +1 -0
  105. package/router/route-element.js +239 -0
  106. package/router/route-element.js.map +1 -0
  107. package/router/route-events.cjs +14 -0
  108. package/router/route-events.cjs.map +1 -0
  109. package/router/route-events.js +10 -0
  110. package/router/route-events.js.map +1 -0
  111. package/router/route-source.cjs +134 -0
  112. package/router/route-source.cjs.map +1 -0
  113. package/router/route-source.js +129 -0
  114. package/router/route-source.js.map +1 -0
  115. package/router/route-templates.cjs +18 -0
  116. package/router/route-templates.cjs.map +1 -0
  117. package/router/route-templates.js +16 -0
  118. package/router/route-templates.js.map +1 -0
  119. package/router/{tha-router-config.cjs → router-config-element.cjs} +51 -51
  120. package/router/router-config-element.cjs.map +1 -0
  121. package/router/{tha-router-config.js → router-config-element.js} +52 -52
  122. package/router/router-config-element.js.map +1 -0
  123. package/router/{tha-router.cjs → router-element.cjs} +47 -33
  124. package/router/router-element.cjs.map +1 -0
  125. package/router/{tha-router.js → router-element.js} +47 -33
  126. package/router/router-element.js.map +1 -0
  127. package/router/{tha-router-link.cjs → router-link-element.cjs} +15 -15
  128. package/router/router-link-element.cjs.map +1 -0
  129. package/router/{tha-router-link.js → router-link-element.js} +16 -16
  130. package/router/router-link-element.js.map +1 -0
  131. package/router/{tha-router-outlet.cjs → router-outlet-element.cjs} +44 -31
  132. package/router/router-outlet-element.cjs.map +1 -0
  133. package/router/{tha-router-outlet.js → router-outlet-element.js} +43 -30
  134. package/router/router-outlet-element.js.map +1 -0
  135. package/router/{tha-router-param.cjs → router-param-element.cjs} +62 -62
  136. package/router/router-param-element.cjs.map +1 -0
  137. package/router/{tha-router-param.js → router-param-element.js} +62 -62
  138. package/router/router-param-element.js.map +1 -0
  139. package/router/tha-route.cjs +0 -128
  140. package/router/tha-route.cjs.map +0 -1
  141. package/router/tha-route.js +0 -125
  142. package/router/tha-route.js.map +0 -1
  143. package/router/tha-router-config.cjs.map +0 -1
  144. package/router/tha-router-config.js.map +0 -1
  145. package/router/tha-router-link.cjs.map +0 -1
  146. package/router/tha-router-link.js.map +0 -1
  147. package/router/tha-router-outlet.cjs.map +0 -1
  148. package/router/tha-router-outlet.js.map +0 -1
  149. package/router/tha-router-param.cjs.map +0 -1
  150. package/router/tha-router-param.js.map +0 -1
  151. package/router/tha-router.cjs.map +0 -1
  152. package/router/tha-router.js.map +0 -1
@@ -19,13 +19,13 @@ import { HistoryManaged, HISTORY_TYPE } from './history-managed.js';
19
19
  * ```html
20
20
  * <head>
21
21
  * <!-- All routers will use hash routing by default -->
22
- * <tha-router-config history="hash"></tha-router-config>
22
+ * <tp-router-config history="hash"></tp-router-config>
23
23
  * </head>
24
24
  * <body>
25
- * <tha-router>
25
+ * <tp-router>
26
26
  * <!-- Uses hash history (global default) -->
27
- * <tha-route path="/home">...</tha-route>
28
- * </tha-router>
27
+ * <tp-route path="/home">...</tp-route>
28
+ * </tp-router>
29
29
  * </body>
30
30
  * ```
31
31
  *
@@ -38,20 +38,20 @@ import { HistoryManaged, HISTORY_TYPE } from './history-managed.js';
38
38
  * ```html
39
39
  * <body>
40
40
  * <!-- Section 1: Hash routing -->
41
- * <tha-router-config history="hash">
42
- * <tha-router>
41
+ * <tp-router-config history="hash">
42
+ * <tp-router>
43
43
  * <!-- Uses hash history from parent config -->
44
- * <tha-route path="/dashboard">...</tha-route>
45
- * </tha-router>
46
- * </tha-router-config>
44
+ * <tp-route path="/dashboard">...</tp-route>
45
+ * </tp-router>
46
+ * </tp-router-config>
47
47
  *
48
48
  * <!-- Section 2: Memory routing (isolated) -->
49
- * <tha-router-config history="memory">
50
- * <tha-router>
49
+ * <tp-router-config history="memory">
50
+ * <tp-router>
51
51
  * <!-- Uses memory history from parent config -->
52
- * <tha-route path="/preview">...</tha-route>
53
- * </tha-router>
54
- * </tha-router-config>
52
+ * <tp-route path="/preview">...</tp-route>
53
+ * </tp-router>
54
+ * </tp-router-config>
55
55
  * </body>
56
56
  * ```
57
57
  *
@@ -65,7 +65,7 @@ import { HistoryManaged, HISTORY_TYPE } from './history-managed.js';
65
65
  * <!DOCTYPE html>
66
66
  * <html>
67
67
  * <head>
68
- * <tha-router-config history="browser"></tha-router-config>
68
+ * <tp-router-config history="browser"></tp-router-config>
69
69
  * </head>
70
70
  * <body>
71
71
  * <!-- All routers use browser history -->
@@ -80,16 +80,16 @@ import { HistoryManaged, HISTORY_TYPE } from './history-managed.js';
80
80
  * ```html
81
81
  * <head>
82
82
  * <!-- Global: browser history -->
83
- * <tha-router-config history="browser"></tha-router-config>
83
+ * <tp-router-config history="browser"></tp-router-config>
84
84
  * </head>
85
85
  * <body>
86
86
  * <!-- Main app uses browser history -->
87
- * <tha-router>...</tha-router>
87
+ * <tp-router>...</tp-router>
88
88
  *
89
89
  * <!-- Admin section uses hash history -->
90
- * <tha-router-config history="hash">
91
- * <tha-router>...</tha-router>
92
- * </tha-router-config>
90
+ * <tp-router-config history="hash">
91
+ * <tp-router>...</tp-router>
92
+ * </tp-router-config>
93
93
  * </body>
94
94
  * ```
95
95
  *
@@ -100,17 +100,17 @@ import { HistoryManaged, HISTORY_TYPE } from './history-managed.js';
100
100
  * ```html
101
101
  * <body>
102
102
  * <!-- Each component has independent navigation -->
103
- * <tha-router-config history="memory:component1">
103
+ * <tp-router-config history="memory:component1">
104
104
  * <my-widget>
105
- * <tha-router>...</tha-router>
105
+ * <tp-router>...</tp-router>
106
106
  * </my-widget>
107
- * </tha-router-config>
107
+ * </tp-router-config>
108
108
  *
109
- * <tha-router-config history="memory:component2">
109
+ * <tp-router-config history="memory:component2">
110
110
  * <my-widget>
111
- * <tha-router>...</tha-router>
111
+ * <tp-router>...</tp-router>
112
112
  * </my-widget>
113
- * </tha-router-config>
113
+ * </tp-router-config>
114
114
  * </body>
115
115
  * ```
116
116
  *
@@ -123,11 +123,11 @@ import { HistoryManaged, HISTORY_TYPE } from './history-managed.js';
123
123
  *
124
124
  * it('should navigate', async () => {
125
125
  * const el = await fixture(html`
126
- * <tha-router-config history="memory:test">
127
- * <tha-router>
128
- * <tha-route path="/test">Test Page</tha-route>
129
- * </tha-router>
130
- * </tha-router-config>
126
+ * <tp-router-config history="memory:test">
127
+ * <tp-router>
128
+ * <tp-route path="/test">Test Page</tp-route>
129
+ * </tp-router>
130
+ * </tp-router-config>
131
131
  * `);
132
132
  *
133
133
  * // Test navigation without affecting browser URL
@@ -139,56 +139,56 @@ import { HistoryManaged, HISTORY_TYPE } from './history-managed.js';
139
139
  * Router components resolve their history in this order:
140
140
  *
141
141
  * 1. **Own `history` attribute** (highest priority)
142
- * 2. **Parent `tha-router-config`** (local configuration)
143
- * 3. **Global `tha-router-config`** (in `<head>`)
142
+ * 2. **Parent `tp-router-config`** (local configuration)
143
+ * 3. **Global `tp-router-config`** (in `<head>`)
144
144
  * 4. **Default** (`"browser"`)
145
145
  *
146
146
  * ## Best Practices
147
147
  *
148
- * ✅ **DO**: Place one `tha-router-config` in `<head>` for global settings
148
+ * ✅ **DO**: Place one `tp-router-config` in `<head>` for global settings
149
149
  *
150
150
  * ```html
151
151
  * <head>
152
- * <tha-router-config history="browser"></tha-router-config>
152
+ * <tp-router-config history="browser"></tp-router-config>
153
153
  * </head>
154
154
  * ```
155
155
  *
156
156
  * ✅ **DO**: Use local configs for sections with different routing needs
157
157
  *
158
158
  * ```html
159
- * <tha-router-config history="memory">
159
+ * <tp-router-config history="memory">
160
160
  * <component-preview>...</component-preview>
161
- * </tha-router-config>
161
+ * </tp-router-config>
162
162
  * ```
163
163
  *
164
164
  * ✅ **DO**: Use named memory history for isolated components
165
165
  *
166
166
  * ```html
167
- * <tha-router-config history="memory:sidebar">
167
+ * <tp-router-config history="memory:sidebar">
168
168
  * <sidebar-nav>...</sidebar-nav>
169
- * </tha-router-config>
169
+ * </tp-router-config>
170
170
  * ```
171
171
  *
172
172
  * ❌ **DON'T**: Place multiple configs in `<head>` (last one wins)
173
173
  *
174
174
  * ```html
175
175
  * <head>
176
- * <tha-router-config history="browser"></tha-router-config>
177
- * <tha-router-config history="hash"></tha-router-config> <!-- Overrides above -->
176
+ * <tp-router-config history="browser"></tp-router-config>
177
+ * <tp-router-config history="hash"></tp-router-config> <!-- Overrides above -->
178
178
  * </head>
179
179
  * ```
180
180
  *
181
181
  * ❌ **DON'T**: Nest configs unnecessarily (inner configs take precedence)
182
182
  *
183
183
  * ```html
184
- * <tha-router-config history="browser">
185
- * <tha-router-config history="hash">
184
+ * <tp-router-config history="browser">
185
+ * <tp-router-config history="hash">
186
186
  * <!-- Uses hash, not browser -->
187
- * </tha-router-config>
188
- * </tha-router-config>
187
+ * </tp-router-config>
188
+ * </tp-router-config>
189
189
  * ```
190
190
  */
191
- let ThaRouterConfig = class ThaRouterConfig extends HistoryManaged(SignalWatcherLitElement) {
191
+ let RouterConfigElement = class RouterConfigElement extends HistoryManaged(SignalWatcherLitElement) {
192
192
  /**
193
193
  * Cleanup function for the global history effect.
194
194
  * Only used when the element is placed in `<head>`.
@@ -205,7 +205,7 @@ let ThaRouterConfig = class ThaRouterConfig extends HistoryManaged(SignalWatcher
205
205
  super.connectedCallback();
206
206
  if (!document.head.contains(this))
207
207
  return;
208
- console.log('ThaRouterConfig: Setting global history type to', this[HISTORY_TYPE].get());
208
+ console.log('RouterConfigElement: Setting global history type to', this[HISTORY_TYPE].get());
209
209
  // Set the global history type when this element is connected in <head>
210
210
  this.#globalHistoryUnsubscribe = this.updateEffect(() => {
211
211
  GLOBAL_HISTORY_TYPE.set(this[HISTORY_TYPE].get());
@@ -233,9 +233,9 @@ let ThaRouterConfig = class ThaRouterConfig extends HistoryManaged(SignalWatcher
233
233
  return this;
234
234
  }
235
235
  };
236
- ThaRouterConfig = __decorate([
237
- customElement('tha-router-config')
238
- ], ThaRouterConfig);
236
+ RouterConfigElement = __decorate([
237
+ customElement('tp-router-config')
238
+ ], RouterConfigElement);
239
239
 
240
- export { ThaRouterConfig };
241
- //# sourceMappingURL=tha-router-config.js.map
240
+ export { RouterConfigElement };
241
+ //# sourceMappingURL=router-config-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-config-element.js","sources":["../../../../libs/elements/src/router/router-config-element.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsLG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,cAAc,CAAC,uBAAuB,CAAC,CAAA;AAC9E;;;;AAIG;IACH,yBAAyB,GAAG,IAAI;AAEhC;;;;;AAKG;IACM,iBAAiB,GAAA;QACxB,KAAK,CAAC,iBAAiB,EAAE;QAEzB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE;AAEnC,QAAA,OAAO,CAAC,GAAG,CAAC,qDAAqD,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC;;QAG5F,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC,YAAY,CAAC,MAAK;YACtD,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,EAAG,CAAC;AACpD,QAAA,CAAC,CAAC;IACJ;AAEA;;;;AAIG;IACM,oBAAoB,GAAA;QAC3B,KAAK,CAAC,oBAAoB,EAAE;AAE5B,QAAA,IAAI;YACF,IAAI,CAAC,yBAAyB,EAAE;QAClC;QAAE,MAAM,EAAC;IACX;AAEA;;;;;AAKG;IACgB,gBAAgB,GAAA;AACjC,QAAA,OAAO,IAAI;IACb;;AAhDW,mBAAmB,GAAA,UAAA,CAAA;IAD/B,aAAa,CAAC,kBAAkB;AACpB,CAAA,EAAA,mBAAmB,CAiD/B;;;;"}
@@ -3,9 +3,9 @@
3
3
  var tslib = require('tslib');
4
4
  var lit = require('lit');
5
5
  var decorators_js = require('lit/decorators.js');
6
- var thaRoute = require('./tha-route.cjs');
6
+ var routeElement = require('./route-element.cjs');
7
7
  var signals = require('@lit-labs/signals');
8
- var thaRouterOutlet = require('./tha-router-outlet.cjs');
8
+ var routerOutletElement = require('./router-outlet-element.cjs');
9
9
  var noop = require('@telperion/js-utils/function/noop');
10
10
  var defer = require('@telperion/js-utils/function/defer');
11
11
  var signalWatcherLitElement = require('../utils/signal-watcher-lit-element.cjs');
@@ -15,34 +15,34 @@ var historyManaged = require('./history-managed.cjs');
15
15
  * A custom element that manages client-side routing for single-page applications.
16
16
  *
17
17
  * The router watches for navigation events and matches the current URL against
18
- * registered routes (tha-route elements), rendering the matching route's content
19
- * in a tha-router-outlet element.
18
+ * registered routes (tp-route elements), rendering the matching route's content
19
+ * in a tp-router-outlet element.
20
20
  *
21
21
  * @example
22
22
  * ```html
23
- * <tha-router history="browser">
24
- * <tha-route path="/">
23
+ * <tp-router history="browser">
24
+ * <tp-route path="/">
25
25
  * <template><h1>Home</h1></template>
26
- * </tha-route>
27
- * <tha-route path="/about">
26
+ * </tp-route>
27
+ * <tp-route path="/about">
28
28
  * <template><h1>About</h1></template>
29
- * </tha-route>
30
- * <tha-router-outlet></tha-router-outlet>
31
- * </tha-router>
29
+ * </tp-route>
30
+ * <tp-router-outlet></tp-router-outlet>
31
+ * </tp-router>
32
32
  * ```
33
33
  */
34
- exports.ThaRouter = class ThaRouter extends historyManaged.HistoryManaged(signalWatcherLitElement.SignalWatcherLitElement) {
34
+ exports.RouterElement = class RouterElement extends historyManaged.HistoryManaged(signalWatcherLitElement.SignalWatcherLitElement) {
35
35
  /**
36
- * Injects global styles for tha-router elements to hide non-outlet children.
37
- * Ensures that only tha-router-outlet elements are visible within the router.
36
+ * Injects global styles for tp-router elements to hide non-outlet children.
37
+ * Ensures that only tp-router-outlet elements are visible within the router.
38
38
  */
39
39
  static {
40
40
  const styleEl = document.createElement("style");
41
41
  styleEl.setAttribute("type", "text/css");
42
- styleEl.setAttribute("data-id", "tha-router-styles");
42
+ styleEl.setAttribute("data-id", "tp-router-styles");
43
43
  styleEl.textContent = lit.css `
44
- tha-router {
45
- & > :not(tha-router-outlet) {
44
+ tp-router {
45
+ & > :not(tp-router-outlet) {
46
46
  display: none;
47
47
  }
48
48
  }
@@ -51,13 +51,13 @@ exports.ThaRouter = class ThaRouter extends historyManaged.HistoryManaged(signal
51
51
  }
52
52
  /**
53
53
  * Observes changes to child elements to detect when routes are added or removed.
54
- * Updates the #routeEls signal whenever tha-route children change.
54
+ * Updates the #routeEls signal whenever tp-route children change.
55
55
  */
56
56
  #routeChildObserver = new MutationObserver((mutations) => {
57
57
  const childListMutations = mutations.filter(mutation => mutation.type === 'childList');
58
58
  if (!childListMutations.length)
59
59
  return;
60
- this.#routeEls.set(Array.from(this.children).filter(child => child instanceof thaRoute.ThaRoute).map(routeEl => new WeakRef(routeEl)));
60
+ this.#routeEls.set(Array.from(this.children).filter(child => child instanceof routeElement.RouteElement).map(routeEl => new WeakRef(routeEl)));
61
61
  });
62
62
  /** Cleanup function for the route children rendering effect */
63
63
  #routeChildrenEffectCleaner = noop.noop;
@@ -65,12 +65,14 @@ exports.ThaRouter = class ThaRouter extends historyManaged.HistoryManaged(signal
65
65
  #historyTypeEffectCleaner = noop.noop;
66
66
  /** Cleanup function to remove history listener */
67
67
  #historyListenerRemover = noop.noop;
68
- /** Signal containing weak references to all tha-route children */
68
+ /** Signal containing weak references to all tp-route children */
69
69
  #routeEls = signals.signal([]);
70
70
  /** Signal containing weak reference to the currently active route */
71
71
  #activeRoute = signals.signal(null);
72
72
  /** Signal containing weak reference to the assigned outlet element */
73
73
  #outlet = signals.signal(null);
74
+ /** Last route marked active through SET_ACTIVE (not reactive, see #activate) */
75
+ #activatedRoute = null;
74
76
  /**
75
77
  * Lifecycle callback when the element is connected to the DOM.
76
78
  * Sets up observers, effects, and history listeners.
@@ -83,7 +85,7 @@ exports.ThaRouter = class ThaRouter extends historyManaged.HistoryManaged(signal
83
85
  this.#routeChildrenEffectCleaner = this.updateEffect(() => {
84
86
  const activeRoute = this.#activeRoute.get()?.deref() ?? null;
85
87
  const outlet = this.#outlet.get()?.deref() ?? null;
86
- outlet?.[thaRouterOutlet.RENDER_ROUTE](activeRoute);
88
+ outlet?.[routerOutletElement.RENDER_ROUTE](activeRoute);
87
89
  });
88
90
  // Effect to handle history type changes
89
91
  this.#historyTypeEffectCleaner = this.updateEffect(() => {
@@ -124,15 +126,27 @@ exports.ThaRouter = class ThaRouter extends historyManaged.HistoryManaged(signal
124
126
  const routes = this.#routeEls.get()
125
127
  .map(weakRef => weakRef.deref())
126
128
  .filter(Boolean);
127
- for (const route of routes) {
128
- const pathPattern = route[thaRoute.PATH_PATTERN];
129
- if (pathPattern?.test({ pathname: update.location.pathname })) {
130
- this.#activeRoute.set(new WeakRef(route));
131
- return;
132
- }
133
- }
134
- this.#activeRoute.set(null);
129
+ const match = routes.find(route => route[routeElement.PATH_PATTERN]?.test({ pathname: update.location.pathname })) ?? null;
130
+ this.#activate(match);
131
+ this.#activeRoute.set(match ? new WeakRef(match) : null);
135
132
  };
133
+ /**
134
+ * Marks the matched route as active and the previous one as inactive.
135
+ * Re-activating the same route is intentional: it retries a failed `src`.
136
+ *
137
+ * The previous route is tracked in a plain field rather than read from
138
+ * the #activeRoute signal, so effects calling #handleRouteChange do not
139
+ * start depending on the signal they write.
140
+ *
141
+ * @param route - The matched route, or null when nothing matches
142
+ */
143
+ #activate(route) {
144
+ const previous = this.#activatedRoute?.deref() ?? null;
145
+ if (previous && previous !== route)
146
+ previous[routeElement.SET_ACTIVE](false);
147
+ route?.[routeElement.SET_ACTIVE](true);
148
+ this.#activatedRoute = route ? new WeakRef(route) : null;
149
+ }
136
150
  /**
137
151
  * Lifecycle callback when the element is disconnected from the DOM.
138
152
  * Cleans up all observers, effects, and listeners.
@@ -157,7 +171,7 @@ exports.ThaRouter = class ThaRouter extends historyManaged.HistoryManaged(signal
157
171
  return this;
158
172
  }
159
173
  };
160
- exports.ThaRouter = tslib.__decorate([
161
- decorators_js.customElement("tha-router")
162
- ], exports.ThaRouter);
163
- //# sourceMappingURL=tha-router.cjs.map
174
+ exports.RouterElement = tslib.__decorate([
175
+ decorators_js.customElement("tp-router")
176
+ ], exports.RouterElement);
177
+ //# sourceMappingURL=router-element.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-element.cjs","sources":["../../../../libs/elements/src/router/router-element.ts"],"sourcesContent":[null],"names":["RouterElement","HistoryManaged","SignalWatcherLitElement","css","RouteElement","noop","signal","RENDER_ROUTE","HISTORY","defer","PATH_PATTERN","SET_ACTIVE","__decorate","customElement"],"mappings":";;;;;;;;;;;;;AA2BA;;;;;;;;;;;;;;;;;;;AAmBG;AAEUA,qBAAa,GAAnB,MAAM,aAAc,SAAQC,6BAAc,CAACC,+CAAuB,CAAC,CAAA;AACxE;;;AAGG;AACH,IAAA;QACE,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAE/C,QAAA,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC;AACxC,QAAA,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,kBAAkB,CAAC;AACnD,QAAA,OAAO,CAAC,WAAW,GAAGC,OAAG,CAAA;;;;;;KAMxB,CAAC,QAAQ,EAAE;AACZ,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;;AAGpC;;;AAGG;AACH,IAAA,mBAAmB,GAAG,IAAI,gBAAgB,CAAC,CAAC,SAAS,KAAI;AACvD,QAAA,MAAM,kBAAkB,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,WAAW,CAAC;QAEtF,IAAI,CAAC,kBAAkB,CAAC,MAAM;YAAE;AAEhC,QAAA,IAAI,CAAC,SAAS,CAAC,G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AA0B,EAAA;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,IAAI,IAAI;AAEtD,QAAA,IAAI,QAAQ,IAAI,QAAQ,KAAK,KAAK;AAAE,YAAA,QAAQ,CAACC,uBAAU,CAAC,CAAC,KAAK,CAAC;AAE/D,QAAA,KAAK,GAAGA,uBAAU,CAAC,CAAC,IAAI,CAAC;AACzB,QAAA,IAAI,CAAC,eAAe,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;IAC1D;AAEA;;;AAGG;IACM,oBAAoB,GAAA;QAC3B,KAAK,CAAC,oBAAoB,EAAE;AAE5B,QAAA,IAAI;YACF,IAAI,CAAC,2BAA2B,EAAE;YAClC,IAAI,CAAC,yBAAyB,EAAE;QAClC;AAAE,QAAA,MAAM,cAAc;AAEtB,QAAA,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE;QACrC,IAAI,CAAC,uBAAuB,EAAE;IAChC;AAEA;;;;;AAKG;IACgB,gBAAgB,GAAA;AACjC,QAAA,OAAO,IAAI;IACb;;AAlKWX,qBAAa,GAAAY,gBAAA,CAAA;IADzBC,2BAAa,CAAC,WAAW;AACb,CAAA,EAAAb,qBAAa,CAmKzB;;"}
@@ -1,9 +1,9 @@
1
1
  import { __decorate } from 'tslib';
2
2
  import { css } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
- import { ThaRoute, PATH_PATTERN } from './tha-route.js';
4
+ import { RouteElement, PATH_PATTERN, SET_ACTIVE } from './route-element.js';
5
5
  import { signal } from '@lit-labs/signals';
6
- import { RENDER_ROUTE } from './tha-router-outlet.js';
6
+ import { RENDER_ROUTE } from './router-outlet-element.js';
7
7
  import { noop } from '@telperion/js-utils/function/noop';
8
8
  import { defer } from '@telperion/js-utils/function/defer';
9
9
  import { SignalWatcherLitElement } from '../utils/signal-watcher-lit-element.js';
@@ -13,34 +13,34 @@ import { HistoryManaged, HISTORY } from './history-managed.js';
13
13
  * A custom element that manages client-side routing for single-page applications.
14
14
  *
15
15
  * The router watches for navigation events and matches the current URL against
16
- * registered routes (tha-route elements), rendering the matching route's content
17
- * in a tha-router-outlet element.
16
+ * registered routes (tp-route elements), rendering the matching route's content
17
+ * in a tp-router-outlet element.
18
18
  *
19
19
  * @example
20
20
  * ```html
21
- * <tha-router history="browser">
22
- * <tha-route path="/">
21
+ * <tp-router history="browser">
22
+ * <tp-route path="/">
23
23
  * <template><h1>Home</h1></template>
24
- * </tha-route>
25
- * <tha-route path="/about">
24
+ * </tp-route>
25
+ * <tp-route path="/about">
26
26
  * <template><h1>About</h1></template>
27
- * </tha-route>
28
- * <tha-router-outlet></tha-router-outlet>
29
- * </tha-router>
27
+ * </tp-route>
28
+ * <tp-router-outlet></tp-router-outlet>
29
+ * </tp-router>
30
30
  * ```
31
31
  */
32
- let ThaRouter = class ThaRouter extends HistoryManaged(SignalWatcherLitElement) {
32
+ let RouterElement = class RouterElement extends HistoryManaged(SignalWatcherLitElement) {
33
33
  /**
34
- * Injects global styles for tha-router elements to hide non-outlet children.
35
- * Ensures that only tha-router-outlet elements are visible within the router.
34
+ * Injects global styles for tp-router elements to hide non-outlet children.
35
+ * Ensures that only tp-router-outlet elements are visible within the router.
36
36
  */
37
37
  static {
38
38
  const styleEl = document.createElement("style");
39
39
  styleEl.setAttribute("type", "text/css");
40
- styleEl.setAttribute("data-id", "tha-router-styles");
40
+ styleEl.setAttribute("data-id", "tp-router-styles");
41
41
  styleEl.textContent = css `
42
- tha-router {
43
- & > :not(tha-router-outlet) {
42
+ tp-router {
43
+ & > :not(tp-router-outlet) {
44
44
  display: none;
45
45
  }
46
46
  }
@@ -49,13 +49,13 @@ let ThaRouter = class ThaRouter extends HistoryManaged(SignalWatcherLitElement)
49
49
  }
50
50
  /**
51
51
  * Observes changes to child elements to detect when routes are added or removed.
52
- * Updates the #routeEls signal whenever tha-route children change.
52
+ * Updates the #routeEls signal whenever tp-route children change.
53
53
  */
54
54
  #routeChildObserver = new MutationObserver((mutations) => {
55
55
  const childListMutations = mutations.filter(mutation => mutation.type === 'childList');
56
56
  if (!childListMutations.length)
57
57
  return;
58
- this.#routeEls.set(Array.from(this.children).filter(child => child instanceof ThaRoute).map(routeEl => new WeakRef(routeEl)));
58
+ this.#routeEls.set(Array.from(this.children).filter(child => child instanceof RouteElement).map(routeEl => new WeakRef(routeEl)));
59
59
  });
60
60
  /** Cleanup function for the route children rendering effect */
61
61
  #routeChildrenEffectCleaner = noop;
@@ -63,12 +63,14 @@ let ThaRouter = class ThaRouter extends HistoryManaged(SignalWatcherLitElement)
63
63
  #historyTypeEffectCleaner = noop;
64
64
  /** Cleanup function to remove history listener */
65
65
  #historyListenerRemover = noop;
66
- /** Signal containing weak references to all tha-route children */
66
+ /** Signal containing weak references to all tp-route children */
67
67
  #routeEls = signal([]);
68
68
  /** Signal containing weak reference to the currently active route */
69
69
  #activeRoute = signal(null);
70
70
  /** Signal containing weak reference to the assigned outlet element */
71
71
  #outlet = signal(null);
72
+ /** Last route marked active through SET_ACTIVE (not reactive, see #activate) */
73
+ #activatedRoute = null;
72
74
  /**
73
75
  * Lifecycle callback when the element is connected to the DOM.
74
76
  * Sets up observers, effects, and history listeners.
@@ -122,15 +124,27 @@ let ThaRouter = class ThaRouter extends HistoryManaged(SignalWatcherLitElement)
122
124
  const routes = this.#routeEls.get()
123
125
  .map(weakRef => weakRef.deref())
124
126
  .filter(Boolean);
125
- for (const route of routes) {
126
- const pathPattern = route[PATH_PATTERN];
127
- if (pathPattern?.test({ pathname: update.location.pathname })) {
128
- this.#activeRoute.set(new WeakRef(route));
129
- return;
130
- }
131
- }
132
- this.#activeRoute.set(null);
127
+ const match = routes.find(route => route[PATH_PATTERN]?.test({ pathname: update.location.pathname })) ?? null;
128
+ this.#activate(match);
129
+ this.#activeRoute.set(match ? new WeakRef(match) : null);
133
130
  };
131
+ /**
132
+ * Marks the matched route as active and the previous one as inactive.
133
+ * Re-activating the same route is intentional: it retries a failed `src`.
134
+ *
135
+ * The previous route is tracked in a plain field rather than read from
136
+ * the #activeRoute signal, so effects calling #handleRouteChange do not
137
+ * start depending on the signal they write.
138
+ *
139
+ * @param route - The matched route, or null when nothing matches
140
+ */
141
+ #activate(route) {
142
+ const previous = this.#activatedRoute?.deref() ?? null;
143
+ if (previous && previous !== route)
144
+ previous[SET_ACTIVE](false);
145
+ route?.[SET_ACTIVE](true);
146
+ this.#activatedRoute = route ? new WeakRef(route) : null;
147
+ }
134
148
  /**
135
149
  * Lifecycle callback when the element is disconnected from the DOM.
136
150
  * Cleans up all observers, effects, and listeners.
@@ -155,9 +169,9 @@ let ThaRouter = class ThaRouter extends HistoryManaged(SignalWatcherLitElement)
155
169
  return this;
156
170
  }
157
171
  };
158
- ThaRouter = __decorate([
159
- customElement("tha-router")
160
- ], ThaRouter);
172
+ RouterElement = __decorate([
173
+ customElement("tp-router")
174
+ ], RouterElement);
161
175
 
162
- export { ThaRouter };
163
- //# sourceMappingURL=tha-router.js.map
176
+ export { RouterElement };
177
+ //# sourceMappingURL=router-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-element.js","sources":["../../../../libs/elements/src/router/router-element.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;AA2BA;;;;;;;;;;;;;;;;;;;AAmBG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,cAAc,CAAC,uBAAuB,CAAC,CAAA;AACxE;;;AAGG;AACH,IAAA;QACE,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAE/C,QAAA,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC;AACxC,QAAA,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,kBAAkB,CAAC;AACnD,QAAA,OAAO,CAAC,WAAW,GAAG,GAAG,CAAA;;;;;;KAMxB,CAAC,QAAQ,EAAE;AACZ,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;;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,EAAE,CAAC,CAAC,IAAI,IAAI;AAE7G,QAAA,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AACrB,QAAA,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;AAC1D,IAAA,CAAC;AAED;;;;;;;;;AASG;AACH,IAAA,SAAS,CAAC,KAA0B,EAAA;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,IAAI,IAAI;AAEtD,QAAA,IAAI,QAAQ,IAAI,QAAQ,KAAK,KAAK;AAAE,YAAA,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;AAE/D,QAAA,KAAK,GAAG,UAAU,CAAC,CAAC,IAAI,CAAC;AACzB,QAAA,IAAI,CAAC,eAAe,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;IAC1D;AAEA;;;AAGG;IACM,oBAAoB,GAAA;QAC3B,KAAK,CAAC,oBAAoB,EAAE;AAE5B,QAAA,IAAI;YACF,IAAI,CAAC,2BAA2B,EAAE;YAClC,IAAI,CAAC,yBAAyB,EAAE;QAClC;AAAE,QAAA,MAAM,cAAc;AAEtB,QAAA,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE;QACrC,IAAI,CAAC,uBAAuB,EAAE;IAChC;AAEA;;;;;AAKG;IACgB,gBAAgB,GAAA;AACjC,QAAA,OAAO,IAAI;IACb;;AAlKW,aAAa,GAAA,UAAA,CAAA;IADzB,aAAa,CAAC,WAAW;AACb,CAAA,EAAA,aAAa,CAmKzB;;;;"}
@@ -22,18 +22,18 @@ var signalWatcherLitElement = require('../utils/signal-watcher-lit-element.cjs')
22
22
  * @example
23
23
  * ```html
24
24
  * <!-- Absolute path -->
25
- * <tha-router-link to="/about">About</tha-router-link>
25
+ * <tp-router-link to="/about">About</tp-router-link>
26
26
  *
27
27
  * <!-- Relative path -->
28
- * <tha-router-link to="./details">Details</tha-router-link>
29
- * <tha-router-link to="../users">Back to Users</tha-router-link>
28
+ * <tp-router-link to="./details">Details</tp-router-link>
29
+ * <tp-router-link to="../users">Back to Users</tp-router-link>
30
30
  *
31
31
  * <!-- History navigation -->
32
- * <tha-router-link to="back">← Back</tha-router-link>
33
- * <tha-router-link to="forward">Forward →</tha-router-link>
32
+ * <tp-router-link to="back">← Back</tp-router-link>
33
+ * <tp-router-link to="forward">Forward →</tp-router-link>
34
34
  * ```
35
35
  */
36
- exports.ThaRouterLink = class ThaRouterLink extends historyManaged.HistoryManaged(signalWatcherLitElement.SignalWatcherLitElement) {
36
+ exports.RouterLinkElement = class RouterLinkElement extends historyManaged.HistoryManaged(signalWatcherLitElement.SignalWatcherLitElement) {
37
37
  constructor() {
38
38
  super(...arguments);
39
39
  /**
@@ -108,13 +108,13 @@ exports.ThaRouterLink = class ThaRouterLink extends historyManaged.HistoryManage
108
108
  this[historyManaged.HISTORY].get()?.push(link || '/');
109
109
  };
110
110
  }
111
- /** Injects global styles for tha-router-link elements to show pointer cursor */
111
+ /** Injects global styles for tp-router-link elements to show pointer cursor */
112
112
  static {
113
113
  const styleEl = document.createElement("style");
114
114
  styleEl.setAttribute("type", "text/css");
115
- styleEl.setAttribute("data-id", "tha-router-link-styles");
115
+ styleEl.setAttribute("data-id", "tp-router-link-styles");
116
116
  styleEl.textContent = lit.css `
117
- tha-router-link {
117
+ tp-router-link {
118
118
  cursor: pointer;
119
119
  }
120
120
  `.toString();
@@ -198,12 +198,12 @@ exports.ThaRouterLink = class ThaRouterLink extends historyManaged.HistoryManage
198
198
  tslib.__decorate([
199
199
  decorators_js.property({ type: String }),
200
200
  tslib.__metadata("design:type", Object)
201
- ], exports.ThaRouterLink.prototype, "to", void 0);
201
+ ], exports.RouterLinkElement.prototype, "to", void 0);
202
202
  tslib.__decorate([
203
203
  decorators_js.property({ type: Boolean, reflect: true }),
204
204
  tslib.__metadata("design:type", Object)
205
- ], exports.ThaRouterLink.prototype, "active", void 0);
206
- exports.ThaRouterLink = tslib.__decorate([
207
- decorators_js.customElement("tha-router-link")
208
- ], exports.ThaRouterLink);
209
- //# sourceMappingURL=tha-router-link.cjs.map
205
+ ], exports.RouterLinkElement.prototype, "active", void 0);
206
+ exports.RouterLinkElement = tslib.__decorate([
207
+ decorators_js.customElement("tp-router-link")
208
+ ], exports.RouterLinkElement);
209
+ //# sourceMappingURL=router-link-element.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-link-element.cjs","sources":["../../../../libs/elements/src/router/router-link-element.ts"],"sourcesContent":[null],"names":["RouterLinkElement","HistoryManaged","SignalWatcherLitElement","noop","signal","computed","HISTORY","HISTORY_TYPE","compact","css","__decorate","property","customElement"],"mappings":";;;;;;;;;;;AA8BA;;;;;;;;;;;;;;;;;;;;;;;AAuBG;AAEUA,yBAAiB,GAAvB,MAAM,iBAAkB,SAAQC,6BAAc,CAACC,+CAAuB,CAAC,CAAA;AAAvE,IAAA,WAAA,GAAA;;AAeL;;;;;;;AAOG;QAEH,IAAA,CAAA,EAAE,GAAoB,IAAI;AAE1B;;;;;;AAMG;QAEH,IAAA,CAAA,MAAM,GAAG,KAAK;;QAGd,IAAA,CAAA,yBAAyB,GAAGC,SAAI;;QAEhC,IAAA,CAAA,uBAAuB,GAAGA,SAAI;;AAG9B,QAAA,IAAA,CAAA,GAAG,GAAGC,cAAM,CAAkB,IAAI,CAAC;;AAEnC,QAAA,IAAA,CAAA,WAAW,GAAGC,gBAAQ,CAAC,MAAK;YAC1B,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;YACzB,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE,KAAK,SAAS;AAAE,gBAAA,OAAO,IAAI;AAEzD,YAAA,IAAI;gBACF,OAAO,IAAI,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;YACzC;AAAE,YAAA,MAAM;AACN,gBAAA,OAAO,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