@orbitcommerce/constellation-docs 1.0.0 → 1.2.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/dist/docs.css +14764 -2237
- package/dist/index.js +2 -2
- package/dist/pages/{Playground-CNbBbErC.js → Playground-Mk1yIWXb.js} +2 -2
- package/dist/pages/_address-data-L9BR499w.js +161 -0
- package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
- package/dist/pages/_card-art-0be5ncyV.js +18 -0
- package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
- package/dist/pages/{_figures-data-BDmScEny.js → _figures-data-DaDvB7Nm.js} +5 -5
- package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
- package/dist/pages/{_overlays-specimens-Dpn6oiyH.js → _overlays-specimens-bawR331Z.js} +33 -23
- package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
- package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
- package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
- package/dist/pages/address-block-BZOOOPA9.js +368 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/{alert-BD4e6QTh.js → alert-D3i7xZTU.js} +195 -50
- package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
- package/dist/pages/{app-shell-KbA-nRqZ.js → app-shell-D4hdlHps.js} +133 -54
- package/dist/pages/{area-chart-B91dLcGo.js → area-chart-BEWFwiB2.js} +183 -27
- package/dist/pages/{avatar-DPPHXJAu.js → avatar-BFEqQViw.js} +194 -12
- package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
- package/dist/pages/{badge-C9JR0thI.js → badge-0-PyMrih.js} +441 -135
- package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
- package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
- package/dist/pages/board-card-D2tZY_mU.js +415 -0
- package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
- package/dist/pages/{button-D3V912P4.js → button-DAyfssDY.js} +276 -79
- package/dist/pages/{calendar-DSDZ9nRH.js → calendar-Ds7KsgSI.js} +69 -17
- package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
- package/dist/pages/card-CQEM1_wc.js +1567 -0
- package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
- package/dist/pages/chart-legend-B20AbakD.js +724 -0
- package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
- package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
- package/dist/pages/checklist-card-DEyykVFS.js +783 -0
- package/dist/pages/chip-Ck-o3Ui6.js +839 -0
- package/dist/pages/chip-list-k1LxXuCi.js +414 -0
- package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
- package/dist/pages/coachmark-Be2ghobT.js +366 -0
- package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
- package/dist/pages/collab-field-CfqqK7d2.js +696 -0
- package/dist/pages/color-field-CZpfcA-A.js +1127 -0
- package/dist/pages/{colour-BwuO8xAv.js → colour-q2ntvI0w.js} +496 -20
- package/dist/pages/column-mapper-TsTG39cl.js +502 -0
- package/dist/pages/combobox-DvK2j5tI.js +1334 -0
- package/dist/pages/{command-palette-xAD7fOg6.js → command-palette-CJ7uBA04.js} +201 -58
- package/dist/pages/comment-box-CDSGYhr5.js +346 -0
- package/dist/pages/composer-D4B0NgpA.js +689 -0
- package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
- package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
- package/dist/pages/context-menu-F9DV30ia.js +487 -0
- package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
- package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
- package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
- package/dist/pages/date-input-GOW067EB.js +956 -0
- package/dist/pages/{date-picker-BYSa816m.js → date-picker-GdBciR99.js} +186 -38
- package/dist/pages/date-time-BLKCXtVZ.js +678 -0
- package/dist/pages/{delta-CtAo0eIM.js → delta-CNAGv8JY.js} +266 -61
- package/dist/pages/description-list-BPeXn1eW.js +1268 -0
- package/dist/pages/device-switcher-BCaN99c1.js +554 -0
- package/dist/pages/dialog-CRpkRC98.js +3164 -0
- package/dist/pages/{docs-BNOb7AqR.js → docs-lM2UBSir.js} +20 -15
- package/dist/pages/doodle-nzkqi2UI.js +201 -0
- package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
- package/dist/pages/drill-menu-cskH5mol.js +490 -0
- package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
- package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
- package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
- package/dist/pages/empty-state-4U2txFpI.js +1113 -0
- package/dist/pages/facet-filters-McbBeY9e.js +353 -0
- package/dist/pages/figure-D-HF5vCj.js +563 -0
- package/dist/pages/figure-strip-BB3mNl7D.js +1364 -0
- package/dist/pages/{figure-tabs-CoPFzzKz.js → figure-tabs-QOeQMY6N.js} +153 -35
- package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
- package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
- package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
- package/dist/pages/form-grid-BfWCVlie.js +692 -0
- package/dist/pages/gallery-BBk2EOri.js +453 -0
- package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
- package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
- package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
- package/dist/pages/heatmap-BohgIcNk.js +507 -0
- package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
- package/dist/pages/{home-dashboard-CFQwDtC9.js → home-dashboard-CxPmvduE.js} +21 -18
- package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
- package/dist/pages/hosted-field-BLh-53AE.js +208 -0
- package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
- package/dist/pages/{icon-button-C9eSVPPW.js → icon-button-Bu4Gj5sy.js} +370 -31
- package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
- package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
- package/dist/pages/{icons-sxkTs5Ob.js → icons-CJ9Aar3d.js} +315 -52
- package/dist/pages/image-cropper-NyougqLH.js +466 -0
- package/dist/pages/image-field-7knBv4mJ.js +567 -0
- package/dist/pages/import-result-CmTtGXW_.js +486 -0
- package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
- package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
- package/dist/pages/input-CzLCzfyx.js +2372 -0
- package/dist/pages/{installation-DpsX8G_n.js → installation-C3UcpQJT.js} +112 -29
- package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
- package/dist/pages/kanban-Dy9sPAI0.js +740 -0
- package/dist/pages/{kbd-cNfDoikz.js → kbd-UNj4zqxn.js} +15 -14
- package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
- package/dist/pages/line-chart-CntWxeMF.js +1117 -0
- package/dist/pages/link-CXqvAg9z.js +689 -0
- package/dist/pages/link-picker-BMFGCC67.js +478 -0
- package/dist/pages/link-row-x8yaUuWc.js +595 -0
- package/dist/pages/{live-globe-ClvLn9Lb.js → live-globe-95ROMhGQ.js} +191 -47
- package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
- package/dist/pages/loading-state-BNbCo51C.js +556 -0
- package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
- package/dist/pages/{logo-BfGF1Pq9.js → logo-B38rnzoq.js} +13 -13
- package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
- package/dist/pages/markdown-Ied72vMT.js +237 -0
- package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
- package/dist/pages/media-banner-DkStCia0.js +233 -0
- package/dist/pages/{menu-by2sgQ09.js → menu-NrLYKqKp.js} +623 -109
- package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
- package/dist/pages/meta-line-D5p2TycR.js +371 -0
- package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
- package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
- package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
- package/dist/pages/{motion-BvTGc2Dk.js → motion-CrXtiBvA.js} +20 -10
- package/dist/pages/number-input-CuyMZg18.js +968 -0
- package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
- package/dist/pages/{orbit-spinner-Dil1Z3Oy.js → orbit-spinner-Dxv5qAhr.js} +30 -14
- package/dist/pages/otp-input-CVRoX1mw.js +591 -0
- package/dist/pages/{overview-BPEbZQ6g.js → overview-LA9XRhZc.js} +4 -4
- package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
- package/dist/pages/{pagination-BBUnGvv5.js → pagination-C1EgVtW4.js} +74 -29
- package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
- package/dist/pages/password-field-DHEQKyUC.js +912 -0
- package/dist/pages/person-cell-BmjbADBz.js +564 -0
- package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
- package/dist/pages/plan-card-DRaA6RuB.js +621 -0
- package/dist/pages/plan-card-DtloWvMh.js +258 -0
- package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
- package/dist/pages/plan-grid-cfPVTB5V.js +251 -0
- package/dist/pages/point-list-BbPmZjsm.js +222 -0
- package/dist/pages/{popover-Db1gLDpb.js → popover-C3Oar9D5.js} +76 -14
- package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
- package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
- package/dist/pages/price-CRBLoa9h.js +604 -0
- package/dist/pages/{principles-CeAIOIdt.js → principles-pnDyfHpK.js} +9 -9
- package/dist/pages/print-page-BkLv6bW8.js +513 -0
- package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
- package/dist/pages/progress-CP_awmo4.js +904 -0
- package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
- package/dist/pages/{radio-group-CkdBWWfG.js → radio-group-C-4tg6FS.js} +580 -18
- package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
- package/dist/pages/rating-CweKN2SX.js +471 -0
- package/dist/pages/record-layout-DUP_X0RL.js +719 -0
- package/dist/pages/record-pager-y9D7JFgb.js +278 -0
- package/dist/pages/registry-BZg-xAbi.js +594 -0
- package/dist/pages/{release-Dvo684UJ.js → release-Cs6tl16C.js} +4 -1
- package/dist/pages/repeater-BRZYKRQa.js +1351 -0
- package/dist/pages/reply-feedback-BDnHprla.js +192 -0
- package/dist/pages/reveal-BygENBbL.js +460 -0
- package/dist/pages/rich-text-DOFQZEpT.js +156 -0
- package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
- package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
- package/dist/pages/{rolling-number-qmvH84Mq.js → rolling-number-GR3Cyfpz.js} +12 -12
- package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
- package/dist/pages/rule-list-DTCmIMpT.js +648 -0
- package/dist/pages/save-status-B5KkyMZP.js +378 -0
- package/dist/pages/schedule-YycI95O1.js +243 -0
- package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
- package/dist/pages/{search-field-BN7MWGQ4.js → search-field-D1uG7R6A.js} +15 -15
- package/dist/pages/search-menu-DMuXyUUW.js +580 -0
- package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
- package/dist/pages/section-rail-BtTCETS5.js +637 -0
- package/dist/pages/section-v2Pubup9.js +639 -0
- package/dist/pages/{segmented-control-CTbIpRBW.js → segmented-control-D-FB1K1T.js} +450 -37
- package/dist/pages/{select-DguELoRR.js → select-DZ43NpOm.js} +22 -17
- package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
- package/dist/pages/{separator-CPZub9pv.js → separator-CFwqRvfO.js} +99 -22
- package/dist/pages/serp-preview-BGwORjmo.js +346 -0
- package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
- package/dist/pages/{shape-DKvA0YKr.js → shape-DzniHAVT.js} +10 -10
- package/dist/pages/share-list-D4wgBxKN.js +926 -0
- package/dist/pages/side-panel-CCtkrZjs.js +811 -0
- package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
- package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
- package/dist/pages/skip-link-BxznhSkz.js +252 -0
- package/dist/pages/slider-CAoPURKD.js +774 -0
- package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
- package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
- package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
- package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
- package/dist/pages/{sparkline-DMMYGbHn.js → sparkline-D3aavCly.js} +301 -22
- package/dist/pages/split-bar-DYgZnFID.js +414 -0
- package/dist/pages/split-button-Be08-VI-.js +335 -0
- package/dist/pages/split-pane-lSNZgTKt.js +523 -0
- package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
- package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
- package/dist/pages/status-dot-D99gAGsV.js +567 -0
- package/dist/pages/stepper-CxKTbEA-.js +1093 -0
- package/dist/pages/success-mark-CqFTOBEu.js +142 -0
- package/dist/pages/swatch-H_kNvHuC.js +565 -0
- package/dist/pages/{switch-B-Qe4kcT.js → switch-C93K6j9h.js} +151 -51
- package/dist/pages/table-CL0vomno.js +3225 -0
- package/dist/pages/{tabs-B4M-usCV.js → tabs-Dh0mUsLw.js} +256 -21
- package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
- package/dist/pages/task-card-Dv0sR1-w.js +295 -0
- package/dist/pages/{textarea-fTuUZRQb.js → textarea-CCM-SnGN.js} +271 -15
- package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
- package/dist/pages/time-input-CA9-uZAa.js +442 -0
- package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
- package/dist/pages/timeline-BsMUTlpR.js +1798 -0
- package/dist/pages/{toast-CKP03zjy.js → toast-zXLRiMRT.js} +240 -25
- package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
- package/dist/pages/toolbar-B9l_fHKy.js +754 -0
- package/dist/pages/{tooltip-CBYil3kt.js → tooltip-LHtCUkF-.js} +162 -33
- package/dist/pages/translation-field-CTRXiF2N.js +251 -0
- package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
- package/dist/pages/tree-select-DU1qXHy_.js +492 -0
- package/dist/pages/tree-view-g_RjLtAb.js +739 -0
- package/dist/pages/{typography-PCbg8Bhg.js → typography-BSijtiRl.js} +153 -12
- package/dist/pages/unit-input-Dml4fjmK.js +659 -0
- package/dist/pages/upload-rules-yozEzSah.js +419 -0
- package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
- package/dist/pages/value-change-CnubDKyO.js +489 -0
- package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
- package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
- package/dist/pages/working-status-CENemSsw.js +389 -0
- package/manifest.json +10984 -1108
- package/package.json +2 -2
- package/dist/pages/card-DUggbis3.js +0 -659
- package/dist/pages/checkbox-DwimQaK3.js +0 -365
- package/dist/pages/dialog-BRAf4LMh.js +0 -1451
- package/dist/pages/empty-state-C-mLrXW2.js +0 -417
- package/dist/pages/input-KF9Gkawf.js +0 -1093
- package/dist/pages/registry-CroHzK9I.js +0 -244
- package/dist/pages/skeleton-DLuBhP46.js +0 -561
- package/dist/pages/table-AMoODng4.js +0 -607
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { a as DocTable, d as Section$1, i as DocPage, l as Note, m as ThemePair, o as Example, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Markdown } from "@orbitcommerce/constellation";
|
|
6
|
+
//#region src/pages/components/markdown.tsx
|
|
7
|
+
var REPLY = `Your best seller this week is the **Arden ergonomic chair**: 42 sold, up 18% on last week.
|
|
8
|
+
|
|
9
|
+
1. Restock the charcoal fabric first, it sells out in *about* four days.
|
|
10
|
+
2. Read the [restocking guide](https://help.example.com/restocking) before Friday's order.
|
|
11
|
+
|
|
12
|
+
Ask me for a \`CSV\` of the full list if you need it.`;
|
|
13
|
+
var ARTICLE = `# Returning an order
|
|
14
|
+
|
|
15
|
+
Customers can start a return from their account for **30 days** after delivery.
|
|
16
|
+
|
|
17
|
+
## What we accept
|
|
18
|
+
- Unused items in their original packaging
|
|
19
|
+
- Faulty items at any time, with a photo
|
|
20
|
+
|
|
21
|
+
## Refund times
|
|
22
|
+
| Payment | Refund lands in |
|
|
23
|
+
|:--|--:|
|
|
24
|
+
| Card | 3 to 5 working days |
|
|
25
|
+
| Gift card | Straight away |
|
|
26
|
+
|
|
27
|
+
> Questions? Write to [support@harbourdesk.example](mailto:support@harbourdesk.example).`;
|
|
28
|
+
var UNSAFE = `A [harmless looking link](javascript:alert(1)) stays as its words, and <b>tags</b> show as text.
|
|
29
|
+
|
|
30
|
+
`;
|
|
31
|
+
function Preview() {
|
|
32
|
+
return /* @__PURE__ */ jsx("div", {
|
|
33
|
+
className: "markdown-preview",
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
children: /* @__PURE__ */ jsx(Markdown, {
|
|
36
|
+
size: "sm",
|
|
37
|
+
children: `Your best seller is the **Arden chair**: 42 sold.\n\n1. Restock charcoal first\n2. Read the [restocking guide](https://help.example.com/restocking)`
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function Page() {
|
|
42
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
43
|
+
title: "Markdown",
|
|
44
|
+
status: "new",
|
|
45
|
+
importNames: ["Markdown"],
|
|
46
|
+
lead: "A safe subset of Markdown drawn as the kit's prose: an assistant's replies, a help article's preview, legal text an API serves. Nothing in the source is ever drawn as HTML.",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
49
|
+
id: "basics",
|
|
50
|
+
title: "Basics",
|
|
51
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
52
|
+
"Pass the source as the child. It reads headings, paragraphs with their line breaks, bulleted and numbered lists, quotes, fenced code, rules, pipe tables, ",
|
|
53
|
+
/* @__PURE__ */ jsx("strong", { children: "bold" }),
|
|
54
|
+
", ",
|
|
55
|
+
/* @__PURE__ */ jsx("em", { children: "italic" }),
|
|
56
|
+
", ",
|
|
57
|
+
/* @__PURE__ */ jsx("code", { children: "code" }),
|
|
58
|
+
", links and images, and draws them in the same prose styles as the ",
|
|
59
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
60
|
+
to: "/components/rich-text-editor",
|
|
61
|
+
children: "rich text editor"
|
|
62
|
+
}),
|
|
63
|
+
"."
|
|
64
|
+
] }),
|
|
65
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
66
|
+
align: "fill",
|
|
67
|
+
code: `<Markdown>{article.body}</Markdown>`,
|
|
68
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
69
|
+
className: "markdown-stage",
|
|
70
|
+
children: /* @__PURE__ */ jsx(Markdown, { children: ARTICLE })
|
|
71
|
+
})
|
|
72
|
+
}), /* @__PURE__ */ jsx(ThemePair, {
|
|
73
|
+
align: "fill",
|
|
74
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
75
|
+
className: "markdown-stage",
|
|
76
|
+
children: /* @__PURE__ */ jsx(Markdown, { children: ARTICLE })
|
|
77
|
+
})
|
|
78
|
+
})]
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
81
|
+
id: "small",
|
|
82
|
+
title: "Small, for a chat",
|
|
83
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
84
|
+
/* @__PURE__ */ jsx("code", { children: "size=\"sm\"" }),
|
|
85
|
+
" is the small prose of a chat bubble: 13px, tighter spacing, and headings in the UI face. A ",
|
|
86
|
+
/* @__PURE__ */ jsx("code", { children: "#" }),
|
|
87
|
+
" heading is drawn as an ",
|
|
88
|
+
/* @__PURE__ */ jsx("code", { children: "h2" }),
|
|
89
|
+
" by default; ",
|
|
90
|
+
/* @__PURE__ */ jsx("code", { children: "headingStart" }),
|
|
91
|
+
" moves it down under a dialog's or a bubble's own heading."
|
|
92
|
+
] }),
|
|
93
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
94
|
+
align: "fill",
|
|
95
|
+
code: `<Markdown size="sm">{reply.content}</Markdown>`,
|
|
96
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
97
|
+
className: "markdown-bubble",
|
|
98
|
+
children: /* @__PURE__ */ jsx(Markdown, {
|
|
99
|
+
size: "sm",
|
|
100
|
+
children: REPLY
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
106
|
+
id: "links-images",
|
|
107
|
+
title: "Links and images",
|
|
108
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
109
|
+
"A link is drawn when it goes to a web address, a path in the app, an anchor or an email; a web address opens in a new tab. Any other link stays as its words. By default an image is drawn, lazily, only from a path on the app's own origin, and shows as its words in brackets otherwise; ",
|
|
110
|
+
/* @__PURE__ */ jsx("code", { children: "imageSrc" }),
|
|
111
|
+
" is the allow-list of the hosts your images come from (and may rewrite an API's paths). ",
|
|
112
|
+
/* @__PURE__ */ jsx("code", { children: "renderLink" }),
|
|
113
|
+
" draws a safe link your way (a router's link)."
|
|
114
|
+
] }),
|
|
115
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
116
|
+
align: "fill",
|
|
117
|
+
code: `<Markdown
|
|
118
|
+
renderLink={({ href, external, children }) =>
|
|
119
|
+
external ? <a href={href} target="_blank" rel="noopener noreferrer">{children}</a> : <RouterLink to={href}>{children}</RouterLink>
|
|
120
|
+
}
|
|
121
|
+
// An allow-list: the API's own files, and the one image host the store uses.
|
|
122
|
+
imageSrc={(src) => (src.startsWith('/api/') ? API_ORIGIN + src : src.startsWith('https://images.harbourdesk.example/') ? src : null)}
|
|
123
|
+
>
|
|
124
|
+
{message.content}
|
|
125
|
+
</Markdown>`,
|
|
126
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
127
|
+
className: "markdown-stage",
|
|
128
|
+
children: /* @__PURE__ */ jsx(Markdown, { children: UNSAFE })
|
|
129
|
+
})
|
|
130
|
+
}), /* @__PURE__ */ jsx(DocTable, {
|
|
131
|
+
columns: ["Written", "Drawn"],
|
|
132
|
+
rows: [
|
|
133
|
+
["[Docs](https://…)", "A link that opens in a new tab"],
|
|
134
|
+
["[Orders](/orders), [Totals](#totals), [Mail](mailto:…)", "A link in place"],
|
|
135
|
+
["[x](javascript:…), [x](data:…), [x](//host)", "The words alone"],
|
|
136
|
+
["", "An image, loaded lazily"],
|
|
137
|
+
["", "[Image: Alt], unless imageSrc allows its host"],
|
|
138
|
+
[", ", "[Image: Alt]"]
|
|
139
|
+
]
|
|
140
|
+
})]
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
143
|
+
id: "guidelines",
|
|
144
|
+
title: "Guidelines",
|
|
145
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
146
|
+
"Use it for text written elsewhere in Markdown: a model’s reply, an article body, a document an API serves.",
|
|
147
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
148
|
+
"For HTML from an editor, use ",
|
|
149
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
150
|
+
to: "/components/rich-text",
|
|
151
|
+
children: "rich text"
|
|
152
|
+
}),
|
|
153
|
+
", which keeps the editor’s formatting and blank lines."
|
|
154
|
+
] }),
|
|
155
|
+
"Keep tables small: a wide one scrolls inside its own box rather than stretching the page."
|
|
156
|
+
] })
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
159
|
+
id: "accessibility",
|
|
160
|
+
title: "Accessibility",
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
163
|
+
"Headings are real headings, from headingStart down, so the page’s outline holds: never more than three levels deep.",
|
|
164
|
+
"A table has column headings, and its scrolling box is a named region that takes focus, so the keyboard can scroll it.",
|
|
165
|
+
"A link that opens a new tab is marked with rel=\"noopener noreferrer\". An image keeps its alt text."
|
|
166
|
+
] }),
|
|
167
|
+
/* @__PURE__ */ jsx(Note, {
|
|
168
|
+
title: "Safety",
|
|
169
|
+
children: "The source is parsed and every run reaches the page as text, so a tag in it is shown, never run. Links and images are allow-listed, never deny-listed."
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ jsxs(Note, {
|
|
172
|
+
title: "An assistant's replies",
|
|
173
|
+
children: [
|
|
174
|
+
"An image is fetched as soon as it is drawn, so an image address a model was steered into writing could carry what it read off to someone else's server. Nebula passes ",
|
|
175
|
+
/* @__PURE__ */ jsx("code", { children: "imageSrc" }),
|
|
176
|
+
" an allow-list of its own image hosts, and remote images stay as their words everywhere else."
|
|
177
|
+
]
|
|
178
|
+
})
|
|
179
|
+
]
|
|
180
|
+
}),
|
|
181
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
182
|
+
id: "props",
|
|
183
|
+
title: "Props",
|
|
184
|
+
description: /* @__PURE__ */ jsx("p", { children: "Also accepts every attribute of a div." }),
|
|
185
|
+
children: [/* @__PURE__ */ jsx(PropsTable, {
|
|
186
|
+
title: "Markdown",
|
|
187
|
+
rows: [
|
|
188
|
+
{
|
|
189
|
+
name: "children",
|
|
190
|
+
type: "string",
|
|
191
|
+
required: true,
|
|
192
|
+
description: "The Markdown source."
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "size",
|
|
196
|
+
type: "'md' | 'sm'",
|
|
197
|
+
default: "'md'",
|
|
198
|
+
description: "The prose’s size; sm for a chat bubble."
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "headingStart",
|
|
202
|
+
type: "1 | 2 | 3 | 4",
|
|
203
|
+
default: "2",
|
|
204
|
+
description: "The level a # heading is drawn at."
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: "renderLink",
|
|
208
|
+
type: "(link: MarkdownLinkProps) => ReactNode",
|
|
209
|
+
description: "Draws a safe link your way: { href, external, children }."
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "imageSrc",
|
|
213
|
+
type: "(src: string) => string | null",
|
|
214
|
+
description: "The address to load an image from, or null to show its words."
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "labels",
|
|
218
|
+
type: "Partial<MarkdownLabels>",
|
|
219
|
+
description: "blockedImage(alt) and table, the scrolling box’s name."
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
223
|
+
title: "The parser on its own",
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsx("code", { children: "parseMarkdown(source)" }),
|
|
226
|
+
" returns the blocks and runs the component draws, and",
|
|
227
|
+
" ",
|
|
228
|
+
/* @__PURE__ */ jsx("code", { children: "isSafeMarkdownHref(href)" }),
|
|
229
|
+
" the link rule, for a renderer of your own."
|
|
230
|
+
]
|
|
231
|
+
})]
|
|
232
|
+
})
|
|
233
|
+
]
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
//#endregion
|
|
237
|
+
export { Page, Preview };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { d as Section$1, i as DocPage, l as Note, m as ThemePair, o as Example, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Field, MarkdownField } from "@orbitcommerce/constellation";
|
|
7
|
+
//#region src/pages/components/markdown-field.tsx
|
|
8
|
+
var ARTICLE = `# Returning an order
|
|
9
|
+
|
|
10
|
+
Customers can start a return from their account for **30 days** after delivery.
|
|
11
|
+
|
|
12
|
+
## What we accept
|
|
13
|
+
- Unused items in their original packaging
|
|
14
|
+
- Faulty items at any time, with a photo
|
|
15
|
+
|
|
16
|
+
Read the [full policy](/pages/returns) before you write to us.`;
|
|
17
|
+
function ArticleEditor({ initial = ARTICLE, invalid = false }) {
|
|
18
|
+
const [body, setBody] = useState(initial);
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
className: "markdown-field-stage",
|
|
21
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
22
|
+
label: "Article",
|
|
23
|
+
hint: "Markdown: # for a heading, - for a list, [words](/path) for a link.",
|
|
24
|
+
error: invalid ? "Write at least a sentence before you publish." : void 0,
|
|
25
|
+
children: /* @__PURE__ */ jsx(MarkdownField, {
|
|
26
|
+
value: body,
|
|
27
|
+
onValueChange: setBody,
|
|
28
|
+
rows: 10,
|
|
29
|
+
textareaProps: {
|
|
30
|
+
maxLength: 4e3,
|
|
31
|
+
showCount: true
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function Preview() {
|
|
38
|
+
return /* @__PURE__ */ jsx("div", {
|
|
39
|
+
className: "markdown-field-preview",
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
children: /* @__PURE__ */ jsx(MarkdownField, {
|
|
42
|
+
"aria-label": "Article",
|
|
43
|
+
defaultValue: "# Returns\n\n- Unused items\n- Within 30 days",
|
|
44
|
+
rows: 3
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function Page() {
|
|
49
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
50
|
+
title: "Markdown field",
|
|
51
|
+
status: "new",
|
|
52
|
+
importNames: ["MarkdownField"],
|
|
53
|
+
lead: "Write and Preview tabs over one Markdown text, as the help centre's article editor has them: a mono textarea to write in, and the text as the reader will see it.",
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
56
|
+
id: "basics",
|
|
57
|
+
title: "Basics",
|
|
58
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
59
|
+
"Put it in a ",
|
|
60
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
61
|
+
to: "/components/input",
|
|
62
|
+
children: "Field"
|
|
63
|
+
}),
|
|
64
|
+
", which names the textarea and carries its hint and error. Write is the kit's textarea set in mono; Preview draws the same text through",
|
|
65
|
+
" ",
|
|
66
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
67
|
+
to: "/components/markdown",
|
|
68
|
+
children: "Markdown"
|
|
69
|
+
}),
|
|
70
|
+
", at least as tall as the textarea, so switching tabs moves nothing under the field. The textarea stays on the page while the preview shows."
|
|
71
|
+
] }),
|
|
72
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
73
|
+
align: "fill",
|
|
74
|
+
code: `<Field label="Article" hint="Markdown: # for a heading, - for a list.">
|
|
75
|
+
<MarkdownField value={body} onValueChange={setBody} rows={10} textareaProps={{ maxLength: 4000, showCount: true }} />
|
|
76
|
+
</Field>`,
|
|
77
|
+
children: /* @__PURE__ */ jsx(ArticleEditor, {})
|
|
78
|
+
}), /* @__PURE__ */ jsx(ThemePair, {
|
|
79
|
+
align: "fill",
|
|
80
|
+
children: /* @__PURE__ */ jsx(ArticleEditor, {})
|
|
81
|
+
})]
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
84
|
+
id: "states",
|
|
85
|
+
title: "Empty and invalid",
|
|
86
|
+
description: /* @__PURE__ */ jsx("p", { children: "With nothing written the preview says so. In a Field with an error, the textarea takes the error look." }),
|
|
87
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
88
|
+
align: "fill",
|
|
89
|
+
code: `<Field label="Article" error="Write at least a sentence before you publish.">…</Field>`,
|
|
90
|
+
children: /* @__PURE__ */ jsx(ArticleEditor, {
|
|
91
|
+
initial: "",
|
|
92
|
+
invalid: true
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
97
|
+
id: "guidelines",
|
|
98
|
+
title: "Guidelines",
|
|
99
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
100
|
+
"Use it where the text is stored as Markdown and shown elsewhere through Markdown: a help article, a widget’s answer.",
|
|
101
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
102
|
+
"For formatted copy written by people who do not know Markdown, use the",
|
|
103
|
+
" ",
|
|
104
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
105
|
+
to: "/components/rich-text-editor",
|
|
106
|
+
children: "rich text editor"
|
|
107
|
+
}),
|
|
108
|
+
"."
|
|
109
|
+
] }),
|
|
110
|
+
"Say in the hint which Markdown the reader’s side draws: headings, lists, links and images."
|
|
111
|
+
] })
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
114
|
+
id: "accessibility",
|
|
115
|
+
title: "Accessibility",
|
|
116
|
+
children: [/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
117
|
+
"The tabs are a tab list: the arrow keys move between Write and Preview, and each panel is named by its tab.",
|
|
118
|
+
"The textarea is named, described and marked invalid by the Field around it, on either tab.",
|
|
119
|
+
"The preview never draws HTML from the text, and its links and images keep Markdown’s safe rules."
|
|
120
|
+
] }), /* @__PURE__ */ jsxs(Note, {
|
|
121
|
+
title: "Previewing as the reader sees it",
|
|
122
|
+
children: [
|
|
123
|
+
"Give ",
|
|
124
|
+
/* @__PURE__ */ jsx("code", { children: "previewProps" }),
|
|
125
|
+
" the same ",
|
|
126
|
+
/* @__PURE__ */ jsx("code", { children: "headingStart" }),
|
|
127
|
+
", ",
|
|
128
|
+
/* @__PURE__ */ jsx("code", { children: "renderLink" }),
|
|
129
|
+
" and ",
|
|
130
|
+
/* @__PURE__ */ jsx("code", { children: "imageSrc" }),
|
|
131
|
+
" ",
|
|
132
|
+
"the page that shows the text uses, so the preview is that page's."
|
|
133
|
+
]
|
|
134
|
+
})]
|
|
135
|
+
}),
|
|
136
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
137
|
+
id: "props",
|
|
138
|
+
title: "Props",
|
|
139
|
+
description: /* @__PURE__ */ jsx("p", { children: "Also accepts every attribute of a div. The ref reaches the textarea." }),
|
|
140
|
+
children: /* @__PURE__ */ jsx(PropsTable, {
|
|
141
|
+
title: "MarkdownField",
|
|
142
|
+
rows: [
|
|
143
|
+
{
|
|
144
|
+
name: "value, onValueChange",
|
|
145
|
+
type: "string, (value) => void",
|
|
146
|
+
description: "The Markdown, controlled."
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "defaultValue",
|
|
150
|
+
type: "string",
|
|
151
|
+
default: "''",
|
|
152
|
+
description: "The Markdown at first, uncontrolled."
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "tab, defaultTab, onTabChange",
|
|
156
|
+
type: "'write' | 'preview'",
|
|
157
|
+
default: "'write'",
|
|
158
|
+
description: "The tab shown."
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "rows",
|
|
162
|
+
type: "number",
|
|
163
|
+
default: "12",
|
|
164
|
+
description: "The textarea’s rows; the preview is at least as tall."
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "textareaProps",
|
|
168
|
+
type: "TextareaProps",
|
|
169
|
+
description: "maxLength, showCount, placeholder, name, onBlur."
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "previewProps",
|
|
173
|
+
type: "MarkdownProps",
|
|
174
|
+
description: "headingStart, renderLink, imageSrc, size."
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "invalid, disabled",
|
|
178
|
+
type: "boolean",
|
|
179
|
+
description: "The error look; the field switched off."
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "labels",
|
|
183
|
+
type: "Partial<MarkdownFieldLabels>",
|
|
184
|
+
description: "tabs, write, preview, empty."
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
]
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
export { Page, Preview };
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { d as Section$1, i as DocPage, o as Example, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { MediaBanner } from "@orbitcommerce/constellation";
|
|
6
|
+
//#region src/pages/components/media-banner.tsx
|
|
7
|
+
var svgUrl = (markup) => `data:image/svg+xml,${encodeURIComponent(markup)}`;
|
|
8
|
+
var releaseUrl = svgUrl("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1200 520\"><rect width=\"1200\" height=\"520\" fill=\"#dfe8e6\"/><rect x=\"120\" y=\"70\" width=\"560\" height=\"380\" rx=\"24\" fill=\"#ffffff\"/><rect x=\"160\" y=\"112\" width=\"240\" height=\"20\" rx=\"10\" fill=\"#2f6f5e\"/>" + [
|
|
9
|
+
0,
|
|
10
|
+
1,
|
|
11
|
+
2,
|
|
12
|
+
3,
|
|
13
|
+
4
|
|
14
|
+
].map((i) => `<rect x="160" y="${170 + i * 52}" width="480" height="36" rx="10" fill="#eef2f1"/>`).join("") + "<rect x=\"720\" y=\"150\" width=\"360\" height=\"220\" rx=\"24\" fill=\"#2f6f5e\"/><circle cx=\"900\" cy=\"260\" r=\"58\" fill=\"#f0c86e\"/></svg>");
|
|
15
|
+
var posterUrl = svgUrl("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1280 720\"><rect width=\"1280\" height=\"720\" fill=\"#26343a\"/><circle cx=\"640\" cy=\"360\" r=\"120\" fill=\"#2f6f5e\"/></svg>");
|
|
16
|
+
/** Records a two-second film of a dot orbiting, once, in the browser: a blob address, or null where it cannot. */
|
|
17
|
+
function useDrawnFilm() {
|
|
18
|
+
const [url, setUrl] = useState(null);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (typeof MediaRecorder === "undefined") return void 0;
|
|
21
|
+
const canvas = document.createElement("canvas");
|
|
22
|
+
canvas.width = 640;
|
|
23
|
+
canvas.height = 360;
|
|
24
|
+
const context = canvas.getContext("2d");
|
|
25
|
+
if (!context || typeof canvas.captureStream !== "function") return void 0;
|
|
26
|
+
const stream = canvas.captureStream(30);
|
|
27
|
+
const recorder = new MediaRecorder(stream, { mimeType: "video/webm" });
|
|
28
|
+
const chunks = [];
|
|
29
|
+
let made = null;
|
|
30
|
+
let frame = 0;
|
|
31
|
+
let raf = 0;
|
|
32
|
+
const draw = () => {
|
|
33
|
+
const t = frame / 60;
|
|
34
|
+
context.fillStyle = "#26343a";
|
|
35
|
+
context.fillRect(0, 0, 640, 360);
|
|
36
|
+
context.strokeStyle = "#3f565e";
|
|
37
|
+
context.lineWidth = 3;
|
|
38
|
+
context.beginPath();
|
|
39
|
+
context.ellipse(320, 180, 170, 70, 0, 0, Math.PI * 2);
|
|
40
|
+
context.stroke();
|
|
41
|
+
context.fillStyle = "#2f6f5e";
|
|
42
|
+
context.beginPath();
|
|
43
|
+
context.arc(320, 180, 46, 0, Math.PI * 2);
|
|
44
|
+
context.fill();
|
|
45
|
+
context.fillStyle = "#f0c86e";
|
|
46
|
+
context.beginPath();
|
|
47
|
+
context.arc(320 + Math.cos(t * Math.PI * 2) * 170, 180 + Math.sin(t * Math.PI * 2) * 70, 16, 0, Math.PI * 2);
|
|
48
|
+
context.fill();
|
|
49
|
+
frame += 1;
|
|
50
|
+
if (frame <= 60) raf = requestAnimationFrame(draw);
|
|
51
|
+
else recorder.stop();
|
|
52
|
+
};
|
|
53
|
+
recorder.ondataavailable = (event) => chunks.push(event.data);
|
|
54
|
+
recorder.onstop = () => {
|
|
55
|
+
made = URL.createObjectURL(new Blob(chunks, { type: "video/webm" }));
|
|
56
|
+
setUrl(made);
|
|
57
|
+
};
|
|
58
|
+
recorder.start();
|
|
59
|
+
draw();
|
|
60
|
+
return () => {
|
|
61
|
+
cancelAnimationFrame(raf);
|
|
62
|
+
if (recorder.state !== "inactive") recorder.stop();
|
|
63
|
+
if (made) URL.revokeObjectURL(made);
|
|
64
|
+
};
|
|
65
|
+
}, []);
|
|
66
|
+
return url;
|
|
67
|
+
}
|
|
68
|
+
function Preview() {
|
|
69
|
+
return /* @__PURE__ */ jsx("div", {
|
|
70
|
+
className: "media-banner-preview",
|
|
71
|
+
children: /* @__PURE__ */ jsx(MediaBanner, {
|
|
72
|
+
src: releaseUrl,
|
|
73
|
+
maxHeight: 120
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function FilmExample() {
|
|
78
|
+
const film = useDrawnFilm();
|
|
79
|
+
return film ? /* @__PURE__ */ jsx(MediaBanner, {
|
|
80
|
+
kind: "video",
|
|
81
|
+
src: film,
|
|
82
|
+
poster: posterUrl,
|
|
83
|
+
label: "Orbit's new order list, a short film"
|
|
84
|
+
}) : /* @__PURE__ */ jsx(MediaBanner, {
|
|
85
|
+
kind: "image",
|
|
86
|
+
src: posterUrl,
|
|
87
|
+
alt: ""
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function Page() {
|
|
91
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
92
|
+
title: "Media banner",
|
|
93
|
+
status: "new",
|
|
94
|
+
importNames: ["MediaBanner"],
|
|
95
|
+
lead: "The picture or the short film at the head of an article, an announcement or a changelog entry, in a rounded frame. A picture fills the width up to a capped height; a video is muted, loops, and plays only while it is in view.",
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
98
|
+
id: "basics",
|
|
99
|
+
title: "A picture",
|
|
100
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
101
|
+
"Give ",
|
|
102
|
+
/* @__PURE__ */ jsx("code", { children: "src" }),
|
|
103
|
+
". A picture fills the frame's width and is cut off at 420px tall (",
|
|
104
|
+
/* @__PURE__ */ jsx("code", { children: "maxHeight" }),
|
|
105
|
+
"), covering the frame; ",
|
|
106
|
+
/* @__PURE__ */ jsx("code", { children: "fit=\"contain\"" }),
|
|
107
|
+
" shows the whole of it on the sunken ground instead. Its",
|
|
108
|
+
" ",
|
|
109
|
+
/* @__PURE__ */ jsx("code", { children: "alt" }),
|
|
110
|
+
" is empty by default, since the heading beside it says what the entry is about: describe it when the picture shows something the words do not."
|
|
111
|
+
] }),
|
|
112
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
113
|
+
align: "fill",
|
|
114
|
+
code: `
|
|
115
|
+
<MediaBanner src={releaseUrl} />
|
|
116
|
+
<MediaBanner src={releaseUrl} fit="contain" maxHeight={200} alt="The new order list beside an order" />`,
|
|
117
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
118
|
+
className: "media-banner-stack",
|
|
119
|
+
children: [/* @__PURE__ */ jsx(MediaBanner, { src: releaseUrl }), /* @__PURE__ */ jsx(MediaBanner, {
|
|
120
|
+
src: releaseUrl,
|
|
121
|
+
fit: "contain",
|
|
122
|
+
maxHeight: 200,
|
|
123
|
+
alt: "The new order list beside an order"
|
|
124
|
+
})]
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
129
|
+
id: "video",
|
|
130
|
+
title: "A short film",
|
|
131
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
132
|
+
/* @__PURE__ */ jsx("code", { children: "kind=\"video\"" }),
|
|
133
|
+
" draws a muted, looping video with its controls, and plays it only while 30% of it is in view (",
|
|
134
|
+
/* @__PURE__ */ jsx("code", { children: "threshold" }),
|
|
135
|
+
"), so a page of entries never plays them all at once. Name it with",
|
|
136
|
+
" ",
|
|
137
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
138
|
+
". Under reduced motion it stays still, its controls there to play it; a video the person paused stays paused when it scrolls back into view. ",
|
|
139
|
+
/* @__PURE__ */ jsxs("code", { children: ["autoplay=", "{false}"] }),
|
|
140
|
+
" leaves it to the controls always."
|
|
141
|
+
] }),
|
|
142
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
143
|
+
align: "fill",
|
|
144
|
+
clientOnly: true,
|
|
145
|
+
code: `
|
|
146
|
+
<MediaBanner kind="video" src={filmUrl} poster={posterUrl} label="Orbit's new order list, a short film" />`,
|
|
147
|
+
children: /* @__PURE__ */ jsx(FilmExample, {})
|
|
148
|
+
}), /* @__PURE__ */ jsx(Fragment$1, {})]
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
151
|
+
id: "accessibility",
|
|
152
|
+
title: "Accessibility",
|
|
153
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
154
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
155
|
+
"A video is named by ",
|
|
156
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
157
|
+
" and keeps the browser's own controls, which a keyboard reaches."
|
|
158
|
+
] }),
|
|
159
|
+
"It is muted, so playing by itself never makes a sound; it never plays under reduced motion.",
|
|
160
|
+
"A pause pressed in its controls is the person’s: scrolling away and back does not undo it.",
|
|
161
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
162
|
+
"A picture's ",
|
|
163
|
+
/* @__PURE__ */ jsx("code", { children: "alt" }),
|
|
164
|
+
" is empty by default: give it words when the picture says something the heading does not."
|
|
165
|
+
] })
|
|
166
|
+
] })
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
169
|
+
id: "props",
|
|
170
|
+
title: "Props",
|
|
171
|
+
children: /* @__PURE__ */ jsx(PropsTable, {
|
|
172
|
+
title: "MediaBanner",
|
|
173
|
+
rows: [
|
|
174
|
+
{
|
|
175
|
+
name: "src",
|
|
176
|
+
type: "string",
|
|
177
|
+
required: true,
|
|
178
|
+
description: "The picture's or the video's address."
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "kind",
|
|
182
|
+
type: "'image' | 'video'",
|
|
183
|
+
default: "'image'",
|
|
184
|
+
description: "A picture, or a muted looping video."
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "alt",
|
|
188
|
+
type: "string",
|
|
189
|
+
default: "''",
|
|
190
|
+
description: "What the picture shows."
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: "poster",
|
|
194
|
+
type: "string",
|
|
195
|
+
description: "A picture shown before the video loads."
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: "label",
|
|
199
|
+
type: "string",
|
|
200
|
+
description: "Names the video."
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: "maxHeight",
|
|
204
|
+
type: "number",
|
|
205
|
+
default: "420",
|
|
206
|
+
description: "A picture's tallest, in px."
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "fit",
|
|
210
|
+
type: "'cover' | 'contain'",
|
|
211
|
+
default: "'cover'",
|
|
212
|
+
description: "Fill the frame, or show the whole of it."
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: "autoplay",
|
|
216
|
+
type: "boolean",
|
|
217
|
+
default: "true",
|
|
218
|
+
description: "Plays the video while it is in view. Never under reduced motion."
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: "threshold",
|
|
222
|
+
type: "number",
|
|
223
|
+
default: "0.3",
|
|
224
|
+
description: "How much of the video is in view before it plays."
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
})
|
|
228
|
+
})
|
|
229
|
+
]
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
export { Page, Preview };
|