Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: QwikDev/qwik
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.5.4
Choose a base ref
...
head repository: QwikDev/qwik
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.5.5
Choose a head ref

Commits on May 7, 2024

  1. Copy the full SHA
    2267f47 View commit details

Commits on May 8, 2024

  1. docs: Update caching index.mdx verbiage and phrasing (#6280)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    Jemsco and PatrickJS authored May 8, 2024
    Copy the full SHA
    ab9fcc6 View commit details
  2. docs: Update html-attributes index.mdx verbiage and phrasing (#6282)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    Jemsco and PatrickJS authored May 8, 2024
    Copy the full SHA
    c463462 View commit details
  3. docs: Update integrations index.mdx (#6283)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    Jemsco and PatrickJS authored May 8, 2024
    Copy the full SHA
    7711fdb View commit details
  4. docs: Update bootstrap index.mdx verbiage and phrasing (#6284)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    Jemsco and PatrickJS authored May 8, 2024
    Copy the full SHA
    efdbeee View commit details
  5. docs: Update i18n index.mdx verbiage and phrasing (#6285)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    Jemsco and PatrickJS authored May 8, 2024
    Copy the full SHA
    5e76e42 View commit details

Commits on May 9, 2024

  1. docs(routes / typed-routes): add Declarative Routing (#6287)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    RumNCodeDev and PatrickJS authored May 9, 2024
    Copy the full SHA
    a418b91 View commit details
  2. chore: fix Test Typo (#6289)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    ToanTrinh01 and PatrickJS authored May 9, 2024
    Copy the full SHA
    79716fc View commit details

Commits on May 10, 2024

  1. Copy the full SHA
    f2aecea View commit details
  2. feat(qwikloader): emit error (#6254)

    * feat(qwikloader): 
    
    fixes #3716
    
    * Update qwikloader.ts
    
    * Update qwikloader.ts
    
    * Update qwikloader.ts
    
    * style: lint
    
    * feat(qwikloader): importError
    PatrickJS authored May 10, 2024
    Copy the full SHA
    cab4ae3 View commit details
  3. docs(polymorphism): changed hi to slot (#6294)

    * docs(polymorphism): changed hi to slot
    
    The examples were wrong, because <Slot/> was missing
    
    * updated indentation and wrapped examples in component$
    
    ---------
    
    Co-authored-by: Tobias Zimmermann <ich@tzdesign.de>
    tzdesign and Tobias Zimmermann authored May 10, 2024
    Copy the full SHA
    de50926 View commit details
  4. feat(Form): multi onSubmit$ handlers (#6241)

    * feat(Form): multi onSubmit$
    
    * style(Form): fmt
    
    * chore: api.update
    
    * fix: multiple onSubmit
    
    * feat(Form): "submitcompleted" event for action forms
    
    * style(Form): comments
    
    * revert: submitcompleted fires in action.submit
    
    * Revert "fix: multiple onSubmit"
    
    This reverts commit f60741d.
    
    * refactor(Form): array onSubmit new API
    
    * style: lint
    
    * chore(Form): api.update
    
    * refactor(Form): isArray once
    
    * feat(action): submitted
    
    * fix: test
    
    * chore: update tests
    
    * chore: correct test
    
    * test: fix spa only tests
    
    * chore: fix types
    
    * fix: submitted
    
    * Update index.tsx
    PatrickJS authored May 10, 2024
    Copy the full SHA
    ac6ea5c View commit details
  5. Copy the full SHA
    a2fb6e3 View commit details
  6. Copy the full SHA
    434737e View commit details
  7. Copy the full SHA
    23c04d2 View commit details
  8. docs(sync$): adding note pointing to preventDefault docs (#6296)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    RumNCodeDev and PatrickJS authored May 10, 2024
    Copy the full SHA
    41ce1d8 View commit details
  9. Copy the full SHA
    61605ec View commit details
  10. feat: When closing over values in server$ the values should be mark…

    …ed as readonly (#5238)
    
    Co-authored-by: wajihaNiazi <waijehaniazi204@gmail.com>
    Co-authored-by: Phu Nguyen <51897872+phunguyenmurcul@users.noreply.github.com>
    Co-authored-by: Hameed Abdulrahaman <hameedabdulrahamann@gmail.com>
    Co-authored-by: PatrickJS <github@patrickjs.com>
    Co-authored-by: PatrickJS <github@gdi2290.com>
    6 people authored May 10, 2024
    Copy the full SHA
    b8bdc31 View commit details

Commits on May 11, 2024

  1. Copy the full SHA
    e9012d1 View commit details

Commits on May 12, 2024

  1. docs: show selected path if block scroll in view (#6079)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    RaiVaibhav and PatrickJS authored May 12, 2024
    Copy the full SHA
    80ea7cf View commit details
  2. docs(CONTRIBUTING): spelling fix (#6299)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    MVAodhan and PatrickJS authored May 12, 2024
    Copy the full SHA
    6fcee57 View commit details

Commits on May 13, 2024

  1. fix: SSG ignoring the index page when trailingSlash is false (#6304)

    ---------
    
    Co-authored-by: wuls <linsheng.wu@beantechs.com>
    JerryWu1234 and wuls authored May 13, 2024
    Copy the full SHA
    dde6644 View commit details
  2. docs(qwik-nutshell): more code examples for isServer (#6306)

    Co-authored-by: Jack Shelton <104264123+thejackshelton@users.noreply.github.com>
    PatrickJS and thejackshelton authored May 13, 2024
    Copy the full SHA
    7627cf5 View commit details
  3. docs: Document exposing gtag for custom events in Qwik Partytown setup (

    #6303)
    
    Expose gtag for custom events in Qwik Partytown setup
    
    This update enhances the Qwik application's integration with Google Analytics via Partytown by ensuring the `gtag` function is exposed for use in components, enabling the sending of custom events directly from the component level.
    
    Key changes:
    1. Updated the Partytown script configuration to expose `gtag` globally, allowing for direct invocation in component logic.
    2. Added the complete Google Analytics integration script as recommended by Google, ensuring comprehensive tracking capabilities.
    3. Documented this integration pattern to assist others in setting up Google Analytics with Partytown in Qwik applications, addressing a common challenge found during implementation.
    itssajan authored May 13, 2024
    Copy the full SHA
    bb8b7a9 View commit details

Commits on May 14, 2024

  1. fix(bun): Rewrite TextEncoderStream polyfill implementation for Bun m…

    …iddleware (#6309)
    
    Co-authored-by: PatrickJS <github@gdi2290.com>
    Co-authored-by: PatrickJS <github@patrickjs.com>
    3 people authored May 14, 2024
    Copy the full SHA
    45ba302 View commit details
  2. Copy the full SHA
    f511f86 View commit details
  3. docs: Grammar correction and rewording (#6312)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    codyroberts and PatrickJS authored May 14, 2024
    Copy the full SHA
    b3e4bf4 View commit details

Commits on May 15, 2024

  1. Copy the full SHA
    7bd3bcc View commit details
  2. Copy the full SHA
    b381b22 View commit details
  3. feat(PrefetchServiceWorker): add nonce (#6316)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    DustinJSilk and PatrickJS authored May 15, 2024
    Copy the full SHA
    d107f23 View commit details
  4. Copy the full SHA
    96e1863 View commit details
  5. Copy the full SHA
    fe3a00e View commit details

Commits on May 16, 2024

  1. Copy the full SHA
    3b862ef View commit details
  2. Copy the full SHA
    d79b934 View commit details

Commits on May 17, 2024

  1. chore(TextEncoderStream): better polyfill tests (#6310)

    Co-authored-by: Nick K. <me@octetstream.dev>
    PatrickJS and octet-stream authored May 17, 2024
    Copy the full SHA
    a2f3739 View commit details
  2. docs: alternative cookie delete (#6331)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    Twiggeh and PatrickJS authored May 17, 2024
    Copy the full SHA
    53fe36d View commit details

Commits on May 18, 2024

  1. feat(starters): error if qwik packages aren't together (#6332)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    ToanTrinh01 and PatrickJS authored May 18, 2024
    Copy the full SHA
    a76b6e8 View commit details
  2. Copy the full SHA
    3a90bb6 View commit details
  3. Copy the full SHA
    8ba9973 View commit details

Commits on May 19, 2024

  1. fix(qwik-city): Removed limiter from recursive path matching (#6327)

    Co-authored-by: gnemanja <nemanjag@thevtool.com>
    gnemanja and nemanjagVtool authored May 19, 2024
    Copy the full SHA
    7708f71 View commit details

Commits on May 20, 2024

  1. Copy the full SHA
    d78c13a View commit details
  2. fix(image-size-runtime.html): exclude SVG images from Perf: properly … (

    #6318)
    
    fix(image-size-runtime.html): exclude SVG images from Perf: properly size image warnings
    
    SVG is a vector format. Attributes like width, height & viewbox are not relevant to the size in
    bytes of the image, so the Perf: properly size image warning is incorrect.
    williamsdyyz authored May 20, 2024
    Copy the full SHA
    a738299 View commit details
  3. Copy the full SHA
    37f0dba View commit details
  4. fix(qwik-city): 404 resources for less bandwidth (#6341)

    Co-authored-by: PatrickJS <github@patrickjs.com>
    okikio and PatrickJS authored May 20, 2024
    Copy the full SHA
    a6a8525 View commit details
  5. Copy the full SHA
    0380331 View commit details

Commits on May 21, 2024

  1. Copy the full SHA
    f38f153 View commit details
  2. Copy the full SHA
    86dcf1d View commit details
  3. chore: v1.5.5 (#6349)

    chore: 1.5.5
    wmertens authored May 21, 2024
    Copy the full SHA
    6d4a549 View commit details
  4. Copy the full SHA
    0b8410b View commit details
Showing with 1,827 additions and 322 deletions.
  1. +7 −1 CONTRIBUTING.md
  2. +2 −2 package.json
  3. +1 −1 packages/create-qwik/package.json
  4. +4 −0 packages/docs/scripts/pages.json
  5. +30 −4 packages/docs/src/components/code-block/code-block.tsx
  6. +64 −0 packages/docs/src/components/copy-code/copy-code-block.tsx
  7. +14 −0 packages/docs/src/components/copy-code/copy-code.css
  8. +23 −0 packages/docs/src/components/svgs/copy-code-icon.tsx
  9. +54 −18 packages/docs/src/repl/repl-output-modules.tsx
  10. +3 −2 packages/docs/src/repl/repl-output-panel.tsx
  11. +54 −17 packages/docs/src/repl/repl-output-symbols.tsx
  12. +15 −2 packages/docs/src/repl/repl.css
  13. +4 −0 packages/docs/src/repl/types.ts
  14. +66 −1 packages/docs/src/routes/api/qwik-city-middleware-request-handler/api.json
  15. +167 −0 packages/docs/src/routes/api/qwik-city-middleware-request-handler/index.md
  16. +5 −5 packages/docs/src/routes/api/qwik-city/api.json
  17. +22 −4 packages/docs/src/routes/api/qwik-city/index.md
  18. +2 −2 packages/docs/src/routes/api/qwik/api.json
  19. +6 −4 packages/docs/src/routes/api/qwik/index.md
  20. +25 −15 packages/docs/src/routes/docs/(qwik)/components/overview/index.mdx
  21. +2 −0 packages/docs/src/routes/docs/(qwik)/components/state/index.mdx
  22. +2 −4 packages/docs/src/routes/docs/(qwikcity)/action/index.mdx
  23. +2 −0 packages/docs/src/routes/docs/(qwikcity)/advanced/request-handling/index.mdx
  24. +25 −6 packages/docs/src/routes/docs/(qwikcity)/api/index.mdx
  25. +7 −6 packages/docs/src/routes/docs/(qwikcity)/caching/index.mdx
  26. +24 −3 packages/docs/src/routes/docs/(qwikcity)/guides/qwik-nutshell/index.mdx
  27. +3 −4 packages/docs/src/routes/docs/(qwikcity)/html-attributes/index.mdx
  28. +5 −0 packages/docs/src/routes/docs/(qwikcity)/routing/index.mdx
  29. +21 −9 packages/docs/src/routes/docs/(qwikcity)/server$/index.mdx
  30. +1 −1 packages/docs/src/routes/docs/cookbook/algolia-search/index.mdx
  31. +1 −1 packages/docs/src/routes/docs/cookbook/portals/index.mdx
  32. +2 −0 packages/docs/src/routes/docs/cookbook/sync-events/index.mdx
  33. +4 −3 packages/docs/src/routes/docs/integrations/bootstrap/index.mdx
  34. +3 −3 packages/docs/src/routes/docs/integrations/i18n/index.mdx
  35. +2 −1 packages/docs/src/routes/docs/integrations/index.mdx
  36. +12 −1 packages/docs/src/routes/docs/integrations/partytown/index.mdx
  37. +99 −2 packages/docs/src/routes/docs/labs/typed-routes/index.mdx
  38. +1 −1 packages/eslint-plugin-qwik/package.json
  39. +1 −1 packages/insights/src/db/query.ts
  40. +1 −0 packages/insights/src/routes/plugin@auth.ts
  41. +17 −5 packages/qwik-city/buildtime/context.ts
  42. +8 −1 packages/qwik-city/middleware/azure-swa/index.ts
  43. +11 −39 packages/qwik-city/middleware/bun/index.ts
  44. +10 −38 packages/qwik-city/middleware/cloudflare-pages/index.ts
  45. +7 −1 packages/qwik-city/middleware/deno/index.ts
  46. +7 −1 packages/qwik-city/middleware/netlify-edge/index.ts
  47. +35 −13 packages/qwik-city/middleware/node/http.ts
  48. +9 −3 packages/qwik-city/middleware/node/index.ts
  49. +1 −0 packages/qwik-city/middleware/node/node-fetch.ts
  50. +22 −0 packages/qwik-city/middleware/request-handler/api.md
  51. +20 −0 packages/qwik-city/middleware/request-handler/cookie.ts
  52. +81 −0 packages/qwik-city/middleware/request-handler/cookie.unit.ts
  53. +10 −0 packages/qwik-city/middleware/request-handler/error-handler.ts
  54. +4 −0 packages/qwik-city/middleware/request-handler/generated/not-found-paths.ts
  55. +19 −0 packages/qwik-city/middleware/request-handler/generated/static-paths.ts
  56. +2 −1 packages/qwik-city/middleware/request-handler/index.ts
  57. +75 −0 packages/qwik-city/middleware/request-handler/polyfill.ts
  58. +116 −0 packages/qwik-city/middleware/request-handler/polyfill.unit.ts
  59. +13 −2 packages/qwik-city/middleware/request-handler/request-event.ts
  60. +9 −1 packages/qwik-city/middleware/request-handler/resolve-request-handlers.ts
  61. +8 −0 packages/qwik-city/middleware/request-handler/types.ts
  62. +7 −1 packages/qwik-city/middleware/vercel-edge/index.ts
  63. +1 −1 packages/qwik-city/package.json
  64. +11 −6 packages/qwik-city/runtime/src/api.md
  65. +2 −0 packages/qwik-city/runtime/src/constants.ts
  66. +56 −19 packages/qwik-city/runtime/src/form-component.tsx
  67. +6 −0 packages/qwik-city/runtime/src/qwik-city-component.tsx
  68. +6 −3 packages/qwik-city/runtime/src/route-matcher.ts
  69. +6 −0 packages/qwik-city/runtime/src/route-matcher.unit.ts
  70. +58 −9 packages/qwik-city/runtime/src/server-functions.ts
  71. +20 −1 packages/qwik-city/runtime/src/types.ts
  72. +3 −1 packages/qwik-city/utils/fs.ts
  73. +1 −1 packages/qwik/package.json
  74. +2 −0 packages/qwik/src/core/api.md
  75. +6 −3 packages/qwik/src/core/components/prefetch.ts
  76. +27 −2 packages/qwik/src/core/components/prefetch.unit.tsx
  77. +1 −1 packages/qwik/src/core/container/container.ts
  78. +5 −5 packages/qwik/src/optimizer/src/platform.ts
  79. +1 −1 packages/qwik/src/optimizer/src/plugins/image-size-runtime.html
  80. +6 −0 packages/qwik/src/optimizer/src/plugins/plugin.unit.ts
  81. +12 −2 packages/qwik/src/optimizer/src/plugins/vite.ts
  82. +57 −25 packages/qwik/src/qwikloader.ts
  83. +1 −1 packages/qwik/src/server/utils.ts
  84. +2 −0 starters/adapters/aws-lambda/src/entry_aws-lambda.tsx
  85. +5 −0 starters/adapters/bun/adapters/bun/vite.config.ts
  86. +5 −0 starters/adapters/cloudflare-pages/public/_headers
  87. +9 −0 starters/adapters/vercel-edge/vercel.json
  88. +15 −1 starters/apps/base/vite.config.ts
  89. +14 −2 starters/apps/qwikcity-test/src/components/router-head/router-head.tsx
  90. +50 −0 starters/apps/qwikcity-test/src/routes/(common)/actions/multiple-handlers/index.tsx
  91. +60 −0 starters/apps/qwikcity-test/src/routes/(common)/server-func/server-configs/index.tsx
  92. +45 −0 starters/apps/qwikcity-test/src/routes/(common)/server-func/server-error/index.tsx
  93. +1 −1 starters/dev-server.ts
  94. +18 −4 starters/e2e/qwikcity/actions.spec.ts
  95. +19 −0 starters/e2e/qwikcity/adapter.spec.ts
  96. +17 −1 starters/e2e/qwikcity/server.spec.ts
  97. +2 −2 starters/features/localize/src/routes/[locale]/i18n-utils.ts
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -71,6 +71,12 @@ If you want to use Docker:
- Install the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension in your VSCode.
- Once installed you will be prompted to 'Reopen the folder to develop in a container [learn more](https://code.visualstudio.com/docs/devcontainers/containers) or Clone repository in Docker volume for [better I/O performance](https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume)'. If you're not prompted, you can run the `Dev Containers: Open Folder in Container` command from the [VSCode Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette).

Alternatively you can use [devcontainers/cli](https://github.com/devcontainers/cli):

- Install devcontainers following their documentation.
- In your terminal navigate to the Qwik's project root directory.
- Then run `devcontainer up --workspace-folder .`. This command will start a Docker container with all required environment dependencies.

If you want to use Nix:

- Install [Nix](https://nixos.org/download.html) on your machine and enable flakes. The [DetSys installer](https://github.com/DeterminateSystems/nix-installer) makes that easy.
@@ -303,7 +309,7 @@ To update all dependencies, run:
pnpm deps
```

This will show an interactive UI to update all dependencies. Be careful about performing major updates, especially for the docs site, since not all functionalitty has test coverage there.
This will show an interactive UI to update all dependencies. Be careful about performing major updates, especially for the docs site, since not all functionality has test coverage there.

## Starter CLI `create-qwik`

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qwik-monorepo",
"version": "1.5.4",
"version": "1.5.5",
"comments": {
"01": "devDependencies includes reference to @builder.io/qwik: workspace: *. This is needed or e2e tests will fail",
"02": " It would be nice to be able to remove this dependency and fix the test.",
@@ -136,7 +136,7 @@
"node": ">=16.8.0 <18.0.0 || >=18.11",
"npm": "please-use-pnpm",
"yarn": "please-use-pnpm",
"pnpm": ">=8.6.12"
"pnpm": ">=9.0.5"
},
"packageManager": "pnpm@9.0.5",
"pnpm": {
2 changes: 1 addition & 1 deletion packages/create-qwik/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "create-qwik",
"description": "Interactive CLI for create Qwik projects and adding features.",
"version": "1.5.4",
"version": "1.5.5",
"author": "Builder.io Team",
"bin": "./create-qwik.cjs",
"bugs": "https://github.com/QwikDev/qwik/issues",
4 changes: 4 additions & 0 deletions packages/docs/scripts/pages.json
Original file line number Diff line number Diff line change
@@ -187,5 +187,9 @@
{
"href": "https://numeia.com",
"tags": "saas, marketing, ai"
},
{
"href": "https://qit.tools/",
"tags": "online,tools,converters"
}
]
34 changes: 30 additions & 4 deletions packages/docs/src/components/code-block/code-block.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { component$, useStyles$ } from '@builder.io/qwik';
import { component$, useStyles$, type QRL, useVisibleTask$, useSignal } from '@builder.io/qwik';
import prismjs from 'prismjs';
// Set to global so that prism language plugins can find it.
const _global =
@@ -12,14 +12,37 @@ import 'prismjs/components/prism-jsx'; // needs PRISM global
import 'prismjs/components/prism-tsx'; // needs PRISM global

import styles from './code-block.css?inline';
import { CopyCode } from '../copy-code/copy-code-block';
interface CodeBlockProps {
path?: string;
language?: 'markup' | 'css' | 'javascript' | 'json' | 'jsx' | 'tsx';
code: string;
pathInView$?: QRL<(name: string) => void>;
observerRootId?: string;
}

export const CodeBlock = component$((props: CodeBlockProps) => {
const listSig = useSignal<Element>();
useStyles$(styles);

useVisibleTask$(async () => {
const { pathInView$, path, observerRootId } = props;
if (pathInView$ && path && listSig.value !== undefined) {
const el = listSig.value;
const intersectionObserver = new IntersectionObserver(
([{ isIntersecting }]) => isIntersecting && pathInView$(path),
{
//to avoid any edge case
root: observerRootId ? document.getElementById(observerRootId) : null,
}
);
intersectionObserver.observe(el);
return () => {
intersectionObserver.unobserve(el);
};
}
});

let language = props.language;
if (!language && props.path && props.code) {
const ext = props.path.split('.').pop();
@@ -37,9 +60,12 @@ export const CodeBlock = component$((props: CodeBlockProps) => {
const highlighted = prismjs.highlight(props.code, prismjs.languages[language], language);
const className = `language-${language}`;
return (
<pre class={className}>
<code class={className} dangerouslySetInnerHTML={highlighted} />
</pre>
<div class="relative">
<pre class={className} ref={listSig}>
<code class={className} dangerouslySetInnerHTML={highlighted} />
</pre>
<CopyCode code={props.code} />
</div>
);
}
return null;
64 changes: 64 additions & 0 deletions packages/docs/src/components/copy-code/copy-code-block.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { component$, useSignal, useStyles$ } from '@builder.io/qwik';
import { CopyCode as CopyCodeIcon } from '../svgs/copy-code-icon';
import styles from './copy-code.css?inline';

const Check = component$(({ height = 12, width = 12 }: { height?: number; width?: number }) => {
useStyles$(styles);

return (
<svg
class="w-3.5 h-3.5 text-white "
height={height}
width={width}
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 16 12"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M1 5.917 5.724 10.5 15 1.5"
/>
</svg>
);
});
export const CopyCode = component$(({ code }: { code: string }) => {
const copied = useSignal(false);
return (
<button
preventdefault:click
onClick$={async (e) => {
copied.value = !copied.value;
if (copied.value) {
setTimeout(() => (copied.value = false), 1500);
}
if (navigator.clipboard) {
await navigator.clipboard.writeText(code);
}
}}
class="absolute text-white right-2 top-2 shadow-2xl bg-[#1e1e1e] z-10"
>
<span
class={{
animate: true,
visible: copied.value,
hidden: !copied.value,
}}
>
<Check />
</span>
<span
class={{
animate: true,
visible: !copied.value,
hidden: copied.value,
}}
>
<CopyCodeIcon />
</span>
</button>
);
});
14 changes: 14 additions & 0 deletions packages/docs/src/components/copy-code/copy-code.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.animate {
opacity: 1;
animation: check-in 1 1s;
}

@keyframes check-in {
0% {
opacity: 0;
}

100% {
opacity: 1;
}
}
23 changes: 23 additions & 0 deletions packages/docs/src/components/svgs/copy-code-icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
interface CopyIconProps {
width?: number;
height?: number;
}

export const CopyCode = ({ height = 18, width = 18 }: CopyIconProps) => {
return (
<svg
width={width}
height={height}
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
{' '}
<path stroke="none" d="M0 0h24v24H0z" /> <rect x="8" y="8" width="12" height="12" rx="2" />
<path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" />
</svg>
);
};
72 changes: 54 additions & 18 deletions packages/docs/src/repl/repl-output-modules.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,81 @@
import { $, useStore, component$ } from '@builder.io/qwik';
import { CodeBlock } from '../components/code-block/code-block';
import type { ReplModuleOutput } from './types';
import type { PathInView, ReplModuleOutput } from './types';
const FILE_MODULE_DIV_ID = 'file-modules-client-buisness';

export const ReplOutputModules = ({ outputs, headerText }: ReplOutputModulesProps) => {
export const ReplOutputModules = component$(({ outputs, headerText }: ReplOutputModulesProps) => {
const store = useStore<PathInView>({
selectedPath: outputs.length ? outputs[0].path : '',
});
const pathInView$ = $((path: string) => {
store.selectedPath = path;
});
return (
<div class="output-result output-modules">
<div class="file-tree">
<div class="file-tree-header">{outputs.length > 0 ? headerText : ''}</div>
<div class="file-tree-items">
{outputs.map((o, i) => (
<a
href="#"
onClick$={() => {
const fileItem = document.querySelector(`[data-file-item="${i}"]`);
if (fileItem) {
fileItem.scrollIntoView();
}
}}
preventdefault:click
key={o.path}
>
{o.path}
</a>
<div key={o.path}>
<a
href="#"
onClick$={() => {
const fileItem = document.querySelector(`[data-file-item="${i}"]`);
if (fileItem) {
fileItem.scrollIntoView();
}
}}
class={{
'in-view': store.selectedPath && store.selectedPath === o.path,
'!hidden': true,
'md:!block': true,
}}
preventdefault:click
key={o.path}
>
{o.path}
</a>
<div class="block md:hidden">
<div class="file-item" data-file-item={i} key={o.path}>
<div class="file-info">
<span>{o.path}</span>
{o.size ? <span class="file-size">({o.size})</span> : null}
</div>
<div class="file-text">
<CodeBlock
pathInView$={pathInView$}
path={o.path}
code={o.code}
observerRootId={FILE_MODULE_DIV_ID}
/>
</div>
</div>
</div>
</div>
))}
</div>
</div>
<div class="file-modules">
<div class="file-modules" id={FILE_MODULE_DIV_ID}>
{outputs.map((o, i) => (
<div class="file-item" data-file-item={i} key={o.path}>
<div class="file-info">
<span>{o.path}</span>
{o.size ? <span class="file-size">({o.size})</span> : null}
</div>
<div class="file-text">
<CodeBlock path={o.path} code={o.code} />
<CodeBlock
pathInView$={pathInView$}
path={o.path}
code={o.code}
observerRootId={FILE_MODULE_DIV_ID}
/>
</div>
</div>
))}
</div>
</div>
);
};
});

interface ReplOutputModulesProps {
headerText: string;
5 changes: 3 additions & 2 deletions packages/docs/src/repl/repl-output-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { component$ } from '@builder.io/qwik';
import { CodeBlock } from '../components/code-block/code-block';
import { ReplOutputModules } from './repl-output-modules';
import { ReplOutputSymbols } from './repl-output-symbols';
import { ReplTabButton } from './repl-tab-button';
import { ReplTabButtons } from './repl-tab-buttons';
import type { ReplAppInput, ReplStore } from './types';

export const ReplOutputPanel = ({ input, store }: ReplOutputPanelProps) => {
export const ReplOutputPanel = component$(({ input, store }: ReplOutputPanelProps) => {
const diagnosticsLen = store.diagnostics.length + store.monacoDiagnostics.length;

return (
@@ -131,7 +132,7 @@ export const ReplOutputPanel = ({ input, store }: ReplOutputPanelProps) => {
</div>
</div>
);
};
});

interface ReplOutputPanelProps {
input: ReplAppInput;
Loading