@phun-ky/speccer 10.1.0 → 11.1.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
 
@@ -24,10 +24,14 @@
24
24
  - [React](#react)
25
25
  - [Features](#features)
26
26
  - [Element spacing](#element-spacing)
27
+ - [Bound spacing](#bound-spacing)
27
28
  - [Element dimensions](#element-dimensions)
28
- - [Subtle measure](#subtle-measure)
29
+ - [Slim measure](#slim-measure)
29
30
  - [Pin element to highlight the anatomy](#pin-element-to-highlight-the-anatomy)
31
+ - [Default](#default)
32
+ - [Enclose](#enclose)
30
33
  - [Align with parent container](#align-with-parent-container)
34
+ - [Pin with text](#pin-with-text)
31
35
  - [Custom literals](#custom-literals)
32
36
  - [Subtle anatomy](#subtle-anatomy)
33
37
  - [Curly brackets](#curly-brackets)
@@ -199,39 +203,64 @@ export default Component;
199
203
 
200
204
  ### Element spacing
201
205
 
202
- ![Image of speccer](./public/spacing.png)
206
+ ![Image of the spacing feature](./public/speccer-spacing-light.png)
203
207
 
204
208
  Use the following attribute to display element padding and margin:
205
209
 
206
210
  ```html
207
- <div data-speccer="spacing" class="..."></div>
211
+ <div data-speccer="spacing [padding|margin] [bound]" class=""></div>
208
212
  ```
209
213
 
210
- This will display the element _and all of it's children_ padding and margin.
214
+ This will display the element _and all of it's children_ padding and margin, unless you specify `padding` and `margin`
215
+
216
+ ![Image of the spacing feature in dark mode](./public/speccer-spacing-dark.png)
217
+
218
+ #### Bound spacing
219
+
220
+ ![spacing](./public/speccer-spacing-bound.png)
221
+
222
+ This option binds the speccer elements to the bounds of the element container.
223
+
224
+ ```html
225
+ <div data-speccer="spacing bound" class="…"></div>
226
+ ```
211
227
 
212
228
  ### Element dimensions
213
229
 
214
- ![Image of speccer](./public/measure.png)
230
+ ![Image of the measure feature](./public/speccer-measure-right-full-light.png)
231
+ ![Image of the measure feature](./public/speccer-measure-bottom-dark.png)
215
232
 
216
233
  Display dimensions with:
217
234
 
218
235
  ```html
219
236
  <div
220
- data-speccer="measure [height right|left] | [width top|bottom]"
221
- class="..."
237
+ data-speccer="measure [height left|right] | [width top|bottom]"
238
+ class=""
222
239
  ></div>
223
240
  ```
224
241
 
225
242
  Where `height` and `width` comes with placement flags. Default for `height` is `left`, default for `width` is `top`.
226
243
 
227
- #### Subtle measure
244
+ ![Image of the measure feature](./public/speccer-measure-spacing-example-dark.png)
245
+
246
+ #### Slim measure
228
247
 
229
- ![Image of subtle option for measure](./public/subtle-measure.png)
248
+ ![Image of slim option for measure](./public/speccer-measure-right-light.png)
230
249
 
231
- Use a subtle style:
250
+ Use a slim style:
232
251
 
233
252
  ```html
234
- <div data-speccer="measure height left subtle" class="..."></div>
253
+ <div data-speccer="measure slim height left" class=""></div>
254
+ ```
255
+
256
+ This will give a slimmer look and feel.
257
+
258
+ ##### Subtle slim measure
259
+
260
+ Use a subtle style for the slim option, uses a dashed line instead of a solid line:
261
+
262
+ ```html
263
+ <div data-speccer="measure slim height left subtle" class="…"></div>
235
264
  ```
236
265
 
237
266
  This will give a dashed border.
@@ -246,22 +275,52 @@ In your component examples, use the following attribute. Remember to use the `da
246
275
  <div data-speccer="pin-area">
247
276
  <div
248
277
  data-speccer="pin [bracket [curly] |enclose] [left|right|top|bottom]"
249
- class="..."
278
+ class=""
250
279
  ></div>
251
280
  </div>
252
281
  ```
253
282
 
254
283
  This will place a pin to the outline of the element. Default is `top`.
255
284
 
285
+ #### Default
286
+
287
+ ![Image of speccer](./public/speccer-pin-default-light.png)
288
+
289
+ ```html
290
+ <div data-speccer="pin-area">
291
+ <div data-speccer="pin" class="…"></div>
292
+ </div>
293
+ ```
294
+
295
+ #### Enclose
296
+
297
+ ![Image of speccer](./public/speccer-pin-enclose-light.png)
298
+
299
+ ```html
300
+ <div data-speccer="pin-area">
301
+ <div data-speccer="pin enclose" class="…"></div>
302
+ </div>
303
+ ```
304
+
305
+ ##### Subtle enclose
306
+
307
+ ![Image of speccer](./public/speccer-pin-enclose-subtle-light.png)
308
+
309
+ ```html
310
+ <div data-speccer="pin-area">
311
+ <div data-speccer="pin enclose" class="…"></div>
312
+ </div>
313
+ ```
314
+
256
315
  #### Align with parent container
257
316
 
258
- ![Screenshot of the dissection/anatomy feature where the pins are aligned with the parent container](./public/align-parent.png)
317
+ ![Screenshot of the dissection/anatomy feature where the pins are aligned with the parent container](./public/speccer-pin-parent-align-default-light.png)
259
318
 
260
319
  You can also align the pins to the parent container.
261
320
 
262
321
  ```html
263
322
  <div data-speccer="pin-area">
264
- <div data-speccer="pin parent [left|right|top|bottom]" class="..."></div>
323
+ <div data-speccer="pin parent [left|right|top|bottom]" class=""></div>
265
324
  </div>
266
325
  ```
267
326
 
@@ -287,9 +346,28 @@ The lines from the element to the pin is drawn with a svg path and circle, so re
287
346
  </svg>
288
347
  ```
289
348
 
349
+ ![Screenshot of the dissection/anatomy feature where the pins are aligned with the parent container](./public/speccer-pin-parent-align-light.png)
350
+
351
+ #### Pin with text
352
+
353
+ ![Image of text pin option](./public/speccer-pin-text-light.png)
354
+
355
+ If you want _text-in-place_ pinning feature, instead of referencing the pins, you can use the `text` feature:
356
+
357
+ ```html
358
+ <input
359
+ type="text"
360
+
361
+ data-speccer="pin left text"
362
+ data-speccer-title="Static text"
363
+ data-speccer-description="Document size [xx] by [yy][units]"
364
+
365
+ />
366
+ ```
367
+
290
368
  #### Custom literals
291
369
 
292
- ![Image of japanese literals instead of latin characters](./public/literals.png)
370
+ ![Image of japanese literals instead of latin characters](./public/speccer-pin-symbols-light.png)
293
371
 
294
372
  You can use custom literals by assigned a global variable with the literals you want:
295
373
 
@@ -307,15 +385,33 @@ window.SPECCER_LITERALS = [
307
385
  ];
308
386
  ```
309
387
 
388
+ Or with a data attribute on the `data-speccer="pin-area"`-element:
389
+
390
+ ```html
391
+ <div data-speccer="pin-area" data-speccer-literals="ऄ|अआइईउऊऋऌऍऎएऐऑऒओऔकखगघङच">
392
+
393
+ </div>
394
+ ```
395
+
396
+ > [!TIP]
397
+ > Try it out with emoticons!
398
+ >
399
+ > ```js
400
+ > window.SPECCER_LITERALS = [
401
+ > '🥰',
402
+ > …
403
+ > ];
404
+ > ```
405
+
310
406
  #### Subtle anatomy
311
407
 
312
- ![Image of subtle option for anatomy](./public/subtle.png)
408
+ ![Image of subtle option for anatomy](./public/speccer-pin-default-subtle-light.png)
313
409
 
314
410
  You can also give a more subtle touch to the anatomy elements.
315
411
 
316
412
  ```html
317
413
  <div data-speccer="pin-area">
318
- <div data-speccer="pin top subtle" class="..."></div>
414
+ <div data-speccer="pin top subtle" class=""></div>
319
415
  </div>
320
416
  ```
321
417
 
@@ -325,6 +421,8 @@ This will give a dashed border, and a more subtle pin style.
325
421
 
326
422
  You can use curly brackets with the `curly` tag in `data-speccer` along side `pin bracket` to provide a more sleek style.
327
423
 
424
+ ![Image of curly option for anatomy](./public/speccer-pin-curly-light.png)
425
+
328
426
  > [!NOTE]
329
427
  > Only works with `pin bracket`
330
428
 
@@ -355,12 +453,12 @@ from v9.5 you can utilize the `pin` feature to highlight the anatomy of an eleme
355
453
 
356
454
  ### Element typography
357
455
 
358
- ![Image of typography speccer](./public/typography.png)
456
+ ![Image of typography speccer](./public/speccer-typography-light.png)
359
457
 
360
458
  Display typography details:
361
459
 
362
460
  ```html
363
- <p data-speccer="typography [left|right|top|bottom]" class="...">Some text</p>
461
+ <p data-speccer="typography [left|right|top|bottom]" class="">Some text</p>
364
462
  ```
365
463
 
366
464
  This will place a box to display typography information. Default is `left`.
@@ -373,7 +471,7 @@ This will place a box to display typography information. Default is `left`.
373
471
  If you want to produce a box that uses `pre` and `code` tags with support for syntax highlighting ([PrismJS](https://prismjs.com/) compatible), add `syntax` to the `data-speccer="typography"` attribute.
374
472
 
375
473
  ```html
376
- <p data-speccer="typography syntax right" class="...">Some text</p>
474
+ <p data-speccer="typography syntax right" class="">Some text</p>
377
475
  ```
378
476
 
379
477
  You can then override the colors, based on these variables:
@@ -412,11 +510,11 @@ Here is an example with these colors and overrides:
412
510
  }
413
511
  ```
414
512
 
415
- ![Screenshot of typgraphy with different syntax theme](./public/typography-syntax.png)
513
+ ![Screenshot of typgraphy with different syntax theme](./public/speccer-typography-syntax-light.png)
416
514
 
417
515
  ### Grid spacing
418
516
 
419
- ![Screenshot of grid feature](./public/grid.png)
517
+ ![Screenshot of grid feature](./public/speccer-grid-full-light.png)
420
518
 
421
519
  This will highlight the grid spacing in a `display: grid;` element.
422
520
 
@@ -426,15 +524,18 @@ In your component examples, use the following attribute on your grid container.
426
524
  <div data-speccer="grid" …>…</div>
427
525
  ```
428
526
 
429
- If you only want to display `rows` or `columns`, use this syntax (default is both with `grid` only):
527
+ > [!TIP]
528
+ > If you only want to display `rows` or `columns`, use this syntax (default is both with `grid` only):
529
+ >
530
+ > ```html
531
+ > <div data-speccer="grid [rows|columns]" …>…</div>
532
+ > ```
430
533
 
431
- ```html
432
- <div data-speccer="grid [rows|columns]" …>…</div>
433
- ```
534
+ ![Screenshot of grid feature](./public/speccer-grid-full-dark.png)
434
535
 
435
536
  ### Mark elements
436
537
 
437
- ![Screenshot of marked elements](./public/mark.png)
538
+ ![Screenshot of marked elements](./public/speccer-pin-mark-light.png)
438
539
 
439
540
  This will mark the given elements.
440
541
 
@@ -452,19 +553,19 @@ Prior art: [Jeremy Elder](https://twitter.com/JeremyElder)
452
553
 
453
554
  #### Tab stops
454
555
 
455
- ![Screenshot of speccer a11y tab stops in use](./public/a11y-tabstop.png)
556
+ ![Screenshot of speccer a11y tab stops in use](./public/speccer-a11y-tabstops-light.png)
456
557
 
457
558
  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
559
 
459
560
  #### Landmarks and regions
460
561
 
461
- ![Screenshot of speccer a11y landmarks in use](./public/a11y-landmark.png)
562
+ ![Screenshot of speccer a11y landmarks in use](./public/speccer-a11y-landmarks-light.png)
462
563
 
463
564
  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
565
 
465
566
  #### Keys and shortcut
466
567
 
467
- ![Screenshot of speccer a11y shortcuts in use](./public/a11y-shortcut.png)
568
+ ![Screenshot of speccer a11y shortcuts in use](./public/speccer-a11y-shortcuts-light.png)
468
569
 
469
570
  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
571
 
@@ -480,7 +581,7 @@ If you want to display the shortcut with keys used for elements, use `data-specc
480
581
 
481
582
  ### Customization
482
583
 
483
- ![Screenshot of speccer in a dark mode example](./public/darkmode.png)
584
+ ![Screenshot of speccer in a dark mode example](./public/speccer-measure-spacing-example-dark.png)
484
585
 
485
586
  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
587
 
@@ -497,18 +598,17 @@ Allthough the styling works nicely with dark mode, you can use the provided CSS
497
598
  --ph-speccer-color-fuchsiaBlue: #7e60c5;
498
599
  --ph-speccer-base-color: var(--ph-speccer-color-artificialStrawberry);
499
600
  --ph-speccer-spacing-color: var(--ph-speccer-base-color);
500
- --ph-speccer-spacing-color-padding: rgb(
601
+ --ph-speccer-spacing-padding-color: var(--ph-speccer-color-carbon);
602
+ --ph-speccer-spacing-padding-color-background: rgb(
501
603
  from var(--ph-speccer-color-venusSlipperOrchid) r g b /
502
604
  var(--ph-speccer-opacity-40)
503
605
  );
504
- --ph-speccer-spacing-color-padding-hover: var(
505
- --ph-speccer-color-venusSlipperOrchid
506
- );
507
- --ph-speccer-spacing-color-margin: rgb(
606
+ --ph-speccer-spacing-margin-color: var(--ph-speccer-color-red);
607
+ --ph-speccer-spacing-margin-color-background: rgb(
508
608
  from var(--ph-speccer-color-superBanana) r g b /
509
609
  var(--ph-speccer-opacity-40)
510
610
  );
511
- --ph-speccer-spacing-color-margin-hover: var(--ph-speccer-color-superBanana);
611
+ --ph-speccer-spacing-line-width: var(--ph-speccer-line-width);
512
612
  --ph-speccer-typography-background-color: var(--ph-speccer-color-white);
513
613
  --ph-speccer-typography-color-property: var(--ph-speccer-color-niuZaiSeDenim);
514
614
  --ph-speccer-typography-color-text: var(--ph-speccer-base-color);
@@ -517,9 +617,11 @@ Allthough the styling works nicely with dark mode, you can use the provided CSS
517
617
  from var(--ph-speccer-base-color) r g b / var(--ph-speccer-opacity-20)
518
618
  );
519
619
  --ph-speccer-mark-border-color: var(--ph-speccer-base-color);
520
- --ph-speccer-mark-border-width: 1px;
620
+ --ph-speccer-mark-border-width: 1.5px;
521
621
  --ph-speccer-mark-border-style: solid;
522
622
  --ph-speccer-measure-color: var(--ph-speccer-color-red);
623
+ --ph-speccer-measure-line-width: 1.5px;
624
+ --ph-speccer-measure-border-style: dotted;
523
625
  --ph-speccer-measure-size: 8px;
524
626
  --ph-speccer-a11y-color-background: var(--ph-speccer-color-beautifulBlue);
525
627
  --ph-speccer-a11y-landmark-color-background: var(
@@ -531,8 +633,8 @@ Allthough the styling works nicely with dark mode, you can use the provided CSS
531
633
  --ph-speccer-pin-size: 24px;
532
634
  --ph-speccer-pin-space: 48px;
533
635
  --ph-speccer-line-height: 12px;
534
- --ph-speccer-line-width: 1px;
535
- --ph-speccer-line-width-negative: -1px;
636
+ --ph-speccer-line-width: 1.5px;
637
+ --ph-speccer-line-width-negative: -1.5px;
536
638
  --ph-speccer-opacity-20: 0.2;
537
639
  --ph-speccer-opacity-40: 0.4;
538
640
  --ph-speccer-font-family: 'Menlo for Powerline', 'Menlo Regular for Powerline',