@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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +82 -0
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.js +7073 -0
  5. package/dist/lib/action-runtime.d.ts +78 -0
  6. package/dist/lib/default-styles.d.ts +2 -0
  7. package/dist/lib/dom-state.d.ts +45 -0
  8. package/dist/lib/layout.d.ts +11 -0
  9. package/dist/lib/logging.d.ts +1 -0
  10. package/dist/lib/network.d.ts +29 -0
  11. package/dist/lib/references.d.ts +25 -0
  12. package/dist/lib/render.d.ts +3 -0
  13. package/dist/lib/resource-manager.d.ts +25 -0
  14. package/dist/lib/types.d.ts +144 -0
  15. package/dist/lib/widgets/adaptive-layout.d.ts +10 -0
  16. package/dist/lib/widgets/bindings.d.ts +33 -0
  17. package/dist/lib/widgets/button.d.ts +11 -0
  18. package/dist/lib/widgets/checkbox.d.ts +11 -0
  19. package/dist/lib/widgets/combobox.d.ts +9 -0
  20. package/dist/lib/widgets/conditional-container.d.ts +21 -0
  21. package/dist/lib/widgets/container-layout.d.ts +39 -0
  22. package/dist/lib/widgets/context-menu.d.ts +14 -0
  23. package/dist/lib/widgets/context.d.ts +58 -0
  24. package/dist/lib/widgets/delegation.d.ts +30 -0
  25. package/dist/lib/widgets/edit.d.ts +12 -0
  26. package/dist/lib/widgets/grid-view.d.ts +9 -0
  27. package/dist/lib/widgets/image.d.ts +7 -0
  28. package/dist/lib/widgets/link.d.ts +10 -0
  29. package/dist/lib/widgets/list.d.ts +9 -0
  30. package/dist/lib/widgets/listbox.d.ts +9 -0
  31. package/dist/lib/widgets/md-text.d.ts +9 -0
  32. package/dist/lib/widgets/modal-window.d.ts +15 -0
  33. package/dist/lib/widgets/overlay-container.d.ts +11 -0
  34. package/dist/lib/widgets/panel.d.ts +9 -0
  35. package/dist/lib/widgets/radio-group.d.ts +9 -0
  36. package/dist/lib/widgets/splitter.d.ts +6 -0
  37. package/dist/lib/widgets/spoiler.d.ts +9 -0
  38. package/dist/lib/widgets/static-text.d.ts +10 -0
  39. package/dist/lib/widgets/tabs.d.ts +10 -0
  40. package/dist/lib/widgets/textarea.d.ts +10 -0
  41. package/dist/lib/widgets/ui-reference.d.ts +9 -0
  42. package/package.json +61 -0
  43. package/vjt-styles.css +756 -0
