@phun-ky/speccer 10.1.0 → 11.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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  ## About
8
8
 
9
- ![Image of speccer](./public/speccer.png)
9
+ ![Image of speccer](./public/speccer-pin-parent-align-light.png)
10
10
 
11
11
  **SPECCER** was originally created to simplify documenting components in a design system, but it can be used to highlight any HTML element on a webpage. If you need to draw attention to elements, **SPECCER** is your tool!
12
12
 
@@ -25,9 +25,12 @@
25
25
  - [Features](#features)
26
26
  - [Element spacing](#element-spacing)
27
27
  - [Element dimensions](#element-dimensions)
28
- - [Subtle measure](#subtle-measure)
28
+ - [Slim measure](#slim-measure)
29
29
  - [Pin element to highlight the anatomy](#pin-element-to-highlight-the-anatomy)
30
+ - [Default](#default)
31
+ - [Enclose](#enclose)
30
32
  - [Align with parent container](#align-with-parent-container)
33
+ - [Pin with text](#pin-with-text)
31
34
  - [Custom literals](#custom-literals)
32
35
  - [Subtle anatomy](#subtle-anatomy)
33
36
  - [Curly brackets](#curly-brackets)
@@ -199,7 +202,7 @@ export default Component;
199
202
 
200
203
  ### Element spacing
201
204
 
202
- ![Image of speccer](./public/spacing.png)
205
+ ![Image of the spacing feature](./public/speccer-spacing-light.png)
203
206
 
204
207
  Use the following attribute to display element padding and margin:
205
208
 
@@ -209,29 +212,44 @@ Use the following attribute to display element padding and margin:
209
212
 
210
213
  This will display the element _and all of it's children_ padding and margin.
211
214
 
215
+ ![Image of the spacing feature in dark mode](./public/speccer-spacing-dark.png)
216
+
212
217
  ### Element dimensions
213
218
 
214
- ![Image of speccer](./public/measure.png)
219
+ ![Image of the measure feature](./public/speccer-measure-right-full-light.png)
220
+ ![Image of the measure feature](./public/speccer-measure-bottom-dark.png)
215
221
 
216
222
  Display dimensions with:
217
223
 
218
224
  ```html
219
225
  <div
220
- data-speccer="measure [height right|left] | [width top|bottom]"
226
+ data-speccer="measure [height left|right] | [width top|bottom]"
221
227
  class="..."
222
228
  ></div>
223
229
  ```
224
230
 
225
231
  Where `height` and `width` comes with placement flags. Default for `height` is `left`, default for `width` is `top`.
226
232
 
227
- #### Subtle measure
233
+ ![Image of the measure feature](./public/speccer-measure-spacing-example-dark.png)
234
+
235
+ #### Slim measure
228
236
 
229
- ![Image of subtle option for measure](./public/subtle-measure.png)
237
+ ![Image of slim option for measure](./public/speccer-measure-right-light.png)
230
238
 
231
- Use a subtle style:
239
+ Use a slim style:
232
240
 
233
241
  ```html
234
- <div data-speccer="measure height left subtle" class="..."></div>
242
+ <div data-speccer="measure slim height left" class="..."></div>
243
+ ```
244
+
245
+ This will give a slimmer look and feel.
246
+
247
+ ##### Subtle slim measure
248
+
249
+ Use a subtle style for the slim option, uses a dashed line instead of a solid line:
250
+
251
+ ```html
252
+ <div data-speccer="measure slim height left subtle" class="..."></div>
235
253
  ```
236
254
 
237
255
  This will give a dashed border.
@@ -253,9 +271,39 @@ In your component examples, use the following attribute. Remember to use the `da
253
271
 
254
272
  This will place a pin to the outline of the element. Default is `top`.
255
273
 
274
+ #### Default
275
+
276
+ ![Image of speccer](./public/speccer-pin-default-light.png)
277
+
278
+ ```html
279
+ <div data-speccer="pin-area">
280
+ <div data-speccer="pin" class="..."></div>
281
+ </div>
282
+ ```
283
+
284
+ #### Enclose
285
+
286
+ ![Image of speccer](./public/speccer-pin-enclose-light.png)
287
+
288
+ ```html
289
+ <div data-speccer="pin-area">
290
+ <div data-speccer="pin enclose" class="..."></div>
291
+ </div>
292
+ ```
293
+
294
+ ##### Subtle enclose
295
+
296
+ ![Image of speccer](./public/speccer-pin-enclose-subtle-light.png)
297
+
298
+ ```html
299
+ <div data-speccer="pin-area">
300
+ <div data-speccer="pin enclose" class="..."></div>
301
+ </div>
302
+ ```
303
+
256
304
  #### Align with parent container
257
305
 
258
- ![Screenshot of the dissection/anatomy feature where the pins are aligned with the parent container](./public/align-parent.png)
306
+ ![Screenshot of the dissection/anatomy feature where the pins are aligned with the parent container](./public/speccer-pin-parent-align-default-light.png)
259
307
 
260
308
  You can also align the pins to the parent container.
261
309
 
@@ -287,9 +335,28 @@ The lines from the element to the pin is drawn with a svg path and circle, so re
287
335
  </svg>
288
336
  ```
289
337
 
338
+ ![Screenshot of the dissection/anatomy feature where the pins are aligned with the parent container](./public/speccer-pin-parent-align-light.png)
339
+
340
+ #### Pin with text
341
+
342
+ ![Image of text pin option](./public/speccer-pin-text-light.png)
343
+
344
+ If you want _text-in-place_ pinning feature, instead of referencing the pins, you can use the `text` feature:
345
+
346
+ ```html
347
+ <input
348
+ type="text"
349
+
350
+ data-speccer="pin left text"
351
+ data-speccer-title="Static text"
352
+ data-speccer-description="Document size [xx] by [yy][units]"
353
+
354
+ />
355
+ ```
356
+
290
357
  #### Custom literals
291
358
 
292
- ![Image of japanese literals instead of latin characters](./public/literals.png)
359
+ ![Image of japanese literals instead of latin characters](./public/speccer-pin-symbols-light.png)
293
360
 
294
361
  You can use custom literals by assigned a global variable with the literals you want:
295
362
 
@@ -307,9 +374,27 @@ window.SPECCER_LITERALS = [
307
374
  ];
308
375
  ```
309
376
 
377
+ Or with a data attribute on the `data-speccer="pin-area"`-element:
378
+
379
+ ```html
380
+ <div data-speccer="pin-area" data-speccer-literals="ऄ|अआइईउऊऋऌऍऎएऐऑऒओऔकखगघङच">
381
+
382
+ </div>
383
+ ```
384
+
385
+ > [!TIP]
386
+ > Try it out with emoticons!
387
+ >
388
+ > ```js
389
+ > window.SPECCER_LITERALS = [
390
+ > '🥰',
391
+ > …
392
+ > ];
393
+ > ```
394
+
310
395
  #### Subtle anatomy
311
396
 
312
- ![Image of subtle option for anatomy](./public/subtle.png)
397
+ ![Image of subtle option for anatomy](./public/speccer-pin-default-subtle-light.png)
313
398
 
314
399
  You can also give a more subtle touch to the anatomy elements.
315
400
 
@@ -325,6 +410,8 @@ This will give a dashed border, and a more subtle pin style.
325
410
 
326
411
  You can use curly brackets with the `curly` tag in `data-speccer` along side `pin bracket` to provide a more sleek style.
327
412
 
413
+ ![Image of curly option for anatomy](./public/speccer-pin-curly-light.png)
414
+
328
415
  > [!NOTE]
329
416
  > Only works with `pin bracket`
330
417
 
@@ -355,7 +442,7 @@ from v9.5 you can utilize the `pin` feature to highlight the anatomy of an eleme
355
442
 
356
443
  ### Element typography
357
444
 
358
- ![Image of typography speccer](./public/typography.png)
445
+ ![Image of typography speccer](./public/speccer-typography-light.png)
359
446
 
360
447
  Display typography details:
361
448
 
@@ -412,11 +499,11 @@ Here is an example with these colors and overrides:
412
499
  }
413
500
  ```
414
501
 
415
- ![Screenshot of typgraphy with different syntax theme](./public/typography-syntax.png)
502
+ ![Screenshot of typgraphy with different syntax theme](./public/speccer-typography-syntax-light.png)
416
503
 
417
504
  ### Grid spacing
418
505
 
419
- ![Screenshot of grid feature](./public/grid.png)
506
+ ![Screenshot of grid feature](./public/speccer-grid-full-light.png)
420
507
 
421
508
  This will highlight the grid spacing in a `display: grid;` element.
422
509
 
@@ -426,15 +513,18 @@ In your component examples, use the following attribute on your grid container.
426
513
  <div data-speccer="grid" …>…</div>
427
514
  ```
428
515
 
429
- If you only want to display `rows` or `columns`, use this syntax (default is both with `grid` only):
516
+ > [!TIP]
517
+ > If you only want to display `rows` or `columns`, use this syntax (default is both with `grid` only):
518
+ >
519
+ > ```html
520
+ > <div data-speccer="grid [rows|columns]" …>…</div>
521
+ > ```
430
522
 
431
- ```html
432
- <div data-speccer="grid [rows|columns]" …>…</div>
433
- ```
523
+ ![Screenshot of grid feature](./public/speccer-grid-full-dark.png)
434
524
 
435
525
  ### Mark elements
436
526
 
437
- ![Screenshot of marked elements](./public/mark.png)
527
+ ![Screenshot of marked elements](./public/speccer-pin-mark-light.png)
438
528
 
439
529
  This will mark the given elements.
440
530
 
@@ -452,19 +542,19 @@ Prior art: [Jeremy Elder](https://twitter.com/JeremyElder)
452
542
 
453
543
  #### Tab stops
454
544
 
455
- ![Screenshot of speccer a11y tab stops in use](./public/a11y-tabstop.png)
545
+ ![Screenshot of speccer a11y tab stops in use](./public/speccer-a11y-tabstops-light.png)
456
546
 
457
547
  If you want to display tab stops, append `data-speccer="a11y tabstops"` as an attribute to the container you want to display the tab stops in.
458
548
 
459
549
  #### Landmarks and regions
460
550
 
461
- ![Screenshot of speccer a11y landmarks in use](./public/a11y-landmark.png)
551
+ ![Screenshot of speccer a11y landmarks in use](./public/speccer-a11y-landmarks-light.png)
462
552
 
463
553
  If you want to display landmarks and regions, append `data-speccer="a11y landmark"` as an attribute to the container you want to display the landmarks and regions in.
464
554
 
465
555
  #### Keys and shortcut
466
556
 
467
- ![Screenshot of speccer a11y shortcuts in use](./public/a11y-shortcut.png)
557
+ ![Screenshot of speccer a11y shortcuts in use](./public/speccer-a11y-shortcuts-light.png)
468
558
 
469
559
  If you want to display the shortcut with keys used for elements, use `data-speccer="a11y shortcut"` and `data-speccer-a11y-shortcut="<shortcut>"` on the element that uses this shortcut:
470
560
 
@@ -480,7 +570,7 @@ If you want to display the shortcut with keys used for elements, use `data-specc
480
570
 
481
571
  ### Customization
482
572
 
483
- ![Screenshot of speccer in a dark mode example](./public/darkmode.png)
573
+ ![Screenshot of speccer in a dark mode example](./public/speccer-measure-spacing-example-dark.png)
484
574
 
485
575
  Allthough the styling works nicely with dark mode, you can use the provided CSS variables to customize the look and feel. If more control is needed, you can use CSS overrides :)
486
576
 
@@ -497,18 +587,17 @@ Allthough the styling works nicely with dark mode, you can use the provided CSS
497
587
  --ph-speccer-color-fuchsiaBlue: #7e60c5;
498
588
  --ph-speccer-base-color: var(--ph-speccer-color-artificialStrawberry);
499
589
  --ph-speccer-spacing-color: var(--ph-speccer-base-color);
500
- --ph-speccer-spacing-color-padding: rgb(
590
+ --ph-speccer-spacing-padding-color: var(--ph-speccer-color-carbon);
591
+ --ph-speccer-spacing-padding-color-background: rgb(
501
592
  from var(--ph-speccer-color-venusSlipperOrchid) r g b /
502
593
  var(--ph-speccer-opacity-40)
503
594
  );
504
- --ph-speccer-spacing-color-padding-hover: var(
505
- --ph-speccer-color-venusSlipperOrchid
506
- );
507
- --ph-speccer-spacing-color-margin: rgb(
595
+ --ph-speccer-spacing-margin-color: var(--ph-speccer-color-red);
596
+ --ph-speccer-spacing-margin-color-background: rgb(
508
597
  from var(--ph-speccer-color-superBanana) r g b /
509
598
  var(--ph-speccer-opacity-40)
510
599
  );
511
- --ph-speccer-spacing-color-margin-hover: var(--ph-speccer-color-superBanana);
600
+ --ph-speccer-spacing-line-width: var(--ph-speccer-line-width);
512
601
  --ph-speccer-typography-background-color: var(--ph-speccer-color-white);
513
602
  --ph-speccer-typography-color-property: var(--ph-speccer-color-niuZaiSeDenim);
514
603
  --ph-speccer-typography-color-text: var(--ph-speccer-base-color);
@@ -517,9 +606,11 @@ Allthough the styling works nicely with dark mode, you can use the provided CSS
517
606
  from var(--ph-speccer-base-color) r g b / var(--ph-speccer-opacity-20)
518
607
  );
519
608
  --ph-speccer-mark-border-color: var(--ph-speccer-base-color);
520
- --ph-speccer-mark-border-width: 1px;
609
+ --ph-speccer-mark-border-width: 1.5px;
521
610
  --ph-speccer-mark-border-style: solid;
522
611
  --ph-speccer-measure-color: var(--ph-speccer-color-red);
612
+ --ph-speccer-measure-line-width: 1.5px;
613
+ --ph-speccer-measure-border-style: dotted;
523
614
  --ph-speccer-measure-size: 8px;
524
615
  --ph-speccer-a11y-color-background: var(--ph-speccer-color-beautifulBlue);
525
616
  --ph-speccer-a11y-landmark-color-background: var(
@@ -531,8 +622,8 @@ Allthough the styling works nicely with dark mode, you can use the provided CSS
531
622
  --ph-speccer-pin-size: 24px;
532
623
  --ph-speccer-pin-space: 48px;
533
624
  --ph-speccer-line-height: 12px;
534
- --ph-speccer-line-width: 1px;
535
- --ph-speccer-line-width-negative: -1px;
625
+ --ph-speccer-line-width: 1.5px;
626
+ --ph-speccer-line-width-negative: -1.5px;
536
627
  --ph-speccer-opacity-20: 0.2;
537
628
  --ph-speccer-opacity-40: 0.4;
538
629
  --ph-speccer-font-family: 'Menlo for Powerline', 'Menlo Regular for Powerline',