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

@conform-to/dom

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@conform-to/dom - npm Package Compare versions

Comparing version 1.0.0-pre.3 to 1.0.0-pre.4

2

form.d.ts

@@ -37,3 +37,3 @@ import { getFormAction, getFormEncType, getFormMethod } from './dom';

constraint: Record<string, Constraint>;
key: Record<string, string>;
key: Record<string, string | undefined>;
validated: Record<string, boolean>;

@@ -40,0 +40,0 @@ };

@@ -138,6 +138,12 @@ 'use strict';

return createStateProxy((name, proxy) => {
var _key$name, _proxy$formatPaths;
var currentKey = (_key$name = key[name]) !== null && _key$name !== void 0 ? _key$name : '';
var resultKey = name === '' ? currentKey : "".concat((_proxy$formatPaths = proxy[formdata.formatPaths(formdata.getPaths(name).slice(0, -1))]) !== null && _proxy$formatPaths !== void 0 ? _proxy$formatPaths : '', "/").concat(currentKey);
return resultKey;
var currentKey = key[name];
var paths = formdata.getPaths(name);
if (paths.length === 0) {
return currentKey;
}
var parentKey = proxy[formdata.formatPaths(paths.slice(0, -1))];
if (typeof parentKey === 'undefined') {
return currentKey;
}
return "".concat(parentKey, "/").concat(currentKey !== null && currentKey !== void 0 ? currentKey : name);
});

@@ -374,3 +380,3 @@ }

var formElement = getFormElement();
if (typeof result.initialValue === 'undefined') {
if (!result.initialValue) {
formElement.reset();

@@ -377,0 +383,0 @@ return;

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "1.0.0-pre.3",
"version": "1.0.0-pre.4",
"main": "index.js",

@@ -9,0 +9,0 @@ "module": "index.mjs",

@@ -31,3 +31,3 @@ import type { DefaultValue, FieldName, FormValue } from './form';

intent?: Intent;
initialValue?: Record<string, unknown>;
initialValue?: Record<string, unknown> | null;
error?: Record<string, Error | null>;

@@ -133,7 +133,7 @@ state?: SubmissionState;

export declare const intent: {
reset: <Schema>(payload: {
reset: <Schema>(payload?: {
name?: FieldName<Schema> | undefined;
value?: boolean | undefined;
validated?: boolean | undefined;
}) => ResetIntent<Schema>;
} | undefined) => ResetIntent<Schema>;
validate: <Schema_1>(payload: FieldName<Schema_1>) => ValidateIntent<Schema_1>;

@@ -140,0 +140,0 @@ replace: <Schema_2>(payload: {

@@ -190,3 +190,4 @@ 'use strict';

return {
status: 'success'
status: 'success',
initialValue: null
};

@@ -206,3 +207,15 @@ }

function rejectSubmission(context, options) {
var _context$error, _simplify2;
var _context$intent, _context$error, _simplify2;
switch ((_context$intent = context.intent) === null || _context$intent === void 0 ? void 0 : _context$intent.type) {
case 'reset':
{
var _context$intent$paylo;
var name = (_context$intent$paylo = context.intent.payload.name) !== null && _context$intent$paylo !== void 0 ? _context$intent$paylo : '';
if (name === '') {
return {
initialValue: null
};
}
}
}
var error = Object.entries((_context$error = context.error) !== null && _context$error !== void 0 ? _context$error : {}).reduce((result, _ref) => {

@@ -369,6 +382,9 @@ var [name, currentError] = _ref;

get(_, type) {
return payload => ({
type,
payload
});
return function () {
var payload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return {
type,
payload
};
};
}

@@ -375,0 +391,0 @@ });

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