@phun-ky/speccer 7.0.0 → 8.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.
Files changed (3) hide show
  1. package/README.md +14 -9
  2. package/package.json +3 -2
  3. package/speccer.d.ts +52 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @phun-ky/speccer
2
2
 
3
- ![logo](./public/logo-speccer-colored-dark.svg)
3
+ ![logo](./public/logo-speccer-colored-package.svg)
4
4
 
5
5
  > A zero dependency package to highlight elements
6
6
 
@@ -12,9 +12,10 @@
12
12
  1. [About](#about)
13
13
  2. [API](#api)
14
14
  3. [Usage](#usage)
15
- 1. [ESM](#esm)
16
- 2. [Script](#script)
17
- 3. [React](#react)
15
+ 1. [Typescript](#typescript)
16
+ 2. [ESM](#esm)
17
+ 3. [Script](#script)
18
+ 4. [React](#react)
18
19
  4. [Advanced usage](#advanced-usage)
19
20
  1. [Lazy](#lazy)
20
21
  5. [Features](#features)
@@ -24,15 +25,15 @@
24
25
  3. [Highlight the anatomy of an element](#highlight-the-anatomy-of-an-element)
25
26
  1. [Subtle anatomy](#subtle-anatomy)
26
27
  4. [Curly brackets](#curly-brackets)
27
- 5. [Element typogpraphy](#element-typogpraphy)
28
+ 5. [Element typography](#element-typography)
28
29
  6. [Mark elements](#mark-elements)
29
30
  6. [Customization](#customization)
30
31
 
31
32
  ## About
32
33
 
33
- Speccer was created to make it easier to document components in a design system.
34
+ Speccer was originally created to make it easier to document components in a design system, but you can use it to whatever you like, if you are in the need to highlight any element!
34
35
 
35
- ```zsh
36
+ ```shell-session
36
37
  npm i @phun-ky/speccer
37
38
  ```
38
39
 
@@ -40,10 +41,14 @@ See demo here: <https://codepen.io/phun-ky/pen/xaOrYX>
40
41
 
41
42
  ## API
42
43
 
43
- Go [here](api/README.md) to read the full API documentation.
44
+ Go [here](https://github.com/phun-ky/speccer/blob/main/api/README.md) to read the full API documentation.
44
45
 
45
46
  ## Usage
46
47
 
48
+ ### Typescript
49
+
50
+ Types can be found in `@phun-ky/speccer/speccer.d.ts`.
51
+
47
52
  ### ESM
48
53
 
49
54
  Either import and run the required functions:
@@ -239,7 +244,7 @@ The curly brackets are made with SVG paths, and it is required to have the follo
239
244
 
240
245
  This will give a dashed border, and a more subtle pin style.
241
246
 
242
- ### Element typogpraphy
247
+ ### Element typography
243
248
 
244
249
  ![Image of typography speccer](./public/typography.png)
245
250
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phun-ky/speccer",
3
- "version": "7.0.0",
3
+ "version": "8.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": {
@@ -25,7 +25,8 @@
25
25
  "/speccer.js",
26
26
  "/speccer.js.map",
27
27
  "/speccer.min.css",
28
- "/speccer.css"
28
+ "/speccer.css",
29
+ "/speccer.d.ts"
29
30
  ],
30
31
  "repository": {
31
32
  "type": "git",
package/speccer.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ declare type SpeccerFunctionType = () => void;
2
+
3
+ /**
4
+ * Extends the global Window interface to add custom properties.
5
+ */
6
+ declare global {
7
+ interface Window {
8
+ /**
9
+ * Represents the DrawSVGCurlyBracket class for drawing curly brackets.
10
+ */
11
+ DrawSVGCurlyBracket: any;
12
+ /**
13
+ * Represents the DrawSVGLine class for drawing lines.
14
+ */
15
+ DrawSVGLine: any;
16
+ /**
17
+ * Represents the speccer object for additional functionality.
18
+ */
19
+ speccer: any;
20
+ }
21
+ }
22
+ //# sourceMappingURL=global.d.ts.map
23
+
24
+ declare const spacing: {
25
+ create: (text?: string | number, tag?: string) => HTMLElement;
26
+ element: (targetEl: HTMLElement) => Promise<void>;
27
+ };
28
+ declare const dissect: {
29
+ create: (textContent: string | undefined, area: string, n?: string) => HTMLElement;
30
+ element: (sectionEl: HTMLElement) => Promise<void>;
31
+ };
32
+ declare const measure: {
33
+ create: (text?: string | number, area?: string | null, tag?: string) => HTMLElement;
34
+ element: (targetEl: HTMLElement) => Promise<void>;
35
+ };
36
+ declare const mark: {
37
+ create: (n?: string) => HTMLElement;
38
+ element: (elementToMark: HTMLElement) => Promise<void>;
39
+ };
40
+ declare const typography: {
41
+ create: (html: string, area: string | null) => HTMLElement;
42
+ element: (targetEl: HTMLElement) => Promise<void>;
43
+ };
44
+ declare const modes: {
45
+ dom: (speccer: SpeccerFunctionType) => void;
46
+ lazy: () => void;
47
+ manual: (speccer: SpeccerFunctionType) => void;
48
+ activate: (speccer: SpeccerFunctionType) => void;
49
+ };
50
+ declare const speccer: () => void;
51
+
52
+ export { speccer as default, dissect, mark, measure, modes, spacing, typography };