Compare commits

...

23 Commits

Author SHA1 Message Date
Benny Powers
5c3eda35a9 Merge pull request #191 from modernweb-dev/changeset-release/main
Version Packages
2021-07-04 22:57:22 +03:00
github-actions[bot]
6910d50bf5 Version Packages 2021-07-04 19:47:35 +00:00
Dani Garcia
a2dc8656db chore: improve wording in getting-started.md (#196) 2021-07-04 21:46:26 +02:00
Benny Powers
e778cd8a3c Update 30-collection-header.njk
fixes #189
2021-07-04 21:45:21 +02:00
Thomas Allmer
9e3c2f52d9 fix(launch): create help & feedback link only if site.helpUrl is defined 2021-07-04 18:21:19 +02:00
Thomas Allmer
579e8e72a2 fix(cli): Unordered joiningBlocks should generally end up at the end 2021-07-04 16:50:11 +02:00
Thomas Allmer
06ae8693b2 docs: add info that a server needs to handle the 404.html file 2021-07-04 16:50:07 +02:00
Thomas Allmer
cee2b7b04c fix(launch): fix font variables 2021-07-04 16:49:40 +02:00
Thomas Allmer
9625b94d39 fix(launch): remove footer urls that require user creation 2021-07-04 16:48:44 +02:00
Benny Powers
1f79d7a047 feat(launch): move font-family to variables 2021-07-04 12:00:31 +02:00
Benny Powers
bf99541951 fix(cli): copy all static assets on build 2021-07-04 12:00:14 +02:00
github-actions[bot]
8df9a3e9c3 Version Packages 2021-07-02 13:42:36 +02:00
Benny Powers
1b9559f2a5 feat(cli): add async before11ty hook (#183) 2021-07-02 11:58:54 +02:00
github-actions[bot]
8eede4b16b Version Packages 2021-06-30 15:24:07 +02:00
Thomas Allmer
2294ccf4a2 chore: only release patch versions 2021-06-30 15:20:51 +02:00
Benny Powers
3b1a0cf26a feat(cli): expose checkLinks options 2021-06-30 15:18:36 +02:00
Benny Powers
cf442215a9 feat: add slack invite 2021-06-30 15:02:33 +02:00
Thomas Allmer
41049f3908 chore: fix launch tests 2021-06-30 14:36:54 +02:00
Thomas Allmer
2b5c61d19c feat: no responsive images for svgs & option to define ignores 2021-06-30 14:36:54 +02:00
Jorge del Casar
f5d349e256 feat(launch): load used fonts from google fonts 2021-06-28 21:00:13 +02:00
Jorge del Casar
ce0b00e7a1 fix(cli): don't transform external images
Fix #141
2021-06-28 20:59:28 +02:00
github-actions[bot]
83286a99de Version Packages 2021-06-22 18:42:00 +02:00
Thijs Louisse
6cabdba5f6 feat(rocket): upgrade to lit2 2021-06-22 18:27:19 +02:00
54 changed files with 685 additions and 151 deletions

View File

@@ -9,6 +9,11 @@ module.exports = async function () {
name: 'GitHub',
url: 'https://github.com/modernweb-dev/rocket',
},
{
name: 'Slack',
url:
'https://join.slack.com/t/lit-and-friends/shared_invite/zt-llwznvsy-LZwT13R66gOgnrg12PUGqw',
},
],
gitSiteUrl: 'https://github.com/modernweb-dev/rocket',
gitBranch: 'main',

View File

@@ -1,11 +1,3 @@
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap"
rel="stylesheet"
/>
<meta name="twitter:creator" content="@modern_web_dev" />
<link rel="stylesheet" href="{{ '/_assets/body.css' | asset | url }}" mdjs-use>

View File

@@ -100,6 +100,82 @@ export default {
};
```
## Ignoring Images
Files ending in `.svg` or that include `rocket-ignore.` will remain untouched.
For example
```md
![Logo stays svg](logo.svg)
![Ignore by file name](my-image.rocket-unresponsive.jpg)
![My Image Alternative Text](my-image.jpeg)
```
becomes
```html
<img src="logo.svg" alt="Logo stays svg" rocket-image="responsive" />
<img src="my-image.rocket-unresponsive.jpg" alt="Ignore by file name" rocket-image="responsive" />
<picture>[...] </picture>
```
### Adjusting ignore function
The default ignore function looks like this
```js
/**
* The default responsive ignore function will ignore files
* - ending in `.svg`
* - containing `rocket-unresponsive.`
*
* @param {object} opts
* @param {string} opts.src
* @param {string} opts.title
* @param {string} opts.alt
* @param {{name: string, value: string}[]} opts.attributes
* @returns {boolean}
*/
function ignore({ src }) {
return src.endsWith('svg') || src.includes('rocket-unresponsive.');
}
```
and you can adjust it by setting it via the `imagePreset`.
For this example we want to also ignore `.jpeg` files.
👉 `rocket.config.js`
```js
export default {
imagePresets: {
responsive: {
// ...
ignore: ({ src }) =>
src.endsWith('.jpeg') || src.endsWith('svg') || src.includes('rocket-unresponsive.'),
},
},
};
```
With that setting we get the following behavior
```md
![Logo stays svg](logo.svg)
![Ignore by file name](my-image.rocket-unresponsive.jpg)
![My Image Alternative Text](my-image.jpeg)
```
becomes
```html
<img src="logo.svg" alt="Logo stays svg" rocket-image="responsive" />
<img src="my-image.rocket-unresponsive.jpg" alt="Ignore by file name" rocket-image="responsive" />
<img src="my-image.jpeg" alt="My Image Alternative Text" rocket-image="responsive" />
```
## Defining your own presets
You can add your own image preset like so

View File

@@ -1,4 +1,4 @@
# Configuration >> Overview ||10
# Configuration >> Overview || 10
The configuration file is `rocket.config.js` or `rocket.config.mjs`.
@@ -86,3 +86,15 @@ const config = {
export default config;
```
## Lifecycle
You can hook into the rocket lifecycle by specifying a function for `before11ty`. This function runs before 11ty calls it's write method. If it is an async function, Rocket will await it's promise.
```js
export default {
async before11ty() {
await copyDataFiles();
},
};
```

View File

@@ -20,7 +20,7 @@ The Plugins Manager helps you register and execute your plugins across the vario
## Adding Remark/Unified Plugins
If you want to a plugin to the Markdown processing you can use `setupUnifiedPlugins`.
If you want to add a plugin to the Markdown processing you can use `setupUnifiedPlugins`.
```js
import emoji from 'remark-emoji';

View File

@@ -9,7 +9,7 @@ Many servers are configured to handle this automatically and to serve a 404.html
The [Rocket Launch preset](../../docs/presets/launch.md) ships a default 404 template you can use.
To enable it, you need to create a 404.md and use the 404 layout.
To enable it, you need to create a `404.md` and use the 404 layout.
👉 `docs/404.md`
@@ -20,6 +20,10 @@ permalink: 404.html
---
```
This results in a `404.html` page, which will do nothing by itself. But many hosting services like netlify or firebase, for example will redirect 404s to this `404.html` by default.
If the hosting provider doesn't already do this, then you may be able to accomplish it via some settings for example by using a `.htaccess` file in case of an apache server.
## Add a Sitemap
A sitemap can be used to inform search engines or services about the pages your site has.

View File

@@ -0,0 +1,11 @@
# Presets >> Create your own > Options || 10
Your preset can hook into the rocket lifecycle by specifying a function for `before11ty`. This function runs before 11ty calls it's write method. If it is an async function, Rocket will await it's promise.
```js
export default {
async before11ty() {
await copyDataFiles();
},
};
```

View File

@@ -37,6 +37,14 @@ If you look into `docs/_merged_includes/_joiningBlocks/bottom/` you will see a f
- `190-google-analytics.njk`
- `my-script.njk`
<inline-notification type="tip">
File names without an order/number in front are considered with the order number `10 000` so the generally end up at the bottom. If you need something even below unordered items you can use numbers that are greater then `10 000`.
_Note: For unordered files there is no guarantee of any order._
</inline-notification>
## Controlling the order
In the html `<head>` order is usually not that important but when adding script it does.
@@ -57,3 +65,7 @@ which brings the order to
## More information
For more details please see the [Joining Blocks Docs](../../docs/presets/joining-blocks.md)
```js script
import '@rocket/launch/inline-notification/inline-notification.js';
```

View File

@@ -1,5 +1,53 @@
# @rocket/cli
## 0.9.6
### Patch Changes
- bf99541: Adjust copy logic to
1. for `_assets/_static` copy over everything
2. for all other paths copy over everything except `*.html` and `*.md`
- 579e8e7: Unordered joiningBlocks are now considered with the order number `10 000` and will generally be at the bottom.
You can use numbers `> 10 000` to place files even after unordered joiningBlocks.
## 0.9.5
### Patch Changes
- 1b9559f: Adds `before11ty` hook to config and presets
## 0.9.4
### Patch Changes
- 2b5c61d: Allow configuring the imagePreset ignore rules via the option `ignore`
```js
export default {
imagePresets: {
responsive: {
// ...
ignore: ({ src }) =>
src.endsWith('.jpeg') || src.endsWith('svg') || src.includes('rocket-unresponsive.'),
},
},
};
```
- 2b5c61d: Do not generate responsive images for files ending in `.svg` or that include `rocket-ignore.`
- ce0b00e: don't transform external images
- 3b1a0cf: Allow to configure check-html-links
```js
export default {
checkLinks: {
/* ... */
},
};
```
## 0.9.3
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/cli",
"version": "0.9.3",
"version": "0.9.6",
"publishConfig": {
"access": "public"
},

View File

@@ -29,7 +29,7 @@ async function productionBuild(config) {
name: 'copy',
plugin: copy,
options: {
patterns: ['!(*.md|*.html)*', '_merged_assets/_static/**/*.{png,gif,jpg,json,css,svg,ico}'],
patterns: ['!(*.md|*.html)*', '_merged_assets/_static/**/*'],
rootDir: config.outputDevDir,
},
}),

View File

@@ -31,6 +31,7 @@ export class RocketEleventy extends Eleventy {
async write() {
await this.__rocketCli.mergePresets();
for (const fn of this.__rocketCli.config.__before11tyFunctions) await fn();
await super.write();
await this.__rocketCli.update();
}
@@ -120,7 +121,7 @@ export class RocketCli {
for (const folder of ['_assets', '_data', '_includes']) {
const to = path.join(this.config._inputDirCwdRelative, `_merged${folder}`);
await fs.emptyDir(to);
for (const sourceDir of this.config._presetPathes) {
for (const sourceDir of this.config._presetPaths) {
const from = path.join(sourceDir, folder);
if (fs.existsSync(from)) {
if (folder === '_includes') {

View File

@@ -50,6 +50,7 @@ export class RocketLint {
const checkLinks = new CheckHtmlLinksCli();
checkLinks.setOptions({
...this.config.checkLinks,
rootDir: this.config.lintInputDir,
printOnError: false,
continueOnError: true,

View File

@@ -83,10 +83,20 @@ function getAttributes(data) {
// return classString ? classString.split(' ') : [];
// }
/**
*
* @param src {string} image src attribute value.
* @returns {boolean} true if src starts with https://, http:// or //
*/
function isExternalSrc(src) {
return /^(?:https?:)?\/\//.test(src);
}
/**
* @param {string} html
*/
function getImages(html) {
function getImages(html, { imagePresets }) {
/** @type {Heading[]} */
const images = [];
parser.eventHandler = (ev, _data) => {
@@ -100,16 +110,26 @@ function getImages(html) {
const src = getAttribute(data, 'src');
const title = getAttribute(data, 'title');
const alt = getAttribute(data, 'alt');
if (presetName) {
images.push({
presetName,
attributes,
src,
title,
alt,
openStart,
closeEnd,
});
const presetSettings = imagePresets[presetName];
if (!presetSettings) {
throw new Error(`Could not find imagePresets: { ${presetName}: {} }`);
}
const { ignore } = presetSettings;
const ignoreFn = typeof ignore === 'function' ? ignore : () => false;
if (!isExternalSrc(src) && !ignoreFn({ src, title, alt, attributes })) {
images.push({
presetName,
attributes,
src,
title,
alt,
openStart,
closeEnd,
});
}
}
}
}
@@ -232,7 +252,7 @@ async function insertResponsiveImages(html) {
imagePresets: config.imagePresets,
};
let images = getImages(html);
let images = getImages(html, options);
images = resolveFilePath(images, options);
images = await responsiveImages(images, options);
const newHtml = updateHtml(html, images);

View File

@@ -1,6 +1,10 @@
const rocketCopy = {
configFunction: (eleventyConfig, { _inputDirCwdRelative, filesExtensionsToCopy }) => {
eleventyConfig.addPassthroughCopy(`${_inputDirCwdRelative}/**/*.{${filesExtensionsToCopy}}`);
configFunction: (eleventyConfig, { _inputDirCwdRelative }) => {
eleventyConfig.addPassthroughCopy(`${_inputDirCwdRelative}/!(*.md|*.html)*`);
eleventyConfig.addPassthroughCopy(
`${_inputDirCwdRelative}/!(_includes|_data|_assets|_merged_data|_merged_includes)*/**/!(*.md|*.html)*`,
);
eleventyConfig.addPassthroughCopy(`${_inputDirCwdRelative}/_merged_assets/_static/**/*`);
},
};

View File

@@ -5,6 +5,7 @@
/** @typedef {import('@web/dev-server').DevServerConfig} DevServerConfig */
/** @typedef {import('../types/main').RocketCliOptions} RocketCliOptions */
/** @typedef {import('../types/main').ImagePreset} ImagePreset */
/** @typedef {import('../types/main').RocketPlugin} RocketPlugin */
import path from 'path';
@@ -19,9 +20,25 @@ import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
/**
* The default responsive ignore function will ignore files
* - ending in `.svg`
* - containing `rocket-unresponsive.`
*
* @param {object} opts
* @param {string} opts.src
* @param {string} opts.title
* @param {string} opts.alt
* @param {{name: string, value: string}[]} opts.attributes
* @returns {boolean}
*/
function ignore({ src }) {
return src.endsWith('svg') || src.includes('rocket-unresponsive.');
}
/**
* @param {Partial<RocketCliOptions>} inConfig
* @returns {Promise<RocketCliOptions>}
* @returns {Promise<RocketCliOptions & { __before11tyFunctions: RocketCliOptions['before11ty'][] }>}
*/
export async function normalizeConfig(inConfig) {
let config = {
@@ -45,11 +62,17 @@ export async function normalizeConfig(inConfig) {
devServer: {},
...inConfig,
/** @type{RocketCliOptions['before11ty'][]} */
__before11tyFunctions: [],
/** @type{{[key: string]: ImagePreset}} */
imagePresets: {
responsive: {
widths: [600, 900, 1640],
formats: ['avif', 'jpeg'],
sizes: '100vw',
ignore,
},
},
};
@@ -104,9 +127,9 @@ export async function normalizeConfig(inConfig) {
const _inputDirCwdRelative = path.join(_configDirCwdRelative, config.inputDir);
// cli core preset is always first
config._presetPathes = [path.join(__dirname, '..', 'preset')];
config._presetPaths = [path.join(__dirname, '..', 'preset')];
for (const preset of config.presets) {
config._presetPathes.push(preset.path);
config._presetPaths.push(preset.path);
if (preset.adjustImagePresets) {
config.imagePresets = preset.adjustImagePresets(config.imagePresets);
@@ -142,9 +165,13 @@ export async function normalizeConfig(inConfig) {
if (preset.setupCliPlugins) {
config.setupCliPlugins = [...config.setupCliPlugins, ...preset.setupCliPlugins];
}
if (typeof preset.before11ty === 'function') {
config.__before11tyFunctions.push(preset.before11ty);
}
}
// add "local" preset
config._presetPathes.push(path.resolve(_inputDirCwdRelative));
config._presetPaths.push(path.resolve(_inputDirCwdRelative));
/** @type {MetaPlugin[]} */
let pluginsMeta = [
@@ -169,6 +196,10 @@ export async function normalizeConfig(inConfig) {
plugins.push(pluginInst);
}
if (typeof config.before11ty === 'function') {
config.__before11tyFunctions.push(config.before11ty);
}
// TODO: check pathPrefix to NOT have a '/' at the end as it will mean it may get ignored by 11ty 🤷‍♂️
return {

View File

@@ -106,7 +106,7 @@ function socialMediaImagePlugin(args = {}) {
};
}
function sortyByOrder(a, b) {
function sortByOrder(a, b) {
if (a.order > b.order) {
return 1;
}
@@ -127,20 +127,20 @@ async function dirToTree(sourcePath, extra = '') {
if (entry.isDirectory()) {
const value = await dirToTree(sourcePath, relativePath);
unsortedEntries.push({
order: matches && matches.length > 0 ? parseInt(matches[1]) : 0,
order: matches && matches.length > 0 ? parseInt(matches[1]) : 10000,
name: entry.name,
value,
});
} else {
unsortedEntries.push({
order: matches && matches.length > 0 ? parseInt(matches[1]) : 0,
order: matches && matches.length > 0 ? parseInt(matches[1]) : 10000,
name: entry.name,
value: relativePath,
});
}
}
const sortedTree = {};
for (const unsortedEntry of unsortedEntries.sort(sortyByOrder)) {
for (const unsortedEntry of unsortedEntries.sort(sortByOrder)) {
sortedTree[unsortedEntry.name] = unsortedEntry.value;
}
return sortedTree;

View File

@@ -30,10 +30,7 @@ module.exports = function (eleventyConfig) {
{
name: 'rocket-copy',
plugin: rocketCopy,
options: {
_inputDirCwdRelative,
filesExtensionsToCopy: 'png,gif,jpg,jpeg,svg,css,xml,json,js',
},
options: { _inputDirCwdRelative },
},
{
name: 'eleventy-plugin-mdjs-unified',

View File

@@ -56,6 +56,79 @@ describe('RocketCli images', () => {
'</p>',
].join('\n'),
);
const keepSvgHtml = await readStartOutput(cli, 'ignores/index.html', {
formatHtml: true,
replaceImageHashes: true,
});
// ignores src="[...].svg" and src="[...]rocket-unresponsive.[...]"
expect(keepSvgHtml).to.equal(
[
'<p>Ignore SVG</p>',
'<p><img src="../_assets/logo.svg" alt="Logo stays svg" rocket-image="responsive" /></p>',
'<p>Ignore if contains <code>rocket-unresponsive.</code></p>',
'<p>',
' <img',
' src="../_assets/my-image.rocket-unresponsive.jpg"',
' alt="Logo stays svg"',
' rocket-image="responsive"',
' />',
'</p>',
'<p>Responsive</p>',
'<p>',
' <picture>',
' <source',
' type="image/avif"',
' srcset="/images/__HASH__-600.avif 600w, /images/__HASH__-900.avif 900w"',
' sizes="100vw"',
' />',
' <source',
' type="image/jpeg"',
' srcset="/images/__HASH__-600.jpeg 600w, /images/__HASH__-900.jpeg 900w"',
' sizes="100vw"',
' />',
' <img',
' alt="My Image Alternative Text"',
' rocket-image="responsive"',
' src="/images/__HASH__-600.jpeg"',
' width="600"',
' height="316"',
' loading="lazy"',
' decoding="async"',
' />',
' </picture>',
'</p>',
].join('\n'),
);
});
it('can configure more patterns to ignore', async () => {
cli = await executeStart('e2e-fixtures/images/ignore-more.rocket.config.js');
const keepSvgHtml = await readStartOutput(cli, 'ignores/index.html', {
formatHtml: true,
replaceImageHashes: true,
});
// ignores src="[...].svg" and src="[...]rocket-unresponsive.[...]"
expect(keepSvgHtml).to.equal(
[
'<p>Ignore SVG</p>',
'<p><img src="../_assets/logo.svg" alt="Logo stays svg" rocket-image="responsive" /></p>',
'<p>Ignore if contains <code>rocket-unresponsive.</code></p>',
'<p>',
' <img',
' src="../_assets/my-image.rocket-unresponsive.jpg"',
' alt="Logo stays svg"',
' rocket-image="responsive"',
' />',
'</p>',
'<p>Responsive</p>',
'<p>',
' <img src="../_assets/my-image.jpeg" alt="My Image Alternative Text" rocket-image="responsive" />',
'</p>',
].join('\n'),
);
});
it('renders multiple images in the correct order', async () => {

View File

@@ -29,7 +29,13 @@ describe('RocketCli mergeTemplates', () => {
const indexHtml = await readStartOutput(cli, 'index.html');
expect(trimWhiteSpace(indexHtml)).to.equal(
['<p>first</p>', '<p>second</p>', '<p>30-third</p>', '<p>100-last</p>'].join('\n'),
[
'<p>30-first</p>',
'<p>100-second</p>',
'<p>bar-third</p>',
'<p>foo-fourth</p>',
'<p>10100-last</p>',
].join('\n'),
);
});

View File

@@ -31,7 +31,7 @@ describe('RocketCli e2e', () => {
}
});
it.only('will add a script to inject the service worker', async () => {
it('will add a script to inject the service worker', async () => {
cli = await executeBuild('e2e-fixtures/service-worker/rocket.config.js');
const indexHtml = await readStartOutput(cli, 'index.html');
const indexInject = getInjectServiceWorker(indexHtml);

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@@ -0,0 +1,15 @@
---
layout: layout-raw
---
Ignore SVG
![Logo stays svg](./_assets/logo.svg)
Ignore if contains `rocket-unresponsive.`
![Logo stays svg](./_assets/my-image.rocket-unresponsive.jpg)
Responsive
![My Image Alternative Text](./_assets/my-image.jpeg)

View File

@@ -0,0 +1,10 @@
/** @type {Partial<import("../../../types/main").RocketCliOptions>} */
const config = {
imagePresets: {
responsive: {
ignore: ({ src }) =>
src.endsWith('.jpeg') || src.endsWith('svg') || src.includes('rocket-unresponsive.'),
},
},
};
export default config;

View File

@@ -10,9 +10,10 @@ function cleanup(config) {
const configNoPaths = { ...config };
delete configNoPaths._inputDirCwdRelative;
delete configNoPaths.configFile;
delete configNoPaths._presetPathes;
delete configNoPaths._presetPaths;
delete configNoPaths.eleventy;
delete configNoPaths.outputDevDir;
delete configNoPaths.imagePresets.responsive.ignore;
return configNoPaths;
}
@@ -23,11 +24,12 @@ describe('normalizeConfig', () => {
// testing pathes is always a little more complicted 😅
expect(config._inputDirCwdRelative).to.match(/empty\/docs$/);
expect(config._presetPathes[0]).to.match(/cli\/preset$/);
expect(config._presetPathes[1]).to.match(/empty\/docs$/);
expect(config._presetPaths[0]).to.match(/cli\/preset$/);
expect(config._presetPaths[1]).to.match(/empty\/docs$/);
expect(config.outputDevDir).to.match(/_site-dev$/);
expect(cleanup(config)).to.deep.equal({
__before11tyFunctions: [],
command: 'help',
createSocialMediaImages: true,
devServer: {},
@@ -69,6 +71,7 @@ describe('normalizeConfig', () => {
});
expect(cleanup(config)).to.deep.equal({
__before11tyFunctions: [],
command: 'help',
createSocialMediaImages: true,
devServer: {
@@ -109,6 +112,7 @@ describe('normalizeConfig', () => {
});
expect(cleanup(config)).to.deep.equal({
__before11tyFunctions: [],
command: 'help',
createSocialMediaImages: true,
devServer: {
@@ -154,6 +158,7 @@ describe('normalizeConfig', () => {
});
expect(cleanup(config)).to.deep.equal({
__before11tyFunctions: [],
command: 'help',
createSocialMediaImages: true,
devServer: {},

View File

@@ -1,23 +1,28 @@
import { DevServerConfig } from '@web/dev-server';
import { CheckHtmlLinksCliOptions } from 'check-html-links/dist-types/types/main';
export interface RocketPreset {
path: string;
adjustImagePresets?: (preset: { [key: string]: ImagePreset }) => { [key: string]: ImagePreset };
before11ty?: () => void | Promise<void>;
// TODO: improve all setup functions
setupUnifiedPlugins?: function[];
setupDevAndBuildPlugins: function[];
setupBuildPlugins: function[];
setupDevPlugins: function[];
setupCliPlugins: function[];
setupEleventyPlugins: function[];
setupEleventyComputedConfig: function[];
setupDevAndBuildPlugins?: function[];
setupBuildPlugins?: function[];
setupDevPlugins?: function[];
setupCliPlugins?: function[];
setupEleventyPlugins?: function[];
setupEleventyComputedConfig?: function[];
}
interface RocketStartConfig {
createSocialMediaImages?: boolean;
}
type ImageFormat = 'avif' | 'webp' | 'jpg' | 'png' | 'svg';
type ImageFormat = 'avif' | 'webp' | 'jpg' | 'jpeg' | 'png' | 'svg';
interface ImagePreset {
widths: number[];
@@ -26,44 +31,49 @@ interface ImagePreset {
}
export interface RocketCliOptions {
presets: Array<RocketPreset>;
presets?: Array<RocketPreset>;
pathPrefix?: string;
serviceWorkerName?: string;
inputDir: string;
outputDir: string;
inputDir?: string;
outputDir?: string;
emptyOutputDir?: boolean;
absoluteBaseUrl?: string;
watch: boolean;
watch?: boolean;
createSocialMediaImages?: boolean;
imagePresets: {
imagePresets?: {
[key: string]: ImagePreset;
};
before11ty?: () => void | Promise<void>;
checkLinks?: Partial<CheckHtmlLinksCliOptions>;
start?: RocketStartConfig;
// TODO: improve all setup functions
setupUnifiedPlugins?: function[];
setupDevAndBuildPlugins: function[];
setupBuildPlugins: function[];
setupDevPlugins: function[];
setupCliPlugins: function[];
setupEleventyPlugins: function[];
setupEleventyComputedConfig: function[];
setupDevAndBuildPlugins?: function[];
setupBuildPlugins?: function[];
setupDevPlugins?: function[];
setupCliPlugins?: function[];
setupEleventyPlugins?: function[];
setupEleventyComputedConfig?: function[];
// advanced
devServer: DevServerConfig;
eleventy: function; // TODO: improve
plugins: RocketPlugin[];
devServer?: DevServerConfig;
eleventy?: (eleventyConfig: any) => void; // TODO: improve
plugins?: RocketPlugin[];
// rarely used
command: string;
command?: string;
configFile?: string;
outputDevDir: string;
outputDevDir?: string;
private _inputDirCwdRelative: string;
private _presetPathes?: Array<string>;
private _inputDirCwdRelative?: string;
private _presetPaths?: string[];
private __before11tyFunctions?: (() => void | Promise<void>)[];
}
export interface RocketPlugin {
commands: Array<string>;
commands: string[];
}

View File

@@ -1,5 +1,25 @@
# @rocket/launch
## 0.5.2
### Patch Changes
- 9e3c2f5: Only show the help & feedback link if a site.helpUrl is defined
- 9625b94: Remove footer urls to pages that users would need to create
- 1f79d7a: Add font-family CSS variables
- `--primary-font-family` for body text
- `--secondary-font-family` for emphasis (e.g. call-to-action)
- `--heading-font-family` for headings (defaults to `--primary-font-family`)
- `--monospace-font-family` for code blocks
## 0.5.1
### Patch Changes
- cf44221: Adds a Slack invite to social links
- f5d349e: add used fonts from google fonts
## 0.5.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/launch",
"version": "0.5.0",
"version": "0.5.2",
"publishConfig": {
"access": "public"
},

View File

@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 123 123" fill="currentColor">
<title>Slack</title>
<path stroke="none" stroke-width="1" stroke-dasharray="none" stroke-linecap="butt" stroke-dashoffset="0" stroke-linejoin="miter" stroke-miterlimit="4" fill-rule="nonzero"
d="M26.4 78.2c0 7.1-5.8 12.9-12.9 12.9S.6 85.3.6 78.2c0-7.1 5.8-12.9 12.9-12.9h12.9v12.9zm6.5 0c0-7.1 5.8-12.9 12.9-12.9s12.9 5.8 12.9 12.9v32.3c0 7.1-5.8 12.9-12.9 12.9s-12.9-5.8-12.9-12.9V78.2zm12.9-51.8c-7.1 0-12.9-5.8-12.9-12.9S38.7.6 45.8.6s12.9 5.8 12.9 12.9v12.9H45.8zm0 6.5c7.1 0 12.9 5.8 12.9 12.9s-5.8 12.9-12.9 12.9H13.5C6.4 58.7.6 52.9.6 45.8s5.8-12.9 12.9-12.9h32.3zM97.6 45.8c0-7.1 5.8-12.9 12.9-12.9 7.1 0 12.9 5.8 12.9 12.9s-5.8 12.9-12.9 12.9H97.6V45.8zm-6.5 0c0 7.1-5.8 12.9-12.9 12.9-7.1 0-12.9-5.8-12.9-12.9V13.5C65.3 6.4 71.1.6 78.2.6c7.1 0 12.9 5.8 12.9 12.9v32.3zM78.2 97.6c7.1 0 12.9 5.8 12.9 12.9 0 7.1-5.8 12.9-12.9 12.9-7.1 0-12.9-5.8-12.9-12.9V97.6h12.9zm0-6.5c-7.1 0-12.9-5.8-12.9-12.9 0-7.1 5.8-12.9 12.9-12.9h32.3c7.1 0 12.9 5.8 12.9 12.9 0 7.1-5.8 12.9-12.9 12.9H78.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -7,7 +7,7 @@
body {
margin: 0;
font-family: 'Open Sans', sans-serif;
font-family: var(--primary-font-family);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 16px;
@@ -213,6 +213,14 @@ body[layout^='layout-home'] #main-header a:hover {
margin-right: 50px;
}
#main-header .content-area > .social-link {
margin-right: 15px;
}
#main-header .content-area > *:last-child {
margin-right: 0;
}
#main-header .search {
order: 1;
}
@@ -426,11 +434,13 @@ li.current > ul > li.anchor {
/* for blog detail page */
rocket-navigation h3 {
font-family: var(--heading-font-family, var(--primary-font-family));
font-size: 16px;
margin: 0 0 7px 0;
}
.sidebar-tags h3 {
font-family: var(--heading-font-family, var(--primary-font-family));
margin-top: 30px;
}
@@ -533,7 +543,7 @@ main > * {
display: inline-block;
text-align: center;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
font-family: var(--secondary-font-family);
font-size: 16px;
font-weight: bold;
vertical-align: middle;

View File

@@ -1,6 +1,7 @@
@font-face {
font-family: octicons-link;
src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJ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SikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==)
format('woff');
}
@@ -61,7 +62,7 @@
-webkit-text-size-adjust: 100%;
color: var(--markdown-body, --page-background);
line-height: 1.5;
font-family: 'Open Sans', sans-serif;
font-family: var(--primary-font-family);
font-size: 16px;
line-height: 1.5;
word-wrap: break-word;
@@ -188,6 +189,7 @@
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
font-family: var(--heading-font-family, var(--primary-font-family));
margin-bottom: 0;
margin-top: 0;
}
@@ -265,7 +267,7 @@
.markdown-body code,
.markdown-body pre {
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
font-family: var(--monospace-font-family);
font-size: 12px;
}
@@ -555,57 +557,75 @@ pre[class*='language-'] {
.token.atrule {
color: var(--markdown-syntax-atrule-color, #d73a49);
}
.token.attr-name {
color: var(--markdown-syntax-attr-name-color, #d73a49);
}
.token.boolean {
color: var(--markdown-syntax-boolean-color, #005cc5);
}
.token.class-name {
color: var(--markdown-syntax-class-name-color, #6f42c1);
}
.token.constant {
color: var(--markdown-syntax-constant-color, #005cc5);
}
.token.entity {
color: var(--markdown-syntax-entity-color, #005cc5);
}
.token.function {
color: var(--markdown-syntax-function-color, #6f42c1);
}
.token.inserted {
color: var(--markdown-syntax-inserted-color, #005cc5);
}
.token.keyword {
color: var(--markdown-syntax-keyword-color, #d73a49);
}
.token.number {
color: var(--markdown-syntax-number-color, #005cc5);
}
.token.operator {
color: var(--markdown-syntax-operator-color, #005cc5);
}
.token.property {
color: var(--markdown-syntax-property-color, #005cc5);
}
.token.punctuation {
color: var(--markdown-syntax-punctuation-color, #005cc5);
}
.token.regex {
color: var(--markdown-syntax-regex-color, #032f62);
}
.token.selector {
color: var(--markdown-syntax-selector-color, #22863a);
}
.token.symbol {
color: var(--markdown-syntax-symbol-color, #005cc5);
}
.token.tag {
color: var(--markdown-syntax-tag-color, #22863a);
}
.token.url {
color: var(--markdown-syntax-url-color, #005cc5);
}
.token.variable {
color: var(--markdown-syntax-variable-color, #005cc5);
}
@@ -613,6 +633,7 @@ pre[class*='language-'] {
.language-autohotkey .token.selector {
color: var(--markdown-syntax-hotkey-selector-color, #d73a49);
}
.language-autohotkey .token.keyword {
color: var(--markdown-syntax-keyword-color, #22863a);
}

View File

@@ -14,7 +14,11 @@ html {
--page-background: white;
--footer-background: rgba(0, 0, 0, 0.1);
/* typography */
--text-color: black;
--primary-font-family: 'Open Sans', sans-serif;
--secondary-font-family: 'Montserrat', sans-serif;
--monospace-font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', 'Courier', monospace;
}
html.dark {
@@ -32,8 +36,10 @@ html.dark {
--page-background: #333;
--footer-background: #4f4f4f;
/* typography */
--text-color: white;
/* markdown */
--markdown-octicon-link: white;
--markdown-syntax-background-color: #a0a0a0;
--markdown-link-color: #fb7881;

View File

@@ -2,10 +2,6 @@
{
"name": "Discover",
"children": [
{
"text": "Blog",
"href": "/blog/"
},
{
"text": "Help and Feedback",
"href": "https://github.com/modernweb-dev/rocket/issues"
@@ -23,19 +19,11 @@
"text": "Twitter",
"href": "https://twitter.com/modern_web_dev"
},
{
"text": "Slack",
"href": "/about/slack/"
}
]
},
{
"name": "Support",
"children": [
{
"text": "Sponsor",
"href": "/about/sponsor/"
},
{
"text": "Contribute",
"href": "https://github.com/modernweb-dev/rocket/blob/master/CONTRIBUTING.md"

View File

@@ -9,6 +9,11 @@ module.exports = function () {
name: 'GitHub',
url: 'https://github.com/modernweb-dev/rocket',
},
{
name: 'Slack',
url:
'https://join.slack.com/t/lit-and-friends/shared_invite/zt-llwznvsy-LZwT13R66gOgnrg12PUGqw',
},
],
gitSiteUrl: 'https://github.com/modernweb-dev/rocket',
gitBranch: 'master',

View File

@@ -0,0 +1,10 @@
<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&amp;display=optional"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&amp;display=optional"
rel="stylesheet"
/>

View File

@@ -1,6 +1,6 @@
{%- for entry in collections.header %}
<a href="{{ entry.url | url }}" class="
{% if entry.url == page.url %} current {% endif %}
{% if (page.url.search(entry.url) !== -1) and (page.url !== '/') %} active {% endif %}
{% if page.url and page.url.search and (page.url.search(entry.url) !== -1) and (page.url !== '/') %} active {% endif %}
">{{ entry.data.eleventyNavigation.key }}</a>
{%- endfor %}

View File

@@ -1,6 +1,6 @@
<div class="sidebar-bottom">
<hr>
{% include 'partials/_shared/darkSwitch.njk' %}
<a href="{{ site.helpUrl | url }}">Help and Feedback</a>
<hr/> {% include 'partials/_shared/darkSwitch.njk' %}
{% if site.helpUrl %}
<a href="{{ site.helpUrl | url }}">Help and Feedback</a>
{% endif %}
</div>

View File

@@ -83,6 +83,17 @@ describe('RocketLaunch preset', () => {
'',
' <meta name="twitter:card" content="summary_large_image" />',
'',
' <link rel="preconnect" href="https://fonts.googleapis.com" crossorigin />',
'',
' <link',
' href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&amp;display=optional"',
' rel="stylesheet"',
' />',
' <link',
' href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&amp;display=optional"',
' rel="stylesheet"',
' />',
'',
' <link rel="stylesheet" href="/_merged_assets/variables.css" />',
' <link rel="stylesheet" href="/_merged_assets/layout.css" />',
' <link rel="stylesheet" href="/_merged_assets/markdown.css" />',
@@ -138,6 +149,30 @@ describe('RocketLaunch preset', () => {
' ></path>',
' </svg>',
' </a>',
' <a',
' class="social-link"',
' href="https://join.slack.com/t/lit-and-friends/shared_invite/zt-llwznvsy-LZwT13R66gOgnrg12PUGqw"',
' aria-label="Rocket on Slack"',
' rel="noopener noreferrer"',
' target="_blank"',
' >',
' <span class="sr-only">Slack</span>',
'',
' <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 123 123" fill="currentColor">',
' <title>Slack</title>',
' <path',
' stroke="none"',
' stroke-width="1"',
' stroke-dasharray="none"',
' stroke-linecap="butt"',
' stroke-dashoffset="0"',
' stroke-linejoin="miter"',
' stroke-miterlimit="4"',
' fill-rule="nonzero"',
' d="M26.4 78.2c0 7.1-5.8 12.9-12.9 12.9S.6 85.3.6 78.2c0-7.1 5.8-12.9 12.9-12.9h12.9v12.9zm6.5 0c0-7.1 5.8-12.9 12.9-12.9s12.9 5.8 12.9 12.9v32.3c0 7.1-5.8 12.9-12.9 12.9s-12.9-5.8-12.9-12.9V78.2zm12.9-51.8c-7.1 0-12.9-5.8-12.9-12.9S38.7.6 45.8.6s12.9 5.8 12.9 12.9v12.9H45.8zm0 6.5c7.1 0 12.9 5.8 12.9 12.9s-5.8 12.9-12.9 12.9H13.5C6.4 58.7.6 52.9.6 45.8s5.8-12.9 12.9-12.9h32.3zM97.6 45.8c0-7.1 5.8-12.9 12.9-12.9 7.1 0 12.9 5.8 12.9 12.9s-5.8 12.9-12.9 12.9H97.6V45.8zm-6.5 0c0 7.1-5.8 12.9-12.9 12.9-7.1 0-12.9-5.8-12.9-12.9V13.5C65.3 6.4 71.1.6 78.2.6c7.1 0 12.9 5.8 12.9 12.9v32.3zM78.2 97.6c7.1 0 12.9 5.8 12.9 12.9 0 7.1-5.8 12.9-12.9 12.9-7.1 0-12.9-5.8-12.9-12.9V97.6h12.9zm0-6.5c-7.1 0-12.9-5.8-12.9-12.9 0-7.1 5.8-12.9 12.9-12.9h32.3c7.1 0 12.9 5.8 12.9 12.9 0 7.1-5.8 12.9-12.9 12.9H78.2z"',
' />',
' </svg>',
' </a>',
' </div>',
' </header>',
'',
@@ -285,6 +320,17 @@ describe('RocketLaunch preset', () => {
'',
' <meta name="twitter:card" content="summary_large_image" />',
'',
' <link rel="preconnect" href="https://fonts.googleapis.com" crossorigin />',
'',
' <link',
' href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&amp;display=optional"',
' rel="stylesheet"',
' />',
' <link',
' href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&amp;display=optional"',
' rel="stylesheet"',
' />',
'',
' <link rel="stylesheet" href="/_merged_assets/variables.css" />',
' <link rel="stylesheet" href="/_merged_assets/layout.css" />',
' <link rel="stylesheet" href="/_merged_assets/markdown.css" />',
@@ -340,6 +386,30 @@ describe('RocketLaunch preset', () => {
' ></path>',
' </svg>',
' </a>',
' <a',
' class="social-link"',
' href="https://join.slack.com/t/lit-and-friends/shared_invite/zt-llwznvsy-LZwT13R66gOgnrg12PUGqw"',
' aria-label="Rocket on Slack"',
' rel="noopener noreferrer"',
' target="_blank"',
' >',
' <span class="sr-only">Slack</span>',
'',
' <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 123 123" fill="currentColor">',
' <title>Slack</title>',
' <path',
' stroke="none"',
' stroke-width="1"',
' stroke-dasharray="none"',
' stroke-linecap="butt"',
' stroke-dashoffset="0"',
' stroke-linejoin="miter"',
' stroke-miterlimit="4"',
' fill-rule="nonzero"',
' d="M26.4 78.2c0 7.1-5.8 12.9-12.9 12.9S.6 85.3.6 78.2c0-7.1 5.8-12.9 12.9-12.9h12.9v12.9zm6.5 0c0-7.1 5.8-12.9 12.9-12.9s12.9 5.8 12.9 12.9v32.3c0 7.1-5.8 12.9-12.9 12.9s-12.9-5.8-12.9-12.9V78.2zm12.9-51.8c-7.1 0-12.9-5.8-12.9-12.9S38.7.6 45.8.6s12.9 5.8 12.9 12.9v12.9H45.8zm0 6.5c7.1 0 12.9 5.8 12.9 12.9s-5.8 12.9-12.9 12.9H13.5C6.4 58.7.6 52.9.6 45.8s5.8-12.9 12.9-12.9h32.3zM97.6 45.8c0-7.1 5.8-12.9 12.9-12.9 7.1 0 12.9 5.8 12.9 12.9s-5.8 12.9-12.9 12.9H97.6V45.8zm-6.5 0c0 7.1-5.8 12.9-12.9 12.9-7.1 0-12.9-5.8-12.9-12.9V13.5C65.3 6.4 71.1.6 78.2.6c7.1 0 12.9 5.8 12.9 12.9v32.3zM78.2 97.6c7.1 0 12.9 5.8 12.9 12.9 0 7.1-5.8 12.9-12.9 12.9-7.1 0-12.9-5.8-12.9-12.9V97.6h12.9zm0-6.5c-7.1 0-12.9-5.8-12.9-12.9 0-7.1 5.8-12.9 12.9-12.9h32.3c7.1 0 12.9 5.8 12.9 12.9 0 7.1-5.8 12.9-12.9 12.9H78.2z"',
' />',
' </svg>',
' </a>',
' </div>',
' </header>',
'',

View File

@@ -1,5 +1,11 @@
# @rocket/search
## 0.4.0
### Minor Changes
- 6cabdba: BREAKING: upgraded search to lit version 2
## 0.3.5
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/search",
"version": "0.3.5",
"version": "0.4.0",
"publishConfig": {
"access": "public"
},
@@ -41,8 +41,10 @@
"search"
],
"dependencies": {
"@lion/combobox": "^0.5.1",
"@open-wc/scoped-elements": "^1.3.2",
"@lion/combobox": "^0.8.0",
"@lion/core": "^0.18.0",
"@lion/listbox": "^0.10.1",
"@open-wc/scoped-elements": "^2.0.0-next.3",
"chalk": "^4.0.0",
"minisearch": "^3.0.2",
"plugins-manager": "^0.2.2",

View File

@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { html, LitElement, css } from 'lit-element';
import { html, LitElement, css, repeat } from '@lion/core';
import MiniSearch from 'minisearch';
import { repeat } from 'lit-html/directives/repeat.js';
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
import { RocketSearchCombobox } from './RocketSearchCombobox.js';
import { RocketSearchOption } from './RocketSearchOption.js';
@@ -94,7 +93,7 @@ export class RocketSearch extends ScopedElementsMixin(LitElement) {
}
get combobox() {
return this.shadowRoot?.children[0];
return this.shadowRoot.querySelector('rocket-search-combobox');
}
/** @param {import('lit-element').PropertyValues } changedProperties */

View File

@@ -1,4 +1,5 @@
import { expect, fixture as _fixture, html } from '@open-wc/testing';
import { expect, fixture as _fixture } from '@open-wc/testing';
import { html } from 'lit/static-html.js';
import { setViewport } from '@web/test-runner-commands';
import { stubMethod } from 'hanbi';

118
yarn.lock
View File

@@ -1110,15 +1110,15 @@
dependencies:
"@lion/core" "0.16.0"
"@lion/combobox@^0.5.1":
version "0.5.1"
resolved "https://registry.yarnpkg.com/@lion/combobox/-/combobox-0.5.1.tgz#6395d5c34f0935aee32034584a253c1a2c6fa717"
integrity sha512-sOpJLCH8pzZAOohrqVnlTjC7L93tavXugSV2SqhVsFFnSQIWXytaeL8eJPlVBrTrmcOpns6AQX2uyBbeY6ZTsg==
"@lion/combobox@^0.8.0":
version "0.8.0"
resolved "https://registry.yarnpkg.com/@lion/combobox/-/combobox-0.8.0.tgz#ef60cfcfa55b659033900615efb207dd80708320"
integrity sha512-qjudhZ/UAbvPjJavWT/VZt9t76Xa0MFaqRnmX7Ga0acJhm29vtMi4r5BqniF/JfCucXz5ya3oFYNqxkOQcWReA==
dependencies:
"@lion/core" "0.16.0"
"@lion/form-core" "0.11.0"
"@lion/listbox" "0.7.0"
"@lion/overlays" "0.26.1"
"@lion/core" "0.18.0"
"@lion/form-core" "0.14.1"
"@lion/listbox" "0.10.1"
"@lion/overlays" "0.28.1"
"@lion/core@0.16.0":
version "0.16.0"
@@ -1130,32 +1130,50 @@
lit-element "~2.4.0"
lit-html "^1.3.0"
"@lion/form-core@0.11.0":
version "0.11.0"
resolved "https://registry.yarnpkg.com/@lion/form-core/-/form-core-0.11.0.tgz#83985baba62e11082b42ea84f3683f72a8f36fcf"
integrity sha512-opDXzTtVHJlRo+BLSI0dtSjbIz7PsJL80wnU8WAK3S+WNH5z2S37OBCoVvOVpXRpoqGAj5L/BmaJnHZeo6pPYw==
dependencies:
"@lion/core" "0.16.0"
"@lion/localize" "0.18.0"
"@lion/listbox@0.7.0":
version "0.7.0"
resolved "https://registry.yarnpkg.com/@lion/listbox/-/listbox-0.7.0.tgz#bd1d8cb25098387fd0ae1087f8dd641510f741f0"
integrity sha512-wHGqahRIjpTmMAvU/hDZyDGNhmjRj6FEYSWn7Z3ugE52D9a1PQd7HVc1cVVIRc71jC3w4n5ZYVeZChwR3N3fWw==
dependencies:
"@lion/core" "0.16.0"
"@lion/form-core" "0.11.0"
"@lion/localize@0.18.0":
"@lion/core@0.18.0", "@lion/core@^0.18.0":
version "0.18.0"
resolved "https://registry.yarnpkg.com/@lion/localize/-/localize-0.18.0.tgz#beaf8c161feb58ecab670892c06e7b524527b7e8"
integrity sha512-+adOGlot4IItOy1udLKflZlO2fTKM7R0Ji7iZ5SEVG80XOZxC3RXjVM7mWSd5wqcCUe51j1P/tgKM3vDLF0RAw==
resolved "https://registry.yarnpkg.com/@lion/core/-/core-0.18.0.tgz#475b872407829ab7860f50ff771c2e5ee957b204"
integrity sha512-tfSKvd/YvGY8JPqb3Nv4TV85nzgeXOxXfnnNVpAGGC0yoRK9jKR4FvRdqDROenbPsfPOVz9+uL/2fd+GJl6qKg==
dependencies:
"@open-wc/dedupe-mixin" "^1.2.18"
"@open-wc/scoped-elements" "^2.0.0-next.3"
lit "^2.0.0-rc.2"
"@lion/form-core@0.14.1":
version "0.14.1"
resolved "https://registry.yarnpkg.com/@lion/form-core/-/form-core-0.14.1.tgz#404e047e32ea56ae5318db6444809cf83089d5f3"
integrity sha512-WQQASer/vv0dyaxdp4nK2M+SqosCdk2JIyvShMmo9aqsTtUlKfyof/JszHj1e5pkydGHqC4x7ehN3gx4UiDk2g==
dependencies:
"@lion/core" "0.18.0"
"@lion/localize" "0.20.1"
"@lion/listbox@0.10.1", "@lion/listbox@^0.10.1":
version "0.10.1"
resolved "https://registry.yarnpkg.com/@lion/listbox/-/listbox-0.10.1.tgz#c6a6e4cebc4f76386c1261faf582c46e58f41a37"
integrity sha512-WrQ1/BiaEo3TBAQgFuRxqHTYlhLD4BZxp73Itlf9ooH6p/NlRsYKlppPfzWmhtoc7uJRbc9PDoo2krxvMFKxfA==
dependencies:
"@lion/core" "0.18.0"
"@lion/form-core" "0.14.1"
"@lion/localize@0.20.1":
version "0.20.1"
resolved "https://registry.yarnpkg.com/@lion/localize/-/localize-0.20.1.tgz#92b3e795b1cec1cffeac8e54ed9a19ad6fc934fc"
integrity sha512-su55r7wsNAYUl0s5J2ySv6KThIKAXt76nA/6OkCFGTS5e4LClCenqvK6jrhpGQKZ29I4OW4XQMFXTu/XlaKNMQ==
dependencies:
"@bundled-es-modules/message-format" "6.0.4"
"@lion/core" "0.16.0"
singleton-manager "1.4.1"
"@lion/core" "0.18.0"
singleton-manager "1.4.2"
"@lion/overlays@0.26.1", "@lion/overlays@^0.26.1":
"@lion/overlays@0.28.1":
version "0.28.1"
resolved "https://registry.yarnpkg.com/@lion/overlays/-/overlays-0.28.1.tgz#08f0d781a45208c7beef2730c66f42b571d49ab8"
integrity sha512-MiEkGtPIUHewGqay3VI++S6UXcTrSLt2Or0RxYFZfS64PIPMRPmKKsyW8xiouuKXWGV7vafP7apAauP8CxaY+g==
dependencies:
"@lion/core" "0.18.0"
"@popperjs/core" "^2.5.4"
singleton-manager "1.4.2"
"@lion/overlays@^0.26.1":
version "0.26.1"
resolved "https://registry.yarnpkg.com/@lion/overlays/-/overlays-0.26.1.tgz#d1bfa4f5f97108982afa7b409ba4300f8b2d2ba5"
integrity sha512-1FvphbR/yTQ1WtcB1gNuH772i9qAydQkI6NwibIw8QeOGXisA+6SChv2OHS7CijlpDJnDxNyX44LGdDM1/Pd8A==
@@ -1224,14 +1242,6 @@
resolved "https://registry.yarnpkg.com/@open-wc/dedupe-mixin/-/dedupe-mixin-1.3.0.tgz#0df5d438285fc3482838786ee81895318f0ff778"
integrity sha512-UfdK1MPnR6T7f3svzzYBfu3qBkkZ/KsPhcpc3JYhsUY4hbpwNF9wEQtD4Z+/mRqMTJrKg++YSxIxE0FBhY3RIw==
"@open-wc/scoped-elements@^1.3.2":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@open-wc/scoped-elements/-/scoped-elements-1.3.2.tgz#6ae54c49731bbe8c3e0b5383c989f983dcdfacf5"
integrity sha512-DoP3XA8r03tGx+IrlJwP/voLuDFkyS56kvwhmXIhpESo7M5jMt5e0zScNrawj7EMe4b5gDaJjorx2Jza8FLaLw==
dependencies:
"@open-wc/dedupe-mixin" "^1.3.0"
lit-html "^1.0.0"
"@open-wc/scoped-elements@^1.3.3":
version "1.3.3"
resolved "https://registry.yarnpkg.com/@open-wc/scoped-elements/-/scoped-elements-1.3.3.tgz#fe008aef4d74fb00c553c900602960638fc1c7b0"
@@ -1249,6 +1259,15 @@
"@open-wc/dedupe-mixin" "^1.3.0"
"@webcomponents/scoped-custom-element-registry" "0.0.1"
"@open-wc/scoped-elements@^2.0.0-next.3":
version "2.0.0-next.4"
resolved "https://registry.yarnpkg.com/@open-wc/scoped-elements/-/scoped-elements-2.0.0-next.4.tgz#d8294358e3e8ad2ba44200ab805549fde49245f6"
integrity sha512-BMd5n5BHLi3FBhwhPbBuN7pZdi8I1CIQn10aKLZtg9aplVhN2BG1rwr0ANebXJ6fdq8m1PE1wQAaCXYCcEBTEQ==
dependencies:
"@lit/reactive-element" "^1.0.0-rc.1"
"@open-wc/dedupe-mixin" "^1.3.0"
"@webcomponents/scoped-custom-element-registry" "0.0.2"
"@open-wc/semantic-dom-diff@^0.13.16":
version "0.13.21"
resolved "https://registry.yarnpkg.com/@open-wc/semantic-dom-diff/-/semantic-dom-diff-0.13.21.tgz#718b9ec5f9a98935fc775e577ad094ae8d8b7dea"
@@ -1993,6 +2012,11 @@
resolved "https://registry.yarnpkg.com/@webcomponents/scoped-custom-element-registry/-/scoped-custom-element-registry-0.0.1.tgz#196365260a019f87bddbded154ab09faf0e666fc"
integrity sha512-ef5/v4U2vCxrnSMpo41LSWTjBOXCQ4JOt4+Y6PaSd8ympYioPhOP6E1tKmIk2ppwLSjCKbTyYf7ocHvwDat7bA==
"@webcomponents/scoped-custom-element-registry@0.0.2":
version "0.0.2"
resolved "https://registry.yarnpkg.com/@webcomponents/scoped-custom-element-registry/-/scoped-custom-element-registry-0.0.2.tgz#c863d163cb39c60063808e5ae23e06a1766fbe5f"
integrity sha512-lKCoZfKoE3FHvmmj2ytaLBB8Grxp4HaxfSzaGlIZN6xXnOILfpCO0PFJkAxanefLGJWMho4kRY5PhgxWFhmSOw==
"@webcomponents/webcomponentsjs@^2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@webcomponents/webcomponentsjs/-/webcomponentsjs-2.5.0.tgz#61b27785a6ad5bfd68fa018201fe418b118cb38d"
@@ -2629,15 +2653,10 @@ camelcase@^6.0.0, camelcase@^6.2.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809"
integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==
caniuse-lite@^1.0.30001165:
version "1.0.30001170"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001170.tgz#0088bfecc6a14694969e391cc29d7eb6362ca6a7"
integrity sha512-Dd4d/+0tsK0UNLrZs3CvNukqalnVTRrxb5mcQm8rHL49t7V5ZaTygwXkrq+FB+dVDf++4ri8eJnFEJAB8332PA==
caniuse-lite@^1.0.30001173:
version "1.0.30001174"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001174.tgz#0f2aca2153fd88ceb07a2bb982fc2acb787623c4"
integrity sha512-tqClL/4ThQq6cfFXH3oJL4rifFBeM6gTkphjao5kgwMaW9yn0tKgQLAEfKzDwj6HQWCB/aWo8kTFlSvIN8geEA==
caniuse-lite@^1.0.30001165, caniuse-lite@^1.0.30001173:
version "1.0.30001239"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001239.tgz"
integrity sha512-cyBkXJDMeI4wthy8xJ2FvDU6+0dtcZSJW3voUF8+e9f1bBeuvyZfc3PNbkOETyhbR+dGCPzn9E7MA3iwzusOhQ==
ccount@^1.0.0:
version "1.1.0"
@@ -7747,6 +7766,11 @@ singleton-manager@1.4.1:
resolved "https://registry.yarnpkg.com/singleton-manager/-/singleton-manager-1.4.1.tgz#0a9cd1db2b26e5cbc4ecdc20d5a16f284b36aabb"
integrity sha512-HOvKT/WcHvl2cLYGqmO6MaC2J4wAA82LntGwtLn6avnTq15UDLCnSRVXedmglVooLbQGVsQJ+dQz2sKz+2GUZA==
singleton-manager@1.4.2:
version "1.4.2"
resolved "https://registry.yarnpkg.com/singleton-manager/-/singleton-manager-1.4.2.tgz#4649acafca3eccf987d828ab16369ee59c4a22a5"
integrity sha512-3/K7K61TiN0+tw32HRC3AZQBacN0Ky/NmHEnhofFPEFROqZ5T6BXK45Z94OQsvuFD2euOVOU40XDNeTal63Baw==
sinon@^9.2.3:
version "9.2.3"
resolved "https://registry.yarnpkg.com/sinon/-/sinon-9.2.3.tgz#f68ce414e843e2fd638703043c97f260697caa52"