@walkeros/explorer 3.0.0 → 3.0.2
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/__mocks__/@monaco-editor/react.d.ts +3 -0
- package/dist/__mocks__/@monaco-editor/react.d.ts.map +1 -0
- package/dist/__mocks__/@monaco-editor/react.js +4 -0
- package/dist/__mocks__/@monaco-editor/react.js.map +1 -0
- package/dist/components/atoms/box.d.ts +27 -0
- package/dist/components/atoms/box.d.ts.map +1 -0
- package/dist/components/atoms/box.js +86 -0
- package/dist/components/atoms/box.js.map +1 -0
- package/dist/components/atoms/box.stories.d.ts +34 -0
- package/dist/components/atoms/box.stories.d.ts.map +1 -0
- package/dist/components/atoms/box.stories.js +104 -0
- package/dist/components/atoms/box.stories.js.map +1 -0
- package/dist/components/atoms/button-group.d.ts +17 -0
- package/dist/components/atoms/button-group.d.ts.map +1 -0
- package/dist/components/atoms/button-group.js +12 -0
- package/dist/components/atoms/button-group.js.map +1 -0
- package/dist/components/atoms/button-group.stories.d.ts +18 -0
- package/dist/components/atoms/button-group.stories.d.ts.map +1 -0
- package/dist/components/atoms/button-group.stories.js +39 -0
- package/dist/components/atoms/button-group.stories.js.map +1 -0
- package/dist/components/atoms/button-link.d.ts +12 -0
- package/dist/components/atoms/button-link.d.ts.map +1 -0
- package/dist/components/atoms/button-link.js +10 -0
- package/dist/components/atoms/button-link.js.map +1 -0
- package/dist/components/atoms/button-link.stories.d.ts +11 -0
- package/dist/components/atoms/button-link.stories.d.ts.map +1 -0
- package/dist/components/atoms/button-link.stories.js +50 -0
- package/dist/components/atoms/button-link.stories.js.map +1 -0
- package/dist/components/atoms/button.d.ts +15 -0
- package/dist/components/atoms/button.d.ts.map +1 -0
- package/dist/components/atoms/button.js +11 -0
- package/dist/components/atoms/button.js.map +1 -0
- package/dist/components/atoms/button.stories.d.ts +14 -0
- package/dist/components/atoms/button.stories.d.ts.map +1 -0
- package/dist/components/atoms/button.stories.js +25 -0
- package/dist/components/atoms/button.stories.js.map +1 -0
- package/dist/components/atoms/code.d.ts +92 -0
- package/dist/components/atoms/code.d.ts.map +1 -0
- package/dist/components/atoms/code.js +405 -0
- package/dist/components/atoms/code.js.map +1 -0
- package/dist/components/atoms/code.stories.d.ts +46 -0
- package/dist/components/atoms/code.stories.d.ts.map +1 -0
- package/dist/components/atoms/code.stories.js +156 -0
- package/dist/components/atoms/code.stories.js.map +1 -0
- package/dist/components/atoms/footer.d.ts +21 -0
- package/dist/components/atoms/footer.d.ts.map +1 -0
- package/dist/components/atoms/footer.js +19 -0
- package/dist/components/atoms/footer.js.map +1 -0
- package/dist/components/atoms/footer.stories.d.ts +14 -0
- package/dist/components/atoms/footer.stories.d.ts.map +1 -0
- package/dist/components/atoms/footer.stories.js +29 -0
- package/dist/components/atoms/footer.stories.js.map +1 -0
- package/dist/components/atoms/grid.d.ts +65 -0
- package/dist/components/atoms/grid.d.ts.map +1 -0
- package/dist/components/atoms/grid.js +169 -0
- package/dist/components/atoms/grid.js.map +1 -0
- package/dist/components/atoms/grid.stories.d.ts +18 -0
- package/dist/components/atoms/grid.stories.d.ts.map +1 -0
- package/dist/components/atoms/grid.stories.js +60 -0
- package/dist/components/atoms/grid.stories.js.map +1 -0
- package/dist/components/atoms/header.d.ts +7 -0
- package/dist/components/atoms/header.d.ts.map +1 -0
- package/dist/components/atoms/header.js +5 -0
- package/dist/components/atoms/header.js.map +1 -0
- package/dist/components/atoms/header.stories.d.ts +15 -0
- package/dist/components/atoms/header.stories.d.ts.map +1 -0
- package/dist/components/atoms/header.stories.js +37 -0
- package/dist/components/atoms/header.stories.js.map +1 -0
- package/dist/components/atoms/icons/icon.stories.d.ts +18 -0
- package/dist/components/atoms/icons/icon.stories.d.ts.map +1 -0
- package/dist/components/atoms/icons/icon.stories.js +37 -0
- package/dist/components/atoms/icons/icon.stories.js.map +1 -0
- package/dist/components/atoms/icons/icons.d.ts +2 -0
- package/dist/components/atoms/icons/icons.d.ts.map +1 -0
- package/dist/components/atoms/icons/icons.js +7 -0
- package/dist/components/atoms/icons/icons.js.map +1 -0
- package/dist/components/atoms/icons/index.d.ts +3 -0
- package/dist/components/atoms/icons/index.d.ts.map +1 -0
- package/dist/components/atoms/icons/index.js +3 -0
- package/dist/components/atoms/icons/index.js.map +1 -0
- package/dist/components/atoms/mdx-code.d.ts +33 -0
- package/dist/components/atoms/mdx-code.d.ts.map +1 -0
- package/dist/components/atoms/mdx-code.js +69 -0
- package/dist/components/atoms/mdx-code.js.map +1 -0
- package/dist/components/atoms/preview-footer.d.ts +32 -0
- package/dist/components/atoms/preview-footer.d.ts.map +1 -0
- package/dist/components/atoms/preview-footer.js +31 -0
- package/dist/components/atoms/preview-footer.js.map +1 -0
- package/dist/components/atoms/spinner.d.ts +17 -0
- package/dist/components/atoms/spinner.d.ts.map +1 -0
- package/dist/components/atoms/spinner.js +14 -0
- package/dist/components/atoms/spinner.js.map +1 -0
- package/dist/components/atoms/spinner.stories.d.ts +7 -0
- package/dist/components/atoms/spinner.stories.d.ts.map +1 -0
- package/dist/components/atoms/spinner.stories.js +9 -0
- package/dist/components/atoms/spinner.stories.js.map +1 -0
- package/dist/components/atoms/toggle.d.ts +9 -0
- package/dist/components/atoms/toggle.d.ts.map +1 -0
- package/dist/components/atoms/toggle.js +6 -0
- package/dist/components/atoms/toggle.js.map +1 -0
- package/dist/components/demos/DestinationDemo.d.ts +48 -0
- package/dist/components/demos/DestinationDemo.d.ts.map +1 -0
- package/dist/components/demos/DestinationDemo.js +105 -0
- package/dist/components/demos/DestinationDemo.js.map +1 -0
- package/dist/components/demos/DestinationDemo.stories.d.ts +17 -0
- package/dist/components/demos/DestinationDemo.stories.d.ts.map +1 -0
- package/dist/components/demos/DestinationDemo.stories.js +53 -0
- package/dist/components/demos/DestinationDemo.stories.js.map +1 -0
- package/dist/components/demos/DestinationInitDemo.d.ts +34 -0
- package/dist/components/demos/DestinationInitDemo.d.ts.map +1 -0
- package/dist/components/demos/DestinationInitDemo.js +73 -0
- package/dist/components/demos/DestinationInitDemo.js.map +1 -0
- package/dist/components/demos/DestinationInitDemo.stories.d.ts +17 -0
- package/dist/components/demos/DestinationInitDemo.stories.d.ts.map +1 -0
- package/dist/components/demos/DestinationInitDemo.stories.js +39 -0
- package/dist/components/demos/DestinationInitDemo.stories.js.map +1 -0
- package/dist/components/demos/PromotionPlayground.d.ts +30 -0
- package/dist/components/demos/PromotionPlayground.d.ts.map +1 -0
- package/dist/components/demos/PromotionPlayground.js +366 -0
- package/dist/components/demos/PromotionPlayground.js.map +1 -0
- package/dist/components/demos/PromotionPlayground.stories.d.ts +27 -0
- package/dist/components/demos/PromotionPlayground.stories.d.ts.map +1 -0
- package/dist/components/demos/PromotionPlayground.stories.js +32 -0
- package/dist/components/demos/PromotionPlayground.stories.js.map +1 -0
- package/dist/components/molecules/architecture-flow/ArchitectureFlow.d.ts +24 -0
- package/dist/components/molecules/architecture-flow/ArchitectureFlow.d.ts.map +1 -0
- package/dist/components/molecules/architecture-flow/ArchitectureFlow.js +10 -0
- package/dist/components/molecules/architecture-flow/ArchitectureFlow.js.map +1 -0
- package/dist/components/molecules/architecture-flow/ArchitectureFlow.stories.d.ts +7 -0
- package/dist/components/molecules/architecture-flow/ArchitectureFlow.stories.d.ts.map +1 -0
- package/dist/components/molecules/architecture-flow/ArchitectureFlow.stories.js +71 -0
- package/dist/components/molecules/architecture-flow/ArchitectureFlow.stories.js.map +1 -0
- package/dist/components/molecules/architecture-flow/index.d.ts +3 -0
- package/dist/components/molecules/architecture-flow/index.d.ts.map +1 -0
- package/dist/components/molecules/architecture-flow/index.js +2 -0
- package/dist/components/molecules/architecture-flow/index.js.map +1 -0
- package/dist/components/molecules/code-box.d.ts +75 -0
- package/dist/components/molecules/code-box.d.ts.map +1 -0
- package/dist/components/molecules/code-box.js +174 -0
- package/dist/components/molecules/code-box.js.map +1 -0
- package/dist/components/molecules/code-box.stories.d.ts +87 -0
- package/dist/components/molecules/code-box.stories.d.ts.map +1 -0
- package/dist/components/molecules/code-box.stories.js +300 -0
- package/dist/components/molecules/code-box.stories.js.map +1 -0
- package/dist/components/molecules/code-snippet.d.ts +58 -0
- package/dist/components/molecules/code-snippet.d.ts.map +1 -0
- package/dist/components/molecules/code-snippet.js +72 -0
- package/dist/components/molecules/code-snippet.js.map +1 -0
- package/dist/components/molecules/code-snippet.stories.d.ts +23 -0
- package/dist/components/molecules/code-snippet.stories.d.ts.map +1 -0
- package/dist/components/molecules/code-snippet.stories.js +87 -0
- package/dist/components/molecules/code-snippet.stories.js.map +1 -0
- package/dist/components/molecules/dropdown.d.ts +68 -0
- package/dist/components/molecules/dropdown.d.ts.map +1 -0
- package/dist/components/molecules/dropdown.js +47 -0
- package/dist/components/molecules/dropdown.js.map +1 -0
- package/dist/components/molecules/dropdown.stories.d.ts +7 -0
- package/dist/components/molecules/dropdown.stories.d.ts.map +1 -0
- package/dist/components/molecules/dropdown.stories.js +18 -0
- package/dist/components/molecules/dropdown.stories.js.map +1 -0
- package/dist/components/molecules/flow-map/FlowMap.d.ts +74 -0
- package/dist/components/molecules/flow-map/FlowMap.d.ts.map +1 -0
- package/dist/components/molecules/flow-map/FlowMap.js +1039 -0
- package/dist/components/molecules/flow-map/FlowMap.js.map +1 -0
- package/dist/components/molecules/flow-map/FlowMap.stories.d.ts +47 -0
- package/dist/components/molecules/flow-map/FlowMap.stories.d.ts.map +1 -0
- package/dist/components/molecules/flow-map/FlowMap.stories.js +355 -0
- package/dist/components/molecules/flow-map/FlowMap.stories.js.map +1 -0
- package/dist/components/molecules/flow-map/FlowMap.transformers.stories.d.ts +29 -0
- package/dist/components/molecules/flow-map/FlowMap.transformers.stories.d.ts.map +1 -0
- package/dist/components/molecules/flow-map/FlowMap.transformers.stories.js +117 -0
- package/dist/components/molecules/flow-map/FlowMap.transformers.stories.js.map +1 -0
- package/dist/components/molecules/flow-map/index.d.ts +3 -0
- package/dist/components/molecules/flow-map/index.d.ts.map +1 -0
- package/dist/components/molecules/flow-map/index.js +2 -0
- package/dist/components/molecules/flow-map/index.js.map +1 -0
- package/dist/components/molecules/preview.d.ts +23 -0
- package/dist/components/molecules/preview.d.ts.map +1 -0
- package/dist/components/molecules/preview.js +232 -0
- package/dist/components/molecules/preview.js.map +1 -0
- package/dist/components/molecules/preview.stories.d.ts +23 -0
- package/dist/components/molecules/preview.stories.d.ts.map +1 -0
- package/dist/components/molecules/preview.stories.js +186 -0
- package/dist/components/molecules/preview.stories.js.map +1 -0
- package/dist/components/molecules/property-table.d.ts +7 -0
- package/dist/components/molecules/property-table.d.ts.map +1 -0
- package/dist/components/molecules/property-table.js +88 -0
- package/dist/components/molecules/property-table.js.map +1 -0
- package/dist/components/molecules/property-table.stories.d.ts +24 -0
- package/dist/components/molecules/property-table.stories.d.ts.map +1 -0
- package/dist/components/molecules/property-table.stories.js +86 -0
- package/dist/components/molecules/property-table.stories.js.map +1 -0
- package/dist/components/organisms/browser-box.d.ts +31 -0
- package/dist/components/organisms/browser-box.d.ts.map +1 -0
- package/dist/components/organisms/browser-box.js +80 -0
- package/dist/components/organisms/browser-box.js.map +1 -0
- package/dist/components/organisms/browser-box.stories.d.ts +26 -0
- package/dist/components/organisms/browser-box.stories.d.ts.map +1 -0
- package/dist/components/organisms/browser-box.stories.js +102 -0
- package/dist/components/organisms/browser-box.stories.js.map +1 -0
- package/dist/components/organisms/collector-box.d.ts +24 -0
- package/dist/components/organisms/collector-box.d.ts.map +1 -0
- package/dist/components/organisms/collector-box.js +56 -0
- package/dist/components/organisms/collector-box.js.map +1 -0
- package/dist/components/organisms/collector-box.stories.d.ts +22 -0
- package/dist/components/organisms/collector-box.stories.d.ts.map +1 -0
- package/dist/components/organisms/collector-box.stories.js +59 -0
- package/dist/components/organisms/collector-box.stories.js.map +1 -0
- package/dist/components/organisms/live-code.d.ts +22 -0
- package/dist/components/organisms/live-code.d.ts.map +1 -0
- package/dist/components/organisms/live-code.js +50 -0
- package/dist/components/organisms/live-code.js.map +1 -0
- package/dist/components/organisms/live-code.stories.d.ts +24 -0
- package/dist/components/organisms/live-code.stories.d.ts.map +1 -0
- package/dist/components/organisms/live-code.stories.js +55 -0
- package/dist/components/organisms/live-code.stories.js.map +1 -0
- package/dist/components/ui/button.d.ts +4 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +6 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/icon.d.ts +5 -0
- package/dist/components/ui/icon.d.ts.map +1 -0
- package/dist/components/ui/icon.js +5 -0
- package/dist/components/ui/icon.js.map +1 -0
- package/dist/contexts/GridHeightContext.d.ts +11 -0
- package/dist/contexts/GridHeightContext.d.ts.map +1 -0
- package/dist/contexts/GridHeightContext.js +14 -0
- package/dist/contexts/GridHeightContext.js.map +1 -0
- package/dist/helpers/capture.d.ts +83 -0
- package/dist/helpers/capture.d.ts.map +1 -0
- package/dist/helpers/capture.js +125 -0
- package/dist/helpers/capture.js.map +1 -0
- package/dist/helpers/destinations.d.ts +21 -0
- package/dist/helpers/destinations.d.ts.map +1 -0
- package/dist/helpers/destinations.js +46 -0
- package/dist/helpers/destinations.js.map +1 -0
- package/dist/hooks/useDropdown.d.ts +34 -0
- package/dist/hooks/useDropdown.d.ts.map +1 -0
- package/dist/hooks/useDropdown.js +66 -0
- package/dist/hooks/useDropdown.js.map +1 -0
- package/dist/hooks/useMonacoHeight.d.ts +31 -0
- package/dist/hooks/useMonacoHeight.d.ts.map +1 -0
- package/dist/hooks/useMonacoHeight.js +83 -0
- package/dist/hooks/useMonacoHeight.js.map +1 -0
- package/dist/hooks/useTreeState.d.ts +32 -0
- package/dist/hooks/useTreeState.d.ts.map +1 -0
- package/dist/hooks/useTreeState.js +94 -0
- package/dist/hooks/useTreeState.js.map +1 -0
- package/dist/index.d.ts +69 -1338
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +10 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/providers/MDXProvider.d.ts +40 -0
- package/dist/providers/MDXProvider.d.ts.map +1 -0
- package/dist/providers/MDXProvider.js +57 -0
- package/dist/providers/MDXProvider.js.map +1 -0
- package/dist/themes/index.d.ts +23 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +29 -0
- package/dist/themes/index.js.map +1 -0
- package/dist/themes/lighthouse.d.ts +26 -0
- package/dist/themes/lighthouse.d.ts.map +1 -0
- package/dist/themes/lighthouse.js +230 -0
- package/dist/themes/lighthouse.js.map +1 -0
- package/dist/themes/palenight.d.ts +31 -0
- package/dist/themes/palenight.d.ts.map +1 -0
- package/dist/themes/palenight.js +236 -0
- package/dist/themes/palenight.js.map +1 -0
- package/dist/themes/types.d.ts +103 -0
- package/dist/themes/types.d.ts.map +1 -0
- package/dist/themes/types.js +8 -0
- package/dist/themes/types.js.map +1 -0
- package/dist/types/intellisense.d.ts +33 -0
- package/dist/types/intellisense.d.ts.map +1 -0
- package/dist/types/intellisense.js +2 -0
- package/dist/types/intellisense.js.map +1 -0
- package/dist/utils/code-normalizer.d.ts +11 -0
- package/dist/utils/code-normalizer.d.ts.map +1 -0
- package/dist/utils/code-normalizer.js +21 -0
- package/dist/utils/code-normalizer.js.map +1 -0
- package/dist/utils/contract-path-walker.d.ts +27 -0
- package/dist/utils/contract-path-walker.d.ts.map +1 -0
- package/dist/utils/contract-path-walker.js +145 -0
- package/dist/utils/contract-path-walker.js.map +1 -0
- package/dist/utils/format-code.d.ts +9 -0
- package/dist/utils/format-code.d.ts.map +1 -0
- package/dist/utils/format-code.js +77 -0
- package/dist/utils/format-code.js.map +1 -0
- package/dist/utils/mapping-context-detector.d.ts +17 -0
- package/dist/utils/mapping-context-detector.d.ts.map +1 -0
- package/dist/utils/mapping-context-detector.js +22 -0
- package/dist/utils/mapping-context-detector.js.map +1 -0
- package/dist/utils/monaco-context-types.d.ts +39 -0
- package/dist/utils/monaco-context-types.d.ts.map +1 -0
- package/dist/utils/monaco-context-types.js +426 -0
- package/dist/utils/monaco-context-types.js.map +1 -0
- package/dist/utils/monaco-decorators.d.ts +17 -0
- package/dist/utils/monaco-decorators.d.ts.map +1 -0
- package/dist/utils/monaco-decorators.js +81 -0
- package/dist/utils/monaco-decorators.js.map +1 -0
- package/dist/utils/monaco-formatters.d.ts +16 -0
- package/dist/utils/monaco-formatters.d.ts.map +1 -0
- package/dist/utils/monaco-formatters.js +139 -0
- package/dist/utils/monaco-formatters.js.map +1 -0
- package/dist/utils/monaco-intellisense-flow-extractor.d.ts +13 -0
- package/dist/utils/monaco-intellisense-flow-extractor.d.ts.map +1 -0
- package/dist/utils/monaco-intellisense-flow-extractor.js +168 -0
- package/dist/utils/monaco-intellisense-flow-extractor.js.map +1 -0
- package/dist/utils/monaco-json-path.d.ts +12 -0
- package/dist/utils/monaco-json-path.d.ts.map +1 -0
- package/dist/utils/monaco-json-path.js +68 -0
- package/dist/utils/monaco-json-path.js.map +1 -0
- package/dist/utils/monaco-json-schema.d.ts +45 -0
- package/dist/utils/monaco-json-schema.d.ts.map +1 -0
- package/dist/utils/monaco-json-schema.js +90 -0
- package/dist/utils/monaco-json-schema.js.map +1 -0
- package/dist/utils/monaco-schema-contract.d.ts +8 -0
- package/dist/utils/monaco-schema-contract.d.ts.map +1 -0
- package/dist/utils/monaco-schema-contract.js +73 -0
- package/dist/utils/monaco-schema-contract.js.map +1 -0
- package/dist/utils/monaco-schema-enrichment.d.ts +26 -0
- package/dist/utils/monaco-schema-enrichment.d.ts.map +1 -0
- package/dist/utils/monaco-schema-enrichment.js +31 -0
- package/dist/utils/monaco-schema-enrichment.js.map +1 -0
- package/dist/utils/monaco-schema-flow-config.d.ts +10 -0
- package/dist/utils/monaco-schema-flow-config.d.ts.map +1 -0
- package/dist/utils/monaco-schema-flow-config.js +201 -0
- package/dist/utils/monaco-schema-flow-config.js.map +1 -0
- package/dist/utils/monaco-schema-variables.d.ts +4 -0
- package/dist/utils/monaco-schema-variables.d.ts.map +1 -0
- package/dist/utils/monaco-schema-variables.js +26 -0
- package/dist/utils/monaco-schema-variables.js.map +1 -0
- package/dist/utils/monaco-types.d.ts +174 -0
- package/dist/utils/monaco-types.d.ts.map +1 -0
- package/dist/utils/monaco-types.js +378 -0
- package/dist/utils/monaco-types.js.map +1 -0
- package/dist/utils/monaco-walkeros-completions.d.ts +23 -0
- package/dist/utils/monaco-walkeros-completions.d.ts.map +1 -0
- package/dist/utils/monaco-walkeros-completions.js +258 -0
- package/dist/utils/monaco-walkeros-completions.js.map +1 -0
- package/dist/utils/monaco-walkeros-decorations.d.ts +29 -0
- package/dist/utils/monaco-walkeros-decorations.d.ts.map +1 -0
- package/dist/utils/monaco-walkeros-decorations.js +87 -0
- package/dist/utils/monaco-walkeros-decorations.js.map +1 -0
- package/dist/utils/monaco-walkeros-markers.d.ts +13 -0
- package/dist/utils/monaco-walkeros-markers.d.ts.map +1 -0
- package/dist/utils/monaco-walkeros-markers.js +69 -0
- package/dist/utils/monaco-walkeros-markers.js.map +1 -0
- package/dist/utils/monaco-walkeros-providers.d.ts +19 -0
- package/dist/utils/monaco-walkeros-providers.d.ts.map +1 -0
- package/dist/utils/monaco-walkeros-providers.js +284 -0
- package/dist/utils/monaco-walkeros-providers.js.map +1 -0
- package/dist/utils/path-analyzer.d.ts +88 -0
- package/dist/utils/path-analyzer.d.ts.map +1 -0
- package/dist/utils/path-analyzer.js +215 -0
- package/dist/utils/path-analyzer.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { editor } from 'monaco-editor';
|
|
2
|
+
import type { IntelliSenseContext } from '../../types/intellisense';
|
|
3
|
+
export interface CodeProps {
|
|
4
|
+
code: string;
|
|
5
|
+
language?: string;
|
|
6
|
+
onChange?: (code: string) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
lineNumbers?: boolean;
|
|
9
|
+
minimap?: boolean;
|
|
10
|
+
folding?: boolean;
|
|
11
|
+
wordWrap?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
beforeMount?: (monaco: typeof import('monaco-editor')) => void;
|
|
14
|
+
onMount?: (editor: editor.IStandaloneCodeEditor) => void;
|
|
15
|
+
autoHeight?: boolean | {
|
|
16
|
+
min?: number;
|
|
17
|
+
max?: number;
|
|
18
|
+
};
|
|
19
|
+
fontSize?: number;
|
|
20
|
+
packages?: string[];
|
|
21
|
+
sticky?: boolean;
|
|
22
|
+
ide?: boolean;
|
|
23
|
+
/** JSON Schema (Draft 7) for validation and IntelliSense in JSON mode */
|
|
24
|
+
jsonSchema?: Record<string, unknown>;
|
|
25
|
+
/** Context data for dynamic IntelliSense (variable names, secrets, etc.) */
|
|
26
|
+
intellisenseContext?: IntelliSenseContext;
|
|
27
|
+
/** Validation function — called on content change, results rendered as Monaco markers */
|
|
28
|
+
validate?: (code: string) => {
|
|
29
|
+
valid: boolean;
|
|
30
|
+
errors: Array<{
|
|
31
|
+
message: string;
|
|
32
|
+
severity: 'error' | 'warning';
|
|
33
|
+
line: number;
|
|
34
|
+
column: number;
|
|
35
|
+
endLine?: number;
|
|
36
|
+
endColumn?: number;
|
|
37
|
+
}>;
|
|
38
|
+
warnings: Array<{
|
|
39
|
+
message: string;
|
|
40
|
+
severity: 'error' | 'warning';
|
|
41
|
+
line: number;
|
|
42
|
+
column: number;
|
|
43
|
+
endLine?: number;
|
|
44
|
+
endColumn?: number;
|
|
45
|
+
}>;
|
|
46
|
+
};
|
|
47
|
+
/** Callback when Monaco marker counts change */
|
|
48
|
+
onMarkerCounts?: (info: {
|
|
49
|
+
errors: number;
|
|
50
|
+
warnings: number;
|
|
51
|
+
markers: Array<{
|
|
52
|
+
message: string;
|
|
53
|
+
severity: 'error' | 'warning';
|
|
54
|
+
line: number;
|
|
55
|
+
column: number;
|
|
56
|
+
}>;
|
|
57
|
+
}) => void;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Code - Pure Monaco editor atom
|
|
61
|
+
*
|
|
62
|
+
* Height Management:
|
|
63
|
+
* Two modes controlled by `autoHeight` prop:
|
|
64
|
+
*
|
|
65
|
+
* 1. Default (autoHeight=false): height="100%" - fills parent container
|
|
66
|
+
* - Uses flex: 1 + min-height: 0 for proper flex overflow containment
|
|
67
|
+
* - Monaco set to height="100%" to fill container
|
|
68
|
+
* - automaticLayout: true + ResizeObserver for reliable resize detection
|
|
69
|
+
* - Use in Grid (equal heights) and Flex contexts (fill parent)
|
|
70
|
+
*
|
|
71
|
+
* 2. Auto-height (autoHeight=true): Dynamically sizes to content
|
|
72
|
+
* - Uses Monaco's getContentHeight() API for accurate content measurement
|
|
73
|
+
* - Respects min/max boundaries (default: 100-600px)
|
|
74
|
+
* - Updates automatically when content changes
|
|
75
|
+
* - Use in standalone contexts (docs) to eliminate blank space
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* // Grid context - use default height="100%" for equal row heights
|
|
79
|
+
* <Grid columns={3}>
|
|
80
|
+
* <CodeBox code={event} />
|
|
81
|
+
* <CodeBox code={mapping} />
|
|
82
|
+
* </Grid>
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* // Standalone context - use autoHeight to fit content
|
|
86
|
+
* <CodeBox
|
|
87
|
+
* code={shortExample}
|
|
88
|
+
* autoHeight={{ min: 100, max: 600 }}
|
|
89
|
+
* />
|
|
90
|
+
*/
|
|
91
|
+
export declare function Code({ code, language, onChange, disabled, lineNumbers, minimap, folding, wordWrap, className, beforeMount, onMount, autoHeight, fontSize, packages, sticky, ide, jsonSchema, intellisenseContext, validate, onMarkerCounts, }: CodeProps): import("react/jsx-runtime").JSX.Element;
|
|
92
|
+
//# sourceMappingURL=code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../../src/components/atoms/code.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AA8B5C,OAAO,KAAK,EA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EAAE,MAAM,CAAC;YACf,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,SAAS,CAAC,EAAE,MAAM,CAAC;SACpB,CAAC,CAAC;QACH,QAAQ,EAAE,KAAK,CAAC;YACd,OAAO,EAAE,MAAM,CAAC;YAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;YAC9B,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,SAAS,CAAC,EAAE,MAAM,CAAC;SACpB,CAAC,CAAC;KACJ,CAAC;IACF,gDAAgD;IAChD,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,KAAK,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;YAC9B,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,EAAE,MAAM,CAAC;SAChB,CAAC,CAAC;KACJ,KAAK,IAAI,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,QAAuB,EACvB,QAAQ,EACR,QAAgB,EAChB,WAAmB,EACnB,OAAe,EACf,OAAe,EACf,QAAgB,EAChB,SAAS,EACT,WAAW,EACX,OAAO,EACP,UAAU,EACV,QAAa,EACb,QAAQ,EACR,MAAa,EACb,GAAW,EACX,UAAU,EACV,mBAAmB,EACnB,QAAQ,EACR,cAAc,GACf,EAAE,SAAS,2CA2cX"}
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, useRef, useCallback, } from 'react';
|
|
3
|
+
import { Editor } from '@monaco-editor/react';
|
|
4
|
+
import { registerAllThemes } from '../../themes';
|
|
5
|
+
import { registerWalkerOSTypes } from '../../utils/monaco-types';
|
|
6
|
+
import { applyDataElbDecorations, registerDataElbStyles, } from '../../utils/monaco-decorators';
|
|
7
|
+
import { applyWalkerOSDecorations, registerWalkerOSDecorationStyles, } from '../../utils/monaco-walkeros-decorations';
|
|
8
|
+
import { registerWalkerOSProviders, setIntelliSenseContext, removeIntelliSenseContext, } from '../../utils/monaco-walkeros-providers';
|
|
9
|
+
import { registerFormatters } from '../../utils/monaco-formatters';
|
|
10
|
+
import { generateModelPath, initMonacoJson, registerJsonSchema, unregisterJsonSchema, } from '../../utils/monaco-json-schema';
|
|
11
|
+
import { useMonacoHeight } from '../../hooks/useMonacoHeight';
|
|
12
|
+
import { useGridHeight } from '../../contexts/GridHeightContext';
|
|
13
|
+
/**
|
|
14
|
+
* Code - Pure Monaco editor atom
|
|
15
|
+
*
|
|
16
|
+
* Height Management:
|
|
17
|
+
* Two modes controlled by `autoHeight` prop:
|
|
18
|
+
*
|
|
19
|
+
* 1. Default (autoHeight=false): height="100%" - fills parent container
|
|
20
|
+
* - Uses flex: 1 + min-height: 0 for proper flex overflow containment
|
|
21
|
+
* - Monaco set to height="100%" to fill container
|
|
22
|
+
* - automaticLayout: true + ResizeObserver for reliable resize detection
|
|
23
|
+
* - Use in Grid (equal heights) and Flex contexts (fill parent)
|
|
24
|
+
*
|
|
25
|
+
* 2. Auto-height (autoHeight=true): Dynamically sizes to content
|
|
26
|
+
* - Uses Monaco's getContentHeight() API for accurate content measurement
|
|
27
|
+
* - Respects min/max boundaries (default: 100-600px)
|
|
28
|
+
* - Updates automatically when content changes
|
|
29
|
+
* - Use in standalone contexts (docs) to eliminate blank space
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Grid context - use default height="100%" for equal row heights
|
|
33
|
+
* <Grid columns={3}>
|
|
34
|
+
* <CodeBox code={event} />
|
|
35
|
+
* <CodeBox code={mapping} />
|
|
36
|
+
* </Grid>
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Standalone context - use autoHeight to fit content
|
|
40
|
+
* <CodeBox
|
|
41
|
+
* code={shortExample}
|
|
42
|
+
* autoHeight={{ min: 100, max: 600 }}
|
|
43
|
+
* />
|
|
44
|
+
*/
|
|
45
|
+
export function Code({ code, language = 'javascript', onChange, disabled = false, lineNumbers = false, minimap = false, folding = false, wordWrap = false, className, beforeMount, onMount, autoHeight, fontSize = 13, packages, sticky = true, ide = false, jsonSchema, intellisenseContext, validate, onMarkerCounts, }) {
|
|
46
|
+
// Track if component has mounted (client-side hydration complete)
|
|
47
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
48
|
+
// Use a consistent default theme for SSR - only update after mount
|
|
49
|
+
const [monacoTheme, setMonacoTheme] = useState('vs-light');
|
|
50
|
+
const decorationsCleanupRef = useRef([]);
|
|
51
|
+
const monacoRef = useRef(null);
|
|
52
|
+
const editorRef = useRef(null);
|
|
53
|
+
const containerRef = useRef(null);
|
|
54
|
+
const gridContext = useGridHeight();
|
|
55
|
+
const boxIdRef = useRef(null);
|
|
56
|
+
if (gridContext?.enabled && boxIdRef.current === null) {
|
|
57
|
+
boxIdRef.current = gridContext.getBoxId();
|
|
58
|
+
}
|
|
59
|
+
const handleHeightChange = useCallback((height) => {
|
|
60
|
+
if (gridContext?.enabled && boxIdRef.current !== null) {
|
|
61
|
+
gridContext.registerBox(boxIdRef.current, height);
|
|
62
|
+
}
|
|
63
|
+
}, [gridContext]);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
return () => {
|
|
66
|
+
if (gridContext?.enabled && boxIdRef.current !== null) {
|
|
67
|
+
gridContext.unregisterBox(boxIdRef.current);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}, [gridContext]);
|
|
71
|
+
const heightConfig = typeof autoHeight === 'object' ? autoHeight : {};
|
|
72
|
+
const [calculatedHeight, registerEditor] = useMonacoHeight({
|
|
73
|
+
enabled: !!autoHeight || !!gridContext?.enabled,
|
|
74
|
+
minHeight: heightConfig.min ?? (gridContext?.enabled ? 1 : 20),
|
|
75
|
+
maxHeight: heightConfig.max ?? 600,
|
|
76
|
+
defaultHeight: gridContext?.enabled ? 250 : 400,
|
|
77
|
+
onHeightChange: handleHeightChange,
|
|
78
|
+
});
|
|
79
|
+
// Register data-elb styles on mount
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
registerDataElbStyles();
|
|
82
|
+
}, []);
|
|
83
|
+
// Helper: Find data-theme attribute from closest ancestor or document
|
|
84
|
+
// Returns null during SSR (no document available)
|
|
85
|
+
const getDataTheme = useCallback(() => {
|
|
86
|
+
if (typeof document === 'undefined')
|
|
87
|
+
return null;
|
|
88
|
+
// Check container ref first (closest to Monaco)
|
|
89
|
+
if (containerRef.current) {
|
|
90
|
+
const closest = containerRef.current.closest('[data-theme]');
|
|
91
|
+
if (closest) {
|
|
92
|
+
return closest.getAttribute('data-theme');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Fall back to document root
|
|
96
|
+
return document.documentElement.getAttribute('data-theme');
|
|
97
|
+
}, []);
|
|
98
|
+
// Mark component as mounted (hydration complete)
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
setIsMounted(true);
|
|
101
|
+
}, []);
|
|
102
|
+
// Theme detection - only runs after mount to prevent hydration mismatch
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!isMounted)
|
|
105
|
+
return;
|
|
106
|
+
const checkTheme = () => {
|
|
107
|
+
const dataTheme = getDataTheme();
|
|
108
|
+
const isDark = dataTheme === 'dark' ||
|
|
109
|
+
(dataTheme === null &&
|
|
110
|
+
window.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
111
|
+
const newTheme = isDark ? 'elbTheme-dark' : 'elbTheme-light';
|
|
112
|
+
setMonacoTheme(newTheme);
|
|
113
|
+
};
|
|
114
|
+
checkTheme();
|
|
115
|
+
const observer = new MutationObserver(() => {
|
|
116
|
+
checkTheme();
|
|
117
|
+
});
|
|
118
|
+
observer.observe(document.documentElement, {
|
|
119
|
+
attributes: true,
|
|
120
|
+
attributeFilter: ['data-theme'],
|
|
121
|
+
});
|
|
122
|
+
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
123
|
+
const handleChange = () => {
|
|
124
|
+
checkTheme();
|
|
125
|
+
};
|
|
126
|
+
mediaQuery.addEventListener('change', handleChange);
|
|
127
|
+
return () => {
|
|
128
|
+
observer.disconnect();
|
|
129
|
+
mediaQuery.removeEventListener('change', handleChange);
|
|
130
|
+
};
|
|
131
|
+
}, [isMounted, getDataTheme]);
|
|
132
|
+
// ResizeObserver for container size changes
|
|
133
|
+
// Complements automaticLayout: true for more reliable detection
|
|
134
|
+
// Handles cases where Grid constraints change or parent container resizes
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
const editor = editorRef.current;
|
|
137
|
+
const container = containerRef.current;
|
|
138
|
+
if (!editor || !container)
|
|
139
|
+
return;
|
|
140
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
141
|
+
// Debounce layout calls to prevent excessive updates
|
|
142
|
+
requestAnimationFrame(() => {
|
|
143
|
+
editor.layout();
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
resizeObserver.observe(container);
|
|
147
|
+
return () => {
|
|
148
|
+
resizeObserver.disconnect();
|
|
149
|
+
};
|
|
150
|
+
}, []);
|
|
151
|
+
// JSON Schema registration for IntelliSense
|
|
152
|
+
const modelPathRef = useRef(null);
|
|
153
|
+
const intellisenseContextRef = useRef(intellisenseContext);
|
|
154
|
+
intellisenseContextRef.current = intellisenseContext;
|
|
155
|
+
const validateRef = useRef(validate);
|
|
156
|
+
validateRef.current = validate;
|
|
157
|
+
const onMarkerCountsRef = useRef(onMarkerCounts);
|
|
158
|
+
onMarkerCountsRef.current = onMarkerCounts;
|
|
159
|
+
// Generate stable model path on first render if jsonSchema is provided
|
|
160
|
+
if ((jsonSchema || intellisenseContext) && !modelPathRef.current) {
|
|
161
|
+
modelPathRef.current = generateModelPath();
|
|
162
|
+
}
|
|
163
|
+
// Register/update JSON schema when it changes
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (!jsonSchema || !modelPathRef.current)
|
|
166
|
+
return;
|
|
167
|
+
registerJsonSchema(modelPathRef.current, jsonSchema);
|
|
168
|
+
return () => {
|
|
169
|
+
if (modelPathRef.current) {
|
|
170
|
+
unregisterJsonSchema(modelPathRef.current);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}, [jsonSchema]);
|
|
174
|
+
// Sync intellisenseContext with provider registry
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
if (intellisenseContext && modelPathRef.current) {
|
|
177
|
+
setIntelliSenseContext(modelPathRef.current, intellisenseContext);
|
|
178
|
+
return () => {
|
|
179
|
+
if (modelPathRef.current) {
|
|
180
|
+
removeIntelliSenseContext(modelPathRef.current);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}, [intellisenseContext]);
|
|
185
|
+
const handleChange = (value) => {
|
|
186
|
+
if (onChange && value !== undefined) {
|
|
187
|
+
onChange(value);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const handleBeforeMount = async (monaco) => {
|
|
191
|
+
monacoRef.current = monaco;
|
|
192
|
+
// Initialize JSON schema registry with this monaco instance
|
|
193
|
+
initMonacoJson(monaco);
|
|
194
|
+
// Always run built-in setup
|
|
195
|
+
registerAllThemes(monaco);
|
|
196
|
+
registerFormatters(monaco);
|
|
197
|
+
if (packages && packages.length > 0) {
|
|
198
|
+
registerWalkerOSTypes(monaco);
|
|
199
|
+
const { loadPackageTypes } = await import('../../utils/monaco-types');
|
|
200
|
+
for (const pkg of packages) {
|
|
201
|
+
if (pkg !== '@walkeros/core') {
|
|
202
|
+
await loadPackageTypes(monaco, { package: pkg }).catch(() => { });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const dataTheme = getDataTheme();
|
|
207
|
+
const isDark = dataTheme === 'dark' ||
|
|
208
|
+
(dataTheme === null &&
|
|
209
|
+
window.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
210
|
+
const themeName = isDark ? 'elbTheme-dark' : 'elbTheme-light';
|
|
211
|
+
monaco.editor.setTheme(themeName);
|
|
212
|
+
// Register walkerOS IntelliSense providers for JSON
|
|
213
|
+
if (language === 'json') {
|
|
214
|
+
registerWalkerOSProviders(monaco);
|
|
215
|
+
}
|
|
216
|
+
// Call user's beforeMount AFTER built-in setup
|
|
217
|
+
if (beforeMount) {
|
|
218
|
+
beforeMount(monaco);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const MonacoEditor = Editor;
|
|
222
|
+
const handleEditorMount = (monacoEditor) => {
|
|
223
|
+
editorRef.current = monacoEditor;
|
|
224
|
+
// Register with height hook if auto-height or grid context is enabled
|
|
225
|
+
if (autoHeight || gridContext?.enabled) {
|
|
226
|
+
registerEditor(monacoEditor);
|
|
227
|
+
}
|
|
228
|
+
// Apply data-elb decorations for HTML
|
|
229
|
+
if (language === 'html' && monacoRef.current) {
|
|
230
|
+
decorationsCleanupRef.current.push(applyDataElbDecorations(monacoEditor, monacoRef.current));
|
|
231
|
+
}
|
|
232
|
+
// Apply walkerOS reference decorations for JSON
|
|
233
|
+
if (language === 'json') {
|
|
234
|
+
registerWalkerOSDecorationStyles();
|
|
235
|
+
decorationsCleanupRef.current.push(applyWalkerOSDecorations(monacoEditor));
|
|
236
|
+
}
|
|
237
|
+
// Run validation from validate prop (replaces internal walkerOS markers)
|
|
238
|
+
if (validateRef.current && monacoRef.current) {
|
|
239
|
+
const monacoInstance = monacoRef.current;
|
|
240
|
+
let validateTimer;
|
|
241
|
+
const runValidation = () => {
|
|
242
|
+
const model = monacoEditor.getModel();
|
|
243
|
+
if (!model)
|
|
244
|
+
return;
|
|
245
|
+
const text = model.getValue();
|
|
246
|
+
const fn = validateRef.current;
|
|
247
|
+
if (!fn)
|
|
248
|
+
return;
|
|
249
|
+
const result = fn(text);
|
|
250
|
+
const allIssues = [...result.errors, ...result.warnings];
|
|
251
|
+
monacoInstance.editor.setModelMarkers(model, 'validate', allIssues.map((issue) => ({
|
|
252
|
+
severity: issue.severity === 'error' ? 8 : 4,
|
|
253
|
+
message: issue.message,
|
|
254
|
+
startLineNumber: issue.line,
|
|
255
|
+
startColumn: issue.column,
|
|
256
|
+
endLineNumber: issue.endLine ?? issue.line,
|
|
257
|
+
endColumn: issue.endColumn ?? issue.column + 1,
|
|
258
|
+
})));
|
|
259
|
+
// Don't report here — the global marker listener below handles it
|
|
260
|
+
};
|
|
261
|
+
// Initial validation
|
|
262
|
+
runValidation();
|
|
263
|
+
// Debounced validation on content change
|
|
264
|
+
const validateDisposable = monacoEditor.onDidChangeModelContent(() => {
|
|
265
|
+
clearTimeout(validateTimer);
|
|
266
|
+
validateTimer = setTimeout(runValidation, 300);
|
|
267
|
+
});
|
|
268
|
+
decorationsCleanupRef.current.push(() => {
|
|
269
|
+
clearTimeout(validateTimer);
|
|
270
|
+
validateDisposable.dispose();
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
// Listen for marker changes and report counts to CodeBox header badges.
|
|
274
|
+
// When a custom validate prop is provided, it is the single source of truth
|
|
275
|
+
// (same validator the CLI uses). Clear Monaco's built-in JSON diagnostics
|
|
276
|
+
// so they don't double-count.
|
|
277
|
+
if (onMarkerCountsRef.current && monacoRef.current) {
|
|
278
|
+
const monacoInstance = monacoRef.current;
|
|
279
|
+
const model = monacoEditor.getModel();
|
|
280
|
+
const hasCustomValidate = !!validateRef.current;
|
|
281
|
+
if (model) {
|
|
282
|
+
const reportMarkers = () => {
|
|
283
|
+
// When custom validate owns validation, strip Monaco's JSON markers
|
|
284
|
+
if (hasCustomValidate) {
|
|
285
|
+
monacoInstance.editor.setModelMarkers(model, 'json', []);
|
|
286
|
+
}
|
|
287
|
+
const raw = monacoInstance.editor.getModelMarkers({
|
|
288
|
+
resource: model.uri,
|
|
289
|
+
});
|
|
290
|
+
let errors = 0;
|
|
291
|
+
let warnings = 0;
|
|
292
|
+
const details = [];
|
|
293
|
+
for (const m of raw) {
|
|
294
|
+
if (m.severity === 8) {
|
|
295
|
+
errors++;
|
|
296
|
+
details.push({
|
|
297
|
+
message: m.message,
|
|
298
|
+
severity: 'error',
|
|
299
|
+
line: m.startLineNumber,
|
|
300
|
+
column: m.startColumn,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
else if (m.severity === 4) {
|
|
304
|
+
warnings++;
|
|
305
|
+
details.push({
|
|
306
|
+
message: m.message,
|
|
307
|
+
severity: 'warning',
|
|
308
|
+
line: m.startLineNumber,
|
|
309
|
+
column: m.startColumn,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
onMarkerCountsRef.current?.({ errors, warnings, markers: details });
|
|
314
|
+
};
|
|
315
|
+
const markerDisposable = monacoInstance.editor.onDidChangeMarkers((uris) => {
|
|
316
|
+
if (uris.some((uri) => uri.toString() === model.uri.toString())) {
|
|
317
|
+
reportMarkers();
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
// Initial report (catches markers set before listener)
|
|
321
|
+
requestAnimationFrame(reportMarkers);
|
|
322
|
+
decorationsCleanupRef.current.push(() => {
|
|
323
|
+
markerDisposable.dispose();
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// Initial layout call after mount
|
|
328
|
+
requestAnimationFrame(() => {
|
|
329
|
+
monacoEditor.layout();
|
|
330
|
+
});
|
|
331
|
+
if (onMount) {
|
|
332
|
+
onMount(monacoEditor);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
// Cleanup
|
|
336
|
+
useEffect(() => {
|
|
337
|
+
return () => {
|
|
338
|
+
for (const cleanup of decorationsCleanupRef.current) {
|
|
339
|
+
cleanup();
|
|
340
|
+
}
|
|
341
|
+
decorationsCleanupRef.current = [];
|
|
342
|
+
};
|
|
343
|
+
}, []);
|
|
344
|
+
// Choose height strategy: auto-calculated or fill parent
|
|
345
|
+
// Note: When grid context is enabled with synced mode, CodeBox applies
|
|
346
|
+
// syncedHeight to the Box container. Monaco should use calculatedHeight
|
|
347
|
+
// (content-only) here, not syncedHeight (which includes header + border).
|
|
348
|
+
const monacoHeight = autoHeight || gridContext?.enabled ? `${calculatedHeight}px` : '100%';
|
|
349
|
+
// Add modifier class when using auto-height or synced height
|
|
350
|
+
const useContentHeight = !!autoHeight || !!gridContext?.enabled;
|
|
351
|
+
const codeClassName = `elb-code ${useContentHeight ? 'elb-code--auto-height' : ''} ${className || ''}`.trim();
|
|
352
|
+
return (_jsx("div", { className: codeClassName, ref: containerRef, children: _jsx(MonacoEditor, { height: monacoHeight, language: language, value: code, onChange: handleChange, beforeMount: handleBeforeMount, onMount: handleEditorMount, theme: monacoTheme, path: modelPathRef.current || undefined, options: {
|
|
353
|
+
readOnly: disabled || !onChange,
|
|
354
|
+
readOnlyMessage: { value: '' },
|
|
355
|
+
minimap: { enabled: minimap },
|
|
356
|
+
fontSize: fontSize,
|
|
357
|
+
lineHeight: Math.round(fontSize * 1.5),
|
|
358
|
+
padding: 0,
|
|
359
|
+
lineNumbers: lineNumbers ? 'on' : 'off',
|
|
360
|
+
lineNumbersMinChars: 3,
|
|
361
|
+
glyphMargin: false,
|
|
362
|
+
folding: folding,
|
|
363
|
+
lineDecorationsWidth: 8, // Gap between line numbers and code
|
|
364
|
+
scrollBeyondLastLine: false,
|
|
365
|
+
automaticLayout: true,
|
|
366
|
+
tabSize: 2,
|
|
367
|
+
detectIndentation: false,
|
|
368
|
+
trimAutoWhitespace: false,
|
|
369
|
+
wordWrap: wordWrap ? 'on' : 'off',
|
|
370
|
+
fixedOverflowWidgets: true,
|
|
371
|
+
overviewRulerLanes: 0,
|
|
372
|
+
renderLineHighlight: 'none',
|
|
373
|
+
renderValidationDecorations: ide || jsonSchema ? 'editable' : 'off',
|
|
374
|
+
hover: { enabled: ide || !!jsonSchema || !!intellisenseContext },
|
|
375
|
+
'semanticHighlighting.enabled': ide,
|
|
376
|
+
showDeprecated: ide,
|
|
377
|
+
showUnused: ide,
|
|
378
|
+
'bracketPairColorization.enabled': false,
|
|
379
|
+
guides: {
|
|
380
|
+
bracketPairs: false,
|
|
381
|
+
bracketPairsHorizontal: false,
|
|
382
|
+
highlightActiveBracketPair: false,
|
|
383
|
+
indentation: false, // Disable indentation guide lines
|
|
384
|
+
},
|
|
385
|
+
scrollbar: {
|
|
386
|
+
vertical: 'auto',
|
|
387
|
+
horizontal: 'auto',
|
|
388
|
+
alwaysConsumeMouseWheel: false,
|
|
389
|
+
},
|
|
390
|
+
// Cursor and selection behavior
|
|
391
|
+
cursorBlinking: 'blink', // Make cursor blink visibly
|
|
392
|
+
cursorStyle: 'line', // Use line cursor (most visible)
|
|
393
|
+
cursorWidth: 2, // Make cursor 2px wide for better visibility
|
|
394
|
+
cursorSmoothCaretAnimation: 'off', // Disable smooth cursor animation
|
|
395
|
+
selectionHighlight: false, // Disable auto-highlighting of selected text occurrences
|
|
396
|
+
occurrencesHighlight: 'off', // Disable highlighting matching words
|
|
397
|
+
selectOnLineNumbers: false, // Don't select line when clicking line numbers
|
|
398
|
+
wordBasedSuggestions: 'off', // Reduce auto-completion interference
|
|
399
|
+
quickSuggestions: jsonSchema || intellisenseContext
|
|
400
|
+
? { strings: true, other: true, comments: false }
|
|
401
|
+
: false,
|
|
402
|
+
stickyScroll: { enabled: sticky },
|
|
403
|
+
} }) }));
|
|
404
|
+
}
|
|
405
|
+
//# sourceMappingURL=code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","sourceRoot":"","sources":["../../../src/components/atoms/code.tsx"],"names":[],"mappings":";AAAA,OAAc,EAEZ,SAAS,EACT,QAAQ,EACR,MAAM,EACN,WAAW,GACZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,MAAM,EAAU,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;A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E,KAAK,EAAE,sCAAsC;gBACnE,gBAAgB,EACd,UAAU,IAAI,mBAAmB;oBAC/B,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE;oBACjD,CAAC,CAAC,KAAK;gBACX,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;aAClC,GACD,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Code } from './code';
|
|
3
|
+
/**
|
|
4
|
+
* Code - Monaco Editor atom component
|
|
5
|
+
*
|
|
6
|
+
* Pure Monaco editor without Box wrapper. This is the base atom that CodeBox uses.
|
|
7
|
+
* Supports syntax highlighting, auto-height, and various editor configurations.
|
|
8
|
+
*
|
|
9
|
+
* Note: For most use cases, use CodeBox (molecule) which includes header and actions.
|
|
10
|
+
*/
|
|
11
|
+
declare const meta: Meta<typeof Code>;
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof Code>;
|
|
14
|
+
/**
|
|
15
|
+
* Default code editor - fills parent container height
|
|
16
|
+
*
|
|
17
|
+
* The dashed border shows the parent container bounds.
|
|
18
|
+
* Code uses height="100%" by default, filling the available space.
|
|
19
|
+
*/
|
|
20
|
+
export declare const Default: Story;
|
|
21
|
+
/**
|
|
22
|
+
* With line numbers enabled
|
|
23
|
+
*/
|
|
24
|
+
export declare const WithLineNumbers: Story;
|
|
25
|
+
/**
|
|
26
|
+
* Auto-height mode - sizes to content
|
|
27
|
+
*
|
|
28
|
+
* Instead of filling the container, the editor sizes to fit its content.
|
|
29
|
+
* Useful for documentation and standalone code displays.
|
|
30
|
+
*/
|
|
31
|
+
export declare const AutoHeight: Story;
|
|
32
|
+
/**
|
|
33
|
+
* Sticky scroll disabled
|
|
34
|
+
*
|
|
35
|
+
* When sticky={false}, the nested context headers won't stick to the top when scrolling.
|
|
36
|
+
* Compare with default (sticky=true) to see the difference.
|
|
37
|
+
*/
|
|
38
|
+
export declare const NoStickyScroll: Story;
|
|
39
|
+
/**
|
|
40
|
+
* IDE mode ON - Full Monaco features
|
|
41
|
+
*
|
|
42
|
+
* Enable hover tooltips, validation decorations, and other IDE features.
|
|
43
|
+
* Use for interactive editors like playgrounds where feedback is useful.
|
|
44
|
+
*/
|
|
45
|
+
export declare const IdeOn: Story;
|
|
46
|
+
//# sourceMappingURL=code.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.stories.d.ts","sourceRoot":"","sources":["../../../src/components/atoms/code.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B;;;;;;;GAOG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,CAsB3B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAcnC;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAM7B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAsBxB,CAAC;AAkCF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,KAM5B,CAAC;AAiBF;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAC"}
|