@@ -0,0 +1,10 @@
1
+ import type { ActionDefinition, BaseNode } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type LinkNode = BaseNode & {
4
+ widget: 'link';
5
+ text?: string;
6
+ type?: 'text' | 'button' | 'link';
7
+ url?: string;
8
+ actions?: ActionDefinition[];
9
+ };
10
+ export declare const renderLink: WidgetRenderer<LinkNode>;
@@ -0,0 +1,9 @@
1
+ import type { BaseNode, DescriptionNode } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type ListNode = BaseNode & {
4
+ widget: 'list';
5
+ orientation?: 'vertical' | 'horizontal';
6
+ size?: number;
7
+ elements?: DescriptionNode[];
8
+ };
9
+ export declare const renderList: WidgetRenderer<ListNode>;
@@ -0,0 +1,9 @@
1
+ import type { BaseNode } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type ListboxNode = BaseNode & {
4
+ widget: 'listbox';
5
+ size?: number;
6
+ selected?: number | string;
7
+ elements?: Array<Record<string, unknown>>;
8
+ };
9
+ export declare const renderListbox: WidgetRenderer<ListboxNode>;
@@ -0,0 +1,9 @@
1
+ import type { BaseNode, TextAlign, VerticalAlign } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type MdTextNode = BaseNode & {
4
+ widget: 'md-text';
5
+ text?: string;
6
+ 'horiz-align'?: TextAlign;
7
+ 'vert-align'?: VerticalAlign;
8
+ };
9
+ export declare const renderMdText: WidgetRenderer<MdTextNode>;
@@ -0,0 +1,15 @@
1
+ import type { ActionDefinition, BaseNode, DescriptionNode } from '../types.js';
2
+ import type { WidgetRenderEnvironment } from './context.js';
3
+ export type ModalWindowNode = BaseNode & {
4
+ widget: 'modal-window';
5
+ resetOnClose?: boolean | string;
6
+ width?: number | string;
7
+ height?: number | string;
8
+ child?: DescriptionNode;
9
+ bottomButtons?: Array<{
10
+ text?: string;
11
+ color?: 'bright' | 'regular';
12
+ actions?: ActionDefinition[];
13
+ }>;
14
+ };
15
+ export declare function renderModalOverlay(env: WidgetRenderEnvironment, modalId: string): string;
@@ -0,0 +1,11 @@
1
+ import type { BaseNode, DescriptionNode } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type OverlayLayer = {
4
+ transparency?: number | string;
5
+ child?: DescriptionNode;
6
+ };
7
+ export type OverlayContainerNode = BaseNode & {
8
+ widget: 'overlay-container';
9
+ layers?: OverlayLayer[];
10
+ };
11
+ export declare const renderOverlayContainer: WidgetRenderer<OverlayContainerNode>;
@@ -0,0 +1,9 @@
1
+ import type { BaseNode, DescriptionNode } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type PanelNode = BaseNode & {
4
+ widget: 'panel';
5
+ maySwellHorizontally?: boolean | string;
6
+ maySwellVertically?: boolean | string;
7
+ child?: DescriptionNode;
8
+ };
9
+ export declare const renderPanel: WidgetRenderer<PanelNode>;
@@ -0,0 +1,9 @@
1
+ import type { BaseNode } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type RadioGroupNode = BaseNode & {
4
+ widget: 'radio-group';
5
+ borderVisible?: boolean | string;
6
+ selected?: number | string;
7
+ group?: string[];
8
+ };
9
+ export declare const renderRadioGroup: WidgetRenderer<RadioGroupNode>;
@@ -0,0 +1,6 @@
1
+ import type { BaseNode } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type SplitterNode = BaseNode & {
4
+ widget: 'splitter';
5
+ };
6
+ export declare const renderSplitter: WidgetRenderer<SplitterNode>;
@@ -0,0 +1,9 @@
1
+ import type { BaseNode, DescriptionNode } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type SpoilerNode = BaseNode & {
4
+ widget: 'spoiler';
5
+ caption?: string;
6
+ content?: DescriptionNode | string;
7
+ isHidden?: boolean | string;
8
+ };
9
+ export declare const renderSpoiler: WidgetRenderer<SpoilerNode>;
@@ -0,0 +1,10 @@
1
+ import type { BaseNode, HeadingTag, TextAlign, VerticalAlign } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type StaticTextNode = BaseNode & {
4
+ widget: 'static-text';
5
+ text?: string;
6
+ heading?: HeadingTag;
7
+ 'horiz-align'?: TextAlign;
8
+ 'vert-align'?: VerticalAlign;
9
+ };
10
+ export declare const renderStaticText: WidgetRenderer<StaticTextNode>;
@@ -0,0 +1,10 @@
1
+ import type { BaseNode, DescriptionNode } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type TabsNode = BaseNode & {
4
+ widget: 'tabs';
5
+ tabs?: Array<{
6
+ name: string;
7
+ content?: DescriptionNode;
8
+ }>;
9
+ };
10
+ export declare const renderTabs: WidgetRenderer<TabsNode>;
@@ -0,0 +1,10 @@
1
+ import type { BaseNode } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type TextareaNode = BaseNode & {
4
+ widget: 'textarea';
5
+ text?: string;
6
+ placeholder?: string;
7
+ enabled?: boolean | string;
8
+ editable?: boolean | string;
9
+ };
10
+ export declare const renderTextarea: WidgetRenderer<TextareaNode>;
@@ -0,0 +1,9 @@
1
+ import type { BaseNode } from '../types.js';
2
+ import type { WidgetRenderer } from './context.js';
3
+ export type UiReferenceNode = BaseNode & {
4
+ widget: 'ui-reference';
5
+ ref: string;
6
+ maySwellHorizontally?: boolean | string;
7
+ maySwellVertically?: boolean | string;
8
+ };
9
+ export declare const renderUiReference: WidgetRenderer<UiReferenceNode>;
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@vortexm/vjt",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ },
12
+ "./styles.css": "./vjt-styles.css"
13
+ },
14
+ "files": [
15
+ "dist/index.js",
16
+ "dist/index.d.ts",
17
+ "dist/lib",
18
+ "vjt-styles.css",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "sideEffects": [
23
+ "./vjt-styles.css"
24
+ ],
25
+ "scripts": {
26
+ "build": "npm run build:lib && npm run build:examples && npm run build:types",
27
+ "build:lib": "esbuild src/index.ts --bundle --format=esm --outfile=dist/index.js --loader:.json=json",
28
+ "build:examples": "esbuild src/examples.ts --bundle --format=esm --outfile=dist/examples.js --loader:.json=json",
29
+ "build:types": "tsc -p tsconfig.build.json",
30
+ "watch": "esbuild src/index.ts src/examples.ts --bundle --format=esm --outdir=dist --loader:.json=json --watch",
31
+ "typecheck": "tsc -p tsconfig.json",
32
+ "lint": "eslint \"src/**/*.ts\"",
33
+ "serve": "http-server . -c-1 -p 4173",
34
+ "serve:mock-backend": "node ./mock-backend/server.mjs",
35
+ "dev": "concurrently \"npm:watch\" \"npm:serve\" \"npm:serve:mock-backend\"",
36
+ "prepack": "npm run build"
37
+ },
38
+ "author": "vortexm",
39
+ "license": "MIT",
40
+ "description": "Declarative JSON-driven UI renderer for browser web apps",
41
+ "keywords": [
42
+ "json",
43
+ "ui",
44
+ "renderer",
45
+ "declarative",
46
+ "browser",
47
+ "html"
48
+ ],
49
+ "devDependencies": {
50
+ "@eslint/js": "^9.25.1",
51
+ "concurrently": "^9.1.2",
52
+ "esbuild": "^0.25.3",
53
+ "eslint": "^9.25.1",
54
+ "http-server": "^14.1.1",
55
+ "typescript": "^5.8.3",
56
+ "typescript-eslint": "^8.30.1"
57
+ },
58
+ "dependencies": {
59
+ "showdown": "^2.1.0"
60
+ }
61
+ }