@transcodes/ui-components 0.3.4 → 0.3.6

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 (110) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/controllers/animation.controller.d.ts +48 -0
  3. package/dist/controllers/animation.controller.d.ts.map +1 -0
  4. package/dist/controllers/base.controller.d.ts +14 -0
  5. package/dist/controllers/base.controller.d.ts.map +1 -0
  6. package/dist/controllers/history.controller.d.ts +34 -0
  7. package/dist/controllers/history.controller.d.ts.map +1 -0
  8. package/dist/controllers/index.d.ts +0 -2
  9. package/dist/controllers/index.d.ts.map +1 -0
  10. package/dist/controllers/index.js +10 -12
  11. package/dist/controllers/loading.controller.d.ts +36 -0
  12. package/dist/controllers/loading.controller.d.ts.map +1 -0
  13. package/dist/controllers/match-media.controller.d.ts +32 -0
  14. package/dist/controllers/match-media.controller.d.ts.map +1 -0
  15. package/dist/controllers/message-bus.controller.d.ts +45 -0
  16. package/dist/controllers/message-bus.controller.d.ts.map +1 -0
  17. package/dist/controllers/storage.controller.d.ts +40 -0
  18. package/dist/controllers/storage.controller.d.ts.map +1 -0
  19. package/dist/index.d.ts +4 -295
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +48 -64
  22. package/dist/primitives/index.d.ts +1 -0
  23. package/dist/primitives/index.d.ts.map +1 -0
  24. package/dist/primitives/index.js +18 -16
  25. package/dist/primitives/tc-box.d.ts +19 -0
  26. package/dist/primitives/tc-box.d.ts.map +1 -0
  27. package/dist/primitives/tc-box.js +4 -4
  28. package/dist/primitives/tc-button.d.ts +25 -0
  29. package/dist/primitives/tc-button.d.ts.map +1 -0
  30. package/dist/primitives/tc-button.js +21 -20
  31. package/dist/primitives/tc-callout.d.ts +22 -0
  32. package/dist/primitives/tc-callout.d.ts.map +1 -0
  33. package/dist/primitives/tc-callout.js +5 -4
  34. package/dist/primitives/tc-card.d.ts +20 -0
  35. package/dist/primitives/tc-card.d.ts.map +1 -0
  36. package/dist/primitives/tc-card.js +11 -10
  37. package/dist/primitives/tc-chip.d.ts +19 -0
  38. package/dist/primitives/tc-chip.d.ts.map +1 -0
  39. package/dist/primitives/tc-chip.js +18 -16
  40. package/dist/primitives/tc-container.d.ts +20 -0
  41. package/dist/primitives/tc-container.d.ts.map +1 -0
  42. package/dist/primitives/tc-container.js +12 -10
  43. package/dist/primitives/tc-divider.d.ts +22 -0
  44. package/dist/primitives/tc-divider.d.ts.map +1 -0
  45. package/dist/primitives/tc-divider.js +4 -3
  46. package/dist/primitives/tc-error-message.d.ts +23 -0
  47. package/dist/primitives/tc-error-message.d.ts.map +1 -0
  48. package/dist/primitives/tc-error-message.js +13 -9
  49. package/dist/primitives/tc-form-header.d.ts +25 -0
  50. package/dist/primitives/tc-form-header.d.ts.map +1 -0
  51. package/dist/primitives/tc-form-header.js +9 -7
  52. package/dist/primitives/tc-icon.d.ts +20 -0
  53. package/dist/primitives/tc-icon.d.ts.map +1 -0
  54. package/dist/primitives/tc-icon.js +3 -3
  55. package/dist/primitives/tc-input-with-chip.d.ts +38 -0
  56. package/dist/primitives/tc-input-with-chip.d.ts.map +1 -0
  57. package/dist/primitives/tc-input-with-chip.js +12 -8
  58. package/dist/primitives/tc-input.d.ts +45 -0
  59. package/dist/primitives/tc-input.d.ts.map +1 -0
  60. package/dist/primitives/tc-input.js +11 -9
  61. package/dist/primitives/tc-item-button.d.ts +30 -0
  62. package/dist/primitives/tc-item-button.d.ts.map +1 -0
  63. package/dist/primitives/tc-item-button.js +18 -17
  64. package/dist/primitives/tc-item.d.ts +25 -0
  65. package/dist/primitives/tc-item.d.ts.map +1 -0
  66. package/dist/primitives/tc-item.js +13 -12
  67. package/dist/primitives/tc-otp-input.d.ts +38 -0
  68. package/dist/primitives/tc-otp-input.d.ts.map +1 -0
  69. package/dist/primitives/tc-otp-input.js +6 -4
  70. package/dist/primitives/tc-page-decoration.d.ts +19 -0
  71. package/dist/primitives/tc-page-decoration.d.ts.map +1 -0
  72. package/dist/{widgets → primitives}/tc-page-decoration.js +8 -8
  73. package/dist/primitives/tc-section.d.ts +19 -0
  74. package/dist/primitives/tc-section.d.ts.map +1 -0
  75. package/dist/primitives/tc-section.js +15 -13
  76. package/dist/primitives/tc-spinner.d.ts +20 -0
  77. package/dist/primitives/tc-spinner.d.ts.map +1 -0
  78. package/dist/primitives/tc-spinner.js +17 -17
  79. package/dist/primitives/tc-symbol.d.ts +20 -0
  80. package/dist/primitives/tc-symbol.d.ts.map +1 -0
  81. package/dist/primitives/tc-symbol.js +15 -13
  82. package/dist/primitives/tc-text.d.ts +31 -0
  83. package/dist/primitives/tc-text.d.ts.map +1 -0
  84. package/dist/primitives/tc-text.js +3 -3
  85. package/dist/primitives/tc-toast.d.ts +34 -0
  86. package/dist/primitives/tc-toast.d.ts.map +1 -0
  87. package/dist/primitives/tc-toast.js +3 -3
  88. package/dist/screens/index.d.ts.map +1 -0
  89. package/dist/screens/tc-error-screen.d.ts +32 -0
  90. package/dist/screens/tc-error-screen.d.ts.map +1 -0
  91. package/dist/screens/tc-error-screen.js +84 -29
  92. package/dist/screens/tc-loading-screen.d.ts +23 -0
  93. package/dist/screens/tc-loading-screen.d.ts.map +1 -0
  94. package/dist/screens/tc-loading-screen.js +16 -11
  95. package/dist/screens/tc-success-screen.d.ts +31 -0
  96. package/dist/screens/tc-success-screen.d.ts.map +1 -0
  97. package/dist/screens/tc-success-screen.js +19 -13
  98. package/dist/styles/shared.d.ts +20 -0
  99. package/dist/styles/shared.d.ts.map +1 -0
  100. package/package.json +13 -13
  101. package/dist/controllers/form-validation.controller.js +0 -49
  102. package/dist/widgets/index.d.ts +0 -9
  103. package/dist/widgets/index.js +0 -18
  104. package/dist/widgets/tc-authenticator-card.js +0 -213
  105. package/dist/widgets/tc-floating-button.js +0 -132
  106. package/dist/widgets/tc-iframe-modal.js +0 -263
  107. package/dist/widgets/tc-installation-banner.js +0 -234
  108. package/dist/widgets/tc-ios-installation-guide.js +0 -240
  109. package/dist/widgets/tc-notification-modal.js +0 -230
  110. package/dist/widgets/tc-offline-modal.js +0 -202
