@spiffcommerce/theme-bridge 1.27.0 → 1.27.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configurationTypes-6D808idm.js.map +1 -1
- package/dist/configurationTypes-Bt8NVGKp.cjs.map +1 -1
- package/dist/index.d.ts +64 -1
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +130 -33
- package/dist/plugin.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurationTypes-6D808idm.js","sources":["../src/configurationTypes.ts"],"sourcesContent":["export interface ThemeConfigurationFile {\n /**\n * Information the theme loader needs in order to launch your theme.\n */\n launchData: ThemeConfigurationLaunchData;\n /**\n * An object that describes information that's configurable by a Partner when they install your theme.\n */\n configurationSchema?: ThemeConfigurationSchema;\n}\n\nexport enum ThemeFileType {\n Javascript = \"Javascript\",\n CSS = \"CSS\",\n}\n\nexport interface ThemeConfigurationLaunchData {\n /**\n * Files that will be loaded when launching the theme.\n */\n targetFiles: ThemeConfigurationLaunchDataTargetFile[];\n}\n\ninterface LaunchFileBase {\n /**\n * The local path to the file.\n */\n filename: string;\n /**\n * The MIME type of the file.\n */\n mimeType: string;\n}\n\ninterface GenericLaunchFile extends LaunchFileBase {\n type: ThemeFileType.CSS;\n}\n\ninterface JavascriptLaunchFile extends LaunchFileBase {\n /**\n * When `false`, the file will be loaded immediately. When `true`, the file will instead be pre-loaded.\n * With javascript files, this will insert them into the page as `<link rel=\"modulepreload\" ... >`.\n */\n preload?: boolean;\n type: ThemeFileType.Javascript;\n}\n\nexport type ThemeConfigurationLaunchDataTargetFile = GenericLaunchFile | JavascriptLaunchFile;\n\nexport enum FieldType {\n Asset = \"Asset\",\n Boolean = \"Boolean\",\n Color = \"Color\",\n ConversionConfiguration = \"ConversionConfiguration\",\n Heading = \"Heading\",\n List = \"List\",\n Number = \"Number\",\n Object = \"Object\",\n Select = \"Select\",\n Text = \"Text\",\n DateRange = \"DateRange\",\n ProductCollection = \"ProductCollection\",\n MetafieldConfiguration = \"MetafieldConfiguration\",\n}\n\nexport interface ThemeConfigurationSchema {\n /**\n * An array of fields that a Partner can configure when they install the theme.\n */\n fields: ThemeConfigurationSchemaField[];\n\n /**\n * An array of custom schemas that can be reused anywhere on any field.\n */\n customSchemas?: ThemeConfigurationSchemaCustomSchema[];\n}\n\ninterface FieldBase {\n /**\n * The display name for the field. When `type` is `\"Heading\"`, this is the heading string.\n */\n title: string;\n}\n\n/**\n * Base type for a field that is actually configurable by a user.\n */\ninterface ConfigurableField extends FieldBase {\n /**\n * A locally unique identifier for the field.\n */\n key: string;\n /**\n * Optional: A brief description of what the field might be used for. This is displayed beneath the field in the configuration form.\n */\n description?: string;\n}\n\ninterface RequiredOption {\n /**\n * Optional: Set to `true` to require a value to be provided in the configuration form.\n */\n required?: boolean;\n /** Cannot combine required and defaultValue options. */\n readonly defaultValue?: undefined;\n}\n\ntype RequiredOrDefault =\n | RequiredOption\n | {\n /**\n * Optional: A default value to supply. Values are always supplied as strings.\n * When the `type` is `\"Select\"`, this should be one of the `key` fields in the `options` array.\n */\n defaultValue?: string;\n /** Cannot combine required and defaultValue options. */\n readonly required?: undefined;\n };\n\ninterface LimitOption {\n /**\n * Optional: A limit to impose on the input.\n * When the `type` is `\"Text\"`, this is a character limit.\n * When the `type` is `\"List\"`, this is a limit to the number of items in the list.\n * When this value is < 1, or not supplied, it is ignored.\n */\n limit?: number;\n}\n\n/**\n * Generic fields which have no extra configuration and can accept default values from the Theme developer.\n */\ninterface GenericFieldBase extends ConfigurableField {\n type: FieldType.Boolean | FieldType.Color | FieldType.Number | FieldType.DateRange;\n}\n\ntype GenericField = GenericFieldBase & RequiredOrDefault;\n\nexport enum AssetType {\n Color = \"Color\",\n ColorProfile = \"ColorProfile\",\n Data = \"Data\",\n Environment = \"Environment\",\n Font = \"Font\",\n Frame = \"Frame\",\n Illustration = \"Illustration\",\n Image = \"Image\",\n Material = \"Material\",\n Model = \"Model\",\n Video = \"Video\",\n}\n\ninterface AssetField extends ConfigurableField, RequiredOption {\n /**\n * The type of asset, e.g. Image, Model, Font, etc.\n */\n assetType: AssetType;\n type: FieldType.Asset;\n}\n\ninterface ConversionConfigurationField extends ConfigurableField {\n type: FieldType.ConversionConfiguration;\n}\n\ninterface SelectFieldBase extends ConfigurableField {\n /**\n * The options available for the Partner to select in the configuration form.\n */\n options: {\n /**\n * A locally unique identifier (within this set of options).\n */\n key: string;\n /**\n * The string that is displayed visually in the menu item.\n */\n value: string;\n }[];\n type: FieldType.Select;\n}\n\ntype SelectField = SelectFieldBase & RequiredOrDefault;\n\ninterface TextFieldBase extends ConfigurableField, LimitOption {\n /**\n * Allows the Partner to configure the field in a multi-line text editor.\n */\n multiLine?: boolean;\n type: FieldType.Text;\n}\n\ntype TextField = TextFieldBase & RequiredOrDefault;\n\n/**\n * Displays a heading in the Configuration Editor page in Hub.\n */\ninterface HeadingField extends FieldBase {\n type: FieldType.Heading;\n}\n\n/**\n * A list of one specific field type.\n */\ninterface ListField extends ConfigurableField, RequiredOption, LimitOption {\n type: FieldType.List;\n /**\n * Defines the configuration schema for the entries in this list.\n */\n items: DistributiveOmit<ThemeConfigurationConfigurableFields, \"key\" | \"title\" | \"description\">;\n}\n\n/**\n * A collection of any number of different fields.\n */\ninterface ObjectField extends ConfigurableField, RequiredOption {\n type: FieldType.Object;\n /**\n * Defines the configuration schema for the fields in this object.\n */\n fields: ThemeConfigurationSchemaField[];\n /**\n * The schema to use from the `customSchemas` field. Leave this undefined when not using a pre-defined schema.\n */\n schema?: undefined;\n}\n\ninterface CustomObjectField extends Omit<ObjectField, \"fields\" | \"schema\"> {\n schema: string;\n}\n\ninterface ProductCollectionField extends ConfigurableField {\n type: FieldType.ProductCollection;\n}\n\nexport enum MetafieldConfigurationEntityType {\n Asset = \"Asset\",\n Customer = \"Customer\",\n Integration = \"Integration\",\n Option = \"Option\",\n Order = \"Order\",\n Partner = \"Partner\",\n Product = \"Product\",\n ProductCollection = \"ProductCollection\",\n Variant = \"Variant\",\n Workflow = \"Workflow\",\n WorkflowStep = \"WorkflowStep\",\n}\n\ninterface MetafieldConfigurationField extends ConfigurableField {\n type: FieldType.MetafieldConfiguration;\n entityType: MetafieldConfigurationEntityType;\n}\n\n/** https://stackoverflow.com/a/57103940/23523714 */\ntype DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;\n\n/**\n * All field types that are configurable by a user in Hub.\n */\nexport type ThemeConfigurationConfigurableFields =\n | GenericField\n | AssetField\n | ConversionConfigurationField\n | SelectField\n | TextField\n | ListField\n | ObjectField\n | CustomObjectField\n | ProductCollectionField\n | MetafieldConfigurationField;\n\n/**\n * All field types, including non-configurable ones.\n */\nexport type ThemeConfigurationSchemaField = ThemeConfigurationConfigurableFields | HeadingField;\n\nexport enum CustomSchemaType {\n Object = \"Object\",\n Union = \"Union\",\n}\n\ninterface CustomSchemaBase {\n /**\n * A unique name for the schema.\n */\n name: string;\n}\n\n/**\n * A schema for a reusable custom object. This is effectively the same as an ObjectField.\n */\ninterface ObjectCustomSchema extends CustomSchemaBase {\n type: CustomSchemaType.Object;\n /**\n * The text displayed when selecting this type in the configuration UI (when part of a Union)\n */\n title?: string;\n /**\n * Defines the configuration schema for the fields in this object.\n */\n fields: ThemeConfigurationSchemaField[];\n /**\n * Optional: Allows your schema to extend from other object schemas.\n * Useful when you have a base type and want to create variants.\n */\n extends?: string[];\n}\n\n/**\n * A schema for a reusable union of multiple custom object schemas.\n */\ninterface UnionCustomSchema extends CustomSchemaBase {\n type: CustomSchemaType.Union;\n /**\n * All schemas that can be selected for this union.\n */\n schemas: string[];\n}\n\nexport type ThemeConfigurationSchemaCustomSchema = ObjectCustomSchema | UnionCustomSchema;\n\n// TODO: Absolutely need a way to generate a schema from a typescript type.\n"],"names":["ThemeFileType","FieldType","AssetType","MetafieldConfigurationEntityType","CustomSchemaType"],"mappings":"AAWO,IAAKA,sBAAAA,OACRA,EAAA,aAAa,cACbA,EAAA,MAAM,OAFEA,IAAAA,KAAA,CAAA,CAAA,GAsCAC,sBAAAA,OACRA,EAAA,QAAQ,SACRA,EAAA,UAAU,WACVA,EAAA,QAAQ,SACRA,EAAA,0BAA0B,2BAC1BA,EAAA,UAAU,WACVA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,OAAO,QACPA,EAAA,YAAY,aACZA,EAAA,oBAAoB,qBACpBA,EAAA,yBAAyB,0BAbjBA,IAAAA,KAAA,CAAA,CAAA,GAyFAC,sBAAAA,OACRA,EAAA,QAAQ,SACRA,EAAA,eAAe,gBACfA,EAAA,OAAO,QACPA,EAAA,cAAc,eACdA,EAAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,eAAe,gBACfA,EAAA,QAAQ,SACRA,EAAA,WAAW,YACXA,EAAA,QAAQ,SACRA,EAAA,QAAQ,SAXAA,IAAAA,KAAA,CAAA,CAAA,GAgGAC,sBAAAA,OACRA,EAAA,QAAQ,SACRA,EAAA,WAAW,YACXA,EAAA,cAAc,eACdA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,UAAU,WACVA,EAAA,UAAU,WACVA,EAAA,oBAAoB,qBACpBA,EAAA,UAAU,WACVA,EAAA,WAAW,YACXA,EAAA,eAAe,gBAXPA,IAAAA,KAAA,CAAA,CAAA,GA0CAC,sBAAAA,OACRA,EAAA,SAAS,UACTA,EAAA,QAAQ,SAFAA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
1
|
+
{"version":3,"file":"configurationTypes-6D808idm.js","sources":["../src/configurationTypes.ts"],"sourcesContent":["export interface ThemeConfigurationFile {\n /**\n * Information the theme loader needs in order to launch your theme.\n */\n launchData: ThemeConfigurationLaunchData;\n /**\n * An object that describes information that's configurable by a Partner when they install your theme.\n */\n configurationSchema?: ThemeConfigurationSchema;\n /**\n * Optional: Settings for how the Spiff Hub displays your theme's configuration fields.\n * If this is not present, all of your fields will be placed in an auto-generated `Misc` page.\n */\n pageSettings?: ThemeConfigurationPageSettings;\n}\n\nexport interface ThemeConfigurationPageSettings {\n /**\n * Settings for each page to display in the Spiff Hub. Use this to group large sections of fields together.\n * Any fields not configured into these pages will be placed in an auto-generated `Misc` page.\n */\n items: ThemeConfigurationPageItem[];\n /**\n * Optional: configuration for which pages can be reordered.\n * All pages which fall between `start` and `end` (inclusive) will be reorderable by the user.\n */\n reorderablePageSettings?: {\n /** The key of the first page which can be reordered. */\n start: string;\n /** The key of the final page which can be reordered. */\n end: string;\n };\n}\n\nexport interface ThemeConfigurationPageItem {\n /**\n * An identifier used for the system to reference this page by.\n * You may also use this to reference the page in your theme at runtime.\n */\n key: string;\n /**\n * The heading to display in the configuration page.\n * This will also be displayed in summary views.\n */\n title: string;\n /**\n * Optional: A sub-heading to display in the configuration page.\n */\n subtitle?: string | null;\n /**\n * Groups of configuration fields to be editable on this page.\n */\n sections: ThemeConfigurationPageSection[];\n /**\n * Whether this page can be disabled/enabled/hidden/visible.\n * Note that fields on page will still be configurable by the user.\n */\n toggleable: boolean;\n /**\n * When true, this page will not be active by default.\n * Note that if you specify `toggleable: true`, this only acts as a default value.\n */\n disabled?: boolean;\n}\n\nexport interface ThemeConfigurationPageSection {\n /** A heading to group these fields by. */\n title: string;\n /** Optional: Sub-heading to display underneath the heading. */\n subtitle?: string | null;\n /**\n * The `key` names of the fields to display in this section.\n * These **must** be static fields.\n */\n fields: string[];\n}\n\nexport enum ThemeFileType {\n Javascript = \"Javascript\",\n CSS = \"CSS\",\n}\n\nexport interface ThemeConfigurationLaunchData {\n /**\n * Files that will be loaded when launching the theme.\n */\n targetFiles: ThemeConfigurationLaunchDataTargetFile[];\n}\n\ninterface LaunchFileBase {\n /**\n * The local path to the file.\n */\n filename: string;\n /**\n * The MIME type of the file.\n */\n mimeType: string;\n}\n\ninterface GenericLaunchFile extends LaunchFileBase {\n type: ThemeFileType.CSS;\n}\n\ninterface JavascriptLaunchFile extends LaunchFileBase {\n /**\n * When `false`, the file will be loaded immediately. When `true`, the file will instead be pre-loaded.\n * With javascript files, this will insert them into the page as `<link rel=\"modulepreload\" ... >`.\n */\n preload?: boolean;\n type: ThemeFileType.Javascript;\n}\n\nexport type ThemeConfigurationLaunchDataTargetFile = GenericLaunchFile | JavascriptLaunchFile;\n\nexport enum FieldType {\n Asset = \"Asset\",\n Boolean = \"Boolean\",\n Color = \"Color\",\n ConversionConfiguration = \"ConversionConfiguration\",\n Heading = \"Heading\",\n List = \"List\",\n Number = \"Number\",\n Object = \"Object\",\n Select = \"Select\",\n Text = \"Text\",\n DateRange = \"DateRange\",\n ProductCollection = \"ProductCollection\",\n MetafieldConfiguration = \"MetafieldConfiguration\",\n}\n\nexport interface ThemeConfigurationSchema {\n /**\n * An array of fields that a Partner can configure when they install the theme.\n */\n fields: ThemeConfigurationSchemaField[];\n\n /**\n * An array of custom schemas that can be reused anywhere on any field.\n */\n customSchemas?: ThemeConfigurationSchemaCustomSchema[];\n}\n\ninterface FieldBase {\n /**\n * The display name for the field. When `type` is `\"Heading\"`, this is the heading string.\n */\n title: string;\n}\n\n/**\n * Base type for a field that is actually configurable by a user.\n */\ninterface ConfigurableField extends FieldBase {\n /**\n * A locally unique identifier for the field.\n */\n key: string;\n /**\n * Optional: A brief description of what the field might be used for. This is displayed beneath the field in the configuration form.\n */\n description?: string;\n}\n\ninterface RequiredOption {\n /**\n * Optional: Set to `true` to require a value to be provided in the configuration form.\n */\n required?: boolean;\n /** Cannot combine required and defaultValue options. */\n readonly defaultValue?: undefined;\n}\n\ntype RequiredOrDefault =\n | RequiredOption\n | {\n /**\n * Optional: A default value to supply. Values are always supplied as strings.\n * When the `type` is `\"Select\"`, this should be one of the `key` fields in the `options` array.\n */\n defaultValue?: string;\n /** Cannot combine required and defaultValue options. */\n readonly required?: undefined;\n };\n\ninterface LimitOption {\n /**\n * Optional: A limit to impose on the input.\n * When the `type` is `\"Text\"`, this is a character limit.\n * When the `type` is `\"List\"`, this is a limit to the number of items in the list.\n * When this value is < 1, or not supplied, it is ignored.\n */\n limit?: number;\n}\n\n/**\n * Generic fields which have no extra configuration and can accept default values from the Theme developer.\n */\ninterface GenericFieldBase extends ConfigurableField {\n type: FieldType.Boolean | FieldType.Color | FieldType.Number | FieldType.DateRange;\n}\n\ntype GenericField = GenericFieldBase & RequiredOrDefault;\n\nexport enum AssetType {\n Color = \"Color\",\n ColorProfile = \"ColorProfile\",\n Data = \"Data\",\n Environment = \"Environment\",\n Font = \"Font\",\n Frame = \"Frame\",\n Illustration = \"Illustration\",\n Image = \"Image\",\n Material = \"Material\",\n Model = \"Model\",\n Video = \"Video\",\n}\n\ninterface AssetField extends ConfigurableField, RequiredOption {\n /**\n * The type of asset, e.g. Image, Model, Font, etc.\n */\n assetType: AssetType;\n type: FieldType.Asset;\n}\n\ninterface ConversionConfigurationField extends ConfigurableField {\n type: FieldType.ConversionConfiguration;\n}\n\ninterface SelectFieldBase extends ConfigurableField {\n /**\n * The options available for the Partner to select in the configuration form.\n */\n options: {\n /**\n * A locally unique identifier (within this set of options).\n */\n key: string;\n /**\n * The string that is displayed visually in the menu item.\n */\n value: string;\n }[];\n type: FieldType.Select;\n}\n\ntype SelectField = SelectFieldBase & RequiredOrDefault;\n\ninterface TextFieldBase extends ConfigurableField, LimitOption {\n /**\n * Allows the Partner to configure the field in a multi-line text editor.\n */\n multiLine?: boolean;\n type: FieldType.Text;\n}\n\ntype TextField = TextFieldBase & RequiredOrDefault;\n\n/**\n * Displays a heading in the Configuration Editor page in Hub.\n */\ninterface HeadingField extends FieldBase {\n type: FieldType.Heading;\n}\n\n/**\n * A list of one specific field type.\n */\ninterface ListField extends ConfigurableField, RequiredOption, LimitOption {\n type: FieldType.List;\n /**\n * Defines the configuration schema for the entries in this list.\n */\n items: DistributiveOmit<ThemeConfigurationConfigurableFields, \"key\" | \"title\" | \"description\">;\n}\n\n/**\n * A collection of any number of different fields.\n */\ninterface ObjectField extends ConfigurableField, RequiredOption {\n type: FieldType.Object;\n /**\n * Defines the configuration schema for the fields in this object.\n */\n fields: ThemeConfigurationSchemaField[];\n /**\n * The schema to use from the `customSchemas` field. Leave this undefined when not using a pre-defined schema.\n */\n schema?: undefined;\n}\n\ninterface CustomObjectField extends Omit<ObjectField, \"fields\" | \"schema\"> {\n schema: string;\n}\n\ninterface ProductCollectionField extends ConfigurableField {\n type: FieldType.ProductCollection;\n}\n\nexport enum MetafieldConfigurationEntityType {\n Asset = \"Asset\",\n Customer = \"Customer\",\n Integration = \"Integration\",\n Option = \"Option\",\n Order = \"Order\",\n Partner = \"Partner\",\n Product = \"Product\",\n ProductCollection = \"ProductCollection\",\n Variant = \"Variant\",\n Workflow = \"Workflow\",\n WorkflowStep = \"WorkflowStep\",\n}\n\ninterface MetafieldConfigurationField extends ConfigurableField {\n type: FieldType.MetafieldConfiguration;\n entityType: MetafieldConfigurationEntityType;\n}\n\n/** https://stackoverflow.com/a/57103940/23523714 */\ntype DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;\n\n/**\n * All field types that are configurable by a user in Hub.\n */\nexport type ThemeConfigurationConfigurableFields =\n | GenericField\n | AssetField\n | ConversionConfigurationField\n | SelectField\n | TextField\n | ListField\n | ObjectField\n | CustomObjectField\n | ProductCollectionField\n | MetafieldConfigurationField;\n\n/**\n * All field types, including non-configurable ones.\n */\nexport type ThemeConfigurationSchemaField = ThemeConfigurationConfigurableFields | HeadingField;\n\nexport enum CustomSchemaType {\n Object = \"Object\",\n Union = \"Union\",\n}\n\ninterface CustomSchemaBase {\n /**\n * A unique name for the schema.\n */\n name: string;\n}\n\n/**\n * A schema for a reusable custom object. This is effectively the same as an ObjectField.\n */\ninterface ObjectCustomSchema extends CustomSchemaBase {\n type: CustomSchemaType.Object;\n /**\n * The text displayed when selecting this type in the configuration UI (when part of a Union)\n */\n title?: string;\n /**\n * Defines the configuration schema for the fields in this object.\n */\n fields: ThemeConfigurationSchemaField[];\n /**\n * Optional: Allows your schema to extend from other object schemas.\n * Useful when you have a base type and want to create variants.\n */\n extends?: string[];\n}\n\n/**\n * A schema for a reusable union of multiple custom object schemas.\n */\ninterface UnionCustomSchema extends CustomSchemaBase {\n type: CustomSchemaType.Union;\n /**\n * All schemas that can be selected for this union.\n */\n schemas: string[];\n}\n\nexport type ThemeConfigurationSchemaCustomSchema = ObjectCustomSchema | UnionCustomSchema;\n\n// TODO: Absolutely need a way to generate a schema from a typescript type.\n"],"names":["ThemeFileType","FieldType","AssetType","MetafieldConfigurationEntityType","CustomSchemaType"],"mappings":"AA6EO,IAAKA,sBAAAA,OACRA,EAAA,aAAa,cACbA,EAAA,MAAM,OAFEA,IAAAA,KAAA,CAAA,CAAA,GAsCAC,sBAAAA,OACRA,EAAA,QAAQ,SACRA,EAAA,UAAU,WACVA,EAAA,QAAQ,SACRA,EAAA,0BAA0B,2BAC1BA,EAAA,UAAU,WACVA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,OAAO,QACPA,EAAA,YAAY,aACZA,EAAA,oBAAoB,qBACpBA,EAAA,yBAAyB,0BAbjBA,IAAAA,KAAA,CAAA,CAAA,GAyFAC,sBAAAA,OACRA,EAAA,QAAQ,SACRA,EAAA,eAAe,gBACfA,EAAA,OAAO,QACPA,EAAA,cAAc,eACdA,EAAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,eAAe,gBACfA,EAAA,QAAQ,SACRA,EAAA,WAAW,YACXA,EAAA,QAAQ,SACRA,EAAA,QAAQ,SAXAA,IAAAA,KAAA,CAAA,CAAA,GAgGAC,sBAAAA,OACRA,EAAA,QAAQ,SACRA,EAAA,WAAW,YACXA,EAAA,cAAc,eACdA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,UAAU,WACVA,EAAA,UAAU,WACVA,EAAA,oBAAoB,qBACpBA,EAAA,UAAU,WACVA,EAAA,WAAW,YACXA,EAAA,eAAe,gBAXPA,IAAAA,KAAA,CAAA,CAAA,GA0CAC,sBAAAA,OACRA,EAAA,SAAS,UACTA,EAAA,QAAQ,SAFAA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurationTypes-Bt8NVGKp.cjs","sources":["../src/configurationTypes.ts"],"sourcesContent":["export interface ThemeConfigurationFile {\n /**\n * Information the theme loader needs in order to launch your theme.\n */\n launchData: ThemeConfigurationLaunchData;\n /**\n * An object that describes information that's configurable by a Partner when they install your theme.\n */\n configurationSchema?: ThemeConfigurationSchema;\n}\n\nexport enum ThemeFileType {\n Javascript = \"Javascript\",\n CSS = \"CSS\",\n}\n\nexport interface ThemeConfigurationLaunchData {\n /**\n * Files that will be loaded when launching the theme.\n */\n targetFiles: ThemeConfigurationLaunchDataTargetFile[];\n}\n\ninterface LaunchFileBase {\n /**\n * The local path to the file.\n */\n filename: string;\n /**\n * The MIME type of the file.\n */\n mimeType: string;\n}\n\ninterface GenericLaunchFile extends LaunchFileBase {\n type: ThemeFileType.CSS;\n}\n\ninterface JavascriptLaunchFile extends LaunchFileBase {\n /**\n * When `false`, the file will be loaded immediately. When `true`, the file will instead be pre-loaded.\n * With javascript files, this will insert them into the page as `<link rel=\"modulepreload\" ... >`.\n */\n preload?: boolean;\n type: ThemeFileType.Javascript;\n}\n\nexport type ThemeConfigurationLaunchDataTargetFile = GenericLaunchFile | JavascriptLaunchFile;\n\nexport enum FieldType {\n Asset = \"Asset\",\n Boolean = \"Boolean\",\n Color = \"Color\",\n ConversionConfiguration = \"ConversionConfiguration\",\n Heading = \"Heading\",\n List = \"List\",\n Number = \"Number\",\n Object = \"Object\",\n Select = \"Select\",\n Text = \"Text\",\n DateRange = \"DateRange\",\n ProductCollection = \"ProductCollection\",\n MetafieldConfiguration = \"MetafieldConfiguration\",\n}\n\nexport interface ThemeConfigurationSchema {\n /**\n * An array of fields that a Partner can configure when they install the theme.\n */\n fields: ThemeConfigurationSchemaField[];\n\n /**\n * An array of custom schemas that can be reused anywhere on any field.\n */\n customSchemas?: ThemeConfigurationSchemaCustomSchema[];\n}\n\ninterface FieldBase {\n /**\n * The display name for the field. When `type` is `\"Heading\"`, this is the heading string.\n */\n title: string;\n}\n\n/**\n * Base type for a field that is actually configurable by a user.\n */\ninterface ConfigurableField extends FieldBase {\n /**\n * A locally unique identifier for the field.\n */\n key: string;\n /**\n * Optional: A brief description of what the field might be used for. This is displayed beneath the field in the configuration form.\n */\n description?: string;\n}\n\ninterface RequiredOption {\n /**\n * Optional: Set to `true` to require a value to be provided in the configuration form.\n */\n required?: boolean;\n /** Cannot combine required and defaultValue options. */\n readonly defaultValue?: undefined;\n}\n\ntype RequiredOrDefault =\n | RequiredOption\n | {\n /**\n * Optional: A default value to supply. Values are always supplied as strings.\n * When the `type` is `\"Select\"`, this should be one of the `key` fields in the `options` array.\n */\n defaultValue?: string;\n /** Cannot combine required and defaultValue options. */\n readonly required?: undefined;\n };\n\ninterface LimitOption {\n /**\n * Optional: A limit to impose on the input.\n * When the `type` is `\"Text\"`, this is a character limit.\n * When the `type` is `\"List\"`, this is a limit to the number of items in the list.\n * When this value is < 1, or not supplied, it is ignored.\n */\n limit?: number;\n}\n\n/**\n * Generic fields which have no extra configuration and can accept default values from the Theme developer.\n */\ninterface GenericFieldBase extends ConfigurableField {\n type: FieldType.Boolean | FieldType.Color | FieldType.Number | FieldType.DateRange;\n}\n\ntype GenericField = GenericFieldBase & RequiredOrDefault;\n\nexport enum AssetType {\n Color = \"Color\",\n ColorProfile = \"ColorProfile\",\n Data = \"Data\",\n Environment = \"Environment\",\n Font = \"Font\",\n Frame = \"Frame\",\n Illustration = \"Illustration\",\n Image = \"Image\",\n Material = \"Material\",\n Model = \"Model\",\n Video = \"Video\",\n}\n\ninterface AssetField extends ConfigurableField, RequiredOption {\n /**\n * The type of asset, e.g. Image, Model, Font, etc.\n */\n assetType: AssetType;\n type: FieldType.Asset;\n}\n\ninterface ConversionConfigurationField extends ConfigurableField {\n type: FieldType.ConversionConfiguration;\n}\n\ninterface SelectFieldBase extends ConfigurableField {\n /**\n * The options available for the Partner to select in the configuration form.\n */\n options: {\n /**\n * A locally unique identifier (within this set of options).\n */\n key: string;\n /**\n * The string that is displayed visually in the menu item.\n */\n value: string;\n }[];\n type: FieldType.Select;\n}\n\ntype SelectField = SelectFieldBase & RequiredOrDefault;\n\ninterface TextFieldBase extends ConfigurableField, LimitOption {\n /**\n * Allows the Partner to configure the field in a multi-line text editor.\n */\n multiLine?: boolean;\n type: FieldType.Text;\n}\n\ntype TextField = TextFieldBase & RequiredOrDefault;\n\n/**\n * Displays a heading in the Configuration Editor page in Hub.\n */\ninterface HeadingField extends FieldBase {\n type: FieldType.Heading;\n}\n\n/**\n * A list of one specific field type.\n */\ninterface ListField extends ConfigurableField, RequiredOption, LimitOption {\n type: FieldType.List;\n /**\n * Defines the configuration schema for the entries in this list.\n */\n items: DistributiveOmit<ThemeConfigurationConfigurableFields, \"key\" | \"title\" | \"description\">;\n}\n\n/**\n * A collection of any number of different fields.\n */\ninterface ObjectField extends ConfigurableField, RequiredOption {\n type: FieldType.Object;\n /**\n * Defines the configuration schema for the fields in this object.\n */\n fields: ThemeConfigurationSchemaField[];\n /**\n * The schema to use from the `customSchemas` field. Leave this undefined when not using a pre-defined schema.\n */\n schema?: undefined;\n}\n\ninterface CustomObjectField extends Omit<ObjectField, \"fields\" | \"schema\"> {\n schema: string;\n}\n\ninterface ProductCollectionField extends ConfigurableField {\n type: FieldType.ProductCollection;\n}\n\nexport enum MetafieldConfigurationEntityType {\n Asset = \"Asset\",\n Customer = \"Customer\",\n Integration = \"Integration\",\n Option = \"Option\",\n Order = \"Order\",\n Partner = \"Partner\",\n Product = \"Product\",\n ProductCollection = \"ProductCollection\",\n Variant = \"Variant\",\n Workflow = \"Workflow\",\n WorkflowStep = \"WorkflowStep\",\n}\n\ninterface MetafieldConfigurationField extends ConfigurableField {\n type: FieldType.MetafieldConfiguration;\n entityType: MetafieldConfigurationEntityType;\n}\n\n/** https://stackoverflow.com/a/57103940/23523714 */\ntype DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;\n\n/**\n * All field types that are configurable by a user in Hub.\n */\nexport type ThemeConfigurationConfigurableFields =\n | GenericField\n | AssetField\n | ConversionConfigurationField\n | SelectField\n | TextField\n | ListField\n | ObjectField\n | CustomObjectField\n | ProductCollectionField\n | MetafieldConfigurationField;\n\n/**\n * All field types, including non-configurable ones.\n */\nexport type ThemeConfigurationSchemaField = ThemeConfigurationConfigurableFields | HeadingField;\n\nexport enum CustomSchemaType {\n Object = \"Object\",\n Union = \"Union\",\n}\n\ninterface CustomSchemaBase {\n /**\n * A unique name for the schema.\n */\n name: string;\n}\n\n/**\n * A schema for a reusable custom object. This is effectively the same as an ObjectField.\n */\ninterface ObjectCustomSchema extends CustomSchemaBase {\n type: CustomSchemaType.Object;\n /**\n * The text displayed when selecting this type in the configuration UI (when part of a Union)\n */\n title?: string;\n /**\n * Defines the configuration schema for the fields in this object.\n */\n fields: ThemeConfigurationSchemaField[];\n /**\n * Optional: Allows your schema to extend from other object schemas.\n * Useful when you have a base type and want to create variants.\n */\n extends?: string[];\n}\n\n/**\n * A schema for a reusable union of multiple custom object schemas.\n */\ninterface UnionCustomSchema extends CustomSchemaBase {\n type: CustomSchemaType.Union;\n /**\n * All schemas that can be selected for this union.\n */\n schemas: string[];\n}\n\nexport type ThemeConfigurationSchemaCustomSchema = ObjectCustomSchema | UnionCustomSchema;\n\n// TODO: Absolutely need a way to generate a schema from a typescript type.\n"],"names":["ThemeFileType","FieldType","AssetType","MetafieldConfigurationEntityType","CustomSchemaType"],"mappings":"aAWO,IAAKA,GAAAA,IACRA,EAAA,WAAa,aACbA,EAAA,IAAM,MAFEA,IAAAA,GAAA,CAAA,CAAA,EAsCAC,GAAAA,IACRA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,MAAQ,QACRA,EAAA,wBAA0B,0BAC1BA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,KAAO,OACPA,EAAA,UAAY,YACZA,EAAA,kBAAoB,oBACpBA,EAAA,uBAAyB,yBAbjBA,IAAAA,GAAA,CAAA,CAAA,EAyFAC,GAAAA,IACRA,EAAA,MAAQ,QACRA,EAAA,aAAe,eACfA,EAAA,KAAO,OACPA,EAAA,YAAc,cACdA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,aAAe,eACfA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,MAAQ,QACRA,EAAA,MAAQ,QAXAA,IAAAA,GAAA,CAAA,CAAA,EAgGAC,GAAAA,IACRA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,YAAc,cACdA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,kBAAoB,oBACpBA,EAAA,QAAU,UACVA,EAAA,SAAW,WACXA,EAAA,aAAe,eAXPA,IAAAA,GAAA,CAAA,CAAA,EA0CAC,GAAAA,IACRA,EAAA,OAAS,SACTA,EAAA,MAAQ,QAFAA,IAAAA,GAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"configurationTypes-Bt8NVGKp.cjs","sources":["../src/configurationTypes.ts"],"sourcesContent":["export interface ThemeConfigurationFile {\n /**\n * Information the theme loader needs in order to launch your theme.\n */\n launchData: ThemeConfigurationLaunchData;\n /**\n * An object that describes information that's configurable by a Partner when they install your theme.\n */\n configurationSchema?: ThemeConfigurationSchema;\n /**\n * Optional: Settings for how the Spiff Hub displays your theme's configuration fields.\n * If this is not present, all of your fields will be placed in an auto-generated `Misc` page.\n */\n pageSettings?: ThemeConfigurationPageSettings;\n}\n\nexport interface ThemeConfigurationPageSettings {\n /**\n * Settings for each page to display in the Spiff Hub. Use this to group large sections of fields together.\n * Any fields not configured into these pages will be placed in an auto-generated `Misc` page.\n */\n items: ThemeConfigurationPageItem[];\n /**\n * Optional: configuration for which pages can be reordered.\n * All pages which fall between `start` and `end` (inclusive) will be reorderable by the user.\n */\n reorderablePageSettings?: {\n /** The key of the first page which can be reordered. */\n start: string;\n /** The key of the final page which can be reordered. */\n end: string;\n };\n}\n\nexport interface ThemeConfigurationPageItem {\n /**\n * An identifier used for the system to reference this page by.\n * You may also use this to reference the page in your theme at runtime.\n */\n key: string;\n /**\n * The heading to display in the configuration page.\n * This will also be displayed in summary views.\n */\n title: string;\n /**\n * Optional: A sub-heading to display in the configuration page.\n */\n subtitle?: string | null;\n /**\n * Groups of configuration fields to be editable on this page.\n */\n sections: ThemeConfigurationPageSection[];\n /**\n * Whether this page can be disabled/enabled/hidden/visible.\n * Note that fields on page will still be configurable by the user.\n */\n toggleable: boolean;\n /**\n * When true, this page will not be active by default.\n * Note that if you specify `toggleable: true`, this only acts as a default value.\n */\n disabled?: boolean;\n}\n\nexport interface ThemeConfigurationPageSection {\n /** A heading to group these fields by. */\n title: string;\n /** Optional: Sub-heading to display underneath the heading. */\n subtitle?: string | null;\n /**\n * The `key` names of the fields to display in this section.\n * These **must** be static fields.\n */\n fields: string[];\n}\n\nexport enum ThemeFileType {\n Javascript = \"Javascript\",\n CSS = \"CSS\",\n}\n\nexport interface ThemeConfigurationLaunchData {\n /**\n * Files that will be loaded when launching the theme.\n */\n targetFiles: ThemeConfigurationLaunchDataTargetFile[];\n}\n\ninterface LaunchFileBase {\n /**\n * The local path to the file.\n */\n filename: string;\n /**\n * The MIME type of the file.\n */\n mimeType: string;\n}\n\ninterface GenericLaunchFile extends LaunchFileBase {\n type: ThemeFileType.CSS;\n}\n\ninterface JavascriptLaunchFile extends LaunchFileBase {\n /**\n * When `false`, the file will be loaded immediately. When `true`, the file will instead be pre-loaded.\n * With javascript files, this will insert them into the page as `<link rel=\"modulepreload\" ... >`.\n */\n preload?: boolean;\n type: ThemeFileType.Javascript;\n}\n\nexport type ThemeConfigurationLaunchDataTargetFile = GenericLaunchFile | JavascriptLaunchFile;\n\nexport enum FieldType {\n Asset = \"Asset\",\n Boolean = \"Boolean\",\n Color = \"Color\",\n ConversionConfiguration = \"ConversionConfiguration\",\n Heading = \"Heading\",\n List = \"List\",\n Number = \"Number\",\n Object = \"Object\",\n Select = \"Select\",\n Text = \"Text\",\n DateRange = \"DateRange\",\n ProductCollection = \"ProductCollection\",\n MetafieldConfiguration = \"MetafieldConfiguration\",\n}\n\nexport interface ThemeConfigurationSchema {\n /**\n * An array of fields that a Partner can configure when they install the theme.\n */\n fields: ThemeConfigurationSchemaField[];\n\n /**\n * An array of custom schemas that can be reused anywhere on any field.\n */\n customSchemas?: ThemeConfigurationSchemaCustomSchema[];\n}\n\ninterface FieldBase {\n /**\n * The display name for the field. When `type` is `\"Heading\"`, this is the heading string.\n */\n title: string;\n}\n\n/**\n * Base type for a field that is actually configurable by a user.\n */\ninterface ConfigurableField extends FieldBase {\n /**\n * A locally unique identifier for the field.\n */\n key: string;\n /**\n * Optional: A brief description of what the field might be used for. This is displayed beneath the field in the configuration form.\n */\n description?: string;\n}\n\ninterface RequiredOption {\n /**\n * Optional: Set to `true` to require a value to be provided in the configuration form.\n */\n required?: boolean;\n /** Cannot combine required and defaultValue options. */\n readonly defaultValue?: undefined;\n}\n\ntype RequiredOrDefault =\n | RequiredOption\n | {\n /**\n * Optional: A default value to supply. Values are always supplied as strings.\n * When the `type` is `\"Select\"`, this should be one of the `key` fields in the `options` array.\n */\n defaultValue?: string;\n /** Cannot combine required and defaultValue options. */\n readonly required?: undefined;\n };\n\ninterface LimitOption {\n /**\n * Optional: A limit to impose on the input.\n * When the `type` is `\"Text\"`, this is a character limit.\n * When the `type` is `\"List\"`, this is a limit to the number of items in the list.\n * When this value is < 1, or not supplied, it is ignored.\n */\n limit?: number;\n}\n\n/**\n * Generic fields which have no extra configuration and can accept default values from the Theme developer.\n */\ninterface GenericFieldBase extends ConfigurableField {\n type: FieldType.Boolean | FieldType.Color | FieldType.Number | FieldType.DateRange;\n}\n\ntype GenericField = GenericFieldBase & RequiredOrDefault;\n\nexport enum AssetType {\n Color = \"Color\",\n ColorProfile = \"ColorProfile\",\n Data = \"Data\",\n Environment = \"Environment\",\n Font = \"Font\",\n Frame = \"Frame\",\n Illustration = \"Illustration\",\n Image = \"Image\",\n Material = \"Material\",\n Model = \"Model\",\n Video = \"Video\",\n}\n\ninterface AssetField extends ConfigurableField, RequiredOption {\n /**\n * The type of asset, e.g. Image, Model, Font, etc.\n */\n assetType: AssetType;\n type: FieldType.Asset;\n}\n\ninterface ConversionConfigurationField extends ConfigurableField {\n type: FieldType.ConversionConfiguration;\n}\n\ninterface SelectFieldBase extends ConfigurableField {\n /**\n * The options available for the Partner to select in the configuration form.\n */\n options: {\n /**\n * A locally unique identifier (within this set of options).\n */\n key: string;\n /**\n * The string that is displayed visually in the menu item.\n */\n value: string;\n }[];\n type: FieldType.Select;\n}\n\ntype SelectField = SelectFieldBase & RequiredOrDefault;\n\ninterface TextFieldBase extends ConfigurableField, LimitOption {\n /**\n * Allows the Partner to configure the field in a multi-line text editor.\n */\n multiLine?: boolean;\n type: FieldType.Text;\n}\n\ntype TextField = TextFieldBase & RequiredOrDefault;\n\n/**\n * Displays a heading in the Configuration Editor page in Hub.\n */\ninterface HeadingField extends FieldBase {\n type: FieldType.Heading;\n}\n\n/**\n * A list of one specific field type.\n */\ninterface ListField extends ConfigurableField, RequiredOption, LimitOption {\n type: FieldType.List;\n /**\n * Defines the configuration schema for the entries in this list.\n */\n items: DistributiveOmit<ThemeConfigurationConfigurableFields, \"key\" | \"title\" | \"description\">;\n}\n\n/**\n * A collection of any number of different fields.\n */\ninterface ObjectField extends ConfigurableField, RequiredOption {\n type: FieldType.Object;\n /**\n * Defines the configuration schema for the fields in this object.\n */\n fields: ThemeConfigurationSchemaField[];\n /**\n * The schema to use from the `customSchemas` field. Leave this undefined when not using a pre-defined schema.\n */\n schema?: undefined;\n}\n\ninterface CustomObjectField extends Omit<ObjectField, \"fields\" | \"schema\"> {\n schema: string;\n}\n\ninterface ProductCollectionField extends ConfigurableField {\n type: FieldType.ProductCollection;\n}\n\nexport enum MetafieldConfigurationEntityType {\n Asset = \"Asset\",\n Customer = \"Customer\",\n Integration = \"Integration\",\n Option = \"Option\",\n Order = \"Order\",\n Partner = \"Partner\",\n Product = \"Product\",\n ProductCollection = \"ProductCollection\",\n Variant = \"Variant\",\n Workflow = \"Workflow\",\n WorkflowStep = \"WorkflowStep\",\n}\n\ninterface MetafieldConfigurationField extends ConfigurableField {\n type: FieldType.MetafieldConfiguration;\n entityType: MetafieldConfigurationEntityType;\n}\n\n/** https://stackoverflow.com/a/57103940/23523714 */\ntype DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;\n\n/**\n * All field types that are configurable by a user in Hub.\n */\nexport type ThemeConfigurationConfigurableFields =\n | GenericField\n | AssetField\n | ConversionConfigurationField\n | SelectField\n | TextField\n | ListField\n | ObjectField\n | CustomObjectField\n | ProductCollectionField\n | MetafieldConfigurationField;\n\n/**\n * All field types, including non-configurable ones.\n */\nexport type ThemeConfigurationSchemaField = ThemeConfigurationConfigurableFields | HeadingField;\n\nexport enum CustomSchemaType {\n Object = \"Object\",\n Union = \"Union\",\n}\n\ninterface CustomSchemaBase {\n /**\n * A unique name for the schema.\n */\n name: string;\n}\n\n/**\n * A schema for a reusable custom object. This is effectively the same as an ObjectField.\n */\ninterface ObjectCustomSchema extends CustomSchemaBase {\n type: CustomSchemaType.Object;\n /**\n * The text displayed when selecting this type in the configuration UI (when part of a Union)\n */\n title?: string;\n /**\n * Defines the configuration schema for the fields in this object.\n */\n fields: ThemeConfigurationSchemaField[];\n /**\n * Optional: Allows your schema to extend from other object schemas.\n * Useful when you have a base type and want to create variants.\n */\n extends?: string[];\n}\n\n/**\n * A schema for a reusable union of multiple custom object schemas.\n */\ninterface UnionCustomSchema extends CustomSchemaBase {\n type: CustomSchemaType.Union;\n /**\n * All schemas that can be selected for this union.\n */\n schemas: string[];\n}\n\nexport type ThemeConfigurationSchemaCustomSchema = ObjectCustomSchema | UnionCustomSchema;\n\n// TODO: Absolutely need a way to generate a schema from a typescript type.\n"],"names":["ThemeFileType","FieldType","AssetType","MetafieldConfigurationEntityType","CustomSchemaType"],"mappings":"aA6EO,IAAKA,GAAAA,IACRA,EAAA,WAAa,aACbA,EAAA,IAAM,MAFEA,IAAAA,GAAA,CAAA,CAAA,EAsCAC,GAAAA,IACRA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,MAAQ,QACRA,EAAA,wBAA0B,0BAC1BA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,KAAO,OACPA,EAAA,UAAY,YACZA,EAAA,kBAAoB,oBACpBA,EAAA,uBAAyB,yBAbjBA,IAAAA,GAAA,CAAA,CAAA,EAyFAC,GAAAA,IACRA,EAAA,MAAQ,QACRA,EAAA,aAAe,eACfA,EAAA,KAAO,OACPA,EAAA,YAAc,cACdA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,aAAe,eACfA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,MAAQ,QACRA,EAAA,MAAQ,QAXAA,IAAAA,GAAA,CAAA,CAAA,EAgGAC,GAAAA,IACRA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,YAAc,cACdA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,kBAAoB,oBACpBA,EAAA,QAAU,UACVA,EAAA,SAAW,WACXA,EAAA,aAAe,eAXPA,IAAAA,GAAA,CAAA,CAAA,EA0CAC,GAAAA,IACRA,EAAA,OAAS,SACTA,EAAA,MAAQ,QAFAA,IAAAA,GAAA,CAAA,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,69 @@ interface ThemeConfigurationFile {
|
|
|
12
12
|
* An object that describes information that's configurable by a Partner when they install your theme.
|
|
13
13
|
*/
|
|
14
14
|
configurationSchema?: ThemeConfigurationSchema;
|
|
15
|
+
/**
|
|
16
|
+
* Optional: Settings for how the Spiff Hub displays your theme's configuration fields.
|
|
17
|
+
* If this is not present, all of your fields will be placed in an auto-generated `Misc` page.
|
|
18
|
+
*/
|
|
19
|
+
pageSettings?: ThemeConfigurationPageSettings;
|
|
20
|
+
}
|
|
21
|
+
interface ThemeConfigurationPageSettings {
|
|
22
|
+
/**
|
|
23
|
+
* Settings for each page to display in the Spiff Hub. Use this to group large sections of fields together.
|
|
24
|
+
* Any fields not configured into these pages will be placed in an auto-generated `Misc` page.
|
|
25
|
+
*/
|
|
26
|
+
items: ThemeConfigurationPageItem[];
|
|
27
|
+
/**
|
|
28
|
+
* Optional: configuration for which pages can be reordered.
|
|
29
|
+
* All pages which fall between `start` and `end` (inclusive) will be reorderable by the user.
|
|
30
|
+
*/
|
|
31
|
+
reorderablePageSettings?: {
|
|
32
|
+
/** The key of the first page which can be reordered. */
|
|
33
|
+
start: string;
|
|
34
|
+
/** The key of the final page which can be reordered. */
|
|
35
|
+
end: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface ThemeConfigurationPageItem {
|
|
39
|
+
/**
|
|
40
|
+
* An identifier used for the system to reference this page by.
|
|
41
|
+
* You may also use this to reference the page in your theme at runtime.
|
|
42
|
+
*/
|
|
43
|
+
key: string;
|
|
44
|
+
/**
|
|
45
|
+
* The heading to display in the configuration page.
|
|
46
|
+
* This will also be displayed in summary views.
|
|
47
|
+
*/
|
|
48
|
+
title: string;
|
|
49
|
+
/**
|
|
50
|
+
* Optional: A sub-heading to display in the configuration page.
|
|
51
|
+
*/
|
|
52
|
+
subtitle?: string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Groups of configuration fields to be editable on this page.
|
|
55
|
+
*/
|
|
56
|
+
sections: ThemeConfigurationPageSection[];
|
|
57
|
+
/**
|
|
58
|
+
* Whether this page can be disabled/enabled/hidden/visible.
|
|
59
|
+
* Note that fields on page will still be configurable by the user.
|
|
60
|
+
*/
|
|
61
|
+
toggleable: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* When true, this page will not be active by default.
|
|
64
|
+
* Note that if you specify `toggleable: true`, this only acts as a default value.
|
|
65
|
+
*/
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
}
|
|
68
|
+
interface ThemeConfigurationPageSection {
|
|
69
|
+
/** A heading to group these fields by. */
|
|
70
|
+
title: string;
|
|
71
|
+
/** Optional: Sub-heading to display underneath the heading. */
|
|
72
|
+
subtitle?: string | null;
|
|
73
|
+
/**
|
|
74
|
+
* The `key` names of the fields to display in this section.
|
|
75
|
+
* These **must** be static fields.
|
|
76
|
+
*/
|
|
77
|
+
fields: string[];
|
|
15
78
|
}
|
|
16
79
|
declare enum ThemeFileType {
|
|
17
80
|
Javascript = "Javascript",
|
|
@@ -609,4 +672,4 @@ declare function setSpiffDevOptions(container: HTMLElement | string, context: Sp
|
|
|
609
672
|
declare function exampleThemeInstallConfig(opts?: Partial<ThemeInstallConfigurationResource>): ThemeInstallConfigurationResource;
|
|
610
673
|
declare function getDefaultsForSchema(schema: ThemeConfigurationSchema, ...excludeKeys: string[]): ThemeInstallConfigurationFieldResource[];
|
|
611
674
|
|
|
612
|
-
export { type AssetResource, AssetType, type CompleteQuoteMessage, type ConversionConfiguration, type ConversionData, ConversionLocation, CustomSchemaType, FieldType, MetafieldConfigurationEntityType, type MetafieldConfigurationResource, type ProductCollectionResource, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationConfigurableFields, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaCustomSchema, type ThemeConfigurationSchemaCustomSchemaGraphQl, type ThemeConfigurationSchemaCustomSchemaResource, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldGraphQl, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaGraphQl, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsNewBase, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationFieldGraphQl, type ThemeInstallConfigurationFieldResource, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionGraphQl, type ThemeVersionResource, exampleThemeInstallConfig, getDefaultsForSchema, setSpiffDevOptions, themeInstallConfigurationFieldsToRecordObject, themeInstallConfigurationGraphQlToResource, themeInstallConfigurationToRecordObject, themeVersionConfigurationGraphQlToResource, themeVersionGraphQlToResource };
|
|
675
|
+
export { type AssetResource, AssetType, type CompleteQuoteMessage, type ConversionConfiguration, type ConversionData, ConversionLocation, CustomSchemaType, FieldType, MetafieldConfigurationEntityType, type MetafieldConfigurationResource, type ProductCollectionResource, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationConfigurableFields, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationPageItem, type ThemeConfigurationPageSection, type ThemeConfigurationPageSettings, type ThemeConfigurationSchema, type ThemeConfigurationSchemaCustomSchema, type ThemeConfigurationSchemaCustomSchemaGraphQl, type ThemeConfigurationSchemaCustomSchemaResource, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldGraphQl, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaGraphQl, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsNewBase, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationFieldGraphQl, type ThemeInstallConfigurationFieldResource, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionGraphQl, type ThemeVersionResource, exampleThemeInstallConfig, getDefaultsForSchema, setSpiffDevOptions, themeInstallConfigurationFieldsToRecordObject, themeInstallConfigurationGraphQlToResource, themeInstallConfigurationToRecordObject, themeVersionConfigurationGraphQlToResource, themeVersionGraphQlToResource };
|
package/dist/plugin.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./configurationTypes-Bt8NVGKp.cjs"),m=require("fs"),y=require("path"),S="1.27.1-alpha.0",b={version:S};function v(r,s,n){return s.type==="chunk"?(console.log(`chunk ${r} isEntry: ${s.isEntry}, isDynamicEntry: ${s.isDynamicEntry}, isImplicitEntry: ${s.isImplicitEntry}`),!s.isEntry&&!n?null:{type:l.ThemeFileType.Javascript,mimeType:"text/javascript",preload:!s.isEntry,filename:r}):r.endsWith(".css")?{type:l.ThemeFileType.CSS,mimeType:"text/css",filename:r}:null}function E(r){const{autoGenerateTargetFiles:s=!0,configurationSchema:n,pageSettings:e,includePreloadChunks:i=!1,targetFiles:t}=r??{};return{name:"spiff-theme-plugin",version:b.version,config(a,o){a.base!==void 0&&a.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),a.base=""},writeBundle(a,o){if(n&&e){const c=T(n,e);if(c.hasErrors)throw new Error(`Theme pages validation failed: ${JSON.stringify(c)}`)}const u=s?Object.keys(o).map(c=>t?.some(d=>d.filename===c)?null:v(c,o[c],i)).filter(c=>c!==null):[];t&&u.push(...t);const p={launchData:{targetFiles:u},configurationSchema:n,pageSettings:e};m.writeFileSync(y.join(a.dir,"spiffTheme.json"),JSON.stringify(p,void 0,4))}}}function T(r,s){const n=new Map(r.customSchemas?.map(t=>[t.name,t])??[]),e={pages:s.items.map(t=>({sections:t.sections.map(()=>({}))})),hasErrors:!1},i=new Map(s.items.map(t=>[t.key,t]));s.reorderablePageSettings&&(s.reorderablePageSettings.start?i.get(s.reorderablePageSettings.start)||(e.errors=f(e.errors,"reorderablePageSettings.start references page which does not exist"),e.hasErrors=!0):(e.errors=f(e.errors,"reorderablePageSettings.start is not set"),e.hasErrors=!0),s.reorderablePageSettings.end?i.get(s.reorderablePageSettings.end)||(e.errors=f(e.errors,"reorderablePageSettings.end references page which does not exist"),e.hasErrors=!0):(e.errors=f(e.errors,"reorderablePageSettings.end is not set"),e.hasErrors=!0));for(let t=0;t<s.items.length;t++){const a=s.items[t];a.key||(e.pages[t].pageErrors=f(e.pages[t].pageErrors,"missing key"),e.hasErrors=!0);for(let o=0;o<a.sections.length;o++){const u=a.sections[o];for(const p of u.fields){const c=w(r.fields,p,n);typeof c=="string"&&(e.pages[t].sections[o].errors=f(e.pages[t].sections[o].errors,c),e.hasErrors=!0)}}}return e}function f(r,s){return[...r??[],s]}function w(r,s,n){const e=s.split(".");let i;const t=[];for(const a of e)if(t.push(a),i){const o=$(i,a,n);if(typeof o=="string")return`error at path ${t.join(".")}: ${o}`;i=o}else{const o=h(r,a);if(!o)return`unknown root field ${a}`;i=o}return i||"provided path was empty"}function $(r,s,n){if(r.type===l.FieldType.Heading)return`heading field ${r.title} is not a type which has nested properties`;if(r.type!==l.FieldType.Object)return`field ${r.key}, of type ${r.type}, is not a type which has nested properties`;let e=[];if(r.schema){const t=g(r.schema,n);if(typeof t=="string")return`object field ${r.key} has schema errors: ${t}`}else{if(r.schema!==void 0)return`object field ${r.key} references schema via empty string`;e=r.fields}const i=h(e,s);return i||`object field ${r.key} has no property ${s}`}function h(r,s){return r.find(n=>n.type!==l.FieldType.Heading&&n.key===s)}function g(r,s){const n=s.get(r);if(!n)return`unknown schema ${r}`;let e=[];if(n.type===l.CustomSchemaType.Union)for(const i of n.schemas){const t=g(i,s);if(typeof t=="string")return t;e=[...e,...t]}else{if(n.extends)for(const i of n.extends){const t=g(i,s);if(typeof t=="string")return t;e=[...e,...t]}e=[...e,...n.fields]}return e}exports.spiffThemePlugin=E;
|
|
2
2
|
//# sourceMappingURL=plugin.cjs.map
|
package/dist/plugin.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs","sources":["../src/rollup.ts"],"sourcesContent":["import {\n ThemeConfigurationFile,\n ThemeConfigurationLaunchDataTargetFile,\n ThemeConfigurationSchema,\n ThemeFileType,\n} from \"./configurationTypes\";\nimport { Plugin } from \"vite\";\nimport { OutputAsset, OutputChunk } from \"rollup\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport pkg from \"../package.json\";\n\nfunction mapFile(key: string, file: OutputAsset | OutputChunk, includePreload: boolean) {\n if (file.type === \"chunk\") {\n console.log(\n `chunk ${key} isEntry: ${file.isEntry}, isDynamicEntry: ${file.isDynamicEntry}, isImplicitEntry: ${file.isImplicitEntry}`,\n );\n if (!file.isEntry && !includePreload) {\n return null;\n }\n return {\n type: ThemeFileType.Javascript,\n mimeType: \"text/javascript\",\n preload: !file.isEntry,\n filename: key,\n };\n } else {\n if (key.endsWith(\".css\")) {\n return {\n type: ThemeFileType.CSS,\n mimeType: \"text/css\",\n filename: key,\n };\n }\n }\n return null;\n}\n\ninterface PluginOptions {\n /**\n * When `true`, will automatically insert files from the build into the `launchData.targetFiles` field.\n * @default true\n */\n autoGenerateTargetFiles?: boolean;\n /**\n * A configuration schema to allow installs to customize your theme.\n * @default undefined\n */\n configurationSchema?: ThemeConfigurationSchema;\n /**\n * Generates `targetFiles` entries with preload set to true. Only applies when `autoGenerateTargetFiles` is set to true.\n * By default this will only include the primary entry file(s).\n * @default false\n */\n includePreloadChunks?: boolean;\n /**\n * Manually add/override specific files.\n * @default undefined\n */\n targetFiles?: ThemeConfigurationLaunchDataTargetFile[];\n}\n\n/**\n * Automatically generates a `spiffTheme.json` file in your output directory.\n * @param opts Options to customize the generated file.\n */\nexport function spiffThemePlugin(opts?: PluginOptions): Plugin {\n const {\n autoGenerateTargetFiles = true,\n configurationSchema,\n includePreloadChunks = false,\n targetFiles,\n } = opts ?? ({} as PluginOptions);\n return {\n name: \"spiff-theme-plugin\",\n version: pkg.version,\n config(config, _env) {\n if (config.base !== undefined && config.base !== \"\") {\n console.warn(\n 'You have specified a `base` in your vite configuration other than \"\". This value will now be overwritten.',\n );\n }\n config.base = \"\";\n },\n writeBundle(this, options, bundle) {\n const files = autoGenerateTargetFiles\n ? (Object.keys(bundle)\n .map((key) => {\n // Override files will be included manually after\n if (targetFiles?.some((file) => file.filename === key)) {\n return null;\n }\n return mapFile(key, bundle[key], includePreloadChunks);\n })\n .filter((x) => x !== null) as ThemeConfigurationLaunchDataTargetFile[])\n : [];\n if (targetFiles) {\n files.push(...targetFiles);\n }\n const config: ThemeConfigurationFile = {\n launchData: {\n targetFiles: files,\n },\n configurationSchema: configurationSchema,\n };\n fs.writeFileSync(path.join(options.dir!, \"spiffTheme.json\"), JSON.stringify(config, undefined, 4));\n },\n };\n}\n"],"names":["mapFile","key","file","includePreload","ThemeFileType","spiffThemePlugin","opts","autoGenerateTargetFiles","configurationSchema","includePreloadChunks","targetFiles","pkg","config","_env","options","bundle","files","x","fs","path"],"mappings":"gMAYA,SAASA,EAAQC,EAAaC,EAAiCC,EAAyB,CACpF,OAAID,EAAK,OAAS,SACd,QAAQ,IACJ,SAASD,CAAG,aAAaC,EAAK,OAAO,qBAAqBA,EAAK,cAAc,sBAAsBA,EAAK,eAAe,EAAA,EAEvH,CAACA,EAAK,SAAW,CAACC,EACX,KAEJ,CACH,KAAMC,EAAAA,cAAc,WACpB,SAAU,kBACV,QAAS,CAACF,EAAK,QACf,SAAUD,CAAA,GAGVA,EAAI,SAAS,MAAM,EACZ,CACH,KAAMG,EAAAA,cAAc,IACpB,SAAU,WACV,SAAUH,CAAA,EAIf,IACX,CA8BO,SAASI,EAAiBC,EAA8B,CAC3D,KAAM,CACF,wBAAAC,EAA0B,GAC1B,oBAAAC,EACA,qBAAAC,EAAuB,GACvB,YAAAC,CAAA,EACAJ,GAAS,CAAA,EACb,MAAO,CACH,KAAM,qBACN,QAASK,EAAI,QACb,OAAOC,EAAQC,EAAM,CACbD,EAAO,OAAS,QAAaA,EAAO,OAAS,IAC7C,QAAQ,KACJ,2GAAA,EAGRA,EAAO,KAAO,EAClB,EACA,YAAkBE,EAASC,EAAQ,CAC/B,MAAMC,EAAQT,EACP,OAAO,KAAKQ,CAAM,EACd,IAAKd,GAEES,GAAa,KAAMR,GAASA,EAAK,WAAaD,CAAG,EAC1C,KAEJD,EAAQC,EAAKc,EAAOd,CAAG,EAAGQ,CAAoB,CACxD,EACA,OAAQQ,GAAMA,IAAM,IAAI,EAC7B,CAAA,EACFP,GACAM,EAAM,KAAK,GAAGN,CAAW,EAE7B,MAAME,EAAiC,CACnC,WAAY,CACR,YAAaI,CAAA,EAEjB,oBAAAR,CAAA,EAEJU,EAAG,cAAcC,EAAK,KAAKL,EAAQ,IAAM,iBAAiB,EAAG,KAAK,UAAUF,EAAQ,OAAW,CAAC,CAAC,CACrG,CAAA,CAER"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs","sources":["../src/rollup.ts"],"sourcesContent":["import {\n CustomSchemaType,\n FieldType,\n ThemeConfigurationFile,\n ThemeConfigurationLaunchDataTargetFile,\n ThemeConfigurationPageItem,\n ThemeConfigurationPageSettings,\n ThemeConfigurationSchema,\n ThemeConfigurationSchemaCustomSchema,\n ThemeConfigurationSchemaField,\n ThemeFileType,\n} from \"./configurationTypes\";\nimport { Plugin } from \"vite\";\nimport { OutputAsset, OutputChunk } from \"rollup\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport pkg from \"../package.json\";\n\nfunction mapFile(key: string, file: OutputAsset | OutputChunk, includePreload: boolean) {\n if (file.type === \"chunk\") {\n console.log(\n `chunk ${key} isEntry: ${file.isEntry}, isDynamicEntry: ${file.isDynamicEntry}, isImplicitEntry: ${file.isImplicitEntry}`,\n );\n if (!file.isEntry && !includePreload) {\n return null;\n }\n return {\n type: ThemeFileType.Javascript,\n mimeType: \"text/javascript\",\n preload: !file.isEntry,\n filename: key,\n };\n } else {\n if (key.endsWith(\".css\")) {\n return {\n type: ThemeFileType.CSS,\n mimeType: \"text/css\",\n filename: key,\n };\n }\n }\n return null;\n}\n\nexport interface PluginOptions {\n /**\n * When `true`, will automatically insert files from the build into the `launchData.targetFiles` field.\n * @default true\n */\n autoGenerateTargetFiles?: boolean;\n /**\n * A configuration schema to allow installs to customize your theme.\n * @default undefined\n */\n configurationSchema?: ThemeConfigurationSchema;\n /**\n * Options for changing how your theme configuration is displayed to users.\n * This is ignored if `configurationSchema` is not provided.\n * @default undefined.\n */\n pageSettings?: ThemeConfigurationPageSettings;\n /**\n * Generates `targetFiles` entries with preload set to true. Only applies when `autoGenerateTargetFiles` is set to true.\n * By default this will only include the primary entry file(s).\n * @default false\n */\n includePreloadChunks?: boolean;\n /**\n * Manually add/override specific files.\n * @default undefined\n */\n targetFiles?: ThemeConfigurationLaunchDataTargetFile[];\n}\n\n/**\n * Automatically generates a `spiffTheme.json` file in your output directory.\n * @param opts Options to customize the generated file.\n */\nexport function spiffThemePlugin(opts?: PluginOptions): Plugin {\n const {\n autoGenerateTargetFiles = true,\n configurationSchema,\n pageSettings: pages,\n includePreloadChunks = false,\n targetFiles,\n } = opts ?? ({} as PluginOptions);\n return {\n name: \"spiff-theme-plugin\",\n version: pkg.version,\n config(config, _env) {\n if (config.base !== undefined && config.base !== \"\") {\n console.warn(\n 'You have specified a `base` in your vite configuration other than \"\". This value will now be overwritten.',\n );\n }\n config.base = \"\";\n },\n writeBundle(this, options, bundle) {\n if (configurationSchema && pages) {\n const validationResult = validateThemePages(configurationSchema, pages);\n if (validationResult.hasErrors) {\n throw new Error(`Theme pages validation failed: ${JSON.stringify(validationResult)}`);\n }\n }\n\n const files = autoGenerateTargetFiles\n ? (Object.keys(bundle)\n .map((key) => {\n // Override files will be included manually after\n if (targetFiles?.some((file) => file.filename === key)) {\n return null;\n }\n return mapFile(key, bundle[key], includePreloadChunks);\n })\n .filter((x) => x !== null) as ThemeConfigurationLaunchDataTargetFile[])\n : [];\n if (targetFiles) {\n files.push(...targetFiles);\n }\n const config: ThemeConfigurationFile = {\n launchData: {\n targetFiles: files,\n },\n configurationSchema: configurationSchema,\n pageSettings: pages,\n };\n fs.writeFileSync(path.join(options.dir!, \"spiffTheme.json\"), JSON.stringify(config, undefined, 4));\n },\n };\n}\n\ninterface pageError {\n sections: { errors?: string[] }[];\n pageErrors?: string[];\n}\n\ninterface validationErrors {\n pages: pageError[];\n errors?: string[];\n hasErrors: boolean;\n}\n\nfunction validateThemePages(\n configurationSchema: ThemeConfigurationSchema,\n pages: ThemeConfigurationPageSettings,\n): validationErrors {\n const schemaLookup: Map<string, ThemeConfigurationSchemaCustomSchema> = new Map(\n configurationSchema.customSchemas?.map((it) => [it.name, it]) ?? [],\n );\n\n const result: validationErrors = {\n pages: pages.items.map((p) => ({ sections: p.sections.map(() => ({})) })),\n hasErrors: false,\n };\n const pageKeyLookup = new Map<string, ThemeConfigurationPageItem>(pages.items.map((p) => [p.key, p]));\n if (pages.reorderablePageSettings) {\n if (!pages.reorderablePageSettings.start) {\n result.errors = append(result.errors, \"reorderablePageSettings.start is not set\");\n result.hasErrors = true;\n } else if (!pageKeyLookup.get(pages.reorderablePageSettings.start)) {\n result.errors = append(result.errors, \"reorderablePageSettings.start references page which does not exist\");\n result.hasErrors = true;\n }\n if (!pages.reorderablePageSettings.end) {\n result.errors = append(result.errors, \"reorderablePageSettings.end is not set\");\n result.hasErrors = true;\n } else if (!pageKeyLookup.get(pages.reorderablePageSettings.end)) {\n result.errors = append(result.errors, \"reorderablePageSettings.end references page which does not exist\");\n result.hasErrors = true;\n }\n }\n for (let pageIndex = 0; pageIndex < pages.items.length; pageIndex++) {\n const page = pages.items[pageIndex];\n if (!page.key) {\n result.pages[pageIndex].pageErrors = append(result.pages[pageIndex].pageErrors, `missing key`);\n result.hasErrors = true;\n }\n for (let sectionIndex = 0; sectionIndex < page.sections.length; sectionIndex++) {\n const section = page.sections[sectionIndex];\n for (const field of section.fields) {\n const found = getPath(configurationSchema.fields, field, schemaLookup);\n if (typeof found === \"string\") {\n result.pages[pageIndex].sections[sectionIndex].errors = append(\n result.pages[pageIndex].sections[sectionIndex].errors,\n found,\n );\n result.hasErrors = true;\n }\n }\n }\n }\n return result;\n}\n\nfunction append<T>(existing: T[] | undefined, item: T): T[] {\n return [...(existing ?? []), item];\n}\n\nfunction getPath(\n rootFields: ThemeConfigurationSchemaField[],\n path: string,\n schemaLookup: Map<string, ThemeConfigurationSchemaCustomSchema>,\n): ThemeConfigurationSchemaField | string {\n const split = path.split(\".\");\n let field: ThemeConfigurationSchemaField | undefined;\n const currentChain: string[] = [];\n for (const key of split) {\n currentChain.push(key);\n if (!field) {\n // Search the root\n const result = findField(rootFields, key);\n if (!result) {\n return `unknown root field ${key}`;\n }\n field = result;\n } else {\n const result = getNestedField(field, key, schemaLookup);\n if (typeof result === \"string\") {\n return `error at path ${currentChain.join(\".\")}: ${result}`;\n }\n field = result;\n }\n }\n if (!field) {\n return \"provided path was empty\";\n }\n return field;\n}\n\nfunction getNestedField(\n field: ThemeConfigurationSchemaField,\n key: string,\n schemaLookup: Map<string, ThemeConfigurationSchemaCustomSchema>,\n): ThemeConfigurationSchemaField | string {\n if (field.type === FieldType.Heading) {\n return `heading field ${field.title} is not a type which has nested properties`;\n }\n if (field.type !== FieldType.Object) {\n return `field ${field.key}, of type ${field.type}, is not a type which has nested properties`;\n }\n let fields: ThemeConfigurationSchemaField[] = [];\n if (field.schema) {\n const result = getFieldsForCustomSchema(field.schema, schemaLookup);\n if (typeof result === \"string\") {\n return `object field ${field.key} has schema errors: ${result}`;\n }\n } else if (field.schema !== undefined) {\n return `object field ${field.key} references schema via empty string`;\n } else {\n fields = field.fields;\n }\n\n const found = findField(fields, key);\n if (!found) {\n return `object field ${field.key} has no property ${key}`;\n }\n return found;\n}\n\nfunction findField(fields: ThemeConfigurationSchemaField[], key: string): ThemeConfigurationSchemaField | undefined {\n return fields.find((it) => it.type !== FieldType.Heading && it.key === key);\n}\n\nfunction getFieldsForCustomSchema(\n schemaName: string,\n schemaLookup: Map<string, ThemeConfigurationSchemaCustomSchema>,\n): ThemeConfigurationSchemaField[] | string {\n const schema = schemaLookup.get(schemaName);\n if (!schema) {\n return `unknown schema ${schemaName}`;\n }\n let fields: ThemeConfigurationSchemaField[] = [];\n if (schema.type === CustomSchemaType.Union) {\n for (const item of schema.schemas) {\n const result = getFieldsForCustomSchema(item, schemaLookup);\n if (typeof result === \"string\") {\n return result;\n }\n fields = [...fields, ...result];\n }\n } else {\n // Object type\n if (schema.extends) {\n for (const item of schema.extends) {\n const result = getFieldsForCustomSchema(item, schemaLookup);\n if (typeof result === \"string\") {\n return result;\n }\n fields = [...fields, ...result];\n }\n }\n fields = [...fields, ...schema.fields];\n }\n return fields;\n}\n"],"names":["mapFile","key","file","includePreload","ThemeFileType","spiffThemePlugin","opts","autoGenerateTargetFiles","configurationSchema","pages","includePreloadChunks","targetFiles","pkg","config","_env","options","bundle","validationResult","validateThemePages","files","x","fs","path","schemaLookup","it","result","p","pageKeyLookup","append","pageIndex","page","sectionIndex","section","field","found","getPath","existing","item","rootFields","split","currentChain","getNestedField","findField","FieldType","fields","getFieldsForCustomSchema","schemaName","schema","CustomSchemaType"],"mappings":"wMAkBA,SAASA,EAAQC,EAAaC,EAAiCC,EAAyB,CACpF,OAAID,EAAK,OAAS,SACd,QAAQ,IACJ,SAASD,CAAG,aAAaC,EAAK,OAAO,qBAAqBA,EAAK,cAAc,sBAAsBA,EAAK,eAAe,EAAA,EAEvH,CAACA,EAAK,SA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hC,CAAG,EAG/D,CAEA,SAASyC,EAAUE,EAAyC3C,EAAwD,CAChH,OAAO2C,EAAO,KAAMpB,GAAOA,EAAG,OAASmB,EAAAA,UAAU,SAAWnB,EAAG,MAAQvB,CAAG,CAC9E,CAEA,SAAS4C,EACLC,EACAvB,EACwC,CACxC,MAAMwB,EAASxB,EAAa,IAAIuB,CAAU,EAC1C,GAAI,CAACC,EACD,MAAO,kBAAkBD,CAAU,GAEvC,IAAIF,EAA0C,CAAA,EAC9C,GAAIG,EAAO,OAASC,EAAAA,iBAAiB,MACjC,UAAWX,KAAQU,EAAO,QAAS,CAC/B,MAAMtB,EAASoB,EAAyBR,EAAMd,CAAY,EAC1D,GAAI,OAAOE,GAAW,SAClB,OAAOA,EAEXmB,EAAS,CAAC,GAAGA,EAAQ,GAAGnB,CAAM,CAClC,KACG,CAEH,GAAIsB,EAAO,QACP,UAAWV,KAAQU,EAAO,QAAS,CAC/B,MAAMtB,EAASoB,EAAyBR,EAAMd,CAAY,EAC1D,GAAI,OAAOE,GAAW,SAClB,OAAOA,EAEXmB,EAAS,CAAC,GAAGA,EAAQ,GAAGnB,CAAM,CAClC,CAEJmB,EAAS,CAAC,GAAGA,EAAQ,GAAGG,EAAO,MAAM,CACzC,CACA,OAAOH,CACX"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,52 +1,149 @@
|
|
|
1
|
-
import { T as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
version:
|
|
1
|
+
import { T as h, F as p, C as y } from "./configurationTypes-6D808idm.js";
|
|
2
|
+
import E from "fs";
|
|
3
|
+
import S from "path";
|
|
4
|
+
const b = "1.27.1-alpha.0", v = {
|
|
5
|
+
version: b
|
|
6
6
|
};
|
|
7
|
-
function
|
|
8
|
-
return
|
|
9
|
-
`chunk ${
|
|
10
|
-
), !
|
|
11
|
-
type:
|
|
7
|
+
function w(r, s, n) {
|
|
8
|
+
return s.type === "chunk" ? (console.log(
|
|
9
|
+
`chunk ${r} isEntry: ${s.isEntry}, isDynamicEntry: ${s.isDynamicEntry}, isImplicitEntry: ${s.isImplicitEntry}`
|
|
10
|
+
), !s.isEntry && !n ? null : {
|
|
11
|
+
type: h.Javascript,
|
|
12
12
|
mimeType: "text/javascript",
|
|
13
|
-
preload: !
|
|
14
|
-
filename:
|
|
15
|
-
}) :
|
|
16
|
-
type:
|
|
13
|
+
preload: !s.isEntry,
|
|
14
|
+
filename: r
|
|
15
|
+
}) : r.endsWith(".css") ? {
|
|
16
|
+
type: h.CSS,
|
|
17
17
|
mimeType: "text/css",
|
|
18
|
-
filename:
|
|
18
|
+
filename: r
|
|
19
19
|
} : null;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function x(r) {
|
|
22
22
|
const {
|
|
23
|
-
autoGenerateTargetFiles:
|
|
24
|
-
configurationSchema:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
autoGenerateTargetFiles: s = !0,
|
|
24
|
+
configurationSchema: n,
|
|
25
|
+
pageSettings: e,
|
|
26
|
+
includePreloadChunks: i = !1,
|
|
27
|
+
targetFiles: t
|
|
28
|
+
} = r ?? {};
|
|
28
29
|
return {
|
|
29
30
|
name: "spiff-theme-plugin",
|
|
30
|
-
version:
|
|
31
|
-
config(
|
|
32
|
-
|
|
31
|
+
version: v.version,
|
|
32
|
+
config(a, o) {
|
|
33
|
+
a.base !== void 0 && a.base !== "" && console.warn(
|
|
33
34
|
'You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'
|
|
34
|
-
),
|
|
35
|
+
), a.base = "";
|
|
35
36
|
},
|
|
36
|
-
writeBundle(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
writeBundle(a, o) {
|
|
38
|
+
if (n && e) {
|
|
39
|
+
const c = $(n, e);
|
|
40
|
+
if (c.hasErrors)
|
|
41
|
+
throw new Error(`Theme pages validation failed: ${JSON.stringify(c)}`);
|
|
42
|
+
}
|
|
43
|
+
const l = s ? Object.keys(o).map((c) => t?.some((m) => m.filename === c) ? null : w(c, o[c], i)).filter((c) => c !== null) : [];
|
|
44
|
+
t && l.push(...t);
|
|
45
|
+
const u = {
|
|
40
46
|
launchData: {
|
|
41
|
-
targetFiles:
|
|
47
|
+
targetFiles: l
|
|
42
48
|
},
|
|
43
|
-
configurationSchema:
|
|
49
|
+
configurationSchema: n,
|
|
50
|
+
pageSettings: e
|
|
44
51
|
};
|
|
45
|
-
|
|
52
|
+
E.writeFileSync(S.join(a.dir, "spiffTheme.json"), JSON.stringify(u, void 0, 4));
|
|
46
53
|
}
|
|
47
54
|
};
|
|
48
55
|
}
|
|
56
|
+
function $(r, s) {
|
|
57
|
+
const n = new Map(
|
|
58
|
+
r.customSchemas?.map((t) => [t.name, t]) ?? []
|
|
59
|
+
), e = {
|
|
60
|
+
pages: s.items.map((t) => ({ sections: t.sections.map(() => ({})) })),
|
|
61
|
+
hasErrors: !1
|
|
62
|
+
}, i = new Map(s.items.map((t) => [t.key, t]));
|
|
63
|
+
s.reorderablePageSettings && (s.reorderablePageSettings.start ? i.get(s.reorderablePageSettings.start) || (e.errors = f(e.errors, "reorderablePageSettings.start references page which does not exist"), e.hasErrors = !0) : (e.errors = f(e.errors, "reorderablePageSettings.start is not set"), e.hasErrors = !0), s.reorderablePageSettings.end ? i.get(s.reorderablePageSettings.end) || (e.errors = f(e.errors, "reorderablePageSettings.end references page which does not exist"), e.hasErrors = !0) : (e.errors = f(e.errors, "reorderablePageSettings.end is not set"), e.hasErrors = !0));
|
|
64
|
+
for (let t = 0; t < s.items.length; t++) {
|
|
65
|
+
const a = s.items[t];
|
|
66
|
+
a.key || (e.pages[t].pageErrors = f(e.pages[t].pageErrors, "missing key"), e.hasErrors = !0);
|
|
67
|
+
for (let o = 0; o < a.sections.length; o++) {
|
|
68
|
+
const l = a.sections[o];
|
|
69
|
+
for (const u of l.fields) {
|
|
70
|
+
const c = P(r.fields, u, n);
|
|
71
|
+
typeof c == "string" && (e.pages[t].sections[o].errors = f(
|
|
72
|
+
e.pages[t].sections[o].errors,
|
|
73
|
+
c
|
|
74
|
+
), e.hasErrors = !0);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return e;
|
|
79
|
+
}
|
|
80
|
+
function f(r, s) {
|
|
81
|
+
return [...r ?? [], s];
|
|
82
|
+
}
|
|
83
|
+
function P(r, s, n) {
|
|
84
|
+
const e = s.split(".");
|
|
85
|
+
let i;
|
|
86
|
+
const t = [];
|
|
87
|
+
for (const a of e)
|
|
88
|
+
if (t.push(a), i) {
|
|
89
|
+
const o = T(i, a, n);
|
|
90
|
+
if (typeof o == "string")
|
|
91
|
+
return `error at path ${t.join(".")}: ${o}`;
|
|
92
|
+
i = o;
|
|
93
|
+
} else {
|
|
94
|
+
const o = d(r, a);
|
|
95
|
+
if (!o)
|
|
96
|
+
return `unknown root field ${a}`;
|
|
97
|
+
i = o;
|
|
98
|
+
}
|
|
99
|
+
return i || "provided path was empty";
|
|
100
|
+
}
|
|
101
|
+
function T(r, s, n) {
|
|
102
|
+
if (r.type === p.Heading)
|
|
103
|
+
return `heading field ${r.title} is not a type which has nested properties`;
|
|
104
|
+
if (r.type !== p.Object)
|
|
105
|
+
return `field ${r.key}, of type ${r.type}, is not a type which has nested properties`;
|
|
106
|
+
let e = [];
|
|
107
|
+
if (r.schema) {
|
|
108
|
+
const t = g(r.schema, n);
|
|
109
|
+
if (typeof t == "string")
|
|
110
|
+
return `object field ${r.key} has schema errors: ${t}`;
|
|
111
|
+
} else {
|
|
112
|
+
if (r.schema !== void 0)
|
|
113
|
+
return `object field ${r.key} references schema via empty string`;
|
|
114
|
+
e = r.fields;
|
|
115
|
+
}
|
|
116
|
+
const i = d(e, s);
|
|
117
|
+
return i || `object field ${r.key} has no property ${s}`;
|
|
118
|
+
}
|
|
119
|
+
function d(r, s) {
|
|
120
|
+
return r.find((n) => n.type !== p.Heading && n.key === s);
|
|
121
|
+
}
|
|
122
|
+
function g(r, s) {
|
|
123
|
+
const n = s.get(r);
|
|
124
|
+
if (!n)
|
|
125
|
+
return `unknown schema ${r}`;
|
|
126
|
+
let e = [];
|
|
127
|
+
if (n.type === y.Union)
|
|
128
|
+
for (const i of n.schemas) {
|
|
129
|
+
const t = g(i, s);
|
|
130
|
+
if (typeof t == "string")
|
|
131
|
+
return t;
|
|
132
|
+
e = [...e, ...t];
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
if (n.extends)
|
|
136
|
+
for (const i of n.extends) {
|
|
137
|
+
const t = g(i, s);
|
|
138
|
+
if (typeof t == "string")
|
|
139
|
+
return t;
|
|
140
|
+
e = [...e, ...t];
|
|
141
|
+
}
|
|
142
|
+
e = [...e, ...n.fields];
|
|
143
|
+
}
|
|
144
|
+
return e;
|
|
145
|
+
}
|
|
49
146
|
export {
|
|
50
|
-
|
|
147
|
+
x as spiffThemePlugin
|
|
51
148
|
};
|
|
52
149
|
//# sourceMappingURL=plugin.js.map
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["../src/rollup.ts"],"sourcesContent":["import {\n ThemeConfigurationFile,\n ThemeConfigurationLaunchDataTargetFile,\n ThemeConfigurationSchema,\n ThemeFileType,\n} from \"./configurationTypes\";\nimport { Plugin } from \"vite\";\nimport { OutputAsset, OutputChunk } from \"rollup\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport pkg from \"../package.json\";\n\nfunction mapFile(key: string, file: OutputAsset | OutputChunk, includePreload: boolean) {\n if (file.type === \"chunk\") {\n console.log(\n `chunk ${key} isEntry: ${file.isEntry}, isDynamicEntry: ${file.isDynamicEntry}, isImplicitEntry: ${file.isImplicitEntry}`,\n );\n if (!file.isEntry && !includePreload) {\n return null;\n }\n return {\n type: ThemeFileType.Javascript,\n mimeType: \"text/javascript\",\n preload: !file.isEntry,\n filename: key,\n };\n } else {\n if (key.endsWith(\".css\")) {\n return {\n type: ThemeFileType.CSS,\n mimeType: \"text/css\",\n filename: key,\n };\n }\n }\n return null;\n}\n\ninterface PluginOptions {\n /**\n * When `true`, will automatically insert files from the build into the `launchData.targetFiles` field.\n * @default true\n */\n autoGenerateTargetFiles?: boolean;\n /**\n * A configuration schema to allow installs to customize your theme.\n * @default undefined\n */\n configurationSchema?: ThemeConfigurationSchema;\n /**\n * Generates `targetFiles` entries with preload set to true. Only applies when `autoGenerateTargetFiles` is set to true.\n * By default this will only include the primary entry file(s).\n * @default false\n */\n includePreloadChunks?: boolean;\n /**\n * Manually add/override specific files.\n * @default undefined\n */\n targetFiles?: ThemeConfigurationLaunchDataTargetFile[];\n}\n\n/**\n * Automatically generates a `spiffTheme.json` file in your output directory.\n * @param opts Options to customize the generated file.\n */\nexport function spiffThemePlugin(opts?: PluginOptions): Plugin {\n const {\n autoGenerateTargetFiles = true,\n configurationSchema,\n includePreloadChunks = false,\n targetFiles,\n } = opts ?? ({} as PluginOptions);\n return {\n name: \"spiff-theme-plugin\",\n version: pkg.version,\n config(config, _env) {\n if (config.base !== undefined && config.base !== \"\") {\n console.warn(\n 'You have specified a `base` in your vite configuration other than \"\". This value will now be overwritten.',\n );\n }\n config.base = \"\";\n },\n writeBundle(this, options, bundle) {\n const files = autoGenerateTargetFiles\n ? (Object.keys(bundle)\n .map((key) => {\n // Override files will be included manually after\n if (targetFiles?.some((file) => file.filename === key)) {\n return null;\n }\n return mapFile(key, bundle[key], includePreloadChunks);\n })\n .filter((x) => x !== null) as ThemeConfigurationLaunchDataTargetFile[])\n : [];\n if (targetFiles) {\n files.push(...targetFiles);\n }\n const config: ThemeConfigurationFile = {\n launchData: {\n targetFiles: files,\n },\n configurationSchema: configurationSchema,\n };\n fs.writeFileSync(path.join(options.dir!, \"spiffTheme.json\"), JSON.stringify(config, undefined, 4));\n },\n };\n}\n"],"names":["mapFile","key","file","includePreload","ThemeFileType","spiffThemePlugin","opts","autoGenerateTargetFiles","configurationSchema","includePreloadChunks","targetFiles","pkg","config","_env","options","bundle","files","x","fs","path"],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AAG,cAAcC,EAAK,KAAKL,EAAQ,KAAM,iBAAiB,GAAG,KAAK,UAAUF,GAAQ,QAAW,CAAC,CAAC;AAAA,IACrG;AAAA,EAAA;AAER;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["../src/rollup.ts"],"sourcesContent":["import {\n CustomSchemaType,\n FieldType,\n ThemeConfigurationFile,\n ThemeConfigurationLaunchDataTargetFile,\n ThemeConfigurationPageItem,\n ThemeConfigurationPageSettings,\n ThemeConfigurationSchema,\n ThemeConfigurationSchemaCustomSchema,\n ThemeConfigurationSchemaField,\n ThemeFileType,\n} from \"./configurationTypes\";\nimport { Plugin } from \"vite\";\nimport { OutputAsset, OutputChunk } from \"rollup\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport pkg from \"../package.json\";\n\nfunction mapFile(key: string, file: OutputAsset | OutputChunk, includePreload: boolean) {\n if (file.type === \"chunk\") {\n console.log(\n `chunk ${key} isEntry: ${file.isEntry}, isDynamicEntry: ${file.isDynamicEntry}, isImplicitEntry: ${file.isImplicitEntry}`,\n );\n if (!file.isEntry && !includePreload) {\n return null;\n }\n return {\n type: ThemeFileType.Javascript,\n mimeType: \"text/javascript\",\n preload: !file.isEntry,\n filename: key,\n };\n } else {\n if (key.endsWith(\".css\")) {\n return {\n type: ThemeFileType.CSS,\n mimeType: \"text/css\",\n filename: key,\n };\n }\n }\n return null;\n}\n\nexport interface PluginOptions {\n /**\n * When `true`, will automatically insert files from the build into the `launchData.targetFiles` field.\n * @default true\n */\n autoGenerateTargetFiles?: boolean;\n /**\n * A configuration schema to allow installs to customize your theme.\n * @default undefined\n */\n configurationSchema?: ThemeConfigurationSchema;\n /**\n * Options for changing how your theme configuration is displayed to users.\n * This is ignored if `configurationSchema` is not provided.\n * @default undefined.\n */\n pageSettings?: ThemeConfigurationPageSettings;\n /**\n * Generates `targetFiles` entries with preload set to true. Only applies when `autoGenerateTargetFiles` is set to true.\n * By default this will only include the primary entry file(s).\n * @default false\n */\n includePreloadChunks?: boolean;\n /**\n * Manually add/override specific files.\n * @default undefined\n */\n targetFiles?: ThemeConfigurationLaunchDataTargetFile[];\n}\n\n/**\n * Automatically generates a `spiffTheme.json` file in your output directory.\n * @param opts Options to customize the generated file.\n */\nexport function spiffThemePlugin(opts?: PluginOptions): Plugin {\n const {\n autoGenerateTargetFiles = true,\n configurationSchema,\n pageSettings: pages,\n includePreloadChunks = false,\n targetFiles,\n } = opts ?? ({} as PluginOptions);\n return {\n name: \"spiff-theme-plugin\",\n version: pkg.version,\n config(config, _env) {\n if (config.base !== undefined && config.base !== \"\") {\n console.warn(\n 'You have specified a `base` in your vite configuration other than \"\". This value will now be overwritten.',\n );\n }\n config.base = \"\";\n },\n writeBundle(this, options, bundle) {\n if (configurationSchema && pages) {\n const validationResult = validateThemePages(configurationSchema, pages);\n if (validationResult.hasErrors) {\n throw new Error(`Theme pages validation failed: ${JSON.stringify(validationResult)}`);\n }\n }\n\n const files = autoGenerateTargetFiles\n ? (Object.keys(bundle)\n .map((key) => {\n // Override files will be included manually after\n if (targetFiles?.some((file) => file.filename === key)) {\n return null;\n }\n return mapFile(key, bundle[key], includePreloadChunks);\n })\n .filter((x) => x !== null) as ThemeConfigurationLaunchDataTargetFile[])\n : [];\n if (targetFiles) {\n files.push(...targetFiles);\n }\n const config: ThemeConfigurationFile = {\n launchData: {\n targetFiles: files,\n },\n configurationSchema: configurationSchema,\n pageSettings: pages,\n };\n fs.writeFileSync(path.join(options.dir!, \"spiffTheme.json\"), JSON.stringify(config, undefined, 4));\n },\n };\n}\n\ninterface pageError {\n sections: { errors?: string[] }[];\n pageErrors?: string[];\n}\n\ninterface validationErrors {\n pages: pageError[];\n errors?: string[];\n hasErrors: boolean;\n}\n\nfunction validateThemePages(\n configurationSchema: ThemeConfigurationSchema,\n pages: ThemeConfigurationPageSettings,\n): validationErrors {\n const schemaLookup: Map<string, ThemeConfigurationSchemaCustomSchema> = new Map(\n configurationSchema.customSchemas?.map((it) => [it.name, it]) ?? [],\n );\n\n const result: validationErrors = {\n pages: pages.items.map((p) => ({ sections: p.sections.map(() => ({})) })),\n hasErrors: false,\n };\n const pageKeyLookup = new Map<string, ThemeConfigurationPageItem>(pages.items.map((p) => [p.key, p]));\n if (pages.reorderablePageSettings) {\n if (!pages.reorderablePageSettings.start) {\n result.errors = append(result.errors, \"reorderablePageSettings.start is not set\");\n result.hasErrors = true;\n } else if (!pageKeyLookup.get(pages.reorderablePageSettings.start)) {\n result.errors = append(result.errors, \"reorderablePageSettings.start references page which does not exist\");\n result.hasErrors = true;\n }\n if (!pages.reorderablePageSettings.end) {\n result.errors = append(result.errors, \"reorderablePageSettings.end is not set\");\n result.hasErrors = true;\n } else if (!pageKeyLookup.get(pages.reorderablePageSettings.end)) {\n result.errors = append(result.errors, \"reorderablePageSettings.end references page which does not exist\");\n result.hasErrors = true;\n }\n }\n for (let pageIndex = 0; pageIndex < pages.items.length; pageIndex++) {\n const page = pages.items[pageIndex];\n if (!page.key) {\n result.pages[pageIndex].pageErrors = append(result.pages[pageIndex].pageErrors, `missing key`);\n result.hasErrors = true;\n }\n for (let sectionIndex = 0; sectionIndex < page.sections.length; sectionIndex++) {\n const section = page.sections[sectionIndex];\n for (const field of section.fields) {\n const found = getPath(configurationSchema.fields, field, schemaLookup);\n if (typeof found === \"string\") {\n result.pages[pageIndex].sections[sectionIndex].errors = append(\n result.pages[pageIndex].sections[sectionIndex].errors,\n found,\n );\n result.hasErrors = true;\n }\n }\n }\n }\n return result;\n}\n\nfunction append<T>(existing: T[] | undefined, item: T): T[] {\n return [...(existing ?? []), item];\n}\n\nfunction getPath(\n rootFields: ThemeConfigurationSchemaField[],\n path: string,\n schemaLookup: Map<string, ThemeConfigurationSchemaCustomSchema>,\n): ThemeConfigurationSchemaField | string {\n const split = path.split(\".\");\n let field: ThemeConfigurationSchemaField | undefined;\n const currentChain: string[] = [];\n for (const key of split) {\n currentChain.push(key);\n if (!field) {\n // Search the root\n const result = findField(rootFields, key);\n if (!result) {\n return `unknown root field ${key}`;\n }\n field = result;\n } else {\n const result = getNestedField(field, key, schemaLookup);\n if (typeof result === \"string\") {\n return `error at path ${currentChain.join(\".\")}: ${result}`;\n }\n field = result;\n }\n }\n if (!field) {\n return \"provided path was empty\";\n }\n return field;\n}\n\nfunction getNestedField(\n field: ThemeConfigurationSchemaField,\n key: string,\n schemaLookup: Map<string, ThemeConfigurationSchemaCustomSchema>,\n): ThemeConfigurationSchemaField | string {\n if (field.type === FieldType.Heading) {\n return `heading field ${field.title} is not a type which has nested properties`;\n }\n if (field.type !== FieldType.Object) {\n return `field ${field.key}, of type ${field.type}, is not a type which has nested properties`;\n }\n let fields: ThemeConfigurationSchemaField[] = [];\n if (field.schema) {\n const result = getFieldsForCustomSchema(field.schema, schemaLookup);\n if (typeof result === \"string\") {\n return `object field ${field.key} has schema errors: ${result}`;\n }\n } else if (field.schema !== undefined) {\n return `object field ${field.key} references schema via empty string`;\n } else {\n fields = field.fields;\n }\n\n const found = findField(fields, key);\n if (!found) {\n return `object field ${field.key} has no property ${key}`;\n }\n return found;\n}\n\nfunction findField(fields: ThemeConfigurationSchemaField[], key: string): ThemeConfigurationSchemaField | undefined {\n return fields.find((it) => it.type !== FieldType.Heading && it.key === key);\n}\n\nfunction getFieldsForCustomSchema(\n schemaName: string,\n schemaLookup: Map<string, ThemeConfigurationSchemaCustomSchema>,\n): ThemeConfigurationSchemaField[] | string {\n const schema = schemaLookup.get(schemaName);\n if (!schema) {\n return `unknown schema ${schemaName}`;\n }\n let fields: ThemeConfigurationSchemaField[] = [];\n if (schema.type === CustomSchemaType.Union) {\n for (const item of schema.schemas) {\n const result = getFieldsForCustomSchema(item, schemaLookup);\n if (typeof result === \"string\") {\n return result;\n }\n fields = [...fields, ...result];\n }\n } else {\n // Object type\n if (schema.extends) {\n for (const item of schema.extends) {\n const result = getFieldsForCustomSchema(item, schemaLookup);\n if (typeof result === \"string\") {\n return result;\n }\n fields = [...fields, ...result];\n }\n }\n fields = [...fields, ...schema.fields];\n }\n return fields;\n}\n"],"names":["mapFile","key","file","includePreload","ThemeFileType","spiffThemePlugin","opts","autoGenerateTargetFiles","configurationSchema","pages","includePreloadChunks","targetFiles","pkg","config","_env","options","bundle","validationResult","validateThemePages","files","x","fs","path","schemaLookup","it","result","p","pageKeyLookup","append","pageIndex","page","sectionIndex","section","field","found","getPath","existing","item","rootFields","split","currentChain","getNestedField","findField","FieldType","fields","getFieldsForCustomSchema","schemaName","schema","CustomSchemaType"],"mappings":";;;;;;AAkBA,SAASA,EAAQC,GAAaC,GAAiCC,GAAyB;AACpF,SAAID,EAAK,SAAS,WACd,QAAQ;AAAA,IACJ,SAASD,CAAG,aAAaC,EAAK,OAAO,qBAAqBA,EAAK,cAAc,sBAAsBA,EAAK,eAAe;AAAA,EAAA,GAEvH,CAACA,EAAK,WAAW,CAACC,IACX,OAEJ;AAAA,IACH,MAAMC,EAAc;AAAA,IACpB,UAAU;AAAA,IACV,SAAS,CAACF,EAAK;AAAA,IACf,UAAUD;AAAA,EAAA,KAGVA,EAAI,SAAS,MAAM,IACZ;AAAA,IACH,MAAMG,EAAc;AAAA,IACpB,UAAU;AAAA,IACV,UAAUH;AAAA,EAAA,IAIf;AACX;AAoCO,SAASI,EAAiBC,GAA8B;AAC3D,QAAM;AAAA,IACF,yBAAAC,IAA0B;AAAA,IAC1B,qBAAAC;AAAA,IACA,cAAcC;AAAA,IACd,sBAAAC,IAAuB;AAAA,IACvB,aAAAC;AAAA,EAAA,IACAL,KAAS,CAAA;AACb,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAASM,EAAI;AAAA,IACb,OAAOC,GAAQC,GAAM;AACjB,MAAID,EAAO,SAAS,UAAaA,EAAO,SAAS,MAC7C,QAAQ;AAAA,QACJ;AAAA,MAAA,GAGRA,EAAO,OAAO;AAAA,IAClB;AAAA,IACA,YAAkBE,GAASC,GAAQ;AAC/B,UAAIR,KAAuBC,GAAO;AAC9B,cAAMQ,IAAmBC,EAAmBV,GAAqBC,CAAK;AACtE,YAAIQ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AY;AAC1D,UAAI,OAAOE,KAAW;AAClB,eAAOA;AAEX,MAAAmB,IAAS,CAAC,GAAGA,GAAQ,GAAGnB,CAAM;AAAA,IAClC;AAAA,OACG;AAEH,QAAIsB,EAAO;AACP,iBAAWV,KAAQU,EAAO,SAAS;AAC/B,cAAMtB,IAASoB,EAAyBR,GAAMd,CAAY;AAC1D,YAAI,OAAOE,KAAW;AAClB,iBAAOA;AAEX,QAAAmB,IAAS,CAAC,GAAGA,GAAQ,GAAGnB,CAAM;AAAA,MAClC;AAEJ,IAAAmB,IAAS,CAAC,GAAGA,GAAQ,GAAGG,EAAO,MAAM;AAAA,EACzC;AACA,SAAOH;AACX;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spiffcommerce/theme-bridge",
|
|
3
|
-
"version": "1.27.0",
|
|
3
|
+
"version": "1.27.1-alpha.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "SpiffCommerce",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@spiffcommerce/core": "^44.
|
|
36
|
+
"@spiffcommerce/core": "^44.12.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@repo/core": "*"
|