@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,88 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
function schemaToProperties(schema) {
|
|
4
|
+
const properties = [];
|
|
5
|
+
const required = schema.required || [];
|
|
6
|
+
if (!schema.properties) {
|
|
7
|
+
return properties;
|
|
8
|
+
}
|
|
9
|
+
for (const [name, prop] of Object.entries(schema.properties)) {
|
|
10
|
+
const property = prop;
|
|
11
|
+
let type = property.type || 'any';
|
|
12
|
+
if (property.enum) {
|
|
13
|
+
type = property.enum
|
|
14
|
+
.map((v) => `'${v}'`)
|
|
15
|
+
.join(' | ');
|
|
16
|
+
}
|
|
17
|
+
if (type === 'array' && property.items) {
|
|
18
|
+
const items = property.items;
|
|
19
|
+
if (items.enum) {
|
|
20
|
+
type = `Array<${items.enum.map((v) => `'${v}'`).join(' | ')}>`;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
type = `Array<${items.type || 'any'}>`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (type === 'object' && property.additionalProperties) {
|
|
27
|
+
const addProps = property.additionalProperties;
|
|
28
|
+
const valueType = addProps.type || 'any';
|
|
29
|
+
type = `Record<string, ${valueType}>`;
|
|
30
|
+
}
|
|
31
|
+
if (property.anyOf || property.oneOf) {
|
|
32
|
+
const variants = (property.anyOf || property.oneOf);
|
|
33
|
+
type = variants.map((v) => v.type || 'any').join(' | ');
|
|
34
|
+
}
|
|
35
|
+
let description = property.description || '';
|
|
36
|
+
let example;
|
|
37
|
+
const exampleMatch = description.match(/\(like\s+(.+?)\)$/);
|
|
38
|
+
if (exampleMatch) {
|
|
39
|
+
example = exampleMatch[1];
|
|
40
|
+
description = description.replace(/\s*\(like\s+.+?\)$/, '');
|
|
41
|
+
}
|
|
42
|
+
if (type === 'any' && description.toLowerCase().includes('function')) {
|
|
43
|
+
type = 'function';
|
|
44
|
+
}
|
|
45
|
+
properties.push({
|
|
46
|
+
name,
|
|
47
|
+
type,
|
|
48
|
+
description,
|
|
49
|
+
required: required.includes(name),
|
|
50
|
+
default: property.default !== undefined ? String(property.default) : undefined,
|
|
51
|
+
example,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return properties;
|
|
55
|
+
}
|
|
56
|
+
function PropertyModal({ property, isOpen, onClose }) {
|
|
57
|
+
if (!isOpen || !property)
|
|
58
|
+
return null;
|
|
59
|
+
const handleBackdropClick = (e) => {
|
|
60
|
+
if (e.target === e.currentTarget) {
|
|
61
|
+
onClose();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return (_jsx("div", { className: "elb-property-table__modal-backdrop", onClick: handleBackdropClick, children: _jsxs("div", { className: "elb-property-table__modal-content", children: [_jsxs("div", { className: "elb-property-table__modal-header", children: [_jsxs("h3", { className: "elb-property-table__modal-title", children: [_jsx("code", { className: "elb-property-table__modal-property-name", children: property.name }), property.required && (_jsx("span", { className: "elb-property-table__required-icon", children: "*" }))] }), _jsx("button", { className: "elb-property-table__close-button", onClick: onClose, "aria-label": "Close", children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }) })] }), _jsxs("div", { className: "elb-property-table__modal-body", children: [_jsxs("div", { className: "elb-property-table__modal-row", children: [_jsx("span", { className: "elb-property-table__modal-label", children: "Type:" }), _jsx("code", { className: "elb-property-table__modal-type elb-property-table__modal-type--wrap", children: property.type })] }), property.description && (_jsxs("div", { className: "elb-property-table__modal-row", children: [_jsx("span", { className: "elb-property-table__modal-label", children: "Description:" }), _jsx("p", { className: "elb-property-table__modal-description", children: property.description })] })), property.default && (_jsxs("div", { className: "elb-property-table__modal-row", children: [_jsx("span", { className: "elb-property-table__modal-label", children: "Default:" }), _jsx("code", { className: "elb-property-table__modal-default", children: property.default })] })), property.example && (_jsxs("div", { className: "elb-property-table__modal-row", children: [_jsx("span", { className: "elb-property-table__modal-label", children: "Example:" }), _jsx("code", { className: "elb-property-table__modal-example", children: property.example })] }))] })] }) }));
|
|
65
|
+
}
|
|
66
|
+
export function PropertyTable({ schema, className }) {
|
|
67
|
+
const [selectedProperty, setSelectedProperty] = useState(null);
|
|
68
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
69
|
+
const properties = schemaToProperties(schema);
|
|
70
|
+
const hasRequiredProperties = properties.some((property) => property.required);
|
|
71
|
+
const TYPE_MAX_LENGTH = 30;
|
|
72
|
+
const isTruncated = (type) => type.length > TYPE_MAX_LENGTH;
|
|
73
|
+
const truncateType = (type) => {
|
|
74
|
+
if (type.length <= TYPE_MAX_LENGTH)
|
|
75
|
+
return type;
|
|
76
|
+
return type.slice(0, TYPE_MAX_LENGTH);
|
|
77
|
+
};
|
|
78
|
+
const openModal = (property) => {
|
|
79
|
+
setSelectedProperty(property);
|
|
80
|
+
setIsModalOpen(true);
|
|
81
|
+
};
|
|
82
|
+
const closeModal = () => {
|
|
83
|
+
setIsModalOpen(false);
|
|
84
|
+
setSelectedProperty(null);
|
|
85
|
+
};
|
|
86
|
+
return (_jsxs("div", { className: `elb-explorer ${className || ''}`, children: [_jsx("div", { className: "elb-property-table__container", children: _jsxs("table", { className: "elb-property-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Property" }), _jsx("th", { children: "Type" }), _jsx("th", { children: "Description" }), _jsx("th", { children: "More" })] }) }), _jsx("tbody", { children: properties.map((property, index) => (_jsxs("tr", { children: [_jsx("td", { className: "elb-property-table__property-cell", "data-label": "Property", children: _jsxs("code", { className: "elb-property-table__property-name", children: [property.name, property.required && (_jsx("span", { className: "elb-property-table__required-icon", children: "*" }))] }) }), _jsx("td", { className: "elb-property-table__type-cell", "data-label": "Type", children: isTruncated(property.type) ? (_jsx("button", { className: "elb-property-table__type-button", onClick: () => openModal(property), "aria-label": `View full type for ${property.name}`, children: _jsx("code", { className: "elb-property-table__property-type elb-property-table__property-type--truncated", children: truncateType(property.type) }) })) : (_jsx("code", { className: "elb-property-table__property-type", children: property.type })) }), _jsx("td", { className: "elb-property-table__description", "data-label": "Description", children: property.description }), _jsx("td", { className: "elb-property-table__action-cell", "data-label": "More", children: _jsx("button", { className: "elb-property-table__more-button", onClick: () => openModal(property), "aria-label": `More info about ${property.name}`, children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("line", { x1: "12", y1: "16", x2: "12", y2: "12" }), _jsx("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })] }) }) })] }, index))) })] }) }), hasRequiredProperties && (_jsxs("div", { className: "elb-property-table__required-notice", children: [_jsx("span", { className: "elb-property-table__required-icon", children: "*" }), " Required fields"] })), _jsx(PropertyModal, { property: selectedProperty, isOpen: isModalOpen, onClose: closeModal })] }));
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=property-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-table.js","sourceRoot":"","sources":["../../../src/components/molecules/property-table.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAuBxC,SAAS,kBAAkB,CAAC,MAAkB;IAC5C,MAAM,UAAU,GAAe,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAI,MAAM,CAAC,QAAqB,IAAI,EAAE,CAAC;IAErD,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACvB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7D,MAAM,QAAQ,GAAG,IAA+B,CAAC;QAEjD,IAAI,IAAI,GAAI,QAAQ,CAAC,IAAe,IAAI,KAAK,CAAC;QAE9C,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;YAClB,IAAI,GAAI,QAAQ,CAAC,IAAkB;iBAChC,GAAG,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;iBAC7B,IAAI,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;QAED,IAAI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AC,EAAE,EAAC,IAAI,GAAG,EACxC,eAAM,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,OAAO,EAAC,EAAE,EAAC,GAAG,GAAG,IACrC,GACC,GACN,KA7DE,KAAK,CA8DT,CACN,CAAC,GACI,IACF,GACJ,EACL,qBAAqB,IAAI,CACxB,eAAK,SAAS,EAAC,qCAAqC,aAClD,eAAM,SAAS,EAAC,mCAAmC,kBAAS,wBAExD,CACP,EACD,KAAC,aAAa,IACZ,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,UAAU,GACnB,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { PropertyTable } from './property-table';
|
|
3
|
+
/**
|
|
4
|
+
* PropertyTable - Schema-based property documentation table
|
|
5
|
+
*
|
|
6
|
+
* Generates a documentation table from a JSON Schema showing properties,
|
|
7
|
+
* types, descriptions, defaults, and required fields. Click on a row to
|
|
8
|
+
* see full property details in a modal.
|
|
9
|
+
*/
|
|
10
|
+
declare const meta: Meta<typeof PropertyTable>;
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof PropertyTable>;
|
|
13
|
+
/**
|
|
14
|
+
* Default property table with various data types
|
|
15
|
+
*
|
|
16
|
+
* Demonstrates different schema types:
|
|
17
|
+
* - Required fields (marked with *)
|
|
18
|
+
* - Enum types
|
|
19
|
+
* - Arrays with typed items
|
|
20
|
+
* - Objects with additionalProperties
|
|
21
|
+
* - Union types (anyOf)
|
|
22
|
+
*/
|
|
23
|
+
export declare const Default: Story;
|
|
24
|
+
//# sourceMappingURL=property-table.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-table.stories.d.ts","sourceRoot":"","sources":["../../../src/components/molecules/property-table.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;;GAMG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAIpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AA2D5C;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { PropertyTable } from './property-table';
|
|
2
|
+
/**
|
|
3
|
+
* PropertyTable - Schema-based property documentation table
|
|
4
|
+
*
|
|
5
|
+
* Generates a documentation table from a JSON Schema showing properties,
|
|
6
|
+
* types, descriptions, defaults, and required fields. Click on a row to
|
|
7
|
+
* see full property details in a modal.
|
|
8
|
+
*/
|
|
9
|
+
const meta = {
|
|
10
|
+
component: PropertyTable,
|
|
11
|
+
title: 'Molecules/PropertyTable',
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
const exampleSchema = {
|
|
16
|
+
type: 'object',
|
|
17
|
+
required: ['apiKey', 'region'],
|
|
18
|
+
properties: {
|
|
19
|
+
apiKey: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Your API authentication key for the service',
|
|
22
|
+
},
|
|
23
|
+
region: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
enum: ['us-east-1', 'eu-west-1', 'ap-south-1'],
|
|
26
|
+
description: 'Geographic region for data processing',
|
|
27
|
+
default: 'us-east-1',
|
|
28
|
+
},
|
|
29
|
+
timeout: {
|
|
30
|
+
type: 'number',
|
|
31
|
+
description: 'Request timeout in milliseconds (like 5000)',
|
|
32
|
+
default: '3000',
|
|
33
|
+
},
|
|
34
|
+
retryAttempts: {
|
|
35
|
+
type: 'number',
|
|
36
|
+
description: 'Number of retry attempts on failure',
|
|
37
|
+
default: '3',
|
|
38
|
+
},
|
|
39
|
+
enableDebug: {
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
description: 'Enable verbose debug logging',
|
|
42
|
+
default: 'false',
|
|
43
|
+
},
|
|
44
|
+
tags: {
|
|
45
|
+
type: 'array',
|
|
46
|
+
items: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
},
|
|
49
|
+
description: 'Custom tags for categorization (like analytics, marketing)',
|
|
50
|
+
},
|
|
51
|
+
metadata: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
additionalProperties: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
},
|
|
56
|
+
description: 'Additional key-value metadata',
|
|
57
|
+
},
|
|
58
|
+
endpoints: {
|
|
59
|
+
type: 'array',
|
|
60
|
+
items: {
|
|
61
|
+
enum: ['tracking', 'analytics', 'conversion'],
|
|
62
|
+
},
|
|
63
|
+
description: 'Enabled API endpoints',
|
|
64
|
+
},
|
|
65
|
+
mode: {
|
|
66
|
+
anyOf: [{ type: 'string' }, { type: 'number' }],
|
|
67
|
+
description: 'Operation mode - can be string identifier or numeric code',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Default property table with various data types
|
|
73
|
+
*
|
|
74
|
+
* Demonstrates different schema types:
|
|
75
|
+
* - Required fields (marked with *)
|
|
76
|
+
* - Enum types
|
|
77
|
+
* - Arrays with typed items
|
|
78
|
+
* - Objects with additionalProperties
|
|
79
|
+
* - Union types (anyOf)
|
|
80
|
+
*/
|
|
81
|
+
export const Default = {
|
|
82
|
+
args: {
|
|
83
|
+
schema: exampleSchema,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=property-table.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-table.stories.js","sourceRoot":"","sources":["../../../src/components/molecules/property-table.stories.tsx"],"names":[],"mappings":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WAAW,EAAE,uBAAuB;SACrC;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YAC/C,WAAW,EAAE,2DAA2D;SACzE;KACF;CACF,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,MAAM,EAAE,aAAa;KACtB;CACF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface BrowserBoxProps {
|
|
2
|
+
html?: string;
|
|
3
|
+
css?: string;
|
|
4
|
+
js?: string;
|
|
5
|
+
onHtmlChange?: (value: string) => void;
|
|
6
|
+
onCssChange?: (value: string) => void;
|
|
7
|
+
onJsChange?: (value: string) => void;
|
|
8
|
+
showPreview?: boolean;
|
|
9
|
+
label?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
initialTab?: 'preview' | 'html' | 'css' | 'js';
|
|
12
|
+
lineNumbers?: boolean;
|
|
13
|
+
wordWrap?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* BrowserBox - Code editor with HTML/CSS/JS toggle
|
|
17
|
+
*
|
|
18
|
+
* Displays code editor with button group to switch between HTML, CSS, and JavaScript.
|
|
19
|
+
* Only shows tabs for content that is provided.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <BrowserBox
|
|
23
|
+
* html={htmlCode}
|
|
24
|
+
* css={cssCode}
|
|
25
|
+
* onHtmlChange={setHtml}
|
|
26
|
+
* onCssChange={setCss}
|
|
27
|
+
* label="Code"
|
|
28
|
+
* />
|
|
29
|
+
*/
|
|
30
|
+
export declare function BrowserBox({ html, css, js, onHtmlChange, onCssChange, onJsChange, showPreview, label, className, initialTab, lineNumbers, wordWrap, }: BrowserBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
//# sourceMappingURL=browser-box.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-box.d.ts","sourceRoot":"","sources":["../../../src/components/organisms/browser-box.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,GAAG,EACH,EAAE,EACF,YAAY,EACZ,WAAW,EACX,UAAU,EACV,WAAkB,EAClB,KAAc,EACd,SAAc,EACd,UAAU,EACV,WAAmB,EACnB,QAAgB,GACjB,EAAE,eAAe,2CAqFjB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo } from 'react';
|
|
3
|
+
import { Box } from '../atoms/box';
|
|
4
|
+
import { ButtonGroup } from '../atoms/button-group';
|
|
5
|
+
import { Preview } from '../molecules/preview';
|
|
6
|
+
import { Code } from '../atoms/code';
|
|
7
|
+
/**
|
|
8
|
+
* BrowserBox - Code editor with HTML/CSS/JS toggle
|
|
9
|
+
*
|
|
10
|
+
* Displays code editor with button group to switch between HTML, CSS, and JavaScript.
|
|
11
|
+
* Only shows tabs for content that is provided.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <BrowserBox
|
|
15
|
+
* html={htmlCode}
|
|
16
|
+
* css={cssCode}
|
|
17
|
+
* onHtmlChange={setHtml}
|
|
18
|
+
* onCssChange={setCss}
|
|
19
|
+
* label="Code"
|
|
20
|
+
* />
|
|
21
|
+
*/
|
|
22
|
+
export function BrowserBox({ html, css, js, onHtmlChange, onCssChange, onJsChange, showPreview = true, label = 'Code', className = '', initialTab, lineNumbers = false, wordWrap = false, }) {
|
|
23
|
+
// Determine available tabs
|
|
24
|
+
const availableTabs = useMemo(() => {
|
|
25
|
+
const tabs = [];
|
|
26
|
+
if (showPreview && html !== undefined)
|
|
27
|
+
tabs.push({ label: 'Preview', value: 'preview' });
|
|
28
|
+
if (html !== undefined)
|
|
29
|
+
tabs.push({ label: 'HTML', value: 'html' });
|
|
30
|
+
if (css !== undefined)
|
|
31
|
+
tabs.push({ label: 'CSS', value: 'css' });
|
|
32
|
+
if (js !== undefined)
|
|
33
|
+
tabs.push({ label: 'JS', value: 'js' });
|
|
34
|
+
return tabs;
|
|
35
|
+
}, [html, css, js, showPreview]);
|
|
36
|
+
// Set initial active tab
|
|
37
|
+
const [activeTab, setActiveTab] = useState(() => {
|
|
38
|
+
if (initialTab && availableTabs.some((t) => t.value === initialTab)) {
|
|
39
|
+
return initialTab;
|
|
40
|
+
}
|
|
41
|
+
return availableTabs[0]?.value || 'preview';
|
|
42
|
+
});
|
|
43
|
+
// Get current content and language
|
|
44
|
+
const { content, language, onChange } = useMemo(() => {
|
|
45
|
+
switch (activeTab) {
|
|
46
|
+
case 'html':
|
|
47
|
+
return {
|
|
48
|
+
content: html || '',
|
|
49
|
+
language: 'html',
|
|
50
|
+
onChange: onHtmlChange,
|
|
51
|
+
};
|
|
52
|
+
case 'css':
|
|
53
|
+
return {
|
|
54
|
+
content: css || '',
|
|
55
|
+
language: 'css',
|
|
56
|
+
onChange: onCssChange,
|
|
57
|
+
};
|
|
58
|
+
case 'js':
|
|
59
|
+
return {
|
|
60
|
+
content: js || '',
|
|
61
|
+
language: 'javascript',
|
|
62
|
+
onChange: onJsChange,
|
|
63
|
+
};
|
|
64
|
+
default:
|
|
65
|
+
return {
|
|
66
|
+
content: '',
|
|
67
|
+
language: 'text',
|
|
68
|
+
onChange: undefined,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}, [activeTab, html, css, js, onHtmlChange, onCssChange, onJsChange]);
|
|
72
|
+
// Build button group data
|
|
73
|
+
const buttons = useMemo(() => availableTabs.map((tab) => ({
|
|
74
|
+
label: tab.label,
|
|
75
|
+
value: tab.value,
|
|
76
|
+
active: activeTab === tab.value,
|
|
77
|
+
})), [availableTabs, activeTab]);
|
|
78
|
+
return (_jsx(Box, { header: label, headerActions: availableTabs.length > 1 ? (_jsx(ButtonGroup, { buttons: buttons, onButtonClick: setActiveTab })) : null, className: className, children: activeTab === 'preview' ? (_jsx(Preview, { html: html || '', css: css || '' })) : (_jsx(Code, { code: content, language: language, onChange: onChange, disabled: !onChange, lineNumbers: lineNumbers, wordWrap: wordWrap })) }));
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=browser-box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-box.js","sourceRoot":"","sources":["../../../src/components/organisms/browser-box.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAiBrC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,UAAU,CAAC,EACz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AAC,CACzB,KAAC,WAAW,IAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,GAAI,CAC/D,CAAC,CAAC,CAAC,IAAI,EAEV,SAAS,EAAE,SAAS,YAEnB,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,CACzB,KAAC,OAAO,IAAC,IAAI,EAAE,IAAI,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAI,CAC9C,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IACH,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,CAAC,QAAQ,EACnB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GAClB,CACH,GACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { BrowserBox } from './browser-box';
|
|
3
|
+
/**
|
|
4
|
+
* BrowserBox - Multi-tab HTML/CSS/JS editor with live preview
|
|
5
|
+
*
|
|
6
|
+
* Tabbed code editor that shows:
|
|
7
|
+
* - Live preview of HTML
|
|
8
|
+
* - HTML editor
|
|
9
|
+
* - CSS editor
|
|
10
|
+
* - JavaScript editor (when provided)
|
|
11
|
+
*
|
|
12
|
+
* Tabs are automatically hidden if content isn't provided.
|
|
13
|
+
*/
|
|
14
|
+
declare const meta: Meta<typeof BrowserBox>;
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof BrowserBox>;
|
|
17
|
+
/**
|
|
18
|
+
* Default browser box with HTML and CSS
|
|
19
|
+
*
|
|
20
|
+
* Shows a product card with:
|
|
21
|
+
* - Preview tab (live render)
|
|
22
|
+
* - HTML tab (editable source)
|
|
23
|
+
* - CSS tab (editable styles)
|
|
24
|
+
*/
|
|
25
|
+
export declare const Default: Story;
|
|
26
|
+
//# sourceMappingURL=browser-box.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-box.stories.d.ts","sourceRoot":"","sources":["../../../src/components/organisms/browser-box.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAOjC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC;AAmEzC;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { BrowserBox } from './browser-box';
|
|
2
|
+
/**
|
|
3
|
+
* BrowserBox - Multi-tab HTML/CSS/JS editor with live preview
|
|
4
|
+
*
|
|
5
|
+
* Tabbed code editor that shows:
|
|
6
|
+
* - Live preview of HTML
|
|
7
|
+
* - HTML editor
|
|
8
|
+
* - CSS editor
|
|
9
|
+
* - JavaScript editor (when provided)
|
|
10
|
+
*
|
|
11
|
+
* Tabs are automatically hidden if content isn't provided.
|
|
12
|
+
*/
|
|
13
|
+
const meta = {
|
|
14
|
+
component: BrowserBox,
|
|
15
|
+
title: 'Organisms/BrowserBox',
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: 'fullscreen',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
const sampleHtml = `<div class="product-card">
|
|
23
|
+
<div class="product-header">
|
|
24
|
+
<h2 class="product-title">Everyday Ruck Snack</h2>
|
|
25
|
+
<span class="product-badge">New</span>
|
|
26
|
+
</div>
|
|
27
|
+
<p class="product-price">€ 2.50</p>
|
|
28
|
+
<button class="product-button">Add to Cart</button>
|
|
29
|
+
</div>`;
|
|
30
|
+
const sampleCss = `
|
|
31
|
+
.product-card {
|
|
32
|
+
width: 300px;
|
|
33
|
+
padding: 20px;
|
|
34
|
+
background: white;
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
37
|
+
font-family: -apple-system, sans-serif;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.product-header {
|
|
41
|
+
display: flex;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
align-items: center;
|
|
44
|
+
margin-bottom: 16px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.product-title {
|
|
48
|
+
margin: 0;
|
|
49
|
+
font-size: 1.25rem;
|
|
50
|
+
color: #1f2937;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.product-badge {
|
|
54
|
+
background: #3b82f6;
|
|
55
|
+
color: white;
|
|
56
|
+
padding: 4px 12px;
|
|
57
|
+
border-radius: 12px;
|
|
58
|
+
font-size: 0.75rem;
|
|
59
|
+
font-weight: 600;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.product-price {
|
|
63
|
+
font-size: 1.5rem;
|
|
64
|
+
font-weight: 700;
|
|
65
|
+
color: #1f2937;
|
|
66
|
+
margin: 0 0 16px 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.product-button {
|
|
70
|
+
width: 100%;
|
|
71
|
+
padding: 12px;
|
|
72
|
+
background: #3b82f6;
|
|
73
|
+
color: white;
|
|
74
|
+
border: none;
|
|
75
|
+
border-radius: 6px;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
transition: background 0.2s;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.product-button:hover {
|
|
82
|
+
background: #2563eb;
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
/**
|
|
86
|
+
* Default browser box with HTML and CSS
|
|
87
|
+
*
|
|
88
|
+
* Shows a product card with:
|
|
89
|
+
* - Preview tab (live render)
|
|
90
|
+
* - HTML tab (editable source)
|
|
91
|
+
* - CSS tab (editable styles)
|
|
92
|
+
*/
|
|
93
|
+
export const Default = {
|
|
94
|
+
args: {
|
|
95
|
+
html: sampleHtml,
|
|
96
|
+
css: sampleCss,
|
|
97
|
+
showPreview: true,
|
|
98
|
+
label: 'Code',
|
|
99
|
+
initialTab: 'preview',
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=browser-box.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-box.stories.js","sourceRoot":"","sources":["../../../src/components/organisms/browser-box.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,IAAI,GAA4B;IACpC,SAAS,EAAE,UAAU;IACrB,KAAK,EAAE,sBAAsB;IAC7B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,YAAY;KACrB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,UAAU,GAAG;;;;;;;OAOZ,CAAC;AAER,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDjB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,SAAS;QACd,WAAW,EAAE,IAAI;QACjB,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,SAAS;KACtB;CACF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DestinationCode } from '../../helpers/destinations';
|
|
2
|
+
export interface CollectorBoxProps {
|
|
3
|
+
event: string;
|
|
4
|
+
mapping: string;
|
|
5
|
+
destination: DestinationCode;
|
|
6
|
+
label?: string;
|
|
7
|
+
wordWrap?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* CollectorBox - Runs a collector with destination to transform events
|
|
11
|
+
*
|
|
12
|
+
* Takes raw event and mapping config, processes through collector pipeline,
|
|
13
|
+
* and displays the formatted destination output.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <CollectorBox
|
|
17
|
+
* event={JSON.stringify(event)}
|
|
18
|
+
* mapping={mappingConfig}
|
|
19
|
+
* destination={createGtagDestination()}
|
|
20
|
+
* label="Result"
|
|
21
|
+
* />
|
|
22
|
+
*/
|
|
23
|
+
export declare function CollectorBox({ event, mapping, destination, label, wordWrap, }: CollectorBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=collector-box.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collector-box.d.ts","sourceRoot":"","sources":["../../../src/components/organisms/collector-box.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,eAAe,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,OAAO,EACP,WAAW,EACX,KAAgB,EAChB,QAAgB,GACjB,EAAE,iBAAiB,2CAgDnB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { startFlow } from '@walkeros/collector';
|
|
4
|
+
import { CodeBox } from '../molecules/code-box';
|
|
5
|
+
/**
|
|
6
|
+
* CollectorBox - Runs a collector with destination to transform events
|
|
7
|
+
*
|
|
8
|
+
* Takes raw event and mapping config, processes through collector pipeline,
|
|
9
|
+
* and displays the formatted destination output.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <CollectorBox
|
|
13
|
+
* event={JSON.stringify(event)}
|
|
14
|
+
* mapping={mappingConfig}
|
|
15
|
+
* destination={createGtagDestination()}
|
|
16
|
+
* label="Result"
|
|
17
|
+
* />
|
|
18
|
+
*/
|
|
19
|
+
export function CollectorBox({ event, mapping, destination, label = 'Result', wordWrap = false, }) {
|
|
20
|
+
const [output, setOutput] = useState('// Click elements in the preview to see function call');
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
(async () => {
|
|
23
|
+
try {
|
|
24
|
+
// Parse inputs
|
|
25
|
+
const eventObj = JSON.parse(event);
|
|
26
|
+
const mappingObj = JSON.parse(mapping);
|
|
27
|
+
// Create collector with destination
|
|
28
|
+
const { collector } = await startFlow({
|
|
29
|
+
destinations: {
|
|
30
|
+
demo: {
|
|
31
|
+
code: destination,
|
|
32
|
+
config: {
|
|
33
|
+
mapping: mappingObj,
|
|
34
|
+
},
|
|
35
|
+
env: {
|
|
36
|
+
elb: setOutput,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
// Push event through collector → destination
|
|
42
|
+
await collector.push(eventObj);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error instanceof Error) {
|
|
46
|
+
setOutput(`// Error: ${error.message}`);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
setOutput(`// Error: ${String(error)}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
})();
|
|
53
|
+
}, [event, mapping, destination]);
|
|
54
|
+
return (_jsx(CodeBox, { code: output, language: "javascript", disabled: true, label: label, wordWrap: wordWrap }));
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=collector-box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collector-box.js","sourceRoot":"","sources":["../../../src/components/organisms/collector-box.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAUhD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,KAAK,EACL,OAAO,EACP,WAAW,EACX,KAAK,GAAG,QAAQ,EAChB,QAAQ,GAAG,KAAK,GACE;IAClB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAClC,uDAAuD,CACxD,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,CAAC,KAAK,IAAI,EAAE;YACV,IAAI,CAAC;gBACH,eAAe;gBACf,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACnC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAEvC,oCAAoC;gBACpC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,SAAS,CAAC;oBACpC,YAAY,EAAE;wBACZ,IAAI,EAAE;4BACJ,IAAI,EAAE,WAAW;4BACjB,MAAM,EAAE;gCACN,OAAO,EAAE,UAAU;6BACpB;4BACD,GAAG,EAAE;gCACH,GAAG,EAAE,SAAS;6BACf;yBACF;qBACF;iBACF,CAAC,CAAC;gBAEH,6CAA6C;gBAC7C,MAAM,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;oBAC3B,SAAS,CAAC,aAAa,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC1C,CAAC;qBAAM,CAAC;oBACN,SAAS,CAAC,aAAa,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBAC1C,CAAC;YACH,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;IAElC,OAAO,CACL,KAAC,OAAO,IACN,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAC,YAAY,EACrB,QAAQ,QACR,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { CollectorBox } from './collector-box';
|
|
3
|
+
/**
|
|
4
|
+
* CollectorBox - Event pipeline processor with collector
|
|
5
|
+
*
|
|
6
|
+
* Processes events through the walkerOS collector pipeline with a destination,
|
|
7
|
+
* showing the final formatted output. Perfect for demonstrating how events
|
|
8
|
+
* are transformed and sent to analytics tools.
|
|
9
|
+
*/
|
|
10
|
+
declare const meta: Meta<typeof CollectorBox>;
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof CollectorBox>;
|
|
13
|
+
/**
|
|
14
|
+
* Default collector box with product view event
|
|
15
|
+
*
|
|
16
|
+
* Shows how a product view event is:
|
|
17
|
+
* 1. Processed by the collector
|
|
18
|
+
* 2. Transformed by mapping rules
|
|
19
|
+
* 3. Formatted as gtag() call
|
|
20
|
+
*/
|
|
21
|
+
export declare const Default: Story;
|
|
22
|
+
//# sourceMappingURL=collector-box.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collector-box.stories.d.ts","sourceRoot":"","sources":["../../../src/components/organisms/collector-box.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;;;;GAMG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAOnC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC;AAmC3C;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC"}
|