@rocket/js 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-types/exports/adapters/cloudflare.d.ts +2 -0
- package/dist-types/exports/adapters/cloudflare.d.ts.map +1 -0
- package/dist-types/exports/types/rocket.d.ts +11 -0
- package/dist-types/exports/types/rocket.d.ts.map +1 -1
- package/dist-types/exports/types.d.ts +1 -1
- package/dist-types/exports/types.d.ts.map +1 -1
- package/dist-types/src/PageData.d.ts +9 -0
- package/dist-types/src/PageData.d.ts.map +1 -1
- package/dist-types/src/RocketCodeBlock.d.ts.map +1 -1
- package/dist-types/src/RocketJsDemo.d.ts.map +1 -1
- package/dist-types/src/adapters/cloudflare.d.ts +27 -0
- package/dist-types/src/adapters/cloudflare.d.ts.map +1 -0
- package/dist-types/src/adapters/netlify.d.ts.map +1 -1
- package/dist-types/src/adapters/redirects.d.ts +14 -0
- package/dist-types/src/adapters/redirects.d.ts.map +1 -0
- package/dist-types/src/icons.d.ts +27 -0
- package/dist-types/src/icons.d.ts.map +1 -1
- package/dist-types/src/layouts/atlas/atlasBlogLayout.d.ts.map +1 -1
- package/dist-types/src/layouts/atlas/atlasDocLayout.d.ts.map +1 -1
- package/dist-types/src/layouts/atlas/atlasHeroLayout.d.ts.map +1 -1
- package/dist-types/src/layouts/atlas/atlasNotFoundLayout.d.ts.map +1 -1
- package/dist-types/src/layouts/layout-helper.d.ts.map +1 -1
- package/dist-types/src/markdownHook.d.ts.map +1 -1
- package/dist-types/src/menus/MainMenu.d.ts.map +1 -1
- package/dist-types/src/menus/RocketMenu.d.ts.map +1 -1
- package/dist-types/src/menus/RocketToc.d.ts.map +1 -1
- package/dist-types/src/menus/pageNavigation.d.ts.map +1 -1
- package/dist-types/src/publicAssets.d.ts.map +1 -1
- package/exports/adapters/cloudflare.js +1 -0
- package/exports/types/rocket.ts +17 -4
- package/exports/types.ts +1 -0
- package/package.json +40 -26
- package/src/PageData.js +15 -0
- package/src/RocketCodeBlock.js +11 -9
- package/src/RocketJsDemo.js +7 -5
- package/src/adapters/cloudflare.js +522 -0
- package/src/adapters/netlify.js +2 -24
- package/src/adapters/redirects.js +31 -0
- package/src/cli/RocketBuild.js +5 -2
- package/src/config.js +1 -1
- package/src/icons.js +138 -0
- package/src/layouts/atlas/atlasBlogLayout.js +45 -31
- package/src/layouts/atlas/atlasDocLayout.js +22 -16
- package/src/layouts/atlas/atlasHeroLayout.js +39 -31
- package/src/layouts/atlas/atlasNotFoundLayout.js +5 -3
- package/src/layouts/layout-helper.js +38 -26
- package/src/main.js +15 -0
- package/src/markdownCompiler.js +5 -1
- package/src/menus/MainMenu.js +17 -13
- package/src/menus/RocketMenu.js +25 -19
- package/src/menus/RocketToc.js +7 -5
- package/src/menus/pageNavigation.js +24 -10
- package/src/publicAssets.js +9 -2
- package/src/transform.js +7 -1
- package/src/wds-plugin.js +2 -1
package/src/menus/RocketMenu.js
CHANGED
|
@@ -47,25 +47,31 @@ export class RocketMenu extends LitElement {
|
|
|
47
47
|
|
|
48
48
|
return html`
|
|
49
49
|
<li class=${classMap(itemClasses)}>
|
|
50
|
-
${
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
${
|
|
51
|
+
page.menuNoLink
|
|
52
|
+
? html`<span class=${classMap(classes)}>${title}</span>`
|
|
53
|
+
: html`<a
|
|
54
|
+
href=${ifDefined(page.url)}
|
|
55
|
+
class=${classMap(classes)}
|
|
56
|
+
aria-current=${ifDefined(isCurrent ? 'page' : undefined)}
|
|
57
|
+
>${
|
|
58
|
+
page.iconName
|
|
59
|
+
? html`<rocket-icon
|
|
60
|
+
class="nav-icon"
|
|
61
|
+
name=${page.iconName}
|
|
62
|
+
aria-hidden="true"
|
|
63
|
+
></rocket-icon>`
|
|
64
|
+
: ''
|
|
65
|
+
}<span class="nav-text">${title}</span></a
|
|
66
|
+
>`
|
|
67
|
+
}
|
|
68
|
+
${
|
|
69
|
+
page.children.length > 0
|
|
70
|
+
? html`<ul>
|
|
71
|
+
${page.children.map(child => this.list(child, depth + 1))}
|
|
72
|
+
</ul>`
|
|
73
|
+
: ''
|
|
74
|
+
}
|
|
69
75
|
</li>
|
|
70
76
|
`;
|
|
71
77
|
}
|
package/src/menus/RocketToc.js
CHANGED
|
@@ -68,11 +68,13 @@ export class RocketToc extends LitElement {
|
|
|
68
68
|
>
|
|
69
69
|
${headline.text}
|
|
70
70
|
</a>
|
|
71
|
-
${
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
${
|
|
72
|
+
headline.children.length > 0
|
|
73
|
+
? html`<ol>
|
|
74
|
+
${headline.children.map(child => this.list(child, depth + 1))}
|
|
75
|
+
</ol>`
|
|
76
|
+
: html``
|
|
77
|
+
}
|
|
76
78
|
</li>
|
|
77
79
|
`;
|
|
78
80
|
}
|
|
@@ -50,20 +50,34 @@ export function renderPageNavigationCard(page, direction) {
|
|
|
50
50
|
const isNext = direction === 'next';
|
|
51
51
|
const label = isNext ? 'Next Page' : 'Previous Page';
|
|
52
52
|
const icon = html`<span class="page-card-icon" aria-hidden="true">
|
|
53
|
-
${
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
${
|
|
54
|
+
isNext
|
|
55
|
+
? html`<svg
|
|
56
|
+
class="page-card-arrow"
|
|
57
|
+
viewBox="0 0 36 16"
|
|
58
|
+
focusable="false"
|
|
59
|
+
aria-hidden="true"
|
|
60
|
+
>
|
|
61
|
+
<path d="M5 8h25m-7-6 7 6-7 6" />
|
|
62
|
+
</svg>`
|
|
63
|
+
: html`<svg
|
|
64
|
+
class="page-card-arrow"
|
|
65
|
+
viewBox="0 0 36 16"
|
|
66
|
+
focusable="false"
|
|
67
|
+
aria-hidden="true"
|
|
68
|
+
>
|
|
69
|
+
<path d="M31 8H6m7-6-7 6 7 6" />
|
|
70
|
+
</svg>`
|
|
71
|
+
}
|
|
60
72
|
</span>`;
|
|
61
73
|
const text = html`<span class="page-card-text">
|
|
62
74
|
<span class="page-card-label">${label}</span>
|
|
63
75
|
<strong class="page-card-title">${page.linkText}</strong>
|
|
64
|
-
${
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
${
|
|
77
|
+
page.sectionLabel
|
|
78
|
+
? html`<span class="page-card-section">${page.sectionLabel}</span>`
|
|
79
|
+
: nothing
|
|
80
|
+
}
|
|
67
81
|
</span>`;
|
|
68
82
|
|
|
69
83
|
return html`<a
|
package/src/publicAssets.js
CHANGED
|
@@ -5,6 +5,12 @@ import { paginatedArchivePaths } from './page-pagination.js';
|
|
|
5
5
|
import { normalizeDocumentPath, standaloneDemoPaths } from './standalone-demo-url.js';
|
|
6
6
|
import { needsDefaultSocialPreviewImage, publicSocialPreviewPages } from './socialPreviewImages.js';
|
|
7
7
|
|
|
8
|
+
/** Adapters that write `_redirects` into the build output, by adapter name. */
|
|
9
|
+
const REDIRECTS_FILE_HOSTS = new Map([
|
|
10
|
+
['netlify', 'Netlify'],
|
|
11
|
+
['cloudflare', 'Cloudflare'],
|
|
12
|
+
]);
|
|
13
|
+
|
|
8
14
|
export const PUBLIC_ASSETS_DIR = 'public';
|
|
9
15
|
|
|
10
16
|
/**
|
|
@@ -237,8 +243,9 @@ function generatedOutputClaims({ pages, generatedPages, config, emitRedirectFall
|
|
|
237
243
|
if (config.siteDiscoverability?.robots === true) {
|
|
238
244
|
claims.set('/robots.txt', 'generated Robots File');
|
|
239
245
|
}
|
|
240
|
-
|
|
241
|
-
|
|
246
|
+
const redirectsFileHost = REDIRECTS_FILE_HOSTS.get(config.adapter?.name ?? '');
|
|
247
|
+
if (redirectsFileHost && config.urlLifecycle?.redirects?.length) {
|
|
248
|
+
claims.set('/_redirects', `${redirectsFileHost} Redirect output`);
|
|
242
249
|
}
|
|
243
250
|
|
|
244
251
|
return claims;
|
package/src/transform.js
CHANGED
|
@@ -412,7 +412,13 @@ export function isDemoCodeNode(node) {
|
|
|
412
412
|
*/
|
|
413
413
|
function demoExportName(code) {
|
|
414
414
|
const [, moduleExports] = parseExports(code);
|
|
415
|
-
const
|
|
415
|
+
const first = moduleExports[0];
|
|
416
|
+
const name =
|
|
417
|
+
first?.type === 'direct'
|
|
418
|
+
? first.localName || first.name
|
|
419
|
+
: first?.type === 'reexport'
|
|
420
|
+
? first.name
|
|
421
|
+
: undefined;
|
|
416
422
|
if (!name) {
|
|
417
423
|
throw new Error(
|
|
418
424
|
'A ```js demo code block must export the demo function, ' +
|
package/src/wds-plugin.js
CHANGED
|
@@ -129,7 +129,8 @@ export default (include, exclude, resolverPort, options = {}) => {
|
|
|
129
129
|
type: rocketIconRuntime.type,
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
const iconAsset =
|
|
132
|
+
const iconAsset =
|
|
133
|
+
iconAssetStore.get(context.path) ?? (await iconAssetStore.getWebAwesomeIcon(context.path));
|
|
133
134
|
if (iconAsset) {
|
|
134
135
|
return {
|
|
135
136
|
body: iconAsset.svg,
|