@elmethis/qwik 0.0.18 → 0.0.20

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/README.md CHANGED
@@ -1,55 +1,108 @@
1
- # Qwik Library ⚡️
1
+ # Qwik Library
2
2
 
3
- - [Qwik Docs](https://qwik.dev/)
4
- - [Discord](https://qwik.dev/chat)
5
- - [Qwik on GitHub](https://github.com/QwikDev/qwik)
6
- - [@QwikDev](https://twitter.com/QwikDev)
7
- - [Vite](https://vitejs.dev/)
8
- - [Partytown](https://partytown.qwik.dev/)
9
- - [Mitosis](https://github.com/BuilderIO/mitosis)
10
- - [Builder.io](https://www.builder.io/)
3
+ This package provides reusable UI building blocks for the Qwik web framework.
11
4
 
12
- ---
5
+ ## Directory structure
13
6
 
14
- ## Project Structure
7
+ This package is one of the workspace packages managed by pnpm.
15
8
 
16
- Inside your project, you'll see the following directories and files:
9
+ The package lives at `./packages/qwik`.
17
10
 
18
- ```
19
- ├── public/
20
- │ └── ...
21
- └── src/
22
- ├── components/
23
- │ └── ...
24
- └── index.ts
25
- ```
11
+ - `.storybook/` - Storybook configuration
12
+ - `lib/` - build output
13
+ - `lib-types/` - build output (TypeScript types)
14
+ - `src/` - source root
15
+ - `assets/` - static assets
16
+ - `components/` - Qwik components
17
+ - `<category>/`
18
+ - `elm-x.module.scss`
19
+ - `elm-x.stories.tsx`
20
+ - `elm-x.tsx`
21
+ - `hooks/` - custom Qwik hooks
22
+ - `styles/` - shared styles (SCSS)
23
+ - `index.ts` - package exports (re-export components)
26
24
 
27
- - `src/components`: Recommended directory for components.
25
+ ## Coding style
28
26
 
29
- - `index.ts`: The entry point of your component library, make sure all the public components are exported from this file.
27
+ ### Module structure
30
28
 
31
- ## Development
29
+ Each component module should include:
32
30
 
33
- Development mode uses [Vite's development server](https://vitejs.dev/). For Qwik during development, the `dev` command will also server-side render (SSR) the output. The client-side development modules are loaded by the browser.
31
+ - **Component**: TypeScript JSX (`.tsx`)
32
+ - **Styles**: SCSS Modules (`.module.scss`)
33
+ - **Storybook**: a Storybook meta file (`.stories.tsx`)
34
34
 
35
- ```
36
- pnpm dev
37
- ```
35
+ ### Component (TypeScript JSX)
38
36
 
39
- > Note: during dev mode, Vite will request many JS files, which does not represent a Qwik production build.
37
+ File: `elm-my-something.tsx`
40
38
 
41
- ## Production
39
+ ```tsx
40
+ import { component$ } from "@builder.io/qwik";
42
41
 
43
- The production build should generate the production build of your component library in (./lib) and the typescript type definitions in (./lib-types).
42
+ import styles from "./elm-my-something.module.scss";
44
43
 
44
+ export interface ElmMySomethingProps {
45
+ placeholder?: string;
46
+ }
47
+
48
+ export const ElmMySomething = component$<ElmMySomethingProps>(
49
+ ({ placeholder = "Howdy" }) => {
50
+ return <div class={styles["elm-my-something"]}>{placeholder}</div>;
51
+ },
52
+ );
45
53
  ```
46
- pnpm build
54
+
55
+ ### Styles (SCSS Modules)
56
+
57
+ File: `elm-my-something.module.scss`
58
+
59
+ ```scss
60
+ .elm-my-something {
61
+ }
47
62
  ```
48
63
 
49
- ## sideEffects: false
64
+ ### Storybook
50
65
 
51
- This package is configured with "sideEffects": false in its package.json.<br/>
52
- This tells bundlers that the module [has no side effects](https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free) when imported.<br/>
53
- Consequently, to maintain the integrity of tree-shaking optimizations, please ensure your code truly contains no side effects (such as modifying global variables or the DOM upon import).<br/>
54
- If your module does introduce side effects, remove "sideEffects": false or specify the specific files with side effects.<br/>
55
- Be sure to only remove it from the specific file where the global is being set. Finally, verify that your build continues to function as expected after making any adjustments to the sideEffects setting.
66
+ File: `elm-my-something.stories.tsx`
67
+
68
+ ```tsx
69
+ import type { Meta, StoryObj } from "storybook-framework-qwik";
70
+ import { ElmMySomething } from "./elm-my-something";
71
+
72
+ const meta: Meta<typeof ElmMySomething> = {
73
+ // Replace the <Category> placeholder
74
+ title: "Components/<Category>/elm-my-something",
75
+ component: ElmMySomething,
76
+ tags: ["autodocs"],
77
+ args: {},
78
+ };
79
+
80
+ export default meta;
81
+
82
+ type Story = StoryObj<typeof meta>;
83
+
84
+ export const Primary: Story = {};
85
+ ```
86
+
87
+ ### Bulk Exports
88
+
89
+ We export all components and their prop types in `src/index.ts`.
90
+
91
+ ```tsx
92
+ // | Code |
93
+ export {
94
+ ElmCodeBlock,
95
+ type ElmCodeBlockProps,
96
+ } from "./components/code/elm-code-block";
97
+ export { ElmKatex, type ElmKatexProps } from "./components/code/elm-katex";
98
+ export {
99
+ ElmShikiHighlighter,
100
+ type ElmShikiHighlighterProps,
101
+ } from "./components/code/elm-shiki-highlighter";
102
+
103
+ // | Containments |
104
+ export {
105
+ ElmParallax,
106
+ type ElmParallaxProps,
107
+ } from "./components/containments/elm-parallax";
108
+ ```