Merge branch 'storybook-v7-upgrade' into docs/add-draft-concept-docs

This commit is contained in:
Mads Rasmussen
2023-02-23 21:39:17 +01:00
10 changed files with 14 additions and 69 deletions

View File

@@ -1,21 +1,18 @@
import { StorybookConfig } from '@storybook/web-components-vite';
const config: StorybookConfig = {
stories: ['../@(src|libs|apps)/**/*.stories.mdx', '../@(src|libs|apps)/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-a11y'],
framework: {
name: '@storybook/web-components-vite',
options: {}
},
features: {
storyStoreV7: true
},
staticDirs: ['../public-assets'],
typescript: {
check: true,
},
docs: {
autodocs: true
}
stories: ['../@(src|libs|apps)/**/*.mdx', '../@(src|libs|apps)/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-a11y'],
framework: {
name: '@storybook/web-components-vite',
options: {},
},
staticDirs: ['../public-assets'],
typescript: {
check: true,
},
docs: {
autodocs: true,
},
};
export default config;
export default config;

View File

@@ -1,13 +0,0 @@
import { Meta } from '@storybook/blocks';
<Meta title="Guides/Getting Started" />
# Getting started
This section contains a set of guide which will ease the learning of the Umbraco CMS (Backoffice).
In this document you will get a overview of the articles — Enabling you to get started with the parts that makes sense for you.
# Terminology
There is a few words that covers certain concepts, which is good to learn to easilier decode the purpose of code.
[Go to Resource Guide](/?path=/story/guides-resource--page)

View File

@@ -1,39 +0,0 @@
import { Meta } from '@storybook/addon-docs';
<Meta title="Guides/Umbraco Element" parameters={{ previewTabs: { canvas: { hidden: true } } }} />
# Umbraco Element
This element can be used as the base of any Element.
Do this if you need to Observe Data, Consume or Provide a Context API or use a Resource.
The Element implements the Controller Host and provides a few shortcut methods for initializing some Controllers.
The methods are (_note this can be out of date, we need to look into how we can ensure this Doc originates from code._)
```
observe<T>(source: Observable<T>, callback: (_value: T) => void, unique?: string): UmbObserverController<T>
provideContext<R = unknown>(alias: string | UmbContextToken<R>, instance: R): UmbContextProviderController<R>
consumeContext<R = unknown>(alias: string | UmbContextToken<R>, callback: UmbContextCallback<R>): UmbContextConsumerController<R>
```
Use these for an smooth consumption, like this request for a Context API using a simple string context, where the callback value is unknown
```
this.consumeContext('requestThisContextAlias', (context) => {
// Notice this is a subscription, as context might change or a new one appears.
console.log("I've got the context", context);
});
```
Or use the UmbContextToken type to define the type of the context, like this
```
const contextAlias = new UmbContextToken<SomeType>('description of context for debugging purposes');
this.consumeContext(contextAlias, (context) => {
// Notice this is a subscription, as context might change or a new one appears, but the value is strongly typed
console.log("I've got the context", context);
});
```