@elmethis/qwik 0.0.2 → 0.0.4

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.
Files changed (271) hide show
  1. package/.prettierignore +6 -0
  2. package/.storybook/main.ts +23 -0
  3. package/.storybook/preview-head.html +4 -0
  4. package/.storybook/preview.tsx +51 -0
  5. package/.storybook/sb.scss +13 -0
  6. package/.storybook/tsconfig.json +24 -0
  7. package/eslint.config.js +79 -0
  8. package/package.json +5 -8
  9. package/src/assets/bg1.webp +0 -0
  10. package/src/assets/bg2.webp +0 -0
  11. package/src/assets/images/2.svg +4 -0
  12. package/src/assets/images/lamdscape.svg +4 -0
  13. package/src/assets/images/portrait.svg +4 -0
  14. package/src/assets/images/square.svg +4 -0
  15. package/src/assets/vite.svg +1 -0
  16. package/src/assets/vue.svg +1 -0
  17. package/src/components/code/elm-code-block.module.scss +67 -0
  18. package/src/components/code/elm-code-block.stories.tsx +44 -0
  19. package/src/components/code/elm-code-block.tsx +95 -0
  20. package/src/components/code/elm-katex.stories.tsx +28 -0
  21. package/src/components/code/elm-katex.tsx +34 -0
  22. package/src/components/code/elm-shiki-highlighter.global.scss +18 -0
  23. package/src/components/code/elm-shiki-highlighter.stories.tsx +21 -0
  24. package/src/components/code/elm-shiki-highlighter.tsx +44 -0
  25. package/src/components/code/seed/main.rs +24 -0
  26. package/{lib/qwik31.js → src/components/code/shikiInstance.ts} +8 -11
  27. package/src/components/containments/elm-toggle.module.scss +132 -0
  28. package/src/components/containments/elm-toggle.stories.tsx +34 -0
  29. package/src/components/containments/elm-toggle.tsx +106 -0
  30. package/src/components/fallback/elm-block-fallback.module.scss +8 -0
  31. package/src/components/fallback/elm-block-fallback.stories.tsx +14 -0
  32. package/src/components/fallback/elm-block-fallback.tsx +20 -0
  33. package/src/components/fallback/elm-rectangle-wave.module.scss +42 -0
  34. package/src/components/fallback/elm-rectangle-wave.stories.tsx +28 -0
  35. package/src/components/fallback/elm-rectangle-wave.tsx +11 -0
  36. package/src/components/icon/elm-dot-loading-icon.module.scss +53 -0
  37. package/src/components/icon/elm-dot-loading-icon.stories.tsx +15 -0
  38. package/src/components/icon/elm-dot-loading-icon.tsx +35 -0
  39. package/src/components/icon/elm-inline-icon.module.scss +21 -0
  40. package/src/components/icon/elm-inline-icon.stories.tsx +16 -0
  41. package/src/components/icon/elm-inline-icon.tsx +25 -0
  42. package/src/components/icon/elm-language-icon.stories.tsx +22 -0
  43. package/src/components/icon/elm-language-icon.tsx +167 -0
  44. package/src/components/icon/elm-mdi-icon.module.scss +8 -0
  45. package/src/components/icon/elm-mdi-icon.stories.tsx +25 -0
  46. package/src/components/icon/elm-mdi-icon.tsx +34 -0
  47. package/src/components/icon/languages/bash.module.scss +6 -0
  48. package/src/components/icon/languages/bash.tsx +27 -0
  49. package/src/components/icon/languages/c-plus-plus.tsx +33 -0
  50. package/src/components/icon/languages/c-sharp.tsx +29 -0
  51. package/src/components/icon/languages/c.tsx +27 -0
  52. package/src/components/icon/languages/css.tsx +21 -0
  53. package/src/components/icon/languages/go.tsx +22 -0
  54. package/src/components/icon/languages/html.tsx +30 -0
  55. package/src/components/icon/languages/java.tsx +37 -0
  56. package/src/components/icon/languages/javascript.tsx +22 -0
  57. package/src/components/icon/languages/json.tsx +53 -0
  58. package/src/components/icon/languages/kotlin.tsx +36 -0
  59. package/src/components/icon/languages/language-interface.ts +4 -0
  60. package/src/components/icon/languages/lua.tsx +29 -0
  61. package/src/components/icon/languages/npm.tsx +25 -0
  62. package/src/components/icon/languages/python.tsx +67 -0
  63. package/src/components/icon/languages/rust.tsx +19 -0
  64. package/src/components/icon/languages/sql.tsx +21 -0
  65. package/src/components/icon/languages/terraform.tsx +31 -0
  66. package/src/components/icon/languages/typescript.tsx +22 -0
  67. package/src/components/media/elm-block-image.module.scss +68 -0
  68. package/src/components/media/elm-block-image.stories.tsx +79 -0
  69. package/src/components/media/elm-block-image.tsx +110 -0
  70. package/src/components/media/elm-file.module.scss +43 -0
  71. package/src/components/media/elm-file.stories.tsx +27 -0
  72. package/src/components/media/elm-file.tsx +75 -0
  73. package/src/components/navigation/elm-bookmark.module.scss +100 -0
  74. package/src/components/navigation/elm-bookmark.stories.tsx +87 -0
  75. package/src/components/navigation/elm-bookmark.tsx +72 -0
  76. package/src/components/others/elm-jarkup.module.scss +26 -0
  77. package/src/components/others/elm-jarkup.stories.tsx +18 -0
  78. package/src/components/others/elm-jarkup.tsx +267 -0
  79. package/src/components/table/elm-table-body.tsx +14 -0
  80. package/src/components/table/elm-table-cell.module.scss +41 -0
  81. package/src/components/table/elm-table-cell.tsx +33 -0
  82. package/src/components/table/elm-table-header.module.scss +8 -0
  83. package/src/components/table/elm-table-header.tsx +21 -0
  84. package/src/components/table/elm-table-row.module.scss +28 -0
  85. package/src/components/table/elm-table-row.tsx +15 -0
  86. package/src/components/table/elm-table.module.scss +29 -0
  87. package/src/components/table/elm-table.stories.tsx +67 -0
  88. package/src/components/table/elm-table.tsx +63 -0
  89. package/src/components/typography/elm-block-quote.module.scss +29 -0
  90. package/src/components/typography/elm-block-quote.stories.tsx +22 -0
  91. package/src/components/typography/elm-block-quote.tsx +34 -0
  92. package/src/components/typography/elm-callout.module.scss +36 -0
  93. package/src/components/typography/elm-callout.stories.tsx +47 -0
  94. package/src/components/typography/elm-callout.tsx +52 -0
  95. package/src/components/typography/elm-divider.module.scss +6 -0
  96. package/src/components/typography/elm-divider.stories.tsx +14 -0
  97. package/src/components/typography/elm-divider.tsx +14 -0
  98. package/src/components/typography/elm-fragment-identifier.module.scss +28 -0
  99. package/src/components/typography/elm-fragment-identifier.stories.tsx +14 -0
  100. package/src/components/typography/elm-fragment-identifier.tsx +31 -0
  101. package/src/components/typography/elm-heading.module.scss +120 -0
  102. package/src/components/typography/elm-heading.stories.tsx +42 -0
  103. package/src/components/typography/elm-heading.tsx +40 -0
  104. package/src/components/typography/elm-inline-text.module.scss +114 -0
  105. package/src/components/typography/elm-inline-text.stories.tsx +70 -0
  106. package/src/components/typography/elm-inline-text.tsx +147 -0
  107. package/src/components/typography/elm-list.global.scss +66 -0
  108. package/src/components/typography/elm-list.stories.tsx +61 -0
  109. package/src/components/typography/elm-list.tsx +39 -0
  110. package/src/components/typography/elm-paragraph.module.scss +21 -0
  111. package/src/components/typography/elm-paragraph.stories.tsx +47 -0
  112. package/src/components/typography/elm-paragraph.tsx +31 -0
  113. package/src/entry.dev.tsx +17 -0
  114. package/{lib-types/entry.ssr.d.ts → src/entry.ssr.tsx} +9 -2
  115. package/src/global.d.ts +13 -0
  116. package/src/hooks/useDelayedSignal.ts +27 -0
  117. package/src/hooks/useInView.tsx +23 -0
  118. package/src/index.ts +113 -0
  119. package/src/root.tsx +13 -0
  120. package/src/styles/text.module.scss +17 -0
  121. package/src/vite-env.d.ts +1 -0
  122. package/tsconfig.json +21 -0
  123. package/vite.config.ts +36 -0
  124. package/lib/assets/6FDiDjPb-qwik.css +0 -955
  125. package/lib/qwik.js +0 -56
  126. package/lib/qwik10.js +0 -108
  127. package/lib/qwik11.js +0 -25
  128. package/lib/qwik12.js +0 -87
  129. package/lib/qwik13.js +0 -62
  130. package/lib/qwik14.js +0 -62
  131. package/lib/qwik15.js +0 -44
  132. package/lib/qwik16.js +0 -58
  133. package/lib/qwik17.js +0 -14
  134. package/lib/qwik18.js +0 -24
  135. package/lib/qwik19.js +0 -41
  136. package/lib/qwik2.js +0 -68
  137. package/lib/qwik20.js +0 -89
  138. package/lib/qwik21.js +0 -28
  139. package/lib/qwik22.js +0 -24
  140. package/lib/qwik23.js +0 -57
  141. package/lib/qwik24.js +0 -15
  142. package/lib/qwik25.js +0 -12
  143. package/lib/qwik26.js +0 -17
  144. package/lib/qwik27.js +0 -27
  145. package/lib/qwik28.js +0 -193
  146. package/lib/qwik29.js +0 -17
  147. package/lib/qwik3.js +0 -17
  148. package/lib/qwik30.js +0 -8
  149. package/lib/qwik33.js +0 -32
  150. package/lib/qwik34.js +0 -6
  151. package/lib/qwik35.js +0 -6
  152. package/lib/qwik36.js +0 -11
  153. package/lib/qwik37.js +0 -8
  154. package/lib/qwik38.js +0 -18
  155. package/lib/qwik39.js +0 -24
  156. package/lib/qwik4.js +0 -33
  157. package/lib/qwik40.js +0 -24
  158. package/lib/qwik41.js +0 -29
  159. package/lib/qwik42.js +0 -31
  160. package/lib/qwik43.js +0 -32
  161. package/lib/qwik44.js +0 -18
  162. package/lib/qwik45.js +0 -24
  163. package/lib/qwik46.js +0 -36
  164. package/lib/qwik47.js +0 -45
  165. package/lib/qwik48.js +0 -27
  166. package/lib/qwik49.js +0 -89
  167. package/lib/qwik5.js +0 -123
  168. package/lib/qwik50.js +0 -18
  169. package/lib/qwik51.js +0 -64
  170. package/lib/qwik52.js +0 -28
  171. package/lib/qwik53.js +0 -28
  172. package/lib/qwik54.js +0 -32
  173. package/lib/qwik55.js +0 -28
  174. package/lib/qwik56.js +0 -8
  175. package/lib/qwik57.js +0 -15
  176. package/lib/qwik58.js +0 -10
  177. package/lib/qwik59.js +0 -26
  178. package/lib/qwik6.js +0 -20
  179. package/lib/qwik60.js +0 -14
  180. package/lib/qwik61.js +0 -14
  181. package/lib/qwik62.js +0 -8
  182. package/lib/qwik63.js +0 -8
  183. package/lib/qwik64.js +0 -24
  184. package/lib/qwik65.js +0 -17
  185. package/lib/qwik67.js +0 -8
  186. package/lib/qwik68.js +0 -23
  187. package/lib/qwik69.js +0 -15
  188. package/lib/qwik7.js +0 -12
  189. package/lib/qwik70.js +0 -8
  190. package/lib/qwik71.js +0 -9
  191. package/lib/qwik72.js +0 -14
  192. package/lib/qwik73.js +0 -10
  193. package/lib/qwik74.js +0 -8
  194. package/lib/qwik8.js +0 -29
  195. package/lib/qwik9.js +0 -16
  196. package/lib-types/components/code/elm-code-block.d.ts +0 -21
  197. package/lib-types/components/code/elm-code-block.stories.d.ts +0 -9
  198. package/lib-types/components/code/elm-katex.d.ts +0 -15
  199. package/lib-types/components/code/elm-katex.stories.d.ts +0 -8
  200. package/lib-types/components/code/elm-shiki-highlighter.d.ts +0 -12
  201. package/lib-types/components/code/elm-shiki-highlighter.stories.d.ts +0 -6
  202. package/lib-types/components/code/shikiInstance.d.ts +0 -2
  203. package/lib-types/components/containments/elm-toggle.d.ts +0 -7
  204. package/lib-types/components/containments/elm-toggle.stories.d.ts +0 -6
  205. package/lib-types/components/fallback/elm-block-fallback.d.ts +0 -5
  206. package/lib-types/components/fallback/elm-block-fallback.stories.d.ts +0 -6
  207. package/lib-types/components/fallback/elm-rectangle-wave.d.ts +0 -4
  208. package/lib-types/components/fallback/elm-rectangle-wave.stories.d.ts +0 -6
  209. package/lib-types/components/icon/elm-dot-loading-icon.d.ts +0 -14
  210. package/lib-types/components/icon/elm-dot-loading-icon.stories.d.ts +0 -6
  211. package/lib-types/components/icon/elm-inline-icon.d.ts +0 -11
  212. package/lib-types/components/icon/elm-inline-icon.stories.d.ts +0 -6
  213. package/lib-types/components/icon/elm-language-icon.d.ts +0 -14
  214. package/lib-types/components/icon/elm-language-icon.stories.d.ts +0 -6
  215. package/lib-types/components/icon/elm-mdi-icon.d.ts +0 -8
  216. package/lib-types/components/icon/elm-mdi-icon.stories.d.ts +0 -6
  217. package/lib-types/components/icon/languages/bash.d.ts +0 -2
  218. package/lib-types/components/icon/languages/c-plus-plus.d.ts +0 -2
  219. package/lib-types/components/icon/languages/c-sharp.d.ts +0 -2
  220. package/lib-types/components/icon/languages/c.d.ts +0 -2
  221. package/lib-types/components/icon/languages/css.d.ts +0 -2
  222. package/lib-types/components/icon/languages/go.d.ts +0 -2
  223. package/lib-types/components/icon/languages/html.d.ts +0 -2
  224. package/lib-types/components/icon/languages/java.d.ts +0 -2
  225. package/lib-types/components/icon/languages/javascript.d.ts +0 -2
  226. package/lib-types/components/icon/languages/json.d.ts +0 -2
  227. package/lib-types/components/icon/languages/kotlin.d.ts +0 -2
  228. package/lib-types/components/icon/languages/language-interface.d.ts +0 -4
  229. package/lib-types/components/icon/languages/lua.d.ts +0 -2
  230. package/lib-types/components/icon/languages/npm.d.ts +0 -2
  231. package/lib-types/components/icon/languages/python.d.ts +0 -2
  232. package/lib-types/components/icon/languages/rust.d.ts +0 -2
  233. package/lib-types/components/icon/languages/sql.d.ts +0 -2
  234. package/lib-types/components/icon/languages/terraform.d.ts +0 -2
  235. package/lib-types/components/icon/languages/typescript.d.ts +0 -2
  236. package/lib-types/components/media/elm-block-image.d.ts +0 -16
  237. package/lib-types/components/media/elm-block-image.stories.d.ts +0 -12
  238. package/lib-types/components/media/elm-file.d.ts +0 -15
  239. package/lib-types/components/media/elm-file.stories.d.ts +0 -7
  240. package/lib-types/components/navigation/elm-bookmark.d.ts +0 -24
  241. package/lib-types/components/navigation/elm-bookmark.stories.d.ts +0 -12
  242. package/lib-types/components/others/elm-jarkup.d.ts +0 -5
  243. package/lib-types/components/others/elm-jarkup.stories.d.ts +0 -6
  244. package/lib-types/components/table/elm-table-body.d.ts +0 -2
  245. package/lib-types/components/table/elm-table-cell.d.ts +0 -12
  246. package/lib-types/components/table/elm-table-header.d.ts +0 -3
  247. package/lib-types/components/table/elm-table-row.d.ts +0 -2
  248. package/lib-types/components/table/elm-table.d.ts +0 -13
  249. package/lib-types/components/table/elm-table.stories.d.ts +0 -6
  250. package/lib-types/components/typography/elm-block-quote.d.ts +0 -4
  251. package/lib-types/components/typography/elm-block-quote.stories.d.ts +0 -6
  252. package/lib-types/components/typography/elm-callout.d.ts +0 -8
  253. package/lib-types/components/typography/elm-callout.stories.d.ts +0 -10
  254. package/lib-types/components/typography/elm-divider.d.ts +0 -8
  255. package/lib-types/components/typography/elm-divider.stories.d.ts +0 -6
  256. package/lib-types/components/typography/elm-fragment-identifier.d.ts +0 -7
  257. package/lib-types/components/typography/elm-fragment-identifier.stories.d.ts +0 -6
  258. package/lib-types/components/typography/elm-heading.d.ts +0 -6
  259. package/lib-types/components/typography/elm-heading.stories.d.ts +0 -7
  260. package/lib-types/components/typography/elm-inline-text.d.ts +0 -54
  261. package/lib-types/components/typography/elm-inline-text.stories.d.ts +0 -13
  262. package/lib-types/components/typography/elm-list.d.ts +0 -5
  263. package/lib-types/components/typography/elm-list.stories.d.ts +0 -8
  264. package/lib-types/components/typography/elm-paragraph.d.ts +0 -5
  265. package/lib-types/components/typography/elm-paragraph.stories.d.ts +0 -9
  266. package/lib-types/entry.dev.d.ts +0 -2
  267. package/lib-types/hooks/useDelayedSignal.d.ts +0 -6
  268. package/lib-types/hooks/useInView.d.ts +0 -6
  269. package/lib-types/index.d.ts +0 -27
  270. package/lib-types/root.d.ts +0 -2
  271. /package/{lib-types/components/table/index.d.ts → src/components/table/index.ts} +0 -0
