Skip to content

Commit

Permalink
Use official remote-dom library
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonmade committed Feb 16, 2024
1 parent 063a65c commit ca89d9f
Show file tree
Hide file tree
Showing 90 changed files with 260 additions and 226 deletions.
9 changes: 9 additions & 0 deletions .changeset/twelve-steaks-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@watching/thread-render': patch
'@watching/clips-preact': patch
'@watching/clips-svelte': patch
'@watching/clips-react': patch
'@watching/clips': patch
---

Upgrade to real remote-dom library
6 changes: 3 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"@lemon/css": "workspace:*",
"@lemon/zest": "workspace:*",
"@lemonmade/graphql-live": "^0.4.3",
"@lemonmade/remote-ui": "^0.3.3",
"@lemonmade/remote-ui-preact": "^0.4.1",
"@lemonmade/remote-ui-react": "^0.3.1",
"@quilted/graphql": "^3.0.1",
"@quilted/graphql-tools": "^0.2.0",
"@quilted/localize": "^0.2.0",
"@quilted/quilt": "^0.6.8",
"@quilted/react-query": "^0.3.1",
"@remote-dom/core": "^0.1.0",
"@remote-dom/preact": "^0.1.0",
"@remote-dom/react": "^0.1.0",
"@simplewebauthn/browser": "^6.2.0",
"@simplewebauthn/server": "^6.2.0",
"@stripe/stripe-js": "^1.46.0",
Expand Down
2 changes: 1 addition & 1 deletion app/shared/clips/Clip/Clip.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ComponentType, useEffect, useRef} from 'react';
import {type ExtensionPoint} from '@watching/clips';
import {RemoteRootRenderer} from '@lemonmade/remote-ui-preact/host';
import {RemoteRootRenderer} from '@remote-dom/preact/host';
import {
Style,
Popover,
Expand Down
4 changes: 2 additions & 2 deletions app/shared/clips/components.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {RemoteFragmentRenderer} from '@lemonmade/remote-ui-preact/host';
import {type RemoteComponentRendererMap} from '@lemonmade/remote-ui-react/host';
import {RemoteFragmentRenderer} from '@remote-dom/preact/host';
import {type RemoteComponentRendererMap} from '@remote-dom/react/host';

import {Action} from './components/Action.tsx';
import {BlockGrid} from './components/BlockGrid.tsx';
Expand Down
21 changes: 8 additions & 13 deletions app/shared/clips/components/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import {
type ForwardRefExoticComponent,
type ForwardRefRenderFunction,
} from 'react';
import {type Elements} from '@watching/clips';
import {type RemoteElement} from '@lemonmade/remote-ui/elements';
import {createRemoteComponentRenderer} from '@lemonmade/remote-ui-preact/host';
import {ElementConstructors, type Elements} from '@watching/clips';
import {createRemoteComponentRenderer} from '@remote-dom/preact/host';
import {
type RemoteComponentType,
type RemoteComponentProps,
type RemoteComponentRendererProps,
} from '@lemonmade/remote-ui-react/host';
type RemoteComponentTypeFromElementConstructor,
type RemoteComponentPropsFromElementConstructor,
} from '@remote-dom/react/host';
import {signal, type Signal} from '@quilted/quilt/signals';
import {
isThreadSignal,
Expand All @@ -20,14 +19,10 @@ import {
} from '@quilted/quilt/threads';

export type ReactComponentPropsForClipsElement<Element extends keyof Elements> =
Elements[Element] extends RemoteElement<infer Properties, infer Slots>
? RemoteComponentProps<Properties, Slots>
: never;
RemoteComponentPropsFromElementConstructor<ElementConstructors[Element]>;

export type ReactComponentTypeForClipsElement<Element extends keyof Elements> =
Elements[Element] extends RemoteElement<infer Properties, infer Slots>
? RemoteComponentType<Properties, Slots>
: never;
RemoteComponentTypeFromElementConstructor<ElementConstructors[Element]>;

export function createClipsComponent<Element extends keyof Elements>(
element: Element,
Expand All @@ -36,7 +31,7 @@ export function createClipsComponent<Element extends keyof Elements>(
ReactComponentPropsForClipsElement<Element>
>,
): ForwardRefExoticComponent<RemoteComponentRendererProps> {
return createRemoteComponentRenderer(Component, {
return createRemoteComponentRenderer(Component as any, {
name: `Clips(${element})`,
}) as any;
}
Expand Down
2 changes: 1 addition & 1 deletion app/shared/clips/extension-points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
type SharedGraphQLApi,
type GraphQLApiForExtensionPoint,
} from '@watching/clips';
import type {RemoteComponentRendererMap} from '@lemonmade/remote-ui-react/host';
import type {RemoteComponentRendererMap} from '@remote-dom/react/host';
import {
type GraphQLLiveResolverCreateHelper,
type GraphQLLiveResolverObject,
Expand Down
2 changes: 1 addition & 1 deletion app/shared/clips/extension.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {type Signal} from '@quilted/quilt/signals';
import {type ThreadCallable} from '@quilted/quilt/threads';
import {type ThreadRenderer} from '@watching/thread-render';
import {type RemoteComponentRendererMap} from '@lemonmade/remote-ui-react/host';
import {type RemoteComponentRendererMap} from '@remote-dom/react/host';

import {type Version, type ExtensionPoint, type Api} from '@watching/clips';

Expand Down
4 changes: 2 additions & 2 deletions app/shared/clips/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export function createClipsManager(
mutate: mutate as any,
};

await sandbox.render(options.target, receiver.receive, api as any);
await sandbox.render(options.target, receiver.connection, api as any);
},
});

Expand Down Expand Up @@ -248,7 +248,7 @@ export function createClipsManager(
mutate: mutate as any,
};

await sandbox.render(options.target, receiver.receive, api as any);
await sandbox.render(options.target, receiver.connection, api as any);
},
});

