@ndla/preset-panda 0.0.53 → 0.0.55
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 +148 -0
- package/es/animations.js +111 -223
- package/es/animations.js.map +1 -0
- package/es/boxShadows.js +33 -37
- package/es/boxShadows.js.map +1 -0
- package/es/colors.js +132 -346
- package/es/colors.js.map +1 -0
- package/es/conditions.js +16 -12
- package/es/conditions.js.map +1 -0
- package/es/globalCss.js +149 -226
- package/es/globalCss.js.map +1 -0
- package/es/index.js +43 -45
- package/es/index.js.map +1 -0
- package/es/plugins/forwardCssPropPlugin.js +39 -46
- package/es/plugins/forwardCssPropPlugin.js.map +1 -0
- package/es/radii.js +14 -28
- package/es/radii.js.map +1 -0
- package/es/semanticTokens.js +233 -549
- package/es/semanticTokens.js.map +1 -0
- package/es/spacing.js +50 -136
- package/es/spacing.js.map +1 -0
- package/es/typography.js +200 -274
- package/es/typography.js.map +1 -0
- package/es/zIndex.js +22 -52
- package/es/zIndex.js.map +1 -0
- package/lib/_virtual/rolldown_runtime.js +30 -0
- package/lib/animations.js +115 -229
- package/lib/animations.js.map +1 -0
- package/lib/boxShadows.js +32 -41
- package/lib/boxShadows.js.map +1 -0
- package/lib/colors.js +131 -350
- package/lib/colors.js.map +1 -0
- package/lib/conditions.js +16 -17
- package/lib/conditions.js.map +1 -0
- package/lib/globalCss.js +148 -230
- package/lib/globalCss.js.map +1 -0
- package/lib/index.js +47 -58
- package/lib/index.js.map +1 -0
- package/lib/plugins/forwardCssPropPlugin.js +37 -51
- package/lib/plugins/forwardCssPropPlugin.js.map +1 -0
- package/lib/radii.js +13 -32
- package/lib/radii.js.map +1 -0
- package/lib/semanticTokens.js +232 -553
- package/lib/semanticTokens.js.map +1 -0
- package/lib/spacing.js +49 -140
- package/lib/spacing.js.map +1 -0
- package/lib/typography.js +205 -280
- package/lib/typography.js.map +1 -0
- package/lib/zIndex.js +21 -56
- package/lib/zIndex.js.map +1 -0
- package/package.json +6 -5
package/es/globalCss.js
CHANGED
|
@@ -1,227 +1,150 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2024-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
1
|
import { defineGlobalStyles } from "@pandacss/dev";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
borderLeft: "4px solid",
|
|
160
|
-
borderLeftColor: "stroke.default",
|
|
161
|
-
borderRadius: "xsmall",
|
|
162
|
-
boxSizing: "border-box",
|
|
163
|
-
overflowX: "auto",
|
|
164
|
-
textStyle: "label.medium",
|
|
165
|
-
fontFamily: "code",
|
|
166
|
-
display: "block",
|
|
167
|
-
whiteSpace: "pre",
|
|
168
|
-
"& .linenumber": {
|
|
169
|
-
display: "inline-block",
|
|
170
|
-
paddingBlock: "0",
|
|
171
|
-
paddingInline: "small",
|
|
172
|
-
borderRight: "1px solid",
|
|
173
|
-
borderColor: "stroke.subtle",
|
|
174
|
-
width: "xxlarge",
|
|
175
|
-
textAlign: "right",
|
|
176
|
-
marginInlineEnd: "xsmall"
|
|
177
|
-
},
|
|
178
|
-
"& :nth-child(1 of .linenumber)": {
|
|
179
|
-
paddingBlockStart: "xsmall"
|
|
180
|
-
},
|
|
181
|
-
"& :nth-last-child(1 of .linenumber)": {
|
|
182
|
-
paddingBlockEnd: "xsmall"
|
|
183
|
-
},
|
|
184
|
-
// The remaining css is copied from the coy theme in prismjs. A lot of css is omitted due to styling clashes
|
|
185
|
-
"& .token.comment, .token.block-comment, .token.prolog, .token.doctype, .token.cdata": {
|
|
186
|
-
color: "#7d8b99"
|
|
187
|
-
},
|
|
188
|
-
"& .token.punctuation": {
|
|
189
|
-
color: "#5f6364"
|
|
190
|
-
},
|
|
191
|
-
"& .token.property, .token.tag, .token.boolean, .token.number, .token.function-name, .token.constant, .token.symbol, .token.deleted": {
|
|
192
|
-
color: "#c92c2c"
|
|
193
|
-
},
|
|
194
|
-
"& .token.selector, .token.attr-name, .token.string, .token.char, .token.function, .token.builtin, .token.inserted": {
|
|
195
|
-
color: "#2f9c0a"
|
|
196
|
-
},
|
|
197
|
-
"& .token.operator, .token.entity, .token.url, .token.variable": {
|
|
198
|
-
color: "#a67f59",
|
|
199
|
-
background: "rgba(255, 255, 255, 0.5)"
|
|
200
|
-
},
|
|
201
|
-
"& .token.atrule, .token.attr-value, .token.keyword, .token.class-name": {
|
|
202
|
-
color: "#1990b8"
|
|
203
|
-
},
|
|
204
|
-
"& .token.regex, .token.important": {
|
|
205
|
-
color: "#e90"
|
|
206
|
-
},
|
|
207
|
-
"& .language-css .token.string, .style .token.string": {
|
|
208
|
-
color: "#a67f59",
|
|
209
|
-
background: "rgba(255, 255, 255, 0.5)"
|
|
210
|
-
},
|
|
211
|
-
"& .token.important": {
|
|
212
|
-
fontWeight: "normal"
|
|
213
|
-
},
|
|
214
|
-
"& .token.bold": {
|
|
215
|
-
fontWeight: "bold"
|
|
216
|
-
},
|
|
217
|
-
"& .token.italic": {
|
|
218
|
-
fontStyle: "italic"
|
|
219
|
-
},
|
|
220
|
-
"& .token.entity": {
|
|
221
|
-
cursor: "help"
|
|
222
|
-
},
|
|
223
|
-
"& .token.namespace": {
|
|
224
|
-
opacity: "0.7"
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
});
|
|
2
|
+
|
|
3
|
+
//#region src/globalCss.ts
|
|
4
|
+
const globalCss = defineGlobalStyles({
|
|
5
|
+
":root": {
|
|
6
|
+
"--global-font-body": "fonts.sans",
|
|
7
|
+
"--global-font-mono": "fonts.code"
|
|
8
|
+
},
|
|
9
|
+
html: {
|
|
10
|
+
minHeight: "100%",
|
|
11
|
+
fontFeatureSettings: "'ss03' on, 'liga' off, 'clig' off",
|
|
12
|
+
"& h1, h2, h3, h4, h5, h6": { textWrap: "unset" }
|
|
13
|
+
},
|
|
14
|
+
body: {
|
|
15
|
+
background: "background.default",
|
|
16
|
+
color: "text.default"
|
|
17
|
+
},
|
|
18
|
+
"a, summary,[tabindex]:not([tabindex='-1'])": {
|
|
19
|
+
outline: "none",
|
|
20
|
+
_focusVisible: {
|
|
21
|
+
outline: "3px",
|
|
22
|
+
borderRadius: "xsmall",
|
|
23
|
+
outlineColor: "stroke.default",
|
|
24
|
+
outlineOffset: "3px",
|
|
25
|
+
outlineStyle: "solid"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
code: {
|
|
29
|
+
background: "background.subtle",
|
|
30
|
+
whiteSpace: "pre-wrap"
|
|
31
|
+
},
|
|
32
|
+
"iframe#launcher": { display: "none" },
|
|
33
|
+
".ndla-article": {
|
|
34
|
+
h1: { textStyle: "heading.medium" },
|
|
35
|
+
h2: { textStyle: "heading.small" },
|
|
36
|
+
h3: { textStyle: "title.medium" },
|
|
37
|
+
"h4, h5, h6": { textStyle: "title.small" },
|
|
38
|
+
"& p[data-align=\"center\"]": { textAlign: "center" },
|
|
39
|
+
blockquote: {
|
|
40
|
+
textStyle: "body.medium",
|
|
41
|
+
fontFamily: "serif"
|
|
42
|
+
},
|
|
43
|
+
"& p:has(span[dir=\"rtl\"])": { direction: "rtl" },
|
|
44
|
+
textStyle: "body.article",
|
|
45
|
+
width: "100%",
|
|
46
|
+
"& details, :not(li) > blockquote, [data-embed-type=\"expandable-box\"], [data-embed-type=\"framed-content\"], [data-embed-type=\"factbox\"], table, [data-embed-type=\"related-content-list\"], [data-embed-type=\"link-block-list\"], [data-embed-type=\"pitch\"], [data-embed-type=\"campaign-block\"], [data-embed-type=\"key-figure\"], [data-embed-type=\"grid\"], [data-embed-type=\"contact-block\"], [data-embed-type=\"file-list\"], [data-embed-type=\"uu-disclaimer\"]": {
|
|
47
|
+
marginBlockStart: "xxlarge",
|
|
48
|
+
marginBlockEnd: "xxlarge",
|
|
49
|
+
tabletDown: {
|
|
50
|
+
marginBlockStart: "xlarge",
|
|
51
|
+
marginBlockEnd: "xlarge"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"& section:not([class]), section:not([class]) > div:not([class]), [data-embed-type=\"framed-content\"], [data-embed-type=\"grid\"] > div, [data-embed-type=\"grid-parallax\"] > div, [data-embed-type=\"factbox\"] > div, [data-embed-type=\"copyright\"] > [data-copyright-content], [data-embed-type=\"uu-disclaimer\"] > [data-uu-content], [data-embed-wrapper], details, [data-embed-type=\"expandable-box\"], blockquote": {
|
|
55
|
+
"& > :is(h2, [data-embed-type=\"copy-heading\"])": {
|
|
56
|
+
marginBlockStart: "xlarge",
|
|
57
|
+
marginBlockEnd: "small",
|
|
58
|
+
tabletDown: { marginBlockStart: "large" }
|
|
59
|
+
},
|
|
60
|
+
"& > h3": {
|
|
61
|
+
marginBlockStart: "large",
|
|
62
|
+
marginBlockEnd: "xsmall",
|
|
63
|
+
tabletDown: { marginBlockStart: "medium" }
|
|
64
|
+
},
|
|
65
|
+
"& > :is(h4, h5, h6)": {
|
|
66
|
+
marginBlockStart: "medium",
|
|
67
|
+
marginBlockEnd: "xsmall",
|
|
68
|
+
tabletDown: { marginBlockStart: "small" }
|
|
69
|
+
},
|
|
70
|
+
"& > :is(figure)": {
|
|
71
|
+
marginBlockStart: "xxlarge",
|
|
72
|
+
marginBlockEnd: "xxlarge",
|
|
73
|
+
tabletDown: { marginBlockStart: "xlarge" }
|
|
74
|
+
},
|
|
75
|
+
"& > :is(p, ul, ol, dl, [data-embed-type=\"speech\"])": {
|
|
76
|
+
marginBlockStart: "xsmall",
|
|
77
|
+
marginBlockEnd: "xsmall"
|
|
78
|
+
},
|
|
79
|
+
"& > :is([data-embed-type=\"ordered-list\"])": { marginInlineStart: "xlarge!" }
|
|
80
|
+
},
|
|
81
|
+
"& [data-embed-type=\"framed-content\"], [data-embed-type=\"grid\"] > div, [data-embed-type=\"grid-parallax\"] > div, [data-embed-type=\"factbox\"] > div, [data-embed-type=\"copyright\"] > [data-copyright-content], [data-embed-type=\"uu-disclaimer\"] > [data-uu-content], details, blockquote": {
|
|
82
|
+
"& > :first-child": { marginBlockStart: "0" },
|
|
83
|
+
"& > :last-child": { marginBlockEnd: "0" }
|
|
84
|
+
},
|
|
85
|
+
"& section:not([class]), section:not([class]) > div:not([class])": {
|
|
86
|
+
"& > :first-child": {
|
|
87
|
+
marginBlockStart: "xxlarge",
|
|
88
|
+
tabletDown: { marginBlockStart: "xlarge" }
|
|
89
|
+
},
|
|
90
|
+
"& > :last-child": {
|
|
91
|
+
marginBlockEnd: "xxlarge",
|
|
92
|
+
tabletDown: { marginBlockStart: "xlarge" }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"a:not([class]):not([data-unstyled]), a[class=\"\"]:not([data-unstyled])": {
|
|
97
|
+
color: "text.link",
|
|
98
|
+
textDecoration: "underline",
|
|
99
|
+
_hover: { textDecoration: "none" },
|
|
100
|
+
_visited: { color: "text.linkVisited" }
|
|
101
|
+
},
|
|
102
|
+
".codeblock": {
|
|
103
|
+
border: "1px solid",
|
|
104
|
+
borderColor: "stroke.subtle",
|
|
105
|
+
borderLeft: "4px solid",
|
|
106
|
+
borderLeftColor: "stroke.default",
|
|
107
|
+
borderRadius: "xsmall",
|
|
108
|
+
boxSizing: "border-box",
|
|
109
|
+
overflowX: "auto",
|
|
110
|
+
textStyle: "label.medium",
|
|
111
|
+
fontFamily: "code",
|
|
112
|
+
display: "block",
|
|
113
|
+
whiteSpace: "pre",
|
|
114
|
+
"& .linenumber": {
|
|
115
|
+
display: "inline-block",
|
|
116
|
+
paddingBlock: "0",
|
|
117
|
+
paddingInline: "small",
|
|
118
|
+
borderRight: "1px solid",
|
|
119
|
+
borderColor: "stroke.subtle",
|
|
120
|
+
width: "xxlarge",
|
|
121
|
+
textAlign: "right",
|
|
122
|
+
marginInlineEnd: "xsmall"
|
|
123
|
+
},
|
|
124
|
+
"& :nth-child(1 of .linenumber)": { paddingBlockStart: "xsmall" },
|
|
125
|
+
"& :nth-last-child(1 of .linenumber)": { paddingBlockEnd: "xsmall" },
|
|
126
|
+
"& .token.comment, .token.block-comment, .token.prolog, .token.doctype, .token.cdata": { color: "#7d8b99" },
|
|
127
|
+
"& .token.punctuation": { color: "#5f6364" },
|
|
128
|
+
"& .token.property, .token.tag, .token.boolean, .token.number, .token.function-name, .token.constant, .token.symbol, .token.deleted": { color: "#c92c2c" },
|
|
129
|
+
"& .token.selector, .token.attr-name, .token.string, .token.char, .token.function, .token.builtin, .token.inserted": { color: "#2f9c0a" },
|
|
130
|
+
"& .token.operator, .token.entity, .token.url, .token.variable": {
|
|
131
|
+
color: "#a67f59",
|
|
132
|
+
background: "rgba(255, 255, 255, 0.5)"
|
|
133
|
+
},
|
|
134
|
+
"& .token.atrule, .token.attr-value, .token.keyword, .token.class-name": { color: "#1990b8" },
|
|
135
|
+
"& .token.regex, .token.important": { color: "#e90" },
|
|
136
|
+
"& .language-css .token.string, .style .token.string": {
|
|
137
|
+
color: "#a67f59",
|
|
138
|
+
background: "rgba(255, 255, 255, 0.5)"
|
|
139
|
+
},
|
|
140
|
+
"& .token.important": { fontWeight: "normal" },
|
|
141
|
+
"& .token.bold": { fontWeight: "bold" },
|
|
142
|
+
"& .token.italic": { fontStyle: "italic" },
|
|
143
|
+
"& .token.entity": { cursor: "help" },
|
|
144
|
+
"& .token.namespace": { opacity: "0.7" }
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
//#endregion
|
|
149
|
+
export { globalCss };
|
|
150
|
+
//# sourceMappingURL=globalCss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalCss.js","names":[],"sources":["../src/globalCss.ts"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { defineGlobalStyles } from \"@pandacss/dev\";\n\nexport const globalCss = defineGlobalStyles({\n \":root\": {\n // Applied to html in preflight (css reset)\n \"--global-font-body\": \"fonts.sans\",\n // Code, kbd, pre, samp\n \"--global-font-mono\": \"fonts.code\",\n },\n html: {\n minHeight: \"100%\",\n fontFeatureSettings: \"'ss03' on, 'liga' off, 'clig' off\",\n // this is included in the css reset we use. We don't want it.\n \"& h1, h2, h3, h4, h5, h6\": {\n textWrap: \"unset\",\n },\n },\n body: {\n background: \"background.default\",\n color: \"text.default\",\n },\n \"a, summary,[tabindex]:not([tabindex='-1'])\": {\n outline: \"none\",\n _focusVisible: {\n outline: \"3px\",\n borderRadius: \"xsmall\",\n outlineColor: \"stroke.default\",\n outlineOffset: \"3px\",\n outlineStyle: \"solid\",\n },\n },\n code: {\n background: \"background.subtle\",\n whiteSpace: \"pre-wrap\",\n },\n /* Hide default zendesk launcher so that we can provide our own. */\n \"iframe#launcher\": {\n display: \"none\",\n },\n // For future readers: Life here would be much simpler if we could use flex.\n // However, our usage of float within the article content forces us to use margins.\n \".ndla-article\": {\n h1: {\n textStyle: \"heading.medium\",\n },\n h2: {\n textStyle: \"heading.small\",\n },\n h3: {\n textStyle: \"title.medium\",\n },\n \"h4, h5, h6\": {\n textStyle: \"title.small\",\n },\n '& p[data-align=\"center\"]': {\n textAlign: \"center\",\n },\n // TODO: This is not an actual text style. Should it be?\n blockquote: {\n textStyle: \"body.medium\",\n fontFamily: \"serif\",\n },\n '& p:has(span[dir=\"rtl\"])': {\n direction: \"rtl\",\n },\n textStyle: \"body.article\",\n width: \"100%\",\n\n // Non-figure block elements that should have margin above and below.\n '& details, :not(li) > blockquote, [data-embed-type=\"expandable-box\"], [data-embed-type=\"framed-content\"], [data-embed-type=\"factbox\"], table, [data-embed-type=\"related-content-list\"], [data-embed-type=\"link-block-list\"], [data-embed-type=\"pitch\"], [data-embed-type=\"campaign-block\"], [data-embed-type=\"key-figure\"], [data-embed-type=\"grid\"], [data-embed-type=\"contact-block\"], [data-embed-type=\"file-list\"], [data-embed-type=\"uu-disclaimer\"]':\n {\n marginBlockStart: \"xxlarge\",\n marginBlockEnd: \"xxlarge\",\n tabletDown: {\n marginBlockStart: \"xlarge\",\n marginBlockEnd: \"xlarge\",\n },\n },\n\n // Article content is usually wrapped in a section. The rest of the elements in this list contains other elements, and should add margin to them no matter where they are placed in the DOM.\n '& section:not([class]), section:not([class]) > div:not([class]), [data-embed-type=\"framed-content\"], [data-embed-type=\"grid\"] > div, [data-embed-type=\"grid-parallax\"] > div, [data-embed-type=\"factbox\"] > div, [data-embed-type=\"copyright\"] > [data-copyright-content], [data-embed-type=\"uu-disclaimer\"] > [data-uu-content], [data-embed-wrapper], details, [data-embed-type=\"expandable-box\"], blockquote':\n {\n '& > :is(h2, [data-embed-type=\"copy-heading\"])': {\n marginBlockStart: \"xlarge\",\n marginBlockEnd: \"small\",\n tabletDown: {\n marginBlockStart: \"large\",\n },\n },\n \"& > h3\": {\n marginBlockStart: \"large\",\n marginBlockEnd: \"xsmall\",\n tabletDown: {\n marginBlockStart: \"medium\",\n },\n },\n \"& > :is(h4, h5, h6)\": {\n marginBlockStart: \"medium\",\n marginBlockEnd: \"xsmall\",\n tabletDown: {\n marginBlockStart: \"small\",\n },\n },\n \"& > :is(figure)\": {\n marginBlockStart: \"xxlarge\",\n marginBlockEnd: \"xxlarge\",\n tabletDown: {\n marginBlockStart: \"xlarge\",\n },\n },\n '& > :is(p, ul, ol, dl, [data-embed-type=\"speech\"])': {\n marginBlockStart: \"xsmall\",\n marginBlockEnd: \"xsmall\",\n },\n '& > :is([data-embed-type=\"ordered-list\"])': {\n marginInlineStart: \"xlarge!\",\n },\n },\n '& [data-embed-type=\"framed-content\"], [data-embed-type=\"grid\"] > div, [data-embed-type=\"grid-parallax\"] > div, [data-embed-type=\"factbox\"] > div, [data-embed-type=\"copyright\"] > [data-copyright-content], [data-embed-type=\"uu-disclaimer\"] > [data-uu-content], details, blockquote':\n {\n \"& > :first-child\": {\n marginBlockStart: \"0\",\n },\n \"& > :last-child\": {\n marginBlockEnd: \"0\",\n },\n },\n \"& section:not([class]), section:not([class]) > div:not([class])\": {\n \"& > :first-child\": {\n marginBlockStart: \"xxlarge\",\n tabletDown: {\n marginBlockStart: \"xlarge\",\n },\n },\n \"& > :last-child\": {\n marginBlockEnd: \"xxlarge\",\n tabletDown: {\n marginBlockStart: \"xlarge\",\n },\n },\n },\n },\n // Adds default link styling to links without classes\n 'a:not([class]):not([data-unstyled]), a[class=\"\"]:not([data-unstyled])': {\n color: \"text.link\",\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n _visited: {\n color: \"text.linkVisited\",\n },\n },\n \".codeblock\": {\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n borderLeft: \"4px solid\",\n borderLeftColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n boxSizing: \"border-box\",\n overflowX: \"auto\",\n textStyle: \"label.medium\",\n fontFamily: \"code\",\n display: \"block\",\n whiteSpace: \"pre\",\n \"& .linenumber\": {\n display: \"inline-block\",\n paddingBlock: \"0\",\n paddingInline: \"small\",\n borderRight: \"1px solid\",\n borderColor: \"stroke.subtle\",\n width: \"xxlarge\",\n textAlign: \"right\",\n marginInlineEnd: \"xsmall\",\n },\n \"& :nth-child(1 of .linenumber)\": {\n paddingBlockStart: \"xsmall\",\n },\n \"& :nth-last-child(1 of .linenumber)\": {\n paddingBlockEnd: \"xsmall\",\n },\n // The remaining css is copied from the coy theme in prismjs. A lot of css is omitted due to styling clashes. TODO: Consider moving this\n \"& .token.comment, .token.block-comment, .token.prolog, .token.doctype, .token.cdata\": {\n color: \"#7d8b99\",\n },\n \"& .token.punctuation\": {\n color: \"#5f6364\",\n },\n \"& .token.property, .token.tag, .token.boolean, .token.number, .token.function-name, .token.constant, .token.symbol, .token.deleted\":\n {\n color: \"#c92c2c\",\n },\n \"& .token.selector, .token.attr-name, .token.string, .token.char, .token.function, .token.builtin, .token.inserted\":\n {\n color: \"#2f9c0a\",\n },\n \"& .token.operator, .token.entity, .token.url, .token.variable\": {\n color: \"#a67f59\",\n background: \"rgba(255, 255, 255, 0.5)\",\n },\n \"& .token.atrule, .token.attr-value, .token.keyword, .token.class-name\": {\n color: \"#1990b8\",\n },\n \"& .token.regex, .token.important\": {\n color: \"#e90\",\n },\n \"& .language-css .token.string, .style .token.string\": {\n color: \"#a67f59\",\n background: \"rgba(255, 255, 255, 0.5)\",\n },\n \"& .token.important\": {\n fontWeight: \"normal\",\n },\n \"& .token.bold\": {\n fontWeight: \"bold\",\n },\n \"& .token.italic\": {\n fontStyle: \"italic\",\n },\n \"& .token.entity\": {\n cursor: \"help\",\n },\n \"& .token.namespace\": {\n opacity: \"0.7\",\n },\n },\n});\n"],"mappings":";;;AAUA,MAAa,YAAY,mBAAmB;CAC1C,SAAS;EAEP,sBAAsB;EAEtB,sBAAsB;CACvB;CACD,MAAM;EACJ,WAAW;EACX,qBAAqB;EAErB,4BAA4B,EAC1B,UAAU,QACX;CACF;CACD,MAAM;EACJ,YAAY;EACZ,OAAO;CACR;CACD,8CAA8C;EAC5C,SAAS;EACT,eAAe;GACb,SAAS;GACT,cAAc;GACd,cAAc;GACd,eAAe;GACf,cAAc;EACf;CACF;CACD,MAAM;EACJ,YAAY;EACZ,YAAY;CACb;CAED,mBAAmB,EACjB,SAAS,OACV;CAGD,iBAAiB;EACf,IAAI,EACF,WAAW,iBACZ;EACD,IAAI,EACF,WAAW,gBACZ;EACD,IAAI,EACF,WAAW,eACZ;EACD,cAAc,EACZ,WAAW,cACZ;EACD,8BAA4B,EAC1B,WAAW,SACZ;EAED,YAAY;GACV,WAAW;GACX,YAAY;EACb;EACD,8BAA4B,EAC1B,WAAW,MACZ;EACD,WAAW;EACX,OAAO;EAGP,qdACE;GACE,kBAAkB;GAClB,gBAAgB;GAChB,YAAY;IACV,kBAAkB;IAClB,gBAAgB;GACjB;EACF;EAGH,iaACE;GACE,mDAAiD;IAC/C,kBAAkB;IAClB,gBAAgB;IAChB,YAAY,EACV,kBAAkB,QACnB;GACF;GACD,UAAU;IACR,kBAAkB;IAClB,gBAAgB;IAChB,YAAY,EACV,kBAAkB,SACnB;GACF;GACD,uBAAuB;IACrB,kBAAkB;IAClB,gBAAgB;IAChB,YAAY,EACV,kBAAkB,QACnB;GACF;GACD,mBAAmB;IACjB,kBAAkB;IAClB,gBAAgB;IAChB,YAAY,EACV,kBAAkB,SACnB;GACF;GACD,wDAAsD;IACpD,kBAAkB;IAClB,gBAAgB;GACjB;GACD,+CAA6C,EAC3C,mBAAmB,UACpB;EACF;EACH,sSACE;GACE,oBAAoB,EAClB,kBAAkB,IACnB;GACD,mBAAmB,EACjB,gBAAgB,IACjB;EACF;EACH,mEAAmE;GACjE,oBAAoB;IAClB,kBAAkB;IAClB,YAAY,EACV,kBAAkB,SACnB;GACF;GACD,mBAAmB;IACjB,gBAAgB;IAChB,YAAY,EACV,kBAAkB,SACnB;GACF;EACF;CACF;CAED,2EAAyE;EACvE,OAAO;EACP,gBAAgB;EAChB,QAAQ,EACN,gBAAgB,OACjB;EACD,UAAU,EACR,OAAO,mBACR;CACF;CACD,cAAc;EACZ,QAAQ;EACR,aAAa;EACb,YAAY;EACZ,iBAAiB;EACjB,cAAc;EACd,WAAW;EACX,WAAW;EACX,WAAW;EACX,YAAY;EACZ,SAAS;EACT,YAAY;EACZ,iBAAiB;GACf,SAAS;GACT,cAAc;GACd,eAAe;GACf,aAAa;GACb,aAAa;GACb,OAAO;GACP,WAAW;GACX,iBAAiB;EAClB;EACD,kCAAkC,EAChC,mBAAmB,SACpB;EACD,uCAAuC,EACrC,iBAAiB,SAClB;EAED,uFAAuF,EACrF,OAAO,UACR;EACD,wBAAwB,EACtB,OAAO,UACR;EACD,sIACE,EACE,OAAO,UACR;EACH,qHACE,EACE,OAAO,UACR;EACH,iEAAiE;GAC/D,OAAO;GACP,YAAY;EACb;EACD,yEAAyE,EACvE,OAAO,UACR;EACD,oCAAoC,EAClC,OAAO,OACR;EACD,uDAAuD;GACrD,OAAO;GACP,YAAY;EACb;EACD,sBAAsB,EACpB,YAAY,SACb;EACD,iBAAiB,EACf,YAAY,OACb;EACD,mBAAmB,EACjB,WAAW,SACZ;EACD,mBAAmB,EACjB,QAAQ,OACT;EACD,sBAAsB,EACpB,SAAS,MACV;CACF;AACF,EAAC"}
|
package/es/index.js
CHANGED
|
@@ -1,49 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { animations, durations, easings, keyframes } from "./animations.js";
|
|
2
|
+
import { boxShadows } from "./boxShadows.js";
|
|
3
|
+
import { colors } from "./colors.js";
|
|
4
|
+
import { conditions } from "./conditions.js";
|
|
5
|
+
import { globalCss } from "./globalCss.js";
|
|
6
|
+
import { radii } from "./radii.js";
|
|
7
|
+
import { semanticTokens } from "./semanticTokens.js";
|
|
8
|
+
import { spacing } from "./spacing.js";
|
|
9
|
+
import { fontSizes, fontWeights, fonts, lineHeights, textStyles } from "./typography.js";
|
|
10
|
+
import { zIndex } from "./zIndex.js";
|
|
11
|
+
import { forwardCssPropPlugin } from "./plugins/forwardCssPropPlugin.js";
|
|
9
12
|
import { definePreset } from "@pandacss/dev";
|
|
10
13
|
import { breakpoints } from "@ndla/core";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import { colors } from "./colors";
|
|
14
|
-
import { conditions } from "./conditions";
|
|
15
|
-
import { globalCss } from "./globalCss";
|
|
16
|
-
import { radii } from "./radii";
|
|
17
|
-
import { semanticTokens } from "./semanticTokens";
|
|
18
|
-
import { spacing } from "./spacing";
|
|
19
|
-
import { fontWeights, textStyles, fonts, fontSizes, lineHeights } from "./typography";
|
|
20
|
-
import { zIndex } from "./zIndex";
|
|
14
|
+
|
|
15
|
+
//#region src/index.ts
|
|
21
16
|
const preset = definePreset({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
17
|
+
name: "ndla/panda",
|
|
18
|
+
globalCss,
|
|
19
|
+
conditions,
|
|
20
|
+
theme: {
|
|
21
|
+
breakpoints,
|
|
22
|
+
textStyles,
|
|
23
|
+
keyframes,
|
|
24
|
+
tokens: {
|
|
25
|
+
colors,
|
|
26
|
+
easings,
|
|
27
|
+
durations,
|
|
28
|
+
radii,
|
|
29
|
+
spacing,
|
|
30
|
+
sizes: spacing,
|
|
31
|
+
lineHeights,
|
|
32
|
+
fontWeights,
|
|
33
|
+
fontSizes,
|
|
34
|
+
fonts,
|
|
35
|
+
animations,
|
|
36
|
+
shadows: boxShadows,
|
|
37
|
+
zIndex
|
|
38
|
+
},
|
|
39
|
+
semanticTokens,
|
|
40
|
+
containerSizes: breakpoints
|
|
41
|
+
}
|
|
47
42
|
});
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
var src_default = preset;
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { src_default as default, forwardCssPropPlugin };
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
package/es/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { definePreset } from \"@pandacss/dev\";\nimport { breakpoints } from \"@ndla/core\";\nimport { animations, durations, easings, keyframes } from \"./animations\";\nimport { boxShadows } from \"./boxShadows\";\nimport { colors } from \"./colors\";\nimport { conditions } from \"./conditions\";\nimport { globalCss } from \"./globalCss\";\nimport { radii } from \"./radii\";\nimport { semanticTokens } from \"./semanticTokens\";\nimport { spacing } from \"./spacing\";\nimport { fontWeights, textStyles, fonts, fontSizes, lineHeights } from \"./typography\";\nimport { zIndex } from \"./zIndex\";\n\nconst preset = definePreset({\n name: \"ndla/panda\",\n globalCss: globalCss,\n conditions: conditions,\n theme: {\n breakpoints: breakpoints,\n textStyles: textStyles,\n keyframes: keyframes,\n tokens: {\n colors: colors,\n easings: easings,\n durations: durations,\n radii: radii,\n spacing: spacing,\n sizes: spacing,\n lineHeights: lineHeights,\n fontWeights: fontWeights,\n fontSizes: fontSizes,\n fonts: fonts,\n animations: animations,\n shadows: boxShadows,\n zIndex: zIndex,\n },\n semanticTokens: semanticTokens,\n containerSizes: breakpoints,\n },\n});\n\nexport { forwardCssPropPlugin } from \"./plugins/forwardCssPropPlugin\";\n\nexport default preset;\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAM,SAAS,aAAa;CAC1B,MAAM;CACK;CACC;CACZ,OAAO;EACQ;EACD;EACD;EACX,QAAQ;GACE;GACC;GACE;GACJ;GACE;GACT,OAAO;GACM;GACA;GACF;GACJ;GACK;GACZ,SAAS;GACD;EACT;EACe;EAChB,gBAAgB;CACjB;AACF,EAAC;AAIF,kBAAe"}
|
|
@@ -1,56 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) 2024-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
1
|
+
//#region src/plugins/forwardCssPropPlugin.ts
|
|
9
2
|
const supportedJsxFrameworks = ["react"];
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
};
|
|
3
|
+
const forwardCssPropPlugin = () => {
|
|
4
|
+
return {
|
|
5
|
+
name: "forward-css-prop",
|
|
6
|
+
hooks: {
|
|
7
|
+
"config:resolved": (args) => {
|
|
8
|
+
const jsxFramework = args.config.jsxFramework;
|
|
9
|
+
if (!supportedJsxFrameworks.includes(jsxFramework)) throw new Error(`[plugin:restrict-styled-props]: Unsupported jsxFramework: ${jsxFramework}. This Panda plugin only supports: ${supportedJsxFrameworks.join(", ")}`);
|
|
10
|
+
},
|
|
11
|
+
"codegen:prepare": (args) => {
|
|
12
|
+
return transformStyledFn(args);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
25
16
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const baseCode = "const __base__ = Dynamic.__base__ || Dynamic";
|
|
35
|
-
factoryJs.code = factoryJs.code.replace(baseCode, `${baseCode}
|
|
17
|
+
const transformStyledFn = (args) => {
|
|
18
|
+
const factoryArtifact = args.artifacts.find((art) => art.id === "jsx-factory");
|
|
19
|
+
const factoryJs = factoryArtifact?.files.find((f) => f.file.includes(".mjs") || f.file.includes(".js"));
|
|
20
|
+
const jsxTypes = args.artifacts.find((art) => art.id === "types-jsx")?.files.find((f) => f.file.includes("jsx"));
|
|
21
|
+
const systemTypes = args.artifacts.find((art) => art.id === "types-gen-system")?.files.find((f) => f.file.includes("system-types"));
|
|
22
|
+
if (!factoryJs?.code || !jsxTypes?.code || !systemTypes?.code) return args.artifacts;
|
|
23
|
+
const baseCode = "const __base__ = Dynamic.__base__ || Dynamic";
|
|
24
|
+
factoryJs.code = factoryJs.code.replace(baseCode, `${baseCode}
|
|
36
25
|
const contextConsume = options.baseComponent || Dynamic.__base__ || typeof Dynamic === "string"`);
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
const propsCode = "const { as: Element = __base__, children, ...restProps } = props";
|
|
27
|
+
factoryJs.code = factoryJs.code.replace(propsCode, `const { as: Element = __base__, consumeCss, children, ...restProps } = props
|
|
39
28
|
|
|
40
29
|
const consume = props.asChild
|
|
41
30
|
? consumeCss && (options.baseComponent || Dynamic.__baseComponent__)
|
|
42
31
|
: consumeCss || contextConsume`);
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
const cvaCode = "const cvaStyles = __cvaFn__.raw(variantProps)";
|
|
33
|
+
factoryJs.code = factoryJs.code.replace(cvaCode, `${cvaCode}
|
|
45
34
|
if(!consume) {
|
|
46
35
|
return css.raw(cvaStyles, propStyles, cssStyles)
|
|
47
36
|
}`);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
factoryJs.code = factoryJs.code.replace("className: classes()", `...(consume ? { className: classes() } : { css: classes(), consumeCss } )`);
|
|
38
|
+
const styledComponentForwardPropDeclaration = `StyledComponent.__shouldForwardProps__ = shouldForwardProp`;
|
|
39
|
+
factoryJs.code = factoryJs.code.replace(styledComponentForwardPropDeclaration, `${styledComponentForwardPropDeclaration}
|
|
51
40
|
StyledComponent.__baseComponent__ = options.baseComponent || Dynamic.__baseComponent__`);
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
const shouldForwardPropCode = "shouldForwardProp?(prop: string, variantKeys: string[]): boolean";
|
|
42
|
+
jsxTypes.code = jsxTypes.code.replace(shouldForwardPropCode, `${shouldForwardPropCode}
|
|
54
43
|
/**
|
|
55
44
|
* Used when creating styled components from React components that do not support the css prop. If true, the css prop will be consumed and converted to \`className\`
|
|
56
45
|
* @example
|
|
@@ -59,8 +48,8 @@ export const transformStyledFn = args => {
|
|
|
59
48
|
* const Button = styled(ark.button, { baseComponent: true })
|
|
60
49
|
*/
|
|
61
50
|
baseComponent?: boolean`);
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
const jsxStylePropsCode = "export type JsxStyleProps =";
|
|
52
|
+
systemTypes.code = systemTypes.code.replace(jsxStylePropsCode, `${jsxStylePropsCode} {
|
|
64
53
|
/**
|
|
65
54
|
* Tells a component to consume the \`css\` prop and turn it into a \`className\` prop. This is only used in conjunction with the \`baseComponent\` prop in the \`styled\` function to ensure that components that are \`asChild\`-ed onto non-panda components can consume their css before being merged with their child.
|
|
66
55
|
* @example
|
|
@@ -76,5 +65,9 @@ export const transformStyledFn = args => {
|
|
|
76
65
|
*/
|
|
77
66
|
consumeCss?: boolean
|
|
78
67
|
} & `);
|
|
79
|
-
|
|
80
|
-
};
|
|
68
|
+
return args.artifacts;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { forwardCssPropPlugin };
|
|
73
|
+
//# sourceMappingURL=forwardCssPropPlugin.js.map
|