@phis/ui 0.5.4 → 0.5.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.
Files changed (94) hide show
  1. package/components/cms/phi-cms-layout-renderer.js +17 -7
  2. package/components/layouts/clients/phi-flex-layout-client.js +17 -2
  3. package/components/layouts/clients/phi-layout-anchored-overlay.d.ts +2 -0
  4. package/components/layouts/clients/phi-layout-anchored-overlay.js +2 -0
  5. package/components/regions/presets/content-entry-editor-page-tree.js +2 -0
  6. package/components/regions/presets/content-entry-public-page-trees.js +2 -0
  7. package/components/widgets/builder/stack-tabs.d.ts +2 -1
  8. package/components/widgets/builder/stack-tabs.js +18 -2
  9. package/components/widgets/config/choice-shared.d.ts +0 -48
  10. package/components/widgets/config/choice-shared.js +0 -1
  11. package/components/widgets/config/stack-tabs.js +4 -3
  12. package/helpers/config-text-fields.d.ts +49 -0
  13. package/helpers/config-text-fields.js +122 -0
  14. package/helpers/preset-text-source-check.d.ts +22 -0
  15. package/helpers/preset-text-source-check.js +45 -0
  16. package/helpers/text-source.d.ts +14 -5
  17. package/helpers/text-source.js +16 -3
  18. package/module-page-check.d.ts +1 -0
  19. package/module-page-check.js +1 -0
  20. package/package.json +1 -1
  21. package/plugins/runtime/phi-slot-child-frame-view.js +1 -1
  22. package/plugins/runtime/slot-size-policy.d.ts +8 -2
  23. package/plugins/runtime/slot-size-policy.js +51 -16
  24. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-page-tree.js +2 -0
  25. package/plugins/runtime-modules/builder/clients/widget-inspector.js +2 -2
  26. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -0
  27. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +11 -0
  28. package/plugins/runtime-modules/core/widgets/button/config.d.ts +0 -1
  29. package/plugins/runtime-modules/core/widgets/button/config.js +0 -1
  30. package/plugins/runtime-modules/core/widgets/button/plugin.js +6 -25
  31. package/plugins/runtime-modules/core/widgets/card/config.d.ts +17 -1
  32. package/plugins/runtime-modules/core/widgets/card/config.js +16 -1
  33. package/plugins/runtime-modules/core/widgets/card/plugin.js +8 -10
  34. package/plugins/runtime-modules/core/widgets/card/server.d.ts +1 -2
  35. package/plugins/runtime-modules/core/widgets/card/server.js +16 -28
  36. package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +1 -0
  37. package/plugins/runtime-modules/core/widgets/checkbox-group/config.d.ts +7 -1
  38. package/plugins/runtime-modules/core/widgets/checkbox-group/config.js +1 -1
  39. package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -0
  40. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
  41. package/plugins/runtime-modules/core/widgets/entry-list/config.js +0 -1
  42. package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -3
  43. package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +1 -3
  44. package/plugins/runtime-modules/core/widgets/entry-list/server.js +3 -3
  45. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -0
  46. package/plugins/runtime-modules/core/widgets/image/server.js +5 -9
  47. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -0
  48. package/plugins/runtime-modules/core/widgets/markdown-toc/server.js +3 -5
  49. package/plugins/runtime-modules/core/widgets/quick-links/plugin.js +2 -4
  50. package/plugins/runtime-modules/core/widgets/quick-links/server.d.ts +2 -5
  51. package/plugins/runtime-modules/core/widgets/quick-links/server.js +2 -6
  52. package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
  53. package/plugins/runtime-modules/core/widgets/result/config.js +0 -1
  54. package/plugins/runtime-modules/core/widgets/result/plugin.js +2 -4
  55. package/plugins/runtime-modules/core/widgets/result/server.d.ts +2 -3
  56. package/plugins/runtime-modules/core/widgets/result/server.js +11 -33
  57. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -0
  58. package/plugins/runtime-modules/core/widgets/slider/config.d.ts +11 -0
  59. package/plugins/runtime-modules/core/widgets/slider/config.js +1 -1
  60. package/plugins/runtime-modules/core/widgets/slot-upload/config.d.ts +0 -1
  61. package/plugins/runtime-modules/core/widgets/slot-upload/config.js +0 -2
  62. package/plugins/runtime-modules/core/widgets/slot-upload/plugin.js +2 -4
  63. package/plugins/runtime-modules/core/widgets/slot-upload/server.d.ts +3 -4
  64. package/plugins/runtime-modules/core/widgets/slot-upload/server.js +5 -13
  65. package/plugins/runtime-modules/core/widgets/spacer/config.d.ts +1 -1
  66. package/plugins/runtime-modules/core/widgets/spacer/config.js +1 -1
  67. package/plugins/runtime-modules/core/widgets/steps/config.d.ts +7 -2
  68. package/plugins/runtime-modules/core/widgets/steps/config.js +1 -2
  69. package/plugins/runtime-modules/core/widgets/steps/plugin.js +6 -30
  70. package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -0
  71. package/plugins/runtime-modules/core/widgets/table/config.js +1 -1
  72. package/plugins/runtime-modules/core/widgets/timeline/config.d.ts +8 -1
  73. package/plugins/runtime-modules/core/widgets/timeline/config.js +1 -2
  74. package/plugins/runtime-modules/core/widgets/timeline/plugin.js +6 -37
  75. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +2 -0
  76. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -0
  77. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -0
  78. package/plugins/runtime-modules/page-preset-overlays.d.ts +18 -0
  79. package/plugins/runtime-modules/page-preset-overlays.js +70 -0
  80. package/plugins/runtime-modules/public/trees/phi-default-pub-welcome-page-tree.js +1 -0
  81. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +3 -0
  82. package/plugins/runtime-modules/search/widgets/search-box/server.js +3 -5
  83. package/plugins/runtime-modules/search/widgets/search-results/server.js +3 -5
  84. package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +4 -0
  85. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +2 -0
  86. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +2 -0
  87. package/server-helpers/cms-request.js +34 -12
  88. package/server-helpers/cms-widget-texts.d.ts +14 -0
  89. package/server-helpers/cms-widget-texts.js +117 -0
  90. package/server-helpers/search-index.js +12 -3
  91. package/styles/root.css +6 -2
  92. package/types/cms-plugins.d.ts +30 -5
  93. package/types/core-widget-placements.d.ts +5 -0
  94. package/types/slot-size-policy.d.ts +19 -2
