@frontify/guideline-blocks-settings 0.0.1-alpha.0 → 0.2.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.
Files changed (58) hide show
  1. package/README.md +6 -7
  2. package/dist/blocks/assetInput.d.ts +25 -0
  3. package/dist/blocks/assetInput.js +16 -0
  4. package/dist/blocks/assetInput.js.map +1 -0
  5. package/dist/blocks/base.d.ts +8 -0
  6. package/dist/blocks/base.js +4 -0
  7. package/dist/blocks/base.js.map +1 -0
  8. package/dist/blocks/checkbox.d.ts +4 -0
  9. package/dist/blocks/checkbox.js +4 -0
  10. package/dist/blocks/checkbox.js.map +1 -0
  11. package/{types → dist}/blocks/checklist.d.ts +1 -4
  12. package/dist/blocks/checklist.js +4 -0
  13. package/dist/blocks/checklist.js.map +1 -0
  14. package/{types → dist}/blocks/choices.d.ts +2 -6
  15. package/dist/blocks/choices.js +4 -0
  16. package/dist/blocks/choices.js.map +1 -0
  17. package/{types → dist}/blocks/colorInput.d.ts +1 -4
  18. package/dist/blocks/colorInput.js +4 -0
  19. package/dist/blocks/colorInput.js.map +1 -0
  20. package/{types → dist}/blocks/dropdown.d.ts +3 -5
  21. package/dist/blocks/dropdown.js +4 -0
  22. package/dist/blocks/dropdown.js.map +1 -0
  23. package/dist/blocks/index.d.ts +19 -0
  24. package/dist/blocks/index.js +23 -0
  25. package/dist/blocks/index.js.map +1 -0
  26. package/{types → dist}/blocks/input.d.ts +1 -4
  27. package/dist/blocks/input.js +4 -0
  28. package/dist/blocks/input.js.map +1 -0
  29. package/{types → dist}/blocks/multiInput.d.ts +1 -4
  30. package/dist/blocks/multiInput.js +4 -0
  31. package/dist/blocks/multiInput.js.map +1 -0
  32. package/{types → dist}/blocks/slider.d.ts +1 -4
  33. package/dist/blocks/slider.js +4 -0
  34. package/dist/blocks/slider.js.map +1 -0
  35. package/dist/blocks/switch.d.ts +10 -0
  36. package/dist/blocks/switch.js +4 -0
  37. package/dist/blocks/switch.js.map +1 -0
  38. package/dist/blocks/templateInput.d.ts +7 -0
  39. package/dist/blocks/templateInput.js +4 -0
  40. package/dist/blocks/templateInput.js.map +1 -0
  41. package/dist/bundle.d.ts +8 -0
  42. package/dist/bundle.js +4 -0
  43. package/dist/bundle.js.map +1 -0
  44. package/dist/index.d.ts +20 -0
  45. package/dist/index.js +25 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/validation.d.ts +4 -0
  48. package/dist/validation.js +4 -0
  49. package/dist/validation.js.map +1 -0
  50. package/package.json +20 -8
  51. package/types/blocks/assetInput.d.ts +0 -12
  52. package/types/blocks/base.d.ts +0 -11
  53. package/types/blocks/checkbox.d.ts +0 -6
  54. package/types/blocks/index.d.ts +0 -20
  55. package/types/blocks/switch.d.ts +0 -29
  56. package/types/bundle.d.ts +0 -12
  57. package/types/index.d.ts +0 -23
  58. package/types/validation.d.ts +0 -6
package/README.md CHANGED
@@ -1,17 +1,19 @@
1
1
  # Block Settings
2
+
2
3
  Provides the block settings types for the guideline-blocks.
3
4
 
4
5
  ## Example
6
+
5
7
  ```ts
6
- import { ApiBundle, ApiSettings } from '@frontify/guideline-blocks-settings';
8
+ import { Bundle, BlockSettings } from '@frontify/guideline-blocks-settings';
7
9
  import { IconEnum } from '@frontify/arcade';
8
10
 
9
- const Settings: ApiSettings = {
11
+ const Settings: BlockSettings = {
10
12
  main: [
11
13
  {
12
14
  id: 'example',
13
15
  type: 'dropdown',
14
- size: 'large',
16
+ size: 'Large',
15
17
  defaultValue: 'solid',
16
18
  choices: [
17
19
  {
@@ -25,7 +27,7 @@ const Settings: ApiSettings = {
25
27
  label: 'Line',
26
28
  },
27
29
  ],
28
- onChange: (bundle: ApiBundle): void => {
30
+ onChange: (bundle: Bundle): void => {
29
31
  const blockWidth = Number(bundle.getBlock('widthCustom')?.value);
30
32
  if (!Number.isNaN(blockWidth)) {
31
33
  bundle.setBlockValue('widthCustom', `${blockWidth}%`);
@@ -34,6 +36,3 @@ const Settings: ApiSettings = {
34
36
  },
35
37
  ],
36
38
  ```
