@vicinae/api 0.16.2 → 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/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 +1 -1
- package/dist/api/components/actions.js +7 -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 +1 -1
- package/dist/api/components/form.js +3 -1
- 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/image.d.ts +7 -5
- package/dist/api/image.js +4 -0
- package/dist/api/proto/daemon.d.ts +4 -1
- package/dist/api/proto/daemon.js +71 -16
- package/dist/api/proto/ui.d.ts +12 -1
- package/dist/api/proto/ui.js +164 -9
- package/dist/commands/build/index.js +5 -2
- package/dist/commands/develop/index.js +7 -2
- package/dist/schemas/manifest.d.ts +254 -4
- 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 +41 -32
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,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import type { PathLike } from "node:fs";
|
|
3
3
|
import { Clipboard } from "../clipboard";
|
|
4
|
-
import { ImageLike } from "../image";
|
|
4
|
+
import { type ImageLike } from "../image";
|
|
5
5
|
import { Keyboard } from "../keyboard";
|
|
6
6
|
import { Application } from "../utils";
|
|
7
7
|
import { Form } from "./form";
|
|
@@ -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 () => {
|
|
@@ -50,6 +54,7 @@ const SubmitForm = ({ title = "Submit", ...props }) => {
|
|
|
50
54
|
const nativeProps = {
|
|
51
55
|
...props,
|
|
52
56
|
title,
|
|
57
|
+
icon: props.icon ? (0, image_1.serializeProtoImage)(props.icon) : props.icon,
|
|
53
58
|
onAction: () => { },
|
|
54
59
|
};
|
|
55
60
|
return (0, jsx_runtime_1.jsx)("action", { ...nativeProps });
|
|
@@ -67,6 +72,7 @@ const CreateQuicklink = ({ title = "Create Quicklink", quicklink, ...props }) =>
|
|
|
67
72
|
: quicklink.application?.name,
|
|
68
73
|
icon: quicklink.icon,
|
|
69
74
|
},
|
|
75
|
+
icon: props.icon ? (0, image_1.serializeProtoImage)(props.icon) : props.icon,
|
|
70
76
|
onAction: () => { },
|
|
71
77
|
};
|
|
72
78
|
return (0, jsx_runtime_1.jsx)("action", { ...nativeProps });
|
|
@@ -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;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
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 {
|
|
@@ -81,7 +82,8 @@ const TagPickerRoot = ({ children, ...props }) => {
|
|
|
81
82
|
return ((0, jsx_runtime_1.jsx)("tag-picker-field", { ...wrapFormItemProps(props), children: children }));
|
|
82
83
|
};
|
|
83
84
|
const TagPickerItem = ({ icon, ...props }) => {
|
|
84
|
-
|
|
85
|
+
const serializedIcon = icon ? (0, image_1.serializeProtoImage)(icon) : icon;
|
|
86
|
+
return (0, jsx_runtime_1.jsx)("tag-picker-item", { ...props, icon: serializedIcon });
|
|
85
87
|
};
|
|
86
88
|
const TagPicker = Object.assign(TagPickerRoot, {
|
|
87
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;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TagList = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const color_1 = require("../color");
|
|
6
|
+
const image_1 = require("../image");
|
|
6
7
|
const TagListRoot = ({ title, children }) => {
|
|
7
8
|
const nativeProps = {
|
|
8
9
|
title,
|
|
@@ -10,12 +11,12 @@ const TagListRoot = ({ title, children }) => {
|
|
|
10
11
|
};
|
|
11
12
|
return (0, jsx_runtime_1.jsx)("tag-list", { ...nativeProps });
|
|
12
13
|
};
|
|
13
|
-
const TagItem = ({ color, ...props }) => {
|
|
14
|
+
const TagItem = ({ color, icon, ...props }) => {
|
|
14
15
|
const nativeProps = {
|
|
15
16
|
...props,
|
|
17
|
+
color: color ? (0, color_1.serializeColorLike)(color) : undefined,
|
|
18
|
+
icon: icon ? (0, image_1.serializeProtoImage)(icon) : undefined,
|
|
16
19
|
};
|
|
17
|
-
if (color)
|
|
18
|
-
nativeProps.color = (0, color_1.serializeColorLike)(color);
|
|
19
20
|
return (0, jsx_runtime_1.jsx)("tag-item", { ...nativeProps });
|
|
20
21
|
};
|
|
21
22
|
exports.TagList = Object.assign(TagListRoot, {
|
package/dist/api/image.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ColorLike } from "./color";
|
|
2
|
+
import type { Icon } from "./icon";
|
|
2
3
|
import * as ui from "./proto/ui";
|
|
3
4
|
export type Image = {
|
|
4
5
|
source: Image.Source;
|
|
5
|
-
fallback?: Image.Fallback;
|
|
6
|
-
tintColor?:
|
|
7
|
-
mask?: Image.Mask;
|
|
6
|
+
fallback?: Image.Fallback | undefined | null;
|
|
7
|
+
tintColor?: ColorLike | undefined | null;
|
|
8
|
+
mask?: Image.Mask | undefined | null;
|
|
8
9
|
};
|
|
9
10
|
export type ImageLike = Image.ImageLike;
|
|
11
|
+
export type SerializedImageLike = URL | Image.Asset | Icon | ui.Image | Image.ThemedImage;
|
|
10
12
|
export declare namespace Image {
|
|
11
13
|
type Asset = string;
|
|
12
14
|
type ThemedSource = {
|
|
@@ -15,7 +17,7 @@ export declare namespace Image {
|
|
|
15
17
|
};
|
|
16
18
|
type Fallback = Source;
|
|
17
19
|
type Source = URL | Asset | ThemedSource;
|
|
18
|
-
type ImageLike = URL | Image.Asset | Image | ThemedImage;
|
|
20
|
+
type ImageLike = URL | Image.Asset | Icon | Image | ThemedImage;
|
|
19
21
|
type ThemedImage = {
|
|
20
22
|
light: URL | Asset;
|
|
21
23
|
dark: URL | Asset;
|
package/dist/api/image.js
CHANGED
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.serializeProtoImage = exports.Image = void 0;
|
|
37
|
+
const color_1 = require("./color");
|
|
37
38
|
const ui = __importStar(require("./proto/ui"));
|
|
38
39
|
var Image;
|
|
39
40
|
(function (Image) {
|
|
@@ -69,6 +70,9 @@ const serializeProtoImage = (image) => {
|
|
|
69
70
|
if (img.mask) {
|
|
70
71
|
proto.mask = maskMap[img.mask];
|
|
71
72
|
}
|
|
73
|
+
if (img.tintColor) {
|
|
74
|
+
proto.tintColor = (0, color_1.serializeColorLike)(img.tintColor);
|
|
75
|
+
}
|
|
72
76
|
return proto;
|
|
73
77
|
};
|
|
74
78
|
exports.serializeProtoImage = serializeProtoImage;
|
|
@@ -15,9 +15,12 @@ export interface DmenuRequest {
|
|
|
15
15
|
rawContent: string;
|
|
16
16
|
navigationTitle: string;
|
|
17
17
|
placeholder: string;
|
|
18
|
-
noIcon: boolean;
|
|
19
18
|
sectionTitle: string;
|
|
20
19
|
noSection: boolean;
|
|
20
|
+
noQuickLook: boolean;
|
|
21
|
+
noIcon: boolean;
|
|
22
|
+
noMetadata: boolean;
|
|
23
|
+
query: string;
|
|
21
24
|
}
|
|
22
25
|
export interface LaunchAppRequest {
|
|
23
26
|
appId: string;
|