@dxos/plugin-settings 0.6.12 → 0.6.13-main.09887cd
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/lib/browser/{chunk-JKQMH66V.mjs → chunk-PD3C4TDW.mjs} +1 -1
- package/dist/lib/browser/chunk-PD3C4TDW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +16 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/node/{chunk-LZVHLML4.cjs → chunk-AHM6OLF2.cjs} +4 -4
- package/dist/lib/node/chunk-AHM6OLF2.cjs.map +7 -0
- package/dist/lib/node/index.cjs +56 -54
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.cjs +3 -3
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/chunk-PPOEIFFE.mjs +13 -0
- package/dist/lib/node-esm/chunk-PPOEIFFE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +258 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/meta.mjs +10 -0
- package/dist/lib/node-esm/meta.mjs.map +7 -0
- package/dist/types/src/SettingsPlugin.d.ts.map +1 -1
- package/dist/types/src/components/SettingsDialog.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/package.json +16 -14
- package/src/SettingsPlugin.tsx +1 -3
- package/src/components/SettingsDialog.tsx +21 -14
- package/src/meta.ts +3 -1
- package/dist/lib/browser/chunk-JKQMH66V.mjs.map +0 -7
- package/dist/lib/node/chunk-LZVHLML4.cjs.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';\n\nexport default {\n id: SETTINGS_PLUGIN,\n} satisfies PluginMeta;\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,kBAAkB;AAE/B,IAAA,eAAe;EACbC,IAAID;AACN;",
|
|
6
|
+
"names": ["SETTINGS_PLUGIN", "id"]
|
|
7
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETTINGS_PLUGIN,
|
|
3
3
|
meta_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PD3C4TDW.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-settings/src/SettingsPlugin.tsx
|
|
7
|
-
import { Gear } from "@phosphor-icons/react";
|
|
8
7
|
import React3 from "react";
|
|
9
8
|
import { parseIntentPlugin, resolvePlugin, LayoutAction, SettingsAction } from "@dxos/app-framework";
|
|
10
9
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
@@ -29,8 +28,9 @@ var SettingsDialog = ({ selected, onSelected }) => {
|
|
|
29
28
|
"dxos.org/plugin/observability",
|
|
30
29
|
"dxos.org/plugin/registry"
|
|
31
30
|
];
|
|
32
|
-
const
|
|
33
|
-
const
|
|
31
|
+
const sortPlugin = ({ name: a }, { name: b }) => a?.localeCompare(b ?? "") ?? 0;
|
|
32
|
+
const corePlugins = core.map((id) => plugins.find((plugin) => plugin.meta.id === id)?.meta).filter(nonNullable).sort(sortPlugin);
|
|
33
|
+
const filteredPlugins = enabled.filter((id) => !core.includes(id)).map((id) => plugins.find((plugin) => plugin.meta.id === id)).filter((plugin) => plugin?.provides?.settings).map((plugin) => plugin.meta).sort(sortPlugin);
|
|
34
34
|
const [tabsActivePart, setTabsActivePart] = useState("list");
|
|
35
35
|
return /* @__PURE__ */ React.createElement(Dialog.Content, {
|
|
36
36
|
classNames: "p-0 bs-content max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
@@ -72,14 +72,13 @@ var SettingsDialog = ({ selected, onSelected }) => {
|
|
|
72
72
|
role: "none",
|
|
73
73
|
className: "overflow-y-auto pli-3 @md:pis-2 @md:pie-0 mbe-4 border-r border-separator"
|
|
74
74
|
}, /* @__PURE__ */ React.createElement(Tabs.Tablist, {
|
|
75
|
-
classNames: "max-bs-none overflow-y-visible"
|
|
75
|
+
classNames: "flex flex-col gap-4 max-bs-none overflow-y-visible"
|
|
76
76
|
}, /* @__PURE__ */ React.createElement(PluginList, {
|
|
77
77
|
title: "Options",
|
|
78
78
|
plugins: corePlugins
|
|
79
79
|
}), filteredPlugins.length > 0 && /* @__PURE__ */ React.createElement(PluginList, {
|
|
80
80
|
title: "Plugins",
|
|
81
|
-
plugins: filteredPlugins
|
|
82
|
-
gap: true
|
|
81
|
+
plugins: filteredPlugins
|
|
83
82
|
}))), corePlugins.map((plugin) => /* @__PURE__ */ React.createElement(Tabs.Tabpanel, {
|
|
84
83
|
key: plugin.id,
|
|
85
84
|
value: plugin.id,
|
|
@@ -100,13 +99,17 @@ var SettingsDialog = ({ selected, onSelected }) => {
|
|
|
100
99
|
}
|
|
101
100
|
}))))));
|
|
102
101
|
};
|
|
103
|
-
var PluginList = ({ title, plugins
|
|
104
|
-
return /* @__PURE__ */ React.createElement(
|
|
105
|
-
|
|
106
|
-
},
|
|
102
|
+
var PluginList = ({ title, plugins }) => {
|
|
103
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
104
|
+
role: "none"
|
|
105
|
+
}, /* @__PURE__ */ React.createElement(Tabs.TabGroupHeading, {
|
|
106
|
+
classNames: "pli-1 mlb-2 mbs-4 @md:mbs-2"
|
|
107
|
+
}, title), /* @__PURE__ */ React.createElement("div", {
|
|
108
|
+
className: "flex flex-col ml-1"
|
|
109
|
+
}, plugins.map((plugin) => /* @__PURE__ */ React.createElement(Tabs.Tab, {
|
|
107
110
|
key: plugin.id,
|
|
108
111
|
value: plugin.id
|
|
109
|
-
}, plugin.name)));
|
|
112
|
+
}, plugin.name))));
|
|
110
113
|
};
|
|
111
114
|
|
|
112
115
|
// packages/plugins/plugin-settings/src/components/SettingsValue.tsx
|
|
@@ -227,8 +230,7 @@ var SettingsPlugin = () => {
|
|
|
227
230
|
ns: SETTINGS_PLUGIN
|
|
228
231
|
}
|
|
229
232
|
],
|
|
230
|
-
icon:
|
|
231
|
-
iconSymbol: "ph--gear--regular",
|
|
233
|
+
icon: "ph--gear--regular",
|
|
232
234
|
keyBinding: {
|
|
233
235
|
macos: "meta+,",
|
|
234
236
|
windows: "alt+,"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/SettingsPlugin.tsx", "../../../src/components/SettingsDialog.tsx", "../../../src/components/SettingsValue.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Gear, type IconProps } from '@phosphor-icons/react';\nimport React from 'react';\n\nimport {\n type IntentResolverProvides,\n type PluginDefinition,\n type SurfaceProvides,\n parseIntentPlugin,\n resolvePlugin,\n LayoutAction,\n SettingsAction,\n type GraphBuilderProvides,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\n\nimport { SettingsDialog } from './components';\nimport meta, { SETTINGS_PLUGIN } from './meta';\nimport translations from './translations';\n\nconst DEFAULT_PLUGIN = 'dxos.org/plugin/registry';\n\nexport type SettingsPluginProvides = SurfaceProvides &\n IntentResolverProvides &\n GraphBuilderProvides &\n TranslationsProvides;\n\ntype SettingsSettingsProps = {\n selected: string;\n};\n\n/**\n * Plugin for aggregating and rendering plugin settings.\n */\nexport const SettingsPlugin = (): PluginDefinition<SettingsPluginProvides> => {\n const settings = new LocalStorageStore<SettingsSettingsProps>(SETTINGS_PLUGIN, { selected: DEFAULT_PLUGIN });\n\n return {\n meta,\n ready: async () => {\n settings.prop({ key: 'selected', type: LocalStorageStore.string() });\n },\n provides: {\n surface: {\n component: ({ data }) => {\n switch (data.component) {\n case `${SETTINGS_PLUGIN}/Settings`:\n return (\n <SettingsDialog\n selected={settings.values.selected}\n onSelected={(selected) => (settings.values.selected = selected)}\n />\n );\n\n default:\n return null;\n }\n },\n },\n intent: {\n resolver: (intent) => {\n switch (intent.action) {\n case SettingsAction.OPEN: {\n if (intent.data?.plugin) {\n settings.values.selected = intent.data?.plugin;\n }\n\n return {\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: `${SETTINGS_PLUGIN}/Settings`,\n dialogBlockAlign: 'start',\n },\n },\n ],\n ],\n };\n }\n }\n },\n },\n graph: {\n builder: (plugins) => {\n const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n\n return createExtension({\n id: SETTINGS_PLUGIN,\n filter: (node): node is Node<null> => node.id === 'root',\n actions: () => [\n {\n id: SETTINGS_PLUGIN,\n data: async () => {\n await intentPlugin?.provides.intent.dispatch({\n plugin: SETTINGS_PLUGIN,\n action: SettingsAction.OPEN,\n });\n },\n properties: {\n label: ['open settings label', { ns: SETTINGS_PLUGIN }],\n icon: (props: IconProps) => <Gear {...props} />,\n iconSymbol: 'ph--gear--regular',\n keyBinding: {\n macos: 'meta+,',\n windows: 'alt+,',\n },\n },\n },\n ],\n });\n },\n },\n translations,\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { type Plugin, Surface, usePlugins } from '@dxos/app-framework';\nimport { Button, Dialog, Icon, useTranslation } from '@dxos/react-ui';\nimport { Tabs, type TabsActivePart } from '@dxos/react-ui-tabs';\nimport { getSize } from '@dxos/react-ui-theme';\nimport { nonNullable } from '@dxos/util';\n\nimport { SETTINGS_PLUGIN } from '../meta';\n\nexport const SettingsDialog = ({\n selected,\n onSelected,\n}: {\n selected: string;\n onSelected: (plugin: string) => void;\n}) => {\n const { t } = useTranslation(SETTINGS_PLUGIN);\n const { plugins, enabled } = usePlugins();\n\n // TODO(burdon): Factor out common defs?\n const core = [\n 'dxos.org/plugin/layout',\n 'dxos.org/plugin/deck',\n 'dxos.org/plugin/files',\n 'dxos.org/plugin/space',\n 'dxos.org/plugin/stack',\n 'dxos.org/plugin/observability',\n 'dxos.org/plugin/registry',\n ];\n\n const corePlugins = core.map((id) => plugins.find((plugin) => plugin.meta.id === id)?.meta).filter(nonNullable);\n\n const filteredPlugins = enabled\n .filter((id) => !core.includes(id))\n .map((id) => plugins.find((plugin) => plugin.meta.id === id))\n .filter((plugin) => (plugin?.provides as any)?.settings)\n .map((plugin) => plugin!.meta)\n .sort(({ name: a }, { name: b }) => a?.localeCompare(b ?? '') ?? 0);\n\n const [tabsActivePart, setTabsActivePart] = useState<TabsActivePart>('list');\n\n return (\n <Dialog.Content classNames='p-0 bs-content max-bs-full md:max-is-[40rem] overflow-hidden'>\n <div role='none' className='flex justify-between mbe-1 pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5'>\n <Dialog.Title\n onClick={() => setTabsActivePart('list')}\n aria-description={t('click to return to tablist description')}\n classNames='flex cursor-pointer items-center group/title'\n >\n <Icon\n icon='ph--caret-left--regular'\n classNames={['@md:hidden', getSize(4), tabsActivePart === 'list' && 'invisible']}\n />\n <span\n className={\n tabsActivePart !== 'list'\n ? 'group-hover/title:underline @md:group-hover/title:no-underline underline-offset-4 decoration-1'\n : ''\n }\n >\n {t('settings dialog title')}\n </span>\n </Dialog.Title>\n <Dialog.Close asChild>\n <Button density='fine' variant='ghost' autoFocus>\n <Icon icon='ph--x--regular' size={3} />\n </Button>\n </Dialog.Close>\n </div>\n\n <Tabs.Root\n orientation='vertical'\n value={selected}\n onValueChange={(nextSelected) => onSelected(nextSelected)}\n activePart={tabsActivePart}\n onActivePartChange={setTabsActivePart}\n classNames='flex flex-col flex-1 mbs-2'\n >\n <Tabs.Viewport classNames='flex-1 min-bs-0'>\n <div role='none' className='overflow-y-auto pli-3 @md:pis-2 @md:pie-0 mbe-4 border-r border-separator'>\n <Tabs.Tablist classNames='max-bs-none overflow-y-visible'>\n <PluginList title='Options' plugins={corePlugins} />\n {filteredPlugins.length > 0 && <PluginList title='Plugins' plugins={filteredPlugins} gap />}\n </Tabs.Tablist>\n </div>\n\n {corePlugins.map((plugin) => (\n <Tabs.Tabpanel key={plugin.id} value={plugin.id} classNames='pli-3 @md:pli-5 max-bs-dvh overflow-y-auto'>\n <Surface role='settings' data={{ plugin: plugin.id }} />\n </Tabs.Tabpanel>\n ))}\n {filteredPlugins.map((plugin) => (\n <Tabs.Tabpanel key={plugin.id} value={plugin.id} classNames='pli-3 @md:pli-5 max-bs-dvh overflow-y-auto'>\n <Surface role='settings' data={{ plugin: plugin.id }} />\n </Tabs.Tabpanel>\n ))}\n </Tabs.Viewport>\n </Tabs.Root>\n </Dialog.Content>\n );\n};\n\nconst PluginList = ({ title, plugins, gap }: { title: string; plugins: Plugin['meta'][]; gap?: boolean }) => {\n return (\n <>\n <Tabs.TabGroupHeading classNames={gap ? 'mbs-4' : 'mbs-4 @md:mbs-2'}>{title}</Tabs.TabGroupHeading>\n {plugins.map((plugin) => (\n <Tabs.Tab key={plugin.id} value={plugin.id}>\n {plugin.name}\n </Tabs.Tab>\n ))}\n </>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type JSX, type PropsWithChildren } from 'react';\n\nimport { Input } from '@dxos/react-ui';\n\ntype SettingValueProps = {\n label: string;\n description?: JSX.Element;\n secondary?: JSX.Element;\n};\n\nexport const SettingsValue = ({ label, description, secondary, children }: PropsWithChildren<SettingValueProps>) => {\n const primary = (\n <div role='none' className='flex w-full gap-4 py-1'>\n <Input.Root>\n <div role='none' className='flex flex-col w-full'>\n {/* TODO(burdon): Consistent height for controls (e.g., Select, Textbox, and Checkbox are all different). */}\n <Input.Label classNames='flex min-h-[40px] items-center'>{label}</Input.Label>\n {description && (\n <Input.DescriptionAndValidation classNames='mbs-0.5'>\n <Input.Description>{description}</Input.Description>\n </Input.DescriptionAndValidation>\n )}\n </div>\n\n <div role='none'>\n <div role='none' className='flex min-h-[40px] items-center'>\n {children}\n </div>\n </div>\n </Input.Root>\n </div>\n );\n\n if (secondary) {\n // console.log(secondary);\n return (\n <div role='none' className='flex flex-col w-full'>\n {primary}\n {secondary}\n </div>\n );\n }\n\n return primary;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SETTINGS_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [SETTINGS_PLUGIN]: {\n 'open settings label': 'Show settings',\n 'settings dialog title': 'Settings',\n 'back label': 'Back',\n 'click to return to tablist description': 'Click the title to return to the settings menu',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SettingsPlugin } from './SettingsPlugin';\n\nexport default SettingsPlugin;\n\nexport * from './SettingsPlugin';\n\n// TODO(wittjosiah): Remove.\n// Settings should be exposed from plugins as state and intents rather than components.\nexport * from './components';\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport {\n type IntentResolverProvides,\n type PluginDefinition,\n type SurfaceProvides,\n parseIntentPlugin,\n resolvePlugin,\n LayoutAction,\n SettingsAction,\n type GraphBuilderProvides,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\n\nimport { SettingsDialog } from './components';\nimport meta, { SETTINGS_PLUGIN } from './meta';\nimport translations from './translations';\n\nconst DEFAULT_PLUGIN = 'dxos.org/plugin/registry';\n\nexport type SettingsPluginProvides = SurfaceProvides &\n IntentResolverProvides &\n GraphBuilderProvides &\n TranslationsProvides;\n\ntype SettingsSettingsProps = {\n selected: string;\n};\n\n/**\n * Plugin for aggregating and rendering plugin settings.\n */\nexport const SettingsPlugin = (): PluginDefinition<SettingsPluginProvides> => {\n const settings = new LocalStorageStore<SettingsSettingsProps>(SETTINGS_PLUGIN, { selected: DEFAULT_PLUGIN });\n\n return {\n meta,\n ready: async () => {\n settings.prop({ key: 'selected', type: LocalStorageStore.string() });\n },\n provides: {\n surface: {\n component: ({ data }) => {\n switch (data.component) {\n case `${SETTINGS_PLUGIN}/Settings`:\n return (\n <SettingsDialog\n selected={settings.values.selected}\n onSelected={(selected) => (settings.values.selected = selected)}\n />\n );\n\n default:\n return null;\n }\n },\n },\n intent: {\n resolver: (intent) => {\n switch (intent.action) {\n case SettingsAction.OPEN: {\n if (intent.data?.plugin) {\n settings.values.selected = intent.data?.plugin;\n }\n\n return {\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: `${SETTINGS_PLUGIN}/Settings`,\n dialogBlockAlign: 'start',\n },\n },\n ],\n ],\n };\n }\n }\n },\n },\n graph: {\n builder: (plugins) => {\n const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n\n return createExtension({\n id: SETTINGS_PLUGIN,\n filter: (node): node is Node<null> => node.id === 'root',\n actions: () => [\n {\n id: SETTINGS_PLUGIN,\n data: async () => {\n await intentPlugin?.provides.intent.dispatch({\n plugin: SETTINGS_PLUGIN,\n action: SettingsAction.OPEN,\n });\n },\n properties: {\n label: ['open settings label', { ns: SETTINGS_PLUGIN }],\n icon: 'ph--gear--regular',\n keyBinding: {\n macos: 'meta+,',\n windows: 'alt+,',\n },\n },\n },\n ],\n });\n },\n },\n translations,\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { type PluginMeta, Surface, usePlugins } from '@dxos/app-framework';\nimport { Button, Dialog, Icon, useTranslation } from '@dxos/react-ui';\nimport { Tabs, type TabsActivePart } from '@dxos/react-ui-tabs';\nimport { getSize } from '@dxos/react-ui-theme';\nimport { nonNullable } from '@dxos/util';\n\nimport { SETTINGS_PLUGIN } from '../meta';\n\nexport const SettingsDialog = ({\n selected,\n onSelected,\n}: {\n selected: string;\n onSelected: (plugin: string) => void;\n}) => {\n const { t } = useTranslation(SETTINGS_PLUGIN);\n const { plugins, enabled } = usePlugins();\n\n // TODO(burdon): Factor out common defs?\n const core = [\n 'dxos.org/plugin/layout',\n 'dxos.org/plugin/deck',\n 'dxos.org/plugin/files',\n 'dxos.org/plugin/space',\n 'dxos.org/plugin/stack',\n 'dxos.org/plugin/observability',\n 'dxos.org/plugin/registry',\n ];\n\n const sortPlugin = ({ name: a }: PluginMeta, { name: b }: PluginMeta) => a?.localeCompare(b ?? '') ?? 0;\n\n const corePlugins = core\n .map((id) => plugins.find((plugin) => plugin.meta.id === id)?.meta)\n .filter(nonNullable)\n .sort(sortPlugin);\n\n const filteredPlugins = enabled\n .filter((id) => !core.includes(id))\n .map((id) => plugins.find((plugin) => plugin.meta.id === id))\n .filter((plugin) => (plugin?.provides as any)?.settings)\n .map((plugin) => plugin!.meta)\n .sort(sortPlugin);\n\n const [tabsActivePart, setTabsActivePart] = useState<TabsActivePart>('list');\n\n return (\n <Dialog.Content classNames='p-0 bs-content max-bs-full md:max-is-[40rem] overflow-hidden'>\n <div role='none' className='flex justify-between mbe-1 pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5'>\n <Dialog.Title\n onClick={() => setTabsActivePart('list')}\n aria-description={t('click to return to tablist description')}\n classNames='flex cursor-pointer items-center group/title'\n >\n <Icon\n icon='ph--caret-left--regular'\n classNames={['@md:hidden', getSize(4), tabsActivePart === 'list' && 'invisible']}\n />\n <span\n className={\n tabsActivePart !== 'list'\n ? 'group-hover/title:underline @md:group-hover/title:no-underline underline-offset-4 decoration-1'\n : ''\n }\n >\n {t('settings dialog title')}\n </span>\n </Dialog.Title>\n <Dialog.Close asChild>\n <Button density='fine' variant='ghost' autoFocus>\n <Icon icon='ph--x--regular' size={3} />\n </Button>\n </Dialog.Close>\n </div>\n\n <Tabs.Root\n orientation='vertical'\n value={selected}\n onValueChange={(nextSelected) => onSelected(nextSelected)}\n activePart={tabsActivePart}\n onActivePartChange={setTabsActivePart}\n classNames='flex flex-col flex-1 mbs-2'\n >\n <Tabs.Viewport classNames='flex-1 min-bs-0'>\n <div role='none' className='overflow-y-auto pli-3 @md:pis-2 @md:pie-0 mbe-4 border-r border-separator'>\n <Tabs.Tablist classNames='flex flex-col gap-4 max-bs-none overflow-y-visible'>\n <PluginList title='Options' plugins={corePlugins} />\n {filteredPlugins.length > 0 && <PluginList title='Plugins' plugins={filteredPlugins} />}\n </Tabs.Tablist>\n </div>\n\n {corePlugins.map((plugin) => (\n <Tabs.Tabpanel key={plugin.id} value={plugin.id} classNames='pli-3 @md:pli-5 max-bs-dvh overflow-y-auto'>\n <Surface role='settings' data={{ plugin: plugin.id }} />\n </Tabs.Tabpanel>\n ))}\n {filteredPlugins.map((plugin) => (\n <Tabs.Tabpanel key={plugin.id} value={plugin.id} classNames='pli-3 @md:pli-5 max-bs-dvh overflow-y-auto'>\n <Surface role='settings' data={{ plugin: plugin.id }} />\n </Tabs.Tabpanel>\n ))}\n </Tabs.Viewport>\n </Tabs.Root>\n </Dialog.Content>\n );\n};\n\nconst PluginList = ({ title, plugins }: { title: string; plugins: PluginMeta[] }) => {\n return (\n <div role='none'>\n <Tabs.TabGroupHeading classNames={'pli-1 mlb-2 mbs-4 @md:mbs-2'}>{title}</Tabs.TabGroupHeading>\n <div className='flex flex-col ml-1'>\n {plugins.map((plugin) => (\n <Tabs.Tab key={plugin.id} value={plugin.id}>\n {plugin.name}\n </Tabs.Tab>\n ))}\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type JSX, type PropsWithChildren } from 'react';\n\nimport { Input } from '@dxos/react-ui';\n\ntype SettingValueProps = {\n label: string;\n description?: JSX.Element;\n secondary?: JSX.Element;\n};\n\nexport const SettingsValue = ({ label, description, secondary, children }: PropsWithChildren<SettingValueProps>) => {\n const primary = (\n <div role='none' className='flex w-full gap-4 py-1'>\n <Input.Root>\n <div role='none' className='flex flex-col w-full'>\n {/* TODO(burdon): Consistent height for controls (e.g., Select, Textbox, and Checkbox are all different). */}\n <Input.Label classNames='flex min-h-[40px] items-center'>{label}</Input.Label>\n {description && (\n <Input.DescriptionAndValidation classNames='mbs-0.5'>\n <Input.Description>{description}</Input.Description>\n </Input.DescriptionAndValidation>\n )}\n </div>\n\n <div role='none'>\n <div role='none' className='flex min-h-[40px] items-center'>\n {children}\n </div>\n </div>\n </Input.Root>\n </div>\n );\n\n if (secondary) {\n // console.log(secondary);\n return (\n <div role='none' className='flex flex-col w-full'>\n {primary}\n {secondary}\n </div>\n );\n }\n\n return primary;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SETTINGS_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [SETTINGS_PLUGIN]: {\n 'open settings label': 'Show settings',\n 'settings dialog title': 'Settings',\n 'back label': 'Back',\n 'click to return to tablist description': 'Click the title to return to the settings menu',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SettingsPlugin } from './SettingsPlugin';\n\nexport default SettingsPlugin;\n\nexport * from './SettingsPlugin';\n\n// TODO(wittjosiah): Remove.\n// Settings should be exposed from plugins as state and intents rather than components.\nexport * from './components';\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,OAAOA,YAAW;AAElB,SAIEC,mBACAC,eACAC,cACAC,sBAGK;AACP,SAASC,yBAAyB;AAClC,SAASC,uBAAkC;;;ACd3C,OAAOC,SAASC,gBAAgB;AAEhC,SAA0BC,SAASC,kBAAkB;AACrD,SAASC,QAAQC,QAAQC,MAAMC,sBAAsB;AACrD,SAASC,YAAiC;AAC1C,SAASC,eAAe;AACxB,SAASC,mBAAmB;AAIrB,IAAMC,iBAAiB,CAAC,EAC7BC,UACAC,WAAU,MAIX;AACC,QAAM,EAAEC,EAAC,IAAKC,eAAeC,eAAAA;AAC7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AW,CAAC,EAAEC,KAAI,MAAE;AAClB,kBAAQA,KAAKD,WAAS;YACpB,KAAK,GAAGV,eAAAA;AACN,qBACE,gBAAAY,OAAA,cAACC,gBAAAA;gBACCZ,UAAUH,SAASgB,OAAOb;gBAC1Bc,YAAY,CAACd,aAAcH,SAASgB,OAAOb,WAAWA;;YAI5D;AACE,qBAAO;UACX;QACF;MACF;MACAe,QAAQ;QACNC,UAAU,CAACD,WAAAA;AACT,kBAAQA,OAAOE,QAAM;YACnB,KAAKC,eAAeC,MAAM;AACxB,kBAAIJ,OAAOL,MAAMU,QAAQ;AACvBvB,yBAASgB,OAAOb,WAAWe,OAAOL,MAAMU;cAC1C;AAEA,qBAAO;gBACLC,SAAS;kBACP;oBACE;sBACEJ,QAAQK,aAAaC;sBACrBb,MAAM;wBACJc,SAAS;wBACTf,WAAW,GAAGV,eAAAA;wBACd0B,kBAAkB;sBACpB;oBACF;;;cAGN;YACF;UACF;QACF;MACF;MACAC,OAAO;QACLC,SAAS,CAACC,YAAAA;AACR,gBAAMC,eAAeC,cAAcF,SAASG,iBAAAA;AAE5C,iBAAOC,gBAAgB;YACrBC,IAAIlC;YACJmC,QAAQ,CAACC,SAA6BA,KAAKF,OAAO;YAClDG,SAAS,MAAM;cACb;gBACEH,IAAIlC;gBACJW,MAAM,YAAA;AACJ,wBAAMmB,cAActB,SAASQ,OAAOsB,SAAS;oBAC3CjB,QAAQrB;oBACRkB,QAAQC,eAAeC;kBACzB,CAAA;gBACF;gBACAmB,YAAY;kBACVC,OAAO;oBAAC;oBAAuB;sBAAEC,IAAIzC;oBAAgB;;kBACrD0C,MAAM;kBACNC,YAAY;oBACVC,OAAO;oBACPC,SAAS;kBACX;gBACF;cACF;;UAEJ,CAAA;QACF;MACF;MACAC;IACF;EACF;AACF;;;AInHA,IAAA,cAAeC;",
|
|
6
|
+
"names": ["React", "parseIntentPlugin", "resolvePlugin", "LayoutAction", "SettingsAction", "LocalStorageStore", "createExtension", "React", "useState", "Surface", "usePlugins", "Button", "Dialog", "Icon", "useTranslation", "Tabs", "getSize", "nonNullable", "SettingsDialog", "selected", "onSelected", "t", "useTranslation", "SETTINGS_PLUGIN", "plugins", "enabled", "usePlugins", "core", "sortPlugin", "name", "a", "b", "localeCompare", "corePlugins", "map", "id", "find", "plugin", "meta", "filter", "nonNullable", "sort", "filteredPlugins", "includes", "provides", "settings", "tabsActivePart", "setTabsActivePart", "useState", "Dialog", "Content", "classNames", "div", "role", "className", "Title", "onClick", "aria-description", "Icon", "icon", "getSize", "span", "Close", "asChild", "Button", "density", "variant", "autoFocus", "size", "Tabs", "Root", "orientation", "value", "onValueChange", "nextSelected", "activePart", "onActivePartChange", "Viewport", "Tablist", "PluginList", "title", "length", "Tabpanel", "key", "Surface", "data", "TabGroupHeading", "Tab", "React", "Input", "SettingsValue", "label", "description", "secondary", "children", "primary", "React", "div", "role", "className", "Input", "Root", "Label", "classNames", "DescriptionAndValidation", "Description", "SETTINGS_PLUGIN", "DEFAULT_PLUGIN", "SettingsPlugin", "settings", "LocalStorageStore", "SETTINGS_PLUGIN", "selected", "meta", "ready", "prop", "key", "type", "string", "provides", "surface", "component", "data", "React", "SettingsDialog", "values", "onSelected", "intent", "resolver", "action", "SettingsAction", "OPEN", "plugin", "intents", "LayoutAction", "SET_LAYOUT", "element", "dialogBlockAlign", "graph", "builder", "plugins", "intentPlugin", "resolvePlugin", "parseIntentPlugin", "createExtension", "id", "filter", "node", "actions", "dispatch", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "translations", "SettingsPlugin"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-settings/src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-settings/src/meta.ts":{"bytes":886,"imports":[],"format":"esm"},"packages/plugins/plugin-settings/src/components/SettingsDialog.tsx":{"bytes":15774,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-tabs","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-settings/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-settings/src/components/SettingsValue.tsx":{"bytes":4471,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-settings/src/components/index.ts":{"bytes":634,"imports":[{"path":"packages/plugins/plugin-settings/src/components/SettingsDialog.tsx","kind":"import-statement","original":"./SettingsDialog"},{"path":"packages/plugins/plugin-settings/src/components/SettingsValue.tsx","kind":"import-statement","original":"./SettingsValue"}],"format":"esm"},"packages/plugins/plugin-settings/src/translations.ts":{"bytes":1571,"imports":[{"path":"packages/plugins/plugin-settings/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-settings/src/SettingsPlugin.tsx":{"bytes":12272,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-settings/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/plugin-settings/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-settings/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-settings/src/index.ts":{"bytes":1216,"imports":[{"path":"packages/plugins/plugin-settings/src/SettingsPlugin.tsx","kind":"import-statement","original":"./SettingsPlugin"},{"path":"packages/plugins/plugin-settings/src/SettingsPlugin.tsx","kind":"import-statement","original":"./SettingsPlugin"},{"path":"packages/plugins/plugin-settings/src/components/index.ts","kind":"import-statement","original":"./components"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-settings/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16969},"packages/plugins/plugin-settings/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-settings/dist/lib/browser/chunk-PD3C4TDW.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-tabs","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["SettingsDialog","SettingsPlugin","SettingsValue","default"],"entryPoint":"packages/plugins/plugin-settings/src/index.ts","inputs":{"packages/plugins/plugin-settings/src/SettingsPlugin.tsx":{"bytesInOutput":2830},"packages/plugins/plugin-settings/src/components/SettingsDialog.tsx":{"bytesInOutput":4430},"packages/plugins/plugin-settings/src/components/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-settings/src/components/SettingsValue.tsx":{"bytesInOutput":1125},"packages/plugins/plugin-settings/src/translations.ts":{"bytesInOutput":318},"packages/plugins/plugin-settings/src/index.ts":{"bytesInOutput":34}},"bytes":9304},"packages/plugins/plugin-settings/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-settings/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/plugin-settings/dist/lib/browser/chunk-PD3C4TDW.mjs","kind":"import-statement"}],"exports":["SETTINGS_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-settings/src/meta.ts","inputs":{},"bytes":165},"packages/plugins/plugin-settings/dist/lib/browser/chunk-PD3C4TDW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":417},"packages/plugins/plugin-settings/dist/lib/browser/chunk-PD3C4TDW.mjs":{"imports":[],"exports":["SETTINGS_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-settings/src/meta.ts":{"bytesInOutput":96}},"bytes":235}}}
|
|
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_AHM6OLF2_exports = {};
|
|
20
|
+
__export(chunk_AHM6OLF2_exports, {
|
|
21
21
|
SETTINGS_PLUGIN: () => SETTINGS_PLUGIN,
|
|
22
22
|
meta_default: () => meta_default
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(chunk_AHM6OLF2_exports);
|
|
25
25
|
var SETTINGS_PLUGIN = "dxos.org/plugin/settings";
|
|
26
26
|
var meta_default = {
|
|
27
27
|
id: SETTINGS_PLUGIN
|
|
@@ -31,4 +31,4 @@ var meta_default = {
|
|
|
31
31
|
SETTINGS_PLUGIN,
|
|
32
32
|
meta_default
|
|
33
33
|
});
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-AHM6OLF2.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';\n\nexport default {\n id: SETTINGS_PLUGIN,\n} satisfies PluginMeta;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAMA,kBAAkB;AAE/B,IAAA,eAAe;EACbC,IAAID;AACN;",
|
|
6
|
+
"names": ["SETTINGS_PLUGIN", "id"]
|
|
7
|
+
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -34,22 +34,21 @@ __export(node_exports, {
|
|
|
34
34
|
default: () => src_default
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(node_exports);
|
|
37
|
-
var
|
|
38
|
-
var import_react = require("
|
|
39
|
-
var import_react2 = __toESM(require("react"));
|
|
37
|
+
var import_chunk_AHM6OLF2 = require("./chunk-AHM6OLF2.cjs");
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
40
39
|
var import_app_framework = require("@dxos/app-framework");
|
|
41
40
|
var import_local_storage = require("@dxos/local-storage");
|
|
42
41
|
var import_plugin_graph = require("@dxos/plugin-graph");
|
|
43
|
-
var
|
|
42
|
+
var import_react2 = __toESM(require("react"));
|
|
44
43
|
var import_app_framework2 = require("@dxos/app-framework");
|
|
45
44
|
var import_react_ui = require("@dxos/react-ui");
|
|
46
45
|
var import_react_ui_tabs = require("@dxos/react-ui-tabs");
|
|
47
46
|
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
48
47
|
var import_util = require("@dxos/util");
|
|
49
|
-
var
|
|
48
|
+
var import_react3 = __toESM(require("react"));
|
|
50
49
|
var import_react_ui2 = require("@dxos/react-ui");
|
|
51
50
|
var SettingsDialog = ({ selected, onSelected }) => {
|
|
52
|
-
const { t } = (0, import_react_ui.useTranslation)(
|
|
51
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_AHM6OLF2.SETTINGS_PLUGIN);
|
|
53
52
|
const { plugins, enabled } = (0, import_app_framework2.usePlugins)();
|
|
54
53
|
const core = [
|
|
55
54
|
"dxos.org/plugin/layout",
|
|
@@ -60,104 +59,108 @@ var SettingsDialog = ({ selected, onSelected }) => {
|
|
|
60
59
|
"dxos.org/plugin/observability",
|
|
61
60
|
"dxos.org/plugin/registry"
|
|
62
61
|
];
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
62
|
+
const sortPlugin = ({ name: a }, { name: b }) => a?.localeCompare(b ?? "") ?? 0;
|
|
63
|
+
const corePlugins = core.map((id) => plugins.find((plugin) => plugin.meta.id === id)?.meta).filter(import_util.nonNullable).sort(sortPlugin);
|
|
64
|
+
const filteredPlugins = enabled.filter((id) => !core.includes(id)).map((id) => plugins.find((plugin) => plugin.meta.id === id)).filter((plugin) => plugin?.provides?.settings).map((plugin) => plugin.meta).sort(sortPlugin);
|
|
65
|
+
const [tabsActivePart, setTabsActivePart] = (0, import_react2.useState)("list");
|
|
66
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Content, {
|
|
67
67
|
classNames: "p-0 bs-content max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
68
|
-
}, /* @__PURE__ */
|
|
68
|
+
}, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
69
69
|
role: "none",
|
|
70
70
|
className: "flex justify-between mbe-1 pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5"
|
|
71
|
-
}, /* @__PURE__ */
|
|
71
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Title, {
|
|
72
72
|
onClick: () => setTabsActivePart("list"),
|
|
73
73
|
"aria-description": t("click to return to tablist description"),
|
|
74
74
|
classNames: "flex cursor-pointer items-center group/title"
|
|
75
|
-
}, /* @__PURE__ */
|
|
75
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Icon, {
|
|
76
76
|
icon: "ph--caret-left--regular",
|
|
77
77
|
classNames: [
|
|
78
78
|
"@md:hidden",
|
|
79
79
|
(0, import_react_ui_theme.getSize)(4),
|
|
80
80
|
tabsActivePart === "list" && "invisible"
|
|
81
81
|
]
|
|
82
|
-
}), /* @__PURE__ */
|
|
82
|
+
}), /* @__PURE__ */ import_react2.default.createElement("span", {
|
|
83
83
|
className: tabsActivePart !== "list" ? "group-hover/title:underline @md:group-hover/title:no-underline underline-offset-4 decoration-1" : ""
|
|
84
|
-
}, t("settings dialog title"))), /* @__PURE__ */
|
|
84
|
+
}, t("settings dialog title"))), /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Close, {
|
|
85
85
|
asChild: true
|
|
86
|
-
}, /* @__PURE__ */
|
|
86
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Button, {
|
|
87
87
|
density: "fine",
|
|
88
88
|
variant: "ghost",
|
|
89
89
|
autoFocus: true
|
|
90
|
-
}, /* @__PURE__ */
|
|
90
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Icon, {
|
|
91
91
|
icon: "ph--x--regular",
|
|
92
92
|
size: 3
|
|
93
|
-
})))), /* @__PURE__ */
|
|
93
|
+
})))), /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Root, {
|
|
94
94
|
orientation: "vertical",
|
|
95
95
|
value: selected,
|
|
96
96
|
onValueChange: (nextSelected) => onSelected(nextSelected),
|
|
97
97
|
activePart: tabsActivePart,
|
|
98
98
|
onActivePartChange: setTabsActivePart,
|
|
99
99
|
classNames: "flex flex-col flex-1 mbs-2"
|
|
100
|
-
}, /* @__PURE__ */
|
|
100
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Viewport, {
|
|
101
101
|
classNames: "flex-1 min-bs-0"
|
|
102
|
-
}, /* @__PURE__ */
|
|
102
|
+
}, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
103
103
|
role: "none",
|
|
104
104
|
className: "overflow-y-auto pli-3 @md:pis-2 @md:pie-0 mbe-4 border-r border-separator"
|
|
105
|
-
}, /* @__PURE__ */
|
|
106
|
-
classNames: "max-bs-none overflow-y-visible"
|
|
107
|
-
}, /* @__PURE__ */
|
|
105
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Tablist, {
|
|
106
|
+
classNames: "flex flex-col gap-4 max-bs-none overflow-y-visible"
|
|
107
|
+
}, /* @__PURE__ */ import_react2.default.createElement(PluginList, {
|
|
108
108
|
title: "Options",
|
|
109
109
|
plugins: corePlugins
|
|
110
|
-
}), filteredPlugins.length > 0 && /* @__PURE__ */
|
|
110
|
+
}), filteredPlugins.length > 0 && /* @__PURE__ */ import_react2.default.createElement(PluginList, {
|
|
111
111
|
title: "Plugins",
|
|
112
|
-
plugins: filteredPlugins
|
|
113
|
-
|
|
114
|
-
}))), corePlugins.map((plugin) => /* @__PURE__ */ import_react3.default.createElement(import_react_ui_tabs.Tabs.Tabpanel, {
|
|
112
|
+
plugins: filteredPlugins
|
|
113
|
+
}))), corePlugins.map((plugin) => /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Tabpanel, {
|
|
115
114
|
key: plugin.id,
|
|
116
115
|
value: plugin.id,
|
|
117
116
|
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
118
|
-
}, /* @__PURE__ */
|
|
117
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_app_framework2.Surface, {
|
|
119
118
|
role: "settings",
|
|
120
119
|
data: {
|
|
121
120
|
plugin: plugin.id
|
|
122
121
|
}
|
|
123
|
-
}))), filteredPlugins.map((plugin) => /* @__PURE__ */
|
|
122
|
+
}))), filteredPlugins.map((plugin) => /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Tabpanel, {
|
|
124
123
|
key: plugin.id,
|
|
125
124
|
value: plugin.id,
|
|
126
125
|
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
127
|
-
}, /* @__PURE__ */
|
|
126
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_app_framework2.Surface, {
|
|
128
127
|
role: "settings",
|
|
129
128
|
data: {
|
|
130
129
|
plugin: plugin.id
|
|
131
130
|
}
|
|
132
131
|
}))))));
|
|
133
132
|
};
|
|
134
|
-
var PluginList = ({ title, plugins
|
|
135
|
-
return /* @__PURE__ */
|
|
136
|
-
|
|
137
|
-
},
|
|
133
|
+
var PluginList = ({ title, plugins }) => {
|
|
134
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
135
|
+
role: "none"
|
|
136
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.TabGroupHeading, {
|
|
137
|
+
classNames: "pli-1 mlb-2 mbs-4 @md:mbs-2"
|
|
138
|
+
}, title), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
139
|
+
className: "flex flex-col ml-1"
|
|
140
|
+
}, plugins.map((plugin) => /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Tab, {
|
|
138
141
|
key: plugin.id,
|
|
139
142
|
value: plugin.id
|
|
140
|
-
}, plugin.name)));
|
|
143
|
+
}, plugin.name))));
|
|
141
144
|
};
|
|
142
145
|
var SettingsValue = ({ label, description, secondary, children }) => {
|
|
143
|
-
const primary = /* @__PURE__ */
|
|
146
|
+
const primary = /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
144
147
|
role: "none",
|
|
145
148
|
className: "flex w-full gap-4 py-1"
|
|
146
|
-
}, /* @__PURE__ */
|
|
149
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
147
150
|
role: "none",
|
|
148
151
|
className: "flex flex-col w-full"
|
|
149
|
-
}, /* @__PURE__ */
|
|
152
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.Label, {
|
|
150
153
|
classNames: "flex min-h-[40px] items-center"
|
|
151
|
-
}, label), description && /* @__PURE__ */
|
|
154
|
+
}, label), description && /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.DescriptionAndValidation, {
|
|
152
155
|
classNames: "mbs-0.5"
|
|
153
|
-
}, /* @__PURE__ */
|
|
156
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.Description, null, description))), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
154
157
|
role: "none"
|
|
155
|
-
}, /* @__PURE__ */
|
|
158
|
+
}, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
156
159
|
role: "none",
|
|
157
160
|
className: "flex min-h-[40px] items-center"
|
|
158
161
|
}, children))));
|
|
159
162
|
if (secondary) {
|
|
160
|
-
return /* @__PURE__ */
|
|
163
|
+
return /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
161
164
|
role: "none",
|
|
162
165
|
className: "flex flex-col w-full"
|
|
163
166
|
}, primary, secondary);
|
|
@@ -167,7 +170,7 @@ var SettingsValue = ({ label, description, secondary, children }) => {
|
|
|
167
170
|
var translations_default = [
|
|
168
171
|
{
|
|
169
172
|
"en-US": {
|
|
170
|
-
[
|
|
173
|
+
[import_chunk_AHM6OLF2.SETTINGS_PLUGIN]: {
|
|
171
174
|
"open settings label": "Show settings",
|
|
172
175
|
"settings dialog title": "Settings",
|
|
173
176
|
"back label": "Back",
|
|
@@ -178,11 +181,11 @@ var translations_default = [
|
|
|
178
181
|
];
|
|
179
182
|
var DEFAULT_PLUGIN = "dxos.org/plugin/registry";
|
|
180
183
|
var SettingsPlugin = () => {
|
|
181
|
-
const settings = new import_local_storage.LocalStorageStore(
|
|
184
|
+
const settings = new import_local_storage.LocalStorageStore(import_chunk_AHM6OLF2.SETTINGS_PLUGIN, {
|
|
182
185
|
selected: DEFAULT_PLUGIN
|
|
183
186
|
});
|
|
184
187
|
return {
|
|
185
|
-
meta:
|
|
188
|
+
meta: import_chunk_AHM6OLF2.meta_default,
|
|
186
189
|
ready: async () => {
|
|
187
190
|
settings.prop({
|
|
188
191
|
key: "selected",
|
|
@@ -193,8 +196,8 @@ var SettingsPlugin = () => {
|
|
|
193
196
|
surface: {
|
|
194
197
|
component: ({ data }) => {
|
|
195
198
|
switch (data.component) {
|
|
196
|
-
case `${
|
|
197
|
-
return /* @__PURE__ */
|
|
199
|
+
case `${import_chunk_AHM6OLF2.SETTINGS_PLUGIN}/Settings`:
|
|
200
|
+
return /* @__PURE__ */ import_react.default.createElement(SettingsDialog, {
|
|
198
201
|
selected: settings.values.selected,
|
|
199
202
|
onSelected: (selected) => settings.values.selected = selected
|
|
200
203
|
});
|
|
@@ -217,7 +220,7 @@ var SettingsPlugin = () => {
|
|
|
217
220
|
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
218
221
|
data: {
|
|
219
222
|
element: "dialog",
|
|
220
|
-
component: `${
|
|
223
|
+
component: `${import_chunk_AHM6OLF2.SETTINGS_PLUGIN}/Settings`,
|
|
221
224
|
dialogBlockAlign: "start"
|
|
222
225
|
}
|
|
223
226
|
}
|
|
@@ -232,14 +235,14 @@ var SettingsPlugin = () => {
|
|
|
232
235
|
builder: (plugins) => {
|
|
233
236
|
const intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
|
|
234
237
|
return (0, import_plugin_graph.createExtension)({
|
|
235
|
-
id:
|
|
238
|
+
id: import_chunk_AHM6OLF2.SETTINGS_PLUGIN,
|
|
236
239
|
filter: (node) => node.id === "root",
|
|
237
240
|
actions: () => [
|
|
238
241
|
{
|
|
239
|
-
id:
|
|
242
|
+
id: import_chunk_AHM6OLF2.SETTINGS_PLUGIN,
|
|
240
243
|
data: async () => {
|
|
241
244
|
await intentPlugin?.provides.intent.dispatch({
|
|
242
|
-
plugin:
|
|
245
|
+
plugin: import_chunk_AHM6OLF2.SETTINGS_PLUGIN,
|
|
243
246
|
action: import_app_framework.SettingsAction.OPEN
|
|
244
247
|
});
|
|
245
248
|
},
|
|
@@ -247,11 +250,10 @@ var SettingsPlugin = () => {
|
|
|
247
250
|
label: [
|
|
248
251
|
"open settings label",
|
|
249
252
|
{
|
|
250
|
-
ns:
|
|
253
|
+
ns: import_chunk_AHM6OLF2.SETTINGS_PLUGIN
|
|
251
254
|
}
|
|
252
255
|
],
|
|
253
|
-
icon:
|
|
254
|
-
iconSymbol: "ph--gear--regular",
|
|
256
|
+
icon: "ph--gear--regular",
|
|
255
257
|
keyBinding: {
|
|
256
258
|
macos: "meta+,",
|
|
257
259
|
windows: "alt+,"
|