@novely/dynamic-character 0.4.0 → 0.5.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/dist/actions.d.ts +2 -2
- package/dist/index.jsx +28 -28
- package/dist/types.d.ts +7 -7
- package/package.json +6 -6
package/dist/actions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EngineInstance, Attributes, ClothingData, AllOptions, ShowPickerOptionsAttribute, ShowPickerOptionsBase,
|
|
2
|
-
declare const createActions: (this: ClothingData<string, Attributes>, engine: EngineInstance, options: AllOptions<
|
|
1
|
+
import type { EngineInstance, Attributes, ClothingData, AllOptions, ShowPickerOptionsAttribute, ShowPickerOptionsBase, DefaultEngineTypes } from './types';
|
|
2
|
+
declare const createActions: (this: ClothingData<string, Attributes>, engine: EngineInstance, options: AllOptions<DefaultEngineTypes, string, Attributes>) => {
|
|
3
3
|
showBasePicker: (options?: ShowPickerOptionsBase) => import("@novely/core").ValidAction;
|
|
4
4
|
showAttributePicker: (options: ShowPickerOptionsAttribute<Attributes>) => import("@novely/core").ValidAction;
|
|
5
5
|
showCharacter: () => import("@novely/core").ValidAction;
|
package/dist/index.jsx
CHANGED
|
@@ -79,8 +79,8 @@ import { effect as _$effect } from "solid-js/web";
|
|
|
79
79
|
import { insert as _$insert } from "solid-js/web";
|
|
80
80
|
import { createComponent as _$createComponent } from "solid-js/web";
|
|
81
81
|
import { createSignal, createEffect, untrack, createSelector, For } from "solid-js";
|
|
82
|
-
var _tmpl$ = /* @__PURE__ */ _$template(`<div role=
|
|
83
|
-
var _tmpl$2 = /* @__PURE__ */ _$template(`<div role=
|
|
82
|
+
var _tmpl$ = /* @__PURE__ */ _$template(`<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>`);
|
|
83
|
+
var _tmpl$2 = /* @__PURE__ */ _$template(`<div role=group class=ndc-slide>`);
|
|
84
84
|
var Slider = (props) => {
|
|
85
85
|
const [currentSlide, setCurrentSlide] = createSignal(props.initialSlideIndex);
|
|
86
86
|
const isSelected = createSelector(currentSlide);
|
|
@@ -89,7 +89,7 @@ var Slider = (props) => {
|
|
|
89
89
|
untrack(() => props.onIndexChange(currentIndex));
|
|
90
90
|
});
|
|
91
91
|
return (() => {
|
|
92
|
-
|
|
92
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$2.nextSibling;
|
|
93
93
|
_el$.$$keydown = (event) => {
|
|
94
94
|
if (event.key === "ArrowLeft") {
|
|
95
95
|
setCurrentSlide((value) => value > 0 ? value - 1 : props.slides.length - 1);
|
|
@@ -119,7 +119,7 @@ var Slider = (props) => {
|
|
|
119
119
|
},
|
|
120
120
|
children: (variant, i) => {
|
|
121
121
|
return (() => {
|
|
122
|
-
|
|
122
|
+
var _el$6 = _tmpl$2();
|
|
123
123
|
_$insert(_el$6, () => props.children(variant, i));
|
|
124
124
|
_$effect(() => _el$6.classList.toggle("ndc-slide-active", !!isSelected(i())));
|
|
125
125
|
return _el$6;
|
|
@@ -127,19 +127,19 @@ var Slider = (props) => {
|
|
|
127
127
|
}
|
|
128
128
|
}));
|
|
129
129
|
_$effect((_p$) => {
|
|
130
|
-
|
|
131
|
-
_v$ !== _p$.
|
|
132
|
-
_v$2 !== _p$.
|
|
133
|
-
_v$3 !== _p$.
|
|
134
|
-
_v$4 !== _p$.
|
|
135
|
-
_v$5 !== _p$.
|
|
130
|
+
var _v$ = props.translation.ui.variants, _v$2 = !props.expanded, _v$3 = props.translation.ui.slidesControl, _v$4 = props.translation.ui.prevSlide, _v$5 = props.translation.ui.nextSlide;
|
|
131
|
+
_v$ !== _p$.e && _$setAttribute(_el$, "aria-label", _p$.e = _v$);
|
|
132
|
+
_v$2 !== _p$.t && _el$.classList.toggle("ndc-slider-picker-collapsed", _p$.t = _v$2);
|
|
133
|
+
_v$3 !== _p$.a && _$setAttribute(_el$2, "aria-label", _p$.a = _v$3);
|
|
134
|
+
_v$4 !== _p$.o && _$setAttribute(_el$3, "aria-label", _p$.o = _v$4);
|
|
135
|
+
_v$5 !== _p$.i && _$setAttribute(_el$4, "aria-label", _p$.i = _v$5);
|
|
136
136
|
return _p$;
|
|
137
137
|
}, {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
e: void 0,
|
|
139
|
+
t: void 0,
|
|
140
|
+
a: void 0,
|
|
141
|
+
o: void 0,
|
|
142
|
+
i: void 0
|
|
143
143
|
});
|
|
144
144
|
return _el$;
|
|
145
145
|
})();
|
|
@@ -148,16 +148,16 @@ _$delegateEvents(["keydown", "click"]);
|
|
|
148
148
|
|
|
149
149
|
// src/components/Picker.tsx
|
|
150
150
|
import pLimit from "p-limit";
|
|
151
|
-
var _tmpl$3 = /* @__PURE__ */ _$template2(`<div class=
|
|
152
|
-
var _tmpl$22 = /* @__PURE__ */ _$template2(`<p class=
|
|
153
|
-
var _tmpl$32 = /* @__PURE__ */ _$template2(`<div class=
|
|
151
|
+
var _tmpl$3 = /* @__PURE__ */ _$template2(`<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 class=ndc-heading>`);
|
|
152
|
+
var _tmpl$22 = /* @__PURE__ */ _$template2(`<p class=ndc-variant-name>`);
|
|
153
|
+
var _tmpl$32 = /* @__PURE__ */ _$template2(`<div class=ndc-control-buttons><button type=button class=button>`);
|
|
154
154
|
var limitClick = pLimit(1);
|
|
155
155
|
var Picker = (props) => {
|
|
156
156
|
const [expanded, setExpanded] = createSignal2(props.initialExpanded);
|
|
157
157
|
const [appearance, setAppearance] = createSignal2(props.initialEmotion);
|
|
158
158
|
const initialSlideIndex = props.getInitialSlideIndex(appearance());
|
|
159
159
|
return (() => {
|
|
160
|
-
|
|
160
|
+
var _el$ = _tmpl$3(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
|
|
161
161
|
_el$2.$$click = () => {
|
|
162
162
|
setExpanded((value) => !value);
|
|
163
163
|
};
|
|
@@ -191,11 +191,11 @@ var Picker = (props) => {
|
|
|
191
191
|
});
|
|
192
192
|
};
|
|
193
193
|
return [(() => {
|
|
194
|
-
|
|
194
|
+
var _el$5 = _tmpl$22();
|
|
195
195
|
_$insert2(_el$5, () => props.translationGroup[variant]);
|
|
196
196
|
return _el$5;
|
|
197
197
|
})(), (() => {
|
|
198
|
-
|
|
198
|
+
var _el$6 = _tmpl$32(), _el$7 = _el$6.firstChild;
|
|
199
199
|
_el$7.$$click = onClick;
|
|
200
200
|
_$insert2(_el$7, _$createComponent2(Show, {
|
|
201
201
|
get when() {
|
|
@@ -213,15 +213,15 @@ var Picker = (props) => {
|
|
|
213
213
|
}
|
|
214
214
|
}), null);
|
|
215
215
|
_$effect2((_p$) => {
|
|
216
|
-
|
|
217
|
-
_v$ !== _p$.
|
|
218
|
-
_v$2 !== _p$.
|
|
219
|
-
_v$3 !== _p$.
|
|
216
|
+
var _v$ = !expanded(), _v$2 = !expanded(), _v$3 = !expanded();
|
|
217
|
+
_v$ !== _p$.e && _el$.classList.toggle("ndc-picker-root-collapsed", _p$.e = _v$);
|
|
218
|
+
_v$2 !== _p$.t && _el$3.classList.toggle("ndc-collapse-button-icon-collapsed", _p$.t = _v$2);
|
|
219
|
+
_v$3 !== _p$.a && _el$4.classList.toggle("ndc-heading-picker-collapsed", _p$.a = _v$3);
|
|
220
220
|
return _p$;
|
|
221
221
|
}, {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
e: void 0,
|
|
223
|
+
t: void 0,
|
|
224
|
+
a: void 0
|
|
225
225
|
});
|
|
226
226
|
return _el$;
|
|
227
227
|
})();
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Character, Data, Lang, NovelyAsset, State,
|
|
1
|
+
import type { Character, Data, Lang, NovelyAsset, State, EngineTypes, ValidAction } from '@novely/core';
|
|
2
2
|
type Attributes<BaseKeys extends string = string> = Record<string, Record<string, Record<BaseKeys, NovelyAsset | NovelyAsset[]>>>;
|
|
3
3
|
type EmotionsDefinition<BaseKeys extends string, Attribs extends Attributes<BaseKeys>> = {
|
|
4
4
|
base: Record<BaseKeys, NovelyAsset | NovelyAsset[]>;
|
|
@@ -47,7 +47,7 @@ type ClothingData<BaseKeys extends string, Attribs extends Attributes<BaseKeys>>
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
type CreateActionsFN<BaseKeys extends string, Attribs extends Attributes<BaseKeys>> = {
|
|
50
|
-
<Engine extends EngineInstance>(engine: Engine, options: AllOptions<NoInfer<Engine['
|
|
50
|
+
<Engine extends EngineInstance>(engine: Engine, options: AllOptions<NoInfer<Engine['types']>, NoInfer<BaseKeys>, NoInfer<Attribs>>): {
|
|
51
51
|
showBasePicker: (options?: ShowPickerOptionsBase) => ValidAction;
|
|
52
52
|
showAttributePicker: (options: ShowPickerOptionsAttribute<Attribs>) => ValidAction;
|
|
53
53
|
showCharacter: () => ValidAction;
|
|
@@ -58,8 +58,8 @@ type EmotionsResult<BaseKeys extends string, Attribs extends Attributes<BaseKeys
|
|
|
58
58
|
createActions: CreateActionsFN<BaseKeys, Attribs>;
|
|
59
59
|
};
|
|
60
60
|
type Entries<T> = T extends Record<infer T, infer K> ? [T, K][] : never;
|
|
61
|
-
type
|
|
62
|
-
type AllOptions<TE extends
|
|
61
|
+
type DefaultEngineTypes = EngineTypes<Lang, State, Data, Record<string, Character>>;
|
|
62
|
+
type AllOptions<TE extends DefaultEngineTypes, BaseKeys extends string, Attribs extends Attributes<BaseKeys>> = {
|
|
63
63
|
/**
|
|
64
64
|
* Character ID
|
|
65
65
|
*/
|
|
@@ -118,7 +118,7 @@ type AllOptions<TE extends DefaultTypeEssentials, BaseKeys extends string, Attri
|
|
|
118
118
|
};
|
|
119
119
|
type AllThis = {
|
|
120
120
|
clothingData: ClothingData<string, Attributes>;
|
|
121
|
-
options: AllOptions<
|
|
121
|
+
options: AllOptions<DefaultEngineTypes, string, Attributes>;
|
|
122
122
|
};
|
|
123
123
|
type EmotionObject = {
|
|
124
124
|
base: string;
|
|
@@ -159,6 +159,6 @@ type ShowPickerOptionsAttribute<Attribs extends Attributes> = ShowPickerBuyFunct
|
|
|
159
159
|
type ShowPickerOptionsBase = ShowPickerBuyFunctions;
|
|
160
160
|
type EngineInstance = {
|
|
161
161
|
action: Record<string, (...args: any[]) => ValidAction>;
|
|
162
|
-
|
|
162
|
+
types: DefaultEngineTypes;
|
|
163
163
|
};
|
|
164
|
-
export type { Entries, EmotionsDefinition, EmotionsResult, Attributes, ClothingData, EmotionObject, AllOptions, AllThis,
|
|
164
|
+
export type { Entries, EmotionsDefinition, EmotionsResult, Attributes, ClothingData, EmotionObject, AllOptions, AllThis, DefaultEngineTypes, InternalShowPickerOptions, ShowPickerOptionsAttribute, ShowPickerOptionsBase, EngineInstance, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novely/dynamic-character",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"module": "./dist/index.jsx",
|
|
11
11
|
"sideEffects": false,
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"esbuild": "^0.
|
|
13
|
+
"esbuild": "^0.25.5",
|
|
14
14
|
"esbuild-plugin-solid": "^0.6.0",
|
|
15
|
-
"typescript": "^5.
|
|
15
|
+
"typescript": "^5.8.3"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"p-limit": "^6.
|
|
19
|
-
"solid-js": "~1.9.
|
|
20
|
-
"@novely/core": "0.
|
|
18
|
+
"p-limit": "^6.2.0",
|
|
19
|
+
"solid-js": "~1.9.7",
|
|
20
|
+
"@novely/core": "0.52.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@novely/core": "*",
|