@brightspace-ui/core 3.227.3 → 3.227.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/components/button/button.js +8 -8
  2. package/components/colors/colors.js +8 -0
  3. package/components/count-badge/count-badge-icon.js +1 -1
  4. package/components/count-badge/count-badge-mixin.js +4 -4
  5. package/components/demo/test/demo-page-settings.test.js +25 -0
  6. package/components/demo/test/demo-page.test.js +17 -0
  7. package/package.json +1 -1
  8. package/components/alert/demo/alert-toast.html +0 -106
  9. package/components/alert/demo/alert.html +0 -82
  10. package/components/backdrop/demo/backdrop-loading.html +0 -166
  11. package/components/backdrop/demo/backdrop.html +0 -57
  12. package/components/breadcrumbs/demo/breadcrumbs.html +0 -53
  13. package/components/button/demo/button-add.html +0 -55
  14. package/components/button/demo/button-copy.html +0 -122
  15. package/components/button/demo/button-icon.html +0 -174
  16. package/components/button/demo/button-move.html +0 -38
  17. package/components/button/demo/button-split.html +0 -76
  18. package/components/button/demo/button-subtle.html +0 -132
  19. package/components/button/demo/button-toggle.html +0 -80
  20. package/components/button/demo/button.html +0 -67
  21. package/components/button/demo/floating-buttons-in-frame.html +0 -44
  22. package/components/button/demo/floating-buttons-in-tabs.html +0 -244
  23. package/components/button/demo/floating-buttons-page.html +0 -100
  24. package/components/button/demo/floating-buttons.html +0 -101
  25. package/components/calendar/demo/calendar.html +0 -76
  26. package/components/card/demo/card.html +0 -304
  27. package/components/collapsible-panel/demo/collapsible-panel.html +0 -218
  28. package/components/colors/demo/color-swatch.js +0 -240
  29. package/components/colors/demo/colors.html +0 -139
  30. package/components/count-badge/demo/count-badge-icon.html +0 -48
  31. package/components/count-badge/demo/count-badge.html +0 -73
  32. package/components/demo/demo/demo-snippet.html +0 -71
  33. package/components/description-list/demo/description-list-test.js +0 -142
  34. package/components/description-list/demo/description-list.html +0 -48
  35. package/components/dialog/demo/dialog-async-content-until.js +0 -89
  36. package/components/dialog/demo/dialog-async-content.js +0 -72
  37. package/components/dialog/demo/dialog-confirm.html +0 -102
  38. package/components/dialog/demo/dialog-container.js +0 -40
  39. package/components/dialog/demo/dialog-fullscreen.html +0 -273
  40. package/components/dialog/demo/dialog-nested.html +0 -94
  41. package/components/dialog/demo/dialog.html +0 -398
  42. package/components/dropdown/demo/dropdown-button.html +0 -102
  43. package/components/dropdown/demo/dropdown-context-menu.html +0 -129
  44. package/components/dropdown/demo/dropdown-flicker-inner.html +0 -70
  45. package/components/dropdown/demo/dropdown-flicker.html +0 -142
  46. package/components/dropdown/demo/dropdown-menu-demo-view.js +0 -37
  47. package/components/dropdown/demo/dropdown-menu.html +0 -227
  48. package/components/dropdown/demo/dropdown-more.html +0 -160
  49. package/components/dropdown/demo/dropdown-positioning.html +0 -127
  50. package/components/dropdown/demo/dropdown-tabs.html +0 -87
  51. package/components/dropdown/demo/dropdown.html +0 -217
  52. package/components/empty-state/demo/empty-state.html +0 -94
  53. package/components/expand-collapse/demo/expand-collapse-content.html +0 -58
  54. package/components/filter/demo/filter-load-more-demo.js +0 -182
  55. package/components/filter/demo/filter-overflow-group.html +0 -246
  56. package/components/filter/demo/filter-search-demo.js +0 -135
  57. package/components/filter/demo/filter-tags.html +0 -115
  58. package/components/filter/demo/filter.html +0 -230
  59. package/components/focus-trap/demo/focus-trap.html +0 -75
  60. package/components/form/demo/form-demo.js +0 -105
  61. package/components/form/demo/form-dialog-demo.js +0 -94
  62. package/components/form/demo/form-panel-demo.js +0 -89
  63. package/components/form/demo/form.html +0 -37
  64. package/components/hierarchical-view/demo/hierarchical-view.html +0 -221
  65. package/components/html-block/demo/html-block-code.html +0 -55
  66. package/components/html-block/demo/html-block.html +0 -696
  67. package/components/icons/demo/icon-color-override.js +0 -23
  68. package/components/icons/demo/icon-custom.html +0 -112
  69. package/components/icons/demo/icon-size-override.js +0 -24
  70. package/components/icons/demo/icon.html +0 -52
  71. package/components/inputs/demo/input-checkbox.html +0 -118
  72. package/components/inputs/demo/input-color-palette.js +0 -67
  73. package/components/inputs/demo/input-color.html +0 -110
  74. package/components/inputs/demo/input-date-range.html +0 -114
  75. package/components/inputs/demo/input-date-time-range.html +0 -128
  76. package/components/inputs/demo/input-date-time.html +0 -100
  77. package/components/inputs/demo/input-date.html +0 -81
  78. package/components/inputs/demo/input-group.html +0 -56
  79. package/components/inputs/demo/input-number.html +0 -136
  80. package/components/inputs/demo/input-percent.html +0 -99
  81. package/components/inputs/demo/input-radio-label-test.js +0 -45
  82. package/components/inputs/demo/input-radio-solo-test.js +0 -47
  83. package/components/inputs/demo/input-radio.html +0 -119
  84. package/components/inputs/demo/input-search.html +0 -75
  85. package/components/inputs/demo/input-select-test.js +0 -60
  86. package/components/inputs/demo/input-select.html +0 -45
  87. package/components/inputs/demo/input-text.html +0 -163
  88. package/components/inputs/demo/input-textarea.html +0 -124
  89. package/components/inputs/demo/input-time-range.html +0 -121
  90. package/components/inputs/demo/input-time.html +0 -95
  91. package/components/link/demo/link.html +0 -111
  92. package/components/list/demo/demo-list-nav.js +0 -170
  93. package/components/list/demo/demo-list-nested-iterations-helper.js +0 -168
  94. package/components/list/demo/demo-list-nested-lazy-load.js +0 -133
  95. package/components/list/demo/demo-list-nested.js +0 -291
  96. package/components/list/demo/demo-list.js +0 -241
  97. package/components/list/demo/list-color.html +0 -423
  98. package/components/list/demo/list-demo-scenarios.js +0 -380
  99. package/components/list/demo/list-drag-and-drop-position.js +0 -102
  100. package/components/list/demo/list-drag-and-drop.html +0 -82
  101. package/components/list/demo/list-expand-collapse.html +0 -136
  102. package/components/list/demo/list-item-actions.html +0 -371
  103. package/components/list/demo/list-item-custom.js +0 -204
  104. package/components/list/demo/list-item-layouts.html +0 -331
  105. package/components/list/demo/list-item-scroll.html +0 -122
  106. package/components/list/demo/list-layout.html +0 -575
  107. package/components/list/demo/list-nav.html +0 -110
  108. package/components/list/demo/list-nested.html +0 -270
  109. package/components/list/demo/list-selection.html +0 -301
  110. package/components/list/demo/list.html +0 -319
  111. package/components/loading-spinner/demo/loading-spinner-override.js +0 -34
  112. package/components/loading-spinner/demo/loading-spinner.html +0 -63
  113. package/components/menu/demo/checkbox-menu.html +0 -52
  114. package/components/menu/demo/custom-menu-item.js +0 -37
  115. package/components/menu/demo/custom-view.js +0 -63
  116. package/components/menu/demo/menu.html +0 -211
  117. package/components/menu/demo/radio-menu.html +0 -52
  118. package/components/meter/demo/meter.html +0 -115
  119. package/components/more-less/demo/more-less-test.js +0 -67
  120. package/components/more-less/demo/more-less.html +0 -71
  121. package/components/object-property-list/demo/object-property-list.html +0 -99
  122. package/components/offscreen/demo/offscreen-demo.js +0 -16
  123. package/components/offscreen/demo/offscreen.html +0 -44
  124. package/components/overflow-group/demo/demo-overflow-group.js +0 -29
  125. package/components/overflow-group/demo/overflow-group.html +0 -110
  126. package/components/paging/demo/pager-load-more.html +0 -120
  127. package/components/popover/demo/popover.html +0 -309
  128. package/components/progress/demo/progress.html +0 -104
  129. package/components/scroll-wrapper/demo/scroll-wrapper-test.js +0 -108
  130. package/components/scroll-wrapper/demo/scroll-wrapper.html +0 -52
  131. package/components/selection/demo/demo-selection.js +0 -35
  132. package/components/selection/demo/selection.html +0 -198
  133. package/components/skeleton/demo/skeleton-group-nested-test.js +0 -71
  134. package/components/skeleton/demo/skeleton-group-test-wrapper.js +0 -18
  135. package/components/skeleton/demo/skeleton-group-test.js +0 -91
  136. package/components/skeleton/demo/skeleton-mixin.html +0 -78
  137. package/components/skeleton/demo/skeleton-test-box.js +0 -34
  138. package/components/skeleton/demo/skeleton-test-container.js +0 -45
  139. package/components/skeleton/demo/skeleton-test-heading.js +0 -44
  140. package/components/skeleton/demo/skeleton-test-link.js +0 -47
  141. package/components/skeleton/demo/skeleton-test-paragraph.js +0 -54
  142. package/components/skeleton/demo/skeleton-test-stack.js +0 -38
  143. package/components/skeleton/demo/skeleton-test-width.js +0 -20
  144. package/components/sorting/demo/sort.html +0 -37
  145. package/components/status-indicator/demo/status-indicator.html +0 -99
  146. package/components/switch/demo/switch.html +0 -95
  147. package/components/table/demo/table-test.js +0 -271
  148. package/components/table/demo/table.html +0 -107
  149. package/components/tabs/demo/tab-custom.js +0 -39
  150. package/components/tabs/demo/tabs-array.js +0 -43
  151. package/components/tabs/demo/tabs.html +0 -558
  152. package/components/tag-list/demo/tag-list.html +0 -117
  153. package/components/tooltip/demo/tooltip.html +0 -275
  154. package/components/typography/demo/typography.html +0 -93
  155. package/components/view-switcher/demo/demo-table-view.js +0 -41
  156. package/components/view-switcher/demo/view-switcher.html +0 -71
  157. package/directives/animate/demo/animate-test.js +0 -98
  158. package/directives/animate/demo/index.html +0 -23
  159. package/helpers/demo/announce-test.js +0 -37
  160. package/helpers/demo/announce.html +0 -19
  161. package/helpers/demo/dismissible-test.js +0 -66
  162. package/helpers/demo/dismissible.html +0 -38
  163. package/helpers/demo/gestures.html +0 -58
  164. package/helpers/demo/prism.html +0 -694
  165. package/helpers/demo/template-tags.html +0 -118
  166. package/mixins/arrow-keys/demo/arrow-keys-mixin.html +0 -29
  167. package/mixins/arrow-keys/demo/arrow-keys-test.js +0 -38
  168. package/mixins/async-container/demo/async-container.html +0 -109
  169. package/mixins/async-container/demo/async-container.js +0 -27
  170. package/mixins/async-container/demo/async-item.js +0 -80
  171. package/mixins/labelled/demo/labelled-mixin.html +0 -90
  172. package/mixins/localize/demo/localize-mixin-greeting.js +0 -39
  173. package/mixins/localize/demo/localize-mixin-mission.js +0 -25
  174. package/mixins/localize/demo/localize-mixin.html +0 -28
  175. package/templates/primary-secondary/demo/form.html +0 -55
  176. package/templates/primary-secondary/demo/index.html +0 -27
  177. package/templates/primary-secondary/demo/integration.html +0 -457
  178. package/templates/primary-secondary/demo/overflow-hidden.html +0 -22
  179. package/templates/primary-secondary/demo/width-type-normal.html +0 -26
