@thednp/shorty 2.0.0-alpha6 → 2.0.0-alpha7
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.
- package/README.md +5 -4
- package/dist/shorty.cjs +1 -1
- package/dist/shorty.cjs.map +1 -1
- package/dist/shorty.d.ts +1454 -377
- package/dist/shorty.js +1 -1
- package/dist/shorty.js.map +1 -1
- package/dist/shorty.mjs +356 -358
- package/dist/shorty.mjs.map +1 -1
- package/package.json +11 -10
- package/src/boolean/isApple.ts +1 -1
- package/src/get/getBoundingClientRect.ts +1 -1
- package/src/get/getRectRelativeToOffsetParent.ts +1 -1
- package/src/index.ts +5 -6
- package/src/interface/{boundingClientRect.ts → boundingClientRect.d.ts} +1 -1
- package/src/interface/css4Declaration.d.ts +4 -0
- package/src/interface/{customElement.ts → customElement.d.ts} +1 -1
- package/src/interface/{navigatorUA.ts → navigatorUA.d.ts} +3 -3
- package/src/interface/{offsetRect.ts → offsetRect.d.ts} +1 -1
- package/src/interface/originalEvent.d.ts +4 -0
- package/src/is/isCustomElement.ts +1 -1
- package/src/misc/{hasOwn.ts → ObjectHasOwn.ts} +2 -2
- package/src/misc/createCustomEvent.ts +1 -1
- package/src/misc/data.ts +0 -6
- package/src/misc/getInstance.ts +9 -0
- package/src/misc/setElementStyle.ts +1 -1
- package/src/selectors/getCustomElements.ts +1 -1
- package/src/strings/userAgentData.ts +1 -1
- package/src/interface/css4Declaration.ts +0 -3
- package/src/interface/originalEvent.ts +0 -4
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thednp/shorty",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.0alpha7",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "TypeScript shorties for the web",
|
|
5
6
|
"source": "./src/index.ts",
|
|
6
7
|
"main": "./dist/shorty.js",
|
|
7
8
|
"types": "./dist/shorty.d.ts",
|
|
8
9
|
"module": "./dist/shorty.mjs",
|
|
9
|
-
"
|
|
10
|
+
"exports": {
|
|
10
11
|
".": {
|
|
11
12
|
"import": "./dist/shorty.mjs",
|
|
12
13
|
"require": "./dist/shorty.cjs",
|
|
@@ -20,14 +21,14 @@
|
|
|
20
21
|
"scripts": {
|
|
21
22
|
"pre-test": "npm run clean-coverage",
|
|
22
23
|
"test": "npm run pre-test && npx cypress run",
|
|
23
|
-
"clean": "rimraf dist",
|
|
24
24
|
"clean-coverage": "rimraf coverage .nyc_output",
|
|
25
25
|
"cypress": "npm run pre-test && npx cypress open",
|
|
26
26
|
"coverage:report": "nyc report --reporter=lcov --reporter=json --reporter=text --reporter=json-summary",
|
|
27
27
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
28
|
-
"lint:ts": "eslint -c .eslintrc.
|
|
29
|
-
"fix:ts": "eslint -c .eslintrc.
|
|
30
|
-
"build": "npm run
|
|
28
|
+
"lint:ts": "eslint -c .eslintrc.cjs --ext .ts src",
|
|
29
|
+
"fix:ts": "eslint -c .eslintrc.cjs --ext .ts src --fix",
|
|
30
|
+
"build": "npm run lint:ts && vite build && npm run dts",
|
|
31
|
+
"dts": "dts-bundle-generator --config ./dts.config.ts"
|
|
31
32
|
},
|
|
32
33
|
"publishConfig": {
|
|
33
34
|
"access": "public",
|
|
@@ -51,12 +52,12 @@
|
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@bahmutov/cypress-esbuild-preprocessor": "^2.1.3",
|
|
53
54
|
"@cypress/code-coverage": "^3.10.0",
|
|
54
|
-
"@
|
|
55
|
+
"@rollup/plugin-json": "^5.0.2",
|
|
55
56
|
"@types/istanbul-lib-instrument": "^1.7.4",
|
|
56
57
|
"@typescript-eslint/eslint-plugin": "^5.35.1",
|
|
57
58
|
"@typescript-eslint/parser": "^5.35.1",
|
|
58
|
-
"cypress": "^
|
|
59
|
-
"dts-bundle-generator": "^
|
|
59
|
+
"cypress": "^12.0.2",
|
|
60
|
+
"dts-bundle-generator": "^7.1.0",
|
|
60
61
|
"esbuild": "^0.14.30",
|
|
61
62
|
"eslint": "^8.23.0",
|
|
62
63
|
"eslint-plugin-jsdoc": "^39.3.6",
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
"nyc": "^15.1.0",
|
|
70
71
|
"prettier": "^2.7.1",
|
|
71
72
|
"rimraf": "^3.0.2",
|
|
72
|
-
"typescript": "^4.
|
|
73
|
+
"typescript": "^4.9.4",
|
|
73
74
|
"vite": "^3.0.9"
|
|
74
75
|
}
|
|
75
76
|
}
|
package/src/boolean/isApple.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OffsetRect } from '../interface/offsetRect';
|
|
1
|
+
import type { OffsetRect } from '../interface/offsetRect';
|
|
2
2
|
import isScaledElement from '../is/isScaledElement';
|
|
3
3
|
import isHTMLElement from '../is/isHTMLElement';
|
|
4
4
|
import getBoundingClientRect from './getBoundingClientRect';
|
package/src/index.ts
CHANGED
|
@@ -160,7 +160,8 @@ import documentHead from './blocks/documentHead';
|
|
|
160
160
|
|
|
161
161
|
// misc
|
|
162
162
|
import ArrayFrom from './misc/ArrayFrom';
|
|
163
|
-
import Data
|
|
163
|
+
import Data from './misc/data';
|
|
164
|
+
import getInstance from './misc/getInstance';
|
|
164
165
|
import createElement from './misc/createElement';
|
|
165
166
|
import createElementNS from './misc/createElementNS';
|
|
166
167
|
import dispatchEvent from './misc/dispatchEvent';
|
|
@@ -171,11 +172,11 @@ import Float32ArrayFrom from './misc/Float32ArrayFrom';
|
|
|
171
172
|
import Float64ArrayFrom from './misc/Float64ArrayFrom';
|
|
172
173
|
import focus from './misc/focus';
|
|
173
174
|
import noop from './misc/noop';
|
|
174
|
-
import hasOwn from './misc/hasOwn';
|
|
175
175
|
import normalizeOptions from './misc/normalizeOptions';
|
|
176
176
|
import normalizeValue from './misc/normalizeValue';
|
|
177
177
|
import ObjectAssign from './misc/ObjectAssign';
|
|
178
178
|
import ObjectEntries from './misc/ObjectEntries';
|
|
179
|
+
import ObjectHasOwn from './misc/ObjectHasOwn';
|
|
179
180
|
import ObjectKeys from './misc/ObjectKeys';
|
|
180
181
|
import ObjectValues from './misc/ObjectValues';
|
|
181
182
|
import createCustomEvent from './misc/createCustomEvent';
|
|
@@ -242,7 +243,7 @@ import getElementsByTagName from './selectors/getElementsByTagName';
|
|
|
242
243
|
import getElementsByClassName from './selectors/getElementsByClassName';
|
|
243
244
|
import matches from './selectors/matches';
|
|
244
245
|
|
|
245
|
-
|
|
246
|
+
export {
|
|
246
247
|
ariaChecked,
|
|
247
248
|
ariaDescription,
|
|
248
249
|
ariaDescribedBy,
|
|
@@ -426,7 +427,6 @@ const SHORTY = {
|
|
|
426
427
|
getElementsByClassName,
|
|
427
428
|
getElementsByTagName,
|
|
428
429
|
matches,
|
|
429
|
-
hasOwn,
|
|
430
430
|
normalizeValue,
|
|
431
431
|
normalizeOptions,
|
|
432
432
|
reflow,
|
|
@@ -436,6 +436,7 @@ const SHORTY = {
|
|
|
436
436
|
ArrayFrom,
|
|
437
437
|
Float32ArrayFrom,
|
|
438
438
|
Float64ArrayFrom,
|
|
439
|
+
ObjectHasOwn,
|
|
439
440
|
ObjectAssign,
|
|
440
441
|
ObjectEntries,
|
|
441
442
|
ObjectKeys,
|
|
@@ -456,5 +457,3 @@ const SHORTY = {
|
|
|
456
457
|
removeAttribute,
|
|
457
458
|
removeAttributeNS,
|
|
458
459
|
};
|
|
459
|
-
|
|
460
|
-
export default SHORTY;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// https://github.com/lukewarlow/user-agent-data-types/blob/master/index.d.ts
|
|
2
|
-
export interface NavigatorUABrand {
|
|
2
|
+
export declare interface NavigatorUABrand {
|
|
3
3
|
readonly brand: string;
|
|
4
4
|
readonly version: string;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export interface NavigatorUAData {
|
|
7
|
+
export declare interface NavigatorUAData {
|
|
8
8
|
readonly brands: NavigatorUABrand[];
|
|
9
9
|
readonly mobile: boolean;
|
|
10
10
|
readonly platform: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export interface NavigatorUA extends Navigator {
|
|
13
|
+
export declare interface NavigatorUA extends Navigator {
|
|
14
14
|
readonly userAgentData: NavigatorUAData;
|
|
15
15
|
}
|
|
@@ -9,9 +9,9 @@ import isObject from '../is/isObject';
|
|
|
9
9
|
* @param prop the property to check
|
|
10
10
|
* @returns the query result
|
|
11
11
|
*/
|
|
12
|
-
const
|
|
12
|
+
const ObjectHasOwn = <T extends object, K extends PropertyKey>(
|
|
13
13
|
obj: T,
|
|
14
14
|
prop: K,
|
|
15
15
|
): obj is T & Record<K, unknown> => isObject(obj) && (Object.hasOwn(obj, prop) || prop in obj);
|
|
16
16
|
|
|
17
|
-
export default
|
|
17
|
+
export default ObjectHasOwn;
|
package/src/misc/data.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ObjectAssign from './ObjectAssign';
|
|
2
2
|
import ObjectEntries from './ObjectEntries';
|
|
3
|
-
import { CSS4Declaration } from '../interface/css4Declaration';
|
|
4
3
|
import isString from '../is/isString';
|
|
4
|
+
import type { CSS4Declaration } from '../interface/css4Declaration';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Shortcut for multiple uses of `HTMLElement.style.propertyName` method.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CustomElement } from '../interface/customElement';
|
|
2
1
|
import isCustomElement from '../is/isCustomElement';
|
|
3
2
|
import getElementsByTagName from './getElementsByTagName';
|
|
3
|
+
import type { CustomElement } from '../interface/customElement';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns an `Array` of `Node` elements that are registered as
|