Skip to content

Commit

Permalink
feat: add documentation app (positive-js#140)
Browse files Browse the repository at this point in the history
* chore: init docs

* chore: test commit - 3 #UIM-4 (+14 squashed commit)

Squashed commit:

[a355848] chore: test commit - 3 #UIM-4

[d5b74eb] chore: test commit - 2 (#UIM-4)

[a9f165c] chore: test commit (positive-js#4)

[8ec0506] fix: base-href parametr

[5c47f43] fix: ci PR NUmbers

[539390d] fix: ci PR NUmbers

[0c59de1] fix: correct deps for ci

[1e867ee] fix: build

[5d0c17d] chore: added preview docs script

* testing stage

[665b0a7] feat: added unit test config and 1 simple spec

[39b6f25] fix: angular cli build

[c641ade] chore: fixes McTreeSelection, await fix in master

[240ac61] chore: tree-selection test

[96b5b92] chore: added prod build for docs (+7 squashed commit)

Squashed commit:

[0dd9d64] chore: version for stackblitz

[66610cf] chore: added stackblitz

[2c20840] chore: updated code snippets

[e11b757] chore: updated css

[fc86734] chore: updated ts paths

[ef81da5] chore: added button overview

[b8f4450] chore: added pages (+3 squashed commit)

Squashed commit:

[203cb20] chore: updated example generator

[e70432d] chore: updated example generator

[7f33804] chore: updated dgeni generator

* chore: updated to angular cdk

* chore: added cleanup docs script

* chore: base layout

* chore: added dropdown

* chore: added sidenav

* chore: fixed button preview

* chore: added styles for doc view

* chore: updated router and buttond description

* chore: added left sidebar data

* feat(docs): fixing docs's scroll (positive-js#181)

* chore: remove container

* chore: remove container

* feat(docs): navbar styling (positive-js#185)

* chore: updated accordion animation

* chore: display correct module for entry-point

* feat(docs): navbar color picker corrected (positive-js#188)

* feat(docs): sidenav styling (positive-js#189)

* feat(docs): anchors component was added (positive-js#191)

* feat(docs): footer was added (positive-js#193)

* feat(docs): anchor routing was added (positive-js#192)

* chore: adde sevice workers

* chore: small update for sidebar styles

* feat(docs): styling generated from markdown content (positive-js#199)

* fix: path to doc-content

* feat(docs): styling code editor (positive-js#200)

* fix: return mosaic-examples script

* fix: return angular-cli

* fix: stackblitz button

* chore: remove unused componentes and updated path to assets

* fix: small fix for anchors

* chore: added checkbox example

* feat(docs): routing in production (positive-js#210)

* feat(docs): checkbox documentation (positive-js#214)

* feat(docs): list styling (positive-js#215)

* feat(docs): image styling (positive-js#212)

* feat(docs): code editor styling (positive-js#216)

* feat(docs): 404 routing with localStorage (positive-js#220)

* feat(docs): angular anchors (positive-js#223)

* feat(docs): anchors are working with base href (positive-js#224)

* feat(docs): code editor stiling fixed for Edge (positive-js#226)

* feat(docs): changing list padding (positive-js#227)

* fix: safari logo height

* feat(docs): svg logo (positive-js#230)

* feat(docs): smooth scroll (positive-js#231)

* feat(docs): color correction (positive-js#233)

* feat(docs): correcting example viewer (positive-js#234)

Setting min height,  hiding bottom shade when showing whole sourse and correcting munber's generation.

* feat(docs): deleting routing to button/overview by default (positive-js#235)

* feat(docs): version dropdown styling (positive-js#237)

* feat(docs): updating component's colors (positive-js#238)

* feat(docs): checkbox indeterminate example (positive-js#236)

* feat(docs): theme change functionality added (positive-js#239)

* feat: group examples

* feat(docs): switch hint-text color to less-contrast-text and adding the dark theme for code editor (positive-js#241)

* chore: stackblitz

* chore: added assets for stackblitz

* feat(docs): active color change feature (positive-js#242)

* feat(docs): fixing stackblitz icon and footer's link for correct theme styling (positive-js#243)

* feat(docs): styling missing code example (positive-js#244)

* feat(docs): lost code alert (positive-js#247)

* feat(docs): dark theme background (positive-js#250)

* feat(docs): styling active color dropdown (positive-js#251)

* feat(docs): sidenav background (positive-js#240)

* feat(docs): new highlightjs themes (positive-js#252)

* feat(docs): increase_header_padding (positive-js#255)

* feat(docs): show/hide editor fix WIP (positive-js#254)

* feat(docs): adding transparent buttons to navbar (positive-js#257)

* feat(docs): setting footer higher then stackblitz link (positive-js#258)

* feat(docs): styling code copy button (positive-js#259)

* feat(docs): changing typography from static to depended on theme (positive-js#260)

* feat(docs): increase debounceTime for smooth scroll support (positive-js#262)

* feat(docs): set target=_blank to links (positive-js#264)

* feat(docs): fixing dark background for Edge (positive-js#266)

* feat(docs): sidenav selected and focus styles correction (positive-js#265)

* feat(docs): moving logo to assets for safary support (positive-js#263)

* feat(docs): styling failed to load documents

* feat(docs): correcting copy tooltip position

* feat(docs): fixing code editor switсh

* feat(docs): fixing color picker in Edge (positive-js#273)

* feat(docs): setting animation for component-overview (positive-js#275)

* feat(docs): storing theme and active color (positive-js#274)

* feat(docs): refactoring navbar component (positive-js#276)

* feat(docs): disabling selected route (positive-js#277)

* feat(docs): styling tables (positive-js#279)

* feat(docs): correcting animation's start and adaptivity (positive-js#288)

* feat(docs): adding components description (positive-js#287)

* feat(docs): adding embed icons in stackblitz examples (positive-js#300)

@ptsecurity/mosaic-icons version is updated in stackblitz writer.
mc-icons.css is switched to mc-icons-embed.css with embed icon font included.

* chore: updated lock file

* fix: correct component name

* chore: added firebase config

* fix(docs): fixing dropdown trigger icon (positive-js#301)

* chore: simple ru localization for button

* chore: updated firebase tools

* chore: updated SVG logo & button desc

* feat(docs): styling blocks of code in markdown WIP (positive-js#307)

Copy icon is added through TS by createCopyIcons function.
Unfortunately it is not possible to add manually triggering tooltip, so onclick animation is used for UI matter.

* chore: updated md docs

* chore: firebase config v8

* chore: fixed raio-button example

* chore: fixed checkbox

* chore: docs for Icon

* chore: docs for checkbox

* feat(docs): restyling code copy icon (positive-js#312)

Bringing code copy icon in example viewer and markdown to the same view. Tooltip isn't used anymore.

* chore: added badges

* feat(docs): setting content width (positive-js#313)

setting content width to calc(100% - 600px) for empty examples and correct view in Edge

* chore: badges style

* feat(docs): adding dropdown examples (positive-js#322)

Dropdown overview and nested dropdown examples are added.

* chore: test build

* feat(docs): adding page title to anchors (positive-js#323)

Page title is added  to anchor's menu and is separated by border-bottom.
Bug of not updating anchors on contentRenderFailed error is fixed.

* feat(docs): adding alerts example (positive-js#324)

* feat: added documentation for Links
  • Loading branch information
pimenovoleg authored and Peter Kornuishin committed Nov 7, 2019
1 parent 0748785 commit a70482e
Show file tree
Hide file tree
Showing 224 changed files with 8,571 additions and 913 deletions.
60 changes: 53 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ jobs:
- attach_workspace: *attach_options
- run: yarn run valid:lic

build_mosaic_docs:
<<: *job_defaults
steps:
- attach_workspace: *attach_options
- run:
name: Setup Environment Variables
command: |
echo 'export CI_PREVIEW=true' >> $BASH_ENV
echo 'export SHORT_GIT_HASH=$(git rev-parse --short $CIRCLE_SHA1)' >> $BASH_ENV
echo 'export CIRCLE_PULL_REQUEST_NUMBER=$(echo "$CIRCLE_PULL_REQUEST" | cut -d"/" -f7)' >> $BASH_ENV
source $BASH_ENV
- run: yarn run build:docs
- run: yarn run build:mosaic-examples
- run: yarn run docs:prod-build --progress false --base-href /mosaic-previews/pr$CIRCLE_PULL_REQUEST_NUMBER-$SHORT_GIT_HASH/ --output-path dist/releases/mosaic-docs/pr$CIRCLE_PULL_REQUEST_NUMBER-$SHORT_GIT_HASH/
- persist_to_workspace:
root: dist
paths:
- *release_path

build_mosaic:
<<: *job_defaults
steps:
Expand Down Expand Up @@ -125,16 +144,34 @@ jobs:
- "c3:de:eb:9c:82:70:a8:23:f3:4e:92:b8:07:d2:22:df"
- run: ./scripts/deploy/publish-artifacts.sh

docs_publish:
preview_mosaic_docs:
<<: *job_defaults
steps:
- add_ssh_keys:
fingerprints:
- "c3:de:eb:9c:82:70:a8:23:f3:4e:92:b8:07:d2:22:df"
- *checkout_code
- *restore_cache
- run: ./scripts/deploy/publish-docs.sh

- *attach_release_output
- run:
name: Setup Environment Variables
command: |
echo 'export CI_PREVIEW=true' >> $BASH_ENV
echo 'export SHORT_GIT_HASH=$(git rev-parse --short $CIRCLE_SHA1)' >> $BASH_ENV
echo 'export CIRCLE_PULL_REQUEST_NUMBER=$(echo "$CIRCLE_PULL_REQUEST" | cut -d"/" -f7)' >> $BASH_ENV
source $BASH_ENV
- run: yarn run build:docs
- run: yarn run docs:publish-preview

cleanup_preview_mosaic_docs:
<<: *job_defaults
steps:
- add_ssh_keys:
fingerprints:
- "c3:de:eb:9c:82:70:a8:23:f3:4e:92:b8:07:d2:22:df"
- *checkout_code
- *restore_cache
- run: yarn run cleanup-preview

workflows:
version: 2
Expand All @@ -155,6 +192,12 @@ workflows:
- build_mosaic:
requires:
- install

- build_mosaic_docs:
requires:
- build_cdk
- build_mosaic
- build_mosaic-moment-adapter
# 3 Group
- test_unit:
requires:
Expand All @@ -177,11 +220,14 @@ workflows:
branches:
only:
- master
- docs_publish:

- preview_mosaic_docs:
requires:
- build_mosaic_docs
- test_unit
- build_mosaic
- cleanup_preview_mosaic_docs:
requires:
- install
filters:
branches:
only:
- master
only: master
17 changes: 17 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"projects": {
"default": "mosaic-stable"
},
"targets": {
"mosaic-stable": {
"hosting": {
"stable": [
"mosaic-stable"
],
"v8": [
"mosaic-v8"
]
}
}
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# firebase artifacts
.firebase

package-lock.json

.env
Expand Down
126 changes: 126 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"mosaic-docs": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "./dist/releases/mosaic-docs",
"index": "packages/docs/src/index.html",
"main": "packages/docs/src/main.ts",
"polyfills": "packages/docs/src/polyfills.ts",
"tsConfig": "packages/docs/tsconfig.app.json",
"aot": false,
"assets": [
{
"glob": "**/*",
"input": "packages/docs/src/assets",
"output": "/assets"
},
{
"glob": "**/*",
"input": "dist/docs-content",
"output": "/docs-content"
},
{
"glob": "favicon.ico",
"input": "packages/docs/src",
"output": "/"
}
],
"styles": [
{
"input": "packages/docs/src/main.scss"
},
{
"input": "packages/docs/src/highlightjs/material-light.scss"
}

],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "packages/docs/src/environments/environment.ts",
"with": "packages/docs/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "mosaic-docs:build"
},
"configurations": {
"production": {
"browserTarget": "mosaic-docs:build:production"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "packages/docs/src/test.ts",
"polyfills": "packages/docs/src/polyfills.ts",
"tsConfig": "packages/docs/tsconfig.spec.json",
"karmaConfig": "packages/docs/karma.conf.js",
"assets": [
{
"glob": "**/*",
"input": "packages/docs/src/assets",
"output": "/assets"
},
{
"glob": "favicon.ico",
"input": "packages/docs/src",
"output": "/"
}
],
"styles": [
{
"input": "packages/docs/src/main.scss"
},
{
"input": "packages/docs/src/highlightjs/material-light.scss"
}
],
"scripts": []
}
}
}
}
},
"defaultProject": "mosaic-docs"
}
68 changes: 68 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"hosting": [
{
"target": "stable",
"public": "dist/releases/mosaic-docs",
"cleanUrls": true,
"rewrites": [
{
"source": "**/!(*.*)",
"destination": "/index.html"
}
],
"headers": [
{
// Hashed CSS/JS files...
"source": "**/*.+([0-9a-f]).@(css|js)",
"headers": [
{"key": "Cache-Control", "value": "max-age=2592000"} // 30 days
]
},
{
// Images, fonts, (non-hashed) CSS/JS files.
"source": "**/*.@(gif|jpg|jpeg|png|svg|webp|js|css|eot|otf|ttf|ttc|woff|woff2)",
"headers": [
{"key": "Cache-Control", "value": "max-age=86400"} // 1 day
]
}
],
"ignore": [
"firebase.json",
"**/node_modules/**",
"tmp"
]
},
{
"target": "v8",
"public": "dist/releases/mosaic-docs",
"cleanUrls": true,
"rewrites": [
{
"source": "**/!(*.*)",
"destination": "/index.html"
}
],
"headers": [
{
// Hashed CSS/JS files...
"source": "**/*.+([0-9a-f]).@(css|js)",
"headers": [
{"key": "Cache-Control", "value": "max-age=2592000"} // 30 days
]
},
{
// Images, fonts, (non-hashed) CSS/JS files.
"source": "**/*.@(gif|jpg|jpeg|png|svg|webp|js|css|eot|otf|ttf|ttc|woff|woff2)",
"headers": [
{"key": "Cache-Control", "value": "max-age=86400"} // 1 day
]
}
],
"ignore": [
"firebase.json",
"**/node_modules/**",
"tmp"
]
}
]
}
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@angular-devkit/build-angular": "~0.802.1",
"@angular-devkit/core": "^8.2.1",
"@angular-devkit/schematics": "^8.2.1",
"@angular/cli": "^8.2.1",
"@angular/compiler-cli": "^8.2.2",
"@angular/platform-browser-dynamic": "^8.2.2",
"@angular/platform-server": "^8.2.2",
Expand Down Expand Up @@ -69,6 +70,7 @@
"dgeni": "^0.4.12",
"dgeni-packages": "^0.28.1",
"dotenv": "^6.2.0",
"firebase-tools": "^7.5.0",
"fs-extra": "^5.0.0",
"glob": "^7.1.3",
"gulp": "^4.0.0",
Expand Down Expand Up @@ -148,8 +150,15 @@
"build:cdk": "gulp cdk:build-release",
"build:mosaic-moment-adapter": "gulp mosaic-moment-adapter:build-release",
"build:mosaic": "gulp mosaic:build-release",
"build:mosaic-examples": "gulp mosaic-examples:build-release",
"build:docs": "gulp docs",
"changelog": "ts-node --project tools/release tools/release/changelog.ts",
"ng": "ng",
"docs:start": "ng serve",
"docs:prod-build": "ng build",
"docs:prod-build:aot": "ng build --aot --prod",
"docs:publish-preview": "ts-node --project ./scripts/tsconfig.deploy.json ./scripts/deploy/publish-docs-preview.ts",
"docs:cleanup-preview": "ts-node --project ./scripts/tsconfig.deploy.json ./scripts/deploy/cleanup-preview.ts",
"postinstall": "ngc -p angular.tsconfig.json",
"preinstall": "node ./tools/npm/check-npm.js",
"publish": "ts-node --project ./scripts/tsconfig.deploy.json ./scripts/deploy/publish-artifacts.ts",
Expand Down
42 changes: 18 additions & 24 deletions packages/cdk/schematics/utils/parse5-element.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { SchematicsException } from '@angular-devkit/schematics';
import { DefaultTreeElement } from 'parse5';

import {DefaultTreeElement} from 'parse5';

/** Determines the indentation of child elements for the given Parse5 element. */
export function getChildElementIndentation(element: DefaultTreeElement) {
const childElement = element.childNodes
.find(node => node['tagName']) as DefaultTreeElement | null;
const childElement = element.childNodes
.find((node) => node.tagName) as DefaultTreeElement | null;

if ((childElement && !childElement.sourceCodeLocation) || !element.sourceCodeLocation) {
throw new Error('Cannot determine child element indentation because the specified Parse5 ' +
'element does not have any source code location metadata.');
}
if ((childElement && !childElement.sourceCodeLocation) || !element.sourceCodeLocation) {
throw new SchematicsException('Cannot determine child element indentation because the ' +
'specified Parse5 element does not have any source code location metadata.');
}

const startColumns = childElement ?
// In case there are child elements inside of the element, we assume that their
// indentation is also applicable for other child elements.
childElement.sourceCodeLocation!.startCol :
// In case there is no child element, we just assume that child elements should be indented
// by two spaces.
element.sourceCodeLocation!.startCol + 2;
const startColumns = childElement ?
// In case there are child elements inside of the element, we assume that their
// indentation is also applicable for other child elements.
childElement.sourceCodeLocation!.startCol :
// In case there is no child element, we just assume that child elements should be indented
// by two spaces.
element.sourceCodeLocation!.startCol + 2;

// Since Parse5 does not set the `startCol` properties as zero-based, we need to subtract
// one column in order to have a proper zero-based offset for the indentation.
return startColumns - 1;
// Since Parse5 does not set the `startCol` properties as zero-based, we need to subtract
// one column in order to have a proper zero-based offset for the indentation.
return startColumns - 1;
}
Loading

0 comments on commit a70482e

Please sign in to comment.