Skip to content

Commit b8f99e3

Browse files
thejacksheltonmaiieulcwoolumgithub-actions[bot]
authored
Preview (#940)
* chore(website): bump to qwik 1.7.3 + entry files output (#926) * Revert-new-sw (#927) * Revert "change to new sw impl" This reverts commit 3081504. * chore(website): charSet -> charset in root.tsx * Remove-import-meta-glob-eager-true (#928) * chore(website): remove import.meta.glob eager true * chore(website): comment out vite config trick to se chunk names * chore(pkg.pr.new): remove 0.0.9 flag (#921) * chore(qwik-themes): move code internally + signal implementation (#922) * chore(qwik-themes): move code internally under _state folder * chore(themes): linting * fix(themes): use signals instead of stores * chore(themes provider): useVisibleTask to useOnWindow * chore(themes): move to qwik-ui/themes * Tooltip Beta (#934) * feat(tooltip): implement tooltip to beta phase * fix(tooltip): small tweaks to the tooltip state * fix: remove animations form tooltip docs and fix placement example * feat(tooltip): implement onOpenChange$ * chore: fix changeset type * test: update placement test to remove loop * fix: remove breaking examples and tooltip route * fix: checkbox tests preventing us from opening pw * refactor: deprecate popover hover prop in favor of tooltip * latest --------- Co-authored-by: Christopher Woolum <[email protected]> * fix: comment out bundle issue when changing user pref (#935) * chore(website): disable qwikVite linter to speed up preview and builds (#936) * Inline comp docs (#931) * allow people to pass handlers to modal close * docs: improve contributor guide * docs: mention inline components * add utils changeset (#937) * Version Packages (#917) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * chore(/themes): turn visible task to strategy:document-idle (#938) * chore(/themes): turn visible task to strategy:document-idle * fix(themes): add timeout to themeSig assignment to localstorage * fix(themes): augment timeout to themeSig assignment to localstorage * fix(website): remove js execution on load by assigning themes sig on click (#939) * feat: static adapter * use improved shiki node version now that we're on static --------- Co-authored-by: Maïeul <[email protected]> Co-authored-by: Christopher Woolum <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: maiieul <[email protected]>
1 parent dbd0eb6 commit b8f99e3

File tree

89 files changed

+2319
-400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2319
-400
lines changed

.changeset/slow-jokes-sleep.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ jobs:
4040
with:
4141
node_version: 20
4242
- run: pnpm release.prepare --parallel=false
43-
- run: pnpm dlx pkg-pr-new@^0.0.9 publish --pnpm ./dist/packages/kit-headless ./dist/packages/kit-styled ./dist/packages/cli ./dist/packages/utils
43+
- run: pnpm dlx pkg-pr-new publish --pnpm ./dist/packages/kit-headless ./dist/packages/kit-styled ./dist/packages/cli ./dist/packages/utils
4444
env:
4545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GITHUB_TOKEN is provided automatically in any repository

apps/component-tests/src/components/showcase-test/component-imports.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import { isDev } from '@builder.io/qwik/build';
32

43
// The below `/src/routes/docs/**/**/examples/*.tsx` patterns are here so that import.meta.glob works both for styled and headless routes.
54
// For example:
@@ -11,7 +10,6 @@ function createMetaGlobComponents() {
1110
'../../../../website/src/routes/docs/**/**/examples/*.tsx',
1211
{
1312
import: 'default',
14-
eager: isDev ? false : true,
1513
},
1614
);
1715

apps/website/src/_state/component-statuses.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ export const statusByComponent: ComponentKitsStatuses = {
4949
Select: ComponentStatus.Beta,
5050
Separator: ComponentStatus.Beta,
5151
Tabs: ComponentStatus.Beta,
52-
Tooltip: ComponentStatus.Draft,
52+
Tooltip: ComponentStatus.Beta,
5353
},
5454
};

apps/website/src/components/code-snippet/code-snippet.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { PropsOf, component$, useSignal, useTask$ } from '@builder.io/qwik';
22
import { useLocation } from '@builder.io/qwik-city';
3-
import { isDev } from '@builder.io/qwik/build';
43
import { Highlight } from '../highlight/highlight';
54

65
// The below `/src/routes/docs/**/**/snippets/*.tsx` pattern is here so that import.meta.glob works both for styled and headless routes.
@@ -12,7 +11,6 @@ import { Highlight } from '../highlight/highlight';
1211
const codeSnippets: any = import.meta.glob('/src/routes/docs/**/**/snippets/*', {
1312
query: '?raw',
1413
import: 'default',
15-
eager: isDev ? false : true,
1614
});
1715

1816
type CodeSnippetProps = PropsOf<'div'> & {
@@ -30,9 +28,7 @@ export const CodeSnippet = component$<CodeSnippetProps>(({ name }) => {
3028
const codeSnippetSig = useSignal<string>();
3129

3230
useTask$(async () => {
33-
codeSnippetSig.value = isDev
34-
? await codeSnippets[snippetPath]() // We need to call `await codeSnippets[snippetPath]()` in development as it is `eager:false`
35-
: codeSnippets[snippetPath]; // We need to directly access the `codeSnippets[snippetPath]` expression in preview/production as it is `eager:true`
31+
codeSnippetSig.value = await codeSnippets[snippetPath](); // We need to call `await codeSnippets[snippetPath]()` in development as it is `eager:false`
3632
});
3733

3834
return (

apps/website/src/components/copy-css-config/copy-css-config.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Modal } from '@qwik-ui/headless';
33
import { Button } from '~/components/ui';
44
import { extractThemeCSS } from '@qwik-ui/utils';
55
import { LuX } from '@qwikest/icons/lucide';
6-
import { useTheme } from 'qwik-themes';
6+
import { useTheme } from '@qwik-ui/themes';
77
import globalCSS from '~/global.css?raw';
88
import { Highlight } from '../highlight/highlight';
99

@@ -12,16 +12,17 @@ export default component$(() => {
1212

1313
const cssThemeOutput = useSignal<string>('');
1414

15-
const { theme } = useTheme();
15+
const { themeSig, defaultTheme, storageKey } = useTheme();
1616

1717
return (
1818
<Modal.Root bind:show={showSig}>
1919
<Button
2020
onClick$={() => {
21+
themeSig.value = localStorage.getItem(storageKey) ?? defaultTheme;
2122
cssThemeOutput.value = extractThemeCSS(
22-
theme === 'dark' || theme === 'light'
23+
themeSig.value === 'dark' || themeSig.value === 'light'
2324
? 'border-radius-0 simple primary-cyan-600 light base-slate'
24-
: theme,
25+
: themeSig.value,
2526
globalCSS,
2627
);
2728
showSig.value = true;

apps/website/src/components/header/header.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import { MoonIcon } from '../icons/MoonIcon';
2020
import { SunIcon } from '../icons/SunIcon';
2121
import { LogoIcon, LogoWithBorders } from '../icons/logo';
2222

23-
import { useTheme } from 'qwik-themes';
23+
import { useTheme } from '@qwik-ui/themes';
24+
2425
import { Modal } from '@qwik-ui/headless';
2526
import { useAppState } from '~/_state/use-app-state';
2627
import { LuX } from '@qwikest/icons/lucide';
@@ -126,13 +127,13 @@ export default component$(({ showVersion = false }: HeaderProps) => {
126127
}
127128
});
128129

129-
const { theme } = useTheme();
130+
const { themeSig } = useTheme();
130131

131132
return (
132133
<Modal.Root
133134
class={cn(
134135
'sticky top-0 z-10 flex h-16 justify-center border-b bg-background',
135-
theme?.includes('brutalist') && 'border-b-2',
136+
themeSig.value?.includes('brutalist') && 'border-b-2',
136137
)}
137138
bind:show={isSidebarOpenedSig}
138139
>
@@ -219,7 +220,7 @@ export default component$(({ showVersion = false }: HeaderProps) => {
219220
});
220221

221222
const DarkModeToggle = component$<PropsOf<typeof Button>>(({ ...props }) => {
222-
const { theme, setTheme } = useTheme();
223+
const { themeSig } = useTheme();
223224
const switchLightDark = $((input: string | string[]): string | string[] | undefined => {
224225
const switchWord = (word: string): string =>
225226
word.includes('light')
@@ -237,7 +238,9 @@ const DarkModeToggle = component$<PropsOf<typeof Button>>(({ ...props }) => {
237238
aria-label="Toggle dark mode"
238239
size="icon"
239240
look="ghost"
240-
onClick$={async () => setTheme(await switchLightDark(theme || 'light'))}
241+
onClick$={async () =>
242+
(themeSig.value = await switchLightDark(themeSig.value || 'light'))
243+
}
241244
>
242245
<div class="hidden dark:block">
243246
<MoonIcon />

apps/website/src/components/highlight/highlight.tsx

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
1-
import { ClassList, PropsOf, component$, useSignal, useTask$ } from '@builder.io/qwik';
1+
import { ClassList, PropsOf, component$, useSignal, useTask$, $ } from '@builder.io/qwik';
22
import { CodeCopy } from '../code-copy/code-copy';
33
import { cn } from '@qwik-ui/utils';
4-
import poimandres from 'shiki/themes/poimandres.mjs';
5-
import html from 'shiki/langs/html.mjs';
6-
import css from 'shiki/langs/css.mjs';
7-
import tsx from 'shiki/langs/tsx.mjs';
8-
import { createHighlighterCore, BundledLanguage } from 'shiki/index.mjs';
9-
10-
// Create a single highlighter instance
11-
const highlighterPromise = createHighlighterCore({
12-
themes: [poimandres],
13-
langs: [html, css, tsx],
14-
loadWasm: import('shiki/wasm'),
15-
});
4+
import { codeToHtml } from 'shiki';
165

176
export type HighlightProps = PropsOf<'div'> & {
187
code: string;
198
copyCodeClass?: ClassList;
20-
language?: BundledLanguage;
9+
language?: 'tsx' | 'html' | 'css';
2110
splitCommentStart?: string;
2211
splitCommentEnd?: string;
2312
};
@@ -33,26 +22,31 @@ export const Highlight = component$(
3322
}: HighlightProps) => {
3423
const codeSig = useSignal('');
3524

36-
useTask$(async ({ track }) => {
37-
track(() => code);
25+
const addShiki$ = $(async () => {
3826
let modifiedCode: string = code;
3927

4028
let partsOfCode = modifiedCode.split(splitCommentStart);
29+
4130
if (partsOfCode.length > 1) {
4231
modifiedCode = partsOfCode[1];
4332
}
4433

4534
partsOfCode = modifiedCode.split(splitCommentEnd);
35+
4636
if (partsOfCode.length > 1) {
4737
modifiedCode = partsOfCode[0];
4838
}
4939

50-
const highlighter = await highlighterPromise;
51-
const str = highlighter.codeToHtml(modifiedCode, {
40+
const str = await codeToHtml(modifiedCode, {
5241
lang: language,
5342
theme: 'poimandres',
5443
});
55-
codeSig.value = str;
44+
45+
codeSig.value = str.toString();
46+
});
47+
48+
useTask$(async () => {
49+
await addShiki$();
5650
});
5751

5852
return (

apps/website/src/components/icons/logo.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { PropsOf, component$ } from '@builder.io/qwik';
22
import { cn } from '@qwik-ui/utils';
3-
import { useTheme } from 'qwik-themes';
3+
import { useTheme } from '@qwik-ui/themes';
44

55
export const Logo = component$<PropsOf<'svg'>>(({ ...props }) => {
66
return (
@@ -57,7 +57,7 @@ export const Logo = component$<PropsOf<'svg'>>(({ ...props }) => {
5757
});
5858

5959
export const LogoWithBorders = component$<PropsOf<'svg'>>(({ ...props }) => {
60-
const { theme } = useTheme();
60+
const { themeSig } = useTheme();
6161
return (
6262
<svg
6363
{...props}
@@ -72,7 +72,7 @@ export const LogoWithBorders = component$<PropsOf<'svg'>>(({ ...props }) => {
7272
clip-rule="evenodd"
7373
>
7474
<g
75-
class={cn(theme?.includes('light') ? 'stroke-black' : 'stroke-white')}
75+
class={cn(themeSig.value?.includes('light') ? 'stroke-black' : 'stroke-white')}
7676
stroke-width="8"
7777
fill="none"
7878
>
@@ -118,7 +118,7 @@ export const LogoWithBorders = component$<PropsOf<'svg'>>(({ ...props }) => {
118118
});
119119

120120
export const LogoIcon = component$<PropsOf<'svg'>>(({ ...props }) => {
121-
const { theme } = useTheme();
121+
const { themeSig } = useTheme();
122122
return (
123123
<svg
124124
{...props}
@@ -129,7 +129,7 @@ export const LogoIcon = component$<PropsOf<'svg'>>(({ ...props }) => {
129129
xmlns="http://www.w3.org/2000/svg"
130130
>
131131
<g
132-
class={cn(theme?.includes('light') ? 'stroke-black' : 'stroke-white')}
132+
class={cn(themeSig.value?.includes('light') ? 'stroke-black' : 'stroke-white')}
133133
stroke-width="8"
134134
fill="none"
135135
>

apps/website/src/components/make-it-yours/make-it-yours.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
cn,
1111
} from '@qwik-ui/utils';
1212
import { LuSlidersHorizontal, LuX } from '@qwikest/icons/lucide';
13-
import { useTheme } from 'qwik-themes';
13+
import { useTheme } from '@qwik-ui/themes';
14+
1415
import { Button, Modal, buttonVariants } from '~/components/ui';
1516

1617
import { useAppState } from '~/_state/use-app-state';
@@ -19,10 +20,10 @@ import CopyCssConfig from '../copy-css-config/copy-css-config';
1920
export default component$<PropsOf<typeof Button>>(() => {
2021
const rootStore = useAppState();
2122

22-
const { theme, setTheme } = useTheme();
23+
const { themeSig } = useTheme();
2324

2425
const themeComputedObjectSig = useComputed$((): ThemeConfig => {
25-
if (!theme || theme === 'light') {
26+
if (!themeSig.value || themeSig.value === 'light') {
2627
return {
2728
font: ThemeFonts.SANS,
2829
mode: ThemeModes.LIGHT,
@@ -33,7 +34,7 @@ export default component$<PropsOf<typeof Button>>(() => {
3334
};
3435
}
3536

36-
if (theme === 'dark') {
37+
if (themeSig.value === 'dark') {
3738
return {
3839
font: ThemeFonts.SANS,
3940
mode: ThemeModes.DARK,
@@ -44,7 +45,9 @@ export default component$<PropsOf<typeof Button>>(() => {
4445
};
4546
}
4647

47-
const themeArray = Array.isArray(theme) ? theme : theme.split(' ');
48+
const themeArray = Array.isArray(themeSig.value)
49+
? themeSig.value
50+
: themeSig.value.split(' ');
4851
return {
4952
font: themeArray[0],
5053
mode: themeArray[1],
@@ -91,7 +94,7 @@ export default component$<PropsOf<typeof Button>>(() => {
9194
themeComputedObjectSig.value.font = ThemeFonts.SANS;
9295
}
9396
themeComputedObjectSig.value.style = el.value;
94-
setTheme(await themeStoreToThemeClasses$());
97+
themeSig.value = await themeStoreToThemeClasses$();
9598
}}
9699
>
97100
<option value={'simple'}>Simple</option>
@@ -114,7 +117,7 @@ export default component$<PropsOf<typeof Button>>(() => {
114117
onClick$={async () => {
115118
themeComputedObjectSig.value.baseColor = baseColor;
116119

117-
setTheme(await themeStoreToThemeClasses$());
120+
themeSig.value = await themeStoreToThemeClasses$();
118121
}}
119122
class={cn(
120123
'flex h-3 w-3 items-center justify-center rounded-none',
@@ -165,7 +168,7 @@ export default component$<PropsOf<typeof Button>>(() => {
165168
size="icon"
166169
onClick$={async () => {
167170
themeComputedObjectSig.value.primaryColor = primaryColor;
168-
setTheme(await themeStoreToThemeClasses$());
171+
themeSig.value = await themeStoreToThemeClasses$();
169172
}}
170173
class={cn(
171174
'h-3 w-3 rounded-none',
@@ -182,7 +185,7 @@ export default component$<PropsOf<typeof Button>>(() => {
182185
primaryColor === 'primary-zinc-900' ||
183186
primaryColor === 'primary-neutral-900' ||
184187
primaryColor === 'primary-stone-900') &&
185-
theme?.includes('dark') ? (
188+
themeSig.value?.includes('dark') ? (
186189
<span
187190
class={cn(
188191
'flex h-[10px] w-[10px] shrink-0 rounded-none',
@@ -439,7 +442,7 @@ export default component$<PropsOf<typeof Button>>(() => {
439442
look="outline"
440443
onClick$={async () => {
441444
themeComputedObjectSig.value.borderRadius = borderRadius;
442-
setTheme(await themeStoreToThemeClasses$());
445+
themeSig.value = await themeStoreToThemeClasses$();
443446
}}
444447
class={cn('w-12', isActive && 'mb-2 border-ring')}
445448
>
@@ -462,7 +465,7 @@ export default component$<PropsOf<typeof Button>>(() => {
462465
themeComputedObjectSig.value.mode =
463466
themeComputedObjectSig.value.mode?.includes('light') ? 'dark' : 'light';
464467

465-
setTheme(await themeStoreToThemeClasses$());
468+
themeSig.value = await themeStoreToThemeClasses$();
466469
}}
467470
/>
468471
</div>
@@ -471,7 +474,9 @@ export default component$<PropsOf<typeof Button>>(() => {
471474
<footer class=" flex w-full justify-between gap-4">
472475
<Button
473476
look="ghost"
474-
onClick$={() => setTheme(theme?.includes('dark') ? 'dark' : 'light')}
477+
onClick$={() => {
478+
themeSig.value = themeSig.value?.includes('dark') ? 'dark' : 'light';
479+
}}
475480
>
476481
Reset
477482
</Button>

0 commit comments

Comments
 (0)