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
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"browserslist": "defaults, not ie <= 11",
"dependencies": {
"@algolia/autocomplete-core": "^1.9.2",
"@coltorapps/builder": "^0.2.1",
"@coltorapps/builder-react": "^0.2.1",
"@coltorapps/builder": "^0.2.2",
"@coltorapps/builder-react": "^0.2.2",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/modifiers": "^7.0.0",
"@dnd-kit/sortable": "^8.0.0",
Expand Down
8 changes: 4 additions & 4 deletions docs/src/app/docs/api/create-interpreter-store/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ In the example above, we've hardcoded the schema, but typically, you would retri

The `options` parameter properties:

| Property | Type | Description {% class="api-description" %} |
| ----------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| `initialData` | {% badge content="object" /%} {% badge content="optional" /%} | The optional partial initial data. |
| `initialEntitiesValuesWithDefaults` | {% badge content="boolean" /%} {% badge content="optional" /%} | A flag to disable the automatic setting of default values. Defaults to `true`. |
| Property | Type | Description {% class="api-description" %} |
| ----------------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `initialData` | {% badge content="object" /%} {% badge content="optional" /%} | The optional partial initial data. |
| `initialEntitiesValuesWithDefaults` | {% badge content="boolean" /%} {% badge content="optional" /%} | A flag to enable or disable the automatic setting of default values. Defaults to `true`. |

### Returns

Expand Down
9 changes: 5 additions & 4 deletions docs/src/app/docs/api/react/use-interpreter-store/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ In the example above, we've hardcoded the schema, but typically, you would retri

The `options` parameter properties:

| Property | Type | Description {% class="api-description" %} |
| ------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `initialData` | {% badge content="object" /%} {% badge content="optional" /%} | The optional partial initial data of the [interpreter store](/docs/api/create-interpreter-store#data). |
| `events` | {% badge content="object" /%} {% badge content="optional" /%} | An optional partial object with [events callbacks](#events-callbacks). |
| Property | Type | Description {% class="api-description" %} |
| ----------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `initialData` | {% badge content="object" /%} {% badge content="optional" /%} | The optional partial initial data of the [interpreter store](/docs/api/create-interpreter-store#data). |
| `initialEntitiesValuesWithDefaults` | {% badge content="boolean" /%} {% badge content="optional" /%} | A flag to enable or disable the automatic setting of default values. Defaults to `true`. |
| `events` | {% badge content="object" /%} {% badge content="optional" /%} | An optional partial object with [events callbacks](#events-callbacks). |

### Returns

Expand Down
6 changes: 6 additions & 0 deletions packages/builder-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coltorapps/builder-react

## 0.2.2

### Patch Changes

- Expose all interpreter store options and make them available in useInterpreterStore.

## 0.2.1

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/builder-react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@coltorapps/builder-react",
"private": false,
"version": "0.2.1",
"version": "0.2.2",
"homepage": "https://builder.coltorapps.com/",
"repository": {
"type": "git",
Expand Down Expand Up @@ -32,7 +32,7 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
},
"devDependencies": {
"@coltorapps/builder": "^0.2.1",
"@coltorapps/builder": "^0.2.2",
"@coltorapps/eslint-config": "0.1.0",
"@types/react": "^18.2.32",
"eslint": "^8.52.0",
Expand All @@ -41,7 +41,7 @@
"vitest": "^0.34.6"
},
"peerDependencies": {
"@coltorapps/builder": "^0.2.0",
"@coltorapps/builder": "^0.2.2",
"react": "^18.0.0 || ^19.0.0"
},
"publishConfig": {
Expand Down
9 changes: 3 additions & 6 deletions packages/builder-react/src/interpreter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
type InterpreterStore,
type InterpreterStoreData,
type InterpreterStoreEvent,
type InterpreterStoreOptions,
type Schema,
} from "@coltorapps/builder";

Expand All @@ -24,15 +25,11 @@ export function useInterpreterStore<TBuilder extends Builder>(
builder: TBuilder,
schema: Schema<TBuilder>,
options: {
initialData?: Partial<InterpreterStoreData<TBuilder>>;
events?: EventsListeners<InterpreterStoreEvent<TBuilder>>;
} = {},
} & InterpreterStoreOptions<TBuilder> = {},
): InterpreterStore<TBuilder> {
const interpreterStore = useMemo(
() =>
createInterpreterStore(builder, schema, {
initialData: options.initialData,
}),
() => createInterpreterStore(builder, schema, options),
// eslint-disable-next-line react-hooks/exhaustive-deps
[builder, schema],
);
Expand Down
6 changes: 6 additions & 0 deletions packages/builder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @coltorapps/builder

## 0.2.2

### Patch Changes

- Expose all interpreter store options and make them available in useInterpreterStore.

## 0.2.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/builder/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@coltorapps/builder",
"private": false,
"version": "0.2.1",
"version": "0.2.2",
"homepage": "https://builder.coltorapps.com/",
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions packages/builder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type {
InterpreterStore,
InterpreterStoreData,
InterpreterStoreEvent,
InterpreterStoreOptions,
InterpreterStoreEventName,
} from "./interpreter-store";

Expand Down
14 changes: 8 additions & 6 deletions packages/builder/src/interpreter-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,15 +488,17 @@ function ensureEntityProcessable(
}
}

export type InterpreterStoreOptions<TBuilder extends Builder> = {
initialData?: Partial<
Omit<InterpreterStoreData<TBuilder>, "unprocessableEntitiesIds">
>;
initialEntitiesValuesWithDefaults?: boolean;
};

export function createInterpreterStore<TBuilder extends Builder>(
builder: TBuilder,
schema: Schema<TBuilder>,
options?: {
initialData?: Partial<
Omit<InterpreterStoreData<TBuilder>, "unprocessableEntitiesIds">
>;
initialEntitiesValuesWithDefaults?: boolean;
},
options?: InterpreterStoreOptions<TBuilder>,
): InterpreterStore<TBuilder> {
const schemaValidationResult = validateSchemaShape(schema, builder);

Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading