orbital-ds 0.35.0 → 0.36.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.
@@ -4,7 +4,7 @@ import { useRender } from '@base-ui/react/use-render';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const badgeVariants: (props?: ({
7
- variant?: "default" | "destructive" | "info" | "success" | "warning" | "danger" | "link" | "outline" | "secondary" | "ghost" | "neutral" | null | undefined;
7
+ variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | "info" | "success" | "warning" | "danger" | "neutral" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
10
10
 
@@ -5,7 +5,7 @@ import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare function BubbleGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
7
7
  declare const bubbleVariants: (props?: ({
8
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "muted" | "tinted" | null | undefined;
8
+ variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "muted" | "tinted" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  declare function Bubble({ variant, align, className, ...props }: React.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
11
11
  align?: "start" | "end";
@@ -4,7 +4,7 @@ import { useRender } from '@base-ui/react/use-render';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const buttonVariants: (props?: ({
7
- variant?: "default" | "destructive" | "link" | "outline" | "secondary" | "ghost" | "cta" | null | undefined;
7
+ variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | "cta" | null | undefined;
8
8
  size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  declare function Button({ className, variant, size, render, nativeButton: _nativeButton, ...props }: useRender.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
@@ -93,6 +93,61 @@ function Toolbar({ editor, tools, disabled }) {
93
93
  g
94
94
  ] }, i)) });
95
95
  }
96
+ function applySourceOp(op, text, a, b) {
97
+ const wrap = (m) => {
98
+ const sel = text.slice(a, b);
99
+ if (sel.length >= 2 * m.length && sel.startsWith(m) && sel.endsWith(m)) {
100
+ const inner = sel.slice(m.length, sel.length - m.length);
101
+ return { text: text.slice(0, a) + inner + text.slice(b), start: a, end: a + inner.length };
102
+ }
103
+ return { text: text.slice(0, a) + m + sel + m + text.slice(b), start: a + m.length, end: b + m.length };
104
+ };
105
+ const lines = (prefix, has) => {
106
+ const from = text.lastIndexOf("\n", a - 1) + 1;
107
+ const nl = text.indexOf("\n", b);
108
+ const to = nl === -1 ? text.length : nl;
109
+ const rows = text.slice(from, to).split("\n");
110
+ const all = rows.every((r) => has.test(r));
111
+ const out = rows.map((r, i) => all ? r.replace(has, "") : prefix(i) + r.replace(has, "")).join("\n");
112
+ return { text: text.slice(0, from) + out + text.slice(to), start: from, end: from + out.length };
113
+ };
114
+ switch (op) {
115
+ case "bold":
116
+ return wrap("**");
117
+ case "italic":
118
+ return wrap("*");
119
+ case "strike":
120
+ return wrap("~~");
121
+ case "code":
122
+ return wrap("`");
123
+ case "heading":
124
+ return lines(() => "## ", /^#{1,6} /);
125
+ case "bullet":
126
+ return lines(() => "- ", /^[-*] /);
127
+ case "ordered":
128
+ return lines((i) => `${i + 1}. `, /^\d+\. /);
129
+ case "quote":
130
+ return lines(() => "> ", /^> ?/);
131
+ case "codeBlock": {
132
+ const sel = text.slice(a, b);
133
+ return { text: text.slice(0, a) + "```\n" + sel + "\n```" + text.slice(b), start: a + 4, end: a + 4 + sel.length };
134
+ }
135
+ }
136
+ }
137
+ function SourceToolbar({ tools, onApply }) {
138
+ const t = useDsMessages();
139
+ const btn = (op, label, icon) => /* @__PURE__ */ jsx(ToolButton, { label, onPress: () => onApply(op), children: icon }, op);
140
+ const groups = [];
141
+ if (tools.includes("heading")) groups.push([btn("heading", t.editorHeading, /* @__PURE__ */ jsx(Heading2Icon, {}))]);
142
+ if (tools.includes("marks"))
143
+ groups.push([btn("bold", t.editorBold, /* @__PURE__ */ jsx(BoldIcon, {})), btn("italic", t.editorItalic, /* @__PURE__ */ jsx(ItalicIcon, {})), btn("strike", t.editorStrike, /* @__PURE__ */ jsx(StrikethroughIcon, {})), btn("code", t.editorCode, /* @__PURE__ */ jsx(CodeIcon, {}))]);
144
+ if (tools.includes("lists")) groups.push([btn("bullet", t.editorBulletList, /* @__PURE__ */ jsx(ListIcon, {})), btn("ordered", t.editorOrderedList, /* @__PURE__ */ jsx(ListOrderedIcon, {}))]);
145
+ if (tools.includes("blocks")) groups.push([btn("quote", t.editorQuote, /* @__PURE__ */ jsx(QuoteIcon, {})), btn("codeBlock", t.editorCodeBlock, /* @__PURE__ */ jsx(SquareCodeIcon, {}))]);
146
+ return /* @__PURE__ */ jsx("div", { role: "toolbar", "aria-label": t.editorToolbar, "data-slot": "instruction-editor-toolbar", className: "flex flex-wrap items-center gap-1", children: groups.map((g, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
147
+ i > 0 ? /* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mx-1 h-4" }) : null,
148
+ g
149
+ ] }, i)) });
150
+ }
96
151
  function InstructionEditor({
97
152
  preset = "prompt",
98
153
  value,
@@ -166,6 +221,15 @@ function InstructionEditor({
166
221
  fromSource(current.slice(0, a) + text + current.slice(b));
167
222
  } else editor?.chain().focus().insertContent(text).run();
168
223
  };
224
+ const applyOp = (op) => {
225
+ const el = textareaRef.current;
226
+ const r = applySourceOp(op, current, el?.selectionStart ?? current.length, el?.selectionEnd ?? current.length);
227
+ fromSource(r.text);
228
+ requestAnimationFrame(() => {
229
+ el?.focus();
230
+ el?.setSelectionRange(r.start, r.end);
231
+ });
232
+ };
169
233
  const insertVariable = (name) => insertText(`{{${name}}}`);
170
234
  const isTemplate = syntax === "template";
171
235
  const issues = React.useMemo(() => isTemplate ? analyzeTemplate(current, variables) : [], [isTemplate, current, variables]);
@@ -199,7 +263,7 @@ function InstructionEditor({
199
263
  ...props,
200
264
  children: [
201
265
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border p-2", children: [
202
- mode === "visual" && editor && !readOnly ? /* @__PURE__ */ jsx(Toolbar, { editor, tools: toolList, disabled: false }) : /* @__PURE__ */ jsx("span", {}),
266
+ mode === "visual" && editor && !readOnly ? /* @__PURE__ */ jsx(Toolbar, { editor, tools: toolList, disabled: false }) : mode === "markdown" && !readOnly ? /* @__PURE__ */ jsx(SourceToolbar, { tools: toolList.filter((x) => x !== "history"), onApply: applyOp }) : /* @__PURE__ */ jsx("span", {}),
203
267
  availableModes.length > 1 ? /* @__PURE__ */ jsx(Tabs, { value: mode, onValueChange: (v) => setMode(v), children: /* @__PURE__ */ jsx(TabsList, { "aria-label": t.editorModes, children: availableModes.map((m) => /* @__PURE__ */ jsx(TabsTrigger, { value: m, children: { visual: t.editorModeVisual, markdown: t.editorModeMarkdown, html: t.editorModeHtml, preview: t.editorModePreview }[m] }, m)) }) }) : null
204
268
  ] }),
205
269
  variables?.length && editingSource ? /* @__PURE__ */ jsxs("div", { "data-slot": "instruction-editor-variables", className: "flex flex-wrap items-center gap-1 px-2", children: [
package/dist/ui/item.d.ts CHANGED
@@ -13,7 +13,7 @@ declare const itemVariants: (props?: ({
13
13
  } & class_variance_authority_types.ClassProp) | undefined) => string;
14
14
  declare function Item({ className, variant, size, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof itemVariants>): React.JSX.Element;
15
15
  declare const itemMediaVariants: (props?: ({
16
- variant?: "default" | "image" | "icon" | null | undefined;
16
+ variant?: "image" | "default" | "icon" | null | undefined;
17
17
  } & class_variance_authority_types.ClassProp) | undefined) => string;
18
18
  declare function ItemMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>): React.JSX.Element;
19
19
  declare function ItemContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
@@ -4,7 +4,7 @@ import { useRender } from '@base-ui/react/use-render';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const markerVariants: (props?: ({
7
- variant?: "default" | "separator" | "border" | null | undefined;
7
+ variant?: "separator" | "default" | "border" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  declare function Marker({ className, variant, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof markerVariants>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
10
10
  declare function MarkerIcon({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  type SparklineSeries = 1 | 2 | 3 | 4 | 5;
5
5
  type SparklineTone = "info" | "success" | "warning" | "danger" | "neutral";
6
6
  declare const sparklineVariants: (props?: ({
7
- color?: "info" | "success" | "warning" | "danger" | "current" | "neutral" | "series-1" | "series-2" | "series-3" | "series-4" | "series-5" | null | undefined;
7
+ color?: "current" | "info" | "success" | "warning" | "danger" | "neutral" | "series-1" | "series-2" | "series-3" | "series-4" | "series-5" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  type SparklineProps = Omit<React.ComponentProps<"svg">, "children" | "color"> & {
10
10
  /** Serie de valores; `null` = sin dato (hueco), nunca cero. */
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  type StatusLevel = "critical" | "warning" | "ok" | "info" | "neutral" | "none";
5
5
  type StatusBadgeVariant = "soft" | "dot" | "outline";
6
6
  declare const statusDotVariants: (props?: ({
7
- level?: "info" | "warning" | "none" | "neutral" | "critical" | "ok" | null | undefined;
7
+ level?: "none" | "info" | "warning" | "neutral" | "critical" | "ok" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  type StatusDotProps = Omit<React.ComponentProps<"span">, "children"> & {
10
10
  level?: StatusLevel;
@@ -17,7 +17,7 @@ type StatusDotProps = Omit<React.ComponentProps<"span">, "children"> & {
17
17
  declare function StatusDot({ level, pulse, size, label, className, ...props }: StatusDotProps): React.JSX.Element;
18
18
  declare const statusBadgeVariants: (props?: ({
19
19
  variant?: "outline" | "soft" | "dot" | null | undefined;
20
- level?: "info" | "warning" | "none" | "neutral" | "critical" | "ok" | null | undefined;
20
+ level?: "none" | "info" | "warning" | "neutral" | "critical" | "ok" | null | undefined;
21
21
  } & class_variance_authority_types.ClassProp) | undefined) => string;
22
22
  type StatusBadgeProps = Omit<React.ComponentProps<"span">, "children"> & {
23
23
  level?: StatusLevel;
package/dist/ui/tabs.d.ts CHANGED
@@ -5,7 +5,7 @@ import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare function Tabs({ className, orientation, ...props }: Tabs$1.Root.Props): React.JSX.Element;
7
7
  declare const tabsListVariants: (props?: ({
8
- variant?: "default" | "line" | null | undefined;
8
+ variant?: "line" | "default" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  declare function TabsList({ className, variant, ...props }: Tabs$1.List.Props & VariantProps<typeof tabsListVariants>): React.JSX.Element;
11
11
  declare function TabsTrigger({ className, ...props }: Tabs$1.Tab.Props): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orbital-ds",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Sistema de diseño genérico: estructura común + temas con personalidad (qratia, zyro) + ~60 componentes sobre Base UI y Tailwind v4, con contrato verificable y legible por agentes.",
5
5
  "keywords": [
6
6
  "design-system",