uiik 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.esm.js +21 -20
  2. package/index.js +21 -20
  3. package/package.json +2 -2
package/index.esm.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * uiik v1.0.1
3
- * A UI interaction kit includes draggable, splittable, rotatable, selectable, etc.
2
+ * uiik v1.0.3
3
+ * A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.
4
4
  * https://github.com/holyhigh2/uiik
5
5
  * c) 2021-2023 @holyhigh2 may be freely distributed under the MIT license
6
6
  */
7
- import { isArrayLike, isString, map, isElement, toArray, each, assign, reject, includes, isArray, isEmpty, call, isNumber, isFunction, isDefined, isUndefined, closest, some, compact, split, test, flatMap } from '@holyhigh/func.js';
7
+ import { isArrayLike, isString, map, isElement, toArray, each, assign, find, reject, includes, isArray, isEmpty, call, isNumber, isFunction, isDefined, isUndefined, closest, some, compact, split, test, flatMap } from '@holyhigh/func.js';
8
8
 
9
9
  /******************************************************************************
10
10
  Copyright (c) Microsoft Corporation.
@@ -133,10 +133,6 @@ class Uii {
133
133
  _Uii_listeners = new WeakMap();
134
134
 
135
135
  /* eslint-disable max-len */
136
- /**
137
- * 工具包
138
- * @author holyhigh2
139
- */
140
136
  /**
141
137
  * 获取child相对于parent的offset信息。含border宽度
142
138
  * @returns
@@ -159,11 +155,23 @@ function getOffset(child, parent) {
159
155
  */
160
156
  const EDGE_THRESHOLD = 5;
161
157
  const DRAGGING_RULE = "body * { pointer-events: none; }";
158
+ let lockSheet;
162
159
  function lockPage() {
163
- document.styleSheets[0].insertRule(DRAGGING_RULE, 0);
160
+ lockSheet = getFirstSS();
161
+ lockSheet === null || lockSheet === void 0 ? void 0 : lockSheet.insertRule(DRAGGING_RULE, 0);
164
162
  }
165
163
  function unlockPage() {
166
- document.styleSheets[0].deleteRule(0);
164
+ lockSheet === null || lockSheet === void 0 ? void 0 : lockSheet.deleteRule(0);
165
+ }
166
+ function getFirstSS() {
167
+ if (document.styleSheets.length < 1) {
168
+ document.head.appendChild(document.createElement('style'));
169
+ }
170
+ const sheet = find(document.styleSheets, ss => !ss.href);
171
+ if (!sheet) {
172
+ document.head.appendChild(document.createElement('style'));
173
+ }
174
+ return sheet || find(document.styleSheets, ss => !ss.href);
167
175
  }
168
176
 
169
177
  var _Splittable_instances, _Splittable_checkDirection, _Splittable_bindHandle;
@@ -1928,16 +1936,14 @@ function newSelectable(container, opts) {
1928
1936
  return new Selectable(container, opts);
1929
1937
  }
1930
1938
 
1931
- var version = "1.0.1";
1939
+ var version = "1.0.3";
1932
1940
  var repository = {
1933
1941
  type: "git",
1934
1942
  url: "https://github.com/holyhigh2/uiik"
1935
1943
  };
1936
1944
 
1937
1945
  // welcome info
1938
- const welcome = globalThis.top
1939
- ? globalThis.top.welcome
1940
- : globalThis.welcome;
1946
+ const welcome = globalThis.welcome;
1941
1947
  if (!welcome) {
1942
1948
  const ssAry = [];
1943
1949
  ['102,227,255', '59,208,251', '67,180,255'].forEach((v, i) => {
@@ -1949,13 +1955,8 @@ if (!welcome) {
1949
1955
  ssAry[i] = 'color:#fff;' + cu;
1950
1956
  }
1951
1957
  });
1952
- console.info(`%c %c %c Uiik - UI Interactions Kit | v${version} %c %c `, ...ssAry, `💎 ${repository.url}`);
1953
- if (globalThis.top) {
1954
- globalThis.top.welcome = true;
1955
- }
1956
- else {
1957
- globalThis.welcome = true;
1958
- }
1958
+ console.info(`%c %c %c Uiik - UI interactions kit | v${version} %c %c `, ...ssAry, `💎 ${repository.url}`);
1959
+ globalThis.welcome = true;
1959
1960
  }
1960
1961
  const VERSION = version;
