|
2 | 2 |
|
3 | 3 | import LiveCodes from '../../src/components/LiveCodes.tsx'; |
4 | 4 |
|
5 | | -The Web Components SDK is a thin wrapper around the [JavaScript SDK](js-ts.mdx) to provide an easy to use custom element (`<live-codes>`), yet retaining the full power, by having access to the [SDK methods](js-ts.mdx#sdk-methods). |
| 5 | +The Web Components SDK is a wrapper around the [JavaScript SDK](js-ts.mdx) to provide an easy to use custom element (`<live-codes>`), yet retaining the full power, by having access to the [SDK methods](js-ts.mdx#sdk-methods). |
6 | 6 |
|
7 | 7 | ## Demo |
8 | 8 |
|
9 | 9 | export const webComponentsSDKDemo = { |
10 | | - html: `<live-codes height="80vh" params='{"console": "open"}'>\n <template>\n <template lang="html">\n <h1>Hello World!</h1>\n </template>\n <style lang="scss">\n h1 { color: royalblue; }\n </style>\n <script lang="ts" active>\n console.log('hello!');\n </script>\n </template>\n</live-codes>\n\n<script src="https://cdn.jsdelivr.net/npm/livecodes@${process.env.SDK_VERSION}/web-components.js"></script>\n`, |
| 10 | + markup: { |
| 11 | + language: 'html', |
| 12 | + content: `<live-codes height="90vh" params='{"console": "open"}'> |
| 13 | + <template> |
| 14 | + <template lang="html"> |
| 15 | + <h1>Hello World!</h1> |
| 16 | + </template> |
| 17 | + <style lang="scss"> |
| 18 | + h1 { color: royalblue; } |
| 19 | + </style> |
| 20 | + <script lang="ts" active> |
| 21 | + console.log('hello!'); |
| 22 | + </script> |
| 23 | + </template> |
| 24 | +</live-codes> |
| 25 | +
|
| 26 | +<script src="https://cdn.jsdelivr.net/npm/livecodes@${process.env.SDK_VERSION}/web-components.js"></script> |
| 27 | +`, |
| 28 | + }, |
11 | 29 | }; |
12 | 30 |
|
13 | | -<LiveCodes params={webComponentsSDKDemo} height="80vh" /> |
| 31 | +<LiveCodes config={webComponentsSDKDemo} height="80vh" /> |
14 | 32 |
|
15 | 33 | ## Installation |
16 | 34 |
|
@@ -238,16 +256,14 @@ The following HTML attributes are supported and correspond to [embed options](js |
238 | 256 | | `loading` | `string` | When to load the playground (`"click"`, `"lazy"`, or `"eager"`). | |
239 | 257 | | `params` | `string` | A JSON string representing [URL Query parameters](../configuration/query-params.mdx). | |
240 | 258 | | `template` | `string` | A [starter template](../features/templates.mdx) to load. | |
241 | | -| `view` | `string` | Deprecated! The `view` option has been moved to `config.view`. For headless mode use the `headless` attribute. | |
242 | 259 | | `headless` | `boolean` | Whether to use the headless mode of LiveCodes. | |
243 | | -| `lite` | `boolean` | Deprecated! Use `config.mode = "lite"` instead. | |
244 | 260 | | `height` | `string` | Sets the [height of playground container](js-ts.mdx#height) element. | |
245 | 261 | | `data-default-styles` | `string` | If set to `"false"`, disables the [default styles](js-ts.mdx#default-styles) applied to the playground container. | |
246 | 262 |
|
247 | 263 | Example: |
248 | 264 |
|
249 | 265 | ```html title="HTML" |
250 | | -<live-codes template="react" loading="lazy"></live-codes> |
| 266 | +<live-codes template="react" loading="click"></live-codes> |
251 | 267 |
|
252 | 268 | <script type="module"> |
253 | 269 | import 'livecodes/web-components'; |
|
0 commit comments