Skip to content

Commit 0184b9c

Browse files
authored
Merge branch 'dev' into feature/pseudo-pattern-config
2 parents b8d575a + caaaa7b commit 0184b9c

File tree

15 files changed

+128
-81
lines changed

15 files changed

+128
-81
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
If you'd like to contribute to Pattern Lab Node, please do so! There is always a lot of ground to cover and something for your wheelhouse.
44

5-
No pull request is too small. Check out any [help wanted 🆘](https://github.com/pattern-lab/patternlab-node/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted+%3Asos%3A%22) or [good first issues 🎓](https://github.com/pattern-lab/patternlab-node/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue+%3Amortar_board%3A%22)as a good way to get your feet wet, or add some more unit tests.
5+
No pull request is too small. Check out any [help wanted 🆘](https://github.com/pattern-lab/patternlab-node/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted+%3Asos%3A%22) or [good first issues 🎓](https://github.com/pattern-lab/patternlab-node/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue+%3Amortar_board%3A%22) as a good way to get your feet wet, or add some more unit tests.
66

77
## Prerequisites
88

packages/core/docs/events.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Emitted after global `data.json` and `listitems.json` are read, and the supporti
7777
Emitted before all data is merged prior to a Pattern's render. Global `data.json` is merged with any pattern `.json`. Global `listitems.json` is merged with any pattern `.listitems.json`.
7878

7979
**Kind**: inner property of [<code>EVENTS</code>](#exp_module_Events--EVENTS)
80-
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16)
80+
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16)
8181
**Properties**
8282

8383
| Name | Type | Description |
@@ -92,7 +92,7 @@ Emitted before all data is merged prior to a Pattern's render. Global `data.json
9292
Emitted before a pattern's template, HTML, and encoded HTML files are written to their output location
9393

9494
**Kind**: inner property of [<code>EVENTS</code>](#exp_module_Events--EVENTS)
95-
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16)
95+
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16)
9696
**Properties**
9797

9898
| Name | Type | Description |
@@ -107,7 +107,7 @@ Emitted before a pattern's template, HTML, and encoded HTML files are written to
107107
Emitted after a pattern's template, HTML, and encoded HTML files are written to their output location
108108

109109
**Kind**: inner property of [<code>EVENTS</code>](#exp_module_Events--EVENTS)
110-
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16)
110+
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16)
111111
**Properties**
112112

113113
| Name | Type | Description |

packages/core/src/lib/events.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,23 @@ const EVENTS = Object.freeze({
3939
* @desc Emitted before all data is merged prior to a Pattern's render. Global `data.json` is merged with any pattern `.json`. Global `listitems.json` is merged with any pattern `.listitems.json`.
4040
* @property {object} patternlab - global data store
4141
* @property {Pattern} pattern - current pattern
42-
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16|Pattern}
42+
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16|Pattern}
4343
*/
4444
PATTERNLAB_PATTERN_BEFORE_DATA_MERGE: 'patternlab-pattern-before-data-merge',
4545

4646
/**
4747
* @desc Emitted before a pattern's template, HTML, and encoded HTML files are written to their output location
4848
* @property {object} patternlab - global data store
4949
* @property {Pattern} pattern - current pattern
50-
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16|Pattern}
50+
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16|Pattern}
5151
*/
5252
PATTERNLAB_PATTERN_WRITE_BEGIN: 'patternlab-pattern-write-begin',
5353

5454
/**
5555
* @desc Emitted after a pattern's template, HTML, and encoded HTML files are written to their output location
5656
* @property {object} patternlab - global data store
5757
* @property {Pattern} pattern - current pattern
58-
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16|Pattern}
58+
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16|Pattern}
5959
*/
6060
PATTERNLAB_PATTERN_WRITE_END: 'patternlab-pattern-write-end',
6161

packages/docs/src/docs/advanced-config-options.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,19 +238,38 @@ These template and page patterns would still be accessible via navigation.
238238

239239
### theme
240240

241-
Sets the theme options for the styleguide. There are three options: 'color', 'density', and 'layout'.
241+
Sets the theme options for the styleguide. There are five options:
242+
* `"color"`
243+
* `"density"`
244+
* `"layout"`
245+
* `"noViewAll"` (optional)
246+
* `"logo"` (optional)
242247

243248
Available values are:
244249

245250
```javascript
246251
"theme" : {
247252
"color" : "dark" | "light",
248253
"density" : "compact" | "cozy" | "comfortable",
249-
"layout" : "horizontal" | "vertical"
254+
"layout" : "horizontal" | "vertical",
255+
"noViewAll" : true | false,
256+
"logo": {
257+
"text": "Pattern Lab",
258+
"altText": "Pattern Lab Logo",
259+
"url": "/",
260+
"srcLight": "styleguide/images/pattern-lab-logo--on-light.svg",
261+
"srcDark": "styleguide/images/pattern-lab-logo--on-dark.svg",
262+
"width": "187",
263+
"height": "185"
264+
}
250265
}
251266
```
252267