1961
1962
  var index = {
package/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  /**
2
- * uiik v1.0.1
3
- * A UI interaction kit includes draggable, splittable, rotatable, selectable, etc.
2
+ * uiik v1.0.3
3
+ * A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.
4
4
  * https://github.com/holyhigh2/uiik
5
5
  * c) 2021-2023 @holyhigh2 may be freely distributed under the MIT license
6
6
  */
7
7
  (function (global, factory) {
8
8
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@holyhigh/func.js')) :
9
9
  typeof define === 'function' && define.amd ? define(['exports', '@holyhigh/func.js'], factory) :
10
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.uii = {}, global.func_js));
10
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.uiik = {}, global.func_js));
11
11
  })(this, (function (exports, func_js) { 'use strict';
12
12
 
13
13
  /******************************************************************************
@@ -137,10 +137,6 @@
137
137
  _Uii_listeners = new WeakMap();
138
138
 
139
139
  /* eslint-disable max-len */
140
- /**
141
- * 工具包
142
- * @author holyhigh2
143
- */
144
140
  /**
145
141
  * 获取child相对于parent的offset信息。含border宽度
146
142
  * @returns
@@ -163,11 +159,23 @@
163
159
  */
164
160
  const EDGE_THRESHOLD = 5;
165
161
  const DRAGGING_RULE = "body * { pointer-events: none; }";
162
+ let lockSheet;
166
163
  function lockPage() {
167
- document.styleSheets[0].insertRule(DRAGGING_RULE, 0);
164
+ lockSheet = getFirstSS();
165
+ lockSheet === null || lockSheet === void 0 ? void 0 : lockSheet.insertRule(DRAGGING_RULE, 0);
168
166
  }
169
167
  function unlockPage() {
170
- document.styleSheets[0].deleteRule(0);
168
+ lockSheet === null || lockSheet === void 0 ? void 0 : lockSheet.deleteRule(0);
169
+ }
170
+ function getFirstSS() {
171
+ if (document.styleSheets.length < 1) {
172
+ document.head.appendChild(document.createElement('style'));
173
+ }
174
+ const sheet = func_js.find(document.styleSheets, ss => !ss.href);
175
+ if (!sheet) {
176
+ document.head.appendChild(document.createElement('style'));
177
+ }
178
+ return sheet || func_js.find(document.styleSheets, ss => !ss.href);
171
179
  }
172
180
 
173
181
  var _Splittable_instances, _Splittable_checkDirection, _Splittable_bindHandle;
@@ -1932,16 +1940,14 @@
1932
1940
  return new Selectable(container, opts);
1933
1941
  }
1934
1942
 
1935
- var version = "1.0.1";
1943
+ var version = "1.0.3";
1936
1944
  var repository = {
1937
1945
  type: "git",
1938
1946
  url: "https://github.com/holyhigh2/uiik"
1939
1947
  };
1940
1948
 
1941
1949
  // welcome info
1942
- const welcome = globalThis.top
1943
- ? globalThis.top.welcome
1944
- : globalThis.welcome;
1950
+ const welcome = globalThis.welcome;
1945
1951
  if (!welcome) {
1946
1952
  const ssAry = [];
1947
1953
  ['102,227,255', '59,208,251', '67,180,255'].forEach((v, i) => {
@@ -1953,13 +1959,8 @@
1953
1959
  ssAry[i] = 'color:#fff;' + cu;
1954
1960
  }
1955
1961
  });
1956
- console.info(`%c %c %c Uiik - UI Interactions Kit | v${version} %c %c `, ...ssAry, `💎 ${repository.url}`);
1957
- if (globalThis.top) {
1958
- globalThis.top.welcome = true;
1959
- }
1960
- else {
1961
- globalThis.welcome = true;
1962
- }
1962
+ console.info(`%c %c %c Uiik - UI interactions kit | v${version} %c %c `, ...ssAry, `💎 ${repository.url}`);
1963
+ globalThis.welcome = true;
1963
1964
  }
1964
1965
  const VERSION = version;
1965
1966
  var index = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "uiik",
3
- "version": "1.0.1",
4
- "description": "A UI interaction kit includes draggable, splittable, rotatable, selectable, etc.",
3
+ "version": "1.0.3",
4
+ "description": "A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.",
5
5
  "main": "index.js",
6
6
  "module": "index.esm.js",
7
7
  "types": "types/index.d.ts",