@nesso-how/ui 1.0.0-beta.2 → 1.0.0-beta.22
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 +9 -5
- package/dist/index.d.ts +37 -29
- package/dist/index.js +300 -84
- package/dist/styles.css +101 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,19 +39,23 @@ Your build must compile this CSS; it is not a precompiled stylesheet. Supply the
|
|
|
39
39
|
|
|
40
40
|
| Area | Exports |
|
|
41
41
|
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
42
|
-
| Buttons and inputs | `Button`, `IconButton`, `Input`, `MarkdownInput`, `Label`, `PreferenceSelect`, `ColorPicker`
|
|
42
|
+
| Buttons and inputs | `Button`, `IconButton`, `Input`, `DirectoryField`, `MarkdownInput`, `Label`, `PreferenceSelect`, `ColorPicker` |
|
|
43
43
|
| Forms and rows | `Field`, `FieldHint`, `ListRow`, `ListRowButton`, `ListRowDetail`, `ListRowTitle`, `RevealActions`, `PromptForm` |
|
|
44
44
|
| Menus and popovers | `Menu`, `MenuItem`, `MenuPopup`, `MenuRadioItem`, `Popover`, `PopoverPopup` |
|
|
45
45
|
| Search and suggestions | `Combobox`, `ComboboxItem`, `ComboboxPopup`, `Autocomplete`, `AutocompleteClear`, `AutocompleteItem`, `AutocompletePopup` |
|
|
46
|
-
| Dialogs | `Dialog`, `DialogActions`, `DialogPopup`, `ConfirmDialog`, `TextPromptDialog`
|
|
46
|
+
| Dialogs | `Dialog`, `DialogActions`, `DialogPopup`, `ConfirmDialog`, `TextPromptDialog`, `BottomSheet` |
|
|
47
47
|
| Panels and disclosure | `SidePanel`, `PanelHeader`, `PluginPage`, `PluginContent`, `SectionHeading`, `Collapsible`, `Tabs` |
|
|
48
48
|
| Feedback | `Banner`, `BannerRow`, `BannerDetails`, `ToastViewport`, `Spinner` |
|
|
49
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
|
-
`
|
|
53
|
+
`BottomSheet` is a controlled, non-modal drawer with a title, close label, optional footer, and popup ref for measuring covered content. It supports swipe-down dismissal, safe-area padding, and reduced motion. Reading text can use `--nesso-reading-font-size` and `--nesso-reading-line-height`, which increase from 13/20px to 15/23px on narrow screens or coarse pointers.
|
|
54
54
|
|
|
55
|
-
`MarkdownInput`
|
|
55
|
+
`MarkdownInput` accepts Markdown through `value`/`onChange`, with live preview of emphasis, inline code, links, and lists. Syntax reappears around the selection. Cmd/Ctrl+B/I/E toggles bold, italic, and inline code; Enter continues or exits lists, Tab/Shift+Tab changes nesting, and Shift+Enter inserts a line break. Optional `tasks` enables clickable task checkboxes; `placeholder` appears when empty.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
Undo/redo is local by default. Use `history={false}` for host-owned history or `history="focus"` to reset local history on blur and external value changes. Exhausted local history never falls through. Menu commands can send `beforeinput` events (`historyUndo`/`historyRedo`) to the focused editor inside `[data-local-history]`.
|
|
58
|
+
|
|
59
|
+
Cmd/Ctrl-click calls `onOpenLink`; read-only fields use a regular click. The host validates and opens destinations.
|
|
60
|
+
|
|
61
|
+
The package also exports `useMediaQuery`, `conceptColor`, 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
|
-
import { ButtonHTMLAttributes, ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
3
|
+
import { ButtonHTMLAttributes, ComponentProps, HTMLAttributes, ReactNode, Ref } from "react";
|
|
4
4
|
import { LucideIcon, Zap } from "lucide-react";
|
|
5
5
|
import { Dialog, Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
6
6
|
import { Combobox } from "@base-ui/react/combobox";
|
|
@@ -55,16 +55,33 @@ export declare function useMediaQuery(query: string): boolean;
|
|
|
55
55
|
//#region src/input.d.ts
|
|
56
56
|
declare function Input({ className, type, ...props }: ComponentProps<'input'>): import("react").JSX.Element;
|
|
57
57
|
//#endregion
|
|
58
|
+
//#region src/directory-field.d.ts
|
|
59
|
+
export declare function DirectoryField({ label, value, labels, disabled, changeDisabled, onOpen, onChange, onRestore }: {
|
|
60
|
+
label: string;
|
|
61
|
+
value?: string;
|
|
62
|
+
labels: {
|
|
63
|
+
open: string;
|
|
64
|
+
change: string;
|
|
65
|
+
restore: string;
|
|
66
|
+
};
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
changeDisabled?: boolean;
|
|
69
|
+
onOpen: () => void;
|
|
70
|
+
onChange: () => void;
|
|
71
|
+
onRestore?: () => void;
|
|
72
|
+
}): import("react").JSX.Element;
|
|
73
|
+
//#endregion
|
|
58
74
|
//#region src/markdown-input.d.ts
|
|
59
75
|
type MarkdownInputProps = Omit<ComponentProps<'div'>, 'onChange' | 'children' | 'defaultValue'> & {
|
|
60
76
|
value: string;
|
|
61
77
|
onChange: (value: string) => void;
|
|
62
78
|
readOnly?: boolean;
|
|
63
|
-
history?: boolean;
|
|
79
|
+
history?: boolean | 'focus';
|
|
80
|
+
tasks?: boolean;
|
|
64
81
|
onOpenLink?: (url: string) => void;
|
|
65
82
|
placeholder?: string;
|
|
66
83
|
};
|
|
67
|
-
export declare function MarkdownInput({ value, onChange, readOnly, history, onOpenLink, placeholder, className, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...props }: MarkdownInputProps): import("react").JSX.Element;
|
|
84
|
+
export declare function MarkdownInput({ value, onChange, readOnly, history, tasks, onOpenLink, placeholder, className, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...props }: MarkdownInputProps): import("react").JSX.Element;
|
|
68
85
|
//#endregion
|
|
69
86
|
//#region src/label.d.ts
|
|
70
87
|
declare function Label({ className, ...props }: ComponentProps<'label'>): import("react").JSX.Element;
|
|
@@ -140,6 +157,18 @@ export declare function ConfirmDialog({ open, onOpenChange, title, description,
|
|
|
140
157
|
children?: ReactNode;
|
|
141
158
|
}): import("react").JSX.Element;
|
|
142
159
|
//#endregion
|
|
160
|
+
//#region src/sheet.d.ts
|
|
161
|
+
export declare function BottomSheet({ open, onOpenChange, title, closeLabel, popupRef, footer, className, children }: {
|
|
162
|
+
open: boolean;
|
|
163
|
+
onOpenChange: (open: boolean) => void;
|
|
164
|
+
title: ReactNode;
|
|
165
|
+
closeLabel: string;
|
|
166
|
+
popupRef?: Ref<HTMLDivElement>;
|
|
167
|
+
footer?: ReactNode;
|
|
168
|
+
className?: string;
|
|
169
|
+
children: ReactNode;
|
|
170
|
+
}): import("react").JSX.Element;
|
|
171
|
+
//#endregion
|
|
143
172
|
//#region src/prompt.d.ts
|
|
144
173
|
export declare function PromptForm({ initialValue, nameLabel, submitLabel, cancelLabel, maxLength, onSubmit }: {
|
|
145
174
|
initialValue?: string;
|
|
@@ -218,6 +247,7 @@ export declare function ColorPicker({ value: color, onValueChange, onCopyError,
|
|
|
218
247
|
presets: readonly {
|
|
219
248
|
label: string;
|
|
220
249
|
value: string;
|
|
250
|
+
color: string;
|
|
221
251
|
}[];
|
|
222
252
|
disabled?: boolean;
|
|
223
253
|
inputProps?: ComponentProps<'input'> & {
|
|
@@ -226,32 +256,10 @@ export declare function ColorPicker({ value: color, onValueChange, onCopyError,
|
|
|
226
256
|
}): import("react").JSX.Element;
|
|
227
257
|
//#endregion
|
|
228
258
|
//#region src/color.d.ts
|
|
229
|
-
export declare const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}, {
|
|
234
|
-
readonly key: 'presetSand';
|
|
235
|
-
readonly value: '#f3ead5';
|
|
236
|
-
}, {
|
|
237
|
-
readonly key: 'presetPeach';
|
|
238
|
-
readonly value: '#f5e3d5';
|
|
239
|
-
}, {
|
|
240
|
-
readonly key: 'presetRose';
|
|
241
|
-
readonly value: '#f5dfe2';
|
|
242
|
-
}, {
|
|
243
|
-
readonly key: 'presetSage';
|
|
244
|
-
readonly value: '#e1ecde';
|
|
245
|
-
}, {
|
|
246
|
-
readonly key: 'presetMint';
|
|
247
|
-
readonly value: '#dceee8';
|
|
248
|
-
}, {
|
|
249
|
-
readonly key: 'presetSky';
|
|
250
|
-
readonly value: '#dfeaf5';
|
|
251
|
-
}, {
|
|
252
|
-
readonly key: 'presetLavender';
|
|
253
|
-
readonly value: '#e9e2f3';
|
|
254
|
-
}];
|
|
259
|
+
export declare const conceptColor: (value: string) => {
|
|
260
|
+
background: string;
|
|
261
|
+
color: string;
|
|
262
|
+
};
|
|
255
263
|
//#endregion
|
|
256
264
|
//#region src/combobox.d.ts
|
|
257
265
|
export declare function ComboboxPopup({ className, children, ...props }: Combobox.Popup.Props): import("react").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -5,11 +5,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
6
6
|
import { ArrowRight, BookOpen, Check, ChevronDown, ChevronLeft, ChevronRight, CircleHelp, ClipboardPaste, Copy, Download, FileDown, FileUp, Folder, Glasses, Globe, Info, Layers, Minus, Pencil, Play, Plus, RefreshCw, Repeat, 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";
|
|
8
|
+
import { Annotation, Compartment, EditorSelection, EditorState, Facet, Transaction } from "@codemirror/state";
|
|
9
9
|
import { Decoration, EditorView, ViewPlugin, WidgetType, keymap, placeholder } from "@codemirror/view";
|
|
10
|
-
import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
|
|
11
|
-
import { parser } from "@lezer/markdown";
|
|
10
|
+
import { defaultKeymap, history, historyKeymap, redo } from "@codemirror/commands";
|
|
11
|
+
import { TaskList, parser } from "@lezer/markdown";
|
|
12
12
|
import { Dialog, Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
13
|
+
import { Drawer } from "@base-ui/react/drawer";
|
|
13
14
|
import { Combobox } from "@base-ui/react/combobox";
|
|
14
15
|
import { Menu } from "@base-ui/react/menu";
|
|
15
16
|
import { Popover } from "@base-ui/react/popover";
|
|
@@ -236,27 +237,166 @@ function Input({ className, type, ...props }) {
|
|
|
236
237
|
});
|
|
237
238
|
}
|
|
238
239
|
//#endregion
|
|
240
|
+
//#region src/directory-field.tsx
|
|
241
|
+
function DirectoryField({ label, value, labels, disabled, changeDisabled, onOpen, onChange, onRestore }) {
|
|
242
|
+
const id = useId();
|
|
243
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
244
|
+
className: "mt-4",
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsx("label", {
|
|
247
|
+
htmlFor: id,
|
|
248
|
+
className: "block text-xs",
|
|
249
|
+
children: label
|
|
250
|
+
}),
|
|
251
|
+
/* @__PURE__ */ jsxs("div", {
|
|
252
|
+
className: "mt-2 flex items-center gap-2",
|
|
253
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
254
|
+
className: "relative min-w-0 flex-1",
|
|
255
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
256
|
+
id,
|
|
257
|
+
className: "pr-10",
|
|
258
|
+
readOnly: true,
|
|
259
|
+
value: value ?? "",
|
|
260
|
+
title: value
|
|
261
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
262
|
+
className: "absolute top-1/2 right-1 -translate-y-1/2 text-muted-foreground",
|
|
263
|
+
"aria-label": labels.open,
|
|
264
|
+
title: labels.open,
|
|
265
|
+
disabled,
|
|
266
|
+
onClick: onOpen,
|
|
267
|
+
children: /* @__PURE__ */ jsx(Folder, { "aria-hidden": "true" })
|
|
268
|
+
})]
|
|
269
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
270
|
+
variant: "outline",
|
|
271
|
+
disabled: disabled || changeDisabled,
|
|
272
|
+
onClick: onChange,
|
|
273
|
+
children: labels.change
|
|
274
|
+
})]
|
|
275
|
+
}),
|
|
276
|
+
onRestore && /* @__PURE__ */ jsxs(Button, {
|
|
277
|
+
variant: "ghost",
|
|
278
|
+
size: "sm",
|
|
279
|
+
className: "mt-2",
|
|
280
|
+
disabled: disabled || changeDisabled,
|
|
281
|
+
onClick: onRestore,
|
|
282
|
+
children: [/* @__PURE__ */ jsx(RotateCcw, { "aria-hidden": "true" }), labels.restore]
|
|
283
|
+
})
|
|
284
|
+
]
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
//#endregion
|
|
239
288
|
//#region src/markdown.ts
|
|
240
289
|
const listPrefix = /^(\s*)([-+*]|(\d{1,9})([.)]))([\t ]+|$)/;
|
|
290
|
+
const taskPrefix = /^\[[ xX]\]([\t ]+|$)/;
|
|
291
|
+
const taskParser = parser.configure(TaskList);
|
|
292
|
+
const formats = {
|
|
293
|
+
"**": {
|
|
294
|
+
node: "StrongEmphasis",
|
|
295
|
+
mark: "EmphasisMark",
|
|
296
|
+
decoration: Decoration.mark({ class: "nesso-markdown-bold" })
|
|
297
|
+
},
|
|
298
|
+
"*": {
|
|
299
|
+
node: "Emphasis",
|
|
300
|
+
mark: "EmphasisMark",
|
|
301
|
+
decoration: Decoration.mark({ class: "nesso-markdown-italic" })
|
|
302
|
+
},
|
|
303
|
+
"`": {
|
|
304
|
+
node: "InlineCode",
|
|
305
|
+
mark: "CodeMark",
|
|
306
|
+
decoration: Decoration.mark({
|
|
307
|
+
class: "nesso-markdown-code",
|
|
308
|
+
attributes: { spellcheck: "false" }
|
|
309
|
+
})
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
const markdownTasks = Facet.define({ combine: (values) => values.some(Boolean) });
|
|
313
|
+
const parse = (state) => (state.facet(markdownTasks) ? taskParser : parser).parse(state.doc.toString());
|
|
241
314
|
var ListMarker = class extends WidgetType {
|
|
242
315
|
label;
|
|
243
|
-
|
|
316
|
+
checked;
|
|
317
|
+
constructor(label, checked = null) {
|
|
244
318
|
super();
|
|
245
319
|
this.label = label;
|
|
320
|
+
this.checked = checked;
|
|
246
321
|
}
|
|
247
322
|
eq(other) {
|
|
248
|
-
return this.label === other.label;
|
|
323
|
+
return this.label === other.label && this.checked === other.checked;
|
|
249
324
|
}
|
|
250
325
|
toDOM(view) {
|
|
251
|
-
const
|
|
326
|
+
const document = view.dom.ownerDocument;
|
|
327
|
+
const marker = document.createElement("span");
|
|
252
328
|
marker.className = "nesso-markdown-list-marker";
|
|
253
329
|
marker.textContent = this.label;
|
|
330
|
+
if (this.label === "• ") {
|
|
331
|
+
const bullet = document.createElement("span");
|
|
332
|
+
bullet.className = "nesso-markdown-bullet";
|
|
333
|
+
bullet.textContent = "•";
|
|
334
|
+
marker.replaceChildren(bullet, document.createTextNode(" "));
|
|
335
|
+
}
|
|
336
|
+
if (this.checked !== null) {
|
|
337
|
+
const checkbox = document.createElement("input");
|
|
338
|
+
checkbox.type = "checkbox";
|
|
339
|
+
checkbox.className = "nesso-markdown-task";
|
|
340
|
+
checkbox.checked = this.checked;
|
|
341
|
+
checkbox.tabIndex = -1;
|
|
342
|
+
marker.append(checkbox);
|
|
343
|
+
}
|
|
254
344
|
return marker;
|
|
255
345
|
}
|
|
256
346
|
ignoreEvent() {
|
|
257
347
|
return false;
|
|
258
348
|
}
|
|
259
349
|
};
|
|
350
|
+
function markerWidth(item) {
|
|
351
|
+
const marker = item.getChild("ListMark");
|
|
352
|
+
const task = item.getChild("Task") ? 1.4 : 0;
|
|
353
|
+
return item.parent?.name === "BulletList" ? {
|
|
354
|
+
ch: 0,
|
|
355
|
+
em: task || 1
|
|
356
|
+
} : {
|
|
357
|
+
ch: marker.to - marker.from - 1,
|
|
358
|
+
em: .75 + task
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function markerLabel(state, item, checked) {
|
|
362
|
+
if (item.parent?.name !== "BulletList") {
|
|
363
|
+
const marker = item.getChild("ListMark");
|
|
364
|
+
return `${state.sliceDoc(marker.from, marker.to)} `;
|
|
365
|
+
}
|
|
366
|
+
return checked === null ? "• " : "";
|
|
367
|
+
}
|
|
368
|
+
function listPadding(item) {
|
|
369
|
+
const padding = {
|
|
370
|
+
ch: 0,
|
|
371
|
+
em: 0
|
|
372
|
+
};
|
|
373
|
+
for (let node = item; node; node = node.parent) {
|
|
374
|
+
if (node.name !== "ListItem") continue;
|
|
375
|
+
const width = markerWidth(node);
|
|
376
|
+
padding.ch += width.ch;
|
|
377
|
+
padding.em += width.em;
|
|
378
|
+
}
|
|
379
|
+
return padding;
|
|
380
|
+
}
|
|
381
|
+
function listItemDecorations(state, item, active) {
|
|
382
|
+
const marker = item.getChild("ListMark");
|
|
383
|
+
const task = item.getChild("Task");
|
|
384
|
+
const taskMarker = task?.getChild("TaskMarker");
|
|
385
|
+
const checked = taskMarker ? state.sliceDoc(taskMarker.from + 1, taskMarker.from + 2) !== " " : null;
|
|
386
|
+
const line = state.doc.lineAt(marker.from);
|
|
387
|
+
const from = /^[\t ]*$/.test(state.sliceDoc(line.from, marker.from)) ? line.from : marker.from;
|
|
388
|
+
const start = taskMarker?.to ?? marker.to;
|
|
389
|
+
const end = start + state.sliceDoc(start, line.to).match(/^[\t ]*/)[0].length;
|
|
390
|
+
const label = markerLabel(state, item, checked);
|
|
391
|
+
const width = markerWidth(item);
|
|
392
|
+
const padding = listPadding(item);
|
|
393
|
+
const decorations = [Decoration.line({
|
|
394
|
+
class: "nesso-markdown-list-item",
|
|
395
|
+
attributes: { style: `--nesso-list-indent: calc(${width.ch}ch + ${width.em}em); --nesso-list-padding: calc(var(--nesso-list-inset) + ${padding.ch}ch + ${padding.em}em)` }
|
|
396
|
+
}).range(line.from), (active ? Decoration.mark({ class: "nesso-markdown-syntax nesso-markdown-list-marker" }) : Decoration.replace({ widget: new ListMarker(label, checked) })).range(from, end)];
|
|
397
|
+
if (checked && task && end < task.to) decorations.push(Decoration.mark({ class: "nesso-markdown-task-done" }).range(end, task.to));
|
|
398
|
+
return decorations;
|
|
399
|
+
}
|
|
260
400
|
function markdownDecorations(state, focused) {
|
|
261
401
|
const source = state.doc.toString();
|
|
262
402
|
const decorations = [];
|
|
@@ -265,29 +405,19 @@ function markdownDecorations(state, focused) {
|
|
|
265
405
|
const decoration = active ? Decoration.mark({ class: "nesso-markdown-syntax" }) : Decoration.replace({});
|
|
266
406
|
decorations.push(decoration.range(from, to));
|
|
267
407
|
};
|
|
268
|
-
|
|
408
|
+
parse(state).iterate({ enter(node) {
|
|
269
409
|
if ([
|
|
270
410
|
"Image",
|
|
271
|
-
"InlineCode",
|
|
272
411
|
"FencedCode",
|
|
273
412
|
"CodeBlock",
|
|
274
413
|
"HTMLBlock"
|
|
275
414
|
].includes(node.name)) return false;
|
|
276
415
|
const active = focused && state.selection.ranges.some((range) => range.from <= node.to && range.to >= node.from);
|
|
277
|
-
if (node.name === "ListItem")
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
const width = Math.max(3, end - marker.from);
|
|
283
|
-
decorations.push(Decoration.line({
|
|
284
|
-
class: "nesso-markdown-list-item",
|
|
285
|
-
attributes: { style: `--nesso-list-indent: ${width}ch; --nesso-list-padding: ${marker.from - line.from + width}ch` }
|
|
286
|
-
}).range(line.from), (active ? Decoration.mark({ class: "nesso-markdown-syntax nesso-markdown-list-marker" }) : Decoration.replace({ widget: new ListMarker(`${label} `) })).range(marker.from, end));
|
|
287
|
-
}
|
|
288
|
-
if (node.name === "StrongEmphasis" || node.name === "Emphasis") {
|
|
289
|
-
const [open, close] = node.node.getChildren("EmphasisMark");
|
|
290
|
-
decorations.push(Decoration.mark({ class: node.name === "StrongEmphasis" ? "nesso-markdown-bold" : "nesso-markdown-italic" }).range(open.to, close.from));
|
|
416
|
+
if (node.name === "ListItem") decorations.push(...listItemDecorations(state, node.node, active));
|
|
417
|
+
const format = Object.values(formats).find((format) => format.node === node.name);
|
|
418
|
+
if (format) {
|
|
419
|
+
const [open, close] = node.node.getChildren(format.mark);
|
|
420
|
+
decorations.push(format.decoration.range(open.to, close.from));
|
|
291
421
|
syntax(open.from, open.to, active);
|
|
292
422
|
syntax(close.from, close.to, active);
|
|
293
423
|
}
|
|
@@ -309,7 +439,7 @@ function markdownListItem(state) {
|
|
|
309
439
|
if (state.readOnly || state.selection.ranges.length !== 1) return null;
|
|
310
440
|
const { from, to } = state.selection.main;
|
|
311
441
|
if (to > state.doc.lineAt(from).to) return null;
|
|
312
|
-
let node =
|
|
442
|
+
let node = parse(state).resolveInner(from, -1);
|
|
313
443
|
while (node.name !== "ListItem") {
|
|
314
444
|
if ([
|
|
315
445
|
"FencedCode",
|
|
@@ -377,12 +507,17 @@ function continueMarkdownList(state) {
|
|
|
377
507
|
if (!item) return null;
|
|
378
508
|
const { node, firstLine, prefix } = item;
|
|
379
509
|
let { from, to } = state.selection.main;
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
510
|
+
const task = state.facet(markdownTasks) ? firstLine.text.slice(prefix[0].length).match(taskPrefix)?.[0] ?? "" : "";
|
|
511
|
+
if (from < firstLine.from + prefix[0].length + task.length) return null;
|
|
512
|
+
const next = (prefix) => {
|
|
513
|
+
const marker = nextListPrefix(prefix);
|
|
514
|
+
return marker === null ? null : marker + (task && "[ ] ");
|
|
515
|
+
};
|
|
516
|
+
let insert = next(prefix);
|
|
517
|
+
if (state.doc.lineAt(from).from === firstLine.from && !firstLine.text.slice(prefix[0].length + task.length).trim()) {
|
|
383
518
|
const parent = node.parent?.parent;
|
|
384
519
|
const parentPrefix = parent?.name === "ListItem" ? state.doc.lineAt(parent.from).text.match(listPrefix) : null;
|
|
385
|
-
insert = parentPrefix ?
|
|
520
|
+
insert = parentPrefix ? next(parentPrefix) : "";
|
|
386
521
|
from = firstLine.from;
|
|
387
522
|
to = firstLine.to;
|
|
388
523
|
} else if (insert !== null) insert = `\n${insert}`;
|
|
@@ -397,14 +532,29 @@ function continueMarkdownList(state) {
|
|
|
397
532
|
userEvent: "input"
|
|
398
533
|
};
|
|
399
534
|
}
|
|
535
|
+
function toggleMarkdownTask(state, position) {
|
|
536
|
+
if (state.readOnly || !state.facet(markdownTasks)) return null;
|
|
537
|
+
const marker = parse(state).resolveInner(position, 1).parent?.getChild("Task")?.getChild("TaskMarker");
|
|
538
|
+
if (!marker) return null;
|
|
539
|
+
const from = marker.from + 1;
|
|
540
|
+
return {
|
|
541
|
+
changes: {
|
|
542
|
+
from,
|
|
543
|
+
to: from + 1,
|
|
544
|
+
insert: state.sliceDoc(from, from + 1) === " " ? "x" : " "
|
|
545
|
+
},
|
|
546
|
+
userEvent: "input.toggle"
|
|
547
|
+
};
|
|
548
|
+
}
|
|
400
549
|
function toggleMarkdownFormat(state, marker) {
|
|
401
550
|
if (state.readOnly) return null;
|
|
402
551
|
const { from, to } = state.selection.main;
|
|
403
552
|
const selected = state.sliceDoc(from, to);
|
|
553
|
+
const format = formats[marker];
|
|
404
554
|
let delimiters;
|
|
405
|
-
|
|
406
|
-
if (node.name !==
|
|
407
|
-
const [open, close] = node.node.getChildren(
|
|
555
|
+
parse(state).iterate({ enter(node) {
|
|
556
|
+
if (node.name !== format.node) return;
|
|
557
|
+
const [open, close] = node.node.getChildren(format.mark);
|
|
408
558
|
if (from === node.from && to === node.to || from >= open.to && to <= close.from) delimiters = [open, close].map(({ from, to }) => ({
|
|
409
559
|
from,
|
|
410
560
|
to
|
|
@@ -431,13 +581,32 @@ function toggleMarkdownFormat(state, marker) {
|
|
|
431
581
|
//#endregion
|
|
432
582
|
//#region src/markdown-input.tsx
|
|
433
583
|
const externalChange = Annotation.define();
|
|
584
|
+
const resetHistory = (view, compartment) => {
|
|
585
|
+
view.dispatch({ effects: compartment.reconfigure([]) });
|
|
586
|
+
view.dispatch({ effects: compartment.reconfigure(history()) });
|
|
587
|
+
};
|
|
434
588
|
const livePreview = ViewPlugin.define((view) => ({
|
|
435
589
|
decorations: markdownDecorations(view.state, view.hasFocus && !view.state.readOnly),
|
|
436
590
|
update(update) {
|
|
437
|
-
if (update.docChanged || update.selectionSet || update.focusChanged || update.startState.readOnly !== update.state.readOnly) this.decorations = markdownDecorations(update.state, update.view.hasFocus && !update.state.readOnly);
|
|
591
|
+
if (update.docChanged || update.selectionSet || update.focusChanged || update.startState.readOnly !== update.state.readOnly || update.startState.facet(markdownTasks) !== update.state.facet(markdownTasks)) this.decorations = markdownDecorations(update.state, update.view.hasFocus && !update.state.readOnly);
|
|
438
592
|
}
|
|
439
593
|
}), { decorations: (plugin) => plugin.decorations });
|
|
440
|
-
|
|
594
|
+
const taskCheckboxes = EditorView.domEventHandlers({
|
|
595
|
+
mousedown(event, view) {
|
|
596
|
+
const task = event.target.closest(".nesso-markdown-task");
|
|
597
|
+
if (!task) return false;
|
|
598
|
+
event.preventDefault();
|
|
599
|
+
const transaction = toggleMarkdownTask(view.state, view.posAtDOM(task));
|
|
600
|
+
if (transaction) view.dispatch(transaction);
|
|
601
|
+
return true;
|
|
602
|
+
},
|
|
603
|
+
click(event) {
|
|
604
|
+
if (!event.target.closest(".nesso-markdown-task")) return false;
|
|
605
|
+
event.preventDefault();
|
|
606
|
+
return true;
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
function MarkdownInput({ value, onChange, readOnly = false, history: history$1 = true, tasks, onOpenLink, placeholder: placeholder$1, className, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }) {
|
|
441
610
|
const container = useRef(null);
|
|
442
611
|
const editor = useRef(null);
|
|
443
612
|
const callbacks = useRef({
|
|
@@ -445,6 +614,7 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
|
|
|
445
614
|
onOpenLink
|
|
446
615
|
});
|
|
447
616
|
const [configuration] = useState(() => new Compartment());
|
|
617
|
+
const [historyState] = useState(() => new Compartment());
|
|
448
618
|
const [initialValue] = useState(value);
|
|
449
619
|
useLayoutEffect(() => {
|
|
450
620
|
callbacks.current = {
|
|
@@ -465,13 +635,15 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
|
|
|
465
635
|
lineHeight: "inherit",
|
|
466
636
|
overflow: "visible"
|
|
467
637
|
},
|
|
638
|
+
".cm-content": { caretColor: "var(--foreground)" },
|
|
468
639
|
".cm-content, .cm-line": { padding: "0" },
|
|
469
640
|
".cm-line.nesso-markdown-list-item": {
|
|
470
641
|
paddingInlineStart: "var(--nesso-list-padding)",
|
|
471
|
-
textIndent: "calc(-1 * var(--nesso-list-
|
|
642
|
+
textIndent: "calc(-1 * var(--nesso-list-indent))"
|
|
472
643
|
}
|
|
473
644
|
}),
|
|
474
645
|
livePreview,
|
|
646
|
+
taskCheckboxes,
|
|
475
647
|
configuration.of([]),
|
|
476
648
|
keymap.of([
|
|
477
649
|
...["Tab", "Shift-Tab"].map((key) => ({
|
|
@@ -498,8 +670,12 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
|
|
|
498
670
|
return true;
|
|
499
671
|
}
|
|
500
672
|
},
|
|
501
|
-
...[
|
|
502
|
-
|
|
673
|
+
...[
|
|
674
|
+
["Mod-b", "**"],
|
|
675
|
+
["Mod-i", "*"],
|
|
676
|
+
["Mod-e", "`"]
|
|
677
|
+
].map(([key, marker]) => ({
|
|
678
|
+
key,
|
|
503
679
|
run: (view) => {
|
|
504
680
|
const transaction = toggleMarkdownFormat(view.state, marker);
|
|
505
681
|
if (!transaction) return false;
|
|
@@ -531,6 +707,7 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
|
|
|
531
707
|
editor.current?.dispatch({ effects: configuration.reconfigure([
|
|
532
708
|
EditorState.readOnly.of(readOnly),
|
|
533
709
|
EditorView.editable.of(!readOnly),
|
|
710
|
+
markdownTasks.of(tasks),
|
|
534
711
|
EditorView.contentAttributes.of({
|
|
535
712
|
...id ? { id } : {},
|
|
536
713
|
...ariaLabel ? { "aria-label": ariaLabel } : {},
|
|
@@ -539,13 +716,22 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
|
|
|
539
716
|
"aria-readonly": String(readOnly),
|
|
540
717
|
spellcheck: "true"
|
|
541
718
|
}),
|
|
542
|
-
...history$1 ? [history(), keymap.of(historyKeymap
|
|
719
|
+
...history$1 ? [historyState.of(history()), keymap.of([...historyKeymap, {
|
|
720
|
+
key: "Mod-Shift-z",
|
|
721
|
+
run: redo,
|
|
722
|
+
preventDefault: true
|
|
723
|
+
}])] : [],
|
|
724
|
+
...history$1 === "focus" ? [EditorView.domEventHandlers({ blur(_event, view) {
|
|
725
|
+
resetHistory(view, historyState);
|
|
726
|
+
} })] : [],
|
|
543
727
|
...placeholder$1 ? [placeholder(placeholder$1)] : []
|
|
544
728
|
]) });
|
|
545
729
|
}, [
|
|
546
730
|
configuration,
|
|
731
|
+
historyState,
|
|
547
732
|
readOnly,
|
|
548
733
|
history$1,
|
|
734
|
+
tasks,
|
|
549
735
|
id,
|
|
550
736
|
ariaLabel,
|
|
551
737
|
ariaLabelledBy,
|
|
@@ -554,6 +740,7 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
|
|
|
554
740
|
useLayoutEffect(() => {
|
|
555
741
|
const view = editor.current;
|
|
556
742
|
if (!view || value === view.state.doc.toString()) return;
|
|
743
|
+
if (history$1 === "focus") resetHistory(view, historyState);
|
|
557
744
|
view.dispatch({
|
|
558
745
|
changes: {
|
|
559
746
|
from: 0,
|
|
@@ -562,11 +749,16 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
|
|
|
562
749
|
},
|
|
563
750
|
annotations: [externalChange.of(true), Transaction.addToHistory.of(false)]
|
|
564
751
|
});
|
|
565
|
-
}, [
|
|
752
|
+
}, [
|
|
753
|
+
value,
|
|
754
|
+
history$1,
|
|
755
|
+
historyState
|
|
756
|
+
]);
|
|
566
757
|
return /* @__PURE__ */ jsx("div", {
|
|
567
758
|
...props,
|
|
568
759
|
ref: container,
|
|
569
|
-
|
|
760
|
+
"data-local-history": history$1 ? "" : void 0,
|
|
761
|
+
className: cn("nesso-input nesso-markdown-input nesso-scroll min-h-24 w-full overflow-y-auto border border-input bg-background px-2.5 py-2 focus-within:border-muted-foreground", className)
|
|
570
762
|
});
|
|
571
763
|
}
|
|
572
764
|
//#endregion
|
|
@@ -811,7 +1003,7 @@ function ToastViewport({ items, label, closeLabel, queueLabel, onDismiss, onRest
|
|
|
811
1003
|
function DialogPopup({ className, ...props }) {
|
|
812
1004
|
return /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
813
1005
|
forceRender: true,
|
|
814
|
-
className: "fixed inset-0 z-50 bg-
|
|
1006
|
+
className: "fixed inset-0 z-50 bg-black/20"
|
|
815
1007
|
}), /* @__PURE__ */ jsx(Dialog.Popup, {
|
|
816
1008
|
className: cn("nesso-popup fixed top-1/2 left-1/2 z-50 w-[min(400px,calc(100vw-32px))] -translate-1/2 border-0 p-6", className),
|
|
817
1009
|
...props
|
|
@@ -858,6 +1050,53 @@ function ConfirmDialog({ open, onOpenChange, title, description, cancelLabel, co
|
|
|
858
1050
|
});
|
|
859
1051
|
}
|
|
860
1052
|
//#endregion
|
|
1053
|
+
//#region src/sheet.tsx
|
|
1054
|
+
function BottomSheet({ open, onOpenChange, title, closeLabel, popupRef, footer, className, children }) {
|
|
1055
|
+
return /* @__PURE__ */ jsx(Drawer.Root, {
|
|
1056
|
+
open,
|
|
1057
|
+
onOpenChange,
|
|
1058
|
+
modal: false,
|
|
1059
|
+
disablePointerDismissal: true,
|
|
1060
|
+
swipeDirection: "down",
|
|
1061
|
+
children: /* @__PURE__ */ jsx(Drawer.Portal, { children: /* @__PURE__ */ jsx(Drawer.Viewport, {
|
|
1062
|
+
className: "pointer-events-none fixed inset-0 z-40 flex items-end pr-[env(safe-area-inset-right)] pl-[env(safe-area-inset-left)]",
|
|
1063
|
+
children: /* @__PURE__ */ jsxs(Drawer.Popup, {
|
|
1064
|
+
ref: popupRef,
|
|
1065
|
+
className: cn("nesso-sheet pointer-events-auto", className),
|
|
1066
|
+
initialFocus: false,
|
|
1067
|
+
children: [
|
|
1068
|
+
/* @__PURE__ */ jsx("div", {
|
|
1069
|
+
"aria-hidden": "true",
|
|
1070
|
+
className: "nesso-sheet-handle"
|
|
1071
|
+
}),
|
|
1072
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1073
|
+
className: "flex shrink-0 items-center justify-between gap-2 pr-2 pl-5",
|
|
1074
|
+
children: [/* @__PURE__ */ jsx(Drawer.Title, {
|
|
1075
|
+
className: "nesso-sheet-title",
|
|
1076
|
+
children: title
|
|
1077
|
+
}), /* @__PURE__ */ jsx(Drawer.Close, {
|
|
1078
|
+
render: /* @__PURE__ */ jsx(IconButton, {
|
|
1079
|
+
className: "min-h-11 min-w-11",
|
|
1080
|
+
"aria-label": closeLabel,
|
|
1081
|
+
title: closeLabel
|
|
1082
|
+
}),
|
|
1083
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
1084
|
+
})]
|
|
1085
|
+
}),
|
|
1086
|
+
/* @__PURE__ */ jsx(Drawer.Content, {
|
|
1087
|
+
className: "nesso-scroll min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-1 pb-5",
|
|
1088
|
+
children
|
|
1089
|
+
}),
|
|
1090
|
+
footer && /* @__PURE__ */ jsx("div", {
|
|
1091
|
+
className: "nesso-sheet-footer",
|
|
1092
|
+
children: footer
|
|
1093
|
+
})
|
|
1094
|
+
]
|
|
1095
|
+
})
|
|
1096
|
+
}) })
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
//#endregion
|
|
861
1100
|
//#region src/prompt.tsx
|
|
862
1101
|
function PromptForm({ initialValue = "", nameLabel, submitLabel, cancelLabel, maxLength, onSubmit }) {
|
|
863
1102
|
const [value, setValue] = useState(initialValue);
|
|
@@ -1028,7 +1267,7 @@ function MenuPopup({ className, align = "start", anchor, sideOffset = 4, childre
|
|
|
1028
1267
|
sideOffset,
|
|
1029
1268
|
className: "z-50",
|
|
1030
1269
|
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
1031
|
-
className: cn("nesso-popup w-max min-w-32 max-w-[calc(100vw-32px)] max-h-(--available-height) overflow-y-auto p-1", className),
|
|
1270
|
+
className: cn("nesso-popup nesso-scroll w-max min-w-32 max-w-[calc(100vw-32px)] max-h-(--available-height) overflow-y-auto p-1", className),
|
|
1032
1271
|
...props,
|
|
1033
1272
|
children
|
|
1034
1273
|
})
|
|
@@ -1059,7 +1298,7 @@ function PopoverPopup({ className, anchor, align = "start", sideOffset = 4, chil
|
|
|
1059
1298
|
sideOffset,
|
|
1060
1299
|
className: "z-50",
|
|
1061
1300
|
children: /* @__PURE__ */ jsx(Popover.Popup, {
|
|
1062
|
-
className: cn("nesso-popup z-50 max-h-(--available-height) overflow-y-auto p-3 outline-none", className),
|
|
1301
|
+
className: cn("nesso-popup nesso-scroll z-50 max-h-(--available-height) overflow-y-auto p-3 outline-none", className),
|
|
1063
1302
|
...props,
|
|
1064
1303
|
children
|
|
1065
1304
|
})
|
|
@@ -1101,40 +1340,13 @@ const hsvToHex = ({ h, s, v }) => {
|
|
|
1101
1340
|
};
|
|
1102
1341
|
return `#${channel(5)}${channel(3)}${channel(1)}`;
|
|
1103
1342
|
};
|
|
1104
|
-
const
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
value: "#f3ead5"
|
|
1112
|
-
},
|
|
1113
|
-
{
|
|
1114
|
-
key: "presetPeach",
|
|
1115
|
-
value: "#f5e3d5"
|
|
1116
|
-
},
|
|
1117
|
-
{
|
|
1118
|
-
key: "presetRose",
|
|
1119
|
-
value: "#f5dfe2"
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
key: "presetSage",
|
|
1123
|
-
value: "#e1ecde"
|
|
1124
|
-
},
|
|
1125
|
-
{
|
|
1126
|
-
key: "presetMint",
|
|
1127
|
-
value: "#dceee8"
|
|
1128
|
-
},
|
|
1129
|
-
{
|
|
1130
|
-
key: "presetSky",
|
|
1131
|
-
value: "#dfeaf5"
|
|
1132
|
-
},
|
|
1133
|
-
{
|
|
1134
|
-
key: "presetLavender",
|
|
1135
|
-
value: "#e9e2f3"
|
|
1136
|
-
}
|
|
1137
|
-
];
|
|
1343
|
+
const conceptColor = (value) => value.startsWith("#") ? {
|
|
1344
|
+
background: value,
|
|
1345
|
+
color: contrastColor(value)
|
|
1346
|
+
} : {
|
|
1347
|
+
background: `var(--preset-${value})`,
|
|
1348
|
+
color: "var(--foreground)"
|
|
1349
|
+
};
|
|
1138
1350
|
//#endregion
|
|
1139
1351
|
//#region src/color-picker.tsx
|
|
1140
1352
|
const defaultColor = "#ffffff";
|
|
@@ -1144,7 +1356,8 @@ function ColorPicker({ value: color, onValueChange, onCopyError, labels, presets
|
|
|
1144
1356
|
const hint = `${hexId}-hint`;
|
|
1145
1357
|
const copyTimer = useRef(void 0);
|
|
1146
1358
|
const colorGroup = useRef(void 0);
|
|
1147
|
-
const
|
|
1359
|
+
const selected = presets.find((preset) => preset.value === color);
|
|
1360
|
+
const value = selected?.color ?? color ?? defaultColor;
|
|
1148
1361
|
const mixed = color === null;
|
|
1149
1362
|
const [picker, setPicker] = useState(() => ({
|
|
1150
1363
|
value,
|
|
@@ -1320,14 +1533,17 @@ function ColorPicker({ value: color, onValueChange, onCopyError, labels, presets
|
|
|
1320
1533
|
children: presets.map((preset) => /* @__PURE__ */ jsx(IconButton, {
|
|
1321
1534
|
title: preset.label,
|
|
1322
1535
|
"aria-label": preset.label,
|
|
1323
|
-
"aria-pressed": !mixed && preset.value ===
|
|
1324
|
-
onClick: () =>
|
|
1536
|
+
"aria-pressed": !mixed && preset.value === color,
|
|
1537
|
+
onClick: () => {
|
|
1538
|
+
colorGroup.current = void 0;
|
|
1539
|
+
onValueChange(preset.value);
|
|
1540
|
+
},
|
|
1325
1541
|
className: "size-6 [&_svg]:size-3",
|
|
1326
1542
|
children: /* @__PURE__ */ jsx("span", {
|
|
1327
|
-
className: "grid size-4 place-items-center rounded-xs border border-
|
|
1328
|
-
style: { background: preset.
|
|
1543
|
+
className: "grid size-4 place-items-center rounded-xs border border-foreground/15",
|
|
1544
|
+
style: { background: preset.color },
|
|
1329
1545
|
"aria-hidden": "true",
|
|
1330
|
-
children: !mixed && preset.value ===
|
|
1546
|
+
children: !mixed && preset.value === color && /* @__PURE__ */ jsx(Check, {
|
|
1331
1547
|
className: "text-foreground",
|
|
1332
1548
|
"aria-hidden": "true"
|
|
1333
1549
|
})
|
|
@@ -1382,7 +1598,7 @@ function ColorPicker({ value: color, onValueChange, onCopyError, labels, presets
|
|
|
1382
1598
|
}),
|
|
1383
1599
|
/* @__PURE__ */ jsx("span", {
|
|
1384
1600
|
className: "min-w-0 flex-1 truncate font-mono text-[10px] leading-4 text-muted-foreground",
|
|
1385
|
-
children: mixed ? labels.mixed : color ? value.toUpperCase() : labels.default
|
|
1601
|
+
children: mixed ? labels.mixed : selected?.label ?? (color ? value.toUpperCase() : labels.default)
|
|
1386
1602
|
}),
|
|
1387
1603
|
/* @__PURE__ */ jsx(IconButton, {
|
|
1388
1604
|
"aria-label": labels.resetColor,
|
|
@@ -1402,7 +1618,7 @@ function AutocompletePopup({ className, children, ...props }) {
|
|
|
1402
1618
|
sideOffset: 4,
|
|
1403
1619
|
className: "z-50 outline-none",
|
|
1404
1620
|
children: /* @__PURE__ */ jsx(Autocomplete.Popup, {
|
|
1405
|
-
className: cn("nesso-popup max-h-72 w-(--anchor-width) overflow-y-auto p-1", className),
|
|
1621
|
+
className: cn("nesso-popup nesso-scroll max-h-72 w-(--anchor-width) overflow-y-auto p-1", className),
|
|
1406
1622
|
...props,
|
|
1407
1623
|
children
|
|
1408
1624
|
})
|
|
@@ -1467,4 +1683,4 @@ function ActionIcon({ name, ...props }) {
|
|
|
1467
1683
|
});
|
|
1468
1684
|
}
|
|
1469
1685
|
//#endregion
|
|
1470
|
-
export { ActionIcon, Autocomplete, AutocompleteClear, AutocompleteItem, AutocompletePopup, Banner, BannerDetails, BannerRow, 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, PluginContent, PluginPage, Popover, PopoverPopup, PreferenceSelect, PromptForm, RevealActions, SectionHeading, SidePanel, Spinner, Tabs, TextPromptDialog, ToastViewport,
|
|
1686
|
+
export { ActionIcon, Autocomplete, AutocompleteClear, AutocompleteItem, AutocompletePopup, Banner, BannerDetails, BannerRow, BottomSheet, Button, Collapsible, ColorPicker, Combobox, ComboboxItem, ComboboxPopup, ConfirmDialog, ContextLabel, Dialog, DialogActions, DialogPopup, DirectoryField, Field, FieldHint, IconButton, Input, Kbd, Label, ListRow, ListRowButton, ListRowDetail, ListRowTitle, MarkdownInput, Menu, MenuItem, MenuPopup, MenuRadioItem, PanelHeader, PluginContent, PluginPage, Popover, PopoverPopup, PreferenceSelect, PromptForm, RevealActions, SectionHeading, SidePanel, Spinner, Tabs, TextPromptDialog, ToastViewport, conceptColor, useMediaQuery };
|
package/dist/styles.css
CHANGED
|
@@ -27,11 +27,15 @@
|
|
|
27
27
|
@layer base {
|
|
28
28
|
:root {
|
|
29
29
|
--nesso-panel-bar-height: 40px;
|
|
30
|
+
--nesso-reading-font-size: 13px;
|
|
31
|
+
--nesso-reading-line-height: 20px;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
@media (pointer: coarse) {
|
|
33
35
|
:root {
|
|
34
36
|
--nesso-panel-bar-height: 52px;
|
|
37
|
+
--nesso-reading-font-size: 15px;
|
|
38
|
+
--nesso-reading-line-height: 23px;
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
}
|
|
@@ -57,6 +61,7 @@
|
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
.nesso-markdown-input {
|
|
64
|
+
--nesso-list-inset: 0.5em;
|
|
60
65
|
display: flex;
|
|
61
66
|
}
|
|
62
67
|
|
|
@@ -66,13 +71,23 @@
|
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
.nesso-markdown-bold {
|
|
69
|
-
font-weight:
|
|
74
|
+
font-weight: 600;
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
.nesso-markdown-italic {
|
|
73
78
|
font-style: italic;
|
|
74
79
|
}
|
|
75
80
|
|
|
81
|
+
.nesso-markdown-code {
|
|
82
|
+
padding: 2px 4px;
|
|
83
|
+
border-radius: var(--radius-control);
|
|
84
|
+
background: var(--sidebar);
|
|
85
|
+
font-family: var(--font-mono);
|
|
86
|
+
font-size: 0.92em;
|
|
87
|
+
box-decoration-break: clone;
|
|
88
|
+
-webkit-box-decoration-break: clone;
|
|
89
|
+
}
|
|
90
|
+
|
|
76
91
|
.nesso-markdown-link {
|
|
77
92
|
color: var(--primary);
|
|
78
93
|
text-decoration: underline;
|
|
@@ -88,13 +103,87 @@
|
|
|
88
103
|
text-indent: 0;
|
|
89
104
|
}
|
|
90
105
|
|
|
106
|
+
.nesso-markdown-bullet {
|
|
107
|
+
display: inline-block;
|
|
108
|
+
transform: scale(1.2);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.nesso-markdown-task {
|
|
112
|
+
width: 0.875em;
|
|
113
|
+
height: 0.875em;
|
|
114
|
+
margin: 0;
|
|
115
|
+
vertical-align: -0.1em;
|
|
116
|
+
accent-color: var(--primary);
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.nesso-markdown-input [aria-readonly='true'] .nesso-markdown-task {
|
|
121
|
+
cursor: default;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.nesso-markdown-task-done {
|
|
125
|
+
color: var(--muted-foreground);
|
|
126
|
+
text-decoration: line-through;
|
|
127
|
+
}
|
|
128
|
+
|
|
91
129
|
.nesso-popup {
|
|
92
130
|
border: 1px solid var(--border);
|
|
93
131
|
border-radius: var(--radius-object);
|
|
94
132
|
background: var(--background);
|
|
95
133
|
color: var(--foreground);
|
|
96
|
-
box-shadow: 0 8px 24px
|
|
134
|
+
box-shadow: 0 8px 24px var(--shadow);
|
|
135
|
+
outline: none;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.nesso-sheet {
|
|
139
|
+
display: flex;
|
|
140
|
+
width: 100%;
|
|
141
|
+
max-height: min(60dvh, calc(100dvh - 96px));
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
border-top: 1px solid var(--border);
|
|
144
|
+
border-radius: calc(var(--radius-object) * 2) calc(var(--radius-object) * 2) 0 0;
|
|
145
|
+
background: var(--background);
|
|
146
|
+
color: var(--foreground);
|
|
147
|
+
box-shadow: 0 -8px 24px var(--shadow);
|
|
97
148
|
outline: none;
|
|
149
|
+
transform: translateY(var(--drawer-swipe-movement-y, 0px));
|
|
150
|
+
transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.nesso-sheet[data-swiping] {
|
|
154
|
+
transition-duration: 0s;
|
|
155
|
+
user-select: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.nesso-sheet[data-starting-style],
|
|
159
|
+
.nesso-sheet[data-ending-style] {
|
|
160
|
+
transform: translateY(calc(100% + 2px));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.nesso-sheet-handle {
|
|
164
|
+
flex-shrink: 0;
|
|
165
|
+
width: 36px;
|
|
166
|
+
height: 4px;
|
|
167
|
+
margin: 8px auto 0;
|
|
168
|
+
border-radius: 2px;
|
|
169
|
+
background: var(--node-border);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.nesso-sheet-title {
|
|
173
|
+
min-width: 0;
|
|
174
|
+
font-size: 18px;
|
|
175
|
+
line-height: 24px;
|
|
176
|
+
font-weight: 500;
|
|
177
|
+
overflow-wrap: anywhere;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.nesso-sheet-footer {
|
|
181
|
+
display: flex;
|
|
182
|
+
flex-shrink: 0;
|
|
183
|
+
align-items: center;
|
|
184
|
+
gap: 12px;
|
|
185
|
+
padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px));
|
|
186
|
+
border-top: 1px solid var(--border);
|
|
98
187
|
}
|
|
99
188
|
|
|
100
189
|
.nesso-option[data-highlighted] {
|
|
@@ -163,6 +252,10 @@
|
|
|
163
252
|
width: 26px;
|
|
164
253
|
height: 28px;
|
|
165
254
|
}
|
|
255
|
+
.nesso-scroll {
|
|
256
|
+
scrollbar-width: thin;
|
|
257
|
+
scrollbar-color: var(--border) transparent;
|
|
258
|
+
}
|
|
166
259
|
.nesso-plugin-page {
|
|
167
260
|
display: flex;
|
|
168
261
|
flex-direction: column;
|
|
@@ -280,7 +373,7 @@
|
|
|
280
373
|
border-radius: var(--radius-control);
|
|
281
374
|
background: var(--background);
|
|
282
375
|
box-shadow:
|
|
283
|
-
0 1px 3px
|
|
376
|
+
0 1px 3px var(--shadow),
|
|
284
377
|
0 0 0 1px var(--border);
|
|
285
378
|
}
|
|
286
379
|
.panel-toggle svg {
|
|
@@ -340,6 +433,9 @@
|
|
|
340
433
|
}
|
|
341
434
|
|
|
342
435
|
@media (prefers-reduced-motion: reduce) {
|
|
436
|
+
.nesso-sheet {
|
|
437
|
+
transition: none;
|
|
438
|
+
}
|
|
343
439
|
*,
|
|
344
440
|
*::before,
|
|
345
441
|
*::after {
|
|
@@ -426,7 +522,7 @@
|
|
|
426
522
|
border-radius: var(--radius-object);
|
|
427
523
|
background: var(--background);
|
|
428
524
|
color: var(--foreground);
|
|
429
|
-
box-shadow: 0 8px 24px
|
|
525
|
+
box-shadow: 0 8px 24px var(--shadow);
|
|
430
526
|
pointer-events: auto;
|
|
431
527
|
animation: toast-enter 180ms ease-out both;
|
|
432
528
|
}
|
|
@@ -468,6 +564,7 @@
|
|
|
468
564
|
color: var(--muted-foreground);
|
|
469
565
|
font-size: 12px;
|
|
470
566
|
line-height: 18px;
|
|
567
|
+
white-space: pre-line;
|
|
471
568
|
}
|
|
472
569
|
.toast-actions {
|
|
473
570
|
display: flex;
|
package/package.json
CHANGED