From c515350922adc0d5dbf5fc610025c09643f518c8 Mon Sep 17 00:00:00 2001 From: atanasster Date: Tue, 16 Jun 2020 08:22:27 -0400 Subject: [PATCH] chore: merge specification into core package --- README.md | 32 +- core/config/README.md | 66 - core/config/package.json | 2 +- core/config/src/index.ts | 2 +- .../test/__snapshots__/stories.test.ts.snap | 14 + core/core/README.md | 1169 +++++++++++++++++ core/core/package.json | 7 +- .../{specification => core}/src/components.ts | 0 .../src/configuration.ts | 0 core/{specification => core}/src/controls.ts | 0 core/{specification => core}/src/deepMerge.ts | 0 core/core/src/index.test.ts | 58 +- core/core/src/index.ts | 14 + core/{specification => core}/src/propsInfo.ts | 0 core/core/src/randomizeData.ts | 6 +- core/core/src/smartControls.ts | 9 +- core/core/src/source.ts | 2 +- core/{specification => core}/src/stories.ts | 0 .../src/stories/components/ArrayControl.ts | 2 +- .../src/stories/components/BooleanControl.ts | 2 +- .../src/stories/components/ButtonControl.ts | 2 +- .../src/stories/components/ColorControl.ts | 2 +- .../src/stories/components/DateControl.ts | 2 +- .../src/stories/components/FilesControl.ts | 2 +- .../src/stories/components/NumberControl.ts | 2 +- .../src/stories/components/ObjectControl.ts | 2 +- .../src/stories/components/OptionsControl.ts | 2 +- .../src/stories/components/TextControl.ts | 2 +- .../src/stories/components/types.ts | 2 +- .../src/stories/controls-array.stories.js | 2 +- .../src/stories/controls-boolean.stories.js | 2 +- .../src/stories/controls-button.stories.js | 2 +- .../src/stories/controls-color.stories.js | 2 +- .../src/stories/controls-date.stories.js | 2 +- .../src/stories/controls-files.stories.js | 2 +- .../src/stories/controls-number.stories.js | 2 +- .../src/stories/controls-object.stories.js | 2 +- .../src/stories/controls-options.stories.js | 2 +- .../src/stories/controls-text.stories.js | 2 +- core/{specification => core}/src/utility.ts | 0 core/core/src/utils.ts | 2 +- .../__snapshots__/randomize.test.ts.snap | 0 core/core/test/index.test.ts | 56 + core/core/{src => test}/randomize.test.ts | 5 +- core/instrument/package.json | 1 - core/instrument/src/babel/csf-stories.ts | 2 +- .../src/babel/extract-arguments-usage.ts | 2 +- .../src/babel/extract-attributes.ts | 2 +- .../instrument/src/babel/extract-component.ts | 2 +- core/instrument/src/babel/extract-exports.ts | 2 +- .../src/babel/extract-function-parameters.ts | 6 +- core/instrument/src/babel/follow-imports.ts | 4 +- core/instrument/src/babel/mdx-stories.ts | 4 +- core/instrument/src/index.ts | 3 +- .../src/misc/component-attributes.ts | 6 +- core/instrument/src/misc/package-info.ts | 2 +- core/instrument/src/misc/props-info.ts | 2 +- core/instrument/src/misc/source-location.ts | 2 +- core/instrument/src/types.ts | 2 +- .../csf-exclude-stories.test.ts.snap | 4 - .../csf-named-exports.test.ts.snap | 3 - .../__snapshots__/csf-parameters.test.ts.snap | 3 - .../__snapshots__/csf-props-info.test.ts.snap | 3 +- .../csf-props-usage.test.ts.snap | 14 - .../__snapshots__/csf-stories.test.ts.snap | 9 - .../__snapshots__/csf-story-doc.test.ts.snap | 4 - .../__snapshots__/csf-toggle.test.ts.snap | 1 - .../extract-component.test.ts.snap | 5 - .../__snapshots__/mdx-stories.test.ts.snap | 8 - .../test/follow-imports-custom.test.ts | 2 +- core/loader/package.json | 2 +- core/loader/src/replaceSource.ts | 2 +- core/loader/src/runtimeLoader.ts | 5 +- core/loader/src/store.ts | 2 +- core/specification/.babelrc | 13 - core/specification/.eslintignore | 1 - core/specification/CHANGELOG.md | 243 ---- core/specification/LICENSE.md | 21 - core/specification/README.md | 1169 ----------------- core/specification/package.json | 50 - core/specification/rollup.config.js | 5 - core/specification/src/index.test.ts | 7 - core/specification/src/index.ts | 14 - core/specification/tsconfig.json | 13 - core/store/package.json | 1 - core/store/src/Store/Store.ts | 2 +- core/store/src/serialization/StoreStorage.ts | 5 +- core/store/src/serialization/load-store.ts | 2 +- .../store/src/serialization/smart-controls.ts | 4 +- core/store/src/types.ts | 2 +- core/webpack-compile/src/utilities.ts | 6 +- .../example-stories.test.ts.snap | 4 + .../react-typescript.test.ts.snap | 34 +- .../controls-editors-starter.stories.tsx | 2 +- .../src/stories/controls-editors.stories.jsx | 2 +- .../src/stories/inherit-from-doc.stories.tsx | 2 +- examples/storybook-6-no-docs/package.json | 2 +- examples/storybook-6/package.json | 2 +- .../gatsby-theme-stories/package.json | 9 +- .../src/components/Layout.tsx | 2 +- .../gatsby-theme-stories/src/gatsby-node.ts | 2 +- .../src/templates/CategoryList.tsx | 2 +- .../src/templates/CategoryPage.tsx | 2 +- .../src/templates/DocPage.tsx | 2 +- .../src/templates/PageList.tsx | 2 +- integrations/storybook/package.json | 1 - .../react-docgen-typescript/package.json | 4 +- .../react-docgen-typescript/src/index.ts | 2 +- .../src/transform-props.ts | 2 +- props-info/react-docgen/package.json | 4 +- props-info/react-docgen/src/index.ts | 2 +- .../react-docgen/src/transform-props.ts | 6 +- ui/app/package.json | 2 +- ui/app/src/AppContext/AppContext.tsx | 2 +- ui/app/src/CategoryList/CategoryList.tsx | 2 +- ui/app/src/CategoryPage/CategoryPage.tsx | 2 +- ui/app/src/DocPage/DocPage.tsx | 2 +- ui/app/src/DocumentsList/DocumentsList.tsx | 2 +- .../src/DocumentsList/DocumentsListItem.tsx | 2 +- ui/app/src/Header/Header.tsx | 2 +- ui/app/src/PageList/PageList.tsx | 2 +- ui/app/src/Sidebar/Sidebar.tsx | 2 +- ui/app/src/SidebarsPage/SidebarsMDXPage.tsx | 2 +- ui/app/src/SidebarsPage/SidebarsStoryPage.tsx | 2 +- ui/app/src/TagsList/TagsList.tsx | 2 +- ui/blocks/package.json | 1 - .../components/ComponentsBlockContainer.tsx | 3 +- .../src/ComponentDeps/BaseComponentDeps.tsx | 2 +- ui/blocks/src/ComponentDeps/Dependencies.tsx | 2 +- ui/blocks/src/PropsTable/BasePropsTable.tsx | 4 +- ui/blocks/src/PropsTable/controlsActions.ts | 5 +- ui/blocks/src/Story/Story.tsx | 7 +- ui/blocks/src/StoryConfig/BaseStoryConfig.tsx | 6 +- ui/blocks/src/StorySource/BaseStorySource.tsx | 7 +- ui/blocks/src/StorySource/arg-values.ts | 5 +- .../context/block/BlockControlsContext.tsx | 4 +- .../src/context/block/BlockDataContext.tsx | 2 +- .../components/ComponentsContainer.tsx | 6 +- .../context/components/ComponentsContext.tsx | 2 +- ui/blocks/src/context/story/StoryContext.tsx | 2 +- ui/blocks/src/test/storyStore.tsx | 6 +- ui/blocks/src/utils/constants.ts | 6 +- ui/blocks/src/utils/repositoryActions.tsx | 2 +- ui/editors/package.json | 1 - .../src/ArrayEditor/ArrayEditor.stories.tsx | 2 +- ui/editors/src/ArrayEditor/ArrayEditor.tsx | 4 +- .../BooleanEditor/BooleanEditor.stories.tsx | 2 +- .../src/BooleanEditor/BooleanEditor.tsx | 2 +- .../src/ButtonEditor/ButtonEditor.stories.tsx | 2 +- ui/editors/src/ButtonEditor/ButtonEditor.tsx | 5 +- .../src/ColorEditor/ColorEditor.stories.tsx | 2 +- ui/editors/src/ColorEditor/ColorEditor.tsx | 5 +- .../src/DateEditor/DateEditor.stories.tsx | 2 +- ui/editors/src/DateEditor/DateEditor.tsx | 5 +- .../src/FilesEditor/FilesEditor.stories.tsx | 2 +- ui/editors/src/FilesEditor/FilesEditor.tsx | 5 +- .../src/NumberEditor/NumberEditor.stories.tsx | 2 +- ui/editors/src/NumberEditor/NumberEditor.tsx | 5 +- .../src/ObjectEditor/ObjectEditor.stories.tsx | 5 +- ui/editors/src/ObjectEditor/ObjectEditor.tsx | 5 +- .../src/OptionsEditor/CheckboxEditor.tsx | 2 +- .../OptionsEditor/OptionsEditor.stories.tsx | 2 +- .../src/OptionsEditor/OptionsEditor.tsx | 2 +- ui/editors/src/OptionsEditor/RadiosEditor.tsx | 2 +- ui/editors/src/OptionsEditor/utils.test.ts | 2 +- ui/editors/src/OptionsEditor/utils.ts | 5 +- ui/editors/src/PropFactory.stories.tsx | 2 +- .../src/TextEditor/TextEditor.stories.tsx | 2 +- ui/editors/src/TextEditor/TextEditor.tsx | 5 +- ui/editors/src/context.tsx | 2 +- ui/editors/src/prop-factory.ts | 2 +- 171 files changed, 1449 insertions(+), 1976 deletions(-) rename core/{specification => core}/src/components.ts (100%) rename core/{specification => core}/src/configuration.ts (100%) rename core/{specification => core}/src/controls.ts (100%) rename core/{specification => core}/src/deepMerge.ts (100%) rename core/{specification => core}/src/propsInfo.ts (100%) rename core/{specification => core}/src/stories.ts (100%) rename core/{specification => core}/src/stories/components/ArrayControl.ts (68%) rename core/{specification => core}/src/stories/components/BooleanControl.ts (68%) rename core/{specification => core}/src/stories/components/ButtonControl.ts (68%) rename core/{specification => core}/src/stories/components/ColorControl.ts (68%) rename core/{specification => core}/src/stories/components/DateControl.ts (67%) rename core/{specification => core}/src/stories/components/FilesControl.ts (68%) rename core/{specification => core}/src/stories/components/NumberControl.ts (68%) rename core/{specification => core}/src/stories/components/ObjectControl.ts (68%) rename core/{specification => core}/src/stories/components/OptionsControl.ts (68%) rename core/{specification => core}/src/stories/components/TextControl.ts (67%) rename core/{specification => core}/src/stories/components/types.ts (56%) rename core/{specification => core}/src/stories/controls-array.stories.js (96%) rename core/{specification => core}/src/stories/controls-boolean.stories.js (87%) rename core/{specification => core}/src/stories/controls-button.stories.js (88%) rename core/{specification => core}/src/stories/controls-color.stories.js (88%) rename core/{specification => core}/src/stories/controls-date.stories.js (94%) rename core/{specification => core}/src/stories/controls-files.stories.js (93%) rename core/{specification => core}/src/stories/controls-number.stories.js (94%) rename core/{specification => core}/src/stories/controls-object.stories.js (95%) rename core/{specification => core}/src/stories/controls-options.stories.js (98%) rename core/{specification => core}/src/stories/controls-text.stories.js (96%) rename core/{specification => core}/src/utility.ts (100%) rename core/core/{src => test}/__snapshots__/randomize.test.ts.snap (100%) create mode 100644 core/core/test/index.test.ts rename core/core/{src => test}/randomize.test.ts (92%) delete mode 100644 core/specification/.babelrc delete mode 100644 core/specification/.eslintignore delete mode 100644 core/specification/CHANGELOG.md delete mode 100644 core/specification/LICENSE.md delete mode 100644 core/specification/README.md delete mode 100644 core/specification/package.json delete mode 100644 core/specification/rollup.config.js delete mode 100644 core/specification/src/index.test.ts delete mode 100644 core/specification/src/index.ts delete mode 100644 core/specification/tsconfig.json diff --git a/README.md b/README.md index 5e29cc2a9..c6912771d 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ - [Motivation](#motivation-1) - [Limitations](#limitations) - [Core packages](#core-packages) - - [@component-controls/specification](#component-controlsspecification) - [@component-controls/core](#component-controlscore) + - [@component-controls/core](#component-controlscore-1) - [@component-controls/instrument](#component-controlsinstrument) - [@component-controls/loader](#component-controlsloader) - [@component-controls/webpack-compile](#component-controlswebpack-compile) @@ -123,22 +123,22 @@ Storybook Addon For live editing of component controls # Core packages - + -## [@component-controls/specification](https://github.com/ccontrols/component-controls/blob/master/core/specification) +## [@component-controls/core](https://github.com/ccontrols/component-controls/blob/master/core/core) -Component controls specification with typescript definitions +Component controls core types and utility functions -Typescript definitions of the component-controls specification. +Type definitions of the component-controls specification and accompanying utility functions. Includes definitions for: -- [Story](https://github.com/ccontrols/component-controls/tree/master/core/specification#story) -- [Stories](https://github.com/ccontrols/component-controls/tree/master/core/specification#stories) -- [ControlTypes](https://github.com/ccontrols/component-controls/tree/master/core/specification#controltypes) -- [ComponentControl](https://github.com/ccontrols/component-controls/tree/master/core/specification#componentcontrol) -- [PropTypes](https://github.com/ccontrols/component-controls/tree/master/core/specification#proptypes) +- [Story](https://github.com/ccontrols/component-controls/tree/master/core/core#story) +- [Stories](https://github.com/ccontrols/component-controls/tree/master/core/core#stories) +- [ControlTypes](https://github.com/ccontrols/component-controls/tree/master/core/core#controltypes) +- [ComponentControl](https://github.com/ccontrols/component-controls/tree/master/core/core#componentcontrol) +- [PropTypes](https://github.com/ccontrols/component-controls/tree/master/core/core#proptypes) - and more... @@ -149,7 +149,17 @@ Includes definitions for: ## [@component-controls/core](https://github.com/ccontrols/component-controls/blob/master/core/core) -Component controls core utility routines +Component controls core types and utility functions + +Type definitions of the component-controls specification and accompanying utility functions. +Includes definitions for: + +- [Story](https://github.com/ccontrols/component-controls/tree/master/core/core#story) +- [Stories](https://github.com/ccontrols/component-controls/tree/master/core/core#stories) +- [ControlTypes](https://github.com/ccontrols/component-controls/tree/master/core/core#controltypes) +- [ComponentControl](https://github.com/ccontrols/component-controls/tree/master/core/core#componentcontrol) +- [PropTypes](https://github.com/ccontrols/component-controls/tree/master/core/core#proptypes) +- and more... diff --git a/core/config/README.md b/core/config/README.md index 29dfb94ce..942ecd790 100644 --- a/core/config/README.md +++ b/core/config/README.md @@ -9,11 +9,6 @@ - [extractStories](#extractstories) - [getConfigurationArg](#getconfigurationarg) - [loadConfiguration](#loadconfiguration) - - [BuildConfiguration](#buildconfiguration) - - [PageType](#pagetype) - - [WebpackConfig](#webpackconfig) - - [PageConfiguration](#pageconfiguration) - - [WebpackConfigFn](#webpackconfigfn) # Overview @@ -109,65 +104,4 @@ _defined in [@component-controls/config/src/index.ts](https://github.com/ccontro | `args` | string\[] | optional arguments | | `returns` | [ConfigrationResult](#configrationresult) \| undefined | | -## BuildConfiguration - -global configuration used at build time -stored in a file named main.js/main.ts - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L45)_ - - - -### properties - -| Name | Type | Description | -| -------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| `categories` | [PageType](#pagetype)\[] | page types that are considred as categories fields as well | -| `finalWebpack` | [WebpackConfig](#webpackconfig) | | -| `pages` | Record<[PageType](#pagetype), Pick<[PageConfiguration](#pageconfiguration), 'basePath'>> | base url path for API documentation pages. Default is "docs/" | -| `stories` | string\[] | wild card search string for the stories internally using \`glob\` for the search: https://www.npmjs.com/package/glob example: "./stories/ | -| `webpack` | [WebpackConfig](#webpackconfig) | custom webpack fonfigurations setup. One or the other will be used | - -## PageType - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L4)_ - -'story' | 'blog' | 'page' | 'tags' | 'author' - -## WebpackConfig - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L39)_ - -[WebpackConfiguration](#webpackconfiguration) \| [WebpackConfigFn](#webpackconfigfn) - -## PageConfiguration - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L6)_ - - - -### properties - -| Name | Type | Description | -| ---------- | ------- | ---------------------------------------------- | -| `basePath` | string | base url path for the page | -| `fullPage` | boolean | whether to take a fullpage theme option | -| `label` | string | label - used for menu labels | -| `sidebars` | boolean | whether to add navigation sidebars to the page | -| `topMenu` | boolean | whether to add to the top navigation menu | - -## WebpackConfigFn - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L35)_ - -**function** (`config`\*: [WebpackConfiguration](#webpackconfiguration), `options`: any): [WebpackConfiguration](#webpackconfiguration); - -### parameters - -| Name | Type | Description | -| --------- | --------------------------------------------- | ----------- | -| `config*` | [WebpackConfiguration](#webpackconfiguration) | | -| `options` | any | | -| `returns` | [WebpackConfiguration](#webpackconfiguration) | | - diff --git a/core/config/package.json b/core/config/package.json index 1acbd6cb9..e90b4714a 100644 --- a/core/config/package.json +++ b/core/config/package.json @@ -30,7 +30,7 @@ }, "license": "MIT", "dependencies": { - "@component-controls/specification": "^1.2.0", + "@component-controls/core": "^1.2.0", "glob": "^7.1.6", "typescript": "^3.8.3", "yargs": "^15.3.1" diff --git a/core/config/src/index.ts b/core/config/src/index.ts index ce3a5a84b..077062d89 100644 --- a/core/config/src/index.ts +++ b/core/config/src/index.ts @@ -2,7 +2,7 @@ import * as path from 'path'; import * as fs from 'fs'; import { sync as globSync } from 'glob'; import yargs from 'yargs'; -import { BuildConfiguration } from '@component-controls/specification'; +import { BuildConfiguration } from '@component-controls/core'; export const buildConfigFileNames = ['buildtime.js', 'build.js', 'main.js']; diff --git a/core/config/test/__snapshots__/stories.test.ts.snap b/core/config/test/__snapshots__/stories.test.ts.snap index 4a401515e..6348b0eec 100644 --- a/core/config/test/__snapshots__/stories.test.ts.snap +++ b/core/config/test/__snapshots__/stories.test.ts.snap @@ -17,11 +17,18 @@ Array [ "/Users/atanasster/component-controls/ui/components/src/ActionContainer/ActionContainer.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/BlockContainer/BlockContainer.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Collapsible/Collapsible.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/ColorMode/ColorMode.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/ExternalLink/ExternalLink.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Header/Header.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Link/Link.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Markdown/Markdown.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Navmenu/Navmenu.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Pagination/Pagination.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/PanelContainer/PanelContainer.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Popover/Popover.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Sidebar/Sidebar.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Source/Source.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Subheading/Subjeading.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Subtitle/Subtitle.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/SyntaxHighlighter/SyntaxHighlighter.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Table/Table.stories.tsx", @@ -68,11 +75,18 @@ Array [ "/Users/atanasster/component-controls/ui/components/src/ActionContainer/ActionContainer.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/BlockContainer/BlockContainer.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Collapsible/Collapsible.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/ColorMode/ColorMode.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/ExternalLink/ExternalLink.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Header/Header.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Link/Link.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Markdown/Markdown.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Navmenu/Navmenu.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Pagination/Pagination.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/PanelContainer/PanelContainer.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Popover/Popover.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Sidebar/Sidebar.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Source/Source.stories.tsx", + "/Users/atanasster/component-controls/ui/components/src/Subheading/Subjeading.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Subtitle/Subtitle.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/SyntaxHighlighter/SyntaxHighlighter.stories.tsx", "/Users/atanasster/component-controls/ui/components/src/Table/Table.stories.tsx", diff --git a/core/core/README.md b/core/core/README.md index e69de29bb..621e0abb9 100644 --- a/core/core/README.md +++ b/core/core/README.md @@ -0,0 +1,1169 @@ +# Table of contents + +- [Overview](#overview) +- [Installation](#installation) +- [API](#api) + - [ArgUsageLocation](#argusagelocation) + - [SourceIdentifier](#sourceidentifier) + - [Stories](#stories) + - [StoriesDoc](#storiesdoc) + - [StoriesStore](#storiesstore) + - [Story](#story) + - [StoryArgument](#storyargument) + - [StoryComponents](#storycomponents) + - [StoryDocs](#storydocs) + - [StoryPackages](#storypackages) + - [StoryParameters](#storyparameters) + - [StoryStories](#storystories) + - [Pages](#pages) + - [StoryArguments](#storyarguments) + - [defPageType](#defpagetype) + - [getDocPath](#getdocpath) + - [getStoryPath](#getstorypath) + - [ControlTypes](#controltypes) + - [ComponentControlArray](#componentcontrolarray) + - [ComponentControlBase](#componentcontrolbase) + - [ComponentControlBoolean](#componentcontrolboolean) + - [ComponentControlButton](#componentcontrolbutton) + - [ComponentControlColor](#componentcontrolcolor) + - [ComponentControlData](#componentcontroldata) + - [ComponentControlDate](#componentcontroldate) + - [ComponentControlFiles](#componentcontrolfiles) + - [ComponentControlNumber](#componentcontrolnumber) + - [ComponentControlObject](#componentcontrolobject) + - [ComponentControlOptions](#componentcontroloptions) + - [ComponentControlText](#componentcontroltext) + - [ComponentControls](#componentcontrols) + - [ComponentControl](#componentcontrol) + - [OptionsListType](#optionslisttype) + - [OptionsValueType](#optionsvaluetype) + - [ComponentInfo](#componentinfo) + - [PropType](#proptype) + - [PropTypes](#proptypes) + - [StoryComponent](#storycomponent) + - [TypeInformation](#typeinformation) + - [TypeValue](#typevalue) + - [getComponentName](#getcomponentname) + - [PropsInfoExtractorFunction](#propsinfoextractorfunction) + - [CodeLocation](#codelocation) + - [CodePosition](#codeposition) + - [ImportName](#importname) + - [Imports](#imports) + - [PackageDependencies](#packagedependencies) + - [PackageInfo](#packageinfo) + - [PackageRepository](#packagerepository) + - [PackageDependency](#packagedependency) + - [StoryRenderFn](#storyrenderfn) + - [BuildConfiguration](#buildconfiguration) + - [PageConfiguration](#pageconfiguration) + - [RunOnlyConfiguration](#runonlyconfiguration) + - [PageType](#pagetype) + - [PagesConfiguration](#pagesconfiguration) + - [RunConfiguration](#runconfiguration) + - [WebpackConfig](#webpackconfig) + - [WebpackConfigFn](#webpackconfigfn) + - [defaultBuildConfig](#defaultbuildconfig) + - [defaultRunConfig](#defaultrunconfig) + - [StoryRenderFn](#storyrenderfn-1) + - [PageType](#pagetype-1) + - [RunConfiguration](#runconfiguration-1) + - [StoryArguments](#storyarguments-1) + - [ComponentControl](#componentcontrol-1) + - [TypeValue](#typevalue-1) + - [PackageDependency](#packagedependency-1) + - [WebpackConfig](#webpackconfig-1) + - [PagesConfiguration](#pagesconfiguration-1) + - [WebpackConfigFn](#webpackconfigfn-1) + - [PageType](#pagetype-2) + +# Overview + +Type definitions of the component-controls specification and accompanying utility functions. +Includes definitions for: + +- [Story](https://github.com/ccontrols/component-controls/tree/master/core/core#story) +- [Stories](https://github.com/ccontrols/component-controls/tree/master/core/core#stories) +- [ControlTypes](https://github.com/ccontrols/component-controls/tree/master/core/core#controltypes) +- [ComponentControl](https://github.com/ccontrols/component-controls/tree/master/core/core#componentcontrol) +- [PropTypes](https://github.com/ccontrols/component-controls/tree/master/core/core#proptypes) +- and more... + +# Installation + +This package is usually installed as part of the @component-controls package, but you can also install it standalone: + +```bash +$ npm install @component-controls/core --save-dev +``` + +# API + + + + + +## ArgUsageLocation + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L12)_ + + + +### properties + +| Name | Type | Description | +| ----------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `loc*` | [CodeLocation](#codelocation) | where in the story source code is the argument used code location is relative to the start of the story | +| `name` | [SourceIdentifier](#sourceidentifier) | optional name for the usage of the argument example: export const story = ({ value }) => <Story value={{ age: value }} />; in this example the name will be 'age' | +| `shorthand` | boolean | true if the property is a 'shorthand'. { prop: value } - not a shorthand. { prop } - a shorthand. | + +## SourceIdentifier + +an identifier/variable.argument in the source code + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L8)_ + + + +### properties + +| Name | Type | Description | +| ------- | ----------------------------- | ----------- | +| `loc` | [CodeLocation](#codelocation) | | +| `name*` | string | | + +## Stories + +map of stories. The id is compatible with CSF story ids + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L148)_ + +`id`\*: string: [Story](#story) + +## StoriesDoc + +a group of stories. Usually multiple stories are in one csf file +and the 'group' is the default export +in the case of MDX stories, the doc is created using a <Meta /> tag + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L158)_ + +`name`\*: string: any + +### properties + +| Name | Type | Description | +| ---------------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | +| `MDXPage` | any | for MDX pages, this is an MDXContent function, to be rendered inside a MDXProvider | +| `author` | string | document author | +| `component` | string \| object | id for component associated with the stories file | +| `components*` | \[name: string]: string | lookup into the global store.components since multiple components of the same name can be used example: \['Button']: 'c:/myapp/Button.tsx' | +| `controls` | [ComponentControls](#componentcontrols) | object of key/value pairs specifying the controls for the stories file this will apply to all the stories in the file | +| `date` | string | optional date the document was created | +| `decorators` | [StoryRenderFn](#storyrenderfn)\[] | story decorators (or wrappers) | +| `description` | string | documentation file description | +| `excludeStories` | string\[] \| [RegExp](#regexp) | list of stories to exclude from the stories file can also use regexp match | +| `fileName` | string | file name of the file of stories | +| `fullPage` | boolean | if true, will display the documentation page full size (pagecontainer.full theme variant) the default value is from the page type configuration | +| `includeStories` | string\[] \| [RegExp](#regexp) | list of stories to include in the stories file can also use regexp match | +| `package` | string | lookup into the global store of PackageInfo package.json | +| `parameters` | [StoryParameters](#storyparameters) | configuration parameters passed to the story groups configured either as CSF default export or MDX <Meta /> tag | +| `route` | string | if provided, will be used as the route for the page if not provided, the title in lowercase will be used as the route | +| `sidebars` | boolean | whether to add navigation sidebars to the page the default value is from the page type configuration | +| `source` | string | source code of the entire file of stories | +| `stories` | string\[] | list of stories contained in the file/groups | +| `subcomponents` | string\[] \| object\[] | multiple components option | +| `tags` | string\[] | comma-separated list of document tags, used for search | +| `title*` | string | title of the groups of stories contained in the doc file. used to generate story ids | +| `type` | [PageType](#pagetype) | document type - blogs a and stories. By default - storie | + +## StoriesStore + +store of stories information in memory after the loader is applied + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L317)_ + + + +### properties + +| Name | Type | Description | +| ------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `components*` | [StoryComponents](#storycomponents) | list of components used in stories | +| `config` | [RunConfiguration](#runconfiguration) | global configuration for config file | +| `docs*` | [StoryDocs](#storydocs) | list of story files, or groups | +| `packages*` | [StoryPackages](#storypackages) | list of package.json files and their data used by the components and the stories of the project | +| `stories*` | [StoryStories](#storystories) | list of stories | + +## Story + +Story interface - usually extracted by the AST instrumenting loader + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L73)_ + + + +### properties + +| Name | Type | Description | +| --------------- | --------------------------------------- | ------------------------------------------------------------------------------------------- | +| `arguments` | [StoryArguments](#storyarguments) | arguments pass to a CSF story eg \`export const story = props => <Story {...props} />;\` | +| `component` | string \| object | id for component associated with the story | +| `controls` | [ComponentControls](#componentcontrols) | object of key/value pairs specifying the controls for the story | +| `decorators` | [StoryRenderFn](#storyrenderfn)\[] | story decorators (or wrappers) | +| `description` | string | story extended description. can use markdown. | +| `doc` | string | title of the file/group of stories | +| `id` | string | csf id of the story | +| `loc` | [CodeLocation](#codelocation) | location in the source file of the story definition | +| `name*` | string | name of the Story. | +| `parameters` | [StoryParameters](#storyparameters) | configuration parameters passed to the story - either CSF or MDX | +| `renderFn` | [StoryRenderFn](#storyrenderfn) | render function for the story | +| `source` | string | the source code of the story, extracted byt the AST instrumenting loaders | +| `subcomponents` | \[key: string]: string \| object | multiple components option | +| `subtitle` | string | optional story subtitle property | + +## StoryArgument + +arguments passed to the 'story' function, extracted by an AST loader + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L36)_ + + + +### properties + +| Name | Type | Description | +| -------- | ------------------------------------------- | ------------------------------------------------------------------------------------------ | +| `loc` | [CodeLocation](#codelocation) | location of the argument declaration, relative to the story source code | +| `name` | string | the original name of the argument | +| `usage` | [ArgUsageLocation](#argusagelocation)\[] | list of locations where the argument is used in the body of the story | +| `value*` | string \| [StoryArguments](#storyarguments) | either the name used (or a variable alias), or an array of sub-arguments ({ name: alias }) | + +## StoryComponents + +list of components used in stories + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L287)_ + +`fileName`\*: string: [StoryComponent](#storycomponent) + +## StoryDocs + +list of story files, or groups + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L294)_ + +`title`\*: string: [StoriesDoc](#storiesdoc) + +## StoryPackages + +list of repositories + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L310)_ + +`id`\*: string: [PackageInfo](#packageinfo) + +## StoryParameters + +list of configuration parameters for indivudual stories and docs files +can be specified either through CSF or MDX tags + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L66)_ + +`name`\*: string: any + +## StoryStories + +list of stories + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L303)_ + +`id`\*: string: [Story](#story) + +## Pages + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L298)_ + +[StoriesDoc](#storiesdoc)\[] + +## StoryArguments + +list of story arguments. Each argument can be a deconstructed argument of itself +the first argument are the control 'values' + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L60)_ + +[StoryArgument](#storyargument)\[] + +## defPageType + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L152)_ + + + +## getDocPath + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L342)_ + +**function** getDocPath(`pageType`\*: [PageType](#pagetype), `doc`: [StoriesDoc](#storiesdoc), `config`: [RunConfiguration](#runconfiguration), `name`\*: string): string; + +### parameters + +| Name | Type | Description | +| ----------- | ------------------------------------- | ----------- | +| `pageType*` | [PageType](#pagetype) | | +| `doc` | [StoriesDoc](#storiesdoc) | | +| `config` | [RunConfiguration](#runconfiguration) | | +| `name*` | string | | +| `returns` | string | | + +## getStoryPath + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L354)_ + +**function** getStoryPath(`story`: [Story](#story), `doc`: [StoriesDoc](#storiesdoc), `config`: [RunConfiguration](#runconfiguration)): string; + +### parameters + +| Name | Type | Description | +| --------- | ------------------------------------- | ----------- | +| `story` | [Story](#story) | | +| `doc` | [StoriesDoc](#storiesdoc) | | +| `config` | [RunConfiguration](#runconfiguration) | | +| `returns` | string | | + +## ControlTypes + +Control field types +examples are provided for the different types: + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L6)_ + + + +### properties + +| Name | Type | Description | +| ---------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ARRAY*` | **function** ARRAY | arrayItems: { type: ControlTypes.ARRAY, label: 'Items', rowType: { name: { type: ControlTypes.TEXT }, }, value: \[{ name: 'Laptop' }, { name: 'Book' }, { name: 'Whiskey' }], }, | +| `BOOLEAN*` | **function** BOOLEAN | nice: { type: ControlTypes.BOOLEAN, label: 'Nice', value: true, }, | +| `BUTTON*` | **function** BUTTON | button: { type: ControlTypes.BUTTON, onClick: () => { ... code to modify some variables } }, | +| `COLOR*` | **function** COLOR | color: { type: 'color', value: '#000000', }, | +| `DATE*` | **function** DATE | birthday: { type: ControlTypes.DATE, label: 'Birthday', value: new Date(), }, | +| `FILES*` | **function** FILES | images: { type: ControlTypes.FILES, label: 'Happy Picture', accept: 'image/\*', value: \[ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfiARwMCyEWcOFPAAAAP0lEQVQoz8WQMQoAIAwDL/7/z3GwghSp4KDZyiUpBMCYUgd8rehtH16/l3XewgU2KAzapjXBbNFaPS6lDMlKB6OiDv3iAH1OAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTAxLTI4VDEyOjExOjMzLTA3OjAwlAHQBgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0wMS0yOFQxMjoxMTozMy0wNzowMOVcaLoAAAAASUVORK5CYII=', ], }, | +| `NUMBER*` | **function** NUMBER | age: { type: ControlTypes.NUMBER, label: 'Age', value: 78, range: true, min: 0, max: 90, step: 5, }, | +| `OBJECT*` | **function** OBJECT | style: { type: ControlTypes.OBJECT, label: 'Styles', value: { // do not randomize the border style border: { type: ControlTypes.TEXT, value: '2px dashed silver', data: null }, borderRadius: { type: ControlTypes.NUMBER, value: 10 }, padding: { type: ControlTypes.NUMBER, value: 10 }, }, } | +| `OPTIONS*` | **function** OPTIONS | fruit: { type: ControlTypes.OPTIONS, label: 'Fruit', value: 'apple', options: { Apple: 'apple', Banana: 'banana', Cherry: 'cherry', }, }, | +| `TEXT*` | **function** TEXT | userName: { type: ControlTypes.TEXT, label: 'Name', value: 'Storyteller', }, | + +## ComponentControlArray + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L263)_ + +** extends ComponentControlBase<\[key: string]: any\[]>** + +### properties + +| Name | Type | Description | +| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | +| `defaultValue` | \[key: string]: any\[] | default value is usually set at run-time, from the value | +| `description` | string | full text property description. can use markdown. | +| `editLabel` | string | the label for the editor button | +| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | +| `hidden` | boolean | hide the property editor for this property will only use the value | +| `label` | string | label to display next to the field editor by default uses the property name itself | +| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | +| `required` | boolean | visually display the control property as required | +| `resetValue` | \[key: string]: any\[] | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | +| `rowType*` | [ComponentControls](#componentcontrols) | type of the items in each row of the array | +| `type*` | [ARRAY](#array) | | +| `value` | \[key: string]: any\[] | a default value for the property | + +## ComponentControlBase + +Base inteface for creating control types +All new property typs should extend this interface and support + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L140)_ + + + +### properties + +| Name | Type | Description | +| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | +| `defaultValue` | | default value is usually set at run-time, from the value | +| `description` | string | full text property description. can use markdown. | +| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | +| `hidden` | boolean | hide the property editor for this property will only use the value | +| `label` | string | label to display next to the field editor by default uses the property name itself | +| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | +| `required` | boolean | visually display the control property as required | +| `resetValue` | | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | +| `type*` | [ControlTypes](#controltypes) | | +| `value` | | a default value for the property | + +## ComponentControlBoolean + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L230)_ + +** extends ComponentControlBase<boolean>** + +### properties + +| Name | Type | Description | +| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | +| `defaultValue` | boolean | default value is usually set at run-time, from the value | +| `description` | string | full text property description. can use markdown. | +| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | +| `hidden` | boolean | hide the property editor for this property will only use the value | +| `label` | string | label to display next to the field editor by default uses the property name itself | +| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | +| `required` | boolean | visually display the control property as required | +| `resetValue` | boolean | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | +| `type*` | [BOOLEAN](#boolean) | | +| `value` | boolean | a default value for the property | + +## ComponentControlButton + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L285)_ + +** extends ComponentControlBase<>** + +### properties + +| Name | Type | Description | +| -------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | +| `defaultValue` | | default value is usually set at run-time, from the value | +| `description` | string | full text property description. can use markdown. | +| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | +| `hidden` | boolean | hide the property editor for this property will only use the value | +| `label` | string | label to display next to the field editor by default uses the property name itself | +| `onClick` | **function** (`prop`\*: [ComponentControlButton](#componentcontrolbutton)): void; | for button type fields, an onClick handler | +| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | +| `required` | boolean | visually display the control property as required | +| `resetValue` | | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | +| `type*` | [BUTTON](#button) | | +| `value` | | a default value for the property | + +## ComponentControlColor + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L234)_ + +** extends ComponentControlBase<string>** + +### properties + +| Name | Type | Description | +| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | +| `defaultValue` | string | default value is usually set at run-time, from the value | +| `description` | string | full text property description. can use markdown. | +| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | +| `hidden` | boolean | hide the property editor for this property will only use the value | +| `label` | string | label to display next to the field editor by default uses the property name itself | +| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | +| `required` | boolean | visually display the control property as required | +| `resetValue` | string | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | +| `type*` | [COLOR](#color) | | +| `value` | string | a default value for the property | + +## ComponentControlData + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L118)_ + + + +### properties + +| Name | Type | Description | +| --------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| `name*` | string | 'name' for generating random data from faker.js usually comprised of two parts, separated by a dot example 'internet.avatar' | +| `options` | \[key: string]: any | options to be passe to the random data generators example { min: 10, max: 20 } | + +## ComponentControlDate + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L238)_ + +** extends ComponentControlBase<[Date](#date)>** + +### properties + +| Name | Type | Description | +| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | +| `datePicker` | boolean | whether to display a date picker (calendar). default: true | +| `defaultValue` | [Date](#date) | default value is usually set at run-time, from the value | +| `description` | string | full text property description. can use markdown. | +| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | +| `hidden` | boolean | hide the property editor for this property will only use the value | +| `label` | string | label to display next to the field editor by default uses the property name itself | +| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | +| `required` | boolean | visually display the control property as required | +| `resetValue` | [Date](#date) | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | +| `timePicker` | boolean | whether to display a time picker (calendar). default: true | +| `type*` | [DATE](#date) | | +| `value` | [Date](#date) | a default value for the property | + +## ComponentControlFiles + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L254)_ + +** extends ComponentControlBase<string\[]>** + +### properties + +| Name | Type | Description | +| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `accept` | string | type of files to accept user to open ex 'image/\*', | +| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | +| `defaultValue` | string\[] | default value is usually set at run-time, from the value | +| `description` | string | full text property description. can use markdown. | +| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | +| `hidden` | boolean | hide the property editor for this property will only use the value | +| `label` | string | label to display next to the field editor by default uses the property name itself | +| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | +| `required` | boolean | visually display the control property as required | +| `resetValue` | string\[] | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | +| `type*` | [FILES](#files) | | +| `value` | string\[] | a default value for the property | + +## ComponentControlNumber + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L335)_ + +** extends ComponentControlBase<number>** + +### properties + +| Name | Type | Description | +| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | +| `defaultValue` | number | default value is usually set at run-time, from the value | +| `description` | string | full text property description. can use markdown. | +| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | +| `hidden` | boolean | hide the property editor for this property will only use the value | +| `label` | string | label to display next to the field editor by default uses the property name itself | +| `max` | number | maximum allowed value for numeric property | +| `min` | number | minimum allowed value for numeric property | +| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | +| `range` | boolean | if true, will display a range type slider editor | +| `required` | boolean | visually display the control property as required | +| `resetValue` | number | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | +| `step` | number | stepper for numeric editor /i nc/dec value | +| `type*` | [NUMBER](#number) | | +| `value` | number | a default value for the property | + +## ComponentControlObject + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L276)_ + +** extends ComponentControlBase<[ComponentControls](#componentcontrols)>** + +### properties + +| Name | Type | Description | +| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | +| `defaultValue` | [ComponentControls](#componentcontrols) | default value is usually set at run-time, from the value | +| `description` | string | full text property description. can use markdown. | +| `editLabel` | string | the label for the editor button | +| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | +| `hidden` | boolean | hide the property editor for this property will only use the value | +| `label` | string | label to display next to the field editor by default uses the property name itself | +| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | +| `required` | boolean | visually display the control property as required | +| `resetValue` | [ComponentControls](#componentcontrols) | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | +| `type*` | [OBJECT](#object) | | +| `value` | [ComponentControls](#componentcontrols) | a default value for the property | + +## ComponentControlOptions + +list of options can be +1\. key-value pair object: in format { label: value } +2\. array of strings +3\. array of key-value pair objects + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L316)_ + +** extends ComponentControlBase<OptionsValueType<>>** + +### properties + +| Name | Type | Description | +| -------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | +| `defaultValue` | OptionsValueType<> | default value is usually set at run-time, from the value | +| `description` | string | full text property description. can use markdown. | +| `display` | 'select' \| 'multi-select' \| 'radio' \| 'inline-radio' \| 'check' \| 'inline-check' | how to render selecting the options: default is 'select' | +| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | +| `hidden` | boolean | hide the property editor for this property will only use the value | +| `label` | string | label to display next to the field editor by default uses the property name itself | +| `options*` | OptionsListType<> | | +| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | +| `required` | boolean | visually display the control property as required | +| `resetValue` | OptionsValueType<> | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | +| `type*` | [OPTIONS](#options) | | +| `value` | OptionsValueType<> | a default value for the property | + +## ComponentControlText + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L205)_ + +** extends ComponentControlBase<string>** + +### properties + +| Name | Type | Description | +| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | +| `defaultValue` | string | default value is usually set at run-time, from the value | +| `description` | string | full text property description. can use markdown. | +| `escapeValue` | boolean | allows to receive escaped string values to help prevent XSS attacks by default - false | +| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | +| `hidden` | boolean | hide the property editor for this property will only use the value | +| `label` | string | label to display next to the field editor by default uses the property name itself | +| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | +| `placeholder` | string | placeholder for empty properties either undefined initial value or user clears the field | +| `required` | boolean | visually display the control property as required | +| `resetValue` | string | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | +| `rows` | number | number of rows for a TextArea field for longer text by default, only 1 row = means a Input field \> 1 rows = an area field | +| `type*` | [TEXT](#text) | | +| `value` | string | a default value for the property | + +## ComponentControls + +ComponentControls are defined in key value pairs +the name of the property is the key +and the value is the ComponentControl + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L388)_ + +`name`\*: string: [ComponentControl](#componentcontrol) + +## ComponentControl + +ComponentControl is a either an object of property settings +or a shortcut can be used: + properties: { + text: 'Hello', +}, + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L371)_ + +[ComponentControlText](#componentcontroltext) \| [ComponentControlBoolean](#componentcontrolboolean) \| [ComponentControlColor](#componentcontrolcolor) \| [ComponentControlDate](#componentcontroldate) \| [ComponentControlObject](#componentcontrolobject) \| [ComponentControlButton](#componentcontrolbutton) \| [ComponentControlOptions](#componentcontroloptions) \| [ComponentControlNumber](#componentcontrolnumber) \| [ComponentControlArray](#componentcontrolarray) \| [ComponentControlFiles](#componentcontrolfiles) + +## OptionsListType + +value/label pairs or array of OptionsValueType + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L305)_ + +\[key: string]: \| OptionsValueType<>\[] + +## OptionsValueType + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L295)_ + + | number | string\[] \| number\[] \| **label**: string**value**: any + +## ComponentInfo + +DocGen type onfo generated for a compoennt + +_defined in [@component-controls/core/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/components.ts#L76)_ + + + +### properties + +| Name | Type | Description | +| -------------- | ----------------------- | --------------------- | +| `description` | string | optional description | +| `displayName*` | string | name of the component | +| `props*` | [PropTypes](#proptypes) | component props | + +## PropType + +docgen generated property types +mapped to common types to be consumed by component-controls +check props-info packages for implementations + +_defined in [@component-controls/core/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/components.ts#L47)_ + + + +### properties + +| Name | Type | Description | +| -------------- | ----------------------------------- | ------------------------------------- | +| `defaultValue` | any | default value for the property | +| `description` | string | description of the property | +| `parentName` | string | name of the parent/inherited property | +| `type*` | [TypeInformation](#typeinformation) | propertty type | + +## PropTypes + +list of properties of the component + +_defined in [@component-controls/core/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/components.ts#L69)_ + +`key`\*: string: [PropType](#proptype) + +## StoryComponent + +component specified for stories or story files + +_defined in [@component-controls/core/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/components.ts#L96)_ + + + +### properties + +| Name | Type | Description | +| -------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `from` | string | imported from | +| `importedName` | 'default' \| 'namespace' \| string | imported name ex: \- default import import Button from 'buttons'; \- namespace import import \* as Button from 'buttons'; \- named import import { Button } from 'buttons'; \- named alias import import { Btn as Button } from 'buttons'; | +| `imports` | [Imports](#imports) | list of external imports | +| `info` | [ComponentInfo](#componentinfo) | docgen generated component info | +| `loc` | [CodeLocation](#codelocation) | location of the import statement in the source code file | +| `name*` | string | name of the component as used in the fiel | +| `package` | string | lookup into the global store of PackageInfo package.json | +| `request` | string | resolved import request | +| `source` | string | the source code of the component file, extracted byt the AST instrumenting loaders | + +## TypeInformation + +_defined in [@component-controls/core/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/components.ts#L17)_ + + + +### properties + +| Name | Type | Description | +| ----------- | --------------------------------------------- | ----------------------------------------------------------------------------- | +| `arguments` | [TypeInformation](#typeinformation)\[] \| any | argument types of function | +| `name*` | [TypeValue](#typevalue) | | +| `raw` | string | raw type code | +| `required` | boolean | is the property required | +| `value` | [TypeInformation](#typeinformation)\[] \| any | type value elements of enum, array, fields of object return value of function | + +## TypeValue + +_defined in [@component-controls/core/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/components.ts#L3)_ + +'any' | 'boolean' | 'number' | 'string' | 'array' | 'object' | 'enum' | 'union' | 'literal' | 'symbol' | 'function' | string + +## getComponentName + +given a component, return its name + +_defined in [@component-controls/core/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/components.ts#L147)_ + +**function** getComponentName(`component`\*: any): string | undefined; + +### parameters + +| Name | Type | Description | +| ------------ | ------------------- | ------------------------------------------------------------------------------------------ | +| `component*` | any | a string component name, or a component class, with a name or displayName static property | +| `returns` | string \| undefined | | + +## PropsInfoExtractorFunction + +callback function to extract props info table - ie docgen type libraries +used to extract displayName, and props tables for a component + +_defined in [@component-controls/core/src/propsInfo.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/propsInfo.ts#L13)_ + +**function** (`fileName`\*: string, `componentName`: string, `source`: string): Promise<[ComponentInfo](#componentinfo) | undefined> | [ComponentInfo](#componentinfo) | undefined; + +### parameters + +| Name | Type | Description | +| --------------- | -------------------------------------------------------------------------------------------------------- | ----------- | +| `fileName*` | string | | +| `componentName` | string | | +| `source` | string | | +| `returns` | Promise<[ComponentInfo](#componentinfo) \| undefined> \| [ComponentInfo](#componentinfo) \| undefined | | + +## CodeLocation + +location in the source code of a story or part of it +ie. arguments, usage of arguments + +_defined in [@component-controls/core/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/utility.ts#L16)_ + + + +### properties + +| Name | Type | Description | +| -------- | ----------------------------- | ----------- | +| `end*` | [CodePosition](#codeposition) | | +| `start*` | [CodePosition](#codeposition) | | + +## CodePosition + +position in the stories source code +usually taken from AST traverse loaders + +_defined in [@component-controls/core/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/utility.ts#L6)_ + + + +### properties + +| Name | Type | Description | +| --------- | ------ | ----------- | +| `column*` | number | | +| `line*` | number | | + +## ImportName + +an import name + +_defined in [@component-controls/core/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/utility.ts#L106)_ + + + +### properties + +| Name | Type | Description | +| --------------- | ------ | --------------------------------------------------------------------- | +| `importedName*` | string | alias imported as. If a default import, the string 'default' is here. | +| `name*` | string | the imported name from the import file | + +## Imports + +imports - library/file as key and the imported names as an array + +_defined in [@component-controls/core/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/utility.ts#L120)_ + +`key`\*: string: [ImportName](#importname)\[] + +## PackageDependencies + +list of dependencies - package name as the key and the version as the value + +_defined in [@component-controls/core/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/utility.ts#L49)_ + +`name`\*: string: [PackageDependency](#packagedependency) + +## PackageInfo + +package.json +information about the repository of the stories and components + +_defined in [@component-controls/core/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/utility.ts#L57)_ + + + +### properties + +| Name | Type | Description | +| ------------------ | ------------------------------------------- | ----------------------------------------------------------------------------- | +| `dependencies` | [PackageDependencies](#packagedependencies) | extracted package.json 'dependencies' section | +| `devDependencies` | [PackageDependencies](#packagedependencies) | extracted package.json 'devDependencies' section | +| `fileHash*` | string | file name hash of package.json | +| `name` | string | package name | +| `peerDependencies` | [PackageDependencies](#packagedependencies) | extracted package.json 'peerDependencies' section | +| `repository*` | [PackageRepository](#packagerepository) | repository information extracted from the "repository" field in package.json. | +| `version` | string | package version | + +## PackageRepository + +repository information from package.json + +_defined in [@component-controls/core/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/utility.ts#L24)_ + + + +### properties + +| Name | Type | Description | +| -------- | ------ | --------------------------------------- | +| `browse` | string | link for browsing the file | +| `docs` | string | link for project readme | +| `issues` | string | link for filing issues with the project | + +## PackageDependency + +dependecy string - the package version number + +_defined in [@component-controls/core/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/utility.ts#L44)_ + +string + +## StoryRenderFn + +story render function + +_defined in [@component-controls/core/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/utility.ts#L98)_ + +**function** (`controlValues`\*: \[key: string]: any, `context`: any): any; + +### parameters + +| Name | Type | Description | +| ---------------- | ------------------- | ----------- | +| `controlValues*` | \[key: string]: any | | +| `context` | any | | +| `returns` | any | | + +## BuildConfiguration + +global configuration used at build time +stored in a file named main.js/main.ts + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L45)_ + + + +### properties + +| Name | Type | Description | +| -------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `categories` | [PageType](#pagetype)\[] | page types that are considred as categories fields as well | +| `finalWebpack` | [WebpackConfig](#webpackconfig) | | +| `pages` | Record<[PageType](#pagetype), Pick<[PageConfiguration](#pageconfiguration), 'basePath'>> | base url path for API documentation pages. Default is "docs/" | +| `stories` | string\[] | wild card search string for the stories internally using \`glob\` for the search: https://www.npmjs.com/package/glob example: "./stories/ | +| `webpack` | [WebpackConfig](#webpackconfig) | custom webpack fonfigurations setup. One or the other will be used | + +## PageConfiguration + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L6)_ + + + +### properties + +| Name | Type | Description | +| ---------- | ------- | ---------------------------------------------- | +| `basePath` | string | base url path for the page | +| `fullPage` | boolean | whether to take a fullpage theme option | +| `label` | string | label - used for menu labels | +| `sidebars` | boolean | whether to add navigation sidebars to the page | +| `topMenu` | boolean | whether to add to the top navigation menu | + +## RunOnlyConfiguration + +global configuration used at build time +stored in a file named main.js/main.ts + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L72)_ + + + +### properties + +| Name | Type | Description | +| ----------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `author` | string | author: Default is "@component-controls" | +| `decorators` | [StoryRenderFn](#storyrenderfn)\[] | story decorator functions - used to wrap stories example: \[story => <ThemeProvider>{story()}</ThemeProvider>] | +| `pages` | [PagesConfiguration](#pagesconfiguration) | page types configurations | +| `siteDescription` | string | site description. siteDescription: Default is "Component controls stories. Write your components documentation with MDX and JSX. Design, develop, test and review in a single site." | +| `siteHeadline` | string | Site headline. Default is "Component controls gatsby" | +| `siteImage` | string | link to site image | +| `siteLanguage` | string | site language, Deault is "en" | +| `siteTitle` | string | standalone site title. Default is "Component controls" | +| `siteTitleAlt` | string | site alt for images. Default is "Component controls - https://github.com/ccontrols/component-controls" | +| `siteUrl` | string | Deployed site url. Default is "https://component-controls-gatsby.netlify.app" | +| `storySort` | **function** (`a`\*: string, `b`\*: string): number; | story sorting function | +| `theme` | \[key: string]: any | theme-ui theme configuration | + +## PageType + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L4)_ + +'story' | 'blog' | 'page' | 'tags' | 'author' + +## PagesConfiguration + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L33)_ + +Record< + +[PageType](#pagetype) + +, + +[PageConfiguration](#pageconfiguration) + +> + +## RunConfiguration + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L133)_ + +### properties + +| Name | Type | Description | +| ---------------------- | ----------------------------------------------------------- | ----------- | +| `RunOnlyConfiguration` | [RunOnlyConfiguration](#runonlyconfiguration) | | +| `Omit` | Omit<[BuildConfiguration](#buildconfiguration), 'pages'> | | + +## WebpackConfig + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L39)_ + +[WebpackConfiguration](#webpackconfiguration) \| [WebpackConfigFn](#webpackconfigfn) + +## WebpackConfigFn + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L35)_ + +**function** (`config`\*: [WebpackConfiguration](#webpackconfiguration), `options`: any): [WebpackConfiguration](#webpackconfiguration); + +### parameters + +| Name | Type | Description | +| --------- | --------------------------------------------- | ----------- | +| `config*` | [WebpackConfiguration](#webpackconfiguration) | | +| `options` | any | | +| `returns` | [WebpackConfiguration](#webpackconfiguration) | | + +## defaultBuildConfig + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L169)_ + + + +### properties + +| Name | Type | Description | +| ------------- | --------------------- | ----------- | +| `categories*` | 'tags' \| 'author'\[] | | +| `pages*` | object | | + +## defaultRunConfig + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L136)_ + + + +### properties + +| Name | Type | Description | +| ------------------ | ------ | ----------- | +| `author*` | string | | +| `siteDescription*` | string | | +| `siteHeadline*` | string | | +| `siteLanguage*` | string | | +| `siteTitle*` | string | | +| `siteTitleAlt*` | string | | +| `siteUrl*` | string | | +| `pages*` | object | | + +## StoryRenderFn + +story render function + +_defined in [@component-controls/core/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/utility.ts#L98)_ + +**function** (`controlValues`\*: \[key: string]: any, `context`: any): any; + +### parameters + +| Name | Type | Description | +| ---------------- | ------------------- | ----------- | +| `controlValues*` | \[key: string]: any | | +| `context` | any | | +| `returns` | any | | + +## PageType + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L4)_ + +'story' | 'blog' | 'page' | 'tags' | 'author' + +## RunConfiguration + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L133)_ + +### properties + +| Name | Type | Description | +| ---------------------- | ----------------------------------------------------------- | ----------- | +| `RunOnlyConfiguration` | [RunOnlyConfiguration](#runonlyconfiguration) | | +| `Omit` | Omit<[BuildConfiguration](#buildconfiguration), 'pages'> | | + +## StoryArguments + +list of story arguments. Each argument can be a deconstructed argument of itself +the first argument are the control 'values' + +_defined in [@component-controls/core/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/stories.ts#L60)_ + +[StoryArgument](#storyargument)\[] + +## ComponentControl + +ComponentControl is a either an object of property settings +or a shortcut can be used: + properties: { + text: 'Hello', +}, + +_defined in [@component-controls/core/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/controls.ts#L371)_ + +[ComponentControlText](#componentcontroltext) \| [ComponentControlBoolean](#componentcontrolboolean) \| [ComponentControlColor](#componentcontrolcolor) \| [ComponentControlDate](#componentcontroldate) \| [ComponentControlObject](#componentcontrolobject) \| [ComponentControlButton](#componentcontrolbutton) \| [ComponentControlOptions](#componentcontroloptions) \| [ComponentControlNumber](#componentcontrolnumber) \| [ComponentControlArray](#componentcontrolarray) \| [ComponentControlFiles](#componentcontrolfiles) + +## TypeValue + +_defined in [@component-controls/core/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/components.ts#L3)_ + +'any' | 'boolean' | 'number' | 'string' | 'array' | 'object' | 'enum' | 'union' | 'literal' | 'symbol' | 'function' | string + +## PackageDependency + +dependecy string - the package version number + +_defined in [@component-controls/core/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/utility.ts#L44)_ + +string + +## WebpackConfig + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L39)_ + +[WebpackConfiguration](#webpackconfiguration) \| [WebpackConfigFn](#webpackconfigfn) + +## PagesConfiguration + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L33)_ + +Record< + +[PageType](#pagetype) + +, + +[PageConfiguration](#pageconfiguration) + +> + +## WebpackConfigFn + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L35)_ + +**function** (`config`\*: [WebpackConfiguration](#webpackconfiguration), `options`: any): [WebpackConfiguration](#webpackconfiguration); + +### parameters + +| Name | Type | Description | +| --------- | --------------------------------------------- | ----------- | +| `config*` | [WebpackConfiguration](#webpackconfiguration) | | +| `options` | any | | +| `returns` | [WebpackConfiguration](#webpackconfiguration) | | + +## PageType + +_defined in [@component-controls/core/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/core/src/configuration.ts#L4)_ + +'story' | 'blog' | 'page' | 'tags' | 'author' + + diff --git a/core/core/package.json b/core/core/package.json index 39dfec42e..8ab55fba6 100644 --- a/core/core/package.json +++ b/core/core/package.json @@ -1,7 +1,7 @@ { "name": "@component-controls/core", "version": "1.2.0", - "description": "Component controls core utility routines", + "description": "Component controls core types and utility functions", "main": "dist/index.js", "module": "dist/index.esm.js", "typings": "dist/index.d.ts", @@ -13,6 +13,7 @@ "scripts": { "build": "yarn cross-env NODE_ENV=production rollup -c", "dev": "yarn cross-env NODE_ENV=development rollup -cw", + "docs": "ts-node -O '{\"module\": \"commonjs\"}' ../../scripts/docs.ts", "fix": "yarn lint --fix", "lint": "yarn eslint . --ext mdx,ts,tsx", "prepare": "yarn build", @@ -29,7 +30,6 @@ }, "license": "MIT", "dependencies": { - "@component-controls/specification": "^1.2.0", "deepmerge": "^4.2.2", "escape-html": "^1.0.3", "faker": "^4.1.0", @@ -40,7 +40,8 @@ "@types/jest": "^25.1.2", "cross-env": "^5.2.1", "eslint": "^6.5.1", - "jest": "^24.9.0" + "jest": "^24.9.0", + "webpack": "^4.43.0" }, "publishConfig": { "access": "public" diff --git a/core/specification/src/components.ts b/core/core/src/components.ts similarity index 100% rename from core/specification/src/components.ts rename to core/core/src/components.ts diff --git a/core/specification/src/configuration.ts b/core/core/src/configuration.ts similarity index 100% rename from core/specification/src/configuration.ts rename to core/core/src/configuration.ts diff --git a/core/specification/src/controls.ts b/core/core/src/controls.ts similarity index 100% rename from core/specification/src/controls.ts rename to core/core/src/controls.ts diff --git a/core/specification/src/deepMerge.ts b/core/core/src/deepMerge.ts similarity index 100% rename from core/specification/src/deepMerge.ts rename to core/core/src/deepMerge.ts diff --git a/core/core/src/index.test.ts b/core/core/src/index.test.ts index f4ed0a8bc..fcbf8b501 100644 --- a/core/core/src/index.test.ts +++ b/core/core/src/index.test.ts @@ -1,59 +1,7 @@ -import { - ControlTypes, - ComponentControls, -} from '@component-controls/specification'; - -import { - mergeControlValues, - resetControlValues, - getControlValues, -} from './index'; - -describe('Controls utils', () => { - const controls: ComponentControls = { - name: { type: ControlTypes.TEXT, value: 'hello', resetValue: 'hello' }, - age: { type: ControlTypes.NUMBER, value: 19, resetValue: 19 }, - }; - const modifiedControls: ComponentControls = { - name: { type: ControlTypes.TEXT, value: 'today', resetValue: 'hello' }, - age: { type: ControlTypes.NUMBER, value: 19, resetValue: 19 }, - }; +import { ControlTypes } from './index'; +describe('verify imports', () => { it('Should merge property value', () => { - expect(mergeControlValues(controls, 'name', 'today')).toMatchObject( - modifiedControls, - ); - }); - it('Should merge property object', () => { - expect( - mergeControlValues(controls, undefined, { - name: modifiedControls.name.value, - age: modifiedControls.age.value, - }), - ).toMatchObject(modifiedControls); - }); - - it('Should reset property value', () => { - expect( - mergeControlValues( - modifiedControls, - 'name', - resetControlValues(modifiedControls, 'name'), - ), - ).toMatchObject(controls); - }); - it('Should reset entire object', () => { - expect(resetControlValues(modifiedControls)).toMatchObject( - getControlValues(controls), - ); - }); - it('Should reset reset entire object and match merged values', () => { - expect( - mergeControlValues( - modifiedControls, - undefined, - resetControlValues(modifiedControls), - ), - ).toMatchObject(controls); + expect(ControlTypes.TEXT === 'text').toEqual(true); }); }); diff --git a/core/core/src/index.ts b/core/core/src/index.ts index 795aeb505..cc62324aa 100644 --- a/core/core/src/index.ts +++ b/core/core/src/index.ts @@ -1,5 +1,19 @@ +export * from './components'; +export * from './configuration'; +export * from './controls'; +export * from './deepMerge'; +export * from './propsInfo'; +export * from './stories'; +export * from './utility'; export * from './utils'; export { randomizeData } from './randomizeData'; export * from './smartControls'; export * from './source'; export * from './faker'; + +export type SetControlValueFn = ( + storyId: string, + propertyName: string | undefined, + value: any, +) => void; +export type ClickControlFn = (storyId: string, propertyName: string) => void; diff --git a/core/specification/src/propsInfo.ts b/core/core/src/propsInfo.ts similarity index 100% rename from core/specification/src/propsInfo.ts rename to core/core/src/propsInfo.ts diff --git a/core/core/src/randomizeData.ts b/core/core/src/randomizeData.ts index 1a7a8b460..d7cac0be7 100644 --- a/core/core/src/randomizeData.ts +++ b/core/core/src/randomizeData.ts @@ -1,3 +1,5 @@ +import deepmerge from 'deepmerge'; +import { faker } from './faker'; import { ControlTypes, ComponentControlNumber, @@ -5,9 +7,7 @@ import { ComponentControl, ComponentControls, ComponentControlArray, -} from '@component-controls/specification'; -import deepmerge from 'deepmerge'; -import { faker } from './faker'; +} from './controls'; const arrayElements = (arr: any[], c?: number) => { const array = arr || ['a', 'b', 'c']; diff --git a/core/core/src/smartControls.ts b/core/core/src/smartControls.ts index 6e8a877a2..41d6da13c 100644 --- a/core/core/src/smartControls.ts +++ b/core/core/src/smartControls.ts @@ -1,11 +1,6 @@ /* eslint-disable no-console */ -import { - ComponentControl, - ComponentControls, - ControlTypes, - PropType, - PropTypes, -} from '@component-controls/specification'; +import { ComponentControl, ComponentControls, ControlTypes } from './controls'; +import { PropType, PropTypes } from './components'; const cleanQuotes = (txt?: string) => (txt ? txt.replace(/['"]+/g, '') : txt); diff --git a/core/core/src/source.ts b/core/core/src/source.ts index 5ca84f38f..e95222505 100644 --- a/core/core/src/source.ts +++ b/core/core/src/source.ts @@ -1,4 +1,4 @@ -import { CodeLocation } from '@component-controls/specification'; +import { CodeLocation } from './utility'; export const getASTSource = ( source?: string, diff --git a/core/specification/src/stories.ts b/core/core/src/stories.ts similarity index 100% rename from core/specification/src/stories.ts rename to core/core/src/stories.ts diff --git a/core/specification/src/stories/components/ArrayControl.ts b/core/core/src/stories/components/ArrayControl.ts similarity index 68% rename from core/specification/src/stories/components/ArrayControl.ts rename to core/core/src/stories/components/ArrayControl.ts index 19417853b..e255eb460 100644 --- a/core/specification/src/stories/components/ArrayControl.ts +++ b/core/core/src/stories/components/ArrayControl.ts @@ -1,4 +1,4 @@ -import { ComponentControlArray } from '@component-controls/specification'; +import { ComponentControlArray } from '../../controls'; import { AsReactComponent } from './types'; export const ArrayControl: AsReactComponent = ( diff --git a/core/specification/src/stories/components/BooleanControl.ts b/core/core/src/stories/components/BooleanControl.ts similarity index 68% rename from core/specification/src/stories/components/BooleanControl.ts rename to core/core/src/stories/components/BooleanControl.ts index 9c5071dae..582ff9821 100644 --- a/core/specification/src/stories/components/BooleanControl.ts +++ b/core/core/src/stories/components/BooleanControl.ts @@ -1,4 +1,4 @@ -import { ComponentControlBoolean } from '@component-controls/specification'; +import { ComponentControlBoolean } from '../../controls'; import { AsReactComponent } from './types'; export const BooleanControl: AsReactComponent = ( diff --git a/core/specification/src/stories/components/ButtonControl.ts b/core/core/src/stories/components/ButtonControl.ts similarity index 68% rename from core/specification/src/stories/components/ButtonControl.ts rename to core/core/src/stories/components/ButtonControl.ts index d985b52e0..9aa6c3d2d 100644 --- a/core/specification/src/stories/components/ButtonControl.ts +++ b/core/core/src/stories/components/ButtonControl.ts @@ -1,4 +1,4 @@ -import { ComponentControlButton } from '@component-controls/specification'; +import { ComponentControlButton } from '../../controls'; import { AsReactComponent } from './types'; export const ButtonControl: AsReactComponent = ( diff --git a/core/specification/src/stories/components/ColorControl.ts b/core/core/src/stories/components/ColorControl.ts similarity index 68% rename from core/specification/src/stories/components/ColorControl.ts rename to core/core/src/stories/components/ColorControl.ts index c137418ea..8adef125b 100644 --- a/core/specification/src/stories/components/ColorControl.ts +++ b/core/core/src/stories/components/ColorControl.ts @@ -1,4 +1,4 @@ -import { ComponentControlColor } from '@component-controls/specification'; +import { ComponentControlColor } from '../../controls'; import { AsReactComponent } from './types'; export const ColorControl: AsReactComponent = ( diff --git a/core/specification/src/stories/components/DateControl.ts b/core/core/src/stories/components/DateControl.ts similarity index 67% rename from core/specification/src/stories/components/DateControl.ts rename to core/core/src/stories/components/DateControl.ts index db43d420f..60b70dbd7 100644 --- a/core/specification/src/stories/components/DateControl.ts +++ b/core/core/src/stories/components/DateControl.ts @@ -1,4 +1,4 @@ -import { ComponentControlDate } from '@component-controls/specification'; +import { ComponentControlDate } from '../../controls'; import { AsReactComponent } from './types'; export const DateControl: AsReactComponent = ( diff --git a/core/specification/src/stories/components/FilesControl.ts b/core/core/src/stories/components/FilesControl.ts similarity index 68% rename from core/specification/src/stories/components/FilesControl.ts rename to core/core/src/stories/components/FilesControl.ts index d93deebc8..253262a43 100644 --- a/core/specification/src/stories/components/FilesControl.ts +++ b/core/core/src/stories/components/FilesControl.ts @@ -1,4 +1,4 @@ -import { ComponentControlFiles } from '@component-controls/specification'; +import { ComponentControlFiles } from '../../controls'; import { AsReactComponent } from './types'; export const FilesControl: AsReactComponent = ( diff --git a/core/specification/src/stories/components/NumberControl.ts b/core/core/src/stories/components/NumberControl.ts similarity index 68% rename from core/specification/src/stories/components/NumberControl.ts rename to core/core/src/stories/components/NumberControl.ts index 7ff38e234..82061f0a1 100644 --- a/core/specification/src/stories/components/NumberControl.ts +++ b/core/core/src/stories/components/NumberControl.ts @@ -1,4 +1,4 @@ -import { ComponentControlNumber } from '@component-controls/specification'; +import { ComponentControlNumber } from '../../controls'; import { AsReactComponent } from './types'; export const NumberControl: AsReactComponent = ( diff --git a/core/specification/src/stories/components/ObjectControl.ts b/core/core/src/stories/components/ObjectControl.ts similarity index 68% rename from core/specification/src/stories/components/ObjectControl.ts rename to core/core/src/stories/components/ObjectControl.ts index 7d0fd5c7b..a04f53a01 100644 --- a/core/specification/src/stories/components/ObjectControl.ts +++ b/core/core/src/stories/components/ObjectControl.ts @@ -1,4 +1,4 @@ -import { ComponentControlObject } from '@component-controls/specification'; +import { ComponentControlObject } from '../../controls'; import { AsReactComponent } from './types'; export const ObjectControl: AsReactComponent = ( diff --git a/core/specification/src/stories/components/OptionsControl.ts b/core/core/src/stories/components/OptionsControl.ts similarity index 68% rename from core/specification/src/stories/components/OptionsControl.ts rename to core/core/src/stories/components/OptionsControl.ts index c3d8aec6d..bf35519b8 100644 --- a/core/specification/src/stories/components/OptionsControl.ts +++ b/core/core/src/stories/components/OptionsControl.ts @@ -1,4 +1,4 @@ -import { ComponentControlOptions } from '@component-controls/specification'; +import { ComponentControlOptions } from '../../controls'; import { AsReactComponent } from './types'; export const OptionsControl: AsReactComponent = ( diff --git a/core/specification/src/stories/components/TextControl.ts b/core/core/src/stories/components/TextControl.ts similarity index 67% rename from core/specification/src/stories/components/TextControl.ts rename to core/core/src/stories/components/TextControl.ts index b6904fe4e..a4b485a6e 100644 --- a/core/specification/src/stories/components/TextControl.ts +++ b/core/core/src/stories/components/TextControl.ts @@ -1,4 +1,4 @@ -import { ComponentControlText } from '@component-controls/specification'; +import { ComponentControlText } from '../../controls'; import { AsReactComponent } from './types'; export const TextControl: AsReactComponent = ( diff --git a/core/specification/src/stories/components/types.ts b/core/core/src/stories/components/types.ts similarity index 56% rename from core/specification/src/stories/components/types.ts rename to core/core/src/stories/components/types.ts index daa8f7e35..ddd181620 100644 --- a/core/specification/src/stories/components/types.ts +++ b/core/core/src/stories/components/types.ts @@ -1,4 +1,4 @@ -import { ComponentControlBase } from '@component-controls/specification'; +import { ComponentControlBase } from '../../controls'; export type AsReactComponent> = ( _props: T, diff --git a/core/specification/src/stories/controls-array.stories.js b/core/core/src/stories/controls-array.stories.js similarity index 96% rename from core/specification/src/stories/controls-array.stories.js rename to core/core/src/stories/controls-array.stories.js index a8dbd7f5b..3f5cffc82 100644 --- a/core/specification/src/stories/controls-array.stories.js +++ b/core/core/src/stories/controls-array.stories.js @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '../components'; import { ArrayControl } from './components/ArrayControl'; export default { diff --git a/core/specification/src/stories/controls-boolean.stories.js b/core/core/src/stories/controls-boolean.stories.js similarity index 87% rename from core/specification/src/stories/controls-boolean.stories.js rename to core/core/src/stories/controls-boolean.stories.js index ecd86977d..1f8971595 100644 --- a/core/specification/src/stories/controls-boolean.stories.js +++ b/core/core/src/stories/controls-boolean.stories.js @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '../components'; import { BooleanControl } from './components/BooleanControl'; export default { diff --git a/core/specification/src/stories/controls-button.stories.js b/core/core/src/stories/controls-button.stories.js similarity index 88% rename from core/specification/src/stories/controls-button.stories.js rename to core/core/src/stories/controls-button.stories.js index d35612c9d..80077b207 100644 --- a/core/specification/src/stories/controls-button.stories.js +++ b/core/core/src/stories/controls-button.stories.js @@ -1,6 +1,6 @@ import React from 'react'; import { Button } from 'theme-ui'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '../components'; import { ButtonControl } from './components/ButtonControl'; export default { diff --git a/core/specification/src/stories/controls-color.stories.js b/core/core/src/stories/controls-color.stories.js similarity index 88% rename from core/specification/src/stories/controls-color.stories.js rename to core/core/src/stories/controls-color.stories.js index 6a980f74c..9f386038d 100644 --- a/core/specification/src/stories/controls-color.stories.js +++ b/core/core/src/stories/controls-color.stories.js @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '../components'; import { ColorControl } from './components/ColorControl'; export default { diff --git a/core/specification/src/stories/controls-date.stories.js b/core/core/src/stories/controls-date.stories.js similarity index 94% rename from core/specification/src/stories/controls-date.stories.js rename to core/core/src/stories/controls-date.stories.js index ef64c5a85..f68a2148a 100644 --- a/core/specification/src/stories/controls-date.stories.js +++ b/core/core/src/stories/controls-date.stories.js @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '../components'; import { DateControl } from './components/DateControl'; export default { diff --git a/core/specification/src/stories/controls-files.stories.js b/core/core/src/stories/controls-files.stories.js similarity index 93% rename from core/specification/src/stories/controls-files.stories.js rename to core/core/src/stories/controls-files.stories.js index 53809c841..3ead230ff 100644 --- a/core/specification/src/stories/controls-files.stories.js +++ b/core/core/src/stories/controls-files.stories.js @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '../components'; import { FilesControl } from './components/FilesControl'; export default { diff --git a/core/specification/src/stories/controls-number.stories.js b/core/core/src/stories/controls-number.stories.js similarity index 94% rename from core/specification/src/stories/controls-number.stories.js rename to core/core/src/stories/controls-number.stories.js index 6df4add10..b28dbede0 100644 --- a/core/specification/src/stories/controls-number.stories.js +++ b/core/core/src/stories/controls-number.stories.js @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '../components'; import { NumberControl } from './components/NumberControl'; export default { diff --git a/core/specification/src/stories/controls-object.stories.js b/core/core/src/stories/controls-object.stories.js similarity index 95% rename from core/specification/src/stories/controls-object.stories.js rename to core/core/src/stories/controls-object.stories.js index e6b2188fe..65aed6af6 100644 --- a/core/specification/src/stories/controls-object.stories.js +++ b/core/core/src/stories/controls-object.stories.js @@ -1,6 +1,6 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; import { Button } from 'theme-ui'; +import { ControlTypes } from '../components'; import { ObjectControl } from './components/ObjectControl'; export default { diff --git a/core/specification/src/stories/controls-options.stories.js b/core/core/src/stories/controls-options.stories.js similarity index 98% rename from core/specification/src/stories/controls-options.stories.js rename to core/core/src/stories/controls-options.stories.js index 700d63e00..a96ba3c8f 100644 --- a/core/specification/src/stories/controls-options.stories.js +++ b/core/core/src/stories/controls-options.stories.js @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '../components'; import { OptionsControl } from './components/OptionsControl'; export default { diff --git a/core/specification/src/stories/controls-text.stories.js b/core/core/src/stories/controls-text.stories.js similarity index 96% rename from core/specification/src/stories/controls-text.stories.js rename to core/core/src/stories/controls-text.stories.js index 5f23193f5..a42811444 100644 --- a/core/specification/src/stories/controls-text.stories.js +++ b/core/core/src/stories/controls-text.stories.js @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '../components'; import { TextControl } from './components/TextControl'; export default { diff --git a/core/specification/src/utility.ts b/core/core/src/utility.ts similarity index 100% rename from core/specification/src/utility.ts rename to core/core/src/utility.ts diff --git a/core/core/src/utils.ts b/core/core/src/utils.ts index ef8269b03..6489bb445 100644 --- a/core/core/src/utils.ts +++ b/core/core/src/utils.ts @@ -5,7 +5,7 @@ import { ComponentControls, ComponentControlArray, ControlTypes, -} from '@component-controls/specification'; +} from './controls'; import deepmerge from 'deepmerge'; const mergeValue = (control: ComponentControl, value: any): any => { diff --git a/core/core/src/__snapshots__/randomize.test.ts.snap b/core/core/test/__snapshots__/randomize.test.ts.snap similarity index 100% rename from core/core/src/__snapshots__/randomize.test.ts.snap rename to core/core/test/__snapshots__/randomize.test.ts.snap diff --git a/core/core/test/index.test.ts b/core/core/test/index.test.ts new file mode 100644 index 000000000..a1c557c24 --- /dev/null +++ b/core/core/test/index.test.ts @@ -0,0 +1,56 @@ +import { + ControlTypes, + ComponentControls, + mergeControlValues, + resetControlValues, + getControlValues, +} from '../src/index'; + +describe('Controls utils', () => { + const controls: ComponentControls = { + name: { type: ControlTypes.TEXT, value: 'hello', resetValue: 'hello' }, + age: { type: ControlTypes.NUMBER, value: 19, resetValue: 19 }, + }; + const modifiedControls: ComponentControls = { + name: { type: ControlTypes.TEXT, value: 'today', resetValue: 'hello' }, + age: { type: ControlTypes.NUMBER, value: 19, resetValue: 19 }, + }; + + it('Should merge property value', () => { + expect(mergeControlValues(controls, 'name', 'today')).toMatchObject( + modifiedControls, + ); + }); + it('Should merge property object', () => { + expect( + mergeControlValues(controls, undefined, { + name: modifiedControls.name.value, + age: modifiedControls.age.value, + }), + ).toMatchObject(modifiedControls); + }); + + it('Should reset property value', () => { + expect( + mergeControlValues( + modifiedControls, + 'name', + resetControlValues(modifiedControls, 'name'), + ), + ).toMatchObject(controls); + }); + it('Should reset entire object', () => { + expect(resetControlValues(modifiedControls)).toMatchObject( + getControlValues(controls), + ); + }); + it('Should reset reset entire object and match merged values', () => { + expect( + mergeControlValues( + modifiedControls, + undefined, + resetControlValues(modifiedControls), + ), + ).toMatchObject(controls); + }); +}); diff --git a/core/core/src/randomize.test.ts b/core/core/test/randomize.test.ts similarity index 92% rename from core/core/src/randomize.test.ts rename to core/core/test/randomize.test.ts index 9c01432e5..684fcd546 100644 --- a/core/core/src/randomize.test.ts +++ b/core/core/test/randomize.test.ts @@ -1,8 +1,5 @@ const faker = require('faker/locale/en_US'); -import { - ControlTypes, - ComponentControl, -} from '@component-controls/specification'; +import { ControlTypes, ComponentControl } from '../src'; import { randomizeData } from '@component-controls/core/src/randomizeData'; describe('Options utility functions', () => { diff --git a/core/instrument/package.json b/core/instrument/package.json index 687ca1a70..1c51c6efb 100644 --- a/core/instrument/package.json +++ b/core/instrument/package.json @@ -34,7 +34,6 @@ "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "camelcase": "^6.0.0", diff --git a/core/instrument/src/babel/csf-stories.ts b/core/instrument/src/babel/csf-stories.ts index 2bf477cfc..fe60c7436 100644 --- a/core/instrument/src/babel/csf-stories.ts +++ b/core/instrument/src/babel/csf-stories.ts @@ -1,4 +1,4 @@ -import { Story, StoriesDoc, Stories } from '@component-controls/specification'; +import { Story, StoriesDoc, Stories } from '@component-controls/core'; import { File } from '@babel/types'; import traverse from '@babel/traverse'; import { extractFunctionParameters } from './extract-function-parameters'; diff --git a/core/instrument/src/babel/extract-arguments-usage.ts b/core/instrument/src/babel/extract-arguments-usage.ts index 939b59ee8..3a1ef85c8 100644 --- a/core/instrument/src/babel/extract-arguments-usage.ts +++ b/core/instrument/src/babel/extract-arguments-usage.ts @@ -3,7 +3,7 @@ import { StoryArguments, StoryArgument, ArgUsageLocation, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { adjustSourceLocation } from '../misc/source-location'; const findArguments = ( diff --git a/core/instrument/src/babel/extract-attributes.ts b/core/instrument/src/babel/extract-attributes.ts index b27aa4f8e..c4276bf61 100644 --- a/core/instrument/src/babel/extract-attributes.ts +++ b/core/instrument/src/babel/extract-attributes.ts @@ -1,4 +1,4 @@ -import { StoryParameters } from '@component-controls/specification'; +import { StoryParameters } from '@component-controls/core'; interface StoryAttribute { name: string; diff --git a/core/instrument/src/babel/extract-component.ts b/core/instrument/src/babel/extract-component.ts index 8f35135c0..7bb67d320 100644 --- a/core/instrument/src/babel/extract-component.ts +++ b/core/instrument/src/babel/extract-component.ts @@ -3,7 +3,7 @@ import { StoryComponent, StoriesDoc, PackageInfo, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { hashStoreId } from '../misc/hashStore'; import { followImports } from './follow-imports'; import { packageInfo } from '../misc/package-info'; diff --git a/core/instrument/src/babel/extract-exports.ts b/core/instrument/src/babel/extract-exports.ts index ef880c953..0ae483988 100644 --- a/core/instrument/src/babel/extract-exports.ts +++ b/core/instrument/src/babel/extract-exports.ts @@ -1,6 +1,6 @@ import * as parser from '@babel/parser'; import traverse from '@babel/traverse'; -import { CodeLocation } from '@component-controls/specification'; +import { CodeLocation } from '@component-controls/core'; import { sourceLocation } from '../misc/source-location'; export interface ExportType { diff --git a/core/instrument/src/babel/extract-function-parameters.ts b/core/instrument/src/babel/extract-function-parameters.ts index d73214147..938f1cc59 100644 --- a/core/instrument/src/babel/extract-function-parameters.ts +++ b/core/instrument/src/babel/extract-function-parameters.ts @@ -1,10 +1,6 @@ import traverse from '@babel/traverse'; import generate from '@babel/generator'; -import { - Story, - CodeLocation, - StoryArguments, -} from '@component-controls/specification'; +import { Story, CodeLocation, StoryArguments } from '@component-controls/core'; import { adjustSourceLocation } from '../misc/source-location'; import { extractArgumentsUsage, diff --git a/core/instrument/src/babel/follow-imports.ts b/core/instrument/src/babel/follow-imports.ts index 54ab7def1..43a1a5923 100644 --- a/core/instrument/src/babel/follow-imports.ts +++ b/core/instrument/src/babel/follow-imports.ts @@ -8,8 +8,8 @@ import { CodeLocation, Imports, Story, -} from '@component-controls/specification'; -import { getASTSource } from '@component-controls/core'; + getASTSource, +} from '@component-controls/core'; import { extractFunctionParameters } from './extract-function-parameters'; import { sourceLocation } from '../misc/source-location'; import { ImportTypes, traverseImports } from './extract-imports'; diff --git a/core/instrument/src/babel/mdx-stories.ts b/core/instrument/src/babel/mdx-stories.ts index 911e08c75..981a5cb9d 100644 --- a/core/instrument/src/babel/mdx-stories.ts +++ b/core/instrument/src/babel/mdx-stories.ts @@ -3,8 +3,8 @@ import { StoriesDoc, StoryParameters, CodeLocation, -} from '@component-controls/specification'; -import { getASTSource } from '@component-controls/core'; + getASTSource, +} from '@component-controls/core'; import camelCase from 'camelcase'; import { File } from '@babel/types'; import traverse from '@babel/traverse'; diff --git a/core/instrument/src/index.ts b/core/instrument/src/index.ts index 877df081d..1b7931f1a 100644 --- a/core/instrument/src/index.ts +++ b/core/instrument/src/index.ts @@ -5,8 +5,7 @@ import { File } from '@babel/types'; import traverse from '@babel/traverse'; import generate from '@babel/generator'; import deepMerge from 'deepmerge'; -import { Story, StoriesDoc } from '@component-controls/specification'; -import { getASTSource } from '@component-controls/core'; +import { Story, StoriesDoc, getASTSource } from '@component-controls/core'; import { extractCSFStories } from './babel/csf-stories'; import { extractMDXStories } from './babel/mdx-stories'; diff --git a/core/instrument/src/misc/component-attributes.ts b/core/instrument/src/misc/component-attributes.ts index c1ff5a74b..6e6eabdee 100644 --- a/core/instrument/src/misc/component-attributes.ts +++ b/core/instrument/src/misc/component-attributes.ts @@ -1,8 +1,4 @@ -import { - Story, - StoriesDoc, - StoryParameters, -} from '@component-controls/specification'; +import { Story, StoriesDoc, StoryParameters } from '@component-controls/core'; export const componentsFromParams = ( element: StoriesDoc | Story | StoryParameters, diff --git a/core/instrument/src/misc/package-info.ts b/core/instrument/src/misc/package-info.ts index 1bcd372a1..2d6ec76c0 100644 --- a/core/instrument/src/misc/package-info.ts +++ b/core/instrument/src/misc/package-info.ts @@ -5,7 +5,7 @@ import readJson from 'read-package-json'; import hostedGitInfo from 'hosted-git-info'; //@ts-ignore import parseRepositoryURL from '@hutson/parse-repository-url'; -import { PackageInfo } from '@component-controls/specification'; +import { PackageInfo } from '@component-controls/core'; import { hashStoreId } from './hashStore'; import { PackageInfoOptions } from '../types'; diff --git a/core/instrument/src/misc/props-info.ts b/core/instrument/src/misc/props-info.ts index 7e8040945..32f06a6a3 100644 --- a/core/instrument/src/misc/props-info.ts +++ b/core/instrument/src/misc/props-info.ts @@ -6,7 +6,7 @@ import findCacheDir from 'find-cache-dir'; import { ComponentInfo, PropsInfoExtractorFunction, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { PropsLoaderConfig } from '../types'; export const propsInfo = async ( diff --git a/core/instrument/src/misc/source-location.ts b/core/instrument/src/misc/source-location.ts index 1cc26bde6..554f71229 100644 --- a/core/instrument/src/misc/source-location.ts +++ b/core/instrument/src/misc/source-location.ts @@ -1,4 +1,4 @@ -import { Story, CodeLocation } from '@component-controls/specification'; +import { Story, CodeLocation } from '@component-controls/core'; export const adjustSourceLocation = ( story: Story, diff --git a/core/instrument/src/types.ts b/core/instrument/src/types.ts index 70939888a..3db28a698 100644 --- a/core/instrument/src/types.ts +++ b/core/instrument/src/types.ts @@ -1,5 +1,5 @@ import { ParserOptions } from '@babel/parser'; -import { StoriesDoc, StoriesStore } from '@component-controls/specification'; +import { StoriesDoc, StoriesStore } from '@component-controls/core'; import { SyncOpts as ResolveOptions } from 'resolve'; import { Options, diff --git a/core/instrument/test/__snapshots__/csf-exclude-stories.test.ts.snap b/core/instrument/test/__snapshots__/csf-exclude-stories.test.ts.snap index 0675426b7..f47eadf51 100644 --- a/core/instrument/test/__snapshots__/csf-exclude-stories.test.ts.snap +++ b/core/instrument/test/__snapshots__/csf-exclude-stories.test.ts.snap @@ -19,7 +19,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -101,7 +100,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -186,7 +184,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -284,7 +281,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", diff --git a/core/instrument/test/__snapshots__/csf-named-exports.test.ts.snap b/core/instrument/test/__snapshots__/csf-named-exports.test.ts.snap index efb375e8b..4435df40b 100644 --- a/core/instrument/test/__snapshots__/csf-named-exports.test.ts.snap +++ b/core/instrument/test/__snapshots__/csf-named-exports.test.ts.snap @@ -15,7 +15,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -95,7 +94,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -175,7 +173,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", diff --git a/core/instrument/test/__snapshots__/csf-parameters.test.ts.snap b/core/instrument/test/__snapshots__/csf-parameters.test.ts.snap index 98a51e125..eea175ca1 100644 --- a/core/instrument/test/__snapshots__/csf-parameters.test.ts.snap +++ b/core/instrument/test/__snapshots__/csf-parameters.test.ts.snap @@ -21,7 +21,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -112,7 +111,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -216,7 +214,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", diff --git a/core/instrument/test/__snapshots__/csf-props-info.test.ts.snap b/core/instrument/test/__snapshots__/csf-props-info.test.ts.snap index 87ee0816e..aee5a32d3 100644 --- a/core/instrument/test/__snapshots__/csf-props-info.test.ts.snap +++ b/core/instrument/test/__snapshots__/csf-props-info.test.ts.snap @@ -3027,10 +3027,10 @@ user setting can display only props table or only controls", "@component-controls/components": "^1.2.0", "@component-controls/core": "^1.2.0", "@component-controls/editors": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@component-controls/store": "^1.2.0", "@primer/octicons-react": "^9.6.0", "@storybook/csf": "^0.0.1", + "@theme-ui/css": "^0.3.1", "@theme-ui/mdx": "^0.3.0", "copy-to-clipboard": "^3.2.1", "global": "^4.3.2", @@ -3074,7 +3074,6 @@ user setting can display only props table or only controls", "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", diff --git a/core/instrument/test/__snapshots__/csf-props-usage.test.ts.snap b/core/instrument/test/__snapshots__/csf-props-usage.test.ts.snap index d2cf5b067..26027ac53 100644 --- a/core/instrument/test/__snapshots__/csf-props-usage.test.ts.snap +++ b/core/instrument/test/__snapshots__/csf-props-usage.test.ts.snap @@ -15,7 +15,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -127,7 +126,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -267,7 +265,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -389,7 +386,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -529,7 +525,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -675,7 +670,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -903,7 +897,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -1010,7 +1003,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -1147,7 +1139,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -1287,7 +1278,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -1435,7 +1425,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -1640,7 +1629,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -1761,7 +1749,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -1916,7 +1903,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", diff --git a/core/instrument/test/__snapshots__/csf-stories.test.ts.snap b/core/instrument/test/__snapshots__/csf-stories.test.ts.snap index 2c922632c..d0f5900c6 100644 --- a/core/instrument/test/__snapshots__/csf-stories.test.ts.snap +++ b/core/instrument/test/__snapshots__/csf-stories.test.ts.snap @@ -15,7 +15,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -75,7 +74,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -150,7 +148,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -208,7 +205,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -298,7 +294,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -446,7 +441,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -550,7 +544,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -669,7 +662,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -788,7 +780,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", diff --git a/core/instrument/test/__snapshots__/csf-story-doc.test.ts.snap b/core/instrument/test/__snapshots__/csf-story-doc.test.ts.snap index 5743e00ee..f496c9157 100644 --- a/core/instrument/test/__snapshots__/csf-story-doc.test.ts.snap +++ b/core/instrument/test/__snapshots__/csf-story-doc.test.ts.snap @@ -16,7 +16,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -89,7 +88,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -171,7 +169,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -241,7 +238,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", diff --git a/core/instrument/test/__snapshots__/csf-toggle.test.ts.snap b/core/instrument/test/__snapshots__/csf-toggle.test.ts.snap index 37b57ee8d..5ca482648 100644 --- a/core/instrument/test/__snapshots__/csf-toggle.test.ts.snap +++ b/core/instrument/test/__snapshots__/csf-toggle.test.ts.snap @@ -28,7 +28,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", diff --git a/core/instrument/test/__snapshots__/extract-component.test.ts.snap b/core/instrument/test/__snapshots__/extract-component.test.ts.snap index 765104bd5..126357772 100644 --- a/core/instrument/test/__snapshots__/extract-component.test.ts.snap +++ b/core/instrument/test/__snapshots__/extract-component.test.ts.snap @@ -22,7 +22,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -82,7 +81,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -164,7 +162,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -329,7 +326,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -389,7 +385,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", diff --git a/core/instrument/test/__snapshots__/mdx-stories.test.ts.snap b/core/instrument/test/__snapshots__/mdx-stories.test.ts.snap index 8428468f6..eec0d66a8 100644 --- a/core/instrument/test/__snapshots__/mdx-stories.test.ts.snap +++ b/core/instrument/test/__snapshots__/mdx-stories.test.ts.snap @@ -31,7 +31,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -114,7 +113,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -252,7 +250,6 @@ export default Button; "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -293,7 +290,6 @@ export default Button; "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -393,7 +389,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -571,7 +566,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -715,7 +709,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", @@ -844,7 +837,6 @@ Object { "@babel/parser": "^7.9.4", "@babel/traverse": "^7.9.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@hutson/parse-repository-url": "^5.0.0", "@mdx-js/loader": "^1.5.5", "@mdx-js/react": "^1.6.5", diff --git a/core/instrument/test/follow-imports-custom.test.ts b/core/instrument/test/follow-imports-custom.test.ts index cf6a52c55..cbd0b2b90 100644 --- a/core/instrument/test/follow-imports-custom.test.ts +++ b/core/instrument/test/follow-imports-custom.test.ts @@ -37,7 +37,7 @@ describe('follow-imports-custom', () => { ), ` import React from 'react'; - import { ControlTypes } from '@component-controls/specification'; + import { ControlTypes } from '@component-controls/core'; import { BooleanEditor } from './BooleanEditor'; export default { diff --git a/core/loader/package.json b/core/loader/package.json index 5370466a6..ef7dacc87 100644 --- a/core/loader/package.json +++ b/core/loader/package.json @@ -37,7 +37,7 @@ "dependencies": { "@component-controls/config": "^1.2.0", "@component-controls/instrument": "^1.2.0", - "@component-controls/specification": "^1.2.0", + "@component-controls/core": "^1.2.0", "@storybook/csf": "^0.0.1", "chalk": "^4.0.0", "js-string-escape": "^1.0.1", diff --git a/core/loader/src/replaceSource.ts b/core/loader/src/replaceSource.ts index cf81edac1..a4ffeb9f2 100644 --- a/core/loader/src/replaceSource.ts +++ b/core/loader/src/replaceSource.ts @@ -1,4 +1,4 @@ -import { BuildConfiguration } from '@component-controls/specification'; +import { BuildConfiguration } from '@component-controls/core'; export interface StoryPath { absPath: string; diff --git a/core/loader/src/runtimeLoader.ts b/core/loader/src/runtimeLoader.ts index 3d9f517fd..915bd03f0 100644 --- a/core/loader/src/runtimeLoader.ts +++ b/core/loader/src/runtimeLoader.ts @@ -1,7 +1,4 @@ -import { - deepMerge, - defaultBuildConfig, -} from '@component-controls/specification'; +import { deepMerge, defaultBuildConfig } from '@component-controls/core'; import { loadConfiguration, extractStories } from '@component-controls/config'; import { stringifyRequest } from 'loader-utils'; diff --git a/core/loader/src/store.ts b/core/loader/src/store.ts index bd74f4fe8..27cb69656 100644 --- a/core/loader/src/store.ts +++ b/core/loader/src/store.ts @@ -7,7 +7,7 @@ import { defPageType, Pages, PageType, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { LoadingDocStore } from '@component-controls/instrument'; export interface LoadingStore { diff --git a/core/specification/.babelrc b/core/specification/.babelrc deleted file mode 100644 index c64480144..000000000 --- a/core/specification/.babelrc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - [ - "@babel/preset-env", - { - "targets": { - "node": "current" - } - } - ] - ] -} \ No newline at end of file diff --git a/core/specification/.eslintignore b/core/specification/.eslintignore deleted file mode 100644 index 53c37a166..000000000 --- a/core/specification/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -dist \ No newline at end of file diff --git a/core/specification/CHANGELOG.md b/core/specification/CHANGELOG.md deleted file mode 100644 index 34674d6e1..000000000 --- a/core/specification/CHANGELOG.md +++ /dev/null @@ -1,243 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [1.2.0](https://github.com/ccontrols/component-controls/compare/v1.1.0...v1.2.0) (2020-05-23) - - -### Performance Improvements - -* optimize bundle, keep only en faker ([8e11fbe](https://github.com/ccontrols/component-controls/commit/8e11fbe0ccb655d091acad9ffea4729993da2ed9)) - - - - - -# [1.1.0](https://github.com/ccontrols/component-controls/compare/v1.0.3...v1.1.0) (2020-05-08) - - -### Features - -* add external dependencies block ([86f09a5](https://github.com/ccontrols/component-controls/commit/86f09a5f103a8df1b02503be8641eb0671a23e24)) -* add per story description, supports markdown ([578d820](https://github.com/ccontrols/component-controls/commit/578d8204c192947e5b286992b41aa667652a5e83)) -* array structured control editor ([1608bb7](https://github.com/ccontrols/component-controls/commit/1608bb7f9e82a713c755ea4dfff86e8ed3d9b2f1)) -* config package to read configuration files ([bbd06f7](https://github.com/ccontrols/component-controls/commit/bbd06f7fa9f73b17303a204896d0eeaf6feab1a7)) -* enhance object controls handling, merging ([62366e4](https://github.com/ccontrols/component-controls/commit/62366e405fc254b30d293fd68d24ee6adb9e0858)) -* props table featured controls with actions ([fc9a8f7](https://github.com/ccontrols/component-controls/commit/fc9a8f7d83e400d534305c978247a93a2d73174d)) - - - - - -## [1.0.1](https://github.com/ccontrols/component-controls/compare/v0.9.0...v1.0.1) (2020-04-26) - -**Note:** Version bump only for package @component-controls/specification - - - - - -# [0.9.0](https://github.com/ccontrols/component-controls/compare/v0.8.2...v0.9.0) (2020-04-26) - - -### Features - -* added StorySource addon panel ([7087bb6](https://github.com/ccontrols/component-controls/commit/7087bb6275e70b8f5b191b563af6e4a70b0af82d)) - - - - - -# [0.8.0](https://github.com/ccontrols/component-controls/compare/v0.7.9...v0.8.0) (2020-04-25) - - -### Features - -* support for decaorators ([686564f](https://github.com/ccontrols/component-controls/commit/686564f2801bbd33ed4034c2e058d19ef4981094)) - - - - - -## [0.7.1](https://github.com/ccontrols/component-controls/compare/v0.7.0...v0.7.1) (2020-04-23) - -**Note:** Version bump only for package @component-controls/specification - - - - - -# [0.7.0](https://github.com/ccontrols/component-controls/compare/v0.6.0...v0.7.0) (2020-04-23) - - -### Bug Fixes - -* accept false for data: ([1ec10ba](https://github.com/ccontrols/component-controls/commit/1ec10ba72e5da3aca9a7bc594d2de6e287a912f2)) -* add prop tables for type alias ([6c99842](https://github.com/ccontrols/component-controls/commit/6c99842392fdd8dfbf316f94aaf68c0d14f8bb35)) -* resolve components in store ([0e69643](https://github.com/ccontrols/component-controls/commit/0e69643df02266f1fd4039d2df8ad7384e9f3274)) -* source tags fixes ([f455cd8](https://github.com/ccontrols/component-controls/commit/f455cd8ae4bff0587daea36f83891e290231e835)) -* support for arg usage with assignment ([34149aa](https://github.com/ccontrols/component-controls/commit/34149aa97dd75584615a69dbc748efc8a1ad7385)) -* various layout fixes ([1a8ff2a](https://github.com/ccontrols/component-controls/commit/1a8ff2acd128cc7c353cc5f6bb7b8e545917dafb)) - - -### Features - -* add description block ([7fabe82](https://github.com/ccontrols/component-controls/commit/7fabe824b31fb73b3656c7d3bc2b058f379f40d7)) -* add function return type to props table ([bc45094](https://github.com/ccontrols/component-controls/commit/bc4509402aa59a881c99c27cb742ccf06d75eeb7)) -* add props-info react-docgen and react-docgen-typescript ([8159202](https://github.com/ccontrols/component-controls/commit/81592029746fc037b7605a417f71f219089b153c)) -* add repo source link for typedoc ([ddba93e](https://github.com/ccontrols/component-controls/commit/ddba93ee609399cd7edaedc392991254cb8d4bd5)) -* add smart controls ([23a5284](https://github.com/ccontrols/component-controls/commit/23a52848a2202bce756a76f78fdada70f0dab388)) -* add Subtitle block ([6486d6c](https://github.com/ccontrols/component-controls/commit/6486d6ce496f780e51c5196b6c049bfefc087032)) -* added docs for react-docgen ([71d4629](https://github.com/ccontrols/component-controls/commit/71d462931a3196730889ae03a5d5685962ca6f78)) -* added docs for specification ([d894587](https://github.com/ccontrols/component-controls/commit/d8945876c0405e2f8a1ddc66571cd800cf060226)) -* added moduleid logic for __webpack_require__ ([7c97c9f](https://github.com/ccontrols/component-controls/commit/7c97c9f80e65359cc242ec112292b0774a4502ae)) -* component import code moved to block ([2c9828c](https://github.com/ccontrols/component-controls/commit/2c9828c54a31412964bbcc303ff06b5a29eeb351)) -* componnt import source ([d8a8231](https://github.com/ccontrols/component-controls/commit/d8a823173c02eceae4b66350b5bc33fa4c365a9d)) -* docs add extract union ([ed8e089](https://github.com/ccontrols/component-controls/commit/ed8e089784e46b325925018a56c05419ca48a7f4)) -* docs support for templates ([c04a539](https://github.com/ccontrols/component-controls/commit/c04a53942d69eddbdd7d42583ff2bf734e1ce790)) -* extract package name and se for ComponentSource ([71d6f13](https://github.com/ccontrols/component-controls/commit/71d6f13029ed765cec6b85d5f40244612f864851)) -* import comonent source block ([3d69fe1](https://github.com/ccontrols/component-controls/commit/3d69fe19eacc1d9de834de762697efb6792fc703)) -* initial check-in store package ([69f5762](https://github.com/ccontrols/component-controls/commit/69f57622a97499f6196896aa685e4f0601ea8e0c)) -* initial checkin typedoc for api ([47064cb](https://github.com/ccontrols/component-controls/commit/47064cb97e650ad89d7ed6029d4b9b0e7d90f834)) -* instrument options what to collect ([4998ed6](https://github.com/ccontrols/component-controls/commit/4998ed6de1d384bf0dba9fb3fd17094dbb11ebd9)) -* mdx docs page ([f7512b5](https://github.com/ccontrols/component-controls/commit/f7512b59793df33c86759bc5ac3320628ef5141c)) -* move controls to main story props ([5aeea92](https://github.com/ccontrols/component-controls/commit/5aeea92b16281d036de79c612be3bcbca289cdd1)) -* move store resolution to loader ([7caf7d5](https://github.com/ccontrols/component-controls/commit/7caf7d503738a4d1009453a83a9d379922302b80)) -* optimize BlockContext ([95d071b](https://github.com/ccontrols/component-controls/commit/95d071b28e35bf6c19ebecc03efb9576b10a603c)) -* parse component import into stories ([04c986a](https://github.com/ccontrols/component-controls/commit/04c986a9bf62577c5da3b1082fd3a30e0c7cc7bf)) -* refactor webpck loader to pitch ([839ae3e](https://github.com/ccontrols/component-controls/commit/839ae3e2b3e7a233ef189cc3001b105798778612)) -* replace values in Source ([1a90295](https://github.com/ccontrols/component-controls/commit/1a902953992509496f9ae773ccea561a0b228dff)) -* show full file source ([881ff32](https://github.com/ccontrols/component-controls/commit/881ff3244c85a075775ed5697396adbe08dd932c)) -* store to use loader for storyfn ([25adfb7](https://github.com/ccontrols/component-controls/commit/25adfb70ecc2957cd32916fcf228170c3abf1b77)) -* update block ControlsTable and ComponentSource ([ff4175c](https://github.com/ccontrols/component-controls/commit/ff4175c1877729e6e5ebdaec5e706bdfc0c9738e)) - - -### Reverts - -* Revert "chore: update infrastructure" ([f475d86](https://github.com/ccontrols/component-controls/commit/f475d86a4e4ac5ba1ce11467d9ae45f24a518f79)) - - - - - -# [0.6.0](https://github.com/ccontrols/component-controls/compare/v0.5.1...v0.6.0) (2020-02-14) - - -### Features - -* smart controls synchronization ([d181774](https://github.com/ccontrols/component-controls/commit/d1817747cc55123be17de1d4a72b8a58ace7fa1c)) - - - - - -## [0.5.1](https://github.com/ccontrols/component-controls/compare/v0.5.0...v0.5.1) (2020-02-12) - - -### Bug Fixes - -* number random generator with step and min/max ([c42d7e4](https://github.com/ccontrols/component-controls/commit/c42d7e4dc55855014f921261d267157afa1636df)) - - - - - -# [0.5.0](https://github.com/ccontrols/component-controls/compare/v0.4.0...v0.5.0) (2020-02-12) - -**Note:** Version bump only for package @component-controls/specification - - - - - -# [0.4.0](https://github.com/ccontrols/component-controls/compare/v0.3.5...v0.4.0) (2020-02-12) - -**Note:** Version bump only for package @component-controls/specification - - - - - -## [0.3.5](https://github.com/ccontrols/component-controls/compare/v0.3.4...v0.3.5) (2020-02-12) - -**Note:** Version bump only for package @component-controls/specification - - - - - -## [0.3.3](https://github.com/ccontrols/component-controls/compare/v0.3.2...v0.3.3) (2020-02-12) - -**Note:** Version bump only for package @component-controls/specification - - - - - -## [0.3.1](https://github.com/ccontrols/component-controls/compare/v0.3.0...v0.3.1) (2020-02-12) - -**Note:** Version bump only for package @component-controls/specification - - - - - -# [0.3.0](https://github.com/ccontrols/component-controls/compare/v0.2.0...v0.3.0) (2020-02-12) - - -### Features - -* synchronize manage/preview legacy mode ([4fc7de3](https://github.com/ccontrols/component-controls/commit/4fc7de3e6c3bda3df83f8af4d50a1f8f402b8029)) - - - - - -# [0.2.0](https://github.com/ccontrols/component-controls/compare/v0.1.11...v0.2.0) (2020-02-11) - - -### Features - -* aded tabs component ([6191630](https://github.com/ccontrols/component-controls/commit/619163027e8fb413a0cfefd65a2c5cb508a20b43)) -* remove storybook/components ([5e2f929](https://github.com/ccontrols/component-controls/commit/5e2f929964b4d37868ca1f1d891b24f10d3a9928)) - - - - - -## [0.1.11](https://github.com/ccontrols/component-controls/compare/v0.1.10...v0.1.11) (2020-02-09) - -**Note:** Version bump only for package @component-controls/specification - - - - - -## [0.1.6](https://github.com/atanasster/component-controls/compare/v0.1.5...v0.1.6) (2020-02-08) - -**Note:** Version bump only for package @component-controls/specification - - - - - -## [0.1.3](https://github.com/atanasster/component-controls/compare/v0.1.2...v0.1.3) (2020-02-08) - -**Note:** Version bump only for package @component-controls/specification - - - - - -## [0.1.2](https://github.com/atanasster/component-controls/compare/v0.1.1...v0.1.2) (2020-02-07) - -**Note:** Version bump only for package @component-controls/specification - - - - - -## 0.1.1 (2020-02-07) - -**Note:** Version bump only for package @component-controls/specification diff --git a/core/specification/LICENSE.md b/core/specification/LICENSE.md deleted file mode 100644 index a64cf9401..000000000 --- a/core/specification/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Atanas Stoyanov - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/core/specification/README.md b/core/specification/README.md deleted file mode 100644 index df786b43b..000000000 --- a/core/specification/README.md +++ /dev/null @@ -1,1169 +0,0 @@ -# Table of contents - -- [Overview](#overview) -- [Installation](#installation) -- [API](#api) - - [ArgUsageLocation](#argusagelocation) - - [SourceIdentifier](#sourceidentifier) - - [Stories](#stories) - - [StoriesDoc](#storiesdoc) - - [StoriesStore](#storiesstore) - - [Story](#story) - - [StoryArgument](#storyargument) - - [StoryComponents](#storycomponents) - - [StoryDocs](#storydocs) - - [StoryPackages](#storypackages) - - [StoryParameters](#storyparameters) - - [StoryStories](#storystories) - - [Pages](#pages) - - [StoryArguments](#storyarguments) - - [defPageType](#defpagetype) - - [getDocPath](#getdocpath) - - [getStoryPath](#getstorypath) - - [ControlTypes](#controltypes) - - [ComponentControlArray](#componentcontrolarray) - - [ComponentControlBase](#componentcontrolbase) - - [ComponentControlBoolean](#componentcontrolboolean) - - [ComponentControlButton](#componentcontrolbutton) - - [ComponentControlColor](#componentcontrolcolor) - - [ComponentControlData](#componentcontroldata) - - [ComponentControlDate](#componentcontroldate) - - [ComponentControlFiles](#componentcontrolfiles) - - [ComponentControlNumber](#componentcontrolnumber) - - [ComponentControlObject](#componentcontrolobject) - - [ComponentControlOptions](#componentcontroloptions) - - [ComponentControlText](#componentcontroltext) - - [ComponentControls](#componentcontrols) - - [ComponentControl](#componentcontrol) - - [OptionsListType](#optionslisttype) - - [OptionsValueType](#optionsvaluetype) - - [ComponentInfo](#componentinfo) - - [PropType](#proptype) - - [PropTypes](#proptypes) - - [StoryComponent](#storycomponent) - - [TypeInformation](#typeinformation) - - [TypeValue](#typevalue) - - [getComponentName](#getcomponentname) - - [PropsInfoExtractorFunction](#propsinfoextractorfunction) - - [CodeLocation](#codelocation) - - [CodePosition](#codeposition) - - [ImportName](#importname) - - [Imports](#imports) - - [PackageDependencies](#packagedependencies) - - [PackageInfo](#packageinfo) - - [PackageRepository](#packagerepository) - - [PackageDependency](#packagedependency) - - [StoryRenderFn](#storyrenderfn) - - [BuildConfiguration](#buildconfiguration) - - [PageConfiguration](#pageconfiguration) - - [RunOnlyConfiguration](#runonlyconfiguration) - - [PageType](#pagetype) - - [PagesConfiguration](#pagesconfiguration) - - [RunConfiguration](#runconfiguration) - - [WebpackConfig](#webpackconfig) - - [WebpackConfigFn](#webpackconfigfn) - - [defaultBuildConfig](#defaultbuildconfig) - - [defaultRunConfig](#defaultrunconfig) - - [StoryRenderFn](#storyrenderfn-1) - - [PageType](#pagetype-1) - - [RunConfiguration](#runconfiguration-1) - - [StoryArguments](#storyarguments-1) - - [ComponentControl](#componentcontrol-1) - - [TypeValue](#typevalue-1) - - [PackageDependency](#packagedependency-1) - - [WebpackConfig](#webpackconfig-1) - - [PagesConfiguration](#pagesconfiguration-1) - - [WebpackConfigFn](#webpackconfigfn-1) - - [PageType](#pagetype-2) - -# Overview - -Typescript definitions of the component-controls specification. -Includes definitions for: - -- [Story](https://github.com/ccontrols/component-controls/tree/master/core/specification#story) -- [Stories](https://github.com/ccontrols/component-controls/tree/master/core/specification#stories) -- [ControlTypes](https://github.com/ccontrols/component-controls/tree/master/core/specification#controltypes) -- [ComponentControl](https://github.com/ccontrols/component-controls/tree/master/core/specification#componentcontrol) -- [PropTypes](https://github.com/ccontrols/component-controls/tree/master/core/specification#proptypes) -- and more... - -# Installation - -This package is usually installed as part of the @component-controls package, but you can also install it standalone: - -```bash -$ npm install @component-controls/specification --save-dev -``` - -# API - - - - - -## ArgUsageLocation - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L12)_ - - - -### properties - -| Name | Type | Description | -| ----------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `loc*` | [CodeLocation](#codelocation) | where in the story source code is the argument used code location is relative to the start of the story | -| `name` | [SourceIdentifier](#sourceidentifier) | optional name for the usage of the argument example: export const story = ({ value }) => <Story value={{ age: value }} />; in this example the name will be 'age' | -| `shorthand` | boolean | true if the property is a 'shorthand'. { prop: value } - not a shorthand. { prop } - a shorthand. | - -## SourceIdentifier - -an identifier/variable.argument in the source code - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L8)_ - - - -### properties - -| Name | Type | Description | -| ------- | ----------------------------- | ----------- | -| `loc` | [CodeLocation](#codelocation) | | -| `name*` | string | | - -## Stories - -map of stories. The id is compatible with CSF story ids - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L148)_ - -`id`\*: string: [Story](#story) - -## StoriesDoc - -a group of stories. Usually multiple stories are in one csf file -and the 'group' is the default export -in the case of MDX stories, the doc is created using a <Meta /> tag - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L158)_ - -`name`\*: string: any - -### properties - -| Name | Type | Description | -| ---------------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -| `MDXPage` | any | for MDX pages, this is an MDXContent function, to be rendered inside a MDXProvider | -| `author` | string | document author | -| `component` | string \| object | id for component associated with the stories file | -| `components*` | \[name: string]: string | lookup into the global store.components since multiple components of the same name can be used example: \['Button']: 'c:/myapp/Button.tsx' | -| `controls` | [ComponentControls](#componentcontrols) | object of key/value pairs specifying the controls for the stories file this will apply to all the stories in the file | -| `date` | string | optional date the document was created | -| `decorators` | [StoryRenderFn](#storyrenderfn)\[] | story decorators (or wrappers) | -| `description` | string | documentation file description | -| `excludeStories` | string\[] \| [RegExp](#regexp) | list of stories to exclude from the stories file can also use regexp match | -| `fileName` | string | file name of the file of stories | -| `fullPage` | boolean | if true, will display the documentation page full size (pagecontainer.full theme variant) the default value is from the page type configuration | -| `includeStories` | string\[] \| [RegExp](#regexp) | list of stories to include in the stories file can also use regexp match | -| `package` | string | lookup into the global store of PackageInfo package.json | -| `parameters` | [StoryParameters](#storyparameters) | configuration parameters passed to the story groups configured either as CSF default export or MDX <Meta /> tag | -| `route` | string | if provided, will be used as the route for the page if not provided, the title in lowercase will be used as the route | -| `sidebars` | boolean | whether to add navigation sidebars to the page the default value is from the page type configuration | -| `source` | string | source code of the entire file of stories | -| `stories` | string\[] | list of stories contained in the file/groups | -| `subcomponents` | string\[] \| object\[] | multiple components option | -| `tags` | string\[] | comma-separated list of document tags, used for search | -| `title*` | string | title of the groups of stories contained in the doc file. used to generate story ids | -| `type` | [PageType](#pagetype) | document type - blogs a and stories. By default - storie | - -## StoriesStore - -store of stories information in memory after the loader is applied - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L317)_ - - - -### properties - -| Name | Type | Description | -| ------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `components*` | [StoryComponents](#storycomponents) | list of components used in stories | -| `config` | [RunConfiguration](#runconfiguration) | global configuration for config file | -| `docs*` | [StoryDocs](#storydocs) | list of story files, or groups | -| `packages*` | [StoryPackages](#storypackages) | list of package.json files and their data used by the components and the stories of the project | -| `stories*` | [StoryStories](#storystories) | list of stories | - -## Story - -Story interface - usually extracted by the AST instrumenting loader - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L73)_ - - - -### properties - -| Name | Type | Description | -| --------------- | --------------------------------------- | ------------------------------------------------------------------------------------------- | -| `arguments` | [StoryArguments](#storyarguments) | arguments pass to a CSF story eg \`export const story = props => <Story {...props} />;\` | -| `component` | string \| object | id for component associated with the story | -| `controls` | [ComponentControls](#componentcontrols) | object of key/value pairs specifying the controls for the story | -| `decorators` | [StoryRenderFn](#storyrenderfn)\[] | story decorators (or wrappers) | -| `description` | string | story extended description. can use markdown. | -| `doc` | string | title of the file/group of stories | -| `id` | string | csf id of the story | -| `loc` | [CodeLocation](#codelocation) | location in the source file of the story definition | -| `name*` | string | name of the Story. | -| `parameters` | [StoryParameters](#storyparameters) | configuration parameters passed to the story - either CSF or MDX | -| `renderFn` | [StoryRenderFn](#storyrenderfn) | render function for the story | -| `source` | string | the source code of the story, extracted byt the AST instrumenting loaders | -| `subcomponents` | \[key: string]: string \| object | multiple components option | -| `subtitle` | string | optional story subtitle property | - -## StoryArgument - -arguments passed to the 'story' function, extracted by an AST loader - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L36)_ - - - -### properties - -| Name | Type | Description | -| -------- | ------------------------------------------- | ------------------------------------------------------------------------------------------ | -| `loc` | [CodeLocation](#codelocation) | location of the argument declaration, relative to the story source code | -| `name` | string | the original name of the argument | -| `usage` | [ArgUsageLocation](#argusagelocation)\[] | list of locations where the argument is used in the body of the story | -| `value*` | string \| [StoryArguments](#storyarguments) | either the name used (or a variable alias), or an array of sub-arguments ({ name: alias }) | - -## StoryComponents - -list of components used in stories - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L287)_ - -`fileName`\*: string: [StoryComponent](#storycomponent) - -## StoryDocs - -list of story files, or groups - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L294)_ - -`title`\*: string: [StoriesDoc](#storiesdoc) - -## StoryPackages - -list of repositories - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L310)_ - -`id`\*: string: [PackageInfo](#packageinfo) - -## StoryParameters - -list of configuration parameters for indivudual stories and docs files -can be specified either through CSF or MDX tags - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L66)_ - -`name`\*: string: any - -## StoryStories - -list of stories - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L303)_ - -`id`\*: string: [Story](#story) - -## Pages - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L298)_ - -[StoriesDoc](#storiesdoc)\[] - -## StoryArguments - -list of story arguments. Each argument can be a deconstructed argument of itself -the first argument are the control 'values' - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L60)_ - -[StoryArgument](#storyargument)\[] - -## defPageType - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L152)_ - - - -## getDocPath - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L342)_ - -**function** getDocPath(`pageType`\*: [PageType](#pagetype), `doc`: [StoriesDoc](#storiesdoc), `config`: [RunConfiguration](#runconfiguration), `name`\*: string): string; - -### parameters - -| Name | Type | Description | -| ----------- | ------------------------------------- | ----------- | -| `pageType*` | [PageType](#pagetype) | | -| `doc` | [StoriesDoc](#storiesdoc) | | -| `config` | [RunConfiguration](#runconfiguration) | | -| `name*` | string | | -| `returns` | string | | - -## getStoryPath - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L354)_ - -**function** getStoryPath(`story`: [Story](#story), `doc`: [StoriesDoc](#storiesdoc), `config`: [RunConfiguration](#runconfiguration)): string; - -### parameters - -| Name | Type | Description | -| --------- | ------------------------------------- | ----------- | -| `story` | [Story](#story) | | -| `doc` | [StoriesDoc](#storiesdoc) | | -| `config` | [RunConfiguration](#runconfiguration) | | -| `returns` | string | | - -## ControlTypes - -Control field types -examples are provided for the different types: - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L6)_ - - - -### properties - -| Name | Type | Description | -| ---------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ARRAY*` | **function** ARRAY | arrayItems: { type: ControlTypes.ARRAY, label: 'Items', rowType: { name: { type: ControlTypes.TEXT }, }, value: \[{ name: 'Laptop' }, { name: 'Book' }, { name: 'Whiskey' }], }, | -| `BOOLEAN*` | **function** BOOLEAN | nice: { type: ControlTypes.BOOLEAN, label: 'Nice', value: true, }, | -| `BUTTON*` | **function** BUTTON | button: { type: ControlTypes.BUTTON, onClick: () => { ... code to modify some variables } }, | -| `COLOR*` | **function** COLOR | color: { type: 'color', value: '#000000', }, | -| `DATE*` | **function** DATE | birthday: { type: ControlTypes.DATE, label: 'Birthday', value: new Date(), }, | -| `FILES*` | **function** FILES | images: { type: ControlTypes.FILES, label: 'Happy Picture', accept: 'image/\*', value: \[ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfiARwMCyEWcOFPAAAAP0lEQVQoz8WQMQoAIAwDL/7/z3GwghSp4KDZyiUpBMCYUgd8rehtH16/l3XewgU2KAzapjXBbNFaPS6lDMlKB6OiDv3iAH1OAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTAxLTI4VDEyOjExOjMzLTA3OjAwlAHQBgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0wMS0yOFQxMjoxMTozMy0wNzowMOVcaLoAAAAASUVORK5CYII=', ], }, | -| `NUMBER*` | **function** NUMBER | age: { type: ControlTypes.NUMBER, label: 'Age', value: 78, range: true, min: 0, max: 90, step: 5, }, | -| `OBJECT*` | **function** OBJECT | style: { type: ControlTypes.OBJECT, label: 'Styles', value: { // do not randomize the border style border: { type: ControlTypes.TEXT, value: '2px dashed silver', data: null }, borderRadius: { type: ControlTypes.NUMBER, value: 10 }, padding: { type: ControlTypes.NUMBER, value: 10 }, }, } | -| `OPTIONS*` | **function** OPTIONS | fruit: { type: ControlTypes.OPTIONS, label: 'Fruit', value: 'apple', options: { Apple: 'apple', Banana: 'banana', Cherry: 'cherry', }, }, | -| `TEXT*` | **function** TEXT | userName: { type: ControlTypes.TEXT, label: 'Name', value: 'Storyteller', }, | - -## ComponentControlArray - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L263)_ - -** extends ComponentControlBase<\[key: string]: any\[]>** - -### properties - -| Name | Type | Description | -| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | -| `defaultValue` | \[key: string]: any\[] | default value is usually set at run-time, from the value | -| `description` | string | full text property description. can use markdown. | -| `editLabel` | string | the label for the editor button | -| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | -| `hidden` | boolean | hide the property editor for this property will only use the value | -| `label` | string | label to display next to the field editor by default uses the property name itself | -| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | -| `required` | boolean | visually display the control property as required | -| `resetValue` | \[key: string]: any\[] | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | -| `rowType*` | [ComponentControls](#componentcontrols) | type of the items in each row of the array | -| `type*` | [ARRAY](#array) | | -| `value` | \[key: string]: any\[] | a default value for the property | - -## ComponentControlBase - -Base inteface for creating control types -All new property typs should extend this interface and support - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L140)_ - - - -### properties - -| Name | Type | Description | -| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | -| `defaultValue` | | default value is usually set at run-time, from the value | -| `description` | string | full text property description. can use markdown. | -| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | -| `hidden` | boolean | hide the property editor for this property will only use the value | -| `label` | string | label to display next to the field editor by default uses the property name itself | -| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | -| `required` | boolean | visually display the control property as required | -| `resetValue` | | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | -| `type*` | [ControlTypes](#controltypes) | | -| `value` | | a default value for the property | - -## ComponentControlBoolean - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L230)_ - -** extends ComponentControlBase<boolean>** - -### properties - -| Name | Type | Description | -| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | -| `defaultValue` | boolean | default value is usually set at run-time, from the value | -| `description` | string | full text property description. can use markdown. | -| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | -| `hidden` | boolean | hide the property editor for this property will only use the value | -| `label` | string | label to display next to the field editor by default uses the property name itself | -| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | -| `required` | boolean | visually display the control property as required | -| `resetValue` | boolean | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | -| `type*` | [BOOLEAN](#boolean) | | -| `value` | boolean | a default value for the property | - -## ComponentControlButton - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L285)_ - -** extends ComponentControlBase<>** - -### properties - -| Name | Type | Description | -| -------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | -| `defaultValue` | | default value is usually set at run-time, from the value | -| `description` | string | full text property description. can use markdown. | -| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | -| `hidden` | boolean | hide the property editor for this property will only use the value | -| `label` | string | label to display next to the field editor by default uses the property name itself | -| `onClick` | **function** (`prop`\*: [ComponentControlButton](#componentcontrolbutton)): void; | for button type fields, an onClick handler | -| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | -| `required` | boolean | visually display the control property as required | -| `resetValue` | | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | -| `type*` | [BUTTON](#button) | | -| `value` | | a default value for the property | - -## ComponentControlColor - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L234)_ - -** extends ComponentControlBase<string>** - -### properties - -| Name | Type | Description | -| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | -| `defaultValue` | string | default value is usually set at run-time, from the value | -| `description` | string | full text property description. can use markdown. | -| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | -| `hidden` | boolean | hide the property editor for this property will only use the value | -| `label` | string | label to display next to the field editor by default uses the property name itself | -| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | -| `required` | boolean | visually display the control property as required | -| `resetValue` | string | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | -| `type*` | [COLOR](#color) | | -| `value` | string | a default value for the property | - -## ComponentControlData - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L118)_ - - - -### properties - -| Name | Type | Description | -| --------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -| `name*` | string | 'name' for generating random data from faker.js usually comprised of two parts, separated by a dot example 'internet.avatar' | -| `options` | \[key: string]: any | options to be passe to the random data generators example { min: 10, max: 20 } | - -## ComponentControlDate - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L238)_ - -** extends ComponentControlBase<[Date](#date)>** - -### properties - -| Name | Type | Description | -| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | -| `datePicker` | boolean | whether to display a date picker (calendar). default: true | -| `defaultValue` | [Date](#date) | default value is usually set at run-time, from the value | -| `description` | string | full text property description. can use markdown. | -| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | -| `hidden` | boolean | hide the property editor for this property will only use the value | -| `label` | string | label to display next to the field editor by default uses the property name itself | -| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | -| `required` | boolean | visually display the control property as required | -| `resetValue` | [Date](#date) | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | -| `timePicker` | boolean | whether to display a time picker (calendar). default: true | -| `type*` | [DATE](#date) | | -| `value` | [Date](#date) | a default value for the property | - -## ComponentControlFiles - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L254)_ - -** extends ComponentControlBase<string\[]>** - -### properties - -| Name | Type | Description | -| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `accept` | string | type of files to accept user to open ex 'image/\*', | -| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | -| `defaultValue` | string\[] | default value is usually set at run-time, from the value | -| `description` | string | full text property description. can use markdown. | -| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | -| `hidden` | boolean | hide the property editor for this property will only use the value | -| `label` | string | label to display next to the field editor by default uses the property name itself | -| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | -| `required` | boolean | visually display the control property as required | -| `resetValue` | string\[] | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | -| `type*` | [FILES](#files) | | -| `value` | string\[] | a default value for the property | - -## ComponentControlNumber - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L335)_ - -** extends ComponentControlBase<number>** - -### properties - -| Name | Type | Description | -| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | -| `defaultValue` | number | default value is usually set at run-time, from the value | -| `description` | string | full text property description. can use markdown. | -| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | -| `hidden` | boolean | hide the property editor for this property will only use the value | -| `label` | string | label to display next to the field editor by default uses the property name itself | -| `max` | number | maximum allowed value for numeric property | -| `min` | number | minimum allowed value for numeric property | -| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | -| `range` | boolean | if true, will display a range type slider editor | -| `required` | boolean | visually display the control property as required | -| `resetValue` | number | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | -| `step` | number | stepper for numeric editor /i nc/dec value | -| `type*` | [NUMBER](#number) | | -| `value` | number | a default value for the property | - -## ComponentControlObject - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L276)_ - -** extends ComponentControlBase<[ComponentControls](#componentcontrols)>** - -### properties - -| Name | Type | Description | -| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | -| `defaultValue` | [ComponentControls](#componentcontrols) | default value is usually set at run-time, from the value | -| `description` | string | full text property description. can use markdown. | -| `editLabel` | string | the label for the editor button | -| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | -| `hidden` | boolean | hide the property editor for this property will only use the value | -| `label` | string | label to display next to the field editor by default uses the property name itself | -| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | -| `required` | boolean | visually display the control property as required | -| `resetValue` | [ComponentControls](#componentcontrols) | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | -| `type*` | [OBJECT](#object) | | -| `value` | [ComponentControls](#componentcontrols) | a default value for the property | - -## ComponentControlOptions - -list of options can be -1\. key-value pair object: in format { label: value } -2\. array of strings -3\. array of key-value pair objects - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L316)_ - -** extends ComponentControlBase<OptionsValueType<>>** - -### properties - -| Name | Type | Description | -| -------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | -| `defaultValue` | OptionsValueType<> | default value is usually set at run-time, from the value | -| `description` | string | full text property description. can use markdown. | -| `display` | 'select' \| 'multi-select' \| 'radio' \| 'inline-radio' \| 'check' \| 'inline-check' | how to render selecting the options: default is 'select' | -| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | -| `hidden` | boolean | hide the property editor for this property will only use the value | -| `label` | string | label to display next to the field editor by default uses the property name itself | -| `options*` | OptionsListType<> | | -| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | -| `required` | boolean | visually display the control property as required | -| `resetValue` | OptionsValueType<> | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | -| `type*` | [OPTIONS](#options) | | -| `value` | OptionsValueType<> | a default value for the property | - -## ComponentControlText - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L205)_ - -** extends ComponentControlBase<string>** - -### properties - -| Name | Type | Description | -| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [ComponentControlData](#componentcontroldata) \| null \| false | helper information to generate random data will be used in conjunction with faker.js datacan be set to false, if the control should not be randomized | -| `defaultValue` | string | default value is usually set at run-time, from the value | -| `description` | string | full text property description. can use markdown. | -| `escapeValue` | boolean | allows to receive escaped string values to help prevent XSS attacks by default - false | -| `groupId` | string | allows grouping of the properties in a property editor for example different editor tabs | -| `hidden` | boolean | hide the property editor for this property will only use the value | -| `label` | string | label to display next to the field editor by default uses the property name itself | -| `order` | number | allows custom sorting of the properties if 'order' is not provided, the props will be sorted by the order/key of the object (unreliable) | -| `placeholder` | string | placeholder for empty properties either undefined initial value or user clears the field | -| `required` | boolean | visually display the control property as required | -| `resetValue` | string | reset value - this is automatically saved as the initial 'value' used when user wants to click rest and go back to the initial values | -| `rows` | number | number of rows for a TextArea field for longer text by default, only 1 row = means a Input field \> 1 rows = an area field | -| `type*` | [TEXT](#text) | | -| `value` | string | a default value for the property | - -## ComponentControls - -ComponentControls are defined in key value pairs -the name of the property is the key -and the value is the ComponentControl - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L388)_ - -`name`\*: string: [ComponentControl](#componentcontrol) - -## ComponentControl - -ComponentControl is a either an object of property settings -or a shortcut can be used: - properties: { - text: 'Hello', -}, - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L371)_ - -[ComponentControlText](#componentcontroltext) \| [ComponentControlBoolean](#componentcontrolboolean) \| [ComponentControlColor](#componentcontrolcolor) \| [ComponentControlDate](#componentcontroldate) \| [ComponentControlObject](#componentcontrolobject) \| [ComponentControlButton](#componentcontrolbutton) \| [ComponentControlOptions](#componentcontroloptions) \| [ComponentControlNumber](#componentcontrolnumber) \| [ComponentControlArray](#componentcontrolarray) \| [ComponentControlFiles](#componentcontrolfiles) - -## OptionsListType - -value/label pairs or array of OptionsValueType - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L305)_ - -\[key: string]: \| OptionsValueType<>\[] - -## OptionsValueType - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L295)_ - - | number | string\[] \| number\[] \| **label**: string**value**: any - -## ComponentInfo - -DocGen type onfo generated for a compoennt - -_defined in [@component-controls/specification/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/components.ts#L76)_ - - - -### properties - -| Name | Type | Description | -| -------------- | ----------------------- | --------------------- | -| `description` | string | optional description | -| `displayName*` | string | name of the component | -| `props*` | [PropTypes](#proptypes) | component props | - -## PropType - -docgen generated property types -mapped to common types to be consumed by component-controls -check props-info packages for implementations - -_defined in [@component-controls/specification/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/components.ts#L47)_ - - - -### properties - -| Name | Type | Description | -| -------------- | ----------------------------------- | ------------------------------------- | -| `defaultValue` | any | default value for the property | -| `description` | string | description of the property | -| `parentName` | string | name of the parent/inherited property | -| `type*` | [TypeInformation](#typeinformation) | propertty type | - -## PropTypes - -list of properties of the component - -_defined in [@component-controls/specification/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/components.ts#L69)_ - -`key`\*: string: [PropType](#proptype) - -## StoryComponent - -component specified for stories or story files - -_defined in [@component-controls/specification/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/components.ts#L96)_ - - - -### properties - -| Name | Type | Description | -| -------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `from` | string | imported from | -| `importedName` | 'default' \| 'namespace' \| string | imported name ex: \- default import import Button from 'buttons'; \- namespace import import \* as Button from 'buttons'; \- named import import { Button } from 'buttons'; \- named alias import import { Btn as Button } from 'buttons'; | -| `imports` | [Imports](#imports) | list of external imports | -| `info` | [ComponentInfo](#componentinfo) | docgen generated component info | -| `loc` | [CodeLocation](#codelocation) | location of the import statement in the source code file | -| `name*` | string | name of the component as used in the fiel | -| `package` | string | lookup into the global store of PackageInfo package.json | -| `request` | string | resolved import request | -| `source` | string | the source code of the component file, extracted byt the AST instrumenting loaders | - -## TypeInformation - -_defined in [@component-controls/specification/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/components.ts#L17)_ - - - -### properties - -| Name | Type | Description | -| ----------- | --------------------------------------------- | ----------------------------------------------------------------------------- | -| `arguments` | [TypeInformation](#typeinformation)\[] \| any | argument types of function | -| `name*` | [TypeValue](#typevalue) | | -| `raw` | string | raw type code | -| `required` | boolean | is the property required | -| `value` | [TypeInformation](#typeinformation)\[] \| any | type value elements of enum, array, fields of object return value of function | - -## TypeValue - -_defined in [@component-controls/specification/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/components.ts#L3)_ - -'any' | 'boolean' | 'number' | 'string' | 'array' | 'object' | 'enum' | 'union' | 'literal' | 'symbol' | 'function' | string - -## getComponentName - -given a component, return its name - -_defined in [@component-controls/specification/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/components.ts#L147)_ - -**function** getComponentName(`component`\*: any): string | undefined; - -### parameters - -| Name | Type | Description | -| ------------ | ------------------- | ------------------------------------------------------------------------------------------ | -| `component*` | any | a string component name, or a component class, with a name or displayName static property | -| `returns` | string \| undefined | | - -## PropsInfoExtractorFunction - -callback function to extract props info table - ie docgen type libraries -used to extract displayName, and props tables for a component - -_defined in [@component-controls/specification/src/propsInfo.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/propsInfo.ts#L13)_ - -**function** (`fileName`\*: string, `componentName`: string, `source`: string): Promise<[ComponentInfo](#componentinfo) | undefined> | [ComponentInfo](#componentinfo) | undefined; - -### parameters - -| Name | Type | Description | -| --------------- | -------------------------------------------------------------------------------------------------------- | ----------- | -| `fileName*` | string | | -| `componentName` | string | | -| `source` | string | | -| `returns` | Promise<[ComponentInfo](#componentinfo) \| undefined> \| [ComponentInfo](#componentinfo) \| undefined | | - -## CodeLocation - -location in the source code of a story or part of it -ie. arguments, usage of arguments - -_defined in [@component-controls/specification/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/utility.ts#L16)_ - - - -### properties - -| Name | Type | Description | -| -------- | ----------------------------- | ----------- | -| `end*` | [CodePosition](#codeposition) | | -| `start*` | [CodePosition](#codeposition) | | - -## CodePosition - -position in the stories source code -usually taken from AST traverse loaders - -_defined in [@component-controls/specification/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/utility.ts#L6)_ - - - -### properties - -| Name | Type | Description | -| --------- | ------ | ----------- | -| `column*` | number | | -| `line*` | number | | - -## ImportName - -an import name - -_defined in [@component-controls/specification/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/utility.ts#L106)_ - - - -### properties - -| Name | Type | Description | -| --------------- | ------ | --------------------------------------------------------------------- | -| `importedName*` | string | alias imported as. If a default import, the string 'default' is here. | -| `name*` | string | the imported name from the import file | - -## Imports - -imports - library/file as key and the imported names as an array - -_defined in [@component-controls/specification/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/utility.ts#L120)_ - -`key`\*: string: [ImportName](#importname)\[] - -## PackageDependencies - -list of dependencies - package name as the key and the version as the value - -_defined in [@component-controls/specification/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/utility.ts#L49)_ - -`name`\*: string: [PackageDependency](#packagedependency) - -## PackageInfo - -package.json -information about the repository of the stories and components - -_defined in [@component-controls/specification/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/utility.ts#L57)_ - - - -### properties - -| Name | Type | Description | -| ------------------ | ------------------------------------------- | ----------------------------------------------------------------------------- | -| `dependencies` | [PackageDependencies](#packagedependencies) | extracted package.json 'dependencies' section | -| `devDependencies` | [PackageDependencies](#packagedependencies) | extracted package.json 'devDependencies' section | -| `fileHash*` | string | file name hash of package.json | -| `name` | string | package name | -| `peerDependencies` | [PackageDependencies](#packagedependencies) | extracted package.json 'peerDependencies' section | -| `repository*` | [PackageRepository](#packagerepository) | repository information extracted from the "repository" field in package.json. | -| `version` | string | package version | - -## PackageRepository - -repository information from package.json - -_defined in [@component-controls/specification/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/utility.ts#L24)_ - - - -### properties - -| Name | Type | Description | -| -------- | ------ | --------------------------------------- | -| `browse` | string | link for browsing the file | -| `docs` | string | link for project readme | -| `issues` | string | link for filing issues with the project | - -## PackageDependency - -dependecy string - the package version number - -_defined in [@component-controls/specification/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/utility.ts#L44)_ - -string - -## StoryRenderFn - -story render function - -_defined in [@component-controls/specification/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/utility.ts#L98)_ - -**function** (`controlValues`\*: \[key: string]: any, `context`: any): any; - -### parameters - -| Name | Type | Description | -| ---------------- | ------------------- | ----------- | -| `controlValues*` | \[key: string]: any | | -| `context` | any | | -| `returns` | any | | - -## BuildConfiguration - -global configuration used at build time -stored in a file named main.js/main.ts - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L45)_ - - - -### properties - -| Name | Type | Description | -| -------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| `categories` | [PageType](#pagetype)\[] | page types that are considred as categories fields as well | -| `finalWebpack` | [WebpackConfig](#webpackconfig) | | -| `pages` | Record<[PageType](#pagetype), Pick<[PageConfiguration](#pageconfiguration), 'basePath'>> | base url path for API documentation pages. Default is "docs/" | -| `stories` | string\[] | wild card search string for the stories internally using \`glob\` for the search: https://www.npmjs.com/package/glob example: "./stories/ | -| `webpack` | [WebpackConfig](#webpackconfig) | custom webpack fonfigurations setup. One or the other will be used | - -## PageConfiguration - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L6)_ - - - -### properties - -| Name | Type | Description | -| ---------- | ------- | ---------------------------------------------- | -| `basePath` | string | base url path for the page | -| `fullPage` | boolean | whether to take a fullpage theme option | -| `label` | string | label - used for menu labels | -| `sidebars` | boolean | whether to add navigation sidebars to the page | -| `topMenu` | boolean | whether to add to the top navigation menu | - -## RunOnlyConfiguration - -global configuration used at build time -stored in a file named main.js/main.ts - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L72)_ - - - -### properties - -| Name | Type | Description | -| ----------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `author` | string | author: Default is "@component-controls" | -| `decorators` | [StoryRenderFn](#storyrenderfn)\[] | story decorator functions - used to wrap stories example: \[story => <ThemeProvider>{story()}</ThemeProvider>] | -| `pages` | [PagesConfiguration](#pagesconfiguration) | page types configurations | -| `siteDescription` | string | site description. siteDescription: Default is "Component controls stories. Write your components documentation with MDX and JSX. Design, develop, test and review in a single site." | -| `siteHeadline` | string | Site headline. Default is "Component controls gatsby" | -| `siteImage` | string | link to site image | -| `siteLanguage` | string | site language, Deault is "en" | -| `siteTitle` | string | standalone site title. Default is "Component controls" | -| `siteTitleAlt` | string | site alt for images. Default is "Component controls - https://github.com/ccontrols/component-controls" | -| `siteUrl` | string | Deployed site url. Default is "https://component-controls-gatsby.netlify.app" | -| `storySort` | **function** (`a`\*: string, `b`\*: string): number; | story sorting function | -| `theme` | \[key: string]: any | theme-ui theme configuration | - -## PageType - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L4)_ - -'story' | 'blog' | 'page' | 'tags' | 'author' - -## PagesConfiguration - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L33)_ - -Record< - -[PageType](#pagetype) - -, - -[PageConfiguration](#pageconfiguration) - -> - -## RunConfiguration - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L133)_ - -### properties - -| Name | Type | Description | -| ---------------------- | ----------------------------------------------------------- | ----------- | -| `RunOnlyConfiguration` | [RunOnlyConfiguration](#runonlyconfiguration) | | -| `Omit` | Omit<[BuildConfiguration](#buildconfiguration), 'pages'> | | - -## WebpackConfig - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L39)_ - -[WebpackConfiguration](#webpackconfiguration) \| [WebpackConfigFn](#webpackconfigfn) - -## WebpackConfigFn - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L35)_ - -**function** (`config`\*: [WebpackConfiguration](#webpackconfiguration), `options`: any): [WebpackConfiguration](#webpackconfiguration); - -### parameters - -| Name | Type | Description | -| --------- | --------------------------------------------- | ----------- | -| `config*` | [WebpackConfiguration](#webpackconfiguration) | | -| `options` | any | | -| `returns` | [WebpackConfiguration](#webpackconfiguration) | | - -## defaultBuildConfig - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L169)_ - - - -### properties - -| Name | Type | Description | -| ------------- | --------------------- | ----------- | -| `categories*` | 'tags' \| 'author'\[] | | -| `pages*` | object | | - -## defaultRunConfig - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L136)_ - - - -### properties - -| Name | Type | Description | -| ------------------ | ------ | ----------- | -| `author*` | string | | -| `siteDescription*` | string | | -| `siteHeadline*` | string | | -| `siteLanguage*` | string | | -| `siteTitle*` | string | | -| `siteTitleAlt*` | string | | -| `siteUrl*` | string | | -| `pages*` | object | | - -## StoryRenderFn - -story render function - -_defined in [@component-controls/specification/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/utility.ts#L98)_ - -**function** (`controlValues`\*: \[key: string]: any, `context`: any): any; - -### parameters - -| Name | Type | Description | -| ---------------- | ------------------- | ----------- | -| `controlValues*` | \[key: string]: any | | -| `context` | any | | -| `returns` | any | | - -## PageType - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L4)_ - -'story' | 'blog' | 'page' | 'tags' | 'author' - -## RunConfiguration - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L133)_ - -### properties - -| Name | Type | Description | -| ---------------------- | ----------------------------------------------------------- | ----------- | -| `RunOnlyConfiguration` | [RunOnlyConfiguration](#runonlyconfiguration) | | -| `Omit` | Omit<[BuildConfiguration](#buildconfiguration), 'pages'> | | - -## StoryArguments - -list of story arguments. Each argument can be a deconstructed argument of itself -the first argument are the control 'values' - -_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L60)_ - -[StoryArgument](#storyargument)\[] - -## ComponentControl - -ComponentControl is a either an object of property settings -or a shortcut can be used: - properties: { - text: 'Hello', -}, - -_defined in [@component-controls/specification/src/controls.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/controls.ts#L371)_ - -[ComponentControlText](#componentcontroltext) \| [ComponentControlBoolean](#componentcontrolboolean) \| [ComponentControlColor](#componentcontrolcolor) \| [ComponentControlDate](#componentcontroldate) \| [ComponentControlObject](#componentcontrolobject) \| [ComponentControlButton](#componentcontrolbutton) \| [ComponentControlOptions](#componentcontroloptions) \| [ComponentControlNumber](#componentcontrolnumber) \| [ComponentControlArray](#componentcontrolarray) \| [ComponentControlFiles](#componentcontrolfiles) - -## TypeValue - -_defined in [@component-controls/specification/src/components.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/components.ts#L3)_ - -'any' | 'boolean' | 'number' | 'string' | 'array' | 'object' | 'enum' | 'union' | 'literal' | 'symbol' | 'function' | string - -## PackageDependency - -dependecy string - the package version number - -_defined in [@component-controls/specification/src/utility.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/utility.ts#L44)_ - -string - -## WebpackConfig - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L39)_ - -[WebpackConfiguration](#webpackconfiguration) \| [WebpackConfigFn](#webpackconfigfn) - -## PagesConfiguration - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L33)_ - -Record< - -[PageType](#pagetype) - -, - -[PageConfiguration](#pageconfiguration) - -> - -## WebpackConfigFn - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L35)_ - -**function** (`config`\*: [WebpackConfiguration](#webpackconfiguration), `options`: any): [WebpackConfiguration](#webpackconfiguration); - -### parameters - -| Name | Type | Description | -| --------- | --------------------------------------------- | ----------- | -| `config*` | [WebpackConfiguration](#webpackconfiguration) | | -| `options` | any | | -| `returns` | [WebpackConfiguration](#webpackconfiguration) | | - -## PageType - -_defined in [@component-controls/specification/src/configuration.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/configuration.ts#L4)_ - -'story' | 'blog' | 'page' | 'tags' | 'author' - - diff --git a/core/specification/package.json b/core/specification/package.json deleted file mode 100644 index a74bb6070..000000000 --- a/core/specification/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "@component-controls/specification", - "version": "1.2.0", - "description": "Component controls specification with typescript definitions", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "typings": "dist/index.d.ts", - "files": [ - "dist/", - "package.json", - "README.md" - ], - "scripts": { - "build": "yarn cross-env NODE_ENV=production rollup -c", - "dev": "yarn cross-env NODE_ENV=development rollup -cw", - "docs": "ts-node -O '{\"module\": \"commonjs\"}' ../../scripts/docs.ts", - "fix": "yarn lint --fix", - "lint": "yarn eslint . --ext mdx,ts,tsx", - "prepare": "yarn build", - "test": "yarn jest" - }, - "homepage": "https://github.com/ccontrols/component-controls", - "bugs": { - "url": "https://github.com/ccontrols/component-controls/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/ccontrols/component-controls.git", - "directory": "core/specification" - }, - "license": "MIT", - "dependencies": { - "deepmerge": "^4.2.2", - "typescript": "^3.8.3" - }, - "devDependencies": { - "@types/jest": "^25.1.2", - "cross-env": "^5.2.1", - "eslint": "^6.5.1", - "jest": "^24.9.0", - "webpack": "^4.43.0" - }, - "publishConfig": { - "access": "public" - }, - "authors": [ - "Atanas Stoyanov" - ], - "gitHead": "c5145d66c6b8a355839e53c3bca97fd361ce9377" -} diff --git a/core/specification/rollup.config.js b/core/specification/rollup.config.js deleted file mode 100644 index 5bf5a8b41..000000000 --- a/core/specification/rollup.config.js +++ /dev/null @@ -1,5 +0,0 @@ -import { config } from '../../rollup-config'; - -export default config({ - input: './src/index.ts', -}); diff --git a/core/specification/src/index.test.ts b/core/specification/src/index.test.ts deleted file mode 100644 index fcbf8b501..000000000 --- a/core/specification/src/index.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ControlTypes } from './index'; - -describe('verify imports', () => { - it('Should merge property value', () => { - expect(ControlTypes.TEXT === 'text').toEqual(true); - }); -}); diff --git a/core/specification/src/index.ts b/core/specification/src/index.ts deleted file mode 100644 index 4fcd41995..000000000 --- a/core/specification/src/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -export * from './components'; -export * from './configuration'; -export * from './controls'; -export * from './deepMerge'; -export * from './propsInfo'; -export * from './stories'; -export * from './utility'; - -export type SetControlValueFn = ( - storyId: string, - propertyName: string | undefined, - value: any, -) => void; -export type ClickControlFn = (storyId: string, propertyName: string) => void; diff --git a/core/specification/tsconfig.json b/core/specification/tsconfig.json deleted file mode 100644 index 25ce695d2..000000000 --- a/core/specification/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "module": "esnext", - "outDir": "dist", - "rootDir": "src", - "declaration": true, - "types": ["node", "jest"], - "typeRoots": ["../../node_modules/@types", "node_modules/@types"] - }, - "include": ["src/**/*", "src/typings.d.ts"], - "exclude": ["node_modules/**"] -} \ No newline at end of file diff --git a/core/store/package.json b/core/store/package.json index c8052ac34..42a1f9933 100644 --- a/core/store/package.json +++ b/core/store/package.json @@ -38,7 +38,6 @@ "dependencies": { "@component-controls/core": "^1.2.0", "@component-controls/loader": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@storybook/csf": "^0.0.1", "broadcast-channel": "^3.1.0", "typescript": "^3.8.3" diff --git a/core/store/src/Store/Store.ts b/core/store/src/Store/Store.ts index 227fba0bb..847a1cd7c 100644 --- a/core/store/src/Store/Store.ts +++ b/core/store/src/Store/Store.ts @@ -7,7 +7,7 @@ import { getStoryPath, PageType, defPageType, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { BroadcastChannel } from 'broadcast-channel'; import { StoreObserver, diff --git a/core/store/src/serialization/StoreStorage.ts b/core/store/src/serialization/StoreStorage.ts index cabc025c0..884d111b8 100644 --- a/core/store/src/serialization/StoreStorage.ts +++ b/core/store/src/serialization/StoreStorage.ts @@ -1,7 +1,4 @@ -import { - StoriesStore, - getComponentName, -} from '@component-controls/specification'; +import { StoriesStore, getComponentName } from '@component-controls/core'; import { COMPONENT_CONTROLS_STORAGE } from '../types'; diff --git a/core/store/src/serialization/load-store.ts b/core/store/src/serialization/load-store.ts index 1759ba717..8f876d6c4 100644 --- a/core/store/src/serialization/load-store.ts +++ b/core/store/src/serialization/load-store.ts @@ -5,7 +5,7 @@ import { Story, deepMerge, defaultRunConfig, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { LoadingStore } from '@component-controls/loader'; import { toId, storyNameFromExport } from '@storybook/csf'; import { addSmartControls } from './smart-controls'; diff --git a/core/store/src/serialization/smart-controls.ts b/core/store/src/serialization/smart-controls.ts index 5261f65c4..eb85e98c6 100644 --- a/core/store/src/serialization/smart-controls.ts +++ b/core/store/src/serialization/smart-controls.ts @@ -4,8 +4,8 @@ import { StoriesDoc, StoryComponents, getComponentName, -} from '@component-controls/specification'; -import { controlsFromProps } from '@component-controls/core'; + controlsFromProps, +} from '@component-controls/core'; export const addSmartControls = ( story: Story, diff --git a/core/store/src/types.ts b/core/store/src/types.ts index 5e439bd82..1cb57ace0 100644 --- a/core/store/src/types.ts +++ b/core/store/src/types.ts @@ -5,7 +5,7 @@ import { Pages, RunConfiguration, PageType, -} from '@component-controls/specification'; +} from '@component-controls/core'; /** * store on change observer. diff --git a/core/webpack-compile/src/utilities.ts b/core/webpack-compile/src/utilities.ts index 64318f6f7..e20832e66 100644 --- a/core/webpack-compile/src/utilities.ts +++ b/core/webpack-compile/src/utilities.ts @@ -59,9 +59,7 @@ const createConfig = (options: CompileRunProps): webpack.Configuration => { '@component-controls/blocks': require.resolve( '@component-controls/blocks', ), - '@component-controls/specification': require.resolve( - '@component-controls/specification', - ), + '@component-controls/core': require.resolve('@component-controls/core'), '@component-controls/loader': require.resolve( '@component-controls/loader', ), @@ -133,7 +131,7 @@ const createConfig = (options: CompileRunProps): webpack.Configuration => { '@mdx-js/react': '@mdx-js/react', 'faker/locale/en_US': 'faker/locale/en_US', 'markdown-to-jsx': 'markdown-to-jsx', - '@component-controls/specification': '@component-controls/specification', + '@component-controls/core': '@component-controls/core', '@component-controls/loader': '@component-controls/loader', '@component-controls/blocks': '@component-controls/blocks', '@component-controls/components': '@component-controls/components', diff --git a/core/webpack-compile/tests/__snapshots__/example-stories.test.ts.snap b/core/webpack-compile/tests/__snapshots__/example-stories.test.ts.snap index 8ca6eecd3..75ce2893e 100644 --- a/core/webpack-compile/tests/__snapshots__/example-stories.test.ts.snap +++ b/core/webpack-compile/tests/__snapshots__/example-stories.test.ts.snap @@ -3,6 +3,10 @@ exports[`test example stories compile 1`] = ` Store { "buildConfig": Object { + "categories": Array [ + "author", + "tags", + ], "pages": Object { "author": Object { "basePath": "authors/", diff --git a/core/webpack-compile/tests/__snapshots__/react-typescript.test.ts.snap b/core/webpack-compile/tests/__snapshots__/react-typescript.test.ts.snap index 52df3880e..a97413fe4 100644 --- a/core/webpack-compile/tests/__snapshots__/react-typescript.test.ts.snap +++ b/core/webpack-compile/tests/__snapshots__/react-typescript.test.ts.snap @@ -3,6 +3,10 @@ exports[`test typescript react settings compile 1`] = ` Store { "buildConfig": Object { + "categories": Array [ + "author", + "tags", + ], "pages": Object { "author": Object { "basePath": "authors/", @@ -89,7 +93,7 @@ actions can accept an order prop, and can also be superimposed", "loc": Object { "end": Object { "column": 1, - "line": 108, + "line": 88, }, "start": Object { "column": 45, @@ -157,11 +161,10 @@ export const ActionBar: FC = ({ actions = [] }) => { return ( = ({ actions = [] }) => { }, ); }, [theme, actions]); - return ( -
- - - {items} - - -
+ + {items} + ); }; ", diff --git a/examples/stories/src/stories/controls-editors-starter.stories.tsx b/examples/stories/src/stories/controls-editors-starter.stories.tsx index 85c353bc8..2bacb5538 100644 --- a/examples/stories/src/stories/controls-editors-starter.stories.tsx +++ b/examples/stories/src/stories/controls-editors-starter.stories.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Button } from 'theme-ui'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; export default { title: 'Introduction/Starter', diff --git a/examples/stories/src/stories/controls-editors.stories.jsx b/examples/stories/src/stories/controls-editors.stories.jsx index 4ca3f493f..9b242adf8 100644 --- a/examples/stories/src/stories/controls-editors.stories.jsx +++ b/examples/stories/src/stories/controls-editors.stories.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; export default { title: 'Introduction/Controls', diff --git a/examples/stories/src/stories/inherit-from-doc.stories.tsx b/examples/stories/src/stories/inherit-from-doc.stories.tsx index 634dffe54..6c79185b5 100644 --- a/examples/stories/src/stories/inherit-from-doc.stories.tsx +++ b/examples/stories/src/stories/inherit-from-doc.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; export default { title: 'Introduction/Doc', diff --git a/examples/storybook-6-no-docs/package.json b/examples/storybook-6-no-docs/package.json index a64525c66..cc872c81c 100644 --- a/examples/storybook-6-no-docs/package.json +++ b/examples/storybook-6-no-docs/package.json @@ -9,7 +9,7 @@ "build-sample": "build-storybook -c .storybook -o ./docs" }, "dependencies": { - "@component-controls/specification": "^1.2.0", + "@component-controls/core": "^1.2.0", "@component-controls/storybook": "^1.2.0", "@storybook/react": "next", "babel-loader": "^8.0.6", diff --git a/examples/storybook-6/package.json b/examples/storybook-6/package.json index 693ee2e55..798f5a072 100644 --- a/examples/storybook-6/package.json +++ b/examples/storybook-6/package.json @@ -10,7 +10,7 @@ "build-sample": "build-storybook -c .storybook -o ./docs" }, "dependencies": { - "@component-controls/specification": "^1.2.0", + "@component-controls/core": "^1.2.0", "@component-controls/storybook": "^1.2.0", "@storybook/addon-docs": "next", "@storybook/preset-typescript": "*", diff --git a/integrations/gatsby-theme-stories/package.json b/integrations/gatsby-theme-stories/package.json index 449a86f44..8b281afb3 100644 --- a/integrations/gatsby-theme-stories/package.json +++ b/integrations/gatsby-theme-stories/package.json @@ -36,10 +36,11 @@ }, "license": "MIT", "dependencies": { - "@component-controls/app": "^1.1.0", - "@component-controls/pages": "^1.1.0", - "@component-controls/specification": "^1.1.0", - "@component-controls/webpack-compile": "^1.1.0", + + "@component-controls/app": "^1.2.0", + "@component-controls/pages": "^1.2.0", + "@component-controls/core": "^1.2.0", + "@component-controls/webpack-compile": "^1.2.0", "gatsby": "^2.22.10", "gatsby-plugin-react-helmet": "^3.3.2", "gatsby-plugin-theme-ui": "^0.3.0", diff --git a/integrations/gatsby-theme-stories/src/components/Layout.tsx b/integrations/gatsby-theme-stories/src/components/Layout.tsx index 5816963f4..1ed43eacb 100644 --- a/integrations/gatsby-theme-stories/src/components/Layout.tsx +++ b/integrations/gatsby-theme-stories/src/components/Layout.tsx @@ -1,7 +1,7 @@ /** @jsx jsx */ import { FC } from 'react'; import { jsx } from 'theme-ui'; -import { PageType } from '@component-controls/specification'; +import { PageType } from '@component-controls/core'; import { AppContext } from '@component-controls/app'; const bundle = require('@component-controls/webpack-compile/bundle'); diff --git a/integrations/gatsby-theme-stories/src/gatsby-node.ts b/integrations/gatsby-theme-stories/src/gatsby-node.ts index 1bd87e83e..a6ebda162 100644 --- a/integrations/gatsby-theme-stories/src/gatsby-node.ts +++ b/integrations/gatsby-theme-stories/src/gatsby-node.ts @@ -1,4 +1,4 @@ -import { getDocPath, PageType } from '@component-controls/specification'; +import { getDocPath, PageType } from '@component-controls/core'; import { compile, diff --git a/integrations/gatsby-theme-stories/src/templates/CategoryList.tsx b/integrations/gatsby-theme-stories/src/templates/CategoryList.tsx index 63b44ad7e..0a60c1f19 100644 --- a/integrations/gatsby-theme-stories/src/templates/CategoryList.tsx +++ b/integrations/gatsby-theme-stories/src/templates/CategoryList.tsx @@ -1,6 +1,6 @@ import React, { FC } from 'react'; -import { PageType } from '@component-controls/specification'; +import { PageType } from '@component-controls/core'; import { CategoryList } from '@component-controls/app'; import { Layout } from '../components/Layout'; diff --git a/integrations/gatsby-theme-stories/src/templates/CategoryPage.tsx b/integrations/gatsby-theme-stories/src/templates/CategoryPage.tsx index f5d6c7e0b..4ed86ac0f 100644 --- a/integrations/gatsby-theme-stories/src/templates/CategoryPage.tsx +++ b/integrations/gatsby-theme-stories/src/templates/CategoryPage.tsx @@ -1,6 +1,6 @@ import React, { FC } from 'react'; -import { PageType } from '@component-controls/specification'; +import { PageType } from '@component-controls/core'; import { CategoryPage } from '@component-controls/app'; import { Layout } from '../components/Layout'; diff --git a/integrations/gatsby-theme-stories/src/templates/DocPage.tsx b/integrations/gatsby-theme-stories/src/templates/DocPage.tsx index ff8725a1c..1d2b4181c 100644 --- a/integrations/gatsby-theme-stories/src/templates/DocPage.tsx +++ b/integrations/gatsby-theme-stories/src/templates/DocPage.tsx @@ -1,5 +1,5 @@ import React, { FC } from 'react'; -import { PageType } from '@component-controls/specification'; +import { PageType } from '@component-controls/core'; import { DocPage } from '@component-controls/app'; import { Layout } from '../components/Layout'; import { pages } from '../config/pages'; diff --git a/integrations/gatsby-theme-stories/src/templates/PageList.tsx b/integrations/gatsby-theme-stories/src/templates/PageList.tsx index 3e27f0d14..460c7f5ce 100644 --- a/integrations/gatsby-theme-stories/src/templates/PageList.tsx +++ b/integrations/gatsby-theme-stories/src/templates/PageList.tsx @@ -1,6 +1,6 @@ import React, { FC } from 'react'; -import { PageType, defPageType } from '@component-controls/specification'; +import { PageType, defPageType } from '@component-controls/core'; import { PageList } from '@component-controls/app'; import { Layout } from '../components/Layout'; diff --git a/integrations/storybook/package.json b/integrations/storybook/package.json index 1d3e9f024..ac6ebd9ae 100644 --- a/integrations/storybook/package.json +++ b/integrations/storybook/package.json @@ -42,7 +42,6 @@ "@component-controls/pages": "^1.2.0", "@component-controls/react-docgen-info": "^1.2.0", "@component-controls/react-docgen-typescript-info": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@component-controls/store": "^1.2.0", "@component-controls/storybook-custom-docs": "^1.2.0", "@component-controls/webpack-configs": "^1.2.0", diff --git a/props-info/react-docgen-typescript/package.json b/props-info/react-docgen-typescript/package.json index 5cc5fd005..a2564e3bc 100644 --- a/props-info/react-docgen-typescript/package.json +++ b/props-info/react-docgen-typescript/package.json @@ -30,7 +30,7 @@ }, "license": "MIT", "dependencies": { - "@component-controls/specification": "^1.2.0", + "@component-controls/core": "^1.2.0", "react": "^16.12.0", "react-docgen-typescript": "^1.16.1" }, @@ -43,7 +43,7 @@ "typescript": "^3.8.3" }, "peerDependencies": { - "@component-controls/specification": "*", + "@component-controls/core": "*", "react": "*" }, "jest": { diff --git a/props-info/react-docgen-typescript/src/index.ts b/props-info/react-docgen-typescript/src/index.ts index 59e3e3a53..0c75d973b 100644 --- a/props-info/react-docgen-typescript/src/index.ts +++ b/props-info/react-docgen-typescript/src/index.ts @@ -1,7 +1,7 @@ import { ComponentInfo, PropsInfoExtractorFunction, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { extractDocgenTypescriptInfo } from './react-docgen-typescript'; import { RectDocgenTypescriptOptions } from './types'; import { transformProps } from './transform-props'; diff --git a/props-info/react-docgen-typescript/src/transform-props.ts b/props-info/react-docgen-typescript/src/transform-props.ts index c6f51fe7d..6e86c8aeb 100644 --- a/props-info/react-docgen-typescript/src/transform-props.ts +++ b/props-info/react-docgen-typescript/src/transform-props.ts @@ -3,7 +3,7 @@ import { PropType, TypeInformation, TypeValue, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { Props, PropItem } from 'react-docgen-typescript'; const cleanQuotes = (txt?: string) => diff --git a/props-info/react-docgen/package.json b/props-info/react-docgen/package.json index 7a86c791c..a202085f0 100644 --- a/props-info/react-docgen/package.json +++ b/props-info/react-docgen/package.json @@ -30,7 +30,7 @@ }, "license": "MIT", "dependencies": { - "@component-controls/specification": "^1.2.0", + "@component-controls/core": "^1.2.0", "react": "^16.12.0", "react-docgen": "^5.3.0" }, @@ -45,7 +45,7 @@ "typescript": "^3.8.3" }, "peerDependencies": { - "@component-controls/specification": "*", + "@component-controls/core": "*", "react": "*" }, "jest": { diff --git a/props-info/react-docgen/src/index.ts b/props-info/react-docgen/src/index.ts index 618f375eb..25996cfc1 100644 --- a/props-info/react-docgen/src/index.ts +++ b/props-info/react-docgen/src/index.ts @@ -1,7 +1,7 @@ import { ComponentInfo, PropsInfoExtractorFunction, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { extractDocgenInfo } from './react-docgen'; import { RectDocgenOptions } from './types'; diff --git a/props-info/react-docgen/src/transform-props.ts b/props-info/react-docgen/src/transform-props.ts index bd2e0fae9..181fd819b 100644 --- a/props-info/react-docgen/src/transform-props.ts +++ b/props-info/react-docgen/src/transform-props.ts @@ -1,8 +1,4 @@ -import { - PropTypes, - PropType, - TypeInformation, -} from '@component-controls/specification'; +import { PropTypes, PropType, TypeInformation } from '@component-controls/core'; const rdPropToCCProp = (rdProp: any): PropType => { const prop: Partial = {}; diff --git a/ui/app/package.json b/ui/app/package.json index f63f574ba..2b17b1cde 100644 --- a/ui/app/package.json +++ b/ui/app/package.json @@ -32,7 +32,7 @@ "dependencies": { "@component-controls/blocks": "^1.2.0", "@component-controls/components": "^1.2.0", - "@component-controls/specification": "^1.2.0", + "@component-controls/core": "^1.2.0", "qs": "^6.9.4", "react": "^16.13.1", "react-dom": "^16.13.1", diff --git a/ui/app/src/AppContext/AppContext.tsx b/ui/app/src/AppContext/AppContext.tsx index 4b1a9019a..2c95417b9 100644 --- a/ui/app/src/AppContext/AppContext.tsx +++ b/ui/app/src/AppContext/AppContext.tsx @@ -1,7 +1,7 @@ /** @jsx jsx */ import { FC, useMemo } from 'react'; import { jsx } from 'theme-ui'; -import { PageType, defPageType } from '@component-controls/specification'; +import { PageType, defPageType } from '@component-controls/core'; import { ThemeProvider } from '@component-controls/components'; import { SidebarContextProvider, diff --git a/ui/app/src/CategoryList/CategoryList.tsx b/ui/app/src/CategoryList/CategoryList.tsx index 86b423dc4..c2bfc9e3a 100644 --- a/ui/app/src/CategoryList/CategoryList.tsx +++ b/ui/app/src/CategoryList/CategoryList.tsx @@ -1,7 +1,7 @@ /** @jsx jsx */ import { FC, useContext } from 'react'; import { jsx, Box } from 'theme-ui'; -import { PageType } from '@component-controls/specification'; +import { PageType } from '@component-controls/core'; import { Title } from '@component-controls/components'; import { PageContainer, BlockContext } from '@component-controls/blocks'; import { CategoryListItem } from './CategoryListItem'; diff --git a/ui/app/src/CategoryPage/CategoryPage.tsx b/ui/app/src/CategoryPage/CategoryPage.tsx index a0b0c2f8d..86f7bb255 100644 --- a/ui/app/src/CategoryPage/CategoryPage.tsx +++ b/ui/app/src/CategoryPage/CategoryPage.tsx @@ -1,7 +1,7 @@ /** @jsx jsx */ import { FC, useContext } from 'react'; import { jsx, Box } from 'theme-ui'; -import { PageType } from '@component-controls/specification'; +import { PageType } from '@component-controls/core'; import { Title, Link } from '@component-controls/components'; import { PageContainer, BlockContext } from '@component-controls/blocks'; import { DocumentsList } from '../DocumentsList'; diff --git a/ui/app/src/DocPage/DocPage.tsx b/ui/app/src/DocPage/DocPage.tsx index fd4cfb92c..e7ebc70fe 100644 --- a/ui/app/src/DocPage/DocPage.tsx +++ b/ui/app/src/DocPage/DocPage.tsx @@ -3,7 +3,7 @@ import { FC, useContext } from 'react'; import { jsx } from 'theme-ui'; import { PageContainer, BlockContext } from '@component-controls/blocks'; import { SidebarsPage, DocPageProps, PageConfig } from '../SidebarsPage'; -import { PageType } from '@component-controls/specification'; +import { PageType } from '@component-controls/core'; export type PagesConfig = (route: string) => PageConfig[]; diff --git a/ui/app/src/DocumentsList/DocumentsList.tsx b/ui/app/src/DocumentsList/DocumentsList.tsx index 6e85cb99a..93e1bb1c8 100644 --- a/ui/app/src/DocumentsList/DocumentsList.tsx +++ b/ui/app/src/DocumentsList/DocumentsList.tsx @@ -1,5 +1,5 @@ import React, { FC, useContext } from 'react'; -import { Pages } from '@component-controls/specification'; +import { Pages } from '@component-controls/core'; import { BlockContext } from '@component-controls/blocks'; import { DocumentsListItem } from './DocumentsListItem'; diff --git a/ui/app/src/DocumentsList/DocumentsListItem.tsx b/ui/app/src/DocumentsList/DocumentsListItem.tsx index 058e0889c..4158ae3a0 100644 --- a/ui/app/src/DocumentsList/DocumentsListItem.tsx +++ b/ui/app/src/DocumentsList/DocumentsListItem.tsx @@ -6,7 +6,7 @@ import { getDocPath, defPageType, RunConfiguration, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { Subtitle, Markdown, Tag, Link } from '@component-controls/components'; import { TagsList } from '../TagsList'; diff --git a/ui/app/src/Header/Header.tsx b/ui/app/src/Header/Header.tsx index 5c740923e..91a80a93b 100644 --- a/ui/app/src/Header/Header.tsx +++ b/ui/app/src/Header/Header.tsx @@ -1,7 +1,7 @@ /** @jsx jsx */ import { FC, useContext } from 'react'; import { jsx, Box, Text } from 'theme-ui'; -import { PageType, PageConfiguration } from '@component-controls/specification'; +import { PageType, PageConfiguration } from '@component-controls/core'; import { Link, diff --git a/ui/app/src/PageList/PageList.tsx b/ui/app/src/PageList/PageList.tsx index 2f48a86de..3f2a0d1e6 100644 --- a/ui/app/src/PageList/PageList.tsx +++ b/ui/app/src/PageList/PageList.tsx @@ -1,7 +1,7 @@ /** @jsx jsx */ import { FC, useContext } from 'react'; import { jsx } from 'theme-ui'; -import { PageType } from '@component-controls/specification'; +import { PageType } from '@component-controls/core'; import { Title } from '@component-controls/components'; import { PageContainer, BlockContext } from '@component-controls/blocks'; import { DocumentsList } from '../DocumentsList'; diff --git a/ui/app/src/Sidebar/Sidebar.tsx b/ui/app/src/Sidebar/Sidebar.tsx index c703f96cc..96fd3b682 100644 --- a/ui/app/src/Sidebar/Sidebar.tsx +++ b/ui/app/src/Sidebar/Sidebar.tsx @@ -17,7 +17,7 @@ import { PageType, Pages, defPageType, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { StoryStore } from '@component-controls/store'; export interface SidebarProps { diff --git a/ui/app/src/SidebarsPage/SidebarsMDXPage.tsx b/ui/app/src/SidebarsPage/SidebarsMDXPage.tsx index a57648761..b972b87b4 100644 --- a/ui/app/src/SidebarsPage/SidebarsMDXPage.tsx +++ b/ui/app/src/SidebarsPage/SidebarsMDXPage.tsx @@ -1,7 +1,7 @@ /** @jsx jsx */ import { FC } from 'react'; import { jsx, Box } from 'theme-ui'; -import { PageType } from '@component-controls/specification'; +import { PageType } from '@component-controls/core'; import { PageContainer } from '@component-controls/blocks'; import { Sidebar } from '../Sidebar'; diff --git a/ui/app/src/SidebarsPage/SidebarsStoryPage.tsx b/ui/app/src/SidebarsPage/SidebarsStoryPage.tsx index 59076dd23..81c1f3f3e 100644 --- a/ui/app/src/SidebarsPage/SidebarsStoryPage.tsx +++ b/ui/app/src/SidebarsPage/SidebarsStoryPage.tsx @@ -2,7 +2,7 @@ import { FC, useRef, ReactNode } from 'react'; import { jsx, Box } from 'theme-ui'; import * as qs from 'qs'; -import { PageType } from '@component-controls/specification'; +import { PageType } from '@component-controls/core'; import { Tabs, Tab, TabList, TabPanel } from '@component-controls/components'; import { PageContainer } from '@component-controls/blocks'; diff --git a/ui/app/src/TagsList/TagsList.tsx b/ui/app/src/TagsList/TagsList.tsx index c97614578..bf6c08b22 100644 --- a/ui/app/src/TagsList/TagsList.tsx +++ b/ui/app/src/TagsList/TagsList.tsx @@ -1,7 +1,7 @@ /** @jsx jsx */ import { FC, useContext } from 'react'; import { jsx, Box } from 'theme-ui'; -import { getDocPath } from '@component-controls/specification'; +import { getDocPath } from '@component-controls/core'; import { Tag } from '@component-controls/components'; import { BlockContext } from '@component-controls/blocks'; import { Link } from '@component-controls/components'; diff --git a/ui/blocks/package.json b/ui/blocks/package.json index 4e7d4d889..d3adfbdad 100644 --- a/ui/blocks/package.json +++ b/ui/blocks/package.json @@ -33,7 +33,6 @@ "@component-controls/components": "^1.2.0", "@component-controls/core": "^1.2.0", "@component-controls/editors": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@component-controls/store": "^1.2.0", "@primer/octicons-react": "^9.6.0", "@storybook/csf": "^0.0.1", diff --git a/ui/blocks/src/BlockContainer/components/ComponentsBlockContainer.tsx b/ui/blocks/src/BlockContainer/components/ComponentsBlockContainer.tsx index 46a2fb6a1..9ab5ce7ed 100644 --- a/ui/blocks/src/BlockContainer/components/ComponentsBlockContainer.tsx +++ b/ui/blocks/src/BlockContainer/components/ComponentsBlockContainer.tsx @@ -4,8 +4,7 @@ import { BlockContainerProps, } from '@component-controls/components'; -import { getComponentName } from '@component-controls/specification'; -import { hasControls } from '@component-controls/core'; +import { getComponentName, hasControls } from '@component-controls/core'; import { CURRENT_STORY } from '../../utils'; import { ComponentsContainer, diff --git a/ui/blocks/src/ComponentDeps/BaseComponentDeps.tsx b/ui/blocks/src/ComponentDeps/BaseComponentDeps.tsx index f4389ecc5..d5d9987ab 100644 --- a/ui/blocks/src/ComponentDeps/BaseComponentDeps.tsx +++ b/ui/blocks/src/ComponentDeps/BaseComponentDeps.tsx @@ -1,5 +1,5 @@ import React, { FC, useMemo } from 'react'; -import { StoryComponent, PackageInfo } from '@component-controls/specification'; +import { StoryComponent, PackageInfo } from '@component-controls/core'; import { Dependencies } from './Dependencies'; export interface BaseComponentDepsProps { diff --git a/ui/blocks/src/ComponentDeps/Dependencies.tsx b/ui/blocks/src/ComponentDeps/Dependencies.tsx index a4b44d710..edb78d855 100644 --- a/ui/blocks/src/ComponentDeps/Dependencies.tsx +++ b/ui/blocks/src/ComponentDeps/Dependencies.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/display-name */ import React, { FC, useMemo } from 'react'; import { Flex, Box } from 'theme-ui'; -import { ImportName } from '@component-controls/specification'; +import { ImportName } from '@component-controls/core'; import { Table, Tag, ExternalLink } from '@component-controls/components'; const defaultExport = 'default'; diff --git a/ui/blocks/src/PropsTable/BasePropsTable.tsx b/ui/blocks/src/PropsTable/BasePropsTable.tsx index 283353fdd..a59bdbcda 100644 --- a/ui/blocks/src/PropsTable/BasePropsTable.tsx +++ b/ui/blocks/src/PropsTable/BasePropsTable.tsx @@ -11,8 +11,8 @@ import { ComponentControl, PropType, ComponentInfo, -} from '@component-controls/specification'; -import { visibleControls } from '@component-controls/core'; + visibleControls, +} from '@component-controls/core'; import { Table, diff --git a/ui/blocks/src/PropsTable/controlsActions.ts b/ui/blocks/src/PropsTable/controlsActions.ts index eb9f89f23..29fd6e285 100644 --- a/ui/blocks/src/PropsTable/controlsActions.ts +++ b/ui/blocks/src/PropsTable/controlsActions.ts @@ -5,12 +5,9 @@ import { resetControlValues, getControlValues, randomizeData, -} from '@component-controls/core'; - -import { ComponentControls, SetControlValueFn, -} from '@component-controls/specification'; +} from '@component-controls/core'; export interface UseControlsActionsProps { controls?: ComponentControls; diff --git a/ui/blocks/src/Story/Story.tsx b/ui/blocks/src/Story/Story.tsx index de72765f5..039653c82 100644 --- a/ui/blocks/src/Story/Story.tsx +++ b/ui/blocks/src/Story/Story.tsx @@ -1,8 +1,11 @@ /** @jsx jsx */ import { FC, createElement, forwardRef, useEffect } from 'react'; import { jsx, Box } from 'theme-ui'; -import { deepMerge, StoryRenderFn } from '@component-controls/specification'; -import { getControlValues } from '@component-controls/core'; +import { + deepMerge, + StoryRenderFn, + getControlValues, +} from '@component-controls/core'; import { StoryBlockContainer, StoryBlockContainerProps, diff --git a/ui/blocks/src/StoryConfig/BaseStoryConfig.tsx b/ui/blocks/src/StoryConfig/BaseStoryConfig.tsx index e54f09ccf..5a506dfed 100644 --- a/ui/blocks/src/StoryConfig/BaseStoryConfig.tsx +++ b/ui/blocks/src/StoryConfig/BaseStoryConfig.tsx @@ -4,11 +4,7 @@ /* eslint react/jsx-key: 0 */ import { jsx } from 'theme-ui'; import { FC, useState, useContext } from 'react'; -import { - Story, - StoriesDoc, - PackageInfo, -} from '@component-controls/specification'; +import { Story, StoriesDoc, PackageInfo } from '@component-controls/core'; import { ThemeContext, Source, diff --git a/ui/blocks/src/StorySource/BaseStorySource.tsx b/ui/blocks/src/StorySource/BaseStorySource.tsx index e133d7adb..ffd260b3e 100644 --- a/ui/blocks/src/StorySource/BaseStorySource.tsx +++ b/ui/blocks/src/StorySource/BaseStorySource.tsx @@ -2,13 +2,8 @@ /** @jsx jsx */ import { jsx } from 'theme-ui'; import { FC, useState, useContext } from 'react'; -import { - Story, - StoriesDoc, - PackageInfo, -} from '@component-controls/specification'; import { Styled } from 'theme-ui'; - +import { Story, StoriesDoc, PackageInfo } from '@component-controls/core'; import { ThemeContext, Source, diff --git a/ui/blocks/src/StorySource/arg-values.ts b/ui/blocks/src/StorySource/arg-values.ts index f83e35efd..1104fefb6 100644 --- a/ui/blocks/src/StorySource/arg-values.ts +++ b/ui/blocks/src/StorySource/arg-values.ts @@ -2,8 +2,9 @@ import { StoryArguments, CodeLocation, ComponentControls, -} from '@component-controls/specification'; -import { getControlValue, getControlValues } from '@component-controls/core'; + getControlValue, + getControlValues, +} from '@component-controls/core'; import stringifyObject from 'stringify-object'; import { PrismTheme } from 'prism-react-renderer'; diff --git a/ui/blocks/src/context/block/BlockControlsContext.tsx b/ui/blocks/src/context/block/BlockControlsContext.tsx index 56561d91f..f6497ad2e 100644 --- a/ui/blocks/src/context/block/BlockControlsContext.tsx +++ b/ui/blocks/src/context/block/BlockControlsContext.tsx @@ -4,8 +4,8 @@ import { SetControlValueFn, ClickControlFn, ComponentControlButton, -} from '@component-controls/specification'; -import { mergeControlValues } from '@component-controls/core'; + mergeControlValues, +} from '@component-controls/core'; export interface BlockControlsContextInputProps { /** diff --git a/ui/blocks/src/context/block/BlockDataContext.tsx b/ui/blocks/src/context/block/BlockDataContext.tsx index 5c5e64c79..f061274ad 100644 --- a/ui/blocks/src/context/block/BlockDataContext.tsx +++ b/ui/blocks/src/context/block/BlockDataContext.tsx @@ -10,7 +10,7 @@ import { StoriesDoc, getComponentName, PackageInfo, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { CURRENT_STORY } from '../../utils'; export interface BlockDataContextProps { diff --git a/ui/blocks/src/context/components/ComponentsContainer.tsx b/ui/blocks/src/context/components/ComponentsContainer.tsx index b684a786c..2656231eb 100644 --- a/ui/blocks/src/context/components/ComponentsContainer.tsx +++ b/ui/blocks/src/context/components/ComponentsContainer.tsx @@ -1,9 +1,5 @@ import React from 'react'; -import { - Story, - StoryComponent, - PackageInfo, -} from '@component-controls/specification'; +import { Story, StoryComponent, PackageInfo } from '@component-controls/core'; import { Tab, Tabs, TabList, TabPanel } from '@component-controls/components'; import { ComponentInputProps, useComponentsContext } from './ComponentsContext'; diff --git a/ui/blocks/src/context/components/ComponentsContext.tsx b/ui/blocks/src/context/components/ComponentsContext.tsx index 8f66b7ba5..8f387f895 100644 --- a/ui/blocks/src/context/components/ComponentsContext.tsx +++ b/ui/blocks/src/context/components/ComponentsContext.tsx @@ -5,7 +5,7 @@ import { StoryComponents, getComponentName, PackageInfo, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { BlockDataContext } from '../block'; import { CURRENT_STORY } from '../../utils'; diff --git a/ui/blocks/src/context/story/StoryContext.tsx b/ui/blocks/src/context/story/StoryContext.tsx index d83285e57..3dcfe05c9 100644 --- a/ui/blocks/src/context/story/StoryContext.tsx +++ b/ui/blocks/src/context/story/StoryContext.tsx @@ -4,7 +4,7 @@ import { StoriesDoc, StoryComponent, PackageInfo, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { BlockContext, BlockDataContext } from '../block'; import { CURRENT_STORY } from '../../utils'; diff --git a/ui/blocks/src/test/storyStore.tsx b/ui/blocks/src/test/storyStore.tsx index 987f11e38..2eb9e2d0b 100644 --- a/ui/blocks/src/test/storyStore.tsx +++ b/ui/blocks/src/test/storyStore.tsx @@ -1,13 +1,14 @@ /* eslint-disable react/display-name */ import React from 'react'; +import { Donut, Button, Heading } from 'theme-ui'; import { StoriesStore, ControlTypes, defaultBuildConfig, deepMerge, defaultRunConfig, -} from '@component-controls/specification'; -import { Donut, Button, Heading } from 'theme-ui'; +} from '@component-controls/core'; + import { MDXContent } from './MDXStory'; export const store: StoriesStore = { @@ -28,7 +29,6 @@ export const store: StoriesStore = { '@component-controls/components': '^1.0.1', '@component-controls/core': '^1.0.1', '@component-controls/editors': '^1.0.1', - '@component-controls/specification': '^1.0.1', '@component-controls/store': '^1.0.3', '@mdx-js/react': '^1.6.5', '@primer/octicons-react': '^9.6.0', diff --git a/ui/blocks/src/utils/constants.ts b/ui/blocks/src/utils/constants.ts index 8598ee345..5850846a8 100644 --- a/ui/blocks/src/utils/constants.ts +++ b/ui/blocks/src/utils/constants.ts @@ -1,8 +1,4 @@ -import { - StoriesDoc, - StoryComponent, - Story, -} from '@component-controls/specification'; +import { StoriesDoc, StoryComponent, Story } from '@component-controls/core'; export const CURRENT_STORY = '.'; diff --git a/ui/blocks/src/utils/repositoryActions.tsx b/ui/blocks/src/utils/repositoryActions.tsx index 25d326392..b4aaf03d4 100644 --- a/ui/blocks/src/utils/repositoryActions.tsx +++ b/ui/blocks/src/utils/repositoryActions.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { PackageInfo } from '@component-controls/specification'; +import { PackageInfo } from '@component-controls/core'; import { ActionItem, ExternalLink } from '@component-controls/components'; export const repositoryActions = ( diff --git a/ui/editors/package.json b/ui/editors/package.json index 9b75a8ae3..4604a5a15 100644 --- a/ui/editors/package.json +++ b/ui/editors/package.json @@ -32,7 +32,6 @@ "dependencies": { "@component-controls/components": "^1.2.0", "@component-controls/core": "^1.2.0", - "@component-controls/specification": "^1.2.0", "@primer/octicons-react": "^9.6.0", "deepmerge": "^4.2.2", "global": "^4.3.2", diff --git a/ui/editors/src/ArrayEditor/ArrayEditor.stories.tsx b/ui/editors/src/ArrayEditor/ArrayEditor.stories.tsx index 7bf52e174..3759bbb1f 100644 --- a/ui/editors/src/ArrayEditor/ArrayEditor.stories.tsx +++ b/ui/editors/src/ArrayEditor/ArrayEditor.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; import { ConrolsContextProvider } from '../context'; import { ArrayEditor } from './ArrayEditor'; diff --git a/ui/editors/src/ArrayEditor/ArrayEditor.tsx b/ui/editors/src/ArrayEditor/ArrayEditor.tsx index 80c774a10..ba6c62f66 100644 --- a/ui/editors/src/ArrayEditor/ArrayEditor.tsx +++ b/ui/editors/src/ArrayEditor/ArrayEditor.tsx @@ -6,8 +6,8 @@ import { ComponentControl, ComponentControlArray, ControlTypes, -} from '@component-controls/specification'; -import { newControlValues } from '@component-controls/core'; + newControlValues, +} from '@component-controls/core'; import { Popover } from '@component-controls/components'; import { PropertyEditor, PropertyControlProps } from '../types'; diff --git a/ui/editors/src/BooleanEditor/BooleanEditor.stories.tsx b/ui/editors/src/BooleanEditor/BooleanEditor.stories.tsx index 50dcc414a..c7c10692d 100644 --- a/ui/editors/src/BooleanEditor/BooleanEditor.stories.tsx +++ b/ui/editors/src/BooleanEditor/BooleanEditor.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; import { ConrolsContextProvider } from '../context'; import { BooleanEditor } from './BooleanEditor'; diff --git a/ui/editors/src/BooleanEditor/BooleanEditor.tsx b/ui/editors/src/BooleanEditor/BooleanEditor.tsx index 4d9666fbb..c05dfe666 100644 --- a/ui/editors/src/BooleanEditor/BooleanEditor.tsx +++ b/ui/editors/src/BooleanEditor/BooleanEditor.tsx @@ -3,7 +3,7 @@ import { Toggle } from '@component-controls/components'; import { ComponentControlBoolean, ControlTypes, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { PropertyEditor } from '../types'; import { useControlContext } from '../context'; import { addPropertyEditor } from '../prop-factory'; diff --git a/ui/editors/src/ButtonEditor/ButtonEditor.stories.tsx b/ui/editors/src/ButtonEditor/ButtonEditor.stories.tsx index 048b2086f..d30fa0017 100644 --- a/ui/editors/src/ButtonEditor/ButtonEditor.stories.tsx +++ b/ui/editors/src/ButtonEditor/ButtonEditor.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; import { ConrolsContextProvider } from '../context'; import { ButtonEditor } from './ButtonEditor'; diff --git a/ui/editors/src/ButtonEditor/ButtonEditor.tsx b/ui/editors/src/ButtonEditor/ButtonEditor.tsx index 2c6ecf62b..2d2586a60 100644 --- a/ui/editors/src/ButtonEditor/ButtonEditor.tsx +++ b/ui/editors/src/ButtonEditor/ButtonEditor.tsx @@ -1,9 +1,6 @@ import React from 'react'; import { Button } from 'theme-ui'; -import { - ComponentControlButton, - ControlTypes, -} from '@component-controls/specification'; +import { ComponentControlButton, ControlTypes } from '@component-controls/core'; import { PropertyEditor } from '../types'; import { useControlContext } from '../context'; import { addPropertyEditor } from '../prop-factory'; diff --git a/ui/editors/src/ColorEditor/ColorEditor.stories.tsx b/ui/editors/src/ColorEditor/ColorEditor.stories.tsx index f49c145d3..14b57b75e 100644 --- a/ui/editors/src/ColorEditor/ColorEditor.stories.tsx +++ b/ui/editors/src/ColorEditor/ColorEditor.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; import { ConrolsContextProvider } from '../context'; import { ColorEditor } from './ColorEditor'; diff --git a/ui/editors/src/ColorEditor/ColorEditor.tsx b/ui/editors/src/ColorEditor/ColorEditor.tsx index 13b4b129a..e2cd47fe6 100644 --- a/ui/editors/src/ColorEditor/ColorEditor.tsx +++ b/ui/editors/src/ColorEditor/ColorEditor.tsx @@ -1,10 +1,7 @@ import React from 'react'; import { SketchPicker, ColorResult } from 'react-color'; import { Button, Box } from 'theme-ui'; -import { - ComponentControlColor, - ControlTypes, -} from '@component-controls/specification'; +import { ComponentControlColor, ControlTypes } from '@component-controls/core'; import { PropertyEditor } from '../types'; import { useControlContext } from '../context'; import { addPropertyEditor } from '../prop-factory'; diff --git a/ui/editors/src/DateEditor/DateEditor.stories.tsx b/ui/editors/src/DateEditor/DateEditor.stories.tsx index ef41394f6..592555eca 100644 --- a/ui/editors/src/DateEditor/DateEditor.stories.tsx +++ b/ui/editors/src/DateEditor/DateEditor.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; import { ConrolsContextProvider } from '../context'; import { DateEditor } from './DateEditor'; diff --git a/ui/editors/src/DateEditor/DateEditor.tsx b/ui/editors/src/DateEditor/DateEditor.tsx index 27516a1cc..ea468cedd 100644 --- a/ui/editors/src/DateEditor/DateEditor.tsx +++ b/ui/editors/src/DateEditor/DateEditor.tsx @@ -1,9 +1,6 @@ import React, { ChangeEvent, RefObject } from 'react'; import { Input, Box } from 'theme-ui'; -import { - ComponentControlDate, - ControlTypes, -} from '@component-controls/specification'; +import { ComponentControlDate, ControlTypes } from '@component-controls/core'; import { PropertyEditor } from '../types'; import { useControlContext } from '../context'; import { addPropertyEditor } from '../prop-factory'; diff --git a/ui/editors/src/FilesEditor/FilesEditor.stories.tsx b/ui/editors/src/FilesEditor/FilesEditor.stories.tsx index fdf68bcdb..8ab18ff62 100644 --- a/ui/editors/src/FilesEditor/FilesEditor.stories.tsx +++ b/ui/editors/src/FilesEditor/FilesEditor.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; import { ConrolsContextProvider } from '../context'; import { FilesEditor } from './FilesEditor'; diff --git a/ui/editors/src/FilesEditor/FilesEditor.tsx b/ui/editors/src/FilesEditor/FilesEditor.tsx index 4f5c1c785..a448ebb0f 100644 --- a/ui/editors/src/FilesEditor/FilesEditor.tsx +++ b/ui/editors/src/FilesEditor/FilesEditor.tsx @@ -1,10 +1,7 @@ import { FileReader } from 'global'; import React, { ChangeEvent } from 'react'; import { Input } from 'theme-ui'; -import { - ComponentControlFiles, - ControlTypes, -} from '@component-controls/specification'; +import { ComponentControlFiles, ControlTypes } from '@component-controls/core'; import { PropertyEditor } from '../types'; import { useControlContext } from '../context'; import { addPropertyEditor } from '../prop-factory'; diff --git a/ui/editors/src/NumberEditor/NumberEditor.stories.tsx b/ui/editors/src/NumberEditor/NumberEditor.stories.tsx index 7b4f382ca..7a729ad91 100644 --- a/ui/editors/src/NumberEditor/NumberEditor.stories.tsx +++ b/ui/editors/src/NumberEditor/NumberEditor.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; import { ConrolsContextProvider } from '../context'; import { NumberEditor } from './NumberEditor'; diff --git a/ui/editors/src/NumberEditor/NumberEditor.tsx b/ui/editors/src/NumberEditor/NumberEditor.tsx index ed3405ff6..5f33f403b 100644 --- a/ui/editors/src/NumberEditor/NumberEditor.tsx +++ b/ui/editors/src/NumberEditor/NumberEditor.tsx @@ -1,9 +1,6 @@ import React, { FC, ChangeEvent } from 'react'; import { Input, Box, BoxProps } from 'theme-ui'; -import { - ComponentControlNumber, - ControlTypes, -} from '@component-controls/specification'; +import { ComponentControlNumber, ControlTypes } from '@component-controls/core'; import { PropertyEditor } from '../types'; import { useControlContext } from '../context'; import { addPropertyEditor } from '../prop-factory'; diff --git a/ui/editors/src/ObjectEditor/ObjectEditor.stories.tsx b/ui/editors/src/ObjectEditor/ObjectEditor.stories.tsx index f50e40da9..b2ed526a2 100644 --- a/ui/editors/src/ObjectEditor/ObjectEditor.stories.tsx +++ b/ui/editors/src/ObjectEditor/ObjectEditor.stories.tsx @@ -1,8 +1,5 @@ import React from 'react'; -import { - ControlTypes, - ComponentControls, -} from '@component-controls/specification'; +import { ControlTypes, ComponentControls } from '@component-controls/core'; import { ConrolsContextProvider } from '../context'; import { ObjectEditor } from './ObjectEditor'; diff --git a/ui/editors/src/ObjectEditor/ObjectEditor.tsx b/ui/editors/src/ObjectEditor/ObjectEditor.tsx index 7851d7471..e0cb8d056 100644 --- a/ui/editors/src/ObjectEditor/ObjectEditor.tsx +++ b/ui/editors/src/ObjectEditor/ObjectEditor.tsx @@ -4,8 +4,9 @@ import { ControlTypes, ComponentControl, ComponentControlObject, -} from '@component-controls/specification'; -import { mergeControlValues, getControlValues } from '@component-controls/core'; + mergeControlValues, + getControlValues, +} from '@component-controls/core'; import { Popover } from '@component-controls/components'; import { PropertyEditor, PropertyControlProps } from '../types'; import { useControlContext, ConrolsContextProvider } from '../context'; diff --git a/ui/editors/src/OptionsEditor/CheckboxEditor.tsx b/ui/editors/src/OptionsEditor/CheckboxEditor.tsx index 488a571f4..bf92069b6 100644 --- a/ui/editors/src/OptionsEditor/CheckboxEditor.tsx +++ b/ui/editors/src/OptionsEditor/CheckboxEditor.tsx @@ -1,6 +1,6 @@ import React, { ChangeEvent } from 'react'; import styled from '@emotion/styled'; -import { ComponentControlOptions } from '@component-controls/specification'; +import { ComponentControlOptions } from '@component-controls/core'; import { normalizeOptions, NormalizedOption } from './utils'; import { PropertyEditor } from '../types'; import { useControlContext } from '../context'; diff --git a/ui/editors/src/OptionsEditor/OptionsEditor.stories.tsx b/ui/editors/src/OptionsEditor/OptionsEditor.stories.tsx index d899c5a32..f63c66832 100644 --- a/ui/editors/src/OptionsEditor/OptionsEditor.stories.tsx +++ b/ui/editors/src/OptionsEditor/OptionsEditor.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; import { ConrolsContextProvider } from '../context'; import { OptionsEditor } from './OptionsEditor'; diff --git a/ui/editors/src/OptionsEditor/OptionsEditor.tsx b/ui/editors/src/OptionsEditor/OptionsEditor.tsx index 7fcc78bab..d864c6bff 100644 --- a/ui/editors/src/OptionsEditor/OptionsEditor.tsx +++ b/ui/editors/src/OptionsEditor/OptionsEditor.tsx @@ -4,7 +4,7 @@ import styled from '@emotion/styled'; import { ComponentControlOptions, ControlTypes, -} from '@component-controls/specification'; +} from '@component-controls/core'; import { normalizeOptions } from './utils'; import { PropertyEditor } from '../types'; import { useControlContext } from '../context'; diff --git a/ui/editors/src/OptionsEditor/RadiosEditor.tsx b/ui/editors/src/OptionsEditor/RadiosEditor.tsx index 0b2cc1d7d..a3a983264 100644 --- a/ui/editors/src/OptionsEditor/RadiosEditor.tsx +++ b/ui/editors/src/OptionsEditor/RadiosEditor.tsx @@ -1,6 +1,6 @@ import React from 'react'; import styled from '@emotion/styled'; -import { ComponentControlOptions } from '@component-controls/specification'; +import { ComponentControlOptions } from '@component-controls/core'; import { normalizeOptions, NormalizedOption } from './utils'; import { PropertyEditor } from '../types'; import { useControlContext } from '../context'; diff --git a/ui/editors/src/OptionsEditor/utils.test.ts b/ui/editors/src/OptionsEditor/utils.test.ts index 172061c5c..42ccb7cac 100644 --- a/ui/editors/src/OptionsEditor/utils.test.ts +++ b/ui/editors/src/OptionsEditor/utils.test.ts @@ -1,4 +1,4 @@ -import { OptionsListType } from '@component-controls/specification'; +import { OptionsListType } from '@component-controls/core'; import { normalizeOptions, NormalizedOptions } from './utils'; diff --git a/ui/editors/src/OptionsEditor/utils.ts b/ui/editors/src/OptionsEditor/utils.ts index 54ec0ced3..a20efbc31 100644 --- a/ui/editors/src/OptionsEditor/utils.ts +++ b/ui/editors/src/OptionsEditor/utils.ts @@ -1,7 +1,4 @@ -import { - OptionsListType, - OptionsValueType, -} from '@component-controls/specification'; +import { OptionsListType, OptionsValueType } from '@component-controls/core'; export interface NormalizedOption { label: string; diff --git a/ui/editors/src/PropFactory.stories.tsx b/ui/editors/src/PropFactory.stories.tsx index e8cd3cf11..7127c7c70 100644 --- a/ui/editors/src/PropFactory.stories.tsx +++ b/ui/editors/src/PropFactory.stories.tsx @@ -1,5 +1,5 @@ import React, { ChangeEvent } from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; import { PropertyEditor } from './types'; import { ConrolsContextProvider, useControlContext } from './context'; import { addPropertyEditor, getPropertyEditor } from './prop-factory'; diff --git a/ui/editors/src/TextEditor/TextEditor.stories.tsx b/ui/editors/src/TextEditor/TextEditor.stories.tsx index 26daf8533..633ecdfad 100644 --- a/ui/editors/src/TextEditor/TextEditor.stories.tsx +++ b/ui/editors/src/TextEditor/TextEditor.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; import { ConrolsContextProvider } from '../context'; import { TextEditor } from './TextEditor'; diff --git a/ui/editors/src/TextEditor/TextEditor.tsx b/ui/editors/src/TextEditor/TextEditor.tsx index 4e6a5a020..a75eee9b3 100644 --- a/ui/editors/src/TextEditor/TextEditor.tsx +++ b/ui/editors/src/TextEditor/TextEditor.tsx @@ -1,9 +1,6 @@ import React, { ChangeEvent } from 'react'; import { Input, Textarea } from 'theme-ui'; -import { - ComponentControlText, - ControlTypes, -} from '@component-controls/specification'; +import { ComponentControlText, ControlTypes } from '@component-controls/core'; import { PropertyEditor } from '../types'; import { useControlContext } from '../context'; import { addPropertyEditor } from '../prop-factory'; diff --git a/ui/editors/src/context.tsx b/ui/editors/src/context.tsx index 6ed08a471..d413e3800 100644 --- a/ui/editors/src/context.tsx +++ b/ui/editors/src/context.tsx @@ -3,7 +3,7 @@ import { ComponentControlBase, ComponentControl, ComponentControls, -} from '@component-controls/specification'; +} from '@component-controls/core'; export type PropertyOnClick = (prop: ComponentControl) => any; diff --git a/ui/editors/src/prop-factory.ts b/ui/editors/src/prop-factory.ts index 97e342d48..86923fc66 100644 --- a/ui/editors/src/prop-factory.ts +++ b/ui/editors/src/prop-factory.ts @@ -1,4 +1,4 @@ -import { ControlTypes } from '@component-controls/specification'; +import { ControlTypes } from '@component-controls/core'; import { PropertyEditor } from './types'; const PropertyEditors: { [key: string]: PropertyEditor } = {};