@dxos/app-framework 0.3.9-main.57b66d1 → 0.3.9-main.cea1d3b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-MNFAM2GF.mjs → chunk-WDA7VA54.mjs} +1 -1
- package/dist/lib/browser/{chunk-MNFAM2GF.mjs.map → chunk-WDA7VA54.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +7 -33
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{plugin-JDIMDLDU.mjs → plugin-XEJ5RYCP.mjs} +2 -2
- package/dist/lib/node/{chunk-DC3GU6QR.cjs → chunk-YDKX45O3.cjs} +4 -4
- package/dist/lib/node/chunk-YDKX45O3.cjs.map +7 -0
- package/dist/lib/node/index.cjs +13 -38
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{plugin-JGSJGRMS.cjs → plugin-RCAOZKNL.cjs} +8 -8
- package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts +0 -2
- package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts.map +1 -1
- package/dist/types/src/plugins/SurfacePlugin/SurfaceRootContext.d.ts +2 -10
- package/dist/types/src/plugins/SurfacePlugin/SurfaceRootContext.d.ts.map +1 -1
- package/dist/types/src/plugins/SurfacePlugin/index.d.ts +0 -1
- package/dist/types/src/plugins/SurfacePlugin/index.d.ts.map +1 -1
- package/dist/types/src/plugins/common/graph.d.ts +2 -2
- package/dist/types/src/plugins/common/graph.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/plugins/SurfacePlugin/Surface.tsx +5 -34
- package/src/plugins/SurfacePlugin/SurfaceRootContext.tsx +2 -15
- package/src/plugins/SurfacePlugin/index.ts +0 -1
- package/src/plugins/common/graph.ts +2 -2
- package/dist/lib/node/chunk-DC3GU6QR.cjs.map +0 -7
- package/dist/types/src/plugins/SurfacePlugin/helpers.d.ts +0 -21
- package/dist/types/src/plugins/SurfacePlugin/helpers.d.ts.map +0 -1
- package/src/plugins/SurfacePlugin/helpers.ts +0 -22
- /package/dist/lib/browser/{plugin-JDIMDLDU.mjs.map → plugin-XEJ5RYCP.mjs.map} +0 -0
- /package/dist/lib/node/{plugin-JGSJGRMS.cjs.map → plugin-RCAOZKNL.cjs.map} +0 -0
|
@@ -10,7 +10,7 @@ import type { Plugin } from '../PluginHost';
|
|
|
10
10
|
/**
|
|
11
11
|
* Provides for a plugin that exposes the application graph.
|
|
12
12
|
*/
|
|
13
|
-
export type
|
|
13
|
+
export type GraphPluginProvides = {
|
|
14
14
|
graph: Graph;
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -24,7 +24,7 @@ export type GraphBuilderProvides = {
|
|
|
24
24
|
* Type guard for graph plugins.
|
|
25
25
|
*/
|
|
26
26
|
export const parseGraphPlugin = (plugin: Plugin) =>
|
|
27
|
-
(plugin.provides as any).graph?.root ? (plugin as Plugin<
|
|
27
|
+
(plugin.provides as any).graph?.root ? (plugin as Plugin<GraphPluginProvides>) : undefined;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Type guard for graph builder plugins.
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/SurfacePlugin/provides.ts", "../../../src/plugins/SurfacePlugin/SurfaceRootContext.tsx", "../../../src/plugins/SurfacePlugin/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type SurfaceComponent, type SurfaceRootContext } from './SurfaceRootContext';\nimport { type Plugin } from '../PluginHost';\n\nexport type SurfaceProvides = {\n surface: {\n /**\n * Used by the `Surface` resolver to find a component to render.\n */\n component: SurfaceComponent;\n };\n};\n\nexport type SurfacePluginProvides = {\n surface: SurfaceRootContext;\n};\n\nexport const parseRootSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.components ? (plugin as Plugin<SurfacePluginProvides>) : undefined;\n\nexport const parseSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.component ? (plugin as Plugin<SurfaceProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { createContext, useContext, type Context, type Provider, type ForwardedRef } from 'react';\n\nimport { type SurfaceProps } from './Surface';\n\n// TODO(wittjosiah): Factor out.\ntype WithRequiredProperty<Type, Key extends keyof Type> = Type & {\n [Property in Key]-?: Type[Property];\n};\n\ntype SurfaceComponentProps = WithRequiredProperty<SurfaceProps, 'data'>;\n\n/**\n * Determines the priority of the surface when multiple components are resolved.\n */\nexport type SurfaceDisposition = 'hoist' | 'fallback';\n\nexport type SurfaceResult = {\n node: JSX.Element;\n disposition?: SurfaceDisposition;\n};\n\n/**\n * Function which resolves a Surface.\n *\n * If a null value is returned, the rendering is deferred to other plugins.\n */\nexport type SurfaceComponent = (\n props: SurfaceComponentProps,\n forwardedRef: ForwardedRef<HTMLElement>,\n) => JSX.Element | SurfaceResult | null;\n\nexport type SurfaceRootContext = {\n components: Record<string, SurfaceComponent>;\n};\n\nconst SurfaceRootContext: Context<SurfaceRootContext> = createContext<SurfaceRootContext>({ components: {} });\n\nexport const useSurface = () => useContext(SurfaceRootContext);\n\nexport const SurfaceProvider: Provider<SurfaceRootContext> = SurfaceRootContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst SurfaceMeta = {\n id: 'dxos.org/plugin/surface',\n};\n\nexport default SurfaceMeta;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;ACIA,mBAA0F;ADgBnF,IAAMA,yBAAyB,CAACC,WACpCA,QAAQC,UAAkBC,SAASC,aAAcH,SAA2CI;AAExF,IAAMC,qBAAqB,CAACL,WAChCA,QAAQC,UAAkBC,SAASI,YAAaN,SAAqCI;ACexF,IAAMG,qBAAkDC,gDAAkC;EAAEL,YAAY,CAAC;AAAE,CAAA;AAEpG,IAAMM,aAAa,UAAMC,yBAAWH,kBAAAA;AAEpC,IAAMI,kBAAgDJ,mBAAmBK;ACvChF,IAAMC,cAAc;EAClBC,IAAI;AACN;AAEA,IAAA,eAAeD;",
|
|
6
|
-
"names": ["parseRootSurfacePlugin", "plugin", "provides", "surface", "components", "undefined", "parseSurfacePlugin", "component", "SurfaceRootContext", "createContext", "useSurface", "useContext", "SurfaceProvider", "Provider", "SurfaceMeta", "id"]
|
|
7
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if the given data is an object and not null.
|
|
3
|
-
*
|
|
4
|
-
* Useful inside surface component resolvers as a type guard.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* const old =
|
|
9
|
-
* data.content &&
|
|
10
|
-
* typeof data.content === 'object' &&
|
|
11
|
-
* 'id' in data.content &&
|
|
12
|
-
* typeof data.content.id === 'string';
|
|
13
|
-
*
|
|
14
|
-
* // becomes
|
|
15
|
-
* const new = isObject(data.content) && typeof data.content.id === 'string';
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare const isObject: (data: unknown) => data is {
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/SurfacePlugin/helpers.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,SAAU,OAAO;;CAA2E,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Checks if the given data is an object and not null.
|
|
7
|
-
*
|
|
8
|
-
* Useful inside surface component resolvers as a type guard.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* const old =
|
|
13
|
-
* data.content &&
|
|
14
|
-
* typeof data.content === 'object' &&
|
|
15
|
-
* 'id' in data.content &&
|
|
16
|
-
* typeof data.content.id === 'string';
|
|
17
|
-
*
|
|
18
|
-
* // becomes
|
|
19
|
-
* const new = isObject(data.content) && typeof data.content.id === 'string';
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export const isObject = (data: unknown): data is { [key: string]: unknown } => !!data && typeof data === 'object';
|
|
File without changes
|
|
File without changes
|