Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

formkit-addon-inertia

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formkit-addon-inertia - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0-beta.2

60

dist/index.cjs.js

@@ -13,54 +13,48 @@ 'use strict';

const injectNode = (node, options) => {
const addonOptions = {};
const mergedOptions = { ...options };
addonOptions.onCancelToken = ({ cancel }) => {
if (options?.onCancelToken) return options.onCancelToken(cancel, node);
};
if (mergedOptions?.onCancelToken) {
mergedOptions.onCancelToken = ({ cancel }) => options?.onCancelToken?.(cancel, node);
}
addonOptions.onBefore = (visit) => {
if (options?.onBefore) return options.onBefore(visit, node);
};
if (mergedOptions?.onCancel) {
mergedOptions.onCancel = () => options?.onCancel?.(node);
}
addonOptions.onStart = (visit) => {
if (mergedOptions?.onSuccess) {
mergedOptions.onSuccess = (page) => options?.onSuccess?.(page, node);
}
if (mergedOptions?.onBefore) {
mergedOptions.onBefore = (visit) => options?.onBefore?.(visit, node);
}
mergedOptions.onStart = (visit) => {
if (!options?.disableLoading) node.store.set(loadingMessage);
if (!options?.disableDisabled) node.props.disabled = true;
if (options?.onStart) options.onStart(visit, node);
if (options?.onStart) return options.onStart(visit, node);
};
addonOptions.onProgress = (progress) => {
if (!options?.disableProgress && node.context)
node.context.attrs = { "data-progress": progress?.total };
mergedOptions.onProgress = (progress) => {
if (!options?.disableProgress && node.context) node.context.attrs = { 'data-progress': progress?.total };
if (options?.onProgress) options.onProgress(progress, node);
if (options?.onProgress) return options.onProgress(progress, node);
};
addonOptions.onFinish = (visit) => {
if (!options?.disableLoading) node.store.remove("loading");
mergedOptions.onFinish = (visit) => {
if (!options?.disableLoading) node.store.remove('loading');
if (!options?.disableDisabled) node.props.disabled = false;
if (
!options?.disableProgress &&
node.context &&
node.context.attrs["data-progress"]
)
delete node.context.attrs["data-progress"];
if (!options?.disableProgress && node.context && node.context.attrs['data-progress']) delete node.context.attrs['data-progress'];
if (options?.onFinish) options.onFinish(visit, node);
if (options?.onFinish) return options.onFinish(visit, node);
};
addonOptions.onCancel = () => {
if (options?.onCancel) options.onCancel(node);
};
mergedOptions.onError = (errors) => {
if (!options?.disableErrors) node.setErrors([], errors);
addonOptions.onSuccess = (page) => {
if (options?.onSuccess) options.onSuccess(page, node);
};
addonOptions.onError = (errors) => {
if (options?.onError) return options.onError(errors, node);
if (!options?.disableErrors) node.setErrors([], errors);
};
return addonOptions;
return mergedOptions;
};

@@ -67,0 +61,0 @@

@@ -11,54 +11,48 @@ import { router } from '@inertiajs/vue3';

const injectNode = (node, options) => {
const addonOptions = {};
const mergedOptions = { ...options };
addonOptions.onCancelToken = ({ cancel }) => {
if (options?.onCancelToken) return options.onCancelToken(cancel, node);
};
if (mergedOptions?.onCancelToken) {
mergedOptions.onCancelToken = ({ cancel }) => options?.onCancelToken?.(cancel, node);
}
addonOptions.onBefore = (visit) => {
if (options?.onBefore) return options.onBefore(visit, node);
};
if (mergedOptions?.onCancel) {
mergedOptions.onCancel = () => options?.onCancel?.(node);
}
addonOptions.onStart = (visit) => {
if (mergedOptions?.onSuccess) {
mergedOptions.onSuccess = (page) => options?.onSuccess?.(page, node);
}
if (mergedOptions?.onBefore) {
mergedOptions.onBefore = (visit) => options?.onBefore?.(visit, node);
}
mergedOptions.onStart = (visit) => {
if (!options?.disableLoading) node.store.set(loadingMessage);
if (!options?.disableDisabled) node.props.disabled = true;
if (options?.onStart) options.onStart(visit, node);
if (options?.onStart) return options.onStart(visit, node);
};
addonOptions.onProgress = (progress) => {
if (!options?.disableProgress && node.context)
node.context.attrs = { "data-progress": progress?.total };
mergedOptions.onProgress = (progress) => {
if (!options?.disableProgress && node.context) node.context.attrs = { 'data-progress': progress?.total };
if (options?.onProgress) options.onProgress(progress, node);
if (options?.onProgress) return options.onProgress(progress, node);
};
addonOptions.onFinish = (visit) => {
if (!options?.disableLoading) node.store.remove("loading");
mergedOptions.onFinish = (visit) => {
if (!options?.disableLoading) node.store.remove('loading');
if (!options?.disableDisabled) node.props.disabled = false;
if (
!options?.disableProgress &&
node.context &&
node.context.attrs["data-progress"]
)
delete node.context.attrs["data-progress"];
if (!options?.disableProgress && node.context && node.context.attrs['data-progress']) delete node.context.attrs['data-progress'];
if (options?.onFinish) options.onFinish(visit, node);
if (options?.onFinish) return options.onFinish(visit, node);
};
addonOptions.onCancel = () => {
if (options?.onCancel) options.onCancel(node);
};
mergedOptions.onError = (errors) => {
if (!options?.disableErrors) node.setErrors([], errors);
addonOptions.onSuccess = (page) => {
if (options?.onSuccess) options.onSuccess(page, node);
};
addonOptions.onError = (errors) => {
if (options?.onError) return options.onError(errors, node);
if (!options?.disableErrors) node.setErrors([], errors);
};
return addonOptions;
return mergedOptions;
};

@@ -65,0 +59,0 @@

{
"name": "formkit-addon-inertia",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"description": "A plugin for integrating InertiaJS with FormKit.",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc