@ohos-ports/braneframe-plugin-settings 0.6.7-beta.1

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.
Files changed (38) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +15 -0
  3. package/dist/lib/browser/chunk-EDQ4DFLG.mjs +11 -0
  4. package/dist/lib/browser/chunk-EDQ4DFLG.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +231 -0
  6. package/dist/lib/browser/index.mjs.map +7 -0
  7. package/dist/lib/browser/meta.json +1 -0
  8. package/dist/lib/browser/meta.mjs +9 -0
  9. package/dist/lib/browser/meta.mjs.map +7 -0
  10. package/dist/lib/node/chunk-EHXHP3H5.cjs +34 -0
  11. package/dist/lib/node/chunk-EHXHP3H5.cjs.map +7 -0
  12. package/dist/lib/node/index.cjs +252 -0
  13. package/dist/lib/node/index.cjs.map +7 -0
  14. package/dist/lib/node/meta.cjs +30 -0
  15. package/dist/lib/node/meta.cjs.map +7 -0
  16. package/dist/lib/node/meta.json +1 -0
  17. package/dist/types/src/SettingsPlugin.d.ts +7 -0
  18. package/dist/types/src/SettingsPlugin.d.ts.map +1 -0
  19. package/dist/types/src/components/SettingsDialog.d.ts +6 -0
  20. package/dist/types/src/components/SettingsDialog.d.ts.map +1 -0
  21. package/dist/types/src/components/SettingsValue.d.ts +9 -0
  22. package/dist/types/src/components/SettingsValue.d.ts.map +1 -0
  23. package/dist/types/src/components/index.d.ts +3 -0
  24. package/dist/types/src/components/index.d.ts.map +1 -0
  25. package/dist/types/src/index.d.ts +5 -0
  26. package/dist/types/src/index.d.ts.map +1 -0
  27. package/dist/types/src/meta.d.ts +6 -0
  28. package/dist/types/src/meta.d.ts.map +1 -0
  29. package/dist/types/src/translations.d.ts +10 -0
  30. package/dist/types/src/translations.d.ts.map +1 -0
  31. package/package.json +70 -0
  32. package/src/SettingsPlugin.tsx +124 -0
  33. package/src/components/SettingsDialog.tsx +110 -0
  34. package/src/components/SettingsValue.tsx +49 -0
  35. package/src/components/index.ts +6 -0
  36. package/src/index.ts +13 -0
  37. package/src/meta.ts +9 -0
  38. package/src/translations.ts +16 -0
