@astryxdesign/core 0.6.2 → 0.6.3-canary.0949cb1
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/CHANGELOG.md +81 -0
- package/dist/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +3 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts +7 -5
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +56 -19
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +10 -5
- package/dist/Chat/ChatComposerDrawer.d.ts +19 -5
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +48 -23
- package/dist/Chat/ChatComposerInput.d.ts +11 -3
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +63 -16
- package/dist/Chat/ChatDictationButton.d.ts +3 -2
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +6 -4
- package/dist/Chat/ChatSendButton.js +1 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +12 -2
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +6 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +1 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +4 -4
- package/dist/DateInput/NativeDateField.d.ts.map +1 -1
- package/dist/DateInput/NativeDateField.js +16 -16
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +2 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +4 -4
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +8 -8
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +4 -4
- package/dist/DateTimeInput/nativePickerSegmentStyles.d.ts +9 -3
- package/dist/DateTimeInput/nativePickerSegmentStyles.d.ts.map +1 -1
- package/dist/DateTimeInput/nativePickerSegmentStyles.js +3 -3
- package/dist/Dialog/DialogHeader.d.ts +8 -1
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +10 -1
- package/dist/Field/InputClearButton.d.ts +4 -2
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +4 -2
- package/dist/Field/PanelSearchInput.d.ts.map +1 -1
- package/dist/Field/PanelSearchInput.js +1 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +7 -7
- package/dist/Kbd/Kbd.d.ts +5 -3
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +36 -42
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +6 -2
- package/dist/Markdown/Markdown.d.ts +8 -2
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.fr23.bench.d.ts +2 -0
- package/dist/Markdown/Markdown.fr23.bench.d.ts.map +1 -0
- package/dist/Markdown/Markdown.fr23.bench.js +150 -0
- package/dist/Markdown/Markdown.fr23.sampling.d.ts +2 -0
- package/dist/Markdown/Markdown.fr23.sampling.d.ts.map +1 -0
- package/dist/Markdown/Markdown.fr23.sampling.js +43 -0
- package/dist/Markdown/Markdown.js +262 -109
- package/dist/Markdown/ast.d.ts +162 -0
- package/dist/Markdown/ast.d.ts.map +1 -0
- package/dist/Markdown/ast.js +74 -0
- package/dist/Markdown/index.d.ts +5 -3
- package/dist/Markdown/index.d.ts.map +1 -1
- package/dist/Markdown/index.js +3 -2
- package/dist/Markdown/parser/index.d.ts +10 -0
- package/dist/Markdown/parser/index.d.ts.map +1 -0
- package/dist/Markdown/parser/index.js +10 -0
- package/dist/Markdown/parser.d.ts +126 -58
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +716 -167
- package/dist/Markdown/plugins/frontmatter.d.ts +32 -0
- package/dist/Markdown/plugins/frontmatter.d.ts.map +1 -0
- package/dist/Markdown/plugins/frontmatter.js +132 -0
- package/dist/Markdown/plugins/index.d.ts +16 -0
- package/dist/Markdown/plugins/index.d.ts.map +1 -0
- package/dist/Markdown/plugins/index.js +13 -0
- package/dist/Markdown/plugins/protocol.d.ts +191 -0
- package/dist/Markdown/plugins/protocol.d.ts.map +1 -0
- package/dist/Markdown/plugins/protocol.js +957 -0
- package/dist/Markdown/plugins/semanticFence.d.ts +36 -0
- package/dist/Markdown/plugins/semanticFence.d.ts.map +1 -0
- package/dist/Markdown/plugins/semanticFence.js +213 -0
- package/dist/Markdown/plugins/sourceDecoration.d.ts +76 -0
- package/dist/Markdown/plugins/sourceDecoration.d.ts.map +1 -0
- package/dist/Markdown/plugins/sourceDecoration.js +393 -0
- package/dist/Markdown/plugins/textTransform.d.ts +30 -0
- package/dist/Markdown/plugins/textTransform.d.ts.map +1 -0
- package/dist/Markdown/plugins/textTransform.js +374 -0
- package/dist/Markdown/remark.d.ts +196 -0
- package/dist/Markdown/remark.d.ts.map +1 -0
- package/dist/Markdown/remark.js +1062 -0
- package/dist/Markdown/url.d.ts +4 -0
- package/dist/Markdown/url.d.ts.map +1 -0
- package/dist/Markdown/url.js +25 -0
- package/dist/Markdown/utils.d.ts +4 -2
- package/dist/Markdown/utils.d.ts.map +1 -1
- package/dist/Markdown/utils.js +2 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +4 -4
- package/dist/Outline/index.d.ts +1 -0
- package/dist/Outline/index.d.ts.map +1 -1
- package/dist/Outline/parseOutlineFromMarkdown.d.ts +7 -1
- package/dist/Outline/parseOutlineFromMarkdown.d.ts.map +1 -1
- package/dist/Outline/parseOutlineFromMarkdown.js +14 -8
- package/dist/Outline/useOutlineFromMarkdown.d.ts +3 -1
- package/dist/Outline/useOutlineFromMarkdown.d.ts.map +1 -1
- package/dist/Outline/useOutlineFromMarkdown.js +8 -3
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +46 -30
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +36 -31
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +13 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +5 -5
- package/dist/Selector/Selector.d.ts +9 -7
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +7 -5
- package/dist/SideNav/SideNav.d.ts +2 -1
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +9 -3
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +28 -12
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +23 -7
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +11 -0
- package/dist/TabList/Tab.d.ts +1 -1
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +20 -7
- package/dist/Table/Table.d.ts +1 -0
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +29 -13
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +1 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +2 -2
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +4 -4
- package/dist/ToggleButton/ToggleButton.d.ts +9 -6
- package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton/ToggleButton.js +15 -27
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +3 -0
- package/dist/TreeList/TreeListItem.d.ts +6 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +12 -2
- package/dist/TreeList/TreeListTypes.d.ts +8 -1
- package/dist/TreeList/TreeListTypes.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +16 -7
- package/dist/astryx.css +18 -7
- package/dist/hooks/scrollKeyboardDelegation.d.ts +3 -0
- package/dist/hooks/scrollKeyboardDelegation.d.ts.map +1 -0
- package/dist/hooks/scrollKeyboardDelegation.js +146 -0
- package/dist/hooks/useScrollableArea.d.ts +6 -2
- package/dist/hooks/useScrollableArea.d.ts.map +1 -1
- package/dist/hooks/useScrollableArea.js +17 -5
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +10 -0
- package/dist/utils/interactionOverlay.stylex.d.ts +8 -0
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +9 -0
- package/locales/af-ZA.json +530 -1
- package/locales/ar-SA.json +490 -1
- package/locales/ca-ES.json +514 -1
- package/locales/cs-CZ.json +498 -1
- package/locales/da-DK.json +522 -1
- package/locales/de-DE.json +522 -1
- package/locales/el-GR.json +498 -1
- package/locales/es-ES.json +510 -1
- package/locales/fi-FI.json +498 -1
- package/locales/fr-FR.json +534 -1
- package/locales/he-IL.json +498 -1
- package/locales/hu-HU.json +498 -1
- package/locales/it-IT.json +510 -1
- package/locales/ja-JP.json +490 -1
- package/locales/ko-KR.json +498 -1
- package/locales/nl-NL.json +534 -1
- package/locales/no-NO.json +510 -1
- package/locales/pl-PL.json +506 -1
- package/locales/pt-BR.json +506 -1
- package/locales/pt-PT.json +506 -1
- package/locales/ro-RO.json +506 -1
- package/locales/ru-RU.json +498 -1
- package/locales/sr-SP.json +498 -1
- package/locales/sv-SE.json +502 -1
- package/locales/tr-TR.json +498 -1
- package/locales/uk-UA.json +498 -1
- package/locales/vi-VN.json +502 -1
- package/locales/zh-CN.json +490 -1
- package/locales/zh-TW.json +490 -1
- package/package.json +19 -4
- package/src/BottomSheet/BottomSheet.doc.mjs +8 -1
- package/src/BottomSheet/BottomSheet.spec.md +46 -20
- package/src/BottomSheet/BottomSheet.test.tsx +6 -3
- package/src/BottomSheet/BottomSheet.tsx +3 -1
- package/src/BottomSheet/BottomSheetKeyboard.test.tsx +195 -0
- package/src/BottomSheet/BottomSheetPanel.test.tsx +11 -1
- package/src/BottomSheet/BottomSheetPanel.tsx +49 -16
- package/src/BottomSheet/__tests__/BottomSheetKeyboard.a11y.browser.spec.ts +344 -0
- package/src/Button/__tests__/Button.a11y.chromium.spec.ts +17 -1
- package/src/Button/__tests__/Button.a11y.known-failures.ts +0 -29
- package/src/Button/__tests__/Button.a11y.renders.tsx +9 -2
- package/src/Button/__tests__/Button.a11y.states.ts +9 -0
- package/src/Chat/ChatComposer.doc.mjs +14 -0
- package/src/Chat/ChatComposer.spec.md +230 -0
- package/src/Chat/ChatComposer.test.tsx +57 -0
- package/src/Chat/ChatComposer.tsx +21 -9
- package/src/Chat/ChatComposerDrawer.doc.mjs +63 -5
- package/src/Chat/ChatComposerDrawer.spec.md +267 -0
- package/src/Chat/ChatComposerDrawer.test.tsx +81 -12
- package/src/Chat/ChatComposerDrawer.tsx +38 -9
- package/src/Chat/ChatComposerInput.doc.mjs +114 -26
- package/src/Chat/ChatComposerInput.spec.md +185 -0
- package/src/Chat/ChatComposerInput.test.tsx +113 -3
- package/src/Chat/ChatComposerInput.tsx +78 -13
- package/src/Chat/ChatComposerTokenElement.spec.md +152 -0
- package/src/Chat/ChatComposerTokenElement.test.tsx +85 -0
- package/src/Chat/ChatDictationButton.doc.mjs +3 -3
- package/src/Chat/ChatDictationButton.spec.md +160 -0
- package/src/Chat/ChatDictationButton.test.tsx +92 -27
- package/src/Chat/ChatDictationButton.tsx +8 -6
- package/src/Chat/ChatSendButton.test.tsx +1 -4
- package/src/Chat/ChatSendButton.tsx +1 -1
- package/src/Chat/index.ts +1 -0
- package/src/CheckboxInput/CheckboxInput.doc.mjs +11 -0
- package/src/CheckboxInput/CheckboxInput.test.tsx +34 -0
- package/src/CheckboxInput/CheckboxInput.tsx +21 -1
- package/src/ClickableCard/ClickableCard.test.tsx +102 -5
- package/src/Collapsible/Collapsible.doc.mjs +11 -0
- package/src/Collapsible/Collapsible.test.tsx +21 -0
- package/src/Collapsible/Collapsible.tsx +5 -0
- package/src/CommandPalette/CommandPaletteInput.tsx +6 -1
- package/src/ComplexSelector/ComplexSelector.tsx +6 -1
- package/src/DateInput/DateInput.tsx +6 -1
- package/src/DateInput/NativeDateField.tsx +24 -8
- package/src/DateInput/TouchDateField.tsx +6 -2
- package/src/DateRangeInput/DateRangeInput.tsx +6 -1
- package/src/DateTimeInput/DateTimeInput.tsx +6 -1
- package/src/DateTimeInput/TouchDateTimeField.tsx +6 -1
- package/src/DateTimeInput/nativePickerSegmentStyles.ts +24 -8
- package/src/Dialog/DialogHeader.doc.mjs +12 -0
- package/src/Dialog/DialogHeader.test.tsx +97 -0
- package/src/Dialog/DialogHeader.tsx +25 -3
- package/src/Dialog/modules/DialogHeader.spec.md +75 -38
- package/src/Field/InputClearButton.test.tsx +17 -3
- package/src/Field/InputClearButton.tsx +5 -2
- package/src/Field/PanelSearchInput.tsx +5 -2
- package/src/FieldStatus/__tests__/StatusMessage.a11y.states.ts +1 -1
- package/src/FileInput/FileInput.tsx +11 -2
- package/src/Kbd/Kbd.doc.mjs +3 -3
- package/src/Kbd/Kbd.test.tsx +57 -1
- package/src/Kbd/Kbd.tsx +57 -37
- package/src/Layout/LayoutFooter.doc.mjs +17 -0
- package/src/Link/Link.doc.mjs +11 -0
- package/src/Link/Link.test.tsx +24 -0
- package/src/Link/Link.tsx +5 -0
- package/src/List/List.spec.md +200 -0
- package/src/Markdown/Markdown.doc.mjs +272 -0
- package/src/Markdown/Markdown.fr23.bench.ts +174 -0
- package/src/Markdown/Markdown.fr23.perf.test.ts +249 -0
- package/src/Markdown/Markdown.fr23.sampling.ts +49 -0
- package/src/Markdown/Markdown.helpers.perf.test.ts +489 -0
- package/src/Markdown/Markdown.public.test.ts +126 -3
- package/src/Markdown/Markdown.spec.md +197 -44
- package/src/Markdown/Markdown.test.tsx +11 -0
- package/src/Markdown/Markdown.tsx +414 -135
- package/src/Markdown/ast.test.ts +307 -0
- package/src/Markdown/ast.ts +337 -0
- package/src/Markdown/incremental.test.ts +12 -0
- package/src/Markdown/index.ts +37 -1
- package/src/Markdown/modules/remark.spec.md +269 -0
- package/src/Markdown/parser/index.ts +64 -0
- package/src/Markdown/parser.public.test.ts +103 -0
- package/src/Markdown/parser.ts +1180 -235
- package/src/Markdown/plugins/frontmatter.test.tsx +125 -0
- package/src/Markdown/plugins/frontmatter.ts +198 -0
- package/src/Markdown/plugins/index.ts +53 -0
- package/src/Markdown/plugins/protocol.test.tsx +1022 -0
- package/src/Markdown/plugins/protocol.ts +1618 -0
- package/src/Markdown/plugins/semanticFence.test.tsx +546 -0
- package/src/Markdown/plugins/semanticFence.ts +424 -0
- package/src/Markdown/plugins/sourceDecoration.test.tsx +799 -0
- package/src/Markdown/plugins/sourceDecoration.ts +539 -0
- package/src/Markdown/plugins/textTransform.test.ts +467 -0
- package/src/Markdown/plugins/textTransform.ts +554 -0
- package/src/Markdown/remark.test.tsx +1877 -0
- package/src/Markdown/remark.ts +1574 -0
- package/src/Markdown/url.ts +30 -0
- package/src/Markdown/utils.ts +13 -1
- package/src/MultiSelector/MultiSelector.test.tsx +1 -35
- package/src/MultiSelector/__tests__/MultiSelector.listbox.a11y.test.tsx +128 -0
- package/src/NumberInput/NumberInput.tsx +6 -1
- package/src/Outline/Outline.doc.mjs +7 -5
- package/src/Outline/Outline.spec.md +1 -1
- package/src/Outline/index.ts +1 -0
- package/src/Outline/modules/parseOutlineFromMarkdown.spec.md +142 -0
- package/src/Outline/parseOutlineFromMarkdown.ts +40 -10
- package/src/Outline/useOutlineFromMarkdown.ts +15 -3
- package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
- package/src/PowerSearch/PowerSearchEditPopover.test.tsx +150 -1
- package/src/PowerSearch/PowerSearchEditPopover.tsx +51 -28
- package/src/ProgressBar/ProgressBar.test.tsx +29 -11
- package/src/ProgressBar/ProgressBar.tsx +59 -72
- package/src/RadioList/RadioList.doc.mjs +11 -0
- package/src/RadioList/RadioList.test.tsx +32 -0
- package/src/RadioList/RadioListItem.tsx +25 -1
- package/src/ScrollableArea/modules/useScrollableArea.spec.md +50 -22
- package/src/SegmentedControl/SegmentedControl.doc.mjs +2 -2
- package/src/SegmentedControl/SegmentedControl.test.tsx +31 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +6 -9
- package/src/Selector/Selector.doc.mjs +2 -2
- package/src/Selector/Selector.spec.md +51 -49
- package/src/Selector/Selector.test.tsx +61 -55
- package/src/Selector/Selector.tsx +23 -14
- package/src/Selector/__tests__/Listbox.a11y.chromium.spec.ts +130 -0
- package/src/Selector/__tests__/Listbox.a11y.dom.ts +38 -0
- package/src/Selector/__tests__/Listbox.a11y.inventory.test.ts +63 -0
- package/src/Selector/__tests__/Listbox.a11y.known-failures.ts +37 -0
- package/src/Selector/__tests__/Listbox.a11y.states.ts +232 -0
- package/src/Selector/__tests__/Selector.listbox.a11y.test.tsx +121 -0
- package/src/SideNav/SideNav.doc.mjs +1 -1
- package/src/SideNav/SideNav.test.tsx +10 -0
- package/src/SideNav/SideNav.tsx +14 -2
- package/src/Slider/Slider.doc.mjs +17 -3
- package/src/Slider/Slider.test.tsx +221 -0
- package/src/Slider/Slider.tsx +40 -9
- package/src/Spinner/Spinner.test.tsx +4 -0
- package/src/Spinner/Spinner.tsx +31 -18
- package/src/Switch/Switch.doc.mjs +11 -0
- package/src/Switch/Switch.test.tsx +16 -0
- package/src/Switch/Switch.tsx +28 -0
- package/src/TabList/Tab.tsx +35 -7
- package/src/TabList/TabList.doc.mjs +11 -0
- package/src/TabList/TabList.spec.md +204 -0
- package/src/TabList/TabList.test.tsx +66 -0
- package/src/TabList/__tests__/Tabs.a11y.known-failures.ts +1 -34
- package/src/Table/Table.doc.mjs +1 -1
- package/src/Table/Table.spec.md +54 -40
- package/src/Table/Table.test.tsx +83 -10
- package/src/Table/Table.tsx +30 -22
- package/src/Table/__tests__/TableScroll.a11y.chromium.spec.ts +137 -0
- package/src/TextArea/TextArea.tsx +6 -1
- package/src/TextInput/TextInput.test.tsx +20 -1
- package/src/TextInput/TextInput.tsx +6 -1
- package/src/TimeInput/TimeInput.tsx +6 -1
- package/src/ToggleButton/ToggleButton.doc.mjs +3 -3
- package/src/ToggleButton/ToggleButton.test.tsx +299 -4
- package/src/ToggleButton/ToggleButton.tsx +26 -33
- package/src/ToggleButton/ToggleButtonGroup.doc.mjs +3 -3
- package/src/ToggleButton/__tests__/ToggleButton.a11y.chromium.spec.ts +209 -0
- package/src/Tokenizer/Tokenizer.spec.md +142 -75
- package/src/TreeList/TreeList.doc.mjs +3 -3
- package/src/TreeList/TreeList.spec.md +123 -75
- package/src/TreeList/TreeList.test.tsx +29 -0
- package/src/TreeList/TreeList.tsx +3 -0
- package/src/TreeList/TreeListItem.tsx +15 -1
- package/src/TreeList/TreeListTypes.ts +11 -1
- package/src/Typeahead/BaseTypeahead.spec.md +4 -3
- package/src/Typeahead/BaseTypeahead.tsx +21 -7
- package/src/Typeahead/Typeahead.test.tsx +53 -0
- package/src/__tests__/PressedState.a11y.chromium.spec.ts +813 -0
- package/src/__tests__/pressState.ts +93 -0
- package/src/hooks/scrollKeyboardDelegation.test.ts +155 -0
- package/src/hooks/scrollKeyboardDelegation.ts +233 -0
- package/src/hooks/useScrollableArea.doc.mjs +15 -3
- package/src/hooks/useScrollableArea.test.tsx +59 -1
- package/src/hooks/useScrollableArea.ts +34 -10
- package/src/inputFontFloor.test.ts +106 -0
- package/src/tailwind-theme.css +0 -6
- package/src/theme/generateThemeRules.test.ts +30 -0
- package/src/theme/generateThemeRules.ts +10 -0
- package/src/utils/interactionOverlay.stylex.ts +20 -0
package/src/Markdown/index.ts
CHANGED
|
@@ -4,10 +4,42 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file index.ts
|
|
7
|
-
* @output Exports Markdown component, parser functions, and types
|
|
7
|
+
* @output Exports Markdown component, canonical and compatibility parser functions, and types
|
|
8
8
|
* @position Component entry point; re-exported by /packages/core/src/index.ts
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
export {visitMarkdownNodes} from './ast';
|
|
12
|
+
export type {
|
|
13
|
+
MarkdownAstPoint,
|
|
14
|
+
MarkdownAstDataValue,
|
|
15
|
+
MarkdownAstPosition,
|
|
16
|
+
MarkdownAstNodeBase,
|
|
17
|
+
MarkdownAstExtensionNode,
|
|
18
|
+
MarkdownAstText,
|
|
19
|
+
MarkdownAstInlineCode,
|
|
20
|
+
MarkdownAstInlineMath,
|
|
21
|
+
MarkdownAstLink,
|
|
22
|
+
MarkdownAstImage,
|
|
23
|
+
MarkdownAstCitation,
|
|
24
|
+
MarkdownAstBreak,
|
|
25
|
+
MarkdownAstPhrasingContent,
|
|
26
|
+
MarkdownAstHeading,
|
|
27
|
+
MarkdownAstParagraph,
|
|
28
|
+
MarkdownAstCode,
|
|
29
|
+
MarkdownAstMath,
|
|
30
|
+
MarkdownAstBlockquote,
|
|
31
|
+
MarkdownAstList,
|
|
32
|
+
MarkdownAstListItem,
|
|
33
|
+
MarkdownAstTable,
|
|
34
|
+
MarkdownAstTableRow,
|
|
35
|
+
MarkdownAstTableCell,
|
|
36
|
+
MarkdownAstThematicBreak,
|
|
37
|
+
MarkdownAstBlockContent,
|
|
38
|
+
MarkdownAstRoot,
|
|
39
|
+
MarkdownAstNodeMap,
|
|
40
|
+
MarkdownAstNode,
|
|
41
|
+
} from './ast';
|
|
42
|
+
|
|
11
43
|
export {Markdown} from './Markdown';
|
|
12
44
|
export type {
|
|
13
45
|
MarkdownProps,
|
|
@@ -18,9 +50,11 @@ export type {
|
|
|
18
50
|
|
|
19
51
|
export {
|
|
20
52
|
parseMarkdown,
|
|
53
|
+
parseMarkdownAst,
|
|
21
54
|
parseMarkdownIncremental,
|
|
22
55
|
createIncrementalState,
|
|
23
56
|
parseInline,
|
|
57
|
+
parseInlineAst,
|
|
24
58
|
} from './parser';
|
|
25
59
|
export type {
|
|
26
60
|
BlockNode,
|
|
@@ -35,5 +69,7 @@ export type {
|
|
|
35
69
|
TableAlignment,
|
|
36
70
|
ParseOptions,
|
|
37
71
|
MathParseOptions,
|
|
72
|
+
IncrementalParseOptions,
|
|
73
|
+
IncrementalMathParseOptions,
|
|
38
74
|
IncrementalState as IncrementalParseState,
|
|
39
75
|
} from './parser';
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
---
|
|
2
|
+
schema_version: 3
|
|
3
|
+
template_version: 2
|
|
4
|
+
kind: module
|
|
5
|
+
id: module:Markdown/remark
|
|
6
|
+
authority: current
|
|
7
|
+
archive_reason: null
|
|
8
|
+
superseded_by: null
|
|
9
|
+
approved_by: cixzhang
|
|
10
|
+
approved_at: 2026-09-15
|
|
11
|
+
owners: [cixzhang]
|
|
12
|
+
review_triggers: [public-api, behavior]
|
|
13
|
+
verified_by: [packages/core/src/Markdown/remark.test.tsx]
|
|
14
|
+
parent_component: component:Markdown
|
|
15
|
+
references: [architecture:public-component-api, spec:AST-036/DEC-3]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# remark module contract
|
|
19
|
+
|
|
20
|
+
## Contract at a glance
|
|
21
|
+
|
|
22
|
+
| Area | Contract |
|
|
23
|
+
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| Public contract | `createMarkdownRemarkTransform(plugin, ...settings)` in the separate `@astryxdesign/core/Markdown/remark` entry point returns one Markdown transform for `createMarkdownPlugin()`. It accepts a conventional Unified/Remark plugin type as well as an Astryx-authored one. |
|
|
25
|
+
| Behavior | Each invocation runs one synchronous transform-only Remark plugin over a fresh mutable copy of the canonical tree with an isolated constrained file, then accepts a lossless round trip or rejects it. |
|
|
26
|
+
| End-user impact | Readers see either the plugin's supported transformation or the last valid readable document; unsupported behavior can never silently drop, approximate, or forge document content. |
|
|
27
|
+
| Builder impact | Builders who import nothing are unaffected. An opt-in builder imports the adapter, proves one plugin compatible with fixtures, and reads one diagnostic when a plugin leaves the profile. |
|
|
28
|
+
| Compatibility/readiness | Additive and opt-in; absent from Markdown's entry point and from parser-only or server bundles unless imported. Compatibility is per plugin evidence, never package identity. |
|
|
29
|
+
| Review checks | Reject silent approximation, dropped fields, restored or rebuilt provenance, authored or shifted positions, edited Astryx owned nodes, raw-markup channels, async or processor-state plugins, plugin-authored diagnostic text, a refusal a plugin can catch and continue past, an unhandled rejection, or adapter imports inside Markdown or the parser. |
|
|
30
|
+
| Governing rules | [`spec:AST-036` FR18–FR20, FR24](../../../../../docs/specs/AST-036/spec.md); [`component:Markdown` FR12–FR16](../Markdown.spec.md); [`architecture:public-component-api`](../../../../../docs/architecture/public-component-api.md). |
|
|
31
|
+
|
|
32
|
+
This table is a review projection; the body below is authoritative.
|
|
33
|
+
|
|
34
|
+
## Intent
|
|
35
|
+
|
|
36
|
+
Teams with existing Remark transforms should be able to reuse a compatible one
|
|
37
|
+
inside Astryx Markdown without adopting Unified as a Core runtime, mutating the
|
|
38
|
+
canonical tree, or weakening Core-owned semantics. This module owns that narrow
|
|
39
|
+
compatibility boundary: what the profile accepts, what it refuses, and how a
|
|
40
|
+
refusal stays readable.
|
|
41
|
+
|
|
42
|
+
Everything outside the profile fails closed. "Remark-compatible" is a claim a
|
|
43
|
+
plugin earns from fixtures in this module's tests, never from a package name.
|
|
44
|
+
|
|
45
|
+
## Compatibility and migration
|
|
46
|
+
|
|
47
|
+
- Released default preserved: `yes`
|
|
48
|
+
- Compatibility class: additive, opt-in, separately imported; no released
|
|
49
|
+
Markdown, parser, Outline, or bundle behavior changes when the adapter is not
|
|
50
|
+
imported
|
|
51
|
+
- Migration decision: `spec:AST-036/DEC-3`
|
|
52
|
+
|
|
53
|
+
Consumer migration instructions belong in consumer docs and release notes.
|
|
54
|
+
|
|
55
|
+
## Ownership boundary
|
|
56
|
+
|
|
57
|
+
**Owns**
|
|
58
|
+
|
|
59
|
+
- The adapter's public factory, its mutable Remark tree types, and its
|
|
60
|
+
constrained file type.
|
|
61
|
+
- The supported-subset round trip and the exact rejection conditions below.
|
|
62
|
+
- The isolated per-invocation copy, file data, and diagnostics.
|
|
63
|
+
- Its own evidence that one real plugin is compatible.
|
|
64
|
+
|
|
65
|
+
**Does not own / non-goals**
|
|
66
|
+
|
|
67
|
+
- Plugin admission, transform ordering, validation, and failure recovery —
|
|
68
|
+
owned by `component:Markdown` and `spec:AST-036`.
|
|
69
|
+
- Unified processors, parser or compiler registration, micromark extensions,
|
|
70
|
+
async pipelines, and `VFile` behavior beyond the constrained file.
|
|
71
|
+
- Heading identity, navigation, resource policy, list, table, and document
|
|
72
|
+
semantics — owned by Core.
|
|
73
|
+
|
|
74
|
+
## Public API and concepts
|
|
75
|
+
|
|
76
|
+
| Concept | Closed values or states | Meaning | Default | Owner | Stability |
|
|
77
|
+
| ------------------------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | ------------------------ | --------- |
|
|
78
|
+
| `createMarkdownRemarkTransform` | `(plugin, ...settings) => MarkdownTransform` | Adapts one attacher-shaped Remark plugin; the attacher runs once, its transformer per run. | none | `module:Markdown/remark` | stable |
|
|
79
|
+
| Adapted tree | supported MDAST subset plus Astryx flow image, citation, extension | A fresh mutable copy the plugin may mutate or replace. | fresh per run | `module:Markdown/remark` | stable |
|
|
80
|
+
| Constrained file | `value`, `data`, `messages`, `message()`, `fail()`, `toString()` | Readonly source, per-run JSON-like data, and diagnostics. | empty `data` | `module:Markdown/remark` | stable |
|
|
81
|
+
| Accepted plugin type | `MarkdownRemarkPlugin` or `MarkdownRemarkCompatiblePlugin` | A new plugin may be authored against typed Astryx trees; a conventional Unified/Remark plugin type is accepted structurally, including a declared async or callback-style transformer that the run time then rejects. | structural | `module:Markdown/remark` | stable |
|
|
82
|
+
| Rejection | one diagnostic plus the last valid document | The fail-closed result for anything outside the profile. | not applicable | `module:Markdown/remark` | stable |
|
|
83
|
+
|
|
84
|
+
## Behavioral contract
|
|
85
|
+
|
|
86
|
+
| ID | Invariant | Basis |
|
|
87
|
+
| ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
|
|
88
|
+
| FR1 | The adapter accepts only a plugin whose attacher synchronously returns one transformer of at most two parameters. A parser, compiler, async, callback-style, or registration-only plugin is rejected. | `spec:AST-036` FR18 |
|
|
89
|
+
| FR2 | Every invocation receives a fresh mutable copy of the canonical tree and a new constrained file. No canonical node, array, data value, or position is mutable, and no state survives between runs. | `spec:AST-036` FR10, FR18 |
|
|
90
|
+
| FR3 | The constrained file exposes exactly `value`, `data`, `messages`, `message()`, `fail()`, and `toString()`. Every other key — `path`, `cwd`, `history`, or any other — fails closed on read, write, define, and delete, rather than answering `undefined`; `in` and key enumeration answer truthfully so a plugin can feature-detect. Processor access fails closed the same way. | `spec:AST-036` FR18 |
|
|
91
|
+
| FR4 | A returned or mutated tree is accepted only when every node and metadata field round-trips losslessly through the supported subset, fenced-code `meta` included; otherwise the last valid document is preserved. | `spec:AST-036` FR19 |
|
|
92
|
+
| FR5 | A surviving source-backed node keeps Core's provenance exactly: every line, column, and offset on both points must come back unchanged. A rebuilt, retyped, duplicated, or shifted surviving node is rejected, never silently restored. Source-backed nodes, including headings, may be removed or reordered; a surviving source heading keeps its depth. | `spec:AST-036` FR11, FR19, FR26 |
|
|
93
|
+
| FR6 | Astryx-owned citation and plugin extension nodes pass through only when every owned field — including `data` and authored `source` — is exactly equal. Authoring or editing one through the adapter is rejected. | `spec:AST-036` FR11, FR15 |
|
|
94
|
+
| FR7 | A failed run reports exactly one diagnostic, assembled only from the adapter's own vocabulary and read from adapter-owned state, never from the thrown value or any object the plugin can rewrite. Text a plugin authored — a thrown error, a `fail()` reason, a `message()` diagnostic — never becomes a diagnostic, because the plugin read the document and may quote it. Any refusal the plugin catches and continues past still fails the run, and the first recorded reason is the one reported. Later plugins and rendering continue on the last valid document. | `spec:AST-036` FR12 |
|
|
95
|
+
| FR8 | An unchanged document returns the identical canonical root, so an adapted no-op costs no tree allocation and no downstream invalidation. | `spec:AST-036` FR13, FR21 |
|
|
96
|
+
| FR9 | The adapter is a separate entry point that Markdown, the parser, and the plugin protocol never import, so parser-only and server bundles exclude it unless a caller imports it. It is registered in the exports generator, so the published subpath cannot drift from the source. | `spec:AST-036` FR24 |
|
|
97
|
+
| FR10 | A conventional Unified/Remark plugin type-checks at the callsite without being rewritten, including a transformer that declares Unified's callback parameter or an asynchronous return union. The run time still rejects an actual promise and a callback-style transformer. | `spec:AST-036` FR18 |
|
|
98
|
+
| FR11 | A promise the adapter refuses — from the attacher or the transformer — gets a rejection handler attached before any other verdict is applied, so a result that is both refused for another reason and rejected cannot surface as an unhandled rejection. That matters most on the server, where an unhandled rejection ends the process by default and would print a plugin-authored reason drawn from the document. `then` is read exactly once, because reading it can itself throw or trip a guard. | `spec:AST-036` FR12, FR18 |
|
|
99
|
+
| FR12 | Sticky refusal is re-checked immediately before validated output becomes observable, so a guard that fires late — inside a hostile `then` accessor, or a getter read while the result is validated — still rejects rather than letting the plugin's output through. | `spec:AST-036` FR12 |
|
|
100
|
+
|
|
101
|
+
### Supported round trip
|
|
102
|
+
|
|
103
|
+
| Input | Round trip |
|
|
104
|
+
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
105
|
+
| `root`, `paragraph`, `heading`, `blockquote`, `thematicBreak` | Structure and children; heading depth stays Core-owned. |
|
|
106
|
+
| `text`, `strong`, `emphasis`, `delete`, `inlineCode`, `break` | Values and ordered phrasing children. |
|
|
107
|
+
| `link`, `image` | `url` revalidated by the navigation and resource owners; `alt` required; `title` null. |
|
|
108
|
+
| `list`, `listItem` | `ordered`, `start`, `spread`, Astryx `delimiter`, and `checked`. |
|
|
109
|
+
| `code` | `lang` and `meta`, each `null` when absent, plus `value`. The authored info string survives both conversions and the released language projection is preserved. |
|
|
110
|
+
| `math`, `inlineMath` | Present only when the caller enabled math. |
|
|
111
|
+
| `table`, `tableRow`, `tableCell` | Normalized `align` and cell children. |
|
|
112
|
+
| Astryx flow image, `citation`, `extension` | Preserved as owned nodes; readable by the plugin, not writable. |
|
|
113
|
+
| `position`, `data` | Core-authored positions and finite JSON-like data. |
|
|
114
|
+
|
|
115
|
+
### Rejection matrix
|
|
116
|
+
|
|
117
|
+
| Rejected input | Result |
|
|
118
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
119
|
+
| Async, callback-style, registration-only, or processor-state plugin | Last valid document plus one diagnostic; FR1, FR3 |
|
|
120
|
+
| `html` or any node outside the supported subset (definitions, references, footnotes, frontmatter, directives, MDX) | Last valid document plus one diagnostic; FR4 |
|
|
121
|
+
| An unsupported field, `hName`, `hProperties`, `hChildren`, or non-JSON node or file data | Last valid document plus one diagnostic; FR3, FR4 |
|
|
122
|
+
| Non-string fence `meta`, a link or image `title`, a loose list item, or a ragged transformed table | Last valid document plus one diagnostic; FR4 |
|
|
123
|
+
| Reading, writing, defining, or deleting an unsupported file key — `path`, `cwd`, `history`, or any other | Last valid document plus one diagnostic; FR3 |
|
|
124
|
+
| An authored, shifted, or removed position on a surviving source-backed node; a rebuilt, retyped, or duplicated source node; or a re-levelled source heading | Last valid document plus one diagnostic; FR5 |
|
|
125
|
+
| A shifted line or column on an otherwise unchanged offset | Last valid document plus one diagnostic; FR5 |
|
|
126
|
+
| Provenance rebuilt from a copied position, or smuggled in from another document | Last valid document plus one diagnostic; FR5 |
|
|
127
|
+
| An authored or edited Astryx citation or extension node, `data` and `source` included | Last valid document plus one diagnostic; FR6 |
|
|
128
|
+
| A rejected link or image URL, invalid built-in structure, a nested link, or block output from an inline entry point | Last valid document plus one diagnostic; FR4 |
|
|
129
|
+
| A transformer that throws, or any refusal the plugin caught and continued past, `fail()` included | Last valid document plus one diagnostic; FR7 |
|
|
130
|
+
| A rejected promise from the attacher or transformer, alone or on top of a caught refusal | Last valid document, one diagnostic, no unhandled rejection; FR11 |
|
|
131
|
+
| A guard that fires late, inside a `then` accessor or a getter read during validation | Last valid document plus one diagnostic; FR12 |
|
|
132
|
+
|
|
133
|
+
### Transformation and precedence order
|
|
134
|
+
|
|
135
|
+
- **ORD1 — one run.** Canonical tree → fresh mutable copy → the plugin's single
|
|
136
|
+
synchronous transformer → validated round trip → the document later plugins
|
|
137
|
+
and rendering observe. Core validates the result again; the adapter never
|
|
138
|
+
substitutes for Core's own validation.
|
|
139
|
+
- **ORD2 — one diagnostic, adapter-authored.** A successful run is silent;
|
|
140
|
+
Core's only diagnostic channel reports plugin failure, so there is nothing
|
|
141
|
+
truthful to say. A failed run reports exactly one line, built from this
|
|
142
|
+
module's own vocabulary. Messages a plugin recorded stay on its file, which
|
|
143
|
+
only the plugin sees.
|
|
144
|
+
- **ORD3 — defuse, then judge, then accept.** A returned value is inspected
|
|
145
|
+
and defused before any verdict is applied, so the reason a run is refused
|
|
146
|
+
never decides whether a promise is left dangling. Sticky refusal is checked
|
|
147
|
+
again immediately before output is accepted, because a guard can fire at any
|
|
148
|
+
point the adapter touches plugin-controlled values.
|
|
149
|
+
|
|
150
|
+
### Performance and resources
|
|
151
|
+
|
|
152
|
+
- **PR1 — one copy per invocation.** Work is proportional to document size once
|
|
153
|
+
per run; an unchanged document returns the canonical root itself.
|
|
154
|
+
- **PR2 — no runtime dependency.** The adapter adds no Unified, Remark, mdast,
|
|
155
|
+
or `VFile` dependency and no parse work; it runs inside the existing transform
|
|
156
|
+
phase and cannot trigger reparsing.
|
|
157
|
+
|
|
158
|
+
## Accessibility contract
|
|
159
|
+
|
|
160
|
+
- **AR1 — required meaning survives.** An image must keep its text alternative
|
|
161
|
+
and a source heading its level, so a rejection is preferred over an
|
|
162
|
+
accessible-name or document-outline regression.
|
|
163
|
+
- **AR2 — no markup channel.** Raw HTML and hast property channels are rejected,
|
|
164
|
+
so an adapted plugin cannot inject unlabeled or non-semantic output.
|
|
165
|
+
|
|
166
|
+
## Design relationships
|
|
167
|
+
|
|
168
|
+
No visual representation is owned by this compatibility adapter; adapted output
|
|
169
|
+
renders through Markdown's existing parts.
|
|
170
|
+
|
|
171
|
+
## Parent and system relationships
|
|
172
|
+
|
|
173
|
+
- `component:Markdown` owns aggregate plugin application, validation, fallback,
|
|
174
|
+
and heading identity.
|
|
175
|
+
- `spec:AST-036` owns the protocol, the canonical MDAST compatibility matrix,
|
|
176
|
+
and the limited Remark profile this record implements.
|
|
177
|
+
- `family:navigation-destinations` keeps ownership of every adapted link
|
|
178
|
+
destination and image resource.
|
|
179
|
+
|
|
180
|
+
## Verification map
|
|
181
|
+
|
|
182
|
+
| Contract | Verification | Representative states | Mutation or failure expectation |
|
|
183
|
+
| -------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
184
|
+
| FR1–FR3 | `remark.test.tsx` attachment, isolation, and constrained-file fixtures | async, callback-style, processor-state, registration-only plugins; repeated invocations; every unsupported file key, read and written; caught guard refusals | Accepting one of them, leaking file data between runs, or letting a caught refusal clear the verdict fails the fixtures. |
|
|
185
|
+
| FR4–FR6 | `remark.test.tsx` round-trip and rejection matrix, including a parsed-fence identity fixture | every supported node kind; fences with and without an info string; each rejected input above; owned citation and extension nodes | A silently dropped field — `meta` included — an accepted unsupported node, or an edited owned node fails closed fixtures. |
|
|
186
|
+
| FR7 | `remark.test.tsx` diagnostics plus Markdown rendering after a rejection | thrown transformer, swallowed `fail()`, forged rejection built from the adapter's own class, rewritten `message`, hand-marked fatal message, later plugin in the same list | A missing, duplicated, or plugin-authored diagnostic, a swallowed failure that succeeds, or a lost sibling plugin, fails. |
|
|
187
|
+
| FR8 | `remark.test.tsx` identity fixture over the full supported document | untouched document with positions, math, citations, and extension nodes | Returning a copy instead of the canonical root fails identity. |
|
|
188
|
+
| FR9 | `remark.test.tsx` import and manifest fixtures; `sync:exports:check` | Markdown, parser, and plugin modules; the published entry point | An adapter import inside Core's Markdown path, or an unregistered subpath, fails. |
|
|
189
|
+
| FR10 | `remark.test.tsx` compile fixture over Unified-shaped declarations | attacher bound to a processor; callback-parameter and async-union transformer; inline Astryx plugin | Narrowing the accepted type so a conventional plugin stops compiling fails the fixture. |
|
|
190
|
+
| FR11 | `remark.test.tsx` rejection fixtures observing `process` unhandled rejections, including server rendering | rejected attacher result; rejected transformer result; a rejected result on top of a caught guard or a caught `fail()`; a thenable whose `then` throws | Applying a verdict before defusing, or refusing without attaching a handler, fails the fixtures. |
|
|
191
|
+
| FR12 | `remark.test.tsx` late-guard fixtures | a hostile `then` accessor; a getter that trips a guard while the result is validated | Dropping the final sticky re-check lets caught-guard output through and fails the fixtures. |
|
|
192
|
+
|
|
193
|
+
## Decision log
|
|
194
|
+
|
|
195
|
+
### DEC-1 — Lossless round trip or a readable rejection
|
|
196
|
+
|
|
197
|
+
**Reference:** `module:Markdown/remark/DEC-1`
|
|
198
|
+
**Decider:** `cixzhang`, `2026-09-15`
|
|
199
|
+
|
|
200
|
+
The adapter never approximates. Link titles, loose list items, raw markup,
|
|
201
|
+
unsupported nodes, and metadata Astryx cannot represent — including a
|
|
202
|
+
non-string fence `meta` — have no Astryx meaning, so accepting them would
|
|
203
|
+
silently change or drop what a reader sees. An authored fence info string does
|
|
204
|
+
have a meaning here and round-trips intact; it is rejected only when it is not
|
|
205
|
+
a string. Refusing the rest keeps the last valid document readable and makes
|
|
206
|
+
the gap visible to the builder in one diagnostic instead of to the reader as
|
|
207
|
+
missing content.
|
|
208
|
+
|
|
209
|
+
### DEC-2 — Provenance is carried, never inferred
|
|
210
|
+
|
|
211
|
+
**Reference:** `module:Markdown/remark/DEC-2`
|
|
212
|
+
**Decider:** `cixzhang`, `2026-09-15`
|
|
213
|
+
|
|
214
|
+
A transformed node belongs to a source node only when it carries the marker the
|
|
215
|
+
adapter put on the copy; matching on a position that merely looks right would
|
|
216
|
+
let a rebuilt node inherit provenance it never had. Equality is exact across
|
|
217
|
+
every line, column, and offset, because restoring Core's position over a
|
|
218
|
+
changed one is the silent approximation this profile exists to refuse.
|
|
219
|
+
|
|
220
|
+
### DEC-3 — Only the adapter speaks in diagnostics
|
|
221
|
+
|
|
222
|
+
**Reference:** `module:Markdown/remark/DEC-3`
|
|
223
|
+
**Decider:** `cixzhang`, `2026-09-15`
|
|
224
|
+
|
|
225
|
+
A plugin's own text reached it from the document and may quote any of it, so
|
|
226
|
+
forwarding it would turn a developer warning into a place private content
|
|
227
|
+
leaks. The single reported line is assembled from this module's vocabulary
|
|
228
|
+
instead; a plugin's messages remain on the file it was given.
|
|
229
|
+
|
|
230
|
+
Everything the plugin can reach, it can also rewrite: `message` is writable on
|
|
231
|
+
any Error, and catching one rejection hands it the rejection class itself. So
|
|
232
|
+
the reported reason is read from adapter-owned state keyed by the thrown
|
|
233
|
+
object, and every refusal — a prohibited file key, a processor access, the
|
|
234
|
+
plugin's own `fail()` — is recorded in adapter-owned run state rather than on
|
|
235
|
+
anything the plugin holds. A refusal the plugin catches and continues past
|
|
236
|
+
still fails the run, and the first reason recorded is the one reported.
|
|
237
|
+
|
|
238
|
+
### DEC-4 — Owned nodes stay Core's
|
|
239
|
+
|
|
240
|
+
**Reference:** `module:Markdown/remark/DEC-4`
|
|
241
|
+
**Decider:** `cixzhang`, `2026-09-15`
|
|
242
|
+
|
|
243
|
+
An adapted plugin may read an Astryx citation or extension node but cannot mint
|
|
244
|
+
or edit one, and cannot change a source heading. Owned nodes are how Markdown,
|
|
245
|
+
Outline, and fallback agree on one document; a compatibility shim is the wrong
|
|
246
|
+
place to let them drift.
|
|
247
|
+
|
|
248
|
+
### DEC-5 — Accept the plugin types Remark already has
|
|
249
|
+
|
|
250
|
+
**Reference:** `module:Markdown/remark/DEC-5`
|
|
251
|
+
**Decider:** `cixzhang`, `2026-09-15`
|
|
252
|
+
|
|
253
|
+
The whole point of the profile is reusing an existing plugin, so a plugin typed
|
|
254
|
+
against Unified must compile here unchanged — Unified declares one transformer
|
|
255
|
+
type carrying both the callback parameter and an async return, and refusing it
|
|
256
|
+
at the type level would refuse every real plugin. The adapter accepts that
|
|
257
|
+
shape structurally and rejects the unsupported behavior at run time, where it
|
|
258
|
+
can fail closed with a readable document. Authors writing a new plugin against
|
|
259
|
+
Astryx annotate it with `MarkdownRemarkPlugin` and keep a fully typed tree.
|
|
260
|
+
|
|
261
|
+
## Open questions
|
|
262
|
+
|
|
263
|
+
None.
|
|
264
|
+
|
|
265
|
+
## Content boundary
|
|
266
|
+
|
|
267
|
+
This record does not duplicate consumer signatures or examples, the canonical
|
|
268
|
+
plugin protocol, Markdown's aggregate application and fallback rules, the AST
|
|
269
|
+
compatibility matrix, or Remark's own documentation. It links to their owners.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file index.ts
|
|
5
|
+
* @input Markdown source and public parser options
|
|
6
|
+
* @output Server-safe legacy and canonical Markdown parser entry points and types
|
|
7
|
+
* @position Public subpath entry point: `@astryxdesign/core/Markdown/parser`
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
createIncrementalState,
|
|
12
|
+
parseInline,
|
|
13
|
+
parseInlineAst,
|
|
14
|
+
parseMarkdown,
|
|
15
|
+
parseMarkdownAst,
|
|
16
|
+
parseMarkdownIncremental,
|
|
17
|
+
} from '../parser';
|
|
18
|
+
export type {
|
|
19
|
+
BlockNode,
|
|
20
|
+
BlockNodeWithMath,
|
|
21
|
+
MathBlockNode,
|
|
22
|
+
InlineNode,
|
|
23
|
+
InlineNodeWithMath,
|
|
24
|
+
MathInlineNode,
|
|
25
|
+
SourceRange,
|
|
26
|
+
ListItemNode,
|
|
27
|
+
TableCellNode,
|
|
28
|
+
TableAlignment,
|
|
29
|
+
ParseOptions,
|
|
30
|
+
MathParseOptions,
|
|
31
|
+
IncrementalParseOptions,
|
|
32
|
+
IncrementalMathParseOptions,
|
|
33
|
+
IncrementalState as IncrementalParseState,
|
|
34
|
+
} from '../parser';
|
|
35
|
+
export type {
|
|
36
|
+
MarkdownAstPoint,
|
|
37
|
+
MarkdownAstDataValue,
|
|
38
|
+
MarkdownAstPosition,
|
|
39
|
+
MarkdownAstNodeBase,
|
|
40
|
+
MarkdownAstExtensionNode,
|
|
41
|
+
MarkdownAstText,
|
|
42
|
+
MarkdownAstInlineCode,
|
|
43
|
+
MarkdownAstInlineMath,
|
|
44
|
+
MarkdownAstLink,
|
|
45
|
+
MarkdownAstImage,
|
|
46
|
+
MarkdownAstCitation,
|
|
47
|
+
MarkdownAstBreak,
|
|
48
|
+
MarkdownAstPhrasingContent,
|
|
49
|
+
MarkdownAstHeading,
|
|
50
|
+
MarkdownAstParagraph,
|
|
51
|
+
MarkdownAstCode,
|
|
52
|
+
MarkdownAstMath,
|
|
53
|
+
MarkdownAstBlockquote,
|
|
54
|
+
MarkdownAstList,
|
|
55
|
+
MarkdownAstListItem,
|
|
56
|
+
MarkdownAstTable,
|
|
57
|
+
MarkdownAstTableRow,
|
|
58
|
+
MarkdownAstTableCell,
|
|
59
|
+
MarkdownAstThematicBreak,
|
|
60
|
+
MarkdownAstBlockContent,
|
|
61
|
+
MarkdownAstRoot,
|
|
62
|
+
MarkdownAstNodeMap,
|
|
63
|
+
MarkdownAstNode,
|
|
64
|
+
} from '../ast';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file parser.public.test.ts
|
|
5
|
+
* @input Imports the documented Markdown parser-only package subpath
|
|
6
|
+
* @output Runtime and type evidence for its canonical server-safe contract
|
|
7
|
+
* @position Public package-contract test for @astryxdesign/core/Markdown/parser
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import {readFileSync} from 'node:fs';
|
|
11
|
+
import {join} from 'node:path';
|
|
12
|
+
import {describe, expect, expectTypeOf, it} from 'vitest';
|
|
13
|
+
import {
|
|
14
|
+
createMarkdownFrontmatter,
|
|
15
|
+
createMarkdownPlugin,
|
|
16
|
+
} from '@astryxdesign/core/Markdown/plugins';
|
|
17
|
+
import {
|
|
18
|
+
createIncrementalState,
|
|
19
|
+
parseInline,
|
|
20
|
+
parseInlineAst,
|
|
21
|
+
parseMarkdown,
|
|
22
|
+
parseMarkdownAst,
|
|
23
|
+
parseMarkdownIncremental,
|
|
24
|
+
} from '@astryxdesign/core/Markdown/parser';
|
|
25
|
+
import type {
|
|
26
|
+
BlockNode,
|
|
27
|
+
InlineNode,
|
|
28
|
+
MarkdownAstPhrasingContent,
|
|
29
|
+
MarkdownAstRoot,
|
|
30
|
+
} from '@astryxdesign/core/Markdown/parser';
|
|
31
|
+
|
|
32
|
+
describe('@astryxdesign/core/Markdown/parser', () => {
|
|
33
|
+
it('is a generated public package subpath', () => {
|
|
34
|
+
const packageJson = JSON.parse(
|
|
35
|
+
readFileSync(join(process.cwd(), 'packages/core/package.json'), 'utf8'),
|
|
36
|
+
) as {
|
|
37
|
+
exports: Record<string, unknown>;
|
|
38
|
+
};
|
|
39
|
+
const entrySources = [
|
|
40
|
+
'packages/core/src/Markdown/parser/index.ts',
|
|
41
|
+
'packages/core/src/Markdown/parser.ts',
|
|
42
|
+
'packages/core/src/Markdown/plugins/index.ts',
|
|
43
|
+
'packages/core/src/Markdown/plugins/protocol.ts',
|
|
44
|
+
'packages/core/src/Markdown/plugins/frontmatter.ts',
|
|
45
|
+
].map(path => readFileSync(join(process.cwd(), path), 'utf8'));
|
|
46
|
+
|
|
47
|
+
expect(packageJson.exports['./Markdown/parser']).toEqual({
|
|
48
|
+
source: './src/Markdown/parser/index.ts',
|
|
49
|
+
types: './dist/Markdown/parser/index.d.ts',
|
|
50
|
+
default: './dist/Markdown/parser/index.js',
|
|
51
|
+
});
|
|
52
|
+
for (const entrySource of entrySources) {
|
|
53
|
+
expect(entrySource).not.toMatch(/^\s*['"]use client['"]/m);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('exposes legacy and canonical parser results from a server-only entry point', () => {
|
|
58
|
+
const source = '# Heading\n\nParagraph';
|
|
59
|
+
const blockAst = parseMarkdownAst(source);
|
|
60
|
+
const inlineAst = parseInlineAst('**bold**');
|
|
61
|
+
|
|
62
|
+
expect(blockAst).toMatchObject({
|
|
63
|
+
type: 'root',
|
|
64
|
+
children: [{type: 'heading', depth: 1}, {type: 'paragraph'}],
|
|
65
|
+
});
|
|
66
|
+
expect(inlineAst).toMatchObject([{type: 'strong'}]);
|
|
67
|
+
expect(parseMarkdown(source)[0]).toMatchObject({type: 'heading', level: 1});
|
|
68
|
+
expect(parseInline('**bold**')[0]).toMatchObject({type: 'bold'});
|
|
69
|
+
expect(parseMarkdownIncremental(source, createIncrementalState())).toEqual(
|
|
70
|
+
parseMarkdown(source),
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const canonicalBlockAst: MarkdownAstRoot = blockAst;
|
|
74
|
+
const canonicalInlineAst: ReadonlyArray<MarkdownAstPhrasingContent> =
|
|
75
|
+
inlineAst;
|
|
76
|
+
expect(canonicalBlockAst).toBe(blockAst);
|
|
77
|
+
expect(canonicalInlineAst).toBe(inlineAst);
|
|
78
|
+
expectTypeOf(parseMarkdown(source)).toEqualTypeOf<BlockNode[]>();
|
|
79
|
+
expectTypeOf(parseInline('text')).toEqualTypeOf<InlineNode[]>();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('runs typed plugins through the server-safe parser boundary', () => {
|
|
83
|
+
const frontmatter = createMarkdownFrontmatter({
|
|
84
|
+
name: 'server-document-metadata',
|
|
85
|
+
parse: fields => ({title: fields.title ?? 'Untitled'}),
|
|
86
|
+
});
|
|
87
|
+
let title: string | undefined;
|
|
88
|
+
const observer = createMarkdownPlugin({
|
|
89
|
+
name: 'server-metadata-observer',
|
|
90
|
+
apiVersion: 1,
|
|
91
|
+
transform(root) {
|
|
92
|
+
title = frontmatter.getMetadata(root)?.title;
|
|
93
|
+
return root;
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
const root = parseMarkdownAst('---\ntitle: Server proof\n---\n# Body', {
|
|
97
|
+
plugins: [frontmatter.plugin, observer],
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
expect(title).toBe('Server proof');
|
|
101
|
+
expect(root.children).toMatchObject([{type: 'heading', depth: 1}]);
|
|
102
|
+
});
|
|
103
|
+
});
|