Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 62 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ when the `content-tree` is in
from its [ecosystem of utilities][unist-utilities].

`content-tree` relates to [JavaScript][js] in that it has an [ecosystem of
utilities][unist-utilities] for working with trees in JavaScript. However,
utilities][unist-utilities] for working with trees in JavaScript. However,
`content-tree` is not limited to JavaScript and can be used in other programming
languages.

Expand Down Expand Up @@ -109,6 +109,14 @@ type BodyBlock =

`BodyBlock` nodes are the only things that are valid as the top level of a `Body`.

### UnstableBodyBlock

```ts
type UnstableBodyBlock = Gallery ;
```

`UnstableBodyBlocks` nodes are also valid body blocks, but like, experimental. you can add more unstable nodes to this block like `UnstableGallery | UnstableComponent`.

### `LayoutWidth`

```ts
Expand Down Expand Up @@ -182,7 +190,7 @@ interface Root extends Node {
interface Body extends Parent {
type: "body"
version: number
children: BodyBlock[]
children: (BodyBlock | UnstableBodyBlock)[]
}
```

Expand Down Expand Up @@ -346,7 +354,6 @@ _non normative note:_ the reason this is string properties and not children is
that it is more confusing if a pullquote falls back to text than if it
doesn't. The text is taken from elsewhere in the article.


### `ImageSet`

```ts
Expand Down Expand Up @@ -409,10 +416,8 @@ type ImageSource = {

**ImageSource** defines a single resource for an [image](#image).


### `Recommended`


```ts
interface Recommended extends Node {
type: "recommended"
Expand Down Expand Up @@ -488,7 +493,6 @@ type Teaser = {
}
```


### `Tweet`

```ts
Expand Down Expand Up @@ -632,7 +636,6 @@ The `layoutName` acts as a sort of theme for the component.

### `LayoutSlot`


```ts
interface LayoutSlot extends Parent {
type: "layout-slot"
Expand Down Expand Up @@ -679,7 +682,7 @@ interface TableCaption extends Parent {
}

interface TableCell extends Parent {
type: 'table-cell'
type: 'table-cell'
heading?: boolean
children: Phrasing[]
}
Expand Down Expand Up @@ -722,7 +725,7 @@ interface Table extends Parent {

```ts
type CustomCodeComponentAttributes = {
[key: string]: string | boolean | undefined
[key: string]: string | boolean | undefined
}

interface CustomCodeComponent extends Node {
Expand All @@ -743,11 +746,60 @@ interface CustomCodeComponent extends Node {
}
```

- The **CustomCodeComponent*** allows for more experimental forms of journalism, allowing editors to provide properties via Spark.
- The **CustomCodeComponent\*** allows for more experimental forms of journalism, allowing editors to provide properties via Spark.
- The component itself lives off-platform, and an example might be a git repository with a standard structure. This structure would include the rendering instructions, and the data structure that is expected to be provided to the component for it to render if necessary.
- The basic interface in Spark to make reference to this system above (eg. the git repo URL or a public S3 bucket), and provide some data for it if necessary. This will be the Custom Component storyblock.
- The data Spark receives from entering a specific ID will be used to render dynamic fields (the `attributes`).

### ExperimentalGallery

```ts
type galleryItem = {
/**
* @description link for the image
*/
imageLink?: "text"
/**
* @description this is the first Image
* @default false
*/
firstImage: boolean
/**
* @description image description
*/

imageDescription?: string
/**
* @description select or upload image
*/
picture?: Image
}

/**
* @sparkGenerateStoryblock true
*/
interface Gallery extends Node {
type: "Gallery"

/**
* @description gallery description
* @default default text for the source field
*/
galleryDescription?: string
/**
* @description autoplay the gallery
* @default false
*/
autoPlay?: boolean

/**
* @description each gallery item
* @maxItems 10
* @minItems 1
*/
galleryItems: [galleryItem]
}
```

## License

Expand Down
2 changes: 1 addition & 1 deletion build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
node tools/maketypes <README.md> content-tree.ts
tsc -d content-tree.ts
typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.full.Root > schemas/content-tree.schema.json
typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json
typescript-json-schema --validationKeywords sparkGenerateStoryblock --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json
typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Body > schemas/body-tree.schema.json
rm content-tree.ts
rm content-tree.js
Loading
Loading