@player-tools/fluent 0.12.1--canary.241.6077

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 (134) hide show
  1. package/dist/cjs/index.cjs +2396 -0
  2. package/dist/cjs/index.cjs.map +1 -0
  3. package/dist/index.legacy-esm.js +2276 -0
  4. package/dist/index.mjs +2276 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/package.json +38 -0
  7. package/src/core/base-builder/__tests__/fluent-builder-base.test.ts +2423 -0
  8. package/src/core/base-builder/__tests__/fluent-partial.test.ts +179 -0
  9. package/src/core/base-builder/__tests__/id-generator.test.ts +658 -0
  10. package/src/core/base-builder/__tests__/registry.test.ts +534 -0
  11. package/src/core/base-builder/__tests__/resolution-mixed-arrays.test.ts +319 -0
  12. package/src/core/base-builder/__tests__/resolution-pipeline.test.ts +416 -0
  13. package/src/core/base-builder/__tests__/resolution-switches.test.ts +468 -0
  14. package/src/core/base-builder/__tests__/resolution-templates.test.ts +255 -0
  15. package/src/core/base-builder/__tests__/switch.test.ts +815 -0
  16. package/src/core/base-builder/__tests__/template.test.ts +596 -0
  17. package/src/core/base-builder/__tests__/value-extraction.test.ts +200 -0
  18. package/src/core/base-builder/__tests__/value-storage.test.ts +459 -0
  19. package/src/core/base-builder/conditional/index.ts +64 -0
  20. package/src/core/base-builder/context.ts +152 -0
  21. package/src/core/base-builder/errors.ts +69 -0
  22. package/src/core/base-builder/fluent-builder-base.ts +308 -0
  23. package/src/core/base-builder/guards.ts +137 -0
  24. package/src/core/base-builder/id/generator.ts +290 -0
  25. package/src/core/base-builder/id/registry.ts +152 -0
  26. package/src/core/base-builder/index.ts +72 -0
  27. package/src/core/base-builder/resolution/path-resolver.ts +116 -0
  28. package/src/core/base-builder/resolution/pipeline.ts +103 -0
  29. package/src/core/base-builder/resolution/steps/__tests__/nested-asset-wrappers.test.ts +206 -0
  30. package/src/core/base-builder/resolution/steps/asset-id.ts +77 -0
  31. package/src/core/base-builder/resolution/steps/asset-wrappers.ts +64 -0
  32. package/src/core/base-builder/resolution/steps/builders.ts +84 -0
  33. package/src/core/base-builder/resolution/steps/mixed-arrays.ts +95 -0
  34. package/src/core/base-builder/resolution/steps/nested-asset-wrappers.ts +124 -0
  35. package/src/core/base-builder/resolution/steps/static-values.ts +35 -0
  36. package/src/core/base-builder/resolution/steps/switches.ts +71 -0
  37. package/src/core/base-builder/resolution/steps/templates.ts +40 -0
  38. package/src/core/base-builder/resolution/value-resolver.ts +333 -0
  39. package/src/core/base-builder/storage/auxiliary-storage.ts +82 -0
  40. package/src/core/base-builder/storage/value-storage.ts +282 -0
  41. package/src/core/base-builder/types.ts +266 -0
  42. package/src/core/base-builder/utils.ts +10 -0
  43. package/src/core/flow/__tests__/index.test.ts +292 -0
  44. package/src/core/flow/index.ts +118 -0
  45. package/src/core/index.ts +8 -0
  46. package/src/core/mocks/generated/action.builder.ts +92 -0
  47. package/src/core/mocks/generated/choice-item.builder.ts +120 -0
  48. package/src/core/mocks/generated/choice.builder.ts +134 -0
  49. package/src/core/mocks/generated/collection.builder.ts +93 -0
  50. package/src/core/mocks/generated/field-collection.builder.ts +86 -0
  51. package/src/core/mocks/generated/index.ts +10 -0
  52. package/src/core/mocks/generated/info.builder.ts +64 -0
  53. package/src/core/mocks/generated/input.builder.ts +63 -0
  54. package/src/core/mocks/generated/overview-collection.builder.ts +65 -0
  55. package/src/core/mocks/generated/splash-collection.builder.ts +93 -0
  56. package/src/core/mocks/generated/text.builder.ts +47 -0
  57. package/src/core/mocks/index.ts +1 -0
  58. package/src/core/mocks/types/action.ts +92 -0
  59. package/src/core/mocks/types/choice.ts +129 -0
  60. package/src/core/mocks/types/collection.ts +140 -0
  61. package/src/core/mocks/types/info.ts +7 -0
  62. package/src/core/mocks/types/input.ts +7 -0
  63. package/src/core/mocks/types/text.ts +5 -0
  64. package/src/core/schema/__tests__/index.test.ts +127 -0
  65. package/src/core/schema/index.ts +195 -0
  66. package/src/core/schema/types.ts +7 -0
  67. package/src/core/switch/__tests__/index.test.ts +156 -0
  68. package/src/core/switch/index.ts +81 -0
  69. package/src/core/tagged-template/README.md +448 -0
  70. package/src/core/tagged-template/__tests__/extract-bindings-from-schema.test.ts +207 -0
  71. package/src/core/tagged-template/__tests__/index.test.ts +190 -0
  72. package/src/core/tagged-template/__tests__/schema-std-integration.test.ts +580 -0
  73. package/src/core/tagged-template/binding.ts +95 -0
  74. package/src/core/tagged-template/expression.ts +92 -0
  75. package/src/core/tagged-template/extract-bindings-from-schema.ts +120 -0
  76. package/src/core/tagged-template/index.ts +5 -0
  77. package/src/core/tagged-template/std.ts +472 -0
  78. package/src/core/tagged-template/types.ts +123 -0
  79. package/src/core/template/__tests__/index.test.ts +380 -0
  80. package/src/core/template/index.ts +196 -0
  81. package/src/core/utils/index.ts +160 -0
  82. package/src/fp/README.md +411 -0
  83. package/src/fp/__tests__/index.test.ts +1178 -0
  84. package/src/fp/index.ts +386 -0
  85. package/src/gen/common.ts +15 -0
  86. package/src/index.ts +5 -0
  87. package/src/types.ts +203 -0
  88. package/types/core/base-builder/conditional/index.d.ts +21 -0
  89. package/types/core/base-builder/context.d.ts +39 -0
  90. package/types/core/base-builder/errors.d.ts +45 -0
  91. package/types/core/base-builder/fluent-builder-base.d.ts +147 -0
  92. package/types/core/base-builder/guards.d.ts +58 -0
  93. package/types/core/base-builder/id/generator.d.ts +69 -0
  94. package/types/core/base-builder/id/registry.d.ts +93 -0
  95. package/types/core/base-builder/index.d.ts +9 -0
  96. package/types/core/base-builder/resolution/path-resolver.d.ts +15 -0
  97. package/types/core/base-builder/resolution/pipeline.d.ts +27 -0
  98. package/types/core/base-builder/resolution/steps/asset-id.d.ts +14 -0
  99. package/types/core/base-builder/resolution/steps/asset-wrappers.d.ts +14 -0
  100. package/types/core/base-builder/resolution/steps/builders.d.ts +14 -0
  101. package/types/core/base-builder/resolution/steps/mixed-arrays.d.ts +14 -0
  102. package/types/core/base-builder/resolution/steps/nested-asset-wrappers.d.ts +14 -0
  103. package/types/core/base-builder/resolution/steps/static-values.d.ts +14 -0
  104. package/types/core/base-builder/resolution/steps/switches.d.ts +15 -0
  105. package/types/core/base-builder/resolution/steps/templates.d.ts +14 -0
  106. package/types/core/base-builder/resolution/value-resolver.d.ts +62 -0
  107. package/types/core/base-builder/storage/auxiliary-storage.d.ts +50 -0
  108. package/types/core/base-builder/storage/value-storage.d.ts +82 -0
  109. package/types/core/base-builder/types.d.ts +183 -0
  110. package/types/core/base-builder/utils.d.ts +2 -0
  111. package/types/core/flow/index.d.ts +23 -0
  112. package/types/core/index.d.ts +8 -0
  113. package/types/core/mocks/index.d.ts +2 -0
  114. package/types/core/mocks/types/action.d.ts +58 -0
  115. package/types/core/mocks/types/choice.d.ts +95 -0
  116. package/types/core/mocks/types/collection.d.ts +102 -0
  117. package/types/core/mocks/types/info.d.ts +7 -0
  118. package/types/core/mocks/types/input.d.ts +7 -0
  119. package/types/core/mocks/types/text.d.ts +5 -0
  120. package/types/core/schema/index.d.ts +34 -0
  121. package/types/core/schema/types.d.ts +5 -0
  122. package/types/core/switch/index.d.ts +21 -0
  123. package/types/core/tagged-template/binding.d.ts +19 -0
  124. package/types/core/tagged-template/expression.d.ts +11 -0
  125. package/types/core/tagged-template/extract-bindings-from-schema.d.ts +7 -0
  126. package/types/core/tagged-template/index.d.ts +6 -0
  127. package/types/core/tagged-template/std.d.ts +174 -0
  128. package/types/core/tagged-template/types.d.ts +69 -0
  129. package/types/core/template/index.d.ts +97 -0
  130. package/types/core/utils/index.d.ts +47 -0
  131. package/types/fp/index.d.ts +149 -0
  132. package/types/gen/common.d.ts +6 -0
  133. package/types/index.d.ts +3 -0
  134. package/types/types.d.ts +163 -0
@@ -0,0 +1,134 @@
1
+ import type { ChoiceAsset, ChoiceItem, ChoiceModifier, ChoiceInputModifier, ChoiceMetaData } from "../types/choice.js";
2
+ import type { Asset } from "@player-ui/types";
3
+ import { type FluentBuilder, type BaseBuildContext, type FluentPartial, FluentBuilderBase, createInspectMethod, type TaggedTemplateValue } from "../../../gen/common.js";
4
+
5
+ export interface ChoiceAssetBuilderMethods<AnyAsset extends Asset = Asset> {
6
+ /** A unique identifier for this asset */
7
+ withId(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder<AnyAsset>;
8
+ /** The binding used to keep track of the selected Choice */
9
+ withBinding(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder<AnyAsset>;
10
+ /** The choiceItems used as options */
11
+ withChoices(value: Array<ChoiceItem<AnyAsset> | FluentBuilder<ChoiceItem<AnyAsset>, BaseBuildContext> | FluentPartial<ChoiceItem<AnyAsset>, BaseBuildContext>>): ChoiceAssetBuilder<AnyAsset>;
12
+ /** The label describing the choice field. */
13
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset>;
14
+ /** choice help providing additional info that could be helpful */
15
+ withHelp(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset>;
16
+ /** choice note */
17
+ withNote(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset>;
18
+ /** placeholder string to show by default for the choice */
19
+ withPlaceholder(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder<AnyAsset>;
20
+ /** any accessibility text to be added as an aria label. */
21
+ withAccessibility(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder<AnyAsset>;
22
+ /** The info that appears underneath the choice */
23
+ withAdditionalInfo(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset>;
24
+ /** The resulting Text that appears underneath the choice */
25
+ withResultText(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset>;
26
+ /** Sets the modifiers property */
27
+ withModifiers(value: Array<ChoiceModifier | FluentBuilder<ChoiceModifier, BaseBuildContext> | FluentPartial<ChoiceModifier, BaseBuildContext> | ChoiceInputModifier | FluentBuilder<ChoiceInputModifier, BaseBuildContext> | FluentPartial<ChoiceInputModifier, BaseBuildContext>>): ChoiceAssetBuilder<AnyAsset>;
28
+ /** Additional metaData for the Choice */
29
+ withMetaData(value: ChoiceMetaData | FluentBuilder<ChoiceMetaData, BaseBuildContext> | FluentPartial<ChoiceMetaData, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset>;
30
+ /** The main action associated with choices */
31
+ withAction(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset>;
32
+ /** The main image associated with choices */
33
+ withImage(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset>;
34
+ }
35
+
36
+ /**
37
+ * A builder for ChoiceAsset
38
+ */
39
+ export class ChoiceAssetBuilder<AnyAsset extends Asset = Asset> extends FluentBuilderBase<ChoiceAsset<AnyAsset>> implements ChoiceAssetBuilderMethods<AnyAsset>, FluentBuilder<ChoiceAsset<AnyAsset>, BaseBuildContext> {
40
+ private static readonly defaults: Record<string, unknown> = {"type":"choice","id":"","binding":""};
41
+ private static readonly __arrayProperties__: ReadonlySet<string> = new Set(["choices", "modifiers"]);
42
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["choices","label"],["choices","icon"],["choices","help"],["choices","choiceHelp"],["choices","description"],["choices","footer"],["choices","choiceDetail"],["label"],["help"],["note"],["additionalInfo"],["resultText"],["action"],["image"]];
43
+
44
+ /** A unique identifier for this asset */
45
+ withId(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder<AnyAsset> {
46
+ return this.set("id", value);
47
+ }
48
+
49
+ /** The binding used to keep track of the selected Choice */
50
+ withBinding(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder<AnyAsset> {
51
+ return this.set("binding", value);
52
+ }
53
+
54
+ /** The choiceItems used as options */
55
+ withChoices(value: Array<ChoiceItem<AnyAsset> | FluentBuilder<ChoiceItem<AnyAsset>, BaseBuildContext> | FluentPartial<ChoiceItem<AnyAsset>, BaseBuildContext>>): ChoiceAssetBuilder<AnyAsset> {
56
+ return this.set("choices", value);
57
+ }
58
+
59
+ /** The label describing the choice field. */
60
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset> {
61
+ return this.set("label", value);
62
+ }
63
+
64
+ /** choice help providing additional info that could be helpful */
65
+ withHelp(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset> {
66
+ return this.set("help", value);
67
+ }
68
+
69
+ /** choice note */
70
+ withNote(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset> {
71
+ return this.set("note", value);
72
+ }
73
+
74
+ /** placeholder string to show by default for the choice */
75
+ withPlaceholder(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder<AnyAsset> {
76
+ return this.set("placeholder", value);
77
+ }
78
+
79
+ /** any accessibility text to be added as an aria label. */
80
+ withAccessibility(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder<AnyAsset> {
81
+ return this.set("accessibility", value);
82
+ }
83
+
84
+ /** The info that appears underneath the choice */
85
+ withAdditionalInfo(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset> {
86
+ return this.set("additionalInfo", value);
87
+ }
88
+
89
+ /** The resulting Text that appears underneath the choice */
90
+ withResultText(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset> {
91
+ return this.set("resultText", value);
92
+ }
93
+
94
+ /** Sets the modifiers property */
95
+ withModifiers(value: Array<ChoiceModifier | FluentBuilder<ChoiceModifier, BaseBuildContext> | FluentPartial<ChoiceModifier, BaseBuildContext> | ChoiceInputModifier | FluentBuilder<ChoiceInputModifier, BaseBuildContext> | FluentPartial<ChoiceInputModifier, BaseBuildContext>>): ChoiceAssetBuilder<AnyAsset> {
96
+ return this.set("modifiers", value);
97
+ }
98
+
99
+ /** Additional metaData for the Choice */
100
+ withMetaData(value: ChoiceMetaData | FluentBuilder<ChoiceMetaData, BaseBuildContext> | FluentPartial<ChoiceMetaData, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset> {
101
+ return this.set("metaData", value);
102
+ }
103
+
104
+ /** The main action associated with choices */
105
+ withAction(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset> {
106
+ return this.set("action", value);
107
+ }
108
+
109
+ /** The main image associated with choices */
110
+ withImage(value: Asset | FluentBuilder<Asset, BaseBuildContext>): ChoiceAssetBuilder<AnyAsset> {
111
+ return this.set("image", value);
112
+ }
113
+
114
+ /**
115
+ * Builds the final ChoiceAsset object
116
+ * @param context - Optional build context for nested builders
117
+ */
118
+ build(context?: BaseBuildContext): ChoiceAsset<AnyAsset> {
119
+ return this.buildWithDefaults(ChoiceAssetBuilder.defaults, context);
120
+ }
121
+
122
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
123
+ return createInspectMethod("ChoiceAssetBuilder", this.values);
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Creates a new ChoiceAsset builder
129
+ * @param initial Optional initial values
130
+ * @returns A fluent builder for ChoiceAsset
131
+ */
132
+ export function choice<AnyAsset extends Asset = Asset>(initial?: FluentPartial<ChoiceAsset<AnyAsset>>): ChoiceAssetBuilder<AnyAsset> {
133
+ return new ChoiceAssetBuilder<AnyAsset>(initial);
134
+ }
@@ -0,0 +1,93 @@
1
+ import type { Collection, CollectionMetaData, CalloutModifier, TagModifier } from "../types/collection.js";
2
+ import type { ActionAsset } from "../types/action.js";
3
+ import type { Asset } from "@player-ui/types";
4
+ import { type FluentBuilder, type BaseBuildContext, type FluentPartial, FluentBuilderBase, createInspectMethod, type TaggedTemplateValue } from "../../../gen/common.js";
5
+
6
+ export interface CollectionBuilderMethods<AnyAsset extends Asset = Asset> {
7
+ /** A unique identifier for this asset */
8
+ withId(value: string | TaggedTemplateValue<string>): CollectionBuilder<AnyAsset>;
9
+ /** The collection items to show */
10
+ withValues(value: Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): CollectionBuilder<AnyAsset>;
11
+ /** The additional information to show */
12
+ withAdditionalInfo(value: Asset | FluentBuilder<Asset, BaseBuildContext>): CollectionBuilder<AnyAsset>;
13
+ /** The result text to show */
14
+ withResultText(value: Asset | FluentBuilder<Asset, BaseBuildContext> | Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): CollectionBuilder<AnyAsset>;
15
+ /** The label defining the collection */
16
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): CollectionBuilder<AnyAsset>;
17
+ /** Actions attached to the collection */
18
+ withActions(value: Array<ActionAsset | FluentBuilder<ActionAsset, BaseBuildContext>>): CollectionBuilder<AnyAsset>;
19
+ /** Extra data associated with the collection */
20
+ withMetaData(value: CollectionMetaData | FluentBuilder<CollectionMetaData, BaseBuildContext> | FluentPartial<CollectionMetaData, BaseBuildContext>): CollectionBuilder<AnyAsset>;
21
+ /** Ways to modify how the component looks */
22
+ withModifiers(value: Array<CalloutModifier | FluentBuilder<CalloutModifier, BaseBuildContext> | FluentPartial<CalloutModifier, BaseBuildContext> | TagModifier | FluentBuilder<TagModifier, BaseBuildContext> | FluentPartial<TagModifier, BaseBuildContext>>): CollectionBuilder<AnyAsset>;
23
+ }
24
+
25
+ /**
26
+ * A builder for Collection
27
+ */
28
+ export class CollectionBuilder<AnyAsset extends Asset = Asset> extends FluentBuilderBase<Collection<AnyAsset>> implements CollectionBuilderMethods<AnyAsset>, FluentBuilder<Collection<AnyAsset>, BaseBuildContext> {
29
+ private static readonly defaults: Record<string, unknown> = {"type":"collection","id":""};
30
+ private static readonly __arrayProperties__: ReadonlySet<string> = new Set(["values", "resultText", "actions", "modifiers"]);
31
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["values"],["additionalInfo"],["resultText"],["label"],["actions"]];
32
+
33
+ /** A unique identifier for this asset */
34
+ withId(value: string | TaggedTemplateValue<string>): CollectionBuilder<AnyAsset> {
35
+ return this.set("id", value);
36
+ }
37
+
38
+ /** The collection items to show */
39
+ withValues(value: Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): CollectionBuilder<AnyAsset> {
40
+ return this.set("values", value);
41
+ }
42
+
43
+ /** The additional information to show */
44
+ withAdditionalInfo(value: Asset | FluentBuilder<Asset, BaseBuildContext>): CollectionBuilder<AnyAsset> {
45
+ return this.set("additionalInfo", value);
46
+ }
47
+
48
+ /** The result text to show */
49
+ withResultText(value: Asset | FluentBuilder<Asset, BaseBuildContext> | Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): CollectionBuilder<AnyAsset> {
50
+ return this.set("resultText", value);
51
+ }
52
+
53
+ /** The label defining the collection */
54
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): CollectionBuilder<AnyAsset> {
55
+ return this.set("label", value);
56
+ }
57
+
58
+ /** Actions attached to the collection */
59
+ withActions(value: Array<ActionAsset | FluentBuilder<ActionAsset, BaseBuildContext>>): CollectionBuilder<AnyAsset> {
60
+ return this.set("actions", value);
61
+ }
62
+
63
+ /** Extra data associated with the collection */
64
+ withMetaData(value: CollectionMetaData | FluentBuilder<CollectionMetaData, BaseBuildContext> | FluentPartial<CollectionMetaData, BaseBuildContext>): CollectionBuilder<AnyAsset> {
65
+ return this.set("metaData", value);
66
+ }
67
+
68
+ /** Ways to modify how the component looks */
69
+ withModifiers(value: Array<CalloutModifier | FluentBuilder<CalloutModifier, BaseBuildContext> | FluentPartial<CalloutModifier, BaseBuildContext> | TagModifier | FluentBuilder<TagModifier, BaseBuildContext> | FluentPartial<TagModifier, BaseBuildContext>>): CollectionBuilder<AnyAsset> {
70
+ return this.set("modifiers", value);
71
+ }
72
+
73
+ /**
74
+ * Builds the final Collection object
75
+ * @param context - Optional build context for nested builders
76
+ */
77
+ build(context?: BaseBuildContext): Collection<AnyAsset> {
78
+ return this.buildWithDefaults(CollectionBuilder.defaults, context);
79
+ }
80
+
81
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
82
+ return createInspectMethod("CollectionBuilder", this.values);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Creates a new Collection builder
88
+ * @param initial Optional initial values
89
+ * @returns A fluent builder for Collection
90
+ */
91
+ export function collection<AnyAsset extends Asset = Asset>(initial?: FluentPartial<Collection<AnyAsset>>): CollectionBuilder<AnyAsset> {
92
+ return new CollectionBuilder<AnyAsset>(initial);
93
+ }
@@ -0,0 +1,86 @@
1
+ import type { FieldCollection, FieldCollectionMetaData } from "../types/collection.js";
2
+ import type { ActionAsset } from "../types/action.js";
3
+ import type { Asset } from "@player-ui/types";
4
+ import { type FluentBuilder, type BaseBuildContext, type FluentPartial, FluentBuilderBase, createInspectMethod, type TaggedTemplateValue } from "../../../gen/common.js";
5
+
6
+ export interface FieldCollectionBuilderMethods<AnyAsset extends Asset = Asset> {
7
+ /** A unique identifier for this asset */
8
+ withId(value: string | TaggedTemplateValue<string>): FieldCollectionBuilder<AnyAsset>;
9
+ /** The collection items to show */
10
+ withValues(value: Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): FieldCollectionBuilder<AnyAsset>;
11
+ /** The additional information to show */
12
+ withAdditionalInfo(value: Asset | FluentBuilder<Asset, BaseBuildContext>): FieldCollectionBuilder<AnyAsset>;
13
+ /** The result text to show */
14
+ withResultText(value: Asset | FluentBuilder<Asset, BaseBuildContext>): FieldCollectionBuilder<AnyAsset>;
15
+ /** The label defining the collection */
16
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): FieldCollectionBuilder<AnyAsset>;
17
+ /** Extra data associated with the collection */
18
+ withMetaData(value: FieldCollectionMetaData | FluentBuilder<FieldCollectionMetaData, BaseBuildContext> | FluentPartial<FieldCollectionMetaData, BaseBuildContext>): FieldCollectionBuilder<AnyAsset>;
19
+ /** Actions attached to the collection */
20
+ withActions(value: Array<ActionAsset | FluentBuilder<ActionAsset, BaseBuildContext>>): FieldCollectionBuilder<AnyAsset>;
21
+ }
22
+
23
+ /**
24
+ * A builder for FieldCollection
25
+ */
26
+ export class FieldCollectionBuilder<AnyAsset extends Asset = Asset> extends FluentBuilderBase<FieldCollection<AnyAsset>> implements FieldCollectionBuilderMethods<AnyAsset>, FluentBuilder<FieldCollection<AnyAsset>, BaseBuildContext> {
27
+ private static readonly defaults: Record<string, unknown> = {"type":"fieldCollection","id":""};
28
+ private static readonly __arrayProperties__: ReadonlySet<string> = new Set(["values", "actions"]);
29
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["values"],["additionalInfo"],["resultText"],["label"],["actions"]];
30
+
31
+ /** A unique identifier for this asset */
32
+ withId(value: string | TaggedTemplateValue<string>): FieldCollectionBuilder<AnyAsset> {
33
+ return this.set("id", value);
34
+ }
35
+
36
+ /** The collection items to show */
37
+ withValues(value: Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): FieldCollectionBuilder<AnyAsset> {
38
+ return this.set("values", value);
39
+ }
40
+
41
+ /** The additional information to show */
42
+ withAdditionalInfo(value: Asset | FluentBuilder<Asset, BaseBuildContext>): FieldCollectionBuilder<AnyAsset> {
43
+ return this.set("additionalInfo", value);
44
+ }
45
+
46
+ /** The result text to show */
47
+ withResultText(value: Asset | FluentBuilder<Asset, BaseBuildContext>): FieldCollectionBuilder<AnyAsset> {
48
+ return this.set("resultText", value);
49
+ }
50
+
51
+ /** The label defining the collection */
52
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): FieldCollectionBuilder<AnyAsset> {
53
+ return this.set("label", value);
54
+ }
55
+
56
+ /** Extra data associated with the collection */
57
+ withMetaData(value: FieldCollectionMetaData | FluentBuilder<FieldCollectionMetaData, BaseBuildContext> | FluentPartial<FieldCollectionMetaData, BaseBuildContext>): FieldCollectionBuilder<AnyAsset> {
58
+ return this.set("metaData", value);
59
+ }
60
+
61
+ /** Actions attached to the collection */
62
+ withActions(value: Array<ActionAsset | FluentBuilder<ActionAsset, BaseBuildContext>>): FieldCollectionBuilder<AnyAsset> {
63
+ return this.set("actions", value);
64
+ }
65
+
66
+ /**
67
+ * Builds the final FieldCollection object
68
+ * @param context - Optional build context for nested builders
69
+ */
70
+ build(context?: BaseBuildContext): FieldCollection<AnyAsset> {
71
+ return this.buildWithDefaults(FieldCollectionBuilder.defaults, context);
72
+ }
73
+
74
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
75
+ return createInspectMethod("FieldCollectionBuilder", this.values);
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Creates a new FieldCollection builder
81
+ * @param initial Optional initial values
82
+ * @returns A fluent builder for FieldCollection
83
+ */
84
+ export function fieldCollection<AnyAsset extends Asset = Asset>(initial?: FluentPartial<FieldCollection<AnyAsset>>): FieldCollectionBuilder<AnyAsset> {
85
+ return new FieldCollectionBuilder<AnyAsset>(initial);
86
+ }
@@ -0,0 +1,10 @@
1
+ export * from "./action.builder.js";
2
+ export * from "./choice-item.builder.js";
3
+ export * from "./choice.builder.js";
4
+ export * from "./collection.builder.js";
5
+ export * from "./field-collection.builder.js";
6
+ export * from "./overview-collection.builder.js";
7
+ export * from "./splash-collection.builder.js";
8
+ export * from "./info.builder.js";
9
+ export * from "./input.builder.js";
10
+ export * from "./text.builder.js";
@@ -0,0 +1,64 @@
1
+ import type { InfoAsset } from "../types/info.js";
2
+ import type { Asset } from "@player-ui/types";
3
+ import { type FluentBuilder, type BaseBuildContext, type FluentPartial, FluentBuilderBase, createInspectMethod, type TaggedTemplateValue } from "../../../gen/common.js";
4
+
5
+ export interface InfoAssetBuilderMethods {
6
+ /** A unique identifier for this asset */
7
+ withId(value: string | TaggedTemplateValue<string>): InfoAssetBuilder;
8
+ /** Sets the primaryInfo property */
9
+ withPrimaryInfo(value: Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): InfoAssetBuilder;
10
+ /** Sets the title property */
11
+ withTitle(value: Asset | FluentBuilder<Asset, BaseBuildContext>): InfoAssetBuilder;
12
+ /** Sets the subtitle property */
13
+ withSubtitle(value: Asset | FluentBuilder<Asset, BaseBuildContext>): InfoAssetBuilder;
14
+ }
15
+
16
+ /**
17
+ * A builder for InfoAsset
18
+ */
19
+ export class InfoAssetBuilder extends FluentBuilderBase<InfoAsset> implements InfoAssetBuilderMethods, FluentBuilder<InfoAsset, BaseBuildContext> {
20
+ private static readonly defaults: Record<string, unknown> = {"type":"info","id":"","primaryInfo":[]};
21
+ private static readonly __arrayProperties__: ReadonlySet<string> = new Set(["primaryInfo"]);
22
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["primaryInfo"],["title"],["subtitle"]];
23
+
24
+ /** A unique identifier for this asset */
25
+ withId(value: string | TaggedTemplateValue<string>): InfoAssetBuilder {
26
+ return this.set("id", value);
27
+ }
28
+
29
+ /** Sets the primaryInfo property */
30
+ withPrimaryInfo(value: Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): InfoAssetBuilder {
31
+ return this.set("primaryInfo", value);
32
+ }
33
+
34
+ /** Sets the title property */
35
+ withTitle(value: Asset | FluentBuilder<Asset, BaseBuildContext>): InfoAssetBuilder {
36
+ return this.set("title", value);
37
+ }
38
+
39
+ /** Sets the subtitle property */
40
+ withSubtitle(value: Asset | FluentBuilder<Asset, BaseBuildContext>): InfoAssetBuilder {
41
+ return this.set("subtitle", value);
42
+ }
43
+
44
+ /**
45
+ * Builds the final InfoAsset object
46
+ * @param context - Optional build context for nested builders
47
+ */
48
+ build(context?: BaseBuildContext): InfoAsset {
49
+ return this.buildWithDefaults(InfoAssetBuilder.defaults, context);
50
+ }
51
+
52
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
53
+ return createInspectMethod("InfoAssetBuilder", this.values);
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Creates a new InfoAsset builder
59
+ * @param initial Optional initial values
60
+ * @returns A fluent builder for InfoAsset
61
+ */
62
+ export function info(initial?: FluentPartial<InfoAsset>): InfoAssetBuilder {
63
+ return new InfoAssetBuilder(initial);
64
+ }
@@ -0,0 +1,63 @@
1
+ import type { InputAsset } from "../types/input.js";
2
+ import type { Asset } from "@player-ui/types";
3
+ import { type FluentBuilder, type BaseBuildContext, type FluentPartial, FluentBuilderBase, createInspectMethod, type TaggedTemplateValue } from "../../../gen/common.js";
4
+
5
+ export interface InputAssetBuilderMethods {
6
+ /** A unique identifier for this asset */
7
+ withId(value: string | TaggedTemplateValue<string>): InputAssetBuilder;
8
+ /** Sets the binding property */
9
+ withBinding(value: string | TaggedTemplateValue<string>): InputAssetBuilder;
10
+ /** Sets the label property */
11
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): InputAssetBuilder;
12
+ /** Sets the placeholder property */
13
+ withPlaceholder(value: string | TaggedTemplateValue<string>): InputAssetBuilder;
14
+ }
15
+
16
+ /**
17
+ * A builder for InputAsset
18
+ */
19
+ export class InputAssetBuilder extends FluentBuilderBase<InputAsset> implements InputAssetBuilderMethods, FluentBuilder<InputAsset, BaseBuildContext> {
20
+ private static readonly defaults: Record<string, unknown> = {"type":"input","id":"","binding":""};
21
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["label"]];
22
+
23
+ /** A unique identifier for this asset */
24
+ withId(value: string | TaggedTemplateValue<string>): InputAssetBuilder {
25
+ return this.set("id", value);
26
+ }
27
+
28
+ /** Sets the binding property */
29
+ withBinding(value: string | TaggedTemplateValue<string>): InputAssetBuilder {
30
+ return this.set("binding", value);
31
+ }
32
+
33
+ /** Sets the label property */
34
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): InputAssetBuilder {
35
+ return this.set("label", value);
36
+ }
37
+
38
+ /** Sets the placeholder property */
39
+ withPlaceholder(value: string | TaggedTemplateValue<string>): InputAssetBuilder {
40
+ return this.set("placeholder", value);
41
+ }
42
+
43
+ /**
44
+ * Builds the final InputAsset object
45
+ * @param context - Optional build context for nested builders
46
+ */
47
+ build(context?: BaseBuildContext): InputAsset {
48
+ return this.buildWithDefaults(InputAssetBuilder.defaults, context);
49
+ }
50
+
51
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
52
+ return createInspectMethod("InputAssetBuilder", this.values);
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Creates a new InputAsset builder
58
+ * @param initial Optional initial values
59
+ * @returns A fluent builder for InputAsset
60
+ */
61
+ export function input(initial?: FluentPartial<InputAsset>): InputAssetBuilder {
62
+ return new InputAssetBuilder(initial);
63
+ }
@@ -0,0 +1,65 @@
1
+ import type { OverviewCollection } from "../types/collection.js";
2
+ import type { ActionAsset } from "../types/action.js";
3
+ import type { Asset } from "@player-ui/types";
4
+ import { type FluentBuilder, type BaseBuildContext, type FluentPartial, FluentBuilderBase, createInspectMethod, type TaggedTemplateValue } from "../../../gen/common.js";
5
+
6
+ export interface OverviewCollectionBuilderMethods<AnyAsset extends Asset = Asset> {
7
+ /** A unique identifier for this asset */
8
+ withId(value: string | TaggedTemplateValue<string>): OverviewCollectionBuilder<AnyAsset>;
9
+ /** The collection items to show */
10
+ withValues(value: Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): OverviewCollectionBuilder<AnyAsset>;
11
+ /** The label defining the collection */
12
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): OverviewCollectionBuilder<AnyAsset>;
13
+ /** Actions attached to the collection */
14
+ withActions(value: Array<ActionAsset | FluentBuilder<ActionAsset, BaseBuildContext>>): OverviewCollectionBuilder<AnyAsset>;
15
+ }
16
+
17
+ /**
18
+ * A builder for OverviewCollection
19
+ */
20
+ export class OverviewCollectionBuilder<AnyAsset extends Asset = Asset> extends FluentBuilderBase<OverviewCollection<AnyAsset>> implements OverviewCollectionBuilderMethods<AnyAsset>, FluentBuilder<OverviewCollection<AnyAsset>, BaseBuildContext> {
21
+ private static readonly defaults: Record<string, unknown> = {"type":"overviewCollection","id":""};
22
+ private static readonly __arrayProperties__: ReadonlySet<string> = new Set(["values", "actions"]);
23
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["values"],["label"],["actions"]];
24
+
25
+ /** A unique identifier for this asset */
26
+ withId(value: string | TaggedTemplateValue<string>): OverviewCollectionBuilder<AnyAsset> {
27
+ return this.set("id", value);
28
+ }
29
+
30
+ /** The collection items to show */
31
+ withValues(value: Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): OverviewCollectionBuilder<AnyAsset> {
32
+ return this.set("values", value);
33
+ }
34
+
35
+ /** The label defining the collection */
36
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): OverviewCollectionBuilder<AnyAsset> {
37
+ return this.set("label", value);
38
+ }
39
+
40
+ /** Actions attached to the collection */
41
+ withActions(value: Array<ActionAsset | FluentBuilder<ActionAsset, BaseBuildContext>>): OverviewCollectionBuilder<AnyAsset> {
42
+ return this.set("actions", value);
43
+ }
44
+
45
+ /**
46
+ * Builds the final OverviewCollection object
47
+ * @param context - Optional build context for nested builders
48
+ */
49
+ build(context?: BaseBuildContext): OverviewCollection<AnyAsset> {
50
+ return this.buildWithDefaults(OverviewCollectionBuilder.defaults, context);
51
+ }
52
+
53
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
54
+ return createInspectMethod("OverviewCollectionBuilder", this.values);
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Creates a new OverviewCollection builder
60
+ * @param initial Optional initial values
61
+ * @returns A fluent builder for OverviewCollection
62
+ */
63
+ export function overviewCollection<AnyAsset extends Asset = Asset>(initial?: FluentPartial<OverviewCollection<AnyAsset>>): OverviewCollectionBuilder<AnyAsset> {
64
+ return new OverviewCollectionBuilder<AnyAsset>(initial);
65
+ }
@@ -0,0 +1,93 @@
1
+ import type { SplashCollection } from "../types/collection.js";
2
+ import type { ActionAsset } from "../types/action.js";
3
+ import type { Asset } from "@player-ui/types";
4
+ import { type FluentBuilder, type BaseBuildContext, type FluentPartial, FluentBuilderBase, createInspectMethod, type TaggedTemplateValue } from "../../../gen/common.js";
5
+
6
+ export interface SplashCollectionBuilderMethods<AnyAsset extends Asset = Asset> {
7
+ /** A unique identifier for this asset */
8
+ withId(value: string | TaggedTemplateValue<string>): SplashCollectionBuilder<AnyAsset>;
9
+ /** Extra data associated with the Asset */
10
+ withMetaData(value: { role?: "promotional" } | FluentBuilder<{ role?: "promotional" }, BaseBuildContext> | FluentPartial<{ role?: "promotional" }, BaseBuildContext>): SplashCollectionBuilder<AnyAsset>;
11
+ /** Asset container for an image */
12
+ withSplash(value: Asset | FluentBuilder<Asset, BaseBuildContext>): SplashCollectionBuilder<AnyAsset>;
13
+ /** Label, typically a single text asset */
14
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): SplashCollectionBuilder<AnyAsset>;
15
+ /** Array of assets, typically text assets */
16
+ withValues(value: Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): SplashCollectionBuilder<AnyAsset>;
17
+ /** @deprecated additionalInfo in splash collection is no longer supported */
18
+ withAdditionalInfo(value: Asset | FluentBuilder<Asset, BaseBuildContext>): SplashCollectionBuilder<AnyAsset>;
19
+ /** @deprecated resultText in splash collection is no longer supported */
20
+ withResultText(value: Asset | FluentBuilder<Asset, BaseBuildContext>): SplashCollectionBuilder<AnyAsset>;
21
+ /** @deprecated actions in splash collection is no longer supported */
22
+ withActions(value: Array<ActionAsset | FluentBuilder<ActionAsset, BaseBuildContext>>): SplashCollectionBuilder<AnyAsset>;
23
+ }
24
+
25
+ /**
26
+ * A builder for SplashCollection
27
+ */
28
+ export class SplashCollectionBuilder<AnyAsset extends Asset = Asset> extends FluentBuilderBase<SplashCollection<AnyAsset>> implements SplashCollectionBuilderMethods<AnyAsset>, FluentBuilder<SplashCollection<AnyAsset>, BaseBuildContext> {
29
+ private static readonly defaults: Record<string, unknown> = {"type":"splashCollection","id":""};
30
+ private static readonly __arrayProperties__: ReadonlySet<string> = new Set(["values", "actions"]);
31
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["splash"],["label"],["values"],["additionalInfo"],["resultText"],["actions"]];
32
+
33
+ /** A unique identifier for this asset */
34
+ withId(value: string | TaggedTemplateValue<string>): SplashCollectionBuilder<AnyAsset> {
35
+ return this.set("id", value);
36
+ }
37
+
38
+ /** Extra data associated with the Asset */
39
+ withMetaData(value: { role?: "promotional" } | FluentBuilder<{ role?: "promotional" }, BaseBuildContext> | FluentPartial<{ role?: "promotional" }, BaseBuildContext>): SplashCollectionBuilder<AnyAsset> {
40
+ return this.set("metaData", value);
41
+ }
42
+
43
+ /** Asset container for an image */
44
+ withSplash(value: Asset | FluentBuilder<Asset, BaseBuildContext>): SplashCollectionBuilder<AnyAsset> {
45
+ return this.set("splash", value);
46
+ }
47
+
48
+ /** Label, typically a single text asset */
49
+ withLabel(value: Asset | FluentBuilder<Asset, BaseBuildContext>): SplashCollectionBuilder<AnyAsset> {
50
+ return this.set("label", value);
51
+ }
52
+
53
+ /** Array of assets, typically text assets */
54
+ withValues(value: Array<Asset | FluentBuilder<Asset, BaseBuildContext>>): SplashCollectionBuilder<AnyAsset> {
55
+ return this.set("values", value);
56
+ }
57
+
58
+ /** @deprecated additionalInfo in splash collection is no longer supported */
59
+ withAdditionalInfo(value: Asset | FluentBuilder<Asset, BaseBuildContext>): SplashCollectionBuilder<AnyAsset> {
60
+ return this.set("additionalInfo", value);
61
+ }
62
+
63
+ /** @deprecated resultText in splash collection is no longer supported */
64
+ withResultText(value: Asset | FluentBuilder<Asset, BaseBuildContext>): SplashCollectionBuilder<AnyAsset> {
65
+ return this.set("resultText", value);
66
+ }
67
+
68
+ /** @deprecated actions in splash collection is no longer supported */
69
+ withActions(value: Array<ActionAsset | FluentBuilder<ActionAsset, BaseBuildContext>>): SplashCollectionBuilder<AnyAsset> {
70
+ return this.set("actions", value);
71
+ }
72
+
73
+ /**
74
+ * Builds the final SplashCollection object
75
+ * @param context - Optional build context for nested builders
76
+ */
77
+ build(context?: BaseBuildContext): SplashCollection<AnyAsset> {
78
+ return this.buildWithDefaults(SplashCollectionBuilder.defaults, context);
79
+ }
80
+
81
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
82
+ return createInspectMethod("SplashCollectionBuilder", this.values);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Creates a new SplashCollection builder
88
+ * @param initial Optional initial values
89
+ * @returns A fluent builder for SplashCollection
90
+ */
91
+ export function splashCollection<AnyAsset extends Asset = Asset>(initial?: FluentPartial<SplashCollection<AnyAsset>>): SplashCollectionBuilder<AnyAsset> {
92
+ return new SplashCollectionBuilder<AnyAsset>(initial);
93
+ }