@elmethis/qwik 0.0.6 → 0.0.8
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/lib/index.qwik.cjs +1678 -0
- package/lib/index.qwik.mjs +1678 -0
- package/lib/shikiInstance-BxkUyfqr.cjs +79 -0
- package/{src/components/code/shikiInstance.ts → lib/shikiInstance-igs7t2fe.js} +11 -8
- package/lib-types/components/code/elm-code-block.d.ts +21 -0
- package/lib-types/components/code/elm-code-block.stories.d.ts +9 -0
- package/lib-types/components/code/elm-katex.d.ts +15 -0
- package/lib-types/components/code/elm-katex.stories.d.ts +8 -0
- package/lib-types/components/code/elm-shiki-highlighter.d.ts +11 -0
- package/lib-types/components/code/elm-shiki-highlighter.stories.d.ts +6 -0
- package/lib-types/components/code/shikiInstance.d.ts +2 -0
- package/lib-types/components/containments/elm-toggle.d.ts +7 -0
- package/lib-types/components/containments/elm-toggle.stories.d.ts +6 -0
- package/lib-types/components/fallback/elm-block-fallback.d.ts +5 -0
- package/lib-types/components/fallback/elm-block-fallback.stories.d.ts +6 -0
- package/lib-types/components/fallback/elm-rectangle-wave.d.ts +4 -0
- package/lib-types/components/fallback/elm-rectangle-wave.stories.d.ts +6 -0
- package/lib-types/components/icon/elm-dot-loading-icon.d.ts +14 -0
- package/lib-types/components/icon/elm-dot-loading-icon.stories.d.ts +6 -0
- package/lib-types/components/icon/elm-inline-icon.d.ts +11 -0
- package/lib-types/components/icon/elm-inline-icon.stories.d.ts +6 -0
- package/lib-types/components/icon/elm-language-icon.d.ts +14 -0
- package/lib-types/components/icon/elm-language-icon.stories.d.ts +6 -0
- package/lib-types/components/icon/elm-mdi-icon.d.ts +8 -0
- package/lib-types/components/icon/elm-mdi-icon.stories.d.ts +6 -0
- package/lib-types/components/icon/languages/bash.d.ts +2 -0
- package/lib-types/components/icon/languages/c-plus-plus.d.ts +2 -0
- package/lib-types/components/icon/languages/c-sharp.d.ts +2 -0
- package/lib-types/components/icon/languages/c.d.ts +2 -0
- package/lib-types/components/icon/languages/css.d.ts +2 -0
- package/lib-types/components/icon/languages/go.d.ts +2 -0
- package/lib-types/components/icon/languages/html.d.ts +2 -0
- package/lib-types/components/icon/languages/java.d.ts +2 -0
- package/lib-types/components/icon/languages/javascript.d.ts +2 -0
- package/lib-types/components/icon/languages/json.d.ts +2 -0
- package/lib-types/components/icon/languages/kotlin.d.ts +2 -0
- package/lib-types/components/icon/languages/language-interface.d.ts +4 -0
- package/lib-types/components/icon/languages/lua.d.ts +2 -0
- package/lib-types/components/icon/languages/npm.d.ts +2 -0
- package/lib-types/components/icon/languages/python.d.ts +2 -0
- package/lib-types/components/icon/languages/rust.d.ts +2 -0
- package/lib-types/components/icon/languages/sql.d.ts +2 -0
- package/lib-types/components/icon/languages/terraform.d.ts +2 -0
- package/lib-types/components/icon/languages/typescript.d.ts +2 -0
- package/lib-types/components/media/elm-block-image.d.ts +16 -0
- package/lib-types/components/media/elm-block-image.stories.d.ts +12 -0
- package/lib-types/components/media/elm-file.d.ts +15 -0
- package/lib-types/components/media/elm-file.stories.d.ts +7 -0
- package/lib-types/components/navigation/elm-bookmark.d.ts +24 -0
- package/lib-types/components/navigation/elm-bookmark.stories.d.ts +12 -0
- package/lib-types/components/others/elm-jarkup.d.ts +5 -0
- package/lib-types/components/others/elm-jarkup.stories.d.ts +6 -0
- package/lib-types/components/table/elm-table-body.d.ts +2 -0
- package/lib-types/components/table/elm-table-cell.d.ts +12 -0
- package/lib-types/components/table/elm-table-header.d.ts +3 -0
- package/lib-types/components/table/elm-table-row.d.ts +2 -0
- package/lib-types/components/table/elm-table.d.ts +13 -0
- package/lib-types/components/table/elm-table.stories.d.ts +6 -0
- package/lib-types/components/typography/elm-block-quote.d.ts +4 -0
- package/lib-types/components/typography/elm-block-quote.stories.d.ts +6 -0
- package/lib-types/components/typography/elm-callout.d.ts +8 -0
- package/lib-types/components/typography/elm-callout.stories.d.ts +10 -0
- package/lib-types/components/typography/elm-divider.d.ts +8 -0
- package/lib-types/components/typography/elm-divider.stories.d.ts +6 -0
- package/lib-types/components/typography/elm-fragment-identifier.d.ts +7 -0
- package/lib-types/components/typography/elm-fragment-identifier.stories.d.ts +6 -0
- package/lib-types/components/typography/elm-heading.d.ts +6 -0
- package/lib-types/components/typography/elm-heading.stories.d.ts +7 -0
- package/lib-types/components/typography/elm-inline-text.d.ts +54 -0
- package/lib-types/components/typography/elm-inline-text.stories.d.ts +13 -0
- package/lib-types/components/typography/elm-list.d.ts +4 -0
- package/lib-types/components/typography/elm-list.stories.d.ts +8 -0
- package/lib-types/components/typography/elm-paragraph.d.ts +5 -0
- package/lib-types/components/typography/elm-paragraph.stories.d.ts +9 -0
- package/lib-types/entry.dev.d.ts +2 -0
- package/{src/entry.ssr.tsx → lib-types/entry.ssr.d.ts} +2 -9
- package/lib-types/hooks/useDelayedSignal.d.ts +6 -0
- package/lib-types/hooks/useInView.d.ts +6 -0
- package/lib-types/index.d.ts +27 -0
- package/lib-types/root.d.ts +2 -0
- package/package.json +5 -1
- package/.prettierignore +0 -6
- package/.storybook/main.ts +0 -23
- package/.storybook/preview-head.html +0 -4
- package/.storybook/preview.tsx +0 -51
- package/.storybook/sb.scss +0 -13
- package/.storybook/tsconfig.json +0 -24
- package/eslint.config.js +0 -79
- package/src/assets/bg1.webp +0 -0
- package/src/assets/bg2.webp +0 -0
- package/src/assets/images/2.svg +0 -4
- package/src/assets/images/lamdscape.svg +0 -4
- package/src/assets/images/portrait.svg +0 -4
- package/src/assets/images/square.svg +0 -4
- package/src/assets/vite.svg +0 -1
- package/src/assets/vue.svg +0 -1
- package/src/components/code/elm-code-block.module.scss +0 -67
- package/src/components/code/elm-code-block.stories.tsx +0 -44
- package/src/components/code/elm-code-block.tsx +0 -95
- package/src/components/code/elm-katex.stories.tsx +0 -28
- package/src/components/code/elm-katex.tsx +0 -34
- package/src/components/code/elm-shiki-highlighter.global.scss +0 -18
- package/src/components/code/elm-shiki-highlighter.stories.tsx +0 -21
- package/src/components/code/elm-shiki-highlighter.tsx +0 -44
- package/src/components/code/seed/main.rs +0 -24
- package/src/components/containments/elm-toggle.module.scss +0 -132
- package/src/components/containments/elm-toggle.stories.tsx +0 -34
- package/src/components/containments/elm-toggle.tsx +0 -106
- package/src/components/fallback/elm-block-fallback.module.scss +0 -8
- package/src/components/fallback/elm-block-fallback.stories.tsx +0 -14
- package/src/components/fallback/elm-block-fallback.tsx +0 -20
- package/src/components/fallback/elm-rectangle-wave.module.scss +0 -42
- package/src/components/fallback/elm-rectangle-wave.stories.tsx +0 -28
- package/src/components/fallback/elm-rectangle-wave.tsx +0 -11
- package/src/components/icon/elm-dot-loading-icon.module.scss +0 -53
- package/src/components/icon/elm-dot-loading-icon.stories.tsx +0 -15
- package/src/components/icon/elm-dot-loading-icon.tsx +0 -35
- package/src/components/icon/elm-inline-icon.module.scss +0 -21
- package/src/components/icon/elm-inline-icon.stories.tsx +0 -16
- package/src/components/icon/elm-inline-icon.tsx +0 -25
- package/src/components/icon/elm-language-icon.stories.tsx +0 -22
- package/src/components/icon/elm-language-icon.tsx +0 -167
- package/src/components/icon/elm-mdi-icon.module.scss +0 -8
- package/src/components/icon/elm-mdi-icon.stories.tsx +0 -25
- package/src/components/icon/elm-mdi-icon.tsx +0 -34
- package/src/components/icon/languages/bash.module.scss +0 -6
- package/src/components/icon/languages/bash.tsx +0 -27
- package/src/components/icon/languages/c-plus-plus.tsx +0 -33
- package/src/components/icon/languages/c-sharp.tsx +0 -29
- package/src/components/icon/languages/c.tsx +0 -27
- package/src/components/icon/languages/css.tsx +0 -21
- package/src/components/icon/languages/go.tsx +0 -22
- package/src/components/icon/languages/html.tsx +0 -30
- package/src/components/icon/languages/java.tsx +0 -37
- package/src/components/icon/languages/javascript.tsx +0 -22
- package/src/components/icon/languages/json.tsx +0 -53
- package/src/components/icon/languages/kotlin.tsx +0 -36
- package/src/components/icon/languages/language-interface.ts +0 -4
- package/src/components/icon/languages/lua.tsx +0 -29
- package/src/components/icon/languages/npm.tsx +0 -25
- package/src/components/icon/languages/python.tsx +0 -67
- package/src/components/icon/languages/rust.tsx +0 -19
- package/src/components/icon/languages/sql.tsx +0 -21
- package/src/components/icon/languages/terraform.tsx +0 -31
- package/src/components/icon/languages/typescript.tsx +0 -22
- package/src/components/media/elm-block-image.module.scss +0 -68
- package/src/components/media/elm-block-image.stories.tsx +0 -79
- package/src/components/media/elm-block-image.tsx +0 -110
- package/src/components/media/elm-file.module.scss +0 -43
- package/src/components/media/elm-file.stories.tsx +0 -27
- package/src/components/media/elm-file.tsx +0 -75
- package/src/components/navigation/elm-bookmark.module.scss +0 -100
- package/src/components/navigation/elm-bookmark.stories.tsx +0 -87
- package/src/components/navigation/elm-bookmark.tsx +0 -72
- package/src/components/others/elm-jarkup.module.scss +0 -26
- package/src/components/others/elm-jarkup.stories.tsx +0 -18
- package/src/components/others/elm-jarkup.tsx +0 -267
- package/src/components/table/elm-table-body.tsx +0 -14
- package/src/components/table/elm-table-cell.module.scss +0 -41
- package/src/components/table/elm-table-cell.tsx +0 -33
- package/src/components/table/elm-table-header.module.scss +0 -8
- package/src/components/table/elm-table-header.tsx +0 -21
- package/src/components/table/elm-table-row.module.scss +0 -28
- package/src/components/table/elm-table-row.tsx +0 -15
- package/src/components/table/elm-table.module.scss +0 -29
- package/src/components/table/elm-table.stories.tsx +0 -67
- package/src/components/table/elm-table.tsx +0 -63
- package/src/components/typography/elm-block-quote.module.scss +0 -29
- package/src/components/typography/elm-block-quote.stories.tsx +0 -22
- package/src/components/typography/elm-block-quote.tsx +0 -34
- package/src/components/typography/elm-callout.module.scss +0 -36
- package/src/components/typography/elm-callout.stories.tsx +0 -47
- package/src/components/typography/elm-callout.tsx +0 -52
- package/src/components/typography/elm-divider.module.scss +0 -6
- package/src/components/typography/elm-divider.stories.tsx +0 -14
- package/src/components/typography/elm-divider.tsx +0 -14
- package/src/components/typography/elm-fragment-identifier.module.scss +0 -28
- package/src/components/typography/elm-fragment-identifier.stories.tsx +0 -14
- package/src/components/typography/elm-fragment-identifier.tsx +0 -31
- package/src/components/typography/elm-heading.module.scss +0 -120
- package/src/components/typography/elm-heading.stories.tsx +0 -42
- package/src/components/typography/elm-heading.tsx +0 -40
- package/src/components/typography/elm-inline-text.module.scss +0 -114
- package/src/components/typography/elm-inline-text.stories.tsx +0 -70
- package/src/components/typography/elm-inline-text.tsx +0 -147
- package/src/components/typography/elm-list.global.scss +0 -66
- package/src/components/typography/elm-list.stories.tsx +0 -61
- package/src/components/typography/elm-list.tsx +0 -39
- package/src/components/typography/elm-paragraph.module.scss +0 -21
- package/src/components/typography/elm-paragraph.stories.tsx +0 -47
- package/src/components/typography/elm-paragraph.tsx +0 -31
- package/src/entry.dev.tsx +0 -17
- package/src/global.d.ts +0 -13
- package/src/hooks/useDelayedSignal.ts +0 -27
- package/src/hooks/useInView.tsx +0 -23
- package/src/index.ts +0 -113
- package/src/root.tsx +0 -13
- package/src/styles/text.module.scss +0 -17
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -21
- package/vite.config.ts +0 -36
- /package/{src/components/table/index.ts → lib-types/components/table/index.d.ts} +0 -0
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import { component$, type JSXOutput } from "@builder.io/qwik";
|
|
2
|
-
import type { Component, InlineComponent } from "jarkup-ts";
|
|
3
|
-
import { kebabCase } from "lodash-es";
|
|
4
|
-
|
|
5
|
-
import styles from "./elm-jarkup.module.scss";
|
|
6
|
-
|
|
7
|
-
import { ElmInlineText } from "../typography/elm-inline-text";
|
|
8
|
-
import { ElmKatex } from "../code/elm-katex";
|
|
9
|
-
import { ElmInlineIcon } from "../icon/elm-inline-icon";
|
|
10
|
-
import { ElmHeading } from "../typography/elm-heading";
|
|
11
|
-
import { ElmParagraph } from "../typography/elm-paragraph";
|
|
12
|
-
import { ElmList } from "../typography/elm-list";
|
|
13
|
-
import { ElmBlockQuote } from "../typography/elm-block-quote";
|
|
14
|
-
import { ElmCallout } from "../typography/elm-callout";
|
|
15
|
-
import { ElmDivider } from "../typography/elm-divider";
|
|
16
|
-
import { ElmToggle } from "../containments/elm-toggle";
|
|
17
|
-
import { ElmBookmark } from "../navigation/elm-bookmark";
|
|
18
|
-
import { ElmFile } from "../media/elm-file";
|
|
19
|
-
import { ElmBlockImage } from "../media/elm-block-image";
|
|
20
|
-
import { ElmCodeBlock } from "../code/elm-code-block";
|
|
21
|
-
import {
|
|
22
|
-
ElmTable,
|
|
23
|
-
ElmTableHeader,
|
|
24
|
-
ElmTableBody,
|
|
25
|
-
ElmTableRow,
|
|
26
|
-
ElmTableCell,
|
|
27
|
-
} from "../table";
|
|
28
|
-
|
|
29
|
-
export interface ElmJarkupProps {
|
|
30
|
-
jsonComponents: Component[];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const convertInlineComponentsToPlainText = (
|
|
34
|
-
inlineComponents: InlineComponent[],
|
|
35
|
-
): string => {
|
|
36
|
-
return inlineComponents
|
|
37
|
-
.map((component) => {
|
|
38
|
-
if (component.type === "Text") {
|
|
39
|
-
return component.props.text;
|
|
40
|
-
} else {
|
|
41
|
-
return "";
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
.join("");
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const ElmJarkup = component$<ElmJarkupProps>((props) => {
|
|
48
|
-
const render = (jsonComponents: Component[]): JSXOutput[] => {
|
|
49
|
-
return jsonComponents.map((component, index) => {
|
|
50
|
-
const key = component.id || index;
|
|
51
|
-
|
|
52
|
-
switch (component.type) {
|
|
53
|
-
case "Text": {
|
|
54
|
-
const { props: p } = component;
|
|
55
|
-
if (p.katex) {
|
|
56
|
-
return <ElmKatex key={key} expression={p.text} block={false} />;
|
|
57
|
-
}
|
|
58
|
-
return (
|
|
59
|
-
<ElmInlineText
|
|
60
|
-
key={key}
|
|
61
|
-
text={p.text}
|
|
62
|
-
color={p.color}
|
|
63
|
-
backgroundColor={p.backgroundColor}
|
|
64
|
-
bold={p.bold}
|
|
65
|
-
italic={p.italic}
|
|
66
|
-
underline={p.underline}
|
|
67
|
-
strikethrough={p.strikethrough}
|
|
68
|
-
code={p.code}
|
|
69
|
-
ruby={p.ruby}
|
|
70
|
-
href={p.href}
|
|
71
|
-
favicon={p.favicon}
|
|
72
|
-
/>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
case "Icon":
|
|
77
|
-
return (
|
|
78
|
-
<ElmInlineIcon
|
|
79
|
-
key={key}
|
|
80
|
-
src={component.props.src}
|
|
81
|
-
alt={component.props.alt}
|
|
82
|
-
/>
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
case "Heading":
|
|
86
|
-
return (
|
|
87
|
-
<ElmHeading
|
|
88
|
-
key={key}
|
|
89
|
-
level={component.props.level}
|
|
90
|
-
id={kebabCase(
|
|
91
|
-
convertInlineComponentsToPlainText(component.slots.default),
|
|
92
|
-
)}
|
|
93
|
-
>
|
|
94
|
-
{render(component.slots.default)}
|
|
95
|
-
</ElmHeading>
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
case "Paragraph":
|
|
99
|
-
return (
|
|
100
|
-
<ElmParagraph
|
|
101
|
-
key={key}
|
|
102
|
-
color={component.props?.color}
|
|
103
|
-
backgroundColor={component.props?.backgroundColor}
|
|
104
|
-
>
|
|
105
|
-
{render(component.slots.default)}
|
|
106
|
-
</ElmParagraph>
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
case "ListItem":
|
|
110
|
-
return <li key={key}>{render(component.slots.default)}</li>;
|
|
111
|
-
|
|
112
|
-
case "List":
|
|
113
|
-
return (
|
|
114
|
-
<ElmList
|
|
115
|
-
key={key}
|
|
116
|
-
listStyle={
|
|
117
|
-
component.props?.listStyle === "unordered"
|
|
118
|
-
? "unordered"
|
|
119
|
-
: "ordered"
|
|
120
|
-
}
|
|
121
|
-
>
|
|
122
|
-
{render(component.slots.default)}
|
|
123
|
-
</ElmList>
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
case "BlockQuote":
|
|
127
|
-
return (
|
|
128
|
-
<ElmBlockQuote key={key} cite={component.props?.cite}>
|
|
129
|
-
{render(component.slots.default)}
|
|
130
|
-
</ElmBlockQuote>
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
case "Callout":
|
|
134
|
-
return (
|
|
135
|
-
<ElmCallout key={key} type={component.props?.type}>
|
|
136
|
-
{render(component.slots.default)}
|
|
137
|
-
</ElmCallout>
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
case "Divider":
|
|
141
|
-
return <ElmDivider key={key} />;
|
|
142
|
-
|
|
143
|
-
case "Toggle":
|
|
144
|
-
return (
|
|
145
|
-
<ElmToggle key={key}>
|
|
146
|
-
<div q:slot="summary">{render(component.slots.summary)}</div>
|
|
147
|
-
{render(component.slots.default)}
|
|
148
|
-
</ElmToggle>
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
case "Bookmark":
|
|
152
|
-
return (
|
|
153
|
-
<ElmBookmark
|
|
154
|
-
key={key}
|
|
155
|
-
url={component.props.url}
|
|
156
|
-
title={component.props.title}
|
|
157
|
-
description={component.props.description}
|
|
158
|
-
image={component.props.image}
|
|
159
|
-
/>
|
|
160
|
-
);
|
|
161
|
-
|
|
162
|
-
case "File":
|
|
163
|
-
return (
|
|
164
|
-
<ElmFile
|
|
165
|
-
key={key}
|
|
166
|
-
src={component.props.src}
|
|
167
|
-
name={component.props.name}
|
|
168
|
-
/>
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
case "Image":
|
|
172
|
-
return (
|
|
173
|
-
<ElmBlockImage
|
|
174
|
-
key={key}
|
|
175
|
-
src={component.props.src}
|
|
176
|
-
alt={component.props.alt}
|
|
177
|
-
enableModal={true}
|
|
178
|
-
/>
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
case "CodeBlock":
|
|
182
|
-
return (
|
|
183
|
-
<ElmCodeBlock
|
|
184
|
-
key={key}
|
|
185
|
-
code={component.props.code}
|
|
186
|
-
language={component.props.language}
|
|
187
|
-
>
|
|
188
|
-
{component.slots?.default && render(component.slots.default)}
|
|
189
|
-
</ElmCodeBlock>
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
case "Katex":
|
|
193
|
-
return (
|
|
194
|
-
<ElmKatex
|
|
195
|
-
key={key}
|
|
196
|
-
expression={component.props.expression}
|
|
197
|
-
block={true}
|
|
198
|
-
/>
|
|
199
|
-
);
|
|
200
|
-
|
|
201
|
-
case "Table":
|
|
202
|
-
return (
|
|
203
|
-
<ElmTable
|
|
204
|
-
key={key}
|
|
205
|
-
caption={component.props?.caption}
|
|
206
|
-
hasRowHeader={component.props?.hasRowHeader}
|
|
207
|
-
>
|
|
208
|
-
{component.slots.header && (
|
|
209
|
-
<ElmTableHeader>
|
|
210
|
-
{render(component.slots.header)}
|
|
211
|
-
</ElmTableHeader>
|
|
212
|
-
)}
|
|
213
|
-
<ElmTableBody>{render(component.slots.body)}</ElmTableBody>
|
|
214
|
-
</ElmTable>
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
case "TableRow":
|
|
218
|
-
return (
|
|
219
|
-
<ElmTableRow key={key}>
|
|
220
|
-
{render(component.slots.default)}
|
|
221
|
-
</ElmTableRow>
|
|
222
|
-
);
|
|
223
|
-
|
|
224
|
-
case "TableCell":
|
|
225
|
-
return (
|
|
226
|
-
<ElmTableCell key={key}>
|
|
227
|
-
{render(component.slots.default)}
|
|
228
|
-
</ElmTableCell>
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
case "ColumnList":
|
|
232
|
-
return (
|
|
233
|
-
<div key={key} class={styles["column-list"]}>
|
|
234
|
-
{render(component.slots.default)}
|
|
235
|
-
</div>
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
case "Column":
|
|
239
|
-
return (
|
|
240
|
-
<div
|
|
241
|
-
key={key}
|
|
242
|
-
class={styles.column}
|
|
243
|
-
style={{
|
|
244
|
-
"--width-ratio": component.props?.widthRatio || 1,
|
|
245
|
-
width: component.props?.widthRatio
|
|
246
|
-
? `${component.props.widthRatio * 100}%`
|
|
247
|
-
: undefined,
|
|
248
|
-
}}
|
|
249
|
-
>
|
|
250
|
-
{render(component.slots.default)}
|
|
251
|
-
</div>
|
|
252
|
-
);
|
|
253
|
-
|
|
254
|
-
default:
|
|
255
|
-
return (
|
|
256
|
-
<div key={key} style={{ color: "red", border: "1px solid red" }}>
|
|
257
|
-
Unsupported component type: {component.type}
|
|
258
|
-
</div>
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
return (
|
|
265
|
-
<div class={styles["jarkup-body"]}>{render(props.jsonComponents)}</div>
|
|
266
|
-
);
|
|
267
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { component$, Slot, useContextProvider } from "@builder.io/qwik";
|
|
2
|
-
import { HasHeaderContext } from "./elm-table-header";
|
|
3
|
-
|
|
4
|
-
export type ElmTableBodyProps = object;
|
|
5
|
-
|
|
6
|
-
export const ElmTableBody = component$<ElmTableBodyProps>(() => {
|
|
7
|
-
useContextProvider(HasHeaderContext, false);
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<tbody>
|
|
11
|
-
<Slot />
|
|
12
|
-
</tbody>
|
|
13
|
-
);
|
|
14
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
.common {
|
|
2
|
-
padding: 0.75rem 1rem;
|
|
3
|
-
|
|
4
|
-
color: rgba(black, 0.7);
|
|
5
|
-
|
|
6
|
-
border-right: 1px dotted rgba(black, 0.15);
|
|
7
|
-
|
|
8
|
-
&::selection {
|
|
9
|
-
color: rgba(white, 0.7);
|
|
10
|
-
background-color: rgba(black, 0.7);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
[data-theme="dark"] & {
|
|
14
|
-
color: rgba(white, 0.7);
|
|
15
|
-
|
|
16
|
-
&::selection {
|
|
17
|
-
color: rgba(black, 0.7);
|
|
18
|
-
background-color: rgba(white, 0.7);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
[data-theme="dark"] & {
|
|
23
|
-
border-right: 1px dotted rgba(white, 0.15);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&:last-child {
|
|
27
|
-
border-right: none;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.td {
|
|
32
|
-
border-top: 1px solid rgba(black, 0.15);
|
|
33
|
-
|
|
34
|
-
[data-theme="dark"] & {
|
|
35
|
-
border-top-color: rgba(white, 0.15);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.th {
|
|
40
|
-
background-color: rgba(gray, 0.15);
|
|
41
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { component$, Slot, useContext } from "@builder.io/qwik";
|
|
2
|
-
import styles from "./elm-table-cell.module.scss";
|
|
3
|
-
import { HasHeaderContext } from "./elm-table-header";
|
|
4
|
-
|
|
5
|
-
export interface ElmTableCellProps {
|
|
6
|
-
/**
|
|
7
|
-
* Whether the cell is a header cell.
|
|
8
|
-
*/
|
|
9
|
-
hasHeader?: boolean;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* The text content of the cell.
|
|
13
|
-
* If not provided, the cell will render its children as content.
|
|
14
|
-
*/
|
|
15
|
-
text?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const ElmTableCell = component$<ElmTableCellProps>((props) => {
|
|
19
|
-
const { hasHeader = false, text } = props;
|
|
20
|
-
const hasHeaderInjected = useContext(HasHeaderContext, false);
|
|
21
|
-
|
|
22
|
-
const isHeader = hasHeader || (hasHeaderInjected as boolean | undefined);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<>
|
|
26
|
-
{isHeader ? (
|
|
27
|
-
<th class={[styles.common, styles.th]}>{text ? text : <Slot />}</th>
|
|
28
|
-
) : (
|
|
29
|
-
<td class={[styles.common, styles.td]}>{text ? text : <Slot />}</td>
|
|
30
|
-
)}
|
|
31
|
-
</>
|
|
32
|
-
);
|
|
33
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
component$,
|
|
3
|
-
Slot,
|
|
4
|
-
createContextId,
|
|
5
|
-
useContextProvider,
|
|
6
|
-
} from "@builder.io/qwik";
|
|
7
|
-
import styles from "./elm-table-header.module.scss";
|
|
8
|
-
|
|
9
|
-
export const HasHeaderContext = createContextId<boolean>("HasHeaderContext");
|
|
10
|
-
|
|
11
|
-
export type ElmTableHeaderProps = object;
|
|
12
|
-
|
|
13
|
-
export const ElmTableHeader = component$<ElmTableHeaderProps>(() => {
|
|
14
|
-
useContextProvider(HasHeaderContext, true);
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<thead class={styles.thead}>
|
|
18
|
-
<Slot />
|
|
19
|
-
</thead>
|
|
20
|
-
);
|
|
21
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
.tr {
|
|
2
|
-
transition: background-color 200ms;
|
|
3
|
-
|
|
4
|
-
&:nth-child(odd) {
|
|
5
|
-
background-color: transparent;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
&:nth-child(even) {
|
|
9
|
-
background-color: rgba(black, 0.015);
|
|
10
|
-
[data-theme="dark"] & {
|
|
11
|
-
background-color: rgba(white, 0.015);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
&:hover {
|
|
16
|
-
background-color: rgba(#6987b8, 0.15);
|
|
17
|
-
[data-theme="dark"] & {
|
|
18
|
-
background-color: rgba(#6987b8, 0.15);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.has-row-header {
|
|
24
|
-
td:first-child,
|
|
25
|
-
tr:first-child {
|
|
26
|
-
background-color: rgba(gray, 0.15);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { component$, Slot, useContext } from "@builder.io/qwik";
|
|
2
|
-
import styles from "./elm-table-row.module.scss";
|
|
3
|
-
import { HasRowHeaderContext } from "./elm-table";
|
|
4
|
-
|
|
5
|
-
export type ElmTableRowProps = object;
|
|
6
|
-
|
|
7
|
-
export const ElmTableRow = component$<ElmTableRowProps>(() => {
|
|
8
|
-
const hasRowHeader = useContext(HasRowHeaderContext);
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<tr class={[styles.tr, hasRowHeader.value && styles["has-row-header"]]}>
|
|
12
|
-
<Slot />
|
|
13
|
-
</tr>
|
|
14
|
-
);
|
|
15
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
.table {
|
|
2
|
-
margin-block: var(--margin-block);
|
|
3
|
-
border-collapse: collapse;
|
|
4
|
-
border-spacing: 0;
|
|
5
|
-
box-shadow: 0 0 0.125rem rgba(black, 0.2);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.caption {
|
|
9
|
-
position: relative;
|
|
10
|
-
width: 100%;
|
|
11
|
-
display: inline-flex;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
align-items: center;
|
|
14
|
-
gap: 1rem;
|
|
15
|
-
margin-block-end: 1rem;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.caption-inner {
|
|
19
|
-
display: inline-flex;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
align-items: center;
|
|
22
|
-
gap: 0.25rem;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.spacing {
|
|
26
|
-
flex-grow: 1;
|
|
27
|
-
height: 1px;
|
|
28
|
-
background-color: rgba(gray, 0.2);
|
|
29
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "storybook-framework-qwik";
|
|
2
|
-
import { ElmTable } from "./elm-table";
|
|
3
|
-
import { ElmTableHeader } from "./elm-table-header";
|
|
4
|
-
import { ElmTableBody } from "./elm-table-body";
|
|
5
|
-
import { ElmTableRow } from "./elm-table-row";
|
|
6
|
-
import { ElmTableCell } from "./elm-table-cell";
|
|
7
|
-
|
|
8
|
-
const meta: Meta<typeof ElmTable> = {
|
|
9
|
-
title: "Components/Table/elm-table",
|
|
10
|
-
component: ElmTable,
|
|
11
|
-
tags: ["autodocs"],
|
|
12
|
-
args: {
|
|
13
|
-
caption: "Example Table",
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default meta;
|
|
18
|
-
type Story = StoryObj<typeof meta>;
|
|
19
|
-
|
|
20
|
-
export const Primary: Story = {
|
|
21
|
-
render() {
|
|
22
|
-
return (
|
|
23
|
-
<ElmTable {...this.args}>
|
|
24
|
-
<ElmTableHeader>
|
|
25
|
-
<ElmTableRow>
|
|
26
|
-
<ElmTableCell hasHeader text="Header 1" />
|
|
27
|
-
<ElmTableCell hasHeader text="Header 2" />
|
|
28
|
-
<ElmTableCell hasHeader text="Header 3" />
|
|
29
|
-
<ElmTableCell hasHeader text="Header 4" />
|
|
30
|
-
<ElmTableCell hasHeader text="Header 5" />
|
|
31
|
-
</ElmTableRow>
|
|
32
|
-
</ElmTableHeader>
|
|
33
|
-
|
|
34
|
-
<ElmTableBody>
|
|
35
|
-
<ElmTableRow>
|
|
36
|
-
<ElmTableCell text="Row 1, Cell 1" />
|
|
37
|
-
<ElmTableCell text="Row 1, Cell 2" />
|
|
38
|
-
<ElmTableCell text="Row 1, Cell 3" />
|
|
39
|
-
<ElmTableCell text="Row 1, Cell 4" />
|
|
40
|
-
<ElmTableCell text="Row 1, Cell 5" />
|
|
41
|
-
</ElmTableRow>
|
|
42
|
-
<ElmTableRow>
|
|
43
|
-
<ElmTableCell text="Row 2, Cell 1" />
|
|
44
|
-
<ElmTableCell text="Row 2, Cell 2" />
|
|
45
|
-
<ElmTableCell text="Row 2, Cell 3" />
|
|
46
|
-
<ElmTableCell text="Row 2, Cell 4" />
|
|
47
|
-
<ElmTableCell text="Row 2, Cell 5" />
|
|
48
|
-
</ElmTableRow>
|
|
49
|
-
<ElmTableRow>
|
|
50
|
-
<ElmTableCell text="Row 3, Cell 1" />
|
|
51
|
-
<ElmTableCell text="Row 3, Cell 2" />
|
|
52
|
-
<ElmTableCell text="Row 3, Cell 3" />
|
|
53
|
-
<ElmTableCell text="Row 3, Cell 4" />
|
|
54
|
-
<ElmTableCell text="Row 3, Cell 5" />
|
|
55
|
-
</ElmTableRow>
|
|
56
|
-
<ElmTableRow>
|
|
57
|
-
<ElmTableCell text="Row 4, Cell 1" />
|
|
58
|
-
<ElmTableCell text="Row 4, Cell 2" />
|
|
59
|
-
<ElmTableCell text="Row 4, Cell 3" />
|
|
60
|
-
<ElmTableCell text="Row 4, Cell 4" />
|
|
61
|
-
<ElmTableCell text="Row 4, Cell 5" />
|
|
62
|
-
</ElmTableRow>
|
|
63
|
-
</ElmTableBody>
|
|
64
|
-
</ElmTable>
|
|
65
|
-
);
|
|
66
|
-
},
|
|
67
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
component$,
|
|
3
|
-
Slot,
|
|
4
|
-
createContextId,
|
|
5
|
-
useContextProvider,
|
|
6
|
-
useComputed$,
|
|
7
|
-
} from "@builder.io/qwik";
|
|
8
|
-
import type { CSSProperties } from "@builder.io/qwik";
|
|
9
|
-
import styles from "./elm-table.module.scss";
|
|
10
|
-
import textStyles from "../../styles/text.module.scss";
|
|
11
|
-
import { ElmInlineText } from "../typography/elm-inline-text";
|
|
12
|
-
|
|
13
|
-
export const HasRowHeaderContext = createContextId<
|
|
14
|
-
Readonly<{ value: boolean }>
|
|
15
|
-
>("HasRowHeaderContext");
|
|
16
|
-
|
|
17
|
-
export interface ElmTableProps {
|
|
18
|
-
/**
|
|
19
|
-
* The margin of the table.
|
|
20
|
-
*/
|
|
21
|
-
margin?: CSSProperties["marginBlock"];
|
|
22
|
-
|
|
23
|
-
caption?: string;
|
|
24
|
-
|
|
25
|
-
hasRowHeader?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const ElmTable = component$<ElmTableProps>((props) => {
|
|
29
|
-
const { margin, caption, hasRowHeader = false } = props;
|
|
30
|
-
|
|
31
|
-
const hasRowHeaderComputed = useComputed$(() => hasRowHeader);
|
|
32
|
-
useContextProvider(HasRowHeaderContext, hasRowHeaderComputed);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<table
|
|
36
|
-
class={[styles.table, textStyles.text]}
|
|
37
|
-
style={{
|
|
38
|
-
"--margin-block": margin,
|
|
39
|
-
}}
|
|
40
|
-
>
|
|
41
|
-
{caption && (
|
|
42
|
-
<caption>
|
|
43
|
-
<span class={styles["caption"]}>
|
|
44
|
-
<span class={styles.spacing}></span>
|
|
45
|
-
|
|
46
|
-
<span class={styles["caption-inner"]}>
|
|
47
|
-
<svg viewBox="0 0 24 24" width="1rem" height="1rem">
|
|
48
|
-
<path
|
|
49
|
-
d="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4M12,6A6,6 0 0,0 6,12A6,6 0 0,0 12,18A6,6 0 0,0 18,12A6,6 0 0,0 12,6M12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8Z"
|
|
50
|
-
fill="#6987b8"
|
|
51
|
-
/>
|
|
52
|
-
</svg>
|
|
53
|
-
<ElmInlineText text={caption} />
|
|
54
|
-
</span>
|
|
55
|
-
|
|
56
|
-
<span class={styles.spacing}></span>
|
|
57
|
-
</span>
|
|
58
|
-
</caption>
|
|
59
|
-
)}
|
|
60
|
-
<Slot />
|
|
61
|
-
</table>
|
|
62
|
-
);
|
|
63
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
.blockquote {
|
|
2
|
-
box-sizing: border-box;
|
|
3
|
-
width: 100%;
|
|
4
|
-
margin: 0;
|
|
5
|
-
background-color: rgba(#868e9c, 0.1);
|
|
6
|
-
position: relative;
|
|
7
|
-
|
|
8
|
-
&::after {
|
|
9
|
-
position: absolute;
|
|
10
|
-
content: "";
|
|
11
|
-
top: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
width: 4px;
|
|
14
|
-
height: 100%;
|
|
15
|
-
background-color: #868e9c;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.body {
|
|
20
|
-
box-sizing: border-box;
|
|
21
|
-
padding: 2rem 1.5rem;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.icon {
|
|
25
|
-
position: absolute;
|
|
26
|
-
content: "";
|
|
27
|
-
inset: var(--inset);
|
|
28
|
-
opacity: 0.5;
|
|
29
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "storybook-framework-qwik";
|
|
2
|
-
import { ElmBlockQuote } from "./elm-block-quote";
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof ElmBlockQuote> = {
|
|
5
|
-
title: "Components/Typography/elm-block-quote",
|
|
6
|
-
component: ElmBlockQuote,
|
|
7
|
-
tags: ["autodocs"],
|
|
8
|
-
args: {},
|
|
9
|
-
render() {
|
|
10
|
-
return (
|
|
11
|
-
<ElmBlockQuote>
|
|
12
|
-
Only a fool learns from his own mistakes. The wise man learns from the
|
|
13
|
-
mistakes of others.
|
|
14
|
-
</ElmBlockQuote>
|
|
15
|
-
);
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default meta;
|
|
20
|
-
type Story = StoryObj<typeof meta>;
|
|
21
|
-
|
|
22
|
-
export const Primary: Story = {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { component$, Slot } from "@builder.io/qwik";
|
|
2
|
-
|
|
3
|
-
import styles from "./elm-block-quote.module.scss";
|
|
4
|
-
import textStyles from "../../styles/text.module.scss";
|
|
5
|
-
import { ElmMdiIcon } from "../icon/elm-mdi-icon";
|
|
6
|
-
import { mdiFormatQuoteClose, mdiFormatQuoteOpen } from "@mdi/js";
|
|
7
|
-
|
|
8
|
-
export interface ElmBlockQuoteProps {
|
|
9
|
-
cite?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const ElmBlockQuote = component$<ElmBlockQuoteProps>(({ cite }) => {
|
|
13
|
-
return (
|
|
14
|
-
<blockquote class={[styles.blockquote, textStyles.text]} cite={cite}>
|
|
15
|
-
<div
|
|
16
|
-
class={styles.icon}
|
|
17
|
-
style={{ "--inset": "0.25rem auto auto 0.5rem" }}
|
|
18
|
-
>
|
|
19
|
-
<ElmMdiIcon d={mdiFormatQuoteOpen} />
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<div class={[styles.body]}>
|
|
23
|
-
<Slot />
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<div
|
|
27
|
-
class={styles.icon}
|
|
28
|
-
style={{ "--inset": "auto 0.25rem 0.25rem auto" }}
|
|
29
|
-
>
|
|
30
|
-
<ElmMdiIcon d={mdiFormatQuoteClose} />
|
|
31
|
-
</div>
|
|
32
|
-
</blockquote>
|
|
33
|
-
);
|
|
34
|
-
});
|