package/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ MIT License
2
+ Copyright (c) 2022 DXOS
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @braneframe/plugin-settings
2
+
3
+ DXOS app plugin for aggregating and rendering plugin settings.
4
+
5
+ ## DXOS Resources
6
+
7
+ - [Website](https://dxos.org)
8
+ - [Developer Documentation](https://docs.dxos.org)
9
+ - Talk to us on [Discord](https://dxos.org/discord)
10
+
11
+ ## Contributions
12
+
13
+ Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
14
+
15
+ License: [MIT](./LICENSE) Copyright 2023 © DXOS
@@ -0,0 +1,11 @@
1
+ // packages/apps/plugins/plugin-settings/src/meta.ts
2
+ var SETTINGS_PLUGIN = "dxos.org/plugin/settings";
3
+ var meta_default = {
4
+ id: SETTINGS_PLUGIN
5
+ };
6
+
7
+ export {
8
+ SETTINGS_PLUGIN,
9
+ meta_default
10
+ };
11
+ //# sourceMappingURL=chunk-EDQ4DFLG.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';\n\nexport default {\n id: SETTINGS_PLUGIN,\n};\n"],
5
+ "mappings": ";AAIO,IAAMA,kBAAkB;AAE/B,IAAA,eAAe;EACbC,IAAID;AACN;",
6
+ "names": ["SETTINGS_PLUGIN", "id"]
7
+ }
@@ -0,0 +1,231 @@
1
+ import {
2
+ SETTINGS_PLUGIN,
3
+ meta_default
4
+ } from "./chunk-EDQ4DFLG.mjs";
5
+
6
+ // packages/apps/plugins/plugin-settings/src/SettingsPlugin.tsx
7
+ import { Gear } from "@phosphor-icons/react";
8
+ import React3 from "react";
9
+ import { createExtension } from "@braneframe/plugin-graph";
10
+ import { parseIntentPlugin, resolvePlugin, LayoutAction, SettingsAction } from "@dxos/app-framework";
11
+ import { LocalStorageStore } from "@dxos/local-storage";
12
+
13
+ // packages/apps/plugins/plugin-settings/src/components/SettingsDialog.tsx
14
+ import React from "react";
15
+ import { Surface, usePlugins } from "@dxos/app-framework";
16
+ import { Button, Dialog, useTranslation } from "@ohos-ports/dxos-react-ui";
17
+ // dxos-react-ui 0.11.x removed List/ListItem (moved to the dedicated list package).
18
+ import { List, ListItem, ListItemHeading } from "@dxos/react-list";
19
+ import { ghostHover, ghostSelected } from "@ohos-ports/dxos-react-ui-theme";
20
+ import { nonNullable } from "@dxos/util";
21
+ var SettingsDialog = ({ selected, onSelected }) => {
22
+ const { t } = useTranslation(SETTINGS_PLUGIN);
23
+ const { plugins, enabled } = usePlugins();
24
+ const core = [
25
+ "dxos.org/plugin/layout",
26
+ "dxos.org/plugin/deck",
27
+ "dxos.org/plugin/files",
28
+ "dxos.org/plugin/space",
29
+ "dxos.org/plugin/stack",
30
+ "dxos.org/plugin/observability",
31
+ "dxos.org/plugin/registry"
32
+ ];
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(({ name: a }, { name: b }) => a?.localeCompare(b ?? "") ?? 0);
34
+ return /* @__PURE__ */ React.createElement(Dialog.Content, {
35
+ classNames: [
36
+ "bs-content max-bs-full md:max-is-[40rem] overflow-hidden"
37
+ ]
38
+ }, /* @__PURE__ */ React.createElement(Dialog.Title, null, t("settings dialog title")), /* @__PURE__ */ React.createElement("div", {
39
+ className: "grow mlb-4 overflow-hidden grid grid-cols-[minmax(min-content,1fr)_3fr] gap-1"
40
+ }, /* @__PURE__ */ React.createElement("div", {
41
+ className: "flex flex-col p-1 gap-4 surface-input rounded place-self-start max-bs-[100%] is-full overflow-y-auto"
42
+ }, /* @__PURE__ */ React.createElement(PluginList, {
43
+ title: "Options",
44
+ plugins: core.map((id) => plugins.find((plugin) => plugin.meta.id === id)?.meta).filter(nonNullable),
45
+ selected,
46
+ onSelect: (plugin) => onSelected(plugin)
47
+ }), filteredPlugins.length > 0 && /* @__PURE__ */ React.createElement(PluginList, {
48
+ title: "Plugins",
49
+ plugins: filteredPlugins,
50
+ selected,
51
+ onSelect: (plugin) => onSelected(plugin)
52
+ })), /* @__PURE__ */ React.createElement("div", {
53
+ className: "pli-1 md:pli-2 max-bs-[100%] overflow-y-auto"
54
+ }, /* @__PURE__ */ React.createElement(Surface, {
55
+ role: "settings",
56
+ data: {
57
+ plugin: selected
58
+ }
59
+ }))), /* @__PURE__ */ React.createElement(Dialog.Close, {
60
+ asChild: true
61
+ }, /* @__PURE__ */ React.createElement(Button, {
62
+ variant: "primary",
63
+ classNames: "mbs-2",
64
+ autoFocus: true
65
+ }, t("done label", {
66
+ ns: "os"
67
+ }))));
68
+ };
69
+ var PluginList = ({ title, plugins, selected, onSelect }) => {
70
+ return /* @__PURE__ */ React.createElement("div", {
71
+ role: "none"
72
+ }, /* @__PURE__ */ React.createElement("h2", {
73
+ className: "mlb-1 pli-2 text-sm text-neutral-500"
74
+ }, title), /* @__PURE__ */ React.createElement(List, {
75
+ selectable: true
76
+ }, plugins.map((plugin) => /* @__PURE__ */ React.createElement(ListItem, {
77
+ key: plugin.id,
78
+ selected: plugin.id === selected,
79
+ onClick: () => onSelect(plugin.id),
80
+ className: [
81
+ "px-2 rounded-sm",
82
+ ghostSelected,
83
+ ghostHover
84
+ ].join(" ")
85
+ }, /* @__PURE__ */ React.createElement(ListItemHeading, {
86
+ className: "flex w-full items-center cursor-pointer"
87
+ }, plugin.name)))));
88
+ };
89
+
90
+ // packages/apps/plugins/plugin-settings/src/components/SettingsValue.tsx
91
+ import React2 from "react";
92
+ import { Input } from "@ohos-ports/dxos-react-ui";
93
+ var SettingsValue = ({ label, description, secondary, children }) => {
94
+ const primary = /* @__PURE__ */ React2.createElement("div", {
95
+ role: "none",
96
+ className: "flex w-full gap-4 py-1"
97
+ }, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement("div", {
98
+ role: "none",
99
+ className: "flex flex-col w-full"
100
+ }, /* @__PURE__ */ React2.createElement(Input.Label, {
101
+ classNames: "flex min-h-[40px] items-center"
102
+ }, label), description && /* @__PURE__ */ React2.createElement(Input.DescriptionAndValidation, {
103
+ classNames: "mbs-0.5"
104
+ }, /* @__PURE__ */ React2.createElement(Input.Description, null, description))), /* @__PURE__ */ React2.createElement("div", {
105
+ role: "none"
106
+ }, /* @__PURE__ */ React2.createElement("div", {
107
+ role: "none",
108
+ className: "flex min-h-[40px] items-center"
109
+ }, children))));
110
+ if (secondary) {
111
+ return /* @__PURE__ */ React2.createElement("div", {
112
+ role: "none",
113
+ className: "flex flex-col w-full"
114
+ }, primary, secondary);
115
+ }
116
+ return primary;
117
+ };
118
+
119
+ // packages/apps/plugins/plugin-settings/src/translations.ts
120
+ var translations_default = [
121
+ {
122
+ "en-US": {
123
+ [SETTINGS_PLUGIN]: {
124
+ "open settings label": "Show settings",
125
+ "settings dialog title": "Settings"
126
+ }
127
+ }
128
+ }
129
+ ];
130
+
131
+ // packages/apps/plugins/plugin-settings/src/SettingsPlugin.tsx
132
+ var DEFAULT_PLUGIN = "dxos.org/plugin/registry";
133
+ var SettingsPlugin = () => {
134
+ const settings = new LocalStorageStore(SETTINGS_PLUGIN, {
135
+ selected: DEFAULT_PLUGIN
136
+ });
137
+ return {
138
+ meta: meta_default,
139
+ ready: async () => {
140
+ settings.prop({
141
+ key: "selected",
142
+ type: LocalStorageStore.string()
143
+ });
144
+ },
145
+ provides: {
146
+ surface: {
147
+ component: ({ data }) => {
148
+ switch (data.component) {
149
+ case `${SETTINGS_PLUGIN}/Settings`:
150
+ return /* @__PURE__ */ React3.createElement(SettingsDialog, {
151
+ selected: settings.values.selected,
152
+ onSelected: (selected) => settings.values.selected = selected
153
+ });
154
+ default:
155
+ return null;
156
+ }
157
+ }
158
+ },
159
+ intent: {
160
+ resolver: (intent) => {
161
+ switch (intent.action) {
162
+ case SettingsAction.OPEN: {
163
+ if (intent.data?.plugin) {
164
+ settings.values.selected = intent.data?.plugin;
165
+ }
166
+ return {
167
+ intents: [
168
+ [
169
+ {
170
+ action: LayoutAction.SET_LAYOUT,
171
+ data: {
172
+ element: "dialog",
173
+ component: `${SETTINGS_PLUGIN}/Settings`,
174
+ dialogBlockAlign: "start"
175
+ }
176
+ }
177
+ ]
178
+ ]
179
+ };
180
+ }
181
+ }
182
+ }
183
+ },
184
+ graph: {
185
+ builder: (plugins) => {
186
+ const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
187
+ return createExtension({
188
+ id: SETTINGS_PLUGIN,
189
+ filter: (node) => node.id === "root",
190
+ actions: () => [
191
+ {
192
+ id: SETTINGS_PLUGIN,
193
+ data: async () => {
194
+ await intentPlugin?.provides.intent.dispatch({
195
+ plugin: SETTINGS_PLUGIN,
196
+ action: SettingsAction.OPEN
197
+ });
198
+ },
199
+ properties: {
200
+ label: [
201
+ "open settings label",
202
+ {
203
+ ns: SETTINGS_PLUGIN
204
+ }
205
+ ],
206
+ icon: (props) => /* @__PURE__ */ React3.createElement(Gear, props),
207
+ iconSymbol: "ph--gear--regular",
208
+ keyBinding: {
209
+ macos: "meta+,",
210
+ windows: "alt+,"
211
+ }
212
+ }
213
+ }
214
+ ]
215
+ });
216
+ }
217
+ },
218
+ translations: translations_default
219
+ }
220
+ };
221
+ };
222
+
223
+ // packages/apps/plugins/plugin-settings/src/index.ts
224
+ var src_default = SettingsPlugin;
225
+ export {
226
+ SettingsDialog,
227
+ SettingsPlugin,
228
+ SettingsValue,
229
+ src_default as default
230
+ };
231
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 { createExtension, type Node } from '@braneframe/plugin-graph';\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';\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 from 'react';\n\nimport { type Plugin, Surface, usePlugins } from '@dxos/app-framework';\nimport { Button, Dialog, List, ListItem, useTranslation } from '@dxos/react-ui';\nimport { ghostHover, ghostSelected } 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 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 return (\n <Dialog.Content classNames={['bs-content max-bs-full md:max-is-[40rem] overflow-hidden']}>\n <Dialog.Title>{t('settings dialog title')}</Dialog.Title>\n\n <div className='grow mlb-4 overflow-hidden grid grid-cols-[minmax(min-content,1fr)_3fr] gap-1'>\n <div className='flex flex-col p-1 gap-4 surface-input rounded place-self-start max-bs-[100%] is-full overflow-y-auto'>\n <PluginList\n title='Options'\n plugins={core.map((id) => plugins.find((plugin) => plugin.meta.id === id)?.meta).filter(nonNullable)}\n selected={selected}\n onSelect={(plugin) => onSelected(plugin)}\n />\n\n {filteredPlugins.length > 0 && (\n <PluginList\n title='Plugins'\n plugins={filteredPlugins}\n selected={selected}\n onSelect={(plugin) => onSelected(plugin)}\n />\n )}\n </div>\n\n <div className='pli-1 md:pli-2 max-bs-[100%] overflow-y-auto'>\n <Surface role='settings' data={{ plugin: selected }} />\n </div>\n </div>\n\n <Dialog.Close asChild>\n <Button variant='primary' classNames='mbs-2' autoFocus>\n {t('done label', { ns: 'os' })}\n </Button>\n </Dialog.Close>\n </Dialog.Content>\n );\n};\n\nconst PluginList = ({\n title,\n plugins,\n selected,\n onSelect,\n}: {\n title: string;\n plugins: Plugin['meta'][];\n selected?: string;\n onSelect: (plugin: string) => void;\n}) => {\n return (\n <div role='none'>\n <h2 className='mlb-1 pli-2 text-sm text-neutral-500'>{title}</h2>\n <List selectable>\n {plugins.map((plugin) => (\n <ListItem.Root\n key={plugin.id}\n onClick={() => onSelect(plugin.id)}\n selected={plugin.id === selected}\n classNames={['px-2 rounded-sm', ghostSelected, ghostHover]}\n >\n <ListItem.Heading classNames={['flex w-full items-center cursor-pointer']}>{plugin.name}</ListItem.Heading>\n </ListItem.Root>\n ))}\n </List>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { 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 },\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": "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",
6
+ "names": ["Gear", "React", "createExtension", "parseIntentPlugin", "resolvePlugin", "LayoutAction", "SettingsAction", "LocalStorageStore", "React", "Surface", "usePlugins", "Button", "Dialog", "List", "ListItem", "useTranslation", "ghostHover", "ghostSelected", "nonNullable", "SettingsDialog", "selected", "onSelected", "t", "useTranslation", "SETTINGS_PLUGIN", "plugins", "enabled", "usePlugins", "core", "filteredPlugins", "filter", "id", "includes", "map", "find", "plugin", "meta", "provides", "settings", "sort", "name", "a", "b", "localeCompare", "Dialog", "Content", "classNames", "Title", "div", "className", "PluginList", "title", "nonNullable", "onSelect", "length", "Surface", "role", "data", "Close", "asChild", "Button", "variant", "autoFocus", "ns", "h2", "List", "selectable", "ListItem", "Root", "key", "onClick", "ghostSelected", "ghostHover", "Heading", "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", "props", "Gear", "iconSymbol", "keyBinding", "macos", "windows", "translations", "SettingsPlugin"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"packages/apps/plugins/plugin-settings/src/meta.ts":{"bytes":783,"imports":[],"format":"esm"},"packages/apps/plugins/plugin-settings/src/components/SettingsDialog.tsx":{"bytes":11671,"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-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/apps/plugins/plugin-settings/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/apps/plugins/plugin-settings/src/components/SettingsValue.tsx":{"bytes":4460,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"format":"esm"},"packages/apps/plugins/plugin-settings/src/components/index.ts":{"bytes":639,"imports":[{"path":"packages/apps/plugins/plugin-settings/src/components/SettingsDialog.tsx","kind":"import-statement","original":"./SettingsDialog"},{"path":"packages/apps/plugins/plugin-settings/src/components/SettingsValue.tsx","kind":"import-statement","original":"./SettingsValue"}],"format":"esm"},"packages/apps/plugins/plugin-settings/src/translations.ts":{"bytes":1218,"imports":[{"path":"packages/apps/plugins/plugin-settings/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/apps/plugins/plugin-settings/src/SettingsPlugin.tsx":{"bytes":12766,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@braneframe/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"packages/apps/plugins/plugin-settings/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/apps/plugins/plugin-settings/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/apps/plugins/plugin-settings/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/apps/plugins/plugin-settings/src/index.ts":{"bytes":1221,"imports":[{"path":"packages/apps/plugins/plugin-settings/src/SettingsPlugin.tsx","kind":"import-statement","original":"./SettingsPlugin"},{"path":"packages/apps/plugins/plugin-settings/src/SettingsPlugin.tsx","kind":"import-statement","original":"./SettingsPlugin"},{"path":"packages/apps/plugins/plugin-settings/src/components/index.ts","kind":"import-statement","original":"./components"}],"format":"esm"}},"outputs":{"packages/apps/plugins/plugin-settings/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15009},"packages/apps/plugins/plugin-settings/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/apps/plugins/plugin-settings/dist/lib/browser/chunk-EDQ4DFLG.mjs","kind":"import-statement"},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@braneframe/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/local-storage","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-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/apps/plugins/plugin-settings/src/index.ts","inputs":{"packages/apps/plugins/plugin-settings/src/SettingsPlugin.tsx":{"bytesInOutput":2974},"packages/apps/plugins/plugin-settings/src/components/SettingsDialog.tsx":{"bytesInOutput":3136},"packages/apps/plugins/plugin-settings/src/components/index.ts":{"bytesInOutput":0},"packages/apps/plugins/plugin-settings/src/components/SettingsValue.tsx":{"bytesInOutput":1125},"packages/apps/plugins/plugin-settings/src/translations.ts":{"bytesInOutput":188},"packages/apps/plugins/plugin-settings/src/index.ts":{"bytesInOutput":34}},"bytes":8054},"packages/apps/plugins/plugin-settings/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/apps/plugins/plugin-settings/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/apps/plugins/plugin-settings/dist/lib/browser/chunk-EDQ4DFLG.mjs","kind":"import-statement"}],"exports":["SETTINGS_PLUGIN","default"],"entryPoint":"packages/apps/plugins/plugin-settings/src/meta.ts","inputs":{},"bytes":165},"packages/apps/plugins/plugin-settings/dist/lib/browser/chunk-EDQ4DFLG.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":338},"packages/apps/plugins/plugin-settings/dist/lib/browser/chunk-EDQ4DFLG.mjs":{"imports":[],"exports":["SETTINGS_PLUGIN","meta_default"],"inputs":{"packages/apps/plugins/plugin-settings/src/meta.ts":{"bytesInOutput":96}},"bytes":240}}}
@@ -0,0 +1,9 @@
1
+ import {
2
+ SETTINGS_PLUGIN,
3
+ meta_default
4
+ } from "./chunk-EDQ4DFLG.mjs";
5
+ export {
6
+ SETTINGS_PLUGIN,
7
+ meta_default as default
8
+ };
9
+ //# sourceMappingURL=meta.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var chunk_EHXHP3H5_exports = {};
20
+ __export(chunk_EHXHP3H5_exports, {
21
+ SETTINGS_PLUGIN: () => SETTINGS_PLUGIN,
22
+ meta_default: () => meta_default
23
+ });
24
+ module.exports = __toCommonJS(chunk_EHXHP3H5_exports);
25
+ var SETTINGS_PLUGIN = "dxos.org/plugin/settings";
26
+ var meta_default = {
27
+ id: SETTINGS_PLUGIN
28
+ };
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ SETTINGS_PLUGIN,
32
+ meta_default
33
+ });
34
+ //# sourceMappingURL=chunk-EHXHP3H5.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';\n\nexport default {\n id: SETTINGS_PLUGIN,\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAMA,kBAAkB;AAE/B,IAAA,eAAe;EACbC,IAAID;AACN;",
6
+ "names": ["SETTINGS_PLUGIN", "id"]
7
+ }
@@ -0,0 +1,252 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var node_exports = {};
30
+ __export(node_exports, {
31
+ SettingsDialog: () => SettingsDialog,
32
+ SettingsPlugin: () => SettingsPlugin,
33
+ SettingsValue: () => SettingsValue,
34
+ default: () => src_default
35
+ });
36
+ module.exports = __toCommonJS(node_exports);
37
+ var import_chunk_EHXHP3H5 = require("./chunk-EHXHP3H5.cjs");
38
+ var import_react = require("@phosphor-icons/react");
39
+ var import_react2 = __toESM(require("react"));
40
+ var import_plugin_graph = require("@braneframe/plugin-graph");
41
+ var import_app_framework = require("@dxos/app-framework");
42
+ var import_local_storage = require("@dxos/local-storage");
43
+ var import_react3 = __toESM(require("react"));
44
+ var import_app_framework2 = require("@dxos/app-framework");
45
+ var import_react_ui = require("@ohos-ports/dxos-react-ui");
46
+ var import_react_ui_theme = require("@ohos-ports/dxos-react-ui-theme");
47
+ // dxos-react-ui 0.11.x removed List/ListItem (moved to the dedicated list package).
48
+ var import_react_list = require("@dxos/react-list");
49
+ var import_util = require("@dxos/util");
50
+ var import_react4 = __toESM(require("react"));
51
+ var import_react_ui2 = require("@ohos-ports/dxos-react-ui");
52
+ var SettingsDialog = ({ selected, onSelected }) => {
53
+ const { t } = (0, import_react_ui.useTranslation)(import_chunk_EHXHP3H5.SETTINGS_PLUGIN);
54
+ const { plugins, enabled } = (0, import_app_framework2.usePlugins)();
55
+ const core = [
56
+ "dxos.org/plugin/layout",
57
+ "dxos.org/plugin/deck",
58
+ "dxos.org/plugin/files",
59
+ "dxos.org/plugin/space",
60
+ "dxos.org/plugin/stack",
61
+ "dxos.org/plugin/observability",
62
+ "dxos.org/plugin/registry"
63
+ ];
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(({ name: a }, { name: b }) => a?.localeCompare(b ?? "") ?? 0);
65
+ return /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Dialog.Content, {
66
+ classNames: [
67
+ "bs-content max-bs-full md:max-is-[40rem] overflow-hidden"
68
+ ]
69
+ }, /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Dialog.Title, null, t("settings dialog title")), /* @__PURE__ */ import_react3.default.createElement("div", {
70
+ className: "grow mlb-4 overflow-hidden grid grid-cols-[minmax(min-content,1fr)_3fr] gap-1"
71
+ }, /* @__PURE__ */ import_react3.default.createElement("div", {
72
+ className: "flex flex-col p-1 gap-4 surface-input rounded place-self-start max-bs-[100%] is-full overflow-y-auto"
73
+ }, /* @__PURE__ */ import_react3.default.createElement(PluginList, {
74
+ title: "Options",
75
+ plugins: core.map((id) => plugins.find((plugin) => plugin.meta.id === id)?.meta).filter(import_util.nonNullable),
76
+ selected,
77
+ onSelect: (plugin) => onSelected(plugin)
78
+ }), filteredPlugins.length > 0 && /* @__PURE__ */ import_react3.default.createElement(PluginList, {
79
+ title: "Plugins",
80
+ plugins: filteredPlugins,
81
+ selected,
82
+ onSelect: (plugin) => onSelected(plugin)
83
+ })), /* @__PURE__ */ import_react3.default.createElement("div", {
84
+ className: "pli-1 md:pli-2 max-bs-[100%] overflow-y-auto"
85
+ }, /* @__PURE__ */ import_react3.default.createElement(import_app_framework2.Surface, {
86
+ role: "settings",
87
+ data: {
88
+ plugin: selected
89
+ }
90
+ }))), /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Dialog.Close, {
91
+ asChild: true
92
+ }, /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Button, {
93
+ variant: "primary",
94
+ classNames: "mbs-2",
95
+ autoFocus: true
96
+ }, t("done label", {
97
+ ns: "os"
98
+ }))));
99
+ };
100
+ var PluginList = ({ title, plugins, selected, onSelect }) => {
101
+ return /* @__PURE__ */ import_react3.default.createElement("div", {
102
+ role: "none"
103
+ }, /* @__PURE__ */ import_react3.default.createElement("h2", {
104
+ className: "mlb-1 pli-2 text-sm text-neutral-500"
105
+ }, title), /* @__PURE__ */ import_react3.default.createElement(import_react_list.List, {
106
+ selectable: true
107
+ }, plugins.map((plugin) => /* @__PURE__ */ import_react3.default.createElement(import_react_list.ListItem, {
108
+ key: plugin.id,
109
+ selected: plugin.id === selected,
110
+ onClick: () => onSelect(plugin.id),
111
+ className: [
112
+ "px-2 rounded-sm",
113
+ import_react_ui_theme.ghostSelected,
114
+ import_react_ui_theme.ghostHover
115
+ ].join(" ")
116
+ }, /* @__PURE__ */ import_react3.default.createElement(import_react_list.ListItemHeading, {
117
+ className: "flex w-full items-center cursor-pointer"
118
+ }, plugin.name)))));
119
+ };
120
+ var SettingsValue = ({ label, description, secondary, children }) => {
121
+ const primary = /* @__PURE__ */ import_react4.default.createElement("div", {
122
+ role: "none",
123
+ className: "flex w-full gap-4 py-1"
124
+ }, /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react4.default.createElement("div", {
125
+ role: "none",
126
+ className: "flex flex-col w-full"
127
+ }, /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.Label, {
128
+ classNames: "flex min-h-[40px] items-center"
129
+ }, label), description && /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.DescriptionAndValidation, {
130
+ classNames: "mbs-0.5"
131
+ }, /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.Description, null, description))), /* @__PURE__ */ import_react4.default.createElement("div", {
132
+ role: "none"
133
+ }, /* @__PURE__ */ import_react4.default.createElement("div", {
134
+ role: "none",
135
+ className: "flex min-h-[40px] items-center"
136
+ }, children))));
137
+ if (secondary) {
138
+ return /* @__PURE__ */ import_react4.default.createElement("div", {
139
+ role: "none",
140
+ className: "flex flex-col w-full"
141
+ }, primary, secondary);
142
+ }
143
+ return primary;
144
+ };
145
+ var translations_default = [
146
+ {
147
+ "en-US": {
148
+ [import_chunk_EHXHP3H5.SETTINGS_PLUGIN]: {
149
+ "open settings label": "Show settings",
150
+ "settings dialog title": "Settings"
151
+ }
152
+ }
153
+ }
154
+ ];
155
+ var DEFAULT_PLUGIN = "dxos.org/plugin/registry";
156
+ var SettingsPlugin = () => {
157
+ const settings = new import_local_storage.LocalStorageStore(import_chunk_EHXHP3H5.SETTINGS_PLUGIN, {
158
+ selected: DEFAULT_PLUGIN
159
+ });
160
+ return {
161
+ meta: import_chunk_EHXHP3H5.meta_default,
162
+ ready: async () => {
163
+ settings.prop({
164
+ key: "selected",
165
+ type: import_local_storage.LocalStorageStore.string()
166
+ });
167
+ },
168
+ provides: {
169
+ surface: {
170
+ component: ({ data }) => {
171
+ switch (data.component) {
172
+ case `${import_chunk_EHXHP3H5.SETTINGS_PLUGIN}/Settings`:
173
+ return /* @__PURE__ */ import_react2.default.createElement(SettingsDialog, {
174
+ selected: settings.values.selected,
175
+ onSelected: (selected) => settings.values.selected = selected
176
+ });
177
+ default:
178
+ return null;
179
+ }
180
+ }
181
+ },
182
+ intent: {
183
+ resolver: (intent) => {
184
+ switch (intent.action) {
185
+ case import_app_framework.SettingsAction.OPEN: {
186
+ if (intent.data?.plugin) {
187
+ settings.values.selected = intent.data?.plugin;
188
+ }
189
+ return {
190
+ intents: [
191
+ [
192
+ {
193
+ action: import_app_framework.LayoutAction.SET_LAYOUT,
194
+ data: {
195
+ element: "dialog",
196
+ component: `${import_chunk_EHXHP3H5.SETTINGS_PLUGIN}/Settings`,
197
+ dialogBlockAlign: "start"
198
+ }
199
+ }
200
+ ]
201
+ ]
202
+ };
203
+ }
204
+ }
205
+ }
206
+ },
207
+ graph: {
208
+ builder: (plugins) => {
209
+ const intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
210
+ return (0, import_plugin_graph.createExtension)({
211
+ id: import_chunk_EHXHP3H5.SETTINGS_PLUGIN,
212
+ filter: (node) => node.id === "root",
213
+ actions: () => [
214
+ {
215
+ id: import_chunk_EHXHP3H5.SETTINGS_PLUGIN,
216
+ data: async () => {
217
+ await intentPlugin?.provides.intent.dispatch({
218
+ plugin: import_chunk_EHXHP3H5.SETTINGS_PLUGIN,
219
+ action: import_app_framework.SettingsAction.OPEN
220
+ });
221
+ },
222
+ properties: {
223
+ label: [
224
+ "open settings label",
225
+ {
226
+ ns: import_chunk_EHXHP3H5.SETTINGS_PLUGIN
227
+ }
228
+ ],
229
+ icon: (props) => /* @__PURE__ */ import_react2.default.createElement(import_react.Gear, props),
230
+ iconSymbol: "ph--gear--regular",
231
+ keyBinding: {
232
+ macos: "meta+,",
233
+ windows: "alt+,"
234
+ }
235
+ }
236
+ }
237
+ ]
238
+ });
239
+ }
240
+ },
241
+ translations: translations_default
242
+ }
243
+ };
244
+ };
245
+ var src_default = SettingsPlugin;
246
+ // Annotate the CommonJS export names for ESM import in node:
247
+ 0 && (module.exports = {
248
+ SettingsDialog,
249
+ SettingsPlugin,
250
+ SettingsValue
251
+ });
252
+ //# sourceMappingURL=index.cjs.map