@meistrari/chat-ui-lang 0.3.0 → 0.4.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 (122) hide show
  1. package/README.md +105 -13
  2. package/dist/actions.d.ts +9 -0
  3. package/dist/answers.d.ts +16 -0
  4. package/dist/components/actions.d.ts +47 -0
  5. package/dist/components/chart.d.ts +23 -0
  6. package/dist/components/chat.d.ts +55 -0
  7. package/dist/components/data.d.ts +31 -0
  8. package/dist/components/form.d.ts +42 -0
  9. package/dist/components/layout.d.ts +1179 -0
  10. package/dist/components/text.d.ts +14 -0
  11. package/dist/define.d.ts +8 -0
  12. package/dist/index.d.ts +25 -0
  13. package/dist/index.js +935 -0
  14. package/dist/library.d.ts +6 -0
  15. package/dist/nuxt/module.d.mts +9 -0
  16. package/dist/nuxt/module.json +9 -0
  17. package/dist/nuxt/module.mjs +31 -0
  18. package/dist/nuxt/runtime/actions.d.ts +15 -0
  19. package/dist/nuxt/runtime/actions.js +40 -0
  20. package/dist/nuxt/runtime/components/openui-widget.d.vue.ts +21 -0
  21. package/dist/nuxt/runtime/components/openui-widget.vue +72 -0
  22. package/dist/nuxt/runtime/components/openui-widget.vue.d.ts +21 -0
  23. package/dist/nuxt/runtime/components/plain-prose.d.vue.ts +7 -0
  24. package/dist/nuxt/runtime/components/plain-prose.vue +12 -0
  25. package/dist/nuxt/runtime/components/plain-prose.vue.d.ts +7 -0
  26. package/dist/nuxt/runtime/components/widgets/bar-chart.d.vue.ts +10 -0
  27. package/dist/nuxt/runtime/components/widgets/bar-chart.vue +39 -0
  28. package/dist/nuxt/runtime/components/widgets/bar-chart.vue.d.ts +10 -0
  29. package/dist/nuxt/runtime/components/widgets/bar.d.vue.ts +10 -0
  30. package/dist/nuxt/runtime/components/widgets/bar.vue +12 -0
  31. package/dist/nuxt/runtime/components/widgets/bar.vue.d.ts +10 -0
  32. package/dist/nuxt/runtime/components/widgets/button.d.vue.ts +11 -0
  33. package/dist/nuxt/runtime/components/widgets/button.vue +30 -0
  34. package/dist/nuxt/runtime/components/widgets/button.vue.d.ts +11 -0
  35. package/dist/nuxt/runtime/components/widgets/buttons.d.vue.ts +8 -0
  36. package/dist/nuxt/runtime/components/widgets/buttons.vue +14 -0
  37. package/dist/nuxt/runtime/components/widgets/buttons.vue.d.ts +8 -0
  38. package/dist/nuxt/runtime/components/widgets/callout.d.vue.ts +11 -0
  39. package/dist/nuxt/runtime/components/widgets/callout.vue +27 -0
  40. package/dist/nuxt/runtime/components/widgets/callout.vue.d.ts +11 -0
  41. package/dist/nuxt/runtime/components/widgets/card.d.vue.ts +9 -0
  42. package/dist/nuxt/runtime/components/widgets/card.vue +19 -0
  43. package/dist/nuxt/runtime/components/widgets/card.vue.d.ts +9 -0
  44. package/dist/nuxt/runtime/components/widgets/checkbox.d.vue.ts +9 -0
  45. package/dist/nuxt/runtime/components/widgets/checkbox.vue +26 -0
  46. package/dist/nuxt/runtime/components/widgets/checkbox.vue.d.ts +9 -0
  47. package/dist/nuxt/runtime/components/widgets/citation.d.vue.ts +9 -0
  48. package/dist/nuxt/runtime/components/widgets/citation.vue +9 -0
  49. package/dist/nuxt/runtime/components/widgets/citation.vue.d.ts +9 -0
  50. package/dist/nuxt/runtime/components/widgets/col.d.vue.ts +10 -0
  51. package/dist/nuxt/runtime/components/widgets/col.vue +16 -0
  52. package/dist/nuxt/runtime/components/widgets/col.vue.d.ts +10 -0
  53. package/dist/nuxt/runtime/components/widgets/file-card.d.vue.ts +9 -0
  54. package/dist/nuxt/runtime/components/widgets/file-card.vue +9 -0
  55. package/dist/nuxt/runtime/components/widgets/file-card.vue.d.ts +9 -0
  56. package/dist/nuxt/runtime/components/widgets/form.d.vue.ts +10 -0
  57. package/dist/nuxt/runtime/components/widgets/form.vue +60 -0
  58. package/dist/nuxt/runtime/components/widgets/form.vue.d.ts +10 -0
  59. package/dist/nuxt/runtime/components/widgets/image.d.vue.ts +10 -0
  60. package/dist/nuxt/runtime/components/widgets/image.vue +34 -0
  61. package/dist/nuxt/runtime/components/widgets/image.vue.d.ts +10 -0
  62. package/dist/nuxt/runtime/components/widgets/input.d.vue.ts +10 -0
  63. package/dist/nuxt/runtime/components/widgets/input.vue +23 -0
  64. package/dist/nuxt/runtime/components/widgets/input.vue.d.ts +10 -0
  65. package/dist/nuxt/runtime/components/widgets/markdown.d.vue.ts +9 -0
  66. package/dist/nuxt/runtime/components/widgets/markdown.vue +14 -0
  67. package/dist/nuxt/runtime/components/widgets/markdown.vue.d.ts +9 -0
  68. package/dist/nuxt/runtime/components/widgets/metric.d.vue.ts +11 -0
  69. package/dist/nuxt/runtime/components/widgets/metric.vue +20 -0
  70. package/dist/nuxt/runtime/components/widgets/metric.vue.d.ts +11 -0
  71. package/dist/nuxt/runtime/components/widgets/option.d.vue.ts +10 -0
  72. package/dist/nuxt/runtime/components/widgets/option.vue +12 -0
  73. package/dist/nuxt/runtime/components/widgets/option.vue.d.ts +10 -0
  74. package/dist/nuxt/runtime/components/widgets/question.d.vue.ts +11 -0
  75. package/dist/nuxt/runtime/components/widgets/question.vue +15 -0
  76. package/dist/nuxt/runtime/components/widgets/question.vue.d.ts +11 -0
  77. package/dist/nuxt/runtime/components/widgets/questions.d.vue.ts +9 -0
  78. package/dist/nuxt/runtime/components/widgets/questions.vue +91 -0
  79. package/dist/nuxt/runtime/components/widgets/questions.vue.d.ts +9 -0
  80. package/dist/nuxt/runtime/components/widgets/select.d.vue.ts +10 -0
  81. package/dist/nuxt/runtime/components/widgets/select.vue +27 -0
  82. package/dist/nuxt/runtime/components/widgets/select.vue.d.ts +10 -0
  83. package/dist/nuxt/runtime/components/widgets/stack.d.vue.ts +9 -0
  84. package/dist/nuxt/runtime/components/widgets/stack.vue +18 -0
  85. package/dist/nuxt/runtime/components/widgets/stack.vue.d.ts +9 -0
  86. package/dist/nuxt/runtime/components/widgets/table.d.vue.ts +9 -0
  87. package/dist/nuxt/runtime/components/widgets/table.vue +41 -0
  88. package/dist/nuxt/runtime/components/widgets/table.vue.d.ts +9 -0
  89. package/dist/nuxt/runtime/context.d.ts +30 -0
  90. package/dist/nuxt/runtime/context.js +4 -0
  91. package/dist/nuxt/runtime/form-fields.d.ts +10 -0
  92. package/dist/nuxt/runtime/form-fields.js +30 -0
  93. package/dist/nuxt/runtime/program.d.ts +15 -0
  94. package/dist/nuxt/runtime/program.js +74 -0
  95. package/dist/nuxt/runtime/registry.d.ts +4 -0
  96. package/dist/nuxt/runtime/registry.js +44 -0
  97. package/dist/nuxt/runtime/render.d.ts +21 -0
  98. package/dist/nuxt/runtime/render.js +48 -0
  99. package/dist/nuxt/runtime/use-openui-context.d.ts +2 -0
  100. package/dist/nuxt/runtime/use-openui-context.js +8 -0
  101. package/dist/nuxt/types.d.mts +9 -0
  102. package/dist/profiles.d.ts +10 -0
  103. package/dist/prompt.d.ts +5 -0
  104. package/dist/safe-url.d.ts +2 -0
  105. package/dist/segments.d.ts +16 -0
  106. package/dist/slack.d.ts +28 -0
  107. package/dist/version.d.ts +2 -0
  108. package/dist/widget-context.d.ts +13 -0
  109. package/package.json +72 -31
  110. package/src/actions.ts +0 -12
  111. package/src/components/actions.ts +0 -21
  112. package/src/components/chart.ts +0 -22
  113. package/src/components/chat.ts +0 -60
  114. package/src/components/data.ts +0 -32
  115. package/src/components/form.ts +0 -41
  116. package/src/components/layout.ts +0 -30
  117. package/src/components/text.ts +0 -20
  118. package/src/define.ts +0 -9
  119. package/src/index.ts +0 -14
  120. package/src/library.ts +0 -64
  121. package/src/prompt.ts +0 -54
  122. package/src/version.ts +0 -2
