@vortexm/vjt 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +7073 -0
- package/dist/lib/action-runtime.d.ts +78 -0
- package/dist/lib/default-styles.d.ts +2 -0
- package/dist/lib/dom-state.d.ts +45 -0
- package/dist/lib/layout.d.ts +11 -0
- package/dist/lib/logging.d.ts +1 -0
- package/dist/lib/network.d.ts +29 -0
- package/dist/lib/references.d.ts +25 -0
- package/dist/lib/render.d.ts +3 -0
- package/dist/lib/resource-manager.d.ts +25 -0
- package/dist/lib/types.d.ts +144 -0
- package/dist/lib/widgets/adaptive-layout.d.ts +10 -0
- package/dist/lib/widgets/bindings.d.ts +33 -0
- package/dist/lib/widgets/button.d.ts +11 -0
- package/dist/lib/widgets/checkbox.d.ts +11 -0
- package/dist/lib/widgets/combobox.d.ts +9 -0
- package/dist/lib/widgets/conditional-container.d.ts +21 -0
- package/dist/lib/widgets/container-layout.d.ts +39 -0
- package/dist/lib/widgets/context-menu.d.ts +14 -0
- package/dist/lib/widgets/context.d.ts +58 -0
- package/dist/lib/widgets/delegation.d.ts +30 -0
- package/dist/lib/widgets/edit.d.ts +12 -0
- package/dist/lib/widgets/grid-view.d.ts +9 -0
- package/dist/lib/widgets/image.d.ts +7 -0
- package/dist/lib/widgets/link.d.ts +10 -0
- package/dist/lib/widgets/list.d.ts +9 -0
- package/dist/lib/widgets/listbox.d.ts +9 -0
- package/dist/lib/widgets/md-text.d.ts +9 -0
- package/dist/lib/widgets/modal-window.d.ts +15 -0
- package/dist/lib/widgets/overlay-container.d.ts +11 -0
- package/dist/lib/widgets/panel.d.ts +9 -0
- package/dist/lib/widgets/radio-group.d.ts +9 -0
- package/dist/lib/widgets/splitter.d.ts +6 -0
- package/dist/lib/widgets/spoiler.d.ts +9 -0
- package/dist/lib/widgets/static-text.d.ts +10 -0
- package/dist/lib/widgets/tabs.d.ts +10 -0
- package/dist/lib/widgets/textarea.d.ts +10 -0
- package/dist/lib/widgets/ui-reference.d.ts +9 -0
- package/package.json +61 -0
- package/vjt-styles.css +756 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# vjt
|
|
2
|
+
|
|
3
|
+
Declarative JSON-driven UI renderer for browser web apps.
|
|
4
|
+
|
|
5
|
+
`vjt` turns JSON widget descriptions into interactive HTML, with built-in support for:
|
|
6
|
+
|
|
7
|
+
- layout containers, adaptive layouts, tabs, spoilers, overlays
|
|
8
|
+
- controls such as edit fields, buttons, links, lists, grids, checkboxes, radio groups, markdown text
|
|
9
|
+
- actions, references, requests, SSE, cookies
|
|
10
|
+
- i18n and light/dark theme styles
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install vjt showdown
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`showdown` is a runtime dependency used by `md-text`.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { renderApp, ResourceManager } from 'vjt';
|
|
24
|
+
import 'vjt/styles.css';
|
|
25
|
+
|
|
26
|
+
const resources = new ResourceManager({
|
|
27
|
+
ui: {
|
|
28
|
+
main: {
|
|
29
|
+
widget: 'container-layout',
|
|
30
|
+
type: 'vertical',
|
|
31
|
+
children: [
|
|
32
|
+
{
|
|
33
|
+
child: {
|
|
34
|
+
widget: 'static-text',
|
|
35
|
+
heading: 'h2',
|
|
36
|
+
text: 'Hello'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
child: {
|
|
41
|
+
widget: 'button',
|
|
42
|
+
text: 'Click me'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const root = document.querySelector('#app');
|
|
51
|
+
if (!(root instanceof HTMLElement)) {
|
|
52
|
+
throw new Error('App requires #app root element');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
renderApp(root, resources.getUi('main')!, {
|
|
56
|
+
resourceManager: resources,
|
|
57
|
+
language: 'en',
|
|
58
|
+
theme: 'dark'
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## API
|
|
63
|
+
|
|
64
|
+
- `renderApp(root, description, options)` mounts an interactive app into a DOM element
|
|
65
|
+
- `renderJson(description, options)` renders markup without mounting
|
|
66
|
+
- `ResourceManager` stores UI resources, actions, requests, SSE configs, i18n, and custom styles
|
|
67
|
+
- `DEFAULT_STYLE_MAP` contains the library predefined styles
|
|
68
|
+
|
|
69
|
+
## CSS
|
|
70
|
+
|
|
71
|
+
Include the bundled stylesheet:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import 'vjt/styles.css';
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
or load `vjt-styles.css` manually in the page.
|
|
78
|
+
|
|
79
|
+
## Notes
|
|
80
|
+
|
|
81
|
+
- This package is browser-oriented and expects DOM APIs.
|
|
82
|
+
- Example apps and mock backend are part of the repository, but are not part of the published npm package surface.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { renderApp, renderJson } from './lib/render.js';
|
|
2
|
+
export { ResourceManager } from './lib/resource-manager.js';
|
|
3
|
+
export { DEFAULT_STYLE_MAP } from './lib/default-styles.js';
|
|
4
|
+
export type { ActionDefinition, ActionMap, AdaptiveLayoutNode, BaseNode, ButtonNode, CheckboxNode, ComboboxNode, ConditionExpression, ConditionalContainerNode, ContextMenuNode, ContainerCell, ContainerLayoutNode, CellConstraints, DescriptionNode, GridViewNode, HeadingTag, I18nMap, ImageNode, LayoutType, LinkNode, ListElementContext, ListNode, ListboxNode, MdTextNode, ModalWindowNode, MountJsonOptions, OverlayContainerNode, OverlayLayer, PanelNode, PrimitiveRequestType, RadioGroupNode, RequestDefinition, RequestMap, RequestSchema, RenderJsonOptions, RuntimeSnapshot, SseConfig, SseConfigInput, SseEventDefinition, SpoilerNode, SplitterNode, StaticTextNode, StyleMap, TabsNode, TextAlign, TextareaNode, UiReferenceNode, Theme, VerticalAlign, WidgetEventName, WidgetState } from './lib/types.js';
|