@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
@@ -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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAqC;AACrC,IAAAA,gBAAkB;AAElB,0BAA2C;AAC3C,2BAUO;AACP,2BAAkC;ACflC,IAAAA,gBAAkB;AAElB,IAAAC,wBAAiD;AACjD,sBAA+D;AAC/D,4BAA0C;AAC1C,kBAA4B;ACL5B,IAAAD,gBAA8C;AAE9C,IAAAE,mBAAsB;ADOf,IAAMC,iBAAiB,CAAC,EAC7BC,UACAC,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6C,SAAS;wBACTV,WAAW,GAAGrE,qCAAAA;wBACdgF,kBAAkB;sBACpB;oBACF;;;cAGN;YACF;UACF;QACF;MACF;MACAC,OAAO;QACLC,SAAS,CAACjF,YAAAA;AACR,gBAAMkF,mBAAeC,oCAAcnF,SAASoF,sCAAAA;AAE5C,qBAAOC,qCAAgB;YACrB/E,IAAIP;YACJM,QAAQ,CAACiF,SAA6BA,KAAKhF,OAAO;YAClDiF,SAAS,MAAM;cACb;gBACEjF,IAAIP;gBACJkC,MAAM,YAAA;AACJ,wBAAMiD,cAActE,SAAS0D,OAAOkB,SAAS;oBAC3C9E,QAAQX;oBACRyE,QAAQC,oCAAeC;kBACzB,CAAA;gBACF;gBACAe,YAAY;kBACVtC,OAAO;oBAAC;oBAAuB;sBAAEZ,IAAIxC;oBAAgB;;kBACrD2F,MAAM,CAACC,UAAqBxE,8BAAAA,QAAA,cAACyE,mBAASD,KAAAA;kBACtCE,YAAY;kBACZC,YAAY;oBACVC,OAAO;oBACPC,SAAS;kBACX;gBACF;cACF;;UAEJ,CAAA;QACF;MACF;MACAC,cAAAA;IACF;EACF;AACF;AIrHA,IAAA,cAAepC;",
6
+ "names": ["import_react", "import_app_framework", "import_react_ui", "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", "React", "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", "SettingsValue", "label", "description", "secondary", "children", "primary", "Input", "Label", "DescriptionAndValidation", "Description", "DEFAULT_PLUGIN", "SettingsPlugin", "LocalStorageStore", "ready", "prop", "type", "string", "surface", "component", "values", "intent", "resolver", "action", "SettingsAction", "OPEN", "intents", "LayoutAction", "SET_LAYOUT", "element", "dialogBlockAlign", "graph", "builder", "intentPlugin", "resolvePlugin", "parseIntentPlugin", "createExtension", "node", "actions", "dispatch", "properties", "icon", "props", "Gear", "iconSymbol", "keyBinding", "macos", "windows", "translations"]
7
+ }
@@ -0,0 +1,30 @@
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 meta_exports = {};
20
+ __export(meta_exports, {
21
+ SETTINGS_PLUGIN: () => import_chunk_EHXHP3H5.SETTINGS_PLUGIN,
22
+ default: () => import_chunk_EHXHP3H5.meta_default
23
+ });
24
+ module.exports = __toCommonJS(meta_exports);
25
+ var import_chunk_EHXHP3H5 = require("./chunk-EHXHP3H5.cjs");
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {
28
+ SETTINGS_PLUGIN
29
+ });
30
+ //# sourceMappingURL=meta.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["meta.cjs"],
4
+ "sourcesContent": ["import {\n SETTINGS_PLUGIN,\n meta_default\n} from \"./chunk-EHXHP3H5.cjs\";\nexport {\n SETTINGS_PLUGIN,\n meta_default as default\n};\n//# sourceMappingURL=meta.cjs.map\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAGO;",
6
+ "names": []
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/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15009},"packages/apps/plugins/plugin-settings/dist/lib/node/index.cjs":{"imports":[{"path":"packages/apps/plugins/plugin-settings/dist/lib/node/chunk-EHXHP3H5.cjs","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/node/meta.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/apps/plugins/plugin-settings/dist/lib/node/meta.cjs":{"imports":[{"path":"packages/apps/plugins/plugin-settings/dist/lib/node/chunk-EHXHP3H5.cjs","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/node/chunk-EHXHP3H5.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":338},"packages/apps/plugins/plugin-settings/dist/lib/node/chunk-EHXHP3H5.cjs":{"imports":[],"exports":["SETTINGS_PLUGIN","meta_default"],"inputs":{"packages/apps/plugins/plugin-settings/src/meta.ts":{"bytesInOutput":96}},"bytes":240}}}
@@ -0,0 +1,7 @@
1
+ import { type IntentResolverProvides, type PluginDefinition, type SurfaceProvides, type GraphBuilderProvides, type TranslationsProvides } from '@dxos/app-framework';
2
+ export type SettingsPluginProvides = SurfaceProvides & IntentResolverProvides & GraphBuilderProvides & TranslationsProvides;
3
+ /**
4
+ * Plugin for aggregating and rendering plugin settings.
5
+ */
6
+ export declare const SettingsPlugin: () => PluginDefinition<SettingsPluginProvides>;
7
+ //# sourceMappingURL=SettingsPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsPlugin.d.ts","sourceRoot":"","sources":["../../../src/SettingsPlugin.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAKpB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAS7B,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAClD,sBAAsB,GACtB,oBAAoB,GACpB,oBAAoB,CAAC;AAMvB;;GAEG;AACH,eAAO,MAAM,cAAc,QAAO,iBAAiB,sBAAsB,CAoFxE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export declare const SettingsDialog: ({ selected, onSelected, }: {
3
+ selected: string;
4
+ onSelected: (plugin: string) => void;
5
+ }) => JSX.Element;
6
+ //# sourceMappingURL=SettingsDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/SettingsDialog.tsx"],"names":[],"mappings":";AAaA,eAAO,MAAM,cAAc,8BAGxB;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,gBAyDA,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ type SettingValueProps = {
3
+ label: string;
4
+ description?: JSX.Element;
5
+ secondary?: JSX.Element;
6
+ };
7
+ export declare const SettingsValue: ({ label, description, secondary, children }: PropsWithChildren<SettingValueProps>) => JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=SettingsValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsValue.d.ts","sourceRoot":"","sources":["../../../../src/components/SettingsValue.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAItD,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,aAAa,gDAAiD,kBAAkB,iBAAiB,CAAC,gBAkC9G,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './SettingsDialog';
2
+ export * from './SettingsValue';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { SettingsPlugin } from './SettingsPlugin';
2
+ export default SettingsPlugin;
3
+ export * from './SettingsPlugin';
4
+ export * from './components';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,eAAe,cAAc,CAAC;AAE9B,cAAc,kBAAkB,CAAC;AAIjC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const SETTINGS_PLUGIN = "dxos.org/plugin/settings";
2
+ declare const _default: {
3
+ id: string;
4
+ };
5
+ export default _default;
6
+ //# sourceMappingURL=meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,6BAA6B,CAAC;;;;AAE1D,wBAEE"}
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ 'en-US': {
3
+ "dxos.org/plugin/settings": {
4
+ 'open settings label': string;
5
+ 'settings dialog title': string;
6
+ };
7
+ };
8
+ }[];
9
+ export default _default;
10
+ //# sourceMappingURL=translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;AAMA,wBASE"}
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@ohos-ports/braneframe-plugin-settings",
3
+ "version": "0.6.7-beta.1",
4
+ "description": "DXOS app plugin for aggregating and rendering plugin settings.",
5
+ "homepage": "https://github.com/ohos-ports/ohos-ports/tree/main/ports/braneframe-plugin-settings/0.6.7",
6
+ "bugs": {
7
+ "url": "https://github.com/ohos-ports/ohos-ports/issues"
8
+ },
9
+ "license": "MIT",
10
+ "author": "DXOS.org",
11
+ "exports": {
12
+ ".": {
13
+ "browser": "./dist/lib/browser/index.mjs",
14
+ "node": {
15
+ "default": "./dist/lib/node/index.cjs"
16
+ },
17
+ "types": "./dist/types/src/index.d.ts"
18
+ },
19
+ "./meta": {
20
+ "browser": "./dist/lib/browser/meta.mjs",
21
+ "node": {
22
+ "default": "./dist/lib/node/meta.cjs"
23
+ },
24
+ "types": "./dist/types/src/meta.d.ts"
25
+ }
26
+ },
27
+ "types": "dist/types/src/index.d.ts",
28
+ "typesVersions": {
29
+ "*": {
30
+ "meta": [
31
+ "dist/types/src/meta.d.ts"
32
+ ]
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "src"
38
+ ],
39
+ "dependencies": {
40
+ "@dxos/local-storage": "0.6.7",
41
+ "@dxos/util": "0.6.7",
42
+ "@dxos/react-list": "^0.11.1",
43
+ "@braneframe/plugin-graph": "0.6.7"
44
+ },
45
+ "devDependencies": {
46
+ "@phosphor-icons/react": "^2.1.5",
47
+ "@types/react": "^18.0.21",
48
+ "react": "~18.2.0",
49
+ "@ohos-ports/vite": "^8.3.0-beta.0",
50
+ "@dxos/app-framework": "0.6.7",
51
+ "@ohos-ports/dxos-react-ui": "^0.11.1-beta.0",
52
+ "@dxos/storybook-utils": "0.6.7",
53
+ "@ohos-ports/dxos-react-ui-theme": "^0.8.3-beta.0"
54
+ },
55
+ "peerDependencies": {
56
+ "@phosphor-icons/react": "^2.1.5",
57
+ "react": "~18.2.0",
58
+ "@dxos/app-framework": "0.6.7",
59
+ "@ohos-ports/dxos-react-ui": "^0.11.1-beta.0",
60
+ "@ohos-ports/dxos-react-ui-theme": "^0.8.3-beta.0"
61
+ },
62
+ "publishConfig": {
63
+ "access": "public"
64
+ },
65
+ "repository": {
66
+ "type": "git",
67
+ "url": "https://github.com/ohos-ports/ohos-ports.git",
68
+ "directory": "ports/braneframe-plugin-settings/0.6.7"
69
+ }
70
+ }
@@ -0,0 +1,124 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Gear, type IconProps } from '@phosphor-icons/react';
6
+ import React from 'react';
7
+
8
+ import { createExtension, type Node } from '@braneframe/plugin-graph';
9
+ import {
10
+ type IntentResolverProvides,
11
+ type PluginDefinition,
12
+ type SurfaceProvides,
13
+ parseIntentPlugin,
14
+ resolvePlugin,
15
+ LayoutAction,
16
+ SettingsAction,
17
+ type GraphBuilderProvides,
18
+ type TranslationsProvides,
19
+ } from '@dxos/app-framework';
20
+ import { LocalStorageStore } from '@dxos/local-storage';
21
+
22
+ import { SettingsDialog } from './components';
23
+ import meta, { SETTINGS_PLUGIN } from './meta';
24
+ import translations from './translations';
25
+
26
+ const DEFAULT_PLUGIN = 'dxos.org/plugin/registry';
27
+
28
+ export type SettingsPluginProvides = SurfaceProvides &
29
+ IntentResolverProvides &
30
+ GraphBuilderProvides &
31
+ TranslationsProvides;
32
+
33
+ type SettingsSettingsProps = {
34
+ selected: string;
35
+ };
36
+
37
+ /**
38
+ * Plugin for aggregating and rendering plugin settings.
39
+ */
40
+ export const SettingsPlugin = (): PluginDefinition<SettingsPluginProvides> => {
41
+ const settings = new LocalStorageStore<SettingsSettingsProps>(SETTINGS_PLUGIN, { selected: DEFAULT_PLUGIN });
42
+
43
+ return {
44
+ meta,
45
+ ready: async () => {
46
+ settings.prop({ key: 'selected', type: LocalStorageStore.string() });
47
+ },
48
+ provides: {
49
+ surface: {
50
+ component: ({ data }) => {
51
+ switch (data.component) {
52
+ case `${SETTINGS_PLUGIN}/Settings`:
53
+ return (
54
+ <SettingsDialog
55
+ selected={settings.values.selected}
56
+ onSelected={(selected) => (settings.values.selected = selected)}
57
+ />
58
+ );
59
+
60
+ default:
61
+ return null;
62
+ }
63
+ },
64
+ },
65
+ intent: {
66
+ resolver: (intent) => {
67
+ switch (intent.action) {
68
+ case SettingsAction.OPEN: {
69
+ if (intent.data?.plugin) {
70
+ settings.values.selected = intent.data?.plugin;
71
+ }
72
+
73
+ return {
74
+ intents: [
75
+ [
76
+ {
77
+ action: LayoutAction.SET_LAYOUT,
78
+ data: {
79
+ element: 'dialog',
80
+ component: `${SETTINGS_PLUGIN}/Settings`,
81
+ dialogBlockAlign: 'start',
82
+ },
83
+ },
84
+ ],
85
+ ],
86
+ };
87
+ }
88
+ }
89
+ },
90
+ },
91
+ graph: {
92
+ builder: (plugins) => {
93
+ const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
94
+
95
+ return createExtension({
96
+ id: SETTINGS_PLUGIN,
97
+ filter: (node): node is Node<null> => node.id === 'root',
98
+ actions: () => [
99
+ {
100
+ id: SETTINGS_PLUGIN,
101
+ data: async () => {
102
+ await intentPlugin?.provides.intent.dispatch({
103
+ plugin: SETTINGS_PLUGIN,
104
+ action: SettingsAction.OPEN,
105
+ });
106
+ },
107
+ properties: {
108
+ label: ['open settings label', { ns: SETTINGS_PLUGIN }],
109
+ icon: (props: IconProps) => <Gear {...props} />,
110
+ iconSymbol: 'ph--gear--regular',
111
+ keyBinding: {
112
+ macos: 'meta+,',
113
+ windows: 'alt+,',
114
+ },
115
+ },
116
+ },
117
+ ],
118
+ });
119
+ },
120
+ },
121
+ translations,
122
+ },
123
+ };
124
+ };
@@ -0,0 +1,110 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { type Plugin, Surface, usePlugins } from '@dxos/app-framework';
8
+ import { Button, Dialog, useTranslation } from '@ohos-ports/dxos-react-ui';
9
+ // dxos-react-ui 0.11.x removed List/ListItem (moved to the dedicated list package).
10
+ // @dxos/react-list provides the headless primitives and loads in Node ESM.
11
+ import { List, ListItem, ListItemHeading } from '@dxos/react-list';
12
+ import { ghostHover, ghostSelected } from '@ohos-ports/dxos-react-ui-theme';
13
+ import { nonNullable } from '@dxos/util';
14
+
15
+ import { SETTINGS_PLUGIN } from '../meta';
16
+
17
+ export const SettingsDialog = ({
18
+ selected,
19
+ onSelected,
20
+ }: {
21
+ selected: string;
22
+ onSelected: (plugin: string) => void;
23
+ }) => {
24
+ const { t } = useTranslation(SETTINGS_PLUGIN);
25
+ const { plugins, enabled } = usePlugins();
26
+
27
+ // TODO(burdon): Factor out common defs?
28
+ const core = [
29
+ 'dxos.org/plugin/layout',
30
+ 'dxos.org/plugin/deck',
31
+ 'dxos.org/plugin/files',
32
+ 'dxos.org/plugin/space',
33
+ 'dxos.org/plugin/stack',
34
+ 'dxos.org/plugin/observability',
35
+ 'dxos.org/plugin/registry',
36
+ ];
37
+
38
+ const filteredPlugins = enabled
39
+ .filter((id) => !core.includes(id))
40
+ .map((id) => plugins.find((plugin) => plugin.meta.id === id))
41
+ .filter((plugin) => (plugin?.provides as any)?.settings)
42
+ .map((plugin) => plugin!.meta)
43
+ .sort(({ name: a }, { name: b }) => a?.localeCompare(b ?? '') ?? 0);
44
+
45
+ return (
46
+ <Dialog.Content classNames={['bs-content max-bs-full md:max-is-[40rem] overflow-hidden']}>
47
+ <Dialog.Title>{t('settings dialog title')}</Dialog.Title>
48
+
49
+ <div className='grow mlb-4 overflow-hidden grid grid-cols-[minmax(min-content,1fr)_3fr] gap-1'>
50
+ <div className='flex flex-col p-1 gap-4 surface-input rounded place-self-start max-bs-[100%] is-full overflow-y-auto'>
51
+ <PluginList
52
+ title='Options'
53
+ plugins={core.map((id) => plugins.find((plugin) => plugin.meta.id === id)?.meta).filter(nonNullable)}
54
+ selected={selected}
55
+ onSelect={(plugin) => onSelected(plugin)}
56
+ />
57
+
58
+ {filteredPlugins.length > 0 && (
59
+ <PluginList
60
+ title='Plugins'
61
+ plugins={filteredPlugins}
62
+ selected={selected}
63
+ onSelect={(plugin) => onSelected(plugin)}
64
+ />
65
+ )}
66
+ </div>
67
+
68
+ <div className='pli-1 md:pli-2 max-bs-[100%] overflow-y-auto'>
69
+ <Surface role='settings' data={{ plugin: selected }} />
70
+ </div>
71
+ </div>
72
+
73
+ <Dialog.Close asChild>
74
+ <Button variant='primary' classNames='mbs-2' autoFocus>
75
+ {t('done label', { ns: 'os' })}
76
+ </Button>
77
+ </Dialog.Close>
78
+ </Dialog.Content>
79
+ );
80
+ };
81
+
82
+ const PluginList = ({
83
+ title,
84
+ plugins,
85
+ selected,
86
+ onSelect,
87
+ }: {
88
+ title: string;
89
+ plugins: Plugin['meta'][];
90
+ selected?: string;
91
+ onSelect: (plugin: string) => void;
92
+ }) => {
93
+ return (
94
+ <div role='none'>
95
+ <h2 className='mlb-1 pli-2 text-sm text-neutral-500'>{title}</h2>
96
+ <List selectable>
97
+ {plugins.map((plugin) => (
98
+ <ListItem
99
+ key={plugin.id}
100
+ selected={plugin.id === selected}
101
+ onClick={() => onSelect(plugin.id)}
102
+ className={['px-2 rounded-sm', ghostSelected, ghostHover].join(' ')}
103
+ >
104
+ <ListItemHeading className='flex w-full items-center cursor-pointer'>{plugin.name}</ListItemHeading>
105
+ </ListItem>
106
+ ))}
107
+ </List>
108
+ </div>
109
+ );
110
+ };
@@ -0,0 +1,49 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React, { type PropsWithChildren } from 'react';
6
+
7
+ import { Input } from '@ohos-ports/dxos-react-ui';
8
+
9
+ type SettingValueProps = {
10
+ label: string;
11
+ description?: JSX.Element;
12
+ secondary?: JSX.Element;
13
+ };
14
+
15
+ export const SettingsValue = ({ label, description, secondary, children }: PropsWithChildren<SettingValueProps>) => {
16
+ const primary = (
17
+ <div role='none' className='flex w-full gap-4 py-1'>
18
+ <Input.Root>
19
+ <div role='none' className='flex flex-col w-full'>
20
+ {/* TODO(burdon): Consistent height for controls (e.g., Select, Textbox, and Checkbox are all different). */}
21
+ <Input.Label classNames='flex min-h-[40px] items-center'>{label}</Input.Label>
22
+ {description && (
23
+ <Input.DescriptionAndValidation classNames='mbs-0.5'>
24
+ <Input.Description>{description}</Input.Description>
25
+ </Input.DescriptionAndValidation>
26
+ )}
27
+ </div>
28
+
29
+ <div role='none'>
30
+ <div role='none' className='flex min-h-[40px] items-center'>
31
+ {children}
32
+ </div>
33
+ </div>
34
+ </Input.Root>
35
+ </div>
36
+ );
37
+
38
+ if (secondary) {
39
+ // console.log(secondary);
40
+ return (
41
+ <div role='none' className='flex flex-col w-full'>
42
+ {primary}
43
+ {secondary}
44
+ </div>
45
+ );
46
+ }
47
+
48
+ return primary;
49
+ };
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './SettingsDialog';
6
+ export * from './SettingsValue';
package/src/index.ts ADDED
@@ -0,0 +1,13 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { SettingsPlugin } from './SettingsPlugin';
6
+
7
+ export default SettingsPlugin;
8
+
9
+ export * from './SettingsPlugin';
10
+
11
+ // TODO(wittjosiah): Remove.
12
+ // Settings should be exposed from plugins as state and intents rather than components.
13
+ export * from './components';
package/src/meta.ts ADDED
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';
6
+
7
+ export default {
8
+ id: SETTINGS_PLUGIN,
9
+ };
@@ -0,0 +1,16 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { SETTINGS_PLUGIN } from './meta';
6
+
7
+ export default [
8
+ {
9
+ 'en-US': {
10
+ [SETTINGS_PLUGIN]: {
11
+ 'open settings label': 'Show settings',
12
+ 'settings dialog title': 'Settings',
13
+ },
14
+ },
15
+ },
16
+ ];