@player-ui/types 0.8.0--canary.307.9621 → 0.8.0-next.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.
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/types/src/index.ts
17
+ var src_exports = {};
18
+ module.exports = __toCommonJS(src_exports);
19
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/types/src/index.ts"],"sourcesContent":["/**\n * An asset is the smallest unit of user interaction in a player view\n */\nexport interface Asset<T extends string = string> {\n /** Each asset requires a unique id per view */\n id: string;\n\n /** The asset type determines the semantics of how a user interacts with a page */\n type: T;\n\n [key: string]: unknown;\n}\n/**\n * An asset that contains a Binding.\n */\nexport interface AssetBinding extends Asset {\n /** A binding that points to somewhere in the data model */\n binding: Binding;\n}\n\n/** A single case statement to use in a switch */\nexport interface SwitchCase<T extends Asset = Asset> {\n /** The Asset to use if this case is applicable */\n asset: T;\n\n /** An expression to execute to determine if this case applies */\n case: Expression | true;\n}\n\n/** A switch can replace an asset with the applicable case on first render */\nexport type Switch<T extends Asset = Asset> = SwitchCase<T>[];\n\n/** An object that contains an asset */\nexport type AssetWrapper<T extends Asset = Asset> = {\n /** An asset instance */\n asset: T;\n\n [key: string]: unknown;\n};\n\nexport type AssetWrapperOrSwitch<T extends Asset = Asset> =\n | (AssetWrapper<T> & {\n /** The dynamicSwitch property can't exist at the same time as 'asset' */\n dynamicSwitch?: never;\n\n /** The staticSwitch property can't exist at the same time as 'asset' */\n staticSwitch?: never;\n })\n | (StaticSwitch<T> & {\n /** The staticSwitch property can't exist at the same time as 'asset' */\n asset?: never;\n\n /** The staticSwitch property can't exist at the same time as 'dynamicSwitch' */\n dynamicSwitch?: never;\n })\n | (DynamicSwitch<T> & {\n /** The dynamicSwitch property can't exist at the same time as 'asset' */\n asset?: never;\n\n /** The dynamicSwitch property can't exist at the same time as 'staticSwitch' */\n staticSwitch?: never;\n });\n\nexport type AssetSwitch<T extends Asset = Asset> =\n | StaticSwitch<T>\n | DynamicSwitch<T>;\n\nexport interface StaticSwitch<T extends Asset = Asset> {\n /** A static switch only evaluates the applicable base on first render of the view */\n staticSwitch: Switch<T>;\n}\n\nexport interface DynamicSwitch<T extends Asset = Asset> {\n /** A dynamic switch re-evaluates the applicable case as data changes */\n dynamicSwitch: Switch<T>;\n}\n\n/**\n * Expressions are a specialized way of executing code.\n * If the expression is a composite, the last expression executed is the return value\n */\nexport type Expression = string | string[];\nexport type ExpressionRef = `@[${string}]@`;\n\n/**\n * Bindings describe locations in the data model.\n */\nexport type Binding = string;\nexport type BindingRef = `{{${Binding}}}`;\n\n/**\n * The data-model is the location that all user data is stored\n */\nexport type DataModel = Record<any, unknown>;\n\n/** The navigation section of the flow describes a State Machine for the user. */\nexport type Navigation = {\n /** The name of the Flow to begin on */\n BEGIN: string;\n} & Record<string, string | NavigationFlow>;\n\n/** An object with an expression in it */\nexport interface ExpressionObject {\n /** The expression to run */\n exp?: Expression;\n}\n\n/** A state machine in the navigation */\nexport interface NavigationFlow {\n /** The first state to kick off the state machine */\n startState: string;\n\n /** An optional expression to run when this Flow starts */\n onStart?: Expression | ExpressionObject;\n\n /** An optional expression to run when this Flow ends */\n onEnd?: Expression | ExpressionObject;\n\n [key: string]:\n | undefined\n | string\n | Expression\n | ExpressionObject\n | NavigationFlowState;\n}\n\nexport type NavigationFlowTransition = Record<string, string>;\n\ninterface CommentBase {\n /** Add comments that will not be processing, but are useful for code explanation */\n _comment?: string;\n}\n\n/** The base representation of a state within a Flow */\nexport interface NavigationBaseState<T extends string> extends CommentBase {\n /** A property to determine the type of state this is */\n state_type: T;\n\n /** An optional expression to run when this view renders */\n onStart?: Expression | ExpressionObject;\n\n /** An optional expression to run before view transition */\n onEnd?: Expression | ExpressionObject;\n\n /**\n * TS gets really confused with both the ActionState and the onStart state both declaring the `exp` property\n * So this explicity says there should never be an exp prop on a state node that's not of type 'ACTION'\n */\n exp?: T extends \"ACTION\" ? Expression : never;\n}\n\n/** A generic state that can transition to another state */\nexport interface NavigationFlowTransitionableState<T extends string>\n extends NavigationBaseState<T> {\n /** A mapping of transition-name to FlowState name */\n transitions: NavigationFlowTransition;\n}\n\n/** A state representing a view */\nexport interface NavigationFlowViewState\n extends NavigationFlowTransitionableState<\"VIEW\"> {\n /** An id corresponding to a view from the 'views' array */\n ref: string;\n\n /** View meta-properties */\n attributes?: {\n [key: string]: any;\n };\n\n /** Any additional properties are forwarded as options, like param */\n [key: string]: unknown;\n}\n\n/**\n * An END state of the flow.\n */\nexport interface NavigationFlowEndState extends NavigationBaseState<\"END\"> {\n /**\n * A description of _how_ the flow ended.\n * If this is a flow started from another flow, the outcome determines the flow transition\n */\n outcome: string;\n\n /** Any additional properties are forwarded as options, like param */\n [key: string]: unknown;\n}\n\n/** Action states execute an expression to determine the next state to transition to */\nexport interface NavigationFlowActionState\n extends NavigationFlowTransitionableState<\"ACTION\"> {\n /**\n * An expression to execute.\n * The return value determines the transition to take\n */\n exp: Expression;\n}\n\n/**\n * External Flow states represent states in the FSM that can't be resolved internally in Player.\n * The flow will wait for the embedded application to manage moving to the next state via a transition\n */\nexport interface NavigationFlowExternalState\n extends NavigationFlowTransitionableState<\"EXTERNAL\"> {\n /** A reference for this external state */\n ref: string;\n /** Any additional properties are forwarded as options */\n [key: string]: unknown;\n}\n\nexport interface NavigationFlowFlowState\n extends NavigationFlowTransitionableState<\"FLOW\"> {\n /** A reference to a FLOW id state to run */\n ref: string;\n}\n\nexport type NavigationFlowState =\n | NavigationFlowViewState\n | NavigationFlowEndState\n | NavigationFlowFlowState\n | NavigationFlowActionState\n | NavigationFlowExternalState;\n\n/** The data at the end of a flow */\nexport interface FlowResult {\n /** The outcome describes _how_ the flow ended (forwards, backwards, etc) */\n endState: NavigationFlowEndState;\n\n /** The serialized data-model */\n data?: any;\n}\n\n/** Any object that contains 1 or more templates */\nexport interface Templatable {\n /** A list of templates to process for this node */\n template?: Template[];\n}\n\n/** A template describes a mapping from a data array -> array of objects */\nexport interface Template<ValueType = unknown, Key extends string = string> {\n /** A pointer to the data-model containing an array of elements to map over */\n data: Binding;\n\n /**\n * The template to iterate over using each value in the supplied template data.\n * Any reference to _index_ is replaced with the current iteration index.\n */\n value: ValueType;\n\n /** should the template be recomputed when data changes */\n dynamic?: boolean;\n\n /**\n * A property on the parent object to store the new map under.\n * If it already exists, values are appended to the end.\n */\n output: Key;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/**\n * The Schema organizes all content related to Data and it's types\n */\nexport declare namespace Schema {\n /** The authored schema object in the JSON payload */\n export interface Schema {\n /** The ROOT object is the top level object to use */\n ROOT: Node;\n\n /** Any additional keys are properties of the ROOT object */\n [key: string]: Node;\n }\n\n /** A Node describes a specific object in the tree */\n export interface Node {\n /** Each property describes a property of the object */\n [key: string]: DataTypes;\n }\n\n export type DataTypes = DataType | RecordType | ArrayType;\n\n /** Each prop in the object can have a specific DataType */\n export interface DataType<T = unknown> {\n /** The reference of the base type to use */\n type: string;\n\n /**\n * Any additional validations that are associated with this property\n * These will add to any base validations associated with the \"type\"\n */\n validation?: Validation.Reference[];\n\n /**\n * A reference to a specific data format to use.\n * If none is specified, will fallback to that of the base type\n */\n format?: Formatting.Reference;\n\n /**\n * A default value for this property.\n * Any reads for this property will result in this default value being written to the model.\n */\n default?: T;\n\n /** Any additional options */\n [key: string]: unknown;\n }\n /** Determines if the Datatype is a record object */\n export interface RecordType extends DataType {\n /** boolean to define if its a record */\n isRecord: boolean;\n\n /** This property is mutually exclusive with RecordType and can not be used with ArrayType */\n isArray?: never;\n }\n\n /** Determines if the DataType is an Array Object */\n export interface ArrayType extends DataType {\n /** boolean to define if its an array */\n isArray: boolean;\n\n /** This property is mutually exclusive with ArrayType and can not be used with RecordType */\n isRecord?: never;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/** Namespace to wrap up core functionality to be used by the Language Service */\nexport declare namespace Language {\n /**\n * Helper to compliment `Schema.DataType` to provide a way to export a reference to a data type instead of the whole object\n */\n export interface DataTypeRef {\n /** Name of the type in Player Core */\n type: string;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/** A spot for formatting */\nexport declare namespace Formatting {\n /** A reference to a specific formatter */\n export interface Reference {\n /** The name of the formatter (and de-formatter) to use */\n type: string;\n\n /** Any additional properties will be passed as options to the formatter function */\n [key: string]: unknown;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/** A space for all thing validation */\nexport declare namespace Validation {\n /**\n * How serious are you about this error?\n * Warning validations are reserved for errors that could be ignored by the user without consequence\n * Errors must be fixed before proceeding\n */\n export type Severity = \"error\" | \"warning\";\n\n /**\n * When to _first_ start caring about a validation of a data-val.\n *\n * load - only check once the first time the binding appears on screen\n * change - check anytime the data changes\n * navigation - check once the user attempts to navigate away from a view\n */\n export type Trigger = \"navigation\" | \"change\" | \"load\";\n\n /**\n * Where the error/warning should be displayed.\n * - `field` is the default display target. This renders the error/warning directly underneath the field.\n * - `section` is used to display a message at a parent node that is designated as a \"section\"\n * - `page` a special section used to display a message at the top of the page.\n */\n export type DisplayTarget = \"page\" | \"section\" | \"field\";\n\n /** A reference to a validation object */\n export interface Reference {\n /**\n * The name of the referenced validation type\n * This will be used to lookup the proper handler\n */\n type: string;\n\n /** An optional means of overriding the default message if the validation is triggered */\n message?: string;\n\n /** An optional means of overriding the default severity of the validation if triggered */\n severity?: Severity;\n\n /** When to run this particular validation */\n trigger?: Trigger;\n\n /**\n * Each validation is passed the value of the data to run it's validation against.\n * By default, this is the value stored in the data-model (deformatted).\n * In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option\n */\n dataTarget?: \"formatted\" | \"deformatted\";\n\n /** Where the error should be displayed */\n displayTarget?: DisplayTarget;\n\n /**\n * If the validation blocks navigation\n * true/false - always/never block navigation\n * once - only block navigation if the validation has not been triggered before\n *\n * @default - true for errors, 'once' for warnings\n */\n blocking?: boolean | \"once\";\n\n /** Additional props to send down to a Validator */\n [key: string]: unknown;\n }\n\n export interface CrossfieldReference extends Reference {\n /** The binding to associate this validation with */\n ref?: Binding;\n\n /** Cross-field references and validation must run against the default (deformatted) value */\n dataTarget?: never;\n }\n}\n\nexport type View<T extends Asset = Asset> = unknown extends T[\"validation\"]\n ? T & {\n /** Each view can optionally supply a list of validations to run against a particular view */\n validation?: Array<Validation.CrossfieldReference>;\n }\n : T;\n\n/**\n * The JSON payload for running Player\n */\nexport interface Flow<T extends Asset = Asset> {\n /** A unique identifier for the flow */\n id: string;\n\n /** A list of views (each with an ID) that can be shown to a user */\n views?: Array<View<T>>;\n\n /**\n * The schema for the supplied (or referenced data).\n * This is used for validation, formatting, etc\n */\n schema?: Schema.Schema;\n\n /** Any initial data that the flow can use */\n data?: DataModel;\n\n /** A state machine to drive a user through the experience */\n navigation: Navigation;\n\n /** Other keys can be present. We just don't know what they are */\n [key: string]: unknown;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.mjs.map
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,34 +1,34 @@
1
- const Asset = require('./Asset.json')
2
- const AssetBinding = require('./AssetBinding.json')
3
- const SwitchCase = require('./SwitchCase.json')
4
- const Switch = require('./Switch.json')
5
- const AssetWrapper = require('./AssetWrapper.json')
6
- const AssetWrapperOrSwitch = require('./AssetWrapperOrSwitch.json')
7
- const AssetSwitch = require('./AssetSwitch.json')
8
- const StaticSwitch = require('./StaticSwitch.json')
9
- const DynamicSwitch = require('./DynamicSwitch.json')
10
- const Expression = require('./Expression.json')
11
- const ExpressionRef = require('./ExpressionRef.json')
12
- const Binding = require('./Binding.json')
13
- const BindingRef = require('./BindingRef.json')
14
- const DataModel = require('./DataModel.json')
15
- const Navigation = require('./Navigation.json')
16
- const ExpressionObject = require('./ExpressionObject.json')
17
- const NavigationFlow = require('./NavigationFlow.json')
18
- const NavigationFlowTransition = require('./NavigationFlowTransition.json')
19
- const NavigationBaseState = require('./NavigationBaseState.json')
20
- const NavigationFlowTransitionableState = require('./NavigationFlowTransitionableState.json')
21
- const NavigationFlowViewState = require('./NavigationFlowViewState.json')
22
- const NavigationFlowEndState = require('./NavigationFlowEndState.json')
23
- const NavigationFlowActionState = require('./NavigationFlowActionState.json')
24
- const NavigationFlowExternalState = require('./NavigationFlowExternalState.json')
25
- const NavigationFlowFlowState = require('./NavigationFlowFlowState.json')
26
- const NavigationFlowState = require('./NavigationFlowState.json')
27
- const FlowResult = require('./FlowResult.json')
28
- const Templatable = require('./Templatable.json')
29
- const Template = require('./Template.json')
30
- const View = require('./View.json')
31
- const Flow = require('./Flow.json')
1
+ const Asset = require("./Asset.json")
2
+ const AssetBinding = require("./AssetBinding.json")
3
+ const SwitchCase = require("./SwitchCase.json")
4
+ const Switch = require("./Switch.json")
5
+ const AssetWrapper = require("./AssetWrapper.json")
6
+ const AssetWrapperOrSwitch = require("./AssetWrapperOrSwitch.json")
7
+ const AssetSwitch = require("./AssetSwitch.json")
8
+ const StaticSwitch = require("./StaticSwitch.json")
9
+ const DynamicSwitch = require("./DynamicSwitch.json")
10
+ const Expression = require("./Expression.json")
11
+ const ExpressionRef = require("./ExpressionRef.json")
12
+ const Binding = require("./Binding.json")
13
+ const BindingRef = require("./BindingRef.json")
14
+ const DataModel = require("./DataModel.json")
15
+ const Navigation = require("./Navigation.json")
16
+ const ExpressionObject = require("./ExpressionObject.json")
17
+ const NavigationFlow = require("./NavigationFlow.json")
18
+ const NavigationFlowTransition = require("./NavigationFlowTransition.json")
19
+ const NavigationBaseState = require("./NavigationBaseState.json")
20
+ const NavigationFlowTransitionableState = require("./NavigationFlowTransitionableState.json")
21
+ const NavigationFlowViewState = require("./NavigationFlowViewState.json")
22
+ const NavigationFlowEndState = require("./NavigationFlowEndState.json")
23
+ const NavigationFlowActionState = require("./NavigationFlowActionState.json")
24
+ const NavigationFlowExternalState = require("./NavigationFlowExternalState.json")
25
+ const NavigationFlowFlowState = require("./NavigationFlowFlowState.json")
26
+ const NavigationFlowState = require("./NavigationFlowState.json")
27
+ const FlowResult = require("./FlowResult.json")
28
+ const Templatable = require("./Templatable.json")
29
+ const Template = require("./Template.json")
30
+ const View = require("./View.json")
31
+ const Flow = require("./Flow.json")
32
32
 
33
33
  module.exports = {
34
34
  "pluginName": "Types",
@@ -36,6 +36,6 @@ const Flow = require('./Flow.json')
36
36
  "Types":[Asset,AssetBinding,SwitchCase,Switch,AssetWrapper,AssetWrapperOrSwitch,AssetSwitch,StaticSwitch,DynamicSwitch,Expression,ExpressionRef,Binding,BindingRef,DataModel,Navigation,ExpressionObject,NavigationFlow,NavigationFlowTransition,NavigationBaseState,NavigationFlowTransitionableState,NavigationFlowViewState,NavigationFlowEndState,NavigationFlowActionState,NavigationFlowExternalState,NavigationFlowFlowState,NavigationFlowState,FlowResult,Templatable,Template,View,Flow],
37
37
  },
38
38
  "customPrimitives": [
39
- 'Expression','Asset','Binding','AssetWrapper','Schema.DataType','ExpressionHandler'
39
+ "Expression","Asset","Binding","AssetWrapper","Schema.DataType","ExpressionHandler"
40
40
  ]
41
41
  }
