Compare commits

..

26 Commits

Author SHA1 Message Date
github-actions[bot]
156719f977 Version Packages 2021-01-13 14:21:53 +01:00
Thomas Allmer
295cfbdbd8 chore: better support for windows 2021-01-13 14:16:36 +01:00
Thomas Allmer
7dd6f4c64f fix(launch): default logo should not break social images 2021-01-13 14:16:36 +01:00
Thomas Allmer
b68923b608 fix(mdjs-core): use gfm to support markdown tables 2021-01-13 14:16:36 +01:00
Benny Powers
86c3a4b0e8 feat(launch): themability for inline-notification 2021-01-13 13:48:37 +01:00
Benny Powers
897892d6f9 chore: update dependencies
chore: patch typescript error in @lion/overlays

chore: changeset for deps
2021-01-13 13:40:25 +01:00
Benny Powers
7b2dc6430f fix(search): improve a11y
- a11y: add labels to buttons
- perf: makes all templates static
- fix: address typescript errors

chore: changeset for search
2021-01-13 13:40:25 +01:00
github-actions[bot]
2a400e09da Version Packages 2021-01-12 01:53:08 +01:00
Benny Powers
25adb741d8 feat(launch): add icons for discord and telegram 2021-01-12 01:48:24 +01:00
Thomas Allmer
485827127d feat: support relative links + src urls for all 11ty templates 2021-01-12 01:38:34 +01:00
Thomas Allmer
ef3b846bb9 feat: auto create social media images 2021-01-10 12:54:52 +01:00
Benny Powers
6922161429 Merge pull request #17 from modernweb-dev/changeset-release/main
Version Packages
2021-01-10 12:12:05 +02:00
github-actions[bot]
06843f3fa9 Version Packages 2021-01-08 13:36:53 +00:00
Benny Powers
496a1b0974 chore: version launch package 2021-01-08 14:35:32 +01:00
Benny Powers
13c15346b1 fix(launch): pass a11y audit
allows rocket sites to pass the netlify-plugin-a11y audit
2021-01-08 14:35:32 +01:00
github-actions[bot]
8eeebbc978 Version Packages 2021-01-07 16:50:42 +01:00
Thomas Allmer
32f39ae96a fix(cli): while watching an update should not hide navigation 2021-01-07 16:47:51 +01:00
github-actions[bot]
579ecfde50 Version Packages 2021-01-07 09:10:15 +01:00
Mathieu Puech
9aa3265ebb docs: small fixes on CONTRIBUTING.md 2021-01-07 08:54:17 +01:00
Mathieu Puech
d955b436b6 fix(drawer): reset translation on teardown overlay controller 2021-01-07 08:54:17 +01:00
Thomas Allmer
3468ff9fc2 fix(cli): rollup-plugin-html needs to be aware of the pathPrefix 2021-01-07 08:49:40 +01:00
github-actions[bot]
fd4bc27f16 Version Packages 2021-01-06 00:49:41 +01:00
Thomas Allmer
641c7e551c feat: add pathPrefix option for subfolder deployment 2021-01-06 00:46:39 +01:00
github-actions[bot]
f9ae2b8208 Version Packages 2021-01-05 07:35:10 +01:00
Thomas Allmer
a8c7173758 fix: only apply the rollup wrap of dev server plugins if needed 2021-01-05 07:25:44 +01:00
Thomas Allmer
dd5c772ba3 chore: add info about the need of .eleventyignore 2021-01-03 23:26:29 +01:00
129 changed files with 2305 additions and 950 deletions

View File

@@ -1,2 +1,4 @@
node_modules/**
/docs/_assets/head.html
/docs/_assets
/docs/_includes
/docs/_data

View File

@@ -15,7 +15,7 @@ git clone git@github.com:modernweb-dev/rocket.git
Once cloning is complete, change directory to the repo.
```sh
cd web
cd rocket
```
Now add your fork as a remote
@@ -89,7 +89,7 @@ Exceptions:
## Committing Your Changes
Commit messages must follow the [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0-beta.2/)
Commit messages must follow the [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/)
Modern-web uses package name as scope. So for example if you fix a _terrible bug_ in the package `@web/test-runner`, the commit message should look like this:
```sh

View File

@@ -9,11 +9,8 @@ import { rocketLaunch } from '@rocket/launch';
export default {
presets: [rocketLaunch()],
build: {
emptyOutputDir: true,
pathPrefix: 'subfolder-only-for-build',
serviceWorkerFileName: 'service-worker.js',
},
emptyOutputDir: true,
pathPrefix: 'subfolder-only-for-build',
};
```
@@ -23,11 +20,22 @@ New plugins can be added and all default plugins can be adjusted or even removed
```js
export default {
// add remark/unified plugin to the markdown processing (e.g. enable special code blocks)
setupUnifiedPlugins: [],
// add a rollup plugins to the web dev server (will be wrapped with @web/dev-server-rollup) AND the rollup build (e.g. enable json importing)
setupDevAndBuildPlugins: [],
// add a plugin to the web dev server (will not be wrapped) (e.g. esbuild for typescript)
setupDevPlugins: [],
// add a plugin to the rollup build (e.g. optimization steps)
setupBuildPlugins: [],
// add a plugin to eleventy (e.g. a filter packs)
setupEleventyPlugins: [],
// add a plugin to the cli (e.g. a new command like "rocket my-command")
setupCliPlugins: [],
};
```

View File

@@ -18,38 +18,6 @@ module.exports = function (eleventyConfig) {
};
```
As mdjs does return html AND javascript at the same time we need to have a template that can understand it. For that we create a layout file.
👉 `_includes/layout.njk`
{% raw %}
```js
<main>
{{ content.html | safe }}
</main>
<script type="module">
{{ content.jsCode | safe }}
</script>
```
{% endraw %}
And in our content we then need to make sure to use that template.
👉 `index.md`
```
---
layout: layout.njk
---
# Hello World
```
You can see a minimal setup in the [examples repo](https://github.com/daKmoR/rocket-example-projects/tree/master/eleventy-and-mdjs).
## Configure a unified or remark plugin with mdjs
By providing a `setupUnifiedPlugins` function as an option to `eleventy-plugin-mdjs` you can set options for all unified/remark plugins.

View File

@@ -216,7 +216,11 @@ const plugins = finalMetaPlugins.map(pluginObj => {
**Examples**
Rollup has a more specific helper
Rollup has a more specific helper that handles
- `config.setupPlugins`
Note: if you provide `config.plugins` then it will return that directly ignoring `setupPlugins`
```js
import { metaConfigToRollupConfig } from 'plugins-manager';
@@ -224,14 +228,19 @@ import { metaConfigToRollupConfig } from 'plugins-manager';
const finalConfig = metaConfigToRollupConfig(currentConfig, defaultMetaPlugins);
```
Web Dev Server has a more specific helper
Web Dev Server has a more specific helper that handles
- `config.setupPlugins`
- `config.setupRollupPlugins`
Note: if you provide `config.plugins` then it will return that directly ignoring `setupPlugins` and `setupRollupPlugins`
```js
import { metaConfigToWebDevServerConfig } from 'plugins-manager';
import { fromRollup } from '@web/dev-server-rollup';
const finalConfig = metaConfigToWebDevServerConfig(currentConfig, defaultMetaPlugins, {
wrapperFunction: fromRollup,
rollupWrapperFunction: fromRollup,
});
```

View File

@@ -12,7 +12,6 @@ import { absoluteBaseUrlNetlify } from '@rocket/core/helpers';
export default /** @type {Partial<import('@rocket/cli').RocketCliOptions>} */ ({
presets: [rocketLaunch(), rocketBlog(), rocketSearch()],
emptyOutputDir: false,
absoluteBaseUrl: absoluteBaseUrlNetlify('http://localhost:8080'),
});
```

View File

@@ -51,6 +51,15 @@ Rocket uses the .gitignore file to manage it's requirements. If you skip this st
};
```
5. (optionally) Create a file `.eleventyignore` (this file will be needed once you start customizing presets)
```
node_modules/**
/docs/_assets
/docs/_includes
/docs/_data
```
<inline-notification type="warning" title="note">
All further pathes are relative to your project root (my-project in this case)

View File

@@ -1,4 +1,4 @@
# Go Live >> Overview
# Go Live >> Overview ||10
A few things are usually needed before going live "for real".

View File

@@ -0,0 +1,44 @@
# Go Live >> Social Media ||20
Having a nice preview image for social media can be very helpful.
For that reason Rocket creates those automatically with the title, parent title, section and your logo.
It will look like this but with your logo
<img src="{{ socialMediaImage }}" width="1200" height="630" alt="Social Media Image of this page" style="border: 1px solid #000" />
There are multiple ways you can modify it.
## Setting it via frontMatter
You can create your own image and link it with something like this
```
---
socialMediaImage: path/to/my/image.png
---
```
## Providing your own text
Sometimes extracting the title + title of parent is not enough but you still want to use the "default image".
You can create an `11tydata.cjs` file next to your page. If your page is `docs/guides/overview.md` then you create a `docs/guides/overview.11tydata.cjs`.
In there you can use the default `createPageSocialImage` but provide your own values.
```js
const { createPageSocialImage } = require('@rocket/cli');
module.exports = async function () {
const socialMediaImage = await createPageSocialImage({
title: 'Learning Rocket',
subTitle: 'Have a website',
subTitle2: 'in 5 Minutes',
footer: 'Rocket Guides',
});
return {
socialMediaImage,
};
};
```

View File

@@ -0,0 +1,13 @@
const { createPageSocialImage } = require('@rocket/cli');
module.exports = async function () {
const socialMediaImage = await createPageSocialImage({
title: 'Learning Rocket',
subTitle: 'Have a website',
subTitle2: 'in 5 Minutes',
footer: 'Rocket Guides',
});
return {
socialMediaImage,
};
};

View File

@@ -1,6 +1,5 @@
---
title: Learning Rocket
description: 'foo'
eleventyNavigation:
key: Guides
order: 10

View File

@@ -1,4 +1,4 @@
# Presets >> Overriding presets ||20
# Presets >> Overriding ||20
All loaded presets will be combined but you can override each file.

View File

@@ -1,3 +1,3 @@
# Presets >> Using preset templates ||30
# Presets >> Using templates ||30
Most presetse have specific entry files you can override...

13
docs/index.11tydata.cjs Normal file
View File

@@ -0,0 +1,13 @@
const { createPageSocialImage } = require('@rocket/cli');
module.exports = async function () {
const socialMediaImage = await createPageSocialImage({
title: 'Rocket',
subTitle: 'Static sites with',
subTitle2: 'a sprinkle of JavaScript.',
footer: 'A Modern Web Product',
});
return {
socialMediaImage,
};
};

View File

@@ -28,6 +28,7 @@
"rocket:build": "node packages/cli/src/cli.js build",
"search": "node packages/cli/src/cli.js search",
"setup": "npm run setup:ts-configs",
"setup:patches": "npx patch-package",
"setup:ts-configs": "node scripts/generate-ts-configs.mjs",
"start": "node packages/cli/src/cli.js start",
"test": "yarn test:node && yarn test:web",
@@ -50,22 +51,22 @@
"@types/chai": "^4.2.14",
"@types/fs-extra": "^9.0.6",
"@types/mocha": "^8.2.0",
"@types/node": "^14.14.16",
"@types/node": "^14.14.20",
"@types/sinon": "^9.0.10",
"@typescript-eslint/eslint-plugin": "^4.11.1",
"@typescript-eslint/parser": "^4.11.1",
"@web/test-runner": "^0.11.5",
"@web/test-runner-commands": "^0.3.0",
"@web/test-runner-playwright": "^0.7.0",
"@typescript-eslint/eslint-plugin": "^4.13.0",
"@typescript-eslint/parser": "^4.13.0",
"@web/test-runner": "^0.12.2",
"@web/test-runner-commands": "^0.4.0",
"@web/test-runner-playwright": "^0.8.0",
"chai": "^4.2.0",
"concurrently": "^5.3.0",
"copyfiles": "^2.4.1",
"deepmerge": "^4.2.2",
"esbuild": "^0.8.26",
"eslint": "^7.16.0",
"esbuild": "^0.8.31",
"eslint": "^7.17.0",
"eslint-config-prettier": "^7.1.0",
"hanbi": "^0.4.1",
"husky": "^4.3.6",
"husky": "^4.3.7",
"lint-staged": "^10.5.3",
"mocha": "^8.2.1",
"node-fetch": "^2.6.1",
@@ -76,9 +77,9 @@
"puppeteer": "^5.5.0",
"remark-emoji": "^2.1.0",
"rimraf": "^3.0.2",
"rollup": "^2.35.1",
"rollup": "^2.36.1",
"rollup-plugin-terser": "^7.0.2",
"sinon": "^9.2.2",
"sinon": "^9.2.3",
"ts-node": "^9.1.1",
"typescript": "^4.1.3"
},

View File

@@ -1,6 +1,20 @@
# @rocket/blog
## 0.2.0
### Minor Changes
- 4858271: Adjust templates for change in `@rocket/eleventy-plugin-mdjs-unified` as it now returns html directly instead of an object with html, js, stories
## 0.1.1
### Patch Changes
- Updated dependencies [a8c7173]
- plugins-manager@0.2.0
## 0.1.0
### Minor Changes
- 1971f5d: Initial Release

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/blog",
"version": "0.1.0",
"version": "0.2.0",
"publishConfig": {
"access": "public"
},
@@ -38,6 +38,6 @@
"testing"
],
"dependencies": {
"plugins-manager": "^0.1.0"
"plugins-manager": "^0.2.0"
}
}

View File

@@ -49,7 +49,7 @@
{% endif %}
{% include 'partials/addTitleHeadline.njk' %}
{{ content.html | safe }}
{{ content | safe }}
{% include 'partials/previousNext.njk' %}
{% include 'partials/blog-content-footer.njk' %}

View File

@@ -12,7 +12,7 @@
{% block main %}
<main class="markdown-body">
{% include 'partials/addTitleHeadline.njk' %}
{{ content.html | safe }}
{{ content | safe }}
<div class="articles">
{% for post in posts %}
{% if post.data.published %}

View File

@@ -1,6 +1,19 @@
# @rocket/building-rollup
## 0.1.2
### Patch Changes
- 897892d: bump dependencies
## 0.1.1
### Patch Changes
- 3468ff9: Update rollup-plugin-html to support `absolutePathPrefix` option
## 0.1.0
### Minor Changes
- 1971f5d: Initial Release

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/building-rollup",
"version": "0.1.0",
"version": "0.1.2",
"publishConfig": {
"access": "public"
},
@@ -54,10 +54,10 @@
"@babel/preset-env": "^7.12.11",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-node-resolve": "^11.0.1",
"@web/rollup-plugin-html": "^1.3.3",
"@web/rollup-plugin-html": "^1.4.0",
"@web/rollup-plugin-import-meta-assets": "^1.0.4",
"@web/rollup-plugin-polyfills-loader": "^1.0.3",
"browserslist": "^4.16.0",
"browserslist": "^4.16.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-workbox": "^6.1.0"
}

View File

@@ -1,6 +1,66 @@
# @rocket/cli
## 0.2.1
### Patch Changes
- 897892d: bump dependencies
- 295cfbd: Better support for windows paths
- Updated dependencies [897892d]
- @rocket/building-rollup@0.1.2
- @rocket/eleventy-rocket-nav@0.2.1
## 0.2.0
### Minor Changes
- ef3b846: Add a default "core" preset to the cli package which provides fundaments like eleventConfig data, eleventyComputed data, logo, site name, simple layout, ...
- 4858271: Process local relative links and images via html (11ty transform) to support all 11ty template systems
- 4858271: Adjust templates for change in `@rocket/eleventy-plugin-mdjs-unified` as it now returns html directly instead of an object with html, js, stories
### Patch Changes
- ef3b846: Move setting of title, eleventyNavigation and section page meta data to eleventyComputed
- ef3b846: Auto create social media images for every page
- Updated dependencies [ef3b846]
- Updated dependencies [4858271]
- Updated dependencies [4858271]
- @rocket/core@0.1.1
- @rocket/eleventy-plugin-mdjs-unified@0.2.0
- @rocket/eleventy-rocket-nav@0.2.0
## 0.1.4
### Patch Changes
- 32f39ae: An updated triggered via watch should not hide the main navgiation.
## 0.1.3
### Patch Changes
- 3468ff9: Pass prefix to rollup-plugin-html so assets can still be extracted
- Updated dependencies [3468ff9]
- @rocket/building-rollup@0.1.1
## 0.1.2
### Patch Changes
- 641c7e5: Add a pathPrefix option to allow deployment to a subdirectory
## 0.1.1
### Patch Changes
- a8c7173: Changes to config:
- Do not auto rollupWrap plugins added via `setupDevPlugins`.
- If you provide `devServer.plugins` then it will return that directly ignoring `setupDevAndBuildPlugins` and `setupDevPlugins`
- Updated dependencies [a8c7173]
- plugins-manager@0.2.0
## 0.1.0
### Minor Changes
- 1971f5d: Initial Release

View File

@@ -1,6 +1,10 @@
const { setComputedConfig, getComputedConfig } = require('./src/public/computedConfig.cjs');
const rocketEleventyComputed = require('./src/public/rocketEleventyComputed.cjs');
const { createPageSocialImage } = require('./src/public/createPageSocialImage.cjs');
module.exports = {
setComputedConfig,
getComputedConfig,
rocketEleventyComputed,
createPageSocialImage,
};

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/cli",
"version": "0.1.0",
"version": "0.2.1",
"publishConfig": {
"access": "public"
},
@@ -38,6 +38,7 @@
"*.mjs",
"dist",
"dist-types",
"preset",
"src"
],
"keywords": [
@@ -50,20 +51,21 @@
],
"dependencies": {
"@11ty/eleventy": "^0.11.1",
"@rocket/building-rollup": "^0.1.0",
"@rocket/core": "^0.1.0",
"@rocket/eleventy-plugin-mdjs-unified": "^0.1.0",
"@rocket/eleventy-rocket-nav": "^0.1.0",
"@11ty/eleventy-img": "^0.7.4",
"@rocket/building-rollup": "^0.1.2",
"@rocket/core": "^0.1.1",
"@rocket/eleventy-plugin-mdjs-unified": "^0.2.0",
"@rocket/eleventy-rocket-nav": "^0.2.1",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-node-resolve": "^11.0.1",
"@web/config-loader": "^0.1.3",
"@web/dev-server": "^0.1.2",
"@web/dev-server-rollup": "^0.3.0",
"@web/dev-server": "^0.1.4",
"@web/dev-server-rollup": "^0.3.2",
"@web/rollup-plugin-copy": "^0.2.0",
"command-line-args": "^5.1.1",
"command-line-usage": "^6.1.1",
"fs-extra": "^9.0.1",
"plugins-manager": "^0.1.0"
"plugins-manager": "^0.2.0"
},
"types": "dist-types/index.d.ts"
}

View File

@@ -0,0 +1,33 @@
<svg fill="#e63946" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 511.998 511.998" xml:space="preserve">
<g>
<path d="M98.649,430.256c-46.365,28.67-71.17,30.939-78.916,23.51c-7.75-7.433-6.519-32.307,20.182-79.832
c24.953-44.412,65.374-96.693,113.818-147.211l-11.279-10.817C93.124,267.348,51.871,320.751,26.291,366.279
c-19.228,34.22-37.848,79.134-17.375,98.766c5.84,5.6,13.599,7.935,22.484,7.935c22.269,0,51.606-14.677,75.469-29.432
c44.416-27.464,96.044-70.919,145.373-122.362l-11.279-10.817C192.517,360.888,141.976,403.464,98.649,430.256z"/>
<rect x="238.112" y="272.64" transform="matrix(-0.7218 -0.6921 0.6921 -0.7218 237.9094 656.5383)" width="25.589" height="15.628"/>
<rect x="268.895" y="302.163" transform="matrix(-0.7218 -0.6921 0.6921 -0.7218 270.4774 728.6761)" width="25.589" height="15.628"/>
<rect x="232.827" y="268.929" transform="matrix(-0.7218 -0.6921 0.6921 -0.7218 297.4719 673.0591)" width="102.364" height="15.628"/>
<path d="M500.916,41.287c-7.769,1.59-76.412,16.062-93.897,34.294l-50.728,52.899l-114.703-3.629l-39.198,40.876l79.28,40.569
l-21.755,22.687l72.848,69.858l21.755-22.687l43.857,77.51l39.197-40.876l-8.433-114.451l50.727-52.899
c17.485-18.234,29.067-87.422,30.331-95.251l1.801-11.169L500.916,41.287z M228.209,161.383l19.842-20.692l93.688,2.964
l-48.775,50.864L228.209,161.383z M401.632,327.686l-35.822-63.308l48.776-50.865l6.886,93.482L401.632,327.686z
M332.298,276.743l-50.287-48.223L412.89,92.037l50.288,48.223L332.298,276.743z M473.009,128.036l-48.316-46.334
c14.54-8.427,44.787-17.217,68.076-22.632C488.336,82.567,480.82,113.155,473.009,128.036z"/>
<rect x="302.369" y="231.988" transform="matrix(-0.7218 -0.6921 0.6921 -0.7218 384.0262 633.9694)" width="34.12" height="15.628"/>
<rect x="411.311" y="127.35" transform="matrix(-0.6921 0.7218 -0.7218 -0.6921 807.9747 -74.331)" width="17.061" height="15.628"/>
<rect x="394.288" y="145.087" transform="matrix(-0.7218 -0.6921 0.6921 -0.7218 586.0206 542.7934)" width="15.628" height="17.06"/>
<rect x="376.571" y="163.565" transform="matrix(-0.7218 -0.6921 0.6921 -0.7218 542.7271 562.3462)" width="15.628" height="17.06"/>
<rect x="161.111" y="185.158" transform="matrix(0.7071 0.7071 -0.7071 0.7071 192.1943 -60.3323)" width="15.628" height="33.35"/>
<rect x="184.683" y="172.695" transform="matrix(0.707 0.7072 -0.7072 0.707 182.4625 -83.9076)" width="15.628" height="11.118"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,5 @@
const { rocketEleventyComputed } = require('@rocket/cli');
module.exports = {
...rocketEleventyComputed,
};

View File

@@ -0,0 +1 @@
module.exports = 'layout.njk';

View File

@@ -0,0 +1,8 @@
module.exports = function () {
return {
dir: 'ltr',
lang: 'en',
name: 'Rocket',
description: 'Rocket is the way to build fast static websites with a sprinkle of javascript',
};
};

View File

@@ -0,0 +1 @@
{{ content | safe }}

View File

