Socket
Socket
Sign inDemoInstall

@zag-js/text-selection

Package Overview
Dependencies
Maintainers
1
Versions
655
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/text-selection - npm Package Compare versions

Comparing version 0.0.0-dev-20230706120929 to 0.0.0-dev-20230710092359

dist/index.d.mts

9

dist/index.d.ts

@@ -1,2 +0,2 @@

export type DisableTextSelectionOptions<T = MaybeElement> = {
type DisableTextSelectionOptions<T = MaybeElement> = {
target?: T;

@@ -6,6 +6,7 @@ doc?: Document;

};
export declare function restoreTextSelection(options?: DisableTextSelectionOptions): void;
declare function restoreTextSelection(options?: DisableTextSelectionOptions): void;
type MaybeElement = HTMLElement | null | undefined;
type NodeOrFn = MaybeElement | (() => MaybeElement);
export declare function disableTextSelection(options?: DisableTextSelectionOptions<NodeOrFn>): () => void;
export {};
declare function disableTextSelection(options?: DisableTextSelectionOptions<NodeOrFn>): () => void;
export { DisableTextSelectionOptions, disableTextSelection, restoreTextSelection };

@@ -1,10 +0,31 @@

'use strict';
"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);
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const domQuery = require('@zag-js/dom-query');
let state = "default";
let userSelect = "";
const elementMap = /* @__PURE__ */ new WeakMap();
// src/index.ts
var src_exports = {};
__export(src_exports, {
disableTextSelection: () => disableTextSelection,
restoreTextSelection: () => restoreTextSelection
});
module.exports = __toCommonJS(src_exports);
var import_dom_query = require("@zag-js/dom-query");
var state = "default";
var userSelect = "";
var elementMap = /* @__PURE__ */ new WeakMap();
function disableTextSelectionImpl(options = {}) {

@@ -14,3 +35,3 @@ const { target, doc } = options;

const rootEl = docNode.documentElement;
if (domQuery.isIos()) {
if ((0, import_dom_query.isIos)()) {
if (state === "default") {

@@ -31,3 +52,3 @@ userSelect = rootEl.style.webkitUserSelect;

const rootEl = docNode.documentElement;
if (domQuery.isIos()) {
if ((0, import_dom_query.isIos)()) {
if (state !== "disabled")

@@ -37,3 +58,3 @@ return;

setTimeout(() => {
domQuery.nextTick(() => {
(0, import_dom_query.nextTick)(() => {
if (state === "restoring") {

@@ -63,3 +84,3 @@ if (rootEl.style.webkitUserSelect === "none") {

const { defer, target, ...restOptions } = options;
const func = defer ? domQuery.raf : (v) => v();
const func = defer ? import_dom_query.raf : (v) => v();
const cleanups = [];

@@ -76,4 +97,7 @@ cleanups.push(

}
exports.disableTextSelection = disableTextSelection;
exports.restoreTextSelection = restoreTextSelection;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
disableTextSelection,
restoreTextSelection
});
//# sourceMappingURL=index.js.map
{
"name": "@zag-js/text-selection",
"version": "0.0.0-dev-20230706120929",
"version": "0.0.0-dev-20230710092359",
"description": "",

@@ -31,3 +31,3 @@ "keywords": [

"dependencies": {
"@zag-js/dom-query": "0.0.0-dev-20230706120929"
"@zag-js/dom-query": "0.0.0-dev-20230710092359"
},

@@ -45,3 +45,3 @@ "module": "dist/index.mjs",

"scripts": {
"build": "vite build -c ../../../vite.config.ts",
"build": "tsup",
"lint": "eslint src --ext .ts,.tsx",

@@ -48,0 +48,0 @@ "typecheck": "tsc --noEmit"

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