@babylonjs/shared-ui-components 9.2.0 → 9.2.2

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 (116) hide show
  1. package/fluent/hoc/buttonLine.js +2 -1
  2. package/fluent/hoc/buttonLine.js.map +1 -1
  3. package/fluent/primitives/accordion.contexts.js +2 -2
  4. package/fluent/primitives/accordion.contexts.js.map +1 -1
  5. package/fluent/primitives/contextMenu.js.map +1 -1
  6. package/fluent/primitives/popover.js.map +1 -1
  7. package/fluent/primitives/tooltip.d.ts +1 -1
  8. package/fluent/primitives/tooltip.js.map +1 -1
  9. package/modularTool/components/errorBoundary.d.ts +31 -0
  10. package/modularTool/components/errorBoundary.js +91 -0
  11. package/modularTool/components/errorBoundary.js.map +1 -0
  12. package/modularTool/components/extensibleAccordion.d.ts +67 -0
  13. package/modularTool/components/extensibleAccordion.js +148 -0
  14. package/modularTool/components/extensibleAccordion.js.map +1 -0
  15. package/modularTool/components/pane.d.ts +4 -0
  16. package/modularTool/components/pane.js +20 -0
  17. package/modularTool/components/pane.js.map +1 -0
  18. package/modularTool/components/teachingMoment.d.ts +20 -0
  19. package/modularTool/components/teachingMoment.js +17 -0
  20. package/modularTool/components/teachingMoment.js.map +1 -0
  21. package/modularTool/components/theme.d.ts +10 -0
  22. package/modularTool/components/theme.js +24 -0
  23. package/modularTool/components/theme.js.map +1 -0
  24. package/modularTool/components/uxContextProvider.d.ts +2 -0
  25. package/modularTool/components/uxContextProvider.js +19 -0
  26. package/modularTool/components/uxContextProvider.js.map +1 -0
  27. package/modularTool/contexts/extensionManagerContext.d.ts +6 -0
  28. package/modularTool/contexts/extensionManagerContext.js +6 -0
  29. package/modularTool/contexts/extensionManagerContext.js.map +1 -0
  30. package/modularTool/contexts/settingsContext.d.ts +3 -0
  31. package/modularTool/contexts/settingsContext.js +6 -0
  32. package/modularTool/contexts/settingsContext.js.map +1 -0
  33. package/modularTool/extensibility/builtInsExtensionFeed.d.ts +21 -0
  34. package/modularTool/extensibility/builtInsExtensionFeed.js +26 -0
  35. package/modularTool/extensibility/builtInsExtensionFeed.js.map +1 -0
  36. package/modularTool/extensibility/extensionFeed.d.ts +113 -0
  37. package/modularTool/extensibility/extensionFeed.js +2 -0
  38. package/modularTool/extensibility/extensionFeed.js.map +1 -0
  39. package/modularTool/extensibility/extensionManager.d.ts +111 -0
  40. package/modularTool/extensibility/extensionManager.js +277 -0
  41. package/modularTool/extensibility/extensionManager.js.map +1 -0
  42. package/modularTool/hooks/observableHooks.d.ts +35 -0
  43. package/modularTool/hooks/observableHooks.js +84 -0
  44. package/modularTool/hooks/observableHooks.js.map +1 -0
  45. package/modularTool/hooks/resourceHooks.d.ts +20 -0
  46. package/modularTool/hooks/resourceHooks.js +101 -0
  47. package/modularTool/hooks/resourceHooks.js.map +1 -0
  48. package/modularTool/hooks/settingsHooks.d.ts +8 -0
  49. package/modularTool/hooks/settingsHooks.js +40 -0
  50. package/modularTool/hooks/settingsHooks.js.map +1 -0
  51. package/modularTool/hooks/teachingMomentHooks.d.ts +34 -0
  52. package/modularTool/hooks/teachingMomentHooks.js +89 -0
  53. package/modularTool/hooks/teachingMomentHooks.js.map +1 -0
  54. package/modularTool/hooks/themeHooks.d.ts +17 -0
  55. package/modularTool/hooks/themeHooks.js +38 -0
  56. package/modularTool/hooks/themeHooks.js.map +1 -0
  57. package/modularTool/hooks/useResizeHandle.d.ts +35 -0
  58. package/modularTool/hooks/useResizeHandle.js +75 -0
  59. package/modularTool/hooks/useResizeHandle.js.map +1 -0
  60. package/modularTool/misc/assert.d.ts +5 -0
  61. package/modularTool/misc/assert.js +10 -0
  62. package/modularTool/misc/assert.js.map +1 -0
  63. package/modularTool/misc/graphUtils.d.ts +44 -0
  64. package/modularTool/misc/graphUtils.js +90 -0
  65. package/modularTool/misc/graphUtils.js.map +1 -0
  66. package/modularTool/misc/observableCollection.d.ts +23 -0
  67. package/modularTool/misc/observableCollection.js +43 -0
  68. package/modularTool/misc/observableCollection.js.map +1 -0
  69. package/modularTool/modularTool.d.ts +42 -0
  70. package/modularTool/modularTool.js +244 -0
  71. package/modularTool/modularTool.js.map +1 -0
  72. package/modularTool/modularity/serviceContainer.d.ts +64 -0
  73. package/modularTool/modularity/serviceContainer.js +181 -0
  74. package/modularTool/modularity/serviceContainer.js.map +1 -0
  75. package/modularTool/modularity/serviceDefinition.d.ts +64 -0
  76. package/modularTool/modularity/serviceDefinition.js +11 -0
  77. package/modularTool/modularity/serviceDefinition.js.map +1 -0
  78. package/modularTool/services/extensionsListService.d.ts +3 -0
  79. package/modularTool/services/extensionsListService.js +202 -0
  80. package/modularTool/services/extensionsListService.js.map +1 -0
  81. package/modularTool/services/globalSettings.d.ts +3 -0
  82. package/modularTool/services/globalSettings.js +9 -0
  83. package/modularTool/services/globalSettings.js.map +1 -0
  84. package/modularTool/services/reactContextService.d.ts +18 -0
  85. package/modularTool/services/reactContextService.js +5 -0
  86. package/modularTool/services/reactContextService.js.map +1 -0
  87. package/modularTool/services/settingsService.d.ts +24 -0
  88. package/modularTool/services/settingsService.js +41 -0
  89. package/modularTool/services/settingsService.js.map +1 -0
  90. package/modularTool/services/settingsStore.d.ts +55 -0
  91. package/modularTool/services/settingsStore.js +35 -0
  92. package/modularTool/services/settingsStore.js.map +1 -0
  93. package/modularTool/services/shellService.d.ts +256 -0
  94. package/modularTool/services/shellService.js +729 -0
  95. package/modularTool/services/shellService.js.map +1 -0
  96. package/modularTool/services/shellSettingsService.d.ts +3 -0
  97. package/modularTool/services/shellSettingsService.js +35 -0
  98. package/modularTool/services/shellSettingsService.js.map +1 -0
  99. package/modularTool/services/themeSelectorService.d.ts +3 -0
  100. package/modularTool/services/themeSelectorService.js +42 -0
  101. package/modularTool/services/themeSelectorService.js.map +1 -0
  102. package/modularTool/services/themeService.d.ts +60 -0
  103. package/modularTool/services/themeService.js +69 -0
  104. package/modularTool/services/themeService.js.map +1 -0
  105. package/modularTool/services/toastService.d.ts +17 -0
  106. package/modularTool/services/toastService.js +5 -0
  107. package/modularTool/services/toastService.js.map +1 -0
  108. package/modularTool/themes/babylonTheme.d.ts +3 -0
  109. package/modularTool/themes/babylonTheme.js +36 -0
  110. package/modularTool/themes/babylonTheme.js.map +1 -0
  111. package/nodeGraphSystem/graphCanvas.js +2 -1
  112. package/nodeGraphSystem/graphCanvas.js.map +1 -1
  113. package/nodeGraphSystem/graphNode.d.ts +2 -0
  114. package/nodeGraphSystem/graphNode.js +5 -1
  115. package/nodeGraphSystem/graphNode.js.map +1 -1
  116. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensibleAccordion.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/components/extensibleAccordion.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAwD,QAAQ,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExK,OAAO,EAAmD,SAAS,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEhJ,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,SAAS,eAAe,CAAI,KAAU;IAClC,OAAO,KAAK,CAAC;AACjB,CAAC;AAkDD,MAAM,SAAS,GAAG,UAAU,CAAC;IACzB,OAAO,EAAE;QACL,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,MAAM;QACf,aAAa,EAAE,QAAQ;KAC1B;CACJ,CAAC,CAAC;AAaH;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAC/B,KAOC;IAED,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;IAE5B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAEpF,MAAM,e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WithChildren, type Ref, Children, isValidElement, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from \"react\";\r\n\r\nimport { type AccordionProps, type AccordionSectionProps, Accordion, AccordionSection } from \"shared-ui-components/fluent/primitives/accordion\";\r\n\r\nimport { makeStyles } from \"@fluentui/react-components\";\r\n\r\nimport { UXContextProvider } from \"./uxContextProvider\";\r\n\r\nfunction AsReadonlyArray<T>(array: T[]): readonly T[] {\r\n return array;\r\n}\r\n\r\n/**\r\n * Describes a section within a dynamic accordion that can be added at runtime.\r\n */\r\nexport type DynamicAccordionSection = Readonly<{\r\n /**\r\n * A unique identity for the section, which can be referenced by section content.\r\n */\r\n identity: string;\r\n\r\n /**\r\n * An optional order for the section, relative to other sections.\r\n * Defaults to 0.\r\n */\r\n order?: number;\r\n\r\n /**\r\n * An optional flag indicating whether the section should be collapsed by default.\r\n * Defaults to false.\r\n */\r\n collapseByDefault?: boolean;\r\n}>;\r\n\r\n/**\r\n * Describes content that belongs to a section within a dynamic accordion.\r\n */\r\nexport type DynamicAccordionSectionContent<ContextT> = Readonly<{\r\n /**\r\n * A unique key for the the content.\r\n */\r\n key: string;\r\n\r\n /**\r\n * The section this content belongs to.\r\n */\r\n section: string;\r\n\r\n /**\r\n * An optional order for the content within the section.\r\n * Defaults to 0.\r\n */\r\n order?: number;\r\n\r\n /**\r\n * The React component that will be rendered for this content.\r\n */\r\n component: ComponentType<{ context: ContextT }>;\r\n}>;\r\n\r\nconst useStyles = makeStyles({\r\n rootDiv: {\r\n flex: 1,\r\n overflow: \"hidden\",\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n },\r\n});\r\n\r\n/**\r\n * Imperative handle for controlling section highlights on the extensible accordion.\r\n */\r\nexport type SectionsImperativeRef = {\r\n /**\r\n * Highlights the specified sections, collapsing all others until the context changes.\r\n * @param sections The identity strings of the sections to highlight.\r\n */\r\n highlightSections: (sections: readonly string[]) => void;\r\n};\r\n\r\n/**\r\n * An accordion component that supports dynamically adding sections and section content at runtime.\r\n * Combines statically defined children sections with dynamically registered sections and content.\r\n * @param props The accordion props including sections, section content, context, and an optional imperative ref.\r\n * @returns The extensible accordion component.\r\n */\r\nexport function ExtensibleAccordion<ContextT = unknown>(\r\n props: PropsWithChildren<\r\n {\r\n sections: readonly DynamicAccordionSection[];\r\n sectionContent: readonly DynamicAccordionSectionContent<ContextT>[];\r\n context: ContextT;\r\n sectionsRef?: Ref<SectionsImperativeRef>;\r\n } & AccordionProps\r\n >\r\n) {\r\n const classes = useStyles();\r\n\r\n const { children, sections, sectionContent, context, sectionsRef, ...rest } = props;\r\n\r\n const defaultSections = useMemo(() => {\r\n const defaultSections: DynamicAccordionSection[] = [];\r\n if (children) {\r\n Children.forEach(children, (child) => {\r\n if (isValidElement(child)) {\r\n const childProps = child.props as AccordionSectionProps;\r\n defaultSections.push({\r\n identity: childProps.title,\r\n collapseByDefault: childProps.collapseByDefault,\r\n });\r\n }\r\n });\r\n }\r\n return AsReadonlyArray(defaultSections);\r\n }, [children]);\r\n\r\n // Cache stable component wrappers for static (children-based) sections so that\r\n // React does not unmount/remount them on every re-render. The components read\r\n // the latest child element from `elements` so they always render fresh content.\r\n const staticComponentCacheRef = useRef<{\r\n elements: Map<string, React.ReactNode>;\r\n components: Map<string, ComponentType<{ context: ContextT }>>;\r\n }>({ elements: new Map(), components: new Map() });\r\n\r\n const defaultSectionContent = useMemo(() => {\r\n const cache = staticComponentCacheRef.current;\r\n cache.elements.clear();\r\n const defaultSectionContent: DynamicAccordionSectionContent<ContextT>[] = [];\r\n if (children) {\r\n Children.forEach(children, (child, index) => {\r\n if (isValidElement(child)) {\r\n const childProps = child.props as AccordionSectionProps;\r\n const key = child.key ?? childProps.title;\r\n\r\n // Update the element so the stable component renders the latest content.\r\n cache.elements.set(key, child);\r\n\r\n // Create a stable component wrapper only once per key.\r\n if (!cache.components.has(key)) {\r\n const capturedKey = key;\r\n cache.components.set(capturedKey, () => <>{cache.elements.get(capturedKey)}</>);\r\n }\r\n\r\n defaultSectionContent.push({\r\n key,\r\n section: defaultSections[index].identity,\r\n component: cache.components.get(key)!,\r\n });\r\n }\r\n });\r\n }\r\n return AsReadonlyArray(defaultSectionContent);\r\n }, [children, defaultSections]);\r\n\r\n const mergedSectionContent = useMemo(() => {\r\n return AsReadonlyArray(\r\n [...defaultSectionContent, ...sectionContent].map((content, index) => {\r\n return {\r\n ...content,\r\n key: `${content.key}-${index}`,\r\n order: content.order ?? index,\r\n } as const;\r\n })\r\n );\r\n }, [defaultSectionContent, sectionContent]);\r\n\r\n const mergedSections = useMemo(() => {\r\n const mergedSections = [...defaultSections.map((s) => ({ ...s, isDefault: true as const })), ...sections.map((s) => ({ ...s, isDefault: false as const }))];\r\n\r\n // Check for implicit sections (e.g. sections that were not explicitly defined, but referenced by content).\r\n const implicitSections: DynamicAccordionSection[] = [];\r\n for (const sectionContent of mergedSectionContent) {\r\n if (!mergedSections.some((s) => s.identity === sectionContent.section) && !implicitSections.some((s) => s.identity === sectionContent.section)) {\r\n implicitSections.push({ identity: sectionContent.section });\r\n }\r\n }\r\n\r\n return AsReadonlyArray(\r\n [...implicitSections.map((s) => ({ ...s, isDefault: false as const })), ...mergedSections].map((section, index) => {\r\n return {\r\n ...section,\r\n order: section.order ?? index,\r\n collapseByDefault: section.collapseByDefault ?? false,\r\n } as const;\r\n })\r\n );\r\n }, [defaultSections, sections, mergedSectionContent]);\r\n\r\n const visibleSections = useMemo(() => {\r\n if (!context) {\r\n return [];\r\n }\r\n\r\n const sortedSections = [...mergedSections].sort((a, b) => {\r\n // Default sections always come before non-default sections.\r\n if (a.isDefault !== b.isDefault) {\r\n return a.isDefault ? -1 : 1;\r\n }\r\n return a.order - b.order;\r\n });\r\n\r\n return sortedSections\r\n .map((section) => {\r\n // Get a flat list of the section content, preserving the key so it can be used when each component for each section is rendered.\r\n const contentForSection = mergedSectionContent.filter((content) => content.section === section.identity);\r\n\r\n // If there is no content for this section, we skip it.\r\n if (contentForSection.length === 0) {\r\n return null; // No content for this section\r\n }\r\n\r\n // Sort the content for this section by order, defaulting to 0 if not specified.\r\n contentForSection.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\r\n\r\n // Return the section with its identity, collapseByDefault flag, and the content components to render.\r\n return {\r\n identity: section.identity,\r\n collapseByDefault: section.collapseByDefault ?? false,\r\n components: contentForSection.map((content) => <content.component key={content.key} context={context} />),\r\n };\r\n })\r\n .filter((section) => section !== null);\r\n }, [mergedSections, mergedSectionContent, context]);\r\n\r\n const [highlightSections, setHighlightSections] = useState<readonly string[]>();\r\n\r\n // When the context changes, clear any existing highlights.\r\n useLayoutEffect(() => {\r\n setHighlightSections(undefined);\r\n }, [context]);\r\n\r\n // This just assigns the returned object to any type of React ref, whether it is\r\n // a mutable ref with a 'current' property or whether it is a callback, useImperativeHandle\r\n // will deal with it.\r\n useImperativeHandle(sectionsRef, () => {\r\n return {\r\n highlightSections: (sectionsToHighlight: readonly string[]) => {\r\n if (sectionsToHighlight.length > 0) {\r\n setHighlightSections(sectionsToHighlight);\r\n }\r\n },\r\n };\r\n }, []);\r\n\r\n return (\r\n <div className={classes.rootDiv}>\r\n {visibleSections.length > -1 && (\r\n <UXContextProvider>\r\n <Accordion highlightSections={highlightSections} {...rest}>\r\n {...visibleSections.map((section) => {\r\n return (\r\n <AccordionSection key={section.identity} title={section.identity} collapseByDefault={section.collapseByDefault}>\r\n {section.components}\r\n </AccordionSection>\r\n );\r\n })}\r\n </Accordion>\r\n </UXContextProvider>\r\n )}\r\n </div>\r\n );\r\n}\r\n"]}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Used to apply common styles to panes.