@@ -1,13 +1,12 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-nocheck
import commandLineArgs from 'command-line-args';
import { rollup } from 'rollup';
import fs from 'fs-extra';
import { copy } from '@web/rollup-plugin-copy';
import { createMpaConfig } from '@rocket/building-rollup';
import { addPlugin } from 'plugins-manager';
import { addPlugin, adjustPluginOptions } from 'plugins-manager';
/**
* @param {object} config
@@ -24,10 +23,21 @@ async function buildAndWrite(config) {
}
async function productionBuild(config) {
// const serviceWorkerFileName =
// config.build && config.build.serviceWorkerFileName
// ? config.build.serviceWorkerFileName
// : 'service-worker.js';
const defaultSetupPlugins = [
addPlugin({
name: 'copy',
plugin: copy,
options: {
patterns: ['!(*.md|*.html)*', '_merged_assets/_static/**/*.{png,gif,jpg,json,css,svg,ico}'],
rootDir: config.outputDevDir,
},
}),
];
if (config.pathPrefix) {
defaultSetupPlugins.push(
adjustPluginOptions('html', { absolutePathPrefix: config.pathPrefix }),
);
}
const mpaConfig = createMpaConfig({
input: '**/*.html',
@@ -38,17 +48,7 @@ async function productionBuild(config) {
rootDir: config.outputDevDir,
absoluteBaseUrl: config.absoluteBaseUrl,
setupPlugins: [
addPlugin({
name: 'copy',
plugin: copy,
options: {
patterns: [
'!(*.md|*.html)*',
'_merged_assets/_static/**/*.{png,gif,jpg,json,css,svg,ico}',
],
rootDir: config.outputDevDir,
},
}),
...defaultSetupPlugins,
...config.setupDevAndBuildPlugins,
...config.setupBuildPlugins,
],
@@ -65,26 +65,10 @@ export class RocketBuild {
return config;
}
async setup({ config, argv }) {
const buildDefinitions = [
{
name: 'mode',
alias: 'm',
type: String,
defaultValue: 'full',
description: 'What build to run [full, site, optimize]',
},
{ name: 'help', type: Boolean, description: 'See all options' },
];
const buildOptions = commandLineArgs(buildDefinitions, { argv });
async setup({ config }) {
this.config = {
...config,
emptyOutputDir: true,
build: {
...config.build,
...buildOptions,
},
...config,
};
}

View File

@@ -79,28 +79,12 @@ export class RocketCli {
const rel = path.relative(process.cwd(), path.join(__dirname));
const relCwdPathToConfig = path.join(rel, 'shared', '.eleventy.cjs');
elev.setConfigPathOverride(relCwdPathToConfig);
// elev.setDryRun(true); // do not write to file system
await elev.init();
if (this.config.watch) {
elev.watch();
}
// // 11ty will bind this hook to itself
// const that = this;
// elev.config.filters['hook-for-rocket'] = async function hook(html, outputPath) {
// // that.requestUpdate();
// // const data = await this.getData();
// // const { layout, title, inputPath } = data;
// // const url = data.page.url;
// // for (const plugin of that.plugins) {
// // if (typeof plugin.transformHtml === 'function') {
// // await plugin.transformHtml({ html, inputPath, outputPath, layout, title, url });
// // }
// // }
// return html;
// };
this.eleventy = elev;
}
}
@@ -135,13 +119,13 @@ export class RocketCli {
if (this.config) {
for (const plugin of this.config.plugins) {
if (this.considerPlugin(plugin)) {
if (typeof plugin.setup === 'function') {
await plugin.setup({ config: this.config, argv: this.subArgv });
}
if (typeof plugin.setupCommand === 'function') {
this.config = plugin.setupCommand(this.config);
}
if (typeof plugin.setup === 'function') {
await plugin.setup({ config: this.config, argv: this.subArgv });
}
}
}
}

View File

@@ -9,6 +9,14 @@ import { metaConfigToWebDevServerConfig } from 'plugins-manager';
export class RocketStart {
commands = ['start'];
/**
* @param {RocketCliOptions} config
*/
setupCommand(config) {
delete config.pathPrefix;
return config;
}
/**
* @param {object} options
* @param {RocketCliOptions} options.config
@@ -39,10 +47,11 @@ export class RocketStart {
clearTerminalOnReload: false,
...this.config.devServer,
setupPlugins: [...this.config.setupDevAndBuildPlugins, ...this.config.setupDevPlugins],
setupRollupPlugins: this.config.setupDevAndBuildPlugins,
setupPlugins: this.config.setupDevPlugins,
},
[],
{ wrapperFunction: fromRollup },
{ rollupWrapperFunction: fromRollup },
);
this.devServer = await startDevServer({

View File

@@ -0,0 +1,183 @@
const fs = require('fs');
const path = require('path');
const { SaxEventType, SAXParser } = require('sax-wasm');
const saxPath = require.resolve('sax-wasm/lib/sax-wasm.wasm');
const saxWasmBuffer = fs.readFileSync(saxPath);
/** @typedef {import('./types').NavigationNode} NavigationNode */
/** @typedef {import('./types').Heading} Heading */
/** @typedef {import('./types').SaxData} SaxData */
// Instantiate
const parser = new SAXParser(
SaxEventType.Attribute,
{ highWaterMark: 256 * 1024 }, // 256k chunks
);
parser.prepareWasm(saxWasmBuffer);
/**
* @param {string} link
*/
function isRelativeLink(link) {
if (link.startsWith('http') || link.startsWith('/')) {
return false;
}
return true;
}
const templateEndings = [
'.html',
'.md',
'.11ty.js',
'.liquid',
'.njk',
'.hbs',
'.mustache',
'.ejs',
'.haml',
'.pug',
];
function endsWithAny(string, suffixes) {
for (let suffix of suffixes) {
if (string.endsWith(suffix)) {
return true;
}
}
return false;
}
function isTemplateFile(href) {
return endsWithAny(href, templateEndings);
}
function isIndexTemplateFile(href) {
const indexTemplateEndings = templateEndings.map(ending => `index${ending}`);
return endsWithAny(href, indexTemplateEndings);
}
/**
* @param {string} html
*/
function extractReferences(html, inputPath) {
const _html = html.replace(/\n/g, 'XXXRocketProcessLocalReferencesXXX');
const hrefs = [];
const assets = [];
parser.eventHandler = (ev, _data) => {
const data = /** @type {SaxData} */ (/** @type {any} */ (_data));
if (ev === SaxEventType.Attribute) {
const attributeName = data.name.toString();
const value = data.value.toString();
const entry = {
value,
startCharacter: data.value.start.character,
};
if (attributeName === 'href') {
if (isRelativeLink(value)) {
hrefs.push(entry);
}
}
if (attributeName === 'src' || attributeName === 'srcset') {
if (isRelativeLink(value) && !isIndexTemplateFile(inputPath)) {
assets.push(entry);
}
}
}
};
parser.write(Buffer.from(_html));
parser.end();
return { hrefs, assets };
}
function calculateNewHrefs(hrefs, inputPath) {
const newHrefs = [];
for (const hrefObj of hrefs) {
const newHrefObj = { ...hrefObj };
const [href, anchor] = newHrefObj.value.split('#');
const suffix = anchor ? `#${anchor}` : '';
if (isRelativeLink(href) && isTemplateFile(href)) {
const hrefParsed = path.parse(href);
const dirPart = hrefParsed.dir.length > 1 ? `${hrefParsed.dir}/` : '';
newHrefObj.newValue = isIndexTemplateFile(href)
? `${dirPart}${suffix}`
: `${dirPart}${hrefParsed.name}/${suffix}`;
if (isTemplateFile(inputPath)) {
if (isIndexTemplateFile(inputPath)) {
// nothing
} else {
newHrefObj.newValue = path.join('../', newHrefObj.newValue);
}
}
}
if (newHrefObj.newValue) {
newHrefs.push(newHrefObj);
}
}
return newHrefs;
}
function calculateNewAssets(assets) {
const newAssets = [...assets];
return newAssets.map(assetObj => {
assetObj.newValue = path.join('../', assetObj.value);
return assetObj;
});
}
function replaceContent(hrefObj, content) {
const upToChange = content.slice(0, hrefObj.startCharacter);
const afterChange = content.slice(hrefObj.startCharacter + hrefObj.value.length);
return `${upToChange}${hrefObj.newValue}${afterChange}`;
}
function sortByStartCharacter(a, b) {
if (a.startCharacter > b.startCharacter) {
return 1;
}
if (a.startCharacter < b.startCharacter) {
return -1;
}
return 0;
}
function applyChanges(_changes, _content) {
// make sure changes are sorted as changes affect all other changes afterwards
let changes = [..._changes].sort(sortByStartCharacter);
let content = _content.replace(/\n/g, 'XXXRocketProcessLocalReferencesXXX');
while (changes.length > 0) {
const hrefObj = changes.shift();
const diff = hrefObj.newValue.length - hrefObj.value.length;
content = replaceContent(hrefObj, content);
changes = changes.map(href => {
href.startCharacter = href.startCharacter + diff;
return href;
});
}
return content.replace(/XXXRocketProcessLocalReferencesXXX/g, '\n');
}
async function processLocalReferences(content) {
const inputPath = this.inputPath;
const { hrefs, assets } = extractReferences(content, inputPath);
const newHrefs = calculateNewHrefs(hrefs, inputPath);
const newAssets = calculateNewAssets(assets, inputPath);
const newContent = applyChanges([...newHrefs, ...newAssets], content);
return newContent;
}
module.exports = {
processLocalReferences,
};

View File

@@ -1,7 +1,6 @@
const path = require('path');
const fs = require('fs');
const { readdirSync } = require('fs');
const { processContentWithTitle } = require('@rocket/core/title');
function getDirectories(source) {
return readdirSync(source, { withFileTypes: true })
@@ -9,32 +8,6 @@ function getDirectories(source) {
.map(dirent => dirent.name);
}
let needSetForAll = true;
/**
* adds title from markdown headline to all pages
*
* @param collection
*/
function setTitleForAll(collection) {
if (needSetForAll) {
const all = collection.getAll();
all.forEach(page => {
page.data.addTitleHeadline = true;
const titleData = processContentWithTitle(
page.template.inputContent,
page.template._templateRender._engineName,
);
if (titleData) {
page.data.title = titleData.title;
page.data.eleventyNavigation = { ...titleData.eleventyNavigation };
page.data.addTitleHeadline = false;
}
});
needSetForAll = false;
}
}
const rocketCollections = {
configFunction: (eleventyConfig, { _inputDirCwdRelative }) => {
const sectionNames = getDirectories(_inputDirCwdRelative);
@@ -50,14 +23,8 @@ const rocketCollections = {
let docs = [
...collection.getFilteredByGlob(`${_inputDirCwdRelative}/${section}/**/*.md`),
];
docs.forEach(page => {
page.data.section = section;
});
docs = docs.filter(page => page.inputPath !== `./${indexSection}`);
// docs = addPrevNextUrls(docs);
setTitleForAll(collection);
return docs;
});
}
@@ -76,6 +43,7 @@ const rocketCollections = {
(b.data && b.data.eleventyNavigation && b.data.eleventyNavigation.order) || 0;
return aOrder - bOrder;
});
return headers;
});
}

View File

@@ -1,5 +1,6 @@
const path = require('path');
const fs = require('fs');
const { processLocalReferences } = require('./processLocalReferences.cjs');
function inlineFilePath(filePath) {
let data = fs.readFileSync(filePath, function (err, contents) {
@@ -22,6 +23,8 @@ const rocketFilters = {
});
eleventyConfig.addFilter('inlineFilePath', inlineFilePath);
eleventyConfig.addTransform('processLocalReferences', processLocalReferences);
},
};

View File

@@ -14,6 +14,10 @@ import { readConfig } from '@web/config-loader';
import { RocketStart } from './RocketStart.js';
import { RocketBuild } from './RocketBuild.js';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
/**
* @param {Partial<RocketCliOptions>} inConfig
* @returns {Promise<RocketCliOptions>}
@@ -32,7 +36,7 @@ export async function normalizeConfig(inConfig) {
watch: true,
inputDir: 'docs',
outputDir: '_site',
outputDevDir: path.resolve('_site-dev'),
outputDevDir: '_site-dev',
build: {},
devServer: {},
@@ -75,7 +79,8 @@ export async function normalizeConfig(inConfig) {
const _configDirCwdRelative = path.relative(process.cwd(), path.resolve(__configDir));
const _inputDirCwdRelative = path.join(_configDirCwdRelative, config.inputDir);
config._presetPathes = [];
// cli core preset is always first
config._presetPathes = [path.join(__dirname, '..', 'preset')];
for (const preset of config.presets) {
config._presetPathes.push(preset.path);

View File

@@ -0,0 +1,73 @@
const path = require('path');
const fs = require('fs');
const Image = require('@11ty/eleventy-img');
const { getComputedConfig } = require('./computedConfig.cjs');
async function createPageSocialImage({ title = '', subTitle = '', subTitle2 = '', footer = '' }) {
const rocketConfig = getComputedConfig();
const outputDir = path.join(rocketConfig.outputDevDir, '_merged_assets', '11ty-img');
const logoPath = path.join(rocketConfig._inputDirCwdRelative, '_merged_assets', 'logo.svg');
const logoBuffer = await fs.promises.readFile(logoPath);
const logo = logoBuffer.toString();
let svgStr = `
<svg xmlns="http://www.w3.org/2000/svg" fill="#4a4a4a" font-family="sans-serif" font-size="80" style="background-color:#fff" viewBox="0 0 1200 630">
<defs></defs>
<rect width="100%" height="100%" fill="#fff" />
<circle cx="1000" cy="230" r="530" fill="#ebebeb"></circle>
`;
if (logo) {
svgStr += `<g transform="matrix(0.7, 0, 0, 0.7, 500, 100)">${logo}</g>`;
}
if (title) {
svgStr += `
<text x="70" y="200" font-family="'Bitstream Vera Sans','Helvetica',sans-serif" font-weight="700">
${title}
</text>
`;
}
if (subTitle) {
svgStr += `
<text x="70" y="320" font-family="'Bitstream Vera Sans','Helvetica',sans-serif" font-weight="700" font-size="60">
${subTitle}
</text>
`;
}
if (subTitle2) {
svgStr += `
<text x="70" y="420" font-family="'Bitstream Vera Sans','Helvetica',sans-serif" font-weight="700" font-size="60">
${subTitle2}
</text>
`;
}
if (footer) {
svgStr += `
<text x="70" y="560" fill="gray" font-size="40">
${footer}
</text>
`;
}
svgStr += '</svg>';
let stats = await Image(Buffer.from(svgStr), {
widths: [1200], // Facebook Opengraph image is 1200 x 630
formats: ['png'],
outputDir,
urlPath: '/_merged_assets/11ty-img/',
sourceUrl: `${title}${subTitle}${footer}${logo}`, // This is only used to generate the output filename hash
});
return stats['png'][0].url;
}
module.exports = {
createPageSocialImage,
};

View File

@@ -0,0 +1,63 @@
const fs = require('fs');
const { processContentWithTitle } = require('@rocket/core/title');
const { createPageSocialImage } = require('./createPageSocialImage.cjs');
module.exports = {
titleMeta: async data => {
if (data.titleMeta) {
return data.titleMeta;
}
let text = await fs.promises.readFile(data.page.inputPath);
text = text.toString();
const titleMetaFromContent = processContentWithTitle(text, 'md');
if (titleMetaFromContent) {
return titleMetaFromContent;
}
return {};
},
title: async data => {
if (data.title) {
return data.title;
}
return data.titleMeta?.title;
},
eleventyNavigation: async data => {
if (data.eleventyNavigation) {
return data.eleventyNavigation;
}
return data.titleMeta?.eleventyNavigation;
},
section: async data => {
if (data.section) {
return data.section;
}
if (data.page.filePathStem) {
// filePathStem: '/sub/subsub/index'
// filePathStem: '/index',
const parts = data.page.filePathStem.split('/');
if (parts.length > 2) {
return parts[1];
}
}
},
socialMediaImage: async data => {
if (data.socialMediaImage) {
return data.socialMediaImage;
}
if (!data.title) {
return;
}
const section = data.section ? ' ' + data.section[0].toUpperCase() + data.section.slice(1) : '';
const footer = `${data.site.name}${section}`;
const imgUrl = await createPageSocialImage({
title: data.titleMeta.parts ? data.titleMeta.parts[0] : '',
subTitle:
data.titleMeta.parts && data.titleMeta.parts[1] ? `in ${data.titleMeta.parts[1]}` : '',
footer,
});
return imgUrl;
},
};

View File

@@ -57,6 +57,11 @@ describe('RocketCli e2e', () => {
return text;
}
function readStartOutput(fileName, options = {}) {
options.type = 'start';
return readOutput(fileName, options);
}
async function execute() {
await cli.setup();
cli.config.outputDevDir = path.join(__dirname, 'e2e-fixtures', '__output-dev');
@@ -67,6 +72,17 @@ describe('RocketCli e2e', () => {
await cli.run();
}
async function executeStart(pathToConfig) {
cli = new RocketCli({
argv: [
'start',
'--config-file',
path.join(__dirname, pathToConfig.split('/').join(path.sep)),
],
});
await execute();
}
afterEach(async () => {
if (cli?.cleanup) {
await cli.cleanup();
@@ -122,7 +138,7 @@ describe('RocketCli e2e', () => {
});
describe('setupDevAndBuildPlugins in config', () => {
it('can add a rollup plugin to build', async () => {
it('can add a rollup plugin via setupDevAndBuildPlugins for build command', async () => {
cli = new RocketCli({
argv: [
'build',
@@ -135,7 +151,7 @@ describe('RocketCli e2e', () => {
expect(inlineModule).to.equal('var a={test:"data"};console.log(a);');
});
it('can add a rollup plugin to dev', async () => {
it('can add a rollup plugin via setupDevAndBuildPlugins for start command', async () => {
cli = new RocketCli({
argv: [
'start',
@@ -199,39 +215,195 @@ describe('RocketCli e2e', () => {
type: 'start',
});
expect(indexHtml).to.equal(
'<p>You can show rocket config data like rocketConfig.absoluteBaseUrl = http://test-domain.com/</p>',
'<p>You can show rocket config data like rocketConfig.absoluteBaseUrl = <a href="http://test-domain.com/">http://test-domain.com/</a></p>',
);
});
it.skip('can add a pathprefix for the build output', async () => {
it('can add a pathprefix that will not influence the start command', async () => {
cli = new RocketCli({
argv: [
'build',
'start',
'--config-file',
path.join(__dirname, 'e2e-fixtures', 'content', 'eleventy.rocket.config.js'),
path.join(__dirname, 'e2e-fixtures', 'content', 'pathprefix.rocket.config.js'),
],
});
await execute();
// const indexHtml = await readOutput('index.html', {
// type: 'start',
// });
// expect(indexHtml).to.equal("<p>Markdown in 'docs/page/index.md'</p>");
const linkHtml = await readOutput('link/index.html', {
type: 'start',
});
expect(linkHtml).to.equal(
['<p><a href="../../">home</a></p>', '<p><a href="/">absolute home</a></p>'].join('\n'),
);
const assetHtml = await readOutput('use-assets/index.html', {
type: 'start',
});
expect(assetHtml).to.equal('<link rel="stylesheet" href="/_merged_assets/some.css">');
});
it.skip('works with an empty object in rocket.config.js', async () => {
it('can add a pathPrefix that will be used in the build command', async () => {
cli = new RocketCli({
argv: [
'build',
'--config-file',
path.join(__dirname, 'e2e-fixtures', 'content', 'empty.rocket.config.js'),
path.join(__dirname, 'e2e-fixtures', 'content', 'pathPrefix.rocket.config.js'),
],
});
await execute();
// const indexHtml = await readOutput('index.html', {
// type: 'start',
// });
// expect(indexHtml).to.equal("<p>Markdown in 'docs/page/index.md'</p>");
const linkHtml = await readOutput('link/index.html', {
stripServiceWorker: true,
stripToBody: true,
});
expect(linkHtml).to.equal(
[
'<p><a href="../../">home</a></p>',
'<p><a href="/my-sub-folder/">absolute home</a></p>',
].join('\n'),
);
const assetHtml = await readOutput('use-assets/index.html', {
stripServiceWorker: true,
});
expect(assetHtml).to.equal(
'<html><head><link rel="stylesheet" href="../41297ffa.css">\n\n</head><body>\n\n</body></html>',
);
});
it('will extract a title from markdown and set first folder as section', async () => {
cli = new RocketCli({
argv: [
'start',
'--config-file',
path.join(__dirname, 'e2e-fixtures', 'headlines', 'rocket.config.js'),
],
});
await execute();
const indexHtml = await readOutput('index.html', {
type: 'start',
});
const [indexTitle, indexSection] = indexHtml.split('\n');
expect(indexTitle).to.equal('Root');
expect(indexSection).to.be.undefined;
const subHtml = await readOutput('sub/index.html', {
type: 'start',
});
const [subTitle, subSection] = subHtml.split('\n');
expect(subTitle).to.equal('Root: Sub');
expect(subSection).to.equal('sub');
const subSubHtml = await readOutput('sub/subsub/index.html', {
type: 'start',
});
const [subSubTitle, subSubSection] = subSubHtml.split('\n');
expect(subSubTitle).to.equal('Sub: SubSub');
expect(subSubSection).to.equal('sub');
const sub2Html = await readOutput('sub2/index.html', {
type: 'start',
});
const [sub2Title, sub2Section] = sub2Html.split('\n');
expect(sub2Title).to.equal('Root: Sub2');
expect(sub2Section).to.equal('sub2');
const withDataHtml = await readOutput('with-data/index.html', {
type: 'start',
});
const [withDataTitle, withDataSection] = withDataHtml.split('\n');
expect(withDataTitle).to.equal('Set via data');
expect(withDataSection).be.undefined;
});
it('will create a social media image for every page', async () => {
cli = new RocketCli({
argv: [
'start',
'--config-file',
path.join(__dirname, 'e2e-fixtures', 'social-images', 'rocket.config.js'),
],
});
await execute();
const indexHtml = await readOutput('index.html', {
type: 'start',
});
expect(indexHtml).to.equal('/_merged_assets/11ty-img/c0a892f2-1200.png');
const guidesHtml = await readOutput('guides/first-pages/getting-started/index.html', {
type: 'start',
});
expect(guidesHtml).to.equal('/_merged_assets/11ty-img/58b7e437-1200.png');
});
it('will add "../" for links and image urls only within named template files', async () => {
await executeStart('e2e-fixtures/image-link/rocket.config.js');
const namedMdContent = [
'<p><a href="../">Root</a>',
'<a href="../guides/#with-anchor">Guides</a>',
'<a href="../one-level/raw/">Raw</a>',
'<a href="../../up-one-level/template/">Template</a>',
'<img src="../images-one-level/my-img.svg" alt="my-img">',
'<img src="/absolute-img.svg" alt="absolute-img"></p>',
];
const namedHtmlContent = [
'<div>',
' <a href="../">Root</a>',
' <a href="../guides/#with-anchor">Guides</a>',
' <a href="../one-level/raw/">Raw</a>',
' <a href="../../up-one-level/template/">Template</a>',
' <img src="../images-one-level/my-img.svg" alt="my-img">',
' <img src="/absolute-img.svg" alt="absolute-img">',
' <picture>',
' <source media="(min-width:465px)" srcset="../picture-min-465.jpg">',
' <img src="../../images-up-one-level/picture-fallback.jpg" alt="Fallback" style="width:auto;">',
' </picture>',
'</div>',
];
const rawHtml = await readStartOutput('raw/index.html');
expect(rawHtml, 'raw/index.html does not match').to.equal(namedHtmlContent.join('\n'));
const templateHtml = await readStartOutput('template/index.html');
expect(templateHtml, 'template/index.html does not match').to.equal(
namedHtmlContent.join('\n'),
);
const guidesHtml = await readStartOutput('guides/index.html');
expect(guidesHtml, 'guides/index.html does not match').to.equal(
[...namedMdContent, ...namedHtmlContent].join('\n'),
);
const noAdjustHtml = await readStartOutput('no-adjust/index.html');
expect(noAdjustHtml, 'no-adjust/index.html does not match').to.equal(
'<p>Nothing to adjust in here</p>',
);
// for index files no '../' will be added
const indexHtml = await readStartOutput('index.html');
expect(indexHtml, 'index.html does not match').to.equal(
[
'<p><a href="./">Root</a>',
'<a href="guides/#with-anchor">Guides</a>',
'<a href="./one-level/raw/">Raw</a>',
'<a href="../up-one-level/template/">Template</a>',
'<img src="./images-one-level/my-img.svg" alt="my-img">',
'<img src="/absolute-img.svg" alt="absolute-img"></p>',
'<div>',
' <a href="./">Root</a>',
' <a href="guides/#with-anchor">Guides</a>',
' <a href="./one-level/raw/">Raw</a>',
' <a href="../up-one-level/template/">Template</a>',
' <img src="./images-one-level/my-img.svg" alt="my-img">',
' <img src="/absolute-img.svg" alt="absolute-img">',
' <picture>',
' <source media="(min-width:465px)" srcset="./picture-min-465.jpg">',
' <img src="../images-up-one-level/picture-fallback.jpg" alt="Fallback" style="width:auto;">',
' </picture>',
'</div>',
].join('\n'),
);
});
});

View File

@@ -1,7 +0,0 @@
{{ content.html | safe }}
{% if content.jsCode %}
<script type="module">
{{ content.jsCode | safe }}
</script>
{% endif %}

View File

@@ -1,5 +1 @@
---
layout: layout.njk
---
Markdown in `docs/page/index.md`

View File

@@ -0,0 +1 @@
body { background: green; }

View File

@@ -1,7 +0,0 @@
{{ content.html | safe }}
{% if content.jsCode %}
<script type="module">
{{ content.jsCode | safe }}
</script>
{% endif %}

View File

@@ -1 +1,7 @@
---
layout: layout.njk
---
[home](../index.md)
<a href="{{ '/' | url }}">absolute home</a>

View File

@@ -0,0 +1,5 @@
---
layout: layout.njk
---
<link rel="stylesheet" href="{{ '/_assets/some.css' | asset | url }}">

View File

@@ -1,6 +1,6 @@
/** @type {Partial<import("../../../types/main").RocketCliOptions>} */
const config = {
pathPrefix: 'my-sub-folder',
pathPrefix: '/my-sub-folder/',
};
export default config;

View File

@@ -0,0 +1 @@
**/*.njk

View File

@@ -0,0 +1 @@
module.exports = 'do-not-generate-it';

View File

@@ -0,0 +1,2 @@
{{ title }}
{{ section }}

View File

@@ -0,0 +1 @@
# Root

View File

@@ -0,0 +1 @@
# Root >> Sub

View File

@@ -0,0 +1 @@
# Root >> Sub >> SubSub ||10

View File

@@ -0,0 +1 @@
# Root >> Sub2

View File

@@ -0,0 +1,3 @@
---
title: Set via data
---

View File

@@ -0,0 +1,4 @@
/** @type {Partial<import("../../../types/main").RocketCliOptions>} */
const config = {};
export default config;

View File

@@ -0,0 +1,19 @@
[Root](./index.md)
[Guides](./guides.md#with-anchor)
[Raw](./one-level/raw.html)
[Template](../up-one-level/template.njk)
![my-img](./images-one-level/my-img.svg)
![absolute-img](/absolute-img.svg)
<div>
<a href="./index.md">Root</a>
<a href="./guides.md#with-anchor">Guides</a>
<a href="./one-level/raw.html">Raw</a>
<a href="../up-one-level/template.njk">Template</a>
<img src="./images-one-level/my-img.svg" alt="my-img">
<img src="/absolute-img.svg" alt="absolute-img">
<picture>
<source media="(min-width:465px)" srcset="./picture-min-465.jpg">
<img src="../images-up-one-level/picture-fallback.jpg" alt="Fallback" style="width:auto;">
</picture>
</div>

View File

@@ -0,0 +1,3 @@
<svg height="100" width="100">
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
</svg>

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -0,0 +1,19 @@
[Root](./)
[Guides](./guides.md#with-anchor)
[Raw](./one-level/raw.html)
[Template](../up-one-level/template.njk)
![my-img](./images-one-level/my-img.svg)
![absolute-img](/absolute-img.svg)
<div>
<a href="./">Root</a>
<a href="./guides.md#with-anchor">Guides</a>
<a href="./one-level/raw.html">Raw</a>
<a href="../up-one-level/template.njk">Template</a>
<img src="./images-one-level/my-img.svg" alt="my-img">
<img src="/absolute-img.svg" alt="absolute-img">
<picture>
<source media="(min-width:465px)" srcset="./picture-min-465.jpg">
<img src="../images-up-one-level/picture-fallback.jpg" alt="Fallback" style="width:auto;">
</picture>
</div>

View File

@@ -0,0 +1 @@
Nothing to adjust in here

View File

@@ -0,0 +1,12 @@
<div>
<a href="./index.md">Root</a>
<a href="./guides.md#with-anchor">Guides</a>
<a href="./one-level/raw.html">Raw</a>
<a href="../up-one-level/template.njk">Template</a>
<img src="./images-one-level/my-img.svg" alt="my-img">
<img src="/absolute-img.svg" alt="absolute-img">
<picture>
<source media="(min-width:465px)" srcset="./picture-min-465.jpg">
<img src="../images-up-one-level/picture-fallback.jpg" alt="Fallback" style="width:auto;">
</picture>
</div>

View File

@@ -0,0 +1,12 @@
<div>
<a href="./index.md">Root</a>
<a href="./guides.md#with-anchor">Guides</a>
<a href="./one-level/raw.html">Raw</a>
<a href="../up-one-level/template.njk">Template</a>
<img src="./images-one-level/my-img.svg" alt="my-img">
<img src="/absolute-img.svg" alt="absolute-img">
<picture>
<source media="(min-width:465px)" srcset="./picture-min-465.jpg">
<img src="../images-up-one-level/picture-fallback.jpg" alt="Fallback" style="width:auto;">
</picture>
</div>

View File

@@ -0,0 +1,3 @@
/** @type {Partial<import("../../../types/main").RocketCliOptions>} */
const config = {};
export default config;

View File

@@ -1,7 +0,0 @@
{{ content.html | safe }}
{% if content.jsCode %}
<script type="module">
{{ content.jsCode | safe }}
</script>
{% endif %}

View File

@@ -1,5 +1 @@
---
layout: layout.njk
---
You can show rocket config data like rocketConfig.absoluteBaseUrl = {{rocketConfig.absoluteBaseUrl}}

View File

@@ -1,7 +0,0 @@
{{ content.html | safe }}
{% if content.jsCode %}
<script type="module">
{{ content.jsCode | safe }}
</script>
{% endif %}

View File

@@ -0,0 +1 @@
**/*.njk

View File

@@ -0,0 +1 @@
{{ socialMediaImage }}

View File

@@ -0,0 +1 @@
# First Pages >> Getting Started

View File

@@ -0,0 +1,12 @@
const { createPageSocialImage } = require('@rocket/cli');
module.exports = async function () {
const socialMediaImage = await createPageSocialImage({
title: 'Rocket',
subTitle: 'Static sites with',
subTitle2: 'a sprinkle of JavaScript.',
});
return {
socialMediaImage,
};
};

View File

@@ -0,0 +1 @@
# Rocket

View File

@@ -0,0 +1,4 @@
/** @type {Partial<import("../../../types/main").RocketCliOptions>} */
const config = {};
export default config;

View File

@@ -1 +0,0 @@
{{ content.html | safe }}

View File

@@ -23,7 +23,8 @@ describe('normalizeConfig', () => {
// testing pathes is always a little more complicted 😅
expect(config._inputDirCwdRelative).to.match(/empty\/docs$/);
expect(config._presetPathes[0]).to.match(/empty\/docs$/);
expect(config._presetPathes[0]).to.match(/cli\/preset$/);
expect(config._presetPathes[1]).to.match(/empty\/docs$/);
expect(config.outputDevDir).to.match(/_site-dev$/);
expect(cleanup(config)).to.deep.equal({

View File

@@ -1,6 +1,13 @@
# @rocket/core
## 0.1.1
### Patch Changes
- ef3b846: Enhance markdown title processing to return additional metaData (e.g. all parent parts)
## 0.1.0
### Minor Changes
- 1971f5d: Initial Release

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/core",
"version": "0.1.0",
"version": "0.1.1",
"publishConfig": {
"access": "public"
},
@@ -26,7 +26,8 @@
"scripts": {
"build:package": "rimraf dist && esbuild --platform=node --format=cjs --bundle --outfile=dist/title.cjs ./src/title/index.js",
"build:types": "tsc -p tsconfig.build.types.json",
"test": "cd ../../ && yarn test:browser \"packages/navigation2/test/**/*.test.js\"",
"debug": "cd ../../ && yarn debug --group core",
"test": "cd ../../ && yarn test:web --group core",
"test:watch": "yarn test --watch"
},
"files": [

View File

@@ -25,6 +25,7 @@ export function parseTitle(inTitle) {
let order = 0;
let navigationTitle = title;
let parent;
let titleParts = [title];
if (title.includes('>>')) {
const parts = title
.split('>>')
@@ -41,6 +42,7 @@ export function parseTitle(inTitle) {
title = `${parts[parts.length - 2]}: ${parts[parts.length - 1]}`;
}
}
titleParts = [...parts].reverse();
}
if (title.includes('||')) {
@@ -51,12 +53,15 @@ export function parseTitle(inTitle) {
if (parts.length !== 2) {
throw new Error('You can use || only once in `parseTitle`');
}
// remove || in titleParts
titleParts = titleParts.map(part => part.split('||')[0]).map(part => part.trim());
navigationTitle = navigationTitle.split('||').map(part => part.trim())[0];
key = key.split('||').map(part => part.trim())[0];
title = parts[0];
order = parseInt(parts[1]);
}
data.parts = titleParts;
data.title = title;
data.eleventyNavigation = {
key,

View File

@@ -6,4 +6,5 @@ export interface EleventyPage {
parent?: string;
order?: number;
};
parts: string[];
}

View File

@@ -10,6 +10,7 @@ describe('parseTitle', () => {
key: 'heading',
order: 0,
},
parts: ['heading'],
});
});
@@ -21,6 +22,7 @@ describe('parseTitle', () => {
key: 'Foo >>',
order: 0,
},
parts: ['Foo'],
});
});
@@ -33,6 +35,7 @@ describe('parseTitle', () => {
parent: 'Foo',
order: 0,
},
parts: ['Bar', 'Foo'],
});
});
@@ -45,6 +48,7 @@ describe('parseTitle', () => {
parent: 'Foo >> Bar',
order: 0,
},
parts: ['Baz', 'Bar', 'Foo'],
});
});
@@ -56,6 +60,7 @@ describe('parseTitle', () => {
key: 'heading',
order: 4,
},
parts: ['heading'],
});
expect(parseTitle('Foo >> Bar >> Baz ||4')).to.deep.equal({
@@ -66,6 +71,7 @@ describe('parseTitle', () => {
order: 4,
parent: 'Foo >> Bar',
},
parts: ['Baz', 'Bar', 'Foo'],
});
});

