@rocket/js 0.0.0 → 0.1.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/LICENSE +21 -0
- package/README.md +224 -2
- package/dist-types/exports/MainMenu.d.ts +2 -0
- package/dist-types/exports/MainMenu.d.ts.map +1 -0
- package/dist-types/exports/PageData.d.ts +2 -0
- package/dist-types/exports/PageData.d.ts.map +1 -0
- package/dist-types/exports/RocketCodeBlock.d.ts +2 -0
- package/dist-types/exports/RocketCodeBlock.d.ts.map +1 -0
- package/dist-types/exports/RocketIcon.d.ts +2 -0
- package/dist-types/exports/RocketIcon.d.ts.map +1 -0
- package/dist-types/exports/RocketJsDemo.d.ts +2 -0
- package/dist-types/exports/RocketJsDemo.d.ts.map +1 -0
- package/dist-types/exports/RocketRequestDemo.d.ts +2 -0
- package/dist-types/exports/RocketRequestDemo.d.ts.map +1 -0
- package/dist-types/exports/SocialPreviewPlayground.d.ts +2 -0
- package/dist-types/exports/SocialPreviewPlayground.d.ts.map +1 -0
- package/dist-types/exports/adapters/netlify.d.ts +2 -0
- package/dist-types/exports/adapters/netlify.d.ts.map +1 -0
- package/dist-types/exports/asyncMessage.d.ts +2 -0
- package/dist-types/exports/asyncMessage.d.ts.map +1 -0
- package/dist-types/exports/component-hydration.d.ts +2 -0
- package/dist-types/exports/component-hydration.d.ts.map +1 -0
- package/dist-types/exports/components/web-awesome.d.ts +3 -0
- package/dist-types/exports/components/web-awesome.d.ts.map +1 -0
- package/dist-types/exports/components.d.ts +2 -0
- package/dist-types/exports/components.d.ts.map +1 -0
- package/dist-types/exports/config.d.ts +2 -0
- package/dist-types/exports/config.d.ts.map +1 -0
- package/dist-types/exports/debounce.d.ts +2 -0
- package/dist-types/exports/debounce.d.ts.map +1 -0
- package/dist-types/exports/define/RocketCodeBlock.d.ts +2 -0
- package/dist-types/exports/define/RocketCodeBlock.d.ts.map +1 -0
- package/dist-types/exports/define/RocketIcon.d.ts +2 -0
- package/dist-types/exports/define/RocketIcon.d.ts.map +1 -0
- package/dist-types/exports/define/RocketJsDemo.d.ts +2 -0
- package/dist-types/exports/define/RocketJsDemo.d.ts.map +1 -0
- package/dist-types/exports/define/RocketRequestDemo.d.ts +2 -0
- package/dist-types/exports/define/RocketRequestDemo.d.ts.map +1 -0
- package/dist-types/exports/define/menus.d.ts +2 -0
- package/dist-types/exports/define/menus.d.ts.map +1 -0
- package/dist-types/exports/extractCode.d.ts +2 -0
- package/dist-types/exports/extractCode.d.ts.map +1 -0
- package/dist-types/exports/globalData.d.ts +2 -0
- package/dist-types/exports/globalData.d.ts.map +1 -0
- package/dist-types/exports/hydration/hydrationLoader.d.ts +2 -0
- package/dist-types/exports/hydration/hydrationLoader.d.ts.map +1 -0
- package/dist-types/exports/icons.d.ts +2 -0
- package/dist-types/exports/icons.d.ts.map +1 -0
- package/dist-types/exports/layout-helper.d.ts +2 -0
- package/dist-types/exports/layout-helper.d.ts.map +1 -0
- package/dist-types/exports/layout.d.ts +2 -0
- package/dist-types/exports/layout.d.ts.map +1 -0
- package/dist-types/exports/layouts/atlasDoc.d.ts +2 -0
- package/dist-types/exports/layouts/atlasDoc.d.ts.map +1 -0
- package/dist-types/exports/layouts/atlasHero.d.ts +2 -0
- package/dist-types/exports/layouts/atlasHero.d.ts.map +1 -0
- package/dist-types/exports/layouts/atlasNotFound.d.ts +2 -0
- package/dist-types/exports/layouts/atlasNotFound.d.ts.map +1 -0
- package/dist-types/exports/loaded-page-module.d.ts +2 -0
- package/dist-types/exports/loaded-page-module.d.ts.map +1 -0
- package/dist-types/exports/markdownHook.d.ts +2 -0
- package/dist-types/exports/markdownHook.d.ts.map +1 -0
- package/dist-types/exports/menu.d.ts +2 -0
- package/dist-types/exports/menu.d.ts.map +1 -0
- package/dist-types/exports/menus.d.ts +6 -0
- package/dist-types/exports/menus.d.ts.map +1 -0
- package/dist-types/exports/page-runtime.d.ts +2 -0
- package/dist-types/exports/page-runtime.d.ts.map +1 -0
- package/dist-types/exports/pages.d.ts +2 -0
- package/dist-types/exports/pages.d.ts.map +1 -0
- package/dist-types/exports/resolve.d.ts +2 -0
- package/dist-types/exports/resolve.d.ts.map +1 -0
- package/dist-types/exports/ssr.d.ts +2 -0
- package/dist-types/exports/ssr.d.ts.map +1 -0
- package/dist-types/exports/standalone-demo-url.d.ts +2 -0
- package/dist-types/exports/standalone-demo-url.d.ts.map +1 -0
- package/dist-types/exports/transform.d.ts +2 -0
- package/dist-types/exports/transform.d.ts.map +1 -0
- package/dist-types/exports/types/hydration.d.ts +23 -0
- package/dist-types/exports/types/hydration.d.ts.map +1 -0
- package/dist-types/exports/types/rocket.d.ts +504 -0
- package/dist-types/exports/types/rocket.d.ts.map +1 -0
- package/dist-types/exports/types.d.ts +3 -0
- package/dist-types/exports/types.d.ts.map +1 -0
- package/dist-types/exports/wds-plugin.d.ts +2 -0
- package/dist-types/exports/wds-plugin.d.ts.map +1 -0
- package/dist-types/src/PageData.d.ts +82 -0
- package/dist-types/src/PageData.d.ts.map +1 -0
- package/dist-types/src/RocketCodeBlock.d.ts +64 -0
- package/dist-types/src/RocketCodeBlock.d.ts.map +1 -0
- package/dist-types/src/RocketIcon.d.ts +35 -0
- package/dist-types/src/RocketIcon.d.ts.map +1 -0
- package/dist-types/src/RocketJsDemo.d.ts +59 -0
- package/dist-types/src/RocketJsDemo.d.ts.map +1 -0
- package/dist-types/src/RocketJsDemo.test-browser.d.ts +3 -0
- package/dist-types/src/RocketJsDemo.test-browser.d.ts.map +1 -0
- package/dist-types/src/RocketRequestDemo.d.ts +57 -0
- package/dist-types/src/RocketRequestDemo.d.ts.map +1 -0
- package/dist-types/src/RocketRequestDemo.test-browser.d.ts +3 -0
- package/dist-types/src/RocketRequestDemo.test-browser.d.ts.map +1 -0
- package/dist-types/src/SocialPreviewPlayground.d.ts +102 -0
- package/dist-types/src/SocialPreviewPlayground.d.ts.map +1 -0
- package/dist-types/src/adapters/netlify.d.ts +54 -0
- package/dist-types/src/adapters/netlify.d.ts.map +1 -0
- package/dist-types/src/asyncMessage.d.ts +14 -0
- package/dist-types/src/asyncMessage.d.ts.map +1 -0
- package/dist-types/src/cli/RocketBuild.d.ts +78 -0
- package/dist-types/src/cli/RocketBuild.d.ts.map +1 -0
- package/dist-types/src/cli/RocketCli.d.ts +17 -0
- package/dist-types/src/cli/RocketCli.d.ts.map +1 -0
- package/dist-types/src/cli/RocketInit.d.ts +22 -0
- package/dist-types/src/cli/RocketInit.d.ts.map +1 -0
- package/dist-types/src/cli/RocketStart.d.ts +13 -0
- package/dist-types/src/cli/RocketStart.d.ts.map +1 -0
- package/dist-types/src/cli/cli.d.ts +3 -0
- package/dist-types/src/cli/cli.d.ts.map +1 -0
- package/dist-types/src/component-hydration.d.ts +26 -0
- package/dist-types/src/component-hydration.d.ts.map +1 -0
- package/dist-types/src/components/FeatureList.d.ts +15 -0
- package/dist-types/src/components/FeatureList.d.ts.map +1 -0
- package/dist-types/src/components/Footer.d.ts +17 -0
- package/dist-types/src/components/Footer.d.ts.map +1 -0
- package/dist-types/src/components/Header.d.ts +6 -0
- package/dist-types/src/components/Header.d.ts.map +1 -0
- package/dist-types/src/components/RocketDrawer.d.ts +20 -0
- package/dist-types/src/components/RocketDrawer.d.ts.map +1 -0
- package/dist-types/src/components/RocketSocialLink.d.ts +30 -0
- package/dist-types/src/components/RocketSocialLink.d.ts.map +1 -0
- package/dist-types/src/components.d.ts +5 -0
- package/dist-types/src/components.d.ts.map +1 -0
- package/dist-types/src/config.d.ts +6 -0
- package/dist-types/src/config.d.ts.map +1 -0
- package/dist-types/src/debounce.d.ts +8 -0
- package/dist-types/src/debounce.d.ts.map +1 -0
- package/dist-types/src/defaultSocialPreviewTemplate.d.ts +31 -0
- package/dist-types/src/defaultSocialPreviewTemplate.d.ts.map +1 -0
- package/dist-types/src/development-page-module-loader.d.ts +15 -0
- package/dist-types/src/development-page-module-loader.d.ts.map +1 -0
- package/dist-types/src/extractCode.d.ts +5 -0
- package/dist-types/src/extractCode.d.ts.map +1 -0
- package/dist-types/src/hydration/evaluate.d.ts +20 -0
- package/dist-types/src/hydration/evaluate.d.ts.map +1 -0
- package/dist-types/src/hydration/extractStrategies.d.ts +5 -0
- package/dist-types/src/hydration/extractStrategies.d.ts.map +1 -0
- package/dist-types/src/hydration/hydrationLoader.d.ts +64 -0
- package/dist-types/src/hydration/hydrationLoader.d.ts.map +1 -0
- package/dist-types/src/icons.d.ts +170 -0
- package/dist-types/src/icons.d.ts.map +1 -0
- package/dist-types/src/layouts/atlas/atlasDocLayout.d.ts +45 -0
- package/dist-types/src/layouts/atlas/atlasDocLayout.d.ts.map +1 -0
- package/dist-types/src/layouts/atlas/atlasHeroLayout.d.ts +7 -0
- package/dist-types/src/layouts/atlas/atlasHeroLayout.d.ts.map +1 -0
- package/dist-types/src/layouts/atlas/atlasNotFoundLayout.d.ts +5 -0
- package/dist-types/src/layouts/atlas/atlasNotFoundLayout.d.ts.map +1 -0
- package/dist-types/src/layouts/layout-helper.d.ts +16 -0
- package/dist-types/src/layouts/layout-helper.d.ts.map +1 -0
- package/dist-types/src/layouts/layout.d.ts +9 -0
- package/dist-types/src/layouts/layout.d.ts.map +1 -0
- package/dist-types/src/loaded-page-module.d.ts +51 -0
- package/dist-types/src/loaded-page-module.d.ts.map +1 -0
- package/dist-types/src/main.d.ts +2 -0
- package/dist-types/src/main.d.ts.map +1 -0
- package/dist-types/src/markdownCompiler.d.ts +22 -0
- package/dist-types/src/markdownCompiler.d.ts.map +1 -0
- package/dist-types/src/markdownHook.d.ts +6 -0
- package/dist-types/src/markdownHook.d.ts.map +1 -0
- package/dist-types/src/menu.d.ts +22 -0
- package/dist-types/src/menu.d.ts.map +1 -0
- package/dist-types/src/menus/MainMenu.d.ts +23 -0
- package/dist-types/src/menus/MainMenu.d.ts.map +1 -0
- package/dist-types/src/menus/RocketMenu.d.ts +23 -0
- package/dist-types/src/menus/RocketMenu.d.ts.map +1 -0
- package/dist-types/src/menus/RocketNextPage.d.ts +18 -0
- package/dist-types/src/menus/RocketNextPage.d.ts.map +1 -0
- package/dist-types/src/menus/RocketPreviousPage.d.ts +18 -0
- package/dist-types/src/menus/RocketPreviousPage.d.ts.map +1 -0
- package/dist-types/src/menus/RocketToc.d.ts +54 -0
- package/dist-types/src/menus/RocketToc.d.ts.map +1 -0
- package/dist-types/src/menus/pageNavigation.d.ts +41 -0
- package/dist-types/src/menus/pageNavigation.d.ts.map +1 -0
- package/dist-types/src/page-pagination.d.ts +69 -0
- package/dist-types/src/page-pagination.d.ts.map +1 -0
- package/dist-types/src/page-runtime.d.ts +110 -0
- package/dist-types/src/page-runtime.d.ts.map +1 -0
- package/dist-types/src/pages.d.ts +10 -0
- package/dist-types/src/pages.d.ts.map +1 -0
- package/dist-types/src/publicAssets.d.ts +70 -0
- package/dist-types/src/publicAssets.d.ts.map +1 -0
- package/dist-types/src/requestDemoMetadata.d.ts +19 -0
- package/dist-types/src/requestDemoMetadata.d.ts.map +1 -0
- package/dist-types/src/resolve.d.ts +7 -0
- package/dist-types/src/resolve.d.ts.map +1 -0
- package/dist-types/src/siteDiscoverability.d.ts +33 -0
- package/dist-types/src/siteDiscoverability.d.ts.map +1 -0
- package/dist-types/src/siteHeadMetadata.d.ts +20 -0
- package/dist-types/src/siteHeadMetadata.d.ts.map +1 -0
- package/dist-types/src/socialPreviewImages.d.ts +186 -0
- package/dist-types/src/socialPreviewImages.d.ts.map +1 -0
- package/dist-types/src/socialPreviewTemplatePreview.d.ts +22 -0
- package/dist-types/src/socialPreviewTemplatePreview.d.ts.map +1 -0
- package/dist-types/src/ssr.d.ts +6 -0
- package/dist-types/src/ssr.d.ts.map +1 -0
- package/dist-types/src/standalone-demo-url.d.ts +60 -0
- package/dist-types/src/standalone-demo-url.d.ts.map +1 -0
- package/dist-types/src/static-page-module-loader.d.ts +15 -0
- package/dist-types/src/static-page-module-loader.d.ts.map +1 -0
- package/dist-types/src/transform.d.ts +10 -0
- package/dist-types/src/transform.d.ts.map +1 -0
- package/dist-types/src/urlLifecycle.d.ts +23 -0
- package/dist-types/src/urlLifecycle.d.ts.map +1 -0
- package/dist-types/src/wds-plugin.d.ts +14 -0
- package/dist-types/src/wds-plugin.d.ts.map +1 -0
- package/docs/assets/home-background.svg +1 -0
- package/docs/assets/prism-one-light.css +368 -0
- package/docs/assets/rocket-logo-dark-with-text-below.svg +8 -0
- package/docs/assets/rocket-logo-dark-with-text.svg +7 -0
- package/docs/assets/rocket-logo-dark.svg +7 -0
- package/docs/assets/rocket-logo-light-with-text-below.svg +14 -0
- package/docs/assets/rocket-logo-light-with-text.svg +13 -0
- package/docs/assets/rocket-logo-light.svg +12 -0
- package/docs/assets/rocket-text-no-logo.svg +3 -0
- package/exports/MainMenu.js +1 -0
- package/exports/PageData.js +1 -0
- package/exports/RocketCodeBlock.js +1 -0
- package/exports/RocketIcon.js +1 -0
- package/exports/RocketJsDemo.js +1 -0
- package/exports/RocketRequestDemo.js +1 -0
- package/exports/SocialPreviewPlayground.js +1 -0
- package/exports/adapters/netlify.js +1 -0
- package/exports/asyncMessage.js +1 -0
- package/exports/component-hydration.js +1 -0
- package/exports/components/web-awesome.js +63 -0
- package/exports/components.js +1 -0
- package/exports/config.js +1 -0
- package/exports/debounce.js +1 -0
- package/exports/define/RocketCodeBlock.js +2 -0
- package/exports/define/RocketIcon.js +3 -0
- package/exports/define/RocketJsDemo.js +5 -0
- package/exports/define/RocketRequestDemo.js +5 -0
- package/exports/define/menus.js +14 -0
- package/exports/extractCode.js +1 -0
- package/exports/globalData.js +1 -0
- package/exports/hydration/hydrationLoader.js +1 -0
- package/exports/icons.js +8 -0
- package/exports/layout-helper.js +1 -0
- package/exports/layout.js +1 -0
- package/exports/layouts/_atlas.css +3 -0
- package/exports/layouts/atlasDoc.js +5 -0
- package/exports/layouts/atlasHero.js +1 -0
- package/exports/layouts/atlasNotFound.js +4 -0
- package/exports/loaded-page-module.js +5 -0
- package/exports/markdownHook.js +4 -0
- package/exports/menu.js +4 -0
- package/exports/menus.js +5 -0
- package/exports/page-runtime.js +5 -0
- package/exports/pages.js +1 -0
- package/exports/resolve.js +1 -0
- package/exports/ssr.js +1 -0
- package/exports/standalone-demo-url.js +10 -0
- package/exports/transform.js +1 -0
- package/exports/types/hydration.ts +26 -0
- package/exports/types/rocket.ts +598 -0
- package/exports/types.ts +71 -0
- package/exports/wds-plugin.js +1 -0
- package/package.json +192 -9
- package/src/PageData.js +244 -0
- package/src/RocketCodeBlock.js +516 -0
- package/src/RocketIcon.js +291 -0
- package/src/RocketJsDemo.js +397 -0
- package/src/RocketJsDemo.test-browser.js +228 -0
- package/src/RocketRequestDemo.js +439 -0
- package/src/RocketRequestDemo.test-browser.js +301 -0
- package/src/SocialPreviewPlayground.js +573 -0
- package/src/adapters/netlify.js +814 -0
- package/src/asyncMessage.js +21 -0
- package/src/cli/RocketBuild.js +545 -0
- package/src/cli/RocketCli.js +47 -0
- package/src/cli/RocketInit.js +323 -0
- package/src/cli/RocketStart.js +79 -0
- package/src/cli/cli.js +7 -0
- package/src/component-hydration.js +86 -0
- package/src/components/FeatureList.js +114 -0
- package/src/components/Footer.js +116 -0
- package/src/components/Header.js +122 -0
- package/src/components/RocketDrawer.js +193 -0
- package/src/components/RocketSocialLink.js +128 -0
- package/src/components/assets/discord.svg +7 -0
- package/src/components/assets/github.svg +4 -0
- package/src/components/assets/gitlab.svg +1 -0
- package/src/components/assets/info.txt +1 -0
- package/src/components/assets/license.svg +3 -0
- package/src/components/assets/npm.svg +5 -0
- package/src/components/assets/slack.svg +5 -0
- package/src/components/assets/telegram.svg +4 -0
- package/src/components/assets/twitter.svg +1 -0
- package/src/components.js +15 -0
- package/src/config.js +319 -0
- package/src/debounce.js +21 -0
- package/src/defaultSocialPreviewTemplate.js +118 -0
- package/src/development-page-module-loader.js +29 -0
- package/src/extractCode.js +41 -0
- package/src/hydration/evaluate.js +54 -0
- package/src/hydration/extractStrategies.js +91 -0
- package/src/hydration/hydrationLoader.js +330 -0
- package/src/icons.js +883 -0
- package/src/layouts/atlas/atlasDoc.css +877 -0
- package/src/layouts/atlas/atlasDocLayout.js +288 -0
- package/src/layouts/atlas/atlasHero.css +774 -0
- package/src/layouts/atlas/atlasHeroLayout.js +346 -0
- package/src/layouts/atlas/atlasNotFound.css +365 -0
- package/src/layouts/atlas/atlasNotFoundLayout.js +69 -0
- package/src/layouts/layout-helper.js +92 -0
- package/src/layouts/layout.js +62 -0
- package/src/loaded-page-module.js +97 -0
- package/src/main.js +55 -0
- package/src/markdownCompiler.js +303 -0
- package/src/markdownHook.js +148 -0
- package/src/menu.js +210 -0
- package/src/menus/MainMenu.js +58 -0
- package/src/menus/RocketMenu.js +191 -0
- package/src/menus/RocketNextPage.js +25 -0
- package/src/menus/RocketPreviousPage.js +29 -0
- package/src/menus/RocketToc.js +309 -0
- package/src/menus/pageNavigation.js +285 -0
- package/src/page-pagination.js +241 -0
- package/src/page-runtime.js +481 -0
- package/src/pages.js +537 -0
- package/src/publicAssets.js +336 -0
- package/src/requestDemoMetadata.js +97 -0
- package/src/resolve.js +15 -0
- package/src/siteDiscoverability.js +184 -0
- package/src/siteHeadMetadata.js +69 -0
- package/src/socialPreviewImages.js +482 -0
- package/src/socialPreviewTemplatePreview.js +352 -0
- package/src/ssr.js +14 -0
- package/src/standalone-demo-url.js +134 -0
- package/src/static-page-module-loader.js +29 -0
- package/src/transform.js +633 -0
- package/src/urlLifecycle.js +57 -0
- package/src/wds-plugin.js +302 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
2
|
+
import { RocketCodeBlock } from './RocketCodeBlock.js';
|
|
3
|
+
import '../exports/define/RocketJsDemo.js';
|
|
4
|
+
|
|
5
|
+
if (!customElements.get('rocket-code-block')) {
|
|
6
|
+
customElements.define('rocket-code-block', RocketCodeBlock);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** @typedef {(name: string, callback: () => void) => void} BrowserDescribe */
|
|
10
|
+
/** @typedef {(name: string, callback: () => void | Promise<void>) => void} BrowserIt */
|
|
11
|
+
|
|
12
|
+
const testGlobals = /** @type {{ describe: BrowserDescribe; it: BrowserIt }} */ (
|
|
13
|
+
/** @type {unknown} */ (globalThis)
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
testGlobals.describe('Test RocketJsDemo browser behavior', () => {
|
|
17
|
+
testGlobals.it(
|
|
18
|
+
'01: keeps JavaScript Demo source collapsed behind a Source disclosure',
|
|
19
|
+
async () => {
|
|
20
|
+
const element = await renderDemo();
|
|
21
|
+
const shadowRoot = shadowRootFor(element);
|
|
22
|
+
|
|
23
|
+
const source = shadowRoot.querySelector('#source');
|
|
24
|
+
const summary = source?.querySelector('summary');
|
|
25
|
+
|
|
26
|
+
assert.ok(summary instanceof HTMLElement, 'Expected Source summary');
|
|
27
|
+
assert.equal(summary?.textContent, 'Source');
|
|
28
|
+
assertSourceDisclosureArrow(summary);
|
|
29
|
+
assert.equal(source?.hasAttribute('open'), false);
|
|
30
|
+
assert.ok(element.querySelector('rocket-code-block'), 'Expected composed Code Block source');
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
testGlobals.it('02: opens and copies the Standalone Demo URL as a site-root path', async () => {
|
|
35
|
+
const originalOpen = window.open;
|
|
36
|
+
const navigatorDescriptor = Object.getOwnPropertyDescriptor(globalThis, 'navigator');
|
|
37
|
+
/** @type {{ url: string | URL | undefined; target: string | undefined; features: string | undefined }[]} */
|
|
38
|
+
const opened = [];
|
|
39
|
+
let copiedText = '';
|
|
40
|
+
|
|
41
|
+
history.pushState({}, '', '/guides/components/button?tab=source#buttonDemo');
|
|
42
|
+
window.open = (url, target, features) => {
|
|
43
|
+
opened.push({ url, target, features });
|
|
44
|
+
return null;
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(globalThis, 'navigator', {
|
|
47
|
+
configurable: true,
|
|
48
|
+
value: {
|
|
49
|
+
clipboard: {
|
|
50
|
+
/**
|
|
51
|
+
* @param {string} text
|
|
52
|
+
*/
|
|
53
|
+
async writeText(text) {
|
|
54
|
+
copiedText = text;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const element = await renderDemo('buttonDemo');
|
|
62
|
+
const shadowRoot = shadowRootFor(element);
|
|
63
|
+
element.copyStateResetDelay = 50;
|
|
64
|
+
|
|
65
|
+
buttonFor(shadowRoot, '#open-standalone-demo').click();
|
|
66
|
+
const copyButton = buttonFor(shadowRoot, '#copy-standalone-demo');
|
|
67
|
+
copyButton.click();
|
|
68
|
+
await Promise.resolve();
|
|
69
|
+
await element.updateComplete;
|
|
70
|
+
|
|
71
|
+
assert.deepEqual(opened, [
|
|
72
|
+
{
|
|
73
|
+
url: '/guides/components/button/_demo/buttonDemo/',
|
|
74
|
+
target: '_blank',
|
|
75
|
+
features: 'noopener,noreferrer',
|
|
76
|
+
},
|
|
77
|
+
]);
|
|
78
|
+
assert.equal(copiedText, '/guides/components/button/_demo/buttonDemo/');
|
|
79
|
+
assert.equal(copyButton.getAttribute('aria-label'), 'Copied Standalone Demo URL');
|
|
80
|
+
|
|
81
|
+
await new Promise(resolve => setTimeout(resolve, 60));
|
|
82
|
+
await element.updateComplete;
|
|
83
|
+
|
|
84
|
+
assert.equal(copyButton.getAttribute('aria-label'), 'Copy Standalone Demo URL');
|
|
85
|
+
} finally {
|
|
86
|
+
window.open = originalOpen;
|
|
87
|
+
if (navigatorDescriptor) {
|
|
88
|
+
Object.defineProperty(globalThis, 'navigator', navigatorDescriptor);
|
|
89
|
+
} else {
|
|
90
|
+
Reflect.deleteProperty(globalThis, 'navigator');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
testGlobals.it('03: keeps standalone actions in the Source row as icon buttons', async () => {
|
|
96
|
+
const element = await renderDemo();
|
|
97
|
+
const shadowRoot = shadowRootFor(element);
|
|
98
|
+
const sourceRow = shadowRoot.querySelector('#source-row');
|
|
99
|
+
const source = shadowRoot.querySelector('#source');
|
|
100
|
+
const standaloneActions = shadowRoot.querySelector('#standalone-actions');
|
|
101
|
+
const openButton = buttonFor(shadowRoot, '#open-standalone-demo');
|
|
102
|
+
const copyButton = buttonFor(shadowRoot, '#copy-standalone-demo');
|
|
103
|
+
|
|
104
|
+
assert.ok(sourceRow instanceof HTMLElement, 'Expected Source row');
|
|
105
|
+
assert.ok(source instanceof HTMLElement, 'Expected Source details');
|
|
106
|
+
assert.ok(standaloneActions instanceof HTMLElement, 'Expected standalone actions');
|
|
107
|
+
assert.equal(sourceRow?.firstElementChild, source);
|
|
108
|
+
assert.equal(sourceRow?.lastElementChild, standaloneActions);
|
|
109
|
+
assert.equal(getComputedStyle(standaloneActions).position, 'absolute');
|
|
110
|
+
assert.equal(openButton.textContent?.trim(), '');
|
|
111
|
+
assert.equal(copyButton.textContent?.trim(), '');
|
|
112
|
+
assert.equal(openButton.getAttribute('aria-label'), 'Open Standalone Demo URL');
|
|
113
|
+
assert.equal(copyButton.getAttribute('aria-label'), 'Copy Standalone Demo URL');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
testGlobals.it('04: keeps open Source actions and Code Block flush with the frame', async () => {
|
|
117
|
+
const element = await renderDemo();
|
|
118
|
+
const shadowRoot = shadowRootFor(element);
|
|
119
|
+
const source = shadowRoot.querySelector('#source');
|
|
120
|
+
const standaloneActions = shadowRoot.querySelector('#standalone-actions');
|
|
121
|
+
const codeBlock = element.querySelector('rocket-code-block');
|
|
122
|
+
|
|
123
|
+
assert.ok(source instanceof HTMLElement, 'Expected Source details');
|
|
124
|
+
assert.ok(standaloneActions instanceof HTMLElement, 'Expected standalone actions');
|
|
125
|
+
assert.ok(codeBlock instanceof HTMLElement, 'Expected slotted Code Block');
|
|
126
|
+
|
|
127
|
+
source.setAttribute('open', '');
|
|
128
|
+
await element.updateComplete;
|
|
129
|
+
await /** @type {import('./RocketCodeBlock.js').RocketCodeBlock} */ (codeBlock).updateComplete;
|
|
130
|
+
|
|
131
|
+
const summary = source.querySelector('summary');
|
|
132
|
+
const frame = codeBlock.shadowRoot?.querySelector('[part~="frame"]');
|
|
133
|
+
|
|
134
|
+
assert.ok(summary instanceof HTMLElement, 'Expected Source summary');
|
|
135
|
+
assert.ok(frame instanceof HTMLElement, 'Expected Code Block frame part');
|
|
136
|
+
assert.closeTo(
|
|
137
|
+
standaloneActions.getBoundingClientRect().bottom,
|
|
138
|
+
summary.getBoundingClientRect().bottom,
|
|
139
|
+
1,
|
|
140
|
+
);
|
|
141
|
+
assert.equal(getComputedStyle(codeBlock).marginBlockStart, '0px');
|
|
142
|
+
assert.equal(getComputedStyle(codeBlock).marginBlockEnd, '0px');
|
|
143
|
+
assert.equal(getComputedStyle(frame).borderTopStyle, 'none');
|
|
144
|
+
assert.equal(getComputedStyle(frame).borderTopLeftRadius, '0px');
|
|
145
|
+
assert.equal(getComputedStyle(frame).borderTopRightRadius, '0px');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
testGlobals.it('05: renders standalone mode as only the live demo', async () => {
|
|
149
|
+
const element = await renderDemo('standaloneButton', true);
|
|
150
|
+
const shadowRoot = shadowRootFor(element);
|
|
151
|
+
|
|
152
|
+
assert.match(shadowRoot.textContent || '', /Rendered standaloneButton/);
|
|
153
|
+
assert.equal(shadowRoot.querySelector('#source'), null);
|
|
154
|
+
assert.equal(shadowRoot.querySelector('#open-standalone-demo'), null);
|
|
155
|
+
assert.equal(shadowRoot.querySelector('#copy-standalone-demo'), null);
|
|
156
|
+
assert.equal(shadowRoot.querySelector('slot'), null);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
testGlobals.it(
|
|
160
|
+
'06: resizes the JavaScript Demo width from the handle keyboard control',
|
|
161
|
+
async () => {
|
|
162
|
+
const element = await renderDemo();
|
|
163
|
+
const shadowRoot = shadowRootFor(element);
|
|
164
|
+
const wrapper = shadowRoot.querySelector('#wrapper');
|
|
165
|
+
const resize = buttonFor(shadowRoot, '#resize');
|
|
166
|
+
|
|
167
|
+
assert.ok(wrapper instanceof HTMLElement, 'Expected demo wrapper');
|
|
168
|
+
wrapper.style.width = '320px';
|
|
169
|
+
|
|
170
|
+
resize.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowLeft', bubbles: true }));
|
|
171
|
+
await element.updateComplete;
|
|
172
|
+
|
|
173
|
+
assert.equal(wrapper.style.width, '304px');
|
|
174
|
+
},
|
|
175
|
+
);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @param {string} demoName
|
|
180
|
+
* @param {boolean} singleDemo
|
|
181
|
+
* @returns {Promise<import('./RocketJsDemo.js').RocketJsDemo>}
|
|
182
|
+
*/
|
|
183
|
+
async function renderDemo(demoName = 'simpleDemo', singleDemo = false) {
|
|
184
|
+
const element = /** @type {import('./RocketJsDemo.js').RocketJsDemo} */ (
|
|
185
|
+
await fixture(html`
|
|
186
|
+
<rocket-js-demo demo-name=${demoName} ?single-demo=${singleDemo}>
|
|
187
|
+
<rocket-code-block
|
|
188
|
+
language="js"
|
|
189
|
+
encoded-code="Y29uc3QgZGVtbyA9IHRydWU7"
|
|
190
|
+
></rocket-code-block>
|
|
191
|
+
</rocket-js-demo>
|
|
192
|
+
`)
|
|
193
|
+
);
|
|
194
|
+
element.demo = () => html`<p>Rendered ${demoName}</p>`;
|
|
195
|
+
await element.updateComplete;
|
|
196
|
+
return element;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @param {Element} element
|
|
201
|
+
*/
|
|
202
|
+
function shadowRootFor(element) {
|
|
203
|
+
assert.ok(element.shadowRoot, 'Expected a shadow root');
|
|
204
|
+
return /** @type {ShadowRoot} */ (element.shadowRoot);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @param {ShadowRoot} root
|
|
209
|
+
* @param {string} selector
|
|
210
|
+
*/
|
|
211
|
+
function buttonFor(root, selector) {
|
|
212
|
+
const button = root.querySelector(selector);
|
|
213
|
+
assert.ok(button instanceof HTMLElement, `Expected ${selector} button`);
|
|
214
|
+
return button;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @param {HTMLElement} summary
|
|
219
|
+
*/
|
|
220
|
+
function assertSourceDisclosureArrow(summary) {
|
|
221
|
+
const arrow = getComputedStyle(summary, '::after');
|
|
222
|
+
|
|
223
|
+
assert.equal(arrow.borderTopWidth, '0px');
|
|
224
|
+
assert.equal(arrow.borderLeftWidth, '0px');
|
|
225
|
+
assert.equal(arrow.borderRightStyle, 'solid');
|
|
226
|
+
assert.equal(arrow.borderBottomStyle, 'solid');
|
|
227
|
+
assert.notEqual(arrow.transform, 'none');
|
|
228
|
+
}
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
/** Runs on: client */
|
|
2
|
+
import { LitElement, css, html } from 'lit';
|
|
3
|
+
import '@awesome.me/webawesome/dist/components/button/button.js';
|
|
4
|
+
import '@awesome.me/webawesome/dist/components/icon/icon.js';
|
|
5
|
+
|
|
6
|
+
/** @type {Record<string, string>} */
|
|
7
|
+
const copyButtonLabels = {
|
|
8
|
+
copy: 'Copy request path',
|
|
9
|
+
success: 'Copied request path',
|
|
10
|
+
error: 'Unable to copy request path',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const DEFAULT_REQUEST_DEMO_HEIGHT = 240;
|
|
14
|
+
const MIN_REQUEST_DEMO_HEIGHT = 120;
|
|
15
|
+
|
|
16
|
+
export class RocketRequestDemo extends LitElement {
|
|
17
|
+
static properties = {
|
|
18
|
+
url: { type: String },
|
|
19
|
+
label: { type: String },
|
|
20
|
+
height: { type: String },
|
|
21
|
+
_copyState: { type: String, state: true },
|
|
22
|
+
_responseHeight: { type: Number, state: true },
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
this.url = '';
|
|
28
|
+
this.label = '';
|
|
29
|
+
this.height = '';
|
|
30
|
+
this._copyState = 'copy';
|
|
31
|
+
/** @type {number | undefined} */
|
|
32
|
+
this._responseHeight = undefined;
|
|
33
|
+
this.copyStateResetDelay = 2000;
|
|
34
|
+
/** @type {ReturnType<typeof setTimeout> | undefined} */
|
|
35
|
+
this.copyStateResetTimeout = undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {Map<PropertyKey, unknown>} changedProperties
|
|
40
|
+
*/
|
|
41
|
+
willUpdate(changedProperties) {
|
|
42
|
+
if (changedProperties.has('height')) {
|
|
43
|
+
this._responseHeight = undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
disconnectedCallback() {
|
|
48
|
+
super.disconnectedCallback();
|
|
49
|
+
this.clearCopyStateResetTimeout();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
get requestPath() {
|
|
53
|
+
return this.url || '';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get frameHeight() {
|
|
57
|
+
return this.height && /^[1-9]\d*$/.test(this.height)
|
|
58
|
+
? Number(this.height)
|
|
59
|
+
: DEFAULT_REQUEST_DEMO_HEIGHT;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get responseHeight() {
|
|
63
|
+
return this._responseHeight ?? this.frameHeight;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
openRequest() {
|
|
67
|
+
if (!this.requestPath) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
window.open(this.requestPath, '_blank', 'noopener,noreferrer');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async copyRequestPath() {
|
|
75
|
+
if (!this.requestPath) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
this.clearCopyStateResetTimeout();
|
|
80
|
+
try {
|
|
81
|
+
await navigator.clipboard.writeText(this.requestPath);
|
|
82
|
+
this._copyState = 'success';
|
|
83
|
+
} catch {
|
|
84
|
+
this._copyState = 'error';
|
|
85
|
+
}
|
|
86
|
+
this.scheduleCopyStateReset();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param {PointerEvent} ev
|
|
91
|
+
*/
|
|
92
|
+
handleResizePointerDown(ev) {
|
|
93
|
+
const iframe = this.renderRoot.querySelector('iframe');
|
|
94
|
+
if (!(iframe instanceof HTMLIFrameElement)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const target = /** @type {HTMLElement} */ (ev.currentTarget);
|
|
98
|
+
const startY = ev.clientY;
|
|
99
|
+
const startHeight = iframe.getBoundingClientRect().height || this.responseHeight;
|
|
100
|
+
|
|
101
|
+
ev.preventDefault();
|
|
102
|
+
target.setPointerCapture(ev.pointerId);
|
|
103
|
+
const pointerMoveHandler = (/** @type {PointerEvent} */ ev) => {
|
|
104
|
+
const diff = ev.clientY - startY;
|
|
105
|
+
this.setResponseHeight(startHeight + diff);
|
|
106
|
+
};
|
|
107
|
+
const pointerUpHandler = (/** @type {PointerEvent} */ ev) => {
|
|
108
|
+
target.releasePointerCapture(ev.pointerId);
|
|
109
|
+
target.removeEventListener('pointermove', pointerMoveHandler);
|
|
110
|
+
target.removeEventListener('pointerup', pointerUpHandler);
|
|
111
|
+
target.removeEventListener('pointercancel', pointerUpHandler);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
target.addEventListener('pointermove', pointerMoveHandler);
|
|
115
|
+
target.addEventListener('pointerup', pointerUpHandler);
|
|
116
|
+
target.addEventListener('pointercancel', pointerUpHandler);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @param {KeyboardEvent} ev
|
|
121
|
+
*/
|
|
122
|
+
handleResizeKeyDown(ev) {
|
|
123
|
+
const step = ev.shiftKey ? 64 : 16;
|
|
124
|
+
if (ev.key === 'ArrowUp') {
|
|
125
|
+
ev.preventDefault();
|
|
126
|
+
this.setResponseHeight(this.responseHeight - step);
|
|
127
|
+
} else if (ev.key === 'ArrowDown') {
|
|
128
|
+
ev.preventDefault();
|
|
129
|
+
this.setResponseHeight(this.responseHeight + step);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @param {number} height
|
|
135
|
+
*/
|
|
136
|
+
setResponseHeight(height) {
|
|
137
|
+
this._responseHeight = Math.max(MIN_REQUEST_DEMO_HEIGHT, Math.round(height));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
scheduleCopyStateReset() {
|
|
141
|
+
this.copyStateResetTimeout = setTimeout(() => {
|
|
142
|
+
this.copyStateResetTimeout = undefined;
|
|
143
|
+
this._copyState = 'copy';
|
|
144
|
+
}, this.copyStateResetDelay);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
clearCopyStateResetTimeout() {
|
|
148
|
+
if (this.copyStateResetTimeout !== undefined) {
|
|
149
|
+
clearTimeout(this.copyStateResetTimeout);
|
|
150
|
+
this.copyStateResetTimeout = undefined;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
render() {
|
|
155
|
+
const copyLabel = copyButtonLabels[this._copyState] || copyButtonLabels.copy;
|
|
156
|
+
const copyIconName =
|
|
157
|
+
this._copyState === 'success' ? 'check' : this._copyState === 'error' ? 'xmark' : 'copy';
|
|
158
|
+
const copyIconVariant = this._copyState === 'copy' ? 'regular' : 'solid';
|
|
159
|
+
|
|
160
|
+
return html`
|
|
161
|
+
<figure id="frame" part="frame" class="rocket-request-demo-frame">
|
|
162
|
+
<figcaption id="header" part="header">
|
|
163
|
+
<span id="request" part="request">
|
|
164
|
+
<span>GET</span>
|
|
165
|
+
<code>${this.requestPath}</code>
|
|
166
|
+
</span>
|
|
167
|
+
</figcaption>
|
|
168
|
+
<div id="response" part="response">
|
|
169
|
+
<iframe
|
|
170
|
+
part="iframe"
|
|
171
|
+
src=${this.requestPath}
|
|
172
|
+
loading="lazy"
|
|
173
|
+
title=${`Request Demo response for ${this.requestPath}`}
|
|
174
|
+
style=${`height: ${this.responseHeight}px`}
|
|
175
|
+
></iframe>
|
|
176
|
+
<button
|
|
177
|
+
id="resize-request-demo"
|
|
178
|
+
part="resize-handle"
|
|
179
|
+
type="button"
|
|
180
|
+
aria-label="Resize Request Demo response height"
|
|
181
|
+
title="Resize Request Demo response height"
|
|
182
|
+
@pointerdown=${(/** @type {PointerEvent} */ ev) => this.handleResizePointerDown(ev)}
|
|
183
|
+
@keydown=${(/** @type {KeyboardEvent} */ ev) => this.handleResizeKeyDown(ev)}
|
|
184
|
+
>
|
|
185
|
+
<wa-icon name="grip-lines" variant="solid" aria-hidden="true"></wa-icon>
|
|
186
|
+
</button>
|
|
187
|
+
</div>
|
|
188
|
+
<div id="source-row" part="source-row">
|
|
189
|
+
<details id="source" part="source">
|
|
190
|
+
<summary>Source</summary>
|
|
191
|
+
<slot></slot>
|
|
192
|
+
</details>
|
|
193
|
+
<div id="request-actions" part="actions" aria-label="Request path actions">
|
|
194
|
+
<wa-button
|
|
195
|
+
id="open-request-demo"
|
|
196
|
+
part="open-button"
|
|
197
|
+
appearance="plain"
|
|
198
|
+
title="Open Request"
|
|
199
|
+
aria-label="Open Request"
|
|
200
|
+
@click=${() => this.openRequest()}
|
|
201
|
+
>
|
|
202
|
+
<wa-icon name="arrow-up-right-from-square" variant="solid"></wa-icon>
|
|
203
|
+
</wa-button>
|
|
204
|
+
<wa-button
|
|
205
|
+
id="copy-request-demo"
|
|
206
|
+
part="copy-button"
|
|
207
|
+
appearance="plain"
|
|
208
|
+
title=${copyLabel}
|
|
209
|
+
aria-label=${copyLabel}
|
|
210
|
+
@click=${() => this.copyRequestPath()}
|
|
211
|
+
>
|
|
212
|
+
<wa-icon name=${copyIconName} variant=${copyIconVariant}></wa-icon>
|
|
213
|
+
</wa-button>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
</figure>
|
|
217
|
+
`;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
static styles = [
|
|
221
|
+
css`
|
|
222
|
+
:host {
|
|
223
|
+
display: block;
|
|
224
|
+
box-sizing: border-box;
|
|
225
|
+
--request-action-size: 2.75rem;
|
|
226
|
+
--request-actions-width: calc(var(--request-action-size) * 2);
|
|
227
|
+
--border-color: var(--rocket-request-demo-border, #dbe3ec);
|
|
228
|
+
--border: 1px solid var(--border-color);
|
|
229
|
+
--border-radius: var(--rocket-request-demo-radius, 8px);
|
|
230
|
+
--frame-header: var(--rocket-request-demo-header, #f8fafc);
|
|
231
|
+
--frame-muted: var(--rocket-request-demo-muted, #57606a);
|
|
232
|
+
--frame-text: var(--rocket-request-demo-text, #24292f);
|
|
233
|
+
margin: var(--rocket-request-demo-margin, 1.3rem 0);
|
|
234
|
+
overflow: hidden;
|
|
235
|
+
border: var(--border);
|
|
236
|
+
border-radius: var(--border-radius);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
*,
|
|
240
|
+
*::before,
|
|
241
|
+
*::after {
|
|
242
|
+
box-sizing: inherit;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
#frame {
|
|
246
|
+
margin: 0;
|
|
247
|
+
background: white;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
#header {
|
|
251
|
+
display: flex;
|
|
252
|
+
min-block-size: 2.75rem;
|
|
253
|
+
align-items: center;
|
|
254
|
+
border-bottom: var(--border);
|
|
255
|
+
background: var(--frame-header);
|
|
256
|
+
color: var(--frame-text);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
#request {
|
|
260
|
+
display: inline-flex;
|
|
261
|
+
min-inline-size: 0;
|
|
262
|
+
flex: 1 1 auto;
|
|
263
|
+
align-items: center;
|
|
264
|
+
gap: 0.45rem;
|
|
265
|
+
color: var(--frame-muted);
|
|
266
|
+
font-size: 0.875rem;
|
|
267
|
+
padding: 0.5rem 0.85rem;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
#request > span {
|
|
271
|
+
font-weight: 700;
|
|
272
|
+
letter-spacing: 0;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
#request code {
|
|
276
|
+
display: inline;
|
|
277
|
+
overflow-wrap: anywhere;
|
|
278
|
+
border: 0;
|
|
279
|
+
border-radius: 0;
|
|
280
|
+
background: transparent;
|
|
281
|
+
color: inherit;
|
|
282
|
+
font-family: 'Fira Code', Consolas, monospace;
|
|
283
|
+
font-size: 1em;
|
|
284
|
+
line-height: inherit;
|
|
285
|
+
padding: 0;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
#response {
|
|
289
|
+
position: relative;
|
|
290
|
+
background: white;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
iframe {
|
|
294
|
+
display: block;
|
|
295
|
+
box-sizing: border-box;
|
|
296
|
+
inline-size: 100%;
|
|
297
|
+
border: 0;
|
|
298
|
+
background: white;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
#resize-request-demo {
|
|
302
|
+
appearance: none;
|
|
303
|
+
-webkit-appearance: none;
|
|
304
|
+
display: grid;
|
|
305
|
+
block-size: 0.95rem;
|
|
306
|
+
inline-size: 100%;
|
|
307
|
+
min-block-size: 0;
|
|
308
|
+
min-height: 0;
|
|
309
|
+
place-items: center;
|
|
310
|
+
border: 0;
|
|
311
|
+
border-block: var(--border);
|
|
312
|
+
border-radius: 0;
|
|
313
|
+
background: white;
|
|
314
|
+
color: var(--frame-muted);
|
|
315
|
+
cursor: ns-resize;
|
|
316
|
+
font: inherit;
|
|
317
|
+
line-height: 1;
|
|
318
|
+
padding: 0;
|
|
319
|
+
touch-action: none;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
#resize-request-demo wa-icon {
|
|
323
|
+
block-size: 0.72rem;
|
|
324
|
+
inline-size: 0.72rem;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
#source-row {
|
|
328
|
+
position: relative;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
#source {
|
|
332
|
+
display: block;
|
|
333
|
+
min-inline-size: 0;
|
|
334
|
+
margin: 0;
|
|
335
|
+
padding: 0;
|
|
336
|
+
border: 0;
|
|
337
|
+
border-radius: 0;
|
|
338
|
+
background: transparent;
|
|
339
|
+
color: inherit;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
#source summary {
|
|
343
|
+
display: flex;
|
|
344
|
+
min-block-size: var(--request-action-size);
|
|
345
|
+
align-items: center;
|
|
346
|
+
justify-content: center;
|
|
347
|
+
gap: 0.4rem;
|
|
348
|
+
box-sizing: border-box;
|
|
349
|
+
cursor: pointer;
|
|
350
|
+
color: var(--frame-muted);
|
|
351
|
+
font-size: 0.875rem;
|
|
352
|
+
font-weight: 600;
|
|
353
|
+
line-height: 1.2;
|
|
354
|
+
list-style: none;
|
|
355
|
+
padding-block: 0;
|
|
356
|
+
padding-inline: var(--request-actions-width);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
#source summary::marker {
|
|
360
|
+
content: '';
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
#source summary::-webkit-details-marker {
|
|
364
|
+
display: none;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
#source summary::after {
|
|
368
|
+
content: '';
|
|
369
|
+
display: inline-block;
|
|
370
|
+
flex: 0 0 auto;
|
|
371
|
+
box-sizing: border-box;
|
|
372
|
+
inline-size: 0.52rem;
|
|
373
|
+
block-size: 0.52rem;
|
|
374
|
+
border: solid currentColor;
|
|
375
|
+
border-width: 0 2px 2px 0;
|
|
376
|
+
transform: rotate(-45deg);
|
|
377
|
+
transform-origin: center;
|
|
378
|
+
transition: transform 120ms ease-in-out;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
#source[open] summary {
|
|
382
|
+
border-bottom: var(--border);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
#source[open] summary::after {
|
|
386
|
+
transform: rotate(45deg);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
#request-actions {
|
|
390
|
+
position: absolute;
|
|
391
|
+
inset-block-start: 0;
|
|
392
|
+
inset-inline-end: 0;
|
|
393
|
+
display: flex;
|
|
394
|
+
align-items: stretch;
|
|
395
|
+
block-size: var(--request-action-size);
|
|
396
|
+
border-left: var(--border);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
#open-request-demo,
|
|
400
|
+
#copy-request-demo {
|
|
401
|
+
inline-size: var(--request-action-size);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
#open-request-demo::part(base),
|
|
405
|
+
#copy-request-demo::part(base) {
|
|
406
|
+
display: inline-grid;
|
|
407
|
+
inline-size: 100%;
|
|
408
|
+
min-block-size: var(--request-action-size);
|
|
409
|
+
place-items: center;
|
|
410
|
+
border: none;
|
|
411
|
+
border-radius: 0;
|
|
412
|
+
padding: 0;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
#copy-request-demo::part(base) {
|
|
416
|
+
border-left: var(--border);
|
|
417
|
+
border-radius: 0;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
::slotted(pre) {
|
|
421
|
+
font-size: 0.9rem;
|
|
422
|
+
border-radius: 0;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
::slotted(rocket-code-block) {
|
|
426
|
+
--rocket-code-border-radius: 0 0 calc(var(--border-radius) - 1px)
|
|
427
|
+
calc(var(--border-radius) - 1px);
|
|
428
|
+
--rocket-code-frame-border: none;
|
|
429
|
+
--rocket-code-margin: 0;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
@media (prefers-reduced-motion: reduce) {
|
|
433
|
+
#source summary::after {
|
|
434
|
+
transition: none;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
`,
|
|
438
|
+
];
|
|
439
|
+
}
|