diff --git a/.eslintrc b/.eslintrc.json similarity index 100% rename from .eslintrc rename to .eslintrc.json diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index ab24808be..ebacb44d9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -47,7 +47,7 @@ This ensures that any changes you've made will still result in a clean and funct ## Coding style -Formatting is automated via [Prettier](https://prettier.io/), setup to run on precommit. We suggest [editor integration](https://prettier.io/docs/en/editors.html) for this and for eslint. Prettier is further configured within `.prettierrc`. Eslint validates syntax and usage that Prettier doesn't handle. Configuration for both is found within the `.eslintrc` file. +Formatting is automated via [Prettier](https://prettier.io/), setup to run on precommit. We suggest [editor integration](https://prettier.io/docs/en/editors.html) for this and for eslint. Prettier is further configured within `.prettierrc`. Eslint validates syntax and usage that Prettier doesn't handle. Configuration for both is found within the `.eslintrc.json` file. The `.editorconfig` controls spaces / tabs within supported editors. Check out their [site](http://editorconfig.org/). diff --git a/.prettierignore b/.prettierignore index 3a4d3d062..627831b2a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -8,3 +8,4 @@ packages/core/scripts/api.handlebars packages/core/scripts/events.handlebars packages/core/test/files/annotations.js +**/uikit-workshop/src/js/**/* diff --git a/.travis.yml b/.travis.yml index 1b313e1a9..40c6ef772 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,14 +4,14 @@ before_install: - phantomjs --version before_script: - - npm install -g lerna@3.0.0-beta.21 + - npm install -g lerna@3.2.1 - npm run bootstrap - - lerna add @pattern-lab/engine-mustache - - lerna add @pattern-lab/engine-handlebars - - lerna add @pattern-lab/engine-underscore - - lerna add @pattern-lab/engine-liquid - - lerna add @pattern-lab/engine-twig - - lerna add @pattern-lab/engine-react + - lerna add @pattern-lab/engine-mustache --scope=@pattern-lab/core + - lerna add @pattern-lab/engine-handlebars --scope=@pattern-lab/core + - lerna add @pattern-lab/engine-underscore --scope=@pattern-lab/core + - lerna add @pattern-lab/engine-liquid --scope=@pattern-lab/core + - lerna add @pattern-lab/engine-twig --scope=@pattern-lab/core + - lerna add @pattern-lab/engine-react --scope=@pattern-lab/core branches: only: diff --git a/lerna.json b/lerna.json index ba1eb1d95..ebb176d9b 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "lerna": "3.0.0-beta.21", + "lerna": "3.2.1", "packages": [ "packages/*" ], @@ -7,6 +7,18 @@ "command": { "init": { "exact": true + }, + "bootstrap": { + "hoist": [ + "tap", + "eslin*", + "husky", + "prettier", + "pretty-quick" + ] + }, + "publish": { + "allowBranch": "master" } }, "npmClientArgs": [ diff --git a/package.json b/package.json index 1307fff29..54127ff3a 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,14 @@ { "devDependencies": { - "lerna": "3.0.0-beta.21" + "lerna": "3.2.1" }, + "private": true, "scripts": { - "bootstrap": "lerna bootstrap --hoist tap --hoist eslin* --hoist husky --hoist prettier --hoist pretty-quick", + "bootstrap": "lerna bootstrap", "precommit": "pretty-quick --staged", "prettier": "prettier --config .prettierrc --write ./**/*.js", - "test": "lerna run test" + "test": "lerna run test", + "clean": "git clean -dfx" }, "nyc": { "exclude": [ diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index fd70e025a..a9f8b89bc 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -4,114 +4,85 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [0.0.1-alpha.23](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.22...@pattern-lab/cli@0.0.1-alpha.23) (2018-07-09) +## [0.0.1-alpha.23](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.22...@pattern-lab/cli@0.0.1-alpha.23) (2018-07-09) ### Bug Fixes * **install:** copy dependencies ([1acef87](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/1acef87)) - - - - + ## [0.0.1-alpha.22](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.21...@pattern-lab/cli@0.0.1-alpha.22) (2018-07-06) **Note:** Version bump only for package @pattern-lab/cli - - - - -## [0.0.1-alpha.21](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.20...@pattern-lab/cli@0.0.1-alpha.21) (2018-07-06) +## [0.0.1-alpha.21](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.20...@pattern-lab/cli@0.0.1-alpha.21) (2018-07-06) ### Bug Fixes * **install:** add break statements to install edition command ([3b1813c](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/3b1813c)) * **install:** use process to find package.json ([200c7cb](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/200c7cb)) - ### Features * **package:** add npmrc file ([55f5bc2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/55f5bc2)) * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/5ab3995)) - - - - -## [0.0.1-alpha.20](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.19...@pattern-lab/cli@0.0.1-alpha.20) (2018-07-05) +## [0.0.1-alpha.20](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.19...@pattern-lab/cli@0.0.1-alpha.20) (2018-07-05) ### Bug Fixes * **cli:** change whitespace to spaces per standard ([4556fc7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/4556fc7)) * **tests:** change test command name similar to live-server until this passes CI ([5c39be1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/5c39be1)) - ### Features * **serve:** change calling method ([3b86a0d](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/3b86a0d)) * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/38a01b1)) - - - -## [0.0.1-alpha.19](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.18...@pattern-lab/cli@0.0.1-alpha.19) (2018-05-19) +## [0.0.1-alpha.19](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.18...@pattern-lab/cli@0.0.1-alpha.19) (2018-05-19) ### Bug Fixes * **cli:** change line-endings of cli entrypoint ([3fc86c2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/3fc86c2)) * **wording:** reconcile Pattern Lab vs PatternLab ([f3d1e0d](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/f3d1e0d)) - - - -## [0.0.1-alpha.18](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.17...@pattern-lab/cli@0.0.1-alpha.18) (2018-05-04) +## [0.0.1-alpha.18](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.17...@pattern-lab/cli@0.0.1-alpha.18) (2018-05-04) ### Bug Fixes * **version:** use static core method getVersion ([f9dcd4d](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/f9dcd4d)) - - - -## [0.0.1-alpha.17](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.16...@pattern-lab/cli@0.0.1-alpha.17) (2018-05-04) +## [0.0.1-alpha.17](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.16...@pattern-lab/cli@0.0.1-alpha.17) (2018-05-04) ### Bug Fixes * **package:** update publish config and installation target ([27d2c8f](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/27d2c8f)) - - - -## [0.0.1-alpha.16](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.15...@pattern-lab/cli@0.0.1-alpha.16) (2018-05-04) +## [0.0.1-alpha.16](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.15...@pattern-lab/cli@0.0.1-alpha.16) (2018-05-04) ### Features * **API:** standardize v() and version() into a single call ([6309e69](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/6309e69)) - ### BREAKING CHANGES * **API:** change `version()` to return a string representation of the version, removing `v()` - - - ## [0.0.1-alpha.15](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.14...@pattern-lab/cli@0.0.1-alpha.15) (2018-03-21) diff --git a/packages/cli/bin/install-plugin.js b/packages/cli/bin/install-plugin.js index b90ed1c1c..42ea84c63 100644 --- a/packages/cli/bin/install-plugin.js +++ b/packages/cli/bin/install-plugin.js @@ -1,5 +1,9 @@ 'use strict'; + +const path = require('path'); + const _ = require('lodash'); + const checkAndInstallPackage = require('./utils').checkAndInstallPackage; const wrapAsync = require('./utils').wrapAsync; @@ -8,7 +12,21 @@ const installPlugin = (plugin, config) => const name = plugin.name || plugin; yield checkAndInstallPackage(name); // Put the installed plugin in the patternlab-config.json - _.set(config, `plugins[${name}]['enabled']`, false); + _.set(config, `plugins[${name}]['enabled']`, true); + _.set(config, `plugins[${name}]['initialized']`, false); + + // Get the options from the plugin, if any + const pluginPathConfig = path.resolve( + path.join(process.cwd(), 'node_modules', name, 'config.json') + ); + try { + const pluginConfigJSON = require(pluginPathConfig); + if (!_.has(config.plugins[name].options)) { + _.set(config, `plugins[${name}]['options]`, pluginConfigJSON); + } + } catch (ex) { + //a config.json file is not required at this time + } return name; }); diff --git a/packages/cli/bin/patternlab.js b/packages/cli/bin/patternlab.js index 0f05a61df..8800dd2fd 100755 --- a/packages/cli/bin/patternlab.js +++ b/packages/cli/bin/patternlab.js @@ -1,6 +1,7 @@ #!/usr/bin/env node 'use strict'; const cli = require('commander'); +const path = require('path'); const build = require('./cli-actions/build'); const disable = require('./cli-actions/disable'); const enable = require('./cli-actions/enable'); @@ -42,7 +43,7 @@ cli '-c, --config ', 'Specify config file. Default looks up the project dir', val => val.trim(), - './patternlab-config.json' + path.resolve(process.cwd(), 'patternlab-config.json') ) .option('-v, --verbose', 'Show verbose console logs', verboseLogs) .option('--silent', 'Turn off console logs', silenceLogs); diff --git a/packages/cli/bin/utils.js b/packages/cli/bin/utils.js index 0699bff36..aae408bbb 100644 --- a/packages/cli/bin/utils.js +++ b/packages/cli/bin/utils.js @@ -175,13 +175,31 @@ const checkAndInstallPackage = (packageName, url) => */ const noop = () => {}; +/** + * @func writeJsonAsync + * Wrapper for fs.writeJsonAsync with consistent spacing + * @param {string} filePath + * @param {object} data + */ +const writeJsonAsync = (filePath, data) => + wrapAsync(function*() { + yield fs.outputJSON(filePath, data, { spaces: 2 }); + }); + +/** + * @func getJSONKey + * Installs package, then returns the value for the given JSON file's key within + * @param {string} packageName - the node_module to install / load + * @param {object} key - the key to find + * @param {object} fileName - the filePath of the JSON + */ const getJSONKey = (packageName, key, fileName = 'package.json') => wrapAsync(function*() { yield checkAndInstallPackage(packageName); - const packageJSON = yield fs.readJson( + const jsonData = yield fs.readJson( path.resolve('node_modules', packageName, fileName) ); - return packageJSON[key]; + return jsonData[key]; }); module.exports = { @@ -189,7 +207,7 @@ module.exports = { copyAsync: fs.copy, mkdirsAsync: fs.mkdirs, moveAsync: fs.move, - writeJsonAsync: fs.outputJson, + writeJsonAsync: writeJsonAsync, readJsonAsync: fs.readJson, error, info, diff --git a/packages/cli/package.json b/packages/cli/package.json index 935ea6906..b92ba64b4 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -30,7 +30,7 @@ "eslint-plugin-prettier": "2.6.0", "prettier": "1.11.1", "proxyquire": "2.0.1", - "tap": "11.1.1" + "tap": "11.1.5" }, "files": [ "bin" diff --git a/packages/cli/test/cli-init.test.js b/packages/cli/test/cli-init.test.js index cafcdb163..a80c031ff 100644 --- a/packages/cli/test/cli-init.test.js +++ b/packages/cli/test/cli-init.test.js @@ -8,31 +8,31 @@ const wrapAsync = require('../bin/utils').wrapAsync; const projectRoot = getUniqueProjectPath(); tap.test('Init ->', t => - wrapAsync(function*() { - yield spawnCmd([ - 'init', - '--verbose', - '--project-dir', - projectRoot, - '--edition', - '@pattern-lab/edition-node', - '--starterkit', - '@pattern-lab/starterkit-mustache-base', - ]); - t.ok( - exists.sync(path.resolve(projectRoot)), - 'should initialize a Pattern Lab project' - ); - t.ok(exists.sync(path.resolve(projectRoot, 'source')), 'with a source dir'); - t.ok(exists.sync(path.resolve(projectRoot, 'public')), 'with a public dir'); - t.ok( - exists.sync(path.resolve(projectRoot, 'pattern_exports')), - 'with a pattern_exports dir' - ); - t.ok( - exists.sync(path.resolve(projectRoot, 'patternlab-config.json')), - 'with a pattern_exports dir' - ); - t.end(); - }) + wrapAsync(function*() { + yield spawnCmd([ + 'init', + '--verbose', + '--project-dir', + projectRoot, + '--edition', + '@pattern-lab/edition-node', + '--starterkit', + '@pattern-lab/starterkit-mustache-base', + ]); + t.ok( + exists.sync(path.resolve(projectRoot)), + 'should initialize a Pattern Lab project' + ); + t.ok(exists.sync(path.resolve(projectRoot, 'source')), 'with a source dir'); + t.ok(exists.sync(path.resolve(projectRoot, 'public')), 'with a public dir'); + t.ok( + exists.sync(path.resolve(projectRoot, 'pattern_exports')), + 'with a pattern_exports dir' + ); + t.ok( + exists.sync(path.resolve(projectRoot, 'patternlab-config.json')), + 'with a pattern_exports dir' + ); + t.end(); + }) ); diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 1ff344cf6..b8aae92b1 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -4,17 +4,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + # [3.0.0-alpha.16](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.15...@pattern-lab/core@3.0.0-alpha.16) (2018-07-06) **Note:** Version bump only for package @pattern-lab/core - - - - -# [3.0.0-alpha.15](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.14...@pattern-lab/core@3.0.0-alpha.15) (2018-07-06) +# [3.0.0-alpha.15](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.14...@pattern-lab/core@3.0.0-alpha.15) (2018-07-06) ### Features @@ -22,13 +19,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/5ab3995)) - - - - -# [3.0.0-alpha.14](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.13...@pattern-lab/core@3.0.0-alpha.14) (2018-07-05) +# [3.0.0-alpha.14](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.13...@pattern-lab/core@3.0.0-alpha.14) (2018-07-05) ### Bug Fixes @@ -38,7 +31,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **viewall:** fix viewall generation ([543558a](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/543558a)) * **watch:** wire up serve and watch listeners correctly ([04cd18e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/04cd18e)) - ### Features * **events:** add PATTERNLAB_BUILD_END event and rename BUILD_START ([5b7bfa3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/5b7bfa3)) @@ -47,23 +39,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **server:** continue server refactor ([8f6cd91](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/8f6cd91)) * **watches:** add additional assets to ignore ([18e74c2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/18e74c2)) - - - -# [3.0.0-alpha.13](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.12...@pattern-lab/core@3.0.0-alpha.13) (2018-05-04) +# [3.0.0-alpha.13](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.12...@pattern-lab/core@3.0.0-alpha.13) (2018-05-04) ### Features * **api:** expose getVersion statically ([4683cd0](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/4683cd0)) - - - -# [3.0.0-alpha.12](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.11...@pattern-lab/core@3.0.0-alpha.12) (2018-05-04) +# [3.0.0-alpha.12](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.11...@pattern-lab/core@3.0.0-alpha.12) (2018-05-04) ### Bug Fixes @@ -76,7 +62,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **tests:** prevent dependency graph output file from being written ([0d9c57e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/0d9c57e)) * **uikits:** fix ui_builder_tests ([e75f434](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/e75f434)) - ### Features * **API:** standardize v() and version() into a single call ([6309e69](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/6309e69)) @@ -96,14 +81,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **uikits:** support watched-asset copying ([4f05311](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/4f05311)) * **uikits:** uikits config to default ([a393851](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/a393851)) - ### BREAKING CHANGES * **API:** change `version()` to return a string representation of the version, removing `v()` - - - # [3.0.0-alpha.11](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.10...@pattern-lab/core@3.0.0-alpha.11) (2018-03-21) diff --git a/packages/core/package.json b/packages/core/package.json index 20b9015bf..d0e5983df 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -30,7 +30,7 @@ "pretty-quick": "1.2.2", "rewire": "2.5.2", "standard-version": "4.3.0", - "tap": "11.1.1" + "tap": "11.1.5" }, "keywords": [ "Pattern Lab", diff --git a/packages/core/scripts/events.handlebars b/packages/core/scripts/events.handlebars index ca564fd52..667e8c9bf 100644 --- a/packages/core/scripts/events.handlebars +++ b/packages/core/scripts/events.handlebars @@ -5,7 +5,7 @@ Pattern Lab emits numerous events during the [build](../docs/) process. Some uses of events: * Core uses `patternlab-pattern-change` events when watching for changes in order to trigger another build -* Plugins such as [plugin-node-tab](https://github.com/pattern-lab/plugin-node-tab) can use an event like `patternlab-pattern-write-end` to define additional code tabs to the pattern viewer / modal +* Plugins such as [plugin-tab](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab) can use an event like `patternlab-pattern-write-end` to define additional code tabs to the pattern viewer / modal Learn more about [Creating Plugins](https://github.com/pattern-lab/patternlab-node/wiki/Creating-Plugins). diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 48eb93022..eb20f4af0 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -10,11 +10,14 @@ 'use strict'; +const path = require('path'); + const updateNotifier = require('update-notifier'); const packageInfo = require('../package.json'); const events = require('./lib/events'); const pe = require('./lib/pattern_exporter'); +const pm = require('./lib/plugin_manager'); const defaultConfig = require('../patternlab-config.json'); @@ -189,7 +192,11 @@ const patternlab_module = function(config) { * @returns {void} */ installplugin: function(pluginName) { - patternlab.installPlugin(pluginName); + //get the config + const configPath = path.resolve(process.cwd(), 'patternlab-config.json'); + const plugin_manager = new pm(config, configPath); + + plugin_manager.install_plugin(pluginName); }, /** diff --git a/packages/core/src/lib/annotation_exporter.js b/packages/core/src/lib/annotationExporter.js similarity index 70% rename from packages/core/src/lib/annotation_exporter.js rename to packages/core/src/lib/annotationExporter.js index 8fb22470d..06b336f6c 100644 --- a/packages/core/src/lib/annotation_exporter.js +++ b/packages/core/src/lib/annotationExporter.js @@ -6,43 +6,49 @@ const _ = require('lodash'); const mp = require('./markdown_parser'); const logger = require('./log'); -const annotations_exporter = function(pl) { +const annotationExporter = function(pl) { const paths = pl.config.paths; - let oldAnnotations; /** * Parses JS annotations. * @returns array of comments that used to be wrapped in raw JS */ - function parseAnnotationsJS() { + function parseAnnotationsJSON() { + const jsonPath = path.resolve(paths.source.annotations, 'annotations.json'); + let annotations; + //attempt to read the file try { - oldAnnotations = fs.readFileSync( - path.resolve(paths.source.annotations, 'annotations.js'), - 'utf8' - ); + if (fs.pathExistsSync(jsonPath)) { + //read the new file + annotations = fs.readFileSync(jsonPath, 'utf8'); + } else { + //read the old file + const jsPath = path.resolve(paths.source.annotations, 'annotations.js'); + + annotations = fs + .readFileSync(jsPath, 'utf8') + .replace(/^\s*var comments ?= ?/, '') + .replace(/};\s*$/, '}'); + + logger.info( + `Please convert ${jsPath} to JSON and rename it annotations.json.` + ); + } } catch (ex) { logger.debug( - `annotations.js file missing from ${ + `annotations.json file missing from ${ paths.source.annotations }. This may be expected if you do not use annotations or are using markdown.` ); return []; } - //parse as JSON by removing the old wrapping js syntax. comments and the trailing semi-colon - oldAnnotations = oldAnnotations.replace('var comments = ', ''); - oldAnnotations = oldAnnotations.replace('};', '}'); - try { - const oldAnnotationsJSON = JSON.parse(oldAnnotations); - return oldAnnotationsJSON.comments; + const annotationsJSON = JSON.parse(annotations); + return annotationsJSON.comments; } catch (ex) { - logger.error( - `There was an error parsing JSON for ${ - paths.source.annotations - }annotations.js` - ); + logger.error(`There was an error parsing JSON for ${jsonPath}`); return []; } } @@ -108,7 +114,7 @@ const annotations_exporter = function(pl) { * @returns array of annotations */ function gatherAnnotations() { - const annotationsJS = parseAnnotationsJS(); + const annotationsJS = parseAnnotationsJSON(); const annotationsMD = parseAnnotationsMD(); return _.unionBy(annotationsJS, annotationsMD, 'el'); } @@ -117,8 +123,8 @@ const annotations_exporter = function(pl) { gather: function() { return gatherAnnotations(); }, - gatherJS: function() { - return parseAnnotationsJS(); + gatherJSON: function() { + return parseAnnotationsJSON(); }, gatherMD: function() { return parseAnnotationsMD(); @@ -126,4 +132,4 @@ const annotations_exporter = function(pl) { }; }; -module.exports = annotations_exporter; +module.exports = annotationExporter; diff --git a/packages/core/src/lib/exportData.js b/packages/core/src/lib/exportData.js index 51b166a08..f0a00cb40 100644 --- a/packages/core/src/lib/exportData.js +++ b/packages/core/src/lib/exportData.js @@ -4,7 +4,7 @@ const eol = require('os').EOL; const path = require('path'); const _ = require('lodash'); -const ae = require('./annotation_exporter'); +const ae = require('./annotationExporter'); let fs = require('fs-extra'); //eslint-disable-line prefer-const @@ -13,7 +13,7 @@ let fs = require('fs-extra'); //eslint-disable-line prefer-const * @param patternlab - global data store */ module.exports = function(patternlab) { - const annotation_exporter = new ae(patternlab); + const annotationExporter = new ae(patternlab); const paths = patternlab.config.paths; @@ -68,7 +68,7 @@ module.exports = function(patternlab) { eol; //annotations - const annotationsJSON = annotation_exporter.gather(); + const annotationsJSON = annotationExporter.gather(); const annotations = 'var comments = { "comments" : ' + JSON.stringify(annotationsJSON) + '};'; _.each(patternlab.uikits, uikit => { diff --git a/packages/core/src/lib/patternlab.js b/packages/core/src/lib/patternlab.js index 940ca5c89..07d4f1d0d 100644 --- a/packages/core/src/lib/patternlab.js +++ b/packages/core/src/lib/patternlab.js @@ -7,9 +7,9 @@ const cleanHtml = require('js-beautify').html; const inherits = require('util').inherits; const pm = require('./plugin_manager'); +const plugin_manager = new pm(); const packageInfo = require('../../package.json'); const events = require('./events'); -const findModules = require('./findModules'); const buildListItems = require('./buildListItems'); const dataLoader = require('./data_loader')(); const loaduikits = require('./loaduikits'); @@ -77,7 +77,6 @@ module.exports = class PatternLab { // Verify correctness of configuration (?) this.checkConfiguration(this); - // TODO: determine if this is the best place to wire up plugins this.initializePlugins(this); } @@ -134,29 +133,11 @@ module.exports = class PatternLab { * Finds and calls the main method of any found plugins. * @param patternlab - global data store */ - //todo, move this to plugin_manager initializePlugins(patternlab) { if (!patternlab.config.plugins) { return; } - - const plugin_manager = new pm( - patternlab.config, - path.resolve(__dirname, '../../patternlab-config.json') - ); - const foundPlugins = findModules('plugin-'); - - if (foundPlugins && foundPlugins.length > 0) { - for (let i = 0; i < foundPlugins.length; i++) { - const pluginKey = foundPlugins[i]; - - logger.info(`Found plugin: ${pluginKey}`); - logger.info(`Attempting to load and initialize plugin.`); - - const plugin = plugin_manager.load_plugin(pluginKey); - plugin(patternlab); - } - } + plugin_manager.intialize_plugins(patternlab); } buildGlobalData(additionalData) { @@ -311,19 +292,6 @@ module.exports = class PatternLab { } } - /** - * Installs a given plugin. Assumes it has already been pulled down via npm - * @param pluginName - the name of the plugin - */ - installPlugin(pluginName) { - //get the config - const configPath = path.resolve(process.cwd(), 'patternlab-config.json'); - const config = fs.readJSONSync(path.resolve(configPath), 'utf8'); - const plugin_manager = new pm(config, configPath); - - plugin_manager.install_plugin(pluginName); - } - /** * Given a path, load info from the folder to compile into a single config object. * @param dataFilesPath diff --git a/packages/core/src/lib/plugin_manager.js b/packages/core/src/lib/plugin_manager.js index 01de3880e..a3a37ab58 100644 --- a/packages/core/src/lib/plugin_manager.js +++ b/packages/core/src/lib/plugin_manager.js @@ -1,114 +1,65 @@ 'use strict'; -const plugin_manager = function(config, configPath) { +const plugin_manager = function() { const path = require('path'); - const fs = require('fs-extra'); + const findModules = require('./findModules'); + + const _ = require('lodash'); + const logger = require('./log'); + const pluginMatcher = /^plugin-(.*)$/; + /** * Loads a plugin * - * @param pluginName {string} the name of the plugin + * @param modulePath {string} the path to the plugin * @return {object} the loaded plugin */ - function loadPlugin(pluginName) { - return require(path.join(process.cwd(), 'node_modules', pluginName)); + function loadPlugin(modulePath) { + return require(modulePath); } /** - * Installs a plugin - * - * @param pluginName {string} the name of the plugin + * Given a path: return the plugin name if the path points to a valid plugin + * module directory, or false if it doesn't. + * @param filePath + * @returns Plugin name if exists or FALSE */ - function installPlugin(pluginName) { - try { - const pluginPath = path.resolve( - path.join(process.cwd(), 'node_modules', pluginName) - ); - logger.debug(`Attempting to load plugin from ${pluginPath}`); - let pluginDirStats; - try { - pluginDirStats = fs.statSync(pluginPath); - } catch (ex) { - logger.warning(`${pluginName} not found, use npm to install it first.`); - logger.warning(`${pluginName} not loaded.`); - return; - } - const pluginPathDirExists = pluginDirStats.isDirectory(); - if (pluginPathDirExists) { - const diskConfig = fs.readJSONSync(path.resolve(configPath), 'utf8'); - - //add the plugin entry to patternlab-config.json - if (!diskConfig.plugins) { - diskConfig.plugins = {}; - } - - if (!diskConfig.plugins[pluginName]) { - diskConfig.plugins[pluginName] = { - enabled: true, - initialized: false, - }; - } - - const pluginPathConfig = path.resolve(pluginPath, 'config.json'); - try { - const pluginConfigJSON = require(pluginPathConfig); - if (!diskConfig.plugins[pluginName].options) { - diskConfig.plugins[pluginName].options = pluginConfigJSON; - } - } catch (ex) { - //a config.json file is not required at this time - } + function isPlugin(filePath) { + const baseName = path.basename(filePath); + const pluginMatch = baseName.match(pluginMatcher); - //write config entry back - fs.outputFileSync( - path.resolve(configPath), - JSON.stringify(diskConfig, null, 2) - ); - - logger.info('Plugin ' + pluginName + ' installed.'); - logger.info('Plugin configration added to patternlab-config.json.'); - } - } catch (ex) { - logger.warning( - `An error occurred during plugin installation for plugin ${pluginName}` - ); - logger.warning(ex); + if (pluginMatch) { + return pluginMatch[1]; } + return false; } /** - * Disables an installed plugin - * Not implemented yet - */ - function disablePlugin(pluginName) { - logger.warning( - `disablePlugin() not implemented yet. No change made to state of plugin ${pluginName}` - ); - } - - /** - * Enables an installed plugin - * Not implemented yet + * Looks for installed plugins, loads them, and invokes them + * @param {object} patternlab */ - function enablePlugin(pluginName) { - logger.warning( - `enablePlugin() not implemented yet. No change made to state of plugin ${pluginName}` - ); + function initializePlugins(patternlab) { + const nodeModulesPath = path.join(process.cwd(), 'node_modules'); + const foundPlugins = findModules(nodeModulesPath, plugin_manager.is_plugin); + foundPlugins.forEach(plugin => { + logger.info(`Found plugin: plugin-${plugin.name}`); + logger.info(`Attempting to load and initialize plugin.`); + const pluginModule = plugin_manager.load_plugin(plugin.modulePath); + pluginModule(patternlab); + }); } return { - install_plugin: function(pluginName) { - installPlugin(pluginName); - }, - load_plugin: function(pluginName) { - return loadPlugin(pluginName); + intialize_plugins: patternlab => { + initializePlugins(patternlab); }, - disable_plugin: function(pluginName) { - disablePlugin(pluginName); + load_plugin: modulePath => { + return loadPlugin(modulePath); }, - enable_plugin: function(pluginName) { - enablePlugin(pluginName); + is_plugin: filePath => { + return isPlugin(filePath); }, }; }; diff --git a/packages/core/test/annotation_exporter_tests.js b/packages/core/test/annotation_exporter_tests.js index 68c7b2f48..9d8f6b57d 100644 --- a/packages/core/test/annotation_exporter_tests.js +++ b/packages/core/test/annotation_exporter_tests.js @@ -20,12 +20,12 @@ function createFakePatternLab(anPath, customProps) { } var patternlab = createFakePatternLab(anPath); -var ae = require('../src/lib/annotation_exporter')(patternlab); +var ae = require('../src/lib/annotationExporter')(patternlab); tap.test('converts old JS annotations into new format', function(test) { //arrange //act - var annotations = ae.gatherJS(); + var annotations = ae.gatherJSON(); //assert test.equals(annotations.length, 2); @@ -77,7 +77,7 @@ tap.test('merges both annotation methods into one array', function(test) { tap.test('when there are 0 annotation files', function(test) { var emptyAnPath = './test/files/empty/'; var patternlab2 = createFakePatternLab(emptyAnPath); - var ae2 = require('../src/lib/annotation_exporter')(patternlab2); + var ae2 = require('../src/lib/annotationExporter')(patternlab2); var annotations = ae2.gather(); test.equals(annotations.length, 0); diff --git a/packages/development-edition-engine-react/CHANGELOG.md b/packages/development-edition-engine-react/CHANGELOG.md index 515588f83..3143802a6 100644 --- a/packages/development-edition-engine-react/CHANGELOG.md +++ b/packages/development-edition-engine-react/CHANGELOG.md @@ -4,52 +4,40 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + ## [0.1.1-alpha.4](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.3...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.4) (2018-07-06) **Note:** Version bump only for package @pattern-lab/engine-react-testing-tree - - - - -## [0.1.1-alpha.3](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.2...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.3) (2018-07-06) +## [0.1.1-alpha.3](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.2...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.3) (2018-07-06) ### Bug Fixes * **package:** fix fat-fingered dependency ([e439f4e](https://github.com/pattern-lab/edition-node-gulp/commit/e439f4e)) - ### Features * **package:** add npmrc file ([55f5bc2](https://github.com/pattern-lab/edition-node-gulp/commit/55f5bc2)) * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/edition-node-gulp/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/edition-node-gulp/commit/5ab3995)) - - - - -## [0.1.1-alpha.2](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.1...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.2) (2018-07-05) - - +## [0.1.1-alpha.2](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.1...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.2) (2018-07-05) **Note:** Version bump only for package @pattern-lab/engine-react-testing-tree -## [0.1.1-alpha.1](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.0...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.1) (2018-05-04) - - +## [0.1.1-alpha.1](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.0...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.1) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-react-testing-tree -## 0.1.1-alpha.0 (2018-05-04) +## 0.1.1-alpha.0 (2018-05-04) ### Features diff --git a/packages/development-edition-engine-react/gulpfile.js b/packages/development-edition-engine-react/gulpfile.js index 4e97eecf2..8d8653659 100644 --- a/packages/development-edition-engine-react/gulpfile.js +++ b/packages/development-edition-engine-react/gulpfile.js @@ -2,13 +2,13 @@ * PATTERN LAB NODE * EDITION-NODE-GULP * The gulp wrapper around patternlab-node core, providing tasks to interact with the core library. -******************************************************/ + ******************************************************/ const gulp = require('gulp'); const argv = require('minimist')(process.argv.slice(2)); /****************************************************** * PATTERN LAB NODE WRAPPER TASKS with core library -******************************************************/ + ******************************************************/ const config = require('./patternlab-config.json'); const patternlab = require('@pattern-lab/core')(config); diff --git a/packages/development-edition-engine-react/source/_patterns/00-atoms/00-general/HelloWorld.jsx b/packages/development-edition-engine-react/source/_patterns/00-atoms/00-general/HelloWorld.jsx index c714186b9..9790e5af0 100644 --- a/packages/development-edition-engine-react/source/_patterns/00-atoms/00-general/HelloWorld.jsx +++ b/packages/development-edition-engine-react/source/_patterns/00-atoms/00-general/HelloWorld.jsx @@ -1,9 +1,5 @@ import React from 'react'; -const HelloWorld = () => ( -
- Hello world! -
-); +const HelloWorld = () =>
Hello world!
; export default HelloWorld; diff --git a/packages/development-edition-engine-react/source/_patterns/01-molecules/00-general/HelloIncluder.jsx b/packages/development-edition-engine-react/source/_patterns/01-molecules/00-general/HelloIncluder.jsx index 0a2b918bf..6b2f3c985 100644 --- a/packages/development-edition-engine-react/source/_patterns/01-molecules/00-general/HelloIncluder.jsx +++ b/packages/development-edition-engine-react/source/_patterns/01-molecules/00-general/HelloIncluder.jsx @@ -12,17 +12,15 @@ class HelloIncluder extends Component { constructor() { super(); this.state = { - bgColor: 'transparent' - } + bgColor: 'transparent', + }; setTimeout(() => this.setState({ bgColor: 'red' }), 2000); } render() { return ( -
-
- Hey! Here's the Hello World component: -
+
+
Hey! Here's the Hello World component:
); diff --git a/packages/development-edition-engine-react/source/css/pattern-scaffolding.css b/packages/development-edition-engine-react/source/css/pattern-scaffolding.css index 2a69457ed..b09172fc8 100644 --- a/packages/development-edition-engine-react/source/css/pattern-scaffolding.css +++ b/packages/development-edition-engine-react/source/css/pattern-scaffolding.css @@ -5,7 +5,7 @@ */ #sg-patterns { -webkit-box-sizing: border-box !important; - box-sizing: border-box !important; + box-sizing: border-box !important; max-width: 100%; padding: 0 0.5em; } @@ -24,15 +24,15 @@ display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; - flex-wrap: wrap; + flex-wrap: wrap; list-style: none !important; padding: 0 !important; margin: 0 !important; } .sg-colors li { -webkit-box-flex: 1; - -ms-flex: auto; - flex: auto; + -ms-flex: auto; + flex: auto; padding: 0.3em; margin: 0 0.5em 0.5em 0; min-width: 5em; diff --git a/packages/development-edition-engine-react/source/css/style.css b/packages/development-edition-engine-react/source/css/style.css index 588a45915..04f745349 100644 --- a/packages/development-edition-engine-react/source/css/style.css +++ b/packages/development-edition-engine-react/source/css/style.css @@ -1,3 +1,3 @@ /* * YOUR STYLES HERE - */ \ No newline at end of file + */ diff --git a/packages/edition-node-gulp/CHANGELOG.md b/packages/edition-node-gulp/CHANGELOG.md index afd205a81..70dfc5272 100644 --- a/packages/edition-node-gulp/CHANGELOG.md +++ b/packages/edition-node-gulp/CHANGELOG.md @@ -4,26 +4,20 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + # [2.0.0-alpha.15](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.14...@pattern-lab/edition-node-gulp@2.0.0-alpha.15) (2018-07-09) **Note:** Version bump only for package @pattern-lab/edition-node-gulp - - - - + # [2.0.0-alpha.14](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.13...@pattern-lab/edition-node-gulp@2.0.0-alpha.14) (2018-07-06) **Note:** Version bump only for package @pattern-lab/edition-node-gulp - - - - -# [2.0.0-alpha.13](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.12...@pattern-lab/edition-node-gulp@2.0.0-alpha.13) (2018-07-06) +# [2.0.0-alpha.13](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.12...@pattern-lab/edition-node-gulp@2.0.0-alpha.13) (2018-07-06) ### Features @@ -31,53 +25,39 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/5ab3995)) - - - - -# [2.0.0-alpha.12](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.11...@pattern-lab/edition-node-gulp@2.0.0-alpha.12) (2018-07-05) +# [2.0.0-alpha.12](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.11...@pattern-lab/edition-node-gulp@2.0.0-alpha.12) (2018-07-05) ### Bug Fixes * **gulp:** remove help command ([71575db](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/71575db)) - ### Features * **serve:** change calling method ([f47217a](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/f47217a)) - - - -# [2.0.0-alpha.11](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.10...@pattern-lab/edition-node-gulp@2.0.0-alpha.11) (2018-05-19) - - +# [2.0.0-alpha.11](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.10...@pattern-lab/edition-node-gulp@2.0.0-alpha.11) (2018-05-19) **Note:** Version bump only for package @pattern-lab/edition-node-gulp -# [2.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.9...@pattern-lab/edition-node-gulp@2.0.0-alpha.10) (2018-05-04) - - +# [2.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.9...@pattern-lab/edition-node-gulp@2.0.0-alpha.10) (2018-05-04) **Note:** Version bump only for package @pattern-lab/edition-node-gulp -# [2.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.8...@pattern-lab/edition-node-gulp@2.0.0-alpha.9) (2018-05-04) - - +# [2.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.8...@pattern-lab/edition-node-gulp@2.0.0-alpha.9) (2018-05-04) **Note:** Version bump only for package @pattern-lab/edition-node-gulp -# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.7...@pattern-lab/edition-node-gulp@2.0.0-alpha.8) (2018-05-04) +# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.7...@pattern-lab/edition-node-gulp@2.0.0-alpha.8) (2018-05-04) ### Features @@ -88,14 +68,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** add cli as a dependency ([a52b487](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/a52b487)) * **uikits:** remove workshop for default config ([55570ff](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/55570ff)) - ### BREAKING CHANGES * **API:** change `version()` to return a string representation of the version, removing `v()` - - - # [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.6...@pattern-lab/edition-node-gulp@2.0.0-alpha.7) (2018-03-21) diff --git a/packages/edition-node/CHANGELOG.md b/packages/edition-node/CHANGELOG.md index 2e6d295bb..fd4554dcf 100644 --- a/packages/edition-node/CHANGELOG.md +++ b/packages/edition-node/CHANGELOG.md @@ -4,29 +4,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [1.0.0-alpha.13](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.12...@pattern-lab/edition-node@1.0.0-alpha.13) (2018-07-09) +# [1.0.0-alpha.13](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.12...@pattern-lab/edition-node@1.0.0-alpha.13) (2018-07-09) ### Features * **scripts:** namespace scripts ([3ecbb3e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/commit/3ecbb3e)) - - - - + # [1.0.0-alpha.12](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.11...@pattern-lab/edition-node@1.0.0-alpha.12) (2018-07-06) **Note:** Version bump only for package @pattern-lab/edition-node - - - - -# [1.0.0-alpha.11](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.10...@pattern-lab/edition-node@1.0.0-alpha.11) (2018-07-06) +# [1.0.0-alpha.11](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.10...@pattern-lab/edition-node@1.0.0-alpha.11) (2018-07-06) ### Features @@ -34,45 +27,33 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/commit/5ab3995)) - - - - -# [1.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.9...@pattern-lab/edition-node@1.0.0-alpha.10) (2018-07-05) - - +# [1.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.9...@pattern-lab/edition-node@1.0.0-alpha.10) (2018-07-05) **Note:** Version bump only for package @pattern-lab/edition-node -# [1.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.8...@pattern-lab/edition-node@1.0.0-alpha.9) (2018-05-19) - - +# [1.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.8...@pattern-lab/edition-node@1.0.0-alpha.9) (2018-05-19) **Note:** Version bump only for package @pattern-lab/edition-node -# [1.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.7...@pattern-lab/edition-node@1.0.0-alpha.8) (2018-05-04) - - +# [1.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.7...@pattern-lab/edition-node@1.0.0-alpha.8) (2018-05-04) **Note:** Version bump only for package @pattern-lab/edition-node -# [1.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.6...@pattern-lab/edition-node@1.0.0-alpha.7) (2018-05-04) - - +# [1.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.6...@pattern-lab/edition-node@1.0.0-alpha.7) (2018-05-04) **Note:** Version bump only for package @pattern-lab/edition-node -# [1.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.5...@pattern-lab/edition-node@1.0.0-alpha.6) (2018-05-04) +# [1.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.5...@pattern-lab/edition-node@1.0.0-alpha.6) (2018-05-04) ### Features @@ -80,9 +61,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **scripts:** refactor to use cli commands ([e8d5c21](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/commit/e8d5c21)) * **uikits:** uikits config ([027e56c](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/commit/027e56c)) - - - # [1.0.0-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.4...@pattern-lab/edition-node@1.0.0-alpha.5) (2018-03-21) diff --git a/packages/engine-handlebars/CHANGELOG.md b/packages/engine-handlebars/CHANGELOG.md index 92ddef103..6ac98f4e6 100644 --- a/packages/engine-handlebars/CHANGELOG.md +++ b/packages/engine-handlebars/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.7...@pattern-lab/engine-handlebars@2.0.0-alpha.8) (2018-07-06) +# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.7...@pattern-lab/engine-handlebars@2.0.0-alpha.8) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/commit/5ab3995)) - - - - -# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.6...@pattern-lab/engine-handlebars@2.0.0-alpha.7) (2018-07-05) +# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.6...@pattern-lab/engine-handlebars@2.0.0-alpha.7) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/commit/38a01b1)) - - - -# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.5...@pattern-lab/engine-handlebars@2.0.0-alpha.6) (2018-05-04) - - +# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.5...@pattern-lab/engine-handlebars@2.0.0-alpha.6) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-handlebars diff --git a/packages/engine-liquid/CHANGELOG.md b/packages/engine-liquid/CHANGELOG.md index 389219d6d..25592dc11 100644 --- a/packages/engine-liquid/CHANGELOG.md +++ b/packages/engine-liquid/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [1.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/compare/@pattern-lab/engine-liquid@1.0.0-alpha.9...@pattern-lab/engine-liquid@1.0.0-alpha.10) (2018-07-06) +# [1.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/compare/@pattern-lab/engine-liquid@1.0.0-alpha.9...@pattern-lab/engine-liquid@1.0.0-alpha.10) (2018-07-06) ### Features @@ -13,15 +13,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/commit/5ab3995)) - - - - -# [1.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/compare/@pattern-lab/engine-liquid@1.0.0-alpha.8...@pattern-lab/engine-liquid@1.0.0-alpha.9) (2018-05-04) - - +# [1.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/compare/@pattern-lab/engine-liquid@1.0.0-alpha.8...@pattern-lab/engine-liquid@1.0.0-alpha.9) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-liquid diff --git a/packages/engine-mustache/CHANGELOG.md b/packages/engine-mustache/CHANGELOG.md index 3a65a3975..698db7c44 100644 --- a/packages/engine-mustache/CHANGELOG.md +++ b/packages/engine-mustache/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.7...@pattern-lab/engine-mustache@2.0.0-alpha.8) (2018-07-06) +# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.7...@pattern-lab/engine-mustache@2.0.0-alpha.8) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/commit/5ab3995)) - - - - -# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.6...@pattern-lab/engine-mustache@2.0.0-alpha.7) (2018-07-05) +# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.6...@pattern-lab/engine-mustache@2.0.0-alpha.7) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/commit/38a01b1)) - - - -# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.5...@pattern-lab/engine-mustache@2.0.0-alpha.6) (2018-05-04) - - +# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.5...@pattern-lab/engine-mustache@2.0.0-alpha.6) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-mustache diff --git a/packages/engine-mustache/package.json b/packages/engine-mustache/package.json index 024ea8c6b..6116fe60b 100644 --- a/packages/engine-mustache/package.json +++ b/packages/engine-mustache/package.json @@ -5,7 +5,7 @@ "main": "lib/engine_mustache.js", "dependencies": { "fs-extra": "0.30.0", - "mustache": "2.2.0" + "mustache": "2.3.0" }, "keywords": [ "Pattern Lab", diff --git a/packages/engine-nunjucks/CHANGELOG.md b/packages/engine-nunjucks/CHANGELOG.md index 85b485607..c5f334584 100644 --- a/packages/engine-nunjucks/CHANGELOG.md +++ b/packages/engine-nunjucks/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [0.1.4-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.3...@pattern-lab/engine-nunjucks@0.1.4-alpha.4) (2018-07-06) +## [0.1.4-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.3...@pattern-lab/engine-nunjucks@0.1.4-alpha.4) (2018-07-06) ### Features @@ -13,32 +13,22 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/commit/5ab3995)) - - - - -## [0.1.4-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.2...@pattern-lab/engine-nunjucks@0.1.4-alpha.3) (2018-07-05) +## [0.1.4-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.2...@pattern-lab/engine-nunjucks@0.1.4-alpha.3) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/commit/38a01b1)) - - - -## [0.1.4-alpha.2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.1...@pattern-lab/engine-nunjucks@0.1.4-alpha.2) (2018-05-04) +## [0.1.4-alpha.2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.1...@pattern-lab/engine-nunjucks@0.1.4-alpha.2) (2018-05-04) ### Features * **package:** add [@pattern-lab](https://github.com/pattern-lab)/cli as a dependency ([760d0e0](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/commit/760d0e0)) - - - ## 0.1.4-alpha.1 (2018-03-21) diff --git a/packages/engine-nunjucks/README.md b/packages/engine-nunjucks/README.md index 7a88645df..b85c5e5d7 100644 --- a/packages/engine-nunjucks/README.md +++ b/packages/engine-nunjucks/README.md @@ -17,10 +17,10 @@ Level of Support is more or less full. Partial calls and lineage hunting are sup ## Extending the Nunjucks instance -To add custom filters or make customizations to the nunjucks instance, create a file named `patternlab-nunjucks-config.js` in the root of your Pattern Lab project. `patternlab-nunjucks-config.js` should export a function that takes two parameters. The first parameter is the nunjucks instance; the second is the nunjucks instance's environment. +To add custom filters or make customizations to the nunjucks instance, create a file named `patternlab-nunjucks-config.js` in the root of your Pattern Lab project. `patternlab-nunjucks-config.js` should export a function with the Nunjucks environment as parameter. ``` -module.exports = function (nunjucks, env) { +module.exports = function (env) { [YOUR CUSTOM CODE HERE] }; ``` @@ -30,7 +30,7 @@ Example: `patternlab-nunjucks-config.js` file that uses lodash and adds three cu var _shuffle = require('lodash/shuffle'), _take = require('lodash/take'); -exports = module.exports = function (nunjucks, env) { +exports = module.exports = function (env) { env.addFilter('shorten', function (str, count) { return str.slice(0, count || 5); }); diff --git a/packages/engine-nunjucks/lib/engine_nunjucks.js b/packages/engine-nunjucks/lib/engine_nunjucks.js index 5c149d3f9..92f5acb7e 100644 --- a/packages/engine-nunjucks/lib/engine_nunjucks.js +++ b/packages/engine-nunjucks/lib/engine_nunjucks.js @@ -20,48 +20,43 @@ 'use strict'; -var fs = require('fs-extra'), - path = require('path'), - plPath = process.cwd(), - plConfig = require(path.join(plPath, 'patternlab-config.json')), - nunjucks = require('nunjucks'), - env = nunjucks.configure(plConfig.paths.source.patterns), - partialRegistry = []; - -//////////////////////////// -// LOAD ANY USER NUNJUCKS CONFIGURATIONS -//////////////////////////// +const fs = require('fs-extra'); +const path = require('path'); +const plPath = process.cwd(); +const plConfig = require(path.join(plPath, 'patternlab-config.json')); +const nunjucks = require('nunjucks'); +const partialRegistry = []; + +// Create Pattern Loader +// Since Pattern Lab includes are not path based we need a custom loader for Nunjucks. +function PatternLoader() {} + +PatternLoader.prototype.getSource = function(name) { + const fullPath = path.resolve( + plConfig.paths.source.patterns, + partialRegistry[name] + ); + return { + src: fs.readFileSync(fullPath, 'utf-8'), + path: fullPath, + }; +}; + +const env = new nunjucks.Environment(new PatternLoader()); + +// Load any user Defined configurations try { - var nunjucksConfig = require(path.join( + const nunjucksConfig = require(path.join( plPath, 'patternlab-nunjucks-config.js' )); - if (typeof nunjucksConfig == 'function') { - nunjucksConfig(nunjucks, env); + if (typeof nunjucksConfig === 'function') { + nunjucksConfig(env); } } catch (err) {} -//////////////////////////// -// HELPER FUNCTIONS -// https://stackoverflow.com/questions/2116558/fastest-method-to-replace-all-instances-of-a-character-in-a-string -// Might do some research on the solution. -//////////////////////////// -if (!String.prototype.replaceAll) { - String.prototype.replaceAll = function(str1, str2, ignore) { - return this.replace( - new RegExp( - str1.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g, '\\$&'), - ignore ? 'gi' : 'g' - ), - typeof str2 == 'string' ? str2.replace(/\$/g, '$$$$') : str2 - ); - }; -} - -//////////////////////////// -// NUNJUCKS ENGINE -//////////////////////////// -var engine_nunjucks = { +// Nunjucks Engine +const engine_nunjucks = { engine: nunjucks, engineName: 'nunjucks', engineFileExtension: '.njk', @@ -77,25 +72,24 @@ var engine_nunjucks = { // render it renderPattern: function renderPattern(pattern, data) { try { - // replace pattern names with their full path so Nunjucks can find them. - pattern.extendedTemplate = this.replacePartials(pattern); - var result = nunjucks.renderString(pattern.extendedTemplate, data); + const result = env.renderString(pattern.extendedTemplate, data); return Promise.resolve(result); } catch (err) { console.error('Failed to render pattern: ' + pattern.name); + console.error(err); } }, // find and return any Nunjucks style includes/imports/extends within pattern findPartials: function findPartials(pattern) { - var matches = pattern.template.match(this.findPartialsRE); + const matches = pattern.template.match(this.findPartialsRE); return matches; }, // given a pattern, and a partial string, tease out the "pattern key" and return it. findPartial: function(partialString) { try { - var partial = partialString.match(this.findPartialKeyRE)[1]; + let partial = partialString.match(this.findPartialKeyRE)[1]; partial = partial.replace(/["']/g, ''); return partial; } catch (err) { @@ -116,38 +110,9 @@ var engine_nunjucks = { } }, - replacePartials: function(pattern) { - try { - var partials = this.findPartials(pattern); - if (partials !== null) { - for (var i = 0; i < partials.length; i++) { - // e.g. {% include "atoms-parent" %} - var partialName = this.findPartial(partials[i]); // e.g. atoms-parent - var partialFullPath = partialRegistry[partialName]; // e.g. 00-atoms/01-parent.njk - var newPartial = partials[i].replaceAll( - partialName, - partialFullPath, - true - ); // e.g. {% include "00-atoms/01-parent.njk" %} - pattern.extendedTemplate = pattern.extendedTemplate.replaceAll( - partials[i], - newPartial, - true - ); - } - } - return pattern.extendedTemplate; - } catch (err) { - console.error( - 'Error occurred in replacing partial names with paths for patern: ' + - pattern.name - ); - } - }, - // still requires the mustache syntax because of the way PL handles lists findListItems: function(pattern) { - var matches = pattern.template.match(this.findListItemsRE); + const matches = pattern.template.match(this.findListItemsRE); return matches; }, @@ -168,7 +133,6 @@ var engine_nunjucks = { fs.statSync(metaFilePath); } catch (err) { //not a file, so spawn it from the included file - const localMetaFilePath = path.resolve(__dirname, '_meta/', fileName); const metaFileContent = fs.readFileSync( path.resolve(__dirname, '..', '_meta/', fileName), 'utf8' diff --git a/packages/engine-nunjucks/package.json b/packages/engine-nunjucks/package.json index cca41a66b..98c8e34e5 100644 --- a/packages/engine-nunjucks/package.json +++ b/packages/engine-nunjucks/package.json @@ -7,8 +7,8 @@ "deprecated": false, "description": "The nunjucks PatternEngine for Pattern Lab / Node", "dependencies": { - "fs-extra": "5.0.0", - "nunjucks": "3.0.1" + "fs-extra": "7.0.0", + "nunjucks": "3.1.3" }, "engines": { "node": ">=4.0" diff --git a/packages/engine-react/CHANGELOG.md b/packages/engine-react/CHANGELOG.md index c1afffdb9..49e7cfcdc 100644 --- a/packages/engine-react/CHANGELOG.md +++ b/packages/engine-react/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [0.2.1-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.4...@pattern-lab/engine-react@0.2.1-alpha.5) (2018-07-06) +## [0.2.1-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.4...@pattern-lab/engine-react@0.2.1-alpha.5) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/commit/5ab3995)) - - - - -## [0.2.1-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.3...@pattern-lab/engine-react@0.2.1-alpha.4) (2018-07-05) +## [0.2.1-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.3...@pattern-lab/engine-react@0.2.1-alpha.4) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/commit/38a01b1)) - - - -## [0.2.1-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.2...@pattern-lab/engine-react@0.2.1-alpha.3) (2018-05-04) - - +## [0.2.1-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.2...@pattern-lab/engine-react@0.2.1-alpha.3) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-react diff --git a/packages/engine-react/lib/engine_react.js b/packages/engine-react/lib/engine_react.js index 70e821bc5..b0f01cdd2 100644 --- a/packages/engine-react/lib/engine_react.js +++ b/packages/engine-react/lib/engine_react.js @@ -215,9 +215,7 @@ var engine_react = { * each with two properties: path, and content */ addOutputFiles(paths, patternlab) { - return [ - - ]; + return []; }, /** diff --git a/packages/engine-twig/CHANGELOG.md b/packages/engine-twig/CHANGELOG.md index cd0f9d89d..040dc4ac8 100644 --- a/packages/engine-twig/CHANGELOG.md +++ b/packages/engine-twig/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [0.2.1-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.4...@pattern-lab/engine-twig@0.2.1-alpha.5) (2018-07-06) +## [0.2.1-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.4...@pattern-lab/engine-twig@0.2.1-alpha.5) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/commit/5ab3995)) - - - - -## [0.2.1-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.3...@pattern-lab/engine-twig@0.2.1-alpha.4) (2018-07-05) +## [0.2.1-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.3...@pattern-lab/engine-twig@0.2.1-alpha.4) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/commit/38a01b1)) - - - -## [0.2.1-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.2...@pattern-lab/engine-twig@0.2.1-alpha.3) (2018-05-04) - - +## [0.2.1-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.2...@pattern-lab/engine-twig@0.2.1-alpha.3) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-twig diff --git a/packages/engine-underscore/CHANGELOG.md b/packages/engine-underscore/CHANGELOG.md index 04dcadba5..533ecb7e8 100644 --- a/packages/engine-underscore/CHANGELOG.md +++ b/packages/engine-underscore/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.6...@pattern-lab/engine-underscore@2.0.0-alpha.7) (2018-07-06) +# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.6...@pattern-lab/engine-underscore@2.0.0-alpha.7) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/commit/5ab3995)) - - - - -# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.5...@pattern-lab/engine-underscore@2.0.0-alpha.6) (2018-07-05) +# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.5...@pattern-lab/engine-underscore@2.0.0-alpha.6) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/commit/38a01b1)) - - - -# [2.0.0-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.4...@pattern-lab/engine-underscore@2.0.0-alpha.5) (2018-05-04) - - +# [2.0.0-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.4...@pattern-lab/engine-underscore@2.0.0-alpha.5) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-underscore diff --git a/packages/live-server/CHANGELOG.md b/packages/live-server/CHANGELOG.md index 9396dc2a1..90c875efe 100644 --- a/packages/live-server/CHANGELOG.md +++ b/packages/live-server/CHANGELOG.md @@ -4,20 +4,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [1.3.3-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.5...@pattern-lab/live-server@1.3.3-alpha.6) (2018-07-06) +## [1.3.3-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.5...@pattern-lab/live-server@1.3.3-alpha.6) (2018-07-06) ### Bug Fixes * **dependencies:** pin all packages marked as latest ([87347d5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/commit/87347d5)) - - - - -## [1.3.3-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.4...@pattern-lab/live-server@1.3.3-alpha.5) (2018-07-06) +## [1.3.3-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.4...@pattern-lab/live-server@1.3.3-alpha.5) (2018-07-06) ### Features @@ -25,26 +21,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/commit/5ab3995)) - - - - -## [1.3.3-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.3...@pattern-lab/live-server@1.3.3-alpha.4) (2018-07-05) +## [1.3.3-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.3...@pattern-lab/live-server@1.3.3-alpha.4) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/commit/38a01b1)) - - - -## [1.3.3-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.2...@pattern-lab/live-server@1.3.3-alpha.3) (2018-05-04) - - +## [1.3.3-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.2...@pattern-lab/live-server@1.3.3-alpha.3) (2018-05-04) **Note:** Version bump only for package @pattern-lab/live-server diff --git a/packages/plugin-tab/CHANGELOG.md b/packages/plugin-tab/CHANGELOG.md index 5987384b9..db05da1ca 100644 --- a/packages/plugin-tab/CHANGELOG.md +++ b/packages/plugin-tab/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [2.0.3-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.4...@pattern-lab/plugin-tab@2.0.3-alpha.5) (2018-07-06) +## [2.0.3-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.4...@pattern-lab/plugin-tab@2.0.3-alpha.5) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/commit/5ab3995)) - - - - -## [2.0.3-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.3...@pattern-lab/plugin-tab@2.0.3-alpha.4) (2018-07-05) +## [2.0.3-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.3...@pattern-lab/plugin-tab@2.0.3-alpha.4) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/commit/38a01b1)) - - - -## [2.0.3-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.2...@pattern-lab/plugin-tab@2.0.3-alpha.3) (2018-05-04) - - +## [2.0.3-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.2...@pattern-lab/plugin-tab@2.0.3-alpha.3) (2018-05-04) **Note:** Version bump only for package @pattern-lab/plugin-tab diff --git a/packages/plugin-tab/README.md b/packages/plugin-tab/README.md index 50e24a477..8bd03b862 100644 --- a/packages/plugin-tab/README.md +++ b/packages/plugin-tab/README.md @@ -1,4 +1,4 @@ -![license](https://img.shields.io/github/license/pattern-lab/plugin-node-tab.svg) +![license](https://img.shields.io/github/license/pattern-lab/patternlab-node.svg) [![npm](https://img.shields.io/npm/v/@pattern-lab/plugin-tab.svg)](https://www.npmjs.com/package/@pattern-lab/plugin-tab) [![Join the chat at Gitter](https://badges.gitter.im/pattern-lab/node.svg)](https://gitter.im/pattern-lab/node) @@ -28,7 +28,7 @@ Example: ``` "plugins": { - "plugin-node-tab": { + "pattern-lab-plugin-tab": { "enabled": true, "initialized": false, "options": { @@ -38,7 +38,7 @@ Example: } ``` -Add file extensions to this array as strings. Example: `"tabsToAdd": ['scss', 'js']`. You are all set now. +Add file extensions to this array as strings. Example: `"tabsToAdd": ["scss", "js"]`. You are all set now. ## Expected Structure @@ -56,4 +56,4 @@ For example, if we added an `scss` tab: ## Enabling / Disabling the Plugin -After install, you may manually enable or disable the plugin by finding the `plugin-node-tab` key within your main Pattern Lab project's `patternlab-config.json` file and setting the `enabled` flag. In the future this will be possible via CLI. +After install, you may manually enable or disable the plugin by finding the `@pattern-lab/plugin-tab` key within your main Pattern Lab project's `patternlab-config.json` file and setting the `enabled` flag. In the future this will be possible via CLI. diff --git a/packages/plugin-tab/dist/js/plugin-node-tab.js b/packages/plugin-tab/dist/js/pattern-lab-plugin-tab.js similarity index 93% rename from packages/plugin-tab/dist/js/plugin-node-tab.js rename to packages/plugin-tab/dist/js/pattern-lab-plugin-tab.js index d0e999422..9573b9bed 100644 --- a/packages/plugin-tab/dist/js/plugin-node-tab.js +++ b/packages/plugin-tab/dist/js/pattern-lab-plugin-tab.js @@ -1,4 +1,4 @@ -var PluginTab = { +const PluginTab = { /** * The function defined as the onready callback within the plugin configuration. */ diff --git a/packages/plugin-tab/index.js b/packages/plugin-tab/index.js index 3790ea383..b5cea6072 100644 --- a/packages/plugin-tab/index.js +++ b/packages/plugin-tab/index.js @@ -1,24 +1,31 @@ 'use strict'; -const pluginName = 'plugin-node-tab'; +const path = require('path'); +const EOL = require('os').EOL; +const _ = require('lodash'); const fs = require('fs-extra'); const glob = require('glob'); -const path = require('path'); -const EOL = require('os').EOL; + const tab_loader = require('./src/tab-loader'); +const pluginName = 'pattern-lab-plugin-tab'; + function writeConfigToOutput(patternlab, pluginConfig) { - var pluginConfigPathName = path.resolve( - patternlab.config.paths.public.root, - 'patternlab-components', - 'packages' - ); try { - fs.outputFileSync( - pluginConfigPathName + '/' + pluginName + '.json', - JSON.stringify(pluginConfig, null, 2) - ); + _.each(patternlab.uikits, uikit => { + fs.outputFileSync( + path.join( + process.cwd(), + uikit.outputDir, + patternlab.config.paths.public.root, + 'patternlab-components', + 'packages', + `/${pluginName}.json` + ), + JSON.stringify(pluginConfig, null, 2) + ); + }); } catch (ex) { console.trace( pluginName + ': Error occurred while writing pluginFile configuration' @@ -48,7 +55,7 @@ function registerEvents(patternlab) { */ function getPluginFrontendConfig() { return { - name: 'pattern-lab/' + pluginName, + name: pluginName, templates: [], stylesheets: [], javascripts: [ @@ -69,33 +76,16 @@ function getPluginFrontendConfig() { */ function pluginInit(patternlab) { if (!patternlab) { - console.error('patternlab object not provided to plugin-init'); + console.error('patternlab object not provided to pluginInit'); process.exit(1); } //write the plugin json to public/patternlab-components - var pluginConfig = getPluginFrontendConfig(); + const pluginConfig = getPluginFrontendConfig(); pluginConfig.tabsToAdd = patternlab.config.plugins[pluginName].options.tabsToAdd; writeConfigToOutput(patternlab, pluginConfig); - var pluginConfigPathName = path.resolve( - patternlab.config.paths.public.root, - 'patternlab-components', - 'packages' - ); - try { - fs.outputFileSync( - pluginConfigPathName + '/' + pluginName + '.json', - JSON.stringify(pluginConfig, null, 2) - ); - } catch (ex) { - console.trace( - 'plugin-node-tab: Error occurred while writing pluginFile configuration' - ); - console.log(ex); - } - //add the plugin config to the patternlab-object if (!patternlab.plugins) { patternlab.plugins = []; @@ -103,22 +93,22 @@ function pluginInit(patternlab) { patternlab.plugins.push(pluginConfig); //write the plugin dist folder to public/pattern-lab - var pluginFiles = glob.sync(__dirname + '/dist/**/*'); + const pluginFiles = glob.sync(__dirname + '/dist/**/*'); if (pluginFiles && pluginFiles.length > 0) { - let tab_frontend_snippet = fs.readFileSync( + const tab_frontend_snippet = fs.readFileSync( path.resolve(__dirname + '/src/snippet.js'), 'utf8' ); for (let i = 0; i < pluginFiles.length; i++) { try { - var fileStat = fs.statSync(pluginFiles[i]); + const fileStat = fs.statSync(pluginFiles[i]); if (fileStat.isFile()) { - var relativePath = path + const relativePath = path .relative(__dirname, pluginFiles[i]) .replace('dist', ''); //dist is dropped - var writePath = path.join( + const writePath = path.join( patternlab.config.paths.public.root, 'patternlab-components', 'pattern-lab', @@ -134,10 +124,10 @@ function pluginInit(patternlab) { //in this case, we need to alter the dist file to loop through our tabs to load as defined in the package.json //we are also being a bit lazy here, since we only expect one file let tabJSFileContents = fs.readFileSync(pluginFiles[i], 'utf8'); - var snippetString = ''; + let snippetString = ''; if (pluginConfig.tabsToAdd && pluginConfig.tabsToAdd.length > 0) { for (let j = 0; j < pluginConfig.tabsToAdd.length; j++) { - let tabSnippetLocal = tab_frontend_snippet + const tabSnippetLocal = tab_frontend_snippet .replace(/<>/g, pluginConfig.tabsToAdd[j]) .replace( /<>/g, @@ -149,12 +139,17 @@ function pluginInit(patternlab) { '/*SNIPPETS*/', snippetString ); - fs.outputFileSync(writePath, tabJSFileContents); + _.each(patternlab.uikits, uikit => { + fs.outputFileSync( + path.join(process.cwd(), uikit.outputDir, writePath), + tabJSFileContents + ); + }); } } } catch (ex) { console.trace( - 'plugin-node-tab: Error occurred while copying pluginFile', + 'plugin-tab: Error occurred while copying pluginFile', pluginFiles[i] ); console.log(ex); diff --git a/packages/plugin-tab/package.json b/packages/plugin-tab/package.json index 744175bda..cc26ea744 100644 --- a/packages/plugin-tab/package.json +++ b/packages/plugin-tab/package.json @@ -5,7 +5,8 @@ "main": "index.js", "dependencies": { "fs-extra": "0.30.0", - "glob": "7.0.0" + "glob": "7.0.0", + "lodash": "4.17.5" }, "repository": "https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab", "bugs": "https://github.com/pattern-lab/patternlab-node/issues", @@ -15,7 +16,7 @@ }, "author": "Brian Muenzenmeyer", "license": "MIT", - "homepage": "https://github.com/pattern-lab/plugin-node-tab#readme", + "homepage": "https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab", "devDependencies": { "eslint": "4.18.2" }, diff --git a/packages/plugin-tab/postinstall.js b/packages/plugin-tab/postinstall.js index 56620abe5..25c8c2039 100644 --- a/packages/plugin-tab/postinstall.js +++ b/packages/plugin-tab/postinstall.js @@ -1,10 +1,5 @@ -console.log('Pattern Lab Node Plugin - "plugin-node-tab" installed. '); -console.log( - 'You may have to run `npm run postinstall` from your console as well.' -); -console.log( - 'Configure or disable this plugin inside your patternlab-config.json file.' -); -console.log( - 'Add tabs to the Pattern Lab UI by adding file extensions to the "tabsToAdd" array on the plugins.plugin-node-tab.options object.' -); +console.log(`Pattern Lab Node Plugin - "plugin-tab" installed. +Use the CLI to install this: patternlab install --plugins @pattern-lab/plugin-tab +Configure or disable this plugin inside your patternlab-config.json file. +Add tabs to the Pattern Lab UI by adding file extensions to the "tabsToAdd" array on the plugins['@pattern-lab/plugin-tab'].options object. +`); diff --git a/packages/plugin-tab/src/snippet.js b/packages/plugin-tab/src/snippet.js index b7e08bb36..499fc65f5 100644 --- a/packages/plugin-tab/src/snippet.js +++ b/packages/plugin-tab/src/snippet.js @@ -9,6 +9,6 @@ Panels.add({ httpRequestReplace: '.<>', httpRequestCompleted: false, prismHighlight: true, - language: 'markup', + language: '<>', keyCombo: 'ctrl+shift+z', }); diff --git a/packages/plugin-tab/src/tab-loader.js b/packages/plugin-tab/src/tab-loader.js index 4793128a9..7ae297500 100644 --- a/packages/plugin-tab/src/tab-loader.js +++ b/packages/plugin-tab/src/tab-loader.js @@ -1,8 +1,10 @@ 'use strict'; -const fs = require('fs-extra'); const path = require('path'); +const _ = require('lodash'); +const fs = require('fs-extra'); + /** * The backend method that is called during the patternlab-pattern-write-end event. * Responsible for looking for a companion filetype file alongside a pattern file and outputting it if found. @@ -12,21 +14,21 @@ const path = require('path'); function findTab(patternlab, pattern) { //read the filetypes from the configuration const fileTypes = - patternlab.config.plugins['plugin-node-tab'].options.tabsToAdd; + patternlab.config.plugins['pattern-lab-plugin-tab'].options.tabsToAdd; //exit if either of these two parameters are missing if (!patternlab) { - console.error('plugin-node-tab: patternlab object not provided to findTab'); + console.error('plugin-tab: patternlab object not provided to findTab'); process.exit(1); } if (!pattern) { - console.error('plugin-node-tab: pattern object not provided to findTab'); + console.error('plugin-tab: pattern object not provided to findTab'); process.exit(1); } //derive the custom filetype paths from the pattern relPath - var customFileTypePath = path.join( + let customFileTypePath = path.join( patternlab.config.paths.source.patterns, pattern.relPath ); @@ -39,35 +41,47 @@ function findTab(patternlab, pattern) { customFileTypePath.substr(0, customFileTypePath.lastIndexOf('.')) + '.' + fileType; - var customFileTypeOutputPath = + const customFileTypeOutputPath = patternlab.config.paths.public.patterns + pattern.getPatternLink(patternlab, 'custom', '.' + fileType); //look for a custom filetype for this template + let tabFileName; + let tabFileNameStats; try { - var tabFileName = path.resolve(customFileTypePath); + tabFileName = path.resolve(customFileTypePath); try { - var tabFileNameStats = fs.statSync(tabFileName); + tabFileNameStats = fs.statSync(tabFileName); } catch (err) { //not a file - move on quietly } if (tabFileNameStats && tabFileNameStats.isFile()) { if (patternlab.config.debug) { console.log( - 'plugin-node-tab: copied pattern-specific custom file for ' + + 'plugin-tab: copied pattern-specific custom file for ' + pattern.patternPartial ); } //copy the file to our output target if found - fs.copySync(tabFileName, customFileTypeOutputPath); + _.each(patternlab.uikits, uikit => { + fs.copySync( + tabFileName, + path.join(process.cwd(), uikit.outputDir, customFileTypeOutputPath) + ); + }); } else { //otherwise write nothing to the same location - this prevents GET errors on the tab. - fs.outputFileSync(customFileTypeOutputPath, ''); + _.each(patternlab.uikits, uikit => { + fs.outputFileSync( + path.join(process.cwd(), uikit.outputDir, customFileTypeOutputPath), + '' + ); + }); } } catch (err) { console.log( - 'plugin-node-tab:There was an error parsing sibling JSON for ' + + 'plugin-tab: There was an error parsing sibling JSON for ' + pattern.relPath ); console.log(err); diff --git a/packages/uikit-workshop/.bowerrc b/packages/uikit-workshop/.bowerrc deleted file mode 100644 index ba7d4d8df..000000000 --- a/packages/uikit-workshop/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "src/bower_components" -} \ No newline at end of file diff --git a/packages/uikit-workshop/.github/CONTRIBUTING.md b/packages/uikit-workshop/.github/CONTRIBUTING.md index d6ab592b8..8cb32513f 100644 --- a/packages/uikit-workshop/.github/CONTRIBUTING.md +++ b/packages/uikit-workshop/.github/CONTRIBUTING.md @@ -19,11 +19,11 @@ The best way to make changes to this repo and test them is through your existing To make changes **always edit files in `src/`**. To make sure that these changes are reflected in the front-end and `dist/` folder run the following: - gulp --copy-dist=../../../public + npm run build To watch for changes you can use: - gulp --watch --copy-dist=../../../public + npm run watch At this point changes to the static assets should compile to the correct locations in the project as well as `dist/`. diff --git a/packages/uikit-workshop/CHANGELOG.md b/packages/uikit-workshop/CHANGELOG.md index 995e767c6..cc83a4d59 100644 --- a/packages/uikit-workshop/CHANGELOG.md +++ b/packages/uikit-workshop/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [1.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.6...@pattern-lab/uikit-workshop@1.0.0-alpha.7) (2018-07-06) +# [1.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.6...@pattern-lab/uikit-workshop@1.0.0-alpha.7) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/commit/5ab3995)) - - - - -# [1.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.5...@pattern-lab/uikit-workshop@1.0.0-alpha.6) (2018-07-05) +# [1.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.5...@pattern-lab/uikit-workshop@1.0.0-alpha.6) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/commit/38a01b1)) - - - -# [1.0.0-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.4...@pattern-lab/uikit-workshop@1.0.0-alpha.5) (2018-05-04) - - +# [1.0.0-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.4...@pattern-lab/uikit-workshop@1.0.0-alpha.5) (2018-05-04) **Note:** Version bump only for package @pattern-lab/uikit-workshop diff --git a/packages/uikit-workshop/bower.json b/packages/uikit-workshop/bower.json deleted file mode 100644 index 86102afa8..000000000 --- a/packages/uikit-workshop/bower.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "styleguidekit-assets-default", - "version": "0.1.0", - "homepage": "https://github.com/pattern-lab/styleguidekit-assets-default", - "authors": [ - "Dave Olsen " - ], - "license": "MIT", - "private": true, - "dependencies": { - "jquery": "~2.1.1", - "jwerty": "~0.3.2", - "prism": "gh-pages", - "typeahead.js": "~0.10.4", - "hogan": "~3.0.2", - "script.js": "~2.5.7", - "eventEmitter": "~4.2.7" - }, - "overrides": { - "hogan": { - "main": "web/builds/3.0.2/hogan-3.0.2.js" - }, - "script.js": { - "main": "dist/script.js" - }, - "jwerty": { - "main": "jwerty.js" - }, - "prism": { - "main": "prism.js" - } - }, - "devDependencies": {} -} diff --git a/packages/uikit-workshop/dist/index.html b/packages/uikit-workshop/dist/index.html index 5022d8f9b..c63d63f16 100644 --- a/packages/uikit-workshop/dist/index.html +++ b/packages/uikit-workshop/dist/index.html @@ -1,399 +1,8 @@ - - - - - Pattern Lab - - - - - - - - - - -
- -
- -
- - - -
- -
- -
- -
- -
- -
-
-
-
- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Pattern Lab + + +
\ No newline at end of file diff --git a/packages/uikit-workshop/dist/styleguide/bower_components/EventEmitter.min.js b/packages/uikit-workshop/dist/styleguide/bower_components/EventEmitter.min.js deleted file mode 100644 index 04dabbb66..000000000 --- a/packages/uikit-workshop/dist/styleguide/bower_components/EventEmitter.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(){"use strict";function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var r=e.prototype,i=this,s=i.EventEmitter;r.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},r.flattenListeners=function(e){var t,n=[];for(t=0;t=0;c--)if(a=e[c],s=n(t,a,u),void 0!==s){o=!0;break}return o?(r||"function"!=typeof s||(s=this.mv(s,e,i)),s):!r&&""},ls:function(t,n,e,r,s){var a=this.options.delimiters;return this.options.delimiters=s,this.b(this.ct(i(t.call(n,r)),n,e)),this.options.delimiters=a,!1},ct:function(t,n,e){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(t,this.options).render(n,e)},b:function(t){this.buf+=t},fl:function(){var t=this.buf;return this.buf="",t},ms:function(t,n,e,i,r,s,a){var o,u=n[n.length-1],c=t.call(u);return"function"==typeof c?!!i||(o=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,u,e,o.substring(r,s),a)):c},mv:function(t,n,e){var r=n[n.length-1],s=t.call(r);return"function"==typeof s?this.ct(i(s.call(r)),r,e):s},sub:function(t,n,e,i){var r=this.subs[t];r&&(this.activeSub=t,r(n,e,this,i),this.activeSub=!1)}};var s=/&/g,a=//g,u=/\'/g,c=/\"/g,l=/[&<>\"\']/,f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}}("undefined"!=typeof exports?exports:Hogan),function(t){function n(t){"}"===t.n.substr(t.n.length-1)&&(t.n=t.n.substring(0,t.n.length-1))}function e(t){return t.trim?t.trim():t.replace(/^\s*|\s*$/g,"")}function i(t,n,e){if(n.charAt(e)!=t.charAt(0))return!1;for(var i=1,r=t.length;i0;){if(f=n.shift(),l&&"<"==l.tag&&!(f.tag in k))throw new Error("Illegal content in < super tag.");if(t.tags[f.tag]<=t.tags.$||s(f,o))i.push(f),f.nodes=r(n,f.tag,i,o);else{if("/"==f.tag){if(0===i.length)throw new Error("Closing tag without opener: /"+f.n);if(c=i.pop(),f.n!=c.n&&!a(f.n,c.n,o))throw new Error("Nesting error: "+c.n+" vs. "+f.n);return c.end=f.i,u}"\n"==f.tag&&(f.last=0==n.length||"\n"==n[0].tag)}u.push(f)}if(i.length>0)throw new Error("missing closing tag: "+i.pop().n);return u}function s(t,n){for(var e=0,i=n.length;e":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(r,s){function a(){m.length>0&&(x.push({tag:"_t",text:new String(m)}),m="")}function o(){for(var n=!0,e=y;e"==e.tag&&(e.indent=x[i].text.toString()),x.splice(i,1));else n||x.push({tag:"\n"});w=!1,y=x.length}function c(t,n){var i="="+S,r=t.indexOf(i,n),s=e(t.substring(t.indexOf("=",n)+1,r)).split(" ");return T=s[0],S=s[s.length-1],r+i.length-1}var l=r.length,f=0,h=1,p=2,v=f,b=null,d=null,m="",x=[],w=!1,k=0,y=0,T="{{",S="}}";for(s&&(s=s.split(" "),T=s[0],S=s[1]),k=0;k":f,"<":function(n,e){var i={partials:{},code:"",subs:{},inPartial:!0};t.walk(n.nodes,i);var r=e.partials[f(n,e)];r.subs=i.subs,r.partials=i.partials},$:function(n,e){var i={subs:{},code:"",partials:e.partials,prefix:n.n};t.walk(n.nodes,i),e.subs[n.n]=i.code,e.inPartial||(e.code+='t.sub("'+c(n.n)+'",c,p,i);')},"\n":function(t,n){n.code+=p('"\\n"'+(t.last?"":" + i"))},_v:function(t,n){n.code+="t.b(t.v(t."+l(t.n)+'("'+c(t.n)+'",c,p,0)));'},_t:function(t,n){n.code+=p('"'+c(t.text)+'"')},"{":h,"&":h},t.walk=function(n,e){for(var i,r=0,s=n.length;r0&&t-1 in e))}function r(e,t,n){if(Z.isFunction(t))return Z.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return Z.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(ae.test(t))return Z.filter(t,e,n);t=Z.filter(t,e)}return Z.grep(e,function(e){return U.call(t,e)>=0!==n})}function i(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function o(e){var t=he[e]={};return Z.each(e.match(de)||[],function(e,n){t[n]=!0}),t}function s(){J.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1),Z.ready()}function a(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=Z.expando+a.uid++}function u(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(be,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:xe.test(n)?Z.parseJSON(n):n)}catch(i){}ye.set(e,t,n)}else n=void 0;return n}function l(){return!0}function c(){return!1}function f(){try{return J.activeElement}catch(e){}}function p(e,t){return Z.nodeName(e,"table")&&Z.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function d(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function h(e){var t=Pe.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function g(e,t){for(var n=0,r=e.length;n")).appendTo(t.documentElement),t=We[0].contentDocument,t.write(),t.close(),n=x(e,t),We.detach()),$e[e]=n),n}function w(e,t,n){var r,i,o,s,a=e.style;return n=n||_e(e),n&&(s=n.getPropertyValue(t)||n[t]),n&&(""!==s||Z.contains(e.ownerDocument,e)||(s=Z.style(e,t)),Be.test(s)&&Ie.test(t)&&(r=a.width,i=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=n.width,a.width=r,a.minWidth=i,a.maxWidth=o)),void 0!==s?s+"":s}function T(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function C(e,t){if(t in e)return t;for(var n=t[0].toUpperCase()+t.slice(1),r=t,i=Ge.length;i--;)if(t=Ge[i]+n,t in e)return t;return r}function N(e,t,n){var r=Xe.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function k(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;o<4;o+=2)"margin"===n&&(s+=Z.css(e,n+Te[o],!0,i)),r?("content"===n&&(s-=Z.css(e,"padding"+Te[o],!0,i)),"margin"!==n&&(s-=Z.css(e,"border"+Te[o]+"Width",!0,i))):(s+=Z.css(e,"padding"+Te[o],!0,i),"padding"!==n&&(s+=Z.css(e,"border"+Te[o]+"Width",!0,i)));return s}function E(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=_e(e),s="border-box"===Z.css(e,"boxSizing",!1,o);if(i<=0||null==i){if(i=w(e,t,o),(i<0||null==i)&&(i=e.style[t]),Be.test(i))return i;r=s&&(Q.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+k(e,t,n||(s?"border":"content"),r,o)+"px"}function S(e,t){for(var n,r,i,o=[],s=0,a=e.length;s=0&&n=0},isPlainObject:function(e){return"object"===Z.type(e)&&!e.nodeType&&!Z.isWindow(e)&&!(e.constructor&&!G.call(e.constructor.prototype,"isPrototypeOf"))},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?V[Y.call(e)]||"object":typeof e},globalEval:function(e){var t,n=eval;e=Z.trim(e),e&&(1===e.indexOf("use strict")?(t=J.createElement("script"),t.text=e,J.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(te,"ms-").replace(ne,re)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,r){var i,o=0,s=e.length,a=n(e);if(r){if(a)for(;oT.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[W]=!0,e}function i(e){var t=q.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=e.length;r--;)T.attrHandle[n[r]]=t}function s(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||V)-(~e.sourceIndex||V);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function a(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),s=o.length;s--;)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))})})}function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function f(){}function p(e){for(var t=0,n=e.length,r="";t1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function g(e,n,r){for(var i=0,o=n.length;i-1&&(r[l]=!(s[l]=f))}}else x=m(x===s?x.splice(h,x.length):x),o?o(null,s,x,u):K.apply(s,x)})}function y(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],s=o||T.relative[" "],a=o?1:0,u=d(function(e){return e===t},s,!0),l=d(function(e){return ee(t,e)>-1},s,!0),c=[function(e,n,r){var i=!o&&(r||n!==D)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,i}];a1&&h(c),a>1&&p(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(ue,"$1"),n,a0,o=e.length>0,s=function(r,s,a,u,l){var c,f,p,d=0,h="0",g=r&&[],v=[],y=D,x=r||o&&T.find.TAG("*",l),b=I+=null==y?1:Math.random()||.1,w=x.length;for(l&&(D=s!==q&&s);h!==w&&null!=(c=x[h]);h++){if(o&&c){for(f=0;p=e[f++];)if(p(c,s,a)){u.push(c);break}l&&(I=b)}i&&((c=!p&&c)&&d--,r&&g.push(c))}if(d+=h,i&&h!==d){for(f=0;p=n[f++];)p(g,v,s,a);if(r){if(d>0)for(;h--;)g[h]||v[h]||(v[h]=Q.call(u));v=m(v)}K.apply(u,v),l&&!r&&v.length>0&&d+n.length>1&&t.uniqueSort(u)}return l&&(I=b,D=y),g};return i?r(s):s}var b,w,T,C,N,k,E,S,D,j,A,L,q,H,O,F,P,R,M,W="sizzle"+1*new Date,$=e.document,I=0,B=0,_=n(),z=n(),X=n(),U=function(e,t){return e===t&&(A=!0),0},V=1<<31,Y={}.hasOwnProperty,G=[],Q=G.pop,J=G.push,K=G.push,Z=G.slice,ee=function(e,t){for(var n=0,r=e.length;n+~]|"+ne+")"+ne+"*"),fe=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),pe=new RegExp(se),de=new RegExp("^"+ie+"$"),he={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re.replace("w","w*")+")"),ATTR:new RegExp("^"+oe),PSEUDO:new RegExp("^"+se),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},ge=/^(?:input|select|textarea|button)$/i,me=/^h\d$/i,ve=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,xe=/[+~]/,be=/'|\\/g,we=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),Te=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Ce=function(){L()};try{K.apply(G=Z.call($.childNodes),$.childNodes),G[$.childNodes.length].nodeType}catch(Ne){K={apply:G.length?function(e,t){J.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}w=t.support={},N=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},L=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:$;return r!==q&&9===r.nodeType&&r.documentElement?(q=r,H=r.documentElement,n=r.defaultView,n&&n!==n.top&&(n.addEventListener?n.addEventListener("unload",Ce,!1):n.attachEvent&&n.attachEvent("onunload",Ce)),O=!N(r),w.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=i(function(e){return e.appendChild(r.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=ve.test(r.getElementsByClassName),w.getById=i(function(e){return H.appendChild(e).id=W,!r.getElementsByName||!r.getElementsByName(W).length}),w.getById?(T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&O){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},T.filter.ID=function(e){var t=e.replace(we,Te);return function(e){return e.getAttribute("id")===t}}):(delete T.find.ID,T.filter.ID=function(e){var t=e.replace(we,Te);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),T.find.TAG=w.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):w.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},T.find.CLASS=w.getElementsByClassName&&function(e,t){if(O)return t.getElementsByClassName(e)},P=[],F=[],(w.qsa=ve.test(r.querySelectorAll))&&(i(function(e){H.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&F.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||F.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+W+"-]").length||F.push("~="),e.querySelectorAll(":checked").length||F.push(":checked"),e.querySelectorAll("a#"+W+"+*").length||F.push(".#.+[+~]")}),i(function(e){var t=r.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&F.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||F.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),F.push(",.*:")})),(w.matchesSelector=ve.test(R=H.matches||H.webkitMatchesSelector||H.mozMatchesSelector||H.oMatchesSelector||H.msMatchesSelector))&&i(function(e){w.disconnectedMatch=R.call(e,"div"),R.call(e,"[s!='']:x"),P.push("!=",se)}),F=F.length&&new RegExp(F.join("|")),P=P.length&&new RegExp(P.join("|")),t=ve.test(H.compareDocumentPosition),M=t||ve.test(H.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},U=t?function(e,t){if(e===t)return A=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!w.sortDetached&&t.compareDocumentPosition(e)===n?e===r||e.ownerDocument===$&&M($,e)?-1:t===r||t.ownerDocument===$&&M($,t)?1:j?ee(j,e)-ee(j,t):0:4&n?-1:1)}:function(e,t){if(e===t)return A=!0,0;var n,i=0,o=e.parentNode,a=t.parentNode,u=[e],l=[t];if(!o||!a)return e===r?-1:t===r?1:o?-1:a?1:j?ee(j,e)-ee(j,t):0;if(o===a)return s(e,t);for(n=e;n=n.parentNode;)u.unshift(n);for(n=t;n=n.parentNode;)l.unshift(n);for(;u[i]===l[i];)i++;return i?s(u[i],l[i]):u[i]===$?-1:l[i]===$?1:0},r):q},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==q&&L(e),n=n.replace(fe,"='$1']"),w.matchesSelector&&O&&(!P||!P.test(n))&&(!F||!F.test(n)))try{var r=R.call(e,n);if(r||w.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return t(n,q,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==q&&L(e),M(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==q&&L(e);var n=T.attrHandle[t.toLowerCase()],r=n&&Y.call(T.attrHandle,t.toLowerCase())?n(e,t,!O):void 0;return void 0!==r?r:w.attributes||!O?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(A=!w.detectDuplicates,j=!w.sortStable&&e.slice(0),e.sort(U),A){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return j=null,e},C=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=C(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=C(t);return n},T=t.selectors={cacheLength:50,createPseudo:r,match:he,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(we,Te),e[3]=(e[3]||e[4]||e[5]||"").replace(we,Te),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return he.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&pe.test(n)&&(t=k(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(we,Te).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=_[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&_(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:!n||(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(ae," ")+" ").indexOf(r)>-1:"|="===n&&(o===r||o.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,v=a&&t.nodeName.toLowerCase(),y=!u&&!a;if(m){if(o){for(;g;){for(f=t;f=f[g];)if(a?f.nodeName.toLowerCase()===v:1===f.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[s?m.firstChild:m.lastChild],s&&y){for(c=m[W]||(m[W]={}),l=c[e]||[],d=l[0]===I&&l[1],p=l[0]===I&&l[2],f=d&&m.childNodes[d];f=++d&&f&&f[g]||(p=d=0)||h.pop();)if(1===f.nodeType&&++p&&f===t){c[e]=[I,d,p];break}}else if(y&&(l=(t[W]||(t[W]={}))[e])&&l[0]===I)p=l[1];else for(;(f=++d&&f&&f[g]||(p=d=0)||h.pop())&&((a?f.nodeName.toLowerCase()!==v:1!==f.nodeType)||!++p||(y&&((f[W]||(f[W]={}))[e]=[I,p]),f!==t)););return p-=i,p===r||p%r===0&&p/r>=0}}},PSEUDO:function(e,n){var i,o=T.pseudos[e]||T.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[W]?o(n):o.length>1?(i=[e,e,"",n],T.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),s=i.length;s--;)r=ee(e,i[s]),e[r]=!(t[r]=i[s])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=E(e.replace(ue,"$1"));return i[W]?r(function(e,t,n,r){for(var o,s=i(e,null,r,[]),a=e.length;a--;)(o=s[a])&&(e[a]=!(t[a]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(we,Te),function(t){return(t.textContent||t.innerText||C(t)).indexOf(e)>-1}}),lang:r(function(e){return de.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(we,Te).toLowerCase(),function(t){var n;do if(n=O?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===H},focus:function(e){return e===q.activeElement&&(!q.hasFocus||q.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!T.pseudos.empty(e)},header:function(e){return me.test(e.nodeName)},input:function(e){return ge.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:l(function(){return[0]}),last:l(function(e,t){return[t-1]}),eq:l(function(e,t,n){return[n<0?n+t:n]}),even:l(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:l(function(e,t,n){for(var r=n<0?n+t:n;++r2&&"ID"===(s=o[0]).type&&w.getById&&9===t.nodeType&&O&&T.relative[o[1].type]){if(t=(T.find.ID(s.matches[0].replace(we,Te),t)||[])[0],!t)return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=he.needsContext.test(e)?0:o.length;i--&&(s=o[i],!T.relative[a=s.type]);)if((u=T.find[a])&&(r=u(s.matches[0].replace(we,Te),xe.test(o[0].type)&&c(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&p(o),!e)return K.apply(n,r),n;break}}return(l||E(e,f))(r,t,!O,n,xe.test(e)&&c(t.parentNode)||t),n},w.sortStable=W.split("").sort(U).join("")===W,w.detectDuplicates=!!A,L(),w.sortDetached=i(function(e){return 1&e.compareDocumentPosition(q.createElement("div"))}),i(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),w.attributes&&i(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);Z.find=ie,Z.expr=ie.selectors,Z.expr[":"]=Z.expr.pseudos,Z.unique=ie.uniqueSort,Z.text=ie.getText,Z.isXMLDoc=ie.isXML,Z.contains=ie.contains;var oe=Z.expr.match.needsContext,se=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,ae=/^.[^:#\[\.,]*$/;Z.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?Z.find.matchesSelector(r,e)?[r]:[]:Z.find.matches(e,Z.grep(t,function(e){return 1===e.nodeType}))},Z.fn.extend({find:function(e){var t,n=this.length,r=[],i=this;if("string"!=typeof e)return this.pushStack(Z(e).filter(function(){ -for(t=0;t1?Z.unique(r):r),r.selector=this.selector?this.selector+" "+e:e,r},filter:function(e){return this.pushStack(r(this,e||[],!1))},not:function(e){return this.pushStack(r(this,e||[],!0))},is:function(e){return!!r(this,"string"==typeof e&&oe.test(e)?Z(e):e||[],!1).length}});var ue,le=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ce=Z.fn.init=function(e,t){var n,r;if(!e)return this;if("string"==typeof e){if(n="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:le.exec(e),!n||!n[1]&&t)return!t||t.jquery?(t||ue).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof Z?t[0]:t,Z.merge(this,Z.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:J,!0)),se.test(n[1])&&Z.isPlainObject(t))for(n in t)Z.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return r=J.getElementById(n[2]),r&&r.parentNode&&(this.length=1,this[0]=r),this.context=J,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):Z.isFunction(e)?"undefined"!=typeof ue.ready?ue.ready(e):e(Z):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),Z.makeArray(e,this))};ce.prototype=Z.fn,ue=Z(J);var fe=/^(?:parents|prev(?:Until|All))/,pe={children:!0,contents:!0,next:!0,prev:!0};Z.extend({dir:function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&Z(e).is(n))break;r.push(e)}return r},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),Z.fn.extend({has:function(e){var t=Z(e,this),n=t.length;return this.filter(function(){for(var e=0;e-1:1===n.nodeType&&Z.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?Z.unique(o):o)},index:function(e){return e?"string"==typeof e?U.call(Z(e),this[0]):U.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(Z.unique(Z.merge(this.get(),Z(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),Z.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Z.dir(e,"parentNode")},parentsUntil:function(e,t,n){return Z.dir(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return Z.dir(e,"nextSibling")},prevAll:function(e){return Z.dir(e,"previousSibling")},nextUntil:function(e,t,n){return Z.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return Z.dir(e,"previousSibling",n)},siblings:function(e){return Z.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return Z.sibling(e.firstChild)},contents:function(e){return e.contentDocument||Z.merge([],e.childNodes)}},function(e,t){Z.fn[e]=function(n,r){var i=Z.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=Z.filter(r,i)),this.length>1&&(pe[e]||Z.unique(i),fe.test(e)&&i.reverse()),this.pushStack(i)}});var de=/\S+/g,he={};Z.Callbacks=function(e){e="string"==typeof e?he[e]||o(e):Z.extend({},e);var t,n,r,i,s,a,u=[],l=!e.once&&[],c=function(o){for(t=e.memory&&o,n=!0,a=i||0,i=0,s=u.length,r=!0;u&&a-1;)u.splice(n,1),r&&(n<=s&&s--,n<=a&&a--)}),this},has:function(e){return e?Z.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],s=0,this},disable:function(){return u=l=t=void 0,this},disabled:function(){return!u},lock:function(){return l=void 0,t||f.disable(),this},locked:function(){return!l},fireWith:function(e,t){return!u||n&&!l||(t=t||[],t=[e,t.slice?t.slice():t],r?l.push(t):c(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!n}};return f},Z.extend({Deferred:function(e){var t=[["resolve","done",Z.Callbacks("once memory"),"resolved"],["reject","fail",Z.Callbacks("once memory"),"rejected"],["notify","progress",Z.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return Z.Deferred(function(n){Z.each(t,function(t,o){var s=Z.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&Z.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[o[0]+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?Z.extend(e,r):r}},i={};return r.pipe=r.then,Z.each(t,function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add(function(){n=a},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=_.call(arguments),s=o.length,a=1!==s||e&&Z.isFunction(e.promise)?s:0,u=1===a?e:Z.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?_.call(arguments):i,r===t?u.notifyWith(n,r):--a||u.resolveWith(n,r)}};if(s>1)for(t=new Array(s),n=new Array(s),r=new Array(s);i0||(ge.resolveWith(J,[Z]),Z.fn.triggerHandler&&(Z(J).triggerHandler("ready"),Z(J).off("ready"))))}}),Z.ready.promise=function(t){return ge||(ge=Z.Deferred(),"complete"===J.readyState?setTimeout(Z.ready):(J.addEventListener("DOMContentLoaded",s,!1),e.addEventListener("load",s,!1))),ge.promise(t)},Z.ready.promise();var me=Z.access=function(e,t,n,r,i,o,s){var a=0,u=e.length,l=null==n;if("object"===Z.type(n)){i=!0;for(a in n)Z.access(e,t,a,n[a],!0,o,s)}else if(void 0!==r&&(i=!0,Z.isFunction(r)||(s=!0),l&&(s?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(Z(e),n)})),t))for(;a1,null,!0)},removeData:function(e){return this.each(function(){ye.remove(this,e)})}}),Z.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=ve.get(e,t),n&&(!r||Z.isArray(n)?r=ve.access(e,t,Z.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=Z.queue(e,t),r=n.length,i=n.shift(),o=Z._queueHooks(e,t),s=function(){Z.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,s,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return ve.get(e,n)||ve.access(e,n,{empty:Z.Callbacks("once memory").add(function(){ve.remove(e,[t+"queue",n])})})}}),Z.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.lengthx",Q.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var ke="undefined";Q.focusinBubbles="onfocusin"in e;var Ee=/^key/,Se=/^(?:mouse|pointer|contextmenu)|click/,De=/^(?:focusinfocus|focusoutblur)$/,je=/^([^.]*)(?:\.(.+)|)$/;Z.event={global:{},add:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=ve.get(e);if(m)for(n.handler&&(o=n,n=o.handler,i=o.selector),n.guid||(n.guid=Z.guid++),(u=m.events)||(u=m.events={}),(s=m.handle)||(s=m.handle=function(t){return typeof Z!==ke&&Z.event.triggered!==t.type?Z.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(de)||[""],l=t.length;l--;)a=je.exec(t[l])||[],d=g=a[1],h=(a[2]||"").split(".").sort(),d&&(f=Z.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=Z.event.special[d]||{},c=Z.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&Z.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||(p=u[d]=[],p.delegateCount=0,f.setup&&f.setup.call(e,r,h,s)!==!1||e.addEventListener&&e.addEventListener(d,s,!1)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),Z.event.global[d]=!0)},remove:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=ve.hasData(e)&&ve.get(e);if(m&&(u=m.events)){for(t=(t||"").match(de)||[""],l=t.length;l--;)if(a=je.exec(t[l])||[],d=g=a[1],h=(a[2]||"").split(".").sort(),d){for(f=Z.event.special[d]||{},d=(r?f.delegateType:f.bindType)||d,p=u[d]||[],a=a[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=p.length;o--;)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));s&&!p.length&&(f.teardown&&f.teardown.call(e,h,m.handle)!==!1||Z.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)Z.event.remove(e,d+t[l],n,r,!0);Z.isEmptyObject(u)&&(delete m.handle,ve.remove(e,"events"))}},trigger:function(t,n,r,i){var o,s,a,u,l,c,f,p=[r||J],d=G.call(t,"type")?t.type:t,h=G.call(t,"namespace")?t.namespace.split("."):[];if(s=a=r=r||J,3!==r.nodeType&&8!==r.nodeType&&!De.test(d+Z.event.triggered)&&(d.indexOf(".")>=0&&(h=d.split("."),d=h.shift(),h.sort()),l=d.indexOf(":")<0&&"on"+d,t=t[Z.expando]?t:new Z.Event(d,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=h.join("."),t.namespace_re=t.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:Z.makeArray(n,[t]),f=Z.event.special[d]||{},i||!f.trigger||f.trigger.apply(r,n)!==!1)){if(!i&&!f.noBubble&&!Z.isWindow(r)){for(u=f.delegateType||d,De.test(u+d)||(s=s.parentNode);s;s=s.parentNode)p.push(s),a=s;a===(r.ownerDocument||J)&&p.push(a.defaultView||a.parentWindow||e)}for(o=0;(s=p[o++])&&!t.isPropagationStopped();)t.type=o>1?u:f.bindType||d,c=(ve.get(s,"events")||{})[t.type]&&ve.get(s,"handle"),c&&c.apply(s,n),c=l&&s[l],c&&c.apply&&Z.acceptData(s)&&(t.result=c.apply(s,n),t.result===!1&&t.preventDefault());return t.type=d,i||t.isDefaultPrevented()||f._default&&f._default.apply(p.pop(),n)!==!1||!Z.acceptData(r)||l&&Z.isFunction(r[d])&&!Z.isWindow(r)&&(a=r[l],a&&(r[l]=null),Z.event.triggered=d,r[d](),Z.event.triggered=void 0,a&&(r[l]=a)),t.result}},dispatch:function(e){e=Z.event.fix(e);var t,n,r,i,o,s=[],a=_.call(arguments),u=(ve.get(this,"events")||{})[e.type]||[],l=Z.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){for(s=Z.event.handlers.call(this,e,u),t=0;(i=s[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(o.namespace)||(e.handleObj=o,e.data=o.data,r=((Z.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,a),void 0!==r&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,s=[],a=t.delegateCount,u=e.target;if(a&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!==this;u=u.parentNode||this)if(u.disabled!==!0||"click"!==e.type){for(r=[],n=0;n=0:Z.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&s.push({elem:u,handlers:r})}return a]*)\/>/gi,Le=/<([\w:]+)/,qe=/<|&#?\w+;/,He=/<(?:script|style|link)/i,Oe=/checked\s*(?:[^=]|=\s*.checked.)/i,Fe=/^$|\/(?:java|ecma)script/i,Pe=/^true\/(.*)/,Re=/^\s*\s*$/g,Me={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};Me.optgroup=Me.option,Me.tbody=Me.tfoot=Me.colgroup=Me.caption=Me.thead,Me.th=Me.td,Z.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=Z.contains(e.ownerDocument,e);if(!(Q.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||Z.isXMLDoc(e)))for(s=v(a),o=v(e),r=0,i=o.length;r0&&g(s,!u&&v(e,"script")),a},buildFragment:function(e,t,n,r){for(var i,o,s,a,u,l,c=t.createDocumentFragment(),f=[],p=0,d=e.length;p")+a[2],l=a[0];l--;)o=o.lastChild;Z.merge(f,o.childNodes),o=c.firstChild,o.textContent=""}else f.push(t.createTextNode(i));for(c.textContent="",p=0;i=f[p++];)if((!r||Z.inArray(i,r)===-1)&&(u=Z.contains(i.ownerDocument,i),o=v(c.appendChild(i),"script"),u&&g(o),n))for(l=0;i=o[l++];)Fe.test(i.type||"")&&n.push(i);return c},cleanData:function(e){for(var t,n,r,i,o=Z.event.special,s=0;void 0!==(n=e[s]);s++){if(Z.acceptData(n)&&(i=n[ve.expando],i&&(t=ve.cache[i]))){if(t.events)for(r in t.events)o[r]?Z.event.remove(n,r):Z.removeEvent(n,r,t.handle);ve.cache[i]&&delete ve.cache[i]}delete ye.cache[n[ye.expando]]}}}),Z.fn.extend({text:function(e){return me(this,function(e){return void 0===e?Z.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=p(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=p(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){for(var n,r=e?Z.filter(e,this):this,i=0;null!=(n=r[i]);i++)t||1!==n.nodeType||Z.cleanData(v(n)),n.parentNode&&(t&&Z.contains(n.ownerDocument,n)&&g(v(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(Z.cleanData(v(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return Z.clone(this,e,t)})},html:function(e){return me(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!He.test(e)&&!Me[(Le.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(Ae,"<$1>");try{for(;n1&&"string"==typeof p&&!Q.checkClone&&Oe.test(p))return this.each(function(n){var r=c.eq(n);g&&(e[0]=p.call(this,n,r.html())),r.domManip(e,t)});if(l&&(n=Z.buildFragment(e,this[0].ownerDocument,!1,this),r=n.firstChild,1===n.childNodes.length&&(n=r),r)){for(i=Z.map(v(n,"script"),d),o=i.length;u1)},show:function(){return S(this,!0)},hide:function(){return S(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Ce(this)?Z(this).show():Z(this).hide()})}}),Z.Tween=D,D.prototype={constructor:D,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(Z.cssNumber[n]?"":"px")},cur:function(){var e=D.propHooks[this.prop];return e&&e.get?e.get(this):D.propHooks._default.get(this)},run:function(e){var t,n=D.propHooks[this.prop];return this.options.duration?this.pos=t=Z.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):D.propHooks._default.set(this),this}},D.prototype.init.prototype=D.prototype,D.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=Z.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){Z.fx.step[e.prop]?Z.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[Z.cssProps[e.prop]]||Z.cssHooks[e.prop])?Z.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},D.propHooks.scrollTop=D.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},Z.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},Z.fx=D.prototype.init,Z.fx.step={};var Qe,Je,Ke=/^(?:toggle|show|hide)$/,Ze=new RegExp("^(?:([+-])=|)("+we+")([a-z%]*)$","i"),et=/queueHooks$/,tt=[q],nt={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Ze.exec(t),o=i&&i[3]||(Z.cssNumber[e]?"":"px"),s=(Z.cssNumber[e]||"px"!==o&&+r)&&Ze.exec(Z.css(n.elem,e)),a=1,u=20;if(s&&s[3]!==o){o=o||s[3],i=i||[],s=+r||1;do a=a||".5",s/=a,Z.style(n.elem,e,s+o);while(a!==(a=n.cur()/r)&&1!==a&&--u)}return i&&(s=n.start=+s||+r||0,n.unit=o,n.end=i[1]?s+(i[1]+1)*i[2]:+i[2]),n}]};Z.Animation=Z.extend(O,{tweener:function(e,t){Z.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,i=e.length;r1)},removeAttr:function(e){return this.each(function(){Z.removeAttr(this,e)})}}),Z.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return typeof e.getAttribute===ke?Z.prop(e,t,n):(1===o&&Z.isXMLDoc(e)||(t=t.toLowerCase(),r=Z.attrHooks[t]||(Z.expr.match.bool.test(t)?it:rt)),void 0===n?r&&"get"in r&&null!==(i=r.get(e,t))?i:(i=Z.find.attr(e,t),null==i?void 0:i):null!==n?r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:(e.setAttribute(t,n+""),n):void Z.removeAttr(e,t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(de);if(o&&1===e.nodeType)for(;n=o[i++];)r=Z.propFix[n]||n,Z.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!Q.radioValue&&"radio"===t&&Z.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}}}),it={set:function(e,t,n){return t===!1?Z.removeAttr(e,n):e.setAttribute(n,n),n}},Z.each(Z.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ot[t]||Z.find.attr;ot[t]=function(e,t,r){var i,o;return r||(o=ot[t],ot[t]=i,i=null!=n(e,t,r)?t.toLowerCase():null,ot[t]=o),i}});var st=/^(?:input|select|textarea|button)$/i;Z.fn.extend({prop:function(e,t){return me(this,Z.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[Z.propFix[e]||e]})}}),Z.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!Z.isXMLDoc(e),o&&(t=Z.propFix[t]||t,i=Z.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||st.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),Q.optSelected||(Z.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),Z.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){Z.propFix[this.toLowerCase()]=this});var at=/[\t\r\n\f]/g;Z.fn.extend({addClass:function(e){var t,n,r,i,o,s,a="string"==typeof e&&e,u=0,l=this.length;if(Z.isFunction(e))return this.each(function(t){Z(this).addClass(e.call(this,t,this.className))});if(a)for(t=(e||"").match(de)||[];u=0;)r=r.replace(" "+i+" "," ");s=e?Z.trim(r):"",n.className!==s&&(n.className=s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):Z.isFunction(e)?this.each(function(n){Z(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n)for(var t,r=0,i=Z(this),o=e.match(de)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else n!==ke&&"boolean"!==n||(this.className&&ve.set(this,"__className__",this.className),this.className=this.className||e===!1?"":ve.get(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;n=0)return!0;return!1}});var ut=/\r/g;Z.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=Z.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,Z(this).val()):e,null==i?i="":"number"==typeof i?i+="":Z.isArray(i)&&(i=Z.map(i,function(e){return null==e?"":e+""})),t=Z.valHooks[this.type]||Z.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return t=Z.valHooks[i.type]||Z.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(ut,""):null==n?"":n)}}}),Z.extend({valHooks:{option:{get:function(e){var t=Z.find.attr(e,"value");return null!=t?t:Z.trim(Z.text(e))}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,s=o?null:[],a=o?i+1:r.length,u=i<0?a:o?i:0;u=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),Z.each(["radio","checkbox"],function(){Z.valHooks[this]={set:function(e,t){if(Z.isArray(t))return e.checked=Z.inArray(Z(e).val(),t)>=0}},Q.checkOn||(Z.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),Z.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){Z.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),Z.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var lt=Z.now(),ct=/\?/;Z.parseJSON=function(e){return JSON.parse(e+"")},Z.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||Z.error("Invalid XML: "+e),t};var ft=/#.*$/,pt=/([?&])_=[^&]*/,dt=/^(.*?):[ \t]*([^\r\n]*)$/gm,ht=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,gt=/^(?:GET|HEAD)$/,mt=/^\/\//,vt=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,yt={},xt={},bt="*/".concat("*"),wt=e.location.href,Tt=vt.exec(wt.toLowerCase())||[];Z.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:wt,type:"GET",isLocal:ht.test(Tt[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":bt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":Z.parseJSON,"text xml":Z.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?R(R(e,Z.ajaxSettings),t):R(Z.ajaxSettings,e)},ajaxPrefilter:F(yt),ajaxTransport:F(xt),ajax:function(e,t){function n(e,t,n,s){var u,c,v,y,b,T=t;2!==x&&(x=2,a&&clearTimeout(a),r=void 0,o=s||"",w.readyState=e>0?4:0,u=e>=200&&e<300||304===e,n&&(y=M(f,w,n)),y=W(f,y,w,u),u?(f.ifModified&&(b=w.getResponseHeader("Last-Modified"),b&&(Z.lastModified[i]=b),b=w.getResponseHeader("etag"),b&&(Z.etag[i]=b)),204===e||"HEAD"===f.type?T="nocontent":304===e?T="notmodified":(T=y.state,c=y.data,v=y.error,u=!v)):(v=T,!e&&T||(T="error",e<0&&(e=0))),w.status=e,w.statusText=(t||T)+"",u?h.resolveWith(p,[c,T,w]):h.rejectWith(p,[w,T,v]),w.statusCode(m),m=void 0,l&&d.trigger(u?"ajaxSuccess":"ajaxError",[w,f,u?c:v]),g.fireWith(p,[w,T]),l&&(d.trigger("ajaxComplete",[w,f]),--Z.active||Z.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,i,o,s,a,u,l,c,f=Z.ajaxSetup({},t),p=f.context||f,d=f.context&&(p.nodeType||p.jquery)?Z(p):Z.event,h=Z.Deferred(),g=Z.Callbacks("once memory"),m=f.statusCode||{},v={},y={},x=0,b="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!s)for(s={};t=dt.exec(o);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?o:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=y[n]=y[n]||e,v[e]=t),this},overrideMimeType:function(e){return x||(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(x<2)for(t in e)m[t]=[m[t],e[t]];else w.always(e[w.status]);return this},abort:function(e){var t=e||b;return r&&r.abort(t),n(0,t),this}};if(h.promise(w).complete=g.add,w.success=w.done,w.error=w.fail,f.url=((e||f.url||wt)+"").replace(ft,"").replace(mt,Tt[1]+"//"),f.type=t.method||t.type||f.method||f.type,f.dataTypes=Z.trim(f.dataType||"*").toLowerCase().match(de)||[""],null==f.crossDomain&&(u=vt.exec(f.url.toLowerCase()),f.crossDomain=!(!u||u[1]===Tt[1]&&u[2]===Tt[2]&&(u[3]||("http:"===u[1]?"80":"443"))===(Tt[3]||("http:"===Tt[1]?"80":"443")))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=Z.param(f.data,f.traditional)),P(yt,f,t,w),2===x)return w;l=Z.event&&f.global,l&&0===Z.active++&&Z.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!gt.test(f.type),i=f.url,f.hasContent||(f.data&&(i=f.url+=(ct.test(i)?"&":"?")+f.data,delete f.data),f.cache===!1&&(f.url=pt.test(i)?i.replace(pt,"$1_="+lt++):i+(ct.test(i)?"&":"?")+"_="+lt++)),f.ifModified&&(Z.lastModified[i]&&w.setRequestHeader("If-Modified-Since",Z.lastModified[i]),Z.etag[i]&&w.setRequestHeader("If-None-Match",Z.etag[i])),(f.data&&f.hasContent&&f.contentType!==!1||t.contentType)&&w.setRequestHeader("Content-Type",f.contentType),w.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+bt+"; q=0.01":""):f.accepts["*"]);for(c in f.headers)w.setRequestHeader(c,f.headers[c]);if(f.beforeSend&&(f.beforeSend.call(p,w,f)===!1||2===x))return w.abort();b="abort";for(c in{success:1,error:1,complete:1})w[c](f[c]);if(r=P(xt,f,t,w)){w.readyState=1,l&&d.trigger("ajaxSend",[w,f]),f.async&&f.timeout>0&&(a=setTimeout(function(){w.abort("timeout")},f.timeout));try{x=1,r.send(v,n)}catch(T){if(!(x<2))throw T;n(-1,T)}}else n(-1,"No Transport");return w},getJSON:function(e,t,n){return Z.get(e,t,n,"json")},getScript:function(e,t){return Z.get(e,void 0,t,"script")}}),Z.each(["get","post"],function(e,t){Z[t]=function(e,n,r,i){return Z.isFunction(n)&&(i=i||r,r=n,n=void 0),Z.ajax({url:e,type:t,dataType:i,data:n,success:r})}}),Z._evalUrl=function(e){return Z.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},Z.fn.extend({wrapAll:function(e){var t;return Z.isFunction(e)?this.each(function(t){Z(this).wrapAll(e.call(this,t))}):(this[0]&&(t=Z(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return Z.isFunction(e)?this.each(function(t){Z(this).wrapInner(e.call(this,t))}):this.each(function(){var t=Z(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=Z.isFunction(e);return this.each(function(n){Z(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){Z.nodeName(this,"body")||Z(this).replaceWith(this.childNodes)}).end()}}),Z.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0},Z.expr.filters.visible=function(e){return!Z.expr.filters.hidden(e)};var Ct=/%20/g,Nt=/\[\]$/,kt=/\r?\n/g,Et=/^(?:submit|button|image|reset|file)$/i,St=/^(?:input|select|textarea|keygen)/i;Z.param=function(e,t){var n,r=[],i=function(e,t){t=Z.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=Z.ajaxSettings&&Z.ajaxSettings.traditional),Z.isArray(e)||e.jquery&&!Z.isPlainObject(e))Z.each(e,function(){i(this.name,this.value)});else for(n in e)$(n,e[n],t,i);return r.join("&").replace(Ct,"+")},Z.fn.extend({serialize:function(){return Z.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=Z.prop(this,"elements");return e?Z.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!Z(this).is(":disabled")&&St.test(this.nodeName)&&!Et.test(e)&&(this.checked||!Ne.test(e))}).map(function(e,t){var n=Z(this).val();return null==n?null:Z.isArray(n)?Z.map(n,function(e){return{name:t.name,value:e.replace(kt,"\r\n")}}):{name:t.name,value:n.replace(kt,"\r\n")}}).get()}}),Z.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var Dt=0,jt={},At={0:200,1223:204},Lt=Z.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var e in jt)jt[e]()}),Q.cors=!!Lt&&"withCredentials"in Lt,Q.ajax=Lt=!!Lt,Z.ajaxTransport(function(e){var t;if(Q.cors||Lt&&!e.crossDomain)return{send:function(n,r){var i,o=e.xhr(),s=++Dt;if(o.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)o[i]=e.xhrFields[i];e.mimeType&&o.overrideMimeType&&o.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)o.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete jt[s],t=o.onload=o.onerror=null,"abort"===e?o.abort():"error"===e?r(o.status,o.statusText):r(At[o.status]||o.status,o.statusText,"string"==typeof o.responseText?{text:o.responseText}:void 0,o.getAllResponseHeaders()))}},o.onload=t(),o.onerror=t("error"),t=jt[s]=t("abort");try{o.send(e.hasContent&&e.data||null)}catch(a){if(t)throw a}},abort:function(){t&&t()}}}),Z.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return Z.globalEval(e),e}}}),Z.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),Z.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=Z(" - - - - - - - + + - + - + - - - - - - - - + + + - - + + - - - - + \ No newline at end of file diff --git a/packages/uikit-workshop/src/html/partials/iframe-loader.html b/packages/uikit-workshop/src/html/partials/iframe-loader.html new file mode 100644 index 000000000..40086f8aa --- /dev/null +++ b/packages/uikit-workshop/src/html/partials/iframe-loader.html @@ -0,0 +1,15 @@ + + +
+
+
Loading Pattern Lab
+
+ + + + + +
+
+
diff --git a/packages/uikit-workshop/src/html/partials/iframe.html b/packages/uikit-workshop/src/html/partials/iframe.html index 3b91bde97..0ae6a5752 100644 --- a/packages/uikit-workshop/src/html/partials/iframe.html +++ b/packages/uikit-workshop/src/html/partials/iframe.html @@ -1,17 +1,20 @@
- -
-
- - - -
+
-
- -
+
-
+ -
\ No newline at end of file +
+ +
+ +
+ + +
+ + +
+ \ No newline at end of file diff --git a/packages/uikit-workshop/src/html/partials/panel-code-template.html b/packages/uikit-workshop/src/html/partials/panel-code-template.html index 10aed4319..d8e59fb4d 100644 --- a/packages/uikit-workshop/src/html/partials/panel-code-template.html +++ b/packages/uikit-workshop/src/html/partials/panel-code-template.html @@ -1,3 +1,3 @@
-	{{{ code }}}
+{{{ code }}}
 
