@phun-ky/speccer 4.3.1 → 6.0.0
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/CHANGELOG.md +40 -0
- package/dts/browser.d.ts +4 -0
- package/dts/enums/area.d.ts +16 -0
- package/dts/helpers/dissect/index.d.ts +1 -0
- package/dts/helpers/dissect/styles.d.ts +1 -0
- package/dts/helpers/typography/index.d.ts +2 -0
- package/dts/helpers/typography/position.d.ts +4 -0
- package/dts/helpers/typography/template.d.ts +1 -0
- package/dts/index.d.ts +53 -0
- package/dts/interfaces/global.d.ts +6 -0
- package/dts/lib/attributes.d.ts +2 -0
- package/dts/lib/classnames.d.ts +4 -0
- package/dts/lib/constants.d.ts +3 -0
- package/dts/lib/css.d.ts +6 -0
- package/dts/lib/debounce.d.ts +3 -0
- package/dts/lib/node.d.ts +2 -0
- package/dts/lib/number.d.ts +1 -0
- package/dts/lib/position.d.ts +6 -0
- package/dts/lib/resize.d.ts +1 -0
- package/dts/lib/styles.d.ts +2 -0
- package/dts/tasks/dissect.d.ts +2 -0
- package/dts/tasks/index.d.ts +4 -0
- package/dts/tasks/measure.d.ts +1 -0
- package/dts/tasks/spec.d.ts +2 -0
- package/dts/tasks/typography.d.ts +2 -0
- package/dts/types/css.d.ts +19 -0
- package/dts/types/speccer.d.ts +5 -0
- package/package.json +13 -16
- package/speccer.css +16 -19
- package/speccer.js +2 -1
- package/speccer.js.map +1 -0
- package/speccer.min.css +1 -1
- package/src/{browser.js → browser.ts} +30 -21
- package/src/enums/area.ts +17 -0
- package/src/helpers/dissect/index.ts +1 -0
- package/src/helpers/dissect/styles.ts +154 -0
- package/src/helpers/typography/index.ts +3 -0
- package/src/helpers/typography/position.ts +54 -0
- package/src/helpers/typography/template.ts +27 -0
- package/src/{index.js → index.ts} +17 -14
- package/src/interfaces/global.ts +7 -0
- package/src/lib/attributes.ts +18 -0
- package/src/lib/classnames.ts +43 -0
- package/src/lib/{constants.js → constants.ts} +3 -0
- package/src/lib/css.ts +45 -0
- package/src/lib/debounce.ts +29 -0
- package/src/lib/node.ts +8 -0
- package/src/lib/number.ts +4 -0
- package/src/lib/position.ts +16 -0
- package/src/lib/{resize.js → resize.ts} +5 -4
- package/src/lib/styles.ts +31 -0
- package/src/styles/index.styl +4 -0
- package/src/styles/spacing.styl +0 -10
- package/src/styles/typography.styl +11 -12
- package/src/tasks/dissect.ts +46 -0
- package/src/tasks/index.ts +7 -0
- package/src/tasks/measure.ts +82 -0
- package/src/tasks/spec.ts +170 -0
- package/src/tasks/typography.ts +45 -0
- package/src/types/css.ts +20 -0
- package/src/types/speccer.ts +6 -0
- package/tsconfig.json +21 -0
- package/tslint.json +23 -0
- package/src/dissect.js +0 -204
- package/src/lib/attributes.js +0 -13
- package/src/lib/classnames.js +0 -37
- package/src/lib/css.js +0 -37
- package/src/lib/debounce.js +0 -22
- package/src/lib/node.js +0 -7
- package/src/lib/number.js +0 -4
- package/src/lib/styles.js +0 -27
- package/src/measure.js +0 -88
- package/src/spec.js +0 -183
- package/src/typography.js +0 -138
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [6.0.0](https://github.com/phun-ky/speccer/compare/v5.0.0...v6.0.0) (2022-02-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* 🧨 The script is now converted to TypeScript. The internal API has changed,
|
|
11
|
+
but now the usage. I've set this as a breaking change to reflect the
|
|
12
|
+
size of the change. There has also been some internal optimizations
|
|
13
|
+
regarding positioning of the speccer elements
|
|
14
|
+
|
|
15
|
+
### Refactoring
|
|
16
|
+
|
|
17
|
+
* 💡 Converted to TypeScript ([ab90bae](https://github.com/phun-ky/speccer/commit/ab90bae5794235ffd13d250500caca98b0a818b5))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Feature
|
|
21
|
+
|
|
22
|
+
* 🎸 Add source map ([de3812d](https://github.com/phun-ky/speccer/commit/de3812dc4a28d274aabfb16cf088f78cf07b2b7e))
|
|
23
|
+
|
|
24
|
+
## [5.0.0](https://github.com/phun-ky/speccer/compare/v4.3.2...v5.0.0) (2022-02-22)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### ⚠ BREAKING CHANGES
|
|
28
|
+
|
|
29
|
+
* 🧨 Speccer is not supporting older browsers any more, to cut down on
|
|
30
|
+
maintenance. Babel is now removed, but you can still polyfill or use
|
|
31
|
+
babel for your own needs if you import the source files instead of the
|
|
32
|
+
build files.
|
|
33
|
+
|
|
34
|
+
### Tasks
|
|
35
|
+
|
|
36
|
+
* 🤖 Remove babel, do not support older browsers anymore ([9ed11c0](https://github.com/phun-ky/speccer/commit/9ed11c06da3d1ac1b80d4cbbc6859146c596cd6f))
|
|
37
|
+
|
|
38
|
+
### [4.3.2](https://github.com/phun-ky/speccer/compare/v4.3.1...v4.3.2) (2022-02-22)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug
|
|
42
|
+
|
|
43
|
+
* And supply the minified version.. ([8cfb69a](https://github.com/phun-ky/speccer/commit/8cfb69a5dc86f1e9c9ccea3f890781a3961a0a7f))
|
|
44
|
+
|
|
5
45
|
### [4.3.1](https://github.com/phun-ky/speccer/compare/v4.3.0...v4.3.1) (2022-02-22)
|
|
6
46
|
|
|
7
47
|
|
package/dts/browser.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum SpeccerAreaEnum {
|
|
2
|
+
Empty = "",
|
|
3
|
+
Left = "left",
|
|
4
|
+
Right = "right",
|
|
5
|
+
Bottom = "bottom",
|
|
6
|
+
Top = "top"
|
|
7
|
+
}
|
|
8
|
+
export declare enum DissectAreaEnum {
|
|
9
|
+
Outline = "outline",
|
|
10
|
+
Enclose = "enclose",
|
|
11
|
+
Full = "full",
|
|
12
|
+
Left = "left",
|
|
13
|
+
Right = "right",
|
|
14
|
+
Bottom = "bottom",
|
|
15
|
+
Top = "top"
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { styles } from './styles';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: (area: string, el: HTMLElement, dissectionEl: HTMLElement) => {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const template: (el: HTMLElement) => Promise<string>;
|
package/dts/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
speccer: any;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare const create$2: (text?: string | number, tag?: string) => HTMLElement;
|
|
8
|
+
declare const element$3: (el: HTMLElement) => Promise<void>;
|
|
9
|
+
|
|
10
|
+
declare namespace __spacing {
|
|
11
|
+
export {
|
|
12
|
+
create$2 as create,
|
|
13
|
+
element$3 as element,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare const create$1: (textContent: string | undefined, area: string, n?: string) => HTMLElement;
|
|
18
|
+
declare const element$2: (el: HTMLElement, dissectIndex: number) => Promise<void>;
|
|
19
|
+
|
|
20
|
+
declare namespace __dissect {
|
|
21
|
+
export {
|
|
22
|
+
create$1 as create,
|
|
23
|
+
element$2 as element,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare const element$1: (el: HTMLElement) => void;
|
|
28
|
+
|
|
29
|
+
declare namespace __measure {
|
|
30
|
+
export {
|
|
31
|
+
element$1 as element,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare const create: (html: string, area: string | null) => HTMLDivElement;
|
|
36
|
+
declare const element: (el: HTMLElement) => Promise<void>;
|
|
37
|
+
|
|
38
|
+
declare const __typography_create: typeof create;
|
|
39
|
+
declare const __typography_element: typeof element;
|
|
40
|
+
declare namespace __typography {
|
|
41
|
+
export {
|
|
42
|
+
__typography_create as create,
|
|
43
|
+
__typography_element as element,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare const spacing: typeof __spacing;
|
|
48
|
+
declare const dissect: typeof __dissect;
|
|
49
|
+
declare const measure: typeof __measure;
|
|
50
|
+
declare const typography: typeof __typography;
|
|
51
|
+
declare const speccer: () => void;
|
|
52
|
+
|
|
53
|
+
export { speccer as default, dissect, measure, spacing, typography };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const set: (el: HTMLElement, cls: string, avoid?: string) => void;
|
|
2
|
+
export declare const toggle: (el: HTMLElement, cls: string, avoid?: string) => void;
|
|
3
|
+
export declare const remove: (el: HTMLElement, cls: string, avoid?: string) => void;
|
|
4
|
+
export declare const cx: (cls: string, cls_obj: {}) => string;
|
package/dts/lib/css.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SpacingCSSPropertiesType, TypographyCSSPropertiesType } from '../types/css';
|
|
2
|
+
export declare const getNumberValue: (value: string) => number;
|
|
3
|
+
export declare const normalizeNumberValue: (value: string | number) => number;
|
|
4
|
+
export declare const getSpacing: (style: SpacingCSSPropertiesType) => SpacingCSSPropertiesType;
|
|
5
|
+
export declare const getTypography: (style: TypographyCSSPropertiesType) => TypographyCSSPropertiesType;
|
|
6
|
+
export declare const pinSpace: (el: HTMLElement) => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const decimal: (number: string | number, decimals?: number) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const get_horizontal_center_of_els: (modifier: number, startRect: DOMRect, targetRect: DOMRect) => number;
|
|
2
|
+
export declare const get_vertical_center_of_els: (modifier: number, startRect: DOMRect, targetRect: DOMRect) => number;
|
|
3
|
+
export declare const get_body_correction: () => {
|
|
4
|
+
top: number;
|
|
5
|
+
left: number;
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const activate: (speccer: Function) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const element: (el: HTMLElement) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare type SpacingCSSPropertiesType = {
|
|
2
|
+
marginTop: string;
|
|
3
|
+
marginBottom: string;
|
|
4
|
+
marginLeft: string;
|
|
5
|
+
marginRight: string;
|
|
6
|
+
paddingTop: string;
|
|
7
|
+
paddingBottom: string;
|
|
8
|
+
paddingLeft: string;
|
|
9
|
+
paddingRight: string;
|
|
10
|
+
};
|
|
11
|
+
export declare type TypographyCSSPropertiesType = {
|
|
12
|
+
lineHeight: string;
|
|
13
|
+
letterSpacing: string;
|
|
14
|
+
fontFamily: string;
|
|
15
|
+
fontSize: string;
|
|
16
|
+
fontStyle: string;
|
|
17
|
+
fontVariationSettings: string;
|
|
18
|
+
fontWeight: string;
|
|
19
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phun-ky/speccer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "A script to annotate, show spacing specs and to display typography information in documentation/website on HTML elements",
|
|
5
5
|
"main": "speccer.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
11
|
"rollup": "rollup -c",
|
|
12
12
|
"rollup:dev": "npm run clean && rollup -c -w",
|
|
13
|
-
"clean": "rm -rf ./speccer.css ./speccer.min.css ./speccer.js",
|
|
13
|
+
"clean": "rm -rf dist/ dts/ ./speccer.css ./speccer.min.css ./speccer.js",
|
|
14
14
|
"build": "npm run clean && npm run rollup && npm run stylus && npm run postcss",
|
|
15
15
|
"styles": "npm run stylus && npm run postcss",
|
|
16
16
|
"stylus": "rm -rf ./speccer.css && stylus ./src/styles/index.styl -o ./speccer.css",
|
|
@@ -100,39 +100,36 @@
|
|
|
100
100
|
},
|
|
101
101
|
"homepage": "https://github.com/phun-ky/speccer#readme",
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@babel/core": "^7.2.2",
|
|
104
|
-
"@babel/plugin-proposal-export-default-from": "^7.12.13",
|
|
105
|
-
"@babel/plugin-transform-runtime": "^7.12.17",
|
|
106
|
-
"@babel/preset-env": "^7.2.3",
|
|
107
|
-
"@babel/register": "^7.12.13",
|
|
108
|
-
"@babel/runtime": "^7.12.18",
|
|
109
|
-
"@rollup/plugin-babel": "^5.3.0",
|
|
110
103
|
"@rollup/plugin-commonjs": "^17.1.0",
|
|
111
104
|
"@rollup/plugin-node-resolve": "^11.2.0",
|
|
112
105
|
"@testing-library/dom": "^7.29.4",
|
|
113
106
|
"@testing-library/jest-dom": "^5.11.9",
|
|
114
107
|
"@testing-library/user-event": "^12.7.1",
|
|
115
|
-
"babel-eslint": "^10.1.0",
|
|
116
|
-
"babel-jest": "^26.6.3",
|
|
117
108
|
"browser-sync": "^2.27.7",
|
|
118
109
|
"cssnano": "^5.0.4",
|
|
119
110
|
"eslint": "^7.32.0",
|
|
120
111
|
"eslint-config-airbnb": "^18.2.1",
|
|
121
112
|
"eslint-config-prettier": "^8.3.0",
|
|
113
|
+
"eslint-plugin-compat": "^3.13.0",
|
|
122
114
|
"eslint-plugin-import": "^2.24.2",
|
|
123
115
|
"eslint-plugin-jest": "^24.4.2",
|
|
124
116
|
"eslint-plugin-prettier": "^4.0.0",
|
|
117
|
+
"eslint-plugin-react": "^7.23.2",
|
|
118
|
+
"eslint-plugin-react-hooks": "^4.2.0",
|
|
125
119
|
"jest": "^26.6.3",
|
|
126
120
|
"postcss": "^8.3.0",
|
|
127
121
|
"postcss-cli": "^8.3.1",
|
|
128
122
|
"prettier": "^2.4.1",
|
|
129
123
|
"prettier-eslint": "^13.0.0",
|
|
130
|
-
"regenerator-runtime": "^0.13.7",
|
|
131
124
|
"rollup": "^2.39.0",
|
|
132
|
-
"
|
|
125
|
+
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
126
|
+
"@typescript-eslint/parser": "^5.7.0",
|
|
133
127
|
"stylus": "^0.56.0",
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
128
|
+
"rollup-plugin-dts": "^4.0.1",
|
|
129
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
130
|
+
"rollup-plugin-typescript2": "^0.31.1",
|
|
131
|
+
"tslib": "^2.3.1",
|
|
132
|
+
"typescript": "^4.5.4",
|
|
133
|
+
"network-information-types": "^0.1.0"
|
|
137
134
|
}
|
|
138
135
|
}
|
package/speccer.css
CHANGED
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
--ph-speccer-line-width-negative: -1px;
|
|
24
24
|
--ph-speccer-measure-size: 8px;
|
|
25
25
|
}
|
|
26
|
+
body.ph {
|
|
27
|
+
margin: 12px;
|
|
28
|
+
padding: 12px;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
}
|
|
26
31
|
.ph.speccer,
|
|
27
32
|
.ph.speccer::after,
|
|
28
33
|
.ph.speccer::before {
|
|
@@ -334,13 +339,6 @@
|
|
|
334
339
|
.ph.speccer.spacing:hover {
|
|
335
340
|
border: var(--ph-speccer-line-width) solid var(--ph-speccer-color-text-dark);
|
|
336
341
|
}
|
|
337
|
-
.is-specced:hover ~ .ph.speccer.spacing.margin {
|
|
338
|
-
background-color: var(--ph-speccer-color-margin-hover);
|
|
339
|
-
}
|
|
340
|
-
.is-specced:hover ~ .ph.speccer.spacing.padding {
|
|
341
|
-
background-color: var(--ph-speccer-color-padding-hover);
|
|
342
|
-
color: var(--ph-speccer-color-text-light);
|
|
343
|
-
}
|
|
344
342
|
.ph.speccer.spacing.margin {
|
|
345
343
|
background-color: var(--ph-speccer-color-margin);
|
|
346
344
|
color: var(--ph-speccer-color-text-dark);
|
|
@@ -440,15 +438,14 @@
|
|
|
440
438
|
.ph.speccer.typography {
|
|
441
439
|
background-color: var(--ph-speccer-typography-background-color);
|
|
442
440
|
color: var(--ph-speccer-typography-color-text);
|
|
443
|
-
font-size:
|
|
444
|
-
padding: 8px
|
|
441
|
+
font-size: 10px;
|
|
442
|
+
padding: 8px;
|
|
445
443
|
max-width: none;
|
|
446
444
|
width: auto;
|
|
447
445
|
display: block;
|
|
448
446
|
text-align: left;
|
|
449
447
|
line-height: 140%;
|
|
450
448
|
border: var(--ph-speccer-line-width) solid var(--ph-speccer-pin-color);
|
|
451
|
-
min-width: 320px;
|
|
452
449
|
}
|
|
453
450
|
.ph.speccer.typography:hover {
|
|
454
451
|
border: var(--ph-speccer-line-width) solid var(--ph-speccer-pin-color);
|
|
@@ -462,14 +459,14 @@
|
|
|
462
459
|
top: 50%;
|
|
463
460
|
transform: translateY(-50%);
|
|
464
461
|
height: var(--ph-speccer-line-width);
|
|
465
|
-
width:
|
|
462
|
+
width: var(--ph-speccer-pin-space);
|
|
466
463
|
}
|
|
467
464
|
.ph.speccer.typography.left:after {
|
|
468
465
|
left: 100%;
|
|
469
466
|
top: 50%;
|
|
470
467
|
transform: translateY(-50%);
|
|
471
468
|
height: var(--ph-speccer-line-width);
|
|
472
|
-
width:
|
|
469
|
+
width: var(--ph-speccer-pin-space);
|
|
473
470
|
}
|
|
474
471
|
.ph.speccer.typography.right:after {
|
|
475
472
|
left: auto;
|
|
@@ -477,14 +474,14 @@
|
|
|
477
474
|
top: 50%;
|
|
478
475
|
transform: translateY(-50%);
|
|
479
476
|
height: var(--ph-speccer-line-width);
|
|
480
|
-
width:
|
|
477
|
+
width: var(--ph-speccer-pin-space);
|
|
481
478
|
}
|
|
482
479
|
.ph.speccer.typography.top:after {
|
|
483
480
|
left: 50%;
|
|
484
481
|
right: auto;
|
|
485
482
|
top: 100%;
|
|
486
483
|
transform: translateX(-50%);
|
|
487
|
-
height:
|
|
484
|
+
height: var(--ph-speccer-pin-space);
|
|
488
485
|
width: var(--ph-speccer-line-width);
|
|
489
486
|
}
|
|
490
487
|
.ph.speccer.typography.bottom:after {
|
|
@@ -493,7 +490,7 @@
|
|
|
493
490
|
top: auto;
|
|
494
491
|
bottom: 100%;
|
|
495
492
|
transform: translateX(-50%);
|
|
496
|
-
height:
|
|
493
|
+
height: var(--ph-speccer-pin-space);
|
|
497
494
|
width: var(--ph-speccer-line-width);
|
|
498
495
|
}
|
|
499
496
|
.ph.speccer.typography .speccer-styles {
|
|
@@ -502,15 +499,15 @@
|
|
|
502
499
|
padding: 0;
|
|
503
500
|
margin: 0;
|
|
504
501
|
line-height: 140%;
|
|
505
|
-
padding-left:
|
|
506
|
-
font-size:
|
|
502
|
+
padding-left: 8px;
|
|
503
|
+
font-size: 10px;
|
|
507
504
|
}
|
|
508
505
|
.ph.speccer.typography .speccer-styles .property {
|
|
509
506
|
font-weight: normal;
|
|
510
507
|
color: var(--ph-speccer-typography-color-property);
|
|
511
508
|
text-align: left;
|
|
512
509
|
padding: 0;
|
|
513
|
-
font-size:
|
|
510
|
+
font-size: 10px;
|
|
514
511
|
margin: 0;
|
|
515
512
|
}
|
|
516
513
|
.ph.speccer.typography .speccer-styles > li {
|
|
@@ -518,7 +515,7 @@
|
|
|
518
515
|
color: var(--ph-speccer-typography-color-value);
|
|
519
516
|
text-align: left;
|
|
520
517
|
padding: 0;
|
|
521
|
-
font-size:
|
|
518
|
+
font-size: 10px;
|
|
522
519
|
margin: 0;
|
|
523
520
|
list-style: none;
|
|
524
521
|
border: none;
|
package/speccer.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).speccer={})}(this,(function(t){"use strict";const e=(t,e)=>t.insertAdjacentElement("afterend",e),n=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;[].forEach.call(e.querySelectorAll(t),(function(t){t.remove()}))};function r(t,e,n,r,i,o,a){try{var c=t[o](a),s=c.value}catch(t){return void n(t)}c.done?e(s):Promise.resolve(s).then(r,i)}function i(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var a=t.apply(e,n);function c(t){r(a,i,o,c,s,"next",t)}function s(t){r(a,i,o,c,s,"throw",t)}c(void 0)}))}}var o=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof x?e:x,o=Object.create(i.prototype),a=new S(r||[]);return o._invoke=function(t,e,n){var r=h;return function(i,o){if(r===d)throw new Error("Generator is already running");if(r===u){if("throw"===i)throw o;return C()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var c=R(a,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=u,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var s=p(t,e,n);if("normal"===s.type){if(r=n.done?u:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r=u,n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h="suspendedStart",f="suspendedYield",d="executing",u="completed",g={};function x(){}function y(){}function m(){}var w={};s(w,o,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(A([])));b&&b!==n&&r.call(b,o)&&(w=b);var O=m.prototype=x.prototype=Object.create(w);function E(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function n(i,o,a,c){var s=p(t[i],t,o);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(s.arg)}var i;this._invoke=function(t,r){function o(){return new e((function(e,i){n(t,r,e,i)}))}return i=i?i.then(o,o):o()}}function R(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,R(t,n),"throw"===n.method))return g;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var i=p(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var o=i.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function B(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,this),this.reset(!0)}function A(t){if(t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}return{next:C}}function C(){return{value:e,done:!0}}return y.prototype=m,s(O,"constructor",m),s(m,"constructor",y),y.displayName=s(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,s(t,c,"GeneratorFunction")),t.prototype=Object.create(O),t},t.awrap=function(t){return{__await:t}},E(L.prototype),s(L.prototype,a,(function(){return this})),t.AsyncIterator=L,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new L(l(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(O),s(O,c,"Generator"),s(O,o,(function(){return this})),s(O,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=A,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:A(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}})),a=o;const c=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"noop";t&&(!e||e&&0===e.length||e.trim().split(" ").filter((t=>t!==n)).forEach((e=>t.classList.add(e))))},s=t=>parseInt(t,10),l=t=>{const e=parseFloat(t);return e>=0&&e<1||e<=0&&e>-1?0:e},p=t=>{const{marginTop:e,marginBottom:n,marginLeft:r,marginRight:i,paddingTop:o,paddingBottom:a,paddingLeft:c,paddingRight:s}=t;return{marginTop:e,marginBottom:n,marginLeft:r,marginRight:i,paddingTop:o,paddingBottom:a,paddingLeft:c,paddingRight:s}},h=t=>{const{lineHeight:e,letterSpacing:n,fontFamily:r,fontSize:i,fontStyle:o,fontVariationSettings:a,fontWeight:c}=t;return{lineHeight:e,letterSpacing:n,fontFamily:r,fontSize:i,fontStyle:o,fontVariationSettings:a,fontWeight:c}},f=()=>new Promise(requestAnimationFrame),d=function(){var t=i(a.mark((function t(e,n){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}return t.abrupt("return");case 2:if(!(!n||n&&0===n.length&&n.constructor===String||n&&0===n.length&&n.constructor===Array||n&&0===Object.keys(n).length&&n.constructor===Object)){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,f();case 6:"string"==typeof n||Array.isArray(n)?n.forEach((t=>e.style[t.key]=t.value)):Object.keys(n).forEach((t=>e.style[t]=n[t]));case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),u=function(){var t=i(a.mark((function t(e){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f();case 2:return t.abrupt("return",window.getComputedStyle?getComputedStyle(e,null):e.currentStyle);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),g=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"],x=["TR","TH","TD","TBODY","THEAD","TFOOT"],y=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"span";const n=document.createElement(e),r=document.createTextNode(t);return n.appendChild(r),n.setAttribute("title",t+"px"),c(n,"ph speccer spacing"),n},m=function(){var t=i(a.mark((function t(n){var r,i,o,h,f,g,m,w,v,b;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={},t.next=3,u(n);case 3:if("none"!==(i=t.sent).display&&"hidden"!==i.visibility){t.next=6;break}return t.abrupt("return");case 6:n.classList.add("is-specced"),"static"===u(n.parentElement).position&&window.requestAnimationFrame((()=>{n.parentElement.style.position="relative"})),r.styles=p(i),r.rect=n.getBoundingClientRect(),"0px"!==r.styles.marginTop&&(o=y(s(r.styles.marginTop)),c(o,"margin top"),d(o,{height:r.styles.marginTop,width:r.rect.width+"px",left:l(r.rect.x-n.parentElement.getBoundingClientRect().x)+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y-parseInt(r.styles.marginTop,10))+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),o):e(n,o)),"0px"!==r.styles.marginRight&&(h=y(s(r.styles.marginRight)),c(h,"margin right"),d(h,{height:r.rect.height+"px",width:r.styles.marginRight,left:l(r.rect.x-n.parentElement.getBoundingClientRect().x+parseInt(r.rect.width,10))+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y)+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),h):e(n,h)),"0px"!==r.styles.marginBottom&&(f=y(s(r.styles.marginBottom)),c(f,"margin bottom"),d(f,{height:r.styles.marginBottom,width:r.rect.width+"px",left:l(r.rect.x-n.parentElement.getBoundingClientRect().x)+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y+parseInt(r.rect.height,10))+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),f):e(n,f)),"0px"!==r.styles.marginLeft&&(g=y(s(r.styles.marginLeft)),c(g,"margin left"),d(g,{height:r.rect.height+"px",width:r.styles.marginLeft,left:l(r.rect.x-n.parentElement.getBoundingClientRect().x-parseInt(r.styles.marginLeft,10))+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y)+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),g):e(n,g)),"0px"!==r.styles.paddingTop&&(m=y(s(r.styles.paddingTop)),c(m,"padding top"),d(m,{height:r.styles.paddingTop,width:r.rect.width+"px",left:l(r.rect.x-n.parentElement.getBoundingClientRect().x)+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y)+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),m):e(n,m)),"0px"!==r.styles.paddingBottom&&(w=y(s(r.styles.paddingBottom)),c(w,"padding bottom"),d(w,{height:r.styles.paddingBottom,width:r.rect.width+"px",left:l(r.rect.x-n.parentElement.getBoundingClientRect().x)+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y+(parseInt(r.rect.height,10)-parseInt(r.styles.paddingBottom,10)))+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),w):e(n,w)),"0px"!==r.styles.paddingRight&&(v=y(s(r.styles.paddingRight)),c(v,"padding right"),d(v,{height:r.rect.height+"px",width:r.styles.paddingRight,left:l(r.rect.x-n.parentElement.getBoundingClientRect().x+(parseInt(r.rect.width,10)-parseInt(r.styles.paddingRight,10)))+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y)+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),v):e(n,v)),"0px"!==r.styles.paddingLeft&&(b=y(s(r.styles.paddingLeft)),c(b,"padding left"),d(b,{height:r.rect.height+"px",width:r.styles.paddingLeft,left:l(r.rect.x-n.parentElement.getBoundingClientRect().x)+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y)+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),b):e(n,b));case 19:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();var w=Object.freeze({__proto__:null,create:y,element:m});const v=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"span";const r=document.createElement(n),i=document.createTextNode(t);return-1===e.indexOf("full")&&-1===e.indexOf("enclose")?r.appendChild(i):-1===e.indexOf("full")&&-1===e.indexOf("enclose")||r.setAttribute("data-dissection-counter",t),c(r,`ph speccer dissection ${e}`),r},b=(t,n)=>{const r=t.getBoundingClientRect(),i=t.getAttribute("data-anatomy"),o=v(g[n],i),a=x.indexOf(t.nodeName)>=0;let c=0,s=0;if(a){const n=t.closest("table"),r=u(n.parentElement);e(n,o);const i=n.getBoundingClientRect();c=i.top-parseInt(r.getPropertyValue("padding-top"),10),s=i.left-parseInt(r.getPropertyValue("padding-left"),10)}else e(t,o);const l=t.offsetLeft,p=t.offsetTop,h=o.getBoundingClientRect();let f=(a?r.left-s:l)-h.width-48+"px",y=(a?r.top-c:p)+r.height/2-h.height/2+"px",m=(a?r.left-s:l)+r.width+48+"px",w=(a?r.top-c:p)+r.height/2-h.height/2+"px",b=(a?r.left-s:l)+r.width/2-h.width/2+"px",O=(a?r.top-c:p)-h.height-48+"px",E=(a?r.left-s:l)+r.width/2-h.width/2+"px",L=(a?r.top-c:p)+r.height+48+"px",R={};R=-1!==i.indexOf("outline")?-1!==i.indexOf("left")?-1!==i.indexOf("full")?{left:l-8+"px",top:p+-1+"px",height:r.height+"px"}:-1!==i.indexOf("enclose")?{left:l-1+"px",top:p+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:f,top:y}:-1!==i.indexOf("right")?-1!==i.indexOf("full")?{left:l+r.width+"px",top:p+-1+"px",height:r.height+"px"}:-1!==i.indexOf("enclose")?{left:l+-1+"px",top:p+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:m,top:w}:-1!==i.indexOf("top")?-1!==i.indexOf("full")?{top:p+-8+"px",left:l+-1+"px",width:r.width+"px"}:-1!==i.indexOf("enclose")?{top:p+-1+"px",left:l+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:b,top:O}:-1!==i.indexOf("bottom")?-1!==i.indexOf("full")?{top:p+r.height+"px",left:l+-1+"px",width:r.width+"px"}:-1!==i.indexOf("enclose")?{top:p+-1+"px",left:l+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:E,top:L}:-1!==i.indexOf("full")?{left:l+r.width+"px",top:p+"px",height:r.height+"px"}:-1!==i.indexOf("enclose")?{left:l+r.width+"px",top:p+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:f,top:y}:-1!==i.indexOf("full")?{left:l-8+"px",top:p+-1+"px",height:r.height+"px"}:-1!==i.indexOf("enclose")?{left:l-1+"px",top:p+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:f,top:y},d(o,R)};var O=Object.freeze({__proto__:null,create:v,element:b});const E=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"span";const r=document.createElement(n);return r.setAttribute("title",t+"px"),r.setAttribute("data-measure",parseInt(t,10)+"px"),c(r,`ph speccer measure ${e}`),r},L=t=>{if(!t)return;const n=t.getBoundingClientRect(),r=t.getAttribute("data-speccer-measure");if(""===r)return;const i=t.offsetTop,o=t.offsetLeft;if(-1!==r.indexOf("width"))if(-1!==r.indexOf("bottom")){const r=E(n.width,"width bottom");x.indexOf(t.nodeName)>=0?e(t.closest("table"),r):e(t,r),d(r,{left:o+"px",top:i+n.height+1+"px",width:n.width+"px"})}else{const r=E(n.width,"width top");x.indexOf(t.nodeName)>=0?e(t.closest("table"),r):e(t,r);const a=r.getBoundingClientRect();d(r,{left:o+"px",top:i-a.height+1+"px",width:n.width+"px"})}else if(-1!==r.indexOf("height"))if(-1!==r.indexOf("right")){const r=E(n.height,"height right");x.indexOf(t.nodeName)>=0?e(t.closest("table"),r):e(t,r),d(r,{left:o+n.width+"px",top:i+"px",height:n.height+"px"})}else{const r=E(n.height,"height left");x.indexOf(t.nodeName)>=0?e(t.closest("table"),r):e(t,r);const a=r.getBoundingClientRect();d(r,{left:o-a.width+"px",top:i+"px",height:n.height+"px"})}};var R=Object.freeze({__proto__:null,element:L});const B=t=>parseFloat(t).toFixed(3),T=(t,e)=>{const n=document.createElement("div");return n.innerHTML=t,c(n,`ph speccer typography ${e}`),n},S=function(){var t=i(a.mark((function t(n){var r,i,o,c,s,l,p,f,g,y,m,w,v,b,O,E,L,R,S,A,C;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.getAttribute("data-speccer-typography"),t.next=3,u(n);case 3:if("none"!==(i=t.sent).display&&"hidden"!==i.visibility){t.next=6;break}return t.abrupt("return");case 6:n.classList.add("is-specced"),"static"===u(n.parentElement).position&&window.requestAnimationFrame((()=>{n.parentElement.style.position="relative"})),o=h(i),c=n.getBoundingClientRect(),s=`\n font-styles: {<ul class="speccer-styles"> <li><span class="property">font-family:</span> ${o.fontFamily};</li> <li><span class="property">font-size:</span> ${o.fontSize} / ${parseInt(o.fontSize,10)/16}rem;</li> <li><span class="property">font-weight:</span> ${o.fontWeight};</li> <li><span class="property">font-variation-settings:</span> ${o.fontVariationSettings};</li> <li><span class="property">line-height:</span> ${o.lineHeight} / ${parseInt(o.lineHeight,10)/16}rem;</li> <li><span class="property">letter-spacing:</span> ${o.letterSpacing};</li> <li><span class="property">font-style:</span> ${o.fontStyle};</li></ul>}`,l=T(s,r),p=0,f=0,(g=x.indexOf(n.nodeName)>=0)?(y=n.parentElement,m=window.getComputedStyle(y.parentElement),e(y,l),p=y.getBoundingClientRect().top-parseInt(m.getPropertyValue("padding-top"),10),f=y.getBoundingClientRect().left-parseInt(m.getPropertyValue("padding-left"),10)):e(n,l),w=l.getBoundingClientRect(),v=(g?w.left-f:n.offsetLeft)-w.width-48+"px",b=B((g?w.top-p:n.offsetTop)-w.height/2+c.height/2)+"px",O=(g?w.left-f:n.offsetLeft)+c.width+48+"px",E=B((g?w.top-p:n.offsetTop)-w.height/2+c.height/2)+"px",L=B((g?w.left-f:n.offsetLeft)-w.width/2+c.width/2)+"px",R=(g?w.top-p:n.offsetTop)-w.height-48+"px",S=B((g?w.left-f:n.offsetLeft)-w.width/2+c.width/2)+"px",A=(g?w.top-p:n.offsetTop)+c.height+48+"px",C={left:v,top:b},-1!==r.indexOf("right")?C={left:O,top:E}:-1!==r.indexOf("top")?C={left:L,top:R}:-1!==r.indexOf("bottom")&&(C={left:S,top:A}),d(l,C);case 29:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();const A=t=>{const e=(n=()=>{t()},r=300,function(){var t=this,e=arguments,a=function(){o=null,i||n.apply(t,e)},c=i&&!o;clearTimeout(o),o=setTimeout(a,r),c&&n.apply(t,e)});var n,r,i,o;window.removeEventListener("resize",e),window.addEventListener("resize",e)},C=t=>{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()},_=()=>{n(".speccer"),n(".dissection");const t=document.querySelectorAll("[data-speccer],[data-speccer] *:not(td)"),e=document.querySelectorAll("[data-speccer-measure]"),r=document.querySelectorAll("[data-speccer-typography]"),i=document.querySelectorAll("[data-anatomy-section] [data-anatomy]");t.forEach(m),e.forEach(L),r.forEach(S),i.forEach(b)},N=w,j=O,I=R,k=Object.freeze({__proto__:null,create:T,element:S});(t=>{const e=document.currentScript;if(e){const n=e.getAttribute("src");-1===n.indexOf("speccer.js")&&-1===n.indexOf("JaXpOK.js")||(e.hasAttribute("data-manual")?(t=>{window.speccer=t})(t):e.hasAttribute("data-instant")?t():e.hasAttribute("data-dom")?C(t):e.hasAttribute("data-lazy")?(()=>{let t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{t.intersectionRatio>0&&(m(t.target),e.unobserve(t.target))}))}));document.querySelectorAll("[data-speccer],[data-speccer] *:not(td)").forEach((e=>{t.observe(e)}));let e=new IntersectionObserver(((t,e)=>{t.forEach((t=>{t.intersectionRatio>0&&(L(t.target),e.unobserve(t.target))}))}));document.querySelectorAll("[data-speccer-measure]").forEach((t=>{e.observe(t)}));let n=new IntersectionObserver(((t,e)=>{t.forEach((t=>{const n=t.target.querySelectorAll("[data-anatomy]");t.intersectionRatio>0&&(n.forEach(b),e.unobserve(t.target))}))}));document.querySelectorAll("[data-anatomy-section]").forEach((t=>{n.observe(t)}))})():C(t),e.hasAttribute("data-manual")||e.hasAttribute("data-lazy")||A(t))}})(_),t.default=_,t.dissect=j,t.measure=I,t.spacing=N,t.typography=k,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).speccer={})}(this,(function(t){"use strict";const e=(t,e,n="noop")=>{t&&(!e||e&&0===e.length||e.trim().split(" ").filter((t=>t!==n)).forEach((e=>t.classList.add(e))))},n=(t,e)=>`${t} ${Object.keys(e).filter((t=>e[t])).join(" ")}`.trim(),i=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"],o=t=>parseInt(t,10),p=t=>o(getComputedStyle(t).getPropertyValue("--ph-speccer-pin-space"))||48,s=()=>new Promise(requestAnimationFrame),a=async(t,e)=>{!t||!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e||Array.isArray(e)&&0===e.length||0===Object.keys(e).length&&e.constructor===Object||(await s(),Array.isArray(e)?e.forEach((e=>t.style[e.key]=e.value)):Object.keys(e).forEach((n=>t.style[n]=e[n])))},r=async t=>(await s(),getComputedStyle(t,null)),d=(t,e,n)=>t-e.width/2+n.width/2,l=(t,e,n)=>t-e.height/2+n.height/2,h=()=>{const t=getComputedStyle(document.body),e=parseInt(t.paddingLeft)+parseInt(t.marginLeft);return{top:parseInt(t.paddingTop)+parseInt(t.marginTop),left:e}},c=(t="",n="span")=>{const i=document.createElement(n),o=document.createTextNode(t+"");return i.appendChild(o),i.setAttribute("title",t+"px"),e(i,"ph speccer spacing"),i},f=async t=>{const n={},i=await r(t);if("none"===i.display||"hidden"===i.visibility||!t.parentElement)return;t.classList.add("is-specced"),n.styles=(t=>{const{marginTop:e,marginBottom:n,marginLeft:i,marginRight:o,paddingTop:p,paddingBottom:s,paddingLeft:a,paddingRight:r}=t;return{marginTop:e,marginBottom:n,marginLeft:i,marginRight:o,paddingTop:p,paddingBottom:s,paddingLeft:a,paddingRight:r}})(i);const p=t.getBoundingClientRect(),s=h(),d=t.offsetTop+s.top,l=t.offsetLeft+s.left;if("0px"!==n.styles.marginTop){const i=c(o(n.styles.marginTop));document.body.appendChild(i),e(i,"margin top"),a(i,{height:n.styles.marginTop,width:p.width+"px",transform:t.style.transform,left:l+"px",top:d-parseInt(n.styles.marginTop,10)+"px"})}if("0px"!==n.styles.marginRight){const i=c(o(n.styles.marginRight));e(i,"margin right"),a(i,{height:p.height+"px",width:n.styles.marginRight,transform:t.style.transform,left:l+parseInt(p.width+"",10)+"px",top:d+"px"}),document.body.appendChild(i)}if("0px"!==n.styles.marginBottom){const i=c(o(n.styles.marginBottom));e(i,"margin bottom"),a(i,{height:n.styles.marginBottom,width:p.width+"px",transform:t.style.transform,left:l+"px",top:d+parseInt(p.height+"",10)+"px"}),document.body.appendChild(i)}if("0px"!==n.styles.marginLeft){const i=c(o(n.styles.marginLeft));e(i,"margin left"),a(i,{height:p.height+"px",width:n.styles.marginLeft,transform:t.style.transform,left:l-parseInt(n.styles.marginLeft,10)+"px",top:d+"px"}),document.body.appendChild(i)}if("0px"!==n.styles.paddingTop){const i=c(o(n.styles.paddingTop));e(i,"padding top"),a(i,{height:n.styles.paddingTop,width:p.width+"px",transform:t.style.transform,left:l+"px",top:d+"px"}),document.body.appendChild(i)}if("0px"!==n.styles.paddingBottom){const i=c(o(n.styles.paddingBottom));e(i,"padding bottom"),a(i,{height:n.styles.paddingBottom,width:p.width+"px",transform:t.style.transform,left:l+"px",top:d+(parseInt(p.height+"",10)-parseInt(n.styles.paddingBottom,10))+"px"}),document.body.appendChild(i)}if("0px"!==n.styles.paddingRight){const i=c(o(n.styles.paddingRight));e(i,"padding right"),a(i,{height:p.height+"px",width:n.styles.paddingRight,transform:t.style.transform,left:l+(parseInt(p.width+"",10)-parseInt(n.styles.paddingRight,10))+"px",top:d+"px"}),document.body.appendChild(i)}if("0px"!==n.styles.paddingLeft){const i=c(o(n.styles.paddingLeft));e(i,"padding left"),a(i,{height:p.height+"px",width:n.styles.paddingLeft,transform:t.style.transform,left:l+"px",top:d+"px"}),document.body.appendChild(i)}};var g,m,u=Object.freeze({__proto__:null,create:c,element:f});!function(t){t.Empty="",t.Left="left",t.Right="right",t.Bottom="bottom",t.Top="top"}(g||(g={})),function(t){t.Outline="outline",t.Enclose="enclose",t.Full="full",t.Left="left",t.Right="right",t.Bottom="bottom",t.Top="top"}(m||(m={}));const x=(t,e=3)=>parseFloat(t+"").toFixed(e),y=(t="",i,o="span")=>{const p=document.createElement(o),s=document.createTextNode(t),a={};null!==i&&""!==i&&(a[i]=!0),-1===i.indexOf(m.Full)&&-1===i.indexOf(m.Enclose)?p.appendChild(s):-1===i.indexOf(m.Full)&&-1===i.indexOf(m.Enclose)||p.setAttribute("data-dissection-counter",t);const r=n("ph speccer dissection",a);return e(p,r),p},w=async(t,e)=>{if(!t)return;const n=t.getAttribute("data-anatomy")||"";if(!n||""===n)return;const o=y(i[e],n);document.body.appendChild(o);const s=((t,e,n)=>{const i=e.getBoundingClientRect(),o=p(n),s=n.getBoundingClientRect(),a=h(),r=e.offsetTop+a.top,c=e.offsetLeft+a.left,f=c-s.width-o+"px",g=x(l(r,s,i))+"px",u=c+i.width+o+"px",y=x(l(r,s,i))+"px",w=x(d(c,s,i))+"px",b=r-s.height-o+"px",O=x(d(c,s,i))+"px",E=r+i.height+o+"px";let A={};return A=-1!==t.indexOf(m.Outline)?-1!==t.indexOf(m.Left)?-1!==t.indexOf(m.Full)?{left:c-8+"px",top:r+-1+"px",height:i.height+"px"}:-1!==t.indexOf(m.Enclose)?{left:c-1+"px",top:r+-1+"px",height:i.height+"px",width:i.width+"px"}:{left:f,top:g}:-1!==t.indexOf(m.Right)?-1!==t.indexOf(m.Full)?{left:c+i.width+"px",top:r+-1+"px",height:i.height+"px"}:-1!==t.indexOf(m.Enclose)?{left:c+-1+"px",top:r+-1+"px",height:i.height+"px",width:i.width+"px"}:{left:u,top:y}:-1!==t.indexOf(m.Top)?-1!==t.indexOf(m.Full)?{top:r+-8+"px",left:c+-1+"px",width:i.width+"px"}:-1!==t.indexOf(m.Enclose)?{top:r+-1+"px",left:c+-1+"px",height:i.height+"px",width:i.width+"px"}:{left:w,top:b}:-1!==t.indexOf(m.Bottom)?-1!==t.indexOf(m.Full)?{top:r+i.height+"px",left:c+-1+"px",width:i.width+"px"}:-1!==t.indexOf(m.Enclose)?{top:r+-1+"px",left:c+-1+"px",height:i.height+"px",width:i.width+"px"}:{left:O,top:E}:-1!==t.indexOf(m.Full)?{left:c+i.width+"px",top:r+"px",height:i.height+"px"}:-1!==t.indexOf(m.Enclose)?{left:c+i.width+"px",top:r+-1+"px",height:i.height+"px",width:i.width+"px"}:{left:f,top:g}:-1!==t.indexOf(m.Full)?{left:c-8+"px",top:r+-1+"px",height:i.height+"px"}:-1!==t.indexOf(m.Enclose)?{left:c-1+"px",top:r+-1+"px",height:i.height+"px",width:i.width+"px"}:{left:f,top:g},A})(n,t,o);a(o,s)};const b=(t="",n="",i="span")=>{const o=document.createElement(i);return o.setAttribute("title",t+"px"),o.setAttribute("data-measure",parseInt(t+"",10)+"px"),e(o,`ph speccer measure ${n}`),o},O=t=>{if(!t)return;const e=t.getBoundingClientRect(),n=t.getAttribute("data-speccer-measure");if(""===n||!n)return;const i=h(),o=t.offsetTop+i.top,p=t.offsetLeft+i.left;if(-1!==n.indexOf("width"))if(-1!==n.indexOf("bottom")){const t=b(e.width,"width bottom");document.body.appendChild(t),a(t,{left:p+"px",top:o+e.height+1+"px",width:e.width+"px"})}else{const t=b(e.width,"width top");document.body.appendChild(t);const n=t.getBoundingClientRect();a(t,{left:p+"px",top:o-n.height+1+"px",width:e.width+"px"})}else if(-1!==n.indexOf("height"))if(-1!==n.indexOf("right")){const t=b(e.height,"height right");document.body.appendChild(t),a(t,{left:p+e.width+"px",top:o+"px",height:e.height+"px"})}else{const t=b(e.height,"height left");document.body.appendChild(t);const n=t.getBoundingClientRect();a(t,{left:p-n.width+"px",top:o+"px",height:e.height+"px"})}};const E=(t,i)=>{const o=document.createElement("div"),p={};null!==i&&""!==i&&(p[i]=!0);const s=n("ph speccer typography",p);return o.innerHTML=t,e(o,s),o};const A=t=>{const e=()=>function(t,e,n){let i;return function(){const o=this,p=arguments,s=function(){i=null,n||t.apply(o,p)},a=n&&!i;i&&clearTimeout(i),i=setTimeout(s,e),a&&t.apply(o,p)}}((()=>{t()}),300);window.removeEventListener("resize",e),window.addEventListener("resize",e)},C=t=>{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{t()})):t()},L=u,T=Object.freeze({__proto__:null,create:y,element:w}),S=Object.freeze({__proto__:null,element:O}),R=Object.freeze({__proto__:null,create:E,element:async t=>{if(!t)return;const e=t.getAttribute("data-speccer-typography"),n=await r(t);if("none"===n.display||"hidden"===n.visibility||!t.parentElement)return;t.classList.add("is-specced");const i=await(async t=>{const e=(t=>{const{lineHeight:e,letterSpacing:n,fontFamily:i,fontSize:o,fontStyle:p,fontVariationSettings:s,fontWeight:a}=t;return{lineHeight:e,letterSpacing:n,fontFamily:i,fontSize:o,fontStyle:p,fontVariationSettings:s,fontWeight:a}})(await r(t));return`\nfont-styles: {<ul class="speccer-styles"> <li><span class="property">font-family:</span> ${e.fontFamily};</li> <li><span class="property">font-size:</span> ${e.fontSize} / ${parseInt(e.fontSize,10)/16}rem;</li> <li><span class="property">font-weight:</span> ${e.fontWeight};</li> <li><span class="property">font-variation-settings:</span> ${e.fontVariationSettings};</li> <li><span class="property">line-height:</span> ${e.lineHeight} / ${parseInt(e.lineHeight,10)/16}rem;</li> <li><span class="property">letter-spacing:</span> ${e.letterSpacing};</li> <li><span class="property">font-style:</span> ${e.fontStyle};</li></ul>}`})(t),o=E(i,e);document.body.appendChild(o);const s=((t,e,n)=>{const i=e.getBoundingClientRect(),o=p(n),s=n.getBoundingClientRect(),a=h(),r=e.offsetTop+a.top,c=e.offsetLeft+a.left,f=c-s.width-o+"px",m=x(l(r,s,i))+"px",u=c+i.width+o+"px",y=x(l(r,s,i))+"px",w=x(d(c,s,i))+"px",b=r-s.height-o+"px",O=x(d(c,s,i))+"px",E=r+i.height+o+"px";let A={left:f,top:m};return t&&-1!==t.indexOf(g.Right)?A={left:u,top:y}:t&&-1!==t.indexOf(g.Top)?A={left:w,top:b}:t&&-1!==t.indexOf(g.Bottom)&&(A={left:O,top:E}),A})(e,t,o);a(o,s)}}),B=()=>{((t,e=document)=>{[].forEach.call(e.querySelectorAll(t),(function(t){t.remove()}))})(".speccer");const t=document.querySelectorAll("[data-speccer],[data-speccer] *:not(td)"),e=document.querySelectorAll("[data-speccer-measure]"),n=document.querySelectorAll("[data-speccer-typography]"),i=document.querySelectorAll("[data-anatomy-section] [data-anatomy]");t.forEach(L.element),e.forEach(S.element),n.forEach(R.element),i.forEach(T.element)};(t=>{const e=document.currentScript;if(e){const n=e.getAttribute("src");!n||-1===n.indexOf("speccer.js")&&-1===n.indexOf("JaXpOK.js")||(e.hasAttribute("data-manual")?(t=>{window.speccer=t})(t):e.hasAttribute("data-instant")?t():e.hasAttribute("data-dom")?C(t):e.hasAttribute("data-lazy")?(()=>{const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{t.intersectionRatio>0&&(f(t.target),e.unobserve(t.target))}))}));document.querySelectorAll("[data-speccer],[data-speccer] *:not(td)").forEach((e=>{t.observe(e)}));const e=new IntersectionObserver(((t,e)=>{t.forEach((t=>{t.intersectionRatio>0&&(O(t.target),e.unobserve(t.target))}))}));document.querySelectorAll("[data-speccer-measure]").forEach((t=>{e.observe(t)}));const n=new IntersectionObserver(((t,e)=>{t.forEach((t=>{const n=t.target.querySelectorAll("[data-anatomy]");t.intersectionRatio>0&&(n.forEach(w),e.unobserve(t.target))}))}));document.querySelectorAll("[data-anatomy-section]").forEach((t=>{n.observe(t)}))})():C(t),e.hasAttribute("data-manual")||e.hasAttribute("data-lazy")||A(t))}})(B),t.default=B,t.dissect=T,t.measure=S,t.spacing=L,t.typography=R,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
2
|
+
//# sourceMappingURL=speccer.js.map
|