@aglyn/besigner-ui 1.18.0 → 1.19.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/besigner-ui",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,22 +25,22 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.18.0",
29
- "@aglyn/aglyn-markdown-editor": "1.18.0",
30
- "@aglyn/aglyn-node-renderer": "1.18.0",
31
- "@aglyn/besigner": "1.18.0",
32
- "@aglyn/shared-data-enums": "1.18.0",
33
- "@aglyn/shared-data-mdi": "1.18.0",
34
- "@aglyn/shared-data-types": "1.18.0",
35
- "@aglyn/shared-svg-icons": "1.18.0",
36
- "@aglyn/shared-ui-json-editor": "1.18.0",
37
- "@aglyn/shared-ui-jsx": "1.18.0",
38
- "@aglyn/shared-ui-jsx-forms": "1.18.0",
39
- "@aglyn/shared-ui-snackstack": "1.18.0",
40
- "@aglyn/shared-ui-theme": "1.18.0",
41
- "@aglyn/shared-util-dom": "1.18.0",
42
- "@aglyn/shared-util-tools": "1.18.0",
43
- "@aglyn/shared-util-vendor": "1.18.0",
28
+ "@aglyn/aglyn": "1.19.0",
29
+ "@aglyn/aglyn-markdown-editor": "1.19.0",
30
+ "@aglyn/aglyn-node-renderer": "1.19.0",
31
+ "@aglyn/besigner": "1.19.0",
32
+ "@aglyn/shared-data-enums": "1.19.0",
33
+ "@aglyn/shared-data-mdi": "1.19.0",
34
+ "@aglyn/shared-data-types": "1.19.0",
35
+ "@aglyn/shared-svg-icons": "1.19.0",
36
+ "@aglyn/shared-ui-json-editor": "1.19.0",
37
+ "@aglyn/shared-ui-jsx": "1.19.0",
38
+ "@aglyn/shared-ui-jsx-forms": "1.19.0",
39
+ "@aglyn/shared-ui-snackstack": "1.19.0",
40
+ "@aglyn/shared-ui-theme": "1.19.0",
41
+ "@aglyn/shared-util-dom": "1.19.0",
42
+ "@aglyn/shared-util-tools": "1.19.0",
43
+ "@aglyn/shared-util-vendor": "1.19.0",
44
44
  "@dnd-kit/core": "^6.3.1",
45
45
  "@dnd-kit/utilities": "^3.2.2",
46
46
  "@react-aria/utils": "^3.34.1",
@@ -371,11 +371,13 @@ export declare function browseMediaKind(options: {
371
371
  }): Aglyn.MediaPickerKind | undefined;
372
372
  /**
373
373
  * Whether an element is offered the two visibility fields: inside a component
374
- * editor, and wherever it already carries a directive, like the logo and name
375
- * of a new site's header (AGL-4119), so what decides whether it shows can be
376
- * read and changed where the element is edited.
374
+ * editor, inside a repeat, where each copy reads a directive bound to an
375
+ * `{{item.*}}` token against its own record (AGL-4212), and wherever it
376
+ * already carries a directive, like the logo and name of a new site's header
377
+ * (AGL-4119), so what decides whether it shows can be read and changed where
378
+ * the element is edited.
377
379
  */