diff --git a/packages/uikit-workshop/src/js/clipboard.min.js b/packages/uikit-workshop/src/js/clipboard.min.js deleted file mode 100644 index ee5770348..000000000 --- a/packages/uikit-workshop/src/js/clipboard.min.js +++ /dev/null @@ -1,9 +0,0 @@ -// jshint ignore: start - -/*! - * clipboard.js v1.7.1 - * https://zenorocha.github.io/clipboard.js - * - * Licensed MIT © Zeno Rocha - */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,o){function i(a,c){if(!n[a]){if(!e[a]){var l="function"==typeof require&&require;if(!c&&l)return l(a,!0);if(r)return r(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return i(n||t)},u,u.exports,t,e,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a0&&void 0!==arguments[0]?arguments[0]:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""}},{key:"initSelection",value:function t(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function t(){var e=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px";var o=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=o+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function t(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function t(){this.selectedText=(0,i.default)(this.target),this.copyText()}},{key:"copyText",value:function t(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function t(e){this.emitter.emit(e?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function t(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function t(){this.removeFake()}},{key:"action",set:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e){if(!e||"object"!==(void 0===e?"undefined":r(e))||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=e}},get:function t(){return this._target}}]),t}();t.exports=c})},{select:5}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if(void 0!==o)r(n,e("./clipboard-action"),e("tiny-emitter"),e("good-listener"));else{var a={exports:{}};r(a,i.clipboardAction,i.tinyEmitter,i.goodListener),i.clipboard=a.exports}}(this,function(t,e,n,o){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var s=i(e),u=i(n),f=i(o),d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText,this.container="object"===d(e.container)?e.container:document.body}},{key:"listenClick",value:function t(e){var n=this;this.listener=(0,f.default)(e,"click",function(t){return n.onClick(t)})}},{key:"onClick",value:function t(e){var n=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new s.default({action:this.action(n),target:this.target(n),text:this.text(n),container:this.container,trigger:n,emitter:this})}},{key:"defaultAction",value:function t(e){return l("action",e)}},{key:"defaultTarget",value:function t(e){var n=l("target",e);if(n)return document.querySelector(n)}},{key:"defaultText",value:function t(e){return l("text",e)}},{key:"destroy",value:function t(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],n="string"==typeof e?[e]:e,o=!!document.queryCommandSupported;return n.forEach(function(t){o=o&&!!document.queryCommandSupported(t)}),o}}]),e}(u.default);t.exports=p})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)}); diff --git a/packages/uikit-workshop/src/js/data-saver.js b/packages/uikit-workshop/src/js/data-saver.js deleted file mode 100644 index 2120f1d1b..000000000 --- a/packages/uikit-workshop/src/js/data-saver.js +++ /dev/null @@ -1,163 +0,0 @@ -/*! - * jQuery Cookie Plugin v1.3 - * https://github.com/carhartl/jquery-cookie - * - * Copyright 2011, Klaus Hartl - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://www.opensource.org/licenses/mit-license.php - * http://www.opensource.org/licenses/GPL-2.0 - */ -(function($, document, undefined) { - var pluses = /\+/g; - - function raw(s) { - return s; - } - - function decoded(s) { - return decodeURIComponent(s.replace(pluses, ' ')); - } - - var config = ($.cookie = function(key, value, options) { - // write - if (value !== undefined) { - options = $.extend({}, config.defaults, options); - - if (value === null) { - options.expires = -1; - } - - if (typeof options.expires === 'number') { - var days = options.expires, - t = (options.expires = new Date()); - t.setDate(t.getDate() + days); - } - - value = config.json ? JSON.stringify(value) : String(value); - - return (document.cookie = [ - encodeURIComponent(key), - '=', - config.raw ? value : encodeURIComponent(value), - options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE - options.path ? '; path=' + options.path : '', - options.domain ? '; domain=' + options.domain : '', - options.secure ? '; secure' : '', - ].join('')); - } - - // read - var decode = config.raw ? raw : decoded; - var cookies = document.cookie.split('; '); - for (var i = 0, l = cookies.length; i < l; i++) { - var parts = cookies[i].split('='); - if (decode(parts.shift()) === key) { - var cookie = decode(parts.join('=')); - return config.json ? JSON.parse(cookie) : cookie; - } - } - - return null; - }); - - config.defaults = {}; - - $.removeCookie = function(key, options) { - if ($.cookie(key) !== null) { - $.cookie(key, null, options); - return true; - } - return false; - }; -})(jQuery, document); - -/*! - * Data Saver - * - * Copyright (c) 2013-2014 Dave Olsen, http://dmolsen.com - * Licensed under the MIT license - */ - -var DataSaver = { - // the name of the cookie to store the data in - cookieName: 'patternlab', - - /** - * Add a given value to the cookie - * @param {String} the name of the key - * @param {String} the value - */ - addValue: function(name, val) { - var cookieVal = $.cookie(this.cookieName); - cookieVal = - cookieVal === null || cookieVal === '' - ? name + '~' + val - : cookieVal + '|' + name + '~' + val; - $.cookie(this.cookieName, cookieVal); - }, - - /** - * Update a value found in the cookie. If the key doesn't exist add the value - * @param {String} the name of the key - * @param {String} the value - */ - updateValue: function(name, val) { - if (this.findValue(name)) { - var updateCookieVals = ''; - var cookieVals = $.cookie(this.cookieName).split('|'); - for (var i = 0; i < cookieVals.length; i++) { - var fieldVals = cookieVals[i].split('~'); - if (fieldVals[0] == name) { - fieldVals[1] = val; - } - updateCookieVals += - i > 0 - ? '|' + fieldVals[0] + '~' + fieldVals[1] - : fieldVals[0] + '~' + fieldVals[1]; - } - $.cookie(this.cookieName, updateCookieVals); - } else { - this.addValue(name, val); - } - }, - - /** - * Remove the given key - * @param {String} the name of the key - */ - removeValue: function(name) { - var updateCookieVals = ''; - var cookieVals = $.cookie(this.cookieName).split('|'); - var k = 0; - for (var i = 0; i < cookieVals.length; i++) { - var fieldVals = cookieVals[i].split('~'); - if (fieldVals[0] != name) { - updateCookieVals += - k === 0 - ? fieldVals[0] + '~' + fieldVals[1] - : '|' + fieldVals[0] + '~' + fieldVals[1]; - k++; - } - } - $.cookie(this.cookieName, updateCookieVals); - }, - - /** - * Find the value using the given key - * @param {String} the name of the key - * - * @return {String} the value of the key or false if the value isn't found - */ - findValue: function(name) { - if ($.cookie(this.cookieName)) { - var cookieVals = $.cookie(this.cookieName).split('|'); - for (var i = 0; i < cookieVals.length; i++) { - var fieldVals = cookieVals[i].split('~'); - if (fieldVals[0] == name) { - return fieldVals[1]; - } - } - } - return false; - }, -}; diff --git a/packages/uikit-workshop/src/js/layout.js b/packages/uikit-workshop/src/js/layout.js deleted file mode 100644 index b3ea67dec..000000000 --- a/packages/uikit-workshop/src/js/layout.js +++ /dev/null @@ -1,25 +0,0 @@ -/*! - * Simple Layout Rendering for Pattern Lab - * - * Copyright (c) 2014 Dave Olsen, http://dmolsen.com - * Licensed under the MIT license - */ - -try { - /* load pattern nav */ - var template = document.querySelector('.pl-js-pattern-nav-template'); - var templateCompiled = Hogan.compile(template.innerHTML); - var templateRendered = templateCompiled.render(navItems); - document.querySelector( - '.pl-js-pattern-nav-target' - ).innerHTML = templateRendered; - - /* load ish controls */ - var template = document.querySelector('.pl-js-ish-controls-template'); - var templateCompiled = Hogan.compile(template.innerHTML); - var templateRendered = templateCompiled.render(ishControls); - document.querySelector('.pl-js-controls').innerHTML = templateRendered; -} catch (e) { - var message = '