@@ -0,0 +1,36 @@
1
+ .callout {
2
+ position: relative;
3
+ padding: 1rem;
4
+
5
+ &::after {
6
+ position: absolute;
7
+ content: "";
8
+ inset: 0 auto auto 0;
9
+ height: 100%;
10
+ width: 0.25rem;
11
+ background-color: var(--callout-color);
12
+ }
13
+
14
+ &::before {
15
+ position: absolute;
16
+ content: "";
17
+ inset: 0 0 auto auto;
18
+ height: 100%;
19
+ width: 100%;
20
+ background-color: var(--callout-color);
21
+ opacity: 0.15;
22
+ z-index: -1;
23
+ pointer-events: none;
24
+ }
25
+ }
26
+
27
+ .header {
28
+ display: flex;
29
+ align-items: center;
30
+ gap: 0.5rem;
31
+ }
32
+
33
+ .content {
34
+ padding-block-start: 1rem;
35
+ padding-block-end: 0.25rem;
36
+ }
@@ -0,0 +1,47 @@
1
+ import type { Meta, StoryObj } from "storybook-framework-qwik";
2
+ import { ElmCallout } from "./elm-callout";
3
+ import { ElmInlineText } from "./elm-inline-text";
4
+
5
+ const lorem =
6
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec nunc tincidunt aliquam. Nullam nec purus nec nunc tincidunt aliquam.";
7
+
8
+ const meta: Meta<typeof ElmCallout> = {
9
+ title: "Components/Typography/elm-callout",
10
+ component: ElmCallout,
11
+ tags: ["autodocs"],
12
+ argTypes: {
13
+ type: {
14
+ control: "radio",
15
+ options: ["note", "tip", "important", "warning", "caution"],
16
+ },
17
+ },
18
+ args: {},
19
+ render() {
20
+ return (
21
+ <ElmCallout {...this.args}>
22
+ <ElmInlineText text={lorem} />
23
+ </ElmCallout>
24
+ );
25
+ },
26
+ };
27
+
28
+ export default meta;
29
+ type Story = StoryObj<typeof meta>;
30
+
31
+ export const Primary: Story = {};
32
+
33
+ export const Tip: Story = {
34
+ args: { type: "tip" },
35
+ };
36
+
37
+ export const Important: Story = {
38
+ args: { type: "important" },
39
+ };
40
+
41
+ export const Warning: Story = {
42
+ args: { type: "warning" },
43
+ };
44
+
45
+ export const Caution: Story = {
46
+ args: { type: "caution" },
47
+ };
@@ -0,0 +1,52 @@
1
+ import { component$, Slot } from "@builder.io/qwik";
2
+
3
+ import styles from "./elm-callout.module.scss";
4
+ import {
5
+ mdiAlert,
6
+ mdiAlertOctagram,
7
+ mdiInformation,
8
+ mdiLightbulbOn,
9
+ mdiShieldAlert,
10
+ } from "@mdi/js";
11
+ import { ElmMdiIcon } from "../icon/elm-mdi-icon";
12
+ import { ElmInlineText } from "./elm-inline-text";
13
+
14
+ export type AlertType = "note" | "tip" | "important" | "warning" | "caution";
15
+
16
+ const COLOR_MAP: Record<AlertType, { code: string; icon: string }> =
17
+ Object.freeze({
18
+ note: { code: "#6987b8", icon: mdiInformation },
19
+ tip: { code: "#59b57c", icon: mdiLightbulbOn },
20
+ important: { code: "#9771bd", icon: mdiShieldAlert },
21
+ warning: { code: "#b8a36e", icon: mdiAlert },
22
+ caution: { code: "#b36472", icon: mdiAlertOctagram },
23
+ } as const);
24
+
25
+ export interface ElmCalloutProps {
26
+ /**
27
+ * Type of alert
28
+ */
29
+ type?: AlertType;
30
+ }
31
+
32
+ export const ElmCallout = component$<ElmCalloutProps>(({ type = "note" }) => {
33
+ return (
34
+ <aside
35
+ class={styles.callout}
36
+ style={{ "--callout-color": COLOR_MAP[type].code }}
37
+ >
38
+ <div class={styles.header}>
39
+ <ElmMdiIcon
40
+ d={COLOR_MAP[type].icon}
41
+ color={COLOR_MAP[type].code}
42
+ size="1.25rem"
43
+ />
44
+ <ElmInlineText>{type.toLocaleUpperCase()}</ElmInlineText>
45
+ </div>
46
+
47
+ <div class={styles.content}>
48
+ <Slot />
49
+ </div>
50
+ </aside>
51
+ );
52
+ });
@@ -0,0 +1,6 @@
1
+ .hr {
2
+ margin: 0;
3
+ width: 100%;
4
+ border: none;
5
+ border-bottom: dashed 1px #868e9c;
6
+ }
@@ -0,0 +1,14 @@
1
+ import type { Meta, StoryObj } from "storybook-framework-qwik";
2
+ import { ElmDivider } from "./elm-divider";
3
+
4
+ const meta: Meta<typeof ElmDivider> = {
5
+ title: "Components/Typography/elm-divider",
6
+ component: ElmDivider,
7
+ tags: ["autodocs"],
8
+ args: {},
9
+ };
10
+
11
+ export default meta;
12
+ type Story = StoryObj<typeof meta>;
13
+
14
+ export const Primary: Story = {};
@@ -0,0 +1,14 @@
1
+ import { component$, CSSProperties } from "@builder.io/qwik";
2
+
3
+ import styles from "./elm-divider.module.scss";
4
+
5
+ export type ElmDividerProps = {
6
+ /**
7
+ * The margin of the divider.
8
+ */
9
+ margin?: CSSProperties["margin-block"];
10
+ };
11
+
12
+ export const ElmDivider = component$<ElmDividerProps>(({ margin }) => {
13
+ return <hr class={styles.hr} style={{ marginBlock: margin }} />;
14
+ });
@@ -0,0 +1,28 @@
1
+ .fragment {
2
+ font-size: 1rem;
3
+ width: 1rem;
4
+ height: 1rem;
5
+ padding: 0.125rem;
6
+ margin-inline-start: 0.5rem;
7
+ border-radius: 0.125rem;
8
+ display: inline-flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ color: #b69545;
12
+ cursor: pointer;
13
+ user-select: none;
14
+ opacity: 1;
15
+ transition:
16
+ background-color 200ms,
17
+ opacity 100ms,
18
+ transform 100ms;
19
+
20
+ &:hover {
21
+ background-color: rgba(#868e9c, 0.2);
22
+ }
23
+
24
+ &:active {
25
+ opacity: 0.5;
26
+ transform: translateX(1px) translateY(1px);
27
+ }
28
+ }
@@ -0,0 +1,14 @@
1
+ import type { Meta, StoryObj } from "storybook-framework-qwik";
2
+ import { ElmFragmentIdentifier } from "./elm-fragment-identifier";
3
+
4
+ const meta: Meta<typeof ElmFragmentIdentifier> = {
5
+ title: "Components/Typography/elm-fragment-identifier",
6
+ component: ElmFragmentIdentifier,
7
+ tags: ["autodocs"],
8
+ args: {},
9
+ };
10
+
11
+ export default meta;
12
+ type Story = StoryObj<typeof meta>;
13
+
14
+ export const Primary: Story = {};
@@ -0,0 +1,31 @@
1
+ import { $, component$ } from "@builder.io/qwik";
2
+
3
+ import styles from "./elm-fragment-identifier.module.scss";
4
+
5
+ export interface ElmFragmentIdentifierProps {
6
+ /**
7
+ * ID of the heading element.
8
+ */
9
+ id: string;
10
+ }
11
+
12
+ export const ElmFragmentIdentifier = component$<ElmFragmentIdentifierProps>(
13
+ ({ id }) => {
14
+ const handleHashClick = $((id: string) => {
15
+ const url = new URL(window.location.href);
16
+ url.hash = id;
17
+ window.history.replaceState(null, "", url.toString());
18
+
19
+ const target = document.getElementById(id);
20
+ if (target != null) {
21
+ target.scrollIntoView({ behavior: "smooth" });
22
+ }
23
+ });
24
+
25
+ return (
26
+ <span class={styles.fragment} onClick$={() => handleHashClick(id)}>
27
+ #
28
+ </span>
29
+ );
30
+ },
31
+ );
@@ -0,0 +1,120 @@
1
+ .heading-common {
2
+ margin: 0;
3
+
4
+ position: relative;
5
+ font-size: var(--font-size);
6
+ line-height: var(--font-size);
7
+ opacity: var(--opacity);
8
+
9
+ transition:
10
+ color 400ms,
11
+ opacity 800ms;
12
+ }
13
+
14
+ .h1 {
15
+ &::after {
16
+ position: absolute;
17
+ content: "";
18
+ bottom: -4px;
19
+ left: 0;
20
+ width: 100%;
21
+ height: 0.25px;
22
+ background-color: rgba(0, 0, 0, 0.5);
23
+
24
+ transition: transform 800ms;
25
+ transform: scaleX(var(--scale));
26
+
27
+ [data-theme="dark"] & {
28
+ background-color: rgba(255, 255, 255, 0.5);
29
+ }
30
+ }
31
+
32
+ &::before {
33
+ position: absolute;
34
+ content: "";
35
+ bottom: -6px;
36
+ left: 45%;
37
+ width: 10%;
38
+ height: 2px;
39
+ background-color: rgba(0, 0, 0, 0.6);
40
+
41
+ transition: transform 800ms;
42
+ transform: scaleY(var(--scale));
43
+ transform-origin: top;
44
+
45
+ [data-theme="dark"] & {
46
+ background-color: rgba(255, 255, 255, 0.6);
47
+ }
48
+ }
49
+ }
50
+
51
+ .h2 {
52
+ border-bottom: solid 1px rgba(0, 0, 0, 0.5);
53
+
54
+ [data-theme="dark"] & {
55
+ border-color: rgba(255, 255, 255, 0.5);
56
+ }
57
+
58
+ &::after {
59
+ position: absolute;
60
+ content: "";
61
+ right: 2px;
62
+ bottom: -4px;
63
+ width: 6px;
64
+ height: 8px;
65
+ opacity: 0.8;
66
+ transform: skewX(-25deg);
67
+
68
+ background-color: rgba(0, 0, 0, 0.8);
69
+ [data-theme="dark"] & {
70
+ background-color: rgba(255, 255, 255, 0.8);
71
+ }
72
+ }
73
+
74
+ &::before {
75
+ position: absolute;
76
+ content: "";
77
+ right: 10px;
78
+ bottom: -4px;
79
+ width: 6px;
80
+ height: 8px;
81
+ opacity: 0.8;
82
+ transform: skewX(-25deg);
83
+
84
+ background-color: rgba(0, 0, 0, 0.8);
85
+ [data-theme="dark"] & {
86
+ background-color: rgba(255, 255, 255, 0.8);
87
+ }
88
+ }
89
+ }
90
+
91
+ .h3 {
92
+ box-sizing: border-box;
93
+ padding-left: 0.75rem;
94
+
95
+ &::after {
96
+ position: absolute;
97
+ content: "";
98
+ width: 3px;
99
+ height: 12px;
100
+ top: calc(50% - 8px);
101
+ left: 0;
102
+
103
+ background-color: rgba(0, 0, 0, 0.5);
104
+ [data-theme="dark"] & {
105
+ background-color: rgba(255, 255, 255, 0.5);
106
+ }
107
+ }
108
+ }
109
+
110
+ .h4 {
111
+ position: relative;
112
+ }
113
+
114
+ .h5 {
115
+ position: relative;
116
+ }
117
+
118
+ .h6 {
119
+ position: relative;
120
+ }
@@ -0,0 +1,42 @@
1
+ import type { Meta, StoryObj } from "storybook-framework-qwik";
2
+
3
+ import { ElmHeading } from "./elm-heading";
4
+ import { ElmInlineText } from "./elm-inline-text";
5
+
6
+ const meta: Meta<typeof ElmHeading> = {
7
+ title: "Components/Typography/elm-heading",
8
+ component: ElmHeading,
9
+ tags: ["autodocs"],
10
+ argTypes: {
11
+ level: {
12
+ options: [1, 2, 3, 4, 5, 6],
13
+ control: "radio",
14
+ },
15
+ },
16
+ };
17
+
18
+ export default meta;
19
+ type Story = StoryObj<typeof meta>;
20
+
21
+ export const Primary: Story = {
22
+ args: {
23
+ level: 1,
24
+ text: "Heading",
25
+ id: "heading-id",
26
+ },
27
+ };
28
+
29
+ export const Slot: Story = {
30
+ args: {
31
+ level: 1,
32
+ id: "heading-id",
33
+ },
34
+ render() {
35
+ return (
36
+ <ElmHeading {...this.args}>
37
+ <ElmInlineText text="This" color="crimson" /> is{" "}
38
+ <ElmInlineText text="code" code /> !
39
+ </ElmHeading>
40
+ );
41
+ },
42
+ };
@@ -0,0 +1,40 @@
1
+ import { component$, Slot } from "@builder.io/qwik";
2
+
3
+ import styles from "./elm-heading.module.scss";
4
+ import textStyles from "../../styles/text.module.scss";
5
+ import { ElmFragmentIdentifier } from "./elm-fragment-identifier";
6
+
7
+ export interface ElmHeadingProps {
8
+ level: 1 | 2 | 3 | 4 | 5 | 6;
9
+
10
+ text?: string;
11
+
12
+ id?: string;
13
+ }
14
+
15
+ const SIZE_MAP: Record<1 | 2 | 3 | 4 | 5 | 6, number> = Object.freeze({
16
+ 1: 1.5,
17
+ 2: 1.4,
18
+ 3: 1.3,
19
+ 4: 1.2,
20
+ 5: 1.15,
21
+ 6: 1.1,
22
+ } as const);
23
+
24
+ export const ElmHeading = component$<ElmHeadingProps>(({ level, text, id }) => {
25
+ const Tag = `h${level}` as "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
26
+ return (
27
+ <Tag
28
+ class={[styles["heading-common"], textStyles.text, styles[`h${level}`]]}
29
+ style={{ "--font-size": `${SIZE_MAP[level]}em` }}
30
+ >
31
+ {text}
32
+ <Slot />
33
+ {id && (
34
+ <span style={{ padding: "0.5rem" }}>
35
+ <ElmFragmentIdentifier id={id} />
36
+ </span>
37
+ )}
38
+ </Tag>
39
+ );
40
+ });
@@ -0,0 +1,114 @@
1
+ .text {
2
+ padding: 0;
3
+ margin: 0;
4
+ white-space: pre-line;
5
+ font-size: var(--font-size, 1em);
6
+ line-height: var(--font-size, 1em);
7
+ background-color: var(--background-color);
8
+ transition: color 200ms;
9
+ text-decoration-color: var(--color);
10
+ }
11
+
12
+ .code {
13
+ margin-inline: 0.25rem;
14
+ padding: 2px 0.5em;
15
+ font-size: calc(1em - 2px);
16
+ border-radius: 0.125rem;
17
+ background-color: rgba(0, 0, 0, 0.075);
18
+ font-family: "Source Code Pro" monospace;
19
+ }
20
+
21
+ .kbd {
22
+ padding: 0.125rem 0.25rem;
23
+ position: relative;
24
+ border-radius: 0.125rem;
25
+ background-color: #e6e6e6;
26
+
27
+ [data-theme="dark"] & {
28
+ background-color: #404040;
29
+ }
30
+
31
+ &::before {
32
+ z-index: -1;
33
+ position: absolute;
34
+ content: "";
35
+ bottom: -0.25em;
36
+ left: 0;
37
+ height: 100%;
38
+ width: 100%;
39
+ background-color: #ccc;
40
+ border-radius: 0 0 0.125rem 0.125rem;
41
+ box-shadow: 0 0 0.125em rgba(black, 0.5);
42
+
43
+ [data-theme="dark"] & {
44
+ background-color: #595959;
45
+ box-shadow: 0 0 0.125em rgba(white, 0.5);
46
+ }
47
+ }
48
+ }
49
+
50
+ .link {
51
+ all: unset;
52
+ box-sizing: border-box;
53
+ padding: 0 0.25rem;
54
+ font-size: var(--font-size);
55
+ display: inline-flex;
56
+ align-items: center;
57
+ gap: 0.25rem;
58
+ cursor: pointer;
59
+ color: #6987b8;
60
+ border-radius: 0.125rem;
61
+ transition:
62
+ background-color 200ms,
63
+ color 200ms,
64
+ opacity 200ms;
65
+
66
+ &:hover {
67
+ background-color: rgba($color: #6987b8, $alpha: 0.2);
68
+ }
69
+
70
+ &:active {
71
+ opacity: 0.5;
72
+ }
73
+
74
+ &:visited {
75
+ color: #9771bd;
76
+ border-bottom: dashed 1px #9771bd;
77
+
78
+ &:hover {
79
+ background-color: rgba($color: #9771bd, $alpha: 0.2);
80
+ }
81
+ }
82
+ }
83
+
84
+ .ogp {
85
+ display: flex;
86
+ flex-direction: column;
87
+ gap: 0.25rem;
88
+ overflow: hidden;
89
+
90
+ border-radius: 0.25rem;
91
+ box-shadow: 0 0 0.125rem rgba(black, 0.3);
92
+
93
+ background-color: rgba(white, 0.8);
94
+
95
+ [data-theme="dark"] & {
96
+ background-color: rgba(white, 0.1);
97
+ }
98
+ }
99
+
100
+ .ogp-text {
101
+ box-sizing: border-box;
102
+ padding: 0.5rem;
103
+ }
104
+
105
+ .ogp-title {
106
+ box-sizing: border-box;
107
+ font-weight: bold;
108
+ padding-block-end: 0.25rem;
109
+ }
110
+
111
+ .ogp-description {
112
+ opacity: 0.7;
113
+ padding: 0.25rem;
114
+ }
@@ -0,0 +1,70 @@
1
+ import type { Meta, StoryObj } from "storybook-framework-qwik";
2
+ import { ElmInlineText } from "./elm-inline-text";
3
+ import { opacify } from "polished";
4
+
5
+ const meta: Meta<typeof ElmInlineText> = {
6
+ title: "Components/Typography/elm-inline-text",
7
+ component: ElmInlineText,
8
+ tags: ["autodocs"],
9
+ argTypes: {
10
+ color: { control: "color" },
11
+ backgroundColor: { control: "color" },
12
+ bold: { control: "boolean" },
13
+ italic: { control: "boolean" },
14
+ underline: { control: "boolean" },
15
+ strikethrough: { control: "boolean" },
16
+ code: { control: "boolean" },
17
+ kbd: { control: "boolean" },
18
+ },
19
+
20
+ args: {
21
+ text: "Inline Text",
22
+ bold: false,
23
+ italic: false,
24
+ underline: false,
25
+ strikethrough: false,
26
+ code: false,
27
+ kbd: false,
28
+ },
29
+ };
30
+
31
+ export default meta;
32
+ type Story = StoryObj<typeof meta>;
33
+
34
+ export const Primary: Story = {};
35
+
36
+ export const Colored: Story = {
37
+ args: { color: "#b36472" },
38
+ };
39
+
40
+ export const Code: Story = {
41
+ args: { code: true, text: "const x = 10;" },
42
+ };
43
+
44
+ export const Kbd: Story = {
45
+ args: { text: "Ctrl", kbd: true },
46
+ };
47
+
48
+ export const Background: Story = {
49
+ args: { backgroundColor: opacify(-0.5, "#6987b8") },
50
+ };
51
+
52
+ export const Ruby: Story = {
53
+ args: { text: "国際連合", ruby: "こくさいれんごう" },
54
+ };
55
+
56
+ export const Link: Story = {
57
+ args: {
58
+ text: "Google Search",
59
+ href: "https://google.com",
60
+ favicon: "https://www.google.com/favicon.ico",
61
+ },
62
+ };
63
+
64
+ export const LinkWithOgp: Story = {
65
+ args: {
66
+ text: "Visual Studio Code - Code Editing. Redefined",
67
+ href: "https://code.visualstudio.com/",
68
+ favicon: "https://code.visualstudio.com/assets/favicon.ico",
69
+ },
70
+ };