@@ -0,0 +1,6 @@
1
+ import { components } from './components/layout';
2
+ export declare const library: Required<import("@openuidev/lang-core").Library<null, import("@openuidev/lang-core").DefinedAction<import("zod").ZodObject<{
3
+ text: import("zod").ZodString;
4
+ }, import("zod/v4/core").$strip>, "CopyText">>>;
5
+ export type UiLibrary = typeof library;
6
+ export declare const componentNames: Array<keyof typeof components>;
@@ -0,0 +1,9 @@
1
+ import * as nuxt_schema from 'nuxt/schema';
2
+ import { Nuxt } from 'nuxt/schema';
3
+ export { OpenuiHost } from '../../dist/nuxt/runtime/context.js';
4
+
5
+ /** Registers <OpenuiWidget> and the auto-import transform its runtime needs; chat-nuxt calls it from its own setup. */
6
+ declare function registerOpenuiWidget(nuxt: Nuxt): void;
7
+ declare const _default: nuxt_schema.NuxtModule<nuxt_schema.ModuleOptions, nuxt_schema.ModuleOptions, false>;
8
+
9
+ export { _default as default, registerOpenuiWidget };
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@meistrari/chat-ui-lang/nuxt",
3
+ "configKey": "@meistrari/chat-ui-lang/nuxt",
4
+ "version": "0.4.0-rc.0",
5
+ "builder": {
6
+ "@nuxt/module-builder": "1.0.2",
7
+ "unbuild": "unknown"
8
+ }
9
+ }
@@ -0,0 +1,31 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { defineNuxtModule, createResolver, addComponent } from 'nuxt/kit';
3
+
4
+ function registerOpenuiWidget(nuxt) {
5
+ const resolver = createResolver(import.meta.url);
6
+ const builtRuntimeDir = resolver.resolve("./runtime");
7
+ const sourceRuntimeDir = resolver.resolve("../../src/nuxt/runtime");
8
+ const runtimeDir = nuxt.options.dev && existsSync(sourceRuntimeDir) ? sourceRuntimeDir : builtRuntimeDir;
9
+ const importsOptions = nuxt.options.imports;
10
+ if (importsOptions !== false) {
11
+ const normalizedImports = importsOptions || {};
12
+ nuxt.options.imports = normalizedImports;
13
+ normalizedImports.transform = normalizedImports.transform || {};
14
+ normalizedImports.transform.include = normalizedImports.transform.include || [];
15
+ normalizedImports.transform.include.push(new RegExp(runtimeDir.replace(/\\/g, "/").replace(/[.*+?^${}()|[\]\\]/g, "\\$&")));
16
+ }
17
+ addComponent({
18
+ name: "OpenuiWidget",
19
+ filePath: `${runtimeDir}/components/openui-widget.vue`
20
+ });
21
+ }
22
+ const module$1 = defineNuxtModule({
23
+ meta: {
24
+ name: "@meistrari/chat-ui-lang/nuxt"
25
+ },
26
+ setup(_options, nuxt) {
27
+ registerOpenuiWidget(nuxt);
28
+ }
29
+ });
30
+
31
+ export { module$1 as default, registerOpenuiWidget };
@@ -0,0 +1,15 @@
1
+ import type { ActionPlan, Store } from '@openuidev/lang-core';
2
+ export type OpenuiActionHandlers = {
3
+ send: (message: string, context?: unknown) => Promise<boolean>;
4
+ openUrl: (url: string) => void;
5
+ custom: (name: string, params: Record<string, unknown>) => Promise<boolean>;
6
+ store: Store;
7
+ stateDefaults: Record<string, unknown>;
8
+ };
9
+ /**
10
+ * Executes an action plan step by step and stops at the first rejected send,
11
+ * so later state changes never outrun what the user actually did. A plain
12
+ * label without a plan behaves like `@ToAssistant(label)`, as the prompt says.
13
+ */
14
+ export declare function runActionPlan(label: string, plan: ActionPlan | undefined, handlers: OpenuiActionHandlers): Promise<boolean>;
15
+ export declare function copyWidgetText(text: string, writeText: (text: string) => Promise<void>): Promise<boolean>;
@@ -0,0 +1,40 @@
1
+ import { ACTION_STEPS, evaluate } from "@openuidev/lang-core";
2
+ export async function runActionPlan(label, plan, handlers) {
3
+ const steps = plan?.steps ?? [];
4
+ if (steps.length === 0)
5
+ return handlers.send(label);
6
+ for (const step of steps) {
7
+ switch (step.type) {
8
+ case ACTION_STEPS.ToAssistant:
9
+ if (!await handlers.send(step.message, step.context))
10
+ return false;
11
+ break;
12
+ case ACTION_STEPS.OpenUrl:
13
+ handlers.openUrl(step.url);
14
+ break;
15
+ case ACTION_STEPS.Set:
16
+ handlers.store.set(step.target, step.valueAST ? evaluate(step.valueAST, { getState: (name) => handlers.store.get(name), resolveRef: () => null }) : null);
17
+ break;
18
+ case ACTION_STEPS.Reset:
19
+ for (const target of step.targets)
20
+ handlers.store.set(target, handlers.stateDefaults[target] ?? null);
21
+ break;
22
+ case "custom_action":
23
+ if (!await handlers.custom(step.name, step.params))
24
+ return false;
25
+ break;
26
+ default:
27
+ break;
28
+ }
29
+ }
30
+ return true;
31
+ }
32
+ export async function copyWidgetText(text, writeText) {
33
+ try {
34
+ await writeText(text);
35
+ return true;
36
+ } catch (error) {
37
+ console.warn("[openui] widget copy failed", { error: error instanceof Error ? error.message : String(error) });
38
+ return false;
39
+ }
40
+ }
@@ -0,0 +1,21 @@
1
+ import type { OpenUIError } from '@openuidev/lang-core';
2
+ import type { OpenuiHost } from '../context.js';
3
+ type __VLS_Props = {
4
+ /** The OpenUI Lang program of one fenced block; it may grow while `complete` is false. */
5
+ code: string;
6
+ complete: boolean;
7
+ /** False disables every control, e.g. on an older message or while the answer still streams. */
8
+ interactive: boolean;
9
+ /** Sends a user message; resolves false when the host rejected it. */
10
+ send: (message: string) => Promise<boolean>;
11
+ host?: OpenuiHost;
12
+ };
13
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ errors: (errors: OpenUIError[], code: string) => any;
15
+ copyFailed: () => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
+ onErrors?: ((errors: OpenUIError[], code: string) => any) | undefined;
18
+ onCopyFailed?: (() => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
@@ -0,0 +1,72 @@
1
+ <script setup>
2
+ import { formatWidgetContext, isSafeUrl } from "@meistrari/chat-ui-lang";
3
+ import { copyWidgetText, runActionPlan } from "../actions";
4
+ import { OPENUI_CONTEXT_KEY, OPENUI_ERROR_REPORTER_KEY, OPENUI_HOST_KEY } from "../context";
5
+ import { useOpenuiProgram } from "../program";
6
+ import { renderNode } from "../render";
7
+ const props = defineProps({
8
+ code: { type: String, required: true },
9
+ complete: { type: Boolean, required: true },
10
+ interactive: { type: Boolean, required: true },
11
+ send: { type: Function, required: true },
12
+ host: { type: Object, required: false }
13
+ });
14
+ const emit = defineEmits(["errors", "copyFailed"]);
15
+ const program = useOpenuiProgram(toRef(props, "code"), toRef(props, "complete"));
16
+ const answered = ref(false);
17
+ const interactive = computed(() => props.interactive && props.complete && !program.incomplete.value && !answered.value);
18
+ async function triggerAction(label, plan) {
19
+ if (!interactive.value)
20
+ return false;
21
+ let sent = false;
22
+ const accepted = await runActionPlan(label, plan, {
23
+ send: async (text, context) => {
24
+ const ok = await props.send(`${text}${formatWidgetContext(context, { onDrop: (drop) => console.warn("[openui] widget context dropped", drop) })}`);
25
+ sent = sent || ok;
26
+ return ok;
27
+ },
28
+ openUrl: (url) => {
29
+ if (isSafeUrl(url))
30
+ window.open(url, "_blank", "noopener");
31
+ },
32
+ custom: runCustomAction,
33
+ store: program.store,
34
+ stateDefaults: program.stateDefaults.value
35
+ });
36
+ if (sent)
37
+ answered.value = true;
38
+ return accepted;
39
+ }
40
+ async function runCustomAction(name, params) {
41
+ if (name === "CopyText" && typeof params.text === "string") {
42
+ const copied = await copyWidgetText(params.text, (text) => navigator.clipboard.writeText(text));
43
+ if (!copied)
44
+ emit("copyFailed");
45
+ return copied;
46
+ }
47
+ console.warn("[openui] unsupported widget action", { name });
48
+ return false;
49
+ }
50
+ function reportErrors(errors, code) {
51
+ emit("errors", errors, code);
52
+ }
53
+ provide(OPENUI_CONTEXT_KEY, { renderNode, interactive, triggerAction });
54
+ provide(OPENUI_ERROR_REPORTER_KEY, reportErrors);
55
+ provide(OPENUI_HOST_KEY, computed(() => props.host ?? {}));
56
+ watch([program.errors, () => props.complete], ([errors, done]) => {
57
+ if (done && errors.length)
58
+ reportErrors(errors, props.code);
59
+ }, { immediate: true });
60
+ const Root = () => renderNode(program.root.value);
61
+ </script>
62
+
63
+ <template>
64
+ <div my-12px data-openui="block" :data-openui-incomplete="program.incomplete.value || void 0">
65
+ <Root v-if="program.root.value" />
66
+ <div v-else-if="!complete" flex flex-col gap-8px>
67
+ <TelaSkeleton h-20px w-40per />
68
+ <TelaSkeleton h-80px w-full />
69
+ </div>
70
+ <pre v-else body-12-regular text-secondary whitespace-pre-wrap data-openui="fallback">{{ code }}</pre>
71
+ </div>
72
+ </template>
@@ -0,0 +1,21 @@
1
+ import type { OpenUIError } from '@openuidev/lang-core';
2
+ import type { OpenuiHost } from '../context.js';
3
+ type __VLS_Props = {
4
+ /** The OpenUI Lang program of one fenced block; it may grow while `complete` is false. */
5
+ code: string;
6
+ complete: boolean;
7
+ /** False disables every control, e.g. on an older message or while the answer still streams. */
8
+ interactive: boolean;
9
+ /** Sends a user message; resolves false when the host rejected it. */
10
+ send: (message: string) => Promise<boolean>;
11
+ host?: OpenuiHost;
12
+ };
13
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ errors: (errors: OpenUIError[], code: string) => any;
15
+ copyFailed: () => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
+ onErrors?: ((errors: OpenUIError[], code: string) => any) | undefined;
18
+ onCopyFailed?: (() => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ text: string;
3
+ partial?: boolean;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,12 @@
1
+ <script setup>
2
+ defineProps({
3
+ text: { type: String, required: true },
4
+ partial: { type: Boolean, required: false }
5
+ });
6
+ </script>
7
+
8
+ <template>
9
+ <p m-0 body-14-regular text-primary whitespace-pre-wrap>
10
+ {{ text }}
11
+ </p>
12
+ </template>
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ text: string;
3
+ partial?: boolean;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ title: string;
4
+ bars: unknown[];
5
+ tone?: 'neutral' | 'positive' | 'negative';
6
+ };
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,39 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ props: { type: Object, required: true }
4
+ });
5
+ const bars = computed(() => (Array.isArray(props.props.bars) ? props.props.bars : []).map((node) => {
6
+ const bar = node;
7
+ if (bar?.typeName !== "Bar" || !bar.props || typeof bar.props.value !== "number" || !Number.isFinite(bar.props.value))
8
+ return null;
9
+ return {
10
+ label: typeof bar.props.label === "string" ? bar.props.label : "",
11
+ value: bar.props.value,
12
+ display: typeof bar.props.display === "string" ? bar.props.display : String(bar.props.value)
13
+ };
14
+ }).filter((bar) => bar !== null));
15
+ const max = computed(() => Math.max(0, ...bars.value.map((bar) => Math.abs(bar.value))));
16
+ const fillClass = computed(() => ({
17
+ neutral: "bg-gray-800",
18
+ positive: "bg-green-600",
19
+ negative: "bg-red-600"
20
+ })[props.props.tone ?? "neutral"]);
21
+ function width(bar) {
22
+ return bar.value === 0 || max.value === 0 ? "0%" : `${Math.max(2, Math.round(Math.abs(bar.value) / max.value * 100))}%`;
23
+ }
24
+ </script>
25
+
26
+ <template>
27
+ <div flex flex-col gap-12px rounded-12px border-0.5px border p-16px data-openui="bar-chart">
28
+ <span body-12-medium text-secondary>{{ props.props.title }}</span>
29
+ <div flex flex-col gap-8px>
30
+ <div v-for="(bar, index) in bars" :key="index" grid grid-cols="[minmax(96px,1fr)_3fr_auto]" items-center gap-12px>
31
+ <span body-14-regular text-primary truncate>{{ bar.label }}</span>
32
+ <div h-8px rounded-4px bg-muted overflow-hidden>
33
+ <div h-full rounded-4px :class="bar.value < 0 ? 'bg-red-600' : fillClass" :style="{ width: width(bar) }" />
34
+ </div>
35
+ <span body-12-medium text-secondary tabular-nums>{{ bar.display }}</span>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </template>
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ title: string;
4
+ bars: unknown[];
5
+ tone?: 'neutral' | 'positive' | 'negative';
6
+ };
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ label: string;
4
+ value: number;
5
+ display?: string;
6
+ };
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,12 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ props: { type: Object, required: true }
4
+ });
5
+ </script>
6
+
7
+ <template>
8
+ <div flex justify-between gap-12px body-14-regular text-primary data-openui="bar">
9
+ <span>{{ props.props.label }}</span>
10
+ <span text-secondary>{{ props.props.display ?? props.props.value }}</span>
11
+ </div>
12
+ </template>
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ label: string;
4
+ value: number;
5
+ display?: string;
6
+ };
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import type { ActionPlan } from '@openuidev/lang-core';
2
+ type __VLS_Props = {
3
+ props: {
4
+ label: string;
5
+ action?: ActionPlan;
6
+ variant?: 'primary' | 'secondary';
7
+ };
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,30 @@
1
+ <script setup>
2
+ import { useOpenuiContext } from "../../use-openui-context";
3
+ const props = defineProps({
4
+ props: { type: Object, required: true }
5
+ });
6
+ const { interactive, triggerAction } = useOpenuiContext();
7
+ const sending = ref(false);
8
+ async function click() {
9
+ if (!interactive.value || sending.value)
10
+ return;
11
+ sending.value = true;
12
+ try {
13
+ await triggerAction(props.props.label, props.props.action);
14
+ } finally {
15
+ sending.value = false;
16
+ }
17
+ }
18
+ </script>
19
+
20
+ <template>
21
+ <TelaButton
22
+ :variant="props.props.variant === 'primary' ? 'primary' : 'secondary'"
23
+ :disabled="!interactive"
24
+ :loading="sending"
25
+ data-openui="button"
26
+ @click="click"
27
+ >
28
+ {{ props.props.label }}
29
+ </TelaButton>
30
+ </template>
@@ -0,0 +1,11 @@
1
+ import type { ActionPlan } from '@openuidev/lang-core';
2
+ type __VLS_Props = {
3
+ props: {
4
+ label: string;
5
+ action?: ActionPlan;
6
+ variant?: 'primary' | 'secondary';
7
+ };
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,8 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ buttons: unknown[];
4
+ };
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,14 @@
1
+ <script setup>
2
+ import { useOpenuiContext } from "../../use-openui-context";
3
+ const props = defineProps({
4
+ props: { type: Object, required: true }
5
+ });
6
+ const { renderNode } = useOpenuiContext();
7
+ const Children = () => renderNode(props.props.buttons);
8
+ </script>
9
+
10
+ <template>
11
+ <div flex flex-wrap gap-8px data-openui="buttons">
12
+ <Children />
13
+ </div>
14
+ </template>
@@ -0,0 +1,8 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ buttons: unknown[];
4
+ };
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,11 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ text: string;
4
+ tone?: 'info' | 'success' | 'warning' | 'error';
5
+ title?: string;
6
+ };
7
+ partial?: boolean;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,27 @@
1
+ <script setup>
2
+ import { OPENUI_HOST_KEY } from "../../context";
3
+ import OpenuiPlainProse from "../plain-prose.vue";
4
+ const props = defineProps({
5
+ props: { type: Object, required: true },
6
+ partial: { type: Boolean, required: false }
7
+ });
8
+ const host = inject(OPENUI_HOST_KEY, ref({}));
9
+ const prose = computed(() => host.value.prose ?? OpenuiPlainProse);
10
+ const TONES = {
11
+ info: { icon: "i-ph-info", color: "text-secondary" },
12
+ success: { icon: "i-ph-check-circle", color: "text-success" },
13
+ warning: { icon: "i-ph-warning", color: "text-warning" },
14
+ error: { icon: "i-ph-warning-octagon", color: "text-error" }
15
+ };
16
+ const tone = computed(() => TONES[props.props.tone ?? "info"]);
17
+ </script>
18
+
19
+ <template>
20
+ <div flex gap-10px rounded-12px border-0.5px border bg-subtle px-14px py-12px data-openui="callout">
21
+ <TelaIcon :name="tone.icon" size="16px" shrink-0 mt-2px :class="tone.color" />
22
+ <div flex flex-col gap-4px min-w-0>
23
+ <span v-if="props.props.title" body-14-medium text-primary>{{ props.props.title }}</span>
24
+ <component :is="prose" :text="props.props.text" :partial="partial" body-14-regular text-primary />
25
+ </div>
26
+ </div>
27
+ </template>
@@ -0,0 +1,11 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ text: string;
4
+ tone?: 'info' | 'success' | 'warning' | 'error';
5
+ title?: string;
6
+ };
7
+ partial?: boolean;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ children: unknown[];
4
+ title?: string;
5
+ };
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,19 @@
1
+ <script setup>
2
+ import { useOpenuiContext } from "../../use-openui-context";
3
+ const props = defineProps({
4
+ props: { type: Object, required: true }
5
+ });
6
+ const { renderNode } = useOpenuiContext();
7
+ const Children = () => renderNode(props.props.children);
8
+ </script>
9
+
10
+ <template>
11
+ <TelaCard size="sm" h-full data-openui="card">
12
+ <div flex flex-col gap-12px>
13
+ <h4 v-if="props.props.title" heading-h5-semibold text-contrast>
14
+ {{ props.props.title }}
15
+ </h4>
16
+ <Children />
17
+ </div>
18
+ </TelaCard>
19
+ </template>
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ children: unknown[];
4
+ title?: string;
5
+ };
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ name: string;
4
+ label: string;
5
+ };
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,26 @@
1
+ <script setup>
2
+ import { OPENUI_FORM_KEY } from "../../context";
3
+ import { useOpenuiContext } from "../../use-openui-context";
4
+ const props = defineProps({
5
+ props: { type: Object, required: true }
6
+ });
7
+ const form = inject(OPENUI_FORM_KEY, null);
8
+ const local = ref(false);
9
+ const { interactive } = useOpenuiContext();
10
+ const checked = computed({
11
+ get: () => (form ? form.get(props.props.name) : local.value) === true,
12
+ set: (next) => {
13
+ if (form)
14
+ form.set(props.props.name, next === true);
15
+ else
16
+ local.value = next === true;
17
+ }
18
+ });
19
+ </script>
20
+
21
+ <template>
22
+ <label flex items-center gap-8px body-14-regular text-primary cursor-pointer data-openui="checkbox">
23
+ <TelaCheckbox v-model="checked" :disabled="!interactive" />
24
+ {{ props.props.label }}
25
+ </label>
26
+ </template>
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ name: string;
4
+ label: string;
5
+ };
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ ref: string;
4
+ label?: string;
5
+ };
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,9 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ props: { type: Object, required: true }
4
+ });
5
+ </script>
6
+
7
+ <template>
8
+ <span body-14-regular text-secondary data-openui="citation">{{ props.props.label || "fonte" }}</span>
9
+ </template>
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ props: {
3
+ ref: string;
4
+ label?: string;
5
+ };
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;