@nuraly/runtime 0.1.0 → 0.1.3

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 (58) hide show
  1. package/components/ui/components/ToastContainer/ToastContainer.ts +8 -1
  2. package/components/ui/components/advanced/AIChat/AIChat.ts +20 -3
  3. package/components/ui/components/advanced/Collapse/Collapse.ts +8 -1
  4. package/components/ui/components/advanced/MicroApp/MicroApp.ts +9 -2
  5. package/components/ui/components/display/Badge/Badge.ts +8 -1
  6. package/components/ui/components/display/Divider/Divider.ts +9 -2
  7. package/components/ui/components/display/Icon/Icon.ts +9 -2
  8. package/components/ui/components/display/Image/Image.ts +9 -2
  9. package/components/ui/components/display/Table/Table.ts +9 -2
  10. package/components/ui/components/display/Tag/Tag.ts +8 -1
  11. package/components/ui/components/display/TextLabel/TextLabel.ts +9 -2
  12. package/components/ui/components/display/Video/Video.ts +9 -2
  13. package/components/ui/components/inputs/Button/Button.ts +7 -1
  14. package/components/ui/components/inputs/Checkbox/Checkbox.ts +9 -2
  15. package/components/ui/components/inputs/DatePicker/DatePicker.ts +15 -3
  16. package/components/ui/components/inputs/Dropdown/Dropdown.ts +8 -1
  17. package/components/ui/components/inputs/FileUpload/FileUpload.ts +9 -2
  18. package/components/ui/components/inputs/IconButton/iconbutton.ts +9 -2
  19. package/components/ui/components/inputs/InsertDropdown/InsertDropdown.ts +20 -3
  20. package/components/ui/components/inputs/NumberInput/NumberInput.ts +9 -2
  21. package/components/ui/components/inputs/Slider/Slider.ts +8 -1
  22. package/components/ui/components/inputs/TextInput/TextInput.ts +9 -2
  23. package/components/ui/components/inputs/Textarea/Textarea.ts +8 -1
  24. package/components/ui/components/inputs/UsersDropdown/UsersDropdown.ts +8 -1
  25. package/components/ui/components/layout/Card/Card.ts +8 -1
  26. package/components/ui/components/layout/Panel/Panel.ts +8 -1
  27. package/components/ui/components/layout/Tabs/Tabs.ts +7 -1
  28. package/components/ui/components/navigation/Menu/Menu.ts +8 -1
  29. package/components/ui/components/utility/Border/Border.ts +14 -2
  30. package/components/ui/components/utility/BoxShadow/BoxShadow.ts +14 -2
  31. package/components/ui/components/utility/Document/Document.ts +9 -2
  32. package/components/ui/components/utility/Handlers/Handlers.ts +9 -2
  33. package/components/ui/nuraly-ui/packages/common/dist/constants/index.d.ts +2 -0
  34. package/components/ui/nuraly-ui/packages/common/dist/constants.d.ts +17 -0
  35. package/components/ui/nuraly-ui/packages/common/dist/controllers/index.d.ts +2 -0
  36. package/components/ui/nuraly-ui/packages/common/dist/controllers.d.ts +21 -0
  37. package/components/ui/nuraly-ui/packages/common/dist/index.d.ts +25 -0
  38. package/components/ui/nuraly-ui/packages/common/dist/mixins/index.d.ts +2 -0
  39. package/components/ui/nuraly-ui/packages/common/dist/mixins.d.ts +26 -0
  40. package/components/ui/nuraly-ui/packages/common/dist/shared/base-mixin.d.ts +42 -0
  41. package/components/ui/nuraly-ui/packages/common/dist/shared/constants.d.ts +1 -0
  42. package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/dropdown.controller.d.ts +78 -0
  43. package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/dropdown.interface.d.ts +39 -0
  44. package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/index.d.ts +4 -0
  45. package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/theme.controller.d.ts +49 -0
  46. package/components/ui/nuraly-ui/packages/common/dist/shared/dependency-mixin.d.ts +37 -0
  47. package/components/ui/nuraly-ui/packages/common/dist/shared/event-handler-mixin.d.ts +65 -0
  48. package/components/ui/nuraly-ui/packages/common/dist/shared/index.d.ts +13 -0
  49. package/components/ui/nuraly-ui/packages/common/dist/shared/theme-mixin.d.ts +79 -0
  50. package/components/ui/nuraly-ui/packages/common/dist/shared/themes.d.ts +45 -0
  51. package/components/ui/nuraly-ui/packages/common/dist/themes/index.d.ts +2 -0
  52. package/components/ui/nuraly-ui/packages/common/dist/themes.d.ts +22 -0
  53. package/components/ui/nuraly-ui/packages/common/dist/utils/index.d.ts +2 -0
  54. package/components/ui/nuraly-ui/packages/common/dist/utils.d.ts +21 -0
  55. package/dist/.claude/settings.local.json +9 -0
  56. package/dist/micro-app.bundle.umd.cjs +5051 -0
  57. package/package.json +6 -2
  58. package/vite.config.ts +17 -18
