@vicinae/api 0.16.1 → 0.16.3
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/dist/api/bus.d.ts +5 -0
- package/dist/api/cache.js +5 -4
- package/dist/api/color.d.ts +2 -1
- package/dist/api/color.js +48 -3
- package/dist/api/components/action-pannel.d.ts +3 -3
- package/dist/api/components/action-pannel.js +4 -2
- package/dist/api/components/actions.d.ts +10 -1
- package/dist/api/components/actions.js +13 -1
- package/dist/api/components/dropdown.d.ts +1 -1
- package/dist/api/components/dropdown.js +3 -1
- package/dist/api/components/empty-view.js +4 -2
- package/dist/api/components/form.d.ts +16 -2
- package/dist/api/components/form.js +28 -4
- package/dist/api/components/grid.d.ts +8 -19
- package/dist/api/components/grid.js +32 -2
- package/dist/api/components/list.d.ts +22 -3
- package/dist/api/components/list.js +49 -2
- package/dist/api/components/metadata.d.ts +1 -1
- package/dist/api/components/metadata.js +5 -1
- package/dist/api/components/tag.d.ts +2 -2
- package/dist/api/components/tag.js +4 -3
- package/dist/api/context/navigation-provider.js +1 -4
- package/dist/api/environment.d.ts +4 -0
- package/dist/api/image.d.ts +7 -5
- package/dist/api/image.js +4 -0
- package/dist/api/oauth.d.ts +3 -8
- package/dist/api/oauth.js +51 -21
- package/dist/api/proto/application.d.ts +10 -0
- package/dist/api/proto/application.js +150 -3
- package/dist/api/proto/daemon.d.ts +4 -1
- package/dist/api/proto/daemon.js +71 -16
- package/dist/api/proto/manager.d.ts +2 -0
- package/dist/api/proto/manager.js +32 -0
- package/dist/api/proto/oauth.d.ts +42 -0
- package/dist/api/proto/oauth.js +620 -5
- package/dist/api/proto/ui.d.ts +12 -1
- package/dist/api/proto/ui.js +164 -9
- package/dist/api/proto/wm.d.ts +20 -0
- package/dist/api/proto/wm.js +291 -7
- package/dist/api/utils.d.ts +43 -0
- package/dist/api/utils.js +24 -1
- package/dist/api/window-management.d.ts +29 -0
- package/dist/api/window-management.js +17 -0
- package/dist/commands/build/index.js +5 -2
- package/dist/commands/develop/index.js +7 -2
- package/dist/schemas/manifest.d.ts +255 -5
- package/dist/schemas/manifest.js +202 -4
- package/dist/utils/extension-types.d.ts +14 -0
- package/dist/utils/extension-types.js +162 -0
- package/package.json +1 -1
- package/types/jsx.d.ts +54 -33
package/dist/api/bus.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ type EndpointMapping = {
|
|
|
38
38
|
"app.list": "app.list";
|
|
39
39
|
"app.open": "app.open";
|
|
40
40
|
"app.getDefault": "app.getDefault";
|
|
41
|
+
"app.runInTerminal": "app.runInTerminal";
|
|
41
42
|
"ui.render": "ui.render";
|
|
42
43
|
"ui.showToast": "ui.showToast";
|
|
43
44
|
"ui.hideToast": "ui.hideToast";
|
|
@@ -53,6 +54,7 @@ type EndpointMapping = {
|
|
|
53
54
|
"wm.getActiveWindow": "wm.getActiveWindow";
|
|
54
55
|
"wm.getActiveWorkspace": "wm.getActiveWorkspace";
|
|
55
56
|
"wm.getWindows": "wm.getWindows";
|
|
57
|
+
"wm.getScreens": "wm.getScreens";
|
|
56
58
|
"wm.getWorkspaces": "wm.getWorkspaces";
|
|
57
59
|
"wm.setWindowBounds": "wm.setWindowBounds";
|
|
58
60
|
"fileSearch.search": "fileSearch.search";
|
|
@@ -64,6 +66,9 @@ type EndpointMapping = {
|
|
|
64
66
|
"storage.clear": "storage.clear";
|
|
65
67
|
"storage.list": "storage.list";
|
|
66
68
|
"oauth.authorize": "oauth.authorize";
|
|
69
|
+
"oauth.getTokens": "oauth.getTokens";
|
|
70
|
+
"oauth.setTokens": "oauth.setTokens";
|
|
71
|
+
"oauth.removeTokens": "oauth.removeTokens";
|
|
67
72
|
"clipboard.copy": "clipboard.copy";
|
|
68
73
|
"clipboard.paste": "clipboard.paste";
|
|
69
74
|
"clipboard.readContent": "clipboard.readContent";
|
package/dist/api/cache.js
CHANGED
|
@@ -77,19 +77,20 @@ class Cache {
|
|
|
77
77
|
throw new Error(`A single cache entry cannot be bigger than the total capacity of the cache. The data for key ${key} is ${data.length} bytes long while the capacity is set to ${this.capacity}. You should either reduce the amount of data stored or increase the cache's capacity.`);
|
|
78
78
|
}
|
|
79
79
|
const info = this.index.keys[key];
|
|
80
|
-
|
|
80
|
+
const newTotalSize = this.index.size + data.length - (info?.size ?? 0);
|
|
81
81
|
if (newTotalSize > this.capacity) {
|
|
82
82
|
this.popLRU();
|
|
83
|
-
|
|
83
|
+
this.set(key, data); // FIXME: get rid of recursion
|
|
84
|
+
return;
|
|
84
85
|
}
|
|
85
86
|
this.index.size = newTotalSize;
|
|
86
87
|
this.index.keys[key] = { size: data.length };
|
|
87
88
|
this.updateLRU(key);
|
|
89
|
+
this.writeKeyData(key, data);
|
|
90
|
+
this.syncIndex();
|
|
88
91
|
for (const sub of this.subscribers) {
|
|
89
92
|
sub(key, data);
|
|
90
93
|
}
|
|
91
|
-
this.writeKeyData(key, data);
|
|
92
|
-
this.syncIndex();
|
|
93
94
|
};
|
|
94
95
|
/**
|
|
95
96
|
* Removes the data for the given key.
|
package/dist/api/color.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as ui from "./proto/ui";
|
|
1
2
|
type DynamicColor = {
|
|
2
3
|
dark: string;
|
|
3
4
|
light: string;
|
|
@@ -19,6 +20,6 @@ export declare enum Color {
|
|
|
19
20
|
SecondaryText = "secondary-text"
|
|
20
21
|
}
|
|
21
22
|
export type ColorLike = Color.Dynamic | Color.Raw | Color;
|
|
22
|
-
export type SerializedColorLike =
|
|
23
|
+
export type SerializedColorLike = ui.ColorLike;
|
|
23
24
|
export declare const serializeColorLike: (color: ColorLike) => SerializedColorLike;
|
|
24
25
|
export {};
|
package/dist/api/color.js
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.serializeColorLike = exports.Color = void 0;
|
|
37
|
+
const ui = __importStar(require("./proto/ui"));
|
|
4
38
|
var Color;
|
|
5
39
|
(function (Color) {
|
|
6
40
|
Color["Blue"] = "blue";
|
|
@@ -14,9 +48,20 @@ var Color;
|
|
|
14
48
|
Color["SecondaryText"] = "secondary-text";
|
|
15
49
|
})(Color || (exports.Color = Color = {}));
|
|
16
50
|
const serializeColorLike = (color) => {
|
|
17
|
-
|
|
18
|
-
|
|
51
|
+
const colorLike = ui.ColorLike.create();
|
|
52
|
+
if (typeof color === "string") {
|
|
53
|
+
colorLike.raw = color;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// It's a DynamicColor
|
|
57
|
+
const dynamicColor = ui.DynamicColor.create();
|
|
58
|
+
dynamicColor.light = color.light;
|
|
59
|
+
dynamicColor.dark = color.dark;
|
|
60
|
+
if (color.adjustContrast !== undefined) {
|
|
61
|
+
dynamicColor.adjustContrast = color.adjustContrast;
|
|
62
|
+
}
|
|
63
|
+
colorLike.dynamic = dynamicColor;
|
|
19
64
|
}
|
|
20
|
-
return
|
|
65
|
+
return colorLike;
|
|
21
66
|
};
|
|
22
67
|
exports.serializeColorLike = serializeColorLike;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { Image } from "../image";
|
|
3
|
-
import { Keyboard } from "../keyboard";
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type Image } from "../image";
|
|
3
|
+
import type { Keyboard } from "../keyboard";
|
|
4
4
|
export type ActionPanelProps = {
|
|
5
5
|
title?: string;
|
|
6
6
|
children?: ReactNode;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActionPanel = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const image_1 = require("../image");
|
|
5
6
|
const ActionPanelRoot = (props) => {
|
|
6
7
|
const nativeProps = props;
|
|
7
8
|
return (0, jsx_runtime_1.jsx)("action-panel", { ...nativeProps });
|
|
@@ -12,8 +13,9 @@ const ActionPanelSection = (props) => {
|
|
|
12
13
|
};
|
|
13
14
|
return ((0, jsx_runtime_1.jsx)("action-panel-section", { ...nativeProps, children: props.children }));
|
|
14
15
|
};
|
|
15
|
-
const ActionPannelSubmenu = ({ children, ...props }) => {
|
|
16
|
-
|
|
16
|
+
const ActionPannelSubmenu = ({ children, icon, ...props }) => {
|
|
17
|
+
const serializedIcon = icon ? (0, image_1.serializeProtoImage)(icon) : icon;
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)("action-panel-submenu", { ...props, icon: serializedIcon, children: children }));
|
|
17
19
|
};
|
|
18
20
|
exports.ActionPanel = Object.assign(ActionPanelRoot, {
|
|
19
21
|
Section: ActionPanelSection,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
+
import type { PathLike } from "node:fs";
|
|
2
3
|
import { Clipboard } from "../clipboard";
|
|
3
|
-
import { ImageLike } from "../image";
|
|
4
|
+
import { type ImageLike } from "../image";
|
|
4
5
|
import { Keyboard } from "../keyboard";
|
|
5
6
|
import { Application } from "../utils";
|
|
6
7
|
import { Form } from "./form";
|
|
@@ -40,6 +41,13 @@ export type ActionPasteProps = BaseActionProps & {
|
|
|
40
41
|
export type ActionOpenInBrowserProps = BaseActionProps & {
|
|
41
42
|
url: string;
|
|
42
43
|
};
|
|
44
|
+
export type ActionShowInFinderProps = {
|
|
45
|
+
path: PathLike;
|
|
46
|
+
icon?: ImageLike;
|
|
47
|
+
onShow?: (path: PathLike) => void;
|
|
48
|
+
shortcut?: Keyboard.Shortcut;
|
|
49
|
+
title?: string;
|
|
50
|
+
};
|
|
43
51
|
export type ActionSubmitFormProps = Omit<BaseActionProps, "title"> & {
|
|
44
52
|
onSubmit: (input: Form.Values) => boolean | void | Promise<boolean | void>;
|
|
45
53
|
title?: string;
|
|
@@ -61,6 +69,7 @@ export declare const Action: React.FC<ActionProps> & {
|
|
|
61
69
|
Paste: React.FC<ActionPasteProps>;
|
|
62
70
|
SubmitForm: React.FC<ActionSubmitFormProps>;
|
|
63
71
|
OpenInBrowser: React.FC<ActionOpenInBrowserProps>;
|
|
72
|
+
ShowInFinder: React.FC<ActionShowInFinderProps>;
|
|
64
73
|
CreateQuicklink: React.FC<ActionCreateQuicklinkProps>;
|
|
65
74
|
Style: {
|
|
66
75
|
Regular: "regular";
|
|
@@ -4,11 +4,15 @@ exports.Action = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const index_1 = require("../hooks/index");
|
|
6
6
|
const clipboard_1 = require("../clipboard");
|
|
7
|
+
const image_1 = require("../image");
|
|
7
8
|
const utils_1 = require("../utils");
|
|
8
9
|
const icon_1 = require("../icon");
|
|
9
10
|
const controls_1 = require("../controls");
|
|
10
11
|
const ActionRoot = (props) => {
|
|
11
|
-
|
|
12
|
+
const serializedIcon = props.icon
|
|
13
|
+
? (0, image_1.serializeProtoImage)(props.icon)
|
|
14
|
+
: props.icon;
|
|
15
|
+
return (0, jsx_runtime_1.jsx)("action", { ...props, icon: serializedIcon });
|
|
12
16
|
};
|
|
13
17
|
const CopyToClipboard = ({ title = "Copy to clipboard", icon = icon_1.Icon.CopyClipboard, content, concealed = false, onCopy, ...props }) => {
|
|
14
18
|
return ((0, jsx_runtime_1.jsx)(ActionRoot, { title: title, ...props, icon: icon_1.Icon.CopyClipboard, onAction: async () => {
|
|
@@ -34,6 +38,11 @@ const OpenInBrowser = ({ url, ...props }) => {
|
|
|
34
38
|
(0, utils_1.open)(url);
|
|
35
39
|
} }));
|
|
36
40
|
};
|
|
41
|
+
const ShowInFinder = ({ path, title = "Show in Finder", ...props }) => {
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(ActionRoot, { ...props, title: title, onAction: () => {
|
|
43
|
+
(0, utils_1.showInFileBrowser)(path);
|
|
44
|
+
} }));
|
|
45
|
+
};
|
|
37
46
|
const Push = ({ target, ...props }) => {
|
|
38
47
|
const { push } = (0, index_1.useNavigation)();
|
|
39
48
|
return ((0, jsx_runtime_1.jsx)(ActionRoot, { ...props, onAction: () => {
|
|
@@ -45,6 +54,7 @@ const SubmitForm = ({ title = "Submit", ...props }) => {
|
|
|
45
54
|
const nativeProps = {
|
|
46
55
|
...props,
|
|
47
56
|
title,
|
|
57
|
+
icon: props.icon ? (0, image_1.serializeProtoImage)(props.icon) : props.icon,
|
|
48
58
|
onAction: () => { },
|
|
49
59
|
};
|
|
50
60
|
return (0, jsx_runtime_1.jsx)("action", { ...nativeProps });
|
|
@@ -62,6 +72,7 @@ const CreateQuicklink = ({ title = "Create Quicklink", quicklink, ...props }) =>
|
|
|
62
72
|
: quicklink.application?.name,
|
|
63
73
|
icon: quicklink.icon,
|
|
64
74
|
},
|
|
75
|
+
icon: props.icon ? (0, image_1.serializeProtoImage)(props.icon) : props.icon,
|
|
65
76
|
onAction: () => { },
|
|
66
77
|
};
|
|
67
78
|
return (0, jsx_runtime_1.jsx)("action", { ...nativeProps });
|
|
@@ -73,6 +84,7 @@ exports.Action = Object.assign(ActionRoot, {
|
|
|
73
84
|
Paste,
|
|
74
85
|
SubmitForm,
|
|
75
86
|
OpenInBrowser,
|
|
87
|
+
ShowInFinder,
|
|
76
88
|
CreateQuicklink,
|
|
77
89
|
Style: {
|
|
78
90
|
Regular: "regular",
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Dropdown = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const image_1 = require("../image");
|
|
5
6
|
const DropdownRoot = ({ children, ...props }) => {
|
|
6
7
|
return (0, jsx_runtime_1.jsx)("dropdown", { ...props, children: children });
|
|
7
8
|
};
|
|
8
9
|
const Item = ({ title, value, icon }) => {
|
|
9
|
-
|
|
10
|
+
const serializedIcon = icon ? (0, image_1.serializeProtoImage)(icon) : icon;
|
|
11
|
+
return (0, jsx_runtime_1.jsx)("dropdown-item", { title: title, value: value, icon: serializedIcon });
|
|
10
12
|
};
|
|
11
13
|
const Section = ({ title, children }) => {
|
|
12
14
|
return (0, jsx_runtime_1.jsx)("dropdown-section", { title: title, children: children });
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EmptyView = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const image_1 = require("../image");
|
|
6
|
+
const EmptyView = ({ actions, icon, ...props }) => {
|
|
7
|
+
const serializedIcon = icon ? (0, image_1.serializeProtoImage)(icon) : icon;
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("empty-view", { ...props, icon: serializedIcon, children: actions }));
|
|
7
9
|
};
|
|
8
10
|
exports.EmptyView = EmptyView;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode, Ref } from "react";
|
|
2
|
-
import { ImageLike } from "../image";
|
|
2
|
+
import { type ImageLike } from "../image";
|
|
3
3
|
type FormProps = {
|
|
4
4
|
actions?: React.ReactNode;
|
|
5
5
|
children?: React.ReactNode;
|
|
@@ -57,7 +57,14 @@ interface TextFieldProps extends FormItemProps<string>, WithFormRef<Form.TextFie
|
|
|
57
57
|
}
|
|
58
58
|
interface PasswordFieldProps extends FormItemProps<string>, WithFormRef<Form.PasswordField> {
|
|
59
59
|
}
|
|
60
|
+
export declare enum DatePickerType {
|
|
61
|
+
DateTime = "dateTime",
|
|
62
|
+
Date = "date"
|
|
63
|
+
}
|
|
60
64
|
interface DatePickerProps extends FormItemProps<Date | null>, WithFormRef<Form.DatePicker> {
|
|
65
|
+
min?: Date;
|
|
66
|
+
max?: Date;
|
|
67
|
+
type?: DatePickerType;
|
|
61
68
|
}
|
|
62
69
|
interface CheckboxProps extends FormItemProps<boolean>, WithFormRef<Form.Checkbox> {
|
|
63
70
|
label?: string;
|
|
@@ -77,6 +84,10 @@ interface TagPickerProps extends FormItemProps<string[]>, WithFormRef<Form.TagPi
|
|
|
77
84
|
interface TextAreaProps extends FormItemProps<string>, WithFormRef<Form.TextArea> {
|
|
78
85
|
}
|
|
79
86
|
interface FilePickerProps extends FormItemProps<string[]>, WithFormRef<Form.FilePicker> {
|
|
87
|
+
allowMultipleSelection?: boolean;
|
|
88
|
+
canChooseDirectories?: boolean;
|
|
89
|
+
canChooseFiles?: boolean;
|
|
90
|
+
showHiddenFiles?: boolean;
|
|
80
91
|
}
|
|
81
92
|
type DescriptionProps = {
|
|
82
93
|
text: string;
|
|
@@ -85,7 +96,10 @@ type DescriptionProps = {
|
|
|
85
96
|
export declare const Form: import("react").FC<FormProps> & {
|
|
86
97
|
TextField: import("react").FC<TextFieldProps>;
|
|
87
98
|
PasswordField: import("react").FC<PasswordFieldProps>;
|
|
88
|
-
DatePicker: import("react").FC<DatePickerProps
|
|
99
|
+
DatePicker: import("react").FC<DatePickerProps> & {
|
|
100
|
+
Type: typeof DatePickerType;
|
|
101
|
+
isFullDay: (value: Date | null | undefined) => boolean;
|
|
102
|
+
};
|
|
89
103
|
Checkbox: import("react").FC<CheckboxProps>;
|
|
90
104
|
TextArea: import("react").FC<TextAreaProps>;
|
|
91
105
|
Dropdown: import("react").FC<DropdownProps> & {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Form = void 0;
|
|
3
|
+
exports.Form = exports.DatePickerType = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const use_imperative_form_handle_1 = require("../hooks/use-imperative-form-handle");
|
|
6
|
+
const image_1 = require("../image");
|
|
6
7
|
const dropdown_1 = require("./dropdown");
|
|
7
8
|
const wrapFormItemProps = (props) => {
|
|
8
9
|
return {
|
|
@@ -36,10 +37,32 @@ const PasswordField = ({ ref, ...props }) => {
|
|
|
36
37
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
37
38
|
return (0, jsx_runtime_1.jsx)("password-field", { ...props });
|
|
38
39
|
};
|
|
39
|
-
|
|
40
|
+
var DatePickerType;
|
|
41
|
+
(function (DatePickerType) {
|
|
42
|
+
DatePickerType["DateTime"] = "dateTime";
|
|
43
|
+
DatePickerType["Date"] = "date";
|
|
44
|
+
})(DatePickerType || (exports.DatePickerType = DatePickerType = {}));
|
|
45
|
+
const DatePickerRoot = ({ ref, onChange, ...props }) => {
|
|
40
46
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
41
|
-
|
|
47
|
+
const _onChange = onChange
|
|
48
|
+
? (newValue) => {
|
|
49
|
+
const dateObj = newValue ? new Date(newValue) : null;
|
|
50
|
+
onChange(dateObj);
|
|
51
|
+
}
|
|
52
|
+
: undefined;
|
|
53
|
+
return ((0, jsx_runtime_1.jsx)("date-picker-field", { ...wrapFormItemProps(props), onChange: _onChange }));
|
|
42
54
|
};
|
|
55
|
+
const DatePicker = Object.assign(DatePickerRoot, {
|
|
56
|
+
Type: DatePickerType,
|
|
57
|
+
isFullDay: (value) => {
|
|
58
|
+
if (!value)
|
|
59
|
+
return false;
|
|
60
|
+
return (value.getHours() === 0 &&
|
|
61
|
+
value.getMinutes() === 0 &&
|
|
62
|
+
value.getSeconds() === 0 &&
|
|
63
|
+
value.getMilliseconds() === 0);
|
|
64
|
+
},
|
|
65
|
+
});
|
|
43
66
|
const Checkbox = ({ ref, ...props }) => {
|
|
44
67
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
45
68
|
return (0, jsx_runtime_1.jsx)("checkbox-field", { ...wrapFormItemProps(props) });
|
|
@@ -59,7 +82,8 @@ const TagPickerRoot = ({ children, ...props }) => {
|
|
|
59
82
|
return ((0, jsx_runtime_1.jsx)("tag-picker-field", { ...wrapFormItemProps(props), children: children }));
|
|
60
83
|
};
|
|
61
84
|
const TagPickerItem = ({ icon, ...props }) => {
|
|
62
|
-
|
|
85
|
+
const serializedIcon = icon ? (0, image_1.serializeProtoImage)(icon) : icon;
|
|
86
|
+
return (0, jsx_runtime_1.jsx)("tag-picker-item", { ...props, icon: serializedIcon });
|
|
63
87
|
};
|
|
64
88
|
const TagPicker = Object.assign(TagPickerRoot, {
|
|
65
89
|
Item: TagPickerItem,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import { Image, ImageLike } from "../image";
|
|
3
|
-
import {
|
|
2
|
+
import { type Image, type ImageLike } from "../image";
|
|
3
|
+
import { type ColorLike } from "../color";
|
|
4
4
|
declare enum GridInset {
|
|
5
5
|
Zero = "zero",
|
|
6
6
|
Small = "small",
|
|
@@ -56,7 +56,7 @@ export declare namespace Grid {
|
|
|
56
56
|
export type ItemSize = GridItemSize;
|
|
57
57
|
export type AspectRatio = "1" | "3/2" | "2/3" | "4/3" | "3/4" | "16/9" | "9/16" | "21/9" | "9/21" | "32/9" | "9/32";
|
|
58
58
|
export namespace Item {
|
|
59
|
-
|
|
59
|
+
type Props = {
|
|
60
60
|
title?: string;
|
|
61
61
|
detail?: React.ReactNode;
|
|
62
62
|
keywords?: string[];
|
|
@@ -64,31 +64,20 @@ export declare namespace Grid {
|
|
|
64
64
|
content: Image.ImageLike | {
|
|
65
65
|
color: ColorLike;
|
|
66
66
|
} | {
|
|
67
|
-
value: Image.ImageLike
|
|
67
|
+
value: Image.ImageLike | {
|
|
68
|
+
color: ColorLike;
|
|
69
|
+
};
|
|
68
70
|
tooltip?: string;
|
|
69
71
|
};
|
|
70
72
|
id?: string;
|
|
71
73
|
subtitle?: string;
|
|
72
74
|
actions?: ReactNode;
|
|
73
|
-
|
|
75
|
+
accessory?: Grid.Item.Accessory;
|
|
74
76
|
};
|
|
75
|
-
type
|
|
76
|
-
color: ColorLike;
|
|
77
|
-
value: string | Date | undefined | null;
|
|
78
|
-
};
|
|
79
|
-
type Text = string | Date | undefined | null | {
|
|
80
|
-
color: Color;
|
|
81
|
-
value: string | Date | undefined | null;
|
|
82
|
-
};
|
|
83
|
-
export type Accessory = ({
|
|
84
|
-
tag?: Tag;
|
|
85
|
-
} | {
|
|
86
|
-
text?: Text;
|
|
87
|
-
}) & {
|
|
77
|
+
type Accessory = {
|
|
88
78
|
icon?: Image.ImageLike;
|
|
89
79
|
tooltip?: string | null;
|
|
90
80
|
};
|
|
91
|
-
export {};
|
|
92
81
|
}
|
|
93
82
|
export {};
|
|
94
83
|
}
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Grid = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const image_1 = require("../image");
|
|
6
7
|
const crypto_1 = require("crypto");
|
|
7
8
|
const empty_view_1 = require("./empty-view");
|
|
9
|
+
const color_1 = require("../color");
|
|
8
10
|
const dropdown_1 = require("./dropdown");
|
|
9
11
|
var GridInset;
|
|
10
12
|
(function (GridInset) {
|
|
@@ -55,9 +57,37 @@ const GridRoot = ({ searchBarAccessory, children, actions, inset, itemSize, fit
|
|
|
55
57
|
}
|
|
56
58
|
return ((0, jsx_runtime_1.jsxs)("grid", { fit: fit, inset: inset, aspectRatio: aspectRatioMap[aspectRatio], ...props, children: [searchBarAccessory, children, actions] }));
|
|
57
59
|
};
|
|
58
|
-
const GridItem = ({ detail, actions, ...props }) => {
|
|
60
|
+
const GridItem = ({ detail, actions, content, accessory, ...props }) => {
|
|
59
61
|
const id = (0, react_1.useRef)(props.id ?? (0, crypto_1.randomUUID)());
|
|
60
|
-
|
|
62
|
+
// Remove value wrapper
|
|
63
|
+
const innerContent = typeof content === "object" && "value" in content ? content.value : content;
|
|
64
|
+
const tooltip = typeof content === "object" && "tooltip" in content
|
|
65
|
+
? content.tooltip
|
|
66
|
+
: undefined;
|
|
67
|
+
// Content
|
|
68
|
+
let serializedContent;
|
|
69
|
+
if (innerContent &&
|
|
70
|
+
typeof innerContent === "object" &&
|
|
71
|
+
"color" in innerContent) {
|
|
72
|
+
serializedContent = {
|
|
73
|
+
color: (0, color_1.serializeColorLike)(innerContent.color),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
serializedContent = innerContent
|
|
78
|
+
? (0, image_1.serializeProtoImage)(innerContent)
|
|
79
|
+
: undefined;
|
|
80
|
+
}
|
|
81
|
+
// Accessory
|
|
82
|
+
const serializedAccessory = accessory
|
|
83
|
+
? {
|
|
84
|
+
icon: accessory.icon
|
|
85
|
+
? (0, image_1.serializeProtoImage)(accessory.icon)
|
|
86
|
+
: accessory.icon,
|
|
87
|
+
tooltip: accessory.tooltip,
|
|
88
|
+
}
|
|
89
|
+
: undefined;
|
|
90
|
+
return ((0, jsx_runtime_1.jsxs)("grid-item", { ...props, content: serializedContent, tooltip: tooltip, accessory: serializedAccessory, id: id.current, children: [detail, actions] }));
|
|
61
91
|
};
|
|
62
92
|
const GridSection = ({ fit, aspectRatio, inset, ...props }) => {
|
|
63
93
|
const nativeProps = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import { Image, ImageLike } from "../image";
|
|
3
|
-
import { Color, ColorLike } from "../color";
|
|
2
|
+
import { type Image, type ImageLike, type SerializedImageLike } from "../image";
|
|
3
|
+
import { type Color, type ColorLike, type SerializedColorLike } from "../color";
|
|
4
4
|
export declare namespace List {
|
|
5
5
|
type Props = {
|
|
6
6
|
actions?: React.ReactNode;
|
|
@@ -31,7 +31,10 @@ export declare namespace List {
|
|
|
31
31
|
title: string;
|
|
32
32
|
keywords?: string[];
|
|
33
33
|
detail?: React.ReactNode;
|
|
34
|
-
icon?: ImageLike
|
|
34
|
+
icon?: ImageLike | {
|
|
35
|
+
value: ImageLike | undefined | null;
|
|
36
|
+
tooltip: string;
|
|
37
|
+
};
|
|
35
38
|
id?: string;
|
|
36
39
|
subtitle?: string;
|
|
37
40
|
actions?: ReactNode;
|
|
@@ -63,6 +66,22 @@ export declare namespace List {
|
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
68
|
}
|
|
69
|
+
export type SerializedTag = List.Item.AccessoryBase | {
|
|
70
|
+
color: SerializedColorLike;
|
|
71
|
+
value: string | Date | undefined | null;
|
|
72
|
+
};
|
|
73
|
+
export type SerializedText = List.Item.AccessoryBase | {
|
|
74
|
+
color: SerializedColorLike;
|
|
75
|
+
value: string | Date | undefined | null;
|
|
76
|
+
};
|
|
77
|
+
export type SerializedAccessory = ({
|
|
78
|
+
tag?: SerializedTag;
|
|
79
|
+
} | {
|
|
80
|
+
text?: SerializedText;
|
|
81
|
+
}) & {
|
|
82
|
+
icon?: SerializedImageLike;
|
|
83
|
+
tooltip?: string | null;
|
|
84
|
+
};
|
|
66
85
|
export declare const List: React.FC<List.Props> & {
|
|
67
86
|
Section: React.FC<List.Section.Props>;
|
|
68
87
|
EmptyView: React.FC<import("./empty-view").EmptyViewProps>;
|
|
@@ -3,10 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.List = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const image_1 = require("../image");
|
|
6
7
|
const crypto_1 = require("crypto");
|
|
7
8
|
const metadata_1 = require("./metadata");
|
|
8
9
|
const empty_view_1 = require("./empty-view");
|
|
10
|
+
const color_1 = require("../color");
|
|
9
11
|
const dropdown_1 = require("./dropdown");
|
|
12
|
+
function serializeAccessory(accessory) {
|
|
13
|
+
const icon = accessory.icon ? (0, image_1.serializeProtoImage)(accessory.icon) : undefined;
|
|
14
|
+
const tag = typeof accessory === "object" && "tag" in accessory
|
|
15
|
+
? serializeTag(accessory.tag)
|
|
16
|
+
: undefined;
|
|
17
|
+
const text = typeof accessory === "object" && "text" in accessory
|
|
18
|
+
? serializeText(accessory.text)
|
|
19
|
+
: undefined;
|
|
20
|
+
return { icon, tooltip: accessory.tooltip, tag, text };
|
|
21
|
+
}
|
|
22
|
+
function serializeTag(tag) {
|
|
23
|
+
if (tag == null)
|
|
24
|
+
return tag; // null or undefined
|
|
25
|
+
if (typeof tag !== "object")
|
|
26
|
+
return tag;
|
|
27
|
+
if ("color" in tag) {
|
|
28
|
+
const color = (0, color_1.serializeColorLike)(tag.color);
|
|
29
|
+
const value = "value" in tag ? tag.value : undefined;
|
|
30
|
+
return { color, value };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function serializeText(text) {
|
|
34
|
+
if (text == null)
|
|
35
|
+
return text; // null or undefined
|
|
36
|
+
if (typeof text !== "object")
|
|
37
|
+
return text;
|
|
38
|
+
if ("color" in text) {
|
|
39
|
+
const color = (0, color_1.serializeColorLike)(text.color);
|
|
40
|
+
const value = "value" in text ? text.value : undefined;
|
|
41
|
+
return { color, value };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
10
44
|
const ListRoot = ({ searchBarAccessory, children, actions, ...props }) => {
|
|
11
45
|
if (typeof props.enableFiltering === "boolean" &&
|
|
12
46
|
typeof props.filtering === "undefined") {
|
|
@@ -14,9 +48,22 @@ const ListRoot = ({ searchBarAccessory, children, actions, ...props }) => {
|
|
|
14
48
|
}
|
|
15
49
|
return ((0, jsx_runtime_1.jsxs)("list", { ...props, children: [searchBarAccessory, children, actions] }));
|
|
16
50
|
};
|
|
17
|
-
const ListItem = ({ detail, actions, ...props }) => {
|
|
51
|
+
const ListItem = ({ detail, actions, icon, accessories, ...props }) => {
|
|
18
52
|
const id = (0, react_1.useRef)(props.id ?? (0, crypto_1.randomUUID)());
|
|
19
|
-
|
|
53
|
+
// Icon
|
|
54
|
+
let serializedIcon;
|
|
55
|
+
if (icon && typeof icon === "object" && "value" in icon) {
|
|
56
|
+
serializedIcon = {
|
|
57
|
+
value: icon.value ? (0, image_1.serializeProtoImage)(icon.value) : undefined,
|
|
58
|
+
tooltip: icon.tooltip,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
serializedIcon = icon ? (0, image_1.serializeProtoImage)(icon) : undefined;
|
|
63
|
+
}
|
|
64
|
+
// Accessories
|
|
65
|
+
const serializedAccessories = accessories?.map(serializeAccessory) ?? undefined;
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)("list-item", { ...props, icon: serializedIcon, accessories: serializedAccessories, id: id.current, children: [detail, actions] }));
|
|
20
67
|
};
|
|
21
68
|
const ListItemDetail = ({ metadata, ...props }) => {
|
|
22
69
|
return (0, jsx_runtime_1.jsx)("list-item-detail", { ...props, children: metadata });
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Metadata = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const image_1 = require("../image");
|
|
5
6
|
const tag_1 = require("./tag");
|
|
6
7
|
const MetadataRoot = (props) => {
|
|
7
8
|
return (0, jsx_runtime_1.jsx)("metadata", { ...props });
|
|
8
9
|
};
|
|
9
10
|
const MetadataLabel = (props) => {
|
|
10
|
-
|
|
11
|
+
const serializedIcon = props.icon
|
|
12
|
+
? (0, image_1.serializeProtoImage)(props.icon)
|
|
13
|
+
: props.icon;
|
|
14
|
+
return (0, jsx_runtime_1.jsx)("metadata-label", { ...props, icon: serializedIcon });
|
|
11
15
|
};
|
|
12
16
|
const MetadataSeparator = () => {
|
|
13
17
|
return (0, jsx_runtime_1.jsx)("metadata-separator", {});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { type ColorLike } from "../color";
|
|
3
|
+
import { type ImageLike } from "../image";
|
|
4
4
|
export type TagListProps = {
|
|
5
5
|
title: string;
|
|
6
6
|
children: ReactNode;
|