chore: Port FreeSewing.dev to docusaurus
The replaces the NextJS site powering FreeSewing.dev with a Docusaurus setup. It's part of my efforts to simplify FreeSewing's setup so we can focus on our core value proposition.
This commit is contained in:
parent
497633d1d3
commit
ab3204f9f1
692 changed files with 11037 additions and 20674 deletions
50
sites/dev/docs/reference/api/store/extend/readme.mdx
Normal file
50
sites/dev/docs/reference/api/store/extend/readme.mdx
Normal file
|
@ -0,0 +1,50 @@
|
|||
---
|
||||
title: Store.extend()
|
||||
---
|
||||
|
||||
The `Store.extend()` method can be used to extend the store with new
|
||||
functionality by passing an array of methods and the path to the location in
|
||||
the store where they should be attached. It is typically not used directly, but
|
||||
rather through a plugin.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
Store Store.extend(Array methods=[])
|
||||
```
|
||||
|
||||
:::tipThis method is chainable as it returns the `Store` object:::
|
||||
|
||||
The single argument should be an Array of methods to add to the
|
||||
store. Each entry in the array should be an array itself holding a path in
|
||||
dot notation and a method, as such:
|
||||
|
||||
The expected first parameter for the method is the `Store` instance.
|
||||
|
||||
```js
|
||||
function myCustomMethod(store, ...otherArguments) {
|
||||
// Do something clever
|
||||
}
|
||||
|
||||
const store = new Store([
|
||||
["path.to.the.method", myCustomMethod ]
|
||||
])
|
||||
```
|
||||
|
||||
With the configuration above, you can call `store.path.to.the.method()` and it
|
||||
will run `myCustomMethod()`.
|
||||
|
||||
Stores the value of `value` in the store under key `key`.
|
||||
|
||||
## Notes
|
||||
|
||||
The Store will not allow you to extend any of the following keys:
|
||||
|
||||
- `set`
|
||||
- `setIfUnset`
|
||||
- `push`
|
||||
- `unset`
|
||||
- `get`
|
||||
- `extend`
|
||||
|
||||
|
46
sites/dev/docs/reference/api/store/get/readme.mdx
Normal file
46
sites/dev/docs/reference/api/store/get/readme.mdx
Normal file
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
title: Store.get()
|
||||
---
|
||||
|
||||
The `Store.get()` method retrieves the data available under `key`.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
mixed store.get(mixed key, mixed dflt)
|
||||
```
|
||||
|
||||
If `key` is not available, the Store will return the optional second parameter
|
||||
(a default value).
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const store = new Store()
|
||||
store.set('example', 'Hi there')
|
||||
const value = store.get('example')
|
||||
// value now holds 'Hi there'
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
You can get/set nested keys either through dot-notation, or by passing an
|
||||
array:
|
||||
|
||||
```js
|
||||
const store = new Store()
|
||||
|
||||
store.set('my.nested.example', 'Hi there')
|
||||
store.set(['my', 'other', 'nested', 'example'], 'Oh hi again')
|
||||
|
||||
let value
|
||||
// Dot notation
|
||||
value = store.get('my.nested.example') // works
|
||||
value = store.get('my.other.nested.example') // works
|
||||
// Using an array
|
||||
value = store.get(['my', 'nested', 'example']) // works
|
||||
value = store.get(['my', 'other', 'nested', 'example']) // works
|
||||
// Direct access to the store object
|
||||
value = store.my.nested.example // Also works
|
||||
value = store.my.other.nested.example // Also works
|
||||
```
|
27
sites/dev/docs/reference/api/store/logs/readme.mdx
Normal file
27
sites/dev/docs/reference/api/store/logs/readme.mdx
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: Store.logs
|
||||
---
|
||||
|
||||
A **Store** is initialized with a `logs` property that holds logging data.
|
||||
|
||||
:::note
|
||||
If errors are logged, FreeSewing will not try to layout the pattern.
|
||||
:::
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
logs: {
|
||||
debug: [],
|
||||
info: [],
|
||||
warning: [],
|
||||
errors: []
|
||||
}
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
Users can override the default logging, so don't assume this is where logs end up.
|
||||
|
||||
That's why, you should always use the [Store.log methods](/reference/store-methods#store-methods-we-maintain) to log.
|
||||
|
29
sites/dev/docs/reference/api/store/push/readme.mdx
Normal file
29
sites/dev/docs/reference/api/store/push/readme.mdx
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: Store.push()
|
||||
---
|
||||
|
||||
The `Store.push()` method adds the parameters you pass it to the array stored under `key`.
|
||||
|
||||
If `key` does not hold and Array, the Store will log a warning, but nothing will happen.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
Store store.push(mixed value1, mixed value2, ...)
|
||||
```
|
||||
|
||||
:::noteThis method is [variadic](https://en.wikipedia.org/wiki/Variadic_function):::
|
||||
|
||||
:::tipThis method is chainable as it returns the `Store` object:::
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const store = new Store()
|
||||
store.set('example', ['Hi there'])
|
||||
store.push(
|
||||
'How are you doing',
|
||||
'How are YOU doing'
|
||||
)
|
||||
```
|
||||
|
22
sites/dev/docs/reference/api/store/readme.mdx
Normal file
22
sites/dev/docs/reference/api/store/readme.mdx
Normal file
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
title: Store
|
||||
---
|
||||
|
||||
A **Store** object holds a simple key/value store with methods for storing and
|
||||
retrieving data. It is shared across the pattern, and is the recommended way
|
||||
to pass data between your parts.
|
||||
|
||||
## Methods and Properties
|
||||
|
||||
A Store object exposes the following methods and properties:
|
||||
|
||||
<ReadMore recurse />
|
||||
|
||||
## Extended store methods
|
||||
|
||||
The store can also be extended with additional methods by plugins.
|
||||
|
||||
- Refer to [the Store Methods documentation](/reference/store-methods)
|
||||
for more information and a list of store methods maintained by FreeSewing.
|
||||
- Refer to [the Plugin guide](/guides/plugins) for information about how
|
||||
plugins can be used to provide store methods.
|
45
sites/dev/docs/reference/api/store/set/readme.mdx
Normal file
45
sites/dev/docs/reference/api/store/set/readme.mdx
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
title: Store.set()
|
||||
---
|
||||
|
||||
The `Store.set()` method stores the value of `value` in the store under key
|
||||
`key`.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
Store store.set(mixed key, mixed value)
|
||||
```
|
||||
|
||||
:::tipThis method is chainable as it returns the `Store` object:::
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const store = new Store()
|
||||
store.set('example', 'Hi there')
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
You can get/set nested keys either through dot-notation, or by passing an
|
||||
array:
|
||||
|
||||
```js
|
||||
const store = new Store()
|
||||
|
||||
store.set('my.nested.example', 'Hi there')
|
||||
store.set(['my', 'other', 'nested', 'example'], 'Oh hi again')
|
||||
|
||||
let value
|
||||
// Dot notation
|
||||
value = store.get('my.nested.example') // works
|
||||
value = store.get('my.other.nested.example') // works
|
||||
// Using an array
|
||||
value = store.get(['my', 'nested', 'example']) // works
|
||||
value = store.get(['my', 'other', 'nested', 'example']) // works
|
||||
// Direct access to the store object
|
||||
value = store.my.nested.example // Also works
|
||||
value = store.my.other.nested.example // Also works
|
||||
```
|
||||
|
23
sites/dev/docs/reference/api/store/setifunset/readme.mdx
Normal file
23
sites/dev/docs/reference/api/store/setifunset/readme.mdx
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
title: Store.setIfUnset()
|
||||
---
|
||||
|
||||
The `Store.set()` method stores the value of `value` in the store under key
|
||||
`key`, but only if that key does not already hold a value.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
Store store.set(mixed key, mixed value)
|
||||
```
|
||||
|
||||
:::tipThis method is chainable as it returns the `Store` object:::
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const store = new Store()
|
||||
store.set('example', 'Hi there')
|
||||
store.setIfUnset('example', 'Hi again') // This has no effect
|
||||
```
|
||||
|
21
sites/dev/docs/reference/api/store/unset/readme.mdx
Normal file
21
sites/dev/docs/reference/api/store/unset/readme.mdx
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
title: Store.unset()
|
||||
---
|
||||
|
||||
The `Store.unset()` value removes a `key` from the store.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
Store store.unset(string key)
|
||||
```
|
||||
|
||||
:::tipThis method is chainable as it returns the `Store` object:::
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const store = new Store()
|
||||
.set('example', 'I will be gone before you know it')
|
||||
.unset('example')
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue