@aglyn/besigner-ui 1.23.1 → 1.25.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.23.1",
3
+ "version": "1.25.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.23.1",
29
- "@aglyn/aglyn-markdown-editor": "1.23.1",
30
- "@aglyn/aglyn-node-renderer": "1.23.1",
31
- "@aglyn/besigner": "1.23.1",
32
- "@aglyn/shared-data-enums": "1.23.1",
33
- "@aglyn/shared-data-mdi": "1.23.1",
34
- "@aglyn/shared-data-types": "1.23.1",
35
- "@aglyn/shared-svg-icons": "1.23.1",
36
- "@aglyn/shared-ui-json-editor": "1.23.1",
37
- "@aglyn/shared-ui-jsx": "1.23.1",
38
- "@aglyn/shared-ui-jsx-forms": "1.23.1",
39
- "@aglyn/shared-ui-snackstack": "1.23.1",
40
- "@aglyn/shared-ui-theme": "1.23.1",
41
- "@aglyn/shared-util-dom": "1.23.1",
42
- "@aglyn/shared-util-tools": "1.23.1",
43
- "@aglyn/shared-util-vendor": "1.23.1",
28
+ "@aglyn/aglyn": "1.25.0",
29
+ "@aglyn/aglyn-markdown-editor": "1.25.0",
30
+ "@aglyn/aglyn-node-renderer": "1.25.0",
31
+ "@aglyn/besigner": "1.25.0",
32
+ "@aglyn/shared-data-enums": "1.25.0",
33
+ "@aglyn/shared-data-mdi": "1.25.0",
34
+ "@aglyn/shared-data-types": "1.25.0",
35
+ "@aglyn/shared-svg-icons": "1.25.0",
36
+ "@aglyn/shared-ui-json-editor": "1.25.0",
37
+ "@aglyn/shared-ui-jsx": "1.25.0",
38
+ "@aglyn/shared-ui-jsx-forms": "1.25.0",
39
+ "@aglyn/shared-ui-snackstack": "1.25.0",
40
+ "@aglyn/shared-ui-theme": "1.25.0",
41
+ "@aglyn/shared-util-dom": "1.25.0",
42
+ "@aglyn/shared-util-tools": "1.25.0",
43
+ "@aglyn/shared-util-vendor": "1.25.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",
@@ -397,6 +397,17 @@ export declare function offersVisibilityFields(nodeProps: Record<string, unknown
397
397
  * than no field.
398
398
  */
399
399
  export declare function buildVisibilityFields(tokenOptions?: unknown, tokenLabelContext?: unknown): Array<Record<string, unknown>>;
400
+ /**
401
+ * "Show to" (AGL-4231), offered on every element: everyone, signed-in visitors
402
+ * or signed-out visitors — "Sign in" in a header for visitors and "Account"
403
+ * for members, a welcome only members see. Decided in the visitor's browser on
404
+ * the published site; the canvas shows every element so each can be edited.
405
+ *
406
+ * "Everyone" is a real value rather than `''`, for the reason the animation
407
+ * "None" is (AGL-1451): an empty value cannot persist, so the choice could
408
+ * never be taken back.
409
+ */
410
+ export declare function buildAudienceFields(): Array<Record<string, unknown>>;
400
411
  /**
401
412
  * The animation fields every element gets (AGL-2486).
402
413
  *
@@ -18,7 +18,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
18
18
  * limitations under the License.
19
19
  */ import PluginSettingsField, { PLUGIN_SETTINGS_FIELD_COMPONENT } from "./plugin-settings-field.component.js";
20
20
  import { isMediaPickerKind } from "@aglyn/aglyn/app-utils/media-picker-context";
21
- import { ANIMATION_DEFAULT_DELAY_MS, ANIMATION_DEFAULT_DURATION_MS, ANIMATION_DEFAULT_EASE, ANIMATION_DEFAULT_STAGGER_STEP_MS, ANIMATION_DEFAULT_TRIGGER, ANIMATION_MAX_DURATION_MS, ANIMATION_MAX_STAGGER_STEP_MS, ANIMATION_NONE, ANIMATION_PRESETS, canvas, COMPONENT_PROP_NAME_PATTERN, components, displayBindingTokens, ENTITY_PICKER_BROWSE_LIMIT, entityListState, EntityPickerContext, entityValueNeedsResolution, FEATURE_FLAG, FieldComponentType, getKnownPluginInstalls, getKnownPluginInstallsVersion, hasBindings, inheritedMediaAlt, intrinsicMediaSize, linkTargetKind, VIDEO_COMPONENT_ID, videoMediaProps, MISSING_BINDING_LABEL, NODE_ANIMATION_DELAY_PROP, NODE_ANIMATION_DURATION_PROP, NODE_ANIMATION_EASE_PROP, NODE_ANIMATION_PROP, NODE_ANIMATION_REPEAT_PROP, NODE_ANIMATION_STAGGER_PROP, NODE_ANIMATION_STAGGER_STEP_PROP, NODE_ANIMATION_TRIGGER_PROP, NODE_HIDE_IF_PROP, isPlacedFormNode, formPropsOnBind, FORM_COMPONENT_ID, NODE_HIDE_UNLESS_PROP, normalizeBindingTokens, readInstanceIconValue, readReusablePropValue, readYesNoValue, reusablePropConditionValue, reusablePropDefaultValue, reusablePropKind, reusablePropTakesSeveral, evaluateReusablePropRule, REUSABLE_INSTANCE_COMPONENT_ID, REUSABLE_INSTANCE_PROP_HTML_KEY, REUSABLE_INSTANCE_PROP_VALUES_KEY, listPropFedTextNodeIds, ScreenLinkContext, screenLinkTargetOptions, subscribeKnownPluginInstalls, unresolvedScreenOption } from "@aglyn/aglyn";
21
+ import { ANIMATION_DEFAULT_DELAY_MS, ANIMATION_DEFAULT_DURATION_MS, ANIMATION_DEFAULT_EASE, ANIMATION_DEFAULT_STAGGER_STEP_MS, ANIMATION_DEFAULT_TRIGGER, ANIMATION_MAX_DURATION_MS, ANIMATION_MAX_STAGGER_STEP_MS, ANIMATION_NONE, ANIMATION_PRESETS, canvas, COMPONENT_PROP_NAME_PATTERN, components, displayBindingTokens, ENTITY_PICKER_BROWSE_LIMIT, entityListState, EntityPickerContext, entityValueNeedsResolution, FEATURE_FLAG, FieldComponentType, getKnownPluginInstalls, getKnownPluginInstallsVersion, hasBindings, inheritedMediaAlt, intrinsicMediaSize, linkTargetKind, matchWholeItemToken, RECORD_ICON_FIELD_TYPE, RECORD_ICON_PATH_PART, VIDEO_COMPONENT_ID, videoMediaProps, MISSING_BINDING_LABEL, NODE_ANIMATION_DELAY_PROP, NODE_ANIMATION_DURATION_PROP, NODE_ANIMATION_EASE_PROP, NODE_ANIMATION_PROP, NODE_ANIMATION_REPEAT_PROP, NODE_ANIMATION_STAGGER_PROP, NODE_ANIMATION_STAGGER_STEP_PROP, NODE_ANIMATION_TRIGGER_PROP, NODE_HIDE_IF_PROP, isPlacedFormNode, formPropsOnBind, FORM_COMPONENT_ID, NODE_HIDE_UNLESS_PROP, NODE_SHOW_TO_PROP, normalizeBindingTokens, readInstanceIconValue, readReusablePropValue, readYesNoValue, reusablePropConditionValue, reusablePropDefaultValue, reusablePropKind, reusablePropTakesSeveral, evaluateReusablePropRule, REUSABLE_INSTANCE_COMPONENT_ID, REUSABLE_INSTANCE_PROP_HTML_KEY, REUSABLE_INSTANCE_PROP_VALUES_KEY, listPropFedTextNodeIds, ScreenLinkContext, screenLinkTargetOptions, SHOW_TO_EVERYONE, SHOW_TO_SIGNED_IN, SHOW_TO_SIGNED_OUT, subscribeKnownPluginInstalls, unresolvedScreenOption } from "@aglyn/aglyn";
22
22
  // By path, not the `@aglyn/aglyn` barrel: a repeat's bounds and the sources
23
23
  // an editor offers are editor business, and a published page must not pull
24
24
  // either in behind them.
@@ -53,7 +53,7 @@ import { readAttributeFieldValue } from "../utils/attribute-field-value.js";
53
53
  import { besignerDocsUrl } from "../utils/docs-help.js";
54
54
  import { buildStyleThemeScales } from "../utils/theme-scale-options.js";
55
55
  import { numericTextValue } from "../utils/numeric-text-value.js";
56
- import useInsertTokenOptions from "../hooks/use-insert-token-options.js";
56
+ import useInsertTokenOptions, { itemFieldBindingOptions } from "../hooks/use-insert-token-options.js";
57
57
  import useRepeatSources from "../hooks/use-repeat-sources.js";
58
58
  import { InteractionsContext, nodeElementSelector } from "../contexts/interactions-context.js";
59
59
  import { MediaPickerContext } from "../contexts/media-picker-context.js";
@@ -355,6 +355,13 @@ export const elementPropsComponentMapper = _extends({}, simpleComponentMapper, {
355
355
  paths[pathProp] = undefined;
356
356
  continue;
357
357
  }
358
+ // Bound to a record's icon field (AGL-4190): each copy of the repeat
359
+ // reads its own record's path, so the path follows the same field.
360
+ const recordField = matchWholeItemToken(pickedId);
361
+ if (recordField) {
362
+ paths[pathProp] = `{{item.${recordField}.${RECORD_ICON_PATH_PART}}}`;
363
+ continue;
364
+ }
358
365
  const unchanged = pickedId === (stored == null ? void 0 : stored[attribute.name]);
359
366
  const storedPath = stored == null ? void 0 : stored[pathProp];
360
367
  paths[pathProp] = (_getMdiIconPath = getMdiIconPath(pickedId)) != null ? _getMdiIconPath : unchanged && typeof storedPath === 'string' ? storedPath : undefined;
@@ -1014,6 +1021,44 @@ export const elementPropsComponentMapper = _extends({}, simpleComponentMapper, {
1014
1021
  field(NODE_HIDE_UNLESS_PROP, 'Hide unless', 'The reverse: remove this element from pages that leave this value ' + 'empty. Point it at the property that fills the element — a button ' + 'bound to {{prop.ctaLink}} then disappears instead of shipping a ' + 'link with nowhere to go.')
1015
1022
  ];
1016
1023
  }
1024
+ /**
1025
+ * "Show to" (AGL-4231), offered on every element: everyone, signed-in visitors
1026
+ * or signed-out visitors — "Sign in" in a header for visitors and "Account"
1027
+ * for members, a welcome only members see. Decided in the visitor's browser on
1028
+ * the published site; the canvas shows every element so each can be edited.
1029
+ *
1030
+ * "Everyone" is a real value rather than `''`, for the reason the animation
1031
+ * "None" is (AGL-1451): an empty value cannot persist, so the choice could
1032
+ * never be taken back.
1033
+ */ export function buildAudienceFields() {
1034
+ const description = 'Which visitors see this element on the live site. Signed in means ' + "signed in to this site's account. It decides what shows, not what is " + 'private: put members-only content on a members-only page. In the ' + 'Besigner every element shows, so you can edit it.';
1035
+ return [
1036
+ {
1037
+ name: NODE_SHOW_TO_PROP,
1038
+ label: 'Show to',
1039
+ description,
1040
+ help: {
1041
+ title: 'Show to',
1042
+ excerpt: description
1043
+ },
1044
+ component: FieldComponentType.SELECT,
1045
+ options: [
1046
+ {
1047
+ value: SHOW_TO_EVERYONE,
1048
+ label: 'Everyone'
1049
+ },
1050
+ {
1051
+ value: SHOW_TO_SIGNED_IN,
1052
+ label: 'Signed-in visitors'
1053
+ },
1054
+ {
1055
+ value: SHOW_TO_SIGNED_OUT,
1056
+ label: 'Signed-out visitors'
1057
+ }
1058
+ ]
1059
+ }
1060
+ ];
1061
+ }
1017
1062
  /**
1018
1063
  * The animation fields every element gets (AGL-2486).
1019
1064
  *
@@ -1744,7 +1789,21 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
1744
1789
  // Insert-picker options + pill display-name inputs (AGL-583/586),
1745
1790
  // assembled from this node's ancestor context — shared with the
1746
1791
  // inline text editor via the extracted hook.
1747
- const { options: insertOptions, labelContext: tokenLabelContext, inRepeat } = useInsertTokenOptions(node);
1792
+ const { options: insertOptions, labelContext: tokenLabelContext, inRepeat, itemFields, itemNoun, entityLabel: repeatEntityLabel } = useInsertTokenOptions(node);
1793
+ /**
1794
+ * Inside a repeat, an Icon picker can follow a record's icon field
1795
+ * (AGL-4190), which each copy then draws with its own record's icon.
1796
+ * Only icon fields are offered: anything else would hand the picker a
1797
+ * value that is no icon.
1798
+ */ const recordIconBindings = useMemo(()=>itemFieldBindingOptions({
1799
+ itemFields,
1800
+ itemNoun,
1801
+ entityLabel: repeatEntityLabel
1802
+ }, RECORD_ICON_FIELD_TYPE), [
1803
+ itemFields,
1804
+ itemNoun,
1805
+ repeatEntityLabel
1806
+ ]);
1748
1807
  // Re-render when the installed-plugin set changes (AGL-1030).
1749
1808
  const knownPluginInstallsVersion = useSyncExternalStore(subscribeKnownPluginInstalls, getKnownPluginInstallsVersion, getKnownPluginInstallsVersion);
1750
1809
  /**
@@ -1886,7 +1945,7 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
1886
1945
  }) : field;
1887
1946
  };
1888
1947
  return (rawAttributes != null ? rawAttributes : []).map(withAttributeHelp).map((field)=>resolveAttributeField(field, resolveContext)).map((field, index)=>{
1889
- var _rawAttributes_index;
1948
+ var _rawAttributes_index, _rawAttributes_index1;
1890
1949
  return(// One field in, one out, so `index` still names the attribute as
1891
1950
  // the schema DECLARED it. The rewrites above change `component` —
1892
1951
  // a Screen picker is the link lookup by now — and what a field can
@@ -1895,6 +1954,7 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
1895
1954
  declaredComponent: rawAttributes == null ? void 0 : (_rawAttributes_index = rawAttributes[index]) == null ? void 0 : _rawAttributes_index.component,
1896
1955
  declaredField: rawAttributes == null ? void 0 : rawAttributes[index],
1897
1956
  componentProps: editedComponentProps,
1957
+ recordBindings: (rawAttributes == null ? void 0 : (_rawAttributes_index1 = rawAttributes[index]) == null ? void 0 : _rawAttributes_index1.component) === FieldComponentType.ICON_PICKER ? recordIconBindings : undefined,
1898
1958
  owner: componentPropsOwner,
1899
1959
  control: elementPropsComponentMapper[field.component],
1900
1960
  tokenLabelContext
@@ -1918,7 +1978,8 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
1918
1978
  tokenLabelContext,
1919
1979
  editedComponentProps,
1920
1980
  componentPropsOwner,
1921
- fieldContext
1981
+ fieldContext,
1982
+ recordIconBindings
1922
1983
  ]);
1923
1984
  // The placed component's properties (AGL-1247), each drawn with the
1924
1985
  // control its kind names and finished by the same resolver as the
@@ -1944,7 +2005,10 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
1944
2005
  ]);
1945
2006
  // Element animation (AGL-2486). Static, so it is built once rather than
1946
2007
  // per render; unlike the visibility directives it is offered everywhere.
1947
- const animationFields = useMemo(()=>buildAnimationFields(), []);
2008
+ const animationFields = useMemo(()=>[
2009
+ ...buildAudienceFields(),
2010
+ ...buildAnimationFields()
2011
+ ], []);
1948
2012
  /**
1949
2013
  * Repeat (AGL-3111), offered on every element and every instance — the
1950
2014
  * whole point of the capability — from whatever sources the loaded plugins