Skip to content

Commit

Permalink
[skip ci] Specs for component name resolution. Fixed milestone detail…
Browse files Browse the repository at this point in the history
…s. Documented all fields for the widgets codegen schema
  • Loading branch information
karurochari committed Nov 28, 2024
1 parent 913c0fd commit 763ec86
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 29 deletions.
9 changes: 9 additions & 0 deletions docs/ideas/path-finding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Order of search for component when the direct `fullname` is not found. `name` is `fullname` reduced of its last extension.

- `fullname`
- `name.vs`
- `name.xml`
- `name.so` | `name.dll` | `name.dylib`
- `name/main.vs`
- `name/main.xml`
- `name/main.so` | `name/main.dll` | `name/main.dylib`
16 changes: 11 additions & 5 deletions docs/milestones.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
## 0.1.1-alpha

- [x] Complete the build process
- [x] Docker image
- [x] Flatpak building pipeline
- [x] Prepare pipeline for github actions

## 0.1.3

- [ ] New getters and setters design (and updated schemas).
- [ ] Implement flex, grid, scroll & pack via codegen.
- [ ] Tidy up the XML caching
- [ ] Tidy up the JS scripting interface.
- [x] Complete the build process
- [ ] Docker image
- [x] Flatpak building pipeline
- [ ] Prepare pipeline for github actions

## 0.1.5

Expand All @@ -23,10 +29,10 @@

- Fully functional c & js support in embedded scripts.
- DOM-like operations (constained due to its mostly immutable structure).
- Constrained operations on files.
- Constrained fetch requests.
- ~~Constrained operations on files.~~ no we use the storage and data sources
- ~~Constrained fetch requests.~~ no we use data sources
- Loading of native components.
- HTTP/HTTPS ~~& gemini~~
- HTTP/HTTPS ~~& gemini~~ gemini require additional effort as it is not supported by curl
- A good coverage of basic fltk components via codegen.

## 0.3.x
Expand Down
49 changes: 25 additions & 24 deletions scripts/codegen/components-new.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,44 @@ import { Type as t } from "@sinclair/typebox"
//Now props, computed, setters and getters are better linked together

export const type_schema = t.Union([
t.Literal('flag'),
t.Literal('enum'),
t.Literal('raw'),
t.Literal('string'),
t.Literal('color'),
t.Literal('scalar-1'),
t.Literal('scalar-2'),
t.Literal('flag'),
t.Literal('enum'),
t.Literal('raw'),
t.Literal('string'),
t.Literal('color'),
t.Literal('scalar-1'),
t.Literal('scalar-2'),
t.Literal('scalar-4')
], { description: 'type', default: 'string' });

const entries_schema = t.Record(t.String(), t.Object({
type: type_schema,
subtype: t.Optional(t.String()),
parse: t.Union([t.String(),t.Null()], {default:null, description:"From string to object. Default based on `type` (and `subtype`)"}),
setter: t.Union([t.String(),t.Null()], {default:null, description:"Operations on setting. If not set, it is just a computed value."}),
getter: t.Union([t.String(),t.Null()], {default:null, description:"Information on how to extract value from object."}),
//`serialize` not needed as it is already implemented for each supported type.
parse: t.Union([t.String(), t.Null()], { default: null, description: "From string to object. Default based on `type` (and `subtype`)" }),
//`serialize` would be the dual of parse, but it is not needed as types are all defined and serialization methods will not be custom.
setter: t.Union([t.String(), t.Null()], { default: null, description: "Operations on setting. If not set, this field is only available as a computed value." }),
getter: t.Union([t.String(), t.Null()], { default: null, description: "Implementation on how to extract value from object. If not set the field is not observable." }),
description: t.Optional(t.String()),
semantic: t.Optional(t.Boolean({default:false, description:'If true this field has a strong semantic meaning. Used for semantic serialization of a document.'})),
alias: t.Optional(t.Array(t.String(), { description: "alias names" , default:[]}))
semantic: t.Optional(t.Boolean({ default: false, description: 'If true, this field has a strong semantic meaning. Used for semantic serialization of a document.' })),
alias: t.Optional(t.Array(t.String(), { description: "alias names", default: [] }))
}))

export const widget_schema = t.Object({
$schema: t.Optional(t.String()),
ns: t.Optional(t.String()),
ns: t.Optional(t.String({ description: "Namespace for this component, for example `fl` in case of fltk wrappers." })),
name: t.Optional(t.String()),
exposed: t.Optional(t.Boolean({default:true})),
description: t.Optional(t.String()),
use_main_header: t.Union([t.Null(), t.String()], { default: null }),
headers: t.Optional(t.Array(t.String())),
type: t.Union([t.Literal('leaf'), t.Literal('node'), t.Literal('container'), t.Literal('slot'), t.Literal('slot-contaiener')]),
exposed: t.Optional(t.Boolean({ default: true, description: "If true, this widget will be usable from XML and shown in the documentation, otherwise it is not exported." })),
description: t.Optional(t.String({ description: "While optional, this field is extremely important for exposed widgets" })),
use_main_header: t.Union([t.Null(), t.String()], { default: null, description: "If set, no class definition will be generated. It will instread load one already present. Used to track and document widgets which are not fully autogenerated." }),
headers: t.Optional(t.Array(t.String(), { description: "List of header files used by the widget in its public header file." })),
private_headers: t.Optional(t.Array(t.String(), { description: "List of header files used by the widget in its generated cpp file." })),
type: t.Union([t.Literal('leaf'), t.Literal('node'), t.Literal('container'), t.Literal('slot'), t.Literal('slot-contaiener')], { description: "Type of frame an instance of this widget class will default top." }),
codegen: t.Object({
extends: t.Union([t.Null(), t.String()], { default: null }),
props_tail: t.Optional(t.Union([t.Null(), t.String()])),
computed_tail: t.Optional(t.Union([t.Null(), t.String()])),
extends: t.Union([t.Null(), t.String()], { default: null, description: "If set, a class to inherit from, usually related to the fltk widget." }),
set_tail: t.Optional(t.Union([t.Null(), t.String()], { description: "If specified, what to do if a getter is not matched." })),
get_tail: t.Optional(t.Union([t.Null(), t.String()], { description: "If specified, what to do if a setter is not matched." })),
}, { additionalProperties: false }),
extends: t.Union([t.Null(), t.String()], { default: null }),
skip_fields: t.Optional(t.Array(t.String(),{default:[],description:"Properties to be matched but ignored"})),
extends: t.Union([t.Null(), t.String()], { default: null, description: "If set, a vs widget to inherit from (not a c++ class name)" }),
skip_fields: t.Optional(t.Array(t.String(), { default: [], description: "Properties to be matched when set, but ignored." })),
fields: entries_schema,
}, { additionalProperties: false })

0 comments on commit 763ec86

Please sign in to comment.