@iyulab/components 0.1.4 → 0.1.5

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 (79) hide show
  1. package/dist/assets/styles/dark.css +40 -36
  2. package/dist/assets/styles/dark.css.js +1 -1
  3. package/dist/assets/styles/light.css +41 -38
  4. package/dist/assets/styles/light.css.js +1 -1
  5. package/dist/components/BaseElement.styles.js +2 -2
  6. package/dist/components/alert/Alert.d.ts +8 -4
  7. package/dist/components/alert/Alert.js +24 -15
  8. package/dist/components/alert/Alert.styles.js +32 -39
  9. package/dist/components/alert/index.js +5 -0
  10. package/dist/components/button/Button.js +4 -2
  11. package/dist/components/button/Button.styles.js +13 -20
  12. package/dist/components/button/index.js +5 -0
  13. package/dist/components/context-menu/index.js +5 -0
  14. package/dist/components/copy-button/CopyButton.d.ts +7 -3
  15. package/dist/components/copy-button/CopyButton.js +69 -0
  16. package/dist/components/copy-button/CopyButton.styles.js +17 -0
  17. package/dist/components/copy-button/index.js +5 -0
  18. package/dist/components/dialog/index.js +5 -0
  19. package/dist/components/divider/Divider.d.ts +5 -5
  20. package/dist/components/divider/Divider.js +15 -15
  21. package/dist/components/divider/Divider.styles.js +7 -5
  22. package/dist/components/divider/index.js +5 -0
  23. package/dist/components/form/Form.d.ts +3 -1
  24. package/dist/components/form/Form.js +3 -1
  25. package/dist/components/form/Form.styles.js +1 -0
  26. package/dist/components/form/index.js +5 -0
  27. package/dist/components/icon/Icon.d.ts +6 -12
  28. package/dist/components/icon/Icon.js +14 -30
  29. package/dist/components/icon/Icon.styles.js +1 -1
  30. package/dist/components/icon/index.js +5 -0
  31. package/dist/components/icon-button/IconButton.d.ts +3 -3
  32. package/dist/components/icon-button/IconButton.js +6 -6
  33. package/dist/components/icon-button/IconButton.styles.js +14 -29
  34. package/dist/components/icon-button/index.js +5 -0
  35. package/dist/components/index.d.ts +1 -1
  36. package/dist/components/input/Input.d.ts +14 -13
  37. package/dist/components/input/Input.js +56 -55
  38. package/dist/components/input/Input.styles.js +52 -54
  39. package/dist/components/input/index.js +5 -0
  40. package/dist/components/menu/index.js +5 -0
  41. package/dist/components/progress-bar/ProgressBar.d.ts +1 -1
  42. package/dist/components/progress-bar/ProgressBar.js +2 -2
  43. package/dist/components/progress-bar/ProgressBar.styles.js +10 -10
  44. package/dist/components/progress-bar/index.js +5 -0
  45. package/dist/components/progress-ring/ProgressRing.d.ts +2 -2
  46. package/dist/components/progress-ring/ProgressRing.js +7 -6
  47. package/dist/components/progress-ring/ProgressRing.styles.js +8 -9
  48. package/dist/components/progress-ring/index.js +5 -0
  49. package/dist/components/spinner/Spinner.styles.js +5 -3
  50. package/dist/components/spinner/index.js +5 -0
  51. package/dist/components/split-panel/SplitPanel.d.ts +1 -1
  52. package/dist/components/split-panel/SplitPanel.js +5 -7
  53. package/dist/components/split-panel/index.js +5 -0
  54. package/dist/components/tooltip/Tooltip.styles.js +1 -1
  55. package/dist/components/tooltip/index.js +5 -0
  56. package/dist/components/tree/index.js +5 -0
  57. package/dist/components/tree-item/index.js +5 -0
  58. package/dist/index.js +24 -5
  59. package/dist/integrations/react/index.d.ts +0 -1
  60. package/dist/integrations/react/index.js +0 -1
  61. package/dist/internals/index.d.ts +0 -1
  62. package/dist/utilities/decorators.js +2 -0
  63. package/dist/utilities/icons.d.ts +46 -0
  64. package/dist/utilities/icons.js +114 -0
  65. package/dist/utilities/index.d.ts +1 -0
  66. package/dist/utilities/notifier.d.ts +17 -7
  67. package/dist/utilities/notifier.js +51 -41
  68. package/dist/utilities/theme.d.ts +15 -20
  69. package/dist/utilities/theme.js +24 -20
  70. package/package.json +7 -6
  71. package/dist/components/panel/Panel.d.ts +0 -9
  72. package/dist/components/panel/Panel.js +0 -17
  73. package/dist/components/panel/Panel.styles.d.ts +0 -1
  74. package/dist/components/panel/Panel.styles.js +0 -12
  75. package/dist/components/panel/index.d.ts +0 -7
  76. package/dist/integrations/react/UPanel.d.ts +0 -8
  77. package/dist/integrations/react/UPanel.js +0 -10
  78. package/dist/internals/icon-helpers.d.ts +0 -32
  79. package/dist/internals/icon-helpers.js +0 -48