View File

@@ -1,6 +1,19 @@
# @rocket/drawer
## 0.1.2
### Patch Changes
- 897892d: bump dependencies
## 0.1.1
### Patch Changes
- d955b43: reset translation on teardown overlay controller
## 0.1.0
### Minor Changes
- 1971f5d: Initial Release

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/drawer",
"version": "0.1.0",
"version": "0.1.2",
"publishConfig": {
"access": "public"
},
@@ -33,7 +33,7 @@
"testing"
],
"dependencies": {
"@lion/overlays": "^0.22.8",
"@lion/overlays": "^0.23.2",
"lit-element": "^2.4.0"
},
"types": "dist-types/index.d.ts"

View File

@@ -64,6 +64,11 @@ export class RocketDrawer extends OverlayMixin(LitElement) {
}
}
_teardownOverlayCtrl() {
super._teardownOverlayCtrl();
this._overlayCtrl.contentNode.style.transform = 'translateX(0)';
}
/** @param {import('lit-element').PropertyValues } changedProperties */
updated(changedProperties) {
super.updated(changedProperties);

View File

@@ -1,6 +1,16 @@
# @rocket/eleventy-plugin-mdjs-unified
## 0.2.0
### Minor Changes
- 4858271: **BREAKING CHANGES**: to support all 11ty templates
- returning html content directly instead of an object with html, js, stories
- no longer process relative links
## 0.1.0
### Minor Changes
- 1971f5d: Initial Release

View File

@@ -2,4 +2,4 @@
Use mdjs in your 11ty site.
For docs please see our homepage [https://rocket.modern-web.dev/docs/markdown-javascript/overview/](https://rocket.modern-web.dev/docs/markdown-javascript/overview/).
For docs please see our homepage [https://rocket.modern-web.dev/docs/eleventy-plugins/mdjs-unified/](https://rocket.modern-web.dev/docs/eleventy-plugins/mdjs-unified/).

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/eleventy-plugin-mdjs-unified",
"version": "0.1.0",
"version": "0.2.0",
"publishConfig": {
"access": "public"
},
@@ -31,7 +31,7 @@
"mdjs"
],
"dependencies": {
"@mdjs/core": "^0.6.0",
"@mdjs/core": "^0.6.1",
"es-module-lexer": "^0.3.26",
"unist-util-visit": "^2.0.3"
},

View File

@@ -12,61 +12,6 @@ const { parseTitle } = require('@rocket/core/title');
/** @typedef {import('../types/code').NodeElement} NodeElement */
/** @typedef {import('unist').Node} Node */
/**
* @param {string} link
*/
function isInternalLink(link) {
if (link.startsWith('http') || link.startsWith('/')) {
return false;
}
return true;
}
/**
* @param {*} pluginOptions
*/
function adjustLinks(pluginOptions) {
/**
* @param {NodeElement} node
*/
const elementVisitor = node => {
if (node.tagName === 'a') {
const fullHref = node.properties && node.properties.href ? node.properties.href : undefined;
if (fullHref) {
const [href, anchor] = fullHref.split('#');
const suffix = anchor ? `#${anchor}` : '';
const { inputPath } = pluginOptions.page;
if (isInternalLink(href) && href.endsWith('.md')) {
if (href.endsWith('index.md')) {
node.properties.href = `${href.substring(0, href.lastIndexOf('/') + 1)}${suffix}`;
} else {
node.properties.href = `${href.substring(0, href.length - 3)}/${suffix}`;
}
if (inputPath.endsWith('.md')) {
if (inputPath.endsWith('index.md')) {
// nothing
} else {
node.properties.href = `../${node.properties.href}`;
}
}
}
}
}
};
/**
* @param {Node} tree
*/
function transformer(tree) {
visit(tree, 'element', elementVisitor);
return tree;
}
return transformer;
}
function cleanupTitleHeadline() {
/**
* @param {NodeChildren} node
@@ -108,21 +53,6 @@ function addCleanupTitleHeadline(plugins) {
return plugins;
}
/**
* @param {MdjsProcessPlugin[]} plugins
*/
function addAdjustLinksForEleventy(plugins) {
if (plugins.findIndex(plugin => plugin.name === 'adjustLinks') === -1) {
// add plugins right after remark2rehype
const remark2rehypePluginIndex = plugins.findIndex(plugin => plugin.name === 'remark2rehype');
plugins.splice(remark2rehypePluginIndex + 1, 0, {
name: 'adjustLinks',
plugin: adjustLinks,
});
}
return plugins;
}
/**
* @param {string} source
* @param {string} inputPath
@@ -196,7 +126,6 @@ function eleventyUnified(pluginOptions) {
const result = await mdjsProcess(mdjs, {
setupUnifiedPlugins: [
addCleanupTitleHeadline,
addAdjustLinksForEleventy,
...userSetupUnifiedPlugins,
addEleventyPageToEveryPlugin,
],
@@ -204,7 +133,15 @@ function eleventyUnified(pluginOptions) {
result.jsCode = await processImports(result.jsCode, eleventySettings.page.inputPath);
return result;
let code = result.html;
if (result.jsCode) {
code += `
<script type="module">
${result.jsCode}
</script>
`;
}
return code;
}
return {
set: () => {

View File

@@ -44,12 +44,8 @@ describe('eleventy-plugin-mdjs-unified', () => {
const files = await renderEleventy('./test-node/fixtures/md');
expect(files).to.deep.equal([
{
html: {
stories: [],
jsCode: '',
html:
'<h1 id="first"><a aria-hidden="true" tabindex="-1" href="#first"><span class="icon icon-link"></span></a>First</h1>',
},
html:
'<h1 id="first"><a aria-hidden="true" tabindex="-1" href="#first"><span class="icon icon-link"></span></a>First</h1>',
name: 'first/index.html',
},
]);
@@ -59,26 +55,8 @@ describe('eleventy-plugin-mdjs-unified', () => {
const files = await renderEleventy('./test-node/fixtures/mdjs');
expect(files).to.deep.equal([
{
html: {
html:
'<h1 id="first"><a aria-hidden="true" tabindex="-1" href="#first"><span class="icon icon-link"></span></a>First</h1>\n<pre class="language-js"><code class="language-js"><span class="token keyword">const</span> foo <span class="token operator">=</span> <span class="token string">\'bar\'</span><span class="token punctuation">;</span>\n<span class="token keyword module">import</span> <span class="token punctuation">{</span> html <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'lit-html\'</span><span class="token punctuation">;</span>\n</code></pre>\n<mdjs-story mdjs-story-name="inline"></mdjs-story>\n<mdjs-preview mdjs-story-name="withBorder"></mdjs-preview>',
jsCode:
'\nexport const inline = () => html` <p>main</p> `;\nexport const withBorder = () => html` <p>main</p> `;\nconst rootNode = document;\nconst stories = [{ key: \'inline\', story: inline, code: `<pre class="language-js"><code class="language-js"><span class="token keyword module">export</span> <span class="token keyword">const</span> <span class="token function-variable function">inline</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> html<span class="token template-string"><span class="token template-punctuation string">\\`</span><span class="token html language-html"> <span class="token tag"><span class="token tag"><span class="token punctuation">&#x3C;</span>p</span><span class="token punctuation">></span></span>main<span class="token tag"><span class="token tag"><span class="token punctuation">&#x3C;/</span>p</span><span class="token punctuation">></span></span> </span><span class="token template-punctuation string">\\`</span></span><span class="token punctuation">;</span>\n</code></pre>` }, { key: \'withBorder\', story: withBorder, code: `<pre class="language-js"><code class="language-js"><span class="token keyword module">export</span> <span class="token keyword">const</span> <span class="token function-variable function">withBorder</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> html<span class="token template-string"><span class="token template-punctuation string">\\`</span><span class="token html language-html"> <span class="token tag"><span class="token tag"><span class="token punctuation">&#x3C;</span>p</span><span class="token punctuation">></span></span>main<span class="token tag"><span class="token tag"><span class="token punctuation">&#x3C;/</span>p</span><span class="token punctuation">></span></span> </span><span class="token template-punctuation string">\\`</span></span><span class="token punctuation">;</span>\n</code></pre>` }];\nfor (const story of stories) {\n const storyEl = rootNode.querySelector(`[mdjs-story-name="${story.key}"]`);\n storyEl.codeHasHtml = true;\n storyEl.story = story.story;\n storyEl.code = story.code;\n};\nif (!customElements.get(\'mdjs-preview\')) { import(\'@mdjs/mdjs-preview/mdjs-preview.js\'); }\nif (!customElements.get(\'mdjs-story\')) { import(\'@mdjs/mdjs-story/mdjs-story.js\'); }',
stories: [
{
code: 'export const inline = () => html` <p>main</p> `;',
key: 'inline',
name: 'inline',
type: 'js',
},
{
code: 'export const withBorder = () => html` <p>main</p> `;',
key: 'withBorder',
name: 'withBorder',
type: 'js',
},
],
},
html:
'<h1 id="first"><a aria-hidden="true" tabindex="-1" href="#first"><span class="icon icon-link"></span></a>First</h1>\n<pre class="language-js"><code class="language-js"><span class="token keyword">const</span> foo <span class="token operator">=</span> <span class="token string">\'bar\'</span><span class="token punctuation">;</span>\n<span class="token keyword module">import</span> <span class="token punctuation">{</span> html <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'lit-html\'</span><span class="token punctuation">;</span>\n</code></pre>\n<mdjs-story mdjs-story-name="inline"></mdjs-story>\n<mdjs-preview mdjs-story-name="withBorder"></mdjs-preview>\n <script type="module">\n \nexport const inline = () => html` <p>main</p> `;\nexport const withBorder = () => html` <p>main</p> `;\nconst rootNode = document;\nconst stories = [{ key: \'inline\', story: inline, code: `<pre class="language-js"><code class="language-js"><span class="token keyword module">export</span> <span class="token keyword">const</span> <span class="token function-variable function">inline</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> html<span class="token template-string"><span class="token template-punctuation string">\\`</span><span class="token html language-html"> <span class="token tag"><span class="token tag"><span class="token punctuation">&#x3C;</span>p</span><span class="token punctuation">></span></span>main<span class="token tag"><span class="token tag"><span class="token punctuation">&#x3C;/</span>p</span><span class="token punctuation">></span></span> </span><span class="token template-punctuation string">\\`</span></span><span class="token punctuation">;</span>\n</code></pre>` }, { key: \'withBorder\', story: withBorder, code: `<pre class="language-js"><code class="language-js"><span class="token keyword module">export</span> <span class="token keyword">const</span> <span class="token function-variable function">withBorder</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> html<span class="token template-string"><span class="token template-punctuation string">\\`</span><span class="token html language-html"> <span class="token tag"><span class="token tag"><span class="token punctuation">&#x3C;</span>p</span><span class="token punctuation">></span></span>main<span class="token tag"><span class="token tag"><span class="token punctuation">&#x3C;/</span>p</span><span class="token punctuation">></span></span> </span><span class="token template-punctuation string">\\`</span></span><span class="token punctuation">;</span>\n</code></pre>` }];\nfor (const story of stories) {\n const storyEl = rootNode.querySelector(`[mdjs-story-name="${story.key}"]`);\n storyEl.codeHasHtml = true;\n storyEl.story = story.story;\n storyEl.code = story.code;\n};\nif (!customElements.get(\'mdjs-preview\')) { import(\'@mdjs/mdjs-preview/mdjs-preview.js\'); }\nif (!customElements.get(\'mdjs-story\')) { import(\'@mdjs/mdjs-story/mdjs-story.js\'); }\n </script>\n ',
name: 'first/index.html',
},
]);
@@ -88,11 +66,8 @@ describe('eleventy-plugin-mdjs-unified', () => {
const files = await renderEleventy('./test-node/fixtures/mdjs-import');
expect(files).to.deep.equal([
{
html: {
html: '<p>first</p>',
jsCode: "import '../import-me.js';\nimport('../import-me-too.js');",
stories: [],
},
html:
"<p>first</p>\n <script type=\"module\">\n import '../import-me.js';\nimport('../import-me-too.js');\n </script>\n ",
name: 'first/index.html',
},
]);
@@ -102,11 +77,8 @@ describe('eleventy-plugin-mdjs-unified', () => {
const files = await renderEleventy('./test-node/fixtures/mdjs-import-in-subpage');
expect(files).to.deep.equal([
{
html: {
html: '<p>first</p>',
jsCode: "import '../../import-me.js';\nimport('../../import-me-too.js');",
stories: [],
},
html:
"<p>first</p>\n <script type=\"module\">\n import '../../import-me.js';\nimport('../../import-me-too.js');\n </script>\n ",
name: 'subpage/first/index.html',
},
]);
@@ -116,62 +88,19 @@ describe('eleventy-plugin-mdjs-unified', () => {
const files = await renderEleventy('./test-node/fixtures/mdjs-import-index');
expect(files).to.deep.equal([
{
html: {
html: '<p>index</p>',
jsCode: "import './import-me.js';\nimport('./import-me-too.js');",
stories: [],
},
html:
"<p>index</p>\n <script type=\"module\">\n import './import-me.js';\nimport('./import-me-too.js');\n </script>\n ",
name: 'index.html',
},
]);
});
it('rewrites links to work with 11ty', async () => {
const files = await renderEleventy('./test-node/fixtures/links');
const sortedFiles = files.sort((a, b) => a.name.length - b.name.length);
expect(sortedFiles).to.deep.equal([
{
html: {
html: [
'<p><a href="./file/">file</a>',
'<a href="./folder/folderfile/">folder file</a>',
'<a href="./file/#my-anchor">file with my anchor</a>',
'<a href="./folder/folderfile/#my-anchor">folder file with my anchor</a></p>',
].join('\n'),
jsCode: '',
stories: [],
},
name: 'index.html',
},
{
html: {
html: '<p>file</p>',
jsCode: '',
stories: [],
},
name: 'file/index.html',
},
{
html: {
html: '<p>folder index file</p>',
jsCode: '',
stories: [],
},
name: 'folder/index.html',
},
]);
});
it('allows to configure the plugins for unity', async () => {
const files = await renderEleventy('./test-node/fixtures/plugin-configure');
expect(files).to.deep.equal([
{
html: {
stories: [],
jsCode: '',
html:
'<h1 id="first"><a class="anchor" href="#first"><span class="icon icon-link"></span></a>First</h1>',
},
html:
'<h1 id="first"><a class="anchor" href="#first"><span class="icon icon-link"></span></a>First</h1>',
name: 'first/index.html',
},
]);

View File

@@ -1,6 +1,19 @@
# @rocket/eleventy-rocket-nav
## 0.2.1
### Patch Changes
- 897892d: bump dependencies
## 0.2.0
### Minor Changes
- 4858271: Adjust templates for change in `@rocket/eleventy-plugin-mdjs-unified` as it now returns html directly instead of an object with html, js, stories
## 0.1.0
### Minor Changes
- 1971f5d: Initial Release

View File

@@ -94,13 +94,10 @@ function findNavigationEntries(nodes = [], key = '') {
entry.title = entry.key;
}
if (entry.key) {
if (!headingsCache.has(entry.templateContent.html)) {
headingsCache.set(
entry.templateContent.html,
getHeadingsOfHtml(entry.templateContent.html),
);
if (!headingsCache.has(entry.templateContent)) {
headingsCache.set(entry.templateContent, getHeadingsOfHtml(entry.templateContent));
}
const headings = /** @type {Heading[]} */ (headingsCache.get(entry.templateContent.html));
const headings = /** @type {Heading[]} */ (headingsCache.get(entry.templateContent));
const anchors = headings.map(heading => ({
key: heading.text + Math.random(),
parent: entry.key,
@@ -125,13 +122,10 @@ function findNavigationEntries(nodes = [], key = '') {
function rocketPageAnchors(nodes, { title }) {
for (const entry of nodes) {
if (entry.data && entry.data.title === title) {
if (!headingsCache.has(entry.templateContent.html)) {
headingsCache.set(
entry.templateContent.html,
getHeadingsOfHtml(entry.templateContent.html),
);
if (!headingsCache.has(entry.templateContent)) {
headingsCache.set(entry.templateContent, getHeadingsOfHtml(entry.templateContent));
}
const headings = /** @type {Heading[]} */ (headingsCache.get(entry.templateContent.html));
const headings = /** @type {Heading[]} */ (headingsCache.get(entry.templateContent));
const anchors = headings.map(heading => ({
key: heading.text + Math.random(),
parent: entry.key,

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/eleventy-rocket-nav",
"version": "0.1.0",
"version": "0.2.1",
"publishConfig": {
"access": "public"
},
@@ -27,7 +27,7 @@
"eleventy-plugin"
],
"dependencies": {
"dependency-graph": "^0.9.0",
"dependency-graph": "^0.10.0",
"sax-wasm": "^2.0.0"
},
"types": "dist-types/index.d.ts"

View File

@@ -4,9 +4,7 @@ export interface NavigationNode {
key: string;
url: string;
pluginType?: string;
templateContent: {
html: string;
};
templateContent: string;
data?: {
title: string;
page: {

View File

@@ -1,6 +1,41 @@
# @rocket/launch
## 0.2.1
### Patch Changes
- 86c3a4b: adds themable CSS custom properties to <inline-notification>
- 7dd6f4c: Make default logo work with auto generating social media images
- Updated dependencies [897892d]
- @rocket/drawer@0.1.2
## 0.2.0
### Minor Changes
- ef3b846: Add a default "core" preset to the cli package which provides fundaments like eleventConfig data, eleventyComputed data, logo, site name, simple layout, ...
- 4858271: Adjust templates for change in `@rocket/eleventy-plugin-mdjs-unified` as it now returns html directly instead of an object with html, js, stories
### Patch Changes
- 25adb74: feat(launch): add icons for discord and telegram
## 0.1.2
### Patch Changes
- 496a1b0: Improves accessibility of the 404 page
## 0.1.1
### Patch Changes
- 3468ff9: Do not double url social media images
- Updated dependencies [d955b43]
- @rocket/drawer@0.1.1
## 0.1.0
### Minor Changes
- 1971f5d: Initial Release

View File

@@ -31,26 +31,29 @@ export class InlineNotification extends LitElement {
}
:host([type='tip']) {
background-color: rgba(221, 221, 221, 0.3);
border-color: #42b983;
background-color: var(--inline-notification-tip-background-color, rgba(221, 221, 221, 0.3));
border-color: var(--inline-notification-tip-border-color, #42b983);
}
:host([type='warning']) {
background-color: rgba(255, 229, 100, 0.2);
border-color: #e7c000;
}
:host([type='warning']) h3 {
color: #b29400;
background-color: var(
--inline-notification-warning-background-color,
rgba(255, 229, 100, 0.2)
);
border-color: var(--inline-notification-warning-border-color, #e7c000);
}
:host([type='danger']) {
background-color: rgba(192, 0, 0, 0.1);
border-color: #c00;
background-color: var(--inline-notification-danger-background-color, rgba(192, 0, 0, 0.1));
border-color: var(--inline-notification-danger-border-color, #c00);
}
:host([type='warning']) h3 {
color: var(--inline-notification-warning-heading-color, #b29400);
}
:host([type='danger']) h3 {
color: #900;
color: var(--inline-notification-danger-heading-color, #900);
}
::slotted(p) {

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/launch",
"version": "0.1.0",
"version": "0.2.1",
"publishConfig": {
"access": "public"
},
@@ -31,7 +31,7 @@
"preset"
],
"dependencies": {
"@rocket/drawer": "^0.1.0",
"@rocket/drawer": "^0.1.2",
"@rocket/navigation": "^0.1.0"
}
}

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -1,39 +1,127 @@
<!--Handcrafted by Saleh Riaz Qureshi - www.salehriaz.com - salehriazq@gmail.com - dribbble.com/salehriaz - behance.net/salehriaz - twitter.com/salehriazq - facebook.com/salehriazqureshi - instagram.com/salehriaz
Please use this SVG with attribution to the author i.e Saleh Riaz
-->
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 177.65 227.57">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 177.65 227.57">
<defs>
<style>.cls-astronaut-1{fill:#f2f2f2;}.cls-astronaut-2{fill:url(#linear-gradient);}.cls-astronaut-12,.cls-astronaut-3{fill:#dedfe0;}.cls-astronaut-4{fill:#c6c6c6;}.cls-astronaut-5{fill:#e8e8e8;}.cls-astronaut-6{isolation:isolate;}.cls-astronaut-7{fill:#b5b5b5;}.cls-astronaut-8{fill:#969696;}.cls-astronaut-9{clip-path:url(#clip-path);}.cls-astronaut-10{fill:#ffcb39;}.cls-astronaut-11,.cls-astronaut-26{fill:#fff;}.cls-astronaut-11{mix-blend-mode:soft-light;}.cls-astronaut-12{mix-blend-mode:multiply;}.cls-astronaut-13{clip-path:url(#clip-path-2);}.cls-astronaut-14{fill:#5208bc;}.cls-astronaut-15{fill:#d3d3d3;}.cls-astronaut-16{fill:url(#linear-gradient-3);}.cls-astronaut-17{fill:#fcfcfc;}.cls-astronaut-18{clip-path:url(#clip-path-3);}.cls-astronaut-19{fill:#c4c4c4;}.cls-astronaut-20{fill:#adadad;}.cls-astronaut-21{clip-path:url(#clip-path-4);}.cls-astronaut-22{clip-path:url(#clip-path-5);}.cls-astronaut-23{fill:#b2b2b2;}.cls-astronaut-24{clip-path:url(#clip-path-6);}.cls-astronaut-25{clip-path:url(#clip-path-7);}.cls-astronaut-27{fill:#7f1bbf;}.cls-astronaut-28{fill:url(#linear-gradient-4);}.cls-astronaut-29{fill:#d8d8d8;}</style>
<linearGradient id="linear-gradient" x1="-49.41" y1="199.04" x2="-35.42" y2="199.04" gradientTransform="translate(102.6 -105.72)" gradientUnits="userSpaceOnUse">
<style>
.cls-astronaut-1 {
fill: #f2f2f2;
}
.cls-astronaut-2 {
fill: url("#astronaut-linear-gradient");
}
.cls-astronaut-12,
.cls-astronaut-3 {
fill: #dedfe0;
}
.cls-astronaut-4 {
fill: #c6c6c6;
}
.cls-astronaut-5 {
fill: #e8e8e8;
}
.cls-astronaut-6 {
isolation: isolate;
}
.cls-astronaut-7 {
fill: #b5b5b5;
}
.cls-astronaut-8 {
fill: #969696;
}
.cls-astronaut-9 {
clip-path: url("#astronaut-clip-path");
}
.cls-astronaut-10 {
fill: #ffcb39;
}
.cls-astronaut-11,
.cls-astronaut-26 {
fill: #fff;
}
.cls-astronaut-11 {
mix-blend-mode: soft-light;
}
.cls-astronaut-12 {
mix-blend-mode: multiply;
}
.cls-astronaut-13 {
clip-path: url("#astronaut-clip-path-2");
}
.cls-astronaut-14 {
fill: #5208bc;
}
.cls-astronaut-15 {
fill: #d3d3d3;
}
.cls-astronaut-16 {
fill: url("#astronaut-linear-gradient-3");
}
.cls-astronaut-17 {
fill: #fcfcfc;
}
.cls-astronaut-18 {
clip-path: url("#astronaut-clip-path-3");
}
.cls-astronaut-19 {
fill: #c4c4c4;
}
.cls-astronaut-20 {
fill: #adadad;
}
.cls-astronaut-21 {
clip-path: url("#astronaut-clip-path-4");
}
.cls-astronaut-22 {
clip-path: url("#astronaut-clip-path-5");
}
.cls-astronaut-23 {
fill: #b2b2b2;
}
.cls-astronaut-24 {
clip-path: url("#astronaut-clip-path-6");
}
.cls-astronaut-25 {
clip-path: url("#astronaut-clip-path-7");
}
.cls-astronaut-27 {
fill: #7f1bbf;
}
.cls-astronaut-28 {
fill: url("#astronaut-linear-gradient-4");
}
.cls-astronaut-29 {
fill: #d8d8d8;
}
</style>
<linearGradient id="astronaut-linear-gradient" x1="-49.41" y1="199.04" x2="-35.42" y2="199.04" gradientTransform="translate(102.6 -105.72)" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#9e23cc"/>
<stop offset="1" stop-color="#4619bf"/>
</linearGradient>
<clipPath id="clip-path">
<path class="cls-astronaut-1" d="M102.52,141l-.74.43a1,1,0,0,0-.31,1.48c3.75,5,15.52,28.93,19,36.07a2.4,2.4,0,0,1-1,3.14l-17.6,10.18a2.41,2.41,0,0,1-2.84-.31c-2.49-2.3-8.3-7.8-15.37-15.5-9.49-10.32-20.91-30.07-24.92-40s-4-10-5.95-19.4c-4.48,5.71-3.15,19.09-2.79,22.06a2.17,2.17,0,0,0,.42,1.05c1.48,2,7.26,9.65,8.58,11.94,1.52,2.63,0,4.7-1.11,4.16A86.32,86.32,0,0,1,50,151a1.52,1.52,0,0,0-1.43-.22c-1.78.7,1.08,3.23,1.08,3.23a47.17,47.17,0,0,0,5.68,3.74,3.72,3.72,0,0,1,2.05,2.61,2.31,2.31,0,0,1-.68,2.32c-3.69,3.32-9.35,1.69-12.48.38a8.71,8.71,0,0,1-4-3.3,19,19,0,0,1-3.09-9.08,18.73,18.73,0,0,0-2.7-10.74c-14.13-27.08,3.31-51.12,4.86-55.66,9-3.18,15.13-10.62,22.07-14.56l-.21.12C68.07,65.77,76.72,63.65,84,57.4c4.71.93,35.09-1.66,51.52,24.1a18.73,18.73,0,0,0,8,7.69,19,19,0,0,1,6.33,7.21,8.71,8.71,0,0,1,.89,5.07c-.43,3.36-1.84,9.08-6.55,10.62a2.31,2.31,0,0,1-2.35-.57,3.72,3.72,0,0,1-1.24-3.08,47.17,47.17,0,0,0-.41-6.79s-.76-3.72-2.25-2.55a1.52,1.52,0,0,0-.53,1.35c.36,3.46,1.8,8.8.56,9.51s-2.63,1.52-4.16-1.11c-1.32-2.29-5.11-11.13-6.07-13.39a2.17,2.17,0,0,0-.7-.89c-2.39-1.79-13.33-9.62-20.51-8.58,7.2,6.37,7.2,6.38,13.85,14.83s18.07,28.2,22.29,41.57c3.15,10,5,17.75,5.78,21.05a2.41,2.41,0,0,1-1.14,2.62l-17.6,10.18a2.4,2.4,0,0,1-3.2-.73c-4.45-6.58-19.32-28.71-21.79-34.46a1,1,0,0,0-1.43-.47l-.74.43"/>
<clipPath id="astronaut-clip-path">
<path
class="cls-astronaut-1"
d="M102.52,141l-.74.43a1,1,0,0,0-.31,1.48c3.75,5,15.52,28.93,19,36.07a2.4,2.4,0,0,1-1,3.14l-17.6,10.18a2.41,2.41,0,0,1-2.84-.31c-2.49-2.3-8.3-7.8-15.37-15.5-9.49-10.32-20.91-30.07-24.92-40s-4-10-5.95-19.4c-4.48,5.71-3.15,19.09-2.79,22.06a2.17,2.17,0,0,0,.42,1.05c1.48,2,7.26,9.65,8.58,11.94,1.52,2.63,0,4.7-1.11,4.16A86.32,86.32,0,0,1,50,151a1.52,1.52,0,0,0-1.43-.22c-1.78.7,1.08,3.23,1.08,3.23a47.17,47.17,0,0,0,5.68,3.74,3.72,3.72,0,0,1,2.05,2.61,2.31,2.31,0,0,1-.68,2.32c-3.69,3.32-9.35,1.69-12.48.38a8.71,8.71,0,0,1-4-3.3,19,19,0,0,1-3.09-9.08,18.73,18.73,0,0,0-2.7-10.74c-14.13-27.08,3.31-51.12,4.86-55.66,9-3.18,15.13-10.62,22.07-14.56l-.21.12C68.07,65.77,76.72,63.65,84,57.4c4.71.93,35.09-1.66,51.52,24.1a18.73,18.73,0,0,0,8,7.69,19,19,0,0,1,6.33,7.21,8.71,8.71,0,0,1,.89,5.07c-.43,3.36-1.84,9.08-6.55,10.62a2.31,2.31,0,0,1-2.35-.57,3.72,3.72,0,0,1-1.24-3.08,47.17,47.17,0,0,0-.41-6.79s-.76-3.72-2.25-2.55a1.52,1.52,0,0,0-.53,1.35c.36,3.46,1.8,8.8.56,9.51s-2.63,1.52-4.16-1.11c-1.32-2.29-5.11-11.13-6.07-13.39a2.17,2.17,0,0,0-.7-.89c-2.39-1.79-13.33-9.62-20.51-8.58,7.2,6.37,7.2,6.38,13.85,14.83s18.07,28.2,22.29,41.57c3.15,10,5,17.75,5.78,21.05a2.41,2.41,0,0,1-1.14,2.62l-17.6,10.18a2.4,2.4,0,0,1-3.2-.73c-4.45-6.58-19.32-28.71-21.79-34.46a1,1,0,0,0-1.43-.47l-.74.43"/>
</clipPath>
<clipPath id="clip-path-2">
<clipPath id="astronaut-clip-path-2">
<circle class="cls-astronaut-2" cx="60.18" cy="93.32" r="6.99" transform="translate(-38.64 42.68) rotate(-30.05)"/>
</clipPath>
<linearGradient id="linear-gradient-3" x1="-48.06" y1="218.81" x2="-16.1" y2="218.81" gradientTransform="translate(113.84 -113.31)" xlink:href="#linear-gradient"/>
<clipPath id="clip-path-3">
<path class="cls-astronaut-3" d="M129.12,178.73l10.53,16.4a11.24,11.24,0,0,0,8.07,4.42,15.15,15.15,0,0,0,4.35-.21,18,18,0,0,0,5.6-2.12c9.16-5.25,17.65-10.09,8.59-17.5a15,15,0,0,0-5.65-2.87c-.87-.23-1.73-.43-2.51-.61a10,10,0,0,1-6.6-4.91l-2.11-3.75Z"/>
<linearGradient id="astronaut-linear-gradient-3" x1="-48.06" y1="218.81" x2="-16.1" y2="218.81" gradientTransform="translate(113.84 -113.31)" xlink:href="#astronaut-linear-gradient"/>
<clipPath id="astronaut-clip-path-3">
<path
class="cls-astronaut-3"
d="M129.12,178.73l10.53,16.4a11.24,11.24,0,0,0,8.07,4.42,15.15,15.15,0,0,0,4.35-.21,18,18,0,0,0,5.6-2.12c9.16-5.25,17.65-10.09,8.59-17.5a15,15,0,0,0-5.65-2.87c-.87-.23-1.73-.43-2.51-.61a10,10,0,0,1-6.6-4.91l-2.11-3.75Z"/>
</clipPath>
<clipPath id="clip-path-4">
<clipPath id="astronaut-clip-path-4">
<path class="cls-astronaut-3" d="M122.22,182.72l9,17.31a11.24,11.24,0,0,1-.19,9.2,15.15,15.15,0,0,1-2.36,3.67,18,18,0,0,1-4.63,3.8c-9.12,5.33-17.55,10.27-19.45-1.27a15,15,0,0,1,.33-6.33c.24-.87.48-1.71.73-2.48a10,10,0,0,0-1-8.17l-2.2-3.69Z"/>
</clipPath>
<clipPath id="clip-path-5">
<clipPath id="astronaut-clip-path-5">
<path id="ear" class="cls-astronaut-4" d="M11.68,50.55h0a0,0,0,0,1,0,0V68.81a0,0,0,0,1,0,0h0a7.3,7.3,0,0,1-7.3-7.3V57.86a7.3,7.3,0,0,1,7.3-7.3Z" transform="matrix(0.87, -0.5, 0.5, 0.87, -28.81, 12.04)"/>
</clipPath>
<clipPath id="clip-path-6">
<clipPath id="astronaut-clip-path-6">
<path id="ear-2" data-name="ear" class="cls-astronaut-4" d="M82.77,9.43h0a0,0,0,0,1,0,0V27.69a0,0,0,0,1,0,0h0a7.3,7.3,0,0,1-7.3-7.3V16.73a7.3,7.3,0,0,1,7.3-7.3Z" transform="translate(156.89 -4.99) rotate(149.95)"/>
</clipPath>
<clipPath id="clip-path-7">
<clipPath id="astronaut-clip-path-7">
<circle id="_Ellipse_" data-name="&lt;Ellipse&gt;" class="cls-astronaut-5" cx="43.68" cy="39.58" r="38.78" transform="matrix(0.87, -0.5, 0.5, 0.87, -13.95, 27.19)"/>
</clipPath>
<linearGradient id="linear-gradient-4" x1="-51.67" y1="143.38" x2="-1.64" y2="143.38" gradientTransform="translate(-2.76 -100.21) rotate(-30.05)" xlink:href="#linear-gradient"/>
<linearGradient id="astronaut-linear-gradient-4" x1="-51.67" y1="143.38" x2="-1.64" y2="143.38" gradientTransform="translate(-2.76 -100.21) rotate(-30.05)" xlink:href="#astronaut-linear-gradient"/>
</defs>
<title>astronaut_1</title>
<g class="cls-astronaut-6">
@@ -45,7 +133,9 @@ Please use this SVG with attribution to the author i.e Saleh Riaz
<rect class="cls-astronaut-7" x="84.16" y="44.49" width="6.32" height="6.32" rx="3.16" ry="3.16" transform="translate(-12.12 50.13) rotate(-30.05)"/>
<path class="cls-astronaut-8" d="M91.82,123.23l30.75-17.79a10.6,10.6,0,0,0,4.35-13.55l-17.23-38a15.5,15.5,0,0,0-21.87-7L57.71,64.26Z"/>
<path class="cls-astronaut-7" d="M91.21,123.07l29.6-17.12a10.2,10.2,0,0,0,4.19-13L108.54,56.58a15.21,15.21,0,0,0-21.47-6.89l-28.7,16.6Z"/>
<path class="cls-astronaut-1" d="M102.52,141l-.74.43a1,1,0,0,0-.31,1.48c3.75,5,15.52,28.93,19,36.07a2.4,2.4,0,0,1-1,3.14l-17.6,10.18a2.41,2.41,0,0,1-2.84-.31c-2.49-2.3-8.3-7.8-15.37-15.5-9.49-10.32-20.91-30.07-24.92-40s-4-10-5.95-19.4c-4.48,5.71-3.15,19.09-2.79,22.06a2.17,2.17,0,0,0,.42,1.05c1.48,2,7.26,9.65,8.58,11.94,1.52,2.63,0,4.7-1.11,4.16A86.32,86.32,0,0,1,50,151a1.52,1.52,0,0,0-1.43-.22c-1.78.7,1.08,3.23,1.08,3.23a47.17,47.17,0,0,0,5.68,3.74,3.72,3.72,0,0,1,2.05,2.61,2.31,2.31,0,0,1-.68,2.32c-3.69,3.32-9.35,1.69-12.48.38a8.71,8.71,0,0,1-4-3.3,19,19,0,0,1-3.09-9.08,18.73,18.73,0,0,0-2.7-10.74c-14.13-27.08,3.31-51.12,4.86-55.66,9-3.18,15.13-10.62,22.07-14.56l-.21.12C68.07,65.77,76.72,63.65,84,57.4c4.71.93,35.09-1.66,51.52,24.1a18.73,18.73,0,0,0,8,7.69,19,19,0,0,1,6.33,7.21,8.71,8.71,0,0,1,.89,5.07c-.43,3.36-1.84,9.08-6.55,10.62a2.31,2.31,0,0,1-2.35-.57,3.72,3.72,0,0,1-1.24-3.08,47.17,47.17,0,0,0-.41-6.79s-.76-3.72-2.25-2.55a1.52,1.52,0,0,0-.53,1.35c.36,3.46,1.8,8.8.56,9.51s-2.63,1.52-4.16-1.11c-1.32-2.29-5.11-11.13-6.07-13.39a2.17,2.17,0,0,0-.7-.89c-2.39-1.79-13.33-9.62-20.51-8.58,7.2,6.37,7.2,6.38,13.85,14.83s18.07,28.2,22.29,41.57c3.15,10,5,17.75,5.78,21.05a2.41,2.41,0,0,1-1.14,2.62l-17.6,10.18a2.4,2.4,0,0,1-3.2-.73c-4.45-6.58-19.32-28.71-21.79-34.46a1,1,0,0,0-1.43-.47l-.74.43"/>
<path
class="cls-astronaut-1"
d="M102.52,141l-.74.43a1,1,0,0,0-.31,1.48c3.75,5,15.52,28.93,19,36.07a2.4,2.4,0,0,1-1,3.14l-17.6,10.18a2.41,2.41,0,0,1-2.84-.31c-2.49-2.3-8.3-7.8-15.37-15.5-9.49-10.32-20.91-30.07-24.92-40s-4-10-5.95-19.4c-4.48,5.71-3.15,19.09-2.79,22.06a2.17,2.17,0,0,0,.42,1.05c1.48,2,7.26,9.65,8.58,11.94,1.52,2.63,0,4.7-1.11,4.16A86.32,86.32,0,0,1,50,151a1.52,1.52,0,0,0-1.43-.22c-1.78.7,1.08,3.23,1.08,3.23a47.17,47.17,0,0,0,5.68,3.74,3.72,3.72,0,0,1,2.05,2.61,2.31,2.31,0,0,1-.68,2.32c-3.69,3.32-9.35,1.69-12.48.38a8.71,8.71,0,0,1-4-3.3,19,19,0,0,1-3.09-9.08,18.73,18.73,0,0,0-2.7-10.74c-14.13-27.08,3.31-51.12,4.86-55.66,9-3.18,15.13-10.62,22.07-14.56l-.21.12C68.07,65.77,76.72,63.65,84,57.4c4.71.93,35.09-1.66,51.52,24.1a18.73,18.73,0,0,0,8,7.69,19,19,0,0,1,6.33,7.21,8.71,8.71,0,0,1,.89,5.07c-.43,3.36-1.84,9.08-6.55,10.62a2.31,2.31,0,0,1-2.35-.57,3.72,3.72,0,0,1-1.24-3.08,47.17,47.17,0,0,0-.41-6.79s-.76-3.72-2.25-2.55a1.52,1.52,0,0,0-.53,1.35c.36,3.46,1.8,8.8.56,9.51s-2.63,1.52-4.16-1.11c-1.32-2.29-5.11-11.13-6.07-13.39a2.17,2.17,0,0,0-.7-.89c-2.39-1.79-13.33-9.62-20.51-8.58,7.2,6.37,7.2,6.38,13.85,14.83s18.07,28.2,22.29,41.57c3.15,10,5,17.75,5.78,21.05a2.41,2.41,0,0,1-1.14,2.62l-17.6,10.18a2.4,2.4,0,0,1-3.2-.73c-4.45-6.58-19.32-28.71-21.79-34.46a1,1,0,0,0-1.43-.47l-.74.43"/>
<g class="cls-astronaut-9">
<rect class="cls-astronaut-10" x="102.92" y="60.31" width="18.38" height="7.44" transform="translate(8.96 141.66) rotate(-66.7)"/>
<path class="cls-astronaut-11" d="M84,57.4s33.5,5.64,47.74,20.34c11.5,16.28,9.9,9.91,11.65,12s9,4.71,4.3,19.15,12.71-8.66,12.71-8.66L136.73,63.89,86.92,52.57l-2.39,4Z"/>
@@ -87,10 +177,14 @@ Please use this SVG with attribution to the author i.e Saleh Riaz
<rect class="cls-astronaut-15" x="60.23" y="130.11" width="75.35" height="6.32" transform="translate(-53.66 67.13) rotate(-30.12)"/>
<rect class="cls-astronaut-7" x="91.39" y="129.1" width="12.63" height="8.57" rx="1.32" ry="1.32" transform="translate(-53.74 67.05) rotate(-30.12)"/>
<circle class="cls-astronaut-17" cx="97.71" cy="133.38" r="2.93" transform="translate(-53.74 67.05) rotate(-30.12)"/>
<path class="cls-astronaut-3" d="M129.12,178.73l10.53,16.4a11.24,11.24,0,0,0,8.07,4.42,15.15,15.15,0,0,0,4.35-.21,18,18,0,0,0,5.6-2.12c9.16-5.25,17.65-10.09,8.59-17.5a15,15,0,0,0-5.65-2.87c-.87-.23-1.73-.43-2.51-.61a10,10,0,0,1-6.6-4.91l-2.11-3.75Z"/>
<path
class="cls-astronaut-3"
d="M129.12,178.73l10.53,16.4a11.24,11.24,0,0,0,8.07,4.42,15.15,15.15,0,0,0,4.35-.21,18,18,0,0,0,5.6-2.12c9.16-5.25,17.65-10.09,8.59-17.5a15,15,0,0,0-5.65-2.87c-.87-.23-1.73-.43-2.51-.61a10,10,0,0,1-6.6-4.91l-2.11-3.75Z"/>
<g class="cls-astronaut-18">
<circle class="cls-astronaut-19" cx="158.17" cy="175.3" r="5.64" transform="translate(-66.52 102.76) rotate(-30.05)"/>
<path class="cls-astronaut-19" d="M130.73,197.69l6.5-5.85a11.24,11.24,0,0,0,8.07,4.42,15.15,15.15,0,0,0,4.35-.21,18,18,0,0,0,5.6-2.12c9.16-5.25,17.65-10.09,8.59-17.5a15,15,0,0,0-5.65-2.87c-.87-.23-1.73-.43-2.51-.61-2.8-.61,16.27.54,14.86-2l7.11,10.48L173.79,191l-10,8.9-11.22,4.93-7,.43-6.39-2-4.44-3.17Z"/>
<path
class="cls-astronaut-19"
d="M130.73,197.69l6.5-5.85a11.24,11.24,0,0,0,8.07,4.42,15.15,15.15,0,0,0,4.35-.21,18,18,0,0,0,5.6-2.12c9.16-5.25,17.65-10.09,8.59-17.5a15,15,0,0,0-5.65-2.87c-.87-.23-1.73-.43-2.51-.61-2.8-.61,16.27.54,14.86-2l7.11,10.48L173.79,191l-10,8.9-11.22,4.93-7,.43-6.39-2-4.44-3.17Z"/>
</g>
<rect class="cls-astronaut-15" x="125.42" y="168.94" width="26.62" height="4.96" rx="2.48" ry="2.48" transform="translate(344.65 250.35) rotate(149.95)"/>
<rect class="cls-astronaut-20" x="139.14" y="179.19" width="1.11" height="9.93" transform="translate(-73.44 94.7) rotate(-30.05)"/>
@@ -99,7 +193,9 @@ Please use this SVG with attribution to the author i.e Saleh Riaz
<path class="cls-astronaut-3" d="M122.22,182.72l9,17.31a11.24,11.24,0,0,1-.19,9.2,15.15,15.15,0,0,1-2.36,3.67,18,18,0,0,1-4.63,3.8c-9.12,5.33-17.55,10.27-19.45-1.27a15,15,0,0,1,.33-6.33c.24-.87.48-1.71.73-2.48a10,10,0,0,0-1-8.17l-2.2-3.69Z"/>
<g class="cls-astronaut-21">
<circle class="cls-astronaut-19" cx="104.77" cy="206.19" r="5.64" transform="translate(-89.16 80.17) rotate(-30.05)"/>
<path class="cls-astronaut-19" d="M137.86,193.56l-8.31,2.72a11.24,11.24,0,0,1-.19,9.2,15.15,15.15,0,0,1-2.36,3.67,18,18,0,0,1-4.63,3.8c-9.12,5.33-17.55,10.27-19.45-1.27a15,15,0,0,1,.33-6.33c.24-.87.48-1.71.73-2.48.87-2.73-7.64,14.37-9.11,11.91l5.55,11.39,10.19,1.4,12.68-4.21,9.87-7.27,3.89-5.9,1.42-6.56-.53-5.43Z"/>
<path
class="cls-astronaut-19"
d="M137.86,193.56l-8.31,2.72a11.24,11.24,0,0,1-.19,9.2,15.15,15.15,0,0,1-2.36,3.67,18,18,0,0,1-4.63,3.8c-9.12,5.33-17.55,10.27-19.45-1.27a15,15,0,0,1,.33-6.33c.24-.87.48-1.71.73-2.48.87-2.73-7.64,14.37-9.11,11.91l5.55,11.39,10.19,1.4,12.68-4.21,9.87-7.27,3.89-5.9,1.42-6.56-.53-5.43Z"/>
</g>
<rect class="cls-astronaut-15" x="97.79" y="184.92" width="26.62" height="4.96" rx="2.48" ry="2.48" transform="translate(-78.91 80.82) rotate(-30.05)"/>
<rect class="cls-astronaut-20" x="121.1" y="189.63" width="1.11" height="9.93" transform="translate(324.4 302.12) rotate(149.95)"/>
@@ -126,7 +222,9 @@ Please use this SVG with attribution to the author i.e Saleh Riaz
<path id="purple" class="cls-astronaut-27" d="M68,25.49c7.78,13.45,3.6,29.1-9.85,36.88S27.1,67.12,19.32,53.67s-1.63-30.24,11.82-38S60.25,12,68,25.49Z"/>
<path id="purple-2" data-name="purple" class="cls-astronaut-28" d="M67.61,24.72c7.53,13,4.26,27.7-7.7,34.62a26.11,26.11,0,0,1-26.15-45.2C45.72,7.22,60.08,11.71,67.61,24.72Z"/>
<g id="outline">
<path class="cls-astronaut-29" d="M45.16,11.75c9.13,0,17.72,4.84,22.87,13.74,7.78,13.45,3.6,29.1-9.85,36.88a31.21,31.21,0,0,1-15.59,4.22c-9.34,0-18.31-4.34-23.27-12.92-7.78-13.45-1.63-30.24,11.82-38a27.93,27.93,0,0,1,14-3.89m0-5v0h0a33.11,33.11,0,0,0-16.51,4.57C12.29,20.78,6.16,40.9,15,56.17c5.58,9.65,15.9,15.42,27.6,15.42A36.19,36.19,0,0,0,60.68,66.7,32,32,0,0,0,75.9,47.35,32,32,0,0,0,72.36,23c-5.88-10.17-16-16.24-27.2-16.24Z"/>
<path
class="cls-astronaut-29"
d="M45.16,11.75c9.13,0,17.72,4.84,22.87,13.74,7.78,13.45,3.6,29.1-9.85,36.88a31.21,31.21,0,0,1-15.59,4.22c-9.34,0-18.31-4.34-23.27-12.92-7.78-13.45-1.63-30.24,11.82-38a27.93,27.93,0,0,1,14-3.89m0-5v0h0a33.11,33.11,0,0,0-16.51,4.57C12.29,20.78,6.16,40.9,15,56.17c5.58,9.65,15.9,15.42,27.6,15.42A36.19,36.19,0,0,0,60.68,66.7,32,32,0,0,0,75.9,47.35,32,32,0,0,0,72.36,23c-5.88-10.17-16-16.24-27.2-16.24Z"/>
</g>
<path class="cls-astronaut-4" d="M40.09,66.57h44.2A7.68,7.68,0,0,1,92,74.25V76a0,0,0,0,1,0,0H32.41a0,0,0,0,1,0,0V74.25A7.68,7.68,0,0,1,40.09,66.57Z" transform="translate(-27.35 40.72) rotate(-30.05)"/>
<path class="cls-astronaut-29" d="M35.38,65.4H87.65A3.65,3.65,0,0,1,91.29,69v5.83a0,0,0,0,1,0,0H31.73a0,0,0,0,1,0,0V69A3.65,3.65,0,0,1,35.38,65.4Z" transform="translate(-26.85 40.23) rotate(-30.05)"/>

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -1,29 +1,50 @@
<!--Handcrafted by Saleh Riaz Qureshi - www.salehriaz.com - salehriazq@gmail.com - dribbble.com/salehriaz - behance.net/salehriaz - twitter.com/salehriazq - facebook.com/salehriazqureshi - instagram.com/salehriaz
Please use this SVG with attribution to the author i.e Saleh Riaz
-->
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 139.64 139.64">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 139.64 139.64">
<defs>
<style>.cls-earth-1{fill:#5bcbf5;}.cls-earth-2{fill:#fff;opacity:0.1;}.cls-earth-3{clip-path:url(#clip-path);}.cls-earth-4{fill:#257793;}.cls-earth-5{opacity:0.2;}</style>
<style>
.cls-earth-1 {
fill: #5bcbf5;
}
.cls-earth-2 {
fill: #fff;
opacity: 0.1;
}
.cls-earth-3 {
clip-path: url("#clip-path");
}
.cls-earth-4 {
fill: #257793;
}
.cls-earth-5 {
opacity: 0.2;
}
</style>
<clipPath id="clip-path">
<circle class="cls-earth-1" cx="69.82" cy="69.82" r="60.9" transform="translate(-28.55 61.3) rotate(-40.05)"/>
</clipPath>
</defs>
<title>earth</title>
<g id="Layer_2" data-name="Layer 2">
<g id="Layer_1-2" data-name="Layer 1">
<g id="earth">
<g data-name="Layer 2">
<g data-name="Layer 1">
<g>
<circle class="cls-earth-2" cx="69.82" cy="69.82" r="69.82" transform="translate(-28.91 70.93) rotate(-45.64)"/>
<circle class="cls-earth-1" cx="69.82" cy="69.82" r="60.9" transform="translate(-28.55 61.3) rotate(-40.05)"/>
<g class="cls-earth-3">
<path class="cls-earth-4" d="M2.63,74.4A52.68,52.68,0,0,1,20.82,34.79s-1.28,4,6.25,2.31,6.3,1.65,6,3.43-4.4.82-7.1.17S15.78,41.92,13,46.8s-5.26,8.9-3.54,9.74,6.33-7.66,9-9.75S21.7,47,20.88,51s.88,6.48,4.68,5.68,7.06-3.38,7-4.85-6.84-5.3.1-7.08S44.86,40.9,44,47.92s-2,15-.16,17.37,5,2.89,4.28,3.78-2.44.5-3.69.21-4.13,1.71-5,3.32-1.6,5.64,1.36,6.31,4.07-1.78,6.66-2.54,7.14,1,7.43,2-2.1,1.48-5.57.09-4.45,2.37-6.53,3.42-3.6,1.88-7.91.37-8.57.73-11.51.25C14.89,81.2,11.94,77.2,9.6,76.24a47.8,47.8,0,0,0-7-1.84Zm0,0"/>
<path class="cls-earth-4" d="M57.77,68.9s4.64-3.28,8.39-3.28,4.65.46,8.54-1.67,6.92-1.52,7.88,3.9,2.05,14.45,1.68,17.77-1.41,6.72.21,10.31,2.81,5.55,5.66,5.08c0,0,1.11,3.29-3.89,2.13s-6.36-6.46-7.79-9-5.85-9.9-7.92-10.85-6.21.9-9.91-1.64S52.88,71.46,57.77,68.9Zm0,0"/>
<path class="cls-earth-4" d="M106.07,17.4c1.23,4.3-2.64,5.57-6.63,8.75-5.12,4.08-10.2,3.65-15.86,6-5.25,2.22-7.16,8.17-6.72,13.48.33,3.94,2.09,12,6.18,13.43a15.55,15.55,0,0,0,6.17.48,57.4,57.4,0,0,0,8.91-1c3.36-.73,6.88-2.05,10.12-.89,2.67,1,4.5,3.41,5.84,5.9C117.72,70.39,116,79.75,125,82.09a11.6,11.6,0,0,0,9.61-1.62,75.57,75.57,0,0,0-28.5-63.07Z"/>
<path class="cls-earth-4" d="M46.65,13.42a7.4,7.4,0,0,0-1.29,3.41c-.07,2.56,2.44,4.54,4,6.18a14.68,14.68,0,0,0,1.81,1.61c8.25,6.11,13-3.14,20-4.63,4.45-1,9,1.43,13.55,1,5.14-.49,7.15-5.71,7.53-10.86q-3.75-2.91-7.75-5.49c-12.81-8.26-30-4.51-37.78,8.61Z"/>
<path
class="cls-earth-4"
d="M2.63,74.4A52.68,52.68,0,0,1,20.82,34.79s-1.28,4,6.25,2.31,6.3,1.65,6,3.43-4.4.82-7.1.17S15.78,41.92,13,46.8s-5.26,8.9-3.54,9.74,6.33-7.66,9-9.75S21.7,47,20.88,51s.88,6.48,4.68,5.68,7.06-3.38,7-4.85-6.84-5.3.1-7.08S44.86,40.9,44,47.92s-2,15-.16,17.37,5,2.89,4.28,3.78-2.44.5-3.69.21-4.13,1.71-5,3.32-1.6,5.64,1.36,6.31,4.07-1.78,6.66-2.54,7.14,1,7.43,2-2.1,1.48-5.57.09-4.45,2.37-6.53,3.42-3.6,1.88-7.91.37-8.57.73-11.51.25C14.89,81.2,11.94,77.2,9.6,76.24a47.8,47.8,0,0,0-7-1.84Zm0,0"/>
<path
class="cls-earth-4"
d="M57.77,68.9s4.64-3.28,8.39-3.28,4.65.46,8.54-1.67,6.92-1.52,7.88,3.9,2.05,14.45,1.68,17.77-1.41,6.72.21,10.31,2.81,5.55,5.66,5.08c0,0,1.11,3.29-3.89,2.13s-6.36-6.46-7.79-9-5.85-9.9-7.92-10.85-6.21.9-9.91-1.64S52.88,71.46,57.77,68.9Zm0,0"/>
<path
class="cls-earth-4"
d="M106.07,17.4c1.23,4.3-2.64,5.57-6.63,8.75-5.12,4.08-10.2,3.65-15.86,6-5.25,2.22-7.16,8.17-6.72,13.48.33,3.94,2.09,12,6.18,13.43a15.55,15.55,0,0,0,6.17.48,57.4,57.4,0,0,0,8.91-1c3.36-.73,6.88-2.05,10.12-.89,2.67,1,4.5,3.41,5.84,5.9C117.72,70.39,116,79.75,125,82.09a11.6,11.6,0,0,0,9.61-1.62,75.57,75.57,0,0,0-28.5-63.07Z"/>
<path
class="cls-earth-4"
d="M46.65,13.42a7.4,7.4,0,0,0-1.29,3.41c-.07,2.56,2.44,4.54,4,6.18a14.68,14.68,0,0,0,1.81,1.61c8.25,6.11,13-3.14,20-4.63,4.45-1,9,1.43,13.55,1,5.14-.49,7.15-5.71,7.53-10.86q-3.75-2.91-7.75-5.49c-12.81-8.26-30-4.51-37.78,8.61Z"/>
<path class="cls-earth-4" d="M43.49,125.16a41.14,41.14,0,0,0,22.75,5.65s-1.78-3.78-3.91-4.52-3.6,1.42-4.86.37,1.51-1.65-1-5.85-8.19-6.18-10.29-3.47-2.71,7.82-2.71,7.82Z"/>
<path class="cls-earth-4" d="M108.53,88.17c1.31.3,2.08-2.07,4.54,1.18s1.59,4.76,3.57,5.77,1,3.73.51,3.85-2.16.74-3.06,1.1-3.37,1.08-4.08-.07-.38-2.07-2-3.21-2-.64-3.28-.73-1.35-1.43-2.7-.3-4,3.82-4.24,2.12a6.14,6.14,0,0,1,.62-3.9c.62-1.57-.56.14.62-1.57s.47-1.71,2-2.29S108.53,88.17,108.53,88.17Z"/>
<path
class="cls-earth-4"
d="M108.53,88.17c1.31.3,2.08-2.07,4.54,1.18s1.59,4.76,3.57,5.77,1,3.73.51,3.85-2.16.74-3.06,1.1-3.37,1.08-4.08-.07-.38-2.07-2-3.21-2-.64-3.28-.73-1.35-1.43-2.7-.3-4,3.82-4.24,2.12a6.14,6.14,0,0,1,.62-3.9c.62-1.57-.56.14.62-1.57s.47-1.71,2-2.29S108.53,88.17,108.53,88.17Z"/>
<path class="cls-earth-5" d="M123.42,39.39A80.86,80.86,0,0,1,94.54,100.8c-16.43,13.81-40.15,20.53-60,19.44a55.56,55.56,0,0,0,4.67,3,61.5,61.5,0,0,0,84.22-83.87Z"/>
</g>
</g>

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Some files were not shown because too many files have changed in this diff Show More