@brightspace-ui/core 2.26.3 → 2.28.0
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/components/alert/README.md +0 -4
- package/components/breadcrumbs/README.md +0 -12
- package/components/button/README.md +0 -12
- package/components/button/floating-buttons.md +0 -4
- package/components/calendar/README.md +0 -4
- package/components/card/README.md +0 -4
- package/components/colors/README.md +0 -12
- package/components/count-badge/README.md +0 -9
- package/components/dialog/README.md +0 -12
- package/components/dropdown/README.md +0 -29
- package/components/expand-collapse/README.md +0 -8
- package/components/filter/README.md +0 -15
- package/components/form/docs/form-element-nesting.md +0 -4
- package/components/form/docs/form.md +0 -4
- package/components/html-block/demo/html-block-code.html +47 -0
- package/components/html-block/html-block.js +4 -2
- package/components/inputs/README.md +0 -4
- package/components/inputs/docs/input-checkbox.md +0 -8
- package/components/inputs/docs/input-date-time.md +0 -24
- package/components/inputs/docs/input-numeric.md +0 -8
- package/components/inputs/docs/input-radio.md +0 -4
- package/components/inputs/docs/input-search.md +0 -4
- package/components/inputs/docs/input-select-styles.md +0 -4
- package/components/inputs/docs/input-text.md +0 -12
- package/components/link/README.md +0 -6
- package/components/list/README.md +0 -24
- package/components/loading-spinner/README.md +0 -3
- package/components/menu/README.md +0 -20
- package/components/meter/README.md +0 -19
- package/components/overflow-group/README.md +0 -4
- package/components/scroll-wrapper/README.md +0 -4
- package/components/selection/README.md +0 -6
- package/components/skeleton/README.md +1 -11
- package/components/status-indicator/README.md +0 -4
- package/components/switch/README.md +0 -7
- package/components/table/README.md +0 -16
- package/components/tabs/README.md +0 -8
- package/components/tooltip/README.md +0 -8
- package/components/typography/README.md +0 -10
- package/components/typography/demo/typography.html +6 -0
- package/components/typography/styles.js +38 -0
- package/components/typography/typography.js +39 -0
- package/directives/animate/README.md +1 -5
- package/helpers/demo/prism.html +417 -0
- package/helpers/prism.js +430 -0
- package/package.json +1 -2
- package/templates/primary-secondary/README.md +0 -4
- package/components/alert/screenshots/alert.png +0 -0
- package/components/breadcrumbs/screenshots/basic.png +0 -0
- package/components/breadcrumbs/screenshots/compact.png +0 -0
- package/components/breadcrumbs/screenshots/limited-width.png +0 -0
- package/components/button/screenshots/button-icon.png +0 -0
- package/components/button/screenshots/button-subtle.png +0 -0
- package/components/button/screenshots/button.png +0 -0
- package/components/button/screenshots/floating-buttons.png +0 -0
- package/components/calendar/screenshots/calendar.png +0 -0
- package/components/card/screenshots/card.png +0 -0
- package/components/colors/screenshots/basic-greys.png +0 -0
- package/components/colors/screenshots/feedback.png +0 -0
- package/components/colors/screenshots/primary-accents.png +0 -0
- package/components/count-badge/screenshots/count-badge-count-large.png +0 -0
- package/components/count-badge/screenshots/count-badge-icon.png +0 -0
- package/components/count-badge/screenshots/count-badge-notification-small.png +0 -0
- package/components/dialog/screenshots/dialog-confirm.png +0 -0
- package/components/dialog/screenshots/dialog-fullscreen.png +0 -0
- package/components/dialog/screenshots/dialog.png +0 -0
- package/components/dropdown/screenshots/dropdown-button-subtle.png +0 -0
- package/components/dropdown/screenshots/dropdown-button.png +0 -0
- package/components/dropdown/screenshots/dropdown-content-mobile-tray.png +0 -0
- package/components/dropdown/screenshots/dropdown-content.png +0 -0
- package/components/dropdown/screenshots/dropdown-context-menu.png +0 -0
- package/components/dropdown/screenshots/dropdown-menu.png +0 -0
- package/components/dropdown/screenshots/dropdown-more.png +0 -0
- package/components/dropdown/screenshots/dropdown-tabs.png +0 -0
- package/components/expand-collapse/screenshots/expand-collapse-content.gif +0 -0
- package/components/expand-collapse/screenshots/more-less.png +0 -0
- package/components/filter/screenshots/filter-mobile.png +0 -0
- package/components/filter/screenshots/filter-multi-dim.png +0 -0
- package/components/filter/screenshots/filter.png +0 -0
- package/components/form/screenshots/form-native.gif +0 -0
- package/components/form/screenshots/nesting-invalid-styling.png +0 -0
- package/components/form/screenshots/nesting-tooltip-conflict.png +0 -0
- package/components/inputs/screenshots/checkbox.gif +0 -0
- package/components/inputs/screenshots/date-range.gif +0 -0
- package/components/inputs/screenshots/date-time-range.gif +0 -0
- package/components/inputs/screenshots/date-time.gif +0 -0
- package/components/inputs/screenshots/date.gif +0 -0
- package/components/inputs/screenshots/label-required.png +0 -0
- package/components/inputs/screenshots/label.png +0 -0
- package/components/inputs/screenshots/number.png +0 -0
- package/components/inputs/screenshots/percent.png +0 -0
- package/components/inputs/screenshots/radio.gif +0 -0
- package/components/inputs/screenshots/search.gif +0 -0
- package/components/inputs/screenshots/select.gif +0 -0
- package/components/inputs/screenshots/text.gif +0 -0
- package/components/inputs/screenshots/textarea-styles.gif +0 -0
- package/components/inputs/screenshots/textarea.gif +0 -0
- package/components/inputs/screenshots/time-range.gif +0 -0
- package/components/inputs/screenshots/time.gif +0 -0
- package/components/link/screenshots/main.png +0 -0
- package/components/link/screenshots/small.png +0 -0
- package/components/link/screenshots/standard.png +0 -0
- package/components/list/screenshots/drag-and-drop.gif +0 -0
- package/components/list/screenshots/list-item-content.png +0 -0
- package/components/list/screenshots/list-item.png +0 -0
- package/components/list/screenshots/list-selection.png +0 -0
- package/components/list/screenshots/list.png +0 -0
- package/components/loading-spinner/screenshots/loading-spinner.gif +0 -0
- package/components/menu/screenshots/checkbox-menu.png +0 -0
- package/components/menu/screenshots/menu-items.png +0 -0
- package/components/menu/screenshots/menu.png +0 -0
- package/components/menu/screenshots/nested-menu.png +0 -0
- package/components/menu/screenshots/radio-menu.png +0 -0
- package/components/meter/screenshots/d2l-meter-circle-completed.png +0 -0
- package/components/meter/screenshots/d2l-meter-circle-has-progress.png +0 -0
- package/components/meter/screenshots/d2l-meter-circle-no-progress.png +0 -0
- package/components/meter/screenshots/d2l-meter-linear-completed.png +0 -0
- package/components/meter/screenshots/d2l-meter-linear-has-progress.png +0 -0
- package/components/meter/screenshots/d2l-meter-linear-no-progress.png +0 -0
- package/components/meter/screenshots/d2l-meter-radial-completed.png +0 -0
- package/components/meter/screenshots/d2l-meter-radial-has-progress.png +0 -0
- package/components/meter/screenshots/d2l-meter-radial-no-progress.png +0 -0
- package/components/meter/screenshots/d2l-meter-radial-with-text.png +0 -0
- package/components/overflow-group/screenshots/overflow-group.png +0 -0
- package/components/scroll-wrapper/screenshots/scroll-wrapper.gif +0 -0
- package/components/selection/screenshots/selection-multiple.png +0 -0
- package/components/selection/screenshots/selection-single.png +0 -0
- package/components/skeleton/screenshots/container.png +0 -0
- package/components/skeleton/screenshots/overview.png +0 -0
- package/components/skeleton/screenshots/paragraph.png +0 -0
- package/components/skeleton/screenshots/text-input.png +0 -0
- package/components/status-indicator/screenshots/bold-indicators.png +0 -0
- package/components/status-indicator/screenshots/default-indicator.png +0 -0
- package/components/status-indicator/screenshots/subtle-indicators.png +0 -0
- package/components/switch/screenshots/switch-visibility.png +0 -0
- package/components/switch/screenshots/switch.png +0 -0
- package/components/table/screenshots/default.png +0 -0
- package/components/table/screenshots/light.png +0 -0
- package/components/table/screenshots/selection.gif +0 -0
- package/components/table/screenshots/sorting.gif +0 -0
- package/components/table/screenshots/sticky.gif +0 -0
- package/components/tabs/screenshots/tabs.png +0 -0
- package/components/tooltip/screenshots/tooltip-boundary.png +0 -0
- package/components/tooltip/screenshots/tooltip-error.png +0 -0
- package/components/typography/screenshots/body-compact.png +0 -0
- package/components/typography/screenshots/body-small.png +0 -0
- package/components/typography/screenshots/body-standard.png +0 -0
- package/components/typography/screenshots/headings.png +0 -0
- package/components/typography/screenshots/labels.png +0 -0
- package/directives/animate/screenshots/focus.gif +0 -0
- package/directives/animate/screenshots/show-hide.gif +0 -0
- package/templates/primary-secondary/screenshots/primary-secondary.gif +0 -0
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Prism Helper</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<meta charset="UTF-8">
|
|
7
|
+
<link rel="stylesheet" href="../../components/demo/styles.css" type="text/css">
|
|
8
|
+
<script type="module">
|
|
9
|
+
import '../../components/colors/colors.js';
|
|
10
|
+
import '../../components/switch/switch.js';
|
|
11
|
+
import '../../components/typography/typography.js';
|
|
12
|
+
import { codeStyles, formatCodeElement } from '../prism.js';
|
|
13
|
+
import { css, html, LitElement } from 'lit';
|
|
14
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
15
|
+
|
|
16
|
+
class DemoPrism extends LitElement {
|
|
17
|
+
static get properties() {
|
|
18
|
+
return {
|
|
19
|
+
dark: { type: Boolean, reflect: true }
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
static get styles() {
|
|
23
|
+
return [codeStyles, css`
|
|
24
|
+
:host {
|
|
25
|
+
display: block;
|
|
26
|
+
}
|
|
27
|
+
`];
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
const classes = { 'd2l-code': true, 'd2l-code-dark': this.dark };
|
|
31
|
+
return html`
|
|
32
|
+
<pre class="${classMap(classes)}"><code class="language-javascript line-numbers">function helloGrumpy(name) {
|
|
33
|
+
console.log(\`Hi there \${name}. Here's some really long text to test overflowing the bounding container.\`);
|
|
34
|
+
}
|
|
35
|
+
helloGrumpy('Wizard');
|
|
36
|
+
</code></pre>
|
|
37
|
+
|
|
38
|
+
<pre class="${classMap(classes)}"><code class="language-bash line-numbers">#!/bin/bash
|
|
39
|
+
if [ -d $directory ]; then
|
|
40
|
+
echo "Directory exists"
|
|
41
|
+
else
|
|
42
|
+
echo "Directory does not exists"
|
|
43
|
+
fi</code></pre>
|
|
44
|
+
|
|
45
|
+
<pre class="${classMap(classes)}"><code class="language-css line-numbers">.grumpy > img {
|
|
46
|
+
height: 100%;
|
|
47
|
+
width: 100%;
|
|
48
|
+
}</code></pre>
|
|
49
|
+
|
|
50
|
+
<pre class="${classMap(classes)}"><code class="language-json line-numbers">{
|
|
51
|
+
"jinxed": "gnomes",
|
|
52
|
+
"grumpy": [ "wizards" ]
|
|
53
|
+
}
|
|
54
|
+
</code></pre>
|
|
55
|
+
|
|
56
|
+
<pre class="${classMap(classes)}"><code class="language-sql line-numbers">DECLARE @MyCounter INT; /* keyword, variable, punctuation */
|
|
57
|
+
|
|
58
|
+
SELECT AVG(Calories) AS AverageCalories FROM Desserts; /* keyword, function */
|
|
59
|
+
|
|
60
|
+
SELECT * FROM Desserts /* keyword, operator */
|
|
61
|
+
|
|
62
|
+
SET ROWCOUNT 4; /* keyword, number */
|
|
63
|
+
|
|
64
|
+
SET @Hidden = FALSE; /* keyword, variable, boolean */
|
|
65
|
+
|
|
66
|
+
SET @Donuts = 'Yummy'; /* keyword, variable, string */
|
|
67
|
+
</code></pre>
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
updated(changedProperties) {
|
|
71
|
+
super.updated(changedProperties);
|
|
72
|
+
this.shadowRoot.querySelectorAll('pre').forEach(code => formatCodeElement(code));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
customElements.define('d2l-demo-prism', DemoPrism);
|
|
76
|
+
</script>
|
|
77
|
+
<style>
|
|
78
|
+
html {
|
|
79
|
+
font-size: 20px;
|
|
80
|
+
}
|
|
81
|
+
body {
|
|
82
|
+
padding: 1rem;
|
|
83
|
+
}
|
|
84
|
+
.heading-container {
|
|
85
|
+
display: flex;
|
|
86
|
+
}
|
|
87
|
+
.heading-container > h1 {
|
|
88
|
+
flex: auto;
|
|
89
|
+
}
|
|
90
|
+
.heading-container > d2l-switch {
|
|
91
|
+
align-self: center;
|
|
92
|
+
flex: none;
|
|
93
|
+
}
|
|
94
|
+
table {
|
|
95
|
+
font-family: 'Lato', 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;
|
|
96
|
+
font-size: 16px;
|
|
97
|
+
}
|
|
98
|
+
th {
|
|
99
|
+
text-align: left;
|
|
100
|
+
}
|
|
101
|
+
tr > td:first-child {
|
|
102
|
+
width: 300px;
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
105
|
+
</head>
|
|
106
|
+
<body class="d2l-typography">
|
|
107
|
+
|
|
108
|
+
<!-- This page intentionally does not use d2l-demo-page so we can properly demo/test the loader without PrismJS being loaded by those components -->
|
|
109
|
+
|
|
110
|
+
<div class="heading-container">
|
|
111
|
+
<h1 class="d2l-heading-2">Prism Helper</h1>
|
|
112
|
+
<d2l-switch text="Dark" on text-position="start" on></d2l-switch>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<h2 class="d2l-heading-3">Tokens</h2>
|
|
116
|
+
|
|
117
|
+
<table style="width: 100%;">
|
|
118
|
+
<thead>
|
|
119
|
+
<tr>
|
|
120
|
+
<th>Token</th>
|
|
121
|
+
<th>Example</th>
|
|
122
|
+
</tr>
|
|
123
|
+
</thead>
|
|
124
|
+
<tbody>
|
|
125
|
+
<tr>
|
|
126
|
+
<td>keyword</td>
|
|
127
|
+
<td>
|
|
128
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">import { stuff } from 'some/where.js';</code></pre>
|
|
129
|
+
</td>
|
|
130
|
+
</tr>
|
|
131
|
+
<tr>
|
|
132
|
+
<td>builtin</td>
|
|
133
|
+
<td>
|
|
134
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-python">pi = round(float('3.14159'), 2)</code></pre>
|
|
135
|
+
</td>
|
|
136
|
+
</tr>
|
|
137
|
+
<tr>
|
|
138
|
+
<td>class-name</td>
|
|
139
|
+
<td>
|
|
140
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">class Wizard extends Human { /* ... */ }</code></pre>
|
|
141
|
+
</td>
|
|
142
|
+
</tr>
|
|
143
|
+
<tr>
|
|
144
|
+
<td>function</td>
|
|
145
|
+
<td>
|
|
146
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">function helloGrumpy(name) { /* ... */ }
|
|
147
|
+
helloGrumpy('Wizard');</code></pre>
|
|
148
|
+
</td>
|
|
149
|
+
</tr>
|
|
150
|
+
<tr>
|
|
151
|
+
<td>parameter</td>
|
|
152
|
+
<td>
|
|
153
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">function helloGrumpy(name) { /* ... */ }</code></pre>
|
|
154
|
+
</td>
|
|
155
|
+
</tr>
|
|
156
|
+
<tr>
|
|
157
|
+
<td>boolean</td>
|
|
158
|
+
<td>
|
|
159
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">const wizardsLikeBeer = false;</code></pre>
|
|
160
|
+
</td>
|
|
161
|
+
</tr>
|
|
162
|
+
<tr>
|
|
163
|
+
<td>number</td>
|
|
164
|
+
<td>
|
|
165
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">const favouriteNumber = 3.14159;</code></pre>
|
|
166
|
+
</td>
|
|
167
|
+
</tr>
|
|
168
|
+
<tr>
|
|
169
|
+
<td>string</td>
|
|
170
|
+
<td>
|
|
171
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">const hiGrumpy = 'Hi Grumpy!';</code></pre>
|
|
172
|
+
</td>
|
|
173
|
+
</tr>
|
|
174
|
+
<tr>
|
|
175
|
+
<td>template-string, template-punctuation</td>
|
|
176
|
+
<td>
|
|
177
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">const hiGrumpy = `Hi Grumpy!`;</code></pre>
|
|
178
|
+
</td>
|
|
179
|
+
</tr>
|
|
180
|
+
<tr>
|
|
181
|
+
<td>interpolation, interpolation-punctuation</td>
|
|
182
|
+
<td>
|
|
183
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">console.log(`Hi there ${name}.`);</code></pre>
|
|
184
|
+
</td>
|
|
185
|
+
</tr>
|
|
186
|
+
<tr>
|
|
187
|
+
<td>char</td>
|
|
188
|
+
<td>
|
|
189
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript"></code></pre>
|
|
190
|
+
</td>
|
|
191
|
+
</tr>
|
|
192
|
+
<tr>
|
|
193
|
+
<td>symbol</td>
|
|
194
|
+
<td>
|
|
195
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript"></code></pre>
|
|
196
|
+
</td>
|
|
197
|
+
</tr>
|
|
198
|
+
<tr>
|
|
199
|
+
<td>regex</td>
|
|
200
|
+
<td>
|
|
201
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">let entity = /&#x?[\da-f]{1,8};/;</code></pre>
|
|
202
|
+
</td>
|
|
203
|
+
</tr>
|
|
204
|
+
<tr>
|
|
205
|
+
<td>url</td>
|
|
206
|
+
<td>
|
|
207
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-css">body { background: url("wizard.png"); }</code></pre>
|
|
208
|
+
</td>
|
|
209
|
+
</tr>
|
|
210
|
+
<tr>
|
|
211
|
+
<td>operator</td>
|
|
212
|
+
<td>
|
|
213
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">x += (y + 4 >> -z === w) ? b ** c : ~a;</code></pre>
|
|
214
|
+
</td>
|
|
215
|
+
</tr>
|
|
216
|
+
<tr>
|
|
217
|
+
<td>variable</td>
|
|
218
|
+
<td>
|
|
219
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-sql">DECLARE @MyCounter INT;</code></pre>
|
|
220
|
+
</td>
|
|
221
|
+
</tr>
|
|
222
|
+
<tr>
|
|
223
|
+
<td>constant</td>
|
|
224
|
+
<td>
|
|
225
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">const PI = 3.14159;</code></pre>
|
|
226
|
+
</td>
|
|
227
|
+
</tr>
|
|
228
|
+
<tr>
|
|
229
|
+
<td>property</td>
|
|
230
|
+
<td>
|
|
231
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-css">.grumpy > img { height: 100%; }</code></pre>
|
|
232
|
+
</td>
|
|
233
|
+
</tr>
|
|
234
|
+
<tr>
|
|
235
|
+
<td>punctuation</td>
|
|
236
|
+
<td>
|
|
237
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">import { stuff } from 'some/where.js';</code></pre>
|
|
238
|
+
</td>
|
|
239
|
+
</tr>
|
|
240
|
+
<tr>
|
|
241
|
+
<td>important</td>
|
|
242
|
+
<td>
|
|
243
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-css">.grumpy > img { height: 100% !important; }</code></pre>
|
|
244
|
+
</td>
|
|
245
|
+
</tr>
|
|
246
|
+
<tr>
|
|
247
|
+
<td>comment</td>
|
|
248
|
+
<td>
|
|
249
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-javascript">/* grump wizards */</code></pre>
|
|
250
|
+
</td>
|
|
251
|
+
</tr>
|
|
252
|
+
<tr>
|
|
253
|
+
<td>tag</td>
|
|
254
|
+
<td>
|
|
255
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-markup"><h1>Grumpy Wizards</h1></code></pre>
|
|
256
|
+
</td>
|
|
257
|
+
</tr>
|
|
258
|
+
<tr>
|
|
259
|
+
<td>attr-name, attr-value</td>
|
|
260
|
+
<td>
|
|
261
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-markup"><h1 class="dangerous">Grumpy Wizards</h1></code></pre>
|
|
262
|
+
</td>
|
|
263
|
+
</tr>
|
|
264
|
+
<tr>
|
|
265
|
+
<td>namespace</td>
|
|
266
|
+
<td>
|
|
267
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-java">throw new java.lang.UnsupportedOperationException();</code></pre>
|
|
268
|
+
</td>
|
|
269
|
+
</tr>
|
|
270
|
+
<tr>
|
|
271
|
+
<td>prolog</td>
|
|
272
|
+
<td>
|
|
273
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-markup"><?xml version="1.0" encoding="utf-8"?></code></pre>
|
|
274
|
+
</td>
|
|
275
|
+
</tr>
|
|
276
|
+
<tr>
|
|
277
|
+
<td>doctype</td>
|
|
278
|
+
<td>
|
|
279
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-markup"><!DOCTYPE html></code></pre>
|
|
280
|
+
</td>
|
|
281
|
+
</tr>
|
|
282
|
+
<tr>
|
|
283
|
+
<td>cdata</td>
|
|
284
|
+
<td>
|
|
285
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-markup"><![CDATA[ grumpy wizards eat donuts ]]></code></pre>
|
|
286
|
+
</td>
|
|
287
|
+
</tr>
|
|
288
|
+
<tr>
|
|
289
|
+
<td>entity</td>
|
|
290
|
+
<td>
|
|
291
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-markup">&pound; &#163;</code></pre>
|
|
292
|
+
</td>
|
|
293
|
+
</tr>
|
|
294
|
+
<tr>
|
|
295
|
+
<td>atrule</td>
|
|
296
|
+
<td>
|
|
297
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-css">@media (prefers-reduced-motion: reduce) { /* no animations */ }</code></pre>
|
|
298
|
+
</td>
|
|
299
|
+
</tr>
|
|
300
|
+
<tr>
|
|
301
|
+
<td>selector</td>
|
|
302
|
+
<td>
|
|
303
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-css">.grumpy > img { /* ... */ }</code></pre>
|
|
304
|
+
</td>
|
|
305
|
+
</tr>
|
|
306
|
+
<tr>
|
|
307
|
+
<td>null</td>
|
|
308
|
+
<td>
|
|
309
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-json">{ "fritter": null }</code></pre>
|
|
310
|
+
</td>
|
|
311
|
+
</tr>
|
|
312
|
+
</tbody>
|
|
313
|
+
</table>
|
|
314
|
+
|
|
315
|
+
<h2 class="d2l-heading-3">More Samples (Global Scope)</h2>
|
|
316
|
+
|
|
317
|
+
<pre class="d2l-code"><code class="language-javascript line-numbers">// comment
|
|
318
|
+
/* comment */
|
|
319
|
+
|
|
320
|
+
import { stuff } from 'some/where.js'; // keyword, punctuation, string
|
|
321
|
+
|
|
322
|
+
function helloGrumpy(name) { // keyword, function, parameter
|
|
323
|
+
console.log(`Hi there ${name}.`); // template-string, template-punctuation, interpolation, interpolation-punctuation
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
class Wizard extends Human { } // keyword, class-name
|
|
327
|
+
|
|
328
|
+
const grumpy = new Wizard(); // keyword, operator, class-name
|
|
329
|
+
|
|
330
|
+
let wizardFoods = [...donuts, ... cakes, ...pies]; // keyword, operator
|
|
331
|
+
|
|
332
|
+
const wizardsLikeBeer = false; // keyword, operator, boolean
|
|
333
|
+
|
|
334
|
+
const favouriteNumber = 3.14159; // keyword, operator, number
|
|
335
|
+
|
|
336
|
+
const PI = 3.14159; // keyword, operator, constant
|
|
337
|
+
|
|
338
|
+
const regex = /[^\w\s]/g; // keyword, operator, regex, regex-delimiter, regex-source, regex-flags
|
|
339
|
+
</code></pre>
|
|
340
|
+
|
|
341
|
+
<pre class="d2l-code"><code class="language-css line-numbers">.grumpy > img { /* selector */
|
|
342
|
+
background-image: url("smile.png"); /* property, url, string */
|
|
343
|
+
height: 100%; /* property, punctuation */
|
|
344
|
+
width: var(--some-var); /* property, punctuation, function */
|
|
345
|
+
}
|
|
346
|
+
@font-face { /* atrule, rule */
|
|
347
|
+
font-family: 'Lato'; /* property, punctuation, string */
|
|
348
|
+
font-style: normal;
|
|
349
|
+
src: local('Lato Regular'); /* property, function, string */
|
|
350
|
+
}
|
|
351
|
+
@media (prefers-reduced-motion: reduce) { /* atrule, rule, property */
|
|
352
|
+
:host([opened]), :host([opened-above]) {
|
|
353
|
+
animation: none !important; /* property, important */
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
</code></pre>
|
|
357
|
+
|
|
358
|
+
<pre class="d2l-code"><code class="language-markup line-numbers"><!DOCTYPE html> <!-- doctype, doctype-tag, name -->
|
|
359
|
+
<html> <!-- tag, punctuation -->
|
|
360
|
+
<body class="typography"> <!-- attr-name, attr-value -->
|
|
361
|
+
<![CDATA[ some cdata section ]]> <!-- cdata -->
|
|
362
|
+
<div style="color: blue;"> <!-- attr-name, attr-value, attr-equals, value, css, property -->
|
|
363
|
+
&pound; <!-- entity, named-entity -->
|
|
364
|
+
&#163; <!-- entity -->
|
|
365
|
+
</div>
|
|
366
|
+
</body>
|
|
367
|
+
</html>
|
|
368
|
+
</code></pre>
|
|
369
|
+
|
|
370
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-sql line-numbers">DECLARE @MyCounter INT; /* keyword, variable, punctuation */
|
|
371
|
+
|
|
372
|
+
SELECT AVG(Calories) AS AverageCalories FROM Desserts; /* keyword, function */
|
|
373
|
+
|
|
374
|
+
SELECT * FROM Desserts /* keyword, operator */
|
|
375
|
+
|
|
376
|
+
SET ROWCOUNT 4; /* keyword, number */
|
|
377
|
+
|
|
378
|
+
SET @Hidden = FALSE; /* keyword, variable, boolean */
|
|
379
|
+
|
|
380
|
+
SET @Donuts = 'Yummy'; /* keyword, variable, string */
|
|
381
|
+
</code></pre>
|
|
382
|
+
|
|
383
|
+
<pre class="d2l-code d2l-code-dark"><code class="language-json line-numbers">{ /* punctuation */
|
|
384
|
+
"jinxed": "gnomes", /* property, operator, string */
|
|
385
|
+
"grumpy": [ "wizards" ],
|
|
386
|
+
"jelly": 99, /* property, operator, number */
|
|
387
|
+
"donut": true, /* property, operator, boolean */
|
|
388
|
+
"fritter": null /* property, operator, null, keyword */
|
|
389
|
+
}
|
|
390
|
+
</code></pre>
|
|
391
|
+
|
|
392
|
+
<h2 class="d2l-heading-3">More Samples (Web Component Scope)</h2>
|
|
393
|
+
|
|
394
|
+
<d2l-demo-prism dark></d2l-demo-prism>
|
|
395
|
+
|
|
396
|
+
<script type="module">
|
|
397
|
+
import { formatCodeElement } from '../prism.js';
|
|
398
|
+
|
|
399
|
+
const formatCodeElements = () => {
|
|
400
|
+
const darkSwitch = document.querySelector('d2l-switch');
|
|
401
|
+
const codeElements = document.querySelectorAll('pre');
|
|
402
|
+
codeElements.forEach(codeElement => {
|
|
403
|
+
if (darkSwitch.on) codeElement.classList.add('d2l-code-dark');
|
|
404
|
+
else codeElement.classList.remove('d2l-code-dark');
|
|
405
|
+
formatCodeElement(codeElement);
|
|
406
|
+
});
|
|
407
|
+
document.querySelector('d2l-demo-prism').dark = darkSwitch.on;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
formatCodeElements();
|
|
411
|
+
|
|
412
|
+
const darkSwitch = document.querySelector('d2l-switch');
|
|
413
|
+
darkSwitch.addEventListener('change', formatCodeElements);
|
|
414
|
+
|
|
415
|
+
</script>
|
|
416
|
+
</body>
|
|
417
|
+
</html>
|