@novely/solid-renderer 0.31.0 → 0.32.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/index.jsx +55 -102
- package/package.json +4 -4
package/dist/index.jsx
CHANGED
|
@@ -4238,15 +4238,6 @@ var memo = (input, cb) => {
|
|
|
4238
4238
|
});
|
|
4239
4239
|
return $memoized;
|
|
4240
4240
|
};
|
|
4241
|
-
var getClonedOldValue = (atom2) => {
|
|
4242
|
-
let oldValue;
|
|
4243
|
-
try {
|
|
4244
|
-
oldValue = structuredClone(atom2.value);
|
|
4245
|
-
} catch {
|
|
4246
|
-
oldValue = { ...atom2.value };
|
|
4247
|
-
}
|
|
4248
|
-
return oldValue;
|
|
4249
|
-
};
|
|
4250
4241
|
var usePath = (atomValue, getPath2) => {
|
|
4251
4242
|
const targets = /* @__PURE__ */ new Set();
|
|
4252
4243
|
const path = [];
|
|
@@ -4286,7 +4277,7 @@ var deepAtom = (init) => {
|
|
|
4286
4277
|
if (newValue === value) {
|
|
4287
4278
|
return newValue;
|
|
4288
4279
|
}
|
|
4289
|
-
const
|
|
4280
|
+
const oldValue = $atom.value;
|
|
4290
4281
|
const fakedPath = {
|
|
4291
4282
|
split: () => {
|
|
4292
4283
|
return {
|
|
@@ -4296,8 +4287,8 @@ var deepAtom = (init) => {
|
|
|
4296
4287
|
};
|
|
4297
4288
|
}
|
|
4298
4289
|
};
|
|
4299
|
-
$atom.value =
|
|
4300
|
-
$atom.notify(
|
|
4290
|
+
$atom.value = setPath($atom.value, fakedPath, newValue);
|
|
4291
|
+
$atom.notify(oldValue, path.join("."));
|
|
4301
4292
|
return newValue;
|
|
4302
4293
|
};
|
|
4303
4294
|
return $atom;
|
|
@@ -4746,7 +4737,7 @@ var handleChoiceAction = ($contextState, label, choices, resolve) => {
|
|
|
4746
4737
|
{ choices, label, resolve, visible: true }
|
|
4747
4738
|
);
|
|
4748
4739
|
};
|
|
4749
|
-
var handleClearAction = ($rendererState, $contextState, context, keep, keepCharacters) => {
|
|
4740
|
+
var handleClearAction = ($rendererState, $contextState, options, context, keep, keepCharacters) => {
|
|
4750
4741
|
$rendererState.mutate((s) => s.exitPromptShown, false);
|
|
4751
4742
|
if (!keep.has("showBackground")) {
|
|
4752
4743
|
$contextState.mutate((s) => s.background.background, "#000");
|
|
@@ -4802,72 +4793,53 @@ var handleClearAction = ($rendererState, $contextState, context, keep, keepChara
|
|
|
4802
4793
|
);
|
|
4803
4794
|
}
|
|
4804
4795
|
}
|
|
4805
|
-
for (const [id,
|
|
4806
|
-
if (!
|
|
4796
|
+
for (const [id, obj] of Object.entries(custom)) {
|
|
4797
|
+
if (!obj)
|
|
4807
4798
|
continue;
|
|
4808
|
-
if (context.meta.goingBack &&
|
|
4799
|
+
if (context.meta.goingBack && obj.fn.skipClearOnGoingBack)
|
|
4809
4800
|
continue;
|
|
4810
|
-
|
|
4801
|
+
options.clearCustomAction(context, obj.fn);
|
|
4811
4802
|
$contextState.mutate((s) => s.custom[id], void 0);
|
|
4812
4803
|
}
|
|
4813
4804
|
};
|
|
4814
|
-
var handleCustomAction = ($contextState,
|
|
4815
|
-
|
|
4816
|
-
const cached = $contextState.get().custom[fn.key];
|
|
4817
|
-
if (cached) {
|
|
4818
|
-
return cached.getReturn;
|
|
4819
|
-
}
|
|
4820
|
-
let clear = () => {
|
|
4821
|
-
};
|
|
4822
|
-
let store = {};
|
|
4823
|
-
const clearManager = () => {
|
|
4824
|
-
clear();
|
|
4825
|
-
$contextState.mutate((s) => s.custom[fn.key], void 0);
|
|
4826
|
-
};
|
|
4827
|
-
const createElement2 = () => {
|
|
4828
|
-
const div = document.createElement("div");
|
|
4829
|
-
div.setAttribute("data-id", fn.key);
|
|
4830
|
-
return div;
|
|
4831
|
-
};
|
|
4832
|
-
const element = insert2 ? createElement2() : null;
|
|
4833
|
-
const getReturn = {
|
|
4834
|
-
root: context.root,
|
|
4835
|
-
element,
|
|
4836
|
-
remove: clearManager,
|
|
4837
|
-
data(data) {
|
|
4838
|
-
return data ? store = data : store;
|
|
4839
|
-
},
|
|
4840
|
-
clear(cb) {
|
|
4841
|
-
clear = cb;
|
|
4842
|
-
},
|
|
4843
|
-
__internals: {
|
|
4844
|
-
ctx: context
|
|
4845
|
-
}
|
|
4846
|
-
};
|
|
4805
|
+
var handleCustomAction = ($contextState, fn) => {
|
|
4806
|
+
if (!$contextState.get().custom[fn.key]) {
|
|
4847
4807
|
$contextState.mutate(
|
|
4848
4808
|
(s) => s.custom[fn.key],
|
|
4849
4809
|
{
|
|
4850
|
-
dom: element,
|
|
4851
4810
|
fn,
|
|
4852
|
-
|
|
4853
|
-
clear:
|
|
4811
|
+
node: null,
|
|
4812
|
+
clear: noop
|
|
4854
4813
|
}
|
|
4855
4814
|
);
|
|
4856
|
-
|
|
4815
|
+
}
|
|
4816
|
+
return {
|
|
4817
|
+
setMountElement(node) {
|
|
4818
|
+
$contextState.mutate(
|
|
4819
|
+
(s) => s.custom[fn.key],
|
|
4820
|
+
(state) => {
|
|
4821
|
+
return {
|
|
4822
|
+
...state,
|
|
4823
|
+
node
|
|
4824
|
+
};
|
|
4825
|
+
}
|
|
4826
|
+
);
|
|
4827
|
+
},
|
|
4828
|
+
setClear(clear) {
|
|
4829
|
+
$contextState.mutate(
|
|
4830
|
+
(s) => s.custom[fn.key],
|
|
4831
|
+
(state) => {
|
|
4832
|
+
return {
|
|
4833
|
+
...state,
|
|
4834
|
+
clear
|
|
4835
|
+
};
|
|
4836
|
+
}
|
|
4837
|
+
);
|
|
4838
|
+
},
|
|
4839
|
+
remove() {
|
|
4840
|
+
$contextState.mutate((s) => s.custom[fn.key], void 0);
|
|
4841
|
+
}
|
|
4857
4842
|
};
|
|
4858
|
-
const result = fn({
|
|
4859
|
-
...context.meta,
|
|
4860
|
-
lang: options.storageData.get().meta[0],
|
|
4861
|
-
get,
|
|
4862
|
-
state: options.getStateFunction(context.id)
|
|
4863
|
-
});
|
|
4864
|
-
result ? result.then(resolve) : resolve();
|
|
4865
|
-
return result;
|
|
4866
|
-
};
|
|
4867
|
-
var handleClearCustomAction = ($contextState, fn) => {
|
|
4868
|
-
const data = $contextState.get().custom[fn.key];
|
|
4869
|
-
if (data)
|
|
4870
|
-
data.clear();
|
|
4871
4843
|
};
|
|
4872
4844
|
var handleClearBlockingActions = ($contextState, preserve) => {
|
|
4873
4845
|
const current = $contextState.get();
|
|
@@ -5697,7 +5669,7 @@ var Save = (props) => {
|
|
|
5697
5669
|
if (!custom)
|
|
5698
5670
|
continue;
|
|
5699
5671
|
try {
|
|
5700
|
-
custom.
|
|
5672
|
+
options.clearCustomAction(context, custom.fn);
|
|
5701
5673
|
} catch {
|
|
5702
5674
|
}
|
|
5703
5675
|
}
|
|
@@ -6331,7 +6303,7 @@ var Game = (props) => {
|
|
|
6331
6303
|
get each() {
|
|
6332
6304
|
return customs();
|
|
6333
6305
|
},
|
|
6334
|
-
children: (value) => value.
|
|
6306
|
+
children: (value) => value.node
|
|
6335
6307
|
}));
|
|
6336
6308
|
addEventListener2(_el$27, "keydown", onKey(TextWriter.clear, " "), true);
|
|
6337
6309
|
addEventListener2(_el$27, "keypress", onKey(TextWriter.clear, "Enter"));
|
|
@@ -6922,11 +6894,9 @@ var createRootComponent = ({
|
|
|
6922
6894
|
var SHOW_ARBITARY_CHARACTER = Symbol();
|
|
6923
6895
|
var createShowArbitraryCharacterAction = (_) => {
|
|
6924
6896
|
const showArbitraryCharacter = (params) => {
|
|
6925
|
-
const handler = ({
|
|
6926
|
-
const
|
|
6927
|
-
|
|
6928
|
-
const handle = ctx.character(params.id);
|
|
6929
|
-
handle.append(params.classes, params.style, ctx.meta.restoring);
|
|
6897
|
+
const handler = ({ rendererContext }) => {
|
|
6898
|
+
const handle = rendererContext.character(params.id);
|
|
6899
|
+
handle.append(params.classes, params.style, rendererContext.meta.restoring);
|
|
6930
6900
|
handle.emotion(params.emotion, true);
|
|
6931
6901
|
const extension = ((e) => Array.isArray(e) ? e : [e])(params.extendWith());
|
|
6932
6902
|
canvasDrawImages(handle.canvas, handle.ctx, extension.map((src) => PRELOADED_IMAGE_MAP.get(src) || createImage(src)));
|
|
@@ -7059,29 +7029,15 @@ var createSolidRenderer = ({
|
|
|
7059
7029
|
});
|
|
7060
7030
|
},
|
|
7061
7031
|
animate(timeout, classes) {
|
|
7062
|
-
const
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
if (!target2)
|
|
7070
|
-
return;
|
|
7071
|
-
const classNames = classes.filter((className2) => !target2.classList.contains(className2));
|
|
7072
|
-
target2.classList.add(...classNames);
|
|
7073
|
-
const removeClassNames = () => {
|
|
7074
|
-
target2.classList.remove(...classNames);
|
|
7075
|
-
};
|
|
7076
|
-
const timeoutId = setTimeout(removeClassNames, timeout);
|
|
7077
|
-
clear(() => {
|
|
7078
|
-
removeClassNames();
|
|
7079
|
-
clearTimeout(timeoutId);
|
|
7080
|
-
});
|
|
7032
|
+
const target2 = this.canvas;
|
|
7033
|
+
if (!target2)
|
|
7034
|
+
return;
|
|
7035
|
+
const classNames = classes.filter((className2) => !target2.classList.contains(className2));
|
|
7036
|
+
target2.classList.add(...classNames);
|
|
7037
|
+
const removeClassNames = () => {
|
|
7038
|
+
target2.classList.remove(...classNames);
|
|
7081
7039
|
};
|
|
7082
|
-
|
|
7083
|
-
context.custom(handler, () => {
|
|
7084
|
-
});
|
|
7040
|
+
setTimeout(removeClassNames, timeout);
|
|
7085
7041
|
}
|
|
7086
7042
|
};
|
|
7087
7043
|
useShared(name).characters[character] = characterHandle;
|
|
@@ -7094,18 +7050,15 @@ var createSolidRenderer = ({
|
|
|
7094
7050
|
handleChoiceAction($contextState, label, choices, resolve);
|
|
7095
7051
|
},
|
|
7096
7052
|
clear(keep, keepCharacters, keepAudio, resolve) {
|
|
7097
|
-
handleClearAction($rendererState, $contextState, context, keep, keepCharacters);
|
|
7053
|
+
handleClearAction($rendererState, $contextState, options, context, keep, keepCharacters);
|
|
7098
7054
|
audio.clear(keepAudio);
|
|
7099
7055
|
resolve();
|
|
7100
7056
|
},
|
|
7101
7057
|
input(label, onInput, setup, resolve) {
|
|
7102
7058
|
handleInputAction($contextState, options, context, label, onInput, setup, resolve);
|
|
7103
7059
|
},
|
|
7104
|
-
custom(fn
|
|
7105
|
-
return handleCustomAction($contextState,
|
|
7106
|
-
},
|
|
7107
|
-
clearCustom(fn) {
|
|
7108
|
-
handleClearCustomAction($contextState, fn);
|
|
7060
|
+
custom(fn) {
|
|
7061
|
+
return handleCustomAction($contextState, fn);
|
|
7109
7062
|
},
|
|
7110
7063
|
clearBlockingActions(name2) {
|
|
7111
7064
|
handleClearBlockingActions($contextState, name2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novely/solid-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"retrieved": "^0.1.0",
|
|
20
20
|
"solid-js": "1.8.17",
|
|
21
21
|
"solid-transition-group": "^0.2.3",
|
|
22
|
-
"@novely/core": "0.
|
|
23
|
-
"@novely/
|
|
24
|
-
"@novely/
|
|
22
|
+
"@novely/core": "0.35.0",
|
|
23
|
+
"@novely/typewriter": "0.5.1",
|
|
24
|
+
"@novely/renderer-toolkit": "0.6.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@novely/core": "*",
|