@@ -1,12 +1,24 @@
1
1
  import type { ComponentElement } from '../../../../../redux/store/component/component.interface.ts';
2
2
  import { css, html } from "lit";
3
3
  import { property, state } from "lit/decorators.js";
4
- import "@nuralyui/checkbox";
5
- import "@nuralyui/slider-input";
6
4
  import { BaseElementBlock } from '../../base/BaseElement';
7
5
  import { executeHandler } from '../../../../../state/runtime-context';
8
6
  import { getNestedAttribute } from '../../../../../utils/object.utils.ts';
9
7
 
8
+ // Safely import @nuralyui/checkbox
9
+ try {
10
+ await import("@nuralyui/checkbox");
11
+ } catch (error) {
12
+ console.warn('[@nuralyui/checkbox] Package not found or failed to load.');
13
+ }
14
+ // Safely import @nuralyui/slider-input
15
+ try {
16
+ await import("@nuralyui/slider-input");
17
+ } catch (error) {
18
+ console.warn('[@nuralyui/slider-input] Package not found or failed to load.');
19
+ }
20
+
21
+
10
22
  function debounce(func, wait = 100) {
11
23
  let timeout;
12
24
  return function(...args) {
@@ -1,11 +1,18 @@
1
1
  import { html, nothing } from "lit";
2
2
  import { customElement, property } from "lit/decorators.js";
3
- import "@nuralyui/document";
4
3
  import { type ComponentElement } from '../../../../../redux/store/component/component.interface.ts';
5
4
  import { BaseElementBlock } from "../../base/BaseElement.ts";
6
5
  import { styleMap } from "lit/directives/style-map.js";
7
6
  import { ref } from "lit/directives/ref.js";
8
7
 
8
+ // Safely import @nuralyui/document
9
+ try {
10
+ await import("@nuralyui/document");
11
+ } catch (error) {
12
+ console.warn('[@nuralyui/document] Package not found or failed to load.');
13
+ }
14
+
15
+
9
16
 
10
17
  @customElement("document-block")
11
18
  export class ImageBlock extends BaseElementBlock {
@@ -44,4 +51,4 @@ export class ImageBlock extends BaseElementBlock {
44
51
  </nr-document-viewer>
45
52
  `;
46
53
  }
47
- }
54
+ }
@@ -1,12 +1,19 @@
1
1
  import { css, html, nothing } from "lit";
2
2
  import { customElement, property } from "lit/decorators.js";
3
- import "@nuralyui/select";
4
3
  import { type ComponentElement } from '../../../../../redux/store/component/component.interface.ts';
5
4
  import { BaseElementBlock } from "../../base/BaseElement.ts";
6
5
  import { styleMap } from "lit/directives/style-map.js";
7
6
  import { executeHandler } from '../../../../../state/runtime-context.ts';
8
7
  import { eventDispatcher } from '../../../../../utils/change-detection.ts';
9
8
 
9
+ // Safely import @nuralyui/select
10
+ try {
11
+ await import("@nuralyui/select");
12
+ } catch (error) {
13
+ console.warn('[@nuralyui/select] Package not found or failed to load.');
14
+ }
15
+
16
+
10
17
  @customElement("handler-block")
11
18
  export class HandlerBlock extends BaseElementBlock {
12
19
  static styles = [
@@ -197,4 +204,4 @@ constructor() {
197
204
  `}
198
205
  `;
199
206
  }
200
- }
207
+ }
@@ -0,0 +1,2 @@
1
+ export * from '../constants.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ /**
7
+ * Shared constants for Nuraly UI components
8
+ *
9
+ * @module @nuralyui/common/constants
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { COMPONENT_PREFIX } from '@nuralyui/common/constants';
14
+ * ```
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from '../controllers.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ /**
7
+ * Shared controllers for Nuraly UI components
8
+ *
9
+ * @module @nuralyui/common/controllers
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { ThemeController, SharedDropdownController } from '@nuralyui/common/controllers';
14
+ *
15
+ * class MyComponent extends LitElement {
16
+ * private themeController = new ThemeController(this);
17
+ * }
18
+ * ```
19
+ */
20
+ export * from './shared/controllers/index.js';
21
+ //# sourceMappingURL=controllers.d.ts.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ /**
7
+ * @nuralyui/common
8
+ *
9
+ * Common UI components package for Nuraly UI Library.
10
+ * Contains basic building blocks used across the component library.
11
+ *
12
+ * This package exposes shared utilities only (mixins, controllers, themes, utils).
13
+ * Components should be imported from their own packages (e.g., @nuralyui/button).
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import { NuralyUIBaseMixin } from '@nuralyui/common/mixins';
18
+ * import { ThemeController } from '@nuralyui/common/controllers';
19
+ * ```
20
+ */
21
+ export * from './mixins.js';
22
+ export * from './controllers.js';
23
+ export * from './themes.js';
24
+ export * from './utils.js';
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from '../mixins.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ /**
7
+ * Shared mixins for Nuraly UI components
8
+ *
9
+ * @module @nuralyui/common/mixins
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { NuralyUIBaseMixin } from '@nuralyui/common/mixins';
14
+ *
15
+ * class MyComponent extends NuralyUIBaseMixin(LitElement) {
16
+ * // Your component code
17
+ * }
18
+ * ```
19
+ */
20
+ export { NuralyUIBaseMixin, BaseMixin, type NuralyUIBaseElement } from './shared/base-mixin.js';
21
+ export { ThemeAwareMixin, type ThemeAware } from './shared/theme-mixin.js';
22
+ export { DependencyValidationMixin, type DependencyAware } from './shared/dependency-mixin.js';
23
+ export { EventHandlerMixin, type EventHandlerCapable } from './shared/event-handler-mixin.js';
24
+ export * from './shared/validation.types.js';
25
+ export * from './shared/validation.types.js';
26
+ //# sourceMappingURL=mixins.d.ts.map
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import { LitElement } from 'lit';
7
+ import { ThemeAware } from './theme-mixin.js';
8
+ import { DependencyAware } from './dependency-mixin.js';
9
+ import { EventHandlerCapable } from './event-handler-mixin.js';
10
+ /**
11
+ * Base interface combining theme awareness, dependency validation, and event handling
12
+ */
13
+ export interface NuralyUIBaseElement extends ThemeAware, DependencyAware, EventHandlerCapable {
14
+ }
15
+ declare type Constructor<T = {}> = new (...args: any[]) => T;
16
+ /**
17
+ * Global base mixin that combines ThemeAwareMixin and DependencyValidationMixin
18
+ * This mixin provides a single entry point for all common functionality needed
19
+ * by Nuraly UI components, reducing boilerplate code in individual components.
20
+ *
21
+ * @param superClass - The base class to extend (typically LitElement)
22
+ * @returns Enhanced class with both theme management and dependency validation capabilities
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * @customElement('my-component')
27
+ * export class MyComponent extends NuralyUIBaseMixin(LitElement) {
28
+ * requiredComponents = ['nr-icon'];
29
+ *
30
+ * render() {
31
+ * return html`<div data-theme="${this.currentTheme}">Content</div>`;
32
+ * }
33
+ * }
34
+ * ```
35
+ */
36
+ export declare const NuralyUIBaseMixin: <T extends Constructor<LitElement>>(superClass: T) => (new (...args: any[]) => DependencyAware) & (new (...args: any[]) => ThemeAware) & (new (...args: any[]) => EventHandlerCapable) & T;
37
+ /**
38
+ * Alternative shorter name for convenience
39
+ */
40
+ export declare const BaseMixin: <T extends Constructor<LitElement>>(superClass: T) => (new (...args: any[]) => DependencyAware) & (new (...args: any[]) => ThemeAware) & (new (...args: any[]) => EventHandlerCapable) & T;
41
+ export {};
42
+ //# sourceMappingURL=base-mixin.d.ts.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,78 @@
1
+ /// <reference types="react" />
2
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
3
+ import { DropdownController, DropdownHost, DropdownPosition, DropdownSpace } from './dropdown.interface.js';
4
+ /**
5
+ * Shared dropdown controller for components that need dropdown functionality
6
+ * Based on the select component's dropdown controller but generalized for reuse
7
+ */
8
+ export declare class SharedDropdownController implements ReactiveController, DropdownController {
9
+ private _host;
10
+ private _isOpen;
11
+ private _position;
12
+ private _dropdownElement;
13
+ private _triggerElement;
14
+ constructor(host: ReactiveControllerHost & DropdownHost);
15
+ hostConnected(): void;
16
+ hostDisconnected(): void;
17
+ /**
18
+ * Check if dropdown is open
19
+ */
20
+ get isOpen(): boolean;
21
+ /**
22
+ * Get current dropdown position
23
+ */
24
+ get position(): DropdownPosition;
25
+ /**
26
+ * Open the dropdown
27
+ */
28
+ open(): void;
29
+ /**
30
+ * Close the dropdown
31
+ */
32
+ close(): void;
33
+ /**
34
+ * Toggle dropdown visibility
35
+ */
36
+ toggle(): void;
37
+ /**
38
+ * Calculate optimal dropdown placement
39
+ */
40
+ calculatePosition(): void;
41
+ /**
42
+ * Reset dropdown position
43
+ */
44
+ resetPosition(): void;
45
+ /**
46
+ * Set dropdown and trigger element references
47
+ */
48
+ setElements(dropdownElement: HTMLElement, triggerElement: HTMLElement): void;
49
+ /**
50
+ * Find dropdown and trigger elements
51
+ */
52
+ private findElements;
53
+ /**
54
+ * Determine optimal dropdown placement
55
+ */
56
+ private determineOptimalPlacement;
57
+ /**
58
+ * Apply calculated position to dropdown element
59
+ */
60
+ private applyPosition;
61
+ /**
62
+ * Calculate available space around trigger
63
+ */
64
+ getAvailableSpace(): DropdownSpace;
65
+ /**
66
+ * Handle window resize to recalculate position
67
+ */
68
+ private handleResize;
69
+ /**
70
+ * Handle scroll to manage dropdown visibility
71
+ */
72
+ private handleScroll;
73
+ /**
74
+ * Handle errors with fallback
75
+ */
76
+ private handleError;
77
+ }
78
+ //# sourceMappingURL=dropdown.controller.d.ts.map
@@ -0,0 +1,39 @@
1
+ /// <reference types="react" />
2
+ /// <reference types="node" />
3
+ /**
4
+ * Shared dropdown controller interface
5
+ */
6
+ export interface DropdownPosition {
7
+ top: number;
8
+ left: number;
9
+ width: number;
10
+ placement: 'bottom' | 'top';
11
+ }
12
+ export interface DropdownSpace {
13
+ above: number;
14
+ below: number;
15
+ left: number;
16
+ right: number;
17
+ }
18
+ /**
19
+ * Host interface for components using dropdown functionality
20
+ */
21
+ export interface DropdownHost {
22
+ requestUpdate(): void;
23
+ dispatchEvent(event: Event): boolean;
24
+ }
25
+ /**
26
+ * Dropdown controller interface
27
+ */
28
+ export interface DropdownController {
29
+ readonly isOpen: boolean;
30
+ readonly position: DropdownPosition;
31
+ open(): void;
32
+ close(): void;
33
+ toggle(): void;
34
+ calculatePosition(): void;
35
+ resetPosition(): void;
36
+ setElements(dropdownElement: HTMLElement, triggerElement: HTMLElement): void;
37
+ getAvailableSpace(): DropdownSpace;
38
+ }
39
+ //# sourceMappingURL=dropdown.interface.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from './dropdown.interface.js';
2
+ export * from './dropdown.controller.js';
3
+ export * from './theme.controller.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /// <reference types="react" />
7
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
8
+ import { ThemeVariant } from '../themes.js';
9
+ /**
10
+ * Theme controller that observes and reacts to theme changes on the host element or its parents
11
+ * This controller watches for data-theme attribute changes and triggers re-renders
12
+ */
13
+ export declare class ThemeController implements ReactiveController {
14
+ private host;
15
+ private observer?;
16
+ private _currentTheme;
17
+ constructor(host: ReactiveControllerHost & HTMLElement);
18
+ /**
19
+ * Get the current theme variant
20
+ */
21
+ get currentTheme(): ThemeVariant | null;
22
+ /**
23
+ * Check if the current theme is a dark variant
24
+ */
25
+ get isDark(): boolean;
26
+ /**
27
+ * Check if the current theme is a light variant
28
+ */
29
+ get isLight(): boolean;
30
+ /**
31
+ * Get the theme system (default, carbon)
32
+ */
33
+ get themeSystem(): string;
34
+ hostConnected(): void;
35
+ hostDisconnected(): void;
36
+ private updateTheme;
37
+ private setupObserver;
38
+ private cleanup;
39
+ /**
40
+ * Apply a theme to the closest themed ancestor or the host element
41
+ * @param theme - The theme variant to apply
42
+ */
43
+ applyTheme(theme: ThemeVariant): void;
44
+ /**
45
+ * Toggle between light and dark variants of the current theme
46
+ */
47
+ toggleVariant(): void;
48
+ }
49
+ //# sourceMappingURL=theme.controller.d.ts.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import { LitElement } from 'lit';
7
+ /**
8
+ * Interface for components that need dependency validation
9
+ */
10
+ export interface DependencyAware {
11
+ requiredComponents: string[];
12
+ validateDependencies(): void;
13
+ isComponentAvailable(componentName: string): boolean;
14
+ }
15
+ declare type Constructor<T = {}> = new (...args: any[]) => T;
16
+ /**
17
+ * Mixin that adds dependency validation functionality to LitElement components
18
+ *
19
+ * @param superClass - The base class to extend (typically LitElement)
20
+ * @returns Enhanced class with dependency validation capabilities
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * @customElement('my-component')
25
+ * export class MyComponent extends DependencyValidationMixin(LitElement) {
26
+ * requiredComponents = ['nr-icon', 'hy-tooltip'];
27
+ *
28
+ * override connectedCallback() {
29
+ * super.connectedCallback();
30
+ * this.validateDependencies();
31
+ * }
32
+ * }
33
+ * ```
34
+ */
35
+ export declare const DependencyValidationMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<DependencyAware> & T;
36
+ export {};
37
+ //# sourceMappingURL=dependency-mixin.d.ts.map
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /// <reference types="react" />
7
+ import { LitElement } from 'lit';
8
+ declare type Constructor<T = {}> = new (...args: any[]) => T;
9
+ /**
10
+ * Interface for components that support event handling operations
11
+ */
12
+ export interface EventHandlerCapable {
13
+ /**
14
+ * Dispatch a custom event with consistent structure
15
+ * @param eventName - The name of the event
16
+ * @param detail - The event detail object
17
+ */
18
+ dispatchCustomEvent(eventName: string, detail: any): void;
19
+ /**
20
+ * Dispatch events with metadata
21
+ */
22
+ dispatchEventWithMetadata(eventName: string, detail: any): void;
23
+ /**
24
+ * Dispatch input-related events
25
+ */
26
+ dispatchInputEvent(eventName: string, detail: any): void;
27
+ /**
28
+ * Dispatch focus-related events
29
+ */
30
+ dispatchFocusEvent(eventName: string, detail: any): void;
31
+ /**
32
+ * Dispatch validation events
33
+ */
34
+ dispatchValidationEvent(eventName: string, detail: any): void;
35
+ /**
36
+ * Dispatch action events
37
+ */
38
+ dispatchActionEvent(eventName: string, detail: any): void;
39
+ /**
40
+ * Check if a key is allowed when component is readonly
41
+ */
42
+ isReadonlyKeyAllowed(keyDownEvent: KeyboardEvent): boolean;
43
+ /**
44
+ * Check if key is an activation key (Enter/Space)
45
+ */
46
+ isActivationKey(keyDownEvent: KeyboardEvent): boolean;
47
+ }
48
+ /**
49
+ * Mixin that provides standardized event handling capabilities
50
+ *
51
+ * @param superClass - The base class to extend
52
+ * @returns Enhanced class with event handling capabilities
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * export class MyComponent extends EventHandlerMixin(LitElement) {
57
+ * handleClick() {
58
+ * this.dispatchCustomEvent('my-click', { value: 'test' });
59
+ * }
60
+ * }
61
+ * ```
62
+ */
63
+ export declare const EventHandlerMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<EventHandlerCapable> & T;
64
+ export {};
65
+ //# sourceMappingURL=event-handler-mixin.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ export { NuralyUIBaseMixin, BaseMixin, type NuralyUIBaseElement } from './base-mixin.js';
7
+ export { ThemeAwareMixin, type ThemeAware } from './theme-mixin.js';
8
+ export { DependencyValidationMixin, type DependencyAware } from './dependency-mixin.js';
9
+ export { EventHandlerMixin, type EventHandlerCapable } from './event-handler-mixin.js';
10
+ export { throttle, debounce, rafThrottle } from './utils.js';
11
+ export * from './controllers/index.js';
12
+ export * from './validation.types.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /// <reference types="react" />
7
+ import { LitElement } from 'lit';
8
+ /**
9
+ * Theme detection and management mixin for Lit components
10
+ * Provides data-theme attribute detection with system fallback
11
+ * Supports multiple design systems (Carbon, Polaris, etc.)
12
+ */
13
+ export interface ThemeAware {
14
+ currentTheme: string;
15
+ currentDesignSystem: 'carbon' | 'default';
16
+ }
17
+ declare type Constructor<T = {}> = new (...args: any[]) => T;
18
+ /**
19
+ * Mixin that adds theme management functionality to LitElement components
20
+ *
21
+ * @param superClass - The base class to extend (typically LitElement)
22
+ * @returns Enhanced class with theme management capabilities
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * @customElement('my-component')
27
+ * export class MyComponent extends ThemeAwareMixin(LitElement) {
28
+ * render() {
29
+ * return html`<div data-theme="${this.currentTheme}">Content</div>`;
30
+ * }
31
+ * }
32
+ * ```
33
+ */
34
+ export declare const ThemeAwareMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<ThemeAware> & T;
35
+ /**
36
+ * Standalone theme detection utility function
37
+ * For components that don't want to use the mixin approach
38
+ *
39
+ * @param element - The element to start theme detection from
40
+ * @returns The detected theme ('light' or 'dark')
41
+ */
42
+ export declare function detectTheme(element: Element): 'light' | 'dark';
43
+ /**
44
+ * Standalone design system detection utility function
45
+ * For components that don't want to use the mixin approach
46
+ *
47
+ * @param element - The element to start detection from
48
+ * @returns The detected design system
49
+ */
50
+ export declare function detectDesignSystem(element: Element): 'carbon' | 'default';
51
+ /**
52
+ * CSS template literal helper for theme-aware styles
53
+ * Generates CSS with both data-theme selectors and system fallback
54
+ *
55
+ * @param lightThemeVars - CSS custom properties for light theme
56
+ * @param darkThemeVars - CSS custom properties for dark theme
57
+ * @returns CSS template literal
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * import { css } from 'lit';
62
+ * import { createThemeStyles } from '../shared/theme-mixin.js';
63
+ *
64
+ * const styles = css`
65
+ * ${createThemeStyles(
66
+ * css`--color: black; --bg: white;`,
67
+ * css`--color: white; --bg: black;`
68
+ * )}
69
+ *
70
+ * .content {
71
+ * color: var(--color);
72
+ * background: var(--bg);
73
+ * }
74
+ * `;
75
+ * ```
76
+ */
77
+ export declare function createThemeStyles(lightThemeVars: any, darkThemeVars: any): string;
78
+ export {};
79
+ //# sourceMappingURL=theme-mixin.d.ts.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ /// <reference types="react" />
7
+ /**
8
+ * Theme utilities and type definitions
9
+ *
10
+ * NOTE: CSS theme files are in the @nuralyui/themes package
11
+ * This file only contains TypeScript utilities and types
12
+ */
13
+ export declare const THEME_VARIANTS: {
14
+ readonly 'default-light': "Default Light";
15
+ readonly 'default-dark': "Default Dark";
16
+ readonly 'carbon-light': "Carbon Light";
17
+ readonly 'carbon-dark': "Carbon Dark";
18
+ readonly light: "Default Light";
19
+ readonly dark: "Default Dark";
20
+ };
21
+ export declare type ThemeVariant = keyof typeof THEME_VARIANTS;
22
+ /**
23
+ * Utility function to apply theme to an element
24
+ * @param element - The element to apply the theme to
25
+ * @param theme - The theme variant to apply
26
+ */
27
+ export declare function applyTheme(element: HTMLElement, theme: ThemeVariant): void;
28
+ /**
29
+ * Utility function to get current theme from an element or its parents
30
+ * @param element - The element to check for theme
31
+ * @returns The current theme variant or null if not found
32
+ */
33
+ export declare function getCurrentTheme(element: HTMLElement): ThemeVariant | null;
34
+ /**
35
+ * Utility function to toggle between light and dark variants of the same theme
36
+ * @param element - The element to toggle theme on
37
+ */
38
+ export declare function toggleThemeVariant(element: HTMLElement): void;
39
+ /**
40
+ * Get the theme system name from a theme variant
41
+ * @param theme - The theme variant
42
+ * @returns The theme system name ('carbon' or 'default')
43
+ */
44
+ export declare function getThemeSystem(theme: ThemeVariant | null): 'carbon' | 'default';
45
+ //# sourceMappingURL=themes.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from '../themes.js';
2
+ //# sourceMappingURL=index.d.ts.map