@radishon/lumina 1.0.9 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
6
11
  var __export = (target, all) => {
7
12
  for (var name in all)
8
13
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -15,286 +20,300 @@ var __copyProps = (to, from, except, desc) => {
15
20
  }
16
21
  return to;
17
22
  };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
18
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
32
 
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- Lumina: () => Lumina_default,
24
- LuminaElement: () => Lumina_default,
25
- SEQUENCES: () => SEQUENCES
26
- });
27
- module.exports = __toCommonJS(index_exports);
28
-
29
33
  // src/sequence.ts
30
- var SEQUENCES = {
31
- claude: {
32
- name: "CLAUDE \u8F68\u8FF9",
33
- chars: ["\u2732", "\u2731", "\u273A", "\u273B", "\u273C", "\u273D", "\u273E"],
34
- color: "#fadb14"
35
- },
36
- diamond: {
37
- name: "\u83F1\u5F62\u8109\u51B2",
38
- chars: ["\u25C7", "\u25C6", "\u25C8", "\u25C6", "\u25C7", "\u25C6", "\u25C8", "\u25C6"],
39
- color: "#40a9ff"
40
- },
41
- circle: {
42
- name: "\u67D4\u5149\u5706\u73AF",
43
- chars: ["\xB7", "\u2219", "\u2218", "\u25CB", "\u25CC", "\u25CD", "\u25CE", "\u25CF", "\u25D0", "\u25D1", "\u25D2", "\u25D3"],
44
- color: "#b37feb"
45
- },
46
- step: {
47
- name: "\u9636\u68AF\u8282\u594F",
48
- chars: ["\u2591", "\u2592", "\u2593", "\u2588", "\u2593", "\u2592", "\u2591"],
49
- color: "#73d13d"
50
- },
51
- flower: {
52
- name: "\u5F00\u82B1\u7EFD\u653E",
53
- chars: ["\u2740", "\u2741", "\u273F", "\u2743", "\u274B", "\u273E", "\u2740"],
54
- color: "#ffadd2"
55
- },
56
- star: {
57
- name: "\u661F\u8FB0\u56DE\u73AF",
58
- chars: ["\u2726", "\u2727", "\u2729", "\u272A", "\u272B", "\u272C", "\u272D", "\u272E", "\u272F"],
59
- color: "#ffffff"
60
- },
61
- snow: {
62
- name: "\u96EA\u82B1\u6676\u683C",
63
- chars: ["\xB7", "\u2744", "\u2745", "\u2746", "\u2744", "\u2745", "\u2746"],
64
- color: "#e6f7ff"
65
- },
66
- spiral: {
67
- name: "\u87BA\u65CB\u56DE\u58F0",
68
- chars: ["\u25C9", "\u25CE", "\u25CB", "\u25CC", "\u25CD", "\u25CF", "\u25D0", "\u25D1"],
69
- color: "#fadb14"
70
- },
71
- braille: {
72
- name: "\u5E03\u83B1\u53F6\u7801",
73
- chars: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
74
- color: "#00ff00"
75
- },
76
- cypher: {
77
- name: "\u5BC6\u7801\u77E9\u9635",
78
- chars: ["\u259E", "\u259A", "\u259C", "\u2599", "\u259F", "\u259B"],
79
- color: "#00d8ff"
80
- },
81
- moon: {
82
- name: "\u6708\u76F8\u53D8\u5316",
83
- chars: ["\u{1F311}", "\u{1F312}", "\u{1F313}", "\u{1F314}", "\u{1F315}", "\u{1F316}", "\u{1F317}", "\u{1F318}"],
84
- color: "#fffae6"
85
- },
86
- wave: {
87
- name: "\u6CE2\u6D6A\u8D77\u4F0F",
88
- chars: ["_", "\u23BD", "\u23BC", "\u23BB", "\u23BA", "\u23BB", "\u23BC", "\u23BD"],
89
- color: "#ff4d4f"
90
- },
91
- compass: {
92
- name: "\u65B9\u5411\u7F57\u76D8",
93
- chars: ["\u2191", "\u2197", "\u2192", "\u2198", "\u2193", "\u2199", "\u2190", "\u2196"],
94
- color: "#ff4500"
95
- },
96
- pixel: {
97
- name: "\u50CF\u7D20\u65B9\u5757",
98
- chars: ["\u25A3", "\u25A4", "\u25A5", "\u25A6", "\u25A7", "\u25A8", "\u25A9"],
99
- color: "#722ed1"
100
- },
101
- clock: {
102
- name: "\u65F6\u949F\u6307\u9488",
103
- chars: ["\u{1F550}", "\u{1F551}", "\u{1F552}", "\u{1F553}", "\u{1F554}", "\u{1F555}", "\u{1F556}", "\u{1F557}", "\u{1F558}", "\u{1F559}", "\u{1F55A}", "\u{1F55B}"],
104
- color: "#ffbb96"
105
- },
106
- // 音乐风格
107
- equalizer: {
108
- name: "\u97F3\u9891\u5747\u8861",
109
- chars: ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588", "\u2587", "\u2586", "\u2585", "\u2584"],
110
- color: "#00bcd4"
111
- },
112
- waveform: {
113
- name: "\u6CE2\u5F62\u632F\u8361",
114
- chars: ["\u223F", "\u25E0", "\u25E1", "\u223F", "\u25E0", "\u25E1"],
115
- color: "#ff5722"
116
- },
117
- // 游戏风格
118
- dice: {
119
- name: "\u9AB0\u5B50\u6EDA\u52A8",
120
- chars: ["\u2680", "\u2681", "\u2682", "\u2683", "\u2684", "\u2685", "\u2680", "\u2681"],
121
- color: "#607d8b"
122
- },
123
- // 动态几何
124
- bounce: {
125
- name: "\u5F39\u8DF3\u7403",
126
- chars: ["\u2801", "\u2803", "\u2807", "\u2847", "\u28C7", "\u28E7", "\u28F7", "\u28FF", "\u28F7", "\u28E7", "\u28C7", "\u2847"],
127
- color: "#ff6b6b"
128
- },
129
- radar: {
130
- name: "\u96F7\u8FBE\u626B\u63CF",
131
- chars: ["\u25D0", "\u25D1", "\u25D2", "\u25D3", "\u25D0", "\u25D1", "\u25D2", "\u25D3"],
132
- color: "#00d4aa"
133
- },
134
- // 数字符号
135
- dots: {
136
- name: "\u70B9\u9635\u547C\u5438",
137
- chars: ["\xB7", "\u22EF", "\u22EF\u22EF", "\xB7\xB7\xB7\xB7", "\u22EF\u22EF\u22EF", "\xB7\xB7\xB7\xB7\xB7\xB7", "\u22EF\u22EF\u22EF\u22EF", "\xB7\xB7\xB7\xB7\xB7\xB7\xB7\xB7"],
138
- color: "#4d96ff"
139
- },
140
- // 液体流体
141
- liquid: {
142
- name: "\u6DB2\u4F53\u6643\u52A8",
143
- chars: ["\u223D", "\u223E", "\u223F", "\u223D", "\u223E", "\u223F", "\u2240", "\u223D"],
144
- color: "#118ab2"
145
- },
146
- ripple: {
147
- name: "\u6C34\u7EB9\u6269\u6563",
148
- chars: ["\u25CB", "\u25CE", "\u25C9", "\u25CF", "\u25CB", "\u25CE", "\u25C9", "\u25CF"],
149
- color: "#073b4c"
150
- },
151
- bubble: {
152
- name: "\u6C14\u6CE1\u6D6E\u8D77",
153
- chars: ["\u2218", "\u25CB", "\u25CC", "\u25CD", "\u25CE", "\u25CF", "\u25CB", "\u2218"],
154
- color: "#48cae4"
155
- },
156
- // 光谱渐变
157
- gradient: {
158
- name: "\u6E10\u53D8\u6761",
159
- chars: ["\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589", "\u2588", "\u2589", "\u258A", "\u258B", "\u258C"],
160
- color: "#ee82ee"
161
- },
162
- spectrum: {
163
- name: "\u5149\u8C31\u626B\u63CF",
164
- chars: ["\u2591\u2592\u2593", "\u2592\u2593\u2588", "\u2593\u2588\u2591", "\u2588\u2591\u2592", "\u2591\u2592\u2593", "\u2592\u2593\u2588"],
165
- color: "#ff69b4"
166
- },
167
- // 中国传统
168
- bagua: {
169
- name: "\u516B\u5366",
170
- chars: ["\u2630", "\u2631", "\u2632", "\u2633", "\u2634", "\u2635", "\u2636", "\u2637"],
171
- color: "#8d6e63"
172
- },
173
- // 几何角落
174
- corners: {
175
- name: "\u89D2\u843D\u65CB\u8F6C",
176
- chars: ["\u231C", "\u231D", "\u231F", "\u231E", "\u231C", "\u231D", "\u231F", "\u231E"],
177
- color: "#80cbc4"
178
- },
179
- // 扑克纸牌
180
- cards: {
181
- name: "\u7EB8\u724C",
182
- chars: ["\u{1F0A1}", "\u{1F0A2}", "\u{1F0A3}", "\u{1F0A4}", "\u{1F0A5}", "\u{1F0A6}", "\u{1F0A7}", "\u{1F0A8}"],
183
- color: "#c62828"
184
- },
185
- // 装饰符号
186
- ornament: {
187
- name: "\u88C5\u9970\u7B26",
188
- chars: ["\u2766", "\u2767", "\u2740", "\u273F", "\u2741", "\u2742", "\u2743", "\u2747", "\u2748"],
189
- color: "#e91e63"
190
- },
191
- // 危险警告
192
- radiation: {
193
- name: "\u8F90\u5C04\u8B66\u544A",
194
- chars: ["\u2622", "\u2623", "\u2620", "\u269B", "\u262E", "\u2622", "\u2623", "\u2620"],
195
- color: "#76ff03"
34
+ var SEQUENCES;
35
+ var init_sequence = __esm({
36
+ "src/sequence.ts"() {
37
+ "use strict";
38
+ SEQUENCES = {
39
+ claude: {
40
+ name: "CLAUDE \u8F68\u8FF9",
41
+ chars: ["\u2732", "\u2731", "\u273A", "\u273B", "\u273C", "\u273D", "\u273E"],
42
+ color: "#fadb14"
43
+ },
44
+ diamond: {
45
+ name: "\u83F1\u5F62\u8109\u51B2",
46
+ chars: ["\u25C7", "\u25C6", "\u25C8", "\u25C6", "\u25C7", "\u25C6", "\u25C8", "\u25C6"],
47
+ color: "#40a9ff"
48
+ },
49
+ circle: {
50
+ name: "\u67D4\u5149\u5706\u73AF",
51
+ chars: ["\xB7", "\u2219", "\u2218", "\u25CB", "\u25CC", "\u25CD", "\u25CE", "\u25CF", "\u25D0", "\u25D1", "\u25D2", "\u25D3"],
52
+ color: "#b37feb"
53
+ },
54
+ step: {
55
+ name: "\u9636\u68AF\u8282\u594F",
56
+ chars: ["\u2591", "\u2592", "\u2593", "\u2588", "\u2593", "\u2592", "\u2591"],
57
+ color: "#73d13d"
58
+ },
59
+ flower: {
60
+ name: "\u5F00\u82B1\u7EFD\u653E",
61
+ chars: ["\u2740", "\u2741", "\u273F", "\u2743", "\u274B", "\u273E", "\u2740"],
62
+ color: "#ffadd2"
63
+ },
64
+ star: {
65
+ name: "\u661F\u8FB0\u56DE\u73AF",
66
+ chars: ["\u2726", "\u2727", "\u2729", "\u272A", "\u272B", "\u272C", "\u272D", "\u272E", "\u272F"],
67
+ color: "#ffffff"
68
+ },
69
+ snow: {
70
+ name: "\u96EA\u82B1\u6676\u683C",
71
+ chars: ["\xB7", "\u2744", "\u2745", "\u2746", "\u2744", "\u2745", "\u2746"],
72
+ color: "#e6f7ff"
73
+ },
74
+ spiral: {
75
+ name: "\u87BA\u65CB\u56DE\u58F0",
76
+ chars: ["\u25C9", "\u25CE", "\u25CB", "\u25CC", "\u25CD", "\u25CF", "\u25D0", "\u25D1"],
77
+ color: "#fadb14"
78
+ },
79
+ braille: {
80
+ name: "\u5E03\u83B1\u53F6\u7801",
81
+ chars: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
82
+ color: "#00ff00"
83
+ },
84
+ cypher: {
85
+ name: "\u5BC6\u7801\u77E9\u9635",
86
+ chars: ["\u259E", "\u259A", "\u259C", "\u2599", "\u259F", "\u259B"],
87
+ color: "#00d8ff"
88
+ },
89
+ moon: {
90
+ name: "\u6708\u76F8\u53D8\u5316",
91
+ chars: ["\u{1F311}", "\u{1F312}", "\u{1F313}", "\u{1F314}", "\u{1F315}", "\u{1F316}", "\u{1F317}", "\u{1F318}"],
92
+ color: "#fffae6"
93
+ },
94
+ wave: {
95
+ name: "\u6CE2\u6D6A\u8D77\u4F0F",
96
+ chars: ["_", "\u23BD", "\u23BC", "\u23BB", "\u23BA", "\u23BB", "\u23BC", "\u23BD"],
97
+ color: "#ff4d4f"
98
+ },
99
+ compass: {
100
+ name: "\u65B9\u5411\u7F57\u76D8",
101
+ chars: ["\u2191", "\u2197", "\u2192", "\u2198", "\u2193", "\u2199", "\u2190", "\u2196"],
102
+ color: "#ff4500"
103
+ },
104
+ pixel: {
105
+ name: "\u50CF\u7D20\u65B9\u5757",
106
+ chars: ["\u25A3", "\u25A4", "\u25A5", "\u25A6", "\u25A7", "\u25A8", "\u25A9"],
107
+ color: "#722ed1"
108
+ },
109
+ clock: {
110
+ name: "\u65F6\u949F\u6307\u9488",
111
+ chars: ["\u{1F550}", "\u{1F551}", "\u{1F552}", "\u{1F553}", "\u{1F554}", "\u{1F555}", "\u{1F556}", "\u{1F557}", "\u{1F558}", "\u{1F559}", "\u{1F55A}", "\u{1F55B}"],
112
+ color: "#ffbb96"
113
+ },
114
+ // 音乐风格
115
+ equalizer: {
116
+ name: "\u97F3\u9891\u5747\u8861",
117
+ chars: ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588", "\u2587", "\u2586", "\u2585", "\u2584"],
118
+ color: "#00bcd4"
119
+ },
120
+ waveform: {
121
+ name: "\u6CE2\u5F62\u632F\u8361",
122
+ chars: ["\u223F", "\u25E0", "\u25E1", "\u223F", "\u25E0", "\u25E1"],
123
+ color: "#ff5722"
124
+ },
125
+ // 游戏风格
126
+ dice: {
127
+ name: "\u9AB0\u5B50\u6EDA\u52A8",
128
+ chars: ["\u2680", "\u2681", "\u2682", "\u2683", "\u2684", "\u2685", "\u2680", "\u2681"],
129
+ color: "#607d8b"
130
+ },
131
+ // 动态几何
132
+ bounce: {
133
+ name: "\u5F39\u8DF3\u7403",
134
+ chars: ["\u2801", "\u2803", "\u2807", "\u2847", "\u28C7", "\u28E7", "\u28F7", "\u28FF", "\u28F7", "\u28E7", "\u28C7", "\u2847"],
135
+ color: "#ff6b6b"
136
+ },
137
+ radar: {
138
+ name: "\u96F7\u8FBE\u626B\u63CF",
139
+ chars: ["\u25D0", "\u25D1", "\u25D2", "\u25D3", "\u25D0", "\u25D1", "\u25D2", "\u25D3"],
140
+ color: "#00d4aa"
141
+ },
142
+ // 数字符号
143
+ dots: {
144
+ name: "\u70B9\u9635\u547C\u5438",
145
+ chars: ["\xB7", "\u22EF", "\u22EF\u22EF", "\xB7\xB7\xB7\xB7", "\u22EF\u22EF\u22EF", "\xB7\xB7\xB7\xB7\xB7\xB7", "\u22EF\u22EF\u22EF\u22EF", "\xB7\xB7\xB7\xB7\xB7\xB7\xB7\xB7"],
146
+ color: "#4d96ff"
147
+ },
148
+ // 液体流体
149
+ liquid: {
150
+ name: "\u6DB2\u4F53\u6643\u52A8",
151
+ chars: ["\u223D", "\u223E", "\u223F", "\u223D", "\u223E", "\u223F", "\u2240", "\u223D"],
152
+ color: "#118ab2"
153
+ },
154
+ ripple: {
155
+ name: "\u6C34\u7EB9\u6269\u6563",
156
+ chars: ["\u25CB", "\u25CE", "\u25C9", "\u25CF", "\u25CB", "\u25CE", "\u25C9", "\u25CF"],
157
+ color: "#073b4c"
158
+ },
159
+ bubble: {
160
+ name: "\u6C14\u6CE1\u6D6E\u8D77",
161
+ chars: ["\u2218", "\u25CB", "\u25CC", "\u25CD", "\u25CE", "\u25CF", "\u25CB", "\u2218"],
162
+ color: "#48cae4"
163
+ },
164
+ // 光谱渐变
165
+ gradient: {
166
+ name: "\u6E10\u53D8\u6761",
167
+ chars: ["\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589", "\u2588", "\u2589", "\u258A", "\u258B", "\u258C"],
168
+ color: "#ee82ee"
169
+ },
170
+ spectrum: {
171
+ name: "\u5149\u8C31\u626B\u63CF",
172
+ chars: ["\u2591\u2592\u2593", "\u2592\u2593\u2588", "\u2593\u2588\u2591", "\u2588\u2591\u2592", "\u2591\u2592\u2593", "\u2592\u2593\u2588"],
173
+ color: "#ff69b4"
174
+ },
175
+ // 中国传统
176
+ bagua: {
177
+ name: "\u516B\u5366",
178
+ chars: ["\u2630", "\u2631", "\u2632", "\u2633", "\u2634", "\u2635", "\u2636", "\u2637"],
179
+ color: "#8d6e63"
180
+ },
181
+ // 几何角落
182
+ corners: {
183
+ name: "\u89D2\u843D\u65CB\u8F6C",
184
+ chars: ["\u231C", "\u231D", "\u231F", "\u231E", "\u231C", "\u231D", "\u231F", "\u231E"],
185
+ color: "#80cbc4"
186
+ },
187
+ // 扑克纸牌
188
+ cards: {
189
+ name: "\u7EB8\u724C",
190
+ chars: ["\u{1F0A1}", "\u{1F0A2}", "\u{1F0A3}", "\u{1F0A4}", "\u{1F0A5}", "\u{1F0A6}", "\u{1F0A7}", "\u{1F0A8}"],
191
+ color: "#c62828"
192
+ },
193
+ // 装饰符号
194
+ ornament: {
195
+ name: "\u88C5\u9970\u7B26",
196
+ chars: ["\u2766", "\u2767", "\u2740", "\u273F", "\u2741", "\u2742", "\u2743", "\u2747", "\u2748"],
197
+ color: "#e91e63"
198
+ },
199
+ // 危险警告
200
+ radiation: {
201
+ name: "\u8F90\u5C04\u8B66\u544A",
202
+ chars: ["\u2622", "\u2623", "\u2620", "\u269B", "\u262E", "\u2622", "\u2623", "\u2620"],
203
+ color: "#76ff03"
204
+ }
205
+ };
196
206
  }
197
- };
207
+ });
198
208
 
199
209
  // src/Lumina.ts
200
- var LuminaElement = class extends HTMLElement {
201
- constructor() {
202
- super();
203
- this._index = 0;
204
- this._timer = null;
205
- this._div = null;
206
- this.attachShadow({ mode: "open" });
207
- }
208
- static get observedAttributes() {
209
- return ["type", "speed", "chars", "color"];
210
- }
211
- connectedCallback() {
212
- this.render();
213
- this.startAnimation();
214
- }
215
- disconnectedCallback() {
216
- if (this._timer) {
217
- clearInterval(this._timer);
218
- }
219
- }
220
- attributeChangedCallback(name, oldValue, newValue) {
221
- if (oldValue !== newValue) {
222
- if (name === "speed" && this._timer) {
223
- this.startAnimation();
210
+ var Lumina_exports = {};
211
+ __export(Lumina_exports, {
212
+ default: () => Lumina_default
213
+ });
214
+ var LuminaElement, Lumina_default;
215
+ var init_Lumina = __esm({
216
+ "src/Lumina.ts"() {
217
+ "use strict";
218
+ init_sequence();
219
+ LuminaElement = class extends HTMLElement {
220
+ constructor() {
221
+ super();
222
+ this._index = 0;
223
+ this._timer = null;
224
+ this._div = null;
225
+ this.attachShadow({ mode: "open" });
226
+ }
227
+ static get observedAttributes() {
228
+ return ["type", "speed", "chars", "color"];
224
229
  }
225
- if (name === "type" || name === "chars" || name === "color") {
230
+ connectedCallback() {
226
231
  this.render();
227
232
  this.startAnimation();
228
233
  }
229
- }
230
- }
231
- get type() {
232
- return this.getAttribute("type") || "claude";
233
- }
234
- set type(value) {
235
- this.setAttribute("type", value);
236
- }
237
- get speed() {
238
- const speed = this.getAttribute("speed");
239
- return speed !== null ? parseInt(speed, 10) : 180;
240
- }
241
- set speed(value) {
242
- this.setAttribute("speed", String(value));
243
- }
244
- get chars() {
245
- const charsAttr = this.getAttribute("chars");
246
- if (charsAttr) {
247
- try {
248
- const parsed = JSON.parse(charsAttr);
249
- if (Array.isArray(parsed) && parsed.every((item) => typeof item === "string")) {
250
- return parsed;
234
+ disconnectedCallback() {
235
+ if (this._timer) {
236
+ clearInterval(this._timer);
251
237
  }
252
- } catch {
253
238
  }
254
- }
255
- return null;
256
- }
257
- set chars(value) {
258
- if (value === null) {
259
- this.removeAttribute("chars");
260
- } else {
261
- this.setAttribute("chars", JSON.stringify(value));
262
- }
263
- }
264
- get color() {
265
- return this.getAttribute("color");
266
- }
267
- set color(value) {
268
- if (value === null) {
269
- this.removeAttribute("color");
270
- } else {
271
- this.setAttribute("color", value);
272
- }
273
- }
274
- getChars() {
275
- const customChars = this.chars;
276
- if (customChars) {
277
- return customChars;
278
- }
279
- const config = SEQUENCES[this.type] || SEQUENCES["claude"];
280
- return config.chars;
281
- }
282
- getConfig() {
283
- return SEQUENCES[this.type] || SEQUENCES["claude"];
284
- }
285
- getColor() {
286
- const customColor = this.color;
287
- if (customColor) {
288
- return customColor;
289
- }
290
- const config = this.getConfig();
291
- return config.color;
292
- }
293
- render() {
294
- const chars = this.getChars();
295
- const color = this.getColor();
296
- const currentChar = chars[this._index] || chars[0];
297
- this.shadowRoot.innerHTML = `
239
+ attributeChangedCallback(name, oldValue, newValue) {
240
+ if (oldValue !== newValue) {
241
+ if (name === "speed" && this._timer) {
242
+ this.startAnimation();
243
+ }
244
+ if (name === "type" || name === "chars" || name === "color") {
245
+ this.render();
246
+ this.startAnimation();
247
+ }
248
+ }
249
+ }
250
+ get type() {
251
+ return this.getAttribute("type") || "claude";
252
+ }
253
+ set type(value) {
254
+ this.setAttribute("type", value);
255
+ }
256
+ get speed() {
257
+ const speed = this.getAttribute("speed");
258
+ return speed !== null ? parseInt(speed, 10) : 180;
259
+ }
260
+ set speed(value) {
261
+ this.setAttribute("speed", String(value));
262
+ }
263
+ get chars() {
264
+ const charsAttr = this.getAttribute("chars");
265
+ if (charsAttr) {
266
+ try {
267
+ const parsed = JSON.parse(charsAttr);
268
+ if (Array.isArray(parsed) && parsed.every((item) => typeof item === "string")) {
269
+ return parsed;
270
+ }
271
+ } catch {
272
+ }
273
+ }
274
+ return null;
275
+ }
276
+ set chars(value) {
277
+ if (value === null) {
278
+ this.removeAttribute("chars");
279
+ } else {
280
+ this.setAttribute("chars", JSON.stringify(value));
281
+ }
282
+ }
283
+ get color() {
284
+ return this.getAttribute("color");
285
+ }
286
+ set color(value) {
287
+ if (value === null) {
288
+ this.removeAttribute("color");
289
+ } else {
290
+ this.setAttribute("color", value);
291
+ }
292
+ }
293
+ getChars() {
294
+ const customChars = this.chars;
295
+ if (customChars) {
296
+ return customChars;
297
+ }
298
+ const config = SEQUENCES[this.type] || SEQUENCES["claude"];
299
+ return config.chars;
300
+ }
301
+ getConfig() {
302
+ return SEQUENCES[this.type] || SEQUENCES["claude"];
303
+ }
304
+ getColor() {
305
+ const customColor = this.color;
306
+ if (customColor) {
307
+ return customColor;
308
+ }
309
+ const config = this.getConfig();
310
+ return config.color;
311
+ }
312
+ render() {
313
+ const chars = this.getChars();
314
+ const color = this.getColor();
315
+ const currentChar = chars[this._index] || chars[0];
316
+ this.shadowRoot.innerHTML = `
298
317
  <style>
299
318
  :host {
300
319
  display: inline-block;
@@ -313,28 +332,70 @@ var LuminaElement = class extends HTMLElement {
313
332
  </style>
314
333
  <div class="container">${currentChar}</div>
315
334
  `;
316
- this._div = this.shadowRoot.querySelector(".container");
317
- }
318
- startAnimation() {
319
- if (this._timer) {
320
- clearInterval(this._timer);
321
- }
322
- const chars = this.getChars();
323
- this._timer = setInterval(() => {
324
- this._index = (this._index + 1) % chars.length;
325
- if (this._div) {
326
- this._div.textContent = chars[this._index];
335
+ this._div = this.shadowRoot.querySelector(".container");
327
336
  }
328
- }, this.speed);
337
+ startAnimation() {
338
+ if (this._timer) {
339
+ clearInterval(this._timer);
340
+ }
341
+ const chars = this.getChars();
342
+ this._timer = setInterval(() => {
343
+ this._index = (this._index + 1) % chars.length;
344
+ if (this._div) {
345
+ this._div.textContent = chars[this._index];
346
+ }
347
+ }, this.speed);
348
+ }
349
+ };
350
+ if (typeof customElements !== "undefined" && !customElements.get("lumina-loading")) {
351
+ customElements.define("lumina-loading", LuminaElement);
352
+ }
353
+ Lumina_default = LuminaElement;
329
354
  }
330
- };
331
- if (typeof customElements !== "undefined" && !customElements.get("lumina-loading")) {
332
- customElements.define("lumina-loading", LuminaElement);
355
+ });
356
+
357
+ // src/index.ts
358
+ var index_exports = {};
359
+ __export(index_exports, {
360
+ LuminaLoading: () => LuminaLoading,
361
+ SEQUENCES: () => SEQUENCES
362
+ });
363
+ module.exports = __toCommonJS(index_exports);
364
+
365
+ // src/LuminaLoading.tsx
366
+ var import_react = __toESM(require("react"));
367
+ function LuminaLoading({
368
+ type = "claude",
369
+ speed = 180,
370
+ chars,
371
+ color,
372
+ fallback = null
373
+ }) {
374
+ const [mounted, setMounted] = (0, import_react.useState)(false);
375
+ const ref = (0, import_react.useRef)(null);
376
+ (0, import_react.useEffect)(() => {
377
+ Promise.resolve().then(() => init_Lumina());
378
+ setMounted(true);
379
+ }, []);
380
+ (0, import_react.useEffect)(() => {
381
+ const el = ref.current;
382
+ if (!el) return;
383
+ if (type) el.setAttribute("type", type);
384
+ el.setAttribute("speed", String(speed));
385
+ if (chars) el.setAttribute("chars", JSON.stringify(chars));
386
+ if (color) el.setAttribute("color", color);
387
+ }, [type, speed, chars, color]);
388
+ if (!mounted) {
389
+ return fallback;
390
+ }
391
+ return import_react.default.createElement("lumina-loading", { ref });
333
392
  }
334
- var Lumina_default = LuminaElement;
393
+
394
+ // src/index.ts
395
+ init_sequence();
396
+ init_Lumina();
335
397
  // Annotate the CommonJS export names for ESM import in node:
336
398
  0 && (module.exports = {
337
- Lumina,
338
- LuminaElement,
399
+ LuminaLoading,
339
400
  SEQUENCES
340
401
  });