package/package.json CHANGED
@@ -1,63 +1,26 @@
1
1
  {
2
2
  "name": "@player-ui/types",
3
- "version": "0.8.0--canary.307.9621",
4
- "private": false,
5
- "publishConfig": {
6
- "registry": "https://registry.npmjs.org"
7
- },
8
- "peerDependencies": {},
9
- "dependencies": {
10
- "@babel/runtime": "7.15.4"
11
- },
12
- "main": "dist/index.cjs.js",
13
- "module": "dist/index.esm.js",
14
- "typings": "dist/index.d.ts",
3
+ "version": "0.8.0-next.0",
4
+ "main": "dist/cjs/index.cjs",
5
+ "module": "dist/index.legacy-esm.js",
6
+ "types": "types/index.d.ts",
15
7
  "sideEffects": false,
16
- "license": "MIT",
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/player-ui/player-ui"
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ "./dist/index.css": "./dist/index.css",
11
+ ".": {
12
+ "types": "./types/index.d.ts",
13
+ "import": "./dist/index.mjs",
14
+ "default": "./dist/cjs/index.cjs"
15
+ }
20
16
  },
21
- "bugs": {
22
- "url": "https://github.com/player-ui/player-ui/issues"
17
+ "files": [
18
+ "dist",
19
+ "src",
20
+ "types"
21
+ ],
22
+ "dependencies": {
23
+ "tslib": "^2.6.2"
23
24
  },
24
- "homepage": "https://player-ui.github.io",
25
- "contributors": [
26
- {
27
- "name": "Adam Dierkens",
28
- "url": "https://github.com/adierkens"
29
- },
30
- {
31
- "name": "Spencer Hamm",
32
- "url": "https://github.com/spentacular"
33
- },
34
- {
35
- "name": "Harris Borawski",
36
- "url": "https://github.com/hborawski"
37
- },
38
- {
39
- "name": "Jeremiah Zucker",
40
- "url": "https://github.com/sugarmanz"
41
- },
42
- {
43
- "name": "Ketan Reddy",
44
- "url": "https://github.com/KetanReddy"
45
- },
46
- {
47
- "name": "Brocollie08",
48
- "url": "https://github.com/brocollie08"
49
- },
50
- {
51
- "name": "Kelly Harrop",
52
- "url": "https://github.com/kharrop"
53
- },
54
- {
55
- "name": "Alejandro Fimbres",
56
- "url": "https://github.com/lexfm"
57
- },
58
- {
59
- "name": "Rafael Campos",
60
- "url": "https://github.com/rafbcampos"
61
- }
62
- ]
25
+ "peerDependencies": {}
63
26
  }