package/CHANGELOG.md CHANGED
@@ -5,6 +5,41 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.6] - 2025-12-17
9
+
10
+ ### Changed
11
+
12
+ - CSS 토큰 활용 강화: 하드코딩된 값을 design-tokens CSS 변수로 교체
13
+ - tc-error-screen, tc-success-screen: 애니메이션 오프셋 토큰화
14
+ - tc-input, tc-input-with-chip: focus ring, slideDown 애니메이션 토큰화
15
+ - tc-item-button, tc-error-message: 아이콘 크기 토큰화
16
+ - tc-page-decoration, tc-spinner: `border-radius: 50%` → `var(--radius-full)`
17
+ - `:host` 스타일 일관성 통일 및 reset.css 통합
18
+ - Storybook 설정 역할 분리 및 중복 제거
19
+
20
+ ### Removed
21
+
22
+ - **widgets 레이어 제거**: 미사용 복합 컴포넌트 삭제
23
+ - tc-authenticator-card, tc-floating-button, tc-iframe-modal
24
+ - tc-installation-banner, tc-ios-installation-guide
25
+ - tc-notification-modal, tc-offline-modal
26
+ - FormValidationController 제거 (미사용)
27
+ - 컨트롤러 Storybook 스토리 제거 (내부 구현 세부사항)
28
+
29
+ ### Fixed
30
+
31
+ - Storybook: sideEffects, storybookAliases, isStorybook 감지 로직 수정
32
+
33
+ **Note**: 이 버전은 `@transcodes/design-tokens@^0.3.6`과 함께 사용해야 합니다.
34
+
35
+ ## [0.3.5] - 2025-12-11
36
+
37
+ ### Fixed
38
+
39
+ - TypeScript 타입 정의 파일(.d.ts) 누락 문제 수정
40
+ - `rollupTypes: false`로 변경하여 모든 컴포넌트의 개별 .d.ts 생성
41
+ - primitives, widgets, screens 모든 컴포넌트에 타입 정의 포함
42
+
8
43
  ## [0.3.4] - 2025-12-11
