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

@zag-js/editable

Package Overview
Dependencies
Maintainers
0
Versions
1043
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/editable - npm Package Compare versions

Comparing version 0.70.0 to 0.71.0

126

dist/index.js

@@ -1,34 +0,12 @@

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
'use strict';
// src/index.ts
var src_exports = {};
__export(src_exports, {
anatomy: () => anatomy,
connect: () => connect,
machine: () => machine,
props: () => props,
splitProps: () => splitProps
});
module.exports = __toCommonJS(src_exports);
var anatomy$1 = require('@zag-js/anatomy');
var domQuery = require('@zag-js/dom-query');
var core = require('@zag-js/core');
var interactOutside = require('@zag-js/interact-outside');
var utils = require('@zag-js/utils');
var types = require('@zag-js/types');
// src/editable.anatomy.ts
var import_anatomy = require("@zag-js/anatomy");
var anatomy = (0, import_anatomy.createAnatomy)("editable").parts(
var anatomy = anatomy$1.createAnatomy("editable").parts(
"root",

@@ -45,10 +23,3 @@ "area",

var parts = anatomy.build();
// src/editable.connect.ts
var import_dom_event = require("@zag-js/dom-event");
var import_dom_query2 = require("@zag-js/dom-query");
// src/editable.dom.ts
var import_dom_query = require("@zag-js/dom-query");
var dom = (0, import_dom_query.createScope)({
var dom = domQuery.createScope({
getRootId: (ctx) => ctx.ids?.root ?? `editable:${ctx.id}`,

@@ -120,5 +91,5 @@ getAreaId: (ctx) => ctx.ids?.area ?? `editable:${ctx.id}:area`,

style: autoResize ? { display: "inline-grid" } : void 0,
"data-focus": (0, import_dom_query2.dataAttr)(editing),
"data-disabled": (0, import_dom_query2.dataAttr)(disabled),
"data-placeholder-shown": (0, import_dom_query2.dataAttr)(empty)
"data-focus": domQuery.dataAttr(editing),
"data-disabled": domQuery.dataAttr(disabled),
"data-placeholder-shown": domQuery.dataAttr(empty)
});

@@ -132,4 +103,4 @@ },

htmlFor: dom.getInputId(state.context),
"data-focus": (0, import_dom_query2.dataAttr)(editing),
"data-invalid": (0, import_dom_query2.dataAttr)(invalid),
"data-focus": domQuery.dataAttr(editing),
"data-invalid": domQuery.dataAttr(invalid),
onClick() {

@@ -155,7 +126,7 @@ if (editing) return;

disabled,
"data-disabled": (0, import_dom_query2.dataAttr)(disabled),
"data-disabled": domQuery.dataAttr(disabled),
readOnly,
"data-readonly": (0, import_dom_query2.dataAttr)(readOnly),
"aria-invalid": (0, import_dom_query2.ariaAttr)(invalid),
"data-invalid": (0, import_dom_query2.dataAttr)(invalid),
"data-readonly": domQuery.dataAttr(readOnly),
"aria-invalid": domQuery.ariaAttr(invalid),
"data-invalid": domQuery.dataAttr(invalid),
defaultValue: value,

@@ -168,3 +139,3 @@ size: autoResize ? 1 : void 0,

if (event.defaultPrevented) return;
if ((0, import_dom_query2.isComposingEvent)(event)) return;
if (domQuery.isComposingEvent(event)) return;
const keyMap = {

@@ -179,3 +150,3 @@ Escape() {

if (localName === "textarea") {
if (!(0, import_dom_query2.isModKey)(event2)) return;
if (!domQuery.isModKey(event2)) return;
send({ type: "SUBMIT", src: "keydown.enter" });

@@ -207,9 +178,9 @@ return;

dir: state.context.dir,
"data-placeholder-shown": (0, import_dom_query2.dataAttr)(empty),
"aria-readonly": (0, import_dom_query2.ariaAttr)(readOnly),
"data-readonly": (0, import_dom_query2.dataAttr)(disabled),
"data-disabled": (0, import_dom_query2.dataAttr)(disabled),
"aria-disabled": (0, import_dom_query2.ariaAttr)(disabled),
"aria-invalid": (0, import_dom_query2.ariaAttr)(invalid),
"data-invalid": (0, import_dom_query2.dataAttr)(invalid),
"data-placeholder-shown": domQuery.dataAttr(empty),
"aria-readonly": domQuery.ariaAttr(readOnly),
"data-readonly": domQuery.dataAttr(disabled),
"data-disabled": domQuery.dataAttr(disabled),
"aria-disabled": domQuery.ariaAttr(disabled),
"aria-invalid": domQuery.ariaAttr(invalid),
"data-invalid": domQuery.dataAttr(invalid),
"aria-label": translations.edit,

@@ -303,13 +274,7 @@ children: valueText,

}
// src/editable.machine.ts
var import_core = require("@zag-js/core");
var import_dom_query3 = require("@zag-js/dom-query");
var import_interact_outside = require("@zag-js/interact-outside");
var import_utils = require("@zag-js/utils");
var submitOnEnter = (ctx) => ["both", "enter"].includes(ctx.submitMode);
var submitOnBlur = (ctx) => ["both", "blur"].includes(ctx.submitMode);
function machine(userContext) {
const ctx = (0, import_utils.compact)(userContext);
return (0, import_core.createMachine)(
const ctx = utils.compact(userContext);
return core.createMachine(
{

@@ -416,6 +381,6 @@ id: "editable",

trackInteractOutside(ctx2, _evt, { send }) {
return (0, import_interact_outside.trackInteractOutside)(dom.getInputEl(ctx2), {
return interactOutside.trackInteractOutside(dom.getInputEl(ctx2), {
exclude(target) {
const ignore = [dom.getCancelTriggerEl(ctx2), dom.getSubmitTriggerEl(ctx2)];
return ignore.some((el) => (0, import_dom_query3.contains)(el, target));
return ignore.some((el) => domQuery.contains(el, target));
},

@@ -436,3 +401,3 @@ onFocusOutside: ctx2.onFocusOutside,

if (evt.focusable) return;
(0, import_dom_query3.raf)(() => {
domQuery.raf(() => {
const finalEl = ctx2.finalFocusEl?.() ?? dom.getEditTriggerEl(ctx2);

@@ -443,3 +408,3 @@ finalEl?.focus({ preventScroll: true });

focusInput(ctx2) {
(0, import_dom_query3.raf)(() => {
domQuery.raf(() => {
const inputEl = dom.getInputEl(ctx2);

@@ -503,3 +468,3 @@ if (!inputEl) return;

value(ctx, value) {
if ((0, import_utils.isEqual)(ctx.value, value)) return;
if (utils.isEqual(ctx.value, value)) return;
ctx.value = value;

@@ -509,7 +474,3 @@ invoke.change(ctx);

};
// src/editable.props.ts
var import_types = require("@zag-js/types");
var import_utils2 = require("@zag-js/utils");
var props = (0, import_types.createProps)()([
var props = types.createProps()([
"activationMode",

@@ -544,11 +505,8 @@ "autoResize",

]);
var splitProps = (0, import_utils2.createSplitProps)(props);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
anatomy,
connect,
machine,
props,
splitProps
});
//# sourceMappingURL=index.js.map
var splitProps = utils.createSplitProps(props);
exports.anatomy = anatomy;
exports.connect = connect;
exports.machine = machine;
exports.props = props;
exports.splitProps = splitProps;
{
"name": "@zag-js/editable",
"version": "0.70.0",
"version": "0.71.0",
"description": "Core logic for the editable widget implemented as a state machine",

@@ -20,4 +20,3 @@ "keywords": [

"files": [
"dist",
"src"
"dist"
],

@@ -31,10 +30,10 @@ "publishConfig": {

"dependencies": {
"@zag-js/anatomy": "0.70.0",
"@zag-js/core": "0.70.0",
"@zag-js/interact-outside": "0.70.0",
"@zag-js/utils": "0.70.0",
"@zag-js/dom-query": "0.70.0",
"@zag-js/dom-event": "0.70.0",
"@zag-js/form-utils": "0.70.0",
"@zag-js/types": "0.70.0"
"@zag-js/anatomy": "0.71.0",
"@zag-js/core": "0.71.0",
"@zag-js/interact-outside": "0.71.0",
"@zag-js/utils": "0.71.0",
"@zag-js/dom-query": "0.71.0",
"@zag-js/dom-event": "0.71.0",
"@zag-js/form-utils": "0.71.0",
"@zag-js/types": "0.71.0"
},

@@ -41,0 +40,0 @@ "devDependencies": {

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