@telperion/elements 1.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.
- package/LICENSE +21 -0
- package/README.md +102 -0
- package/bundle.js +164 -0
- package/bundle.mjs +2630 -0
- package/drag-drop/drag-element.cjs +438 -0
- package/drag-drop/drag-element.d.ts +120 -0
- package/drag-drop/drag-element.js +437 -0
- package/drag-drop/drag-element.js.map +1 -0
- package/drag-drop/drag-handle-element.cjs +35 -0
- package/drag-drop/drag-handle-element.d.ts +12 -0
- package/drag-drop/drag-handle-element.js +34 -0
- package/drag-drop/drag-handle-element.js.map +1 -0
- package/drag-drop/dropzone-element.cjs +117 -0
- package/drag-drop/dropzone-element.d.ts +17 -0
- package/drag-drop/dropzone-element.js +116 -0
- package/drag-drop/dropzone-element.js.map +1 -0
- package/drag-drop/index.cjs +11 -0
- package/drag-drop/index.d.ts +22 -0
- package/drag-drop/index.js +6 -0
- package/drag-drop/index.js.map +1 -0
- package/drag-drop/private-props.cjs +6 -0
- package/drag-drop/private-props.d.ts +3 -0
- package/drag-drop/private-props.js +5 -0
- package/drag-drop/private-props.js.map +1 -0
- package/drag-drop/tha-drag-event.cjs +34 -0
- package/drag-drop/tha-drag-event.d.ts +19 -0
- package/drag-drop/tha-drag-event.js +32 -0
- package/drag-drop/tha-drag-event.js.map +1 -0
- package/icon/icon-element.cjs +114 -0
- package/icon/icon-element.d.ts +40 -0
- package/icon/icon-element.js +113 -0
- package/icon/icon-element.js.map +1 -0
- package/icon/index.cjs +5 -0
- package/icon/index.d.ts +1 -0
- package/icon/index.js +3 -0
- package/icon/index.js.map +1 -0
- package/icon/material-symbols.css +22 -0
- package/index.cjs +11 -0
- package/index.d.ts +6 -0
- package/index.js +10 -0
- package/index.js.map +1 -0
- package/package.json +127 -0
- package/router/history-managed.cjs +97 -0
- package/router/history-managed.d.ts +76 -0
- package/router/history-managed.js +95 -0
- package/router/history-managed.js.map +1 -0
- package/router/history.cjs +65 -0
- package/router/history.d.ts +48 -0
- package/router/history.js +63 -0
- package/router/history.js.map +1 -0
- package/router/index.cjs +15 -0
- package/router/index.d.ts +6 -0
- package/router/index.js +8 -0
- package/router/index.js.map +1 -0
- package/router/signal-watcher-lit-element.cjs +11 -0
- package/router/signal-watcher-lit-element.d.ts +25 -0
- package/router/signal-watcher-lit-element.js +10 -0
- package/router/signal-watcher-lit-element.js.map +1 -0
- package/router/tha-route.cjs +125 -0
- package/router/tha-route.d.ts +90 -0
- package/router/tha-route.js +124 -0
- package/router/tha-route.js.map +1 -0
- package/router/tha-router-config.cjs +241 -0
- package/router/tha-router-config.d.ts +223 -0
- package/router/tha-router-config.js +240 -0
- package/router/tha-router-config.js.map +1 -0
- package/router/tha-router-link.cjs +209 -0
- package/router/tha-router-link.d.ts +95 -0
- package/router/tha-router-link.js +208 -0
- package/router/tha-router-link.js.map +1 -0
- package/router/tha-router-outlet.cjs +215 -0
- package/router/tha-router-outlet.d.ts +112 -0
- package/router/tha-router-outlet.js +214 -0
- package/router/tha-router-outlet.js.map +1 -0
- package/router/tha-router-param.cjs +278 -0
- package/router/tha-router-param.d.ts +226 -0
- package/router/tha-router-param.js +277 -0
- package/router/tha-router-param.js.map +1 -0
- package/router/tha-router.cjs +163 -0
- package/router/tha-router.d.ts +69 -0
- package/router/tha-router.js +162 -0
- package/router/tha-router.js.map +1 -0
- package/tha-url-output.cjs +79 -0
- package/tha-url-output.d.ts +41 -0
- package/tha-url-output.js +78 -0
- package/tha-url-output.js.map +1 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { LitElement, html } from "lit";
|
|
3
|
+
import { customElement, property } from "lit/decorators.js";
|
|
4
|
+
const HOST_CLASSES = [
|
|
5
|
+
"font-normal",
|
|
6
|
+
"not-italic",
|
|
7
|
+
"text-2xl",
|
|
8
|
+
"leading-none",
|
|
9
|
+
"normal-case",
|
|
10
|
+
"tracking-normal",
|
|
11
|
+
"inline-block",
|
|
12
|
+
"whitespace-nowrap",
|
|
13
|
+
"select-none",
|
|
14
|
+
];
|
|
15
|
+
let IconElement = class IconElement extends LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
/** Icon family. Currently only Material Symbols is supported. */
|
|
19
|
+
this.family = "material";
|
|
20
|
+
/** Material Symbols variant. */
|
|
21
|
+
this.variant = "outlined";
|
|
22
|
+
/** Whether the glyph should be filled (FILL axis = 1). */
|
|
23
|
+
this.filled = false;
|
|
24
|
+
/** Material Symbols GRAD axis (-25..200). */
|
|
25
|
+
this.grade = 0;
|
|
26
|
+
/** Material Symbols wght axis (100..700). */
|
|
27
|
+
this.weight = 400;
|
|
28
|
+
/** Material Symbols opsz axis (20..48). Reflects as `optical-size` attribute. */
|
|
29
|
+
this.opticalSize = 24;
|
|
30
|
+
}
|
|
31
|
+
static {
|
|
32
|
+
const style = (this.GLOBAL_STYLE = document.createElement("style"));
|
|
33
|
+
style.textContent = `
|
|
34
|
+
tp-icon[family="material"] {
|
|
35
|
+
font-family: 'Material Symbols Outlined';
|
|
36
|
+
font-variation-settings:
|
|
37
|
+
'FILL' var(--tp-icon-fill, 0),
|
|
38
|
+
'wght' var(--tp-icon-weight, 400),
|
|
39
|
+
'GRAD' var(--tp-icon-grade, 0),
|
|
40
|
+
'opsz' var(--tp-icon-opsz, 24);
|
|
41
|
+
word-wrap: normal;
|
|
42
|
+
direction: ltr;
|
|
43
|
+
font-feature-settings: 'liga';
|
|
44
|
+
-webkit-font-smoothing: antialiased;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
tp-icon[family="material"][variant="round"] {
|
|
48
|
+
font-family: 'Material Symbols Rounded';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
tp-icon[family="material"][variant="sharp"] {
|
|
52
|
+
font-family: 'Material Symbols Sharp';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
tp-icon[filled] {
|
|
56
|
+
--tp-icon-fill: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
tp-icon[grade] {
|
|
60
|
+
--tp-icon-grade: attr(grade type(<number>));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
tp-icon[weight] {
|
|
64
|
+
--tp-icon-weight: attr(weight type(<number>));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
tp-icon[optical-size] {
|
|
68
|
+
--tp-icon-opsz: attr(optical-size type(<number>));
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
document.head.appendChild(style);
|
|
72
|
+
}
|
|
73
|
+
createRenderRoot() {
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
connectedCallback() {
|
|
77
|
+
super.connectedCallback();
|
|
78
|
+
this.classList.add(...HOST_CLASSES);
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
return html ``;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
__decorate([
|
|
85
|
+
property({ reflect: true }),
|
|
86
|
+
__metadata("design:type", String)
|
|
87
|
+
], IconElement.prototype, "family", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
property({ reflect: true }),
|
|
90
|
+
__metadata("design:type", String)
|
|
91
|
+
], IconElement.prototype, "variant", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ type: Boolean, reflect: true }),
|
|
94
|
+
__metadata("design:type", Object)
|
|
95
|
+
], IconElement.prototype, "filled", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
property({ type: Number, reflect: true }),
|
|
98
|
+
__metadata("design:type", Object)
|
|
99
|
+
], IconElement.prototype, "grade", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
property({ type: Number, reflect: true }),
|
|
102
|
+
__metadata("design:type", Object)
|
|
103
|
+
], IconElement.prototype, "weight", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
property({ type: Number, reflect: true, attribute: "optical-size" }),
|
|
106
|
+
__metadata("design:type", Object)
|
|
107
|
+
], IconElement.prototype, "opticalSize", void 0);
|
|
108
|
+
IconElement = __decorate([
|
|
109
|
+
customElement("tp-icon")
|
|
110
|
+
], IconElement);
|
|
111
|
+
export { IconElement };
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=icon-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/elements/src/icon/icon-element.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAuB5D,MAAM,YAAY,GAAG;IACnB,aAAa;IACb,YAAY;IACZ,UAAU;IACV,cAAc;IACd,aAAa;IACb,iBAAiB;IACjB,cAAc;IACd,mBAAmB;IACnB,aAAa;CACd,CAAC;AAGK,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QA+CL,iEAAiE;QAEjE,WAAM,GAAe,UAAU,CAAC;QAEhC,gCAAgC;QAEhC,YAAO,GAAmC,UAAU,CAAC;QAErD,0DAA0D;QAE1D,WAAM,GAAG,KAAK,CAAC;QAEf,6CAA6C;QAE7C,UAAK,GAAG,CAAC,CAAC;QAEV,6CAA6C;QAE7C,WAAM,GAAG,GAAG,CAAC;QAEb,iFAAiF;QAEjF,gBAAW,GAAG,EAAE,CAAC;IAcnB,CAAC;IAhFC;QACE,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;QAEpE,KAAK,CAAC,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCnB,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IA0BkB,gBAAgB;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAEQ,iBAAiB;QACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC;IACtC,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA,EAAE,CAAC;IAChB,CAAC;CACF,CAAA;AAlCC;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;2CACI;AAIhC;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;4CACyB;AAIrD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;2CAC5B;AAIf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;0CAChC;AAIV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;2CAC7B;AAIb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;;gDACpD;AArEN,WAAW;IADvB,aAAa,CAAC,SAAS,CAAC;GACZ,WAAW,CAmFvB","file":"icon-element.js","sourcesContent":["import { LitElement, html } from \"lit\";\r\nimport type { TemplateResult } from \"lit\";\r\nimport { customElement, property } from \"lit/decorators.js\";\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n /**\r\n * A framework-agnostic icon element backed by Material Symbols.\r\n *\r\n * Renders into the **light DOM** so the host's utility classes are styled by the consumer's\r\n * Tailwind v4 build. Required attribute-driven CSS (font-family, font-variation-settings,\r\n * `attr(... type(<number>))` rules) is injected once into `document.head` by the element class.\r\n *\r\n * Pick icons from https://fonts.google.com/icons\r\n *\r\n * @example\r\n * ```html\r\n * <tp-icon>home</tp-icon>\r\n * <tp-icon family=\"material\" variant=\"round\" filled grade=\"200\" weight=\"700\" optical-size=\"48\">favorite</tp-icon>\r\n * ```\r\n */\r\n \"tp-icon\": IconElement;\r\n }\r\n}\r\n\r\nconst HOST_CLASSES = [\r\n \"font-normal\",\r\n \"not-italic\",\r\n \"text-2xl\",\r\n \"leading-none\",\r\n \"normal-case\",\r\n \"tracking-normal\",\r\n \"inline-block\",\r\n \"whitespace-nowrap\",\r\n \"select-none\",\r\n];\r\n\r\n@customElement(\"tp-icon\")\r\nexport class IconElement extends LitElement {\r\n declare private static GLOBAL_STYLE: HTMLStyleElement;\r\n\r\n static {\r\n const style = (this.GLOBAL_STYLE = document.createElement(\"style\"));\r\n\r\n style.textContent = `\r\n tp-icon[family=\"material\"] {\r\n font-family: 'Material Symbols Outlined';\r\n font-variation-settings:\r\n 'FILL' var(--tp-icon-fill, 0),\r\n 'wght' var(--tp-icon-weight, 400),\r\n 'GRAD' var(--tp-icon-grade, 0),\r\n 'opsz' var(--tp-icon-opsz, 24);\r\n word-wrap: normal;\r\n direction: ltr;\r\n font-feature-settings: 'liga';\r\n -webkit-font-smoothing: antialiased;\r\n }\r\n\r\n tp-icon[family=\"material\"][variant=\"round\"] {\r\n font-family: 'Material Symbols Rounded';\r\n }\r\n\r\n tp-icon[family=\"material\"][variant=\"sharp\"] {\r\n font-family: 'Material Symbols Sharp';\r\n }\r\n\r\n tp-icon[filled] {\r\n --tp-icon-fill: 1;\r\n }\r\n\r\n tp-icon[grade] {\r\n --tp-icon-grade: attr(grade type(<number>));\r\n }\r\n\r\n tp-icon[weight] {\r\n --tp-icon-weight: attr(weight type(<number>));\r\n }\r\n\r\n tp-icon[optical-size] {\r\n --tp-icon-opsz: attr(optical-size type(<number>));\r\n }\r\n `;\r\n document.head.appendChild(style);\r\n }\r\n\r\n /** Icon family. Currently only Material Symbols is supported. */\r\n @property({ reflect: true })\r\n family: \"material\" = \"material\";\r\n\r\n /** Material Symbols variant. */\r\n @property({ reflect: true })\r\n variant: \"outlined\" | \"round\" | \"sharp\" = \"outlined\";\r\n\r\n /** Whether the glyph should be filled (FILL axis = 1). */\r\n @property({ type: Boolean, reflect: true })\r\n filled = false;\r\n\r\n /** Material Symbols GRAD axis (-25..200). */\r\n @property({ type: Number, reflect: true })\r\n grade = 0;\r\n\r\n /** Material Symbols wght axis (100..700). */\r\n @property({ type: Number, reflect: true })\r\n weight = 400;\r\n\r\n /** Material Symbols opsz axis (20..48). Reflects as `optical-size` attribute. */\r\n @property({ type: Number, reflect: true, attribute: \"optical-size\" })\r\n opticalSize = 24;\r\n\r\n protected override createRenderRoot(): HTMLElement {\r\n return this;\r\n }\r\n\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n this.classList.add(...HOST_CLASSES);\r\n }\r\n\r\n protected override render(): TemplateResult {\r\n return html``;\r\n }\r\n}\r\n"]}
|
package/icon/index.cjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IconElement = void 0;
|
|
4
|
+
var icon_element_1 = require("./icon-element");
|
|
5
|
+
Object.defineProperty(exports, "IconElement", { enumerable: true, get: function () { return icon_element_1.IconElement; } });
|
package/icon/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IconElement } from "./icon-element";
|
package/icon/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/elements/src/icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC","file":"index.js","sourcesContent":["export { IconElement } from \"./icon-element\";\r\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Material Symbols font loader for `<tp-icon>`.
|
|
3
|
+
*
|
|
4
|
+
* Imports the three Material Symbols variable fonts via the Google Fonts CSS API
|
|
5
|
+
* (https://fonts.googleapis.com/css2). The API resolves to the latest revisioned
|
|
6
|
+
* woff2 URL on each request, so we never have to chase Google's periodic hash
|
|
7
|
+
* rotations on `fonts.gstatic.com`.
|
|
8
|
+
*
|
|
9
|
+
* Loaded by the consumer (this file is NOT auto-imported by the element):
|
|
10
|
+
* import "@telperion/elements/icon/material-symbols.css";
|
|
11
|
+
*
|
|
12
|
+
* Self-host alternative (zero runtime dependency on Google):
|
|
13
|
+
* 1. Download the variable fonts from
|
|
14
|
+
* https://github.com/google/material-design-icons/tree/master/variablefont
|
|
15
|
+
* 2. Replace the @import lines below with @font-face declarations whose
|
|
16
|
+
* `font-family` matches `Material Symbols Outlined`, `Material Symbols Rounded`,
|
|
17
|
+
* and `Material Symbols Sharp` and whose `src` points at your hosted files.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200");
|
|
21
|
+
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200");
|
|
22
|
+
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200");
|
package/index.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @telperion/elements
|
|
4
|
+
* A collection of custom web components built with Lit Elements
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
// Router components
|
|
9
|
+
tslib_1.__exportStar(require("./router"), exports);
|
|
10
|
+
// Drag & drop components
|
|
11
|
+
tslib_1.__exportStar(require("./drag-drop"), exports);
|
package/index.d.ts
ADDED
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/elements/src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAoB;AACpB,cAAc,UAAU,CAAC;AAEzB,yBAAyB;AACzB,cAAc,aAAa,CAAC","file":"index.js","sourcesContent":["/**\n * @telperion/elements\n * A collection of custom web components built with Lit Elements\n */\n\n// Router components\nexport * from './router';\n\n// Drag & drop components\nexport * from './drag-drop';\n\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@telperion/elements",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"homepage": "https://elements.thalesrc.com",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/thalesrc/thalesrc.git",
|
|
8
|
+
"directory": "libs/elements"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@lit-labs/signals": "^0.2.0",
|
|
12
|
+
"@telperion/extra-ts-types": "^1.5.0",
|
|
13
|
+
"@thalesrc/dom-utils": "^1.0.0",
|
|
14
|
+
"@telperion/js-utils": "^3.7.1",
|
|
15
|
+
"history": "^5.3.0",
|
|
16
|
+
"lit": "^3.3.1"
|
|
17
|
+
},
|
|
18
|
+
"main": "./index.js",
|
|
19
|
+
"module": "./index.cjs",
|
|
20
|
+
"typings": "./index.d.ts",
|
|
21
|
+
"private": false,
|
|
22
|
+
"exports": {
|
|
23
|
+
"./icon/material-symbols.css": "./icon/material-symbols.css",
|
|
24
|
+
".": {
|
|
25
|
+
"default": "./index.cjs",
|
|
26
|
+
"import": "./index.js",
|
|
27
|
+
"node": "./index.cjs",
|
|
28
|
+
"require": "./index.cjs",
|
|
29
|
+
"types": "./index.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./router": {
|
|
32
|
+
"default": "./router/index.cjs",
|
|
33
|
+
"import": "./router/index.js",
|
|
34
|
+
"node": "./router/index.cjs",
|
|
35
|
+
"require": "./router/index.cjs",
|
|
36
|
+
"types": "./router/index.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"./router/tha-router": {
|
|
39
|
+
"default": "./router/tha-router.cjs",
|
|
40
|
+
"import": "./router/tha-router.js",
|
|
41
|
+
"node": "./router/tha-router.cjs",
|
|
42
|
+
"require": "./router/tha-router.cjs",
|
|
43
|
+
"types": "./router/tha-router.d.ts"
|
|
44
|
+
},
|
|
45
|
+
"./router/tha-route": {
|
|
46
|
+
"default": "./router/tha-route.cjs",
|
|
47
|
+
"import": "./router/tha-route.js",
|
|
48
|
+
"node": "./router/tha-route.cjs",
|
|
49
|
+
"require": "./router/tha-route.cjs",
|
|
50
|
+
"types": "./router/tha-route.d.ts"
|
|
51
|
+
},
|
|
52
|
+
"./router/tha-router-link": {
|
|
53
|
+
"default": "./router/tha-router-link.cjs",
|
|
54
|
+
"import": "./router/tha-router-link.js",
|
|
55
|
+
"node": "./router/tha-router-link.cjs",
|
|
56
|
+
"require": "./router/tha-router-link.cjs",
|
|
57
|
+
"types": "./router/tha-router-link.d.ts"
|
|
58
|
+
},
|
|
59
|
+
"./router/tha-router-outlet": {
|
|
60
|
+
"default": "./router/tha-router-outlet.cjs",
|
|
61
|
+
"import": "./router/tha-router-outlet.js",
|
|
62
|
+
"node": "./router/tha-router-outlet.cjs",
|
|
63
|
+
"require": "./router/tha-router-outlet.cjs",
|
|
64
|
+
"types": "./router/tha-router-outlet.d.ts"
|
|
65
|
+
},
|
|
66
|
+
"./router/tha-router-config": {
|
|
67
|
+
"default": "./router/tha-router-config.cjs",
|
|
68
|
+
"import": "./router/tha-router-config.js",
|
|
69
|
+
"node": "./router/tha-router-config.cjs",
|
|
70
|
+
"require": "./router/tha-router-config.cjs",
|
|
71
|
+
"types": "./router/tha-router-config.d.ts"
|
|
72
|
+
},
|
|
73
|
+
"./drag-drop": {
|
|
74
|
+
"default": "./drag-drop/index.cjs",
|
|
75
|
+
"import": "./drag-drop/index.js",
|
|
76
|
+
"node": "./drag-drop/index.cjs",
|
|
77
|
+
"require": "./drag-drop/index.cjs",
|
|
78
|
+
"types": "./drag-drop/index.d.ts"
|
|
79
|
+
},
|
|
80
|
+
"./drag-drop/drag-element": {
|
|
81
|
+
"default": "./drag-drop/drag-element.cjs",
|
|
82
|
+
"import": "./drag-drop/drag-element.js",
|
|
83
|
+
"node": "./drag-drop/drag-element.cjs",
|
|
84
|
+
"require": "./drag-drop/drag-element.cjs",
|
|
85
|
+
"types": "./drag-drop/drag-element.d.ts"
|
|
86
|
+
},
|
|
87
|
+
"./drag-drop/drag-handle-element": {
|
|
88
|
+
"default": "./drag-drop/drag-handle-element.cjs",
|
|
89
|
+
"import": "./drag-drop/drag-handle-element.js",
|
|
90
|
+
"node": "./drag-drop/drag-handle-element.cjs",
|
|
91
|
+
"require": "./drag-drop/drag-handle-element.cjs",
|
|
92
|
+
"types": "./drag-drop/drag-handle-element.d.ts"
|
|
93
|
+
},
|
|
94
|
+
"./drag-drop/dropzone-element": {
|
|
95
|
+
"default": "./drag-drop/dropzone-element.cjs",
|
|
96
|
+
"import": "./drag-drop/dropzone-element.js",
|
|
97
|
+
"node": "./drag-drop/dropzone-element.cjs",
|
|
98
|
+
"require": "./drag-drop/dropzone-element.cjs",
|
|
99
|
+
"types": "./drag-drop/dropzone-element.d.ts"
|
|
100
|
+
},
|
|
101
|
+
"./icon": {
|
|
102
|
+
"default": "./icon/index.cjs",
|
|
103
|
+
"import": "./icon/index.js",
|
|
104
|
+
"node": "./icon/index.cjs",
|
|
105
|
+
"require": "./icon/index.cjs",
|
|
106
|
+
"types": "./icon/index.d.ts"
|
|
107
|
+
},
|
|
108
|
+
"./icon/icon-element": {
|
|
109
|
+
"default": "./icon/icon-element.cjs",
|
|
110
|
+
"import": "./icon/icon-element.js",
|
|
111
|
+
"node": "./icon/icon-element.cjs",
|
|
112
|
+
"require": "./icon/icon-element.cjs",
|
|
113
|
+
"types": "./icon/icon-element.d.ts"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"bugs": "https://github.com/telperiontech/telperion/issues",
|
|
117
|
+
"license": "MIT",
|
|
118
|
+
"author": {
|
|
119
|
+
"name": "Ali Şahin Özçelik",
|
|
120
|
+
"email": "alisahinozcelik@gmail.com",
|
|
121
|
+
"url": "https://alisah.in"
|
|
122
|
+
},
|
|
123
|
+
"funding": {
|
|
124
|
+
"type": "patreon",
|
|
125
|
+
"url": "https://www.patreon.com/alisahin"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview History management mixin for Lit elements
|
|
4
|
+
*
|
|
5
|
+
* Hierarchical resolution: own history → parent history → global history
|
|
6
|
+
*
|
|
7
|
+
* @module router/history-managed
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.HistoryManaged = exports.HISTORY_TYPE = exports.HISTORY = void 0;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const decorators_js_1 = require("lit/decorators.js");
|
|
13
|
+
const history_1 = require("./history");
|
|
14
|
+
const signals_1 = require("@lit-labs/signals");
|
|
15
|
+
/**
|
|
16
|
+
* Symbol for accessing the resolved history instance.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const history = this[HISTORY].get();
|
|
21
|
+
* history.push('/path');
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
exports.HISTORY = Symbol('HistoryManaged:history');
|
|
25
|
+
/**
|
|
26
|
+
* Symbol for accessing the resolved history type.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
exports.HISTORY_TYPE = Symbol('HistoryManaged:historyType');
|
|
30
|
+
/**
|
|
31
|
+
* Mixin that adds hierarchical history management to Lit elements.
|
|
32
|
+
*
|
|
33
|
+
* Provides reactive history resolution: own → parent → global
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* class MyRouter extends HistoryManaged(LitElement) {
|
|
38
|
+
* connectedCallback() {
|
|
39
|
+
* super.connectedCallback();
|
|
40
|
+
* const history = this[HISTORY].get();
|
|
41
|
+
* history.listen(({ location }) => this.updateRoutes());
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @template T - Base class (must extend LitElement)
|
|
47
|
+
* @param superClass - The class to extend
|
|
48
|
+
* @returns Extended class with history management
|
|
49
|
+
*/
|
|
50
|
+
const HistoryManaged = (superClass) => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
class HistoryManagedLitElement extends superClass {
|
|
53
|
+
constructor() {
|
|
54
|
+
super(...arguments);
|
|
55
|
+
/**
|
|
56
|
+
* History strategy: "browser" | "hash" | "memory" | "memory:name"
|
|
57
|
+
* If undefined, inherits from parent or uses global default.
|
|
58
|
+
*
|
|
59
|
+
* @attr history
|
|
60
|
+
*/
|
|
61
|
+
this.history = undefined;
|
|
62
|
+
/** Signal for own history type */
|
|
63
|
+
this.#ownHistoryType = (0, signals_1.signal)(this.history);
|
|
64
|
+
/** Computed signal for parent history type */
|
|
65
|
+
this.#parentHistoryType = (0, signals_1.computed)(() => {
|
|
66
|
+
const parent = this.closest('tha-router-config, tha-router-outlet');
|
|
67
|
+
return parent?.[exports.HISTORY_TYPE]?.get();
|
|
68
|
+
});
|
|
69
|
+
/** Resolved history type: own → parent → global */
|
|
70
|
+
this[_a] = (0, signals_1.computed)(() => this.#ownHistoryType.get() ?? this.#parentHistoryType.get() ?? history_1.GLOBAL_HISTORY_TYPE.get());
|
|
71
|
+
/** Resolved history instance: own → parent → global */
|
|
72
|
+
this[_b] = (0, signals_1.computed)(() => (0, history_1.getHistoryByType)(this[exports.HISTORY_TYPE].get()));
|
|
73
|
+
}
|
|
74
|
+
static { _a = exports.HISTORY_TYPE, _b = exports.HISTORY; }
|
|
75
|
+
/** Signal for own history type */
|
|
76
|
+
#ownHistoryType;
|
|
77
|
+
/** Computed signal for parent history type */
|
|
78
|
+
#parentHistoryType;
|
|
79
|
+
/**
|
|
80
|
+
* Handles attribute changes, updating history signals when needed.
|
|
81
|
+
*/
|
|
82
|
+
attributeChangedCallback(name, _old, value) {
|
|
83
|
+
super.attributeChangedCallback(name, _old, value);
|
|
84
|
+
switch (name) {
|
|
85
|
+
case 'history':
|
|
86
|
+
this.#ownHistoryType.set(value);
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
tslib_1.__decorate([
|
|
92
|
+
(0, decorators_js_1.property)({ type: String }),
|
|
93
|
+
tslib_1.__metadata("design:type", Object)
|
|
94
|
+
], HistoryManagedLitElement.prototype, "history", void 0);
|
|
95
|
+
return HistoryManagedLitElement;
|
|
96
|
+
};
|
|
97
|
+
exports.HistoryManaged = HistoryManaged;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview History management mixin for Lit elements
|
|
3
|
+
*
|
|
4
|
+
* Hierarchical resolution: own history → parent history → global history
|
|
5
|
+
*
|
|
6
|
+
* @module router/history-managed
|
|
7
|
+
*/
|
|
8
|
+
import { HistoryType } from "./history";
|
|
9
|
+
import { Signal } from "@lit-labs/signals";
|
|
10
|
+
import { History } from "history";
|
|
11
|
+
import { LitElement } from "lit";
|
|
12
|
+
/**
|
|
13
|
+
* Constructor type for mixin pattern.
|
|
14
|
+
* @template T - The instance type
|
|
15
|
+
*/
|
|
16
|
+
type Constructor<T = {}> = new (...args: any[]) => T;
|
|
17
|
+
/**
|
|
18
|
+
* Symbol for accessing the resolved history instance.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const history = this[HISTORY].get();
|
|
23
|
+
* history.push('/path');
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const HISTORY: unique symbol;
|
|
27
|
+
/**
|
|
28
|
+
* Symbol for accessing the resolved history type.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare const HISTORY_TYPE: unique symbol;
|
|
32
|
+
/**
|
|
33
|
+
* Interface for elements with history management.
|
|
34
|
+
*
|
|
35
|
+
* Resolution order: own history → parent history → global history
|
|
36
|
+
*/
|
|
37
|
+
export interface HistoryManagedLitElementType extends Element {
|
|
38
|
+
/**
|
|
39
|
+
* History strategy: "browser" | "hash" | "memory" | "memory:name"
|
|
40
|
+
* If undefined, inherits from parent or uses global default.
|
|
41
|
+
*/
|
|
42
|
+
history: HistoryType | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Computed signal with resolved history type.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
[HISTORY_TYPE]: Signal.Computed<HistoryType | undefined>;
|
|
48
|
+
/**
|
|
49
|
+
* Computed signal with resolved history instance.
|
|
50
|
+
* Access via: `this[HISTORY].get()`
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
[HISTORY]: Signal.Computed<History>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Mixin that adds hierarchical history management to Lit elements.
|
|
57
|
+
*
|
|
58
|
+
* Provides reactive history resolution: own → parent → global
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* class MyRouter extends HistoryManaged(LitElement) {
|
|
63
|
+
* connectedCallback() {
|
|
64
|
+
* super.connectedCallback();
|
|
65
|
+
* const history = this[HISTORY].get();
|
|
66
|
+
* history.listen(({ location }) => this.updateRoutes());
|
|
67
|
+
* }
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @template T - Base class (must extend LitElement)
|
|
72
|
+
* @param superClass - The class to extend
|
|
73
|
+
* @returns Extended class with history management
|
|
74
|
+
*/
|
|
75
|
+
export declare const HistoryManaged: <T extends Constructor<LitElement>>(superClass: T) => Constructor<HistoryManagedLitElementType> & T;
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview History management mixin for Lit elements
|
|
3
|
+
*
|
|
4
|
+
* Hierarchical resolution: own history → parent history → global history
|
|
5
|
+
*
|
|
6
|
+
* @module router/history-managed
|
|
7
|
+
*/
|
|
8
|
+
import { __decorate, __metadata } from "tslib";
|
|
9
|
+
import { property } from "lit/decorators.js";
|
|
10
|
+
import { getHistoryByType, GLOBAL_HISTORY_TYPE } from "./history";
|
|
11
|
+
import { computed, signal } from "@lit-labs/signals";
|
|
12
|
+
/**
|
|
13
|
+
* Symbol for accessing the resolved history instance.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const history = this[HISTORY].get();
|
|
18
|
+
* history.push('/path');
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export const HISTORY = Symbol('HistoryManaged:history');
|
|
22
|
+
/**
|
|
23
|
+
* Symbol for accessing the resolved history type.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export const HISTORY_TYPE = Symbol('HistoryManaged:historyType');
|
|
27
|
+
/**
|
|
28
|
+
* Mixin that adds hierarchical history management to Lit elements.
|
|
29
|
+
*
|
|
30
|
+
* Provides reactive history resolution: own → parent → global
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* class MyRouter extends HistoryManaged(LitElement) {
|
|
35
|
+
* connectedCallback() {
|
|
36
|
+
* super.connectedCallback();
|
|
37
|
+
* const history = this[HISTORY].get();
|
|
38
|
+
* history.listen(({ location }) => this.updateRoutes());
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @template T - Base class (must extend LitElement)
|
|
44
|
+
* @param superClass - The class to extend
|
|
45
|
+
* @returns Extended class with history management
|
|
46
|
+
*/
|
|
47
|
+
export const HistoryManaged = (superClass) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
class HistoryManagedLitElement extends superClass {
|
|
50
|
+
constructor() {
|
|
51
|
+
super(...arguments);
|
|
52
|
+
/**
|
|
53
|
+
* History strategy: "browser" | "hash" | "memory" | "memory:name"
|
|
54
|
+
* If undefined, inherits from parent or uses global default.
|
|
55
|
+
*
|
|
56
|
+
* @attr history
|
|
57
|
+
*/
|
|
58
|
+
this.history = undefined;
|
|
59
|
+
/** Signal for own history type */
|
|
60
|
+
this.#ownHistoryType = signal(this.history);
|
|
61
|
+
/** Computed signal for parent history type */
|
|
62
|
+
this.#parentHistoryType = computed(() => {
|
|
63
|
+
const parent = this.closest('tha-router-config, tha-router-outlet');
|
|
64
|
+
return parent?.[HISTORY_TYPE]?.get();
|
|
65
|
+
});
|
|
66
|
+
/** Resolved history type: own → parent → global */
|
|
67
|
+
this[_a] = computed(() => this.#ownHistoryType.get() ?? this.#parentHistoryType.get() ?? GLOBAL_HISTORY_TYPE.get());
|
|
68
|
+
/** Resolved history instance: own → parent → global */
|
|
69
|
+
this[_b] = computed(() => getHistoryByType(this[HISTORY_TYPE].get()));
|
|
70
|
+
}
|
|
71
|
+
static { _a = HISTORY_TYPE, _b = HISTORY; }
|
|
72
|
+
/** Signal for own history type */
|
|
73
|
+
#ownHistoryType;
|
|
74
|
+
/** Computed signal for parent history type */
|
|
75
|
+
#parentHistoryType;
|
|
76
|
+
/**
|
|
77
|
+
* Handles attribute changes, updating history signals when needed.
|
|
78
|
+
*/
|
|
79
|
+
attributeChangedCallback(name, _old, value) {
|
|
80
|
+
super.attributeChangedCallback(name, _old, value);
|
|
81
|
+
switch (name) {
|
|
82
|
+
case 'history':
|
|
83
|
+
this.#ownHistoryType.set(value);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
__decorate([
|
|
89
|
+
property({ type: String }),
|
|
90
|
+
__metadata("design:type", Object)
|
|
91
|
+
], HistoryManagedLitElement.prototype, "history", void 0);
|
|
92
|
+
return HistoryManagedLitElement;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=history-managed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/elements/src/router/history-managed.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAkB,mBAAmB,EAAe,MAAM,WAAW,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAU,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAU7D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AA4BjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAoC,UAAa,EAAE,EAAE;;IACjF,MAAM,wBAAyB,SAAQ,UAAU;QAAjD;;YACE;;;;;eAKG;YAEH,YAAO,GAA4B,SAAS,CAAC;YAE7C,kCAAkC;YAClC,oBAAe,GAAG,MAAM,CAA0B,IAAI,CAAC,OAAO,CAAC,CAAC;YAEhE,8CAA8C;YAC9C,uBAAkB,GAAG,QAAQ,CAAC,GAAG,EAAE;gBACjC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,sCAAsC,CAAwC,CAAC;gBAE3G,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;YACvC,CAAC,CAAC,CAAC;YAEH,mDAAmD;YACnD,QAAc,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE,IAAI,mBAAmB,CAAC,GAAG,EAAE,CAAC,CAAC;YAE1H,uDAAuD;YACvD,QAAS,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,EAAG,CAAC,CAAC,CAAC;QAc1E,CAAC;sBAjBE,YAAY,OAGZ,OAAO;QAdR,kCAAkC;QAClC,eAAe,CAAiD;QAEhE,8CAA8C;QAC9C,kBAAkB,CAIf;QAQH;;WAEG;QACM,wBAAwB,CAAC,IAAY,EAAE,IAAmB,EAAE,KAAoB;YACvF,KAAK,CAAC,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAElD,QAAQ,IAAI,EAAE,CAAC;gBACb,KAAK,SAAS;oBACZ,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAgC,CAAC,CAAC;oBAC3D,MAAM;YACV,CAAC;QACH,CAAC;KACF;IA9BC;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6DACkB;IAgC/C,OAAO,wBAAyE,CAAC;AACnF,CAAC,CAAA","file":"history-managed.js","sourcesContent":["/**\n * @fileoverview History management mixin for Lit elements\n *\n * Hierarchical resolution: own history → parent history → global history\n *\n * @module router/history-managed\n */\n\nimport { property } from \"lit/decorators.js\";\nimport { getHistoryByType, GLOBAL_HISTORY, GLOBAL_HISTORY_TYPE, HistoryType } from \"./history\";\nimport { computed, Signal, signal } from \"@lit-labs/signals\";\nimport { History } from \"history\";\nimport { LitElement } from \"lit\";\n\n/**\n * Constructor type for mixin pattern.\n * @template T - The instance type\n */\ntype Constructor<T = {}> = new (...args: any[]) => T;\n\n/**\n * Symbol for accessing the resolved history instance.\n *\n * @example\n * ```typescript\n * const history = this[HISTORY].get();\n * history.push('/path');\n * ```\n */\nexport const HISTORY = Symbol('HistoryManaged:history');\n\n/**\n * Symbol for accessing the resolved history type.\n * @internal\n */\nexport const HISTORY_TYPE = Symbol('HistoryManaged:historyType');\n\n/**\n * Interface for elements with history management.\n *\n * Resolution order: own history → parent history → global history\n */\nexport interface HistoryManagedLitElementType extends Element {\n /**\n * History strategy: \"browser\" | \"hash\" | \"memory\" | \"memory:name\"\n * If undefined, inherits from parent or uses global default.\n */\n history: HistoryType | undefined;\n\n /**\n * Computed signal with resolved history type.\n * @internal\n */\n [HISTORY_TYPE]: Signal.Computed<HistoryType | undefined>;\n\n /**\n * Computed signal with resolved history instance.\n * Access via: `this[HISTORY].get()`\n * @internal\n */\n [HISTORY]: Signal.Computed<History>;\n}\n\n/**\n * Mixin that adds hierarchical history management to Lit elements.\n *\n * Provides reactive history resolution: own → parent → global\n *\n * @example\n * ```typescript\n * class MyRouter extends HistoryManaged(LitElement) {\n * connectedCallback() {\n * super.connectedCallback();\n * const history = this[HISTORY].get();\n * history.listen(({ location }) => this.updateRoutes());\n * }\n * }\n * ```\n *\n * @template T - Base class (must extend LitElement)\n * @param superClass - The class to extend\n * @returns Extended class with history management\n */\nexport const HistoryManaged = <T extends Constructor<LitElement>>(superClass: T) => {\n class HistoryManagedLitElement extends superClass implements HistoryManagedLitElementType {\n /**\n * History strategy: \"browser\" | \"hash\" | \"memory\" | \"memory:name\"\n * If undefined, inherits from parent or uses global default.\n *\n * @attr history\n */\n @property({ type: String })\n history: HistoryType | undefined = undefined;\n\n /** Signal for own history type */\n #ownHistoryType = signal<HistoryType | undefined>(this.history);\n\n /** Computed signal for parent history type */\n #parentHistoryType = computed(() => {\n const parent = this.closest('tha-router-config, tha-router-outlet') as HistoryManagedLitElementType | null;\n\n return parent?.[HISTORY_TYPE]?.get();\n });\n\n /** Resolved history type: own → parent → global */\n [HISTORY_TYPE] = computed(() => this.#ownHistoryType.get() ?? this.#parentHistoryType.get() ?? GLOBAL_HISTORY_TYPE.get());\n\n /** Resolved history instance: own → parent → global */\n [HISTORY] = computed(() => getHistoryByType(this[HISTORY_TYPE].get()!));\n\n /**\n * Handles attribute changes, updating history signals when needed.\n */\n override attributeChangedCallback(name: string, _old: string | null, value: string | null): void {\n super.attributeChangedCallback(name, _old, value);\n\n switch (name) {\n case 'history':\n this.#ownHistoryType.set(value as HistoryType | undefined);\n break;\n }\n }\n }\n\n return HistoryManagedLitElement as Constructor<HistoryManagedLitElementType> & T;\n}\n"]}
|