@@ -2,7 +2,7 @@ import * as dark from '../assets/styles/dark.css.js';
2
2
  import * as light from '../assets/styles/light.css.js';
3
3
  import { BrowserStorage } from './BrowserStorage.js';
4
4
 
5
- const styleAssets = Object.entries(/* #__PURE__ */ Object.assign({"../assets/styles/dark.css": dark,"../assets/styles/light.css": light
5
+ const styleBundle = Object.entries(/* #__PURE__ */ Object.assign({"../assets/styles/dark.css": dark,"../assets/styles/light.css": light
6
6
 
7
7
 
8
8
  })).map(([path, module]) => {
@@ -10,61 +10,67 @@ const styleAssets = Object.entries(/* #__PURE__ */ Object.assign({"../assets/sty
10
10
  return [name, module.default];
11
11
  }).filter(([name]) => name !== "");
12
12
  class Theme {
13
- /** private 생성자 — 외부에서 new Theme()를 할 수 없게 함 */
14
13
  constructor() {
15
- this.STORAGE_KEY_DEFAULT = "theme";
14
+ this.STORAGE_THEME_KEY = "theme";
16
15
  this.storage = null;
17
16
  this._isInitialized = false;
18
17
  this._isDebugMode = false;
19
- /**
20
- * 시스템 테마 변경을 처리하는 메서드
21
- */
18
+ /** 시스템 테마 변경을 처리하는 메서드 */
22
19
  this.handleSystemThemeChanged = (_) => {
23
20
  if (document.documentElement.getAttribute("data-theme") === "system") {
24
21
  const isDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
25
22
  document.documentElement.setAttribute("theme", isDark ? "dark" : "light");
23
+ this.log("system theme changed, applied", isDark ? "dark" : "light");
26
24
  }
27
25
  };
28
26
  }
29
- /** 싱글톤 인스턴스 접근자 */
30
27
  static get instance() {
31
28
  if (!this._instance) {
32
29
  this._instance = new Theme();
33
30
  }
34
31
  return this._instance;
35
32
  }
36
- /** 외부에서 현재 초기화 상태를 확인할 수 있게 getter 제공 */
37
33
  get isInitialized() {
38
34
  return this._isInitialized;
39
35
  }
36
+ get isDebugMode() {
37
+ return this._isDebugMode;
38
+ }
40
39
  /**
41
- * 테마 유틸리티 초기화
40
+ * 테마 유틸리티를 초기화합니다.
42
41
  */
43
42
  async init(options) {
44
43
  this._isDebugMode = options?.debug || false;
45
44
  this.log("init called", { options });
46
45
  if (options?.store) {
47
- this.log("store option provided, initializing BrowserStorage");
48
46
  this.storage = new BrowserStorage(options.store);
47
+ this.log("store option provided, initializing BrowserStorage");
48
+ } else {
49
+ this.storage = null;
50
+ this.log("no store option provided, skipping BrowserStorage initialization");
49
51
  }
50
52
  const useBuiltIn = options?.useBuiltIn ?? true;
51
53
  if (useBuiltIn) {
52
54
  this.log("Import enabled: loading styles via internal assets");
53
- for (let [name, module] of styleAssets) {
55
+ for (let [name, module] of styleBundle) {
54
56
  const style = document.createElement("style");
55
- style.setAttribute("data-path", name);
57
+ style.setAttribute("data-name", name);
56
58
  style.textContent = module;
57
- if (document.head.querySelector(`style[data-path="${name}"]`)) {
59
+ if (document.head.querySelector(`style[data-name="${name}"]`)) {
58
60
  this.log("style already present, skipping", name);
59
61
  continue;
60
62
  }
61
63
  document.head.appendChild(style);
62
64
  this.log("appended style to head", name);
63
65
  }
66
+ } else {
67
+ const styleHead = document.head.querySelectorAll("style[data-name]");
68
+ styleHead.forEach((el) => el.remove());
69
+ this.log("Import disabled: removed internal styles from head");
64
70
  }
65
71
  let theme2 = options?.default ?? "system";
66
72
  if (this.storage !== null) {
67
- const savedTheme = await this.storage.get(this.STORAGE_KEY_DEFAULT);
73
+ const savedTheme = await this.storage.get(this.STORAGE_THEME_KEY);
68
74
  if (savedTheme) {
69
75
  theme2 = savedTheme;
70
76
  this.log("loaded theme from storage", theme2);
@@ -93,7 +99,7 @@ class Theme {
93
99
  }
94
100
  }
95
101
  /**
96
- * 현재 문서 테마를 설정합니다.
102
+ * 현재 문서에 적용할 테마를 설정합니다.
97
103
  */
98
104
  set(theme2) {
99
105
  try {
@@ -120,17 +126,15 @@ class Theme {
120
126
  this.log("Error applying theme:", e);
121
127
  }
122
128
  if (this.storage !== null) {
123
- this.storage.set(this.STORAGE_KEY_DEFAULT, theme2);
129
+ this.storage.set(this.STORAGE_THEME_KEY, theme2);
124
130
  this.log("saved theme to storage", theme2);
125
131
  }
126
132
  }
127
- /**
128
- * 디버그 모드시 로그 출력 함수 (인스턴스 스코프)
129
- */
133
+ /** 디버그 모드시 로그 출력 함수 (인스턴스 스코프) */
130
134
  log(...args) {
131
135
  if (this._isDebugMode) console.log("[theme]", ...args);
132
136
  }
133
137
  }
134
138
  const theme = Theme.instance;
135
139
 
136
- export { Theme, theme };
140
+ export { theme };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@iyulab/components",
3
- "description": "web-components library by iyulab based on lit-element",
4
- "version": "0.1.4",
3
+ "description": "web-components library based on lit-element made by iyulab",
4
+ "version": "0.1.5",
5
5
  "keywords": [
6
6
  "iyulab",
7
+ "components",
7
8
  "web-components",
8
9
  "lit-element"
9
10
  ],
@@ -45,14 +46,14 @@
45
46
  "devDependencies": {
46
47
  "@lit/react": "^1.0.8",
47
48
  "@eslint/js": "^9.39.1",
48
- "@types/node": "^24.10.1",
49
+ "@types/node": "^24.10.2",
49
50
  "eslint": "^9.39.1",
50
51
  "eslint-plugin-lit": "^2.1.1",
51
52
  "globals": "^16.5.0",
52
53
  "typescript": "^5.9.3",
53
- "typescript-eslint": "^8.48.1",
54
- "vite": "^7.2.6",
54
+ "typescript-eslint": "^8.49.0",
55
+ "vite": "^7.2.7",
55
56
  "vite-plugin-dts": "^4.5.4",
56
57
  "vite-plugin-static-copy": "^3.1.4"
57
58
  }
58
- }
59
+ }
@@ -1,9 +0,0 @@
1
- import { BaseElement } from '../BaseElement.js';
2
- /**
3
- * 각 패널은 독립적인 크기와 콘텐츠를 가질 수 있습니다.
4
- */
5
- export declare class Panel extends BaseElement {
6
- static styles: import('lit').CSSResultGroup[];
7
- static dependencies: Record<string, typeof BaseElement>;
8
- render(): import('lit-html').TemplateResult<1>;
9
- }
@@ -1,17 +0,0 @@
1
- import { html } from 'lit';
2
- import { BaseElement } from '../BaseElement.js';
3
- import { styles } from './Panel.styles.js';
4
-
5
- class Panel extends BaseElement {
6
- static {
7
- this.styles = [super.styles, styles];
8
- }
9
- static {
10
- this.dependencies = {};
11
- }
12
- render() {
13
- return html`<slot></slot>`;
14
- }
15
- }
16
-
17
- export { Panel };
@@ -1 +0,0 @@
1
- export declare const styles: import('lit').CSSResult;
@@ -1,12 +0,0 @@
1
- import { css } from 'lit';
2
-
3
- const styles = css`
4
- :host {
5
- position: relative;
6
- display: block;
7
- width: 100%;
8
- height: 100%;
9
- }
10
- `;
11
-
12
- export { styles };
@@ -1,7 +0,0 @@
1
- import { Panel } from './Panel.js';
2
- declare global {
3
- interface HTMLElementTagNameMap {
4
- 'u-panel': Panel;
5
- }
6
- }
7
- export { Panel };
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { Panel } from '../../components/panel/index';
3
-
4
- export declare const UPanel: React.ForwardRefExoticComponent<
5
- Partial<Panel> & React.HTMLAttributes<Panel>
6
- >;
7
-
8
- export type UPanelProps = React.ComponentProps<typeof UPanel>;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { createComponent } from '@lit/react';
3
- import { Panel } from '../../components/panel/index';
4
-
5
- export const UPanel = createComponent({
6
- react: React,
7
- tagName: 'u-panel',
8
- elementClass: Panel,
9
- events: {}
10
- });
@@ -1,32 +0,0 @@
1
- /**
2
- * 아이콘 이름과 SVG 소스를 매핑하는 레지스트리입니다.
3
- *
4
- * - 키: SVG 파일명에서 확장자를 제거한 문자열 (예: `close.svg` → `"close"`)
5
- * - 값: SVG 파일의 raw 문자열 (`?raw` 옵션으로 로드됨)
6
- *
7
- * Vite의 `import.meta.glob`을 사용하여
8
- * `../assets/icons/*.svg` 경로의 모든 SVG 파일을 빌드 시점에 한 번에 로드합니다.
9
- * 이 레지스트리는 런타임 동안 불변이며, 아이콘 조회 시 재사용됩니다.
10
- */
11
- export declare const iconBundle: Map<string, string>;
12
- /**
13
- * 현재 설정된 아이콘 기본 URL을 반환합니다.
14
- *
15
- * 이 값은 아이콘을 정적 경로 또는 CDN 등에서 동적으로 로드할 때
16
- * prefix로 사용됩니다.
17
- *
18
- * @returns 아이콘 로딩에 사용되는 기본 URL (예: `/assets/icons/`)
19
- */
20
- export declare function getBaseUrl(): string;
21
- /**
22
- * 아이콘을 외부에서 로드할 때 사용할 기본 URL을 설정합니다.
23
- *
24
- * 예:
25
- * - `/assets/icons/`
26
- * - `https://cdn.example.com/icons/`
27
- *
28
- * 일반적으로 마지막에 슬래시(`/`)가 포함된 형태를 권장합니다.
29
- *
30
- * @param url 아이콘이 배포된 기본 경로
31
- */
32
- export declare function setBaseUrl(url: string): void;
@@ -1,48 +0,0 @@
1
- import * as arrowClockwise from '../assets/icons/arrow-clockwise.svg.js';
2
- import * as arrowDown from '../assets/icons/arrow-down.svg.js';
3
- import * as arrowUp from '../assets/icons/arrow-up.svg.js';
4
- import * as ban from '../assets/icons/ban.svg.js';
5
- import * as bellFill from '../assets/icons/bell-fill.svg.js';
6
- import * as checkCircleFill from '../assets/icons/check-circle-fill.svg.js';
7
- import * as checkLg from '../assets/icons/check-lg.svg.js';
8
- import * as chevronDown from '../assets/icons/chevron-down.svg.js';
9
- import * as chevronLeft from '../assets/icons/chevron-left.svg.js';
10
- import * as chevronRight from '../assets/icons/chevron-right.svg.js';
11
- import * as chevronUp from '../assets/icons/chevron-up.svg.js';
12
- import * as copy from '../assets/icons/copy.svg.js';
13
- import * as dashLg from '../assets/icons/dash-lg.svg.js';
14
- import * as exclamationCircleFill from '../assets/icons/exclamation-circle-fill.svg.js';
15
- import * as exclamationTriangleFill from '../assets/icons/exclamation-triangle-fill.svg.js';
16
- import * as eyeSlash from '../assets/icons/eye-slash.svg.js';
17
- import * as eye from '../assets/icons/eye.svg.js';
18
- import * as infoCircleFill from '../assets/icons/info-circle-fill.svg.js';
19
- import * as layoutSidebar from '../assets/icons/layout-sidebar.svg.js';
20
- import * as lightbulbFill from '../assets/icons/lightbulb-fill.svg.js';
21
- import * as lightbulbOff from '../assets/icons/lightbulb-off.svg.js';
22
- import * as lightbulb from '../assets/icons/lightbulb.svg.js';
23
- import * as micFill from '../assets/icons/mic-fill.svg.js';
24
- import * as micMuteFill from '../assets/icons/mic-mute-fill.svg.js';
25
- import * as paperclip from '../assets/icons/paperclip.svg.js';
26
- import * as pencilSquare from '../assets/icons/pencil-square.svg.js';
27
- import * as plusLg from '../assets/icons/plus-lg.svg.js';
28
- import * as search from '../assets/icons/search.svg.js';
29
- import * as speedometer from '../assets/icons/speedometer.svg.js';
30
- import * as xLg from '../assets/icons/x-lg.svg.js';
31
-
32
- let iconBaseUrl = "/assets/icons/";
33
- const iconBundle = new Map(
34
- Object.entries(
35
- /* #__PURE__ */ Object.assign({"../assets/icons/arrow-clockwise.svg": arrowClockwise,"../assets/icons/arrow-down.svg": arrowDown,"../assets/icons/arrow-up.svg": arrowUp,"../assets/icons/ban.svg": ban,"../assets/icons/bell-fill.svg": bellFill,"../assets/icons/check-circle-fill.svg": checkCircleFill,"../assets/icons/check-lg.svg": checkLg,"../assets/icons/chevron-down.svg": chevronDown,"../assets/icons/chevron-left.svg": chevronLeft,"../assets/icons/chevron-right.svg": chevronRight,"../assets/icons/chevron-up.svg": chevronUp,"../assets/icons/copy.svg": copy,"../assets/icons/dash-lg.svg": dashLg,"../assets/icons/exclamation-circle-fill.svg": exclamationCircleFill,"../assets/icons/exclamation-triangle-fill.svg": exclamationTriangleFill,"../assets/icons/eye-slash.svg": eyeSlash,"../assets/icons/eye.svg": eye,"../assets/icons/info-circle-fill.svg": infoCircleFill,"../assets/icons/layout-sidebar.svg": layoutSidebar,"../assets/icons/lightbulb-fill.svg": lightbulbFill,"../assets/icons/lightbulb-off.svg": lightbulbOff,"../assets/icons/lightbulb.svg": lightbulb,"../assets/icons/mic-fill.svg": micFill,"../assets/icons/mic-mute-fill.svg": micMuteFill,"../assets/icons/paperclip.svg": paperclip,"../assets/icons/pencil-square.svg": pencilSquare,"../assets/icons/plus-lg.svg": plusLg,"../assets/icons/search.svg": search,"../assets/icons/speedometer.svg": speedometer,"../assets/icons/x-lg.svg": xLg
36
-
37
-
38
- })
39
- ).map(([path, module]) => {
40
- const name = path.split("/").pop()?.replace(".svg", "") || "";
41
- return [name, module.default];
42
- }).filter(([name]) => name !== "")
43
- );
44
- function getBaseUrl() {
45
- return iconBaseUrl;
46
- }
47
-
48
- export { getBaseUrl, iconBundle };