|
2 | 2 | > These specs are not part of `vs.templ`. |
3 | 3 | > They are just temporarily hosted here to decide what to do about that. |
4 | 4 |
|
| 5 | +## What is this |
| 6 | +These are specifications for an agnostic component model based on XML. |
| 7 | +It allows packaging code as single file components, and reuse it inside others. |
| 8 | + |
5 | 9 | ## Tags and attributes |
6 | 10 |
|
7 | 11 | ### `ns:component` |
8 | | -Root for components |
9 | | -Any attribute is considered as default value for when it is later injected. |
| 12 | +Root for any component. |
| 13 | +Further attributes will be assumed as default values for when they are later injected. |
10 | 14 |
|
11 | 15 | ### `ns:section` |
12 | | -- [ ] `type` |
| 16 | +A section inside the component, to logically split its content and let the downstream application handle it on its own. |
| 17 | +- [ ] `type` a marker, usually in the form `logic-function/format`. Used as metadata downstream. |
| 18 | +Any other argument will also be handled downstream. |
13 | 19 |
|
14 | 20 | ### `ns:import` |
15 | | -- [ ] `src` |
16 | | -- [ ] `as` (optional) |
| 21 | +- [ ] `src` a path-like to the object to import, handled externally |
| 22 | +- [ ] `as` (optional) a name to use the resource, if not provided downstream will assign one based on path |
| 23 | +Any other attribute is accepted, and will be package as part of the import request. |
| 24 | + |
| 25 | +Body content is used as alternative if loading fails. |
17 | 26 |
|
18 | | -Body is the alternative if loading fails. |
| 27 | +### `ns:include` |
| 28 | +- [ ] `src` a path-like to the object to import, handled externally |
| 29 | +In-place substitution of content. Used to introduce global things in the component scope. |
| 30 | + |
| 31 | +Body content is used as alternative if loading fails. |
19 | 32 |
|
20 | 33 | ### `ns:use` |
21 | 34 | - [ ] `s:src` either path or local resolution with prefix `#` |
| 35 | +Any other attribute is passed on. |
| 36 | +Body contains slots, some of which have special features, allowing for error handling for example. |
| 37 | + |
| 38 | +### `ns-x:*` namespace |
| 39 | +Elements in this namespace are shorthands for the `use` command. |
22 | 40 |
|
23 | 41 | ### `ns:slot` |
24 | 42 | - [ ] `s:name` identifier for the slot. If empty it is the default one. Special name `error` in case of component failure. |
| 43 | +Any further argument is applied to the injection location. |
| 44 | + |
| 45 | +Its body is also for injection. |
25 | 46 |
|
26 | 47 | ### `ns:inject` as element |
27 | 48 | - [ ] `src` |
28 | | -Body is default in case the injection fails |
| 49 | +Body is default for cases in which the injection fails. |
29 | 50 |
|
30 | | -### `ns:inject.xxx` and `ns:inject-default.xxx` as props |
| 51 | +### `ns:inject.src.xxx` and `ns:inject.defval.xxx` as props |
| 52 | +Like their element counterpart, with the restriction of being simple strings as they operate on attributes. |
31 | 53 |
|
32 | 54 | ### `ns:scope` |
33 | | -It just forces a new scope in which imports can hide what came before. |
| 55 | +It just forces a new scope in which imports and mixins can hide what came before. |
34 | 56 | Totally optional, each component imposes its own scope, and the parent one is not being inherited. |
35 | 57 |
|
36 | 58 | ### `ns:throw` |
| 59 | +To close the process early. At times an error is so bad that it is not possible to continue. |
37 | 60 |
|
38 | 61 | ### `ns:debug` |
39 | | -Like for `vs.templ`. |
| 62 | +Like for `vs.fltk`. |
| 63 | +- [ ] `type` enum with values from `warning`, `info`, `panic`, `ok`, `error`, `log` with `log` being default. |
| 64 | +- [ ] `msg` as a string |
40 | 65 |
|
41 | | -### `ns-x:*` namespace |
42 | | -It references any imported component which appeared before. |
| 66 | +### `ns:mixin` |
| 67 | +- [ ] `ns:rule` |
| 68 | +All the other attributes are part of the mixin definition. |
| 69 | + |
| 70 | +### `ns:mixins` attribute |
| 71 | +To apply a list of mixins to the current element, beyond those which are implicitly applied. |
| 72 | +Mixins are **always** evaluated and replaced in place. They don't pass barriers between components. |
43 | 73 |
|
44 | 74 | ## Examples |
45 | 75 |
|
|
0 commit comments