@aglyn/plugins-mui 1.0.0-beta.143
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/LICENSE +201 -0
- package/README.md +22 -0
- package/package.json +47 -0
- package/src/index.d.ts +21 -0
- package/src/index.js +22 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/accordion.d.ts +96 -0
- package/src/lib/components/accordion.js +392 -0
- package/src/lib/components/accordion.js.map +1 -0
- package/src/lib/components/app-bar.d.ts +32 -0
- package/src/lib/components/app-bar.js +86 -0
- package/src/lib/components/app-bar.js.map +1 -0
- package/src/lib/components/blocks.d.ts +46 -0
- package/src/lib/components/blocks.js +1007 -0
- package/src/lib/components/blocks.js.map +1 -0
- package/src/lib/components/box.d.ts +47 -0
- package/src/lib/components/box.js +125 -0
- package/src/lib/components/box.js.map +1 -0
- package/src/lib/components/breadcrumbs.d.ts +44 -0
- package/src/lib/components/breadcrumbs.js +172 -0
- package/src/lib/components/breadcrumbs.js.map +1 -0
- package/src/lib/components/button.d.ts +89 -0
- package/src/lib/components/button.js +272 -0
- package/src/lib/components/button.js.map +1 -0
- package/src/lib/components/card.d.ts +61 -0
- package/src/lib/components/card.js +336 -0
- package/src/lib/components/card.js.map +1 -0
- package/src/lib/components/collection.d.ts +514 -0
- package/src/lib/components/collection.js +2999 -0
- package/src/lib/components/collection.js.map +1 -0
- package/src/lib/components/container.d.ts +42 -0
- package/src/lib/components/container.js +169 -0
- package/src/lib/components/container.js.map +1 -0
- package/src/lib/components/custom-html.d.ts +78 -0
- package/src/lib/components/custom-html.js +219 -0
- package/src/lib/components/custom-html.js.map +1 -0
- package/src/lib/components/data-table.d.ts +57 -0
- package/src/lib/components/data-table.js +216 -0
- package/src/lib/components/data-table.js.map +1 -0
- package/src/lib/components/document-root.d.ts +77 -0
- package/src/lib/components/document-root.js +118 -0
- package/src/lib/components/document-root.js.map +1 -0
- package/src/lib/components/drawer.d.ts +93 -0
- package/src/lib/components/drawer.js +566 -0
- package/src/lib/components/drawer.js.map +1 -0
- package/src/lib/components/function-controls.d.ts +66 -0
- package/src/lib/components/function-controls.js +207 -0
- package/src/lib/components/function-controls.js.map +1 -0
- package/src/lib/components/function-scope.d.ts +110 -0
- package/src/lib/components/function-scope.js +478 -0
- package/src/lib/components/function-scope.js.map +1 -0
- package/src/lib/components/function-widget.d.ts +75 -0
- package/src/lib/components/function-widget.js +307 -0
- package/src/lib/components/function-widget.js.map +1 -0
- package/src/lib/components/grid.d.ts +91 -0
- package/src/lib/components/grid.js +322 -0
- package/src/lib/components/grid.js.map +1 -0
- package/src/lib/components/icon.d.ts +54 -0
- package/src/lib/components/icon.js +163 -0
- package/src/lib/components/icon.js.map +1 -0
- package/src/lib/components/image-list.d.ts +58 -0
- package/src/lib/components/image-list.js +336 -0
- package/src/lib/components/image-list.js.map +1 -0
- package/src/lib/components/image.d.ts +154 -0
- package/src/lib/components/image.js +451 -0
- package/src/lib/components/image.js.map +1 -0
- package/src/lib/components/inline-text.d.ts +74 -0
- package/src/lib/components/inline-text.js +407 -0
- package/src/lib/components/inline-text.js.map +1 -0
- package/src/lib/components/language-switcher.d.ts +35 -0
- package/src/lib/components/language-switcher.js +179 -0
- package/src/lib/components/language-switcher.js.map +1 -0
- package/src/lib/components/layout-slot.d.ts +68 -0
- package/src/lib/components/layout-slot.js +192 -0
- package/src/lib/components/layout-slot.js.map +1 -0
- package/src/lib/components/link-box-accessible-name.d.ts +79 -0
- package/src/lib/components/link-box-accessible-name.js +158 -0
- package/src/lib/components/link-box-accessible-name.js.map +1 -0
- package/src/lib/components/link-box.d.ts +66 -0
- package/src/lib/components/link-box.js +212 -0
- package/src/lib/components/link-box.js.map +1 -0
- package/src/lib/components/list-item-text.d.ts +22 -0
- package/src/lib/components/list-item-text.js +86 -0
- package/src/lib/components/list-item-text.js.map +1 -0
- package/src/lib/components/list-item.d.ts +32 -0
- package/src/lib/components/list-item.js +127 -0
- package/src/lib/components/list-item.js.map +1 -0
- package/src/lib/components/list.d.ts +34 -0
- package/src/lib/components/list.js +108 -0
- package/src/lib/components/list.js.map +1 -0
- package/src/lib/components/markdown.d.ts +129 -0
- package/src/lib/components/markdown.js +853 -0
- package/src/lib/components/markdown.js.map +1 -0
- package/src/lib/components/nav-menu.d.ts +68 -0
- package/src/lib/components/nav-menu.js +683 -0
- package/src/lib/components/nav-menu.js.map +1 -0
- package/src/lib/components/pagination.d.ts +59 -0
- package/src/lib/components/pagination.js +243 -0
- package/src/lib/components/pagination.js.map +1 -0
- package/src/lib/components/paper.d.ts +47 -0
- package/src/lib/components/paper.js +202 -0
- package/src/lib/components/paper.js.map +1 -0
- package/src/lib/components/plugin-frame.d.ts +64 -0
- package/src/lib/components/plugin-frame.js +335 -0
- package/src/lib/components/plugin-frame.js.map +1 -0
- package/src/lib/components/plugin.d.ts +95 -0
- package/src/lib/components/plugin.js +304 -0
- package/src/lib/components/plugin.js.map +1 -0
- package/src/lib/components/product.d.ts +40 -0
- package/src/lib/components/product.js +287 -0
- package/src/lib/components/product.js.map +1 -0
- package/src/lib/components/reusable-instance.d.ts +57 -0
- package/src/lib/components/reusable-instance.js +126 -0
- package/src/lib/components/reusable-instance.js.map +1 -0
- package/src/lib/components/screen-link.d.ts +85 -0
- package/src/lib/components/screen-link.js +324 -0
- package/src/lib/components/screen-link.js.map +1 -0
- package/src/lib/components/search-box.d.ts +41 -0
- package/src/lib/components/search-box.js +125 -0
- package/src/lib/components/search-box.js.map +1 -0
- package/src/lib/components/section.d.ts +56 -0
- package/src/lib/components/section.js +132 -0
- package/src/lib/components/section.js.map +1 -0
- package/src/lib/components/stack.d.ts +55 -0
- package/src/lib/components/stack.js +309 -0
- package/src/lib/components/stack.js.map +1 -0
- package/src/lib/components/tabs.d.ts +288 -0
- package/src/lib/components/tabs.js +788 -0
- package/src/lib/components/tabs.js.map +1 -0
- package/src/lib/components/theme-mode-switcher.d.ts +38 -0
- package/src/lib/components/theme-mode-switcher.js +168 -0
- package/src/lib/components/theme-mode-switcher.js.map +1 -0
- package/src/lib/components/toolbar.d.ts +37 -0
- package/src/lib/components/toolbar.js +117 -0
- package/src/lib/components/toolbar.js.map +1 -0
- package/src/lib/components/typography.d.ts +33 -0
- package/src/lib/components/typography.js +433 -0
- package/src/lib/components/typography.js.map +1 -0
- package/src/lib/components/video-lightbox-controls.d.ts +131 -0
- package/src/lib/components/video-lightbox-controls.js +536 -0
- package/src/lib/components/video-lightbox-controls.js.map +1 -0
- package/src/lib/components/video-lightbox.d.ts +60 -0
- package/src/lib/components/video-lightbox.js +247 -0
- package/src/lib/components/video-lightbox.js.map +1 -0
- package/src/lib/components/video-playback-beacon.d.ts +80 -0
- package/src/lib/components/video-playback-beacon.js +128 -0
- package/src/lib/components/video-playback-beacon.js.map +1 -0
- package/src/lib/components/video-player-frame.d.ts +58 -0
- package/src/lib/components/video-player-frame.js +51 -0
- package/src/lib/components/video-player-frame.js.map +1 -0
- package/src/lib/components/video.d.ts +220 -0
- package/src/lib/components/video.js +874 -0
- package/src/lib/components/video.js.map +1 -0
- package/src/lib/constants/bundle-common.d.ts +17 -0
- package/src/lib/constants/bundle-common.js +18 -0
- package/src/lib/constants/bundle-common.js.map +1 -0
- package/src/lib/constants/field-presets.d.ts +93 -0
- package/src/lib/constants/field-presets.js +248 -0
- package/src/lib/constants/field-presets.js.map +1 -0
- package/src/lib/plugin.d.ts +80 -0
- package/src/lib/plugin.js +599 -0
- package/src/lib/plugin.js.map +1 -0
- package/src/lib/utils/author-html-label.d.ts +73 -0
- package/src/lib/utils/author-html-label.js +89 -0
- package/src/lib/utils/author-html-label.js.map +1 -0
- package/src/lib/utils/drop-cleared-props.d.ts +18 -0
- package/src/lib/utils/drop-cleared-props.js +74 -0
- package/src/lib/utils/drop-cleared-props.js.map +1 -0
- package/src/lib/utils/element-picker.d.ts +99 -0
- package/src/lib/utils/element-picker.js +140 -0
- package/src/lib/utils/element-picker.js.map +1 -0
- package/src/lib/utils/generate-preset-id.d.ts +19 -0
- package/src/lib/utils/generate-preset-id.js +25 -0
- package/src/lib/utils/generate-preset-id.js.map +1 -0
- package/src/lib/utils/link-target-props.d.ts +53 -0
- package/src/lib/utils/link-target-props.js +53 -0
- package/src/lib/utils/link-target-props.js.map +1 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2026 Aglyn LLC
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/ import * as Aglyn from "@aglyn/aglyn";
|
|
19
|
+
import { mdiFormatListBulletedSquare } from "@aglyn/shared-data-mdi";
|
|
20
|
+
import MuiList from "@mui/material/List";
|
|
21
|
+
import ListSubheader from "@mui/material/ListSubheader";
|
|
22
|
+
import { createElement, forwardRef } from "react";
|
|
23
|
+
import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
24
|
+
import { generatePresetId } from "../utils/generate-preset-id.js";
|
|
25
|
+
import { presets as listItemPresets, schema as listItemSchema } from "./list-item.js";
|
|
26
|
+
// Component ids are persisted in screen documents; keep the legacy ids.
|
|
27
|
+
export const ID = 'muiList';
|
|
28
|
+
/**
|
|
29
|
+
* List (https://mui.com/material-ui/react-list/).
|
|
30
|
+
*
|
|
31
|
+
* Wraps MUI's List only to turn the authored `subheader` string into a
|
|
32
|
+
* real `ListSubheader`: MUI types the prop as a node, so a bare string
|
|
33
|
+
* renders as unstyled text outside the list's own heading treatment.
|
|
34
|
+
*/ const List = forwardRef((props, ref)=>{
|
|
35
|
+
const { subheader } = props, rest = _object_without_properties_loose(props, [
|
|
36
|
+
"subheader"
|
|
37
|
+
]);
|
|
38
|
+
return createElement(MuiList, _extends({
|
|
39
|
+
ref,
|
|
40
|
+
// ListSubheader defaults to `li`, which is what belongs inside the
|
|
41
|
+
// `ul` List renders.
|
|
42
|
+
subheader: subheader ? createElement(ListSubheader, null, subheader) : undefined
|
|
43
|
+
}, rest));
|
|
44
|
+
});
|
|
45
|
+
List.displayName = 'AglynList';
|
|
46
|
+
export const schema = {
|
|
47
|
+
$id: ID,
|
|
48
|
+
pluginId: BUNDLE_ID,
|
|
49
|
+
displayName: 'List',
|
|
50
|
+
description: 'Vertical list of items, optionally under a sticky heading.',
|
|
51
|
+
category: Aglyn.ComponentCategory.DATA_DISPLAY,
|
|
52
|
+
icon: {
|
|
53
|
+
path: mdiFormatListBulletedSquare.path
|
|
54
|
+
},
|
|
55
|
+
restrictChildren: [
|
|
56
|
+
Aglyn.LinealDirectiveFlag.LIMIT_TO,
|
|
57
|
+
{
|
|
58
|
+
components: [
|
|
59
|
+
listItemSchema.$id
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
// The list had NO attributes at all: density and padding were only
|
|
64
|
+
// reachable by hand-writing sx, which is not where authors look.
|
|
65
|
+
attributes: [
|
|
66
|
+
{
|
|
67
|
+
name: 'subheader',
|
|
68
|
+
label: 'Heading',
|
|
69
|
+
description: 'Sticky heading rendered above the items. Leave blank for none.',
|
|
70
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'dense',
|
|
74
|
+
label: 'Dense?',
|
|
75
|
+
description: 'If true, items are compacted vertically. Applies to every item ' + 'in the list.',
|
|
76
|
+
component: Aglyn.FieldComponentType.SWITCH
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'disablePadding',
|
|
80
|
+
label: 'Disable padding?',
|
|
81
|
+
description: 'If true, the padding above and below the list is removed.',
|
|
82
|
+
component: Aglyn.FieldComponentType.SWITCH
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
};
|
|
86
|
+
export const presets = [
|
|
87
|
+
{
|
|
88
|
+
$id: generatePresetId(ID),
|
|
89
|
+
type: Aglyn.NodeType.PRESET,
|
|
90
|
+
displayName: 'List',
|
|
91
|
+
icon: {
|
|
92
|
+
path: mdiFormatListBulletedSquare.path
|
|
93
|
+
},
|
|
94
|
+
category: Aglyn.ComponentCategory.DATA_DISPLAY,
|
|
95
|
+
data: {
|
|
96
|
+
$id: null,
|
|
97
|
+
componentId: ID,
|
|
98
|
+
pluginId: BUNDLE_ID,
|
|
99
|
+
nodes: [
|
|
100
|
+
_extends({}, listItemPresets[0].data),
|
|
101
|
+
_extends({}, listItemPresets[0].data)
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
export default List;
|
|
107
|
+
|
|
108
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/list.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport {\n mdiFormatListBulletedSquare,\n} from '@aglyn/shared-data-mdi'\nimport MuiList, { type ListProps } from '@mui/material/List'\nimport ListSubheader from '@mui/material/ListSubheader'\nimport { createElement, forwardRef } from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport { generatePresetId } from '../utils/generate-preset-id'\nimport {\n presets as listItemPresets,\n schema as listItemSchema,\n} from './list-item'\n\n// Component ids are persisted in screen documents; keep the legacy ids.\nexport const ID: Aglyn.ComponentId = 'muiList'\n\nexport interface ListElementProps extends Omit<ListProps, 'subheader'> {\n /** Sticky heading above the items; omitted entirely when blank. */\n subheader?: string\n}\n\n/**\n * List (https://mui.com/material-ui/react-list/).\n *\n * Wraps MUI's List only to turn the authored `subheader` string into a\n * real `ListSubheader`: MUI types the prop as a node, so a bare string\n * renders as unstyled text outside the list's own heading treatment.\n */\nconst List = forwardRef<HTMLUListElement, ListElementProps>((props, ref) => {\n const { subheader, ...rest } = props\n return createElement(MuiList, {\n ref,\n // ListSubheader defaults to `li`, which is what belongs inside the\n // `ul` List renders.\n subheader: subheader\n ? createElement(ListSubheader, null, subheader)\n : undefined,\n ...rest,\n })\n})\nList.displayName = 'AglynList'\n\nexport const schema: Aglyn.ComponentSchema<ListElementProps> = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'List',\n description: 'Vertical list of items, optionally under a sticky heading.',\n category: Aglyn.ComponentCategory.DATA_DISPLAY,\n icon: { path: mdiFormatListBulletedSquare.path },\n restrictChildren: [\n Aglyn.LinealDirectiveFlag.LIMIT_TO,\n {\n components: [listItemSchema.$id],\n },\n ],\n // The list had NO attributes at all: density and padding were only\n // reachable by hand-writing sx, which is not where authors look.\n attributes: [\n {\n name: 'subheader',\n label: 'Heading',\n description:\n 'Sticky heading rendered above the items. Leave blank for none.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'dense',\n label: 'Dense?',\n description:\n 'If true, items are compacted vertically. Applies to every item ' +\n 'in the list.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n {\n name: 'disablePadding',\n label: 'Disable padding?',\n description: 'If true, the padding above and below the list is removed.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n ],\n}\n\nexport const presets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'List',\n icon: { path: mdiFormatListBulletedSquare.path },\n category: Aglyn.ComponentCategory.DATA_DISPLAY,\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n nodes: [\n {\n ...listItemPresets[0].data,\n },\n {\n ...listItemPresets[0].data,\n },\n ],\n },\n },\n]\n\nexport default List\n"],"names":["Aglyn","mdiFormatListBulletedSquare","MuiList","ListSubheader","createElement","forwardRef","BUNDLE_ID","generatePresetId","presets","listItemPresets","schema","listItemSchema","ID","List","props","ref","subheader","rest","undefined","displayName","$id","pluginId","description","category","ComponentCategory","DATA_DISPLAY","icon","path","restrictChildren","LinealDirectiveFlag","LIMIT_TO","components","attributes","name","label","component","FieldComponentType","TEXT_FIELD","SWITCH","type","NodeType","PRESET","data","componentId","nodes"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SACEC,2BAA2B,QACtB,yBAAwB;AAC/B,OAAOC,aAAiC,qBAAoB;AAC5D,OAAOC,mBAAmB,8BAA6B;AACvD,SAASC,aAAa,EAAEC,UAAU,QAAQ,QAAO;AACjD,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SAASC,gBAAgB,QAAQ,iCAA6B;AAC9D,SACEC,WAAWC,eAAe,EAC1BC,UAAUC,cAAc,QACnB,iBAAa;AAEpB,wEAAwE;AACxE,OAAO,MAAMC,KAAwB,UAAS;AAO9C;;;;;;CAMC,GACD,MAAMC,OAAOR,WAA+C,CAACS,OAAOC;IAClE,MAAM,EAAEC,SAAS,EAAW,GAAGF,OAATG,wCAASH;;;IAC/B,OAAOV,cAAcF,SAAS;QAC5Ba;QACA,mEAAmE;QACnE,qBAAqB;QACrBC,WAAWA,YACPZ,cAAcD,eAAe,MAAMa,aACnCE;OACDD;AAEP;AACAJ,KAAKM,WAAW,GAAG;AAEnB,OAAO,MAAMT,SAAkD;IAC7DU,KAAKR;IACLS,UAAUf;IACVa,aAAa;IACbG,aAAa;IACbC,UAAUvB,MAAMwB,iBAAiB,CAACC,YAAY;IAC9CC,MAAM;QAAEC,MAAM1B,4BAA4B0B,IAAI;IAAC;IAC/CC,kBAAkB;QAChB5B,MAAM6B,mBAAmB,CAACC,QAAQ;QAClC;YACEC,YAAY;gBAACpB,eAAeS,GAAG;aAAC;QAClC;KACD;IACD,mEAAmE;IACnE,iEAAiE;IACjEY,YAAY;QACV;YACEC,MAAM;YACNC,OAAO;YACPZ,aACE;YACFa,WAAWnC,MAAMoC,kBAAkB,CAACC,UAAU;QAChD;QACA;YACEJ,MAAM;YACNC,OAAO;YACPZ,aACE,oEACA;YACFa,WAAWnC,MAAMoC,kBAAkB,CAACE,MAAM;QAC5C;QACA;YACEL,MAAM;YACNC,OAAO;YACPZ,aAAa;YACba,WAAWnC,MAAMoC,kBAAkB,CAACE,MAAM;QAC5C;KACD;AACH,EAAC;AAED,OAAO,MAAM9B,UAAgC;IAC3C;QACEY,KAAKb,iBAAiBK;QACtB2B,MAAMvC,MAAMwC,QAAQ,CAACC,MAAM;QAC3BtB,aAAa;QACbO,MAAM;YAAEC,MAAM1B,4BAA4B0B,IAAI;QAAC;QAC/CJ,UAAUvB,MAAMwB,iBAAiB,CAACC,YAAY;QAC9CiB,MAAM;YACJtB,KAAK;YACLuB,aAAa/B;YACbS,UAAUf;YACVsC,OAAO;gBACL,aACKnC,eAAe,CAAC,EAAE,CAACiC,IAAI;gBAE5B,aACKjC,eAAe,CAAC,EAAE,CAACiC,IAAI;aAE7B;QACH;IACF;CACD,CAAA;AAED,eAAe7B,KAAI"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import * as Aglyn from '@aglyn/aglyn';
|
|
18
|
+
import { type BoxProps } from '@mui/material/Box';
|
|
19
|
+
export declare const MARKDOWN_ID: Aglyn.ComponentId;
|
|
20
|
+
export declare const TABLE_OF_CONTENTS_ID: Aglyn.ComponentId;
|
|
21
|
+
export interface MarkdownProps extends BoxProps {
|
|
22
|
+
/** The document, as markdown-lite source. */
|
|
23
|
+
content?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The pixel pair of each library image this document names, keyed by the
|
|
26
|
+
* target as the document writes it, stamped by the composition from the
|
|
27
|
+
* assets' DAM records (AGL-3149) — never set by hand.
|
|
28
|
+
*
|
|
29
|
+
* An image with no entry here renders exactly as it did before this prop
|
|
30
|
+
* existed: see `mediaBodyImageAttributes` for why a partial answer is worse
|
|
31
|
+
* than none.
|
|
32
|
+
*/
|
|
33
|
+
intrinsicSizes?: Record<string, {
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A whole document authored as markdown (AGL-1162).
|
|
40
|
+
*
|
|
41
|
+
* The elements that made a legal or policy page before this were hundreds of
|
|
42
|
+
* Typography nodes, one per paragraph — which meant the page could not be
|
|
43
|
+
* pasted from, or back into, the markdown file in Drive that is its actual
|
|
44
|
+
* source. Here the source IS the element's content, so updating the page is
|
|
45
|
+
* one paste.
|
|
46
|
+
*
|
|
47
|
+
* Rendered through the shared markdown-lite parser, which emits plain data
|
|
48
|
+
* blocks and never an HTML string — so there is no `dangerouslySetInnerHTML`
|
|
49
|
+
* anywhere on this path and nothing to sanitize. Parsing is pure, so the full
|
|
50
|
+
* document server-renders and the text is in the crawled HTML.
|
|
51
|
+
*
|
|
52
|
+
* Child NODES are never rendered, in either branch (AGL-1388). The document
|
|
53
|
+
* is the `content` prop; there is no position in a parsed block list that a
|
|
54
|
+
* dropped element could occupy, so the schema turns dropping off and
|
|
55
|
+
* `nodeAcceptsChildren` now honors that — a drop lands as a sibling instead.
|
|
56
|
+
* `children` is destructured away rather than left in `rest` because the
|
|
57
|
+
* empty-content branch spreads `rest` onto a childless Box: without this, a
|
|
58
|
+
* Markdown element rendered exactly the child nodes it had swallowed a
|
|
59
|
+
* moment earlier as soon as its content was cleared.
|
|
60
|
+
*/
|
|
61
|
+
declare const Markdown: import("react").ForwardRefExoticComponent<Omit<MarkdownProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
62
|
+
export interface TableOfContentsProps extends BoxProps {
|
|
63
|
+
/**
|
|
64
|
+
* The Markdown element this lists the headings of. Empty means "the first
|
|
65
|
+
* Markdown element on the screen", which is the answer on every page that
|
|
66
|
+
* has exactly one — see {@link resolveMarkdownSource}.
|
|
67
|
+
*/
|
|
68
|
+
forNodeId?: string;
|
|
69
|
+
/** Aside heading; an empty string renders no heading at all. */
|
|
70
|
+
heading?: string;
|
|
71
|
+
/** Deepest heading level listed: `'2'` for top level only. */
|
|
72
|
+
depth?: '2' | '3';
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Which Markdown element a table of contents speaks for (AGL-1162).
|
|
76
|
+
*
|
|
77
|
+
* Resolved through the NODE TREE, never the DOM: the besigner canvas renders
|
|
78
|
+
* inside a closed shadow root, so a `document.querySelector` from a component
|
|
79
|
+
* finds nothing there and the aside would be empty in the one place it is
|
|
80
|
+
* being authored.
|
|
81
|
+
*
|
|
82
|
+
* The tree is walked from the root in document order, so "the first Markdown
|
|
83
|
+
* element" means the first one a reader meets — not the first key of a node
|
|
84
|
+
* map, whose order is storage detail.
|
|
85
|
+
*
|
|
86
|
+
* An explicit `forNodeId` wins, compared with `leafIdsMatch` because the
|
|
87
|
+
* stored id is the raw canvas id while a composed tree namespaces layout and
|
|
88
|
+
* reusable-component grafts (AGL-573/1229). A pick that no longer resolves —
|
|
89
|
+
* the element was deleted and re-added, which is exactly what re-pasting a
|
|
90
|
+
* document looks like — falls back to the first Markdown element rather than
|
|
91
|
+
* leaving a published page with an empty aside.
|
|
92
|
+
*/
|
|
93
|
+
export declare function resolveMarkdownSource(root: Aglyn.NodeSchema | undefined, forNodeId?: string): string;
|
|
94
|
+
/**
|
|
95
|
+
* Scrolls to a heading in the cases the browser cannot reach, and ONLY those
|
|
96
|
+
* (AGL-1162). Returns whether it handled the click.
|
|
97
|
+
*
|
|
98
|
+
* In `document` it deliberately does nothing and lets the plain `#slug`
|
|
99
|
+
* anchor work: native fragment navigation updates the address bar, adds a
|
|
100
|
+
* history entry the back button understands, and honours the site's CSS
|
|
101
|
+
* `scroll-behavior` — none of which a hand-rolled `scrollIntoView` gives
|
|
102
|
+
* back. It is also the only version that works with JavaScript off.
|
|
103
|
+
*
|
|
104
|
+
* (`behavior: 'smooth'` was the first attempt at the whole job, and it is
|
|
105
|
+
* exactly the wrong shape: a browser that declines to animate — a background
|
|
106
|
+
* tab, reduced-motion — leaves the click prevented and the page unmoved, so
|
|
107
|
+
* a working link reads as a broken one.)
|
|
108
|
+
*
|
|
109
|
+
* The besigner canvas renders inside a CLOSED shadow root, where the heading
|
|
110
|
+
* is not in `document` at all and a fragment navigation finds nothing. There
|
|
111
|
+
* the link's own `getRootNode()` is the shadow root holding both ends, and
|
|
112
|
+
* `ShadowRoot.getElementById` finds the heading.
|
|
113
|
+
*/
|
|
114
|
+
export declare function scrollToHeading(anchor: Element, slug: string): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* "On this page" (AGL-1162) — the headings of a Markdown element on the same
|
|
117
|
+
* screen, as working anchor links.
|
|
118
|
+
*
|
|
119
|
+
* A mobx `observer` because it reads ANOTHER node's props: the renderer's
|
|
120
|
+
* Leaf re-renders on changes to the node it is rendering, and nothing else,
|
|
121
|
+
* so without this the aside in the besigner would keep listing the headings
|
|
122
|
+
* of the document as it was when the aside mounted.
|
|
123
|
+
*/
|
|
124
|
+
declare const TableOfContents: import("react").FunctionComponent<Omit<TableOfContentsProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
125
|
+
export declare const markdownSchema: Aglyn.ComponentSchema<MarkdownProps>;
|
|
126
|
+
export declare const tableOfContentsSchema: Aglyn.ComponentSchema<TableOfContentsProps>;
|
|
127
|
+
export declare const markdownPresets: Aglyn.PresetSchema[];
|
|
128
|
+
export { Markdown, TableOfContents };
|
|
129
|
+
export default Markdown;
|