37
-
38
- ## Publish a new version to npm
39
- Use `npm publish` from root of the monorepo to create a new version.
@@ -0,0 +1,25 @@
1
+ import { FileExtension, AssetChooserProjectType, AssetChooserObjectType } from '@frontify/app-bridge';
2
+ import { BaseBlock } from './base';
3
+ export declare enum AssetInputSource {
4
+ Library = "Library",
5
+ Upload = "Upload"
6
+ }
7
+ export declare enum AssetInputMode {
8
+ Both = "Both",
9
+ UploadOnly = "UploadOnly",
10
+ BrowseOnly = "BrowseOnly"
11
+ }
12
+ export declare type AssetInputValue = {
13
+ source: AssetInputSource;
14
+ value: number;
15
+ };
16
+ export declare type AssetInputBlock = {
17
+ type: 'assetInput';
18
+ value?: AssetInputValue | AssetInputValue['value'];
19
+ defaultValue?: AssetInputValue | AssetInputValue['value'];
20
+ multiSelection?: boolean;
21
+ extensions?: FileExtension[];
22
+ projectTypes?: AssetChooserProjectType[];
23
+ objectTypes?: AssetChooserObjectType[];
24
+ mode?: AssetInputMode;
25
+ } & BaseBlock;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AssetInputMode = exports.AssetInputSource = void 0;
5
+ var AssetInputSource;
6
+ (function (AssetInputSource) {
7
+ AssetInputSource["Library"] = "Library";
8
+ AssetInputSource["Upload"] = "Upload";
9
+ })(AssetInputSource = exports.AssetInputSource || (exports.AssetInputSource = {}));
10
+ var AssetInputMode;
11
+ (function (AssetInputMode) {
12
+ AssetInputMode["Both"] = "Both";
13
+ AssetInputMode["UploadOnly"] = "UploadOnly";
14
+ AssetInputMode["BrowseOnly"] = "BrowseOnly";
15
+ })(AssetInputMode = exports.AssetInputMode || (exports.AssetInputMode = {}));
16
+ //# sourceMappingURL=assetInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetInput.js","sourceRoot":"","sources":["../../types/blocks/assetInput.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAKvD,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;AACrB,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B;AAED,IAAY,cAIX;AAJD,WAAY,cAAc;IACtB,+BAAa,CAAA;IACb,2CAAyB,CAAA;IACzB,2CAAyB,CAAA;AAC7B,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB"}
@@ -0,0 +1,8 @@
1
+ import { Bundle } from '../bundle';
2
+ export declare type BaseBlock = {
3
+ id: string;
4
+ label?: string;
5
+ info?: string;
6
+ show?: (bundle: Bundle) => boolean;
7
+ onChange?: (bundle: Bundle) => void;
8
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../types/blocks/base.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -0,0 +1,4 @@
1
+ export declare type Checkbox = {
2
+ id: string;
3
+ label?: string;
4
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../types/blocks/checkbox.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -1,9 +1,6 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
1
  import { BaseBlock } from './base';
4
2
  import { Checkbox } from './checkbox';
5
-
6
- export type ChecklistBlock = {
3
+ export declare type ChecklistBlock = {
7
4
  type: 'checklist';
8
5
  choices: Checkbox[];
9
6
  value?: string[] | null;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=checklist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checklist.js","sourceRoot":"","sources":["../../types/blocks/checklist.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -1,15 +1,11 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
1
  import { IconEnum } from '@frontify/arcade';
4
2
  import { BaseBlock } from './base';
5
-
6
- export type Choice = {
3
+ export declare type Choice = {
7
4
  label?: string | number;
8
5
  icon?: IconEnum;
9
6
  value: string | number;
10
7
  };
11
-
12
- export type ChoicesType = {
8
+ export declare type ChoicesType = {
13
9
  choices: Choice[];
14
10
  value?: string | number;
15
11
  defaultValue: string | number;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=choices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choices.js","sourceRoot":"","sources":["../../types/blocks/choices.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -1,9 +1,6 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
1
  import { Color } from '@frontify/arcade';
4
2
  import { BaseBlock } from './base';
5
-
6
- export type ColorInputBlock = {
3
+ export declare type ColorInputBlock = {
7
4
  type: 'colorInput';
8
5
  value?: Color;
9
6
  defaultValue?: Color;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=colorInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorInput.js","sourceRoot":"","sources":["../../types/blocks/colorInput.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -1,10 +1,8 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
1
+ import { DropdownSize } from '@frontify/arcade';
3
2
  import { ChoicesType } from './choices';
4
-
5
- export type DropdownBlock = {
3
+ export declare type DropdownBlock = {
6
4
  type: 'dropdown';
7
5
  disabled?: boolean;
8
6
  placeholder?: string;
9
- size?: 'Small' | 'Large';
7
+ size?: DropdownSize;
10
8
  } & ChoicesType;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=dropdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../types/blocks/dropdown.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -0,0 +1,19 @@
1
+ import { AssetInputBlock } from './assetInput';
2
+ import { ChecklistBlock } from './checklist';
3
+ import { ColorInputBlock } from './colorInput';
4
+ import { DropdownBlock } from './dropdown';
5
+ import { InputBlock } from './input';
6
+ import { MultiInputBlock } from './multiInput';
7
+ import { SliderBlock } from './slider';
8
+ import { SwitchBlock } from './switch';
9
+ import { TemplateInputBlock } from './templateInput';
10
+ export * from './assetInput';
11
+ export * from './checklist';
12
+ export * from './colorInput';
13
+ export * from './dropdown';
14
+ export * from './input';
15
+ export * from './multiInput';
16
+ export * from './slider';
17
+ export * from './switch';
18
+ export * from './templateInput';
19
+ export declare type SettingBlock = AssetInputBlock | ChecklistBlock | ColorInputBlock | DropdownBlock | InputBlock | MultiInputBlock | SliderBlock | SwitchBlock | TemplateInputBlock;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
6
+ }) : (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ o[k2] = m[k];
9
+ }));
10
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ __exportStar(require("./assetInput"), exports);
15
+ __exportStar(require("./checklist"), exports);
16
+ __exportStar(require("./colorInput"), exports);
17
+ __exportStar(require("./dropdown"), exports);
18
+ __exportStar(require("./input"), exports);
19
+ __exportStar(require("./multiInput"), exports);
20
+ __exportStar(require("./slider"), exports);
21
+ __exportStar(require("./switch"), exports);
22
+ __exportStar(require("./templateInput"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../types/blocks/index.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;;;;;;;;;;AAYvD,+CAA6B;AAC7B,8CAA4B;AAC5B,+CAA6B;AAC7B,6CAA2B;AAC3B,0CAAwB;AACxB,+CAA6B;AAC7B,2CAAyB;AACzB,2CAAyB;AACzB,kDAAgC"}
@@ -1,10 +1,7 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
1
  import { TextInputType } from '@frontify/arcade';
4
2
  import { Rule } from '../validation';
5
3
  import { BaseBlock } from './base';
6
-
7
- export type InputBlock = {
4
+ export declare type InputBlock = {
8
5
  type: 'input';
9
6
  inputType?: TextInputType;
10
7
  placeholder?: string;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../types/blocks/input.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -1,12 +1,9 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
1
  import { MultiInputLayout } from '@frontify/arcade';
4
2
  import { BaseBlock } from './base';
5
3
  import { ColorInputBlock } from './colorInput';
6
4
  import { DropdownBlock } from './dropdown';
7
5
  import { InputBlock } from './input';
8
-
9
- export type MultiInputBlock = {
6
+ export declare type MultiInputBlock = {
10
7
  type: 'multiInput';
11
8
  layout: MultiInputLayout;
12
9
  blocks: (Omit<InputBlock, 'value'> | Omit<ColorInputBlock, 'value'> | Omit<DropdownBlock, 'value'>)[];
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=multiInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiInput.js","sourceRoot":"","sources":["../../types/blocks/multiInput.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -1,8 +1,5 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
1
  import { ChoicesType } from './choices';
4
-
5
- export type SliderBlock = {
2
+ export declare type SliderBlock = {
6
3
  type: 'slider';
7
4
  helperText?: string;
8
5
  } & ChoicesType;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=slider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../types/blocks/slider.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -0,0 +1,10 @@
1
+ import { BaseBlock } from './base';
2
+ import { SettingBlock } from './index';
3
+ export declare type SwitchBlock = {
4
+ type: 'switch';
5
+ switchLabel?: string;
6
+ on?: SettingBlock[];
7
+ off?: SettingBlock[];
8
+ value?: boolean;
9
+ defaultValue: boolean;
10
+ } & BaseBlock;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=switch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../types/blocks/switch.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -0,0 +1,7 @@
1
+ import { BaseBlock } from './base';
2
+ export declare type TemplateInputBlock = {
3
+ type: 'templateInput';
4
+ value?: number;
5
+ defaultValue?: number;
6
+ multiSelection?: boolean;
7
+ } & BaseBlock;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=templateInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateInput.js","sourceRoot":"","sources":["../../types/blocks/templateInput.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -0,0 +1,8 @@
1
+ import { SettingBlock } from './blocks';
2
+ export declare type SettingValue = {
3
+ value?: SettingBlock['value'];
4
+ };
5
+ export declare type Bundle = {
6
+ getBlock: (id: string) => SettingValue | null;
7
+ setBlockValue: (key: string, value: SettingBlock['value']) => void;
8
+ };
package/dist/bundle.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.js","sourceRoot":"","sources":["../types/bundle.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -0,0 +1,20 @@
1
+ import { SettingBlock } from './blocks';
2
+ export * from './blocks';
3
+ export type { BaseBlock } from './blocks/base';
4
+ export type { Bundle, SettingValue } from './bundle';
5
+ export type { Rule } from './validation';
6
+ export declare enum Sections {
7
+ Main = "main",
8
+ Content = "content",
9
+ Layout = "layout",
10
+ Style = "style",
11
+ Security = "security",
12
+ Targets = "targets"
13
+ }
14
+ export declare type BlockSettings = {
15
+ [Sections.Main]?: SettingBlock[];
16
+ [Sections.Content]?: SettingBlock[];
17
+ [Sections.Layout]?: SettingBlock[];
18
+ [Sections.Style]?: SettingBlock[];
19
+ [Sections.Security]?: SettingBlock[];
20
+ };
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
6
+ }) : (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ o[k2] = m[k];
9
+ }));
10
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Sections = void 0;
15
+ __exportStar(require("./blocks"), exports);
16
+ var Sections;
17
+ (function (Sections) {
18
+ Sections["Main"] = "main";
19
+ Sections["Content"] = "content";
20
+ Sections["Layout"] = "layout";
21
+ Sections["Style"] = "style";
22
+ Sections["Security"] = "security";
23
+ Sections["Targets"] = "targets";
24
+ })(Sections = exports.Sections || (exports.Sections = {}));
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../types/index.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;;;;;;;;;;;AAIvD,2CAAyB;AAKzB,IAAY,QAOX;AAPD,WAAY,QAAQ;IAChB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,6BAAiB,CAAA;IACjB,2BAAe,CAAA;IACf,iCAAqB,CAAA;IACrB,+BAAmB,CAAA;AACvB,CAAC,EAPW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAOnB"}
@@ -0,0 +1,4 @@
1
+ export declare type Rule<T> = {
2
+ errorMessage: string;
3
+ validate: (value: T) => boolean;
4
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* (c) Copyright Frontify Ltd., all rights reserved. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../types/validation.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
package/package.json CHANGED
@@ -1,21 +1,33 @@
1
1
  {
2
2
  "name": "@frontify/guideline-blocks-settings",
3
- "version": "0.0.1-alpha.0",
3
+ "version": "0.2.0",
4
4
  "description": "Provides the types for the block settings",
5
+ "sideEffects": false,
6
+ "module": "dist/index.js",
7
+ "main": "dist/index.js",
5
8
  "files": [
6
- "types"
9
+ "dist"
7
10
  ],
11
+ "types": "dist/index.d.ts",
8
12
  "publishConfig": {
9
13
  "access": "public"
10
14
  },
11
- "types": "types/index.d.ts",
12
15
  "author": "Frontify Developers <developers@frontify.com>",
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "lint": "eslint types",
19
+ "lint:fix": "eslint --fix types",
20
+ "prettier": "prettier --check types",
21
+ "prettier:fix": "prettier --write types"
22
+ },
13
23
  "devDependencies": {
14
- "typescript": "4.4.4"
24
+ "@frontify/eslint-config-typescript": "0.14.0",
25
+ "eslint": "8.5.0",
26
+ "prettier": "2.5.1",
27
+ "typescript": "4.5.4"
15
28
  },
16
29
  "dependencies": {
17
- "@frontify/app-bridge": "^2.6.0",
18
- "@frontify/arcade": "^0.12.0"
19
- },
20
- "gitHead": "1b93acd36853dba4103b56903b817816eb86f11f"
30
+ "@frontify/app-bridge": "2.11.0",
31
+ "@frontify/arcade": "0.16.2"
32
+ }
21
33
  }
@@ -1,12 +0,0 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
- import { FileExtension } from '@frontify/app-bridge';
4
- import { AssetInputProps } from '@frontify/arcade';
5
- import { BaseBlock } from './base';
6
-
7
- export type AssetInputBlock = {
8
- type: 'assetInput';
9
- asset?: AssetInputProps['asset'];
10
- value?: number;
11
- allowedExtensions: FileExtension[];
12
- } & BaseBlock;
@@ -1,11 +0,0 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
- import { ApiBundle } from '../bundle';
4
-
5
- export type BaseBlock = {
6
- id: string;
7
- label?: string;
8
- info?: string;
9
- show?: (bundle: ApiBundle) => boolean;
10
- onChange?: (bundle: ApiBundle) => void;
11
- };
@@ -1,6 +0,0 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
- export type Checkbox = {
4
- id: string;
5
- label?: string;
6
- };
@@ -1,20 +0,0 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
- import { AssetInputBlock } from './assetInput';
4
- import { ChecklistBlock } from './checklist';
5
- import { ColorInputBlock } from './colorInput';
6
- import { DropdownBlock } from './dropdown';
7
- import { InputBlock } from './input';
8
- import { MultiInputBlock } from './multiInput';
9
- import { SliderBlock } from './slider';
10
- import { SwitchBlock } from './switch';
11
-
12
- export type ApiBlock =
13
- | AssetInputBlock
14
- | ColorInputBlock
15
- | SwitchBlock
16
- | DropdownBlock
17
- | SliderBlock
18
- | InputBlock
19
- | MultiInputBlock
20
- | ChecklistBlock;
@@ -1,29 +0,0 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
- import { BaseBlock } from './base';
4
- import { AssetInputBlock } from './assetInput';
5
- import { ChecklistBlock } from './checklist';
6
- import { ColorInputBlock } from './colorInput';
7
- import { DropdownBlock } from './dropdown';
8
- import { InputBlock } from './input';
9
- import { MultiInputBlock } from './multiInput';
10
- import { SliderBlock } from './slider';
11
-
12
- export type Block =
13
- | AssetInputBlock
14
- | ChecklistBlock
15
- | ColorInputBlock
16
- | DropdownBlock
17
- | InputBlock
18
- | MultiInputBlock
19
- | SliderBlock
20
- | SwitchBlock;
21
-
22
- export type SwitchBlock = {
23
- type: 'switch';
24
- switchLabel?: string;
25
- on?: Block[];
26
- off?: Block[];
27
- value?: boolean;
28
- defaultValue: boolean;
29
- } & BaseBlock;
package/types/bundle.d.ts DELETED
@@ -1,12 +0,0 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
- import { ApiBlock } from './blocks';
4
-
5
- type ApiField = {
6
- value?: ApiBlock['value'];
7
- };
8
-
9
- export type ApiBundle = {
10
- getBlock: (id: string) => ApiField | null;
11
- setBlockValue: (key: string, value: ApiBlock['value']) => void;
12
- };
package/types/index.d.ts DELETED
@@ -1,23 +0,0 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
- import { ApiBlock } from './blocks';
4
-
5
- export { BaseBlock } from './blocks/base';
6
- export { ApiBundle } from './bundle';
7
-
8
- export enum Sections {
9
- Main = 'main',
10
- Content = 'content',
11
- Layout = 'layout',
12
- Style = 'style',
13
- Security = 'security',
14
- Targets = 'targets',
15
- }
16
-
17
- export type ApiSettings = {
18
- [Sections.Main]?: ApiBlock[];
19
- [Sections.Content]?: ApiBlock[];
20
- [Sections.Layout]?: ApiBlock[];
21
- [Sections.Style]?: ApiBlock[];
22
- [Sections.Security]?: ApiBlock[];
23
- };
@@ -1,6 +0,0 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
- export type Rule<T> = {
4
- errorMessage: string;
5
- validate: (value: T) => boolean;
6
- };