@novely/dynamic-character 0.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 +113 -0
- package/dist/emotions.d.ts +3 -0
- package/dist/index.css +229 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.jsx +1400 -0
- package/dist/picker.d.ts +4 -0
- package/dist/show.d.ts +4 -0
- package/dist/types.d.ts +120 -0
- package/dist/utils.d.ts +15 -0
- package/license +15 -0
- package/package.json +49 -0
package/dist/index.jsx
ADDED
|
@@ -0,0 +1,1400 @@
|
|
|
1
|
+
// src/utils.ts
|
|
2
|
+
var getEntries = (object) => {
|
|
3
|
+
return Object.entries(object);
|
|
4
|
+
};
|
|
5
|
+
var getKeys = (object) => {
|
|
6
|
+
return Object.keys(object);
|
|
7
|
+
};
|
|
8
|
+
var toArray = (target) => {
|
|
9
|
+
return Array.isArray(target) ? target : [target];
|
|
10
|
+
};
|
|
11
|
+
var permutation = (items, size = items.length) => {
|
|
12
|
+
if (!size) {
|
|
13
|
+
return [[]];
|
|
14
|
+
}
|
|
15
|
+
size = Math.min(items.length, size);
|
|
16
|
+
return items.flatMap((item) => {
|
|
17
|
+
return permutation(
|
|
18
|
+
items.filter((it) => it !== item),
|
|
19
|
+
size - 1
|
|
20
|
+
).map((permutation2) => [item, ...permutation2]);
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var getEmotionString = ({ base, attributes }) => {
|
|
24
|
+
return `${base}@${getEntries(attributes).map(([name, value]) => `${name}_${value}`).join("__")}`;
|
|
25
|
+
};
|
|
26
|
+
var getSavedEmotion = (state, character, clothingData, fallback) => {
|
|
27
|
+
const id = `$$emotion_${character}`;
|
|
28
|
+
const saved = state()[id];
|
|
29
|
+
if (!saved) {
|
|
30
|
+
return fallback;
|
|
31
|
+
}
|
|
32
|
+
const filteredAttributes = Object.keys(saved.attributes).filter((key) => key in fallback.attributes).reduce(
|
|
33
|
+
(acc, key) => {
|
|
34
|
+
acc[key] = saved.attributes[key];
|
|
35
|
+
return acc;
|
|
36
|
+
},
|
|
37
|
+
{}
|
|
38
|
+
);
|
|
39
|
+
const base = clothingData.base.includes(saved.base) ? saved.base : fallback.base;
|
|
40
|
+
return {
|
|
41
|
+
base,
|
|
42
|
+
attributes: {
|
|
43
|
+
...fallback.attributes,
|
|
44
|
+
...filteredAttributes
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
var saveEmotion = (state, character, emotion) => {
|
|
49
|
+
state({ [`$$emotion_${character}`]: emotion });
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/emotions.ts
|
|
53
|
+
var generateEmotions = ({
|
|
54
|
+
base,
|
|
55
|
+
attributes
|
|
56
|
+
}) => {
|
|
57
|
+
const emotions = {};
|
|
58
|
+
const combineBaseWithAttributes = (baseEmotion, baseAssets, currentAttributes, attributesLeft) => {
|
|
59
|
+
if (attributesLeft.length === 0) {
|
|
60
|
+
const key = `${baseEmotion}@${currentAttributes.join("__")}`;
|
|
61
|
+
emotions[key] = baseAssets;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const [attribute, variants] = attributesLeft[0];
|
|
65
|
+
const remainingAttributes = attributesLeft.slice(1);
|
|
66
|
+
for (const [variant, emotions2] of Object.entries(variants)) {
|
|
67
|
+
const attributeAssets = emotions2[baseEmotion];
|
|
68
|
+
combineBaseWithAttributes(
|
|
69
|
+
baseEmotion,
|
|
70
|
+
[...baseAssets, ...toArray(attributeAssets)],
|
|
71
|
+
[...currentAttributes, `${attribute}_${variant}`],
|
|
72
|
+
remainingAttributes
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
for (const [baseEmotion, baseAssets] of getEntries(base)) {
|
|
77
|
+
for (const _permutation of permutation(getEntries(attributes))) {
|
|
78
|
+
combineBaseWithAttributes(baseEmotion, toArray(baseAssets), [], _permutation);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const clothingData = {
|
|
82
|
+
base: getKeys(base),
|
|
83
|
+
attributes: Object.fromEntries(getEntries(attributes).map(([name, value]) => [name, getKeys(value)]))
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
emotions,
|
|
87
|
+
clothingData
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// ../../node_modules/.pnpm/solid-js@1.9.3/node_modules/solid-js/dist/solid.js
|
|
92
|
+
var sharedConfig = {
|
|
93
|
+
context: void 0,
|
|
94
|
+
registry: void 0,
|
|
95
|
+
effects: void 0,
|
|
96
|
+
done: false,
|
|
97
|
+
getContextId() {
|
|
98
|
+
return getContextId(this.context.count);
|
|
99
|
+
},
|
|
100
|
+
getNextContextId() {
|
|
101
|
+
return getContextId(this.context.count++);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
function getContextId(count) {
|
|
105
|
+
const num = String(count), len = num.length - 1;
|
|
106
|
+
return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
|
|
107
|
+
}
|
|
108
|
+
function setHydrateContext(context) {
|
|
109
|
+
sharedConfig.context = context;
|
|
110
|
+
}
|
|
111
|
+
function nextHydrateContext() {
|
|
112
|
+
return {
|
|
113
|
+
...sharedConfig.context,
|
|
114
|
+
id: sharedConfig.getNextContextId(),
|
|
115
|
+
count: 0
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
var equalFn = (a, b) => a === b;
|
|
119
|
+
var $PROXY = Symbol("solid-proxy");
|
|
120
|
+
var $TRACK = Symbol("solid-track");
|
|
121
|
+
var $DEVCOMP = Symbol("solid-dev-component");
|
|
122
|
+
var signalOptions = {
|
|
123
|
+
equals: equalFn
|
|
124
|
+
};
|
|
125
|
+
var ERROR = null;
|
|
126
|
+
var runEffects = runQueue;
|
|
127
|
+
var STALE = 1;
|
|
128
|
+
var PENDING = 2;
|
|
129
|
+
var UNOWNED = {
|
|
130
|
+
owned: null,
|
|
131
|
+
cleanups: null,
|
|
132
|
+
context: null,
|
|
133
|
+
owner: null
|
|
134
|
+
};
|
|
135
|
+
var Owner = null;
|
|
136
|
+
var Transition = null;
|
|
137
|
+
var Scheduler = null;
|
|
138
|
+
var ExternalSourceConfig = null;
|
|
139
|
+
var Listener = null;
|
|
140
|
+
var Updates = null;
|
|
141
|
+
var Effects = null;
|
|
142
|
+
var ExecCount = 0;
|
|
143
|
+
function createRoot(fn, detachedOwner) {
|
|
144
|
+
const listener = Listener, owner = Owner, unowned = fn.length === 0, current = detachedOwner === void 0 ? owner : detachedOwner, root = unowned ? UNOWNED : {
|
|
145
|
+
owned: null,
|
|
146
|
+
cleanups: null,
|
|
147
|
+
context: current ? current.context : null,
|
|
148
|
+
owner: current
|
|
149
|
+
}, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
150
|
+
Owner = root;
|
|
151
|
+
Listener = null;
|
|
152
|
+
try {
|
|
153
|
+
return runUpdates(updateFn, true);
|
|
154
|
+
} finally {
|
|
155
|
+
Listener = listener;
|
|
156
|
+
Owner = owner;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function createSignal(value, options) {
|
|
160
|
+
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
161
|
+
const s = {
|
|
162
|
+
value,
|
|
163
|
+
observers: null,
|
|
164
|
+
observerSlots: null,
|
|
165
|
+
comparator: options.equals || void 0
|
|
166
|
+
};
|
|
167
|
+
const setter = (value2) => {
|
|
168
|
+
if (typeof value2 === "function") {
|
|
169
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value2 = value2(s.tValue);
|
|
170
|
+
else value2 = value2(s.value);
|
|
171
|
+
}
|
|
172
|
+
return writeSignal(s, value2);
|
|
173
|
+
};
|
|
174
|
+
return [readSignal.bind(s), setter];
|
|
175
|
+
}
|
|
176
|
+
function createRenderEffect(fn, value, options) {
|
|
177
|
+
const c = createComputation(fn, value, false, STALE);
|
|
178
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
179
|
+
else updateComputation(c);
|
|
180
|
+
}
|
|
181
|
+
function createEffect(fn, value, options) {
|
|
182
|
+
runEffects = runUserEffects;
|
|
183
|
+
const c = createComputation(fn, value, false, STALE), s = SuspenseContext && useContext(SuspenseContext);
|
|
184
|
+
if (s) c.suspense = s;
|
|
185
|
+
if (!options || !options.render) c.user = true;
|
|
186
|
+
Effects ? Effects.push(c) : updateComputation(c);
|
|
187
|
+
}
|
|
188
|
+
function createMemo(fn, value, options) {
|
|
189
|
+
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
190
|
+
const c = createComputation(fn, value, true, 0);
|
|
191
|
+
c.observers = null;
|
|
192
|
+
c.observerSlots = null;
|
|
193
|
+
c.comparator = options.equals || void 0;
|
|
194
|
+
if (Scheduler && Transition && Transition.running) {
|
|
195
|
+
c.tState = STALE;
|
|
196
|
+
Updates.push(c);
|
|
197
|
+
} else updateComputation(c);
|
|
198
|
+
return readSignal.bind(c);
|
|
199
|
+
}
|
|
200
|
+
function untrack(fn) {
|
|
201
|
+
if (!ExternalSourceConfig && Listener === null) return fn();
|
|
202
|
+
const listener = Listener;
|
|
203
|
+
Listener = null;
|
|
204
|
+
try {
|
|
205
|
+
if (ExternalSourceConfig) return ExternalSourceConfig.untrack(fn);
|
|
206
|
+
return fn();
|
|
207
|
+
} finally {
|
|
208
|
+
Listener = listener;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function onCleanup(fn) {
|
|
212
|
+
if (Owner === null) ;
|
|
213
|
+
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
214
|
+
else Owner.cleanups.push(fn);
|
|
215
|
+
return fn;
|
|
216
|
+
}
|
|
217
|
+
function startTransition(fn) {
|
|
218
|
+
if (Transition && Transition.running) {
|
|
219
|
+
fn();
|
|
220
|
+
return Transition.done;
|
|
221
|
+
}
|
|
222
|
+
const l = Listener;
|
|
223
|
+
const o = Owner;
|
|
224
|
+
return Promise.resolve().then(() => {
|
|
225
|
+
Listener = l;
|
|
226
|
+
Owner = o;
|
|
227
|
+
let t;
|
|
228
|
+
if (Scheduler || SuspenseContext) {
|
|
229
|
+
t = Transition || (Transition = {
|
|
230
|
+
sources: /* @__PURE__ */ new Set(),
|
|
231
|
+
effects: [],
|
|
232
|
+
promises: /* @__PURE__ */ new Set(),
|
|
233
|
+
disposed: /* @__PURE__ */ new Set(),
|
|
234
|
+
queue: /* @__PURE__ */ new Set(),
|
|
235
|
+
running: true
|
|
236
|
+
});
|
|
237
|
+
t.done || (t.done = new Promise((res) => t.resolve = res));
|
|
238
|
+
t.running = true;
|
|
239
|
+
}
|
|
240
|
+
runUpdates(fn, false);
|
|
241
|
+
Listener = Owner = null;
|
|
242
|
+
return t ? t.done : void 0;
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
246
|
+
function useContext(context) {
|
|
247
|
+
let value;
|
|
248
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== void 0 ? value : context.defaultValue;
|
|
249
|
+
}
|
|
250
|
+
var SuspenseContext;
|
|
251
|
+
function readSignal() {
|
|
252
|
+
const runningTransition = Transition && Transition.running;
|
|
253
|
+
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
254
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
255
|
+
else {
|
|
256
|
+
const updates = Updates;
|
|
257
|
+
Updates = null;
|
|
258
|
+
runUpdates(() => lookUpstream(this), false);
|
|
259
|
+
Updates = updates;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (Listener) {
|
|
263
|
+
const sSlot = this.observers ? this.observers.length : 0;
|
|
264
|
+
if (!Listener.sources) {
|
|
265
|
+
Listener.sources = [this];
|
|
266
|
+
Listener.sourceSlots = [sSlot];
|
|
267
|
+
} else {
|
|
268
|
+
Listener.sources.push(this);
|
|
269
|
+
Listener.sourceSlots.push(sSlot);
|
|
270
|
+
}
|
|
271
|
+
if (!this.observers) {
|
|
272
|
+
this.observers = [Listener];
|
|
273
|
+
this.observerSlots = [Listener.sources.length - 1];
|
|
274
|
+
} else {
|
|
275
|
+
this.observers.push(Listener);
|
|
276
|
+
this.observerSlots.push(Listener.sources.length - 1);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (runningTransition && Transition.sources.has(this)) return this.tValue;
|
|
280
|
+
return this.value;
|
|
281
|
+
}
|
|
282
|
+
function writeSignal(node, value, isComp) {
|
|
283
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
284
|
+
if (!node.comparator || !node.comparator(current, value)) {
|
|
285
|
+
if (Transition) {
|
|
286
|
+
const TransitionRunning = Transition.running;
|
|
287
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
288
|
+
Transition.sources.add(node);
|
|
289
|
+
node.tValue = value;
|
|
290
|
+
}
|
|
291
|
+
if (!TransitionRunning) node.value = value;
|
|
292
|
+
} else node.value = value;
|
|
293
|
+
if (node.observers && node.observers.length) {
|
|
294
|
+
runUpdates(() => {
|
|
295
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
296
|
+
const o = node.observers[i];
|
|
297
|
+
const TransitionRunning = Transition && Transition.running;
|
|
298
|
+
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
299
|
+
if (TransitionRunning ? !o.tState : !o.state) {
|
|
300
|
+
if (o.pure) Updates.push(o);
|
|
301
|
+
else Effects.push(o);
|
|
302
|
+
if (o.observers) markDownstream(o);
|
|
303
|
+
}
|
|
304
|
+
if (!TransitionRunning) o.state = STALE;
|
|
305
|
+
else o.tState = STALE;
|
|
306
|
+
}
|
|
307
|
+
if (Updates.length > 1e6) {
|
|
308
|
+
Updates = [];
|
|
309
|
+
if (false) ;
|
|
310
|
+
throw new Error();
|
|
311
|
+
}
|
|
312
|
+
}, false);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return value;
|
|
316
|
+
}
|
|
317
|
+
function updateComputation(node) {
|
|
318
|
+
if (!node.fn) return;
|
|
319
|
+
cleanNode(node);
|
|
320
|
+
const time = ExecCount;
|
|
321
|
+
runComputation(
|
|
322
|
+
node,
|
|
323
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
324
|
+
time
|
|
325
|
+
);
|
|
326
|
+
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
327
|
+
queueMicrotask(() => {
|
|
328
|
+
runUpdates(() => {
|
|
329
|
+
Transition && (Transition.running = true);
|
|
330
|
+
Listener = Owner = node;
|
|
331
|
+
runComputation(node, node.tValue, time);
|
|
332
|
+
Listener = Owner = null;
|
|
333
|
+
}, false);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
function runComputation(node, value, time) {
|
|
338
|
+
let nextValue;
|
|
339
|
+
const owner = Owner, listener = Listener;
|
|
340
|
+
Listener = Owner = node;
|
|
341
|
+
try {
|
|
342
|
+
nextValue = node.fn(value);
|
|
343
|
+
} catch (err) {
|
|
344
|
+
if (node.pure) {
|
|
345
|
+
if (Transition && Transition.running) {
|
|
346
|
+
node.tState = STALE;
|
|
347
|
+
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
348
|
+
node.tOwned = void 0;
|
|
349
|
+
} else {
|
|
350
|
+
node.state = STALE;
|
|
351
|
+
node.owned && node.owned.forEach(cleanNode);
|
|
352
|
+
node.owned = null;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
node.updatedAt = time + 1;
|
|
356
|
+
return handleError(err);
|
|
357
|
+
} finally {
|
|
358
|
+
Listener = listener;
|
|
359
|
+
Owner = owner;
|
|
360
|
+
}
|
|
361
|
+
if (!node.updatedAt || node.updatedAt <= time) {
|
|
362
|
+
if (node.updatedAt != null && "observers" in node) {
|
|
363
|
+
writeSignal(node, nextValue, true);
|
|
364
|
+
} else if (Transition && Transition.running && node.pure) {
|
|
365
|
+
Transition.sources.add(node);
|
|
366
|
+
node.tValue = nextValue;
|
|
367
|
+
} else node.value = nextValue;
|
|
368
|
+
node.updatedAt = time;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
function createComputation(fn, init, pure, state = STALE, options) {
|
|
372
|
+
const c = {
|
|
373
|
+
fn,
|
|
374
|
+
state,
|
|
375
|
+
updatedAt: null,
|
|
376
|
+
owned: null,
|
|
377
|
+
sources: null,
|
|
378
|
+
sourceSlots: null,
|
|
379
|
+
cleanups: null,
|
|
380
|
+
value: init,
|
|
381
|
+
owner: Owner,
|
|
382
|
+
context: Owner ? Owner.context : null,
|
|
383
|
+
pure
|
|
384
|
+
};
|
|
385
|
+
if (Transition && Transition.running) {
|
|
386
|
+
c.state = 0;
|
|
387
|
+
c.tState = state;
|
|
388
|
+
}
|
|
389
|
+
if (Owner === null) ;
|
|
390
|
+
else if (Owner !== UNOWNED) {
|
|
391
|
+
if (Transition && Transition.running && Owner.pure) {
|
|
392
|
+
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
393
|
+
else Owner.tOwned.push(c);
|
|
394
|
+
} else {
|
|
395
|
+
if (!Owner.owned) Owner.owned = [c];
|
|
396
|
+
else Owner.owned.push(c);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (ExternalSourceConfig && c.fn) {
|
|
400
|
+
const [track, trigger] = createSignal(void 0, {
|
|
401
|
+
equals: false
|
|
402
|
+
});
|
|
403
|
+
const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
|
|
404
|
+
onCleanup(() => ordinary.dispose());
|
|
405
|
+
const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
|
|
406
|
+
const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
|
|
407
|
+
c.fn = (x) => {
|
|
408
|
+
track();
|
|
409
|
+
return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
return c;
|
|
413
|
+
}
|
|
414
|
+
function runTop(node) {
|
|
415
|
+
const runningTransition = Transition && Transition.running;
|
|
416
|
+
if ((runningTransition ? node.tState : node.state) === 0) return;
|
|
417
|
+
if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
|
|
418
|
+
if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
|
|
419
|
+
const ancestors = [node];
|
|
420
|
+
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
421
|
+
if (runningTransition && Transition.disposed.has(node)) return;
|
|
422
|
+
if (runningTransition ? node.tState : node.state) ancestors.push(node);
|
|
423
|
+
}
|
|
424
|
+
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
425
|
+
node = ancestors[i];
|
|
426
|
+
if (runningTransition) {
|
|
427
|
+
let top = node, prev = ancestors[i + 1];
|
|
428
|
+
while ((top = top.owner) && top !== prev) {
|
|
429
|
+
if (Transition.disposed.has(top)) return;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
if ((runningTransition ? node.tState : node.state) === STALE) {
|
|
433
|
+
updateComputation(node);
|
|
434
|
+
} else if ((runningTransition ? node.tState : node.state) === PENDING) {
|
|
435
|
+
const updates = Updates;
|
|
436
|
+
Updates = null;
|
|
437
|
+
runUpdates(() => lookUpstream(node, ancestors[0]), false);
|
|
438
|
+
Updates = updates;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
function runUpdates(fn, init) {
|
|
443
|
+
if (Updates) return fn();
|
|
444
|
+
let wait = false;
|
|
445
|
+
if (!init) Updates = [];
|
|
446
|
+
if (Effects) wait = true;
|
|
447
|
+
else Effects = [];
|
|
448
|
+
ExecCount++;
|
|
449
|
+
try {
|
|
450
|
+
const res = fn();
|
|
451
|
+
completeUpdates(wait);
|
|
452
|
+
return res;
|
|
453
|
+
} catch (err) {
|
|
454
|
+
if (!wait) Effects = null;
|
|
455
|
+
Updates = null;
|
|
456
|
+
handleError(err);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
function completeUpdates(wait) {
|
|
460
|
+
if (Updates) {
|
|
461
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
462
|
+
else runQueue(Updates);
|
|
463
|
+
Updates = null;
|
|
464
|
+
}
|
|
465
|
+
if (wait) return;
|
|
466
|
+
let res;
|
|
467
|
+
if (Transition) {
|
|
468
|
+
if (!Transition.promises.size && !Transition.queue.size) {
|
|
469
|
+
const sources = Transition.sources;
|
|
470
|
+
const disposed = Transition.disposed;
|
|
471
|
+
Effects.push.apply(Effects, Transition.effects);
|
|
472
|
+
res = Transition.resolve;
|
|
473
|
+
for (const e2 of Effects) {
|
|
474
|
+
"tState" in e2 && (e2.state = e2.tState);
|
|
475
|
+
delete e2.tState;
|
|
476
|
+
}
|
|
477
|
+
Transition = null;
|
|
478
|
+
runUpdates(() => {
|
|
479
|
+
for (const d of disposed) cleanNode(d);
|
|
480
|
+
for (const v of sources) {
|
|
481
|
+
v.value = v.tValue;
|
|
482
|
+
if (v.owned) {
|
|
483
|
+
for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
|
|
484
|
+
}
|
|
485
|
+
if (v.tOwned) v.owned = v.tOwned;
|
|
486
|
+
delete v.tValue;
|
|
487
|
+
delete v.tOwned;
|
|
488
|
+
v.tState = 0;
|
|
489
|
+
}
|
|
490
|
+
setTransPending(false);
|
|
491
|
+
}, false);
|
|
492
|
+
} else if (Transition.running) {
|
|
493
|
+
Transition.running = false;
|
|
494
|
+
Transition.effects.push.apply(Transition.effects, Effects);
|
|
495
|
+
Effects = null;
|
|
496
|
+
setTransPending(true);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
const e = Effects;
|
|
501
|
+
Effects = null;
|
|
502
|
+
if (e.length) runUpdates(() => runEffects(e), false);
|
|
503
|
+
if (res) res();
|
|
504
|
+
}
|
|
505
|
+
function runQueue(queue) {
|
|
506
|
+
for (let i = 0; i < queue.length; i++) runTop(queue[i]);
|
|
507
|
+
}
|
|
508
|
+
function scheduleQueue(queue) {
|
|
509
|
+
for (let i = 0; i < queue.length; i++) {
|
|
510
|
+
const item = queue[i];
|
|
511
|
+
const tasks = Transition.queue;
|
|
512
|
+
if (!tasks.has(item)) {
|
|
513
|
+
tasks.add(item);
|
|
514
|
+
Scheduler(() => {
|
|
515
|
+
tasks.delete(item);
|
|
516
|
+
runUpdates(() => {
|
|
517
|
+
Transition.running = true;
|
|
518
|
+
runTop(item);
|
|
519
|
+
}, false);
|
|
520
|
+
Transition && (Transition.running = false);
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
function runUserEffects(queue) {
|
|
526
|
+
let i, userLength = 0;
|
|
527
|
+
for (i = 0; i < queue.length; i++) {
|
|
528
|
+
const e = queue[i];
|
|
529
|
+
if (!e.user) runTop(e);
|
|
530
|
+
else queue[userLength++] = e;
|
|
531
|
+
}
|
|
532
|
+
if (sharedConfig.context) {
|
|
533
|
+
if (sharedConfig.count) {
|
|
534
|
+
sharedConfig.effects || (sharedConfig.effects = []);
|
|
535
|
+
sharedConfig.effects.push(...queue.slice(0, userLength));
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
setHydrateContext();
|
|
539
|
+
}
|
|
540
|
+
if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
|
|
541
|
+
queue = [...sharedConfig.effects, ...queue];
|
|
542
|
+
userLength += sharedConfig.effects.length;
|
|
543
|
+
delete sharedConfig.effects;
|
|
544
|
+
}
|
|
545
|
+
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
546
|
+
}
|
|
547
|
+
function lookUpstream(node, ignore) {
|
|
548
|
+
const runningTransition = Transition && Transition.running;
|
|
549
|
+
if (runningTransition) node.tState = 0;
|
|
550
|
+
else node.state = 0;
|
|
551
|
+
for (let i = 0; i < node.sources.length; i += 1) {
|
|
552
|
+
const source = node.sources[i];
|
|
553
|
+
if (source.sources) {
|
|
554
|
+
const state = runningTransition ? source.tState : source.state;
|
|
555
|
+
if (state === STALE) {
|
|
556
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
557
|
+
runTop(source);
|
|
558
|
+
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
function markDownstream(node) {
|
|
563
|
+
const runningTransition = Transition && Transition.running;
|
|
564
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
565
|
+
const o = node.observers[i];
|
|
566
|
+
if (runningTransition ? !o.tState : !o.state) {
|
|
567
|
+
if (runningTransition) o.tState = PENDING;
|
|
568
|
+
else o.state = PENDING;
|
|
569
|
+
if (o.pure) Updates.push(o);
|
|
570
|
+
else Effects.push(o);
|
|
571
|
+
o.observers && markDownstream(o);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
function cleanNode(node) {
|
|
576
|
+
let i;
|
|
577
|
+
if (node.sources) {
|
|
578
|
+
while (node.sources.length) {
|
|
579
|
+
const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
|
|
580
|
+
if (obs && obs.length) {
|
|
581
|
+
const n = obs.pop(), s = source.observerSlots.pop();
|
|
582
|
+
if (index < obs.length) {
|
|
583
|
+
n.sourceSlots[s] = index;
|
|
584
|
+
obs[index] = n;
|
|
585
|
+
source.observerSlots[index] = s;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
if (node.tOwned) {
|
|
591
|
+
for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
|
|
592
|
+
delete node.tOwned;
|
|
593
|
+
}
|
|
594
|
+
if (Transition && Transition.running && node.pure) {
|
|
595
|
+
reset(node, true);
|
|
596
|
+
} else if (node.owned) {
|
|
597
|
+
for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
|
|
598
|
+
node.owned = null;
|
|
599
|
+
}
|
|
600
|
+
if (node.cleanups) {
|
|
601
|
+
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
602
|
+
node.cleanups = null;
|
|
603
|
+
}
|
|
604
|
+
if (Transition && Transition.running) node.tState = 0;
|
|
605
|
+
else node.state = 0;
|
|
606
|
+
}
|
|
607
|
+
function reset(node, top) {
|
|
608
|
+
if (!top) {
|
|
609
|
+
node.tState = 0;
|
|
610
|
+
Transition.disposed.add(node);
|
|
611
|
+
}
|
|
612
|
+
if (node.owned) {
|
|
613
|
+
for (let i = 0; i < node.owned.length; i++) reset(node.owned[i]);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
function castError(err) {
|
|
617
|
+
if (err instanceof Error) return err;
|
|
618
|
+
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
619
|
+
cause: err
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
function runErrors(err, fns, owner) {
|
|
623
|
+
try {
|
|
624
|
+
for (const f of fns) f(err);
|
|
625
|
+
} catch (e) {
|
|
626
|
+
handleError(e, owner && owner.owner || null);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
function handleError(err, owner = Owner) {
|
|
630
|
+
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
631
|
+
const error = castError(err);
|
|
632
|
+
if (!fns) throw error;
|
|
633
|
+
if (Effects)
|
|
634
|
+
Effects.push({
|
|
635
|
+
fn() {
|
|
636
|
+
runErrors(error, fns, owner);
|
|
637
|
+
},
|
|
638
|
+
state: STALE
|
|
639
|
+
});
|
|
640
|
+
else runErrors(error, fns, owner);
|
|
641
|
+
}
|
|
642
|
+
var FALLBACK = Symbol("fallback");
|
|
643
|
+
function dispose(d) {
|
|
644
|
+
for (let i = 0; i < d.length; i++) d[i]();
|
|
645
|
+
}
|
|
646
|
+
function mapArray(list, mapFn, options = {}) {
|
|
647
|
+
let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null;
|
|
648
|
+
onCleanup(() => dispose(disposers));
|
|
649
|
+
return () => {
|
|
650
|
+
let newItems = list() || [], newLen = newItems.length, i, j;
|
|
651
|
+
newItems[$TRACK];
|
|
652
|
+
return untrack(() => {
|
|
653
|
+
let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
|
|
654
|
+
if (newLen === 0) {
|
|
655
|
+
if (len !== 0) {
|
|
656
|
+
dispose(disposers);
|
|
657
|
+
disposers = [];
|
|
658
|
+
items = [];
|
|
659
|
+
mapped = [];
|
|
660
|
+
len = 0;
|
|
661
|
+
indexes && (indexes = []);
|
|
662
|
+
}
|
|
663
|
+
if (options.fallback) {
|
|
664
|
+
items = [FALLBACK];
|
|
665
|
+
mapped[0] = createRoot((disposer) => {
|
|
666
|
+
disposers[0] = disposer;
|
|
667
|
+
return options.fallback();
|
|
668
|
+
});
|
|
669
|
+
len = 1;
|
|
670
|
+
}
|
|
671
|
+
} else if (len === 0) {
|
|
672
|
+
mapped = new Array(newLen);
|
|
673
|
+
for (j = 0; j < newLen; j++) {
|
|
674
|
+
items[j] = newItems[j];
|
|
675
|
+
mapped[j] = createRoot(mapper);
|
|
676
|
+
}
|
|
677
|
+
len = newLen;
|
|
678
|
+
} else {
|
|
679
|
+
temp = new Array(newLen);
|
|
680
|
+
tempdisposers = new Array(newLen);
|
|
681
|
+
indexes && (tempIndexes = new Array(newLen));
|
|
682
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++) ;
|
|
683
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
684
|
+
temp[newEnd] = mapped[end];
|
|
685
|
+
tempdisposers[newEnd] = disposers[end];
|
|
686
|
+
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
687
|
+
}
|
|
688
|
+
newIndices = /* @__PURE__ */ new Map();
|
|
689
|
+
newIndicesNext = new Array(newEnd + 1);
|
|
690
|
+
for (j = newEnd; j >= start; j--) {
|
|
691
|
+
item = newItems[j];
|
|
692
|
+
i = newIndices.get(item);
|
|
693
|
+
newIndicesNext[j] = i === void 0 ? -1 : i;
|
|
694
|
+
newIndices.set(item, j);
|
|
695
|
+
}
|
|
696
|
+
for (i = start; i <= end; i++) {
|
|
697
|
+
item = items[i];
|
|
698
|
+
j = newIndices.get(item);
|
|
699
|
+
if (j !== void 0 && j !== -1) {
|
|
700
|
+
temp[j] = mapped[i];
|
|
701
|
+
tempdisposers[j] = disposers[i];
|
|
702
|
+
indexes && (tempIndexes[j] = indexes[i]);
|
|
703
|
+
j = newIndicesNext[j];
|
|
704
|
+
newIndices.set(item, j);
|
|
705
|
+
} else disposers[i]();
|
|
706
|
+
}
|
|
707
|
+
for (j = start; j < newLen; j++) {
|
|
708
|
+
if (j in temp) {
|
|
709
|
+
mapped[j] = temp[j];
|
|
710
|
+
disposers[j] = tempdisposers[j];
|
|
711
|
+
if (indexes) {
|
|
712
|
+
indexes[j] = tempIndexes[j];
|
|
713
|
+
indexes[j](j);
|
|
714
|
+
}
|
|
715
|
+
} else mapped[j] = createRoot(mapper);
|
|
716
|
+
}
|
|
717
|
+
mapped = mapped.slice(0, len = newLen);
|
|
718
|
+
items = newItems.slice(0);
|
|
719
|
+
}
|
|
720
|
+
return mapped;
|
|
721
|
+
});
|
|
722
|
+
function mapper(disposer) {
|
|
723
|
+
disposers[j] = disposer;
|
|
724
|
+
if (indexes) {
|
|
725
|
+
const [s, set] = createSignal(j);
|
|
726
|
+
indexes[j] = set;
|
|
727
|
+
return mapFn(newItems[j], s);
|
|
728
|
+
}
|
|
729
|
+
return mapFn(newItems[j]);
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
var hydrationEnabled = false;
|
|
734
|
+
function createComponent(Comp, props) {
|
|
735
|
+
if (hydrationEnabled) {
|
|
736
|
+
if (sharedConfig.context) {
|
|
737
|
+
const c = sharedConfig.context;
|
|
738
|
+
setHydrateContext(nextHydrateContext());
|
|
739
|
+
const r = untrack(() => Comp(props || {}));
|
|
740
|
+
setHydrateContext(c);
|
|
741
|
+
return r;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return untrack(() => Comp(props || {}));
|
|
745
|
+
}
|
|
746
|
+
var counter = 0;
|
|
747
|
+
function createUniqueId() {
|
|
748
|
+
const ctx = sharedConfig.context;
|
|
749
|
+
return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
|
|
750
|
+
}
|
|
751
|
+
function For(props) {
|
|
752
|
+
const fallback = "fallback" in props && {
|
|
753
|
+
fallback: () => props.fallback
|
|
754
|
+
};
|
|
755
|
+
return createMemo(mapArray(() => props.each, props.children, fallback || void 0));
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// ../../node_modules/.pnpm/solid-js@1.9.3/node_modules/solid-js/web/dist/web.js
|
|
759
|
+
var booleans = [
|
|
760
|
+
"allowfullscreen",
|
|
761
|
+
"async",
|
|
762
|
+
"autofocus",
|
|
763
|
+
"autoplay",
|
|
764
|
+
"checked",
|
|
765
|
+
"controls",
|
|
766
|
+
"default",
|
|
767
|
+
"disabled",
|
|
768
|
+
"formnovalidate",
|
|
769
|
+
"hidden",
|
|
770
|
+
"indeterminate",
|
|
771
|
+
"inert",
|
|
772
|
+
"ismap",
|
|
773
|
+
"loop",
|
|
774
|
+
"multiple",
|
|
775
|
+
"muted",
|
|
776
|
+
"nomodule",
|
|
777
|
+
"novalidate",
|
|
778
|
+
"open",
|
|
779
|
+
"playsinline",
|
|
780
|
+
"readonly",
|
|
781
|
+
"required",
|
|
782
|
+
"reversed",
|
|
783
|
+
"seamless",
|
|
784
|
+
"selected"
|
|
785
|
+
];
|
|
786
|
+
var Properties = /* @__PURE__ */ new Set([
|
|
787
|
+
"className",
|
|
788
|
+
"value",
|
|
789
|
+
"readOnly",
|
|
790
|
+
"formNoValidate",
|
|
791
|
+
"isMap",
|
|
792
|
+
"noModule",
|
|
793
|
+
"playsInline",
|
|
794
|
+
...booleans
|
|
795
|
+
]);
|
|
796
|
+
function reconcileArrays(parentNode, a, b) {
|
|
797
|
+
let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
|
|
798
|
+
while (aStart < aEnd || bStart < bEnd) {
|
|
799
|
+
if (a[aStart] === b[bStart]) {
|
|
800
|
+
aStart++;
|
|
801
|
+
bStart++;
|
|
802
|
+
continue;
|
|
803
|
+
}
|
|
804
|
+
while (a[aEnd - 1] === b[bEnd - 1]) {
|
|
805
|
+
aEnd--;
|
|
806
|
+
bEnd--;
|
|
807
|
+
}
|
|
808
|
+
if (aEnd === aStart) {
|
|
809
|
+
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
810
|
+
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
811
|
+
} else if (bEnd === bStart) {
|
|
812
|
+
while (aStart < aEnd) {
|
|
813
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
814
|
+
aStart++;
|
|
815
|
+
}
|
|
816
|
+
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
817
|
+
const node = a[--aEnd].nextSibling;
|
|
818
|
+
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
|
|
819
|
+
parentNode.insertBefore(b[--bEnd], node);
|
|
820
|
+
a[aEnd] = b[bEnd];
|
|
821
|
+
} else {
|
|
822
|
+
if (!map) {
|
|
823
|
+
map = /* @__PURE__ */ new Map();
|
|
824
|
+
let i = bStart;
|
|
825
|
+
while (i < bEnd) map.set(b[i], i++);
|
|
826
|
+
}
|
|
827
|
+
const index = map.get(a[aStart]);
|
|
828
|
+
if (index != null) {
|
|
829
|
+
if (bStart < index && index < bEnd) {
|
|
830
|
+
let i = aStart, sequence = 1, t;
|
|
831
|
+
while (++i < aEnd && i < bEnd) {
|
|
832
|
+
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
833
|
+
sequence++;
|
|
834
|
+
}
|
|
835
|
+
if (sequence > index - bStart) {
|
|
836
|
+
const node = a[aStart];
|
|
837
|
+
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
838
|
+
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
839
|
+
} else aStart++;
|
|
840
|
+
} else a[aStart++].remove();
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
var $$EVENTS = "_$DX_DELEGATE";
|
|
845
|
+
function render(code, element, init, options = {}) {
|
|
846
|
+
let disposer;
|
|
847
|
+
createRoot((dispose2) => {
|
|
848
|
+
disposer = dispose2;
|
|
849
|
+
element === document ? code() : insert(element, code(), element.firstChild ? null : void 0, init);
|
|
850
|
+
}, options.owner);
|
|
851
|
+
return () => {
|
|
852
|
+
disposer();
|
|
853
|
+
element.textContent = "";
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
function template(html, isImportNode, isSVG) {
|
|
857
|
+
let node;
|
|
858
|
+
const create = () => {
|
|
859
|
+
const t = document.createElement("template");
|
|
860
|
+
t.innerHTML = html;
|
|
861
|
+
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
862
|
+
};
|
|
863
|
+
const fn = isImportNode ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
|
|
864
|
+
fn.cloneNode = fn;
|
|
865
|
+
return fn;
|
|
866
|
+
}
|
|
867
|
+
function delegateEvents(eventNames, document2 = window.document) {
|
|
868
|
+
const e = document2[$$EVENTS] || (document2[$$EVENTS] = /* @__PURE__ */ new Set());
|
|
869
|
+
for (let i = 0, l = eventNames.length; i < l; i++) {
|
|
870
|
+
const name = eventNames[i];
|
|
871
|
+
if (!e.has(name)) {
|
|
872
|
+
e.add(name);
|
|
873
|
+
document2.addEventListener(name, eventHandler);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
function setAttribute(node, name, value) {
|
|
878
|
+
if (isHydrating(node)) return;
|
|
879
|
+
if (value == null) node.removeAttribute(name);
|
|
880
|
+
else node.setAttribute(name, value);
|
|
881
|
+
}
|
|
882
|
+
function use(fn, element, arg) {
|
|
883
|
+
return untrack(() => fn(element, arg));
|
|
884
|
+
}
|
|
885
|
+
function insert(parent, accessor, marker, initial) {
|
|
886
|
+
if (marker !== void 0 && !initial) initial = [];
|
|
887
|
+
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
888
|
+
createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
|
|
889
|
+
}
|
|
890
|
+
function isHydrating(node) {
|
|
891
|
+
return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
|
|
892
|
+
}
|
|
893
|
+
function eventHandler(e) {
|
|
894
|
+
if (sharedConfig.registry && sharedConfig.events) {
|
|
895
|
+
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
896
|
+
}
|
|
897
|
+
let node = e.target;
|
|
898
|
+
const key = `$$${e.type}`;
|
|
899
|
+
const oriTarget = e.target;
|
|
900
|
+
const oriCurrentTarget = e.currentTarget;
|
|
901
|
+
const retarget = (value) => Object.defineProperty(e, "target", {
|
|
902
|
+
configurable: true,
|
|
903
|
+
value
|
|
904
|
+
});
|
|
905
|
+
const handleNode = () => {
|
|
906
|
+
const handler = node[key];
|
|
907
|
+
if (handler && !node.disabled) {
|
|
908
|
+
const data = node[`${key}Data`];
|
|
909
|
+
data !== void 0 ? handler.call(node, data, e) : handler.call(node, e);
|
|
910
|
+
if (e.cancelBubble) return;
|
|
911
|
+
}
|
|
912
|
+
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
913
|
+
return true;
|
|
914
|
+
};
|
|
915
|
+
const walkUpTree = () => {
|
|
916
|
+
while (handleNode() && (node = node._$host || node.parentNode || node.host)) ;
|
|
917
|
+
};
|
|
918
|
+
Object.defineProperty(e, "currentTarget", {
|
|
919
|
+
configurable: true,
|
|
920
|
+
get() {
|
|
921
|
+
return node || document;
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
|
|
925
|
+
if (e.composedPath) {
|
|
926
|
+
const path = e.composedPath();
|
|
927
|
+
retarget(path[0]);
|
|
928
|
+
for (let i = 0; i < path.length - 2; i++) {
|
|
929
|
+
node = path[i];
|
|
930
|
+
if (!handleNode()) break;
|
|
931
|
+
if (node._$host) {
|
|
932
|
+
node = node._$host;
|
|
933
|
+
walkUpTree();
|
|
934
|
+
break;
|
|
935
|
+
}
|
|
936
|
+
if (node.parentNode === oriCurrentTarget) {
|
|
937
|
+
break;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
} else walkUpTree();
|
|
941
|
+
retarget(oriTarget);
|
|
942
|
+
}
|
|
943
|
+
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
944
|
+
const hydrating = isHydrating(parent);
|
|
945
|
+
if (hydrating) {
|
|
946
|
+
!current && (current = [...parent.childNodes]);
|
|
947
|
+
let cleaned = [];
|
|
948
|
+
for (let i = 0; i < current.length; i++) {
|
|
949
|
+
const node = current[i];
|
|
950
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
951
|
+
else cleaned.push(node);
|
|
952
|
+
}
|
|
953
|
+
current = cleaned;
|
|
954
|
+
}
|
|
955
|
+
while (typeof current === "function") current = current();
|
|
956
|
+
if (value === current) return current;
|
|
957
|
+
const t = typeof value, multi = marker !== void 0;
|
|
958
|
+
parent = multi && current[0] && current[0].parentNode || parent;
|
|
959
|
+
if (t === "string" || t === "number") {
|
|
960
|
+
if (hydrating) return current;
|
|
961
|
+
if (t === "number") {
|
|
962
|
+
value = value.toString();
|
|
963
|
+
if (value === current) return current;
|
|
964
|
+
}
|
|
965
|
+
if (multi) {
|
|
966
|
+
let node = current[0];
|
|
967
|
+
if (node && node.nodeType === 3) {
|
|
968
|
+
node.data !== value && (node.data = value);
|
|
969
|
+
} else node = document.createTextNode(value);
|
|
970
|
+
current = cleanChildren(parent, current, marker, node);
|
|
971
|
+
} else {
|
|
972
|
+
if (current !== "" && typeof current === "string") {
|
|
973
|
+
current = parent.firstChild.data = value;
|
|
974
|
+
} else current = parent.textContent = value;
|
|
975
|
+
}
|
|
976
|
+
} else if (value == null || t === "boolean") {
|
|
977
|
+
if (hydrating) return current;
|
|
978
|
+
current = cleanChildren(parent, current, marker);
|
|
979
|
+
} else if (t === "function") {
|
|
980
|
+
createRenderEffect(() => {
|
|
981
|
+
let v = value();
|
|
982
|
+
while (typeof v === "function") v = v();
|
|
983
|
+
current = insertExpression(parent, v, current, marker);
|
|
984
|
+
});
|
|
985
|
+
return () => current;
|
|
986
|
+
} else if (Array.isArray(value)) {
|
|
987
|
+
const array = [];
|
|
988
|
+
const currentArray = current && Array.isArray(current);
|
|
989
|
+
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
990
|
+
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
991
|
+
return () => current;
|
|
992
|
+
}
|
|
993
|
+
if (hydrating) {
|
|
994
|
+
if (!array.length) return current;
|
|
995
|
+
if (marker === void 0) return current = [...parent.childNodes];
|
|
996
|
+
let node = array[0];
|
|
997
|
+
if (node.parentNode !== parent) return current;
|
|
998
|
+
const nodes = [node];
|
|
999
|
+
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
1000
|
+
return current = nodes;
|
|
1001
|
+
}
|
|
1002
|
+
if (array.length === 0) {
|
|
1003
|
+
current = cleanChildren(parent, current, marker);
|
|
1004
|
+
if (multi) return current;
|
|
1005
|
+
} else if (currentArray) {
|
|
1006
|
+
if (current.length === 0) {
|
|
1007
|
+
appendNodes(parent, array, marker);
|
|
1008
|
+
} else reconcileArrays(parent, current, array);
|
|
1009
|
+
} else {
|
|
1010
|
+
current && cleanChildren(parent);
|
|
1011
|
+
appendNodes(parent, array);
|
|
1012
|
+
}
|
|
1013
|
+
current = array;
|
|
1014
|
+
} else if (value.nodeType) {
|
|
1015
|
+
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
1016
|
+
if (Array.isArray(current)) {
|
|
1017
|
+
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
1018
|
+
cleanChildren(parent, current, null, value);
|
|
1019
|
+
} else if (current == null || current === "" || !parent.firstChild) {
|
|
1020
|
+
parent.appendChild(value);
|
|
1021
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
1022
|
+
current = value;
|
|
1023
|
+
} else ;
|
|
1024
|
+
return current;
|
|
1025
|
+
}
|
|
1026
|
+
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
1027
|
+
let dynamic = false;
|
|
1028
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
1029
|
+
let item = array[i], prev = current && current[normalized.length], t;
|
|
1030
|
+
if (item == null || item === true || item === false) ;
|
|
1031
|
+
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
1032
|
+
normalized.push(item);
|
|
1033
|
+
} else if (Array.isArray(item)) {
|
|
1034
|
+
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
1035
|
+
} else if (t === "function") {
|
|
1036
|
+
if (unwrap) {
|
|
1037
|
+
while (typeof item === "function") item = item();
|
|
1038
|
+
dynamic = normalizeIncomingArray(
|
|
1039
|
+
normalized,
|
|
1040
|
+
Array.isArray(item) ? item : [item],
|
|
1041
|
+
Array.isArray(prev) ? prev : [prev]
|
|
1042
|
+
) || dynamic;
|
|
1043
|
+
} else {
|
|
1044
|
+
normalized.push(item);
|
|
1045
|
+
dynamic = true;
|
|
1046
|
+
}
|
|
1047
|
+
} else {
|
|
1048
|
+
const value = String(item);
|
|
1049
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
1050
|
+
else normalized.push(document.createTextNode(value));
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
return dynamic;
|
|
1054
|
+
}
|
|
1055
|
+
function appendNodes(parent, array, marker = null) {
|
|
1056
|
+
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
1057
|
+
}
|
|
1058
|
+
function cleanChildren(parent, current, marker, replacement) {
|
|
1059
|
+
if (marker === void 0) return parent.textContent = "";
|
|
1060
|
+
const node = replacement || document.createTextNode("");
|
|
1061
|
+
if (current.length) {
|
|
1062
|
+
let inserted = false;
|
|
1063
|
+
for (let i = current.length - 1; i >= 0; i--) {
|
|
1064
|
+
const el = current[i];
|
|
1065
|
+
if (node !== el) {
|
|
1066
|
+
const isParent = el.parentNode === parent;
|
|
1067
|
+
if (!inserted && !i)
|
|
1068
|
+
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
1069
|
+
else isParent && el.remove();
|
|
1070
|
+
} else inserted = true;
|
|
1071
|
+
}
|
|
1072
|
+
} else parent.insertBefore(node, marker);
|
|
1073
|
+
return [node];
|
|
1074
|
+
}
|
|
1075
|
+
var RequestContext = Symbol();
|
|
1076
|
+
|
|
1077
|
+
// src/picker.tsx
|
|
1078
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div class="ndc-picker-root"><button type="button" class="ndc-collapse-button"><svg data-icon fill="#fefefe" width="3rem" height="3rem" viewBox="0 0 256 256"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"></path></svg></button><div role="tablist" class="ndc-tablist">`);
|
|
1079
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<button role="tab" class="ndc-tab-button">`);
|
|
1080
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<div role="tabpanel" tabindex="0"><div role="region" class="ndc-slider"><div role="group" class="ndc-controls"><button type="button" class="ndc-button-nav ndc-button-nav-prev"><svg data-icon fill="currentColor" viewBox="0 0 256 256"><path d="M165.66 202.34a8 8 0 0 1-11.32 11.32l-80-80a8 8 0 0 1 0-11.32l80-80a8 8 0 0 1 11.32 11.32L91.31 128Z"></path></svg></button><button type="button" class="ndc-button-nav ndc-button-nav-next"><svg data-icon fill="currentColor" viewBox="0 0 256 256"><path d="m181.66 133.66-80 80a8 8 0 0 1-11.32-11.32L164.69 128 90.34 53.66a8 8 0 0 1 11.32-11.32l80 80a8 8 0 0 1 0 11.32Z"></path></svg></button></div><div class="ndc-slides" aria-live="polite">`);
|
|
1081
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<div role="group" class="ndc-slide"><p class="ndc-variant-name"></p><div class="ndc-control-buttons"><button type="button" class="button"></button><button type="button" class="button">`);
|
|
1082
|
+
var CHARACTER_STYLE_PICKER = Symbol();
|
|
1083
|
+
var getTabs = ({
|
|
1084
|
+
base,
|
|
1085
|
+
attributes,
|
|
1086
|
+
excludeAttributes
|
|
1087
|
+
}) => {
|
|
1088
|
+
const tabs = [];
|
|
1089
|
+
if (base.length >= 2) {
|
|
1090
|
+
tabs.push({
|
|
1091
|
+
type: "base",
|
|
1092
|
+
value: "",
|
|
1093
|
+
tab: createUniqueId(),
|
|
1094
|
+
panel: createUniqueId()
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
const attributesKeys = excludeAttributes ? getKeys(attributes).filter((name) => excludeAttributes.includes(name)) : getKeys(attributes);
|
|
1098
|
+
const attributesTabs = attributesKeys.map((name) => {
|
|
1099
|
+
return {
|
|
1100
|
+
type: "attribute",
|
|
1101
|
+
value: name,
|
|
1102
|
+
tab: createUniqueId(),
|
|
1103
|
+
panel: createUniqueId()
|
|
1104
|
+
};
|
|
1105
|
+
});
|
|
1106
|
+
tabs.push(...attributesTabs);
|
|
1107
|
+
return tabs;
|
|
1108
|
+
};
|
|
1109
|
+
var showPicker = function() {
|
|
1110
|
+
const {
|
|
1111
|
+
clothingData,
|
|
1112
|
+
options: {
|
|
1113
|
+
character: characterId,
|
|
1114
|
+
defaultAttributes,
|
|
1115
|
+
defaultBase,
|
|
1116
|
+
excludeAttributes,
|
|
1117
|
+
translation: translations
|
|
1118
|
+
}
|
|
1119
|
+
} = this;
|
|
1120
|
+
const {
|
|
1121
|
+
base,
|
|
1122
|
+
attributes
|
|
1123
|
+
} = clothingData;
|
|
1124
|
+
const handler = ({
|
|
1125
|
+
clear,
|
|
1126
|
+
flags,
|
|
1127
|
+
getDomNodes,
|
|
1128
|
+
rendererContext,
|
|
1129
|
+
lang,
|
|
1130
|
+
state
|
|
1131
|
+
}) => {
|
|
1132
|
+
const translation = translations[lang];
|
|
1133
|
+
const initialEmotion = getSavedEmotion(state, characterId, clothingData, {
|
|
1134
|
+
base: defaultBase,
|
|
1135
|
+
attributes: defaultAttributes
|
|
1136
|
+
});
|
|
1137
|
+
const {
|
|
1138
|
+
promise,
|
|
1139
|
+
resolve
|
|
1140
|
+
} = Promise.withResolvers();
|
|
1141
|
+
const {
|
|
1142
|
+
element
|
|
1143
|
+
} = getDomNodes(true);
|
|
1144
|
+
const character = rendererContext.character(characterId);
|
|
1145
|
+
character.emotion(getEmotionString(initialEmotion), true);
|
|
1146
|
+
character.append();
|
|
1147
|
+
const Picker = () => {
|
|
1148
|
+
const tabs = getTabs({
|
|
1149
|
+
attributes,
|
|
1150
|
+
base,
|
|
1151
|
+
excludeAttributes
|
|
1152
|
+
});
|
|
1153
|
+
const [activeTab, setActiveTab] = createSignal(0);
|
|
1154
|
+
const [tabElements, setTabElements] = createSignal([]);
|
|
1155
|
+
const [expanded, setExpanded] = createSignal(!flags.preview);
|
|
1156
|
+
const [appearance, setAppearance] = createSignal(initialEmotion);
|
|
1157
|
+
createEffect(() => {
|
|
1158
|
+
character.emotion(getEmotionString(appearance()), true);
|
|
1159
|
+
saveEmotion(state, characterId, appearance());
|
|
1160
|
+
});
|
|
1161
|
+
return (() => {
|
|
1162
|
+
const _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
|
|
1163
|
+
_el$2.$$click = () => {
|
|
1164
|
+
setExpanded((value) => !value);
|
|
1165
|
+
};
|
|
1166
|
+
insert(_el$4, createComponent(For, {
|
|
1167
|
+
each: tabs,
|
|
1168
|
+
children: (tab, i) => (() => {
|
|
1169
|
+
const _el$5 = _tmpl$2();
|
|
1170
|
+
use((element2) => {
|
|
1171
|
+
setTabElements((elements) => {
|
|
1172
|
+
elements[i()] = element2;
|
|
1173
|
+
return elements;
|
|
1174
|
+
});
|
|
1175
|
+
}, _el$5);
|
|
1176
|
+
_el$5.$$keydown = (event) => {
|
|
1177
|
+
const change = event.key === "ArrowLeft" ? -1 : event.key === "ArrowRight" ? 1 : 0;
|
|
1178
|
+
if (change === 0) {
|
|
1179
|
+
return;
|
|
1180
|
+
}
|
|
1181
|
+
event.stopPropagation();
|
|
1182
|
+
event.preventDefault();
|
|
1183
|
+
const nextTab = activeTab() + change;
|
|
1184
|
+
if (nextTab < 0) {
|
|
1185
|
+
setActiveTab(tabs.length - 1);
|
|
1186
|
+
} else if (nextTab > tabs.length - 1) {
|
|
1187
|
+
setActiveTab(0);
|
|
1188
|
+
} else {
|
|
1189
|
+
setActiveTab(nextTab);
|
|
1190
|
+
}
|
|
1191
|
+
const activeTabElement = tabElements()[activeTab()];
|
|
1192
|
+
if (activeTabElement) {
|
|
1193
|
+
activeTabElement.focus();
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
_el$5.$$click = () => {
|
|
1197
|
+
setActiveTab(i());
|
|
1198
|
+
};
|
|
1199
|
+
insert(_el$5, () => tab.type === "attribute" ? translation.tabs.attributes[tab.value] : translation.tabs.base);
|
|
1200
|
+
createRenderEffect((_p$) => {
|
|
1201
|
+
const _v$5 = tab.tab, _v$6 = tab.panel, _v$7 = i() === activeTab(), _v$8 = i() === activeTab() ? void 0 : -1;
|
|
1202
|
+
_v$5 !== _p$._v$5 && setAttribute(_el$5, "id", _p$._v$5 = _v$5);
|
|
1203
|
+
_v$6 !== _p$._v$6 && setAttribute(_el$5, "aria-controls", _p$._v$6 = _v$6);
|
|
1204
|
+
_v$7 !== _p$._v$7 && setAttribute(_el$5, "aria-selected", _p$._v$7 = _v$7);
|
|
1205
|
+
_v$8 !== _p$._v$8 && setAttribute(_el$5, "tabindex", _p$._v$8 = _v$8);
|
|
1206
|
+
return _p$;
|
|
1207
|
+
}, {
|
|
1208
|
+
_v$5: void 0,
|
|
1209
|
+
_v$6: void 0,
|
|
1210
|
+
_v$7: void 0,
|
|
1211
|
+
_v$8: void 0
|
|
1212
|
+
});
|
|
1213
|
+
return _el$5;
|
|
1214
|
+
})()
|
|
1215
|
+
}));
|
|
1216
|
+
insert(_el$, createComponent(For, {
|
|
1217
|
+
each: tabs,
|
|
1218
|
+
children: (tab, i) => {
|
|
1219
|
+
const variants = tab.type === "attribute" ? attributes[tab.value] : base;
|
|
1220
|
+
const translationGroup = tab.type === "attribute" ? translation.attributes[tab.value] : translation.base;
|
|
1221
|
+
const initialSlideIndex = (() => {
|
|
1222
|
+
const currentAppearance = untrack(appearance);
|
|
1223
|
+
if (tab.type === "base") {
|
|
1224
|
+
return base.indexOf(currentAppearance.base);
|
|
1225
|
+
}
|
|
1226
|
+
return variants.indexOf(currentAppearance.attributes[tab.value]);
|
|
1227
|
+
})();
|
|
1228
|
+
const [currentSlide, setCurrentSlide] = createSignal(initialSlideIndex);
|
|
1229
|
+
createEffect(() => {
|
|
1230
|
+
if (activeTab() !== i()) {
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
const currentAppearance = untrack(appearance);
|
|
1234
|
+
const currentVariant = variants[currentSlide()];
|
|
1235
|
+
if (tab.type === "base") {
|
|
1236
|
+
const emotion = getEmotionString({
|
|
1237
|
+
base: currentVariant,
|
|
1238
|
+
attributes: currentAppearance.attributes
|
|
1239
|
+
});
|
|
1240
|
+
character.emotion(emotion, false);
|
|
1241
|
+
} else {
|
|
1242
|
+
const emotion = getEmotionString({
|
|
1243
|
+
base: currentAppearance.base,
|
|
1244
|
+
attributes: {
|
|
1245
|
+
...currentAppearance.attributes,
|
|
1246
|
+
[tab.value]: currentVariant
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
character.emotion(emotion, false);
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
return (() => {
|
|
1253
|
+
const _el$6 = _tmpl$3(), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$8.firstChild, _el$10 = _el$9.nextSibling, _el$11 = _el$8.nextSibling;
|
|
1254
|
+
_el$7.$$keydown = (event) => {
|
|
1255
|
+
if (event.key === "ArrowLeft") {
|
|
1256
|
+
setCurrentSlide((value) => value > 0 ? value - 1 : variants.length - 1);
|
|
1257
|
+
} else if (event.key === "ArrowRight") {
|
|
1258
|
+
setCurrentSlide((value) => value < variants.length - 1 ? value + 1 : 0);
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
_el$9.$$click = () => {
|
|
1262
|
+
setCurrentSlide((slide) => {
|
|
1263
|
+
if (slide > 0) {
|
|
1264
|
+
return slide - 1;
|
|
1265
|
+
}
|
|
1266
|
+
return variants.length - 1;
|
|
1267
|
+
});
|
|
1268
|
+
};
|
|
1269
|
+
_el$10.$$click = () => {
|
|
1270
|
+
setCurrentSlide((slide) => {
|
|
1271
|
+
if (slide < variants.length - 1) {
|
|
1272
|
+
return slide + 1;
|
|
1273
|
+
}
|
|
1274
|
+
return 0;
|
|
1275
|
+
});
|
|
1276
|
+
};
|
|
1277
|
+
insert(_el$11, createComponent(For, {
|
|
1278
|
+
each: variants,
|
|
1279
|
+
children: (variant, i2) => {
|
|
1280
|
+
const titleId = createUniqueId();
|
|
1281
|
+
return (() => {
|
|
1282
|
+
const _el$12 = _tmpl$4(), _el$13 = _el$12.firstChild, _el$14 = _el$13.nextSibling, _el$15 = _el$14.firstChild, _el$16 = _el$15.nextSibling;
|
|
1283
|
+
setAttribute(_el$12, "aria-labelledby", titleId);
|
|
1284
|
+
setAttribute(_el$13, "id", titleId);
|
|
1285
|
+
insert(_el$13, () => translationGroup[variant]);
|
|
1286
|
+
_el$15.$$click = () => {
|
|
1287
|
+
setAppearance((object) => {
|
|
1288
|
+
if (tab.type === "attribute") {
|
|
1289
|
+
return {
|
|
1290
|
+
...object,
|
|
1291
|
+
attributes: {
|
|
1292
|
+
...object.attributes,
|
|
1293
|
+
[tab.value]: variant
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
return {
|
|
1298
|
+
...object,
|
|
1299
|
+
base: variant
|
|
1300
|
+
};
|
|
1301
|
+
});
|
|
1302
|
+
};
|
|
1303
|
+
insert(_el$15, () => translation.ui.apply);
|
|
1304
|
+
_el$16.$$click = () => {
|
|
1305
|
+
resolve();
|
|
1306
|
+
};
|
|
1307
|
+
insert(_el$16, () => translation.ui.sumbit);
|
|
1308
|
+
createRenderEffect(() => _el$12.classList.toggle("ndc-slide-active", !!(i2() == currentSlide())));
|
|
1309
|
+
return _el$12;
|
|
1310
|
+
})();
|
|
1311
|
+
}
|
|
1312
|
+
}));
|
|
1313
|
+
createRenderEffect((_p$) => {
|
|
1314
|
+
const _v$9 = tab.tab, _v$10 = tab.panel, _v$11 = !!(activeTab() !== i()), _v$12 = translation.ui.variants, _v$13 = !expanded(), _v$14 = translation.ui.slidesControl, _v$15 = translation.ui.prevSlide, _v$16 = translation.ui.nextSlide;
|
|
1315
|
+
_v$9 !== _p$._v$9 && setAttribute(_el$6, "aria-labelledby", _p$._v$9 = _v$9);
|
|
1316
|
+
_v$10 !== _p$._v$10 && setAttribute(_el$6, "id", _p$._v$10 = _v$10);
|
|
1317
|
+
_v$11 !== _p$._v$11 && _el$6.classList.toggle("ndc-tabpanel-hidden", _p$._v$11 = _v$11);
|
|
1318
|
+
_v$12 !== _p$._v$12 && setAttribute(_el$7, "aria-label", _p$._v$12 = _v$12);
|
|
1319
|
+
_v$13 !== _p$._v$13 && _el$7.classList.toggle("ndc-slider-picker-collapsed", _p$._v$13 = _v$13);
|
|
1320
|
+
_v$14 !== _p$._v$14 && setAttribute(_el$8, "aria-label", _p$._v$14 = _v$14);
|
|
1321
|
+
_v$15 !== _p$._v$15 && setAttribute(_el$9, "aria-label", _p$._v$15 = _v$15);
|
|
1322
|
+
_v$16 !== _p$._v$16 && setAttribute(_el$10, "aria-label", _p$._v$16 = _v$16);
|
|
1323
|
+
return _p$;
|
|
1324
|
+
}, {
|
|
1325
|
+
_v$9: void 0,
|
|
1326
|
+
_v$10: void 0,
|
|
1327
|
+
_v$11: void 0,
|
|
1328
|
+
_v$12: void 0,
|
|
1329
|
+
_v$13: void 0,
|
|
1330
|
+
_v$14: void 0,
|
|
1331
|
+
_v$15: void 0,
|
|
1332
|
+
_v$16: void 0
|
|
1333
|
+
});
|
|
1334
|
+
return _el$6;
|
|
1335
|
+
})();
|
|
1336
|
+
}
|
|
1337
|
+
}), null);
|
|
1338
|
+
createRenderEffect((_p$) => {
|
|
1339
|
+
const _v$ = !expanded(), _v$2 = !expanded(), _v$3 = translation.ui.tablist, _v$4 = !expanded();
|
|
1340
|
+
_v$ !== _p$._v$ && _el$.classList.toggle("ndc-picker-root-collapsed", _p$._v$ = _v$);
|
|
1341
|
+
_v$2 !== _p$._v$2 && _el$3.classList.toggle("ndc-collapse-button-icon-collapsed", _p$._v$2 = _v$2);
|
|
1342
|
+
_v$3 !== _p$._v$3 && setAttribute(_el$4, "aria-label", _p$._v$3 = _v$3);
|
|
1343
|
+
_v$4 !== _p$._v$4 && _el$4.classList.toggle("ndc-tablist-picker-collapsed", _p$._v$4 = _v$4);
|
|
1344
|
+
return _p$;
|
|
1345
|
+
}, {
|
|
1346
|
+
_v$: void 0,
|
|
1347
|
+
_v$2: void 0,
|
|
1348
|
+
_v$3: void 0,
|
|
1349
|
+
_v$4: void 0
|
|
1350
|
+
});
|
|
1351
|
+
return _el$;
|
|
1352
|
+
})();
|
|
1353
|
+
};
|
|
1354
|
+
const cleanup = render(() => createComponent(Picker, {}), element);
|
|
1355
|
+
clear(() => cleanup());
|
|
1356
|
+
promise.then(() => cleanup());
|
|
1357
|
+
return promise;
|
|
1358
|
+
};
|
|
1359
|
+
handler.id = CHARACTER_STYLE_PICKER;
|
|
1360
|
+
handler.key = `show-picker--${characterId}`;
|
|
1361
|
+
handler.callOnlyLatest = true;
|
|
1362
|
+
handler.requireUserAction = true;
|
|
1363
|
+
return handler;
|
|
1364
|
+
};
|
|
1365
|
+
delegateEvents(["click", "keydown"]);
|
|
1366
|
+
|
|
1367
|
+
// src/show.ts
|
|
1368
|
+
var SHOW_CHARACTER = Symbol();
|
|
1369
|
+
var showCharacter = function() {
|
|
1370
|
+
const handler = ({ rendererContext, state }) => {
|
|
1371
|
+
const emotion = getSavedEmotion(state, this.options.character, this.clothingData, {
|
|
1372
|
+
base: this.options.defaultBase,
|
|
1373
|
+
attributes: this.options.defaultAttributes
|
|
1374
|
+
});
|
|
1375
|
+
const emotionString = getEmotionString(emotion);
|
|
1376
|
+
const character = rendererContext.character(this.options.character);
|
|
1377
|
+
character.emotion(emotionString, true);
|
|
1378
|
+
character.append();
|
|
1379
|
+
};
|
|
1380
|
+
handler.id = SHOW_CHARACTER;
|
|
1381
|
+
handler.key = `dynamic-show-character--${this.options.character}`;
|
|
1382
|
+
handler.callOnlyLatest = true;
|
|
1383
|
+
return handler;
|
|
1384
|
+
};
|
|
1385
|
+
|
|
1386
|
+
// src/index.ts
|
|
1387
|
+
var createDynamicCharacter = (_, clothingData, options) => {
|
|
1388
|
+
const that = {
|
|
1389
|
+
clothingData,
|
|
1390
|
+
options
|
|
1391
|
+
};
|
|
1392
|
+
return {
|
|
1393
|
+
showPicker: showPicker.bind(that),
|
|
1394
|
+
showCharacter: showCharacter.bind(that)
|
|
1395
|
+
};
|
|
1396
|
+
};
|
|
1397
|
+
export {
|
|
1398
|
+
createDynamicCharacter,
|
|
1399
|
+
generateEmotions
|
|
1400
|
+
};
|