@novely/solid-renderer 0.51.0-next.0 → 0.51.0-next.2

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.d.ts CHANGED
@@ -1 +1 @@
1
- export { createSolidRenderer } from './renderer';
1
+ export { createRenderer, createSolidRenderer } from './renderer';
package/dist/index.jsx CHANGED
@@ -2735,8 +2735,7 @@ var handleClearAction = ($rendererState, $contextState, options, context, keep,
2735
2735
  if (!keep.has("text")) {
2736
2736
  $contextState.mutate((s) => s.text, { content: "" });
2737
2737
  }
2738
- const { characters, custom } = $contextState.get();
2739
- for (const character of Object.keys(characters)) {
2738
+ for (const character of Object.keys($contextState.get().characters)) {
2740
2739
  if (!keepCharacters.has(character)) {
2741
2740
  $contextState.mutate((s) => s.characters[character], {
2742
2741
  style: void 0,
@@ -2744,19 +2743,12 @@ var handleClearAction = ($rendererState, $contextState, options, context, keep,
2744
2743
  });
2745
2744
  }
2746
2745
  }
2747
- for (const [id, obj] of Object.entries(custom)) {
2748
- if (!obj) continue;
2749
- if (context.meta.goingBack && obj.fn.skipClearOnGoingBack) continue;
2750
- options.clearCustomAction(context, obj.fn);
2751
- $contextState.mutate((s) => s.custom[id], void 0);
2752
- }
2753
2746
  };
2754
2747
  var handleCustomAction = ($contextState, fn) => {
2755
2748
  if (!$contextState.get().custom[fn.key]) {
2756
2749
  $contextState.mutate((s) => s.custom[fn.key], {
2757
2750
  fn,
2758
- node: null,
2759
- clear: noop
2751
+ node: null
2760
2752
  });
2761
2753
  }
2762
2754
  return {
@@ -2771,17 +2763,6 @@ var handleCustomAction = ($contextState, fn) => {
2771
2763
  }
2772
2764
  );
2773
2765
  },
2774
- setClear(clear) {
2775
- $contextState.mutate(
2776
- (s) => s.custom[fn.key],
2777
- (state) => {
2778
- return {
2779
- ...state,
2780
- clear
2781
- };
2782
- }
2783
- );
2784
- },
2785
2766
  remove() {
2786
2767
  $contextState.mutate((s) => s.custom[fn.key], void 0);
2787
2768
  }
@@ -3559,7 +3540,19 @@ var Save = (props) => {
3559
3540
  minute: "numeric"
3560
3541
  }));
3561
3542
  const stringType = t(type === "auto" ? "Automatic" : "Manual");
3543
+ const cleanup = once(() => {
3544
+ try {
3545
+ options.clearCustomActionsAtContext(context);
3546
+ removeContextState(KEY);
3547
+ removeContext(KEY);
3548
+ options.removeContext(KEY);
3549
+ removeShared(KEY);
3550
+ } catch (error) {
3551
+ console.error(error);
3552
+ }
3553
+ });
3562
3554
  const loadSave = () => {
3555
+ cleanup();
3563
3556
  options.set(props.save);
3564
3557
  };
3565
3558
  const removeSave = (date2) => {
@@ -3605,20 +3598,7 @@ var Save = (props) => {
3605
3598
  previewDone();
3606
3599
  }
3607
3600
  });
3608
- onCleanup(() => {
3609
- const state = useContextState(KEY);
3610
- for (const custom of Object.values(state.get().custom)) {
3611
- if (!custom) continue;
3612
- try {
3613
- options.clearCustomAction(context, custom.fn);
3614
- } catch {
3615
- }
3616
- }
3617
- removeContextState(KEY);
3618
- removeContext(KEY);
3619
- options.removeContext(KEY);
3620
- removeShared(KEY);
3621
- });
3601
+ onCleanup(cleanup);
3622
3602
  onCleanup(() => {
3623
3603
  clearTimeout(previewDoneTimeoutId);
3624
3604
  });
