@novely/solid-renderer 0.43.3 → 0.44.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/context-state.d.ts +2 -1
- package/dist/custom-actions/show-hide-image.d.ts +19 -9
- package/dist/index.jsx +205 -81
- package/dist/renderer.d.ts +7 -9
- package/dist/styles/index.css +9 -4
- package/package.json +1 -1
package/dist/context-state.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ContextImages } from './custom-actions/show-hide-image';
|
|
1
2
|
declare const useContextState: (id: string) => import("@novely/renderer-toolkit").DeepAtom<import("@novely/renderer-toolkit").ContextStateStore<{
|
|
2
|
-
images:
|
|
3
|
+
images: ContextImages;
|
|
3
4
|
dialogOverviewShown: boolean;
|
|
4
5
|
mood: string;
|
|
5
6
|
}>>, removeContextState: (id: string) => void;
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import type { ValidAction, NovelyAsset } from '@novely/core';
|
|
2
2
|
type ShowImageParams = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
style?: string;
|
|
7
|
-
await?: boolean;
|
|
3
|
+
classesBase?: string;
|
|
4
|
+
classesIn?: string;
|
|
5
|
+
wait?: boolean;
|
|
8
6
|
};
|
|
9
|
-
|
|
7
|
+
type ShowImageData = {
|
|
8
|
+
classesBase?: string[];
|
|
9
|
+
classesIn?: string[];
|
|
10
|
+
classesOut?: string[];
|
|
11
|
+
key: string;
|
|
12
|
+
image: HTMLImageElement;
|
|
13
|
+
visible: boolean;
|
|
14
|
+
onIn: () => void;
|
|
15
|
+
onOut: () => void;
|
|
16
|
+
};
|
|
17
|
+
type ContextImages = ShowImageData[];
|
|
18
|
+
declare const showImage: (asset: NovelyAsset, { classesBase, classesIn, wait }?: ShowImageParams) => ValidAction;
|
|
10
19
|
type HideImageParams = {
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
classesOut?: string;
|
|
21
|
+
wait?: boolean;
|
|
13
22
|
};
|
|
14
|
-
declare const hideImage: (
|
|
23
|
+
declare const hideImage: (asset: NovelyAsset, { classesOut, wait }?: HideImageParams) => ValidAction;
|
|
15
24
|
export { showImage, hideImage };
|
|
25
|
+
export type { ContextImages };
|
package/dist/index.jsx
CHANGED
|
@@ -717,6 +717,61 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
717
717
|
}
|
|
718
718
|
};
|
|
719
719
|
}
|
|
720
|
+
function indexArray(list, mapFn, options = {}) {
|
|
721
|
+
let items = [], mapped = [], disposers = [], signals = [], len = 0, i;
|
|
722
|
+
onCleanup(() => dispose(disposers));
|
|
723
|
+
return () => {
|
|
724
|
+
const newItems = list() || [], newLen = newItems.length;
|
|
725
|
+
newItems[$TRACK];
|
|
726
|
+
return untrack(() => {
|
|
727
|
+
if (newLen === 0) {
|
|
728
|
+
if (len !== 0) {
|
|
729
|
+
dispose(disposers);
|
|
730
|
+
disposers = [];
|
|
731
|
+
items = [];
|
|
732
|
+
mapped = [];
|
|
733
|
+
len = 0;
|
|
734
|
+
signals = [];
|
|
735
|
+
}
|
|
736
|
+
if (options.fallback) {
|
|
737
|
+
items = [FALLBACK];
|
|
738
|
+
mapped[0] = createRoot((disposer) => {
|
|
739
|
+
disposers[0] = disposer;
|
|
740
|
+
return options.fallback();
|
|
741
|
+
});
|
|
742
|
+
len = 1;
|
|
743
|
+
}
|
|
744
|
+
return mapped;
|
|
745
|
+
}
|
|
746
|
+
if (items[0] === FALLBACK) {
|
|
747
|
+
disposers[0]();
|
|
748
|
+
disposers = [];
|
|
749
|
+
items = [];
|
|
750
|
+
mapped = [];
|
|
751
|
+
len = 0;
|
|
752
|
+
}
|
|
753
|
+
for (i = 0; i < newLen; i++) {
|
|
754
|
+
if (i < items.length && items[i] !== newItems[i]) {
|
|
755
|
+
signals[i](() => newItems[i]);
|
|
756
|
+
} else if (i >= items.length) {
|
|
757
|
+
mapped[i] = createRoot(mapper);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
for (; i < items.length; i++) {
|
|
761
|
+
disposers[i]();
|
|
762
|
+
}
|
|
763
|
+
len = signals.length = disposers.length = newLen;
|
|
764
|
+
items = newItems.slice(0);
|
|
765
|
+
return mapped = mapped.slice(0, len);
|
|
766
|
+
});
|
|
767
|
+
function mapper(disposer) {
|
|
768
|
+
disposers[i] = disposer;
|
|
769
|
+
const [s, set] = createSignal(newItems[i]);
|
|
770
|
+
signals[i] = set;
|
|
771
|
+
return mapFn(s, i);
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
}
|
|
720
775
|
var hydrationEnabled = false;
|
|
721
776
|
function createComponent(Comp, props) {
|
|
722
777
|
if (hydrationEnabled) {
|
|
@@ -903,6 +958,12 @@ function For(props) {
|
|
|
903
958
|
};
|
|
904
959
|
return createMemo(mapArray(() => props.each, props.children, fallback || void 0));
|
|
905
960
|
}
|
|
961
|
+
function Index(props) {
|
|
962
|
+
const fallback = "fallback" in props && {
|
|
963
|
+
fallback: () => props.fallback
|
|
964
|
+
};
|
|
965
|
+
return createMemo(indexArray(() => props.each, props.children, fallback || void 0));
|
|
966
|
+
}
|
|
906
967
|
function Show(props) {
|
|
907
968
|
const keyed = props.keyed;
|
|
908
969
|
const condition = createMemo(() => props.when, void 0, {
|
|
@@ -3461,7 +3522,7 @@ var Transition2 = (props) => {
|
|
|
3461
3522
|
// src/context-state.ts
|
|
3462
3523
|
var { useContextState, removeContextState } = createContextStateRoot(() => {
|
|
3463
3524
|
return {
|
|
3464
|
-
images:
|
|
3525
|
+
images: [],
|
|
3465
3526
|
dialogOverviewShown: false,
|
|
3466
3527
|
mood: ""
|
|
3467
3528
|
};
|
|
@@ -3527,7 +3588,7 @@ var Save = (props) => {
|
|
|
3527
3588
|
contentDocument
|
|
3528
3589
|
} = iframe();
|
|
3529
3590
|
if (!contentDocument) return;
|
|
3530
|
-
contentDocument.head.insertAdjacentHTML("beforeend", `<style>:root { font-size: 30%; background: black; cursor: pointer; } * { pointer-events: none; } *, *::before, *::after { animation-play-state: paused !important; }</style>`);
|
|
3591
|
+
contentDocument.head.insertAdjacentHTML("beforeend", `<style>:root { font-size: 30%; background: black; cursor: pointer; } * { pointer-events: none; } *, *::before, *::after { animation-play-state: paused !important; animation-fill-mode: forwards !important; animation-direction: reverse !important; }</style>`);
|
|
3531
3592
|
const styleClone = contentDocument.importNode(style2(), true);
|
|
3532
3593
|
contentDocument.head.appendChild(styleClone);
|
|
3533
3594
|
context.root = contentDocument.body;
|
|
@@ -4128,6 +4189,7 @@ var _tmpl$102 = /* @__PURE__ */ template(`<div class="control-panel-container-ba
|
|
|
4128
4189
|
var _tmpl$112 = /* @__PURE__ */ template(`<div class="control-panel"><div role="menubar" class="control-panel-container">`);
|
|
4129
4190
|
var _tmpl$122 = /* @__PURE__ */ template(`<div><div class="characters"></div><div class="action-dialog"><div class="action-dialog-container" role="button" tabindex="0"><div class="action-dialog-content"></div></div></div><div></div><div class="action-text" role="button" tabindex="0"></div><div class="action-image">`);
|
|
4130
4191
|
var _tmpl$132 = /* @__PURE__ */ template(`<button type="button" class="button choice-dialog__choice"><span>`);
|
|
4192
|
+
var _tmpl$14 = /* @__PURE__ */ template(`<div class="action-image__image-container">`);
|
|
4131
4193
|
var Game = (props) => {
|
|
4132
4194
|
const data = useData();
|
|
4133
4195
|
const {
|
|
@@ -4539,11 +4601,52 @@ var Game = (props) => {
|
|
|
4539
4601
|
return _el$18;
|
|
4540
4602
|
}
|
|
4541
4603
|
}), _el$23);
|
|
4542
|
-
insert(_el$23, createComponent(
|
|
4604
|
+
insert(_el$23, createComponent(Index, {
|
|
4543
4605
|
get each() {
|
|
4544
|
-
return
|
|
4606
|
+
return images();
|
|
4545
4607
|
},
|
|
4546
|
-
children: (image) =>
|
|
4608
|
+
children: (image) => createComponent(Transition2, {
|
|
4609
|
+
onEnter: (el, done) => {
|
|
4610
|
+
const classesIn = image().classesIn;
|
|
4611
|
+
const onCompleted = () => {
|
|
4612
|
+
done();
|
|
4613
|
+
image().onIn();
|
|
4614
|
+
};
|
|
4615
|
+
if (!classesIn || classesIn.length === 0) {
|
|
4616
|
+
return onCompleted();
|
|
4617
|
+
}
|
|
4618
|
+
el.classList.add(...classesIn);
|
|
4619
|
+
el.addEventListener("animationend", onCompleted, {
|
|
4620
|
+
once: true
|
|
4621
|
+
});
|
|
4622
|
+
},
|
|
4623
|
+
onExit: (el, done) => {
|
|
4624
|
+
const classesOut = image().classesOut;
|
|
4625
|
+
const onCompleted = () => {
|
|
4626
|
+
done();
|
|
4627
|
+
image().onOut();
|
|
4628
|
+
};
|
|
4629
|
+
if (!classesOut || classesOut.length === 0) {
|
|
4630
|
+
return onCompleted();
|
|
4631
|
+
}
|
|
4632
|
+
el.classList.add(...classesOut);
|
|
4633
|
+
el.addEventListener("animationend", onCompleted, {
|
|
4634
|
+
once: true
|
|
4635
|
+
});
|
|
4636
|
+
},
|
|
4637
|
+
get children() {
|
|
4638
|
+
return createComponent(Show, {
|
|
4639
|
+
get when() {
|
|
4640
|
+
return image().visible;
|
|
4641
|
+
},
|
|
4642
|
+
get children() {
|
|
4643
|
+
const _el$26 = _tmpl$14();
|
|
4644
|
+
insert(_el$26, () => image().image);
|
|
4645
|
+
return _el$26;
|
|
4646
|
+
}
|
|
4647
|
+
});
|
|
4648
|
+
}
|
|
4649
|
+
})
|
|
4547
4650
|
}));
|
|
4548
4651
|
insert(_el$, createComponent(DialogOverview, {
|
|
4549
4652
|
context,
|
|
@@ -4584,17 +4687,17 @@ var Game = (props) => {
|
|
|
4584
4687
|
delegateEvents(["click", "keydown"]);
|
|
4585
4688
|
|
|
4586
4689
|
// src/screens/loading.tsx
|
|
4587
|
-
var _tmpl$
|
|
4690
|
+
var _tmpl$15 = /* @__PURE__ */ template(`<div class="loading"><div class="loading__animation"><div></div><div></div><div></div><div>`);
|
|
4588
4691
|
var Loading = (props) => {
|
|
4589
4692
|
return (() => {
|
|
4590
|
-
const _el$ = _tmpl$
|
|
4693
|
+
const _el$ = _tmpl$15();
|
|
4591
4694
|
createRenderEffect(() => _el$.classList.toggle("overlay", !!props.overlay));
|
|
4592
4695
|
return _el$;
|
|
4593
4696
|
})();
|
|
4594
4697
|
};
|
|
4595
4698
|
|
|
4596
4699
|
// src/screens/mainmenu.tsx
|
|
4597
|
-
var _tmpl$
|
|
4700
|
+
var _tmpl$16 = /* @__PURE__ */ template(`<div class="main-menu"><div class="main-menu__controls"><button type="button" class="button main-menu__button"><span class="main-menu__button__text"></span></button><button type="button" class="button main-menu__button"><span class="main-menu__button__text"></span></button><button type="button" class="button main-menu__button"><span class="main-menu__button__text"></span></button><button type="button" class="button main-menu__button"><span class="main-menu__button__text">`);
|
|
4598
4701
|
var _tmpl$27 = /* @__PURE__ */ template(`<button>`);
|
|
4599
4702
|
var MainMenu = () => {
|
|
4600
4703
|
const {
|
|
@@ -4611,7 +4714,7 @@ var MainMenu = () => {
|
|
|
4611
4714
|
$rendererState.mutate((s) => s.screen, screen);
|
|
4612
4715
|
});
|
|
4613
4716
|
return (() => {
|
|
4614
|
-
const _el$ = _tmpl$
|
|
4717
|
+
const _el$ = _tmpl$16(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$3.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$5.nextSibling, _el$8 = _el$7.firstChild, _el$9 = _el$7.nextSibling, _el$10 = _el$9.firstChild;
|
|
4615
4718
|
_el$3.$$click = () => {
|
|
4616
4719
|
options.newGame();
|
|
4617
4720
|
};
|
|
@@ -4662,7 +4765,7 @@ var MainMenu = () => {
|
|
|
4662
4765
|
delegateEvents(["click"]);
|
|
4663
4766
|
|
|
4664
4767
|
// src/screens/saves.tsx
|
|
4665
|
-
var _tmpl$
|
|
4768
|
+
var _tmpl$17 = /* @__PURE__ */ template(`<ol class="saves__list">`);
|
|
4666
4769
|
var _tmpl$28 = /* @__PURE__ */ template(`<div class="saves"><div class="saves__controls"><button type="button" class="button saves__button"></button></div><div class="saves__list-container">`);
|
|
4667
4770
|
var _tmpl$36 = /* @__PURE__ */ template(`<div class="saves__list saves__list--empty">`);
|
|
4668
4771
|
var Saves = () => {
|
|
@@ -4748,7 +4851,7 @@ var Saves = () => {
|
|
|
4748
4851
|
})();
|
|
4749
4852
|
},
|
|
4750
4853
|
get children() {
|
|
4751
|
-
const _el$5 = _tmpl$
|
|
4854
|
+
const _el$5 = _tmpl$17();
|
|
4752
4855
|
use(setList, _el$5);
|
|
4753
4856
|
insert(_el$5, createComponent(For, {
|
|
4754
4857
|
get each() {
|
|
@@ -4779,7 +4882,7 @@ var Saves = () => {
|
|
|
4779
4882
|
delegateEvents(["click"]);
|
|
4780
4883
|
|
|
4781
4884
|
// src/screens/settings.tsx
|
|
4782
|
-
var _tmpl$
|
|
4885
|
+
var _tmpl$18 = /* @__PURE__ */ template(`<div class="root settings"><div class="settings__controls"><button type="button" class="button settings__button"></button><button type="button" class="button settings__button"></button></div><div class="settings__options"><div></div><div>`);
|
|
4783
4886
|
var _tmpl$29 = /* @__PURE__ */ template(`<option>`);
|
|
4784
4887
|
var Settings = (props) => {
|
|
4785
4888
|
const {
|
|
@@ -4826,7 +4929,7 @@ var Settings = (props) => {
|
|
|
4826
4929
|
return fn;
|
|
4827
4930
|
};
|
|
4828
4931
|
return (() => {
|
|
4829
|
-
const _el$ = _tmpl$
|
|
4932
|
+
const _el$ = _tmpl$18(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$2.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$6.nextSibling;
|
|
4830
4933
|
_el$3.$$click = () => {
|
|
4831
4934
|
$rendererState.setKey("screen", "mainmenu");
|
|
4832
4935
|
};
|
|
@@ -4927,7 +5030,7 @@ var Settings = (props) => {
|
|
|
4927
5030
|
delegateEvents(["click"]);
|
|
4928
5031
|
|
|
4929
5032
|
// src/components/Root.tsx
|
|
4930
|
-
var _tmpl$
|
|
5033
|
+
var _tmpl$19 = /* @__PURE__ */ template(`<div class="root">`);
|
|
4931
5034
|
var createRootComponent = ({
|
|
4932
5035
|
$rendererState,
|
|
4933
5036
|
$contextState,
|
|
@@ -4961,7 +5064,7 @@ var createRootComponent = ({
|
|
|
4961
5064
|
emitter.emit("screen:change", currentScreen);
|
|
4962
5065
|
});
|
|
4963
5066
|
return (() => {
|
|
4964
|
-
const _el$ = _tmpl$
|
|
5067
|
+
const _el$ = _tmpl$19();
|
|
4965
5068
|
const _ref$ = setRoot;
|
|
4966
5069
|
typeof _ref$ === "function" ? use(_ref$, _el$) : setRoot = _el$;
|
|
4967
5070
|
insert(_el$, createComponent(Provider, {
|
|
@@ -5048,90 +5151,111 @@ var createRootComponent = ({
|
|
|
5048
5151
|
};
|
|
5049
5152
|
|
|
5050
5153
|
// src/custom-actions/show-hide-image.ts
|
|
5051
|
-
var
|
|
5052
|
-
|
|
5053
|
-
const
|
|
5054
|
-
|
|
5154
|
+
var getIndex = (ctx, key) => {
|
|
5155
|
+
const images = ctx.get().images;
|
|
5156
|
+
const index = images.findIndex((value) => value.key === key);
|
|
5157
|
+
if (index === -1) {
|
|
5158
|
+
return images.length;
|
|
5159
|
+
}
|
|
5160
|
+
return index;
|
|
5161
|
+
};
|
|
5162
|
+
var SHOW_HIDE_IMAGE = Symbol();
|
|
5163
|
+
var showImage = (asset, { classesBase, classesIn, wait } = {}) => {
|
|
5164
|
+
const key = `show-image--${asset.id}`;
|
|
5165
|
+
const handler = ({ contextKey, clear, rendererContext }) => {
|
|
5055
5166
|
const { promise, resolve } = Promise.withResolvers();
|
|
5056
|
-
const
|
|
5057
|
-
const
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5167
|
+
const ctx = useContextState(contextKey);
|
|
5168
|
+
const index = getIndex(ctx, key);
|
|
5169
|
+
const image = imagePreloadWithCachingNotComplete(asset.source).cloneNode(true);
|
|
5170
|
+
const classesBaseSplitted = classesBase?.split(" ") || [];
|
|
5171
|
+
const classesInSplitted = classesIn?.split(" ") || [];
|
|
5172
|
+
image.classList.add(...classesBaseSplitted);
|
|
5173
|
+
image.classList.add("action-image__image");
|
|
5174
|
+
const onIn = () => {
|
|
5175
|
+
if (wait) {
|
|
5176
|
+
resolve();
|
|
5177
|
+
}
|
|
5178
|
+
};
|
|
5179
|
+
ctx.mutate((s) => s.images[index], {
|
|
5180
|
+
classesBase: classesBaseSplitted,
|
|
5181
|
+
classesIn: classesInSplitted,
|
|
5182
|
+
classesOut: void 0,
|
|
5183
|
+
key,
|
|
5067
5184
|
image,
|
|
5068
|
-
|
|
5185
|
+
visible: false,
|
|
5186
|
+
onIn,
|
|
5187
|
+
onOut: noop
|
|
5069
5188
|
});
|
|
5070
|
-
|
|
5071
|
-
if (
|
|
5072
|
-
|
|
5073
|
-
if (params.await) {
|
|
5074
|
-
rendererContext.clearBlockingActions(void 0);
|
|
5075
|
-
}
|
|
5076
|
-
clearAnimation = () => {
|
|
5077
|
-
image.classList.remove(...inClasses);
|
|
5078
|
-
resolve();
|
|
5079
|
-
};
|
|
5080
|
-
image.addEventListener("animationend", clearAnimation, { once: true });
|
|
5189
|
+
setTimeout(() => ctx.mutate((s) => s.images[index].visible, true));
|
|
5190
|
+
if (wait) {
|
|
5191
|
+
rendererContext.clearBlockingActions(void 0);
|
|
5081
5192
|
} else {
|
|
5082
5193
|
resolve();
|
|
5083
5194
|
}
|
|
5084
5195
|
clear(() => {
|
|
5085
|
-
ctx.mutate((s) => s.images[
|
|
5086
|
-
|
|
5087
|
-
|
|
5196
|
+
ctx.mutate((s) => s.images[index], {
|
|
5197
|
+
classesIn: void 0,
|
|
5198
|
+
classesOut: void 0,
|
|
5199
|
+
key,
|
|
5200
|
+
image,
|
|
5201
|
+
visible: false,
|
|
5202
|
+
onIn: noop,
|
|
5203
|
+
onOut: noop
|
|
5204
|
+
});
|
|
5205
|
+
image.classList.remove(...classesBaseSplitted);
|
|
5088
5206
|
});
|
|
5089
|
-
if (!params.await) {
|
|
5090
|
-
resolve();
|
|
5091
|
-
}
|
|
5092
5207
|
return promise;
|
|
5093
5208
|
};
|
|
5094
|
-
handler.id =
|
|
5095
|
-
handler.key =
|
|
5096
|
-
handler.assets = [
|
|
5097
|
-
handler.
|
|
5209
|
+
handler.id = SHOW_HIDE_IMAGE;
|
|
5210
|
+
handler.key = key;
|
|
5211
|
+
handler.assets = [asset];
|
|
5212
|
+
handler.skipOnRestore = (getNext) => {
|
|
5213
|
+
return getNext().some(
|
|
5214
|
+
(action) => action[0] === "custom" && action[1].id === SHOW_HIDE_IMAGE && action[1].key === key
|
|
5215
|
+
);
|
|
5216
|
+
};
|
|
5098
5217
|
return ["custom", handler];
|
|
5099
5218
|
};
|
|
5100
|
-
var hideImage = (
|
|
5101
|
-
const
|
|
5219
|
+
var hideImage = (asset, { classesOut, wait } = {}) => {
|
|
5220
|
+
const key = `show-image--${asset.id}`;
|
|
5221
|
+
const handler = ({ contextKey, rendererContext }) => {
|
|
5102
5222
|
const ctx = useContextState(contextKey);
|
|
5223
|
+
const index = getIndex(ctx, key);
|
|
5224
|
+
const context = ctx.get().images[index];
|
|
5225
|
+
if (!context) {
|
|
5226
|
+
return;
|
|
5227
|
+
}
|
|
5103
5228
|
const { promise, resolve } = Promise.withResolvers();
|
|
5104
|
-
const
|
|
5105
|
-
|
|
5106
|
-
|
|
5229
|
+
const { image, classesBase } = context;
|
|
5230
|
+
const classesBaseSplitted = classesBase || [];
|
|
5231
|
+
const classesOutSplitted = classesOut?.split(" ") || [];
|
|
5232
|
+
const onOut = () => {
|
|
5233
|
+
if (wait) {
|
|
5234
|
+
image.classList.remove(...classesBaseSplitted);
|
|
5235
|
+
resolve();
|
|
5236
|
+
}
|
|
5107
5237
|
};
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
if (params.out && !flags.preview) {
|
|
5117
|
-
const classes = params.out.split(" ");
|
|
5118
|
-
image.classList.add(...classes);
|
|
5119
|
-
rendererContext.clearBlockingActions(void 0);
|
|
5120
|
-
const onAnimationEnd = () => {
|
|
5121
|
-
image.classList.remove(...classes);
|
|
5122
|
-
done();
|
|
5123
|
-
};
|
|
5124
|
-
image.addEventListener("animationend", onAnimationEnd, { once: true });
|
|
5125
|
-
if (!params.await) {
|
|
5126
|
-
done();
|
|
5238
|
+
ctx.mutate(
|
|
5239
|
+
(s) => s.images[index],
|
|
5240
|
+
(prev) => {
|
|
5241
|
+
return {
|
|
5242
|
+
...prev,
|
|
5243
|
+
onOut,
|
|
5244
|
+
classesOut: classesOutSplitted
|
|
5245
|
+
};
|
|
5127
5246
|
}
|
|
5247
|
+
);
|
|
5248
|
+
setTimeout(() => ctx.mutate((s) => s.images[index].visible, false));
|
|
5249
|
+
if (wait) {
|
|
5250
|
+
rendererContext.clearBlockingActions(void 0);
|
|
5128
5251
|
} else {
|
|
5129
|
-
|
|
5252
|
+
image.classList.remove(...classesBaseSplitted);
|
|
5253
|
+
resolve();
|
|
5130
5254
|
}
|
|
5131
5255
|
return promise;
|
|
5132
5256
|
};
|
|
5133
|
-
handler.id =
|
|
5134
|
-
handler.key =
|
|
5257
|
+
handler.id = SHOW_HIDE_IMAGE;
|
|
5258
|
+
handler.key = key;
|
|
5135
5259
|
handler.assets = [];
|
|
5136
5260
|
handler.callOnlyLatest = true;
|
|
5137
5261
|
return ["custom", handler];
|
|
@@ -5189,7 +5313,7 @@ var createEmitter = () => {
|
|
|
5189
5313
|
};
|
|
5190
5314
|
|
|
5191
5315
|
// src/renderer.tsx
|
|
5192
|
-
var _tmpl$
|
|
5316
|
+
var _tmpl$20 = /* @__PURE__ */ template(`<canvas>`);
|
|
5193
5317
|
var {
|
|
5194
5318
|
preloadAudioBlocking
|
|
5195
5319
|
} = createAudioMisc();
|
|
@@ -5248,7 +5372,7 @@ var createSolidRenderer = ({
|
|
|
5248
5372
|
return chars[character];
|
|
5249
5373
|
}
|
|
5250
5374
|
const canvas = (() => {
|
|
5251
|
-
const _el$ = _tmpl$
|
|
5375
|
+
const _el$ = _tmpl$20();
|
|
5252
5376
|
setAttribute(_el$, "data-character", character);
|
|
5253
5377
|
return _el$;
|
|
5254
5378
|
})();
|
package/dist/renderer.d.ts
CHANGED
|
@@ -21,16 +21,14 @@ declare const createSolidRenderer: ({ fullscreen, controls, skipTypewriterWhenGo
|
|
|
21
21
|
preloadAudioBlocking: (source: string) => Promise<void>;
|
|
22
22
|
};
|
|
23
23
|
actions: {
|
|
24
|
-
showImage: (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
style?: string;
|
|
29
|
-
await?: boolean;
|
|
24
|
+
showImage: (asset: import("@novely/core").NovelyAsset, { classesBase, classesIn, wait }?: {
|
|
25
|
+
classesBase?: string;
|
|
26
|
+
classesIn?: string;
|
|
27
|
+
wait?: boolean;
|
|
30
28
|
}) => import("@novely/core").ValidAction;
|
|
31
|
-
hideImage: (
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
hideImage: (asset: import("@novely/core").NovelyAsset, { classesOut, wait }?: {
|
|
30
|
+
classesOut?: string;
|
|
31
|
+
wait?: boolean;
|
|
34
32
|
}) => import("@novely/core").ValidAction;
|
|
35
33
|
setMood: (mood: string | import("@novely/core").TextContent<Lang, import("@novely/core").State>) => import("@novely/core").ValidAction;
|
|
36
34
|
};
|
package/dist/styles/index.css
CHANGED
|
@@ -579,13 +579,18 @@
|
|
|
579
579
|
left: 0;
|
|
580
580
|
right: 0;
|
|
581
581
|
}
|
|
582
|
-
.action-image__image {
|
|
582
|
+
.action-image__image-container {
|
|
583
583
|
z-index: var(--z-index, 1);
|
|
584
|
-
|
|
585
|
-
|
|
584
|
+
position: absolute;
|
|
585
|
+
}
|
|
586
|
+
.action-image__image-container,
|
|
587
|
+
.action-image__image {
|
|
586
588
|
width: 100vw;
|
|
587
589
|
height: 100vh;
|
|
588
|
-
|
|
590
|
+
}
|
|
591
|
+
.action-image__image {
|
|
592
|
+
object-fit: cover;
|
|
593
|
+
object-position: 50% 50%;
|
|
589
594
|
}
|
|
590
595
|
|
|
591
596
|
/* src/styles/custom-actions/image/index.css */
|