@walkeros/explorer 3.0.1 → 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,300 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { schemas } from '@walkeros/core/dev';
|
|
4
|
+
import { CodeBox } from './code-box';
|
|
5
|
+
import { enrichFlowConfigSchema } from '../../utils/monaco-schema-flow-config';
|
|
6
|
+
import { getEnrichedContractSchema } from '../../utils/monaco-schema-contract';
|
|
7
|
+
import { getVariablesSchema } from '../../utils/monaco-schema-variables';
|
|
8
|
+
/**
|
|
9
|
+
* CodeBox - Monaco Editor wrapped in a Box component
|
|
10
|
+
*
|
|
11
|
+
* Combines the Code atom with Box container, providing header and toolbar actions.
|
|
12
|
+
* Supports copy to clipboard, JSON formatting, and flexible height modes.
|
|
13
|
+
*/
|
|
14
|
+
const meta = {
|
|
15
|
+
component: CodeBox,
|
|
16
|
+
title: 'Molecules/CodeBox',
|
|
17
|
+
tags: ['autodocs'],
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
/**
|
|
21
|
+
* Default CodeBox with JavaScript code
|
|
22
|
+
*/
|
|
23
|
+
export const Default = {
|
|
24
|
+
args: {
|
|
25
|
+
code: `const event = {
|
|
26
|
+
entity: 'product',
|
|
27
|
+
action: 'view',
|
|
28
|
+
data: {
|
|
29
|
+
id: 'P123',
|
|
30
|
+
name: 'Laptop',
|
|
31
|
+
price: 999
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
console.log('Event:', event);`,
|
|
36
|
+
language: 'javascript',
|
|
37
|
+
label: 'Code Editor',
|
|
38
|
+
showCopy: true,
|
|
39
|
+
showFormat: false,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const flowJsonCode = `{
|
|
43
|
+
"flows": {
|
|
44
|
+
"default": {
|
|
45
|
+
"sources": {
|
|
46
|
+
"browser": {
|
|
47
|
+
"package": "@walkeros/web-source-browser",
|
|
48
|
+
"config": { "settings": { "pageview": true } }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"destinations": {
|
|
52
|
+
"ga4": {
|
|
53
|
+
"package": "@walkeros/web-destination-gtag",
|
|
54
|
+
"config": {
|
|
55
|
+
"settings": { "ga4": { "measurementId": "G-XXX" } }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}`;
|
|
62
|
+
/**
|
|
63
|
+
* Mac-style code window with traffic lights and filename tab
|
|
64
|
+
*
|
|
65
|
+
* Use this pattern for landing pages and documentation.
|
|
66
|
+
*/
|
|
67
|
+
export const WithTrafficLights = {
|
|
68
|
+
args: {
|
|
69
|
+
code: flowJsonCode,
|
|
70
|
+
language: 'json',
|
|
71
|
+
showTrafficLights: true,
|
|
72
|
+
tabs: [{ id: 'file', label: 'flow.json', code: flowJsonCode }],
|
|
73
|
+
showCopy: true,
|
|
74
|
+
height: 400,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* CodeBox with multiple tabs - clicking tabs switches code content
|
|
79
|
+
*/
|
|
80
|
+
export const WithTabs = {
|
|
81
|
+
args: {
|
|
82
|
+
tabs: [
|
|
83
|
+
{
|
|
84
|
+
id: 'config',
|
|
85
|
+
label: 'config.ts',
|
|
86
|
+
code: `export const config = {
|
|
87
|
+
tracking: true,
|
|
88
|
+
debug: false,
|
|
89
|
+
destinations: ['ga4', 'gtm']
|
|
90
|
+
};`,
|
|
91
|
+
language: 'typescript',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 'index',
|
|
95
|
+
label: 'index.ts',
|
|
96
|
+
code: `import { config } from './config';
|
|
97
|
+
import { elb } from '@walkeros/core';
|
|
98
|
+
|
|
99
|
+
elb('walker run', config);`,
|
|
100
|
+
language: 'typescript',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 'types',
|
|
104
|
+
label: 'types.ts',
|
|
105
|
+
code: `export interface TrackingConfig {
|
|
106
|
+
tracking: boolean;
|
|
107
|
+
debug: boolean;
|
|
108
|
+
destinations: string[];
|
|
109
|
+
}`,
|
|
110
|
+
language: 'typescript',
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
defaultTab: 'config',
|
|
114
|
+
showCopy: true,
|
|
115
|
+
height: 300,
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* CodeBox with JSON Schema IntelliSense
|
|
120
|
+
*
|
|
121
|
+
* Demonstrates JSON validation, autocomplete, and hover docs
|
|
122
|
+
* powered by a JSON Schema passed via the `jsonSchema` prop.
|
|
123
|
+
*/
|
|
124
|
+
export const WithJsonSchema = {
|
|
125
|
+
render: () => {
|
|
126
|
+
const [code, setCode] = useState(JSON.stringify({ version: 1, flows: {} }, null, 2));
|
|
127
|
+
return (_jsx(CodeBox, { code: code, onChange: setCode, language: "json", label: "Flow Config (with IntelliSense)", showFormat: true, jsonSchema: {
|
|
128
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
129
|
+
type: 'object',
|
|
130
|
+
properties: {
|
|
131
|
+
version: {
|
|
132
|
+
type: 'number',
|
|
133
|
+
description: 'Flow configuration version',
|
|
134
|
+
enum: [1, 2],
|
|
135
|
+
},
|
|
136
|
+
flows: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
description: 'Named flow configurations',
|
|
139
|
+
additionalProperties: {
|
|
140
|
+
type: 'object',
|
|
141
|
+
properties: {
|
|
142
|
+
web: { type: 'object', description: 'Web platform config' },
|
|
143
|
+
server: {
|
|
144
|
+
type: 'object',
|
|
145
|
+
description: 'Server platform config',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
required: ['version', 'flows'],
|
|
152
|
+
} }));
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* CodeBox with settings toggle
|
|
157
|
+
*
|
|
158
|
+
* Click the gear icon to toggle line numbers, minimap, and word wrap.
|
|
159
|
+
*/
|
|
160
|
+
export const WithSettings = {
|
|
161
|
+
render: () => {
|
|
162
|
+
const [code, setCode] = useState(JSON.stringify({
|
|
163
|
+
version: 1,
|
|
164
|
+
flows: {
|
|
165
|
+
default: {
|
|
166
|
+
sources: {
|
|
167
|
+
browser: {
|
|
168
|
+
package: '@walkeros/web-source-browser',
|
|
169
|
+
config: { settings: { pageview: true } },
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
destinations: {
|
|
173
|
+
ga4: {
|
|
174
|
+
package: '@walkeros/web-destination-gtag',
|
|
175
|
+
config: {
|
|
176
|
+
settings: { ga4: { measurementId: 'G-XXX' } },
|
|
177
|
+
mapping: {
|
|
178
|
+
'page view': { name: 'page_view' },
|
|
179
|
+
'product view': {
|
|
180
|
+
name: 'view_item',
|
|
181
|
+
data: { map: { id: 'items.0.item_id' } },
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
}, null, 2));
|
|
190
|
+
return (_jsx(CodeBox, { code: code, onChange: setCode, language: "json", label: "Flow Config", showFormat: true, showSettings: true, height: 500 }));
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
// ============================================================
|
|
194
|
+
// IntelliSense Stories
|
|
195
|
+
// ============================================================
|
|
196
|
+
/**
|
|
197
|
+
* Enriched Flow.Config schema with defaultSnippets and markdownDescription
|
|
198
|
+
*
|
|
199
|
+
* Uses the real Flow.Config JSON Schema from @walkeros/core, enriched with
|
|
200
|
+
* Monaco-specific extensions (snippets, markdown hover docs).
|
|
201
|
+
*
|
|
202
|
+
* **How to verify:** Place cursor inside `{}` after `"flows":`, press
|
|
203
|
+
* Ctrl+Space — autocomplete shows property suggestions from the schema.
|
|
204
|
+
*/
|
|
205
|
+
export const EnrichedFlowConfig = {
|
|
206
|
+
render: () => {
|
|
207
|
+
const [code, setCode] = useState(JSON.stringify({ version: 1, flows: {} }, null, 2));
|
|
208
|
+
return (_jsx(CodeBox, { code: code, onChange: setCode, language: "json", label: "Flow Config (Enriched Schema)", showFormat: true, jsonSchema: enrichFlowConfigSchema(schemas.configJsonSchema), height: 400 }));
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Contract schema with entity/action snippets
|
|
213
|
+
*
|
|
214
|
+
* **How to verify:** Autocomplete inside entities shows entity snippet;
|
|
215
|
+
* hover on properties shows markdown descriptions.
|
|
216
|
+
*/
|
|
217
|
+
export const EnrichedContract = {
|
|
218
|
+
render: () => {
|
|
219
|
+
const [code, setCode] = useState(JSON.stringify({ $tagging: 1 }, null, 2));
|
|
220
|
+
return (_jsx(CodeBox, { code: code, onChange: setCode, language: "json", label: "Data Contract", showFormat: true, jsonSchema: getEnrichedContractSchema(), height: 400 }));
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Variables schema with `$var.` interpolation docs
|
|
225
|
+
*
|
|
226
|
+
* **How to verify:** Autocomplete shows "Add string variable",
|
|
227
|
+
* "Add boolean variable", "Add number variable" snippets.
|
|
228
|
+
*/
|
|
229
|
+
export const VariablesEditor = {
|
|
230
|
+
render: () => {
|
|
231
|
+
const [code, setCode] = useState(JSON.stringify({ measurementId: 'G-XXXXXXXXXX', debug: false }, null, 2));
|
|
232
|
+
return (_jsx(CodeBox, { code: code, onChange: setCode, language: "json", label: "Variables", showFormat: true, jsonSchema: getVariablesSchema(), height: 300 }));
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Visual coloring of `$var.`, `$def.`, `$secret.`, `$env.`, `$code:` references
|
|
237
|
+
*
|
|
238
|
+
* Decorations are applied automatically for JSON content. Each reference type
|
|
239
|
+
* is colored differently: variables=cyan italic, definitions=green italic,
|
|
240
|
+
* secrets/env=amber italic, code=purple.
|
|
241
|
+
*
|
|
242
|
+
* **How to verify:** Each reference value should be colored differently
|
|
243
|
+
* in the editor.
|
|
244
|
+
*/
|
|
245
|
+
export const ReferenceDecorations = {
|
|
246
|
+
render: () => {
|
|
247
|
+
const [code, setCode] = useState(JSON.stringify({
|
|
248
|
+
measurementId: '$var.gaId',
|
|
249
|
+
apiKey: '$secret.apiKey',
|
|
250
|
+
endpoint: '$env.API_URL',
|
|
251
|
+
transform: '$def.cleanEvent',
|
|
252
|
+
code: '$code:myFunction',
|
|
253
|
+
}, null, 2));
|
|
254
|
+
return (_jsx(CodeBox, { code: code, onChange: setCode, language: "json", label: "Reference Decorations", showFormat: true, height: 300 }));
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Dynamic Flow Context — self-referencing IntelliSense
|
|
259
|
+
*
|
|
260
|
+
* Edit the flow JSON and variables/definitions you define become immediately
|
|
261
|
+
* available as `$var.` and `$def.` completions in the same editor.
|
|
262
|
+
*
|
|
263
|
+
* **How to verify:**
|
|
264
|
+
* - Add a variable in the `"variables"` section (e.g., `"myVar": "hello"`)
|
|
265
|
+
* - Scroll down to a destination config and type `$var.` — your new variable appears
|
|
266
|
+
* - Rename or delete the variable — completions update instantly
|
|
267
|
+
* - `$var.nonExistent` gets a warning marker
|
|
268
|
+
*/
|
|
269
|
+
export const DynamicFlowContext = {
|
|
270
|
+
name: 'Dynamic Flow Context',
|
|
271
|
+
render: () => {
|
|
272
|
+
const [code, setCode] = useState(JSON.stringify({
|
|
273
|
+
version: 1,
|
|
274
|
+
variables: { gaId: 'G-XXXXXXXXXX', debug: false },
|
|
275
|
+
definitions: { cleanEvent: { filter: true } },
|
|
276
|
+
flows: {
|
|
277
|
+
default: {
|
|
278
|
+
web: {},
|
|
279
|
+
sources: {
|
|
280
|
+
browser: { package: '@walkeros/web-source-browser' },
|
|
281
|
+
},
|
|
282
|
+
destinations: {
|
|
283
|
+
ga4: {
|
|
284
|
+
package: '@walkeros/web-destination-gtag',
|
|
285
|
+
config: {
|
|
286
|
+
settings: {
|
|
287
|
+
ga4: { measurementId: '$var.gaId' },
|
|
288
|
+
missing: '$var.nonExistent',
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
}, null, 2));
|
|
296
|
+
const validation = schemas.validateFlowConfig(code);
|
|
297
|
+
return (_jsx(CodeBox, { code: code, onChange: setCode, language: "json", label: "Flow Config (Dynamic Validation)", showFormat: true, jsonSchema: enrichFlowConfigSchema(schemas.configJsonSchema), validate: schemas.validateFlowConfig, intellisenseContext: validation.context, onValidationIssues: (counts) => console.log('Validation:', counts), height: 500 }));
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
//# sourceMappingURL=code-box.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-box.stories.js","sourceRoot":"","sources":["../../../src/components/molecules/code-box.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,IAAI,GAAyB;IACjC,SAAS,EAAE,OAAO;IAClB,KAAK,EAAE,mBAAmB;IAC1B,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE;;;;;;;;;;8BAUoB;QAC1B,QAAQ,EAAE,YAAY;QACtB,KAAK,EAAE,aAAa;QACpB,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,KAAK;KAClB;CACF,CAAC;AAEF,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;EAmBnB,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAU;IACtC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,MAAM;QAChB,iBAAiB,EAAE,IAAI;QACvB,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE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& {
|
|
3
|
+
format?: boolean;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* CodeSnippet - Prominent code display for snippets
|
|
7
|
+
*
|
|
8
|
+
* Wraps CodeBox with larger font size and generous padding.
|
|
9
|
+
* Use this for showcasing code examples, one-liners, or small code blocks
|
|
10
|
+
* where you want the code to be more visually prominent than in a standard editor.
|
|
11
|
+
*
|
|
12
|
+
* Always renders without a header. Use CodeBox if you need a header.
|
|
13
|
+
*
|
|
14
|
+
* Default behavior:
|
|
15
|
+
* - Read-only (disabled=true)
|
|
16
|
+
* - Copy button enabled (showCopy=true)
|
|
17
|
+
* - Auto-height with sensible bounds (min: 20px, max: 600px)
|
|
18
|
+
* - Auto-format on mount (format=true) - formats code once on initial load
|
|
19
|
+
*
|
|
20
|
+
* Auto-Formatting:
|
|
21
|
+
* - Enabled by default (format=true)
|
|
22
|
+
* - Runs once on component mount using Monaco's built-in formatters
|
|
23
|
+
* - Supports: JavaScript, TypeScript, JSON, HTML, CSS
|
|
24
|
+
* - Use format={false} to disable for special cases (pre-formatted code)
|
|
25
|
+
*
|
|
26
|
+
* Reuses all CodeBox functionality:
|
|
27
|
+
* - Monaco Editor with syntax highlighting
|
|
28
|
+
* - Grid height management and auto-height modes
|
|
29
|
+
* - Copy button
|
|
30
|
+
* - Theme integration
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Minimal usage - code auto-formats on load
|
|
34
|
+
* <CodeSnippet
|
|
35
|
+
* code="import { elb } from '@walkeros/core';"
|
|
36
|
+
* language="javascript"
|
|
37
|
+
* />
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Disable auto-formatting for pre-formatted code
|
|
41
|
+
* <CodeSnippet
|
|
42
|
+
* code={alreadyFormattedCode}
|
|
43
|
+
* language="javascript"
|
|
44
|
+
* format={false}
|
|
45
|
+
* />
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Override defaults if needed
|
|
49
|
+
* <CodeSnippet
|
|
50
|
+
* code={editableCode}
|
|
51
|
+
* language="javascript"
|
|
52
|
+
* disabled={false}
|
|
53
|
+
* showCopy={false}
|
|
54
|
+
* autoHeight={{ min: 100, max: 800 }}
|
|
55
|
+
* />
|
|
56
|
+
*/
|
|
57
|
+
export declare function CodeSnippet(props: CodeSnippetProps): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
//# sourceMappingURL=code-snippet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-snippet.d.ts","sourceRoot":"","sources":["../../../src/components/molecules/code-snippet.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAGxD,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,YAAY,CAAC,GAAG;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAqClD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { CodeBox } from './code-box';
|
|
4
|
+
import { formatCode } from '../../utils/format-code';
|
|
5
|
+
/**
|
|
6
|
+
* CodeSnippet - Prominent code display for snippets
|
|
7
|
+
*
|
|
8
|
+
* Wraps CodeBox with larger font size and generous padding.
|
|
9
|
+
* Use this for showcasing code examples, one-liners, or small code blocks
|
|
10
|
+
* where you want the code to be more visually prominent than in a standard editor.
|
|
11
|
+
*
|
|
12
|
+
* Always renders without a header. Use CodeBox if you need a header.
|
|
13
|
+
*
|
|
14
|
+
* Default behavior:
|
|
15
|
+
* - Read-only (disabled=true)
|
|
16
|
+
* - Copy button enabled (showCopy=true)
|
|
17
|
+
* - Auto-height with sensible bounds (min: 20px, max: 600px)
|
|
18
|
+
* - Auto-format on mount (format=true) - formats code once on initial load
|
|
19
|
+
*
|
|
20
|
+
* Auto-Formatting:
|
|
21
|
+
* - Enabled by default (format=true)
|
|
22
|
+
* - Runs once on component mount using Monaco's built-in formatters
|
|
23
|
+
* - Supports: JavaScript, TypeScript, JSON, HTML, CSS
|
|
24
|
+
* - Use format={false} to disable for special cases (pre-formatted code)
|
|
25
|
+
*
|
|
26
|
+
* Reuses all CodeBox functionality:
|
|
27
|
+
* - Monaco Editor with syntax highlighting
|
|
28
|
+
* - Grid height management and auto-height modes
|
|
29
|
+
* - Copy button
|
|
30
|
+
* - Theme integration
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Minimal usage - code auto-formats on load
|
|
34
|
+
* <CodeSnippet
|
|
35
|
+
* code="import { elb } from '@walkeros/core';"
|
|
36
|
+
* language="javascript"
|
|
37
|
+
* />
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Disable auto-formatting for pre-formatted code
|
|
41
|
+
* <CodeSnippet
|
|
42
|
+
* code={alreadyFormattedCode}
|
|
43
|
+
* language="javascript"
|
|
44
|
+
* format={false}
|
|
45
|
+
* />
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Override defaults if needed
|
|
49
|
+
* <CodeSnippet
|
|
50
|
+
* code={editableCode}
|
|
51
|
+
* language="javascript"
|
|
52
|
+
* disabled={false}
|
|
53
|
+
* showCopy={false}
|
|
54
|
+
* autoHeight={{ min: 100, max: 800 }}
|
|
55
|
+
* />
|
|
56
|
+
*/
|
|
57
|
+
export function CodeSnippet(props) {
|
|
58
|
+
const { code, language = 'javascript', className, disabled = true, showCopy = true, autoHeight = { min: 20, max: 600 }, fontSize = 15, format = true, ...rest } = props;
|
|
59
|
+
const snippetClassName = `elb-code-snippet ${className || ''}`.trim();
|
|
60
|
+
const [formattedCode, setFormattedCode] = useState(code);
|
|
61
|
+
// Format code on mount
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (format && code) {
|
|
64
|
+
formatCode(code, language).then(setFormattedCode);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
setFormattedCode(code);
|
|
68
|
+
}
|
|
69
|
+
}, [code, language, format]);
|
|
70
|
+
return (_jsx(CodeBox, { ...rest, code: formattedCode, language: language, className: snippetClassName, showHeader: false, disabled: disabled, showCopy: showCopy, autoHeight: autoHeight, fontSize: fontSize }));
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=code-snippet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-snippet.js","sourceRoot":"","sources":["../../../src/components/molecules/code-snippet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAqB,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAMrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,EACJ,IAAI,EACJ,QAAQ,GAAG,YAAY,EACvB,SAAS,EACT,QAAQ,GAAG,IAAI,EACf,QAAQ,GAAG,IAAI,EACf,UAAU,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAClC,QAAQ,GAAG,EAAE,EACb,MAAM,GAAG,IAAI,EACb,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IACV,MAAM,gBAAgB,GAAG,oBAAoB,SAAS,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IACtE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEzD,uBAAuB;IACvB,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACN,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAE7B,OAAO,CACL,KAAC,OAAO,OACF,IAAI,EACR,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,gBAAgB,EAC3B,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { CodeSnippet } from './code-snippet';
|
|
3
|
+
declare const meta: Meta<typeof CodeSnippet>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof CodeSnippet>;
|
|
6
|
+
export declare const OneLine: Story;
|
|
7
|
+
export declare const MultiLine: Story;
|
|
8
|
+
/**
|
|
9
|
+
* Auto-Formatting Demo - Badly formatted code gets auto-formatted on mount
|
|
10
|
+
*/
|
|
11
|
+
export declare const AutoFormatEnabled: Story;
|
|
12
|
+
/**
|
|
13
|
+
* JSON Auto-Formatting - Badly formatted JSON gets auto-formatted
|
|
14
|
+
*/
|
|
15
|
+
export declare const JSONFormatting: Story;
|
|
16
|
+
/**
|
|
17
|
+
* Bare Object Formatting - JS object literals without assignment
|
|
18
|
+
*
|
|
19
|
+
* This is common in docs where event results are shown as plain objects.
|
|
20
|
+
* Previously these were not indented because Prettier couldn't parse them.
|
|
21
|
+
*/
|
|
22
|
+
export declare const BareObjectFormatting: Story;
|
|
23
|
+
//# sourceMappingURL=code-snippet.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-snippet.stories.d.ts","sourceRoot":"","sources":["../../../src/components/molecules/code-snippet.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAUlC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAmBvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAK/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAK5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAsBlC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { CodeSnippet } from './code-snippet';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Molecules/CodeSnippet',
|
|
4
|
+
component: CodeSnippet,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
argTypes: {
|
|
7
|
+
language: {
|
|
8
|
+
control: 'select',
|
|
9
|
+
options: ['javascript', 'typescript', 'json', 'html', 'css'],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
export const OneLine = {
|
|
15
|
+
args: {
|
|
16
|
+
code: "import { getAttribute, sendWeb, sessionStart } from '@walkeros/web-core';",
|
|
17
|
+
language: 'javascript',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export const MultiLine = {
|
|
21
|
+
args: {
|
|
22
|
+
code: `export async function setupGA4Complete() {
|
|
23
|
+
const { collector, elb } = await startFlow({
|
|
24
|
+
destinations: {
|
|
25
|
+
gtag: {
|
|
26
|
+
...destinationGtag,
|
|
27
|
+
config: {
|
|
28
|
+
settings: {
|
|
29
|
+
ga4: { measurementId: 'G-XXXXXXXXXX' },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
return { collector, elb };
|
|
36
|
+
}`,
|
|
37
|
+
language: 'javascript',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Auto-Formatting Demo - Badly formatted code gets auto-formatted on mount
|
|
42
|
+
*/
|
|
43
|
+
export const AutoFormatEnabled = {
|
|
44
|
+
args: {
|
|
45
|
+
code: `function example(){const x={a:1,b:2,c:3};if(x.a===1){return x.b+x.c;}return 0;}`,
|
|
46
|
+
language: 'javascript',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* JSON Auto-Formatting - Badly formatted JSON gets auto-formatted
|
|
51
|
+
*/
|
|
52
|
+
export const JSONFormatting = {
|
|
53
|
+
args: {
|
|
54
|
+
code: `{"entity":"product","action":"view","data":{"id":"P123","name":"Laptop","price":999},"context":{"stage":["shopping",1]}}`,
|
|
55
|
+
language: 'json',
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Bare Object Formatting - JS object literals without assignment
|
|
60
|
+
*
|
|
61
|
+
* This is common in docs where event results are shown as plain objects.
|
|
62
|
+
* Previously these were not indented because Prettier couldn't parse them.
|
|
63
|
+
*/
|
|
64
|
+
export const BareObjectFormatting = {
|
|
65
|
+
args: {
|
|
66
|
+
code: `{
|
|
67
|
+
name: 'promotion view',
|
|
68
|
+
data: {
|
|
69
|
+
name: 'Setting up tracking easily',
|
|
70
|
+
category: 'analytics',
|
|
71
|
+
},
|
|
72
|
+
context: {
|
|
73
|
+
test: ['engagement', 0]
|
|
74
|
+
},
|
|
75
|
+
globals: {
|
|
76
|
+
language: 'en'
|
|
77
|
+
},
|
|
78
|
+
nested: [],
|
|
79
|
+
consent: { functional: true },
|
|
80
|
+
trigger: 'visible',
|
|
81
|
+
entity: 'promotion',
|
|
82
|
+
action: 'view',
|
|
83
|
+
}`,
|
|
84
|
+
language: 'javascript',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=code-snippet.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-snippet.stories.js","sourceRoot":"","sources":["../../../src/components/molecules/code-snippet.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,IAAI,GAA6B;IACrC,KAAK,EAAE,uBAAuB;IAC9B,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;SAC7D;KACF;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,2EAA2E;QACjF,QAAQ,EAAE,YAAY;KACvB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAU;IAC9B,IAAI,EAAE;QACJ,IAAI,EAAE;;;;;;;;;;;;;;EAcR;QACE,QAAQ,EAAE,YAAY;KACvB;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAU;IACtC,IAAI,EAAE;QACJ,IAAI,EAAE,iFAAiF;QACvF,QAAQ,EAAE,YAAY;KACvB;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAU;IACnC,IAAI,EAAE;QACJ,IAAI,EAAE,0HAA0H;QAChI,QAAQ,EAAE,MAAM;KACjB;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAU;IACzC,IAAI,EAAE;QACJ,IAAI,EAAE;;;;;;;;;;;;;;;;;EAiBR;QACE,QAAQ,EAAE,YAAY;KACvB;CACF,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DropdownProps {
|
|
3
|
+
/** Trigger element (button, link, etc.) */
|
|
4
|
+
trigger: React.ReactNode;
|
|
5
|
+
/** Whether dropdown is open (controlled) */
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
/** Toggle handler */
|
|
8
|
+
onToggle: () => void;
|
|
9
|
+
/** Dropdown content */
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
/** Alignment of dropdown panel */
|
|
12
|
+
align?: 'left' | 'right';
|
|
13
|
+
/** ARIA label for accessibility */
|
|
14
|
+
ariaLabel?: string;
|
|
15
|
+
/** Additional CSS class */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface DropdownItemProps {
|
|
19
|
+
/** Item content */
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
/** Click handler */
|
|
22
|
+
onClick?: () => void;
|
|
23
|
+
/** Disabled state */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** Visual variant */
|
|
26
|
+
variant?: 'default' | 'danger';
|
|
27
|
+
/** Additional CSS class */
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface DropdownDividerProps {
|
|
31
|
+
/** Additional CSS class */
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Dropdown - Generic dropdown container (UI only)
|
|
36
|
+
*
|
|
37
|
+
* Pure UI component for dropdown menus.
|
|
38
|
+
* Click-outside and keyboard handling should be implemented in the parent
|
|
39
|
+
* via hooks like useDropdown.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* <Dropdown
|
|
43
|
+
* trigger={<button>Menu</button>}
|
|
44
|
+
* isOpen={isOpen}
|
|
45
|
+
* onToggle={toggle}
|
|
46
|
+
* align="right"
|
|
47
|
+
* >
|
|
48
|
+
* <DropdownItem onClick={handleAction}>Action</DropdownItem>
|
|
49
|
+
* <DropdownDivider />
|
|
50
|
+
* <DropdownItem onClick={handleLogout} variant="danger">Logout</DropdownItem>
|
|
51
|
+
* </Dropdown>
|
|
52
|
+
*/
|
|
53
|
+
export declare function Dropdown({ trigger, isOpen, onToggle, children, align, ariaLabel, className, }: DropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
/**
|
|
55
|
+
* DropdownItem - Menu item within a dropdown
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* <DropdownItem onClick={handleClick}>Action</DropdownItem>
|
|
59
|
+
*/
|
|
60
|
+
export declare function DropdownItem({ children, onClick, disabled, variant, className, }: DropdownItemProps): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
/**
|
|
62
|
+
* DropdownDivider - Visual separator between menu items
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* <DropdownDivider />
|
|
66
|
+
*/
|
|
67
|
+
export declare function DropdownDivider({ className }: DropdownDividerProps): import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
//# sourceMappingURL=dropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/molecules/dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,4CAA4C;IAC5C,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,uBAAuB;IACvB,QAAQ,EAAE,KAAK,CAAC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