Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout: extract slots #660

Merged
merged 6 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
587 changes: 104 additions & 483 deletions build/api/layout.api.md

Large diffs are not rendered by default.

103 changes: 103 additions & 0 deletions build/api/react-slots.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
## API Report File for "@contember/react-slots"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

import { ComponentClassNameProps } from '@contember/utilities';
import { ComponentType } from 'react';
import { ElementType } from 'react';
import { FunctionComponentElement } from 'react';
import { NamedExoticComponent } from 'react';
import { ReactNode } from 'react';

// @public (undocumented)
export function createSlotComponents<K extends string>(slots: readonly K[]): SlotComponents<K>;

// @public (undocumented)
export function createSlotSourceComponent<T extends string>(slot: T): SlotSourceComponent<T>;

// @public (undocumented)
export function createSlotTargetComponent<T extends string>(name: T): SlotTargetComponent<T>;

// @public (undocumented)
export type OwnTargetContainerProps = {
className: string;
};

// @public (undocumented)
export type SlotComponents<K extends string> = readonly [
readonly K[],
SlotSourceComponentsRecord<K>,
SlotTargetComponentsRecord<K>
];

// @public (undocumented)
export const SlotSource: NamedExoticComponent<SlotSourceProps>;

// @public (undocumented)
export type SlotSourceComponent<T extends string> = ComponentType<SlotSourceComponentProps> & {
slot: T;
};

// @public (undocumented)
export type SlotSourceComponentProps = Omit<SlotSourceProps, 'name'>;

// @public (undocumented)
export type SlotSourceComponentsRecord<K extends string> = Readonly<{
readonly [P in K]: SlotSourceComponent<P>;
}>;

// @public (undocumented)
export type SlotSourceProps = {
children: ReactNode;
name: string;
};

// @public (undocumented)
export const SlotsProvider: NamedExoticComponent< {
children: ReactNode;
}>;

// @public (undocumented)
export const SlotTarget: NamedExoticComponent<SlotTargetProps>;

// @public (undocumented)
export type SlotTargetComponent<T extends string> = ComponentType<SlotTargetComponentProps> & {
slot: T;
};

// @public (undocumented)
export type SlotTargetComponentProps = Omit<SlotTargetProps, 'name'>;

// @public (undocumented)
export type SlotTargetComponentsRecord<K extends string> = Readonly<{
readonly [P in K]: SlotTargetComponent<P>;
}>;

// @public (undocumented)
export type SlotTargetProps = ComponentClassNameProps & {
as?: ElementType;
fallback?: ReactNode;
name: string;
aliases?: [string, ...string[]];
display?: boolean | 'contents' | 'block' | 'flex' | 'grid' | 'inline' | 'inline-flex' | 'inline-grid' | 'inline-block' | 'inherit' | 'initial' | 'none' | 'unset';
};

// @public
export function useHasActiveSlotsFactory<T extends SlotTargetComponentsRecord<string>>(): (...slots: ReadonlyArray<keyof T & string>) => boolean;

// @public
export const useSlotTargetElement: (name: string) => HTMLElement | null | undefined;

// @public
export function useSlotTargetsFactory<R extends SlotTargetComponentsRecord<string>>(SlotTargets: R): <T>(slots: ReadonlyArray<keyof R & string>, override?: T | undefined) => NonNullable<T> | FunctionComponentElement< {
children?: ReactNode;
}> | null;

// @public
export const useTargetElementRegistrar: (name: string, aliases?: string[]) => (element: HTMLElement | null) => void;

// (No @packageDocumentation comment for this package)

```
3 changes: 0 additions & 3 deletions build/api/utilities.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,6 @@ export function range(start: number, end: number, step?: number): number[];
// @public (undocumented)
export type SemverString = `${number}.${number}.${number}`;

// @public (undocumented)
export function setHasOneOf<T>(set: Set<T>, values: T[]): boolean;

// @public (undocumented)
export const shouldCancelStart: (event: {
target?: unknown;
Expand Down
1 change: 1 addition & 0 deletions ee/admin-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ COPY ./packages/react-form-fields-ui/package.json ././packages/react-form-fields
COPY ./packages/react-i18n/package.json ././packages/react-i18n/package.json
COPY ./packages/react-leaflet-fields-ui/package.json ././packages/react-leaflet-fields-ui/package.json
COPY ./packages/react-multipass-rendering/package.json ././packages/react-multipass-rendering/package.json
COPY ./packages/react-slots/package.json ././packages/react-slots/package.json
COPY ./packages/react-utils/package.json ././packages/react-utils/package.json
COPY ./packages/ui/package.json ././packages/ui/package.json
COPY ./packages/utilities/package.json ././packages/utilities/package.json
Expand Down
1 change: 1 addition & 0 deletions packages/layout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
},
"dependencies": {
"@contember/react-i18n": "workspace:*",
"@contember/react-slots": "workspace:*",
"@contember/react-utils": "workspace:*",
"@contember/ui": "workspace:*",
"@contember/utilities": "workspace:*",
Expand Down
1 change: 0 additions & 1 deletion packages/layout/src/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@import "primitives/index.css";
@import "slots/index.css";
@import "kit/index.css";
2 changes: 1 addition & 1 deletion packages/layout/src/kit/Slots/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createSlotComponents } from '../../slots'
import { createSlotComponents } from '@contember/react-slots'

export const [commonSlots, CommonSlotSources, CommonSlotTargets] = createSlotComponents([
'Actions',
Expand Down
73 changes: 0 additions & 73 deletions packages/layout/src/slots/Source.tsx

This file was deleted.

96 changes: 0 additions & 96 deletions packages/layout/src/slots/Target.tsx

This file was deleted.

70 changes: 0 additions & 70 deletions packages/layout/src/slots/contexts.ts

This file was deleted.

13 changes: 0 additions & 13 deletions packages/layout/src/slots/createSlotSourceComponent.tsx

This file was deleted.

Loading
Loading