3
+ */
4
+ export declare const SidePaneContainer: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { makeStyles, mergeClasses, tokens } from "@fluentui/react-components";
4
+ const useStyles = makeStyles({
5
+ paneRootDiv: {
6
+ display: "flex",
7
+ flex: 1,
8
+ flexDirection: "column",
9
+ padding: `0 ${tokens.spacingHorizontalM}`,
10
+ },
11
+ });
12
+ /**
13
+ * Used to apply common styles to panes.
14
+ */
15
+ export const SidePaneContainer = forwardRef((props, ref) => {
16
+ const { className, ...rest } = props;
17
+ const classes = useStyles();
18
+ return (_jsx("div", { className: mergeClasses(classes.paneRootDiv, className), ref: ref, ...rest, children: props.children }));
19
+ });
20
+ //# sourceMappingURL=pane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pane.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/components/pane.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAuB,UAAU,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAE9E,MAAM,SAAS,GAAG,UAAU,CAAC;IACzB,WAAW,EAAE;QACT,OAAO,EAAE,MAAM;QACf,IAAI,EAAE,CAAC;QACP,aAAa,EAAE,QAAQ;QACvB,OAAO,EAAE,KAAK,MAAM,CAAC,kBAAkB,EAAE;KAC5C;CACJ,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAwC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC9F,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;IAE5B,OAAO,CACH,cAAK,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,KAAM,IAAI,YAC3E,KAAK,CAAC,QAAQ,GACb,CACT,CAAC;AACN,CAAC,CAAC,CAAC","sourcesContent":["import { type ComponentProps, forwardRef } from \"react\";\r\n\r\nimport { makeStyles, mergeClasses, tokens } from \"@fluentui/react-components\";\r\n\r\nconst useStyles = makeStyles({\r\n paneRootDiv: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n padding: `0 ${tokens.spacingHorizontalM}`,\r\n },\r\n});\r\n\r\n/**\r\n * Used to apply common styles to panes.\r\n */\r\nexport const SidePaneContainer = forwardRef<HTMLDivElement, ComponentProps<\"div\">>((props, ref) => {\r\n const { className, ...rest } = props;\r\n const classes = useStyles();\r\n\r\n return (\r\n <div className={mergeClasses(classes.paneRootDiv, className)} ref={ref} {...rest}>\r\n {props.children}\r\n </div>\r\n );\r\n});\r\n"]}
@@ -0,0 +1,20 @@
1
+ import { type FunctionComponent } from "react";
2
+ import { type MakePopoverTeachingMoment } from "../hooks/teachingMomentHooks.js";
3
+ /**
4
+ * The state returned by the teaching moment hook.
5
+ */
6
+ type TeachingMomentState = ReturnType<ReturnType<typeof MakePopoverTeachingMoment>>;
7
+ /**
8
+ * Props for the {@link TeachingMoment} component.
9
+ */
10
+ type TeachingMomentProps = Pick<TeachingMomentState, "shouldDisplay" | "positioningRef" | "onOpenChange"> & {
11
+ title: string;
12
+ description: string;
13
+ };
14
+ /**
15
+ * A component that displays a teaching moment popover.
16
+ * @param props Props for the teaching moment popover.
17
+ * @returns The teaching moment popover.
18
+ */
19
+ export declare const TeachingMoment: FunctionComponent<TeachingMomentProps>;
20
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { makeStyles, TeachingPopover, TeachingPopoverBody, TeachingPopoverHeader, TeachingPopoverSurface } from "@fluentui/react-components";
3
+ const useStyles = makeStyles({
4
+ extensionTeachingPopover: {
5
+ maxWidth: "320px",
6
+ },
7
+ });
8
+ /**
9
+ * A component that displays a teaching moment popover.
10
+ * @param props Props for the teaching moment popover.
11
+ * @returns The teaching moment popover.
12
+ */
13
+ export const TeachingMoment = ({ shouldDisplay, positioningRef, onOpenChange, title, description }) => {
14
+ const classes = useStyles();
15
+ return (_jsx(TeachingPopover, { appearance: "brand", open: shouldDisplay, positioning: { positioningRef }, onOpenChange: onOpenChange, children: _jsxs(TeachingPopoverSurface, { className: classes.extensionTeachingPopover, children: [_jsx(TeachingPopoverHeader, { children: title }), _jsx(TeachingPopoverBody, { children: description })] }) }));
16
+ };
17
+ //# sourceMappingURL=teachingMoment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teachingMoment.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/components/teachingMoment.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAE7I,MAAM,SAAS,GAAG,UAAU,CAAC;IACzB,wBAAwB,EAAE;QACtB,QAAQ,EAAE,OAAO;KACpB;CACJ,CAAC,CAAC;AAeH;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAA2C,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE;IAC1I,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;IAE5B,OAAO,CACH,KAAC,eAAe,IAAC,UAAU,EAAC,OAAO,EAAC,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,EAAE,cAAc,EAAE,EAAE,YAAY,EAAE,YAAY,YAChH,MAAC,sBAAsB,IAAC,SAAS,EAAE,OAAO,CAAC,wBAAwB,aAC/D,KAAC,qBAAqB,cAAE,KAAK,GAAyB,EACtD,KAAC,mBAAmB,cAAE,WAAW,GAAuB,IACnC,GACX,CACrB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { type FunctionComponent } from \"react\";\r\nimport { type MakePopoverTeachingMoment } from \"../hooks/teachingMomentHooks\";\r\n\r\nimport { makeStyles, TeachingPopover, TeachingPopoverBody, TeachingPopoverHeader, TeachingPopoverSurface } from \"@fluentui/react-components\";\r\n\r\nconst useStyles = makeStyles({\r\n extensionTeachingPopover: {\r\n maxWidth: \"320px\",\r\n },\r\n});\r\n\r\n/**\r\n * The state returned by the teaching moment hook.\r\n */\r\ntype TeachingMomentState = ReturnType<ReturnType<typeof MakePopoverTeachingMoment>>;\r\n\r\n/**\r\n * Props for the {@link TeachingMoment} component.\r\n */\r\ntype TeachingMomentProps = Pick<TeachingMomentState, \"shouldDisplay\" | \"positioningRef\" | \"onOpenChange\"> & {\r\n title: string;\r\n description: string;\r\n};\r\n\r\n/**\r\n * A component that displays a teaching moment popover.\r\n * @param props Props for the teaching moment popover.\r\n * @returns The teaching moment popover.\r\n */\r\nexport const TeachingMoment: FunctionComponent<TeachingMomentProps> = ({ shouldDisplay, positioningRef, onOpenChange, title, description }) => {\r\n const classes = useStyles();\r\n\r\n return (\r\n <TeachingPopover appearance=\"brand\" open={shouldDisplay} positioning={{ positioningRef }} onOpenChange={onOpenChange}>\r\n <TeachingPopoverSurface className={classes.extensionTeachingPopover}>\r\n <TeachingPopoverHeader>{title}</TeachingPopoverHeader>\r\n <TeachingPopoverBody>{description}</TeachingPopoverBody>\r\n </TeachingPopoverSurface>\r\n </TeachingPopover>\r\n );\r\n};\r\n"]}
@@ -0,0 +1,10 @@
1
+ import { type FluentProviderProps } from "@fluentui/react-components";
2
+ import { type FunctionComponent } from "react";
3
+ /**
4
+ * A themed Fluent UI provider that applies the current theme mode (light or dark).
5
+ * @param props Fluent provider props, plus an optional `invert` flag to swap the theme.
6
+ * @returns The themed Fluent UI provider component.
7
+ */
8
+ export declare const Theme: FunctionComponent<FluentProviderProps & {
9
+ invert?: boolean;
10
+ }>;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FluentProvider, makeStyles, mergeClasses, tokens } from "@fluentui/react-components";
3
+ import { useTheme } from "../hooks/themeHooks.js";
4
+ // Fluent doesn't apply styling to scrollbars by default, so provide our own reasonable default.
5
+ const useStyles = makeStyles({
6
+ root: {
7
+ scrollbarColor: `${tokens.colorNeutralForeground3} ${tokens.colorTransparentBackground}`,
8
+ },
9
+ });
10
+ /**
11
+ * A themed Fluent UI provider that applies the current theme mode (light or dark).
12
+ * @param props Fluent provider props, plus an optional `invert` flag to swap the theme.
13
+ * @returns The themed Fluent UI provider component.
14
+ */
15
+ export const Theme = (props) => {
16
+ // NOTE: We do not want to applyStylesToPortals by default. It makes classes flow into portals
17
+ // (like popovers), and if those styles do things like disable overflow, they can completely
18
+ // break any UI within the portal. Therefore, default to false.
19
+ const { invert = false, applyStylesToPortals = false, className, ...rest } = props;
20
+ const theme = useTheme(invert);
21
+ const classes = useStyles();
22
+ return (_jsx(FluentProvider, { theme: theme, className: mergeClasses(classes.root, className), applyStylesToPortals: applyStylesToPortals, ...rest, children: props.children }));
23
+ };
24
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/components/theme.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA4B,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGxH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,gGAAgG;AAChG,MAAM,SAAS,GAAG,UAAU,CAAC;IACzB,IAAI,EAAE;QACF,cAAc,EAAE,GAAG,MAAM,CAAC,uBAAuB,IAAI,MAAM,CAAC,0BAA0B,EAAE;KAC3F;CACJ,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAkE,CAAC,KAAK,EAAE,EAAE;IAC1F,8FAA8F;IAC9F,4FAA4F;IAC5F,+DAA+D;IAC/D,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,oBAAoB,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACnF,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;IAE5B,OAAO,CACH,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,oBAAoB,EAAE,oBAAoB,KAAM,IAAI,YAC/H,KAAK,CAAC,QAAQ,GACF,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { type FluentProviderProps, FluentProvider, makeStyles, mergeClasses, tokens } from \"@fluentui/react-components\";\r\nimport { type FunctionComponent } from \"react\";\r\n\r\nimport { useTheme } from \"../hooks/themeHooks\";\r\n\r\n// Fluent doesn't apply styling to scrollbars by default, so provide our own reasonable default.\r\nconst useStyles = makeStyles({\r\n root: {\r\n scrollbarColor: `${tokens.colorNeutralForeground3} ${tokens.colorTransparentBackground}`,\r\n },\r\n});\r\n\r\n/**\r\n * A themed Fluent UI provider that applies the current theme mode (light or dark).\r\n * @param props Fluent provider props, plus an optional `invert` flag to swap the theme.\r\n * @returns The themed Fluent UI provider component.\r\n */\r\nexport const Theme: FunctionComponent<FluentProviderProps & { invert?: boolean }> = (props) => {\r\n // NOTE: We do not want to applyStylesToPortals by default. It makes classes flow into portals\r\n // (like popovers), and if those styles do things like disable overflow, they can completely\r\n // break any UI within the portal. Therefore, default to false.\r\n const { invert = false, applyStylesToPortals = false, className, ...rest } = props;\r\n const theme = useTheme(invert);\r\n const classes = useStyles();\r\n\r\n return (\r\n <FluentProvider theme={theme} className={mergeClasses(classes.root, className)} applyStylesToPortals={applyStylesToPortals} {...rest}>\r\n {props.children}\r\n </FluentProvider>\r\n );\r\n};\r\n"]}
@@ -0,0 +1,2 @@
1
+ import { type FunctionComponent, type PropsWithChildren } from "react";
2
+ export declare const UXContextProvider: FunctionComponent<PropsWithChildren>;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { ToolContext } from "../../fluent/hoc/fluentToolWrapper.js";
4
+ import { useSetting } from "../hooks/settingsHooks.js";
5
+ import { CompactModeSettingDescriptor, DisableCopySettingDescriptor } from "../services/globalSettings.js";
6
+ export const UXContextProvider = (props) => {
7
+ const [compactMode] = useSetting(CompactModeSettingDescriptor);
8
+ const [disableCopy] = useSetting(DisableCopySettingDescriptor);
9
+ const toolsContext = useMemo(() => {
10
+ return {
11
+ toolName: "",
12
+ size: compactMode ? "small" : "medium",
13
+ disableCopy,
14
+ useFluent: true,
15
+ };
16
+ }, [compactMode, disableCopy]);
17
+ return _jsx(ToolContext.Provider, { value: toolsContext, children: props.children });
18
+ };
19
+ //# sourceMappingURL=uxContextProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uxContextProvider.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/components/uxContextProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAoE,OAAO,EAAE,MAAM,OAAO,CAAC;AAElG,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAExG,MAAM,CAAC,MAAM,iBAAiB,GAAyC,CAAC,KAAK,EAAE,EAAE;IAC7E,MAAM,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC,4BAA4B,CAAC,CAAC;IAC/D,MAAM,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC,4BAA4B,CAAC,CAAC;IAE/D,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE;QAC9B,OAAO;YACH,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;YACtC,WAAW;YACX,SAAS,EAAE,IAAI;SACwB,CAAC;IAChD,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;IAE/B,OAAO,KAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAAG,KAAK,CAAC,QAAQ,GAAwB,CAAC;AAC9F,CAAC,CAAC","sourcesContent":["import { type ContextType, type FunctionComponent, type PropsWithChildren, useMemo } from \"react\";\r\n\r\nimport { ToolContext } from \"shared-ui-components/fluent/hoc/fluentToolWrapper\";\r\nimport { useSetting } from \"../hooks/settingsHooks\";\r\nimport { CompactModeSettingDescriptor, DisableCopySettingDescriptor } from \"../services/globalSettings\";\r\n\r\nexport const UXContextProvider: FunctionComponent<PropsWithChildren> = (props) => {\r\n const [compactMode] = useSetting(CompactModeSettingDescriptor);\r\n const [disableCopy] = useSetting(DisableCopySettingDescriptor);\r\n\r\n const toolsContext = useMemo(() => {\r\n return {\r\n toolName: \"\",\r\n size: compactMode ? \"small\" : \"medium\",\r\n disableCopy,\r\n useFluent: true,\r\n } satisfies ContextType<typeof ToolContext>;\r\n }, [compactMode, disableCopy]);\r\n\r\n return <ToolContext.Provider value={toolsContext}>{props.children}</ToolContext.Provider>;\r\n};\r\n"]}
@@ -0,0 +1,6 @@
1
+ import { type ExtensionManager } from "../extensibility/extensionManager.js";
2
+ export type ExtensionManagerContext = {
3
+ readonly extensionManager: ExtensionManager;
4
+ };
5
+ export declare const ExtensionManagerContext: import("react").Context<ExtensionManagerContext | undefined>;
6
+ export declare function useExtensionManager(): ExtensionManager | undefined;
@@ -0,0 +1,6 @@
1
+ import { createContext, useContext } from "react";
2
+ export const ExtensionManagerContext = createContext(undefined);
3
+ export function useExtensionManager() {
4
+ return useContext(ExtensionManagerContext)?.extensionManager;
5
+ }
6
+ //# sourceMappingURL=extensionManagerContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensionManagerContext.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/contexts/extensionManagerContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAMlD,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAsC,SAAS,CAAC,CAAC;AAErG,MAAM,UAAU,mBAAmB;IAC/B,OAAO,UAAU,CAAC,uBAAuB,CAAC,EAAE,gBAAgB,CAAC;AACjE,CAAC","sourcesContent":["import { type ExtensionManager } from \"../extensibility/extensionManager\";\r\n\r\nimport { createContext, useContext } from \"react\";\r\n\r\nexport type ExtensionManagerContext = {\r\n readonly extensionManager: ExtensionManager;\r\n};\r\n\r\nexport const ExtensionManagerContext = createContext<ExtensionManagerContext | undefined>(undefined);\r\n\r\nexport function useExtensionManager() {\r\n return useContext(ExtensionManagerContext)?.extensionManager;\r\n}\r\n"]}
@@ -0,0 +1,3 @@
1
+ import { type ISettingsStore } from "../services/settingsStore.js";
2
+ export declare const SettingsStoreContext: import("react").Context<ISettingsStore | undefined>;
3
+ export declare function useSettingsStore(): ISettingsStore | undefined;
@@ -0,0 +1,6 @@
1
+ import { createContext, useContext } from "react";
2
+ export const SettingsStoreContext = createContext(undefined);
3
+ export function useSettingsStore() {
4
+ return useContext(SettingsStoreContext);
5
+ }
6
+ //# sourceMappingURL=settingsContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settingsContext.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/contexts/settingsContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAA6B,SAAS,CAAC,CAAC;AAEzF,MAAM,UAAU,gBAAgB;IAC5B,OAAO,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import { type ISettingsStore } from \"../services/settingsStore\";\r\n\r\nimport { createContext, useContext } from \"react\";\r\n\r\nexport const SettingsStoreContext = createContext<ISettingsStore | undefined>(undefined);\r\n\r\nexport function useSettingsStore() {\r\n return useContext(SettingsStoreContext);\r\n}\r\n"]}
@@ -0,0 +1,21 @@
1
+ import { type IExtensionFeed, type ExtensionMetadata, type IExtensionMetadataQuery, type ExtensionModule } from "./extensionFeed.js";
2
+ export type BuiltInExtension = ExtensionMetadata & {
3
+ /**
4
+ * Gets the extension module, typically dynamically importing the extension.
5
+ * @returns The extension module (e.g. a collection of ServiceDefinitions).
6
+ */
7
+ getExtensionModuleAsync(): Promise<ExtensionModule>;
8
+ };
9
+ /**
10
+ * A simple extension feed implementation that provides a fixed set of "built in" extensions.
11
+ * "Built in" in this context means extensions that are known at bundling time, and included
12
+ * in the bundle. Each extension can be dynamically imported so they are split into separate
13
+ * bundle chunks and downloaded only when first installed.
14
+ */
15
+ export declare class BuiltInsExtensionFeed implements IExtensionFeed {
16
+ readonly name: string;
17
+ private readonly _extensions;
18
+ constructor(name: string, extensions: Iterable<BuiltInExtension>);
19
+ queryExtensionsAsync(filter?: string): Promise<IExtensionMetadataQuery>;
20
+ getExtensionModuleAsync(name: string): Promise<ExtensionModule | undefined>;
21
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A simple extension feed implementation that provides a fixed set of "built in" extensions.
3
+ * "Built in" in this context means extensions that are known at bundling time, and included
4
+ * in the bundle. Each extension can be dynamically imported so they are split into separate
5
+ * bundle chunks and downloaded only when first installed.
6
+ */
7
+ export class BuiltInsExtensionFeed {
8
+ constructor(name, extensions) {
9
+ this.name = name;
10
+ this._extensions = Array.from(extensions);
11
+ }
12
+ async queryExtensionsAsync(filter) {
13
+ const filteredExtensions = filter ? this._extensions.filter((extension) => extension.name.includes(filter)) : this._extensions;
14
+ return {
15
+ totalCount: filteredExtensions.length,
16
+ getExtensionMetadataAsync: async (index, count) => {
17
+ return filteredExtensions.slice(index, index + count);
18
+ },
19
+ };
20
+ }
21
+ async getExtensionModuleAsync(name) {
22
+ const extension = this._extensions.find((ext) => ext.name === name);
23
+ return extension ? await extension.getExtensionModuleAsync() : undefined;
24
+ }
25
+ }
26
+ //# sourceMappingURL=builtInsExtensionFeed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtInsExtensionFeed.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/extensibility/builtInsExtensionFeed.ts"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IAG9B,YACoB,IAAY,EAC5B,UAAsC;QADtB,SAAI,GAAJ,IAAI,CAAQ;QAG5B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAC7C,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;QAC/H,OAAO;YACH,UAAU,EAAE,kBAAkB,CAAC,MAAM;YACrC,yBAAyB,EAAE,KAAK,EAAE,KAAa,EAAE,KAAa,EAAE,EAAE;gBAC9D,OAAO,kBAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC;YAC1D,CAAC;SACJ,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,uBAAuB,CAAC,IAAY;QAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QACpE,OAAO,SAAS,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7E,CAAC;CACJ","sourcesContent":["import { type IExtensionFeed, type ExtensionMetadata, type IExtensionMetadataQuery, type ExtensionModule } from \"./extensionFeed\";\r\n\r\nexport type BuiltInExtension = ExtensionMetadata & {\r\n /**\r\n * Gets the extension module, typically dynamically importing the extension.\r\n * @returns The extension module (e.g. a collection of ServiceDefinitions).\r\n */\r\n getExtensionModuleAsync(): Promise<ExtensionModule>;\r\n};\r\n\r\n/**\r\n * A simple extension feed implementation that provides a fixed set of \"built in\" extensions.\r\n * \"Built in\" in this context means extensions that are known at bundling time, and included\r\n * in the bundle. Each extension can be dynamically imported so they are split into separate\r\n * bundle chunks and downloaded only when first installed.\r\n */\r\nexport class BuiltInsExtensionFeed implements IExtensionFeed {\r\n private readonly _extensions: readonly BuiltInExtension[];\r\n\r\n public constructor(\r\n public readonly name: string,\r\n extensions: Iterable<BuiltInExtension>\r\n ) {\r\n this._extensions = Array.from(extensions);\r\n }\r\n\r\n public async queryExtensionsAsync(filter?: string): Promise<IExtensionMetadataQuery> {\r\n const filteredExtensions = filter ? this._extensions.filter((extension) => extension.name.includes(filter)) : this._extensions;\r\n return {\r\n totalCount: filteredExtensions.length,\r\n getExtensionMetadataAsync: async (index: number, count: number) => {\r\n return filteredExtensions.slice(index, index + count);\r\n },\r\n };\r\n }\r\n\r\n public async getExtensionModuleAsync(name: string): Promise<ExtensionModule | undefined> {\r\n const extension = this._extensions.find((ext) => ext.name === name);\r\n return extension ? await extension.getExtensionModuleAsync() : undefined;\r\n }\r\n}\r\n"]}
@@ -0,0 +1,113 @@
1
+ import { type WeaklyTypedServiceDefinition } from "../modularity/serviceContainer.js";
2
+ export type PersonMetadata = {
3
+ /**
4
+ * The name of the person.
5
+ */
6
+ readonly name: string;
7
+ /**
8
+ * The email address of the person.
9
+ */
10
+ readonly email?: string;
11
+ /**
12
+ * The URL to the person's website.
13
+ */
14
+ readonly url?: string;
15
+ /**
16
+ * The Babylon forum username of the person.
17
+ */
18
+ readonly forumUserName?: string;
19
+ /**
20
+ * A base64 encoded PNG image to use as the person's avatar.
21
+ */
22
+ readonly avatar?: string;
23
+ };
24
+ export type ExtensionMetadata = {
25
+ /**
26
+ * The name of the extension.
27
+ */
28
+ readonly name: string;
29
+ /**
30
+ * The version of the extension (as valid semver).
31
+ */
32
+ readonly version?: string;
33
+ /**
34
+ * The description of the extension.
35
+ */
36
+ readonly description: string;
37
+ /**
38
+ * The keywords of the extension.
39
+ */
40
+ readonly keywords?: readonly string[];
41
+ /**
42
+ * The URL to the extension homepage.
43
+ */
44
+ readonly homepage?: string;
45
+ /**
46
+ * Specify the place where your code lives. This is helpful for people who want to contribute.
47
+ */
48
+ readonly repository?: string;
49
+ /**
50
+ * The URL to your extension's issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your extension.
51
+ */
52
+ readonly bugs?: string;
53
+ /**
54
+ * A license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it.
55
+ */
56
+ readonly license?: string;
57
+ /**
58
+ * The primary author of the extension.
59
+ */
60
+ readonly author?: string | PersonMetadata;
61
+ /**
62
+ * The contributors to the extension.
63
+ */
64
+ readonly contributors?: readonly (string | PersonMetadata)[];
65
+ };
66
+ export type ExtensionModule = {
67
+ /**
68
+ * The default export of the module (e.g. export default).
69
+ */
70
+ default: {
71
+ /**
72
+ * The services that are included with the extension.
73
+ */
74
+ serviceDefinitions?: readonly WeaklyTypedServiceDefinition[];
75
+ };
76
+ };
77
+ /**
78
+ * Represents a query to fetch subset ranges of extension metadata from a feed.
79
+ */
80
+ export interface IExtensionMetadataQuery {
81
+ /**
82
+ * The total number of extensions that satisfy the query.
83
+ */
84
+ readonly totalCount: number;
85
+ /**
86
+ * Fetches a range of extension metadata from the feed.
87
+ * @param index The index of the first extension to fetch.
88
+ * @param count The number of extensions to fetch.
89
+ * @returns A promise that resolves to the extension metadata.
90
+ */
91
+ getExtensionMetadataAsync(index: number, count: number): Promise<readonly ExtensionMetadata[]>;
92
+ }
93
+ /**
94
+ * Represents a feed/source of extensions.
95
+ */
96
+ export interface IExtensionFeed {
97
+ /**
98
+ * The name of the feed.
99
+ */
100
+ readonly name: string;
101
+ /**
102
+ * Creates an extension metadata query given a filter.
103
+ * @param filter The filter to apply to the query.
104
+ * @returns A promise that resolves to the extension metadata query.
105
+ */
106
+ queryExtensionsAsync(filter?: string): Promise<IExtensionMetadataQuery>;
107
+ /**
108
+ * Gets the extension module for the specified extension.
109
+ * @param name The name of the extension.
110
+ * @returns A promise that resolves to the extension module.
111
+ */
112
+ getExtensionModuleAsync(name: string): Promise<ExtensionModule | undefined>;
113
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=extensionFeed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensionFeed.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/extensibility/extensionFeed.ts"],"names":[],"mappings":"","sourcesContent":["import { type WeaklyTypedServiceDefinition } from \"../modularity/serviceContainer\";\r\n\r\nexport type PersonMetadata = {\r\n /**\r\n * The name of the person.\r\n */\r\n readonly name: string;\r\n\r\n /**\r\n * The email address of the person.\r\n */\r\n readonly email?: string;\r\n\r\n /**\r\n * The URL to the person's website.\r\n */\r\n readonly url?: string;\r\n\r\n /**\r\n * The Babylon forum username of the person.\r\n */\r\n readonly forumUserName?: string;\r\n\r\n /**\r\n * A base64 encoded PNG image to use as the person's avatar.\r\n */\r\n readonly avatar?: string;\r\n};\r\n\r\nexport type ExtensionMetadata = {\r\n /**\r\n * The name of the extension.\r\n */\r\n readonly name: string;\r\n\r\n /**\r\n * The version of the extension (as valid semver).\r\n */\r\n readonly version?: string;\r\n\r\n /**\r\n * The description of the extension.\r\n */\r\n readonly description: string;\r\n\r\n /**\r\n * The keywords of the extension.\r\n */\r\n readonly keywords?: readonly string[];\r\n\r\n /**\r\n * The URL to the extension homepage.\r\n */\r\n readonly homepage?: string;\r\n\r\n /**\r\n * Specify the place where your code lives. This is helpful for people who want to contribute.\r\n */\r\n readonly repository?: string;\r\n\r\n /**\r\n * The URL to your extension's issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your extension.\r\n */\r\n readonly bugs?: string;\r\n\r\n /**\r\n * A license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it.\r\n */\r\n readonly license?: string;\r\n\r\n /**\r\n * The primary author of the extension.\r\n */\r\n readonly author?: string | PersonMetadata;\r\n\r\n /**\r\n * The contributors to the extension.\r\n */\r\n readonly contributors?: readonly (string | PersonMetadata)[];\r\n};\r\n\r\nexport type ExtensionModule = {\r\n /**\r\n * The default export of the module (e.g. export default).\r\n */\r\n default: {\r\n /**\r\n * The services that are included with the extension.\r\n */\r\n serviceDefinitions?: readonly WeaklyTypedServiceDefinition[];\r\n };\r\n};\r\n\r\n/**\r\n * Represents a query to fetch subset ranges of extension metadata from a feed.\r\n */\r\nexport interface IExtensionMetadataQuery {\r\n /**\r\n * The total number of extensions that satisfy the query.\r\n */\r\n readonly totalCount: number;\r\n\r\n /**\r\n * Fetches a range of extension metadata from the feed.\r\n * @param index The index of the first extension to fetch.\r\n * @param count The number of extensions to fetch.\r\n * @returns A promise that resolves to the extension metadata.\r\n */\r\n getExtensionMetadataAsync(index: number, count: number): Promise<readonly ExtensionMetadata[]>;\r\n}\r\n\r\n/**\r\n * Represents a feed/source of extensions.\r\n */\r\nexport interface IExtensionFeed {\r\n /**\r\n * The name of the feed.\r\n */\r\n readonly name: string;\r\n\r\n /**\r\n * Creates an extension metadata query given a filter.\r\n * @param filter The filter to apply to the query.\r\n * @returns A promise that resolves to the extension metadata query.\r\n */\r\n queryExtensionsAsync(filter?: string): Promise<IExtensionMetadataQuery>;\r\n\r\n /**\r\n * Gets the extension module for the specified extension.\r\n * @param name The name of the extension.\r\n * @returns A promise that resolves to the extension module.\r\n */\r\n getExtensionModuleAsync(name: string): Promise<ExtensionModule | undefined>;\r\n}\r\n"]}
@@ -0,0 +1,111 @@
1
+ import { type IDisposable } from "@babylonjs/core/index.js";
2
+ import { type ServiceContainer } from "../modularity/serviceContainer.js";
3
+ import { type IExtensionFeed, type ExtensionMetadata } from "./extensionFeed.js";
4
+ /**
5
+ * Represents a loaded extension.
6
+ */
7
+ export interface IExtension {
8
+ /**
9
+ * The metadata for the extension.
10
+ */
11
+ readonly metadata: ExtensionMetadata;
12
+ /**
13
+ * Whether the extension is currently being installed, uninstalled, enabled, or disabled.
14
+ */
15
+ readonly isStateChanging: boolean;
16
+ /**
17
+ * Whether the extension is enabled.
18
+ */
19
+ readonly isInstalled: boolean;
20
+ /**
21
+ * Installs the extension.
22
+ */
23
+ installAsync(): Promise<void>;
24
+ /**
25
+ * Uninstalls the extension.
26
+ */
27
+ uninstallAsync(): Promise<void>;
28
+ /**
29
+ * Adds a handler that is called when the state of the extension changes.
30
+ * @param handler The handler to add.
31
+ * @returns A disposable that removes the handler when disposed.
32
+ */
33
+ addStateChangedHandler(handler: () => void): IDisposable;
34
+ }
35
+ /**
36
+ * Provides information about an extension installation failure.
37
+ */
38
+ export type InstallFailedInfo = {
39
+ /**
40
+ * The metadata of the extension that failed to install.
41
+ */
42
+ extension: ExtensionMetadata;
43
+ /**
44
+ * The error that occurred during the installation.
45
+ */
46
+ error: unknown;
47
+ };
48
+ /**
49
+ * Represents a query for loaded extensions.
50
+ */
51
+ export interface IExtensionQuery {
52
+ /**
53
+ * The total number of extensions that satisfy the query.
54
+ */
55
+ readonly totalCount: number;
56
+ /**
57
+ * Fetches a range of extensions from the query.
58
+ * @param index The index of the first extension to fetch.
59
+ * @param count The number of extensions to fetch.
60
+ * @returns A promise that resolves to the extensions.
61
+ */
62
+ getExtensionsAsync(index: number, count: number): Promise<IExtension[]>;
63
+ }
64
+ /**
65
+ * Manages the installation, uninstallation, enabling, and disabling of extensions.
66
+ */
67
+ export declare class ExtensionManager implements IDisposable {
68
+ private readonly _namespace;
69
+ private readonly _serviceContainer;
70
+ private readonly _feeds;
71
+ private readonly _onInstallFailed;
72
+ private readonly _installedExtensions;
73
+ private readonly _stateChangedHandlers;
74
+ private constructor();
75
+ /**
76
+ * Creates a new instance of the ExtensionManager.
77
+ * This will automatically rehydrate previously installed and enabled extensions.
78
+ * @param namespace The namespace to use for storing extension state in local storage.
79
+ * @param serviceContainer The service container to use.
80
+ * @param feeds The extension feeds to include.
81
+ * @param onInstallFailed A callback that is called when an extension installation fails.
82
+ * @returns A promise that resolves to the new instance of the ExtensionManager.
83
+ */
84
+ static CreateAsync(namespace: string, serviceContainer: ServiceContainer, feeds: readonly IExtensionFeed[], onInstallFailed: (info: InstallFailedInfo) => void): Promise<ExtensionManager>;
85
+ /**
86
+ * Gets the names of the feeds that are included in the extension manager.
87
+ * @returns The names of the feeds.
88
+ */
89
+ get feedNames(): string[];
90
+ /**
91
+ * Queries the extension manager for extensions.
92
+ * @param filter The filter to apply to the query.
93
+ * @param feeds The feeds to include in the query.
94
+ * @param installedOnly Whether to only include installed extensions.
95
+ * @returns A promise that resolves to the extension query.
96
+ */
97
+ queryExtensionsAsync(filter?: string, feeds?: string[], installedOnly?: boolean): Promise<IExtensionQuery>;
98
+ /**
99
+ * Disposes the extension manager.
100
+ */
101
+ dispose(): void;
102
+ private _getInstalledExtensionStorageKey;
103
+ private _updateInstalledExtensionsStorage;
104
+ private _installAsync;
105
+ private _uninstallAsync;
106
+ private _enableAsync;
107
+ private _disableAsync;
108
+ private _addStateChangedHandler;
109
+ private _createExtension;
110
+ private _createInstalledExtension;
111
+ }