@wodecorp/openui-vue-intelligent-ui-library 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # `@wodecorp/openui-vue-intelligent-ui-library`
1
+ # @wodecorp/openui-vue-intelligent-ui-library
2
2
 
3
- Vue 3 port of OpenUI's Intelligent UI library (`@openuidev/intelligent-ui-library`), providing **52 composable UI/drawing/play components** and **59 pure `@functions`** keyed on `Col` as root.
3
+ Interactive Intelligent UI component library for OpenUI Vue 3 — 52 model-composable UI components and 59 built-in `@functions` rooted at `Col`.
4
4
 
5
- ## Installation
5
+ ## Install
6
6
 
7
7
  ```bash
8
8
  pnpm add @wodecorp/openui-vue-intelligent-ui-library @wodecorp/openui-vue-lang @wodecorp/openui-vue-ui vue zod
@@ -10,17 +10,35 @@ pnpm add @wodecorp/openui-vue-intelligent-ui-library @wodecorp/openui-vue-lang @
10
10
 
11
11
  ## Usage
12
12
 
13
- ```ts
13
+ ```vue
14
+ <script setup lang="ts">
14
15
  import { Renderer } from "@wodecorp/openui-vue-lang";
15
- import { library, promptOptions, ThemeProvider } from "@wodecorp/openui-vue-intelligent-ui-library";
16
+ import { library, ThemeProvider } from "@wodecorp/openui-vue-intelligent-ui-library";
16
17
  import "@wodecorp/openui-vue-ui/index.css";
17
18
 
18
- const systemPrompt = library.prompt(promptOptions);
19
+ const program = [
20
+ "root = Col([",
21
+ ' Title("Loan Estimator", "lg"),',
22
+ ' Slider($amount, 1000, 50000, 1000, "Amount"),',
23
+ ' Text("Formatted: " + @Format($amount, "currency", 0, "USD"))',
24
+ "])",
25
+ "$amount = 15000",
26
+ ].join("\n");
27
+ </script>
28
+
29
+ <template>
30
+ <ThemeProvider mode="light">
31
+ <Renderer :library="library" :response="program" :is-streaming="false" />
32
+ </ThemeProvider>
33
+ </template>
19
34
  ```
20
35
 
21
- ## Highlights
36
+ ## Key Exports
22
37
 