@@ -116,6 +116,12 @@ export type PhiCmsConfigField = (PhiCmsConfigFieldBase & {
116
116
  emptyValue?: "";
117
117
  /** What an empty box shows: what an unset value means, such as `Auto`. Not stored. */
118
118
  placeholder?: string;
119
+ /**
120
+ * Whether the field holds words a reader reads, where its name answers wrongly: the name decides
121
+ * otherwise (`helpers/config-text-fields.ts`). `false` keeps a field called like a text from being
122
+ * translated; a register makes a field translated that is not called like one.
123
+ */
124
+ text?: false | "label" | "message";
119
125
  }) | (PhiCmsConfigFieldBase & {
120
126
  /**
121
127
  * One link, chosen rather than typed.
@@ -333,6 +339,17 @@ export type PhiCmsPluginLicenseState = {
333
339
  features?: string[];
334
340
  expiresAt?: string | null;
335
341
  };
342
+ /**
343
+ * One text a Widget declares in its config beyond its fields: `config[key]`, or with `item` each entry's
344
+ * `config[key][].item`, whose `values` (`config[key][].<values>`) stand in its sentence as `%1` onwards
345
+ * and are filled after the translation, never sent with it.
346
+ */
347
+ export type PhiCmsWidgetConfigText = {
348
+ key: string;
349
+ register: "label" | "message";
350
+ item?: string;
351
+ values?: string;
352
+ };
336
353
  export type PhiCmsWidgetContentBinding = {
337
354
  storage: "text" | "html" | "markdown" | "asset";
338
355
  sourceField: string;
@@ -465,13 +482,21 @@ export type PhiCmsWidgetPlugin<TConfig> = {
465
482
  requiredDataProviders?: readonly PhiRuntimeDataProviderKey[];
466
483
  contentBinding?: PhiCmsWidgetContentBinding | null;
467
484
  /**
468
- * The Widget translates the text written into its own config.
485
+ * The Widget translates the text written into its own config, and the renderer's pass
486
+ * (`server-helpers/cms-widget-texts.ts`) leaves it out: a content Widget, whose text is parsed before it
487
+ * is translated and which an author may want left as written.
469
488
  *
470
- * Turning that off is the node's `NoTranslate` flag, not a config field: the answer is the same for
471
- * every Widget that writes text, so it lives where every node keeps its yes-or-no answers. A Widget
472
- * that says so here gets the Inspector's switch for it.
489
+ * Turning that off is the node's `NoTranslate` flag, not a config field. A Widget that says so here
490
+ * gets the Inspector's switch for it; no other Widget does, for a Control's words are always
491
+ * translated.
473
492
  */
474
493
  translatesOwnText?: true;
494
+ /**
495
+ * Texts in the config that no Inspector field edits -- a Card's title and its plan's lines are written
496
+ * on the canvas -- which the renderer translates beside the fields' (`server-helpers/cms-widget-texts.ts`).
497
+ * Fields need no entry here: their names answer it (`helpers/config-text-fields.ts`).
498
+ */
499
+ configTexts?: readonly PhiCmsWidgetConfigText[];
475
500
  slotSizePolicy: PhiSlotSizePolicy;
476
501
  /**
477
502
  * Who draws the node's Surface (`config.surface`).
@@ -538,7 +563,7 @@ export type PhiCmsWidgetSearchTextArgs<TConfig> = {
538
563
  * `contentBinding` through an `"x" in plugin` branch, and a Module's `translatesOwnText` travelled on a
539
564
  * plugin whose type did not know it.
540
565
  */
541
- export type PhiCmsWidgetPluginDefinition<TConfig> = Pick<PhiCmsWidgetPlugin<TConfig>, "kind" | "pluginKey" | "typeKey" | "title" | "description" | "category" | "tags" | "icon" | "iconName" | "iconFamily" | "commercial" | "runtimeSignals" | "signalSubcontrols" | "requiredRuntimeControllers" | "requiredDataProviders" | "contentBinding" | "translatesOwnText" | "slotSizePolicy" | "surface" | "requiredRegionOwnership" | "defaultConfig" | "creationConfig" | "fields" | "parseConfig">;
566
+ export type PhiCmsWidgetPluginDefinition<TConfig> = Pick<PhiCmsWidgetPlugin<TConfig>, "kind" | "pluginKey" | "typeKey" | "title" | "description" | "category" | "tags" | "icon" | "iconName" | "iconFamily" | "commercial" | "runtimeSignals" | "signalSubcontrols" | "requiredRuntimeControllers" | "requiredDataProviders" | "contentBinding" | "translatesOwnText" | "configTexts" | "slotSizePolicy" | "surface" | "requiredRegionOwnership" | "defaultConfig" | "creationConfig" | "fields" | "parseConfig">;
542
567
  export type PhiCmsBuilderWidgetEditorInteraction = "inert" | "authoring";
543
568
  export type PhiCmsBuilderWidgetPlugin<TConfig> = PhiCmsWidgetPluginDefinition<TConfig> & {
544
569
  editorInteraction?: PhiCmsBuilderWidgetEditorInteraction;
@@ -39,6 +39,11 @@ export type PhiWidgetPlacementBase = Omit<PhiRenderableBlockBase, "renderMode" |
39
39
  /** Shows the Widget only while the condition holds; the renderer evaluates it for every Widget. */
40
40
  visibleWhen?: PhiRuntimeConditionExpression;
41
41
  signalRoutes?: PhiWidgetPlacementSignalRoutes | null;
42
+ /**
43
+ * Whose words the Widget's text is, which decides the store that translates it (`helpers/text-source.ts`):
44
+ * a Module's Preset states it on every Widget with text (TRANSLATIONS.md, "Widget config text").
45
+ */
46
+ textSource?: PhiTextSource;
42
47
  };
43
48
  /** The routes a placement wires. Read-only lists, so a Preset can build them from shared constants. */
44
49
  export type PhiWidgetPlacementSignalRoutes = {
@@ -1,10 +1,27 @@
1
1
  export type PhiSlotAxisSizePolicy = "intrinsic" | "fill" | "fixed";
2
- export type PhiSlotSizePolicyPreset = "intrinsic" | "fill-inline" | "fill-block" | "fill" | "fixed";
3
- export type PhiSlotSizePolicy = PhiSlotSizePolicyPreset | {
2
+ export type PhiSlotSizePolicyPreset = "intrinsic" | "fill-inline" | "fill-block" | "fill" | "rest" | "fixed";
3
+ /** A policy that holds whatever the config says. */
4
+ export type PhiSlotSizePolicyValue = PhiSlotSizePolicyPreset | {
4
5
  inline?: PhiSlotAxisSizePolicy | null;
5
6
  block?: PhiSlotAxisSizePolicy | null;
6
7
  };
8
+ /**
9
+ * A policy one field of the block's own config decides: `byValue[config[configField]]`, else `otherwise`.
10
+ * A string field is read as it is, a boolean field as the key `"true"` or `"false"`; anything else is `otherwise`.
11
+ * Declarative on purpose: the policy travels to the Builder as data.
12
+ */
13
+ export type PhiSlotSizePolicyByConfig = {
14
+ configField: string;
15
+ byValue: Readonly<Record<string, PhiSlotSizePolicyValue>>;
16
+ otherwise: PhiSlotSizePolicyValue;
17
+ };
18
+ export type PhiSlotSizePolicy = PhiSlotSizePolicyValue | PhiSlotSizePolicyByConfig;
7
19
  export type PhiNormalizedSlotSizePolicy = {
8
20
  inline: PhiSlotAxisSizePolicy;
9
21
  block: PhiSlotAxisSizePolicy;
22
+ /**
23
+ * Set by `"rest"` alone, which is `fill` on both axes and this. Only a Flex Layout reads it: where a
24
+ * child that fills the Layout's main axis also states it, that child alone grows into the room left over.
25
+ */
26
+ takesRest?: true;
10
27
  };