@@ -1,694 +0,0 @@
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, 'line-numbers': true };
31
- return html`
32
- <pre class="${classMap(classes)}"><code class="language-javascript">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">#!/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">.grumpy > img {
46
- height: 100%;
47
- width: 100%;
48
- }</code></pre>
49
-
50
- <pre class="${classMap(classes)}"><code class="language-json">{
51
- "jinxed": "gnomes",
52
- "grumpy": [ "wizards" ]
53
- }
54
- </code></pre>
55
-
56
- <pre class="${classMap(classes)}"><code class="language-sql">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
- background-color: white;
80
- font-size: 20px;
81
- }
82
- body {
83
- padding: 1rem;
84
- }
85
- .heading-container {
86
- display: flex;
87
- }
88
- .heading-container > h1 {
89
- flex: auto;
90
- }
91
- .heading-container > d2l-switch {
92
- align-self: center;
93
- flex: none;
94
- }
95
- table {
96
- font-family: "Lato", "Lucida Sans Unicode", "Lucida Grande", sans-serif;
97
- font-size: 16px;
98
- }
99
- th {
100
- text-align: left;
101
- }
102
- tr > td:first-child {
103
- width: 300px;
104
- }
105
- pre {
106
- max-height: 600px;
107
- overflow: auto;
108
- }
109
- </style>
110
- </head>
111
- <body class="d2l-typography">
112
-
113
- <!-- This page intentionally does not use d2l-demo-page so we can properly demo/test the loader without PrismJS being loaded by those components -->
114
-
115
- <div class="heading-container">
116
- <h1 class="d2l-heading-2">Prism Helper</h1>
117
- <d2l-switch text="Dark" on text-position="start" on></d2l-switch>
118
- </div>
119
-
120
- <h2 class="d2l-heading-3">Tokens</h2>
121
-
122
- <table style="width: 100%;">
123
- <thead>
124
- <tr>
125
- <th>Token</th>
126
- <th>Example</th>
127
- </tr>
128
- </thead>
129
- <tbody>
130
- <tr>
131
- <td>keyword</td>
132
- <td>
133
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">import { stuff } from 'some/where.js';</code></pre>
134
- </td>
135
- </tr>
136
- <tr>
137
- <td>builtin</td>
138
- <td>
139
- <pre class="d2l-code d2l-code-dark"><code class="language-python">pi = round(float('3.14159'), 2)</code></pre>
140
- </td>
141
- </tr>
142
- <tr>
143
- <td>class-name</td>
144
- <td>
145
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">class Wizard extends Human { /* ... */ }</code></pre>
146
- </td>
147
- </tr>
148
- <tr>
149
- <td>function</td>
150
- <td>
151
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">function helloGrumpy(name) { /* ... */ }
152
- helloGrumpy('Wizard');</code></pre>
153
- </td>
154
- </tr>
155
- <tr>
156
- <td>parameter</td>
157
- <td>
158
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">function helloGrumpy(name) { /* ... */ }</code></pre>
159
- </td>
160
- </tr>
161
- <tr>
162
- <td>boolean</td>
163
- <td>
164
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">const wizardsLikeBeer = false;</code></pre>
165
- </td>
166
- </tr>
167
- <tr>
168
- <td>number</td>
169
- <td>
170
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">const favouriteNumber = 3.14159;</code></pre>
171
- </td>
172
- </tr>
173
- <tr>
174
- <td>string</td>
175
- <td>
176
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">const hiGrumpy = 'Hi Grumpy!';</code></pre>
177
- </td>
178
- </tr>
179
- <tr>
180
- <td>template-string, template-punctuation</td>
181
- <td>
182
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">const hiGrumpy = `Hi Grumpy!`;</code></pre>
183
- </td>
184
- </tr>
185
- <tr>
186
- <td>interpolation, interpolation-punctuation</td>
187
- <td>
188
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">console.log(`Hi there ${name}.`);</code></pre>
189
- </td>
190
- </tr>
191
- <tr>
192
- <td>char</td>
193
- <td>
194
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript"></code></pre>
195
- </td>
196
- </tr>
197
- <tr>
198
- <td>symbol</td>
199
- <td>
200
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript"></code></pre>
201
- </td>
202
- </tr>
203
- <tr>
204
- <td>regex</td>
205
- <td>
206
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">let entity = /&amp;#x?[\da-f]{1,8};/;</code></pre>
207
- </td>
208
- </tr>
209
- <tr>
210
- <td>url</td>
211
- <td>
212
- <pre class="d2l-code d2l-code-dark"><code class="language-css">body { background: url("wizard.png"); }</code></pre>
213
- </td>
214
- </tr>
215
- <tr>
216
- <td>operator</td>
217
- <td>
218
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">x += (y + 4 &gt;&gt; -z === w) ? b ** c : ~a;</code></pre>
219
- </td>
220
- </tr>
221
- <tr>
222
- <td>variable</td>
223
- <td>
224
- <pre class="d2l-code d2l-code-dark"><code class="language-sql">DECLARE @MyCounter INT;</code></pre>
225
- </td>
226
- </tr>
227
- <tr>
228
- <td>constant</td>
229
- <td>
230
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">const PI = 3.14159;</code></pre>
231
- </td>
232
- </tr>
233
- <tr>
234
- <td>property</td>
235
- <td>
236
- <pre class="d2l-code d2l-code-dark"><code class="language-css">.grumpy > img { height: 100%; }</code></pre>
237
- </td>
238
- </tr>
239
- <tr>
240
- <td>punctuation</td>
241
- <td>
242
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">import { stuff } from 'some/where.js';</code></pre>
243
- </td>
244
- </tr>
245
- <tr>
246
- <td>important</td>
247
- <td>
248
- <pre class="d2l-code d2l-code-dark"><code class="language-css">.grumpy > img { height: 100% !important; }</code></pre>
249
- </td>
250
- </tr>
251
- <tr>
252
- <td>comment</td>
253
- <td>
254
- <pre class="d2l-code d2l-code-dark"><code class="language-javascript">/* grump wizards */</code></pre>
255
- </td>
256
- </tr>
257
- <tr>
258
- <td>tag</td>
259
- <td>
260
- <pre class="d2l-code d2l-code-dark"><code class="language-markup">&lt;h1&gt;Grumpy Wizards&lt;/h1&gt;</code></pre>
261
- </td>
262
- </tr>
263
- <tr>
264
- <td>attr-name, attr-value</td>
265
- <td>
266
- <pre class="d2l-code d2l-code-dark"><code class="language-markup">&lt;h1 class="dangerous"&gt;Grumpy Wizards&lt;/h1&gt;</code></pre>
267
- </td>
268
- </tr>
269
- <tr>
270
- <td>namespace</td>
271
- <td>
272
- <pre class="d2l-code d2l-code-dark"><code class="language-java">throw new java.lang.UnsupportedOperationException();</code></pre>
273
- </td>
274
- </tr>
275
- <tr>
276
- <td>prolog</td>
277
- <td>
278
- <pre class="d2l-code d2l-code-dark"><code class="language-markup">&lt?xml version="1.0" encoding="utf-8"?&gt;</code></pre>
279
- </td>
280
- </tr>
281
- <tr>
282
- <td>doctype</td>
283
- <td>
284
- <pre class="d2l-code d2l-code-dark"><code class="language-markup">&lt;!DOCTYPE html&gt;</code></pre>
285
- </td>
286
- </tr>
287
- <tr>
288
- <td>cdata</td>
289
- <td>
290
- <pre class="d2l-code d2l-code-dark"><code class="language-markup">&lt;![CDATA[ grumpy wizards eat donuts ]]&gt;</code></pre>
291
- </td>
292
- </tr>
293
- <tr>
294
- <td>entity</td>
295
- <td>
296
- <pre class="d2l-code d2l-code-dark"><code class="language-markup">&amp;pound; &amp;#163;</code></pre>
297
- </td>
298
- </tr>
299
- <tr>
300
- <td>atrule</td>
301
- <td>
302
- <pre class="d2l-code d2l-code-dark"><code class="language-css">@media (prefers-reduced-motion: reduce) { /* no animations */ }</code></pre>
303
- </td>
304
- </tr>
305
- <tr>
306
- <td>selector</td>
307
- <td>
308
- <pre class="d2l-code d2l-code-dark"><code class="language-css">.grumpy > img { /* ... */ }</code></pre>
309
- </td>
310
- </tr>
311
- <tr>
312
- <td>null</td>
313
- <td>
314
- <pre class="d2l-code d2l-code-dark"><code class="language-json">{ "fritter": null }</code></pre>
315
- </td>
316
- </tr>
317
- <tr>
318
- <td>color</td>
319
- <td>
320
- <pre class="d2l-code d2l-code-dark"><code class="language-css">background-color: rgba(0, 0, 0, 0.4);
321
- border: 1px solid #cd2026;
322
- </code></pre>
323
- </td>
324
- </tr>
325
- </tbody>
326
- </table>
327
-
328
- <h2 class="d2l-heading-3">Language Samples</h2>
329
-
330
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-arduino">// digital pin 2 has a pushbutton attached to it. Give it a name:
331
- int pushButton = 2;
332
-
333
- // the setup routine runs once when you press reset:
334
- void setup() {
335
- // initialize serial communication at 9600 bits per second:
336
- Serial.begin(9600);
337
- // make the pushbutton's pin an input:
338
- pinMode(pushButton, INPUT);
339
- }
340
-
341
- // the loop routine runs over and over again forever:
342
- void loop() {
343
- // read the input pin:
344
- int buttonState = digitalRead(pushButton);
345
- // print out the state of the button:
346
- Serial.println(buttonState);
347
- delay(1); // delay in between reads for stability
348
- }
349
- </code></pre>
350
-
351
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-armasm">
352
- AREA ARMex, CODE, READONLY
353
- ; Name this block of code ARMex
354
- ENTRY ; Mark first instruction to execute
355
- start
356
- MOV r0, #10 ; Set up parameters
357
- MOV r1, #3
358
- ADD r0, r0, r1 ; r0 = r0 + r1
359
- stop
360
- MOV r0, #0x18 ; angel_SWIreason_ReportException
361
- LDR r1, =0x20026 ; ADP_Stopped_ApplicationExit
362
- SVC #0x123456 ; ARM semihosting (formerly SWI)
363
- END ; Mark end of file
364
- </code></pre>
365
-
366
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-bash">#!/bin/bash
367
- if [ -d $directory ]; then
368
- echo "Directory exists"
369
- else
370
- echo "Directory does not exists"
371
- fi</code></pre>
372
-
373
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-c">#include &lt;stdio.h&gt;
374
- int main() {
375
- char c;
376
- printf("Enter a character: ");
377
- scanf("%c", &c);
378
-
379
- // %d displays the integer value of a character
380
- // %c displays the actual character
381
- printf("ASCII value of %c = %d", c, c);
382
-
383
- return 0;
384
- }
385
- </code></pre>
386
-
387
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-cpp">#include &lt;iostream&gt;
388
- using namespace std;
389
-
390
- int main()
391
- {
392
- int divisor, dividend, quotient, remainder;
393
-
394
- cout << "Enter dividend: ";
395
- cin >> dividend;
396
-
397
- cout << "Enter divisor: ";
398
- cin >> divisor;
399
-
400
- quotient = dividend / divisor;
401
- remainder = dividend % divisor;
402
-
403
- cout << "Quotient = " << quotient << endl;
404
- cout << "Remainder = " << remainder;
405
-
406
- return 0;
407
- }
408
- </code></pre>
409
-
410
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-csharp">using System;
411
-
412
- namespace Method {
413
-
414
- class Program {
415
-
416
- // method declaration
417
- public void display() {
418
- Console.WriteLine("Hello World");
419
- }
420
-
421
- static void Main(string[] args) {
422
-
423
- // create class object
424
- Program p1 = new Program();
425
-
426
- //call method
427
- p1.display();
428
-
429
- Console.ReadLine();
430
-
431
- }
432
- }
433
- }
434
- </code></pre>
435
-
436
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-css">.grumpy > img {
437
- background-image: url("smile.png");
438
- height: 100%;
439
- width: var(--some-var);
440
- }
441
- @font-face {
442
- font-family: 'Lato';
443
- font-style: normal;
444
- src: local('Lato Regular');
445
- }
446
- @media (prefers-reduced-motion: reduce) {
447
- :host([opened]), :host([opened-above]) {
448
- animation: none !important;
449
- }
450
- }
451
- </code></pre>
452
-
453
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-haskell">{-# START_FILE main.hs #-}
454
- import System.IO
455
-
456
- main = do
457
- handle &lt;- openFile "file.txt" ReadMode
458
- contents &lt;- hGetContents handle
459
- putStr contents
460
- hClose handle
461
-
462
- {-# START_FILE file.txt #-}
463
- Hello, world!
464
-
465
- import System.Random
466
-
467
- main = (randomRIO (1, 100) :: IO Int) &gt;&gt;= print
468
- </code></pre>
469
-
470
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-java">public class VowelConsonant {
471
-
472
- public static void main(String[] args) {
473
-
474
- char ch = 'i';
475
-
476
- if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' )
477
- System.out.println(ch + " is vowel");
478
- else
479
- System.out.println(ch + " is consonant");
480
-
481
- }
482
- }
483
- </code></pre>
484
-
485
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-javascript">
486
- /* grumpy javascript */
487
-
488
- import { stuff } from 'some/where.js';
489
-
490
- function helloGrumpy(name) {
491
- console.log(`Hi there ${name}.`);
492
- }
493
-
494
- class Wizard extends Human { }
495
-
496
- const grumpy = new Wizard();
497
-
498
- let wizardFoods = [...donuts, ... cakes, ...pies];
499
-
500
- const wizardsLikeBeer = false;
501
-
502
- const favouriteNumber = 3.14159;
503
-
504
- const PI = 3.14159;
505
-
506
- const regex = /[^\w\s]/g; // regex, regex-delimiter, regex-source, regex-flag
507
- </code></pre>
508
-
509
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-json">{
510
- "jinxed": "gnomes",
511
- "grumpy": [ "wizards" ],
512
- "jelly": 99,
513
- "donut": true,
514
- "fritter": null
515
- }
516
- </code></pre>
517
-
518
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-kotlin">fun main(args: Array<String>) {
519
-
520
- val a = 2.3
521
- val b = 4
522
- val c = 5.6
523
- val root1: Double
524
- val root2: Double
525
- val output: String
526
-
527
- val determinant = b * b - 4.0 * a * c
528
-
529
- // condition for real and different roots
530
- if (determinant > 0) {
531
- root1 = (-b + Math.sqrt(determinant)) / (2 * a)
532
- root2 = (-b - Math.sqrt(determinant)) / (2 * a)
533
-
534
- output = "root1 = %.2f and root2 = %.2f".format(root1, root2)
535
- }
536
- // Condition for real and equal roots
537
- else if (determinant == 0.0) {
538
- root2 = -b / (2 * a)
539
- root1 = root2
540
-
541
- output = "root1 = root2 = %.2f;".format(root1)
542
- }
543
- // If roots are not real
544
- else {
545
- val realPart = -b / (2 * a)
546
- val imaginaryPart = Math.sqrt(-determinant) / (2 * a)
547
-
548
- output = "root1 = %.2f+%.2fi and root2 = %.2f-%.2fi".format(realPart, imaginaryPart, realPart, imaginaryPart)
549
- }
550
-
551
- println(output)
552
- }
553
- </code></pre>
554
-
555
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-latex">
556
- \begin{aligned} \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\ \nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned}
557
-
558
- P(E) = {n \choose k} p^k (1-p)^{ n-k}
559
-
560
- \begin{aligned} \dot{x} & = \sigma(y-x) \\ \dot{y} & = \rho x - y - xz \\ \dot{z} & = -\beta z + xy \end{aligned}
561
- </code></pre>
562
-
563
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-markup">&lt;!DOCTYPE html&gt; &lt;!-- doctype, doctype-tag, name --&gt;
564
- &lt;html&gt;
565
- &lt;body class="typography"&gt;
566
- &lt;![CDATA[ some cdata section ]]&gt;
567
- &lt;div style="color: blue;"&gt;
568
- &amp;pound;
569
- &amp;#163;
570
- &lt;/div&gt;
571
- &lt;/body&gt;
572
- &lt;/html&gt;
573
- </code></pre>
574
-
575
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-matlab">for n = 1:5
576
- x = n*0.1;
577
- z = myfunc2(x,2,3,7);
578
- fprintf('x = %4.2f f(x) = %8.4f \r',x,z)
579
- end
580
- </code></pre>
581
-
582
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-python"># Program to check if a number is prime or not
583
-
584
- num = 29
585
-
586
- # To take input from the user
587
- #num = int(input("Enter a number: "))
588
-
589
- # define a flag variable
590
- flag = False
591
-
592
- # prime numbers are greater than 1
593
- if num > 1:
594
- # check for factors
595
- for i in range(2, num):
596
- if (num % i) == 0:
597
- # if factor is found, set flag to True
598
- flag = True
599
- # break out of loop
600
- break
601
-
602
- # check if flag is True
603
- if flag:
604
- print(num, "is not a prime number")
605
- else:
606
- print(num, "is a prime number")
607
- </code></pre>
608
-
609
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-r"># decimal variable
610
- num = as.integer(readline(prompt = "Enter a number: "))
611
- # num = 15
612
- isPrime = 0
613
- if (num > 1) {
614
- isPrime = 1
615
- for (i in 2: (num - 1)) {
616
- if ((num %% i) == 0) {
617
- isPrime = 0
618
- break
619
- }
620
- }
621
- }
622
- if (num == 2) isPrime = 1
623
- if (isPrime == 1) {
624
- print(paste(num, "is a prime number"))
625
- } else {
626
- print(paste(num, "is not a prime number"))
627
- }
628
- </code></pre>
629
-
630
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-racket">(define (rgb-maker mk)
631
- (lambda (sz)
632
- (vc-append (colorize (mk sz) "red")
633
- (colorize (mk sz) "green")
634
- (colorize (mk sz) "blue"))))
635
- </code></pre>
636
-
637
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-regex">(\W|^)[\w.\-]{0,25}@(yahoo|hotmail|gmail)\.com(\W|$)
638
- (\W|^)po[#\-]{0,1}\s{0,1}\d{2}[\s-]{0,1}\d{4}(\W|$)
639
- ^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$
640
- \b(?:word1\W+(?:\w+\W+){1,6}?word2|word2\W+(?:\w+\W+){1,6}?word1)\b
641
- ^(?=.*?\bone\b)(?=.*?\btwo\b)(?=.*?\bthree\b).*$
642
- </code></pre>
643
-
644
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-sql">DECLARE @MyCounter INT; /* keyword, variable, punctuation */
645
-
646
- SELECT AVG(Calories) AS AverageCalories FROM Desserts;
647
-
648
- SELECT * FROM Desserts
649
-
650
- SET ROWCOUNT 4;
651
-
652
- SET @Hidden = FALSE;
653
-
654
- SET @Donuts = 'Yummy';
655
- </code></pre>
656
-
657
- <pre class="d2l-code d2l-code-dark line-numbers"><code class="language-wolfram">CloudDeploy[
658
- FormFunction[FormObject[{"ImageURL" -> "String"}],
659
- ImageEffect[
660
- ColorConvert[
661
- ImageMultiply[
662
- ColorConvert[
663
- ImageAdd[ImageAdjust[Import[#ImageURL], .2],
664
- RGBColor[.25, .25, -.1]], "HSB"], Hue[1, .7, 1]],
665
- "RGB"], {"PoissonNoise", .5}] &amp;, "JPEG"],
666
- Permissions -> "Public"]
667
- </code></pre>
668
-
669
- <h2 class="d2l-heading-3">More Samples (Web Component Scope)</h2>
670
-
671
- <d2l-demo-prism dark></d2l-demo-prism>
672
-
673
- <script type="module">
674
- import { formatCodeElement } from '../prism.js';
675
-
676
- const formatCodeElements = () => {
677
- const darkSwitch = document.querySelector('d2l-switch');
678
- const codeElements = document.querySelectorAll('pre');
679
- codeElements.forEach(codeElement => {
680
- if (darkSwitch.on) codeElement.classList.add('d2l-code-dark');
681
- else codeElement.classList.remove('d2l-code-dark');
682
- formatCodeElement(codeElement);
683
- });
684
- document.querySelector('d2l-demo-prism').dark = darkSwitch.on;
685
- };
686
-
687
- formatCodeElements();
688
-
689
- const darkSwitch = document.querySelector('d2l-switch');
690
- darkSwitch.addEventListener('change', formatCodeElements);
691
-
692
- </script>
693
- </body>
694
- </html>