@iyulab/components 0.1.3 → 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 (124) hide show
  1. package/CHANGELOG.md +18 -15
  2. package/LICENSE +20 -20
  3. package/README.md +33 -33
  4. package/dist/assets/icons/arrow-clockwise.svg.js +1 -1
  5. package/dist/assets/icons/arrow-down.svg.js +1 -1
  6. package/dist/assets/icons/arrow-up.svg.js +1 -1
  7. package/dist/assets/icons/ban.svg.js +1 -1
  8. package/dist/assets/icons/check-circle-fill.svg.js +1 -1
  9. package/dist/assets/icons/check-lg.svg.js +1 -1
  10. package/dist/assets/icons/chevron-down.svg.js +1 -1
  11. package/dist/assets/icons/chevron-left.svg.js +1 -1
  12. package/dist/assets/icons/chevron-right.svg.js +1 -1
  13. package/dist/assets/icons/chevron-up.svg.js +1 -1
  14. package/dist/assets/icons/copy.svg.js +1 -1
  15. package/dist/assets/icons/dash-lg.svg.js +1 -1
  16. package/dist/assets/icons/exclamation-circle-fill.svg.js +1 -1
  17. package/dist/assets/icons/exclamation-triangle-fill.svg.js +1 -1
  18. package/dist/assets/icons/info-circle-fill.svg.js +1 -1
  19. package/dist/assets/icons/layout-sidebar.svg.js +1 -1
  20. package/dist/assets/icons/lightbulb-fill.svg.js +1 -1
  21. package/dist/assets/icons/lightbulb-off.svg.js +1 -1
  22. package/dist/assets/icons/lightbulb.svg.js +1 -1
  23. package/dist/assets/icons/mic-fill.svg.js +1 -1
  24. package/dist/assets/icons/mic-mute-fill.svg.js +1 -1
  25. package/dist/assets/icons/paperclip.svg.js +1 -1
  26. package/dist/assets/icons/pencil-square.svg.js +1 -1
  27. package/dist/assets/icons/plus-lg.svg.js +1 -1
  28. package/dist/assets/icons/search.svg.js +1 -1
  29. package/dist/assets/icons/speedometer.svg.js +1 -1
  30. package/dist/assets/icons/x-lg.svg.js +1 -1
  31. package/dist/assets/styles/dark.css +129 -125
  32. package/dist/assets/styles/dark.css.js +1 -1
  33. package/dist/assets/styles/light.css +129 -126
  34. package/dist/assets/styles/light.css.js +1 -1
  35. package/dist/components/BaseElement.styles.js +2 -3
  36. package/dist/components/alert/Alert.d.ts +8 -4
  37. package/dist/components/alert/Alert.js +24 -15
  38. package/dist/components/alert/Alert.styles.js +32 -39
  39. package/dist/components/alert/index.js +5 -0
  40. package/dist/components/button/Button.js +4 -2
  41. package/dist/components/button/Button.styles.js +13 -20
  42. package/dist/components/button/index.js +5 -0
  43. package/dist/components/context-menu/index.js +5 -0
  44. package/dist/components/copy-button/CopyButton.d.ts +7 -3
  45. package/dist/components/copy-button/CopyButton.js +69 -0
  46. package/dist/components/copy-button/CopyButton.styles.js +17 -0
  47. package/dist/components/copy-button/index.js +5 -0
  48. package/dist/components/dialog/index.js +5 -0
  49. package/dist/components/divider/Divider.d.ts +25 -0
  50. package/dist/components/divider/Divider.js +89 -0
  51. package/dist/components/{split-panel/Splitter.styles.js → divider/Divider.styles.js} +25 -13
  52. package/dist/components/divider/index.d.ts +7 -0
  53. package/dist/components/divider/index.js +5 -0
  54. package/dist/components/form/Form.d.ts +3 -1
  55. package/dist/components/form/Form.js +3 -1
  56. package/dist/components/form/Form.styles.js +1 -0
  57. package/dist/components/form/index.js +5 -0
  58. package/dist/components/icon/Icon.d.ts +6 -16
  59. package/dist/components/icon/Icon.js +17 -40
  60. package/dist/components/icon/Icon.styles.js +1 -1
  61. package/dist/components/icon/index.js +5 -0
  62. package/dist/components/icon-button/IconButton.d.ts +3 -3
  63. package/dist/components/icon-button/IconButton.js +6 -6
  64. package/dist/components/icon-button/IconButton.styles.js +14 -29
  65. package/dist/components/icon-button/index.js +5 -0
  66. package/dist/components/index.d.ts +2 -1
  67. package/dist/components/input/Input.d.ts +14 -13
  68. package/dist/components/input/Input.js +56 -55
  69. package/dist/components/input/Input.styles.js +52 -54
  70. package/dist/components/input/index.js +5 -0
  71. package/dist/components/menu/index.js +5 -0
  72. package/dist/components/progress-bar/ProgressBar.d.ts +2 -2
  73. package/dist/components/progress-bar/ProgressBar.js +2 -2
  74. package/dist/components/progress-bar/ProgressBar.styles.js +10 -10
  75. package/dist/components/progress-bar/index.js +5 -0
  76. package/dist/components/progress-ring/ProgressRing.d.ts +2 -2
  77. package/dist/components/progress-ring/ProgressRing.js +9 -6
  78. package/dist/components/progress-ring/ProgressRing.styles.js +8 -9
  79. package/dist/components/progress-ring/index.js +5 -0
  80. package/dist/components/spinner/Spinner.styles.js +5 -3
  81. package/dist/components/spinner/index.js +5 -0
  82. package/dist/components/split-panel/SplitPanel.d.ts +8 -12
  83. package/dist/components/split-panel/SplitPanel.js +64 -91
  84. package/dist/components/split-panel/SplitPanel.styles.js +16 -1
  85. package/dist/components/split-panel/index.js +5 -0
  86. package/dist/components/tooltip/Tooltip.d.ts +8 -12
  87. package/dist/components/tooltip/Tooltip.js +39 -38
  88. package/dist/components/tooltip/Tooltip.styles.js +5 -5
  89. package/dist/components/tooltip/index.js +5 -0
  90. package/dist/components/tree/Tree.d.ts +2 -14
  91. package/dist/components/tree/Tree.js +9 -49
  92. package/dist/components/tree/Tree.styles.js +5 -5
  93. package/dist/components/tree/index.js +5 -0
  94. package/dist/components/tree-item/TreeItem.d.ts +10 -29
  95. package/dist/components/tree-item/TreeItem.js +63 -95
  96. package/dist/components/tree-item/TreeItem.styles.js +10 -41
  97. package/dist/components/tree-item/index.js +5 -0
  98. package/dist/index.js +25 -5
  99. package/dist/integrations/react/UDivider.d.ts +8 -0
  100. package/dist/integrations/react/UDivider.js +10 -0
  101. package/dist/integrations/react/index.d.ts +1 -1
  102. package/dist/integrations/react/index.js +1 -1
  103. package/dist/internals/index.d.ts +0 -1
  104. package/dist/utilities/decorators.js +2 -0
  105. package/dist/utilities/icons.d.ts +46 -0
  106. package/dist/{internals → utilities}/icons.js +74 -2
  107. package/dist/utilities/index.d.ts +1 -0
  108. package/dist/utilities/notifier.d.ts +17 -7
  109. package/dist/utilities/notifier.js +51 -41
  110. package/dist/utilities/theme.d.ts +15 -20
  111. package/dist/utilities/theme.js +36 -29
  112. package/package.json +59 -58
  113. package/dist/components/panel/Panel.d.ts +0 -10
  114. package/dist/components/panel/Panel.js +0 -21
  115. package/dist/components/panel/Panel.styles.js +0 -12
  116. package/dist/components/panel/index.d.ts +0 -7
  117. package/dist/components/split-panel/SplitPanel.types.d.ts +0 -2
  118. package/dist/components/split-panel/Splitter.d.ts +0 -17
  119. package/dist/components/split-panel/Splitter.js +0 -45
  120. package/dist/components/split-panel/Splitter.styles.d.ts +0 -1
  121. package/dist/integrations/react/UPanel.d.ts +0 -8
  122. package/dist/integrations/react/UPanel.js +0 -10
  123. package/dist/internals/icons.d.ts +0 -6
  124. /package/dist/components/{panel/Panel.styles.d.ts → divider/Divider.styles.d.ts} +0 -0