9
44
 
10
45
  ### Changed
@@ -0,0 +1,48 @@
1
+ import { ReactiveControllerHost } from 'lit';
2
+ import { BaseController } from './base.controller.js';
3
+ export type AnimationState = 'hidden' | 'showing' | 'visible' | 'hiding';
4
+ /**
5
+ * Controller for managing show/hide animation states.
6
+ * Provides a state machine for coordinating CSS transitions.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * class MyModal extends LitElement {
11
+ * private animation = new AnimationController(this);
12
+ *
13
+ * async open() {
14
+ * await this.animation.show();
15
+ * }
16
+ *
17
+ * async close() {
18
+ * await this.animation.hide();
19
+ * }
20
+ *
21
+ * render() {
22
+ * return html`
23
+ * <div class="modal modal--${this.animation.state}">
24
+ * <slot></slot>
25
+ * </div>
26
+ * `;
27
+ * }
28
+ * }
29
+ * ```
30
+ */
31
+ export interface AnimationControllerOptions {
32
+ showDuration?: number;
33
+ hideDuration?: number;
34
+ }
35
+ export declare class AnimationController extends BaseController {
36
+ private _state;
37
+ private showDuration;
38
+ private hideDuration;
39
+ constructor(host: ReactiveControllerHost, options?: AnimationControllerOptions | number);
40
+ get state(): AnimationState;
41
+ get isVisible(): boolean;
42
+ get isHidden(): boolean;
43
+ show(): Promise<void>;
44
+ hide(): Promise<void>;
45
+ toggle(): Promise<void>;
46
+ private waitForTransition;
47
+ }
48
+ //# sourceMappingURL=animation.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animation.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/animation.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,0BAA0B;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,YAAY,CAAS;gBAG3B,IAAI,EAAE,sBAAsB,EAC5B,OAAO,GAAE,0BAA0B,GAAG,MAAY;IAYpD,IAAI,KAAK,IAAI,cAAc,CAE1B;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAEK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAcrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAc3B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvB,OAAO,CAAC,iBAAiB;CAK1B"}
@@ -0,0 +1,14 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ /**
3
+ * Base controller class that all reactive controllers extend from.
4
+ * Provides common functionality for registering with a host element.
5
+ */
6
+ export declare abstract class BaseController implements ReactiveController {
7
+ protected host: ReactiveControllerHost;
8
+ constructor(host: ReactiveControllerHost);
9
+ hostConnected?(): void;
10
+ hostDisconnected?(): void;
11
+ hostUpdate?(): void;
12
+ hostUpdated?(): void;
13
+ }
14
+ //# sourceMappingURL=base.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/base.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAEtE;;;GAGG;AACH,8BAAsB,cAAe,YAAW,kBAAkB;IAChE,SAAS,CAAC,IAAI,EAAE,sBAAsB,CAAC;gBAE3B,IAAI,EAAE,sBAAsB;IAKxC,aAAa,CAAC,IAAI,IAAI;IACtB,gBAAgB,CAAC,IAAI,IAAI;IACzB,UAAU,CAAC,IAAI,IAAI;IACnB,WAAW,CAAC,IAAI,IAAI;CACrB"}
@@ -0,0 +1,34 @@
1
+ import { BaseController } from './base.controller.js';
2
+ /**
3
+ * Controller for managing browser history for modals and overlays.
4
+ * Adds a history entry when opened and handles back button navigation.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * class MyModal extends LitElement {
9
+ * private history = new HistoryController(this);
10
+ *
11
+ * open() {
12
+ * this.history.push({ modal: 'my-modal' });
13
+ * this.history.onPopState(() => this.close());
14
+ * // show modal
15
+ * }
16
+ *
17
+ * close() {
18
+ * this.history.pop();
19
+ * // hide modal
20
+ * }
21
+ * }
22
+ * ```
23
+ */
24
+ export declare class HistoryController extends BaseController {
25
+ private hasAddedEntry;
26
+ private onPopCallback?;
27
+ push(state?: object): void;
28
+ pop(): void;
29
+ onPopState(callback: () => void): void;
30
+ private handlePopState;
31
+ hostConnected(): void;
32
+ hostDisconnected(): void;
33
+ }
34
+ //# sourceMappingURL=history.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/history.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;IACnD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,aAAa,CAAC,CAAa;IAEnC,IAAI,CAAC,KAAK,GAAE,MAAwB,GAAG,IAAI;IAO3C,GAAG,IAAI,IAAI;IAMX,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAItC,OAAO,CAAC,cAAc,CAKpB;IAEO,aAAa,IAAI,IAAI;IAIrB,gBAAgB,IAAI,IAAI;CAIlC"}
@@ -1,8 +1,6 @@
1
1
  export type { AnimationControllerOptions, AnimationState, } from './animation.controller.js';
