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

@felte/core

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@felte/core - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

13

dist/esm/create-field.js

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

let control;
let onReset;
if (typeof nameOrConfig === 'string') {

@@ -20,2 +21,3 @@ name = nameOrConfig;

touchOnChange = (_a = config === null || config === void 0 ? void 0 : config.touchOnChange) !== null && _a !== void 0 ? _a : false;
onReset = config === null || config === void 0 ? void 0 : config.onReset;
}

@@ -26,2 +28,3 @@ else {

touchOnChange = (_b = nameOrConfig.touchOnChange) !== null && _b !== void 0 ? _b : false;
onReset = nameOrConfig === null || nameOrConfig === void 0 ? void 0 : nameOrConfig.onReset;
}

@@ -52,5 +55,12 @@ function dispatchEvent(eventType, value) {

}
function handleReset(e) {
if (!onReset)
return;
setControlValue(control, defaultValue);
onReset(e);
}
function field(node) {
fieldNode = node;
let observer;
let formElement;
if (isFormControl(node)) {

@@ -81,2 +91,4 @@ control = node;

observer.observe(control, observerConfig);
formElement = control.closest('form');
formElement === null || formElement === void 0 ? void 0 : formElement.addEventListener('reset', handleReset);
});

@@ -86,2 +98,3 @@ return {

observer === null || observer === void 0 ? void 0 : observer.disconnect();
formElement === null || formElement === void 0 ? void 0 : formElement.removeEventListener('reset', handleReset);
},

@@ -88,0 +101,0 @@ };

4

dist/types/create-field.d.ts

@@ -6,2 +6,3 @@ import { FieldValue } from '@felte/common';

defaultValue?: FieldValue;
onReset?(e: ResetEvent): void;
};

@@ -16,2 +17,5 @@ type Field = {

};
type ResetEvent = Event & {
target: HTMLFormElement;
};
declare function createField(name: string, config?: Omit<FieldConfig, 'name'>): Field;

@@ -18,0 +22,0 @@ declare function createField(config: FieldConfig): Field;

@@ -20,2 +20,3 @@ import { Readable } from "svelte/store";

defaultValue?: FieldValue;
onReset?(e: ResetEvent): void;
};

@@ -30,2 +31,5 @@ type Field = {

};
type ResetEvent = Event & {
target: HTMLFormElement;
};
declare function createField(name: string, config?: Omit<FieldConfig, "name">): Field;

@@ -32,0 +36,0 @@ declare function createField(config: FieldConfig): Field;

2

package.json
{
"name": "@felte/core",
"version": "1.1.1",
"version": "1.2.0",
"description": "Core utility for Felte's integration with front-end frameworks",

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

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