@cratis/components 4.41.4 → 4.41.5

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.
@@ -68,7 +68,7 @@
68
68
  {
69
69
  "name": "@cratis/components",
70
70
  "role": "core",
71
- "version": "4.41.4",
71
+ "version": "4.41.5",
72
72
  "releaseMajorRange": ">=4 <5",
73
73
  "independentRelease": false,
74
74
  "private": false,
@@ -92,7 +92,7 @@
92
92
  {
93
93
  "name": "@cratis/eslint-plugin-components",
94
94
  "role": "eslint",
95
- "version": "4.41.4",
95
+ "version": "4.41.5",
96
96
  "releaseMajorRange": ">=4 <5",
97
97
  "independentRelease": false,
98
98
  "private": false,
@@ -105,7 +105,7 @@
105
105
  {
106
106
  "name": "@cratis/components.migrator",
107
107
  "role": "migrator",
108
- "version": "4.41.4",
108
+ "version": "4.41.5",
109
109
  "releaseMajorRange": ">=4 <5",
110
110
  "independentRelease": false,
111
111
  "private": false,
@@ -116,13 +116,13 @@
116
116
  {
117
117
  "name": "@cratis/components.conformance",
118
118
  "role": "conformance",
119
- "version": "4.41.4",
119
+ "version": "4.41.5",
120
120
  "releaseMajorRange": ">=4 <5",
121
121
  "independentRelease": false,
122
122
  "private": false,
123
123
  "packageAccess": "public",
124
124
  "peerDependencies": {
125
- "@cratis/components": "4.41.4",
125
+ "@cratis/components": "4.41.5",
126
126
  "react": "^19.0.0",
127
127
  "react-dom": "^19.0.0"
128
128
  },
@@ -132,13 +132,13 @@
132
132
  {
133
133
  "name": "@cratis/components.mui",
134
134
  "role": "renderer-adapter",
135
- "version": "4.41.4",
135
+ "version": "4.41.5",
136
136
  "releaseMajorRange": ">=4 <5",
137
137
  "independentRelease": false,
138
138
  "private": false,
139
139
  "packageAccess": "public",
140
140
  "peerDependencies": {
141
- "@cratis/components": "4.41.4",
141
+ "@cratis/components": "4.41.5",
142
142
  "@emotion/react": ">=11.5 <12",
143
143
  "@emotion/styled": ">=11.11 <12",
144
144
  "@mui/material": ">=9 <10",
@@ -188,13 +188,13 @@
188
188
  {
189
189
  "name": "@cratis/components.primereact",
190
190
  "role": "renderer-adapter",
191
- "version": "4.41.4",
191
+ "version": "4.41.5",
192
192
  "releaseMajorRange": ">=4 <5",
193
193
  "independentRelease": false,
194
194
  "private": false,
195
195
  "packageAccess": "public",
196
196
  "peerDependencies": {
197
- "@cratis/components": "4.41.4",
197
+ "@cratis/components": "4.41.5",
198
198
  "@primereact/core": ">=11 <12",
199
199
  "@primereact/ui": ">=11 <12",
200
200
  "@primeuix/themes": ">=3 <4",
@@ -256,13 +256,13 @@
256
256
  {
257
257
  "name": "@cratis/components.primereact10",
258
258
  "role": "renderer-adapter",
259
- "version": "4.41.4",
259
+ "version": "4.41.5",
260
260
  "releaseMajorRange": ">=4 <5",
261
261
  "independentRelease": false,
262
262
  "private": false,
263
263
  "packageAccess": "public",
264
264
  "peerDependencies": {
265
- "@cratis/components": "4.41.4",
265
+ "@cratis/components": "4.41.5",
266
266
  "primereact": ">=10.9.9 <11",
267
267
  "react": "^19.0.0",
268
268
  "react-dom": "^19.0.0"
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationPropertyEditor.d.ts","sourceRoot":"","sources":["../../../ComponentPicker/PresentationPropertyEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iDAA8C,CAAC;AAEvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AAIzD,oDAAoD;AACpD,MAAM,WAAW,+BAA+B;IAC5C,qEAAqE;IACrE,MAAM,EAAE,eAAe,CAAC;IACxB,mHAAmH;IACnH,QAAQ,EAAE,CAAC,OAAO,EAAE,kBAAkB,EAAE,KAAK,IAAI,CAAC;IAClD;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAmED;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,6CAAsD,+BAA+B,gCA+C3H,CAAC"}
1
+ {"version":3,"file":"PresentationPropertyEditor.d.ts","sourceRoot":"","sources":["../../../ComponentPicker/PresentationPropertyEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iDAA8C,CAAC;AAEvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AAIzD,oDAAoD;AACpD,MAAM,WAAW,+BAA+B;IAC5C,qEAAqE;IACrE,MAAM,EAAE,eAAe,CAAC;IACxB,mHAAmH;IACnH,QAAQ,EAAE,CAAC,OAAO,EAAE,kBAAkB,EAAE,KAAK,IAAI,CAAC;IAClD;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAoED;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,6CAAsD,+BAA+B,gCAmD3H,CAAC"}
@@ -4,6 +4,7 @@ import { previewPresentationChanges } from '../configuration/identity/componentI
4
4
  import { proposedChanges } from './proposedChanges.js';
5
5
 
6
6
  const unsetValue = '';
7
+ const emptyDraft = Object.freeze({});
7
8
  const field = (property, id, value, set) => {
8
9
  const common = { id, disabled: !property.editable, 'data-cratis-part': 'input' };
9
10
  switch (property.type) {
@@ -22,12 +23,13 @@ const field = (property, id, value, set) => {
22
23
  };
23
24
  const PresentationPropertyEditor = ({ picked, onChange, preview = false, className }) => {
24
25
  const prefix = useId();
25
- const [draft, setDraft] = useState({});
26
- const changes = useMemo(() => proposedChanges(picked, draft), [picked, draft]);
26
+ const [draft, setDraft] = useState({ picked, values: emptyDraft });
27
+ const values = draft.picked === picked ? draft.values : emptyDraft;
28
+ const changes = useMemo(() => proposedChanges(picked, values), [picked, values]);
27
29
  const reportChange = useRef(onChange);
28
30
  reportChange.current = onChange;
29
31
  useEffect(() => {
30
- setDraft({});
32
+ setDraft({ picked, values: emptyDraft });
31
33
  }, [picked]);
32
34
  useEffect(() => {
33
35
  reportChange.current(changes);
@@ -42,8 +44,11 @@ const PresentationPropertyEditor = ({ picked, onChange, preview = false, classNa
42
44
  }
43
45
  return (jsx("div", { "data-cratis-part": 'root', "data-cratis-component": 'PresentationPropertyEditor', className: className, children: picked.presentationProperties.map((property) => {
44
46
  const id = `${prefix}-${property.name}`;
45
- const value = property.name in draft ? draft[property.name] : property.value;
46
- return (jsxs("div", { "data-cratis-part": 'property', children: [jsx("label", { htmlFor: id, "data-cratis-part": 'label', children: property.label }), field(property, id, value, (next) => setDraft((current) => ({ ...current, [property.name]: next }))), property.description && jsx("small", { "data-cratis-part": 'description', children: property.description })] }, property.name));
47
+ const value = property.name in values ? values[property.name] : property.value;
48
+ return (jsxs("div", { "data-cratis-part": 'property', children: [jsx("label", { htmlFor: id, "data-cratis-part": 'label', children: property.label }), field(property, id, value, (next) => setDraft((current) => ({
49
+ picked,
50
+ values: { ...(current.picked === picked ? current.values : emptyDraft), [property.name]: next },
51
+ }))), property.description && jsx("small", { "data-cratis-part": 'description', children: property.description })] }, property.name));
47
52
  }) }));
48
53
  };
49
54
 
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationPropertyEditor.js","sources":["../../../ComponentPicker/PresentationPropertyEditor.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useEffect, useId, useMemo, useRef, useState } from 'react';\nimport { previewPresentationChanges } from '../configuration/identity/componentInstances';\nimport type { PresentationChange } from '../configuration/identity/PresentationChange';\nimport type { PresentationPropertyValue } from '../configuration/identity/PresentationPropertyValue';\nimport type { PickedComponent } from './PickedComponent';\nimport type { PickedPresentationProperty } from './PickedPresentationProperty';\nimport { proposedChanges } from './proposedChanges';\n\n/** Props for {@link PresentationPropertyEditor}. */\nexport interface PresentationPropertyEditorProps {\n /** The picked component whose presentation properties are edited. */\n picked: PickedComponent;\n /** Called every time the proposed changes change, including with `[]` when nothing differs. Nothing is applied. */\n onChange: (changes: PresentationChange[]) => void;\n /**\n * Applies the proposed changes to the rendered component while editing, through the same\n * registry the picker reads. The component returns to how it was when the editor unmounts,\n * when this turns off, and when a change is edited back to its original value.\n */\n preview?: boolean;\n /** Extra class name for the editor root. */\n className?: string;\n}\n\nconst unsetValue = '';\n\nconst field = (\n property: PickedPresentationProperty,\n id: string,\n value: PresentationPropertyValue,\n set: (next: PresentationPropertyValue) => void,\n) => {\n const common = { id, disabled: !property.editable, 'data-cratis-part': 'input' } as const;\n switch (property.type) {\n case 'boolean':\n return (\n <input\n {...common}\n type='checkbox'\n checked={value === true}\n onChange={(event) => set(event.currentTarget.checked)}\n />\n );\n case 'number':\n return (\n <input\n {...common}\n className='cratis-text-input'\n type='number'\n value={typeof value === 'number' ? value : ''}\n onChange={(event) =>\n set(event.currentTarget.value === '' ? undefined : Number(event.currentTarget.value))\n }\n />\n );\n case 'enum':\n return (\n <select\n {...common}\n className='cratis-text-input'\n value={value === undefined ? unsetValue : String(value)}\n onChange={(event) => {\n const chosen = event.currentTarget.value;\n set(chosen === unsetValue ? undefined : property.values?.find((v) => String(v) === chosen));\n }}\n >\n <option value={unsetValue}>\n {property.defaultValue === undefined ? '(not set)' : `(default: ${String(property.defaultValue)})`}\n </option>\n {property.values?.map((option) => (\n <option key={String(option)} value={String(option)}>\n {String(option)}\n </option>\n ))}\n </select>\n );\n default:\n return (\n <input\n {...common}\n className='cratis-text-input'\n type='text'\n value={typeof value === 'string' ? value : ''}\n onChange={(event) => set(event.currentTarget.value)}\n />\n );\n }\n};\n\n/**\n * A form for the presentation properties of a {@link PickedComponent}: a text, toggle, select or\n * number input per property, built from the component's descriptor. It reports the proposed changes\n * as `{ property, from, to }` and never applies them to the app, except for the optional live\n * `preview`.\n */\nexport const PresentationPropertyEditor = ({ picked, onChange, preview = false, className }: PresentationPropertyEditorProps) => {\n const prefix = useId();\n const [draft, setDraft] = useState<Record<string, PresentationPropertyValue>>({});\n const changes = useMemo(() => proposedChanges(picked, draft), [picked, draft]);\n const reportChange = useRef(onChange);\n reportChange.current = onChange;\n\n useEffect(() => {\n setDraft({});\n }, [picked]);\n\n useEffect(() => {\n reportChange.current(changes);\n }, [changes]);\n\n useEffect(() => {\n if (!preview || changes.length === 0) return;\n return previewPresentationChanges(picked.element, changes);\n }, [preview, changes, picked.element]);\n\n if (picked.presentationProperties.length === 0) {\n return (\n <p data-cratis-part='empty' className={className}>\n {picked.component} has no properties that can be changed here.\n </p>\n );\n }\n\n return (\n <div data-cratis-part='root' data-cratis-component='PresentationPropertyEditor' className={className}>\n {picked.presentationProperties.map((property) => {\n const id = `${prefix}-${property.name}`;\n const value = property.name in draft ? draft[property.name] : property.value;\n return (\n <div key={property.name} data-cratis-part='property'>\n <label htmlFor={id} data-cratis-part='label'>\n {property.label}\n </label>\n {field(property, id, value, (next) =>\n setDraft((current) => ({ ...current, [property.name]: next })),\n )}\n {property.description && <small data-cratis-part='description'>{property.description}</small>}\n </div>\n );\n })}\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;AA2BA,MAAM,UAAU,GAAG,EAAE;AAErB,MAAM,KAAK,GAAG,CACV,QAAoC,EACpC,EAAU,EACV,KAAgC,EAChC,GAA8C,KAC9C;AACA,IAAA,MAAM,MAAM,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAW;AACzF,IAAA,QAAQ,QAAQ,CAAC,IAAI;AACjB,QAAA,KAAK,SAAS;AACV,YAAA,QACIA,GAAA,CAAA,OAAA,EAAA,EAAA,GACQ,MAAM,EACV,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,KAAK,KAAK,IAAI,EACvB,QAAQ,EAAE,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,EAAA,CACvD;AAEV,QAAA,KAAK,QAAQ;AACT,YAAA,QACIA,GAAA,CAAA,OAAA,EAAA,EAAA,GACQ,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Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useEffect, useId, useMemo, useRef, useState } from 'react';\nimport { previewPresentationChanges } from '../configuration/identity/componentInstances';\nimport type { PresentationChange } from '../configuration/identity/PresentationChange';\nimport type { PresentationPropertyValue } from '../configuration/identity/PresentationPropertyValue';\nimport type { PickedComponent } from './PickedComponent';\nimport type { PickedPresentationProperty } from './PickedPresentationProperty';\nimport { proposedChanges } from './proposedChanges';\n\n/** Props for {@link PresentationPropertyEditor}. */\nexport interface PresentationPropertyEditorProps {\n /** The picked component whose presentation properties are edited. */\n picked: PickedComponent;\n /** Called every time the proposed changes change, including with `[]` when nothing differs. Nothing is applied. */\n onChange: (changes: PresentationChange[]) => void;\n /**\n * Applies the proposed changes to the rendered component while editing, through the same\n * registry the picker reads. The component returns to how it was when the editor unmounts,\n * when this turns off, and when a change is edited back to its original value.\n */\n preview?: boolean;\n /** Extra class name for the editor root. */\n className?: string;\n}\n\nconst unsetValue = '';\nconst emptyDraft: Readonly<Record<string, PresentationPropertyValue>> = Object.freeze({});\n\nconst field = (\n property: PickedPresentationProperty,\n id: string,\n value: PresentationPropertyValue,\n set: (next: PresentationPropertyValue) => void,\n) => {\n const common = { id, disabled: !property.editable, 'data-cratis-part': 'input' } as const;\n switch (property.type) {\n case 'boolean':\n return (\n <input\n {...common}\n type='checkbox'\n checked={value === true}\n onChange={(event) => set(event.currentTarget.checked)}\n />\n );\n case 'number':\n return (\n <input\n {...common}\n className='cratis-text-input'\n type='number'\n value={typeof value === 'number' ? value : ''}\n onChange={(event) =>\n set(event.currentTarget.value === '' ? undefined : Number(event.currentTarget.value))\n }\n />\n );\n case 'enum':\n return (\n <select\n {...common}\n className='cratis-text-input'\n value={value === undefined ? unsetValue : String(value)}\n onChange={(event) => {\n const chosen = event.currentTarget.value;\n set(chosen === unsetValue ? undefined : property.values?.find((v) => String(v) === chosen));\n }}\n >\n <option value={unsetValue}>\n {property.defaultValue === undefined ? '(not set)' : `(default: ${String(property.defaultValue)})`}\n </option>\n {property.values?.map((option) => (\n <option key={String(option)} value={String(option)}>\n {String(option)}\n </option>\n ))}\n </select>\n );\n default:\n return (\n <input\n {...common}\n className='cratis-text-input'\n type='text'\n value={typeof value === 'string' ? value : ''}\n onChange={(event) => set(event.currentTarget.value)}\n />\n );\n }\n};\n\n/**\n * A form for the presentation properties of a {@link PickedComponent}: a text, toggle, select or\n * number input per property, built from the component's descriptor. It reports the proposed changes\n * as `{ property, from, to }` and never applies them to the app, except for the optional live\n * `preview`.\n */\nexport const PresentationPropertyEditor = ({ picked, onChange, preview = false, className }: PresentationPropertyEditorProps) => {\n const prefix = useId();\n const [draft, setDraft] = useState({ picked, values: emptyDraft });\n const values = draft.picked === picked ? draft.values : emptyDraft;\n const changes = useMemo(() => proposedChanges(picked, values), [picked, values]);\n const reportChange = useRef(onChange);\n reportChange.current = onChange;\n\n useEffect(() => {\n setDraft({ picked, values: emptyDraft });\n }, [picked]);\n\n useEffect(() => {\n reportChange.current(changes);\n }, [changes]);\n\n useEffect(() => {\n if (!preview || changes.length === 0) return;\n return previewPresentationChanges(picked.element, changes);\n }, [preview, changes, picked.element]);\n\n if (picked.presentationProperties.length === 0) {\n return (\n <p data-cratis-part='empty' className={className}>\n {picked.component} has no properties that can be changed here.\n </p>\n );\n }\n\n return (\n <div data-cratis-part='root' data-cratis-component='PresentationPropertyEditor' className={className}>\n {picked.presentationProperties.map((property) => {\n const id = `${prefix}-${property.name}`;\n const value = property.name in values ? values[property.name] : property.value;\n return (\n <div key={property.name} data-cratis-part='property'>\n <label htmlFor={id} data-cratis-part='label'>\n {property.label}\n </label>\n {field(property, id, value, (next) =>\n setDraft((current) => ({\n picked,\n values: { ...(current.picked === picked ? current.values : emptyDraft), [property.name]: next },\n })),\n )}\n {property.description && <small data-cratis-part='description'>{property.description}</small>}\n </div>\n );\n })}\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;AA2BA,MAAM,UAA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C,IAAI,CAAA,CAAE;YACvC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,IAAI,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK;AAC9E,YAAA,QACIC,IAAA,CAAA,KAAA,EAAA,EAAA,kBAAA,EAA0C,UAAU,EAAA,QAAA,EAAA,CAChDD,GAAA,CAAA,OAAA,EAAA,EAAO,OAAO,EAAE,EAAE,EAAA,kBAAA,EAAmB,OAAO,YACvC,QAAQ,CAAC,KAAK,EAAA,CACX,EACP,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,IAAI,KAC7B,QAAQ,CAAC,CAAC,OAAO,MAAM;wBACnB,MAAM;AACN,wBAAA,MAAM,EAAE,EAAE,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,EAAE;qBAClG,CAAC,CAAC,CACN,EACA,QAAQ,CAAC,WAAW,IAAIA,mCAAwB,aAAa,EAAA,QAAA,EAAE,QAAQ,CAAC,WAAW,GAAS,CAAA,EAAA,EAVvF,QAAQ,CAAC,IAAI,CAWjB;QAEd,CAAC,CAAC,EAAA,CACA;AAEd;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/components",
3
- "version": "4.41.4",
3
+ "version": "4.41.5",
4
4
  "description": "React components for CQRS and event-sourced apps — command dialogs, typed forms, and query-backed data tables for Cratis Arc",
5
5
  "keywords": [
6
6
  "react",