2
2
  export { AnimationController } from './animation.controller.js';
3
3
  export { BaseController } from './base.controller.js';
4
- export type { ValidationRule, ValidationType, } from './form-validation.controller.js';
5
- export { FormValidationController } from './form-validation.controller.js';
6
4
  export { HistoryController } from './history.controller.js';
7
5
  export { LoadingController } from './loading.controller.js';
8
6
  export { MatchMediaController } from './match-media.controller.js';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,0BAA0B,EAC1B,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,18 +1,16 @@
1
1
  import { AnimationController as e } from "./animation.controller.js";
2
2
  import { BaseController as l } from "./base.controller.js";
3
- import { FormValidationController as m } from "./form-validation.controller.js";
4
- import { HistoryController as f } from "./history.controller.js";
5
- import { LoadingController as x } from "./loading.controller.js";
6
- import { MatchMediaController as i } from "./match-media.controller.js";
7
- import { MessageBusController as d } from "./message-bus.controller.js";
8
- import { StorageController as M } from "./storage.controller.js";
3
+ import { HistoryController as m } from "./history.controller.js";
4
+ import { LoadingController as f } from "./loading.controller.js";
5
+ import { MatchMediaController as x } from "./match-media.controller.js";
6
+ import { MessageBusController as i } from "./message-bus.controller.js";
7
+ import { StorageController as g } from "./storage.controller.js";
9
8
  export {
10
9
  e as AnimationController,
11
10
  l as BaseController,
12
- m as FormValidationController,
13
- f as HistoryController,
14
- x as LoadingController,
15
- i as MatchMediaController,
16
- d as MessageBusController,
17
- M as StorageController
11
+ m as HistoryController,
12
+ f as LoadingController,
13
+ x as MatchMediaController,
14
+ i as MessageBusController,
15
+ g as StorageController
18
16
  };
@@ -0,0 +1,36 @@
1
+ import { BaseController } from './base.controller.js';
2
+ /**
3
+ * Controller for managing loading states and progress.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * class MyComponent extends LitElement {
8
+ * private loading = new LoadingController(this);
9
+ *
10
+ * async handleSubmit() {
11
+ * this.loading.start();
12
+ * await doSomething();
13
+ * this.loading.complete();
14
+ * }
15
+ *
16
+ * render() {
17
+ * return html`
18
+ * <button ?disabled=${this.loading.isLoading}>
19
+ * ${this.loading.isLoading ? 'Loading...' : 'Submit'}
20
+ * </button>
21
+ * `;
22
+ * }
23
+ * }
24
+ * ```
25
+ */
26
+ export declare class LoadingController extends BaseController {
27
+ private _isLoading;
28
+ private _progress;
29
+ get isLoading(): boolean;
30
+ get progress(): number;
31
+ start(): void;
32
+ setProgress(value: number): void;
33
+ complete(): void;
34
+ reset(): void;
35
+ }
36
+ //# sourceMappingURL=loading.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/loading.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;IACnD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAK;IAEtB,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,KAAK,IAAI,IAAI;IAMb,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKhC,QAAQ,IAAI,IAAI;IAMhB,KAAK,IAAI,IAAI;CAKd"}
@@ -0,0 +1,32 @@
1
+ import { ReactiveControllerHost } from 'lit';
2
+ import { BaseController } from './base.controller.js';
3
+ /**
4
+ * Controller for reactive media query matching.
5
+ * Automatically updates the host when the media query matches or unmatches.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * class MyComponent extends LitElement {
10
+ * private mobile = new MatchMediaController(this, '(max-width: 768px)');
11
+ * private darkMode = new MatchMediaController(this, '(prefers-color-scheme: dark)');
12
+ *
13
+ * render() {
14
+ * return html`
15
+ * <div class=${this.mobile.matches ? 'mobile' : 'desktop'}>
16
+ * ${this.darkMode.matches ? 'Dark mode' : 'Light mode'}
17
+ * </div>
18
+ * `;
19
+ * }
20
+ * }
21
+ * ```
22
+ */
23
+ export declare class MatchMediaController extends BaseController {
24
+ private mediaQuery;
25
+ private _matches;
26
+ constructor(host: ReactiveControllerHost, query: string);
27
+ get matches(): boolean;
28
+ private handleChange;
29
+ hostConnected(): void;
30
+ hostDisconnected(): void;
31
+ }
32
+ //# sourceMappingURL=match-media.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-media.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/match-media.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,QAAQ,CAAS;gBAEb,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM;IAMvD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,OAAO,CAAC,YAAY,CAGlB;IAEO,aAAa,IAAI,IAAI;IAIrB,gBAAgB,IAAI,IAAI;CAGlC"}
@@ -0,0 +1,45 @@
1
+ import { ReactiveControllerHost } from 'lit';
2
+ import { BaseController } from './base.controller.js';
3
+ export type MessageHandler = (payload: unknown) => void;
4
+ export type WildcardMessageHandler = (type: string, payload: unknown) => void;
5
+ /**
6
+ * Controller for postMessage communication with iframes or other windows.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * class MyIframeHost extends LitElement {
11
+ * private messageBus = new MessageBusController(this);
12
+ *
13
+ * connectedCallback() {
14
+ * super.connectedCallback();
15
+ * this.messageBus.onMessage('READY', (payload) => {
16
+ * console.log('Iframe is ready', payload);
17
+ * });
18
+ * }
19
+ *
20
+ * sendToIframe() {
21
+ * this.messageBus.send('COMMAND', { action: 'do-something' });
22
+ * }
23
+ * }
24
+ * ```
25
+ */
26
+ export declare class MessageBusController extends BaseController {
27
+ private handlers;
28
+ private wildcardHandlers;
29
+ private targetOrigin;
30
+ /**
31
+ * @param host - The reactive controller host
32
+ * @param targetOrigin - The origin to accept messages from and send messages to.
33
+ * SECURITY NOTE: Using '*' accepts messages from any origin which can be dangerous.
34
+ * Always specify an explicit origin in production environments.
35
+ */
36
+ constructor(host: ReactiveControllerHost, targetOrigin?: string);
37
+ send(type: string, payload: unknown, targetWindow?: Window): void;
38
+ sendToFrame(iframe: HTMLIFrameElement, type: string, payload: unknown): void;
39
+ onMessage(type: string, handler: MessageHandler): () => void;
40
+ onMessage(type: '*', handler: WildcardMessageHandler): () => void;
41
+ private handleMessage;
42
+ hostConnected(): void;
43
+ hostDisconnected(): void;
44
+ }
45
+ //# sourceMappingURL=message-bus.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-bus.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/message-bus.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AACxD,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,OAAO,CAAC,QAAQ,CAA0C;IAC1D,OAAO,CAAC,gBAAgB,CAAqC;IAC7D,OAAO,CAAC,YAAY,CAAS;IAE7B;;;;;OAKG;gBACS,IAAI,EAAE,sBAAsB,EAAE,YAAY,SAAM;IAgB5D,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,GAAE,MAAe,GAAG,IAAI;IAIzE,WAAW,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAI5E,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,IAAI;IAC5D,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,sBAAsB,GAAG,MAAM,IAAI;IAsBjE,OAAO,CAAC,aAAa,CAwBnB;IAEO,aAAa,IAAI,IAAI;IAIrB,gBAAgB,IAAI,IAAI;CAIlC"}
@@ -0,0 +1,40 @@
1
+ import { ReactiveControllerHost } from 'lit';
2
+ import { BaseController } from './base.controller.js';
3
+ /**
4
+ * Controller for syncing component state with localStorage/sessionStorage.
5
+ * Automatically updates when storage changes in other tabs.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * class MyBanner extends LitElement {
10
+ * private dismissed = new StorageController<boolean>(this, 'banner-dismissed');
11
+ *
12
+ * handleDismiss() {
13
+ * this.dismissed.set(true);
14
+ * }
15
+ *
16
+ * render() {
17
+ * if (this.dismissed.value) return null;
18
+ * return html`
19
+ * <div class="banner">
20
+ * <button @click=${this.handleDismiss}>Dismiss</button>
21
+ * </div>
22
+ * `;
23
+ * }
24
+ * }
25
+ * ```
26
+ */
27
+ export declare class StorageController<T = unknown> extends BaseController {
28
+ private key;
29
+ private storage;
30
+ private _value;
31
+ constructor(host: ReactiveControllerHost, key: string, storage?: Storage);
32
+ get value(): T | null;
33
+ set(value: T): void;
34
+ remove(): void;
35
+ private load;
36
+ private handleStorageChange;
37
+ hostConnected(): void;
38
+ hostDisconnected(): void;
39
+ }
40
+ //# sourceMappingURL=storage.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/storage.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,iBAAiB,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,cAAc;IAChE,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,MAAM,CAAkB;gBAG9B,IAAI,EAAE,sBAAsB,EAC5B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,OAAsB;IAQjC,IAAI,KAAK,IAAI,CAAC,GAAG,IAAI,CAEpB;IAED,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;IAWnB,MAAM,IAAI,IAAI;IAMd,OAAO,CAAC,IAAI;IAWZ,OAAO,CAAC,mBAAmB,CAKzB;IAEO,aAAa,IAAI,IAAI;IAIrB,gBAAgB,IAAI,IAAI;CAGlC"}
package/dist/index.d.ts CHANGED
@@ -1,295 +1,4 @@
1
- import { ReactiveController } from 'lit';
2
- import { ReactiveControllerHost } from 'lit';
3
-
4
- export declare class AnimationController extends BaseController {
5
- private _state;
6
- private showDuration;
7
- private hideDuration;
8
- constructor(host: ReactiveControllerHost, options?: AnimationControllerOptions | number);
9
- get state(): AnimationState;
10
- get isVisible(): boolean;
11
- get isHidden(): boolean;
12
- show(): Promise<void>;
13
- hide(): Promise<void>;
14
- toggle(): Promise<void>;
15
- private waitForTransition;
16
- }
17
-
18
- /**
19
- * Controller for managing show/hide animation states.
20
- * Provides a state machine for coordinating CSS transitions.
21
- *
22
- * @example
23
- * ```ts
24
- * class MyModal extends LitElement {
25
- * private animation = new AnimationController(this);
26
- *
27
- * async open() {
28
- * await this.animation.show();
29
- * }
30
- *
31
- * async close() {
32
- * await this.animation.hide();
33
- * }
34
- *
35
- * render() {
36
- * return html`
37
- * <div class="modal modal--${this.animation.state}">
38
- * <slot></slot>
39
- * </div>
40
- * `;
41
- * }
42
- * }
43
- * ```
44
- */
45
- export declare interface AnimationControllerOptions {
46
- showDuration?: number;
47
- hideDuration?: number;
48
- }
49
-
50
- export declare type AnimationState = 'hidden' | 'showing' | 'visible' | 'hiding';
51
-
52
- /**
53
- * Base controller class that all reactive controllers extend from.
54
- * Provides common functionality for registering with a host element.
55
- */
56
- export declare abstract class BaseController implements ReactiveController {
57
- protected host: ReactiveControllerHost;
58
- constructor(host: ReactiveControllerHost);
59
- hostConnected?(): void;
60
- hostDisconnected?(): void;
61
- hostUpdate?(): void;
62
- hostUpdated?(): void;
63
- }
64
-
65
- /**
66
- * Controller for form field validation.
67
- * Manages validation rules and error states.
68
- *
69
- * @example
70
- * ```ts
71
- * class MyForm extends LitElement {
72
- * private validation = new FormValidationController(this);
73
- *
74
- * private emailRules: ValidationRule[] = [
75
- * { type: 'required', message: 'Email is required' },
76
- * { type: 'email', message: 'Please enter a valid email' },
77
- * ];
78
- *
79
- * handleBlur(e: Event) {
80
- * const input = e.target as HTMLInputElement;
81
- * this.validation.validate('email', input.value, this.emailRules);
82
- * }
83
- *
84
- * render() {
85
- * const error = this.validation.getError('email');
86
- * return html`
87
- * <input @blur=${this.handleBlur} />
88
- * ${error ? html`<span class="error">${error}</span>` : ''}
89
- * `;
90
- * }
91
- * }
92
- * ```
93
- */
94
- export declare class FormValidationController extends BaseController {
95
- private errors;
96
- get isValid(): boolean;
97
- getError(field: string): string | undefined;
98
- getAllErrors(): Map<string, string>;
99
- validate(field: string, value: string, rules: ValidationRule[]): boolean;
100
- clearError(field: string): void;
101
- reset(): void;
102
- private runRule;
103
- }
104
-
105
- /**
106
- * Controller for managing browser history for modals and overlays.
107
- * Adds a history entry when opened and handles back button navigation.
108
- *
109
- * @example
110
- * ```ts
111
- * class MyModal extends LitElement {
112
- * private history = new HistoryController(this);
113
- *
114
- * open() {
115
- * this.history.push({ modal: 'my-modal' });
116
- * this.history.onPopState(() => this.close());
117
- * // show modal
118
- * }
119
- *
120
- * close() {
121
- * this.history.pop();
122
- * // hide modal
123
- * }
124
- * }
125
- * ```
126
- */
127
- export declare class HistoryController extends BaseController {
128
- private hasAddedEntry;
129
- private onPopCallback?;
130
- push(state?: object): void;
131
- pop(): void;
132
- onPopState(callback: () => void): void;
133
- private handlePopState;
134
- hostConnected(): void;
135
- hostDisconnected(): void;
136
- }
137
-
138
- /**
139
- * Controller for managing loading states and progress.
140
- *
141
- * @example
142
- * ```ts
143
- * class MyComponent extends LitElement {
144
- * private loading = new LoadingController(this);
145
- *
146
- * async handleSubmit() {
147
- * this.loading.start();
148
- * await doSomething();
149
- * this.loading.complete();
150
- * }
151
- *
152
- * render() {
153
- * return html`
154
- * <button ?disabled=${this.loading.isLoading}>
155
- * ${this.loading.isLoading ? 'Loading...' : 'Submit'}
156
- * </button>
157
- * `;
158
- * }
159
- * }
160
- * ```
161
- */
162
- export declare class LoadingController extends BaseController {
163
- private _isLoading;
164
- private _progress;
165
- get isLoading(): boolean;
166
- get progress(): number;
167
- start(): void;
168
- setProgress(value: number): void;
169
- complete(): void;
170
- reset(): void;
171
- }
172
-
173
- /**
174
- * Controller for reactive media query matching.
175
- * Automatically updates the host when the media query matches or unmatches.
176
- *
177
- * @example
178
- * ```ts
179
- * class MyComponent extends LitElement {
180
- * private mobile = new MatchMediaController(this, '(max-width: 768px)');
181
- * private darkMode = new MatchMediaController(this, '(prefers-color-scheme: dark)');
182
- *
183
- * render() {
184
- * return html`
185
- * <div class=${this.mobile.matches ? 'mobile' : 'desktop'}>
186
- * ${this.darkMode.matches ? 'Dark mode' : 'Light mode'}
187
- * </div>
188
- * `;
189
- * }
190
- * }
191
- * ```
192
- */
193
- export declare class MatchMediaController extends BaseController {
194
- private mediaQuery;
195
- private _matches;
196
- constructor(host: ReactiveControllerHost, query: string);
197
- get matches(): boolean;
198
- private handleChange;
199
- hostConnected(): void;
200
- hostDisconnected(): void;
201
- }
202
-
203
- /**
204
- * Controller for postMessage communication with iframes or other windows.
205
- *
206
- * @example
207
- * ```ts
208
- * class MyIframeHost extends LitElement {
209
- * private messageBus = new MessageBusController(this);
210
- *
211
- * connectedCallback() {
212
- * super.connectedCallback();
213
- * this.messageBus.onMessage('READY', (payload) => {
214
- * console.log('Iframe is ready', payload);
215
- * });
216
- * }
217
- *
218
- * sendToIframe() {
219
- * this.messageBus.send('COMMAND', { action: 'do-something' });
220
- * }
221
- * }
222
- * ```
223
- */
224
- export declare class MessageBusController extends BaseController {
225
- private handlers;
226
- private wildcardHandlers;
227
- private targetOrigin;
228
- /**
229
- * @param host - The reactive controller host
230
- * @param targetOrigin - The origin to accept messages from and send messages to.
231
- * SECURITY NOTE: Using '*' accepts messages from any origin which can be dangerous.
232
- * Always specify an explicit origin in production environments.
233
- */
234
- constructor(host: ReactiveControllerHost, targetOrigin?: string);
235
- send(type: string, payload: unknown, targetWindow?: Window): void;
236
- sendToFrame(iframe: HTMLIFrameElement, type: string, payload: unknown): void;
237
- onMessage(type: string, handler: MessageHandler): () => void;
238
- onMessage(type: '*', handler: WildcardMessageHandler): () => void;
239
- private handleMessage;
240
- hostConnected(): void;
241
- hostDisconnected(): void;
242
- }
243
-
244
- declare type MessageHandler = (payload: unknown) => void;
245
-
246
- /**
247
- * Controller for syncing component state with localStorage/sessionStorage.
248
- * Automatically updates when storage changes in other tabs.
249
- *
250
- * @example
251
- * ```ts
252
- * class MyBanner extends LitElement {
253
- * private dismissed = new StorageController<boolean>(this, 'banner-dismissed');
254
- *
255
- * handleDismiss() {
256
- * this.dismissed.set(true);
257
- * }
258
- *
259
- * render() {
260
- * if (this.dismissed.value) return null;
261
- * return html`
262
- * <div class="banner">
263
- * <button @click=${this.handleDismiss}>Dismiss</button>
264
- * </div>
265
- * `;
266
- * }
267
- * }
268
- * ```
269
- */
270
- export declare class StorageController<T = unknown> extends BaseController {
271
- private key;
272
- private storage;
273
- private _value;
274
- constructor(host: ReactiveControllerHost, key: string, storage?: Storage);
275
- get value(): T | null;
276
- set(value: T): void;
277
- remove(): void;
278
- private load;
279
- private handleStorageChange;
280
- hostConnected(): void;
281
- hostDisconnected(): void;
282
- }
283
-
284
- export declare interface ValidationRule {
285
- type: ValidationType;
286
- value?: string | number | RegExp;
287
- message: string;
288
- validator?: (value: string) => boolean;
289
- }
290
-
291
- export declare type ValidationType = 'required' | 'email' | 'minLength' | 'maxLength' | 'pattern' | 'custom';
292
-
293
- declare type WildcardMessageHandler = (type: string, payload: unknown) => void;
294
-
295
- export { }
1
+ export * from './controllers/index.js';
2
+ export * from './primitives/index.js';
3
+ export * from './screens/index.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AAGvC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC"}