Skip to content

Commit 6c3dcf4

Browse files
committed
Merge branch 'feature/uikit-refactor-p7' into feature/uikit-refactor-p8
# Conflicts: # packages/uikit-workshop/dist/styleguide/css/pattern-lab.css # packages/uikit-workshop/dist/styleguide/js/patternlab-pattern.js # packages/uikit-workshop/dist/styleguide/js/patternlab-viewer.js # packages/uikit-workshop/dist/styleguide/js/pl-drawer~pl-layout~pl-search~pl-toggle-info~pl-toggle-layout~pl-toggle-theme-chunk-2c67daaa66841dd22518.js # packages/uikit-workshop/dist/styleguide/js/pl-modal-viewer-chunk-f38ef759072e3833b962.js # packages/uikit-workshop/dist/styleguide/js/pl-search-chunk-129bc9ed93061bd70d16.js # packages/uikit-workshop/dist/styleguide/js/vendors~pl-layout-chunk-1ff0599dcdd07d03f1dd.js
2 parents dee9d70 + e2cd335 commit 6c3dcf4

15 files changed

+37
-29
lines changed

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"lerna": "3.2.1",
2+
"lerna": "3.10.8",
33
"packages": [
44
"packages/*"
55
],

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"devDependencies": {
3-
"lerna": "3.2.1",
2+
"dependencies": {
3+
"lerna": "3.10.8",
44
"prettier": "^1.14.3",
55
"pretty-quick": "^1.8.0"
66
},
77
"private": true,
88
"scripts": {
99
"bootstrap": "lerna bootstrap",
10-
"setup": "npm run bootstrap && npm run build:uikit",
11-
"build:uikit": "lerna exec --scope @pattern-lab/uikit-workshop -- npm run build",
10+
"setup": "npm install && npm run bootstrap && npm run build:uikit",
11+
"build:uikit": "cd packages/uikit-workshop && npm run build",
1212
"precommit": "pretty-quick --staged",
1313
"prettier": "prettier --config .prettierrc --write ./**/*.js --ignore-path .prettierignore",
1414
"test": "lerna run test",

packages/core/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ See [Usage](#usage) for more information.
2828

2929
For users wanting a more pre-packaged experience several editions are available.
3030

31-
* [Pattern Lab/Node: Vanilla Edition](https://github.com/pattern-lab/patternlab-node/packages/edition-node) contains info how to get started within a pure node environment.
31+
* [Pattern Lab/Node: Vanilla Edition](https://github.com/pattern-lab/patternlab-node/tree/dev/packages/edition-node) contains info how to get started within a pure node environment.
3232

33-
* [Pattern Lab/Node: Gulp Edition](https://github.com/pattern-lab/patternlab-node/packages/edition-node-gulp) contains info how to get started within a Gulp task running environment.
33+
* [Pattern Lab/Node: Gulp Edition](https://github.com/pattern-lab/patternlab-node/tree/dev/packages/edition-node-gulp) contains info how to get started within a Gulp task running environment.
3434

3535

3636
## Ecosystem
@@ -63,7 +63,7 @@ patternlab.serve({
6363

6464
* Read more about the rest of [Public API](./docs), and already implemented for you within [Editions](#editions).
6565

66-
* A full-featured [command line interface](https://github.com/pattern-lab/patternlab-node/packages/cli) is also available.
66+
* A full-featured [command line interface](https://github.com/pattern-lab/patternlab-node/tree/dev/packages/cli) is also available.
6767

6868
### Events
6969

packages/core/src/lib/addPattern.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict';
22

3-
const _ = require('lodash');
4-
53
const logger = require('./log');
64

75
module.exports = function(pattern, patternlab) {
@@ -41,12 +39,7 @@ module.exports = function(pattern, patternlab) {
4139
patternlab.partials[pattern.patternPartial] = pattern.patternDesc;
4240
}
4341

44-
//patterns sorted by name so the patterntype and patternsubtype is adhered to for menu building
45-
patternlab.patterns.splice(
46-
_.sortedIndexBy(patternlab.patterns, pattern, 'name'),
47-
0,
48-
pattern
49-
);
42+
patternlab.patterns.push(pattern);
5043
patternlab.graph.add(pattern);
5144
}
5245
};

packages/core/src/lib/patternlab.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,12 @@ module.exports = class PatternLab {
334334
this.patterns.map(pattern => {
335335
return processIterative(pattern, self);
336336
})
337-
);
337+
).then(() => {
338+
// patterns sorted by name so the patterntype and patternsubtype is adhered to for menu building
339+
this.patterns.sort((pattern1, pattern2) =>
340+
pattern1.name.localeCompare(pattern2.name)
341+
);
342+
});
338343
});
339344
}
340345

packages/core/src/lib/pseudopattern_hunter.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const logger = require('./log');
1212
const readDocumentation = require('./readDocumentation');
1313
const lineage_hunter = new lh();
1414
const changes_hunter = new ch();
15+
const yaml = require('js-yaml');
1516

1617
const pseudopattern_hunter = function() {};
1718

@@ -22,9 +23,12 @@ pseudopattern_hunter.prototype.find_pseudopatterns = function(
2223
const paths = patternlab.config.paths;
2324

2425
//look for a pseudo pattern by checking if there is a file containing same
25-
//name, with ~ in it, ending in .json
26+
//name, with ~ in it, ending in .json, .yml or .yaml
2627
const needle =
27-
currentPattern.subdir + '/' + currentPattern.fileName + '~*.json';
28+
currentPattern.subdir +
29+
'/' +
30+
currentPattern.fileName +
31+
'~*.{json,yml,yaml}';
2832
const pseudoPatterns = glob.sync(needle, {
2933
cwd: paths.source.patterns,
3034
debug: false,
@@ -45,7 +49,9 @@ pseudopattern_hunter.prototype.find_pseudopatterns = function(
4549
paths.source.patterns,
4650
pseudoPatterns[i]
4751
);
48-
variantFileData = fs.readJSONSync(variantFileFullPath);
52+
variantFileData = yaml.safeLoad(
53+
fs.readFileSync(variantFileFullPath, 'utf8')
54+
);
4955
} catch (err) {
5056
logger.warning(
5157
`There was an error parsing pseudopattern JSON for ${
@@ -65,9 +71,13 @@ pseudopattern_hunter.prototype.find_pseudopatterns = function(
6571
const variantName = pseudoPatterns[i]
6672
.substring(pseudoPatterns[i].indexOf('~') + 1)
6773
.split('.')[0];
74+
const variantExtension = pseudoPatterns[i]
75+
.split('.')
76+
.slice(-1)
77+
.pop();
6878
const variantFilePath = path.join(
6979
currentPattern.subdir,
70-
currentPattern.fileName + '~' + variantName + '.json'
80+
currentPattern.fileName + '~' + variantName + '.' + variantExtension
7181
);
7282
const lm = fs.statSync(variantFileFullPath);
7383
const patternVariant = Pattern.create(

packages/engine-mustache/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## The Mustache PatternEngine for Pattern Lab / Node
22

3-
This one should be included by default with [Pattern Lab Node Core](https://github.com/pattern-lab/patternlab-node/packages/core) and consumed by [Node Editions](https://github.com/pattern-lab?utf8=%E2%9C%93&query=edition-node).
3+
This one should be included by default with [Pattern Lab Node Core](https://github.com/pattern-lab/patternlab-node/tree/dev/packages/core) and consumed by [Node Editions](https://github.com/pattern-lab?utf8=%E2%9C%93&query=edition-node).
44

55
If it's missing from your project for any reason, `npm install @pattern-lab/engine-mustache` should do the trick.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!doctype html> <html class="pl-c-html"> <head> <title id="title">Pattern Lab</title> <meta charset="UTF-8"> <meta name="viewport" content="initial-scale=1,width=device-width,viewport-fit=cover"> <meta name="theme-color" content="#ababab"> <style>
22
.pl-c-body *{-webkit-box-sizing:border-box;box-sizing:border-box}.pl-c-html{min-height:100%}.pl-c-body{margin:0;padding:0;-webkit-text-size-adjust:100%;display:-webkit-box;display:-ms-flexbox;display:flex}pl-header{position:fixed;position:-webkit-sticky;position:sticky;top:0;left:0;z-index:4;display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;background-color:#000;color:grey}pl-layout{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;width:100%;min-height:100vh;max-width:100vw;background-color:#ddd}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){pl-layout{overflow:hidden}}pl-iframe{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.pl-c-body--theme-sidebar .pl-c-viewport{top:0}.pl-c-viewport-modal-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;max-width:100vw;position:relative}
33
</style>
4-
<link rel="preload" href="styleguide/css/pattern-lab.ca4a0d18.css" media="all" as="style" onload="this.onload=null;this.rel='stylesheet'">
5-
<noscript><link rel="stylesheet" href="styleguide/css/pattern-lab.ca4a0d18.css" media="all"></noscript>
4+
<link rel="preload" href="styleguide/css/pattern-lab.3a52e38b.css" media="all" as="style" onload="this.onload=null;this.rel='stylesheet'">
5+
<noscript><link rel="stylesheet" href="styleguide/css/pattern-lab.3a52e38b.css" media="all"></noscript>
66
<script>!function(n){"use strict";n.loadCSS||(n.loadCSS=function(){});var o=loadCSS.relpreload={};if(o.support=function(){var e;try{e=n.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),o.bindMediaToggle=function(t){var e=t.media||"all";function a(){t.media=e}t.addEventListener?t.addEventListener("load",a):t.attachEvent&&t.attachEvent("onload",a),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(a,3e3)},o.poly=function(){if(!o.support())for(var t=n.document.getElementsByTagName("link"),e=0;e<t.length;e++){var a=t[e];"preload"!==a.rel||"style"!==a.getAttribute("as")||a.getAttribute("data-loadcss")||(a.setAttribute("data-loadcss",!0),o.bindMediaToggle(a))}},!o.support()){o.poly();var t=n.setInterval(o.poly,500);n.addEventListener?n.addEventListener("load",function(){o.poly(),n.clearInterval(t)}):n.attachEvent&&n.attachEvent("onload",function(){o.poly(),n.clearInterval(t)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:n.loadCSS=loadCSS}("undefined"!=typeof global?global:this);</script> </head> <body class="pl-c-body"> <pl-layout> <pl-header></pl-header> <div class="pl-c-viewport-modal-wrapper"> <pl-iframe></pl-iframe> <pl-drawer></pl-drawer> </div> </pl-layout> <script type="text/mustache" class="pl-js-panel-template-base"> {{# descBlockExists }} <div class="pl-c-pattern-info__panel pl-c-pattern-info__panel--info pl-js-pattern-info"> {{# isPatternView }} <div class=pl-c-pattern-info__header> <ul class=pl-c-breadcrumb> {{# patternBreadcrumb }} <li class=pl-c-breadcrumb__item>{{ patternType }}</li> {{# patternSubtype }} <li class=pl-c-breadcrumb__item>{{ patternSubtype }}</li> {{/ patternSubtype }} {{/ patternBreadcrumb }} </ul> <h2 class=pl-c-pattern-info__title> {{ patternName }} {{# patternState }} <span class="pl-c-pattern-state pl-c-pattern-state--{{ patternState }}" title="{{ patternState }}"></span> {{/ patternState }} </h2> </div> {{/ isPatternView }} {{# patternDescExists }} <div class="pl-c-pattern-info__description pl-c-text-passage"> {{{ patternDesc }}} {{# patternDescAdditions }} {{{ patternDescAdditions }}} {{/ patternDescAdditions }} </div> {{/ patternDescExists }} {{# lineageExists }} <p class="pl-c-lineage pl-js-lineage"> The <em>{{ patternName }}</em> pattern contains the following patterns: {{# lineage }} <a href='{{ lineagePath }}' class='pl-c-lineage__link pl-js-lineage-link' data-patternpartial='{{ lineagePattern }}'> {{ lineagePattern }} {{# lineageState }}<span class="pl-c-pattern-state pl-c-pattern-state--{{ lineageState }}" title="{{ lineageState }}"/>{{/ lineageState }} </a> {{# hasComma }}, {{/ hasComma }} {{/ lineage }} </p> {{/ lineageExists }} {{# lineageRExists }} <p class=pl-c-lineage> The <em>{{ patternName }}</em> pattern is included in the following patterns: {{# lineageR }} <a href='{{ lineagePath }}' class='pl-c-lineage__link pl-js-lineage-link' data-patternpartial='{{ lineagePattern }}'> {{ lineagePattern }} {{# lineageState }}<span class="pl-c-pattern-state pl-c-pattern-state--{{ lineageState }}" title="{{ lineageState }}"/>{{/ lineageState }} </a> {{# hasComma }}, {{/ hasComma }} {{/ lineageR }} </p> {{/ lineageRExists }} {{# annotationExists }} <div class="pl-c-annotations pl-c-text-passage pl-js-annotations"> <h2 class=pl-c-annotations__title>Annotations</h2> <ol class=pl-c-annotations__list> {{# annotations }} <li class=pl-c-annotations__item> <h3 class=pl-c-annotations__item-title>{{ title }}</h3> <div class=pl-c-annotations__item-body> {{{ comment }}} </div> </li> {{/ annotations }} </ol> </div> {{/ annotationExists }} </div> {{/ descBlockExists }} <div class="pl-c-pattern-info__panel pl-c-pattern-info__panel--code"> <div id="pl-{{ patternPartial }}-tabs" class="pl-c-tabs pl-js-tabs"> <div class=pl-c-tabs__header> <ul class=pl-c-tabs__list> {{# panels }} <li class=pl-c-tabs__list-item> <a class="pl-c-tabs__link pl-js-tab-link" href="#pl-{{ patternPartial }}-{{ id }}-panel" id="pl-{{ patternPartial }}-{{ id }}-tab" data-patternpartial="{{ patternPartial }}" data-panelid="{{ id }}">{{ name }}</a> </li> {{/ panels }} </ul> </div> <div id="pl-{{ patternPartial }}-panels" class=pl-c-tabs__content> {{# panels }} <div id="pl-{{ patternPartial }}-{{ id }}-panel" class="pl-c-tabs__panel pl-js-tab-panel"> <button class="pl-c-code-copy-btn pl-js-code-copy-btn" data-clipboard-target="#pl-{{ patternPartial }}-{{ id }}-panel code">Copy</button> {{{ content }}} </div> {{/ panels }} </div> </div> </div> </script> <script type="text/mustache" id="pl-panel-template-code"> <pre class=language-markup>
77
<code id="pl-code-fill-{{ language }}" class="language-{{ language }}">{{{ code }}}</code>
88
</pre> </script> <script src="styleguide/data/patternlab-data.js" defer="defer"></script> <script src="annotations/annotations.js" defer="defer"></script> <script src="styleguide/js/patternlab-viewer.js" defer="defer"></script> <script></script> </body> </html>

packages/uikit-workshop/dist/styleguide/css/pattern-lab.ca4a0d18.css renamed to packages/uikit-workshop/dist/styleguide/css/pattern-lab.3a52e38b.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uikit-workshop/dist/styleguide/css/pattern-lab.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)