Please generate your site before trying to view it.

'; - document.querySelector('.pl-js-pattern-nav-target').innerHTML = message; -} diff --git a/packages/uikit-workshop/src/js/panels-util.js b/packages/uikit-workshop/src/js/panels-util.js deleted file mode 100644 index 990219c34..000000000 --- a/packages/uikit-workshop/src/js/panels-util.js +++ /dev/null @@ -1,67 +0,0 @@ -/*! - * Panels Util - * For both styleguide and viewer - * - * Copyright (c) 2013-16 Dave Olsen, http://dmolsen.com - * Licensed under the MIT license - * - * @requires url-handler.js - * - */ - -var panelsUtil = { - /** - * Add click events to the template that was rendered - * @param {String} the rendered template for the modal - * @param {String} the pattern partial for the modal - */ - addClickEvents: function(templateRendered, patternPartial) { - var els = templateRendered.querySelectorAll('.pl-js-tab-link'); - for (var i = 0; i < els.length; ++i) { - els[i].onclick = function(e) { - e.preventDefault(); - - var patternPartial = this.getAttribute('data-patternpartial'); - var panelID = this.getAttribute('data-panelid'); - panelsUtil.show(patternPartial, panelID); - }; - } - - return templateRendered; - }, - - /** - * Show a specific modal - * @param {String} the pattern partial for the modal - * @param {String} the ID of the panel to be shown - */ - show: function(patternPartial, panelID) { - var els; - - // turn off all of the active tabs - els = document.querySelectorAll( - '#pl-' + patternPartial + '-tabs .pl-js-tab-link' - ); - for (i = 0; i < els.length; ++i) { - els[i].classList.remove('pl-is-active-tab'); - } - - // hide all of the panels - els = document.querySelectorAll( - '#pl-' + patternPartial + '-panels .pl-js-tab-panel' - ); - for (i = 0; i < els.length; ++i) { - els[i].classList.remove('pl-is-active-tab'); - } - - // add active tab class - document - .getElementById('pl-' + patternPartial + '-' + panelID + '-tab') - .classList.add('pl-is-active-tab'); - - // show the panel - document - .getElementById('pl-' + patternPartial + '-' + panelID + '-panel') - .classList.add('pl-is-active-tab'); - }, -}; diff --git a/packages/uikit-workshop/src/js/plugin-loader.js b/packages/uikit-workshop/src/js/plugin-loader.js deleted file mode 100644 index 9dc0caa33..000000000 --- a/packages/uikit-workshop/src/js/plugin-loader.js +++ /dev/null @@ -1,63 +0,0 @@ -/*! - * Plugin Loader - * - * Copyright (c) 2015 Dave Olsen, http://dmolsen.com - * Licensed under the MIT license - * - * Takes the assets they can be loaded for plugins and adds them to the DOM - * - * @requires styleguide.js - * - */ - -var pluginLoader = { - init: function() { - var s, t, l, c, n; - - for (var i = 0; i < plugins.length; ++i) { - var plugin = plugins[i]; - - // load the templates - for (var key in plugin.templates) { - if (plugin.templates.hasOwnProperty(key)) { - t = document.getElementsByTagName('script'); - l = t.length - 1; - s = t[l]; - n = document.createElement('script'); - n.type = 'text/mustache'; - n.id = plugin.name.replace('/', '-') + '-' + key + '-template'; - n.innerHTML = plugin.templates[key]; - s.parentNode.insertBefore(n, s.nextSibling); - } - } - - // load the stylesheets - for (var k = 0; k < plugin.stylesheets.length; ++k) { - s = plugin.stylesheets[k]; - t = document.getElementsByTagName('link'); - l = t.length - 1; - c = t[l]; - n = document.createElement('link'); - n.type = 'text/css'; - n.rel = 'stylesheet'; - n.href = 'patternlab-components/' + plugin.name + '/' + s; - n.media = 'screen'; - c.parentNode.insertBefore(n, c.nextSibling); - } - - // load the javascript - // $script.path('patternlab-components/'+plugin.name+'/'); - $script( - plugin.javascripts, - plugin.name, - eval('(function() { ' + plugin.callback + ' })') - ); - $script.ready( - [plugin.name], - eval('(function() { ' + plugin.onready + ' })') - ); - } - }, -}; - -pluginLoader.init(); diff --git a/packages/uikit-workshop/src/sass/pattern-lab--iframe-loader.scss b/packages/uikit-workshop/src/sass/pattern-lab--iframe-loader.scss new file mode 100644 index 000000000..b23c481bc --- /dev/null +++ b/packages/uikit-workshop/src/sass/pattern-lab--iframe-loader.scss @@ -0,0 +1,85 @@ +@import 'scss/01-abstracts/variables'; +@import 'scss/01-abstracts/mixins'; + +@keyframes animateIn { + from { + transform: translate3d(-50%, -100%, 0px); + opacity: 0; + } + to { + opacity: 1; + transform: translate3d(-50%, calc(3rem - 50%), 0px); + } +} + +@keyframes rotate { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} + +.pl-c-loader { + z-index: 1000; + position: absolute; + top: 0; + left: 50%; + margin: auto; + max-width: $pl-space * 25; + width: calc(90vw - #{$pl-doublespace}); + border-radius: $pl-border-radius; + background: rgba($pl-color-black, 0.9); + transform: translate3d(-50%, -100%, 0px); + transition: opacity 0.3s ease, transform 0.3s ease; + pointer-events: none; + opacity: 0; + animation: animateIn ease 0.3s forwards; +} + +.pl-c-loader__content { + display: flex; + align-items: center; + pointer-events: auto; +} + +.pl-c-loader__message { + flex: 1; + padding: $pl-space; + font-size: $pl-font-size-sm-2; + color: $pl-color-white; +} + +.pl-c-loader__spinner { + position: relative; + display: inline-block; + width: $pl-doublespace * 2; + height: $pl-doublespace; +} + +.pl-c-loader-svg:not(:root) { + overflow: hidden; +} + +.pl-c-loader-svg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + transform: translateZ(0); + animation: rotate 1s linear infinite; +} + +.pl-c-loader-svg__outer-circle { + fill: none; + stroke: $pl-color-white; + stroke-width: 15; + stroke-miterlimit: 10; +} + +.pl-c-loader-svg__inner-circle, +.pl-c-loader-svg__electron { + fill: $pl-color-gray-20; +} diff --git a/packages/uikit-workshop/src/sass/pattern-lab.scss b/packages/uikit-workshop/src/sass/pattern-lab.scss index c6002f803..360f8d1e8 100755 --- a/packages/uikit-workshop/src/sass/pattern-lab.scss +++ b/packages/uikit-workshop/src/sass/pattern-lab.scss @@ -15,32 +15,31 @@ #TABLE OF CONTENTS \*------------------------------------*/ /** - * ABSTRACTS.................Variables + * ABSTRACTS.................Variables and mixins * BASE......................Reset & Base elements + * VENDOR....................Styles out of PL control * COMPONENTS................Components + * THEMES....................Theming variations * UTILITIES.................Helper classes - * VENDOR....................Styles out of PL control */ /*------------------------------------*\ #ABSTRACTS \*------------------------------------*/ -@import "scss/abstracts/variables"; -@import "scss/abstracts/mixins"; - - - - +@import 'scss/01-abstracts/variables'; +@import 'scss/01-abstracts/mixins'; /*------------------------------------*\ #BASE \*------------------------------------*/ -@import "scss/base/reset"; -@import "scss/base/body"; - - - +@import 'scss/02-base/reset'; +@import 'scss/02-base/body'; +/*------------------------------------*\ + #VENDOR +\*------------------------------------*/ +@import 'scss/03-vendor/typeahead'; +@import 'scss/03-vendor/prism'; /*------------------------------------*\ #COMPONENTS @@ -49,59 +48,41 @@ /** * Pattern Lab Header */ -@import "scss/components/header"; -@import "scss/components/logo"; -@import "scss/components/navigation"; -@import "scss/components/ish-sizing"; -@import "scss/components/controls"; -@import "scss/components/tools"; +@import 'scss/04-components/header'; +@import 'scss/04-components/logo'; +@import 'scss/04-components/navigation'; +@import 'scss/04-components/ish-sizing'; +@import 'scss/04-components/controls'; +@import 'scss/04-components/tools'; /** * Viewport */ -@import "scss/components/viewport"; +@import 'scss/04-components/viewport'; /** * Pattern Styles */ -@import "scss/components/pattern"; -@import "scss/components/pattern-category"; -@import "scss/components/pattern-info"; -@import "scss/components/pattern-states"; -@import "scss/components/pattern-lineage"; -@import "scss/components/breadcrumbs"; -@import "scss/components/tabs"; -@import "scss/components/tools"; -@import "scss/components/annotations"; -@import "scss/components/modal"; -@import "scss/components/text-passage"; - - - - +@import 'scss/04-components/pattern'; +@import 'scss/04-components/pattern-category'; +@import 'scss/04-components/pattern-info'; +@import 'scss/04-components/pattern-states'; +@import 'scss/04-components/pattern-lineage'; +@import 'scss/04-components/breadcrumbs'; +@import 'scss/04-components/tabs'; +@import 'scss/04-components/tools'; +@import 'scss/04-components/annotations'; +@import 'scss/04-components/modal'; +@import 'scss/04-components/text-passage'; /*------------------------------------*\ - #UTILITIES -\*------------------------------------*/ -@import "scss/utilities/visibility"; - - - - - -/*------------------------------------*\ - #VENDOR + #THEMES \*------------------------------------*/ -@import "scss/vendor/typeahead"; -@import "scss/vendor/prism"; - - - - +@import 'scss/05-themes/light-theme'; +@import 'scss/05-themes/density-theme'; +@import 'scss/05-themes/sidebar-theme'; /*------------------------------------*\ - #THEMES + #UTILITIES \*------------------------------------*/ -@import "scss/themes/light-theme"; -@import "scss/themes/density-theme"; -@import "scss/themes/sidebar-theme"; \ No newline at end of file +@import 'scss/06-utilities/visibility'; diff --git a/packages/uikit-workshop/src/sass/scss/01-abstracts/_mixins.scss b/packages/uikit-workshop/src/sass/scss/01-abstracts/_mixins.scss new file mode 100644 index 000000000..a3f4ec65b --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/01-abstracts/_mixins.scss @@ -0,0 +1,98 @@ +/*------------------------------------*\ + #VARIABLES +\*------------------------------------*/ + +/** + * List Reset + */ +@mixin listReset() { + list-style: none; + margin: 0; + padding: 0; +} + +/** + * Hide scrollbar + * 1) This hides scrollbars on Windows devices + */ +@mixin hideScrollBar() { + -ms-overflow-style: -ms-autohiding-scrollbar; + + &::-webkit-scrollbar { + width: 0 !important; + } +} + +/** + * Header Link Style + */ +@mixin linkStyle() { + background: $pl-color-black; + color: $pl-color-gray-50; + text-decoration: none; + line-height: 1; + padding: 0.7rem 0.5rem; + border: 0; + text-align: left; + transition: background $pl-animate-quick ease-out, + color $pl-animate-quick ease-out; + + &:hover { + color: $pl-color-white; + background: $pl-color-gray-87; + } + + &:focus, + &.active { + color: $pl-color-white; + background: $pl-color-gray-87; + outline: 1px dotted $pl-color-gray-50; + outline-offset: -1px; + } + + /** + * Header link styles inside light theme + */ + .pl-c-body--theme-light & { + background: $pl-color-white; + color: $pl-color-gray-70; + } + + /** + * Header link styles inside cozy theme + */ + .pl-c-body--theme-density-cozy & { + font-size: $pl-font-size-sm-2; + padding: 1.2rem 0.8rem; + } + + /** + * Header link styles inside comfortable theme + */ + .pl-c-body--theme-density-comfortable & { + font-size: $pl-font-size-sm-2; + padding: 1.5rem 1rem; + } +} + +/** + * Accordion panel + */ +@mixin accordionPanel() { + overflow: hidden; + max-height: 0; + transition: max-height $pl-animate-quick ease-out; + + /** + * Active is when accordion panel is open + */ + &.pl-is-active { + max-height: none; + overflow: auto; + @include hideScrollBar(); + + @media all and (min-width: $pl-bp-med) { + max-height: 120rem; + } + } +} diff --git a/packages/uikit-workshop/src/sass/scss/abstracts/_variables.scss b/packages/uikit-workshop/src/sass/scss/01-abstracts/_variables.scss similarity index 73% rename from packages/uikit-workshop/src/sass/scss/abstracts/_variables.scss rename to packages/uikit-workshop/src/sass/scss/01-abstracts/_variables.scss index 2f21048fa..3e663d412 100644 --- a/packages/uikit-workshop/src/sass/scss/abstracts/_variables.scss +++ b/packages/uikit-workshop/src/sass/scss/01-abstracts/_variables.scss @@ -18,15 +18,15 @@ $pl-color-gray-70: #4d4c4c; $pl-color-gray-87: #222; $pl-color-black: #000; -$pl-color-trans-white-25: rgba(255,255,255,0.25); +$pl-color-trans-white-25: rgba(255, 255, 255, 0.25); -$pl-color-state-info: #02A4D5; -$pl-color-state-complete: #03790F; -$pl-color-state-inreview: #C7A118; -$pl-color-state-deprecated: #B00B02; +$pl-color-state-info: #02a4d5; +$pl-color-state-complete: #03790f; +$pl-color-state-inreview: #c7a118; +$pl-color-state-deprecated: #b00b02; // Font Family -$pl-font: "HelveticaNeue", "Helvetica", "Arial", sans-serif; +$pl-font: 'HelveticaNeue', 'Helvetica', 'Arial', sans-serif; // Font sizes $pl-font-size-sm: 0.7rem; @@ -36,7 +36,7 @@ $pl-font-size-large: 1.2rem; // Spacing & Padding $pl-space: 1rem; -$pl-doublespace: $pl-space*2; +$pl-doublespace: $pl-space * 2; $pl-pad: 1rem; $pl-pad-half: $pl-pad/2; $offset-top: 2rem; @@ -51,4 +51,4 @@ $pl-animate-quick: 0.1s; // Borders $pl-border-radius: 3px; -$pl-border-radius-med: 6px; \ No newline at end of file +$pl-border-radius-med: 6px; diff --git a/packages/uikit-workshop/src/sass/scss/base/_body.scss b/packages/uikit-workshop/src/sass/scss/02-base/_body.scss similarity index 65% rename from packages/uikit-workshop/src/sass/scss/base/_body.scss rename to packages/uikit-workshop/src/sass/scss/02-base/_body.scss index 67fc00a39..6f37d3e27 100644 --- a/packages/uikit-workshop/src/sass/scss/base/_body.scss +++ b/packages/uikit-workshop/src/sass/scss/02-base/_body.scss @@ -8,8 +8,11 @@ * 2) Styled as IDs to avoid collisions with user tag */ .pl-c-body { - margin: 0; - padding: 0; - background: $pl-color-gray-13; - -webkit-text-size-adjust: 100%; -} \ No newline at end of file + margin: 0; + padding: 0; + background: $pl-color-gray-13; + -webkit-text-size-adjust: 100%; + display: flex; + flex-direction: column; + height: 100vh; +} diff --git a/packages/uikit-workshop/src/sass/scss/base/_reset.scss b/packages/uikit-workshop/src/sass/scss/02-base/_reset.scss similarity index 78% rename from packages/uikit-workshop/src/sass/scss/base/_reset.scss rename to packages/uikit-workshop/src/sass/scss/02-base/_reset.scss index 8e8487f63..203b0f8fb 100644 --- a/packages/uikit-workshop/src/sass/scss/base/_reset.scss +++ b/packages/uikit-workshop/src/sass/scss/02-base/_reset.scss @@ -11,7 +11,7 @@ * going to default to this. */ .pl-c-body * { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} \ No newline at end of file + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} diff --git a/packages/uikit-workshop/src/sass/scss/03-vendor/_prism.scss b/packages/uikit-workshop/src/sass/scss/03-vendor/_prism.scss new file mode 100644 index 000000000..75b13e0f4 --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/03-vendor/_prism.scss @@ -0,0 +1,183 @@ +/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+handlebars+php+php-extras+twig&plugins=line-numbers+autolinker */ +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ + +code[class*='language-'], +pre[class*='language-'] { + color: black; + text-shadow: 0 1px white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*='language-']::-moz-selection, +pre[class*='language-'] ::-moz-selection, +code[class*='language-']::-moz-selection, +code[class*='language-'] ::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} + +pre[class*='language-']::selection, +pre[class*='language-'] ::selection, +code[class*='language-']::selection, +code[class*='language-'] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + code[class*='language-'], + pre[class*='language-'] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*='language-'] { + padding: 1em; + margin: 0.5em 0; + overflow: auto; +} + +:not(pre) > code[class*='language-'], +pre[class*='language-'] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre) > code[class*='language-'] { + padding: 0.1em; + border-radius: 0.3em; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: 0.7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #a67f59; + background: hsla(0, 0%, 100%, 0.5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function { + color: #dd4a68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + +pre.line-numbers { + position: relative; + padding-left: 3.8em; + counter-reset: linenumber; +} + +pre.line-numbers > code { + position: relative; +} + +.line-numbers .line-numbers-rows { + position: absolute; + pointer-events: none; + top: 0; + font-size: 100%; + left: -3.8em; + width: 3em; /* works for line-numbers below 1000 lines */ + letter-spacing: -1px; + border-right: 1px solid #999; + + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.line-numbers-rows > span { + pointer-events: none; + display: block; + counter-increment: linenumber; +} + +.line-numbers-rows > span:before { + content: counter(linenumber); + color: #999; + display: block; + padding-right: 0.8em; + text-align: right; +} +.token a { + color: inherit; +} diff --git a/packages/uikit-workshop/src/sass/scss/03-vendor/_typeahead.scss b/packages/uikit-workshop/src/sass/scss/03-vendor/_typeahead.scss new file mode 100644 index 000000000..bafd864af --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/03-vendor/_typeahead.scss @@ -0,0 +1,94 @@ +/*------------------------------------*\ + #TWITTER TYPEAHEAD +\*------------------------------------*/ +/** + * Using Twitter Typeahead to autocomplete pattern + * searches. https://twitter.github.io/typeahead.js/ + * 1) Wrapped in pl-c-header to contain styles for projects that + * might already be using Typeahead +*/ + +.pl-c-header { + /** + * Typeahead input + * 1) the primary DOM element that initiates the JS library + */ + .pl-c-typeahead { + border: 0; + background: $pl-color-gray-87 !important; + color: $pl-color-gray-50; + width: 100%; + right: 0; + padding: 0.61rem 0.5rem; + font-size: inherit; + + &:focus { + background: $pl-color-gray-50; + color: $pl-color-white; + } + } + + /** + * Typeahead wrapper + * 1) This is the JS-generated wrapper around the input + * 2) Display after nav list items for horizontal theme + */ + .twitter-typeahead { + display: flex !important; + order: 2; /* 2 */ + width: 100%; + } + + .tt-input { + background: $pl-color-gray-50; + color: $pl-color-white; + + &:hover { + color: $pl-color-white; + background: $pl-color-gray-87 !important; + + &::-webkit-input-placeholder { + color: $pl-color-white; + } + + &::-moz-input-placeholder { + color: $pl-color-white; + } + } + + &:focus { + border-radius: 0; + text-transform: lowercase; + color: $pl-color-white; + background: $pl-color-gray-87; + outline: 1px dotted $pl-color-gray-50; + outline-offset: -1px; + } + } + + .tt-hint { + text-transform: lowercase; + } + + .tt-menu { + text-transform: lowercase; + background-color: $pl-color-gray-50; + width: 100%; + border-bottom-right-radius: $pl-border-radius-med; + border-bottom-left-radius: $pl-border-radius-med; + } + + .tt-suggestion { + color: $pl-color-gray-07; + padding: 0.8em; + } + + .tt-suggestion.tt-cursor { + color: $pl-color-white; + background: $pl-color-trans-white-25; + } + + .tt-suggestion p { + margin: 0; + } +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_annotations.scss b/packages/uikit-workshop/src/sass/scss/04-components/_annotations.scss new file mode 100644 index 000000000..54ac10c9b --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_annotations.scss @@ -0,0 +1,131 @@ +@charset "UTF-8"; + +/*------------------------------------*\ + #ANNOTATIONS +\*------------------------------------*/ + +/** + * Annotated elements styles + * 1) Annotation styles that appear inside the iframe + * 2) For elements in the DOM that have an annotation, we want to + * provide styles that help the user understand that annotations are available. + * We do this with some cursor helpers and a + */ +.pl-has-annotation { + cursor: help !important; + outline: 1px dotted $pl-color-gray-50; + outline-offset: -4px; + transition: box-shadow $pl-animate-quick ease; + + a, + input { + cursor: help !important; + } + + &:hover { + box-shadow: 0 0 3px $pl-color-gray-50; + } + + &.active { + box-shadow: inset 0 0 6px $pl-color-gray-70; + outline: 1px dotted $pl-color-gray-50; + outline-offset: -1px; + } +} + +/** + * Annotation tooltip + * 1) Appears inside the iframe over any element that has an + * anootation attached to it. + * 2) Annotation tip gets dynamically set to `display: none` via + * JavaScript + */ +.pl-c-annotation-tip { + display: flex; /* 2 */ + align-items: center; + justify-content: center; + width: 24px !important; + height: 24px !important; + margin-top: 6px !important; + margin-left: 6px !important; + border-radius: 50% !important; + background: $pl-color-gray-87 !important; + color: $pl-color-white !important; + font-size: 16px !important; + position: absolute; + z-index: 100; +} + +/*------------------------------------*\ + #ANNOTATIONS INSIDE MODAL +\*------------------------------------*/ + +/** + * Annotations area + * 1) Appears inside of modal + */ +.pl-c-annotations { + margin: 1rem 0; +} + +/** + * Annotations Title + * Says the word "Annotations" + */ +.pl-c-annotations__title { + font-size: 1.2rem !important; + margin: 0 0 0.5rem; +} + +/** + * Annotations list + * 1) Ordered list of annotations + * 2) Presented with parent selector to force styles + * over pl-c-text-passage + */ +.pl-c-annotations .pl-c-annotations__list { + counter-reset: the-count; + padding: 0; + margin: 0; + list-style: none; +} + +/** + * Annotations list item + * 1) Displays each item as a number + */ +.pl-c-annotations__item { + position: relative; + padding-left: 1.5rem; + margin-bottom: 1rem; + border-radius: $pl-border-radius-med; + transition: background $pl-animate-quick ease; + + &:before { + content: counter(the-count); + counter-increment: the-count; + font-size: 85%; + display: flex; + align-items: center; + justify-content: center; + width: 14px; + height: 14px; + border-radius: 50%; + padding: 2px; + text-align: center; + background: $pl-color-gray-50; + color: $pl-color-white; + position: absolute; + top: 4px; + left: 0; + } + + &.pl-is-active { + outline: 1px dotted $pl-color-gray-50; + outline-offset: -1px; + } +} + +.pl-c-annotations .pl-c-annotations__item-title { + margin-bottom: 0; +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_breadcrumbs.scss b/packages/uikit-workshop/src/sass/scss/04-components/_breadcrumbs.scss new file mode 100644 index 000000000..ae1cb8f19 --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_breadcrumbs.scss @@ -0,0 +1,32 @@ +@charset "UTF-8"; + +/*------------------------------------*\ + #BREADCRUMBS +\*------------------------------------*/ + +/** + * 1) Breadcrumbs display a pattern's path inside the modal + */ +.pl-c-breadcrumb { + @include listReset(); + margin-bottom: 0.5rem; + display: flex; + font-size: $pl-font-size-sm; + color: $pl-color-gray-50; + text-transform: capitalize; +} + +/** + * Breadcrumb Item + */ +.pl-c-breadcrumb__item { + &:after { + content: '\25b6'; + opacity: 0.4; + font-size: 6px; + display: inline-block; + margin: 0 0.2rem; + position: relative; + top: -1px; + } +} diff --git a/packages/uikit-workshop/src/sass/scss/components/_controls.scss b/packages/uikit-workshop/src/sass/scss/04-components/_controls.scss similarity index 65% rename from packages/uikit-workshop/src/sass/scss/components/_controls.scss rename to packages/uikit-workshop/src/sass/scss/04-components/_controls.scss index f209922a7..224c5dc76 100644 --- a/packages/uikit-workshop/src/sass/scss/components/_controls.scss +++ b/packages/uikit-workshop/src/sass/scss/04-components/_controls.scss @@ -7,16 +7,16 @@ * 2) Right-align inside of header */ .pl-c-controls { - margin-left: auto; /* 2 */ - display: flex; - flex-wrap: nowrap; + margin-left: auto; /* 2 */ + display: flex; + flex-wrap: nowrap; } /** * Control list */ .pl-c-controls__list { - @include listReset(); - display: flex; - flex-wrap: nowrap; -} \ No newline at end of file + @include listReset(); + display: flex; + flex-wrap: nowrap; +} diff --git a/packages/uikit-workshop/src/sass/scss/components/_header.scss b/packages/uikit-workshop/src/sass/scss/04-components/_header.scss similarity index 54% rename from packages/uikit-workshop/src/sass/scss/components/_header.scss rename to packages/uikit-workshop/src/sass/scss/04-components/_header.scss index cc91bd608..f063865b3 100644 --- a/packages/uikit-workshop/src/sass/scss/components/_header.scss +++ b/packages/uikit-workshop/src/sass/scss/04-components/_header.scss @@ -9,16 +9,17 @@ * 2) Display nav and controls horizontally */ .pl-c-header { - position: fixed; - top: 0; - left: 0; - z-index: 4; - display: flex; /* 2 */ - width: 100%; - background: $pl-color-black; - color: $pl-color-gray-50; - font-family: $pl-font; - font-size: $pl-font-size-sm; + position: fixed; + position: sticky; + top: 0; + left: 0; + z-index: 4; + display: flex; /* 2 */ + width: 100%; + background: $pl-color-black; + color: $pl-color-gray-50; + font-family: $pl-font; + font-size: $pl-font-size-sm; } /** @@ -26,11 +27,11 @@ * 1) Styles for the general nav toggle button, which * only appears on small screens */ - .pl-c-header__nav-toggle { - @include linkStyle(); - border: 0; +.pl-c-header__nav-toggle { + @include linkStyle(); + border: 0; - @media all and (min-width: $pl-bp-med) { - display: none; - } -} \ No newline at end of file + @media all and (min-width: $pl-bp-med) { + display: none; + } +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_ish-sizing.scss b/packages/uikit-workshop/src/sass/scss/04-components/_ish-sizing.scss new file mode 100644 index 000000000..55d236f70 --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_ish-sizing.scss @@ -0,0 +1,87 @@ +/*------------------------------------*\ + #ISH SIZING +\*------------------------------------*/ + +/** + * Viewport size form + * 1) This is the form for the form that houses the current + * viewport size in px and em + */ +.pl-c-viewport-size { + margin: 0; + border: 0; + padding: 0.3rem 0.5rem 0.4rem; + line-height: 1; + display: flex; + align-items: center; +} + +/** + * Size input fields + */ +.pl-c-viewport-size__input { + padding: 0.1rem; + margin: 0; + border: 0; + border-radius: $pl-border-radius; + background: transparent; + font-size: inherit; + color: $pl-color-gray-50; + width: 35px; + text-align: right; + transition: all $pl-animate-quick ease-out; + + &::-moz-focus-inner { + padding: 0; + border: 0; + } + + &:hover { + color: $pl-color-white; + background: $pl-color-gray-87; + } + + &:active, + &:focus { + color: $pl-color-white; + background: $pl-color-gray-87; + outline: 1px dotted $pl-color-gray-50; + outline-offset: -1px; + } +} + +/** + * Size input labels + */ +.pl-c-viewport-size__label { + display: block; + margin: 0; + padding: 0; +} + +/** + * Size options + * 1) This holds the S, M, L, Rand, Disco links + * 2) Depending on the config, these number of options may be + * larger or smaller. + */ +.pl-c-size-list { + display: none; + list-style: none; + margin: 0; + padding: 0; + + @media all and (min-width: $pl-bp-large) { + display: block; + display: flex; + align-items: center; + } +} + +/** + * Size actions + * 1) These are the buttons that control the viewport resizing + */ +.pl-c-size-list__action { + @include linkStyle(); +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_logo.scss b/packages/uikit-workshop/src/sass/scss/04-components/_logo.scss new file mode 100644 index 000000000..4e1fd867c --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_logo.scss @@ -0,0 +1,27 @@ +/*------------------------------------*\ + #LOGO +\*------------------------------------*/ + +/** + * 1) An optional logo that lives in PL's header. + * 2) Displayed as a link + */ +.pl-c-logo { + max-width: 2rem; + margin: 0 1rem; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + + &:focus { + outline: 1px dotted $pl-color-gray-50; + outline-offset: -1px; + } +} + +.pl-c-logo__img { + display: block; + max-width: 100%; + height: auto; +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_modal.scss b/packages/uikit-workshop/src/sass/scss/04-components/_modal.scss new file mode 100644 index 000000000..36afcb41b --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_modal.scss @@ -0,0 +1,151 @@ +/*------------------------------------*\ + #MODAL +\*------------------------------------*/ + +/** + * 1) The modal slides up from the bottom of the viewport when + * "show pattern info" is selected on the pattern detail screen. + */ +.pl-c-modal { + display: flex; + flex-direction: column; + font-family: $pl-font; + background: $pl-color-black; + color: $pl-color-gray-20; + position: relative; + top: auto; + bottom: 0; + left: 0; + z-index: 5; + width: 100%; + height: 0; + transition: transform 0.3s ease, height 0.3s ease; + transform: translate3d(0, 100%, 0); + pointer-events: none; + will-change: height, transform; + overflow: hidden; + + /** + * Active modal + */ + &.pl-is-active { + transform: translate3d(0, 0, 0); + height: 50vh; // default height unless manually resized + transition: transform 0.3s ease; + pointer-events: auto; + } +} + +.pl-c-modal__toolbar { + display: flex; +} + +/** + * Modal close button + * 1) Closes the modal popup + */ +.pl-c-modal__close-btn { + font-size: 70%; + background: $pl-color-black; + color: $pl-color-gray-50; + border: 0; + border-radius: $pl-border-radius-med $pl-border-radius-med 0 0; + display: inline-block; + padding: 0.5rem 0.5rem 0.3rem; + margin: 0; + text-decoration: none; + cursor: pointer; + z-index: 2; + transition: all $pl-animate-quick ease-out; + + &:hover, + &:focus { + background: $pl-color-gray-87; + color: $pl-color-white; + } + + &:focus, + &:active { + outline: 1px dotted $pl-color-gray-50; + outline-offset: -2px; + } + + /** + * Modal close button inside active modal + * 1) Move modal button outside of the modal window + */ + .pl-c-modal.pl-is-active & { + bottom: 100%; /* 1 */ + } +} + +.pl-c-modal__cover { + width: 100%; + height: 100%; + display: none; + position: absolute; + z-index: 20; + cursor: move; +} + +.pl-c-modal__resizer { + display: flex; + align-items: center; + justify-content: center; + left: 0; + height: 14px; + width: 100%; + background: $pl-color-black; + z-index: 2; + cursor: ns-resize; + + &:after { + content: ''; + height: 3px; + width: 50px; + border-top: 1px solid $pl-color-gray-50; + border-bottom: 1px solid $pl-color-gray-50; + transition: border-color $pl-animate-quick ease-out; + } + + &:hover:after, + &:focus:after { + border-color: $pl-color-white; + } +} + +/** + * Close button icon + * 1) Displayed as an e + */ +.pl-c-modal__close-btn-icon { + width: 12px; + height: 12px; + color: currentColor; + fill: currentColor; + transition: fill $pl-animate-quick ease-out; +} + +.pl-c-code-copy-btn { + display: inline-block; + position: absolute; + top: 0.5rem; + right: 0.5rem; + padding: 0.2rem 0.4rem; + background: $pl-color-gray-07; + color: $pl-color-gray-87; + border: 1px solid $pl-color-gray-13; + border-radius: $pl-border-radius-med; + font-family: $pl-font; + font-size: $pl-font-size-norm; + text-transform: lowercase; + line-height: 1; + cursor: pointer; + z-index: 2; + transition: background $pl-animate-quick ease-out; + + &:hover, + &:focus { + background: $pl-color-gray-20; + } +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_navigation.scss b/packages/uikit-workshop/src/sass/scss/04-components/_navigation.scss new file mode 100644 index 000000000..0ce861cea --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_navigation.scss @@ -0,0 +1,189 @@ +/*------------------------------------*\ + #NAVIGATION +\*------------------------------------*/ + +/** + * Navigation container + * 1) Collapse height on small screens. Menu trigger button + * activates nav + */ +.pl-c-nav { + @media all and (max-width: $pl-bp-med) { + position: absolute; + top: 100%; + width: 100%; + overflow: hidden; + max-height: 0; /* 1 */ + background: $pl-color-black; + display: flex; + flex-direction: column; + transition: max-height $pl-animate-quick ease-out; + + /** + * Active navigaiton + * 1) Slide + * 2) Set the height to the vierport height minus the height + * of the header + */ + &.pl-is-active { + max-height: 50rem; /* 1 */ + height: calc(100vh - #{$offset-top}); /* 2 */ + overflow: auto; + @include hideScrollBar(); + } + } + + @media all and (min-width: $pl-bp-med) { + display: flex; + } +} + +/** + * Nav list + * 1) appears as an
    + * 2) display as a horizontal list on larger screens + * 3) On small screens, move the nav list after the typeahead form field + */ +.pl-c-nav__list { + z-index: 1; + margin: 0; + padding: 0; + list-style: none; + + @media all and (max-width: $pl-bp-med) { + order: 2; /* 3 */ + } + + @media all and (min-width: $pl-bp-med) { + display: flex; /* 2 */ + } +} + +/** + * Nav list item + */ +.pl-c-nav__item { + cursor: pointer; + position: relative; +} + +/** + * Last sublist item + */ +.pl-c-nav__sublist > .pl-c-nav__item:last-child { + @media all and (min-width: $pl-bp-med) { + overflow: hidden; + border-bottom-left-radius: $pl-border-radius-med; + border-bottom-right-radius: $pl-border-radius-med; + } +} + +/** + * Nav link + */ +.pl-c-nav__link { + display: flex; + align-items: center; + @include linkStyle(); +} + +/** + * Nav sublink + * 1) Visually differentiate sub-item links from + * the other links. Creates better hierarchy. + */ +.pl-c-nav__link--sublink { + text-transform: none; + padding-left: 1rem; +} + +/** + * Nav link + */ +.pl-c-nav__link--dropdown { + /** + * Dropdown caret after accordion handle + */ + &:after { + content: '\25bc'; + color: $pl-color-trans-white-25; + display: inline-block; + font-size: 7px; + position: relative; + top: 1px; + right: -2px; + transition: all $pl-animate-quick ease-out; + } + + &:hover, + &:focus { + &:after { + color: $pl-color-gray-50; + } + } + + /** + * Active dropdown + */ + &.pl-is-active { + color: $pl-color-white; + background: $pl-color-gray-87; + + /** + * Caret rotation and positioning in active dropdown + */ + &:after { + color: $pl-color-gray-50; + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); + } + } +} + +/** + * Nav sublist + * 1) On larger screens, display as dropdowns that + * hang over the header + */ +.pl-c-nav__sublist { + @include listReset(); + + @media all and (min-width: $pl-bp-med) { + position: absolute; + top: 100%; /* 1 */ + left: 0; + min-width: 10rem; + overflow: hidden; + border-bottom-left-radius: $pl-border-radius-med; + border-bottom-right-radius: $pl-border-radius-med; + } +} + +/** + * Dropdown sublist + */ +.pl-c-nav__sublist--dropdown, +.pl-c-nav__subsublist--dropdown { + @include listReset(); + @include accordionPanel(); +} + +/** + * Dropdown sublist + * 1) Set the height to the viewport height minus the height of the header + */ +.pl-c-nav__sublist--dropdown.pl-is-active { + @media all and (min-width: $pl-bp-med) { + height: calc(100vh - #{$offset-top}); /* 1 */ + } +} + +/** + * Sub-navigation + * 1) Third-level links are stylistically different + * than first and second nav links. + */ +.pl-c-nav__subsublist { + @include listReset(); +} diff --git a/packages/uikit-workshop/src/sass/scss/components/_pattern-category.scss b/packages/uikit-workshop/src/sass/scss/04-components/_pattern-category.scss similarity index 60% rename from packages/uikit-workshop/src/sass/scss/components/_pattern-category.scss rename to packages/uikit-workshop/src/sass/scss/04-components/_pattern-category.scss index 331006f18..abe9d6142 100644 --- a/packages/uikit-workshop/src/sass/scss/components/_pattern-category.scss +++ b/packages/uikit-workshop/src/sass/scss/04-components/_pattern-category.scss @@ -9,29 +9,29 @@ * 2) The category contains a title and optional description */ .pl-c-category { - margin-top: 6rem; - font: $pl-font !important; + margin-top: 6rem; + font: $pl-font !important; - &:first-of-type { - margin-top: 2rem; - } + &:first-of-type { + margin-top: 2rem; + } } /** * Pattern Category Title */ .pl-c-category__title { - font-size: 1.4rem !important; - color: $pl-color-gray-87 !important; - margin: 0 0 0.2rem; - text-transform: capitalize; + font-size: 1.4rem !important; + color: $pl-color-gray-87 !important; + margin: 0 0 0.2rem; + text-transform: capitalize; } /** * Pattern Category Link */ .pl-c-category__title-link { - transition: color $pl-animate-quick ease-out; + transition: color $pl-animate-quick ease-out; } /** @@ -40,11 +40,11 @@ * 2) Hide the pattern category description is it's empty */ .pl-c-category__description { - font-size: $pl-font-size-sm-2; - line-height: 1.5; - max-width: 30rem; + font-size: $pl-font-size-sm-2; + line-height: 1.5; + max-width: 30rem; - &:empty { - display: none; /* 2 */ - } -} \ No newline at end of file + &:empty { + display: none; /* 2 */ + } +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_pattern-info.scss b/packages/uikit-workshop/src/sass/scss/04-components/_pattern-info.scss new file mode 100644 index 000000000..5e6c28700 --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_pattern-info.scss @@ -0,0 +1,145 @@ +/*------------------------------------*\ + #PATTERN INFO +\*------------------------------------*/ + +/** + * 1) Pattern info contains two side-by-side panels that + * house a pattern's information, such as title, lineage, + * code, annotations, and more. + */ +.pl-c-pattern-info { + @media all and (min-width: $pl-bp-large) { + display: flex; + } + + /** + * Pattern info inside the "view all" template + */ + .pl-c-pattern & { + max-height: 20rem; + overflow: scroll; + @include hideScrollBar(); + + @media all and (min-width: $pl-bp-large) { + max-height: none; + height: 18rem; + overflow: visible; + } + } + + /** + * Pattern info inside modal + */ + .pl-c-modal & { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + overflow: scroll; + @include hideScrollBar(); + + @media all and (min-width: $pl-bp-large) { + position: static; + overflow: visible; + } + } +} + +/** + * Pattern Info Panel + * 1) Individual panel. Left side contains pattern info + * Right side contains pattern code + */ +.pl-c-pattern-info__panel { + padding: 1rem; + + @media all and (min-width: $pl-bp-large) { + flex: auto; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + } + + .pl-c-modal & { + @media all and (min-width: $pl-bp-xl) { + padding-left: 2rem; + } + } +} + +/** + * Pattern Info Panel + * 1) Left panel that contains pattern title, lineage, description, annotations + */ +.pl-c-pattern-info__panel--info { + padding-top: 2rem; + + @media all and (min-width: $pl-bp-large) { + left: 0; + right: 50%; + overflow: scroll; + @include hideScrollBar(); + } + + @media all and (min-width: $pl-bp-xl) { + right: 55%; + } +} + +/** + * Pattern Code Panel + * 1) Right panel that displays the pattern's code (found in _tabs.scss) + * 2) Using a sibling selector because the pattern info isn't always present. + * The sibling selector allows the code panel to occupy the full width of + * the modal + * 1) Cap the height of the code panel in the modal + */ +.pl-c-pattern-info__panel--info + .pl-c-pattern-info__panel--code { + @media all and (min-width: $pl-bp-large) { + right: 0; + left: 50%; + top: 1.2rem; + } + + @media all and (min-width: $pl-bp-xl) { + left: 45%; + } +} + +/** + * Pattern Header inside modal + */ +.pl-c-pattern-info__header { + margin-bottom: 0.5rem; +} + +/** + * Pattern Title inside modal + */ +.pl-c-pattern-info__title { + font-size: 1.4rem !important; + font-weight: normal; + margin-top: 0; + margin-bottom: 0; + color: inherit; + text-transform: capitalize; + display: inline-flex; + align-items: center; +} + +/** + * Pattern Description inside modal + */ +.pl-c-pattern-info__description { + border-bottom-color: $pl-color-gray-50; +} + +/** + * Pattern Annotations inside modal + */ +.pl-c-annotations { + border-top-color: $pl-color-gray-50; +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_pattern-lineage.scss b/packages/uikit-workshop/src/sass/scss/04-components/_pattern-lineage.scss new file mode 100644 index 000000000..a3e12f881 --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_pattern-lineage.scss @@ -0,0 +1,29 @@ +/*------------------------------------*\ + #PATTERN LINEAGE +\*------------------------------------*/ + +/** + * Pattern Lineage info + */ +.pl-c-lineage { + font-size: $pl-font-size-sm-2; + line-height: 1.7; + margin-top: 0; +} + +/** + * Lineage link + */ +.pl-c-lineage__link { + font-style: italic; + color: $pl-color-gray-50; + text-decoration: underline; + display: inline-flex; + align-items: center; + transition: opacity $pl-animate-quick ease; + + &:hover, + &:focus { + opacity: 0.8; + } +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_pattern-states.scss b/packages/uikit-workshop/src/sass/scss/04-components/_pattern-states.scss new file mode 100644 index 000000000..82f2663bb --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_pattern-states.scss @@ -0,0 +1,40 @@ +/*------------------------------------*\ + #PATTERN STATES +\*------------------------------------*/ + +/** +* Pattern states add color-coded dots next to patterns +* in the dropdown navigation. +*/ +.pl-c-pattern-state { + display: inline-block; + width: 5px; + height: 5px; + margin-left: 10px; + position: relative; + top: 5px; + left: 0; + border-radius: 50%; + background: $pl-color-state-info; + line-height: 4px; + text-indent: 10px; + + &--complete { + background: $pl-color-state-complete; + } + + &--inreview { + background: $pl-color-state-inreview; + } + + &--deprecated { + background: $pl-color-state-deprecated; + } +} + +/** +* Complete state +*/ +.complete:before { + color: #03790f !important; +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_pattern.scss b/packages/uikit-workshop/src/sass/scss/04-components/_pattern.scss new file mode 100644 index 000000000..c07706733 --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_pattern.scss @@ -0,0 +1,131 @@ +/*------------------------------------*\ + #PATTERN +\*------------------------------------*/ + +/** +* Pattern +* 1) This is an individual pattern that appears in the "view all" template. +* It contains pattern title and toggle to view more information, such as +* description, lineage, code, etc. +* 2) Prevents absolutely-positioned elements from floating to the top +* 3) Prevents floated patterns from floating wraps +*/ +.pl-c-pattern { + margin-bottom: $pl-doublespace; + position: relative; /* 2 */ + clear: both; /* 3 */ +} + +/** +* Pattern Header +*/ +.pl-c-pattern__header { + position: relative; + padding: 0.5rem 0 0; + line-height: 1.3; + font-size: 90%; + color: $pl-color-gray-50; + + &:empty { + padding: 0; + } +} + +/** + * Pattern Title + */ +.pl-c-pattern__title { + font-family: $pl-font !important; + font-size: 0.85rem !important; + line-height: 1 !important; + font-weight: normal !important; + margin: 0 !important; + padding: 0 !important; + text-transform: capitalize !important; +} + +/** + * Pattern Title Link + * 1) Vertically align pattern label and pattern state badge + */ +.pl-c-pattern__title-link { + display: inline-flex; /* 1 */ + align-items: flex-start; /* 1 */ + padding: $pl-pad 0 0.3rem; + color: $pl-color-gray-50 !important; + text-decoration: none; + cursor: pointer; + + &:hover, + &:focus { + color: $pl-color-black !important; + } +} + +/** +* Pattern Extra Toggle Button +* 1) This is the button that twirls down extra pattern info +*/ +.pl-c-pattern__extra-toggle { + font-size: 9px; + position: absolute; + bottom: -1px; + right: 0; + z-index: 1; + padding: 0.65em 0.65em 0.5em; + line-height: 1; + color: $pl-color-gray-50; + background: transparent; + font-weight: normal; + border: 1px solid $pl-color-gray-13; + border-top-left-radius: $pl-border-radius-med; + border-top-right-radius: $pl-border-radius-med; + transition: background $pl-animate-quick ease-out; + + .pl-c-pattern__toggle-icon { + display: inline-block; + } + + &:hover, + &:focus, + &.pl-is-active { + background: $pl-color-gray-02; + color: $pl-color-black; + } + + &:focus { + outline: 1px dotted $pl-color-gray-70; + } + + &.pl-is-active { + border-bottom-color: $pl-color-gray-02; + + .pl-c-pattern__toggle-icon { + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); + } + } +} + +/** +* Pattern Extra +* 1) This is the info panel that contains extra pattern info +* like pattern description, lineage, code, and more +*/ +.pl-c-pattern__extra { + background: $pl-color-gray-02; + border-top: 1px solid $pl-color-gray-13; + margin-bottom: $pl-space; + overflow: hidden; + max-height: 1px; + position: relative; + transition: all $pl-animate-quick ease-out; + + &.pl-is-active { + border: 1px solid $pl-color-gray-13; + border-radius: $pl-border-radius-med; + border-top-right-radius: 0; + max-height: 150rem; + } +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_tabs.scss b/packages/uikit-workshop/src/sass/scss/04-components/_tabs.scss new file mode 100644 index 000000000..51740b3d1 --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_tabs.scss @@ -0,0 +1,137 @@ +/*------------------------------------*\ + #TABS +\*------------------------------------*/ + +/** + * 1) Tabs contain a set of horizontally-arranged tabs + * with accompanying panels. When a tab link is clicked + * the corresponding panel becomes visible + */ +.pl-c-tabs { + padding: 0 0.5rem 0.5rem; + background: $pl-color-white; + border: 1px solid $pl-color-gray-13; + border-radius: $pl-border-radius-med; + font-family: $pl-font; + position: relative; + display: flex; + flex-direction: column; + overflow: hidden; + + /** + * Tabs inside a code panel + */ + .pl-c-pattern-info__panel--code & { + @media all and (min-width: $pl-bp-large) { + position: absolute; + top: 1rem; + bottom: 1rem; + left: 1rem; + right: 1rem; + } + } + + .pl-c-modal & { + @media all and (min-width: $pl-bp-xl) { + right: 2rem; + left: 2rem; + } + } +} + +/** + * Tab List + * 1) A unordered list that contains the tab links + */ +.pl-c-tabs__list { + display: flex; + width: 100%; + list-style: none; + margin: 0; + padding: 0.5rem 0; + background: $pl-color-white; +} + +/** + * Tab Link + */ +.pl-c-tabs__link { + display: block; + line-height: 1; + padding: 0.2rem 0.4rem; + border: 1px solid transparent; + border-radius: $pl-border-radius-med; + background: $pl-color-white; + color: $pl-color-gray-50; + cursor: pointer; + text-decoration: none; + text-transform: lowercase; + transition: all $pl-animate-quick ease-out; + + &:hover { + color: $pl-color-gray-87; + } + + /** + * Active Tab + * 1) Note: the active tab color corresponds with the Prism code block + * background color, which is why it doesn't use a Sass variable + */ + &.pl-is-active-tab { + color: $pl-color-gray-87; + background: $pl-color-gray-07; + border: 1px solid $pl-color-gray-13; + } +} + +/** + * Tab Content + * 1) Tab content contains the tab panels + */ +.pl-c-tabs__content { + flex: 1 0 auto; + overflow: scroll; + @include hideScrollBar(); + height: 100%; + padding-top: 0.5rem; + + /** + * Tab content inside modal + */ + .pl-c-modal & { + border: 0; + } +} + +/** + * Tab panel + * 1) Note: the active tab color corresponds with the Prism code block + * background color, which is why it doesn't use a Sass variable + */ +.pl-c-tabs__panel { + display: none; + min-height: 12rem; + + &.pl-is-active-tab { + display: block; + } + + /** + * Tab code + * 1) Targeting pre tag in here as Prism is being used for the majority of the styles + */ + pre[class*='language-'], + :not(pre) > code[class*='language-'], + pre[class*='language-'] { + background: transparent; + margin: 0; + padding: 0; + border: 0; + display: block; + } + + code[class*='language-'] { + background: transparent; + margin: 0; + } +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_text-passage.scss b/packages/uikit-workshop/src/sass/scss/04-components/_text-passage.scss new file mode 100644 index 000000000..82d9eb4e8 --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_text-passage.scss @@ -0,0 +1,135 @@ +/*------------------------------------*\ + #TEXT PASSAGE +\*------------------------------------*/ + +/** + * 1) A passage of text which includes free-form tags (ul, blockquote, p, h2, etc) + * generated by markdown + */ +.pl-c-text-passage { + font-size: $pl-font-size-sm-2; + line-height: 1.7; + + p { + margin-top: 0; + margin-bottom: 1rem; + } + + /** + * Link within the text passage + */ + a { + color: $pl-color-gray-50; + text-decoration: underline; + transition: opacity $pl-animate-quick ease; + + &:hover, + &:focus { + opacity: 0.8; + } + } + + /** + * Code + */ + code[class*='language-'], + pre[class*='language-'] { + color: inherit; + } + + /** + * Blockquote within text passage + */ + blockquote { + padding-left: 0.8rem; + border-left: 3px solid inherit; + } + + /** + * Horizontal rule + */ + hr { + height: 1px; + background: $pl-color-gray-50; + margin: 2rem 0; + border: 0; + } + + /** + * First-level heading within text passage + */ + h1 { + margin-bottom: 1rem; + font-weight: normal; + } + + /** + * Second-level heading within text passage + */ + h2 { + margin: 1rem 0 1rem; + font-weight: normal; + } + + /** + * Third-level heading within text passage + */ + h3 { + margin: 1rem 0 1rem; + font-weight: normal; + } + + /** + * Fourth-level heading within text passage + */ + h4 { + margin: 1rem 0 1rem; + font-weight: normal; + } + + /** + * Fifth-level heading within text passage + */ + h5 { + margin: 1rem 0 1rem; + font-weight: normal; + } + + /** + * Sixth-level heading within text passage + */ + h6 { + margin: 1rem 0 1rem; + font-weight: normal; + } + + /** + * Unordered list within text passage + */ + ul { + list-style: square; + margin-left: 0.9rem; + margin-bottom: 1rem; + + li:last-child { + margin-bottom: 0; + } + } + + /** + * Ordered list within text passage + */ + ol { + list-style: decimal; + margin-left: 0.9rem; + margin-bottom: 1rem; + + li:last-child { + margin-bottom: 0; + } + } + + li { + margin-bottom: 0.5rem; + } +} diff --git a/packages/uikit-workshop/src/sass/scss/components/_tools.scss b/packages/uikit-workshop/src/sass/scss/04-components/_tools.scss similarity index 54% rename from packages/uikit-workshop/src/sass/scss/components/_tools.scss rename to packages/uikit-workshop/src/sass/scss/04-components/_tools.scss index 3a9d688e7..992e0370f 100644 --- a/packages/uikit-workshop/src/sass/scss/components/_tools.scss +++ b/packages/uikit-workshop/src/sass/scss/04-components/_tools.scss @@ -8,8 +8,8 @@ * new window and view the documentation */ .pl-c-tools { - position: relative; - display: flex; + position: relative; + display: flex; } /** @@ -18,15 +18,15 @@ * triggers the tools dropdown list */ .pl-c-tools__toggle { - @include linkStyle(); - margin: 0; - padding-top: 0.6rem; - padding-bottom: 0.5rem; - display: inline-flex; - align-items: center; - justify-content: center; - position: relative; - min-width: 30px; + @include linkStyle(); + margin: 0; + padding-top: 0.6rem; + padding-bottom: 0.5rem; + display: inline-flex; + align-items: center; + justify-content: center; + position: relative; + min-width: 30px; } /** @@ -35,22 +35,22 @@ * 2) Set the width and height of the icon to be the same height of font */ .pl-c-tools__toggle-icon { - position: absolute; + position: absolute; } /** * Tools dropdown list */ .pl-c-tools__list { - @include listReset(); - @include accordionPanel(); - position: absolute; - top: 100%; - right: 0; - z-index: 1; - width: 10rem; - border-bottom-left-radius: $pl-border-radius-med; - border-bottom-right-radius: $pl-border-radius-med; + @include listReset(); + @include accordionPanel(); + position: absolute; + top: 100%; + right: 0; + z-index: 1; + width: 10rem; + border-bottom-left-radius: $pl-border-radius-med; + border-bottom-right-radius: $pl-border-radius-med; } /** @@ -58,8 +58,8 @@ * 1) Links and buttons inside of the tools dropdown */ .pl-c-tools__action { - @include linkStyle(); - display: block; - width: 100%; - margin: 0; -} \ No newline at end of file + @include linkStyle(); + display: block; + width: 100%; + margin: 0; +} diff --git a/packages/uikit-workshop/src/sass/scss/04-components/_viewport.scss b/packages/uikit-workshop/src/sass/scss/04-components/_viewport.scss new file mode 100644 index 000000000..f09661fe8 --- /dev/null +++ b/packages/uikit-workshop/src/sass/scss/04-components/_viewport.scss @@ -0,0 +1,143 @@ +/*------------------------------------*\ + #VIEWPORT +\*------------------------------------*/ + +/** +* To keep user code and PL code separate, and to make +* resizing the viewport possible, PL contains an iframe +* that houses all user code. +*/ + +/** +* Viewport +* 1) This wrapper div occupies all remaining viewport space after PL's header +*/ +.pl-c-viewport { + display: flex; + flex-direction: column; + flex-direction: column; + height: auto; + width: 100%; + position: relative; + top: $offset-top; + bottom: 0; + left: 0; + right: 0; + z-index: 0; + overflow: hidden; + flex-grow: 1; + transition: height 0.3s ease; + transform: translate3d(0, 0, 0); + will-change: height; + + @supports (position: sticky) { + top: 0; + } +} + +/** +* Cover +* 1) This is an invisible div that sits above the iframe and is +* used in JS for manual viewport resizing purposes. +*/ +.pl-c-viewport__cover { + width: 100%; + height: 100%; + display: none; + position: absolute; + z-index: 20; + cursor: move; +} + +/** +* Viewport iframe wrapper +* 1) This is the container that houses the +* iframe and the manual resize handle +*/ +.pl-c-viewport__iframe-wrapper { + height: 100%; + width: 100%; // bug fix for Safari and Firefox getting stuck calculating a width of 0px when the JS first kicks in + position: relative; + margin: 0 auto; + flex: 1; + -webkit-overflow-scrolling: touch; + overflow-y: auto; + overflow-x: hidden; + + &.hay-mode { + transition: all 40s linear; + } + width: 100%; // bug fix for Safari and Firefox getting stuck calculating a width of 0px when the JS first kicks in +} + +/** +* Viewport iframe +* 1) this is the actual