@aglyn/besigner-ui 1.0.0 → 1.1.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.0.0",
3
+ "version": "1.1.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.0.0",
29
- "@aglyn/aglyn-markdown-editor": "1.0.0",
30
- "@aglyn/aglyn-node-renderer": "1.0.0",
31
- "@aglyn/besigner": "1.0.0",
32
- "@aglyn/shared-data-enums": "1.0.0",
33
- "@aglyn/shared-data-mdi": "1.0.0",
34
- "@aglyn/shared-data-types": "1.0.0",
35
- "@aglyn/shared-svg-icons": "1.0.0",
36
- "@aglyn/shared-ui-json-editor": "1.0.0",
37
- "@aglyn/shared-ui-jsx": "1.0.0",
38
- "@aglyn/shared-ui-jsx-forms": "1.0.0",
39
- "@aglyn/shared-ui-snackstack": "1.0.0",
40
- "@aglyn/shared-ui-theme": "1.0.0",
41
- "@aglyn/shared-util-dom": "1.0.0",
42
- "@aglyn/shared-util-tools": "1.0.0",
43
- "@aglyn/shared-util-vendor": "1.0.0",
28
+ "@aglyn/aglyn": "1.1.0",
29
+ "@aglyn/aglyn-markdown-editor": "1.1.0",
30
+ "@aglyn/aglyn-node-renderer": "1.1.0",
31
+ "@aglyn/besigner": "1.1.0",
32
+ "@aglyn/shared-data-enums": "1.1.0",
33
+ "@aglyn/shared-data-mdi": "1.1.0",
34
+ "@aglyn/shared-data-types": "1.1.0",
35
+ "@aglyn/shared-svg-icons": "1.1.0",
36
+ "@aglyn/shared-ui-json-editor": "1.1.0",
37
+ "@aglyn/shared-ui-jsx": "1.1.0",
38
+ "@aglyn/shared-ui-jsx-forms": "1.1.0",
39
+ "@aglyn/shared-ui-snackstack": "1.1.0",
40
+ "@aglyn/shared-ui-theme": "1.1.0",
41
+ "@aglyn/shared-util-dom": "1.1.0",
42
+ "@aglyn/shared-util-tools": "1.1.0",
43
+ "@aglyn/shared-util-vendor": "1.1.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",
@@ -369,6 +369,13 @@ export declare function browseMediaKind(options: {
369
369
  */
370
370
  attributeKind?: unknown;
371
371
  }): Aglyn.MediaPickerKind | undefined;
372
+ /**
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.
377
+ */
378
+ export declare function offersVisibilityFields(nodeProps: Record<string, unknown> | null | undefined, inComponentEditor: boolean): boolean;
372
379
  /**
373
380
  * The two visibility fields every node inside a component definition gets
374
381
  * (AGL-1314), so "this part is optional" is something an author declares by
@@ -379,11 +386,12 @@ export declare function browseMediaKind(options: {
379
386
  * mockup"), `hideUnless` takes the prop that would have supplied the
380
387
  * content ("no link, no button" — AGL-1348).
381
388
  *
382
- * Offered ONLY where `{{prop.*}}` exists — inside a component editor,
383
- * signalled by `BindingPickerContext.componentProps` exactly as the insert
384
- * picker uses it. On an ordinary screen the directive is inert (the graft
385
- * is the only thing that evaluates it), and a field that silently does
386
- * nothing is worse than no field.
389
+ * Offered where `{{prop.*}}` exists — inside a component editor, signalled by
390
+ * `BindingPickerContext.componentProps` exactly as the insert picker uses it —
391
+ * and on an element that already carries one ({@link offersVisibilityFields}).
392
+ * Anywhere else a directive is inert (the graft is the only thing that
393
+ * evaluates a literal one), and a field that silently does nothing is worse
394
+ * than no field.
387
395
  */
388
396
  export declare function buildVisibilityFields(tokenOptions?: unknown, tokenLabelContext?: unknown): Array<Record<string, unknown>>;
389
397
  /**
@@ -967,6 +967,14 @@ export const elementPropsComponentMapper = _extends({}, simpleComponentMapper, {
967
967
  if (propName === 'poster') return 'image';
968
968
  return undefined;
969
969
  }
970
+ /**
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]));
977
+ }
970
978
  /**
971
979
  * The two visibility fields every node inside a component definition gets
972
980
  * (AGL-1314), so "this part is optional" is something an author declares by
@@ -977,11 +985,12 @@ export const elementPropsComponentMapper = _extends({}, simpleComponentMapper, {
977
985
  * mockup"), `hideUnless` takes the prop that would have supplied the
978
986
  * content ("no link, no button" — AGL-1348).
979
987
  *
980
- * Offered ONLY where `{{prop.*}}` exists — inside a component editor,
981
- * signalled by `BindingPickerContext.componentProps` exactly as the insert
982
- * picker uses it. On an ordinary screen the directive is inert (the graft
983
- * is the only thing that evaluates it), and a field that silently does
984
- * nothing is worse than no field.
988
+ * Offered where `{{prop.*}}` exists — inside a component editor, signalled by
989
+ * `BindingPickerContext.componentProps` exactly as the insert picker uses it —
990
+ * and on an element that already carries one ({@link offersVisibilityFields}).
991
+ * Anywhere else a directive is inert (the graft is the only thing that
992
+ * evaluates a literal one), and a field that silently does nothing is worse
993
+ * than no field.
985
994
  */ export function buildVisibilityFields(tokenOptions, tokenLabelContext) {
986
995
  const field = (name, label, description)=>({
987
996
  name,
@@ -1913,11 +1922,11 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
1913
1922
  resolveContext,
1914
1923
  themeScales
1915
1924
  ]);
1916
- // Visibility directives (AGL-1314), inside a component editor only —
1917
- // `componentProps` is the same "am I editing a definition" signal the
1918
- // insert picker keys `{{prop.*}}` off.
1919
- const visibilityFields = useMemo(()=>editedComponentProps ? buildVisibilityFields(insertOptions, tokenLabelContext) : [], [
1920
- editedComponentProps,
1925
+ // Visibility directives (AGL-1314). `componentProps` is the same "am I
1926
+ // editing a definition" signal the insert picker keys `{{prop.*}}` off.
1927
+ const offersVisibility = offersVisibilityFields(nodeProps, Boolean(editedComponentProps));
1928
+ const visibilityFields = useMemo(()=>offersVisibility ? buildVisibilityFields(insertOptions, tokenLabelContext) : [], [
1929
+ offersVisibility,
1921
1930
  insertOptions,
1922
1931
  tokenLabelContext
1923
1932
  ]);