@phun-ky/speccer 11.2.45 → 11.3.1
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 +10 -833
- package/dist/speccer.d.ts +445 -37
- package/dist/speccer.esm.js +2 -2
- package/dist/speccer.js +2 -2
- package/package.json +9 -2
package/dist/speccer.d.ts
CHANGED
|
@@ -1,76 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extends the global Window interface to add custom properties.
|
|
3
|
+
*/
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
/**
|
|
7
|
+
* Represents the DrawSVGCurlyBracket class for drawing curly brackets.
|
|
8
|
+
*/
|
|
9
|
+
DrawSVGCurlyBracket: any;
|
|
10
|
+
/**
|
|
11
|
+
* Represents the DrawCircle class for drawing circles.
|
|
12
|
+
*/
|
|
13
|
+
DrawCircle: any;
|
|
14
|
+
/**
|
|
15
|
+
* Represents the DrawSVGLine class for drawing lines.
|
|
16
|
+
*/
|
|
17
|
+
DrawSVGLine: any;
|
|
18
|
+
/**
|
|
19
|
+
* Represents the speccer object for additional functionality.
|
|
20
|
+
*/
|
|
21
|
+
speccer: any;
|
|
22
|
+
/**
|
|
23
|
+
* Represents the custom literals to be used.
|
|
24
|
+
* 
|
|
25
|
+
* @example
|
|
26
|
+
* ```js
|
|
27
|
+
* window.SPECCER_LITERALS = [あ,い,う,え,お,か,き,く,け,こ,さ,し,す,せ,そ,た,ち,つ,て,と,な,に,ぬ,ね,の,は,ひ,ふ,へ,ほ,ま,み,む,め,も,や,ゆ,よ,ら,り,る,れ,ろ,わ,を];
|
|
28
|
+
* speccer();
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
SPECCER_LITERALS: string[];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=global.d.ts.map
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Initializes the accessibility elements on the document.
|
|
38
|
+
*
|
|
39
|
+
* This feature will annotate or highlight accessibility areas like landmarks and region. It can also display tab stops/sequence and any keyboard shortcuts assigned
|
|
40
|
+
*
|
|
41
|
+
* 
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
*
|
|
45
|
+
* Use the following code, either for html or js:
|
|
46
|
+
*
|
|
47
|
+
* ```html
|
|
48
|
+
* <div
|
|
49
|
+
* data-speccer="a11y [shortcuts|tabstops|landmark|headings|autocomplete]"
|
|
50
|
+
* class="…"
|
|
51
|
+
* >
|
|
52
|
+
* …
|
|
53
|
+
* </div>
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* const targetElement = document.getElementById('target');
|
|
58
|
+
* a11y(targetElement);
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
declare const a11y: () => void;
|
|
64
|
+
|
|
1
65
|
type SpeccerFunctionType = () => void;
|
|
2
66
|
type SpeccerFeatureType = 'pin' | 'grid' | 'mark' | 'typography' | 'measure' | 'spacing';
|
|
3
67
|
type SpeccerPositionType = 'top' | 'left' | 'right' | 'bottom';
|
|
68
|
+
/**
|
|
69
|
+
* Configuration object that tells Speccer **what** to render and **how** to render it.
|
|
70
|
+
*
|
|
71
|
+
* ### Feature flags
|
|
72
|
+
* Only one top-level {@link SpeccerOptionsInterface.type | type} is active at a time
|
|
73
|
+
* (`"pin" | "grid" | "mark" | "typography" | "measure" | "spacing"`). The corresponding
|
|
74
|
+
* nested section (e.g. `pin`, `grid`, `typography`, `measure`, `spacing`) becomes relevant
|
|
75
|
+
* and other sections are typically omitted.
|
|
76
|
+
*
|
|
77
|
+
* @example Basic "pin" annotation
|
|
78
|
+
* ```ts
|
|
79
|
+
* import type { SpeccerOptionsInterface } from "@phun-ky/speccer";
|
|
80
|
+
*
|
|
81
|
+
* const options: SpeccerOptionsInterface = {
|
|
82
|
+
* slug: "pinBracketSubtle",
|
|
83
|
+
* position: "left",
|
|
84
|
+
* type: "pin",
|
|
85
|
+
* pin: {
|
|
86
|
+
* bracket: true,
|
|
87
|
+
* enclose: false,
|
|
88
|
+
* subtle: true,
|
|
89
|
+
* parent: false,
|
|
90
|
+
* text: false,
|
|
91
|
+
* useSVGLine: true,
|
|
92
|
+
* useCurlyBrackets: false
|
|
93
|
+
* }
|
|
94
|
+
* };
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @example Measure width, slim style
|
|
98
|
+
* ```ts
|
|
99
|
+
* const options: SpeccerOptionsInterface = {
|
|
100
|
+
* slug: "measureWidthSlim",
|
|
101
|
+
* position: "bottom",
|
|
102
|
+
* type: "measure",
|
|
103
|
+
* measure: {
|
|
104
|
+
* slim: true,
|
|
105
|
+
* height: false,
|
|
106
|
+
* width: true
|
|
107
|
+
* }
|
|
108
|
+
* };
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @example Typography with syntax highlighting
|
|
112
|
+
* ```ts
|
|
113
|
+
* const options: SpeccerOptionsInterface = {
|
|
114
|
+
* slug: "codeSample",
|
|
115
|
+
* position: "right",
|
|
116
|
+
* type: "typography",
|
|
117
|
+
* typography: {
|
|
118
|
+
* useSyntaxHighlighting: true
|
|
119
|
+
* }
|
|
120
|
+
* };
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @example Spacing overlays (margin vs. padding vs. both)
|
|
124
|
+
* ```ts
|
|
125
|
+
* const marginOnly: SpeccerOptionsInterface = {
|
|
126
|
+
* slug: "spacingMargin",
|
|
127
|
+
* position: "top",
|
|
128
|
+
* type: "spacing",
|
|
129
|
+
* spacing: {
|
|
130
|
+
* margin: true,
|
|
131
|
+
* padding: false,
|
|
132
|
+
* both: false,
|
|
133
|
+
* bound: false
|
|
134
|
+
* }
|
|
135
|
+
* };
|
|
136
|
+
*
|
|
137
|
+
* const bothWithBounds: SpeccerOptionsInterface = {
|
|
138
|
+
* slug: "spacingBothBound",
|
|
139
|
+
* position: "top",
|
|
140
|
+
* type: "spacing",
|
|
141
|
+
* spacing: {
|
|
142
|
+
* margin: false,
|
|
143
|
+
* padding: false,
|
|
144
|
+
* both: true,
|
|
145
|
+
* bound: true
|
|
146
|
+
* }
|
|
147
|
+
* };
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @example Grid overlays (rows, columns, or both)
|
|
151
|
+
* ```ts
|
|
152
|
+
* const gridBoth: SpeccerOptionsInterface = {
|
|
153
|
+
* slug: "gridBoth",
|
|
154
|
+
* position: "bottom",
|
|
155
|
+
* type: "grid",
|
|
156
|
+
* grid: {
|
|
157
|
+
* toggle: "both", // allowed: "rows" | "columns" | "both"
|
|
158
|
+
* both: true,
|
|
159
|
+
* rows: false,
|
|
160
|
+
* columns: false
|
|
161
|
+
* }
|
|
162
|
+
* };
|
|
163
|
+
*
|
|
164
|
+
* const gridRows: SpeccerOptionsInterface = {
|
|
165
|
+
* slug: "gridRows",
|
|
166
|
+
* position: "bottom",
|
|
167
|
+
* type: "grid",
|
|
168
|
+
* grid: {
|
|
169
|
+
* toggle: "rows",
|
|
170
|
+
* both: false,
|
|
171
|
+
* rows: true,
|
|
172
|
+
* columns: false
|
|
173
|
+
* }
|
|
174
|
+
* };
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
4
177
|
interface SpeccerOptionsInterface {
|
|
178
|
+
/**
|
|
179
|
+
* Machine-readable identifier for this option set.
|
|
180
|
+
*
|
|
181
|
+
* @remarks
|
|
182
|
+
* When produced by {@link getOptions}, this is derived from the input `areaString`
|
|
183
|
+
* using a camel-casing strategy (e.g., `"pin bracket subtle"` → `"pinBracketSubtle"`).
|
|
184
|
+
*/
|
|
5
185
|
slug: string;
|
|
186
|
+
/**
|
|
187
|
+
* Preferred anchor side for rendering or label placement.
|
|
188
|
+
*
|
|
189
|
+
* @remarks
|
|
190
|
+
* Use to hint where visual affordances (e.g., labels, callouts) should appear
|
|
191
|
+
* relative to the annotated element.
|
|
192
|
+
*/
|
|
6
193
|
position: SpeccerPositionType;
|
|
194
|
+
/**
|
|
195
|
+
* Which Speccer feature this option set activates.
|
|
196
|
+
*
|
|
197
|
+
* @remarks
|
|
198
|
+
* This field determines which nested section is relevant (`pin`, `grid`, `mark`,
|
|
199
|
+
* `typography`, `measure`, or `spacing`). Only one feature is active at a time.
|
|
200
|
+
*/
|
|
7
201
|
type: SpeccerFeatureType;
|
|
202
|
+
/**
|
|
203
|
+
* Options for the `"pin"` feature.
|
|
204
|
+
*
|
|
205
|
+
* @remarks
|
|
206
|
+
* Present only when {@link SpeccerOptionsInterface.type | type} is `"pin"`.
|
|
207
|
+
* Each flag toggles a specific pin decoration or behavior.
|
|
208
|
+
*/
|
|
8
209
|
pin?: {
|
|
210
|
+
/** Draw bracket-style markers around the pin. */
|
|
9
211
|
bracket: boolean;
|
|
212
|
+
/** Enclose the pin target (e.g., a boxed/outlined emphasis). */
|
|
10
213
|
enclose: boolean;
|
|
214
|
+
/** Reduce visual weight for a subtler presentation. */
|
|
11
215
|
subtle: boolean;
|
|
216
|
+
/** Indicate that the pin references a parent container/element. */
|
|
12
217
|
parent: boolean;
|
|
218
|
+
/** Render an inline text label along with the pin. */
|
|
13
219
|
text: boolean;
|
|
220
|
+
/** Use an SVG line primitive instead of a DOM line. */
|
|
14
221
|
useSVGLine: boolean;
|
|
222
|
+
/** Use curly brackets for bracketed pins instead of straight brackets. */
|
|
15
223
|
useCurlyBrackets: boolean;
|
|
16
224
|
};
|
|
225
|
+
/**
|
|
226
|
+
* Options for the `"measure"` feature.
|
|
227
|
+
*
|
|
228
|
+
* @remarks
|
|
229
|
+
* Present only when {@link SpeccerOptionsInterface.type | type} is `"measure"`.
|
|
230
|
+
* Use `height` and/or `width` to select the axis to measure; `slim` switches to
|
|
231
|
+
* a compact rendering style for tight layouts.
|
|
232
|
+
*/
|
|
17
233
|
measure?: {
|
|
234
|
+
/** Use a compact (thinner) measurement style. */
|
|
18
235
|
slim: boolean;
|
|
236
|
+
/** Show a vertical measurement (element height). */
|
|
19
237
|
height: boolean;
|
|
238
|
+
/** Show a horizontal measurement (element width). */
|
|
20
239
|
width: boolean;
|
|
21
240
|
};
|
|
241
|
+
/**
|
|
242
|
+
* Options for the `"typography"` feature.
|
|
243
|
+
*
|
|
244
|
+
* @remarks
|
|
245
|
+
* Present only when {@link SpeccerOptionsInterface.type | type} is `"typography"`.
|
|
246
|
+
* Enables code-like styling or syntax coloring when appropriate.
|
|
247
|
+
*/
|
|
22
248
|
typography?: {
|
|
249
|
+
/** Enable syntax highlighting for textual samples. */
|
|
23
250
|
useSyntaxHighlighting: boolean;
|
|
24
251
|
};
|
|
252
|
+
/**
|
|
253
|
+
* Options for the `"spacing"` feature.
|
|
254
|
+
*
|
|
255
|
+
* @remarks
|
|
256
|
+
* Present only when {@link SpeccerOptionsInterface.type | type} is `"spacing"`.
|
|
257
|
+
* Exactly one of `margin`, `padding`, or `both` is typically `true`.
|
|
258
|
+
* `bound` can be used to visualize the outer bound in addition to spacing.
|
|
259
|
+
*/
|
|
25
260
|
spacing?: {
|
|
261
|
+
/** Visualize the element's margins. */
|
|
26
262
|
margin?: boolean;
|
|
263
|
+
/** Visualize the element's padding. */
|
|
27
264
|
padding?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Visualize both margin and padding in a combined overlay.
|
|
267
|
+
* @remarks Mutually exclusive with `margin` and `padding` where applicable.
|
|
268
|
+
*/
|
|
28
269
|
both?: boolean;
|
|
270
|
+
/**
|
|
271
|
+
* Emphasize the bounding outline of the target in addition to spacing.
|
|
272
|
+
* @remarks Often used to show the element's overall occupied box.
|
|
273
|
+
*/
|
|
29
274
|
bound?: boolean;
|
|
30
275
|
};
|
|
276
|
+
/**
|
|
277
|
+
* Options for the `"grid"` feature.
|
|
278
|
+
*
|
|
279
|
+
* @remarks
|
|
280
|
+
* Present only when {@link SpeccerOptionsInterface.type | type} is `"grid"`.
|
|
281
|
+
* `toggle` indicates the primary axis selection and should be `"rows" | "columns" | "both"`.
|
|
282
|
+
* The convenience flags (`both`, `rows`, `columns`) mirror the current state for easy checks.
|
|
283
|
+
*/
|
|
31
284
|
grid?: {
|
|
285
|
+
/**
|
|
286
|
+
* Controls which grid axes are active.
|
|
287
|
+
* @remarks Allowed values: `"rows" | "columns" | "both"`.
|
|
288
|
+
*/
|
|
32
289
|
toggle: string;
|
|
290
|
+
/** Convenience flag set when both rows and columns are active. */
|
|
33
291
|
both?: boolean;
|
|
292
|
+
/** Convenience flag set when only rows are active. */
|
|
34
293
|
rows?: boolean;
|
|
294
|
+
/** Convenience flag set when only columns are active. */
|
|
35
295
|
columns?: boolean;
|
|
36
296
|
};
|
|
37
297
|
}
|
|
38
298
|
|
|
39
|
-
/**
|
|
40
|
-
* Extends the global Window interface to add custom properties.
|
|
41
|
-
*/
|
|
42
|
-
declare global {
|
|
43
|
-
interface Window {
|
|
44
|
-
/**
|
|
45
|
-
* Represents the DrawSVGCurlyBracket class for drawing curly brackets.
|
|
46
|
-
*/
|
|
47
|
-
DrawSVGCurlyBracket: any;
|
|
48
|
-
/**
|
|
49
|
-
* Represents the DrawCircle class for drawing circles.
|
|
50
|
-
*/
|
|
51
|
-
DrawCircle: any;
|
|
52
|
-
/**
|
|
53
|
-
* Represents the DrawSVGLine class for drawing lines.
|
|
54
|
-
*/
|
|
55
|
-
DrawSVGLine: any;
|
|
56
|
-
/**
|
|
57
|
-
* Represents the speccer object for additional functionality.
|
|
58
|
-
*/
|
|
59
|
-
speccer: any;
|
|
60
|
-
/**
|
|
61
|
-
* Represents the custom literals to be used.
|
|
62
|
-
* 
|
|
63
|
-
* @example
|
|
64
|
-
* ```js
|
|
65
|
-
* window.SPECCER_LITERALS = [あ,い,う,え,お,か,き,く,け,こ,さ,し,す,せ,そ,た,ち,つ,て,と,な,に,ぬ,ね,の,は,ひ,ふ,へ,ほ,ま,み,む,め,も,や,ゆ,よ,ら,り,る,れ,ろ,わ,を];
|
|
66
|
-
* speccer();
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
SPECCER_LITERALS: string[];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
//# sourceMappingURL=global.d.ts.map
|
|
73
|
-
|
|
74
299
|
/**
|
|
75
300
|
* Remove a speccer element by removing associated elements and SVG paths.
|
|
76
301
|
*
|
|
@@ -90,37 +315,220 @@ declare global {
|
|
|
90
315
|
*/
|
|
91
316
|
declare const removeSpeccerElement: (el: HTMLElement) => void;
|
|
92
317
|
|
|
318
|
+
/**
|
|
319
|
+
* This feature will highlight the grid spacing in a `display: grid;` element.
|
|
320
|
+
*
|
|
321
|
+
* 
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
*
|
|
325
|
+
* Use the following code, either for html or js:
|
|
326
|
+
*
|
|
327
|
+
* ```html
|
|
328
|
+
* <div
|
|
329
|
+
* data-speccer="grid [columns|rows]"
|
|
330
|
+
* class="…"
|
|
331
|
+
* >
|
|
332
|
+
* …
|
|
333
|
+
* </div>
|
|
334
|
+
* ```
|
|
335
|
+
*
|
|
336
|
+
* ```ts
|
|
337
|
+
* const targetElement = document.getElementById('target');
|
|
338
|
+
* const options = {
|
|
339
|
+
* type: 'grid',
|
|
340
|
+
* grid: {
|
|
341
|
+
* toggle: 'both'
|
|
342
|
+
* }
|
|
343
|
+
* };
|
|
344
|
+
*
|
|
345
|
+
* grid(targetElement, options);
|
|
346
|
+
* ```
|
|
347
|
+
*
|
|
348
|
+
*/
|
|
93
349
|
declare const grid: {
|
|
94
350
|
create: (targetElement: HTMLElement, styles: Partial<CSSStyleDeclaration>, options: SpeccerOptionsInterface) => Promise<void>;
|
|
95
351
|
element: (targetElement: HTMLElement, options?: SpeccerOptionsInterface | undefined) => Promise<void>;
|
|
96
352
|
};
|
|
353
|
+
/**
|
|
354
|
+
* This feature highlights the spacing of an element.
|
|
355
|
+
*
|
|
356
|
+
* 
|
|
357
|
+
* *
|
|
358
|
+
* @example
|
|
359
|
+
*
|
|
360
|
+
* Use the following code, either for html or js:
|
|
361
|
+
*
|
|
362
|
+
* ```html
|
|
363
|
+
* <div
|
|
364
|
+
* data-speccer="spacing [padding|margin][bound]"
|
|
365
|
+
* class="…"
|
|
366
|
+
* >
|
|
367
|
+
* …
|
|
368
|
+
* </div>
|
|
369
|
+
* ```
|
|
370
|
+
* ```ts
|
|
371
|
+
* const targetElement = document.getElementById('target');
|
|
372
|
+
* element(targetElement);
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
97
375
|
declare const spacing: {
|
|
98
376
|
create: (text?: string | number, tag?: string) => HTMLElement;
|
|
99
377
|
element: (targetElement: HTMLElement, options?: SpeccerOptionsInterface | undefined) => Promise<void>;
|
|
100
378
|
};
|
|
379
|
+
/**
|
|
380
|
+
* This feature annotate or highlight the anatomy of an element.
|
|
381
|
+
*
|
|
382
|
+
* 
|
|
383
|
+
*
|
|
384
|
+
* In your component examples, use the following attribute. Remember to use the `data-speccer="pin-area"`-attribute on a parent element to scope the marking.
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* ```html
|
|
388
|
+
* <div data-speccer="pin-area">
|
|
389
|
+
* <div
|
|
390
|
+
* data-speccer="pin [bracket [curly] |enclose] [left|right|top|bottom]"
|
|
391
|
+
* class="..."
|
|
392
|
+
* ></div>
|
|
393
|
+
* </div>
|
|
394
|
+
* ```
|
|
395
|
+
*
|
|
396
|
+
*/
|
|
101
397
|
declare const pin: {
|
|
102
398
|
createPinElement: (content: string | undefined, options: SpeccerOptionsInterface, id?: string, n?: string) => HTMLElement;
|
|
103
|
-
pinElement: (targetElement: HTMLElement, parentElement: HTMLElement, content: string, options: SpeccerOptionsInterface) => Promise<string |
|
|
399
|
+
pinElement: (targetElement: HTMLElement, parentElement: HTMLElement, content: string, options: SpeccerOptionsInterface) => Promise<string | undefined>;
|
|
104
400
|
pinElements: (sectionElement: HTMLElement, options?: SpeccerOptionsInterface | undefined) => Promise<void>;
|
|
105
401
|
};
|
|
402
|
+
/**
|
|
403
|
+
* This feature measures given element
|
|
404
|
+
*
|
|
405
|
+
* 
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
*
|
|
409
|
+
* Use the following code, either for html or js:
|
|
410
|
+
*
|
|
411
|
+
* ```html
|
|
412
|
+
* <div
|
|
413
|
+
* data-speccer="measure [height left|right] | [width top|bottom]"
|
|
414
|
+
* class="..."
|
|
415
|
+
* >
|
|
416
|
+
* …
|
|
417
|
+
* </div>
|
|
418
|
+
* ```
|
|
419
|
+
*
|
|
420
|
+
* ```ts
|
|
421
|
+
* const targetElement = document.getElementById('target');
|
|
422
|
+
* const options = {
|
|
423
|
+
* position: 'right',
|
|
424
|
+
* measure: {
|
|
425
|
+
* height: true
|
|
426
|
+
* }
|
|
427
|
+
* };
|
|
428
|
+
*
|
|
429
|
+
* measure(targetElement, options);
|
|
430
|
+
* ```
|
|
431
|
+
*
|
|
432
|
+
*/
|
|
106
433
|
declare const measure: {
|
|
107
434
|
create: (text: string | number | undefined, options: SpeccerOptionsInterface, id: string, tag?: string) => HTMLElement;
|
|
108
435
|
element: (targetElement: HTMLElement, options?: SpeccerOptionsInterface | undefined) => Promise<void>;
|
|
109
436
|
};
|
|
437
|
+
/**
|
|
438
|
+
* This feature marks given element
|
|
439
|
+
*
|
|
440
|
+
* 
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
*
|
|
444
|
+
* Use the following code, either for html or js:
|
|
445
|
+
*
|
|
446
|
+
* ```html
|
|
447
|
+
* <div
|
|
448
|
+
* data-speccer="mark"
|
|
449
|
+
* class="..."
|
|
450
|
+
* >
|
|
451
|
+
* …
|
|
452
|
+
* </div>
|
|
453
|
+
* ```
|
|
454
|
+
*
|
|
455
|
+
* ```ts
|
|
456
|
+
* const targetElement = document.getElementById('target');
|
|
457
|
+
* const options = {
|
|
458
|
+
* type: 'mark'
|
|
459
|
+
* };
|
|
460
|
+
*
|
|
461
|
+
* mark(targetElement, options);
|
|
462
|
+
* ```
|
|
463
|
+
*
|
|
464
|
+
*/
|
|
110
465
|
declare const mark: {
|
|
111
466
|
create: (id: string, n?: string) => HTMLElement;
|
|
112
467
|
element: (targetElement: HTMLElement) => Promise<void>;
|
|
113
468
|
};
|
|
469
|
+
/**
|
|
470
|
+
* This feature presents typography
|
|
471
|
+
*
|
|
472
|
+
* 
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
*
|
|
476
|
+
* Use the following code, either for html or js:
|
|
477
|
+
*
|
|
478
|
+
* ```html
|
|
479
|
+
* <div
|
|
480
|
+
* data-speccer="typography [top|right|bottom|left] [syntax]"
|
|
481
|
+
* class="..."
|
|
482
|
+
* >
|
|
483
|
+
* …
|
|
484
|
+
* </div>
|
|
485
|
+
* ```
|
|
486
|
+
*
|
|
487
|
+
* ```ts
|
|
488
|
+
* const targetElement = document.getElementById('target');
|
|
489
|
+
* const options = {
|
|
490
|
+
* position: 'right',
|
|
491
|
+
* type: 'typography',
|
|
492
|
+
* typography: {
|
|
493
|
+
* useSyntaxHighlighting: false
|
|
494
|
+
* }
|
|
495
|
+
* };
|
|
496
|
+
*
|
|
497
|
+
* typography(targetElement, options);
|
|
498
|
+
* ```
|
|
499
|
+
*
|
|
500
|
+
*/
|
|
114
501
|
declare const typography: {
|
|
115
502
|
create: (html: string, options: SpeccerOptionsInterface, id: string) => HTMLElement;
|
|
116
503
|
element: (targetElement: HTMLElement, options?: SpeccerOptionsInterface | undefined) => Promise<void>;
|
|
117
504
|
};
|
|
505
|
+
/**
|
|
506
|
+
* The available modes to run SPECCER with
|
|
507
|
+
*
|
|
508
|
+
*/
|
|
118
509
|
declare const modes: {
|
|
119
510
|
dom: (speccer: SpeccerFunctionType) => void;
|
|
120
511
|
lazy: () => void;
|
|
121
512
|
manual: (speccer: SpeccerFunctionType) => void;
|
|
122
513
|
activate: (speccer: SpeccerFunctionType) => void;
|
|
123
514
|
};
|
|
515
|
+
/**
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* ```typescript
|
|
519
|
+
* import '@phun-ky/speccer/dist/speccer.min.css';
|
|
520
|
+
* import speccer from '@phun-ky/speccer';
|
|
521
|
+
*
|
|
522
|
+
* // do stuff
|
|
523
|
+
* speccer();
|
|
524
|
+
* ```
|
|
525
|
+
* @example
|
|
526
|
+
* ```html
|
|
527
|
+
* <link rel="stylesheet" href="../path/to/speccer.min.css" />
|
|
528
|
+
* <script src="../path/to/speccer.js"></script>
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
124
531
|
declare const speccer: () => void;
|
|
125
532
|
|
|
126
|
-
export { speccer as default, grid, mark, measure, modes, pin, removeSpeccerElement, spacing, typography };
|
|
533
|
+
export { a11y, speccer as default, grid, mark, measure, modes, pin, removeSpeccerElement, spacing, typography };
|
|
534
|
+
export type { SpeccerFunctionType, SpeccerOptionsInterface };
|