@@ -5624,5 +5604,6 @@ var createRenderer = ({
5624
5604
  };
5625
5605
  var createSolidRenderer = createRenderer;
5626
5606
  export {
5607
+ createRenderer,
5627
5608
  createSolidRenderer
5628
5609
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.51.0-next.0",
3
+ "version": "0.51.0-next.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,14 +0,0 @@
1
- import type { FlowComponent, JSX } from 'solid-js';
2
- type NativeSelectProps = Omit<JSX.SelectHTMLAttributes<HTMLSelectElement>, 'class' | 'id'>;
3
- type SelectProps = NativeSelectProps & {
4
- /**
5
- * Icon HTML string
6
- */
7
- icon: string;
8
- /**
9
- * Label
10
- */
11
- label: string;
12
- };
13
- declare const Select: FlowComponent<SelectProps>;
14
- export { Select };
@@ -1,3 +0,0 @@
1
- import type { FlowComponent } from 'solid-js';
2
- declare const ShadowRoot: FlowComponent;
3
- export { ShadowRoot };
@@ -1,10 +0,0 @@
1
- import type { Character, CharactersData, Lang, ValidAction } from "@novely/core";
2
- type ShowArbitraryCharacterParams<$Characters extends CharactersData<Record<string, Character<Lang>>>, $Character extends keyof $Characters> = {
3
- id: $Character & string;
4
- emotion: $Characters[$Character]['emotions'][number] & string;
5
- extendWith: () => string | string[];
6
- classes?: string;
7
- style?: string;
8
- };
9
- declare const createShowArbitraryCharacterAction: <$Characters extends CharactersData<Record<string, Character>>>() => <$Character extends keyof $Characters>(params: ShowArbitraryCharacterParams<$Characters, $Character>) => ValidAction;
10
- export { createShowArbitraryCharacterAction };
@@ -1,24 +0,0 @@
1
- import type { Character, Lang, ValidAction } from "@novely/core";
2
- type ShowArbitraryCharacterParams<$Characters extends Record<string, Character<Lang>>, $Character extends keyof $Characters> = {
3
- id: $Character & string;
4
- emotion: keyof $Characters[$Character]['emotions'] & string;
5
- extendWith: () => string | string[];
6
- classes?: string;
7
- style?: string;
8
- };
9
- declare const createShowArbitraryCharacterAction: <$Characters extends Record<string, Character>>(_: $Characters) => <$Character extends keyof $Characters>(params: ShowArbitraryCharacterParams<$Characters, $Character>) => ValidAction;
10
- type ShowImageParams = {
11
- z?: number;
12
- in?: string;
13
- class?: string;
14
- style?: string;
15
- position?: string;
16
- await?: boolean;
17
- };
18
- declare const showImage: (source: string, params?: ShowImageParams) => ValidAction;
19
- type HideImageParams = {
20
- out?: string;
21
- await?: boolean;
22
- };
23
- declare const hideImage: (source: string, params?: HideImageParams) => ValidAction;
24
- export { createShowArbitraryCharacterAction, showImage, hideImage };
@@ -1,3 +0,0 @@
1
- import type { AccessorArray } from 'solid-js';
2
- declare const createComputedWithMemory: <T, K>(input: AccessorArray<T>, cb: (current: NoInfer<T>, previous: NoInfer<T> | undefined) => K) => import("solid-js").Accessor<K>;
3
- export { createComputedWithMemory };
@@ -1,6 +0,0 @@
1
- import { type Accessor } from "solid-js";
2
- declare const createPreviousValue: <T>(accessor: Accessor<T>) => {
3
- previous: Accessor<T>;
4
- current: Accessor<T>;
5
- };
6
- export { createPreviousValue };
@@ -1,3 +0,0 @@
1
- import type { Accessor } from 'solid-js';
2
- declare const createPrevious: <T>(get: Accessor<T>) => Accessor<T>;
3
- export { createPrevious };
@@ -1,2 +0,0 @@
1
- declare const showModal: () => void;
2
- export { showModal };