378
- export declare function offersVisibilityFields(nodeProps: Record<string, unknown> | null | undefined, inComponentEditor: boolean): boolean;
380
+ export declare function offersVisibilityFields(nodeProps: Record<string, unknown> | null | undefined, inComponentEditor: boolean, inRepeat?: boolean): boolean;
379
381
  /**
380
382
  * The two visibility fields every node inside a component definition gets
381
383
  * (AGL-1314), so "this part is optional" is something an author declares by
@@ -388,7 +390,8 @@ export declare function offersVisibilityFields(nodeProps: Record<string, unknown
388
390
  *
389
391
  * Offered where `{{prop.*}}` exists — inside a component editor, signalled by
390
392
  * `BindingPickerContext.componentProps` exactly as the insert picker uses it —
391
- * and on an element that already carries one ({@link offersVisibilityFields}).
393
+ * where `{{item.*}}` does, inside a repeat (AGL-4212), and on an element that
394
+ * already carries one ({@link offersVisibilityFields}).
392
395
  * Anywhere else a directive is inert (the graft is the only thing that
393
396
  * evaluates a literal one), and a field that silently does nothing is worse
394
397
  * than no field.
@@ -25,7 +25,7 @@ import { ANIMATION_DEFAULT_DELAY_MS, ANIMATION_DEFAULT_DURATION_MS, ANIMATION_DE
25
25
  import { repeatScope } from "@aglyn/aglyn/app-utils/expand-repeatables";
26
26
  import { entityFieldsPickerForAttribute, entityPickerForAttribute, pluginEntityPicker } from "@aglyn/aglyn/plugin-manager/plugin-entity-pickers";
27
27
  import { REPEAT_NODE_CAPABILITY } from "@aglyn/aglyn/app-utils/node-capabilities";
28
- import { repeatSourceOf } from "@aglyn/aglyn/app-utils/repeat-sources";
28
+ import { repeatKeyOptionLabel, repeatSourceOf } from "@aglyn/aglyn/app-utils/repeat-sources";
29
29
  import { useAglynSiteTheme } from "@aglyn/aglyn-node-renderer";
30
30
  import { FormRenderer, FormSpy, FIELD_MAP_BREAKPOINT_SPAN, FIELD_MAP_CHECKBOX, FIELD_MAP_COLOR_PICKER, FIELD_MAP_CSS_BORDER, FIELD_MAP_CSS_DIMENSION, FIELD_MAP_CSS_GRADIENT, FIELD_MAP_DATA_TABLE, FIELD_MAP_DUAL_LIST_SELECT, FIELD_MAP_ICON_PICKER, FIELD_MAP_PRESET_CHOICE, FIELD_MAP_RADIO, FIELD_MAP_SLIDER, FIELD_MAP_THEME_SCALE, FIELD_MAP_TOGGLE_BUTTON, simpleComponentMapper, useFormApi } from "@aglyn/shared-ui-jsx-forms";
31
31
  import { useHostThemeDocument } from "@aglyn/shared-ui-theme";
@@ -969,11 +969,13 @@ export const elementPropsComponentMapper = _extends({}, simpleComponentMapper, {
969
969
  }
970
970
  /**
971
971
  * Whether an element is offered the two visibility fields: inside a component
972
- * editor, and wherever it already carries a directive, like the logo and name
973
- * of a new site's header (AGL-4119), so what decides whether it shows can be
974
- * read and changed where the element is edited.
975
- */ export function offersVisibilityFields(nodeProps, inComponentEditor) {
976
- return inComponentEditor || Boolean((nodeProps == null ? void 0 : nodeProps[NODE_HIDE_IF_PROP]) || (nodeProps == null ? void 0 : nodeProps[NODE_HIDE_UNLESS_PROP]));
972
+ * editor, inside a repeat, where each copy reads a directive bound to an
973
+ * `{{item.*}}` token against its own record (AGL-4212), and wherever it
974
+ * already carries a directive, like the logo and name of a new site's header
975
+ * (AGL-4119), so what decides whether it shows can be read and changed where
976
+ * the element is edited.
977
+ */ export function offersVisibilityFields(nodeProps, inComponentEditor, inRepeat = false) {
978
+ return inComponentEditor || inRepeat || Boolean((nodeProps == null ? void 0 : nodeProps[NODE_HIDE_IF_PROP]) || (nodeProps == null ? void 0 : nodeProps[NODE_HIDE_UNLESS_PROP]));
977
979
  }
978
980
  /**
979
981
  * The two visibility fields every node inside a component definition gets
@@ -987,7 +989,8 @@ export const elementPropsComponentMapper = _extends({}, simpleComponentMapper, {
987
989
  *
988
990
  * Offered where `{{prop.*}}` exists — inside a component editor, signalled by
989
991
  * `BindingPickerContext.componentProps` exactly as the insert picker uses it —
990
- * and on an element that already carries one ({@link offersVisibilityFields}).
992
+ * where `{{item.*}}` does, inside a repeat (AGL-4212), and on an element that
993
+ * already carries one ({@link offersVisibilityFields}).
991
994
  * Anywhere else a directive is inert (the graft is the only thing that
992
995
  * evaluates a literal one), and a field that silently does nothing is worse
993
996
  * than no field.
@@ -1302,7 +1305,12 @@ export const elementPropsComponentMapper = _extends({}, simpleComponentMapper, {
1302
1305
  excerpt: (_source_keyAttribute_description = source.keyAttribute.description) != null ? _source_keyAttribute_description : '',
1303
1306
  href: besignerDocsUrl('repeat')
1304
1307
  }
1305
- }));
1308
+ }, source.offered === false ? {
1309
+ condition: {
1310
+ when: source.keyProp,
1311
+ isNotEmpty: true
1312
+ }
1313
+ } : {}));
1306
1314
  }),
1307
1315
  ...REPEAT_NODE_CAPABILITY.attributes.filter((attribute)=>hasChildren || !attribute.requiresChildren).map((attribute)=>{
1308
1316
  const { label, description, docsAnchor, requiresChildren: _requiresChildren } = attribute, field = _object_without_properties_loose(attribute, [
@@ -1736,7 +1744,7 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
1736
1744
  // Insert-picker options + pill display-name inputs (AGL-583/586),
1737
1745
  // assembled from this node's ancestor context — shared with the
1738
1746
  // inline text editor via the extracted hook.
1739
- const { options: insertOptions, labelContext: tokenLabelContext } = useInsertTokenOptions(node);
1747
+ const { options: insertOptions, labelContext: tokenLabelContext, inRepeat } = useInsertTokenOptions(node);
1740
1748
  // Re-render when the installed-plugin set changes (AGL-1030).
1741
1749
  const knownPluginInstallsVersion = useSyncExternalStore(subscribeKnownPluginInstalls, getKnownPluginInstallsVersion, getKnownPluginInstallsVersion);
1742
1750
  /**
@@ -1926,8 +1934,9 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
1926
1934
  themeScales
1927
1935
  ]);
1928
1936
  // Visibility directives (AGL-1314). `componentProps` is the same "am I
1929
- // editing a definition" signal the insert picker keys `{{prop.*}}` off.
1930
- const offersVisibility = offersVisibilityFields(nodeProps, Boolean(editedComponentProps));
1937
+ // editing a definition" signal the insert picker keys `{{prop.*}}` off,
1938
+ // and `inRepeat` the one it keys `{{item.*}}` off (AGL-4212).
1939
+ const offersVisibility = offersVisibilityFields(nodeProps, Boolean(editedComponentProps), inRepeat);
1931
1940
  const visibilityFields = useMemo(()=>offersVisibility ? buildVisibilityFields(insertOptions, tokenLabelContext) : [], [
1932
1941
  offersVisibility,
1933
1942
  insertOptions,
@@ -1974,7 +1983,7 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
1974
1983
  // that can name it. A source drawn with anything else — and a picker
1975
1984
  // whose list has not answered — is named by the stored key itself.
1976
1985
  const kind = entityPickerKindOf(repeat.source.keyAttribute.component);
1977
- const label = (_ref = kind ? (_entitySelectionOption = entitySelectionOption(entityOptions, kind, repeat.key)) == null ? void 0 : _entitySelectionOption.label : undefined) != null ? _ref : repeat.key;
1986
+ const label = (_ref = kind ? (_entitySelectionOption = entitySelectionOption(entityOptions, kind, repeat.key)) == null ? void 0 : _entitySelectionOption.label : repeatKeyOptionLabel(repeat.source, repeat.key)) != null ? _ref : repeat.key;
1978
1987
  return repeatScope({
1979
1988
  props: nodeProps,
1980
1989
  nodes: node == null ? void 0 : node.nodes