Skip to content
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
2 changes: 1 addition & 1 deletion .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: "en-US"
early_access: false
tone_instructions: 'You must talk like teacher.'
tone_instructions: 'You are an expert code reviewer in Java, TypeScript, JavaScript, and NodeJS. You work in an enterprise software developer team, providing concise and clear code review advice.You only elaborate or provide detailed explanations when requested.'
reviews:
profile: "chill"
request_changes_workflow: false
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/ad-hoc-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
required: false
type: string
default: ad-hoc
pg_tag:
description: Postgres tag to use for image
required: false
type: string
default: pg

jobs:
server-build:
Expand Down Expand Up @@ -94,7 +99,7 @@ jobs:
run: |
run: |
if [[ -f scripts/prepare_server_artifacts.sh ]]; then
scripts/prepare_server_artifacts.sh
PG_TAG=${{ inputs.pg_tag }} scripts/prepare_server_artifacts.sh
else
echo "No script found to prepare server artifacts"
exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ export const StyledBody = styled.div`
max-height: calc(
var(--popover-max-height) - calc(var(--popover-padding) * 2 + 25.5px)
);
overflow-y: scroll;
overflow-y: auto;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ export class DarkModeTheme implements ColorModeTheme {
color.oklch.l = 0.22;
}

if (this.seedChroma > 0.025) {
color.oklch.c = 0.025;
if (this.seedChroma > 0.005) {
color.oklch.c = 0.005;
}

if (this.seedIsAchromatic) {
Expand Down Expand Up @@ -448,15 +448,15 @@ export class DarkModeTheme implements ColorModeTheme {
private get bgNeutralSoftHover() {
const color = this.bgNeutralSoft.clone();

color.oklch.l += 0.01;
color.oklch.l += 0.02;

return color;
}

private get bgNeutralSoftActive() {
const color = this.bgNeutralSoft.clone();

color.oklch.l -= 0.01;
color.oklch.l -= 0.015;

return color;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,23 +432,23 @@ export class LightModeTheme implements ColorModeTheme {
private get bgNeutralSoft() {
const color = this.bgNeutralSubtle.clone();

color.oklch.l -= 0.03;
color.oklch.l -= 0.045;

return color;
}

private get bgNeutralSoftHover() {
const color = this.bgNeutralSoft.clone();

color.oklch.l += 0.01;
color.oklch.l += 0.015;

return color;
}

private get bgNeutralSoftActive() {
const color = this.bgNeutralSoft.clone();

color.oklch.l -= 0.01;
color.oklch.l -= 0.015;

return color;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
display: inline-flex;
align-items: center;
justify-content: center;
width: var(--sizing-8);
height: var(--sizing-8);
width: var(--icon-size-3);
height: var(--icon-size-3);
}

.avatar[data-size="small"] {
width: var(--sizing-6);
height: var(--sizing-6);
width: var(--icon-size-2);
height: var(--icon-size-2);
}

.avatar[data-size="large"] {
width: var(--sizing-10);
height: var(--sizing-10);
width: var(--icon-size-4);
height: var(--icon-size-4);
}

/* if the avatar has div, that means no source is provided. For this case, we want to add a background color and border radius */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
color: var(--color-fg-$(color));
}
}

/* Adding as special case as we can't add neutral-subtle to $colors variable, as that variable is used generically for many components ( button ). */
&[data-color="neutral-subtle"] {
color: var(--color-fg-neutral-subtle);
}
}

.clampedText {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface TextProps {
/** Color of the text
* @default inherit
*/
color?: keyof typeof COLORS;
color?: keyof typeof COLORS | "neutral-subtle";
/** Sets the weight (or boldness) of the font
* @default false
*/
Expand Down
12 changes: 6 additions & 6 deletions app/client/packages/dsl/src/migrate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const migrateUnversionedDSL = (currentDSL: DSLWidget) => {
// A rudimentary transform function which updates the DSL based on its version.
// A more modular approach needs to be designed.
// This needs the widget config to be already built to migrate correctly
const migrateVersionedDSL = (currentDSL: DSLWidget, newPage = false) => {
const migrateVersionedDSL = async (currentDSL: DSLWidget, newPage = false) => {
if (currentDSL.version === 1) {
if (currentDSL.children && currentDSL.children.length > 0)
currentDSL.children = currentDSL.children.map(updateContainers);
Expand Down Expand Up @@ -205,7 +205,7 @@ const migrateVersionedDSL = (currentDSL: DSLWidget, newPage = false) => {
}

if (currentDSL.version === 12) {
currentDSL = migrateIncorrectDynamicBindingPathLists(currentDSL);
currentDSL = await migrateIncorrectDynamicBindingPathLists(currentDSL);
currentDSL.version = 13;
}

Expand Down Expand Up @@ -619,15 +619,15 @@ const migrateVersionedDSL = (currentDSL: DSLWidget, newPage = false) => {
return currentDSL;
};

export const migrateDSL = (
export const migrateDSL = async (
currentDSL: DSLWidget,
newPage = false,
): DSLWidget => {
): Promise<DSLWidget> => {
if (currentDSL.version === undefined) {
const initialDSL = migrateUnversionedDSL(currentDSL);

return migrateVersionedDSL(initialDSL, newPage) as DSLWidget;
return (await migrateVersionedDSL(initialDSL, newPage)) as DSLWidget;
} else {
return migrateVersionedDSL(currentDSL, newPage) as DSLWidget;
return (await migrateVersionedDSL(currentDSL, newPage)) as DSLWidget;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import isString from "lodash/isString";
import memoize from "micro-memoize";
import { isObject, isUndefined } from "lodash";
import { generateReactKey, isDynamicValue } from "../utils";
import widgetConfigs from "../helpers/widget-configs.json";

export const WidgetHeightLimits = {
MAX_HEIGHT_IN_ROWS: 9000,
Expand Down Expand Up @@ -511,8 +510,33 @@ export function addSearchConfigToPanelConfig(config: readonly any[]) {
return configItem;
});
}
// Cache for lazy-loaded widget configurations
let cachedWidgetConfigs: any | null = null;

/*
Lazily load this file since it is very large and used in migrations for certain DSL versions. By lazily loading
this large file it can be reduce the main chunk only be loaded for certain limited conditions.
*/
const loadWidgetConfig = async () => {
if (!cachedWidgetConfigs) {
try {
const { default: widgetConfigs } = await import(
"../helpers/widget-configs.json"
);

cachedWidgetConfigs = widgetConfigs; // Cache the module for future use
} catch (e) {
log.error("Error loading WidgetConfig", e);
}
}

const getWidgetPropertyPaneContentConfig = (type: string): readonly any[] => {
return cachedWidgetConfigs;
};

const getWidgetPropertyPaneContentConfig = async (
type: string,
): Promise<readonly any[]> => {
const widgetConfigs = await loadWidgetConfig();
const propertyPaneContentConfig = (widgetConfigs as any)[type]
.propertyPaneContentConfig;

Expand Down Expand Up @@ -540,7 +564,11 @@ const getWidgetPropertyPaneContentConfig = (type: string): readonly any[] => {
}
};

const getWidgetPropertyPaneStyleConfig = (type: string): readonly any[] => {
const getWidgetPropertyPaneStyleConfig = async (
type: string,
): Promise<readonly any[]> => {
const widgetConfigs = await loadWidgetConfig();

const propertyPaneStyleConfig = (widgetConfigs as any)[type]
.propertyPaneStyleConfig;

Expand All @@ -567,14 +595,20 @@ const getWidgetPropertyPaneStyleConfig = (type: string): readonly any[] => {
}
};

const getWidgetPropertyPaneCombinedConfig = (type: string): readonly any[] => {
const contentConfig = getWidgetPropertyPaneContentConfig(type);
const styleConfig = getWidgetPropertyPaneStyleConfig(type);
const getWidgetPropertyPaneCombinedConfig = async (
type: string,
): Promise<readonly any[]> => {
const contentConfig = await getWidgetPropertyPaneContentConfig(type);
const styleConfig = await getWidgetPropertyPaneStyleConfig(type);

return [...contentConfig, ...styleConfig];
};

const getWidgetPropertyPaneConfig = (type: string): readonly any[] => {
const getWidgetPropertyPaneConfig = async (
type: string,
): Promise<readonly any[]> => {
const widgetConfigs = await loadWidgetConfig();

const propertyPaneConfig = (widgetConfigs as any)[type].propertyPaneConfig;

const features = (widgetConfigs as any)[type].features;
Expand All @@ -590,7 +624,7 @@ const getWidgetPropertyPaneConfig = (type: string): readonly any[] => {

return enhancedPropertyPaneConfig;
} else {
const config = getWidgetPropertyPaneCombinedConfig(type);
const config = await getWidgetPropertyPaneCombinedConfig(type);

if (config === undefined) {
log.error("Widget property pane config not defined", type);
Expand Down Expand Up @@ -957,14 +991,14 @@ const getAllPathsFromPropertyConfig = memoize(
{ maxSize: 1000 },
);

export const migrateIncorrectDynamicBindingPathLists = (
export const migrateIncorrectDynamicBindingPathLists = async (
currentDSL: Readonly<DSLWidget>,
): DSLWidget => {
): Promise<DSLWidget> => {
const migratedDsl = {
...currentDSL,
};
const dynamicBindingPathList: any[] = [];
const propertyPaneConfig = getWidgetPropertyPaneConfig(currentDSL.type);
const propertyPaneConfig = await getWidgetPropertyPaneConfig(currentDSL.type);
const { bindingPaths } = getAllPathsFromPropertyConfig(
currentDSL,
propertyPaneConfig,
Expand All @@ -984,8 +1018,10 @@ export const migrateIncorrectDynamicBindingPathLists = (
migratedDsl.dynamicBindingPathList = dynamicBindingPathList;

if (currentDSL.children) {
migratedDsl.children = currentDSL.children.map(
migrateIncorrectDynamicBindingPathLists,
migratedDsl.children = await Promise.all(
currentDSL.children.map(async (value) =>
migrateIncorrectDynamicBindingPathLists(value),
),
);
}

Expand Down
Loading