@zag-js/text-selection
Advanced tools
Comparing version 0.0.0-dev-20230601120732 to 0.0.0-dev-20230605130234
@@ -1,2 +0,2 @@ | ||
type DisableTextSelectionOptions<T = MaybeElement> = { | ||
export type DisableTextSelectionOptions<T = MaybeElement> = { | ||
target?: T; | ||
@@ -6,7 +6,6 @@ doc?: Document; | ||
}; | ||
declare function restoreTextSelection(options?: DisableTextSelectionOptions): void; | ||
export declare function restoreTextSelection(options?: DisableTextSelectionOptions): void; | ||
type MaybeElement = HTMLElement | null | undefined; | ||
type NodeOrFn = MaybeElement | (() => MaybeElement); | ||
declare function disableTextSelection(options?: DisableTextSelectionOptions<NodeOrFn>): () => void; | ||
export { DisableTextSelectionOptions, disableTextSelection, restoreTextSelection }; | ||
export declare function disableTextSelection(options?: DisableTextSelectionOptions<NodeOrFn>): () => void; | ||
export {}; |
@@ -1,31 +0,10 @@ | ||
"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, { | ||
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(); | ||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
const domQuery = require('@zag-js/dom-query'); | ||
let state = "default"; | ||
let userSelect = ""; | ||
const elementMap = /* @__PURE__ */ new WeakMap(); | ||
function disableTextSelectionImpl(options = {}) { | ||
@@ -35,3 +14,3 @@ const { target, doc } = options; | ||
const rootEl = docNode.documentElement; | ||
if ((0, import_dom_query.isIos)()) { | ||
if (domQuery.isIos()) { | ||
if (state === "default") { | ||
@@ -52,3 +31,3 @@ userSelect = rootEl.style.webkitUserSelect; | ||
const rootEl = docNode.documentElement; | ||
if ((0, import_dom_query.isIos)()) { | ||
if (domQuery.isIos()) { | ||
if (state !== "disabled") | ||
@@ -58,3 +37,3 @@ return; | ||
setTimeout(() => { | ||
(0, import_dom_query.nextTick)(() => { | ||
domQuery.nextTick(() => { | ||
if (state === "restoring") { | ||
@@ -84,3 +63,3 @@ if (rootEl.style.webkitUserSelect === "none") { | ||
const { defer, target, ...restOptions } = options; | ||
const func = defer ? import_dom_query.raf : (v) => v(); | ||
const func = defer ? domQuery.raf : (v) => v(); | ||
const cleanups = []; | ||
@@ -97,6 +76,4 @@ cleanups.push( | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
disableTextSelection, | ||
restoreTextSelection | ||
}); | ||
exports.disableTextSelection = disableTextSelection; | ||
exports.restoreTextSelection = restoreTextSelection; |
{ | ||
"name": "@zag-js/text-selection", | ||
"version": "0.0.0-dev-20230601120732", | ||
"version": "0.0.0-dev-20230605130234", | ||
"description": "", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/dom-query": "0.0.0-dev-20230601120732" | ||
"@zag-js/dom-query": "0.0.0-dev-20230605130234" | ||
}, | ||
@@ -45,11 +45,6 @@ "module": "dist/index.mjs", | ||
"scripts": { | ||
"build-fast": "tsup src", | ||
"start": "pnpm build --watch", | ||
"build": "tsup src --dts", | ||
"test": "jest --config ../../../jest.config.js --rootDir . --passWithNoTests", | ||
"build": "vite build -c ../../../vite.config.ts", | ||
"lint": "eslint src --ext .ts,.tsx", | ||
"test-ci": "pnpm test --ci --runInBand", | ||
"test-watch": "pnpm test --watch -u", | ||
"typecheck": "tsc --noEmit" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9759
220
+ Added@zag-js/dom-query@0.0.0-dev-20230605130234(transitive)
- Removed@zag-js/dom-query@0.0.0-dev-20230601120732(transitive)