23
- - **52 components** across Layout, Text, Inputs, Media & Data, Play (`Flashcard`, `Celebration`), SVG Drawing (`Svg`, `G`, `Circle`, `Ellipse`, `Rect`, `Line`, `Path`, `Polyline`, `Polygon`, `SvgText`), and sandboxed `HtmlView`.
24
- - **59 `@functions`** for client-side math, text, date, list, data aggregation, and color computation.
25
- - Reactive `$var` state binding and `Form` validation via `@wodecorp/openui-vue-lang`.
26
- - Scoped `ThemeProvider` supporting light/dark modes and `--openui-intelligent-*` tokens.
38
+ - `library` — Ready-to-use OpenUI `Library` (52 components + 59 `@functions`, root `"Col"`)
39
+ - `ThemeProvider` — Light/dark scoped theme wrapper
40
+ - `intelligentComponents`, `componentGroups`, `promptOptions` — Library metadata & LLM prompt builder options
41
+
42
+ ## License
43
+
44
+ MIT
package/dist/index.cjs CHANGED
@@ -2396,6 +2396,7 @@ const SegmentedControlImpl = (0, vue.defineComponent)({
2396
2396
  class: "openui-intelligent-segmented",
2397
2397
  style: {
2398
2398
  display: p.props.block ? "flex" : "inline-flex",
2399
+ flexShrink: 0,
2399
2400
  width: p.props.block ? "100%" : void 0,
2400
2401
  padding: "3px",
2401
2402
  gap: "2px",
@@ -2412,11 +2413,12 @@ const SegmentedControlImpl = (0, vue.defineComponent)({
2412
2413
  "aria-selected": active,
2413
2414
  disabled: streaming.value,
2414
2415
  style: {
2415
- flex: p.props.block ? "1 1 0%" : void 0,
2416
+ flex: p.props.block ? "1 1 0%" : "0 0 auto",
2416
2417
  padding: "6px 12px",
2417
2418
  fontSize: "13px",
2418
2419
  fontWeight: active ? 600 : 500,
2419
2420
  fontFamily: tokens.font,
2421
+ whiteSpace: "nowrap",
2420
2422
  borderRadius: tokens.radiusSm,
2421
2423
  border: "none",
2422
2424
  cursor: streaming.value ? "not-allowed" : "pointer",
@@ -2468,20 +2470,28 @@ const SelectImpl = (0, vue.defineComponent)({
2468
2470
  label: p.props.label ? str(p.props.label) : void 0,
2469
2471
  required: rules.required.value,
2470
2472
  error: rules.error.value,
2471
- control: (0, vue.h)("select", {
2473
+ control: (0, vue.h)("div", { style: {
2474
+ position: "relative",
2475
+ display: "flex",
2476
+ alignItems: "center",
2477
+ width: "100%"
2478
+ } }, [(0, vue.h)("select", {
2472
2479
  value: current,
2473
2480
  disabled: streaming.value,
2474
2481
  class: "openui-intelligent-select",
2475
2482
  style: {
2483
+ appearance: "none",
2484
+ WebkitAppearance: "none",
2476
2485
  width: "100%",
2477
- padding: "8px 10px",
2486
+ padding: "8px 32px 8px 10px",
2478
2487
  fontSize: "14px",
2479
2488
  fontFamily: tokens.font,
2480
2489
  color: tokens.ink,
2481
2490
  background: tokens.canvas,
2482
2491
  border: `1px solid ${rules.error.value ? tokens.danger : tokens.borderStrong}`,
2483
2492
  borderRadius: tokens.radiusMd,
2484
- boxSizing: "border-box"
2493
+ boxSizing: "border-box",
2494
+ cursor: streaming.value ? "not-allowed" : "pointer"
2485
2495
  },
2486
2496
  onChange: (e) => {
2487
2497
  rules.clear();
@@ -2494,7 +2504,25 @@ const SelectImpl = (0, vue.defineComponent)({
2494
2504
  }, str(p.props.placeholder)) : null, ...opts.map((opt) => (0, vue.h)("option", {
2495
2505
  key: opt.value,
2496
2506
  value: opt.value
2497
- }, opt.label))])
2507
+ }, opt.label))]), (0, vue.h)("svg", {
2508
+ width: "14",
2509
+ height: "14",
2510
+ viewBox: "0 0 12 12",
2511
+ fill: "none",
2512
+ "aria-hidden": "true",
2513
+ style: {
2514
+ position: "absolute",
2515
+ right: "10px",
2516
+ pointerEvents: "none",
2517
+ color: tokens.muted
2518
+ }
2519
+ }, [(0, vue.h)("path", {
2520
+ d: "M3 4.5L6 7.5L9 4.5",
2521
+ stroke: "currentColor",
2522
+ "stroke-width": "1.5",
2523
+ "stroke-linecap": "round",
2524
+ "stroke-linejoin": "round"
2525
+ })])])
2498
2526
  });
2499
2527
  };
2500
2528
  }
@@ -3168,6 +3196,7 @@ const TimerImpl = (0, vue.defineComponent)({
3168
3196
  (0, vue.onBeforeUnmount)(stop);
3169
3197
  return () => {
3170
3198
  const secs = typeof field.value === "number" ? field.value : Number(field.value ?? 0);
3199
+ const isZh = typeof document !== "undefined" && document.documentElement.lang.toLowerCase().startsWith("zh");
3171
3200
  return (0, vue.h)("div", {
3172
3201
  class: "openui-intelligent-timer",
3173
3202
  style: {
@@ -3194,7 +3223,8 @@ const TimerImpl = (0, vue.defineComponent)({
3194
3223
  color: tokens.ink
3195
3224
  } }, formatClock(secs))]), (0, vue.h)("div", { style: {
3196
3225
  display: "flex",
3197
- gap: "8px"
3226
+ gap: "8px",
3227
+ flexShrink: 0
3198
3228
  } }, [(0, vue.h)("button", {
3199
3229
  type: "button",
3200
3230
  disabled: streaming.value || !running.value && secs <= 0,
@@ -3206,9 +3236,10 @@ const TimerImpl = (0, vue.defineComponent)({
3206
3236
  background: tokens.ink,
3207
3237
  color: tokens.onInk,
3208
3238
  fontSize: "13px",
3239
+ whiteSpace: "nowrap",
3209
3240
  cursor: "pointer"
3210
3241
  }
3211
- }, running.value ? "Pause" : "Start"), (0, vue.h)("button", {
3242
+ }, running.value ? isZh ? "暂停" : "Pause" : isZh ? "开始" : "Start"), (0, vue.h)("button", {
3212
3243
  type: "button",
3213
3244
  disabled: streaming.value,
3214
3245
  onClick: reset,
@@ -3219,9 +3250,10 @@ const TimerImpl = (0, vue.defineComponent)({
3219
3250
  background: tokens.canvas,
3220
3251
  color: tokens.ink,
3221
3252
  fontSize: "13px",
3253
+ whiteSpace: "nowrap",
3222
3254
  cursor: "pointer"
3223
3255
  }
3224
- }, "Reset")])]);
3256
+ }, isZh ? "重置" : "Reset")])]);
3225
3257
  };
3226
3258
  }
3227
3259
  });