@nesso-how/ui 1.0.0-alpha.31 → 1.0.0-alpha.33
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 +13 -11
- package/dist/index.d.ts +13 -2
- package/dist/index.js +339 -2
- package/dist/styles.css +430 -81
- package/package.json +11 -7
package/README.md
CHANGED
|
@@ -29,25 +29,27 @@ Keep React and React DOM external in your plugin bundle. Import your own layout
|
|
|
29
29
|
Install React/React DOM and configure [Tailwind CSS 4](https://tailwindcss.com/docs/installation) in your application. Import the package's source CSS after Tailwind in your main stylesheet:
|
|
30
30
|
|
|
31
31
|
```css
|
|
32
|
-
@import
|
|
33
|
-
@import
|
|
32
|
+
@import 'tailwindcss';
|
|
33
|
+
@import '@nesso-how/ui/styles.css';
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
Your build must compile this CSS; it is not a precompiled stylesheet. Supply the theme CSS variables on your document or component container: colors such as `--background`, `--foreground`, and `--border`; `--font-sans` and `--font-mono`; `--radius-control` and `--radius-object` with length units; and `--duration-state` with time units. No theme values or font files are included. See the [theme schema](https://github.com/nesso-how/nesso/blob/main/packages/plugin/src/definitions.ts) for all color tokens and [Paper's theme](https://github.com/nesso-how/nesso/blob/main/plugins/paper-theme/src/index.ts) for example values.
|
|
37
37
|
|
|
38
38
|
## Components
|
|
39
39
|
|
|
40
|
-
| Area
|
|
41
|
-
|
|
|
42
|
-
| Buttons and inputs
|
|
43
|
-
| Forms and rows
|
|
44
|
-
| Menus and popovers
|
|
40
|
+
| Area | Exports |
|
|
41
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
42
|
+
| Buttons and inputs | `Button`, `IconButton`, `Input`, `MarkdownInput`, `Label`, `PreferenceSelect`, `ColorPicker` |
|
|
43
|
+
| Forms and rows | `Field`, `FieldHint`, `ListRow`, `ListRowButton`, `ListRowDetail`, `ListRowTitle`, `RevealActions`, `PromptForm` |
|
|
44
|
+
| Menus and popovers | `Menu`, `MenuItem`, `MenuPopup`, `MenuRadioItem`, `Popover`, `PopoverPopup` |
|
|
45
45
|
| Search and suggestions | `Combobox`, `ComboboxItem`, `ComboboxPopup`, `Autocomplete`, `AutocompleteClear`, `AutocompleteItem`, `AutocompletePopup` |
|
|
46
|
-
| Dialogs
|
|
47
|
-
| Panels and disclosure
|
|
48
|
-
| Feedback
|
|
49
|
-
| Labels and icons
|
|
46
|
+
| Dialogs | `Dialog`, `DialogActions`, `DialogPopup`, `ConfirmDialog`, `TextPromptDialog` |
|
|
47
|
+
| Panels and disclosure | `SidePanel`, `PanelHeader`, `SectionHeading`, `Collapsible`, `Tabs` |
|
|
48
|
+
| Feedback | `Banner`, `ToastViewport`, `Spinner` |
|
|
49
|
+
| Labels and icons | `Kbd`, `ContextLabel`, `ActionIcon` |
|
|
50
50
|
|
|
51
51
|
`Button` supports `default`, `outline`, and `ghost` variants. `SidePanel` supports controlled resizing and collapse. `Spinner` accepts an accessible `label` and respects reduced motion. State, content, and event handling remain yours to provide.
|
|
52
52
|
|
|
53
|
+
`MarkdownInput` provides a live preview of bold, italic, links, and bullet or numbered lists in one field without a toolbar. Markdown delimiters reappear when the cursor or selection enters formatted text, including link destinations and list markers. Enter continues a list, incrementing the current number for numbered lists; Enter on an empty nested item returns to the parent level, and on an empty top-level item ends the list. Tab nests the current item under the previous one; Shift+Tab moves it up a level. Both move the item's continuation lines and children together, leaving unrelated text alone. At level boundaries they leave content and focus unchanged; outside lists they retain normal focus navigation. Shift+Enter inserts a plain line break. Existing items are not renumbered, and there are no checklists. It accepts the unchanged Markdown source through `value` and `onChange`, supports Cmd/Ctrl+B/I on selections, and preserves line breaks. Set `history={false}` when the host owns undo/redo and its shortcuts. Cmd/Ctrl-click requests `onOpenLink`; read-only fields request it on a regular click. The host is responsible for validating and opening destinations.
|
|
54
|
+
|
|
53
55
|
The package also exports `useMediaQuery`, `contrastColor`, `presetColors`, and the `ActionIconName` and `ToastItem` types. See the [public exports](https://github.com/nesso-how/nesso/blob/main/packages/ui/src/index.ts) and component source files for prop definitions; published TypeScript declarations provide editor completion.
|
package/dist/index.d.ts
CHANGED
|
@@ -48,10 +48,20 @@ export declare function Spinner({ label, className }: {
|
|
|
48
48
|
export declare function useMediaQuery(query: string): boolean;
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/input.d.ts
|
|
51
|
-
declare function Input({ className, type, ...props }: ComponentProps<
|
|
51
|
+
declare function Input({ className, type, ...props }: ComponentProps<'input'>): import("react").JSX.Element;
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/markdown-input.d.ts
|
|
54
|
+
type MarkdownInputProps = Omit<ComponentProps<'div'>, 'onChange' | 'children' | 'defaultValue'> & {
|
|
55
|
+
value: string;
|
|
56
|
+
onChange: (value: string) => void;
|
|
57
|
+
readOnly?: boolean;
|
|
58
|
+
history?: boolean;
|
|
59
|
+
onOpenLink?: (url: string) => void;
|
|
60
|
+
};
|
|
61
|
+
export declare function MarkdownInput({ value, onChange, readOnly, history, onOpenLink, className, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...props }: MarkdownInputProps): import("react").JSX.Element;
|
|
52
62
|
//#endregion
|
|
53
63
|
//#region src/label.d.ts
|
|
54
|
-
declare function Label({ className, ...props }: ComponentProps<
|
|
64
|
+
declare function Label({ className, ...props }: ComponentProps<'label'>): import("react").JSX.Element;
|
|
55
65
|
//#endregion
|
|
56
66
|
//#region src/kbd.d.ts
|
|
57
67
|
export declare function Kbd({ className, ...props }: ComponentProps<'kbd'>): import("react").JSX.Element;
|
|
@@ -252,6 +262,7 @@ declare const icons: {
|
|
|
252
262
|
readonly 'file-down': LucideIcon;
|
|
253
263
|
readonly 'file-up': LucideIcon;
|
|
254
264
|
readonly folder: LucideIcon;
|
|
265
|
+
readonly glasses: LucideIcon;
|
|
255
266
|
readonly globe: LucideIcon;
|
|
256
267
|
readonly layers: LucideIcon;
|
|
257
268
|
readonly pencil: LucideIcon;
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,12 @@ import { cva } from "class-variance-authority";
|
|
|
3
3
|
import { cn } from "cn";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
6
|
-
import { ArrowRight, BookOpen, Check, ChevronDown, ChevronLeft, ChevronRight, CircleHelp, ClipboardPaste, Copy, Download, FileDown, FileUp, Folder, Globe, Info, Layers, Minus, Pencil, Play, Plus, RefreshCw, RotateCcw, Scissors, Search, Share2, Sparkles, TriangleAlert, Upload, X, Zap } from "lucide-react";
|
|
6
|
+
import { ArrowRight, BookOpen, Check, ChevronDown, ChevronLeft, ChevronRight, CircleHelp, ClipboardPaste, Copy, Download, FileDown, FileUp, Folder, Glasses, Globe, Info, Layers, Minus, Pencil, Play, Plus, RefreshCw, RotateCcw, Scissors, Search, Share2, Sparkles, TriangleAlert, Upload, X, Zap } from "lucide-react";
|
|
7
7
|
import { Input as Input$1 } from "@base-ui/react/input";
|
|
8
|
+
import { Annotation, Compartment, EditorSelection, EditorState, Transaction } from "@codemirror/state";
|
|
9
|
+
import { Decoration, EditorView, ViewPlugin, WidgetType, keymap } from "@codemirror/view";
|
|
10
|
+
import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
|
|
11
|
+
import { parser } from "@lezer/markdown";
|
|
8
12
|
import { Dialog, Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
9
13
|
import { Combobox } from "@base-ui/react/combobox";
|
|
10
14
|
import { Menu } from "@base-ui/react/menu";
|
|
@@ -216,6 +220,338 @@ function Input({ className, type, ...props }) {
|
|
|
216
220
|
});
|
|
217
221
|
}
|
|
218
222
|
//#endregion
|
|
223
|
+
//#region src/markdown.ts
|
|
224
|
+
const listPrefix = /^(\s*)([-+*]|(\d{1,9})([.)]))([\t ]+|$)/;
|
|
225
|
+
var ListMarker = class extends WidgetType {
|
|
226
|
+
label;
|
|
227
|
+
constructor(label) {
|
|
228
|
+
super();
|
|
229
|
+
this.label = label;
|
|
230
|
+
}
|
|
231
|
+
eq(other) {
|
|
232
|
+
return this.label === other.label;
|
|
233
|
+
}
|
|
234
|
+
toDOM(view) {
|
|
235
|
+
const marker = view.dom.ownerDocument.createElement("span");
|
|
236
|
+
marker.className = "nesso-markdown-list-marker";
|
|
237
|
+
marker.textContent = this.label;
|
|
238
|
+
return marker;
|
|
239
|
+
}
|
|
240
|
+
ignoreEvent() {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
function markdownDecorations(state, focused) {
|
|
245
|
+
const source = state.doc.toString();
|
|
246
|
+
const decorations = [];
|
|
247
|
+
const syntax = (from, to, active) => {
|
|
248
|
+
if (from >= to || source.slice(from, to).includes("\n")) return;
|
|
249
|
+
const decoration = active ? Decoration.mark({ class: "nesso-markdown-syntax" }) : Decoration.replace({});
|
|
250
|
+
decorations.push(decoration.range(from, to));
|
|
251
|
+
};
|
|
252
|
+
parser.parse(source).iterate({ enter(node) {
|
|
253
|
+
if ([
|
|
254
|
+
"Image",
|
|
255
|
+
"InlineCode",
|
|
256
|
+
"FencedCode",
|
|
257
|
+
"CodeBlock",
|
|
258
|
+
"HTMLBlock"
|
|
259
|
+
].includes(node.name)) return false;
|
|
260
|
+
const active = focused && state.selection.ranges.some((range) => range.from <= node.to && range.to >= node.from);
|
|
261
|
+
if (node.name === "ListItem") {
|
|
262
|
+
const marker = node.node.getChild("ListMark");
|
|
263
|
+
const line = state.doc.lineAt(marker.from);
|
|
264
|
+
const end = marker.to + (source.slice(marker.to, line.to).match(/^[\t ]*/)?.[0].length ?? 0);
|
|
265
|
+
const label = node.node.parent?.name === "BulletList" ? "•" : source.slice(marker.from, marker.to);
|
|
266
|
+
const width = Math.max(3, end - marker.from);
|
|
267
|
+
decorations.push(Decoration.line({
|
|
268
|
+
class: "nesso-markdown-list-item",
|
|
269
|
+
attributes: { style: `--nesso-list-indent: ${width}ch; --nesso-list-padding: ${marker.from - line.from + width}ch` }
|
|
270
|
+
}).range(line.from), (active ? Decoration.mark({ class: "nesso-markdown-syntax nesso-markdown-list-marker" }) : Decoration.replace({ widget: new ListMarker(`${label} `) })).range(marker.from, end));
|
|
271
|
+
}
|
|
272
|
+
if (node.name === "StrongEmphasis" || node.name === "Emphasis") {
|
|
273
|
+
const [open, close] = node.node.getChildren("EmphasisMark");
|
|
274
|
+
decorations.push(Decoration.mark({ class: node.name === "StrongEmphasis" ? "nesso-markdown-bold" : "nesso-markdown-italic" }).range(open.to, close.from));
|
|
275
|
+
syntax(open.from, open.to, active);
|
|
276
|
+
syntax(close.from, close.to, active);
|
|
277
|
+
}
|
|
278
|
+
if (node.name === "Link") {
|
|
279
|
+
const url = node.node.getChild("URL");
|
|
280
|
+
if (!url) return;
|
|
281
|
+
const [open, close] = node.node.getChildren("LinkMark");
|
|
282
|
+
decorations.push(Decoration.mark({
|
|
283
|
+
class: "nesso-markdown-link",
|
|
284
|
+
attributes: { "data-markdown-link": source.slice(url.from, url.to).replace(/^<|>$/g, "") }
|
|
285
|
+
}).range(open.to, close.from));
|
|
286
|
+
syntax(open.from, open.to, active);
|
|
287
|
+
syntax(close.from, node.to, active);
|
|
288
|
+
}
|
|
289
|
+
} });
|
|
290
|
+
return Decoration.set(decorations, true);
|
|
291
|
+
}
|
|
292
|
+
function markdownListItem(state) {
|
|
293
|
+
if (state.readOnly || state.selection.ranges.length !== 1) return null;
|
|
294
|
+
const { from, to } = state.selection.main;
|
|
295
|
+
if (to > state.doc.lineAt(from).to) return null;
|
|
296
|
+
let node = parser.parse(state.doc.toString()).resolveInner(from, -1);
|
|
297
|
+
while (node.name !== "ListItem") {
|
|
298
|
+
if ([
|
|
299
|
+
"FencedCode",
|
|
300
|
+
"CodeBlock",
|
|
301
|
+
"HTMLBlock"
|
|
302
|
+
].includes(node.name) || !node.parent) return null;
|
|
303
|
+
node = node.parent;
|
|
304
|
+
}
|
|
305
|
+
const firstLine = state.doc.lineAt(node.from);
|
|
306
|
+
const prefix = firstLine.text.match(listPrefix);
|
|
307
|
+
if (!prefix || to > node.to) return null;
|
|
308
|
+
return {
|
|
309
|
+
node,
|
|
310
|
+
firstLine,
|
|
311
|
+
prefix
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function nextListPrefix(prefix) {
|
|
315
|
+
const number = prefix[3] ? Number(prefix[3]) + 1 : null;
|
|
316
|
+
if (number !== null && number > 999999999) return null;
|
|
317
|
+
const marker = number === null ? prefix[2] : `${number}${prefix[4]}`;
|
|
318
|
+
return `${prefix[1]}${marker}${prefix[5] || " "}`;
|
|
319
|
+
}
|
|
320
|
+
function indentMarkdownList(state, outdent = false) {
|
|
321
|
+
const item = markdownListItem(state);
|
|
322
|
+
if (!item) return null;
|
|
323
|
+
const { node, firstLine, prefix } = item;
|
|
324
|
+
const parent = node.parent?.parent;
|
|
325
|
+
let indentation = "";
|
|
326
|
+
if (outdent) {
|
|
327
|
+
if (!prefix[1]) return {};
|
|
328
|
+
if (parent?.name === "ListItem") {
|
|
329
|
+
const parentPrefix = state.doc.lineAt(parent.from).text.match(listPrefix);
|
|
330
|
+
if (!parentPrefix) return {};
|
|
331
|
+
indentation = parentPrefix[1];
|
|
332
|
+
}
|
|
333
|
+
} else {
|
|
334
|
+
const previous = node.prevSibling ?? node.parent?.prevSibling?.lastChild;
|
|
335
|
+
if (previous?.name !== "ListItem") return {};
|
|
336
|
+
const previousPrefix = state.doc.lineAt(previous.from).text.match(listPrefix);
|
|
337
|
+
if (!previousPrefix) return {};
|
|
338
|
+
indentation = previousPrefix[1] + " ".repeat(previousPrefix[0].length - previousPrefix[1].length);
|
|
339
|
+
}
|
|
340
|
+
const difference = indentation.length - prefix[1].length;
|
|
341
|
+
if (difference === 0) return {};
|
|
342
|
+
const edits = [];
|
|
343
|
+
for (let number = firstLine.number; number <= state.doc.lineAt(node.to).number; number++) {
|
|
344
|
+
const line = state.doc.line(number);
|
|
345
|
+
if (!line.text) continue;
|
|
346
|
+
edits.push({
|
|
347
|
+
from: line.from,
|
|
348
|
+
to: line.from + (difference < 0 ? Math.min(-difference, line.text.match(/^\s*/)[0].length) : 0),
|
|
349
|
+
insert: difference > 0 ? " ".repeat(difference) : ""
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
const changes = state.changes(edits);
|
|
353
|
+
return {
|
|
354
|
+
changes,
|
|
355
|
+
selection: state.selection.map(changes, 1),
|
|
356
|
+
userEvent: "input.indent"
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function continueMarkdownList(state) {
|
|
360
|
+
const item = markdownListItem(state);
|
|
361
|
+
if (!item) return null;
|
|
362
|
+
const { node, firstLine, prefix } = item;
|
|
363
|
+
let { from, to } = state.selection.main;
|
|
364
|
+
if (from < firstLine.from + prefix[0].length) return null;
|
|
365
|
+
let insert = nextListPrefix(prefix);
|
|
366
|
+
if (state.doc.lineAt(from).from === firstLine.from && !firstLine.text.slice(prefix[0].length).trim()) {
|
|
367
|
+
const parent = node.parent?.parent;
|
|
368
|
+
const parentPrefix = parent?.name === "ListItem" ? state.doc.lineAt(parent.from).text.match(listPrefix) : null;
|
|
369
|
+
insert = parentPrefix ? nextListPrefix(parentPrefix) : "";
|
|
370
|
+
from = firstLine.from;
|
|
371
|
+
to = firstLine.to;
|
|
372
|
+
} else if (insert !== null) insert = `\n${insert}`;
|
|
373
|
+
if (insert === null) return null;
|
|
374
|
+
return {
|
|
375
|
+
changes: {
|
|
376
|
+
from,
|
|
377
|
+
to,
|
|
378
|
+
insert
|
|
379
|
+
},
|
|
380
|
+
selection: EditorSelection.cursor(from + insert.length),
|
|
381
|
+
userEvent: "input"
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function toggleMarkdownFormat(state, marker) {
|
|
385
|
+
if (state.readOnly) return null;
|
|
386
|
+
const { from, to } = state.selection.main;
|
|
387
|
+
const selected = state.sliceDoc(from, to);
|
|
388
|
+
let delimiters;
|
|
389
|
+
parser.parse(state.doc.toString()).iterate({ enter(node) {
|
|
390
|
+
if (node.name !== (marker === "**" ? "StrongEmphasis" : "Emphasis")) return;
|
|
391
|
+
const [open, close] = node.node.getChildren("EmphasisMark");
|
|
392
|
+
if (from === node.from && to === node.to || from >= open.to && to <= close.from) delimiters = [open, close].map(({ from, to }) => ({
|
|
393
|
+
from,
|
|
394
|
+
to
|
|
395
|
+
}));
|
|
396
|
+
} });
|
|
397
|
+
if (delimiters) {
|
|
398
|
+
const changes = state.changes(delimiters);
|
|
399
|
+
return {
|
|
400
|
+
changes,
|
|
401
|
+
selection: state.selection.map(changes),
|
|
402
|
+
userEvent: "input.format"
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
return {
|
|
406
|
+
changes: {
|
|
407
|
+
from,
|
|
408
|
+
to,
|
|
409
|
+
insert: `${marker}${selected}${marker}`
|
|
410
|
+
},
|
|
411
|
+
selection: EditorSelection.range(from + marker.length, to + marker.length),
|
|
412
|
+
userEvent: "input.format"
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
//#endregion
|
|
416
|
+
//#region src/markdown-input.tsx
|
|
417
|
+
const externalChange = Annotation.define();
|
|
418
|
+
const livePreview = ViewPlugin.define((view) => ({
|
|
419
|
+
decorations: markdownDecorations(view.state, view.hasFocus && !view.state.readOnly),
|
|
420
|
+
update(update) {
|
|
421
|
+
if (update.docChanged || update.selectionSet || update.focusChanged || update.startState.readOnly !== update.state.readOnly) this.decorations = markdownDecorations(update.state, update.view.hasFocus && !update.state.readOnly);
|
|
422
|
+
}
|
|
423
|
+
}), { decorations: (plugin) => plugin.decorations });
|
|
424
|
+
function MarkdownInput({ value, onChange, readOnly = false, history: history$1 = true, onOpenLink, className, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }) {
|
|
425
|
+
const container = useRef(null);
|
|
426
|
+
const editor = useRef(null);
|
|
427
|
+
const callbacks = useRef({
|
|
428
|
+
onChange,
|
|
429
|
+
onOpenLink
|
|
430
|
+
});
|
|
431
|
+
const [configuration] = useState(() => new Compartment());
|
|
432
|
+
const [initialValue] = useState(value);
|
|
433
|
+
useLayoutEffect(() => {
|
|
434
|
+
callbacks.current = {
|
|
435
|
+
onChange,
|
|
436
|
+
onOpenLink
|
|
437
|
+
};
|
|
438
|
+
}, [onChange, onOpenLink]);
|
|
439
|
+
useLayoutEffect(() => {
|
|
440
|
+
const view = new EditorView({
|
|
441
|
+
parent: container.current,
|
|
442
|
+
doc: initialValue,
|
|
443
|
+
extensions: [
|
|
444
|
+
EditorView.lineWrapping,
|
|
445
|
+
EditorView.theme({
|
|
446
|
+
"&.cm-focused": { outline: "none" },
|
|
447
|
+
".cm-scroller": {
|
|
448
|
+
fontFamily: "inherit",
|
|
449
|
+
lineHeight: "inherit",
|
|
450
|
+
overflow: "visible"
|
|
451
|
+
},
|
|
452
|
+
".cm-content, .cm-line": { padding: "0" },
|
|
453
|
+
".cm-line.nesso-markdown-list-item": {
|
|
454
|
+
paddingInlineStart: "var(--nesso-list-padding)",
|
|
455
|
+
textIndent: "calc(-1 * var(--nesso-list-padding))"
|
|
456
|
+
}
|
|
457
|
+
}),
|
|
458
|
+
livePreview,
|
|
459
|
+
configuration.of([]),
|
|
460
|
+
keymap.of([
|
|
461
|
+
...["Tab", "Shift-Tab"].map((key) => ({
|
|
462
|
+
key,
|
|
463
|
+
run: (view) => {
|
|
464
|
+
const transaction = indentMarkdownList(view.state, key === "Shift-Tab");
|
|
465
|
+
if (!transaction) return false;
|
|
466
|
+
view.dispatch({
|
|
467
|
+
...transaction,
|
|
468
|
+
scrollIntoView: true
|
|
469
|
+
});
|
|
470
|
+
return true;
|
|
471
|
+
}
|
|
472
|
+
})),
|
|
473
|
+
{
|
|
474
|
+
key: "Enter",
|
|
475
|
+
run: (view) => {
|
|
476
|
+
const transaction = continueMarkdownList(view.state);
|
|
477
|
+
if (!transaction) return false;
|
|
478
|
+
view.dispatch({
|
|
479
|
+
...transaction,
|
|
480
|
+
scrollIntoView: true
|
|
481
|
+
});
|
|
482
|
+
return true;
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
...["**", "*"].map((marker) => ({
|
|
486
|
+
key: marker === "**" ? "Mod-b" : "Mod-i",
|
|
487
|
+
run: (view) => {
|
|
488
|
+
const transaction = toggleMarkdownFormat(view.state, marker);
|
|
489
|
+
if (!transaction) return false;
|
|
490
|
+
view.dispatch(transaction);
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
})),
|
|
494
|
+
...defaultKeymap
|
|
495
|
+
]),
|
|
496
|
+
EditorView.updateListener.of((update) => {
|
|
497
|
+
if (update.docChanged && !update.transactions.some((t) => t.annotation(externalChange))) callbacks.current.onChange(update.state.doc.toString());
|
|
498
|
+
}),
|
|
499
|
+
EditorView.domEventHandlers({ click(event, view) {
|
|
500
|
+
const url = event.target.closest("[data-markdown-link]")?.getAttribute("data-markdown-link");
|
|
501
|
+
if (!url || !(event.metaKey || event.ctrlKey || view.state.readOnly)) return false;
|
|
502
|
+
event.preventDefault();
|
|
503
|
+
callbacks.current.onOpenLink?.(url);
|
|
504
|
+
return true;
|
|
505
|
+
} })
|
|
506
|
+
]
|
|
507
|
+
});
|
|
508
|
+
editor.current = view;
|
|
509
|
+
return () => {
|
|
510
|
+
editor.current = null;
|
|
511
|
+
view.destroy();
|
|
512
|
+
};
|
|
513
|
+
}, [configuration, initialValue]);
|
|
514
|
+
useLayoutEffect(() => {
|
|
515
|
+
editor.current?.dispatch({ effects: configuration.reconfigure([
|
|
516
|
+
EditorState.readOnly.of(readOnly),
|
|
517
|
+
EditorView.editable.of(!readOnly),
|
|
518
|
+
EditorView.contentAttributes.of({
|
|
519
|
+
...id ? { id } : {},
|
|
520
|
+
...ariaLabel ? { "aria-label": ariaLabel } : {},
|
|
521
|
+
...ariaLabelledBy ? { "aria-labelledby": ariaLabelledBy } : {},
|
|
522
|
+
"aria-multiline": "true",
|
|
523
|
+
"aria-readonly": String(readOnly),
|
|
524
|
+
spellcheck: "true"
|
|
525
|
+
}),
|
|
526
|
+
...history$1 ? [history(), keymap.of(historyKeymap)] : []
|
|
527
|
+
]) });
|
|
528
|
+
}, [
|
|
529
|
+
configuration,
|
|
530
|
+
readOnly,
|
|
531
|
+
history$1,
|
|
532
|
+
id,
|
|
533
|
+
ariaLabel,
|
|
534
|
+
ariaLabelledBy
|
|
535
|
+
]);
|
|
536
|
+
useLayoutEffect(() => {
|
|
537
|
+
const view = editor.current;
|
|
538
|
+
if (!view || value === view.state.doc.toString()) return;
|
|
539
|
+
view.dispatch({
|
|
540
|
+
changes: {
|
|
541
|
+
from: 0,
|
|
542
|
+
to: view.state.doc.length,
|
|
543
|
+
insert: value
|
|
544
|
+
},
|
|
545
|
+
annotations: [externalChange.of(true), Transaction.addToHistory.of(false)]
|
|
546
|
+
});
|
|
547
|
+
}, [value]);
|
|
548
|
+
return /* @__PURE__ */ jsx("div", {
|
|
549
|
+
...props,
|
|
550
|
+
ref: container,
|
|
551
|
+
className: cn("nesso-input nesso-markdown-input min-h-24 w-full overflow-y-auto border border-input bg-background px-2.5 py-2 focus-within:border-muted-foreground", className)
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
//#endregion
|
|
219
555
|
//#region src/label.tsx
|
|
220
556
|
function Label({ className, ...props }) {
|
|
221
557
|
return /* @__PURE__ */ jsx("label", {
|
|
@@ -1064,6 +1400,7 @@ const icons = {
|
|
|
1064
1400
|
"file-down": FileDown,
|
|
1065
1401
|
"file-up": FileUp,
|
|
1066
1402
|
folder: Folder,
|
|
1403
|
+
glasses: Glasses,
|
|
1067
1404
|
globe: Globe,
|
|
1068
1405
|
layers: Layers,
|
|
1069
1406
|
pencil: Pencil,
|
|
@@ -1085,4 +1422,4 @@ function ActionIcon({ name, ...props }) {
|
|
|
1085
1422
|
});
|
|
1086
1423
|
}
|
|
1087
1424
|
//#endregion
|
|
1088
|
-
export { ActionIcon, Autocomplete, AutocompleteClear, AutocompleteItem, AutocompletePopup, Banner, Button, Collapsible, ColorPicker, Combobox, ComboboxItem, ComboboxPopup, ConfirmDialog, ContextLabel, Dialog, DialogActions, DialogPopup, Field, FieldHint, IconButton, Input, Kbd, Label, ListRow, ListRowButton, ListRowDetail, ListRowTitle, Menu, MenuItem, MenuPopup, MenuRadioItem, PanelHeader, Popover, PopoverPopup, PreferenceSelect, PromptForm, RevealActions, SectionHeading, SidePanel, Spinner, Tabs, TextPromptDialog, ToastViewport, contrastColor, presetColors, useMediaQuery };
|
|
1425
|
+
export { ActionIcon, Autocomplete, AutocompleteClear, AutocompleteItem, AutocompletePopup, Banner, Button, Collapsible, ColorPicker, Combobox, ComboboxItem, ComboboxPopup, ConfirmDialog, ContextLabel, Dialog, DialogActions, DialogPopup, Field, FieldHint, IconButton, Input, Kbd, Label, ListRow, ListRowButton, ListRowDetail, ListRowTitle, MarkdownInput, Menu, MenuItem, MenuPopup, MenuRadioItem, PanelHeader, Popover, PopoverPopup, PreferenceSelect, PromptForm, RevealActions, SectionHeading, SidePanel, Spinner, Tabs, TextPromptDialog, ToastViewport, contrastColor, presetColors, useMediaQuery };
|
package/dist/styles.css
CHANGED
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
.nesso-input,
|
|
30
30
|
.nesso-option {
|
|
31
31
|
border-radius: var(--radius-control);
|
|
32
|
-
transition:
|
|
32
|
+
transition:
|
|
33
|
+
background-color var(--duration-state),
|
|
34
|
+
border-color var(--duration-state);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
.nesso-button:focus-visible,
|
|
@@ -42,6 +44,38 @@
|
|
|
42
44
|
outline: none;
|
|
43
45
|
}
|
|
44
46
|
|
|
47
|
+
.nesso-markdown-input {
|
|
48
|
+
display: flex;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.nesso-markdown-input .cm-editor {
|
|
52
|
+
flex: 1;
|
|
53
|
+
min-width: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.nesso-markdown-bold {
|
|
57
|
+
font-weight: 700;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.nesso-markdown-italic {
|
|
61
|
+
font-style: italic;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.nesso-markdown-link {
|
|
65
|
+
color: var(--primary);
|
|
66
|
+
text-decoration: underline;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.nesso-markdown-syntax {
|
|
70
|
+
color: var(--muted-foreground);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.nesso-markdown-list-marker {
|
|
74
|
+
display: inline-block;
|
|
75
|
+
min-width: var(--nesso-list-indent);
|
|
76
|
+
text-indent: 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
45
79
|
.nesso-popup {
|
|
46
80
|
border: 1px solid var(--border);
|
|
47
81
|
border-radius: var(--radius-object);
|
|
@@ -55,11 +89,37 @@
|
|
|
55
89
|
background: var(--hover);
|
|
56
90
|
}
|
|
57
91
|
|
|
58
|
-
.nesso-color-hue {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
92
|
+
.nesso-color-hue {
|
|
93
|
+
appearance: none;
|
|
94
|
+
background: transparent;
|
|
95
|
+
--hue-track: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
|
|
96
|
+
}
|
|
97
|
+
.nesso-color-hue::-webkit-slider-runnable-track {
|
|
98
|
+
height: 8px;
|
|
99
|
+
border-radius: 2px;
|
|
100
|
+
background: var(--hue-track);
|
|
101
|
+
}
|
|
102
|
+
.nesso-color-hue::-moz-range-track {
|
|
103
|
+
height: 8px;
|
|
104
|
+
border-radius: 2px;
|
|
105
|
+
background: var(--hue-track);
|
|
106
|
+
}
|
|
107
|
+
.nesso-color-hue::-webkit-slider-thumb {
|
|
108
|
+
appearance: none;
|
|
109
|
+
width: 12px;
|
|
110
|
+
height: 12px;
|
|
111
|
+
margin-top: -2px;
|
|
112
|
+
border: 1px solid var(--primary);
|
|
113
|
+
border-radius: 50%;
|
|
114
|
+
background: var(--background);
|
|
115
|
+
}
|
|
116
|
+
.nesso-color-hue::-moz-range-thumb {
|
|
117
|
+
width: 10px;
|
|
118
|
+
height: 10px;
|
|
119
|
+
border: 1px solid var(--primary);
|
|
120
|
+
border-radius: 50%;
|
|
121
|
+
background: var(--background);
|
|
122
|
+
}
|
|
63
123
|
|
|
64
124
|
@media (pointer: coarse) {
|
|
65
125
|
.nesso-button,
|
|
@@ -72,48 +132,183 @@
|
|
|
72
132
|
}
|
|
73
133
|
|
|
74
134
|
@layer components {
|
|
75
|
-
.nesso-panel-header {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
.side-panel
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
.panel-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
.panel-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
.panel
|
|
115
|
-
|
|
116
|
-
|
|
135
|
+
.nesso-panel-header {
|
|
136
|
+
display: flex;
|
|
137
|
+
flex-shrink: 0;
|
|
138
|
+
align-items: center;
|
|
139
|
+
justify-content: space-between;
|
|
140
|
+
gap: 12px;
|
|
141
|
+
height: 49px;
|
|
142
|
+
padding: 0 14px 0 20px;
|
|
143
|
+
border-bottom: 1px solid var(--border);
|
|
144
|
+
}
|
|
145
|
+
.nesso-panel-actions {
|
|
146
|
+
display: flex;
|
|
147
|
+
flex-shrink: 0;
|
|
148
|
+
gap: 2px;
|
|
149
|
+
color: var(--muted-foreground);
|
|
150
|
+
}
|
|
151
|
+
.nesso-panel-actions button {
|
|
152
|
+
width: 26px;
|
|
153
|
+
height: 28px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.side-panel {
|
|
157
|
+
position: relative;
|
|
158
|
+
flex-shrink: 0;
|
|
159
|
+
width: var(--panel-size);
|
|
160
|
+
height: 100%;
|
|
161
|
+
transition: width var(--duration-state) linear;
|
|
162
|
+
}
|
|
163
|
+
.side-panel[data-open='false'] {
|
|
164
|
+
width: 0;
|
|
165
|
+
}
|
|
166
|
+
.side-panel-content {
|
|
167
|
+
position: absolute;
|
|
168
|
+
inset-block: 0;
|
|
169
|
+
width: var(--panel-size);
|
|
170
|
+
overflow: hidden;
|
|
171
|
+
background: var(--background);
|
|
172
|
+
transition: transform var(--duration-state) linear;
|
|
173
|
+
}
|
|
174
|
+
.side-panel[data-side='left'] > .side-panel-content {
|
|
175
|
+
left: 0;
|
|
176
|
+
border-right: 1px solid var(--border);
|
|
177
|
+
}
|
|
178
|
+
.side-panel[data-side='right'] > .side-panel-content {
|
|
179
|
+
right: 0;
|
|
180
|
+
border-left: 1px solid var(--border);
|
|
181
|
+
}
|
|
182
|
+
.side-panel[data-side='left'][data-open='false'] > .side-panel-content {
|
|
183
|
+
transform: translateX(-100%);
|
|
184
|
+
}
|
|
185
|
+
.side-panel[data-side='right'][data-open='false'] > .side-panel-content {
|
|
186
|
+
transform: translateX(100%);
|
|
187
|
+
}
|
|
188
|
+
.side-panel > .panel-toggle {
|
|
189
|
+
position: absolute;
|
|
190
|
+
z-index: 30;
|
|
191
|
+
top: 50%;
|
|
192
|
+
}
|
|
193
|
+
.side-panel[data-side='left'] > .panel-toggle {
|
|
194
|
+
left: 100%;
|
|
195
|
+
translate: -50% -50%;
|
|
196
|
+
}
|
|
197
|
+
.side-panel[data-side='right'] > .panel-toggle {
|
|
198
|
+
right: 100%;
|
|
199
|
+
translate: 50% -50%;
|
|
200
|
+
}
|
|
201
|
+
.side-panel[data-open='false'] > .panel-toggle {
|
|
202
|
+
translate: 0 -50%;
|
|
203
|
+
}
|
|
204
|
+
.side-panel-resize {
|
|
205
|
+
position: absolute;
|
|
206
|
+
z-index: 20;
|
|
207
|
+
inset-block: 0;
|
|
208
|
+
width: 9px;
|
|
209
|
+
cursor: col-resize;
|
|
210
|
+
touch-action: none;
|
|
211
|
+
}
|
|
212
|
+
.side-panel-resize:focus-visible {
|
|
213
|
+
outline: 2px solid var(--ring);
|
|
214
|
+
outline-offset: -4px;
|
|
215
|
+
}
|
|
216
|
+
.side-panel[data-side='left'] > .side-panel-resize {
|
|
217
|
+
right: -4px;
|
|
218
|
+
}
|
|
219
|
+
.side-panel[data-side='right'] > .side-panel-resize {
|
|
220
|
+
left: -4px;
|
|
221
|
+
}
|
|
222
|
+
.side-panel[data-open='false'] > .side-panel-resize {
|
|
223
|
+
display: none;
|
|
224
|
+
}
|
|
225
|
+
.side-panel[data-resizing] {
|
|
226
|
+
user-select: none;
|
|
227
|
+
}
|
|
228
|
+
.side-panel[data-resizing],
|
|
229
|
+
.side-panel[data-resizing] > .side-panel-content {
|
|
230
|
+
transition: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.panel-toggle {
|
|
234
|
+
position: relative;
|
|
235
|
+
isolation: isolate;
|
|
236
|
+
display: grid;
|
|
237
|
+
place-items: center;
|
|
238
|
+
width: 28px;
|
|
239
|
+
height: 52px;
|
|
240
|
+
flex-shrink: 0;
|
|
241
|
+
padding: 0;
|
|
242
|
+
border: 0;
|
|
243
|
+
color: color-mix(in srgb, var(--foreground) 70%, var(--muted-foreground));
|
|
244
|
+
background: transparent;
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
}
|
|
247
|
+
.panel-toggle::before {
|
|
248
|
+
content: '';
|
|
249
|
+
position: absolute;
|
|
250
|
+
z-index: -1;
|
|
251
|
+
inset: 10px 6px;
|
|
252
|
+
border-radius: var(--radius-control);
|
|
253
|
+
background: var(--background);
|
|
254
|
+
box-shadow:
|
|
255
|
+
0 1px 3px #00000014,
|
|
256
|
+
0 0 0 1px var(--border);
|
|
257
|
+
}
|
|
258
|
+
.panel-toggle svg {
|
|
259
|
+
width: 13px;
|
|
260
|
+
height: 13px;
|
|
261
|
+
stroke-width: 2;
|
|
262
|
+
pointer-events: none;
|
|
263
|
+
}
|
|
264
|
+
.panel-toggle:hover {
|
|
265
|
+
color: var(--foreground);
|
|
266
|
+
}
|
|
267
|
+
.panel-toggle:hover::before {
|
|
268
|
+
background: linear-gradient(var(--hover), var(--hover)), var(--background);
|
|
269
|
+
}
|
|
270
|
+
.panel-toggle:focus-visible {
|
|
271
|
+
outline: 2px solid var(--ring);
|
|
272
|
+
outline-offset: -2px;
|
|
273
|
+
border-radius: var(--radius-control);
|
|
274
|
+
}
|
|
275
|
+
.panel-toggle[data-side='left'][aria-expanded='false'] {
|
|
276
|
+
padding-right: 6px;
|
|
277
|
+
}
|
|
278
|
+
.panel-toggle[data-side='left'][aria-expanded='false']::before {
|
|
279
|
+
inset: 10px 6px 10px 0;
|
|
280
|
+
border-radius: 0 var(--radius-control) var(--radius-control) 0;
|
|
281
|
+
}
|
|
282
|
+
.panel-toggle[data-side='right'][aria-expanded='false'] {
|
|
283
|
+
padding-left: 6px;
|
|
284
|
+
}
|
|
285
|
+
.panel-toggle[data-side='right'][aria-expanded='false']::before {
|
|
286
|
+
inset: 10px 0 10px 6px;
|
|
287
|
+
border-radius: var(--radius-control) 0 0 var(--radius-control);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
@media (pointer: coarse) {
|
|
291
|
+
.panel-toggle {
|
|
292
|
+
width: 44px;
|
|
293
|
+
}
|
|
294
|
+
.panel-toggle::before {
|
|
295
|
+
inset-inline: 14px;
|
|
296
|
+
}
|
|
297
|
+
.panel-toggle[data-side='left'][aria-expanded='false'] {
|
|
298
|
+
padding-right: 22px;
|
|
299
|
+
}
|
|
300
|
+
.panel-toggle[data-side='left'][aria-expanded='false']::before {
|
|
301
|
+
right: 22px;
|
|
302
|
+
left: 0;
|
|
303
|
+
}
|
|
304
|
+
.panel-toggle[data-side='right'][aria-expanded='false'] {
|
|
305
|
+
padding-left: 22px;
|
|
306
|
+
}
|
|
307
|
+
.panel-toggle[data-side='right'][aria-expanded='false']::before {
|
|
308
|
+
left: 22px;
|
|
309
|
+
right: 0;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
117
312
|
}
|
|
118
313
|
|
|
119
314
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -125,13 +320,38 @@
|
|
|
125
320
|
}
|
|
126
321
|
}
|
|
127
322
|
|
|
128
|
-
.nesso-spinner {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
323
|
+
.nesso-spinner {
|
|
324
|
+
display: grid;
|
|
325
|
+
grid-template-columns: repeat(2, 8px);
|
|
326
|
+
gap: 4px;
|
|
327
|
+
}
|
|
328
|
+
.nesso-spinner > span {
|
|
329
|
+
width: 8px;
|
|
330
|
+
height: 8px;
|
|
331
|
+
background: currentColor;
|
|
332
|
+
opacity: 0.25;
|
|
333
|
+
animation: nesso-spinner-pulse 1.2s ease-in-out infinite;
|
|
334
|
+
}
|
|
335
|
+
.nesso-spinner > span:nth-child(2) {
|
|
336
|
+
animation-delay: -0.9s;
|
|
337
|
+
}
|
|
338
|
+
.nesso-spinner > span:nth-child(3) {
|
|
339
|
+
animation-delay: -0.3s;
|
|
340
|
+
}
|
|
341
|
+
.nesso-spinner > span:nth-child(4) {
|
|
342
|
+
animation-delay: -0.6s;
|
|
343
|
+
}
|
|
133
344
|
|
|
134
|
-
@keyframes nesso-spinner-pulse {
|
|
345
|
+
@keyframes nesso-spinner-pulse {
|
|
346
|
+
0%,
|
|
347
|
+
60%,
|
|
348
|
+
100% {
|
|
349
|
+
opacity: 0.25;
|
|
350
|
+
}
|
|
351
|
+
30% {
|
|
352
|
+
opacity: 1;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
135
355
|
|
|
136
356
|
.toast-viewport {
|
|
137
357
|
position: fixed;
|
|
@@ -151,8 +371,19 @@
|
|
|
151
371
|
display: none;
|
|
152
372
|
}
|
|
153
373
|
|
|
154
|
-
.toast-stack {
|
|
155
|
-
|
|
374
|
+
.toast-stack {
|
|
375
|
+
display: flex;
|
|
376
|
+
flex-direction: column-reverse;
|
|
377
|
+
gap: 8px;
|
|
378
|
+
}
|
|
379
|
+
.toast-queue {
|
|
380
|
+
margin: 0 0 8px;
|
|
381
|
+
text-align: center;
|
|
382
|
+
color: var(--muted-foreground);
|
|
383
|
+
font-family: var(--font-mono);
|
|
384
|
+
font-size: 10px;
|
|
385
|
+
line-height: 16px;
|
|
386
|
+
}
|
|
156
387
|
|
|
157
388
|
.nesso-toast {
|
|
158
389
|
position: relative;
|
|
@@ -172,40 +403,158 @@
|
|
|
172
403
|
animation: toast-enter 180ms ease-out both;
|
|
173
404
|
}
|
|
174
405
|
|
|
175
|
-
.nesso-toast[data-tone='warning'] {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
.toast-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
.toast-
|
|
183
|
-
|
|
184
|
-
|
|
406
|
+
.nesso-toast[data-tone='warning'] {
|
|
407
|
+
border-color: var(--node-border);
|
|
408
|
+
}
|
|
409
|
+
.nesso-toast[data-leaving] {
|
|
410
|
+
animation: toast-exit 140ms ease-in both;
|
|
411
|
+
pointer-events: none;
|
|
412
|
+
}
|
|
413
|
+
.toast-icon {
|
|
414
|
+
width: 16px;
|
|
415
|
+
height: 16px;
|
|
416
|
+
flex-shrink: 0;
|
|
417
|
+
margin-top: 1px;
|
|
418
|
+
stroke-width: 1.5;
|
|
419
|
+
}
|
|
420
|
+
.toast-content {
|
|
421
|
+
min-width: 0;
|
|
422
|
+
flex: 1;
|
|
423
|
+
overflow-wrap: anywhere;
|
|
424
|
+
}
|
|
425
|
+
.toast-label {
|
|
426
|
+
display: block;
|
|
427
|
+
color: var(--muted-foreground);
|
|
428
|
+
font-family: var(--font-mono);
|
|
429
|
+
font-size: 10px;
|
|
430
|
+
line-height: 16px;
|
|
431
|
+
}
|
|
432
|
+
.toast-title {
|
|
433
|
+
margin: 4px 0 0;
|
|
434
|
+
font-size: 13px;
|
|
435
|
+
font-weight: 500;
|
|
436
|
+
line-height: 19px;
|
|
437
|
+
}
|
|
438
|
+
.toast-description {
|
|
439
|
+
margin: 4px 0 0;
|
|
440
|
+
color: var(--muted-foreground);
|
|
441
|
+
font-size: 12px;
|
|
442
|
+
line-height: 18px;
|
|
443
|
+
}
|
|
444
|
+
.toast-actions {
|
|
445
|
+
display: flex;
|
|
446
|
+
flex-basis: 100%;
|
|
447
|
+
flex-wrap: wrap;
|
|
448
|
+
justify-content: flex-end;
|
|
449
|
+
gap: 6px;
|
|
450
|
+
margin-top: 2px;
|
|
451
|
+
}
|
|
452
|
+
.toast-close {
|
|
453
|
+
flex-shrink: 0;
|
|
454
|
+
margin: -6px -6px 0 0;
|
|
455
|
+
color: var(--muted-foreground);
|
|
456
|
+
}
|
|
457
|
+
.toast-progress {
|
|
458
|
+
position: absolute;
|
|
459
|
+
inset: auto 0 0;
|
|
460
|
+
height: 2px;
|
|
461
|
+
background: var(--foreground);
|
|
462
|
+
opacity: 0.2;
|
|
463
|
+
transform-origin: left;
|
|
464
|
+
animation: toast-progress var(--toast-duration) linear forwards;
|
|
465
|
+
}
|
|
185
466
|
|
|
186
|
-
@keyframes toast-enter {
|
|
187
|
-
|
|
188
|
-
|
|
467
|
+
@keyframes toast-enter {
|
|
468
|
+
from {
|
|
469
|
+
opacity: 0;
|
|
470
|
+
transform: translateY(6px);
|
|
471
|
+
}
|
|
472
|
+
to {
|
|
473
|
+
opacity: 1;
|
|
474
|
+
transform: translateY(0);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
@keyframes toast-exit {
|
|
478
|
+
from {
|
|
479
|
+
opacity: 1;
|
|
480
|
+
transform: translateY(0);
|
|
481
|
+
}
|
|
482
|
+
to {
|
|
483
|
+
opacity: 0;
|
|
484
|
+
transform: translateY(4px);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
@keyframes toast-progress {
|
|
488
|
+
from {
|
|
489
|
+
transform: scaleX(1);
|
|
490
|
+
}
|
|
491
|
+
to {
|
|
492
|
+
transform: scaleX(0);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
189
495
|
|
|
190
496
|
@media (max-width: 640px) {
|
|
191
|
-
.toast-viewport {
|
|
192
|
-
|
|
497
|
+
.toast-viewport {
|
|
498
|
+
width: calc(100% - 24px);
|
|
499
|
+
bottom: max(76px, env(safe-area-inset-bottom));
|
|
500
|
+
max-height: calc(100% - 104px);
|
|
501
|
+
}
|
|
502
|
+
.toast-viewport {
|
|
503
|
+
left: 12px;
|
|
504
|
+
right: 12px;
|
|
505
|
+
transform: none;
|
|
506
|
+
}
|
|
193
507
|
}
|
|
194
508
|
|
|
195
509
|
@media (prefers-reduced-motion: reduce) {
|
|
196
|
-
.nesso-spinner > span {
|
|
197
|
-
|
|
198
|
-
|
|
510
|
+
.nesso-spinner > span {
|
|
511
|
+
animation: none;
|
|
512
|
+
opacity: 0.65;
|
|
513
|
+
}
|
|
514
|
+
.nesso-toast {
|
|
515
|
+
animation: none;
|
|
516
|
+
}
|
|
517
|
+
.toast-progress {
|
|
518
|
+
display: none;
|
|
519
|
+
}
|
|
199
520
|
}
|
|
200
521
|
|
|
201
|
-
.nesso-button,
|
|
202
|
-
.nesso-
|
|
522
|
+
.nesso-button,
|
|
523
|
+
.nesso-input,
|
|
524
|
+
.nesso-option {
|
|
525
|
+
font-size: 13px;
|
|
526
|
+
line-height: 20px;
|
|
527
|
+
}
|
|
528
|
+
.nesso-section-heading {
|
|
529
|
+
font-size: 11px;
|
|
530
|
+
line-height: 16px;
|
|
531
|
+
}
|
|
203
532
|
|
|
204
|
-
.nesso-field {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
533
|
+
.nesso-field {
|
|
534
|
+
display: grid;
|
|
535
|
+
grid-template-columns: minmax(100px, 1fr) minmax(160px, 236px);
|
|
536
|
+
align-items: center;
|
|
537
|
+
gap: 16px;
|
|
538
|
+
}
|
|
539
|
+
.nesso-field > button:disabled {
|
|
540
|
+
opacity: 1;
|
|
541
|
+
color: var(--muted-foreground);
|
|
542
|
+
background: var(--canvas);
|
|
543
|
+
}
|
|
544
|
+
.nesso-field > label {
|
|
545
|
+
font-size: 12px;
|
|
546
|
+
}
|
|
547
|
+
.nesso-field-hint {
|
|
548
|
+
margin-top: 6px;
|
|
549
|
+
color: var(--muted-foreground);
|
|
550
|
+
font-size: 11px;
|
|
551
|
+
line-height: 16px;
|
|
552
|
+
min-height: 16px;
|
|
553
|
+
}
|
|
208
554
|
|
|
209
555
|
@media (max-width: 640px) {
|
|
210
|
-
.nesso-field {
|
|
556
|
+
.nesso-field {
|
|
557
|
+
grid-template-columns: minmax(90px, 1fr) minmax(140px, 1.3fr);
|
|
558
|
+
gap: 12px;
|
|
559
|
+
}
|
|
211
560
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nesso-how/ui",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.33",
|
|
4
4
|
"description": "Reusable React primitives and shared styles for Nesso, usable in the app and in isolated plugin panels",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"url": "git+https://github.com/nesso-how/nesso.git",
|
|
9
9
|
"directory": "packages/ui"
|
|
10
10
|
},
|
|
11
|
-
"type": "module",
|
|
12
|
-
"sideEffects": false,
|
|
13
11
|
"files": [
|
|
14
12
|
"dist"
|
|
15
13
|
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"sideEffects": false,
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
@@ -26,18 +26,22 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@base-ui/react": "^1.8.0",
|
|
29
|
+
"@codemirror/commands": "^6.11.1",
|
|
30
|
+
"@codemirror/state": "^6.7.6",
|
|
31
|
+
"@codemirror/view": "^6.43.15",
|
|
32
|
+
"@lezer/markdown": "^1.8.1",
|
|
29
33
|
"class-variance-authority": "^0.7.1",
|
|
30
34
|
"cn": "^0.4.0",
|
|
31
35
|
"lucide-react": "^1.48.0"
|
|
32
36
|
},
|
|
33
|
-
"peerDependencies": {
|
|
34
|
-
"react": "^19.2.8",
|
|
35
|
-
"react-dom": "^19.2.8"
|
|
36
|
-
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/react": "^19.2.18",
|
|
39
39
|
"tsdown": "^0.23.1"
|
|
40
40
|
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": "^19.2.8",
|
|
43
|
+
"react-dom": "^19.2.8"
|
|
44
|
+
},
|
|
41
45
|
"scripts": {
|
|
42
46
|
"build": "tsc -p tsconfig.json && tsdown"
|
|
43
47
|
}
|