package/src/index.ts CHANGED
@@ -146,7 +146,7 @@ export interface NavigationBaseState<T extends string> extends CommentBase {
146
146
  * TS gets really confused with both the ActionState and the onStart state both declaring the `exp` property
147
147
  * So this explicity says there should never be an exp prop on a state node that's not of type 'ACTION'
148
148
  */
149
- exp?: T extends 'ACTION' ? Expression : never;
149
+ exp?: T extends "ACTION" ? Expression : never;
150
150
  }
151
151
 
152
152
  /** A generic state that can transition to another state */
@@ -158,7 +158,7 @@ export interface NavigationFlowTransitionableState<T extends string>
158
158
 
159
159
  /** A state representing a view */
160
160
  export interface NavigationFlowViewState
161
- extends NavigationFlowTransitionableState<'VIEW'> {
161
+ extends NavigationFlowTransitionableState<"VIEW"> {
162
162
  /** An id corresponding to a view from the 'views' array */
163
163
  ref: string;
164
164
 
@@ -174,7 +174,7 @@ export interface NavigationFlowViewState
174
174
  /**
175
175
  * An END state of the flow.
176
176
  */
177
- export interface NavigationFlowEndState extends NavigationBaseState<'END'> {
177
+ export interface NavigationFlowEndState extends NavigationBaseState<"END"> {
178
178
  /**
179
179
  * A description of _how_ the flow ended.
180
180
  * If this is a flow started from another flow, the outcome determines the flow transition
@@ -187,7 +187,7 @@ export interface NavigationFlowEndState extends NavigationBaseState<'END'> {
187
187
 
188
188
  /** Action states execute an expression to determine the next state to transition to */
189
189
  export interface NavigationFlowActionState
190
- extends NavigationFlowTransitionableState<'ACTION'> {
190
+ extends NavigationFlowTransitionableState<"ACTION"> {
191
191
  /**
192
192
  * An expression to execute.
193
193
  * The return value determines the transition to take
@@ -200,7 +200,7 @@ export interface NavigationFlowActionState
200
200
  * The flow will wait for the embedded application to manage moving to the next state via a transition
201
201
  */
202
202
  export interface NavigationFlowExternalState
203
- extends NavigationFlowTransitionableState<'EXTERNAL'> {
203
+ extends NavigationFlowTransitionableState<"EXTERNAL"> {
204
204
  /** A reference for this external state */
205
205
  ref: string;
206
206
  /** Any additional properties are forwarded as options */
@@ -208,7 +208,7 @@ export interface NavigationFlowExternalState
208
208
  }
209
209
 
210
210
  export interface NavigationFlowFlowState
211
- extends NavigationFlowTransitionableState<'FLOW'> {
211
+ extends NavigationFlowTransitionableState<"FLOW"> {
212
212
  /** A reference to a FLOW id state to run */
213
213
  ref: string;
214
214
  }
@@ -256,6 +256,7 @@ export interface Template<ValueType = unknown, Key extends string = string> {
256
256
  output: Key;
257
257
  }
258
258
 
259
+ // eslint-disable-next-line @typescript-eslint/no-namespace
259
260
  /**
260
261
  * The Schema organizes all content related to Data and it's types
261
262
  */
@@ -322,6 +323,7 @@ export declare namespace Schema {
322
323
  }
323
324
  }
324
325
 
326
+ // eslint-disable-next-line @typescript-eslint/no-namespace
325
327
  /** Namespace to wrap up core functionality to be used by the Language Service */
326
328
  export declare namespace Language {
327
329
  /**
@@ -333,6 +335,7 @@ export declare namespace Language {
333
335
  }
334
336
  }
335
337
 
338
+ // eslint-disable-next-line @typescript-eslint/no-namespace
336
339
  /** A spot for formatting */
337
340
  export declare namespace Formatting {
338
341
  /** A reference to a specific formatter */
@@ -345,6 +348,7 @@ export declare namespace Formatting {
345
348
  }
346
349
  }
347
350
 
351
+ // eslint-disable-next-line @typescript-eslint/no-namespace
348
352
  /** A space for all thing validation */
349
353
  export declare namespace Validation {
350
354
  /**
@@ -352,7 +356,7 @@ export declare namespace Validation {
352
356
  * Warning validations are reserved for errors that could be ignored by the user without consequence
353
357
  * Errors must be fixed before proceeding
354
358
  */
355
- export type Severity = 'error' | 'warning';
359
+ export type Severity = "error" | "warning";
356
360
 
357
361
  /**
358
362
  * When to _first_ start caring about a validation of a data-val.
@@ -361,7 +365,7 @@ export declare namespace Validation {
361
365
  * change - check anytime the data changes
362
366
  * navigation - check once the user attempts to navigate away from a view
363
367
  */
364
- export type Trigger = 'navigation' | 'change' | 'load';
368
+ export type Trigger = "navigation" | "change" | "load";
365
369
 
366
370
  /**
367
371
  * Where the error/warning should be displayed.
@@ -369,7 +373,7 @@ export declare namespace Validation {
369
373
  * - `section` is used to display a message at a parent node that is designated as a "section"
370
374
  * - `page` a special section used to display a message at the top of the page.
371
375
  */
372
- export type DisplayTarget = 'page' | 'section' | 'field';
376
+ export type DisplayTarget = "page" | "section" | "field";
373
377
 
374
378
  /** A reference to a validation object */
375
379
  export interface Reference {
@@ -393,7 +397,7 @@ export declare namespace Validation {
393
397
  * By default, this is the value stored in the data-model (deformatted).
394
398
  * In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
395
399
  */
396
- dataTarget?: 'formatted' | 'deformatted';
400
+ dataTarget?: "formatted" | "deformatted";
397
401
 
398
402
  /** Where the error should be displayed */
399
403
  displayTarget?: DisplayTarget;
@@ -405,7 +409,7 @@ export declare namespace Validation {
405
409
  *
406
410
  * @default - true for errors, 'once' for warnings
407
411
  */
408
- blocking?: boolean | 'once';
412
+ blocking?: boolean | "once";
409
413
 
410
414
  /** Additional props to send down to a Validator */
411
415
  [key: string]: unknown;
@@ -420,7 +424,7 @@ export declare namespace Validation {
420
424
  }
421
425
  }
422
426
 
423
- export type View<T extends Asset = Asset> = unknown extends T['validation']
427
+ export type View<T extends Asset = Asset> = unknown extends T["validation"]
424
428
  ? T & {
425
429
  /** Each view can optionally supply a list of validations to run against a particular view */
426
430
  validation?: Array<Validation.CrossfieldReference>;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * An asset is the smallest unit of user interaction in a player view
3
3
  */
4
- interface Asset<T extends string = string> {
4
+ export interface Asset<T extends string = string> {
5
5
  /** Each asset requires a unique id per view */
6
6
  id: string;
7
7
  /** The asset type determines the semantics of how a user interacts with a page */
@@ -11,26 +11,26 @@ interface Asset<T extends string = string> {
11
11
  /**
12
12
  * An asset that contains a Binding.
13
13
  */
14
- interface AssetBinding extends Asset {
14
+ export interface AssetBinding extends Asset {
15
15
  /** A binding that points to somewhere in the data model */
16
16
  binding: Binding;
17
17
  }
18
18
  /** A single case statement to use in a switch */
19
- interface SwitchCase<T extends Asset = Asset> {
19
+ export interface SwitchCase<T extends Asset = Asset> {
20
20
  /** The Asset to use if this case is applicable */
21
21
  asset: T;
22
22
  /** An expression to execute to determine if this case applies */
23
23
  case: Expression | true;
24
24
  }
25
25
  /** A switch can replace an asset with the applicable case on first render */
26
- declare type Switch<T extends Asset = Asset> = SwitchCase<T>[];
26
+ export type Switch<T extends Asset = Asset> = SwitchCase<T>[];
27
27
  /** An object that contains an asset */
28
- declare type AssetWrapper<T extends Asset = Asset> = {
28
+ export type AssetWrapper<T extends Asset = Asset> = {
29
29
  /** An asset instance */
30
30
  asset: T;
31
31
  [key: string]: unknown;
32
32
  };
33
- declare type AssetWrapperOrSwitch<T extends Asset = Asset> = (AssetWrapper<T> & {
33
+ export type AssetWrapperOrSwitch<T extends Asset = Asset> = (AssetWrapper<T> & {
34
34
  /** The dynamicSwitch property can't exist at the same time as 'asset' */
35
35
  dynamicSwitch?: never;
36
36
  /** The staticSwitch property can't exist at the same time as 'asset' */
@@ -46,12 +46,12 @@ declare type AssetWrapperOrSwitch<T extends Asset = Asset> = (AssetWrapper<T> &
46
46
  /** The dynamicSwitch property can't exist at the same time as 'staticSwitch' */
47
47
  staticSwitch?: never;
48
48
  });
49
- declare type AssetSwitch<T extends Asset = Asset> = StaticSwitch<T> | DynamicSwitch<T>;
50
- interface StaticSwitch<T extends Asset = Asset> {
49
+ export type AssetSwitch<T extends Asset = Asset> = StaticSwitch<T> | DynamicSwitch<T>;
50
+ export interface StaticSwitch<T extends Asset = Asset> {
51
51
  /** A static switch only evaluates the applicable base on first render of the view */
52
52
  staticSwitch: Switch<T>;
53
53
  }
54
- interface DynamicSwitch<T extends Asset = Asset> {
54
+ export interface DynamicSwitch<T extends Asset = Asset> {
55
55
  /** A dynamic switch re-evaluates the applicable case as data changes */
56
56
  dynamicSwitch: Switch<T>;
57
57
  }
@@ -59,29 +59,29 @@ interface DynamicSwitch<T extends Asset = Asset> {
59
59
  * Expressions are a specialized way of executing code.
60
60
  * If the expression is a composite, the last expression executed is the return value
61
61
  */
62
- declare type Expression = string | string[];
63
- declare type ExpressionRef = `@[${string}]@`;
62
+ export type Expression = string | string[];
63
+ export type ExpressionRef = `@[${string}]@`;
64
64
  /**
65
65
  * Bindings describe locations in the data model.
66
66
  */
67
- declare type Binding = string;
68
- declare type BindingRef = `{{${Binding}}}`;
67
+ export type Binding = string;
68
+ export type BindingRef = `{{${Binding}}}`;
69
69
  /**
70
70
  * The data-model is the location that all user data is stored
71
71
  */
72
- declare type DataModel = Record<any, unknown>;
72
+ export type DataModel = Record<any, unknown>;
73
73
  /** The navigation section of the flow describes a State Machine for the user. */
74
- declare type Navigation = {
74
+ export type Navigation = {
75
75
  /** The name of the Flow to begin on */
76
76
  BEGIN: string;
77
77
  } & Record<string, string | NavigationFlow>;
78
78
  /** An object with an expression in it */
79
- interface ExpressionObject {
79
+ export interface ExpressionObject {
80
80
  /** The expression to run */
81
81
  exp?: Expression;
82
82
  }
83
83
  /** A state machine in the navigation */
84
- interface NavigationFlow {
84
+ export interface NavigationFlow {
85
85
  /** The first state to kick off the state machine */
86
86
  startState: string;
87
87
  /** An optional expression to run when this Flow starts */
@@ -90,13 +90,13 @@ interface NavigationFlow {
90
90
  onEnd?: Expression | ExpressionObject;
91
91
  [key: string]: undefined | string | Expression | ExpressionObject | NavigationFlowState;
92
92
  }
93
- declare type NavigationFlowTransition = Record<string, string>;
93
+ export type NavigationFlowTransition = Record<string, string>;
94
94
  interface CommentBase {
95
95
  /** Add comments that will not be processing, but are useful for code explanation */
96
96
  _comment?: string;
97
97
  }
98
98
  /** The base representation of a state within a Flow */
99
- interface NavigationBaseState<T extends string> extends CommentBase {
99
+ export interface NavigationBaseState<T extends string> extends CommentBase {
100
100
  /** A property to determine the type of state this is */
101
101
  state_type: T;
102
102
  /** An optional expression to run when this view renders */
@@ -107,15 +107,15 @@ interface NavigationBaseState<T extends string> extends CommentBase {
107
107
  * TS gets really confused with both the ActionState and the onStart state both declaring the `exp` property
108
108
  * So this explicity says there should never be an exp prop on a state node that's not of type 'ACTION'
109
109
  */
110
- exp?: T extends 'ACTION' ? Expression : never;
110
+ exp?: T extends "ACTION" ? Expression : never;
111
111
  }
112
112
  /** A generic state that can transition to another state */
113
- interface NavigationFlowTransitionableState<T extends string> extends NavigationBaseState<T> {
113
+ export interface NavigationFlowTransitionableState<T extends string> extends NavigationBaseState<T> {
114
114
  /** A mapping of transition-name to FlowState name */
115
115
  transitions: NavigationFlowTransition;
116
116
  }
117
117
  /** A state representing a view */
118
- interface NavigationFlowViewState extends NavigationFlowTransitionableState<'VIEW'> {
118
+ export interface NavigationFlowViewState extends NavigationFlowTransitionableState<"VIEW"> {
119
119
  /** An id corresponding to a view from the 'views' array */
120
120
  ref: string;
121
121
  /** View meta-properties */
@@ -128,7 +128,7 @@ interface NavigationFlowViewState extends NavigationFlowTransitionableState<'VIE
128
128
  /**
129
129
  * An END state of the flow.
130
130
  */
131
- interface NavigationFlowEndState extends NavigationBaseState<'END'> {
131
+ export interface NavigationFlowEndState extends NavigationBaseState<"END"> {
132
132
  /**
133
133
  * A description of _how_ the flow ended.
134
134
  * If this is a flow started from another flow, the outcome determines the flow transition
@@ -138,7 +138,7 @@ interface NavigationFlowEndState extends NavigationBaseState<'END'> {
138
138
  [key: string]: unknown;
139
139
  }
140
140
  /** Action states execute an expression to determine the next state to transition to */
141
- interface NavigationFlowActionState extends NavigationFlowTransitionableState<'ACTION'> {
141
+ export interface NavigationFlowActionState extends NavigationFlowTransitionableState<"ACTION"> {
142
142
  /**
143
143
  * An expression to execute.
144
144
  * The return value determines the transition to take
@@ -149,31 +149,31 @@ interface NavigationFlowActionState extends NavigationFlowTransitionableState<'A
149
149
  * External Flow states represent states in the FSM that can't be resolved internally in Player.
150
150
  * The flow will wait for the embedded application to manage moving to the next state via a transition
151
151
  */
152
- interface NavigationFlowExternalState extends NavigationFlowTransitionableState<'EXTERNAL'> {
152
+ export interface NavigationFlowExternalState extends NavigationFlowTransitionableState<"EXTERNAL"> {
153
153
  /** A reference for this external state */
154
154
  ref: string;
155
155
  /** Any additional properties are forwarded as options */
156
156
  [key: string]: unknown;
157
157
  }
158
- interface NavigationFlowFlowState extends NavigationFlowTransitionableState<'FLOW'> {
158
+ export interface NavigationFlowFlowState extends NavigationFlowTransitionableState<"FLOW"> {
159
159
  /** A reference to a FLOW id state to run */
160
160
  ref: string;
161
161
  }
162
- declare type NavigationFlowState = NavigationFlowViewState | NavigationFlowEndState | NavigationFlowFlowState | NavigationFlowActionState | NavigationFlowExternalState;
162
+ export type NavigationFlowState = NavigationFlowViewState | NavigationFlowEndState | NavigationFlowFlowState | NavigationFlowActionState | NavigationFlowExternalState;
163
163
  /** The data at the end of a flow */
164
- interface FlowResult {
164
+ export interface FlowResult {
165
165
  /** The outcome describes _how_ the flow ended (forwards, backwards, etc) */
166
166
  endState: NavigationFlowEndState;
167
167
  /** The serialized data-model */
168
168
  data?: any;
169
169
  }
170
170
  /** Any object that contains 1 or more templates */
171
- interface Templatable {
171
+ export interface Templatable {
172
172
  /** A list of templates to process for this node */
173
173
  template?: Template[];
174
174
  }
175
175
  /** A template describes a mapping from a data array -> array of objects */
176
- interface Template<ValueType = unknown, Key extends string = string> {
176
+ export interface Template<ValueType = unknown, Key extends string = string> {
177
177
  /** A pointer to the data-model containing an array of elements to map over */
178
178
  data: Binding;
179
179
  /**
@@ -192,7 +192,7 @@ interface Template<ValueType = unknown, Key extends string = string> {
192
192
  /**
193
193
  * The Schema organizes all content related to Data and it's types
194
194
  */
195
- declare namespace Schema {
195
+ export declare namespace Schema {
196
196
  /** The authored schema object in the JSON payload */
197
197
  interface Schema {
198
198
  /** The ROOT object is the top level object to use */
@@ -244,7 +244,7 @@ declare namespace Schema {
244
244
  }
245
245
  }
246
246
  /** Namespace to wrap up core functionality to be used by the Language Service */
247
- declare namespace Language {
247
+ export declare namespace Language {
248
248
  /**
249
249
  * Helper to compliment `Schema.DataType` to provide a way to export a reference to a data type instead of the whole object
250
250
  */
@@ -254,7 +254,7 @@ declare namespace Language {
254
254
  }
255
255
  }
256
256
  /** A spot for formatting */
257
- declare namespace Formatting {
257
+ export declare namespace Formatting {
258
258
  /** A reference to a specific formatter */
259
259
  interface Reference {
260
260
  /** The name of the formatter (and de-formatter) to use */
@@ -264,13 +264,13 @@ declare namespace Formatting {
264
264
  }
265
265
  }
266
266
  /** A space for all thing validation */
267
- declare namespace Validation {
267
+ export declare namespace Validation {
268
268
  /**
269
269
  * How serious are you about this error?
270
270
  * Warning validations are reserved for errors that could be ignored by the user without consequence
271
271
  * Errors must be fixed before proceeding
272
272
  */
273
- type Severity = 'error' | 'warning';
273
+ type Severity = "error" | "warning";
274
274
  /**
275
275
  * When to _first_ start caring about a validation of a data-val.
276
276
  *
@@ -278,14 +278,14 @@ declare namespace Validation {
278
278
  * change - check anytime the data changes
279
279
  * navigation - check once the user attempts to navigate away from a view
280
280
  */
281
- type Trigger = 'navigation' | 'change' | 'load';
281
+ type Trigger = "navigation" | "change" | "load";
282
282
  /**
283
283
  * Where the error/warning should be displayed.
284
284
  * - `field` is the default display target. This renders the error/warning directly underneath the field.
285
285
  * - `section` is used to display a message at a parent node that is designated as a "section"
286
286
  * - `page` a special section used to display a message at the top of the page.
287
287
  */
288
- type DisplayTarget = 'page' | 'section' | 'field';
288
+ type DisplayTarget = "page" | "section" | "field";
289
289
  /** A reference to a validation object */
290
290
  interface Reference {
291
291
  /**
@@ -304,7 +304,7 @@ declare namespace Validation {
304
304
  * By default, this is the value stored in the data-model (deformatted).
305
305
  * In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
306
306
  */
307
- dataTarget?: 'formatted' | 'deformatted';
307
+ dataTarget?: "formatted" | "deformatted";
308
308
  /** Where the error should be displayed */
309
309
  displayTarget?: DisplayTarget;
310
310
  /**
@@ -314,7 +314,7 @@ declare namespace Validation {
314
314
  *
315
315
  * @default - true for errors, 'once' for warnings
316
316
  */
317
- blocking?: boolean | 'once';
317
+ blocking?: boolean | "once";
318
318
  /** Additional props to send down to a Validator */
319
319
  [key: string]: unknown;
320
320
  }
@@ -325,14 +325,14 @@ declare namespace Validation {
325
325
  dataTarget?: never;
326
326
  }
327
327
  }
328
- declare type View<T extends Asset = Asset> = unknown extends T['validation'] ? T & {
328
+ export type View<T extends Asset = Asset> = unknown extends T["validation"] ? T & {
329
329
  /** Each view can optionally supply a list of validations to run against a particular view */
330
330
  validation?: Array<Validation.CrossfieldReference>;
331
331
  } : T;
332
332
  /**
333
333
  * The JSON payload for running Player
334
334
  */
335
- interface Flow<T extends Asset = Asset> {
335
+ export interface Flow<T extends Asset = Asset> {
336
336
  /** A unique identifier for the flow */
337
337
  id: string;
338
338
  /** A list of views (each with an ID) that can be shown to a user */
@@ -349,5 +349,5 @@ interface Flow<T extends Asset = Asset> {
349
349
  /** Other keys can be present. We just don't know what they are */
350
350
  [key: string]: unknown;
351
351
  }
352
-
353
- export { Asset, AssetBinding, AssetSwitch, AssetWrapper, AssetWrapperOrSwitch, Binding, BindingRef, DataModel, DynamicSwitch, Expression, ExpressionObject, ExpressionRef, Flow, FlowResult, Formatting, Language, Navigation, NavigationBaseState, NavigationFlow, NavigationFlowActionState, NavigationFlowEndState, NavigationFlowExternalState, NavigationFlowFlowState, NavigationFlowState, NavigationFlowTransition, NavigationFlowTransitionableState, NavigationFlowViewState, Schema, StaticSwitch, Switch, SwitchCase, Templatable, Template, Validation, View };
352
+ export {};
353
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.cjs.js DELETED
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- //# sourceMappingURL=index.cjs.js.map
package/dist/index.esm.js DELETED
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=index.esm.js.map