New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@felte/react

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@felte/react - npm Package Compare versions

Comparing version 1.0.0-next.26 to 1.0.0-next.27

2

dist/esm/packages/core/dist/esm/create-field.js

@@ -68,3 +68,3 @@ import { isFormControl, isElement } from './packages/common/dist/esm/utils/typeGuards.js';

input.name = name;
parent.insertBefore(input, node);
parent.insertBefore(input, node.nextSibling);
control = input;

@@ -71,0 +71,0 @@ }

@@ -61,3 +61,3 @@ import { __rest } from './external/.pnpm/tslib@2.3.1/external/tslib/tslib.es6.js';

const { addValidator, addTransformer, validate, setIsDirty, setIsSubmitting } = helpers, contextHelpers = __rest(helpers, ["addValidator", "addTransformer", "validate", "setIsDirty", "setIsSubmitting"]);
const { data, errors, warnings, touched, isSubmitting, isDirty } = stores;
const { data, errors, warnings, touched, isSubmitting, isDirty, interacted, } = stores;
function createSubmitHandler(altConfig) {

@@ -75,2 +75,3 @@ var _a, _b;

isSubmitting.set(true);
interacted.set(null);
const currentData = deepRemoveKey(get(data));

@@ -203,2 +204,3 @@ const currentErrors = await validateErrors(currentData, altConfig === null || altConfig === void 0 ? void 0 : altConfig.validate);

const inputValue = getInputTextOrNumber(target);
interacted.set(target.name);
data.update(($data) => {

@@ -215,7 +217,8 @@ return _set($data, getPath(target), inputValue);

setTouched(getPath(target), true);
interacted.set(target.name);
if (isSelectElement(target) ||
['checkbox', 'radio', 'file'].includes(target.type)) {
['checkbox', 'radio', 'file', 'hidden'].includes(target.type)) {
isDirty.set(true);
}
if (isSelectElement(target)) {
if (isSelectElement(target) || target.type === 'hidden') {
data.update(($data) => {

@@ -241,3 +244,8 @@ return _set($data, getPath(target), target.value);

setTouched(getPath(target), true);
interacted.set(target.name);
}
function handleReset(e) {
e.preventDefault();
reset();
}
const mutationOptions = { childList: true, subtree: true };

@@ -318,2 +326,3 @@ function unsetTaggedForRemove(formControls) {

node.addEventListener('submit', handleSubmit);
node.addEventListener('reset', handleReset);
const unsubscribeErrors = errors.subscribe(($errors) => {

@@ -348,2 +357,3 @@ for (const el of node.elements) {

node.removeEventListener('submit', handleSubmit);
node.removeEventListener('reset', handleReset);
unsubscribeErrors();

@@ -350,0 +360,0 @@ _getCurrentExtenders().forEach((extender) => { var _a; return (_a = extender.destroy) === null || _a === void 0 ? void 0 : _a.call(extender); });

@@ -54,3 +54,3 @@ import { createHelpers } from './helpers.js';

let currentExtenders = [];
const { isSubmitting, isValidating, data, errors, warnings, touched, isValid, isDirty, cleanup, start, validateErrors, validateWarnings, } = createStores(adapters.storeFactory, config);
const { isSubmitting, isValidating, data, errors, warnings, touched, isValid, isDirty, cleanup, start, validateErrors, validateWarnings, interacted, } = createStores(adapters.storeFactory, config);
const originalUpdate = data.update;

@@ -78,2 +78,3 @@ const originalSet = data.set;

isDirty,
interacted,
},

@@ -107,2 +108,3 @@ });

isDirty,
interacted,
}, helpers: Object.assign(Object.assign({}, helpers.public), { addTransformer,

@@ -123,2 +125,3 @@ addValidator }), extender,

isDirty,
interacted,
form,

@@ -125,0 +128,0 @@ handleSubmit,

@@ -16,4 +16,6 @@ import { get } from './get.js';

return _update(storeValue, path, (oldValue) => {
if (!Array.isArray(oldValue))
if (typeof oldValue !== 'undefined' && !Array.isArray(oldValue))
return oldValue;
if (!oldValue)
oldValue = [];
if (typeof index === 'undefined') {

@@ -52,3 +54,3 @@ oldValue.push(value);

let initialValues = deepSetKey(((_a = config.initialValues) !== null && _a !== void 0 ? _a : {}));
const { data, touched, errors, warnings, isDirty, isSubmitting } = stores;
const { data, touched, errors, warnings, isDirty, isSubmitting, interacted, } = stores;
const setData = createSetHelper(data.update);

@@ -71,3 +73,2 @@ const setTouched = createSetHelper(touched.update);

setTouched(pathOrValue, true);
isDirty.set(true);
}

@@ -140,5 +141,7 @@ };

const setIsDirty = createSetHelper(isDirty.update);
const setInteracted = createSetHelper(interacted.update);
async function validate() {
const currentData = get(data);
touched.set(deepSetTouched(currentData, true));
interacted.set(null);
const currentErrors = await validateErrors(currentData);

@@ -151,2 +154,3 @@ await validateWarnings(currentData);

setTouched(($touched) => deepSet($touched, false));
interacted.set(null);
isDirty.set(false);

@@ -162,2 +166,3 @@ }

setIsDirty,
setInteracted,
validate,

@@ -164,0 +169,0 @@ reset,

@@ -207,2 +207,3 @@ import { deepSetTouched } from './deep-set-touched.js';

const isDirty = storeFactory(false);
const interacted = storeFactory(null);
const validateErrors = cancellableValidation(immediateErrors);

@@ -299,2 +300,3 @@ const validateWarnings = cancellableValidation(immediateWarnings);

isValidating,
interacted,
validateErrors: executeErrorsValidation,

@@ -301,0 +303,0 @@ validateWarnings: executeWarningsValidation,

@@ -31,2 +31,4 @@ import { __rest } from './external/.pnpm/tslib@2.3.1/external/tslib/tslib.es6.js';

const isValid = useAccessor(rest.isValid);
const isValidating = useAccessor(rest.isValidating);
const interacted = useAccessor(rest.interacted);
useEffect(() => {

@@ -47,3 +49,5 @@ const cleanup = startStores();

isDirty,
isValid });
isValid,
isValidating,
interacted });
}

@@ -50,0 +54,0 @@

import { Obj, Errors, Touched, TransWritable, Traverse, Paths, Keyed, KeyedWritable } from '@felte/core';
import { Readable, Writable } from 'svelte/store';
type Accessor<T> = T extends Obj ? (<R>(selector: (storeValue: T) => R) => R) & (<P extends Paths<T> = Paths<T>, V extends Traverse<T, P> = Traverse<T, P>>(path: P) => V) & (() => T) : (<R>(deriveFn: (storeValue: T) => R) => R) & (() => T);
type Accessor<T> = T extends Obj ? (<R>(selector: (storeValue: T) => R) => R) & (<P extends Paths<T> = Paths<T>, V extends Traverse<T, P> = Traverse<T, P>>(path: P) => V) & (() => T) : T extends string | boolean | null ? (<R>(deriveFn: (storeValue: T) => R) => R) & (() => T) : ((selector: (storeValue: any) => any) => any) & ((path: string) => any) & (() => any);
type UnknownStores<Data extends Obj> = Omit<Stores<Data>, 'data'> & {

@@ -18,2 +18,4 @@ data: Accessor<Keyed<Data>> & TransWritable<Data>;

isDirty: Accessor<boolean> & Writable<boolean>;
isValidating: Accessor<boolean> & Readable<boolean>;
interacted: Accessor<string | null> & Writable<string | null>;
};

@@ -20,0 +22,0 @@ declare function useAccessor<T>(store: Writable<T>): Accessor<T> & Writable<T>;

{
"name": "@felte/react",
"version": "1.0.0-next.26",
"version": "1.0.0-next.27",
"description": "An extensible form library for ReactJS",

@@ -29,3 +29,3 @@ "main": "dist/cjs/index.js",

"dependencies": {
"@felte/core": "1.0.0-next.23"
"@felte/core": "1.0.0-next.24"
},

@@ -39,3 +39,3 @@ "publishConfig": {

"devDependencies": {
"@felte/common": "1.0.0-next.19",
"@felte/common": "1.0.0-next.20",
"@testing-library/jest-dom": "^5.11.9",

@@ -42,0 +42,0 @@ "@testing-library/react": "^12.1.2",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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