@radishon/lumina 1.0.9 → 1.1.0
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/README.md +28 -0
- package/dist/Lumina-UMNW6GSY.mjs +6 -0
- package/dist/chunk-QRENGH6F.mjs +311 -0
- package/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +348 -284
- package/dist/index.mjs +32 -304
- package/package.json +12 -4
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
-
|
|
230
|
+
connectedCallback() {
|
|
226
231
|
this.render();
|
|
227
232
|
this.startAnimation();
|
|
228
233
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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,73 @@ var LuminaElement = class extends HTMLElement {
|
|
|
313
332
|
</style>
|
|
314
333
|
<div class="container">${currentChar}</div>
|
|
315
334
|
`;
|
|
316
|
-
|
|
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
|
-
|
|
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
|
-
|
|
332
|
-
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
// src/index.ts
|
|
358
|
+
var index_exports = {};
|
|
359
|
+
__export(index_exports, {
|
|
360
|
+
Lumina: () => Lumina_default,
|
|
361
|
+
LuminaElement: () => Lumina_default,
|
|
362
|
+
LuminaLoading: () => LuminaLoading,
|
|
363
|
+
SEQUENCES: () => SEQUENCES
|
|
364
|
+
});
|
|
365
|
+
module.exports = __toCommonJS(index_exports);
|
|
366
|
+
init_Lumina();
|
|
367
|
+
init_sequence();
|
|
368
|
+
init_Lumina();
|
|
369
|
+
|
|
370
|
+
// src/LuminaLoading.tsx
|
|
371
|
+
var import_react = __toESM(require("react"));
|
|
372
|
+
function LuminaLoading({
|
|
373
|
+
type = "claude",
|
|
374
|
+
speed = 180,
|
|
375
|
+
chars,
|
|
376
|
+
color,
|
|
377
|
+
fallback = null
|
|
378
|
+
}) {
|
|
379
|
+
const [mounted, setMounted] = (0, import_react.useState)(false);
|
|
380
|
+
const ref = (0, import_react.useRef)(null);
|
|
381
|
+
(0, import_react.useEffect)(() => {
|
|
382
|
+
Promise.resolve().then(() => init_Lumina());
|
|
383
|
+
setMounted(true);
|
|
384
|
+
}, []);
|
|
385
|
+
(0, import_react.useEffect)(() => {
|
|
386
|
+
const el = ref.current;
|
|
387
|
+
if (!el) return;
|
|
388
|
+
if (type) el.setAttribute("type", type);
|
|
389
|
+
el.setAttribute("speed", String(speed));
|
|
390
|
+
if (chars) el.setAttribute("chars", JSON.stringify(chars));
|
|
391
|
+
if (color) el.setAttribute("color", color);
|
|
392
|
+
}, [type, speed, chars, color]);
|
|
393
|
+
if (!mounted) {
|
|
394
|
+
return fallback;
|
|
395
|
+
}
|
|
396
|
+
return import_react.default.createElement("lumina-loading", { ref });
|
|
333
397
|
}
|
|
334
|
-
var Lumina_default = LuminaElement;
|
|
335
398
|
// Annotate the CommonJS export names for ESM import in node:
|
|
336
399
|
0 && (module.exports = {
|
|
337
400
|
Lumina,
|
|
338
401
|
LuminaElement,
|
|
402
|
+
LuminaLoading,
|
|
339
403
|
SEQUENCES
|
|
340
404
|
});
|