253-
See the [initial release notes](https://github.com/pattern-lab/styleguidekit-assets-default/releases/tag/v4.0.0-alpha.2) for the theme feature for example output.
268+
See the [initial release notes](https://github.com/pattern-lab/styleguidekit-assets-default/releases/tag/v4.0.0-alpha.2) for the theme feature for example output on `"color"`, `'density"` and `"layout"`.
269+
270+
`"noViewAll"` provides the possibility to hide the "View All" pages and links within the navigation.
271+
272+
And `"logo"` lets you finetune the different aspects of the logo displayed on the left top corner of the styleguide.
254273

255274
**default**:
256275

@@ -288,8 +307,7 @@ Introduced in Pattern Lab Node v3, UIKits are a new term in the Pattern Lab [Eco
288307

289308
- `enabled`: quickly turn on or off the building of this UIKit
290309
- `excludedPatternStates`: tell Pattern Lab not to include patterns with these states in this UIKit's output
291-
- `excludedPatternTags`: tell Pattern Lab not to include patterns with these tags in this UIKit's output
292-
- [currently not supported](https://github.com/pattern-lab/patternlab-node/issues/844)
310+
- `excludedTags`: tell Pattern Lab not to include patterns with these tags in this UIKit's output
293311

294312
Important details:
295313

packages/docs/src/docs/pattern-documenting.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ title: Title for my pattern
1818
This is a *Markdown* description of my pattern.
1919
```
2020

21-
The `title` attribute is used in Pattern Lab's navigation as well as in the styleguide views. The `description` is used in the styleguide views.
21+
Attributes overview:
22+
* The `title` attribute is used in Pattern Lab's navigation as well as in the styleguide views. Format: `string`
23+
* Pattern `tags` has to be an array, like `tags: [new, relaunch, dev]`
24+
* [Pattern `states`](/docs/using-pattern-states/) are defined like `state: incomplete` and [provide a simple visual indication](/docs/using-pattern-states/)
25+
26+
Both `tags` and `states` could be used for [not including patterns in a UIKit specific build](/docs/editing-the-configuration-options/#heading-uikits).
27+
28+
The `description` is used in the styleguide views.
2229

2330
Pattern documentation needs to have a `.md` file extension and match the name of the pattern it's documenting. For example, to document the following pattern:
2431

@@ -46,5 +53,5 @@ We'd name our documentation file:
4653

4754
## Adding More Attributes to the Front Matter
4855

49-
A future update of Pattern Lab will support more front matter attributes including: state, order, hidden, links and tags.
56+
A future update of Pattern Lab will support more front matter attributes including: excludeFromStyleguide, order, hidden and links.
5057
It will also support adding custom attributes that could be utilized by plugins. For example, GitHub issues related to patterns.

packages/docs/src/js/primary-nav.js

Lines changed: 62 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -9,75 +9,77 @@
99
* 4) If the nav dropdown trigger parent does not have an active class, add it.
1010
*/
1111
(function() {
12-
var navDropdownListItem = document.querySelector('.js-nav-dropdown');
13-
var navLink = document.querySelectorAll('.js-nav-dropdown-trigger'); /* 1 */
12+
var navDropdownListItem = document.querySelector('.js-nav-dropdown');
13+
var navLink = document.querySelectorAll('.js-nav-dropdown-trigger'); /* 1 */
1414

15-
for (i = 0; i < navLink.length; i++) {
16-
/* 1 */
15+
for (i = 0; i < navLink.length; i++) {
16+
/* 1 */
1717

18-
navLink[i].addEventListener('click', function(event) {
19-
/* 2 */
20-
event.preventDefault();
21-
var navLinkParent = this.parentNode; /* 2 */
18+
navLink[i].addEventListener('click', function(event) {
19+
/* 2 */
20+
event.preventDefault();
21+
var navLinkParent = this.parentNode; /* 2 */
2222

23-
if (navLinkParent.classList.contains('is-active')) {
24-
/* 3 */
25-
navLinkParent.classList.remove('is-active');
26-
27-
this.setAttribute("aria-expanded", "false");
28-
} else {
29-
/* 4 */
30-
navLinkParent.classList.add('is-active');
31-
32-
this.setAttribute("aria-expanded", "true");
33-
}
34-
35-
});
36-
}
23+
if (navLinkParent.classList.contains('is-active')) {
24+
/* 3 */
25+
navLinkParent.classList.remove('is-active');
3726

38-
/**
39-
* Expose docs dropdown if on a docs page
40-
*/
41-
if (window.location.href.indexOf('docs') > -1) {
42-
navDropdownListItem.classList.add('is-active');
43-
}
27+
this.setAttribute('aria-expanded', 'false');
28+
} else {
29+
/* 4 */
30+
navLinkParent.classList.add('is-active');
4431

45-
var pathName = location.pathname;
32+
this.setAttribute('aria-expanded', 'true');
33+
}
34+
});
35+
}
4636

47-
var navLinks = document.querySelectorAll('.c-tree-nav a');
37+
/**
38+
* Expose docs dropdown if on a docs page
39+
*/
40+
if (window.location.href.indexOf('docs') > -1) {
41+
navDropdownListItem.classList.add('is-active');
42+
}
4843

49-
for (i = 0; i < navLinks.length; i++) {
50-
var subnavLink = navLinks[i].getAttribute('href');
51-
if (subnavLink == pathName) {
52-
navLinks[i].classList.add('is-active');
53-
}
54-
}
44+
var pathName = location.pathname;
5545

56-
/**
57-
* Toggles active class on the primary nav panel
58-
* 1) Select all nav triggers and cycle through them
59-
* 2) On click, find the nav panel within the header
60-
* 3) If the navPanel already has active class, remove it on click.
61-
* 4) If the navPanel does not have an active class, add it on click.
62-
*/
63-
var navToggle = document.querySelectorAll('.js-nav-trigger'); /* 1 */
46+
var navLinks = document.querySelectorAll('.c-tree-nav a');
6447

65-
for (i = 0; i < navToggle.length; i++) {
66-
/* 1 */
48+
for (i = 0; i < navLinks.length; i++) {
49+
var subnavLink = navLinks[i].getAttribute('href');
50+
if (subnavLink == pathName) {
51+
navLinks[i].classList.add('is-active');
52+
}
53+
}
6754

68-
navToggle[i].addEventListener('click', function(event) {
69-
/* 2 */
70-
event.preventDefault();
71-
var navToggleParent = this.parentNode; /* 2 */
72-
var navPanel = navToggleParent.querySelector('.js-nav-panel'); /* 2 */
55+
/**
56+
* Toggles active class on the primary nav panel
57+
* 1) Select all nav triggers and cycle through them
58+
* 2) On click, find the nav panel within the header
59+
* 3) If the navPanel already has active class, remove it on click, as well as the aria-expanded attributes value.
60+
* 4) If the navPanel does not have an active class, add it on click, as well as the aria-expanded attributes value.
61+
*/
62+
var navToggle = document.querySelectorAll('.js-nav-trigger'); /* 1 */
7363

74-
if (navPanel.classList.contains('is-active')) {
75-
/* 3 */
76-
navPanel.classList.remove('is-active');
77-
} else {
78-
/* 4 */
79-
navPanel.classList.add('is-active');
80-
}
81-
});
82-
}
64+
for (i = 0; i < navToggle.length; i++) {
65+
/* 1 */
66+
67+
navToggle[i].addEventListener('click', function(event) {
68+
/* 2 */
69+
event.preventDefault();
70+
var navToggleElement = this;
71+
var navToggleParent = navToggleElement.parentNode; /* 2 */
72+
var navPanel = navToggleParent.querySelector('.js-nav-panel'); /* 2 */
73+
74+
if (navPanel.classList.contains('is-active')) {
75+
/* 3 */
76+
navPanel.classList.remove('is-active');
77+
navToggleElement.setAttribute('aria-expanded', 'false');
78+
} else {
79+
/* 4 */
80+
navPanel.classList.add('is-active');
81+
navToggleElement.setAttribute('aria-expanded', 'true');
82+
}
83+
});
84+
}
8385
})();

packages/docs/src/scss/abstracts/_mixins.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@
9191
z-index: 0;
9292
content: attr(data-text);
9393

94+
// Mitigating the positioning by 4px from the left to not have the words break incorrectly (see #GH-1158)
95+
margin-right: -4px;
96+
9497
background-image: radial-gradient(
9598
$color-brand-purple 0%,
9699
$color-brand-purple 60%,

packages/docs/src/scss/components/_header.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@
4747
.c-header__nav-btn {
4848
margin-left: auto;
4949

50+
// Pseudo / breakout element that enables clicking/tabbing outside of the menu to close it
51+
&[aria-expanded="true"]::after {
52+
position: fixed;
53+
top: 0;
54+
left: 0;
55+
56+
content: "";
57+
58+
width: 100vw;
59+
height: 100vh;
60+
}
61+
5062
@media all and (min-width: $bp-large) {
5163
display: none;
5264
}

packages/edition-node-gulp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Pattern Lab Node - Gulp Edition
77

8-
The Gulp wrapper around [Pattern Lab Node Core](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core)), the default PatternEngine, and supporting frontend assets.
8+
The Gulp wrapper around [Pattern Lab Node Core](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core), the default PatternEngine, and supporting frontend assets.
99

1010
[Online Demo of Pattern Lab Output](https://demo.patternlab.io/)
1111

packages/starterkit-handlebars-demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"bugs": {
1919
"url": "https://github.com/pattern-lab/patternlab-node/issues"
2020
},
21-
"homepage": "https://github.com/pattern-lab/patternlab-node/tree/master/packages/starterkit-handebars-demo",
21+
"homepage": "https://github.com/pattern-lab/patternlab-node/tree/master/packages/starterkit-handlebars-demo",
2222
"publishConfig": {
2323
"access": "public"
2424
},

0 commit comments

Comments
 (0)