Expand Down
8 changes: 4 additions & 4 deletions app/shared/clips/sandbox/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
createBasicEncoder,
createThreadFromWebWorker,
} from '@quilted/quilt/threads';
import {type RemoteMutationCallback} from '@lemonmade/remote-ui';
import {type RemoteConnection} from '@remote-dom/core';

import type {
Api,
Expand Down Expand Up @@ -71,14 +71,14 @@ export async function load(script: string, _: Version) {

export async function render<T extends ExtensionPoint>(
id: T,
callback: RemoteMutationCallback,
connection: RemoteConnection,
api: Api<T>,
) {
retain(callback);
retain(connection);
retain(api);

// @ts-expect-error I can’t get TypeScript to understand the union types going on here...
return runExtensionPoint(id, callback, api);
return runExtensionPoint(id, connection, api);
}

type ArgumentsForExtensionPoint<T extends ExtensionPoint> = Parameters<
Expand Down
6 changes: 3 additions & 3 deletions packages/clips-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"build": "rollup --config configuration/rollup.config.js"
},
"dependencies": {
"@lemonmade/remote-ui": "^0.3.3",
"@lemonmade/remote-ui-preact": "^0.4.1",
"@preact/signals-core": "^1.5.0"
"@preact/signals-core": "^1.5.0",
"@remote-dom/core": "^0.1.0",
"@remote-dom/preact": "^0.1.0"
},
"peerDependencies": {
"@watching/clips": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Action.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Action as ActionElement} from '@watching/clips/elements';

export const Action = createRemoteComponent('ui-action', ActionElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/BlockGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {BlockGrid as BlockGridElement} from '@watching/clips/elements';

export const BlockGrid = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/BlockStack.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {BlockStack as BlockStackElement} from '@watching/clips/elements';

export const BlockStack = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Disclosure.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Disclosure as DisclosureElement} from '@watching/clips/elements';

export const Disclosure = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Footer as FooterElement} from '@watching/clips/elements';

export const Footer = createRemoteComponent('ui-footer', FooterElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Grid.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Grid as GridElement} from '@watching/clips/elements';

export const Grid = createRemoteComponent('ui-grid', GridElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Header as HeaderElement} from '@watching/clips/elements';

export const Header = createRemoteComponent('ui-header', HeaderElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Heading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Heading as HeadingElement} from '@watching/clips/elements';

export const Heading = createRemoteComponent('ui-heading', HeadingElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Image as ImageElement} from '@watching/clips/elements';

export const Image = createRemoteComponent('ui-image', ImageElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/InlineGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {InlineGrid as InlineGridElement} from '@watching/clips/elements';

export const InlineGrid = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/InlineStack.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {InlineStack as InlineStackElement} from '@watching/clips/elements';

export const InlineStack = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Modal as ModalElement} from '@watching/clips/elements';

