Skip to content

Commit

Permalink
docs: about trait tag
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Feb 19, 2023
1 parent e6180e6 commit dac9727
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
16 changes: 16 additions & 0 deletions demo/tiddlers/$__TraitTag.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
created: 20230218103715583
creator: 林一二
modified: 20230218103716732
modifier: 林一二
title: $:/SuperTag/TraitTag
type: text/vnd.tiddlywiki

See `schema` field of following tiddlers for JSON Schema examples.

<$list filter="[tag<currentTiddler>]">

!!! <$link><<currentTiddler>></$link>

{{!!text}}

</$list>
12 changes: 9 additions & 3 deletions demo/tiddlers/Examples.tid
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ tags: Index
title: Examples
type: text/vnd.tiddlywiki

!! Task
!! SuperTag

!!! Task

[[Task]] is a SuperTag, [[MyExampleTask]] is a normal tiddler adds this SuperTag.

[[$:/TraitTag/ActionState]] and [[$:/TraitTag/Priority]] are example TraitTags adding to it.

!! Counter
!!! Counter

[[ColorAndCounter]] is a SuperTag, with TraitTag [[$:/TraitTag/Count]] and [[$:/TraitTag/Color]]

!! TraitTag

[[ColorAndCounter]] is a SuperTag, with TraitTag [[$:/TraitTag/Count]] and [[$:/TraitTag/Color]]
See [[$:/SuperTag/TraitTag]] for details.
6 changes: 4 additions & 2 deletions demo/tiddlers/Index.tid
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ A TraitTag has two important fields, `"schema"` and `"uiSchema"`.
<$whiteboard tiddler="HowToCreateTraitTagDiagram" readonly="yes" height="850px" />

* schema: a [[JSON Schema|https://json-schema.org/]] that describe what data a form will receive.
* uiSchema: a [[jsonforms' option|https://jsonforms.io/docs/uischema/]] to describe the form's UI element and layout.
** You may refer to [[JSON Editor Doc#JSON Schema Support|https://github.com/json-editor/json-editor#json-schema-support]] for advanced features in the form
** A basic assumption is that the JSON Schema are `type: "object"` and has only 1 level of properties.
** All properties provided by all trait tags are merged into a single JSON Schema, and then is used to display the SuperTag Form

See links above to learn how to write them. You can also learn from some existed TraitTag.
See links above to learn how to write them. You can also learn from some existed [[TraitTag Examples|$:/SuperTag/TraitTag]].

!!! Plugin developer

Expand Down

0 comments on commit dac9727

Please sign in to comment.