unwrapped 0.1.11 → 0.1.13

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.
@@ -13,7 +13,7 @@ interface ReactiveProcessOptions {
13
13
  * @param asyncResult the result to make reactive
14
14
  * @returns the ref to the result
15
15
  */
16
- declare function useAsyncResultRef<T, E extends ErrorBase = ErrorBase>(asyncResult?: AsyncResult<T, E>): Ref<AsyncResult<T, E, unknown>, AsyncResult<T, E, unknown>>;
16
+ declare function useAsyncResultRef<T, E extends ErrorBase = ErrorBase, P = unknown>(asyncResult?: AsyncResult<T, E, P>): Ref<AsyncResult<T, E, P>, AsyncResult<T, E, P>>;
17
17
  /**
18
18
  * Creates an AsyncResult ref from a promise returning a Result.
19
19
  * @param promise the promise returning a Result
@@ -32,8 +32,8 @@ declare function useReactiveChain<Inputs, T, E extends ErrorBase = ErrorBase>(so
32
32
  /**
33
33
  * The return type of useLazyAction.
34
34
  */
35
- interface LazyActionRef<T, E extends ErrorBase = ErrorBase> {
36
- resultRef: Ref<AsyncResult<T, E>>;
35
+ interface LazyActionRef<T, E extends ErrorBase = ErrorBase, P = unknown> {
36
+ resultRef: Ref<AsyncResult<T, E, P>>;
37
37
  trigger: () => void;
38
38
  }
39
39
  /**
@@ -44,7 +44,7 @@ interface LazyActionRef<T, E extends ErrorBase = ErrorBase> {
44
44
  * @param action the action to execute immediately
45
45
  * @returns a ref to the AsyncResult representing the action's state
46
46
  */
47
- declare function useAction<T, E extends ErrorBase = ErrorBase>(action: Action<T, E>): Ref<AsyncResult<T, E>>;
47
+ declare function useAction<T, E extends ErrorBase = ErrorBase, P = unknown>(action: Action<T, E, P>): Ref<AsyncResult<T, E, P>>;
48
48
  /**
49
49
  * Creates a lazy action that can be triggered manually.
50
50
  *
@@ -53,21 +53,21 @@ declare function useAction<T, E extends ErrorBase = ErrorBase>(action: Action<T,
53
53
  * @param action the action to execute when triggered
54
54
  * @returns an object containing a ref to the AsyncResult and a trigger function
55
55
  */
56
- declare function useLazyAction<T, E extends ErrorBase = ErrorBase>(action: Action<T, E>): LazyActionRef<T, E>;
56
+ declare function useLazyAction<T, E extends ErrorBase = ErrorBase, P = unknown>(action: Action<T, E, P>): LazyActionRef<T, E, P>;
57
57
  /**
58
58
  * Runs a generator function immediately and returns a ref to the AsyncResult representing the generator's state.
59
59
  * @param generatorFunc the generator function to run immediately
60
60
  * @returns a ref to the AsyncResult representing the generator's state
61
61
  */
62
- declare function useGenerator<T>(generatorFunc: () => AsyncResultGenerator<T>): Ref<AsyncResult<T, any>>;
62
+ declare function useGenerator<T, P = unknown>(generatorFunc: (notifyProgress?: (progress: P) => void) => AsyncResultGenerator<T>): Ref<AsyncResult<T, any, P>>;
63
63
  /**
64
64
  * Creates a lazy generator that can be triggered manually.
65
65
  *
66
66
  * @param generatorFunc the generator function to run when triggered
67
67
  * @returns an object containing a ref to the AsyncResult and a trigger function
68
68
  */
69
- declare function useLazyGenerator<T>(generatorFunc: () => AsyncResultGenerator<T>): {
70
- resultRef: Ref<AsyncResult<T, any>>;
69
+ declare function useLazyGenerator<T, P = unknown>(generatorFunc: () => AsyncResultGenerator<T>): {
70
+ resultRef: Ref<AsyncResult<T, any, P>>;
71
71
  trigger: () => void;
72
72
  };
73
73
  /**
@@ -78,7 +78,7 @@ declare function useLazyGenerator<T>(generatorFunc: () => AsyncResultGenerator<T
78
78
  * @param options optional settings
79
79
  * @returns ref to the result
80
80
  */
81
- declare function useReactiveGenerator<Inputs, T, E extends ErrorBase = ErrorBase>(source: WatchSource<Inputs>, generatorFunc: (args: Inputs) => AsyncResultGenerator<T>, options?: ReactiveProcessOptions): Ref<AsyncResult<T, E>>;
81
+ declare function useReactiveGenerator<Inputs, T, E extends ErrorBase = ErrorBase, P = unknown>(source: WatchSource<Inputs>, generatorFunc: (args: Inputs) => AsyncResultGenerator<T>, options?: ReactiveProcessOptions): Ref<AsyncResult<T, E, P>>;
82
82
  /**
83
83
  * Creates a reactive AsyncResultCollection wrapped in a Vue ref.
84
84
  * The AsyncResultCollection notifies Vue's reactivity system whenever its state changes.
@@ -137,7 +137,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
137
137
  updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
138
138
  chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
139
139
  flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
140
- runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
140
+ runInPlace: (generatorFunc: (notifyProgress: (progress: unknown) => void) => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
141
141
  log: (name?: string) => void;
142
142
  debug: (name?: string) => () => void;
143
143
  [Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
@@ -192,7 +192,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
192
192
  updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
193
193
  chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
194
194
  flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
195
- runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
195
+ runInPlace: (generatorFunc: (notifyProgress: (progress: unknown) => void) => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
196
196
  log: (name?: string) => void;
197
197
  debug: (name?: string) => () => void;
198
198
  [Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
@@ -244,7 +244,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
244
244
  updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
245
245
  chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
246
246
  flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
247
- runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
247
+ runInPlace: (generatorFunc: (notifyProgress: (progress: unknown) => void) => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
248
248
  log: (name?: string) => void;
249
249
  debug: (name?: string) => () => void;
250
250
  [Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
@@ -317,7 +317,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
317
317
  updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
318
318
  chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
319
319
  flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
320
- runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
320
+ runInPlace: (generatorFunc: (notifyProgress: (progress: unknown) => void) => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
321
321
  log: (name?: string) => void;
322
322
  debug: (name?: string) => () => void;
323
323
  [Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
@@ -372,7 +372,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
372
372
  updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
373
373
  chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
374
374
  flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
375
- runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
375
+ runInPlace: (generatorFunc: (notifyProgress: (progress: unknown) => void) => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
376
376
  log: (name?: string) => void;
377
377
  debug: (name?: string) => () => void;
378
378
  [Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
@@ -424,7 +424,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
424
424
  updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
425
425
  chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
426
426
  flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
427
- runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
427
+ runInPlace: (generatorFunc: (notifyProgress: (progress: unknown) => void) => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
428
428
  log: (name?: string) => void;
429
429
  debug: (name?: string) => () => void;
430
430
  [Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
@@ -449,8 +449,10 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
449
449
  debug: (name?: string) => () => void;
450
450
  }>;
451
451
 
452
- interface CustomSlots<E extends ErrorBase = ErrorBase> {
453
- loading?: () => VNode;
452
+ interface CustomSlots<E extends ErrorBase = ErrorBase, P = unknown> {
453
+ loading?: (props: {
454
+ progress?: P;
455
+ }) => VNode;
454
456
  error?: (props: {
455
457
  error: E;
456
458
  }) => VNode;
@@ -477,9 +479,9 @@ interface CustomSlots<E extends ErrorBase = ErrorBase> {
477
479
  * </template>
478
480
  * </MyLoader>
479
481
  */
480
- declare function makeAsyncResultLoader<T, E extends ErrorBase = ErrorBase>(slots: CustomSlots<E>, name?: string): vue.DefineComponent<vue.ExtractPropTypes<{
482
+ declare function makeAsyncResultLoader<T, E extends ErrorBase = ErrorBase, P = unknown>(slots: CustomSlots<E, P>, name?: string): vue.DefineComponent<vue.ExtractPropTypes<{
481
483
  result: {
482
- type: () => AsyncResult<T, E>;
484
+ type: () => AsyncResult<T, E, P>;
483
485
  required: true;
484
486
  };
485
487
  }>, () => VNode<vue.RendererNode, vue.RendererElement, {
@@ -488,10 +490,10 @@ declare function makeAsyncResultLoader<T, E extends ErrorBase = ErrorBase>(slots
488
490
  [key: string]: any;
489
491
  }>[], {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
490
492
  result: {
491
- type: () => AsyncResult<T, E>;
493
+ type: () => AsyncResult<T, E, P>;
492
494
  required: true;
493
495
  };
494
- }>> & Readonly<{}>, {}, SlotsType<CustomSlots<E> & {
496
+ }>> & Readonly<{}>, {}, SlotsType<CustomSlots<E, P> & {
495
497
  default: {
496
498
  value: T;
497
499
  };
package/dist/vue/index.js CHANGED
@@ -66,7 +66,7 @@ function useReactiveChain(source, pipe, options = { immediate: true }) {
66
66
  return resultRef;
67
67
  }
68
68
  function useAction(action) {
69
- return useAsyncResultRefFromPromise(action());
69
+ return useAsyncResultRef(import_core.AsyncResult.fromAction(action));
70
70
  }
71
71
  function useLazyAction(action) {
72
72
  const lazyAction = import_core.AsyncResult.makeLazyAction(action);
@@ -132,7 +132,7 @@ function makeAsyncResultLoader(slots, name = "AsyncResultLoader") {
132
132
  const renderIdle = context.slots.idle ?? slots.idle ?? (() => (0, import_vue2.h)("div", { class: "idle" }, "Idle"));
133
133
  switch (s.status) {
134
134
  case "loading":
135
- return renderLoading();
135
+ return renderLoading({ progress: s.progress });
136
136
  case "error":
137
137
  return renderError({ error: s.error });
138
138
  case "success":
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/vue/index.ts","../../src/vue/composables.ts","../../src/vue/components/asyncResultLoader.ts"],"sourcesContent":["export * from \"./composables\"\nexport * from \"./components/asyncResultLoader\"","import { onUnmounted, ref, triggerRef, watch, type Ref, type WatchSource } from \"vue\";\nimport { AsyncResult, AsyncResultCollection, ErrorBase, type Action, type AsyncResultGenerator, type FlatChainStep, type Result } from \"unwrapped/core\";\n\n\n// === Vue specific types ===\n\ninterface ReactiveProcessOptions {\n immediate: boolean;\n}\n\n\n\n// === Vue Composables for AsyncResult ===\n\n/**\n * Makes a ref to the given AsyncResult. Whenever the state of the AsyncResult changes,\n * the ref gets retriggered, making those changes visible to Vue's reactivity system.\n * \n * @param asyncResult the result to make reactive\n * @returns the ref to the result\n */\nexport function useAsyncResultRef<T, E extends ErrorBase = ErrorBase>(asyncResult?: AsyncResult<T, E>) {\n if (!asyncResult) {\n asyncResult = new AsyncResult<T, E>();\n }\n const state = ref<AsyncResult<T, E>>(asyncResult) as Ref<AsyncResult<T, E>>;\n\n const unsub = asyncResult.listen(() => {\n triggerRef(state);\n });\n\n onUnmounted(() => {\n unsub();\n });\n\n return state;\n}\n\n/**\n * Creates an AsyncResult ref from a promise returning a Result.\n * @param promise the promise returning a Result\n * @returns the ref to the AsyncResult\n */\nexport function useAsyncResultRefFromPromise<T, E extends ErrorBase = ErrorBase>(promise: Promise<Result<T, E>>) {\n return useAsyncResultRef(AsyncResult.fromResultPromise(promise));\n}\n\n\n\n// === Vue Composables for Chains ===\n\n/**\n * Watches a source, gives it as inputs to the function provided, and updates the result contained in the ref accordingly.\n * \n * @param source the inputs to react to\n * @param pipe the function to run when the inputs change\n * @param options optional settings\n * @returns ref to the result\n */\nexport function useReactiveChain<Inputs, T, E extends ErrorBase = ErrorBase>(source: WatchSource<Inputs>, pipe: FlatChainStep<Inputs, T, E>, options: ReactiveProcessOptions = { immediate: true }): Ref<AsyncResult<T, E>> {\n const result = new AsyncResult<T, E>();\n const resultRef = useAsyncResultRef(result);\n\n let unsub: (() => void) | null = null;\n\n watch(source, (newInputs) => {\n unsub?.();\n unsub = result.mirror(pipe(newInputs));\n }, { immediate: options.immediate });\n\n onUnmounted(() => {\n unsub?.();\n });\n\n return resultRef;\n}\n\n\n// === Vue Composables for Actions ===\n\n/**\n * The return type of useLazyAction.\n */\nexport interface LazyActionRef<T, E extends ErrorBase = ErrorBase> {\n resultRef: Ref<AsyncResult<T, E>>;\n trigger: () => void;\n}\n\n/**\n * Executes an action immediately and returns a ref to the AsyncResult representing the action's state.\n * \n * Same as useAsyncResultRefFromPromise(action()).\n * \n * @param action the action to execute immediately\n * @returns a ref to the AsyncResult representing the action's state\n */\nexport function useAction<T, E extends ErrorBase = ErrorBase>(action: Action<T, E>): Ref<AsyncResult<T, E>> {\n return useAsyncResultRefFromPromise(action());\n}\n\n/**\n * Creates a lazy action that can be triggered manually.\n * \n * Same as AsyncResult.makeLazyAction(action), but the AsyncResult is wrapped in a ref for Vue reactivity.\n * \n * @param action the action to execute when triggered\n * @returns an object containing a ref to the AsyncResult and a trigger function\n */\nexport function useLazyAction<T, E extends ErrorBase = ErrorBase>(action: Action<T, E>): LazyActionRef<T, E> {\n const lazyAction = AsyncResult.makeLazyAction<T, E>(action);\n const resultRef = useAsyncResultRef(lazyAction.result);\n\n return { resultRef, trigger: lazyAction.trigger };\n}\n\n\n// === Vue Composables for Generators ===\n\n/**\n * Runs a generator function immediately and returns a ref to the AsyncResult representing the generator's state.\n * @param generatorFunc the generator function to run immediately\n * @returns a ref to the AsyncResult representing the generator's state\n */\nexport function useGenerator<T>(generatorFunc: () => AsyncResultGenerator<T>): Ref<AsyncResult<T, any>> {\n const resultRef = useAsyncResultRef(AsyncResult.run(generatorFunc));\n return resultRef;\n}\n\n/**\n * Creates a lazy generator that can be triggered manually.\n * \n * @param generatorFunc the generator function to run when triggered\n * @returns an object containing a ref to the AsyncResult and a trigger function\n */\nexport function useLazyGenerator<T>(generatorFunc: () => AsyncResultGenerator<T>): { resultRef: Ref<AsyncResult<T, any>>, trigger: () => void } {\n const result = new AsyncResult<T, any>();\n const resultRef = useAsyncResultRef(result);\n\n const trigger = () => {\n result.runInPlace(generatorFunc);\n }\n\n return { resultRef, trigger };\n}\n\n/**\n * Watches a source, gives it as inputs to the generator function provided, and updates the result contained in the ref accordingly.\n * \n * @param source the inputs to react to\n * @param generatorFunc the generator function to run when the inputs change\n * @param options optional settings\n * @returns ref to the result\n */\nexport function useReactiveGenerator<Inputs, T, E extends ErrorBase = ErrorBase>(source: WatchSource<Inputs>, generatorFunc: (args: Inputs) => AsyncResultGenerator<T>, options: ReactiveProcessOptions = { immediate: true }): Ref<AsyncResult<T, E>> {\n const resultRef = useAsyncResultRef(new AsyncResult<T, E>());\n\n watch(source, (newInputs) => {\n resultRef.value.runInPlace(() => generatorFunc(newInputs));\n }, { immediate: options.immediate });\n\n return resultRef;\n}\n\n\n// === Vue Composables for AsyncResultCollection ===\n\n/**\n * Creates a reactive AsyncResultCollection wrapped in a Vue ref.\n * The AsyncResultCollection notifies Vue's reactivity system whenever its state changes.\n * \n * @template T - The type of the values in the AsyncResultCollection.\n * @template E - The type of the error, extending ErrorBase (default is ErrorBase).\n * @returns a ref to the AsyncResultCollection\n */\nexport function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBase>() {\n const list = new AsyncResultCollection<T, E>();\n const listRef = ref(list);\n\n list.listen(() => {\n triggerRef(listRef);\n });\n\n return listRef;\n}","import { defineComponent, watch, h, type VNode, type SlotsType } from \"vue\"\nimport { ErrorBase, type AsyncResult } from \"unwrapped/core\"\nimport { useAsyncResultRef } from \"../composables\"\n\ninterface CustomSlots<E extends ErrorBase = ErrorBase> {\n loading?: () => VNode;\n error?: (props: { error: E }) => VNode;\n idle?: () => VNode;\n}\n\n/**\n * Factory function to create a component that displays different content based on an AsyncResult's state. Provides slots for loading, error, idle, and success states and passes the relevant data to each slot, and are typed appropriately.\n * @param slots predefined slots for loading, error, and idle states. Useful for not having to repeat the same template for displaying a framework-specific spinner while in loading state, or a custom error message.\n * @param name Optional internal name for the component\n * @returns An instantiable component that accepts an AsyncResult prop and a default slot for the success state.\n * \n * @example\n * // loaders.ts - Create reusable loader with default loading/error UI\n * const MyLoader = makeAsyncResultLoader({\n * loading: () => h(Spinner),\n * error: ({ error }) => h(ErrorDisplay, { error }),\n * idle: () => h('div', 'Ready')\n * });\n * \n * // MyPage.vue - Use the loader with custom success content\n * <MyLoader :result=\"myAsyncResult\">\n * <template #default=\"{ value }\">\n * <UserProfile :user=\"value\" />\n * </template>\n * </MyLoader>\n */\nexport function makeAsyncResultLoader<T, E extends ErrorBase = ErrorBase>(slots: CustomSlots<E>, name = \"AsyncResultLoader\") {\n return defineComponent({\n name,\n props: {\n result: {\n type: Object as () => AsyncResult<T, E>,\n required: true\n }\n },\n slots: Object as SlotsType<CustomSlots<E> & { default: { value: T } }>,\n setup(props, context) {\n let resultRef = useAsyncResultRef(props.result);\n\n // Watch for prop changes & update listener\n watch(\n () => props.result,\n (newResult, oldResult) => {\n if (newResult === oldResult) return;\n resultRef = useAsyncResultRef(newResult);\n },\n { immediate: true }\n )\n\n return () => {\n const s = resultRef.value.state;\n\n const renderDefault = context.slots.default ?? (() => h(\"div\", { class: \"success\" }, \"Success\"));\n const renderError = context.slots.error ?? slots.error ?? (() => h(\"div\", { class: \"error\" }, \"Error\"));\n const renderLoading = context.slots.loading ?? slots.loading ?? (() => h(\"div\", { class: \"loading\" }, \"Loading…\"));\n const renderIdle = context.slots.idle ?? slots.idle ?? (() => h(\"div\", { class: \"idle\" }, \"Idle\"));\n\n // Choose what to render based on status\n switch (s.status) {\n case \"loading\":\n return renderLoading();\n\n case \"error\":\n return renderError({ error: s.error });\n\n case \"success\":\n return renderDefault({ value: s.value });\n\n default:\n return renderIdle();\n }\n }\n }\n })\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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OAAO,UAAU,GAAG,eAAU;AAChH,cAAM,aAAa,QAAQ,MAAM,QAAQ,MAAM,SAAS,UAAM,eAAE,OAAO,EAAE,OAAO,OAAO,GAAG,MAAM;AAGhG,gBAAQ,EAAE,QAAQ;AAAA,UACd,KAAK;AACD,mBAAO,cAAc;AAAA,UAEzB,KAAK;AACD,mBAAO,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC;AAAA,UAEzC,KAAK;AACD,mBAAO,cAAc,EAAE,OAAO,EAAE,MAAM,CAAC;AAAA,UAE3C;AACI,mBAAO,WAAW;AAAA,QAC1B;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ,CAAC;AACL;","names":["import_vue","import_core"]}
1
+ {"version":3,"sources":["../../src/vue/index.ts","../../src/vue/composables.ts","../../src/vue/components/asyncResultLoader.ts"],"sourcesContent":["export * from \"./composables\"\nexport * from \"./components/asyncResultLoader\"","import { onUnmounted, ref, triggerRef, watch, type Ref, type WatchSource } from \"vue\";\nimport { AsyncResult, AsyncResultCollection, ErrorBase, type Action, type AsyncResultGenerator, type FlatChainStep, type Result } from \"unwrapped/core\";\n\n\n// === Vue specific types ===\n\ninterface ReactiveProcessOptions {\n immediate: boolean;\n}\n\n\n\n// === Vue Composables for AsyncResult ===\n\n/**\n * Makes a ref to the given AsyncResult. Whenever the state of the AsyncResult changes,\n * the ref gets retriggered, making those changes visible to Vue's reactivity system.\n * \n * @param asyncResult the result to make reactive\n * @returns the ref to the result\n */\nexport function useAsyncResultRef<T, E extends ErrorBase = ErrorBase, P = unknown>(asyncResult?: AsyncResult<T, E, P>) {\n if (!asyncResult) {\n asyncResult = new AsyncResult<T, E, P>();\n }\n const state = ref<AsyncResult<T, E, P>>(asyncResult) as Ref<AsyncResult<T, E, P>>;\n\n const unsub = asyncResult.listen(() => {\n triggerRef(state);\n });\n\n onUnmounted(() => {\n unsub();\n });\n\n return state;\n}\n\n/**\n * Creates an AsyncResult ref from a promise returning a Result.\n * @param promise the promise returning a Result\n * @returns the ref to the AsyncResult\n */\nexport function useAsyncResultRefFromPromise<T, E extends ErrorBase = ErrorBase>(promise: Promise<Result<T, E>>) {\n return useAsyncResultRef(AsyncResult.fromResultPromise(promise));\n}\n\n\n\n// === Vue Composables for Chains ===\n\n/**\n * Watches a source, gives it as inputs to the function provided, and updates the result contained in the ref accordingly.\n * \n * @param source the inputs to react to\n * @param pipe the function to run when the inputs change\n * @param options optional settings\n * @returns ref to the result\n */\nexport function useReactiveChain<Inputs, T, E extends ErrorBase = ErrorBase>(source: WatchSource<Inputs>, pipe: FlatChainStep<Inputs, T, E>, options: ReactiveProcessOptions = { immediate: true }): Ref<AsyncResult<T, E>> {\n const result = new AsyncResult<T, E>();\n const resultRef = useAsyncResultRef(result);\n\n let unsub: (() => void) | null = null;\n\n watch(source, (newInputs) => {\n unsub?.();\n unsub = result.mirror(pipe(newInputs));\n }, { immediate: options.immediate });\n\n onUnmounted(() => {\n unsub?.();\n });\n\n return resultRef;\n}\n\n\n// === Vue Composables for Actions ===\n\n/**\n * The return type of useLazyAction.\n */\nexport interface LazyActionRef<T, E extends ErrorBase = ErrorBase, P = unknown> {\n resultRef: Ref<AsyncResult<T, E, P>>;\n trigger: () => void;\n}\n\n/**\n * Executes an action immediately and returns a ref to the AsyncResult representing the action's state.\n * \n * Same as useAsyncResultRefFromPromise(action()).\n * \n * @param action the action to execute immediately\n * @returns a ref to the AsyncResult representing the action's state\n */\nexport function useAction<T, E extends ErrorBase = ErrorBase, P = unknown>(action: Action<T, E, P>): Ref<AsyncResult<T, E, P>> {\n return useAsyncResultRef(AsyncResult.fromAction(action));\n}\n\n/**\n * Creates a lazy action that can be triggered manually.\n * \n * Same as AsyncResult.makeLazyAction(action), but the AsyncResult is wrapped in a ref for Vue reactivity.\n * \n * @param action the action to execute when triggered\n * @returns an object containing a ref to the AsyncResult and a trigger function\n */\nexport function useLazyAction<T, E extends ErrorBase = ErrorBase, P = unknown>(action: Action<T, E, P>): LazyActionRef<T, E, P> {\n const lazyAction = AsyncResult.makeLazyAction<T, E, P>(action);\n const resultRef = useAsyncResultRef(lazyAction.result);\n\n return { resultRef, trigger: lazyAction.trigger };\n}\n\n\n// === Vue Composables for Generators ===\n\n/**\n * Runs a generator function immediately and returns a ref to the AsyncResult representing the generator's state.\n * @param generatorFunc the generator function to run immediately\n * @returns a ref to the AsyncResult representing the generator's state\n */\nexport function useGenerator<T, P = unknown>(generatorFunc: (notifyProgress?: (progress: P) => void) => AsyncResultGenerator<T>): Ref<AsyncResult<T, any, P>> {\n const resultRef = useAsyncResultRef(AsyncResult.run(generatorFunc));\n return resultRef;\n}\n\n/**\n * Creates a lazy generator that can be triggered manually.\n * \n * @param generatorFunc the generator function to run when triggered\n * @returns an object containing a ref to the AsyncResult and a trigger function\n */\nexport function useLazyGenerator<T, P = unknown>(generatorFunc: () => AsyncResultGenerator<T>): { resultRef: Ref<AsyncResult<T, any, P>>, trigger: () => void } {\n const result = new AsyncResult<T, any, P>();\n const resultRef = useAsyncResultRef(result);\n\n const trigger = () => {\n result.runInPlace(generatorFunc);\n }\n\n return { resultRef, trigger };\n}\n\n/**\n * Watches a source, gives it as inputs to the generator function provided, and updates the result contained in the ref accordingly.\n * \n * @param source the inputs to react to\n * @param generatorFunc the generator function to run when the inputs change\n * @param options optional settings\n * @returns ref to the result\n */\nexport function useReactiveGenerator<Inputs, T, E extends ErrorBase = ErrorBase, P = unknown>(source: WatchSource<Inputs>, generatorFunc: (args: Inputs) => AsyncResultGenerator<T>, options: ReactiveProcessOptions = { immediate: true }): Ref<AsyncResult<T, E, P>> {\n const resultRef = useAsyncResultRef(new AsyncResult<T, E, P>());\n\n watch(source, (newInputs) => {\n resultRef.value.runInPlace(() => generatorFunc(newInputs));\n }, { immediate: options.immediate });\n\n return resultRef;\n}\n\n\n// === Vue Composables for AsyncResultCollection ===\n\n/**\n * Creates a reactive AsyncResultCollection wrapped in a Vue ref.\n * The AsyncResultCollection notifies Vue's reactivity system whenever its state changes.\n * \n * @template T - The type of the values in the AsyncResultCollection.\n * @template E - The type of the error, extending ErrorBase (default is ErrorBase).\n * @returns a ref to the AsyncResultCollection\n */\nexport function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBase>() {\n const list = new AsyncResultCollection<T, E>();\n const listRef = ref(list);\n\n list.listen(() => {\n triggerRef(listRef);\n });\n\n return listRef;\n}","import { defineComponent, watch, h, type VNode, type SlotsType } from \"vue\"\nimport { ErrorBase, type AsyncResult } from \"unwrapped/core\"\nimport { useAsyncResultRef } from \"../composables\"\n\ninterface CustomSlots<E extends ErrorBase = ErrorBase, P = unknown> {\n loading?: (props: { progress?: P }) => VNode;\n error?: (props: { error: E }) => VNode;\n idle?: () => VNode;\n}\n\n/**\n * Factory function to create a component that displays different content based on an AsyncResult's state. Provides slots for loading, error, idle, and success states and passes the relevant data to each slot, and are typed appropriately.\n * @param slots predefined slots for loading, error, and idle states. Useful for not having to repeat the same template for displaying a framework-specific spinner while in loading state, or a custom error message.\n * @param name Optional internal name for the component\n * @returns An instantiable component that accepts an AsyncResult prop and a default slot for the success state.\n * \n * @example\n * // loaders.ts - Create reusable loader with default loading/error UI\n * const MyLoader = makeAsyncResultLoader({\n * loading: () => h(Spinner),\n * error: ({ error }) => h(ErrorDisplay, { error }),\n * idle: () => h('div', 'Ready')\n * });\n * \n * // MyPage.vue - Use the loader with custom success content\n * <MyLoader :result=\"myAsyncResult\">\n * <template #default=\"{ value }\">\n * <UserProfile :user=\"value\" />\n * </template>\n * </MyLoader>\n */\nexport function makeAsyncResultLoader<T, E extends ErrorBase = ErrorBase, P = unknown>(slots: CustomSlots<E, P>, name = \"AsyncResultLoader\") {\n return defineComponent({\n name,\n props: {\n result: {\n type: Object as () => AsyncResult<T, E, P>,\n required: true\n }\n },\n slots: Object as SlotsType<CustomSlots<E, P> & { default: { value: T } }>,\n setup(props, context) {\n let resultRef = useAsyncResultRef(props.result);\n\n // Watch for prop changes & update listener\n watch(\n () => props.result,\n (newResult, oldResult) => {\n if (newResult === oldResult) return;\n resultRef = useAsyncResultRef(newResult);\n },\n { immediate: true }\n )\n\n return () => {\n const s = resultRef.value.state;\n\n const renderDefault = context.slots.default ?? (() => h(\"div\", { class: \"success\" }, \"Success\"));\n const renderError = context.slots.error ?? slots.error ?? (() => h(\"div\", { class: \"error\" }, \"Error\"));\n const renderLoading = context.slots.loading ?? slots.loading ?? (() => h(\"div\", { class: \"loading\" }, \"Loading…\"));\n const renderIdle = context.slots.idle ?? slots.idle ?? (() => h(\"div\", { class: \"idle\" }, \"Idle\"));\n\n // Choose what to render based on status\n switch (s.status) {\n case \"loading\":\n return renderLoading({ progress: s.progress });\n\n case \"error\":\n return renderError({ error: s.error });\n\n case \"success\":\n return renderDefault({ value: s.value });\n\n default:\n return renderIdle();\n }\n }\n }\n })\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAgF;AAChF,kBAAuI;AAoBhI,SAAS,kBAAmE,aAAoC;AACnH,MAAI,CAAC,aAAa;AACd,kBAAc,IAAI,wBAAqB;AAAA,EAC3C;AACA,QAAM,YAAQ,gBAA0B,WAAW;AAEnD,QAAM,QAAQ,YAAY,OAAO,MAAM;AACnC,+BAAW,KAAK;AAAA,EACpB,CAAC;AAED,8BAAY,MAAM;AACd,UAAM;AAAA,EACV,CAAC;AAED,SAAO;AACX;AAOO,SAAS,6BAAiE,SAAgC;AAC7G,SAAO,kBAAkB,wBAAY,kBAAkB,OAAO,CAAC;AACnE;AAcO,SAAS,iBAA6D,QAA6B,MAAmC,UAAkC,EAAE,WAAW,KAAK,GAA2B;AACxN,QAAM,SAAS,IAAI,wBAAkB;AACrC,QAAM,YAAY,kBAAkB,MAAM;AAE1C,MAAI,QAA6B;AAEjC,wBAAM,QAAQ,CAAC,cAAc;AACzB,YAAQ;AACR,YAAQ,OAAO,OAAO,KAAK,SAAS,CAAC;AAAA,EACzC,GAAG,EAAE,W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AU;AAAA,MACd;AAAA,IACJ;AAAA,IACA,OAAO;AAAA,IACP,MAAM,OAAO,SAAS;AAClB,UAAI,YAAY,kBAAkB,MAAM,MAAM;AAG9C;AAAA,QACI,MAAM,MAAM;AAAA,QACZ,CAAC,WAAW,cAAc;AACtB,cAAI,cAAc,UAAW;AAC7B,sBAAY,kBAAkB,SAAS;AAAA,QAC3C;AAAA,QACA,EAAE,WAAW,KAAK;AAAA,MACtB;AAEA,aAAO,MAAM;AACT,cAAM,IAAI,UAAU,MAAM;AAE1B,cAAM,gBAAgB,QAAQ,MAAM,YAAY,UAAM,eAAE,OAAO,EAAE,OAAO,UAAU,GAAG,SAAS;AAC9F,cAAM,cAAc,QAAQ,MAAM,SAAS,MAAM,UAAU,UAAM,eAAE,OAAO,EAAE,OAAO,QAAQ,GAAG,OAAO;AACrG,cAAM,gBAAgB,QAAQ,MAAM,WAAW,MAAM,YAAY,UAAM,eAAE,OAAO,EAAE,OAAO,UAAU,GAAG,eAAU;AAChH,cAAM,aAAa,QAAQ,MAAM,QAAQ,MAAM,SAAS,UAAM,eAAE,OAAO,EAAE,OAAO,OAAO,GAAG,MAAM;AAGhG,gBAAQ,EAAE,QAAQ;AAAA,UACd,KAAK;AACD,mBAAO,cAAc,EAAE,UAAU,EAAE,SAAS,CAAC;AAAA,UAEjD,KAAK;AACD,mBAAO,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC;AAAA,UAEzC,KAAK;AACD,mBAAO,cAAc,EAAE,OAAO,EAAE,MAAM,CAAC;AAAA,UAE3C;AACI,mBAAO,WAAW;AAAA,QAC1B;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ,CAAC;AACL;","names":["import_vue","import_core"]}
@@ -31,7 +31,7 @@ function useReactiveChain(source, pipe, options = { immediate: true }) {
31
31
  return resultRef;
32
32
  }
33
33
  function useAction(action) {
34
- return useAsyncResultRefFromPromise(action());
34
+ return useAsyncResultRef(AsyncResult.fromAction(action));
35
35
  }
36
36
  function useLazyAction(action) {
37
37
  const lazyAction = AsyncResult.makeLazyAction(action);
@@ -97,7 +97,7 @@ function makeAsyncResultLoader(slots, name = "AsyncResultLoader") {
97
97
  const renderIdle = context.slots.idle ?? slots.idle ?? (() => h("div", { class: "idle" }, "Idle"));
98
98
  switch (s.status) {
99
99
  case "loading":
100
- return renderLoading();
100
+ return renderLoading({ progress: s.progress });
101
101
  case "error":
102
102
  return renderError({ error: s.error });
103
103
  case "success":
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/vue/composables.ts","../../src/vue/components/asyncResultLoader.ts"],"sourcesContent":["import { onUnmounted, ref, triggerRef, watch, type Ref, type WatchSource } from \"vue\";\nimport { AsyncResult, AsyncResultCollection, ErrorBase, type Action, type AsyncResultGenerator, type FlatChainStep, type Result } from \"unwrapped/core\";\n\n\n// === Vue specific types ===\n\ninterface ReactiveProcessOptions {\n immediate: boolean;\n}\n\n\n\n// === Vue Composables for AsyncResult ===\n\n/**\n * Makes a ref to the given AsyncResult. Whenever the state of the AsyncResult changes,\n * the ref gets retriggered, making those changes visible to Vue's reactivity system.\n * \n * @param asyncResult the result to make reactive\n * @returns the ref to the result\n */\nexport function useAsyncResultRef<T, E extends ErrorBase = ErrorBase>(asyncResult?: AsyncResult<T, E>) {\n if (!asyncResult) {\n asyncResult = new AsyncResult<T, E>();\n }\n const state = ref<AsyncResult<T, E>>(asyncResult) as Ref<AsyncResult<T, E>>;\n\n const unsub = asyncResult.listen(() => {\n triggerRef(state);\n });\n\n onUnmounted(() => {\n unsub();\n });\n\n return state;\n}\n\n/**\n * Creates an AsyncResult ref from a promise returning a Result.\n * @param promise the promise returning a Result\n * @returns the ref to the AsyncResult\n */\nexport function useAsyncResultRefFromPromise<T, E extends ErrorBase = ErrorBase>(promise: Promise<Result<T, E>>) {\n return useAsyncResultRef(AsyncResult.fromResultPromise(promise));\n}\n\n\n\n// === Vue Composables for Chains ===\n\n/**\n * Watches a source, gives it as inputs to the function provided, and updates the result contained in the ref accordingly.\n * \n * @param source the inputs to react to\n * @param pipe the function to run when the inputs change\n * @param options optional settings\n * @returns ref to the result\n */\nexport function useReactiveChain<Inputs, T, E extends ErrorBase = ErrorBase>(source: WatchSource<Inputs>, pipe: FlatChainStep<Inputs, T, E>, options: ReactiveProcessOptions = { immediate: true }): Ref<AsyncResult<T, E>> {\n const result = new AsyncResult<T, E>();\n const resultRef = useAsyncResultRef(result);\n\n let unsub: (() => void) | null = null;\n\n watch(source, (newInputs) => {\n unsub?.();\n unsub = result.mirror(pipe(newInputs));\n }, { immediate: options.immediate });\n\n onUnmounted(() => {\n unsub?.();\n });\n\n return resultRef;\n}\n\n\n// === Vue Composables for Actions ===\n\n/**\n * The return type of useLazyAction.\n */\nexport interface LazyActionRef<T, E extends ErrorBase = ErrorBase> {\n resultRef: Ref<AsyncResult<T, E>>;\n trigger: () => void;\n}\n\n/**\n * Executes an action immediately and returns a ref to the AsyncResult representing the action's state.\n * \n * Same as useAsyncResultRefFromPromise(action()).\n * \n * @param action the action to execute immediately\n * @returns a ref to the AsyncResult representing the action's state\n */\nexport function useAction<T, E extends ErrorBase = ErrorBase>(action: Action<T, E>): Ref<AsyncResult<T, E>> {\n return useAsyncResultRefFromPromise(action());\n}\n\n/**\n * Creates a lazy action that can be triggered manually.\n * \n * Same as AsyncResult.makeLazyAction(action), but the AsyncResult is wrapped in a ref for Vue reactivity.\n * \n * @param action the action to execute when triggered\n * @returns an object containing a ref to the AsyncResult and a trigger function\n */\nexport function useLazyAction<T, E extends ErrorBase = ErrorBase>(action: Action<T, E>): LazyActionRef<T, E> {\n const lazyAction = AsyncResult.makeLazyAction<T, E>(action);\n const resultRef = useAsyncResultRef(lazyAction.result);\n\n return { resultRef, trigger: lazyAction.trigger };\n}\n\n\n// === Vue Composables for Generators ===\n\n/**\n * Runs a generator function immediately and returns a ref to the AsyncResult representing the generator's state.\n * @param generatorFunc the generator function to run immediately\n * @returns a ref to the AsyncResult representing the generator's state\n */\nexport function useGenerator<T>(generatorFunc: () => AsyncResultGenerator<T>): Ref<AsyncResult<T, any>> {\n const resultRef = useAsyncResultRef(AsyncResult.run(generatorFunc));\n return resultRef;\n}\n\n/**\n * Creates a lazy generator that can be triggered manually.\n * \n * @param generatorFunc the generator function to run when triggered\n * @returns an object containing a ref to the AsyncResult and a trigger function\n */\nexport function useLazyGenerator<T>(generatorFunc: () => AsyncResultGenerator<T>): { resultRef: Ref<AsyncResult<T, any>>, trigger: () => void } {\n const result = new AsyncResult<T, any>();\n const resultRef = useAsyncResultRef(result);\n\n const trigger = () => {\n result.runInPlace(generatorFunc);\n }\n\n return { resultRef, trigger };\n}\n\n/**\n * Watches a source, gives it as inputs to the generator function provided, and updates the result contained in the ref accordingly.\n * \n * @param source the inputs to react to\n * @param generatorFunc the generator function to run when the inputs change\n * @param options optional settings\n * @returns ref to the result\n */\nexport function useReactiveGenerator<Inputs, T, E extends ErrorBase = ErrorBase>(source: WatchSource<Inputs>, generatorFunc: (args: Inputs) => AsyncResultGenerator<T>, options: ReactiveProcessOptions = { immediate: true }): Ref<AsyncResult<T, E>> {\n const resultRef = useAsyncResultRef(new AsyncResult<T, E>());\n\n watch(source, (newInputs) => {\n resultRef.value.runInPlace(() => generatorFunc(newInputs));\n }, { immediate: options.immediate });\n\n return resultRef;\n}\n\n\n// === Vue Composables for AsyncResultCollection ===\n\n/**\n * Creates a reactive AsyncResultCollection wrapped in a Vue ref.\n * The AsyncResultCollection notifies Vue's reactivity system whenever its state changes.\n * \n * @template T - The type of the values in the AsyncResultCollection.\n * @template E - The type of the error, extending ErrorBase (default is ErrorBase).\n * @returns a ref to the AsyncResultCollection\n */\nexport function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBase>() {\n const list = new AsyncResultCollection<T, E>();\n const listRef = ref(list);\n\n list.listen(() => {\n triggerRef(listRef);\n });\n\n return listRef;\n}","import { defineComponent, watch, h, type VNode, type SlotsType } from \"vue\"\nimport { ErrorBase, type AsyncResult } from \"unwrapped/core\"\nimport { useAsyncResultRef } from \"../composables\"\n\ninterface CustomSlots<E extends ErrorBase = ErrorBase> {\n loading?: () => VNode;\n error?: (props: { error: E }) => VNode;\n idle?: () => VNode;\n}\n\n/**\n * Factory function to create a component that displays different content based on an AsyncResult's state. Provides slots for loading, error, idle, and success states and passes the relevant data to each slot, and are typed appropriately.\n * @param slots predefined slots for loading, error, and idle states. Useful for not having to repeat the same template for displaying a framework-specific spinner while in loading state, or a custom error message.\n * @param name Optional internal name for the component\n * @returns An instantiable component that accepts an AsyncResult prop and a default slot for the success state.\n * \n * @example\n * // loaders.ts - Create reusable loader with default loading/error UI\n * const MyLoader = makeAsyncResultLoader({\n * loading: () => h(Spinner),\n * error: ({ error }) => h(ErrorDisplay, { error }),\n * idle: () => h('div', 'Ready')\n * });\n * \n * // MyPage.vue - Use the loader with custom success content\n * <MyLoader :result=\"myAsyncResult\">\n * <template #default=\"{ value }\">\n * <UserProfile :user=\"value\" />\n * </template>\n * </MyLoader>\n */\nexport function makeAsyncResultLoader<T, E extends ErrorBase = ErrorBase>(slots: CustomSlots<E>, name = \"AsyncResultLoader\") {\n return defineComponent({\n name,\n props: {\n result: {\n type: Object as () => AsyncResult<T, E>,\n required: true\n }\n },\n slots: Object as SlotsType<CustomSlots<E> & { default: { value: T } }>,\n setup(props, context) {\n let resultRef = useAsyncResultRef(props.result);\n\n // Watch for prop changes & update listener\n watch(\n () => props.result,\n (newResult, oldResult) => {\n if (newResult === oldResult) return;\n resultRef = useAsyncResultRef(newResult);\n },\n { immediate: true }\n )\n\n return () => {\n const s = resultRef.value.state;\n\n const renderDefault = context.slots.default ?? (() => h(\"div\", { class: \"success\" }, \"Success\"));\n const renderError = context.slots.error ?? slots.error ?? (() => h(\"div\", { class: \"error\" }, \"Error\"));\n const renderLoading = context.slots.loading ?? slots.loading ?? (() => h(\"div\", { class: \"loading\" }, \"Loading…\"));\n const renderIdle = context.slots.idle ?? slots.idle ?? (() => h(\"div\", { class: \"idle\" }, \"Idle\"));\n\n // Choose what to render based on status\n switch (s.status) {\n case \"loading\":\n return renderLoading();\n\n case \"error\":\n return renderError({ error: s.error });\n\n case \"success\":\n return renderDefault({ value: s.value });\n\n default:\n return renderIdle();\n }\n }\n }\n })\n}"],"mappings":";AAAA,SAAS,aAAa,KAAK,YAAY,aAAyC;AAChF,SAAS,aAAa,6BAAiH;AAoBhI,SAAS,kBAAsD,aAAiC;AACnG,MAAI,CAAC,aAAa;AACd,kBAAc,IAAI,YAAkB;AAAA,EACxC;AACA,QAAM,QAAQ,IAAuB,WAAW;AAEhD,QAAM,QAAQ,YAAY,OAAO,MAAM;AACnC,eAAW,KAAK;AAAA,EACpB,CAAC;AAED,cAAY,MAAM;AACd,UAAM;AAAA,EACV,CAAC;AAED,SAAO;AACX;AAOO,SAAS,6BAAiE,SAAgC;AAC7G,SAAO,kBAAkB,YAAY,kBAAkB,OAAO,CAAC;AACnE;AAcO,SAAS,iBAA6D,QAA6B,MAAmC,UAAkC,EAAE,WAAW,KAAK,GAA2B;AACxN,QAAM,SAAS,IAAI,YAAkB;AACrC,QAAM,YAAY,kBAAkB,MAAM;AAE1C,MAAI,QAA6B;AAEjC,QAAM,QAAQ,CAAC,cAAc;AACzB,YAAQ;AACR,YAAQ,OAAO,OAAO,KAAK,SAAS,CAAC;AAAA,EACzC,GAAG,EAAE,WAAW,QAAQ,UAAU,CAAC;AAEnC,cAAY,MAAM;AACd,YAAQ;AAAA,EACZ,CAAC;AAED,SAAO;AACX;AAqBO,SAAS,UAA8C,QAA8C;AACxG,SAAO,6BAA6B,OAAO,CAAC;AAChD;AAUO,SAAS,cAAkD,QAA2C;AACzG,QAAM,aAAa,YAAY,eAAqB,MAAM;AAC1D,QAAM,YAAY,kBAAkB,WAAW,MAAM;AAErD,SAAO,EAAE,WAAW,SAAS,WAAW,QAAQ;AACpD;AAUO,SAAS,aAAgB,eAAwE;AACpG,QAAM,YAAY,kBAAkB,YAAY,IAAI,aAAa,CAAC;AAClE,SAAO;AACX;AAQO,SAAS,iBAAoB,eAA4G;AAC5I,QAAM,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MAAM,UAAU,MAAM,EAAE,OAAO,EAAE,OAAO,QAAQ,GAAG,OAAO;AACrG,cAAM,gBAAgB,QAAQ,MAAM,WAAW,MAAM,YAAY,MAAM,EAAE,OAAO,EAAE,OAAO,UAAU,GAAG,eAAU;AAChH,cAAM,aAAa,QAAQ,MAAM,QAAQ,MAAM,SAAS,MAAM,EAAE,OAAO,EAAE,OAAO,OAAO,GAAG,MAAM;AAGhG,gBAAQ,EAAE,QAAQ;AAAA,UACd,KAAK;AACD,mBAAO,cAAc;AAAA,UAEzB,KAAK;AACD,mBAAO,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC;AAAA,UAEzC,KAAK;AACD,mBAAO,cAAc,EAAE,OAAO,EAAE,MAAM,CAAC;AAAA,UAE3C;AACI,mBAAO,WAAW;AAAA,QAC1B;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ,CAAC;AACL;","names":["watch","watch"]}
1
+ {"version":3,"sources":["../../src/vue/composables.ts","../../src/vue/components/asyncResultLoader.ts"],"sourcesContent":["import { onUnmounted, ref, triggerRef, watch, type Ref, type WatchSource } from \"vue\";\nimport { AsyncResult, AsyncResultCollection, ErrorBase, type Action, type AsyncResultGenerator, type FlatChainStep, type Result } from \"unwrapped/core\";\n\n\n// === Vue specific types ===\n\ninterface ReactiveProcessOptions {\n immediate: boolean;\n}\n\n\n\n// === Vue Composables for AsyncResult ===\n\n/**\n * Makes a ref to the given AsyncResult. Whenever the state of the AsyncResult changes,\n * the ref gets retriggered, making those changes visible to Vue's reactivity system.\n * \n * @param asyncResult the result to make reactive\n * @returns the ref to the result\n */\nexport function useAsyncResultRef<T, E extends ErrorBase = ErrorBase, P = unknown>(asyncResult?: AsyncResult<T, E, P>) {\n if (!asyncResult) {\n asyncResult = new AsyncResult<T, E, P>();\n }\n const state = ref<AsyncResult<T, E, P>>(asyncResult) as Ref<AsyncResult<T, E, P>>;\n\n const unsub = asyncResult.listen(() => {\n triggerRef(state);\n });\n\n onUnmounted(() => {\n unsub();\n });\n\n return state;\n}\n\n/**\n * Creates an AsyncResult ref from a promise returning a Result.\n * @param promise the promise returning a Result\n * @returns the ref to the AsyncResult\n */\nexport function useAsyncResultRefFromPromise<T, E extends ErrorBase = ErrorBase>(promise: Promise<Result<T, E>>) {\n return useAsyncResultRef(AsyncResult.fromResultPromise(promise));\n}\n\n\n\n// === Vue Composables for Chains ===\n\n/**\n * Watches a source, gives it as inputs to the function provided, and updates the result contained in the ref accordingly.\n * \n * @param source the inputs to react to\n * @param pipe the function to run when the inputs change\n * @param options optional settings\n * @returns ref to the result\n */\nexport function useReactiveChain<Inputs, T, E extends ErrorBase = ErrorBase>(source: WatchSource<Inputs>, pipe: FlatChainStep<Inputs, T, E>, options: ReactiveProcessOptions = { immediate: true }): Ref<AsyncResult<T, E>> {\n const result = new AsyncResult<T, E>();\n const resultRef = useAsyncResultRef(result);\n\n let unsub: (() => void) | null = null;\n\n watch(source, (newInputs) => {\n unsub?.();\n unsub = result.mirror(pipe(newInputs));\n }, { immediate: options.immediate });\n\n onUnmounted(() => {\n unsub?.();\n });\n\n return resultRef;\n}\n\n\n// === Vue Composables for Actions ===\n\n/**\n * The return type of useLazyAction.\n */\nexport interface LazyActionRef<T, E extends ErrorBase = ErrorBase, P = unknown> {\n resultRef: Ref<AsyncResult<T, E, P>>;\n trigger: () => void;\n}\n\n/**\n * Executes an action immediately and returns a ref to the AsyncResult representing the action's state.\n * \n * Same as useAsyncResultRefFromPromise(action()).\n * \n * @param action the action to execute immediately\n * @returns a ref to the AsyncResult representing the action's state\n */\nexport function useAction<T, E extends ErrorBase = ErrorBase, P = unknown>(action: Action<T, E, P>): Ref<AsyncResult<T, E, P>> {\n return useAsyncResultRef(AsyncResult.fromAction(action));\n}\n\n/**\n * Creates a lazy action that can be triggered manually.\n * \n * Same as AsyncResult.makeLazyAction(action), but the AsyncResult is wrapped in a ref for Vue reactivity.\n * \n * @param action the action to execute when triggered\n * @returns an object containing a ref to the AsyncResult and a trigger function\n */\nexport function useLazyAction<T, E extends ErrorBase = ErrorBase, P = unknown>(action: Action<T, E, P>): LazyActionRef<T, E, P> {\n const lazyAction = AsyncResult.makeLazyAction<T, E, P>(action);\n const resultRef = useAsyncResultRef(lazyAction.result);\n\n return { resultRef, trigger: lazyAction.trigger };\n}\n\n\n// === Vue Composables for Generators ===\n\n/**\n * Runs a generator function immediately and returns a ref to the AsyncResult representing the generator's state.\n * @param generatorFunc the generator function to run immediately\n * @returns a ref to the AsyncResult representing the generator's state\n */\nexport function useGenerator<T, P = unknown>(generatorFunc: (notifyProgress?: (progress: P) => void) => AsyncResultGenerator<T>): Ref<AsyncResult<T, any, P>> {\n const resultRef = useAsyncResultRef(AsyncResult.run(generatorFunc));\n return resultRef;\n}\n\n/**\n * Creates a lazy generator that can be triggered manually.\n * \n * @param generatorFunc the generator function to run when triggered\n * @returns an object containing a ref to the AsyncResult and a trigger function\n */\nexport function useLazyGenerator<T, P = unknown>(generatorFunc: () => AsyncResultGenerator<T>): { resultRef: Ref<AsyncResult<T, any, P>>, trigger: () => void } {\n const result = new AsyncResult<T, any, P>();\n const resultRef = useAsyncResultRef(result);\n\n const trigger = () => {\n result.runInPlace(generatorFunc);\n }\n\n return { resultRef, trigger };\n}\n\n/**\n * Watches a source, gives it as inputs to the generator function provided, and updates the result contained in the ref accordingly.\n * \n * @param source the inputs to react to\n * @param generatorFunc the generator function to run when the inputs change\n * @param options optional settings\n * @returns ref to the result\n */\nexport function useReactiveGenerator<Inputs, T, E extends ErrorBase = ErrorBase, P = unknown>(source: WatchSource<Inputs>, generatorFunc: (args: Inputs) => AsyncResultGenerator<T>, options: ReactiveProcessOptions = { immediate: true }): Ref<AsyncResult<T, E, P>> {\n const resultRef = useAsyncResultRef(new AsyncResult<T, E, P>());\n\n watch(source, (newInputs) => {\n resultRef.value.runInPlace(() => generatorFunc(newInputs));\n }, { immediate: options.immediate });\n\n return resultRef;\n}\n\n\n// === Vue Composables for AsyncResultCollection ===\n\n/**\n * Creates a reactive AsyncResultCollection wrapped in a Vue ref.\n * The AsyncResultCollection notifies Vue's reactivity system whenever its state changes.\n * \n * @template T - The type of the values in the AsyncResultCollection.\n * @template E - The type of the error, extending ErrorBase (default is ErrorBase).\n * @returns a ref to the AsyncResultCollection\n */\nexport function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBase>() {\n const list = new AsyncResultCollection<T, E>();\n const listRef = ref(list);\n\n list.listen(() => {\n triggerRef(listRef);\n });\n\n return listRef;\n}","import { defineComponent, watch, h, type VNode, type SlotsType } from \"vue\"\nimport { ErrorBase, type AsyncResult } from \"unwrapped/core\"\nimport { useAsyncResultRef } from \"../composables\"\n\ninterface CustomSlots<E extends ErrorBase = ErrorBase, P = unknown> {\n loading?: (props: { progress?: P }) => VNode;\n error?: (props: { error: E }) => VNode;\n idle?: () => VNode;\n}\n\n/**\n * Factory function to create a component that displays different content based on an AsyncResult's state. Provides slots for loading, error, idle, and success states and passes the relevant data to each slot, and are typed appropriately.\n * @param slots predefined slots for loading, error, and idle states. Useful for not having to repeat the same template for displaying a framework-specific spinner while in loading state, or a custom error message.\n * @param name Optional internal name for the component\n * @returns An instantiable component that accepts an AsyncResult prop and a default slot for the success state.\n * \n * @example\n * // loaders.ts - Create reusable loader with default loading/error UI\n * const MyLoader = makeAsyncResultLoader({\n * loading: () => h(Spinner),\n * error: ({ error }) => h(ErrorDisplay, { error }),\n * idle: () => h('div', 'Ready')\n * });\n * \n * // MyPage.vue - Use the loader with custom success content\n * <MyLoader :result=\"myAsyncResult\">\n * <template #default=\"{ value }\">\n * <UserProfile :user=\"value\" />\n * </template>\n * </MyLoader>\n */\nexport function makeAsyncResultLoader<T, E extends ErrorBase = ErrorBase, P = unknown>(slots: CustomSlots<E, P>, name = \"AsyncResultLoader\") {\n return defineComponent({\n name,\n props: {\n result: {\n type: Object as () => AsyncResult<T, E, P>,\n required: true\n }\n },\n slots: Object as SlotsType<CustomSlots<E, P> & { default: { value: T } }>,\n setup(props, context) {\n let resultRef = useAsyncResultRef(props.result);\n\n // Watch for prop changes & update listener\n watch(\n () => props.result,\n (newResult, oldResult) => {\n if (newResult === oldResult) return;\n resultRef = useAsyncResultRef(newResult);\n },\n { immediate: true }\n )\n\n return () => {\n const s = resultRef.value.state;\n\n const renderDefault = context.slots.default ?? (() => h(\"div\", { class: \"success\" }, \"Success\"));\n const renderError = context.slots.error ?? slots.error ?? (() => h(\"div\", { class: \"error\" }, \"Error\"));\n const renderLoading = context.slots.loading ?? slots.loading ?? (() => h(\"div\", { class: \"loading\" }, \"Loading…\"));\n const renderIdle = context.slots.idle ?? slots.idle ?? (() => h(\"div\", { class: \"idle\" }, \"Idle\"));\n\n // Choose what to render based on status\n switch (s.status) {\n case \"loading\":\n return renderLoading({ progress: s.progress });\n\n case \"error\":\n return renderError({ error: s.error });\n\n case \"success\":\n return renderDefault({ value: s.value });\n\n default:\n return renderIdle();\n }\n }\n }\n })\n}"],"mappings":";AAAA,SAAS,aAAa,KAAK,YAAY,aAAyC;AAChF,SAAS,aAAa,6BAAiH;AAoBhI,SAAS,kBAAmE,aAAoC;AACnH,MAAI,CAAC,aAAa;AACd,kBAAc,IAAI,YAAqB;AAAA,EAC3C;AACA,QAAM,QAAQ,IAA0B,WAAW;AAEnD,QAAM,QAAQ,YAAY,OAAO,MAAM;AACnC,eAAW,KAAK;AAAA,EACpB,CAAC;AAED,cAAY,MAAM;AACd,UAAM;AAAA,EACV,CAAC;AAED,SAAO;AACX;AAOO,SAAS,6BAAiE,SAAgC;AAC7G,SAAO,kBAAkB,YAAY,kBAAkB,OAAO,CAAC;AACnE;AAcO,SAAS,iBAA6D,QAA6B,MAAmC,UAAkC,EAAE,WAAW,KAAK,GAA2B;AACxN,QAAM,SAAS,IAAI,YAAkB;AACrC,QAAM,YAAY,kBAAkB,MAAM;AAE1C,MAAI,QAA6B;AAEjC,QAAM,QAAQ,CAAC,cAAc;AACzB,YAAQ;AACR,YAAQ,OAAO,OAAO,KAAK,SAAS,CAAC;AAAA,EACzC,GAAG,EAAE,WAA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AU;AAAA,MACd;AAAA,IACJ;AAAA,IACA,OAAO;AAAA,IACP,MAAM,OAAO,SAAS;AAClB,UAAI,YAAY,kBAAkB,MAAM,MAAM;AAG9C,MAAAC;AAAA,QACI,MAAM,MAAM;AAAA,QACZ,CAAC,WAAW,cAAc;AACtB,cAAI,cAAc,UAAW;AAC7B,sBAAY,kBAAkB,SAAS;AAAA,QAC3C;AAAA,QACA,EAAE,WAAW,KAAK;AAAA,MACtB;AAEA,aAAO,MAAM;AACT,cAAM,IAAI,UAAU,MAAM;AAE1B,cAAM,gBAAgB,QAAQ,MAAM,YAAY,MAAM,EAAE,OAAO,EAAE,OAAO,UAAU,GAAG,SAAS;AAC9F,cAAM,cAAc,QAAQ,MAAM,SAAS,MAAM,UAAU,MAAM,EAAE,OAAO,EAAE,OAAO,QAAQ,GAAG,OAAO;AACrG,cAAM,gBAAgB,QAAQ,MAAM,WAAW,MAAM,YAAY,MAAM,EAAE,OAAO,EAAE,OAAO,UAAU,GAAG,eAAU;AAChH,cAAM,aAAa,QAAQ,MAAM,QAAQ,MAAM,SAAS,MAAM,EAAE,OAAO,EAAE,OAAO,OAAO,GAAG,MAAM;AAGhG,gBAAQ,EAAE,QAAQ;AAAA,UACd,KAAK;AACD,mBAAO,cAAc,EAAE,UAAU,EAAE,SAAS,CAAC;AAAA,UAEjD,KAAK;AACD,mBAAO,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC;AAAA,UAEzC,KAAK;AACD,mBAAO,cAAc,EAAE,OAAO,EAAE,MAAM,CAAC;AAAA,UAE3C;AACI,mBAAO,WAAW;AAAA,QAC1B;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ,CAAC;AACL;","names":["watch","watch"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unwrapped",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },