shirkasoft-ui-components 1.13.18 → 2.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/README.md +415 -42
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +189 -100
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-button.mjs +367 -73
- package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-chart.mjs +206 -142
- package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-config.mjs +976 -0
- package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +307 -142
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +1624 -1400
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs +347 -92
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +484 -293
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-icons.mjs +1141 -0
- package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-knob.mjs +395 -180
- package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-loading.mjs +505 -128
- package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-modal.mjs +311 -303
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-notification.mjs +188 -142
- package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +517 -277
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +669 -289
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +1014 -814
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs +508 -184
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs +197 -57
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +1918 -1676
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tabs.mjs +419 -177
- package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tag.mjs +177 -51
- package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +687 -369
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +466 -0
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-theme.mjs +147 -0
- package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-timeline.mjs +791 -215
- package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-toggle.mjs +205 -128
- package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs +244 -180
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +97 -125
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-wizard.mjs +673 -166
- package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components.mjs +0 -9
- package/package.json +37 -7
- package/src/baseline.css +2472 -0
- package/src/theme.css +15 -543
- package/src/themes/ocean.css +56 -0
- package/src/themes/sunset.css +55 -0
- package/src/themes/violet.css +25 -0
- package/src/tokens.css +612 -0
- package/types/shirkasoft-ui-components-breadcrumb.d.ts +59 -44
- package/types/shirkasoft-ui-components-button.d.ts +142 -49
- package/types/shirkasoft-ui-components-chart.d.ts +59 -44
- package/types/shirkasoft-ui-components-config.d.ts +357 -0
- package/types/shirkasoft-ui-components-confirm-dialog.d.ts +107 -65
- package/types/shirkasoft-ui-components-date-picker.d.ts +527 -373
- package/types/shirkasoft-ui-components-fieldset.d.ts +135 -59
- package/types/shirkasoft-ui-components-file-upload.d.ts +176 -106
- package/types/shirkasoft-ui-components-icons.d.ts +1430 -0
- package/types/shirkasoft-ui-components-knob.d.ts +151 -64
- package/types/shirkasoft-ui-components-loading.d.ts +155 -64
- package/types/shirkasoft-ui-components-modal.d.ts +134 -132
- package/types/shirkasoft-ui-components-notification.d.ts +63 -58
- package/types/shirkasoft-ui-components-price-input.d.ts +198 -85
- package/types/shirkasoft-ui-components-rail-sidebar.d.ts +262 -142
- package/types/shirkasoft-ui-components-select.d.ts +301 -192
- package/types/shirkasoft-ui-components-sidebar.d.ts +198 -92
- package/types/shirkasoft-ui-components-skeleton.d.ts +68 -27
- package/types/shirkasoft-ui-components-table.d.ts +849 -649
- package/types/shirkasoft-ui-components-tabs.d.ts +102 -61
- package/types/shirkasoft-ui-components-tag.d.ts +54 -23
- package/types/shirkasoft-ui-components-text-field.d.ts +231 -111
- package/types/shirkasoft-ui-components-theme-picker.d.ts +117 -0
- package/types/shirkasoft-ui-components-theme.d.ts +80 -0
- package/types/shirkasoft-ui-components-timeline.d.ts +326 -150
- package/types/shirkasoft-ui-components-toggle.d.ts +76 -45
- package/types/shirkasoft-ui-components-tooltip.d.ts +64 -43
- package/types/shirkasoft-ui-components-utils.d.ts +26 -17
- package/types/shirkasoft-ui-components-wizard.d.ts +236 -86
- package/types/shirkasoft-ui-components.d.ts +1 -2
- package/fesm2022/shirkasoft-ui-components.mjs.map +0 -1
|
@@ -1,132 +1,104 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as i0 from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Shirkasoft UI Components.
|
|
7
|
-
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
8
|
-
* Belongs to Shirkasoft.
|
|
9
|
-
*/
|
|
10
|
-
/** Maps the icon names used across the library to their Lucide component. */
|
|
1
|
+
import { ICON_BY_NAME, LucideArrowDown, LucideArrowLeft, LucideArrowUp, LucideArrowUpDown, LucideCalendarDays, LucideCheck, LucideChevronDown, LucideChevronLeft, LucideChevronRight, LucideChevronsLeft, LucideChevronsRight, LucideCirclePlus, LucideCircleQuestionMark, LucideDownload, LucideEllipsisVertical, LucideEye, LucideEyeOff, LucideFile, LucideFileSpreadsheet, LucideFileText, LucideFunnel, LucideGlobe, LucideInbox, LucideInfo, LucideLanguages, LucideLoader, LucideLoaderCircle, LucideLogOut, LucideMaximize2, LucideMenu, LucideMinimize2, LucidePanelRight, LucidePlus, LucideRefreshCw, LucideSearch, LucideTrash2, LucideTriangleAlert, LucideUpload, LucideX } from "shirkasoft-ui-components/icons";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { DestroyRef, Directive, ElementRef, afterNextRender, inject } from "@angular/core";
|
|
11
4
|
const ICONS = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
5
|
+
"arrow-left": LucideArrowLeft,
|
|
6
|
+
"arrow-down": LucideArrowDown,
|
|
7
|
+
"arrow-up": LucideArrowUp,
|
|
8
|
+
"arrow-up-down": LucideArrowUpDown,
|
|
9
|
+
check: LucideCheck,
|
|
10
|
+
"calendar-days": LucideCalendarDays,
|
|
11
|
+
"chevron-down": LucideChevronDown,
|
|
12
|
+
"chevron-left": LucideChevronLeft,
|
|
13
|
+
"chevron-right": LucideChevronRight,
|
|
14
|
+
"chevrons-left": LucideChevronsLeft,
|
|
15
|
+
"chevrons-right": LucideChevronsRight,
|
|
16
|
+
"circle-help": LucideCircleQuestionMark,
|
|
17
|
+
"circle-plus": LucideCirclePlus,
|
|
18
|
+
download: LucideDownload,
|
|
19
|
+
"ellipsis-vertical": LucideEllipsisVertical,
|
|
20
|
+
eye: LucideEye,
|
|
21
|
+
"eye-off": LucideEyeOff,
|
|
22
|
+
file: LucideFile,
|
|
23
|
+
"file-spreadsheet": LucideFileSpreadsheet,
|
|
24
|
+
"file-text": LucideFileText,
|
|
25
|
+
filter: LucideFunnel,
|
|
26
|
+
globe: LucideGlobe,
|
|
27
|
+
languages: LucideLanguages,
|
|
28
|
+
inbox: LucideInbox,
|
|
29
|
+
info: LucideInfo,
|
|
30
|
+
loader: LucideLoader,
|
|
31
|
+
"loader-circle": LucideLoaderCircle,
|
|
32
|
+
"log-out": LucideLogOut,
|
|
33
|
+
"maximize-2": LucideMaximize2,
|
|
34
|
+
menu: LucideMenu,
|
|
35
|
+
"minimize-2": LucideMinimize2,
|
|
36
|
+
"panel-right": LucidePanelRight,
|
|
37
|
+
plus: LucidePlus,
|
|
38
|
+
refresh: LucideRefreshCw,
|
|
39
|
+
search: LucideSearch,
|
|
40
|
+
"trash-2": LucideTrash2,
|
|
41
|
+
"triangle-alert": LucideTriangleAlert,
|
|
42
|
+
upload: LucideUpload,
|
|
43
|
+
x: LucideX
|
|
51
44
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*/
|
|
45
|
+
function isIconResolver(icon) {
|
|
46
|
+
return typeof icon === "function" && !/^class[\s{]/.test(Function.prototype.toString.call(icon));
|
|
47
|
+
}
|
|
56
48
|
function getIcon(icon, fallback = LucideCircleQuestionMark) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
if (typeof icon === 'function') {
|
|
63
|
-
return icon;
|
|
64
|
-
}
|
|
65
|
-
return fallback;
|
|
49
|
+
if (!icon) return null;
|
|
50
|
+
if (typeof icon === "string") return ICONS[icon] ?? ICON_BY_NAME[icon] ?? fallback;
|
|
51
|
+
if (Array.isArray(icon)) return icon;
|
|
52
|
+
return fallback;
|
|
66
53
|
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Shirkasoft UI Components.
|
|
70
|
-
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
71
|
-
* Belongs to Shirkasoft.
|
|
72
|
-
*/
|
|
73
|
-
/**
|
|
74
|
-
* Moves a floating element (dropdown panel, popup, overlay) to `document.body`
|
|
75
|
-
* so it always renders above the rest of the page.
|
|
76
|
-
*
|
|
77
|
-
* `position: fixed` + a high `z-index` is not enough on its own: an ancestor
|
|
78
|
-
* with `transform`, `filter`, `backdrop-filter`, `contain`, or its own stacking
|
|
79
|
-
* context (`z-index` + `position`, `sticky`, `opacity < 1`...) traps the element
|
|
80
|
-
* inside it. Rendering it as a direct child of `body` avoids all of that.
|
|
81
|
-
*
|
|
82
|
-
* The element keeps being managed by Angular (bindings and listeners keep
|
|
83
|
-
* working, and Angular removes it with `node.remove()` when it is hidden).
|
|
84
|
-
* If the anchor lives inside a `.dark` container, the class is copied onto the
|
|
85
|
-
* element so the dark theme (CSS variables, Tailwind `dark:` variants and
|
|
86
|
-
* component `.dark .x` rules) still applies once it is outside the host.
|
|
87
|
-
*
|
|
88
|
-
* Returns a function that removes the element from the DOM; call it when the
|
|
89
|
-
* owner component is destroyed so the element does not stay orphaned in `body`.
|
|
90
|
-
*/
|
|
91
54
|
function portalToBody(element, anchor) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
element.classList.toggle('dark', !!anchor?.closest('.dark'));
|
|
97
|
-
return () => element.remove();
|
|
55
|
+
const doc = element.ownerDocument;
|
|
56
|
+
if (element.parentNode !== doc.body) doc.body.appendChild(element);
|
|
57
|
+
element.classList.toggle("dark", !!anchor?.closest(".dark"));
|
|
58
|
+
return () => element.remove();
|
|
98
59
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
60
|
+
var PortalDirective = class PortalDirective {
|
|
61
|
+
constructor() {
|
|
62
|
+
this.el = inject(ElementRef);
|
|
63
|
+
let remove = null;
|
|
64
|
+
afterNextRender(() => {
|
|
65
|
+
const node = this.el.nativeElement;
|
|
66
|
+
remove = portalToBody(node, node.parentElement);
|
|
67
|
+
});
|
|
68
|
+
inject(DestroyRef).onDestroy(() => remove?.());
|
|
69
|
+
}
|
|
70
|
+
static {
|
|
71
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
72
|
+
minVersion: "12.0.0",
|
|
73
|
+
version: "22.3.2",
|
|
74
|
+
ngImport: i0,
|
|
75
|
+
type: PortalDirective,
|
|
76
|
+
deps: [],
|
|
77
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
static {
|
|
81
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
82
|
+
minVersion: "14.0.0",
|
|
83
|
+
version: "22.3.2",
|
|
84
|
+
type: PortalDirective,
|
|
85
|
+
isStandalone: true,
|
|
86
|
+
selector: "[shkPortal]",
|
|
87
|
+
ngImport: i0
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
92
|
+
minVersion: "12.0.0",
|
|
93
|
+
version: "22.3.2",
|
|
94
|
+
ngImport: i0,
|
|
95
|
+
type: PortalDirective,
|
|
96
|
+
decorators: [{
|
|
97
|
+
type: Directive,
|
|
98
|
+
args: [{ selector: "[shkPortal]" }]
|
|
99
|
+
}],
|
|
100
|
+
ctorParameters: () => []
|
|
101
|
+
});
|
|
102
|
+
export { ICONS, PortalDirective, getIcon, isIconResolver, portalToBody };
|
|
130
103
|
|
|
131
|
-
|
|
132
|
-
//# sourceMappingURL=shirkasoft-ui-components-utils.mjs.map
|
|
104
|
+
//# sourceMappingURL=shirkasoft-ui-components-utils.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shirkasoft-ui-components-utils.mjs","sources":["../../../projects/ui-components/utils/icons.ts","../../../projects/ui-components/utils/portal.ts"
|
|
1
|
+
{"version":3,"file":"shirkasoft-ui-components-utils.mjs","names":[],"sources":["../../../projects/ui-components/utils/icons.ts","../../../projects/ui-components/utils/portal.ts"],"sourcesContent":["/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport {\n LucideArrowDown,\n LucideArrowLeft,\n LucideArrowUp,\n LucideArrowUpDown,\n LucideCalendarDays,\n LucideCheck,\n LucideChevronDown,\n LucideChevronLeft,\n LucideChevronRight,\n LucideChevronsLeft,\n LucideChevronsRight,\n LucideCircleQuestionMark,\n LucideCirclePlus,\n LucideDownload,\n LucideEllipsisVertical,\n LucideEye,\n LucideEyeOff,\n LucideFile,\n LucideFileSpreadsheet,\n LucideFileText,\n LucideFunnel,\n LucideGlobe,\n LucideLanguages,\n LucideInbox,\n LucideInfo,\n LucideLoader,\n LucideLoaderCircle,\n LucideLogOut,\n LucideMaximize2,\n LucideMenu,\n LucideMinimize2,\n LucidePanelRight,\n LucidePlus,\n LucideRefreshCw,\n LucideSearch,\n LucideTrash2,\n LucideTriangleAlert,\n LucideUpload,\n LucideX,\n} from 'shirkasoft-ui-components/icons';\nimport { ICON_BY_NAME } from 'shirkasoft-ui-components/icons';\nimport type { IconNode } from 'shirkasoft-ui-components/icons';\n\n/** Maps the icon names used across the library to their SVG data. */\nexport const ICONS: Record<string, IconNode> = {\n 'arrow-left': LucideArrowLeft,\n 'arrow-down': LucideArrowDown,\n 'arrow-up': LucideArrowUp,\n 'arrow-up-down': LucideArrowUpDown,\n check: LucideCheck,\n 'calendar-days': LucideCalendarDays,\n 'chevron-down': LucideChevronDown,\n 'chevron-left': LucideChevronLeft,\n 'chevron-right': LucideChevronRight,\n 'chevrons-left': LucideChevronsLeft,\n 'chevrons-right': LucideChevronsRight,\n 'circle-help': LucideCircleQuestionMark,\n 'circle-plus': LucideCirclePlus,\n download: LucideDownload,\n 'ellipsis-vertical': LucideEllipsisVertical,\n eye: LucideEye,\n 'eye-off': LucideEyeOff,\n file: LucideFile,\n 'file-spreadsheet': LucideFileSpreadsheet,\n 'file-text': LucideFileText,\n filter: LucideFunnel,\n globe: LucideGlobe,\n languages: LucideLanguages,\n inbox: LucideInbox,\n info: LucideInfo,\n loader: LucideLoader,\n 'loader-circle': LucideLoaderCircle,\n 'log-out': LucideLogOut,\n 'maximize-2': LucideMaximize2,\n menu: LucideMenu,\n 'minimize-2': LucideMinimize2,\n 'panel-right': LucidePanelRight,\n plus: LucidePlus,\n refresh: LucideRefreshCw,\n search: LucideSearch,\n 'trash-2': LucideTrash2,\n 'triangle-alert': LucideTriangleAlert,\n upload: LucideUpload,\n x: LucideX,\n};\n\n/**\n * True when `icon` is a per-item resolver function such as `(row) => 'pencil'`.\n *\n * Classes are functions too, but must never be called: a v1 `@lucide/angular`\n * component passed by an app that has not migrated yet would throw\n * \"Class constructor cannot be invoked without 'new'\". Those fall through to\n * `getIcon()`, which renders the fallback icon instead.\n */\nexport function isIconResolver(icon: unknown): icon is (...args: any[]) => unknown {\n return typeof icon === 'function' && !/^class[\\s{]/.test(Function.prototype.toString.call(icon));\n}\n\n/**\n * Resolves the icon passed to a component into SVG data.\n * Accepts a registered string name or an icon node array.\n */\nexport function getIcon(icon?: any, fallback: any = LucideCircleQuestionMark): IconNode | null {\n if (!icon) return null;\n if (typeof icon === 'string') {\n return ICONS[icon] ?? ICON_BY_NAME[icon] ?? fallback;\n }\n if (Array.isArray(icon)) {\n return icon;\n }\n return fallback;\n}","import { Directive, DestroyRef, ElementRef, afterNextRender, inject } from '@angular/core';\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/**\n * Moves a floating element (dropdown panel, popup, overlay) to `document.body`\n * so it always renders above the rest of the page.\n *\n * `position: fixed` + a high `z-index` is not enough on its own: an ancestor\n * with `transform`, `filter`, `backdrop-filter`, `contain`, or its own stacking\n * context (`z-index` + `position`, `sticky`, `opacity < 1`...) traps the element\n * inside it. Rendering it as a direct child of `body` avoids all of that.\n *\n * The element keeps being managed by Angular (bindings and listeners keep\n * working, and Angular removes it with `node.remove()` when it is hidden).\n * If the anchor lives inside a `.dark` container, the class is copied onto the\n * element so the dark theme (CSS variables, Tailwind `dark:` variants and\n * component `.dark .x` rules) still applies once it is outside the host.\n *\n * Returns a function that removes the element from the DOM; call it when the\n * owner component is destroyed so the element does not stay orphaned in `body`.\n */\nexport function portalToBody(element: HTMLElement, anchor?: HTMLElement | null): () => void {\n const doc = element.ownerDocument;\n if (element.parentNode !== doc.body) {\n doc.body.appendChild(element);\n }\n element.classList.toggle('dark', !!anchor?.closest('.dark'));\n return () => element.remove();\n}\n\n/**\n * Renders the host element in `document.body` (see `portalToBody`) once it is\n * rendered, and removes it when the element or its owner is destroyed.\n *\n * ```html\n * @if (isOpen()) {\n * <div shkPortal class=\"fixed z-[9999]\" [style.top.px]=\"top\">...</div>\n * }\n * ```\n */\n@Directive({ selector: '[shkPortal]' })\nexport class PortalDirective {\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n\n constructor() {\n let remove: (() => void) | null = null;\n afterNextRender(() => {\n const node = this.el.nativeElement;\n remove = portalToBody(node, node.parentElement);\n });\n inject(DestroyRef).onDestroy(() => remove?.());\n }\n}\n"],"mappings":";;;AAkDA,MAAa,QAAkC;CAC7C,cAAc;CACd,cAAc;CACd,YAAY;CACZ,iBAAiB;CACjB,OAAO;CACP,iBAAiB;CACjB,gBAAgB;CAChB,gBAAgB;CAChB,iBAAiB;CACjB,iBAAiB;CACjB,kBAAkB;CAClB,eAAe;CACf,eAAe;CACf,UAAU;CACV,qBAAqB;CACrB,KAAK;CACL,WAAW;CACX,MAAM;CACN,oBAAoB;CACpB,aAAa;CACb,QAAQ;CACR,OAAO;CACP,WAAW;CACX,OAAO;CACP,MAAM;CACN,QAAQ;CACR,iBAAiB;CACjB,WAAW;CACX,cAAc;CACd,MAAM;CACN,cAAc;CACd,eAAe;CACf,MAAM;CACN,SAAS;CACT,QAAQ;CACR,WAAW;CACX,kBAAkB;CAClB,QAAQ;CACR,GAAG;AACJ;AAUD,SAAgB,eAAe,MAAa;CAC1C,OAAO,OAAO,SAAS,cAAc,CAAC,cAAc,KAAK,SAAS,UAAU,SAAS,KAAK,IAAI,CAAC;AACjG;AAMA,SAAgB,QAAQ,MAAY,WAAgB,0BAAwB;CAC1E,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,OAAO,SAAS,UAClB,OAAO,MAAM,SAAS,aAAa,SAAS;CAE9C,IAAI,MAAM,QAAQ,IAAI,GACpB,OAAO;CAET,OAAO;AACT;AC3FA,SAAgB,aAAa,SAAsB,QAA2B;CAC5E,MAAM,MAAM,QAAQ;CACpB,IAAI,QAAQ,eAAe,IAAI,MAC7B,IAAI,KAAK,YAAY,OAAO;CAE9B,QAAQ,UAAU,OAAO,QAAQ,CAAC,CAAC,QAAQ,QAAQ,OAAO,CAAC;CAC3D,aAAa,QAAQ,OAAM;AAC7B;AAaA,IAAa,kBAAb,MAAa,gBAAe;CAG1B,cAAA;EAFiB,KAAA,KAAK,OAAgC,UAAU;EAG9D,IAAI,SAA8B;EAClC,sBAAqB;GACnB,MAAM,OAAO,KAAK,GAAG;GACrB,SAAS,aAAa,MAAM,KAAK,aAAa;EAChD,CAAC;EACD,OAAO,UAAU,CAAC,CAAC,gBAAgB,SAAQ,CAAE;CAC/C;CAVW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAe,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAf;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAe,cAAA;GAAA,UAAA;GAAA,UAAA;EAAA,CAAA;CAAA;;AAAf,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAe,YAAA,CAAA;EAD3B,MAAA;EAAU,MAAA,CAAA,EAAE,UAAU,cAAa,CAAE"}
|