export const Modal = createRemoteComponent('ui-modal', ModalElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Popover.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Popover as PopoverElement} from '@watching/clips/elements';

export const Popover = createRemoteComponent('ui-popover', PopoverElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Section.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Section as SectionElement} from '@watching/clips/elements';

export const Section = createRemoteComponent('ui-section', SectionElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Stack.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Stack as StackElement} from '@watching/clips/elements';

export const Stack = createRemoteComponent('ui-stack', StackElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {Text as TextElement} from '@watching/clips/elements';

export const Text = createRemoteComponent('ui-text', TextElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/TextBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {TextBlock as TextBlockElement} from '@watching/clips/elements';

export const TextBlock = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/TextField.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {TextField as TextFieldElement} from '@watching/clips/elements';

export const TextField = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-preact/source/components/View.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-preact';
import {createRemoteComponent} from '@remote-dom/preact';
import {View as ViewElement} from '@watching/clips/elements';

export const View = createRemoteComponent('ui-view', ViewElement);
2 changes: 1 addition & 1 deletion packages/clips-preact/source/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
type ExtensionPoint,
type WithThreadSignals,
} from '@watching/clips';
import {type RemoteRootElement} from '@lemonmade/remote-ui/elements';
import {type RemoteRootElement} from '@remote-dom/core/elements';

export interface ClipRenderDetails<
Point extends ExtensionPoint = ExtensionPoint,
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-preact/source/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from '@watching/clips';
export * from '@preact/signals-core';
export {html} from '@lemonmade/remote-ui-preact/html';
export {html} from '@remote-dom/preact/html';

export {extension} from './extension.tsx';
export {
Expand Down
4 changes: 2 additions & 2 deletions packages/clips-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"build": "rollup --config configuration/rollup.config.js"
},
"dependencies": {
"@lemonmade/remote-ui": "^0.3.3",
"@lemonmade/remote-ui-react": "^0.3.1",
"@preact/signals-core": "^1.5.0",
"@remote-dom/core": "^0.1.0",
"@remote-dom/react": "^0.1.0",
"@types/react": "^18.2.39",
"@types/react-dom": "^18.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/Action.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {Action as ActionElement} from '@watching/clips/elements';

export const Action = createRemoteComponent('ui-action', ActionElement);
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/BlockGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {BlockGrid as BlockGridElement} from '@watching/clips/elements';

export const BlockGrid = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/BlockStack.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {BlockStack as BlockStackElement} from '@watching/clips/elements';

export const BlockStack = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/Disclosure.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {Disclosure as DisclosureElement} from '@watching/clips/elements';

export const Disclosure = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {Footer as FooterElement} from '@watching/clips/elements';

export const Footer = createRemoteComponent('ui-footer', FooterElement);
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/Grid.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {Grid as GridElement} from '@watching/clips/elements';

export const Grid = createRemoteComponent('ui-grid', GridElement);
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {Header as HeaderElement} from '@watching/clips/elements';

export const Header = createRemoteComponent('ui-header', HeaderElement);
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/Heading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {Heading as HeadingElement} from '@watching/clips/elements';

export const Heading = createRemoteComponent('ui-heading', HeadingElement);
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {Image as ImageElement} from '@watching/clips/elements';

export const Image = createRemoteComponent('ui-image', ImageElement);
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/InlineGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {InlineGrid as InlineGridElement} from '@watching/clips/elements';

export const InlineGrid = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/InlineStack.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {InlineStack as InlineStackElement} from '@watching/clips/elements';

export const InlineStack = createRemoteComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {Modal as ModalElement} from '@watching/clips/elements';

export const Modal = createRemoteComponent('ui-modal', ModalElement);
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/Popover.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {Popover as PopoverElement} from '@watching/clips/elements';

export const Popover = createRemoteComponent('ui-popover', PopoverElement);
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/Section.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {Section as SectionElement} from '@watching/clips/elements';

export const Section = createRemoteComponent('ui-section', SectionElement);
2 changes: 1 addition & 1 deletion packages/clips-react/source/components/Stack.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createRemoteComponent} from '@lemonmade/remote-ui-react';
import {createRemoteComponent} from '@remote-dom/react';
import {Stack as StackElement} from '@watching/clips/elements';

export const Stack = createRemoteComponent('ui-stack', StackElement);
Loading

0 comments on commit ca89d9f

Please sign in to comment.