@@ -2,71 +2,80 @@ 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 styleBundle = Object.entries(/* #__PURE__ */ Object.assign({"../assets/styles/dark.css": dark,"../assets/styles/light.css": light
6
+
7
+
8
+ })).map(([path, module]) => {
9
+ const name = path.split("/").pop()?.replace(".css", "") || "";
10
+ return [name, module.default];
11
+ }).filter(([name]) => name !== "");
5
12
  class Theme {
6
- /** private 생성자 — 외부에서 new Theme()를 할 수 없게 함 */
7
13
  constructor() {
8
- this.STORAGE_KEY_DEFAULT = "theme";
14
+ this.STORAGE_THEME_KEY = "theme";
9
15
  this.storage = null;
10
16
  this._isInitialized = false;
11
17
  this._isDebugMode = false;
12
- /**
13
- * 시스템 테마 변경을 처리하는 메서드
14
- */
18
+ /** 시스템 테마 변경을 처리하는 메서드 */
15
19
  this.handleSystemThemeChanged = (_) => {
16
20
  if (document.documentElement.getAttribute("data-theme") === "system") {
17
21
  const isDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
18
22
  document.documentElement.setAttribute("theme", isDark ? "dark" : "light");
23
+ this.log("system theme changed, applied", isDark ? "dark" : "light");
19
24
  }
20
25
  };
21
26
  }
22
- /** 싱글톤 인스턴스 접근자 */
23
27
  static get instance() {
24
28
  if (!this._instance) {
25
29
  this._instance = new Theme();
26
30
  }
27
31
  return this._instance;
28
32
  }
29
- /** 외부에서 현재 초기화 상태를 확인할 수 있게 getter 제공 */
30
33
  get isInitialized() {
31
34
  return this._isInitialized;
32
35
  }
36
+ get isDebugMode() {
37
+ return this._isDebugMode;
38
+ }
33
39
  /**
34
- * 테마 유틸리티 초기화
40
+ * 테마 유틸리티를 초기화합니다.
35
41
  */
36
42
  async init(options) {
37
43
  this._isDebugMode = options?.debug || false;
38
44
  this.log("init called", { options });
39
45
  if (options?.store) {
40
- this.log("store option provided, initializing BrowserStorage");
41
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");
42
51
  }
43
52
  const useBuiltIn = options?.useBuiltIn ?? true;
44
53
  if (useBuiltIn) {
45
54
  this.log("Import enabled: loading styles via internal assets");
46
- const assets = Object.entries(/* #__PURE__ */ Object.assign({"../assets/styles/dark.css": dark,"../assets/styles/light.css": light
47
-
48
-
49
- }));
50
- this.log(`found ${assets.length} style assets`, assets.map((a) => a[0]));
51
- for (let [path, module] of assets) {
52
- const fileName = path.split("/").pop() || path;
55
+ for (let [name, module] of styleBundle) {
53
56
  const style = document.createElement("style");
54
- style.setAttribute("data-path", fileName);
55
- style.textContent = module.default;
56
- if (document.head.querySelector(`style[data-path="${fileName}"]`)) {
57
- this.log("style already present, skipping", fileName);
57
+ style.setAttribute("data-name", name);
58
+ style.textContent = module;
59
+ if (document.head.querySelector(`style[data-name="${name}"]`)) {
60
+ this.log("style already present, skipping", name);
58
61
  continue;
59
62
  }
60
63
  document.head.appendChild(style);
61
- this.log("appended style to head", fileName);
64
+ this.log("appended style to head", name);
62
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");
63
70
  }
64
- let theme2 = options?.default || "system";
71
+ let theme2 = options?.default ?? "system";
65
72
  if (this.storage !== null) {
66
- const savedTheme = await this.storage.get(this.STORAGE_KEY_DEFAULT);
73
+ const savedTheme = await this.storage.get(this.STORAGE_THEME_KEY);
67
74
  if (savedTheme) {
68
75
  theme2 = savedTheme;
69
76
  this.log("loaded theme from storage", theme2);
77
+ } else {
78
+ this.log("no saved theme in storage, using default", theme2);
70
79
  }
71
80
  }
72
81
  this.set(theme2);
@@ -90,7 +99,7 @@ class Theme {
90
99
  }
91
100
  }
92
101
  /**
93
- * 현재 문서 테마를 설정합니다.
102
+ * 현재 문서에 적용할 테마를 설정합니다.
94
103
  */
95
104
  set(theme2) {
96
105
  try {
@@ -117,17 +126,15 @@ class Theme {
117
126
  this.log("Error applying theme:", e);
118
127
  }
119
128
  if (this.storage !== null) {
120
- this.storage.set(this.STORAGE_KEY_DEFAULT, theme2);
129
+ this.storage.set(this.STORAGE_THEME_KEY, theme2);
121
130
  this.log("saved theme to storage", theme2);
122
131
  }
123
132
  }
124
- /**
125
- * 디버그 모드시 로그 출력 함수 (인스턴스 스코프)
126
- */
133
+ /** 디버그 모드시 로그 출력 함수 (인스턴스 스코프) */
127
134
  log(...args) {
128
135
  if (this._isDebugMode) console.log("[theme]", ...args);
129
136
  }
130
137
  }
131
138
  const theme = Theme.instance;
132
139
 
133
- export { Theme, theme };
140
+ export { theme };
package/package.json CHANGED
@@ -1,58 +1,59 @@
1
- {
2
- "name": "@iyulab/components",
3
- "description": "web-components library by iyulab based on lit-element",
4
- "version": "0.1.3",
5
- "keywords": [
6
- "iyulab",
7
- "web-components",
8
- "lit-element"
9
- ],
10
- "license": "MIT",
11
- "author": "iyulab",
12
- "repository": {
13
- "type": "git",
14
- "url": "https://github.com/iyulab/node-components.git"
15
- },
16
- "files": [
17
- "dist",
18
- "LICENSE",
19
- "README.md",
20
- "CHANGELOG.md",
21
- "package.json"
22
- ],
23
- "type": "module",
24
- "types": "./dist/index.d.ts",
25
- "exports": {
26
- ".": {
27
- "types": "./dist/index.d.ts",
28
- "import": "./dist/index.js"
29
- },
30
- "./dist/*": {
31
- "types": "./dist/*.d.ts",
32
- "import": "./dist/*"
33
- }
34
- },
35
- "scripts": {
36
- "start": "vite --force",
37
- "build": "eslint && vite build"
38
- },
39
- "dependencies": {
40
- "@floating-ui/dom": "^1.7.4",
41
- "lit": "^3.3.1",
42
- "react": "^19.2.0",
43
- "reflect-metadata": "^0.2.2"
44
- },
45
- "devDependencies": {
46
- "@lit/react": "^1.0.8",
47
- "@eslint/js": "^9.39.1",
48
- "@types/node": "^24.10.1",
49
- "eslint": "^9.39.1",
50
- "eslint-plugin-lit": "^2.1.1",
51
- "globals": "^16.5.0",
52
- "typescript": "^5.9.3",
53
- "typescript-eslint": "^8.46.4",
54
- "vite": "^7.2.2",
55
- "vite-plugin-dts": "^4.5.4",
56
- "vite-plugin-static-copy": "^3.1.4"
57
- }
58
- }
1
+ {
2
+ "name": "@iyulab/components",
3
+ "description": "web-components library based on lit-element made by iyulab",
4
+ "version": "0.1.5",
5
+ "keywords": [
6
+ "iyulab",
7
+ "components",
8
+ "web-components",
9
+ "lit-element"
10
+ ],
11
+ "license": "MIT",
12
+ "author": "iyulab",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/iyulab/node-components.git"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "LICENSE",
20
+ "README.md",
21
+ "CHANGELOG.md",
22
+ "package.json"
23
+ ],
24
+ "type": "module",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js"
30
+ },
31
+ "./dist/*": {
32
+ "types": "./dist/*.d.ts",
33
+ "import": "./dist/*"
34
+ }
35
+ },
36
+ "scripts": {
37
+ "start": "vite --force",
38
+ "build": "eslint && vite build"
39
+ },
40
+ "dependencies": {
41
+ "@floating-ui/dom": "^1.7.4",
42
+ "lit": "^3.3.1",
43
+ "react": "^19.2.1",
44
+ "reflect-metadata": "^0.2.2"
45
+ },
46
+ "devDependencies": {
47
+ "@lit/react": "^1.0.8",
48
+ "@eslint/js": "^9.39.1",
49
+ "@types/node": "^24.10.2",
50
+ "eslint": "^9.39.1",
51
+ "eslint-plugin-lit": "^2.1.1",
52
+ "globals": "^16.5.0",
53
+ "typescript": "^5.9.3",
54
+ "typescript-eslint": "^8.49.0",
55
+ "vite": "^7.2.7",
56
+ "vite-plugin-dts": "^4.5.4",
57
+ "vite-plugin-static-copy": "^3.1.4"
58
+ }
59
+ }
@@ -1,10 +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
- connectedCallback(): void;
9
- render(): import('lit-html').TemplateResult<1>;
10
- }
@@ -1,21 +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
- connectedCallback() {
13
- super.connectedCallback();
14
- this.classList.add("scrollable");
15
- }
16
- render() {
17
- return html`<slot></slot>`;
18
- }
19
- }
20
-
21
- export { Panel };
@@ -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,2 +0,0 @@
1
- /** 분할 패널의 방향을 나타내는 타입입니다. */
2
- export type PanelOrientation = 'horizontal' | 'vertical';
@@ -1,17 +0,0 @@
1
- import { BaseElement } from '../BaseElement.js';
2
- import { PanelOrientation } from './SplitPanel.types.js';
3
- /**
4
- * Splitter 컴포넌트는 SplitPanel의 패널들 사이에 배치되는 디바이더입니다.
5
- * 사용자가 드래그하여 패널의 크기를 조절할 수 있습니다.
6
- */
7
- export declare class Splitter extends BaseElement {
8
- static styles: import('lit').CSSResultGroup[];
9
- static dependencies: Record<string, typeof BaseElement>;
10
- /** 드래그 중인지 여부를 나타냅니다. */
11
- dragging: boolean;
12
- /** 분할 방향을 설정합니다. */
13
- orientation: PanelOrientation;
14
- render(): import('lit-html').TemplateResult<1>;
15
- /** 스플리터의 크기를 반환합니다. */
16
- get size(): number;
17
- }
@@ -1,45 +0,0 @@
1
- import { html } from 'lit';
2
- import { state, property } from 'lit/decorators.js';
3
- import { BaseElement } from '../BaseElement.js';
4
- import { styles } from './Splitter.styles.js';
5
-
6
- var __defProp = Object.defineProperty;
7
- var __decorateClass = (decorators, target, key, kind) => {
8
- var result = void 0 ;
9
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
- if (decorator = decorators[i])
11
- result = (decorator(target, key, result) ) || result;
12
- if (result) __defProp(target, key, result);
13
- return result;
14
- };
15
- class Splitter extends BaseElement {
16
- constructor() {
17
- super(...arguments);
18
- this.dragging = false;
19
- this.orientation = "horizontal";
20
- }
21
- static {
22
- this.styles = [super.styles, styles];
23
- }
24
- static {
25
- this.dependencies = {};
26
- }
27
- render() {
28
- return html`
29
- <div class="handler" ?dragging=${this.dragging}></div>
30
- `;
31
- }
32
- /** 스플리터의 크기를 반환합니다. */
33
- get size() {
34
- const sizeStr = getComputedStyle(this).getPropertyValue("--splitter-size").trim();
35
- return parseFloat(sizeStr) || 2;
36
- }
37
- }
38
- __decorateClass([
39
- state()
40
- ], Splitter.prototype, "dragging");
41
- __decorateClass([
42
- property({ type: String, reflect: true })
43
- ], Splitter.prototype, "orientation");
44
-
45
- export { Splitter };
@@ -1 +0,0 @@
1
- export declare const styles: import('lit').CSSResult;
@@ -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,6 +0,0 @@
1
- /**
2
- * 내부적으로 사용되는 아이콘 레지스트리입니다.
3
- * SVG 아이콘 파일을 이름과 매핑하여 저장합니다.
4
- * 아이콘 파일은 '../assets/icons/' 경로에서 자동으로 로드됩니다.
5
- */
6
- export declare const icons: Map<string, string>;