@gxpl/sdk 0.0.1

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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -0
  3. package/dist/Client/Client.d.ts +32 -0
  4. package/dist/Client/Client.js +128 -0
  5. package/dist/Client/Client.test.d.ts +1 -0
  6. package/dist/Client/__mock__/articleMock.d.ts +2 -0
  7. package/dist/Client/__mock__/keyframesMock.d.ts +2 -0
  8. package/dist/Client/__mock__/projectMock.d.ts +2 -0
  9. package/dist/Components/ControlSlider/ControlSlider.d.ts +91 -0
  10. package/dist/Components/ControlSlider/ControlSliderComponent.d.ts +519 -0
  11. package/dist/Components/ImageRevealSlider/ControlImageRevealSliderComponent.d.ts +209 -0
  12. package/dist/Components/ImageRevealSlider/ImageRevealSlider.d.ts +39 -0
  13. package/dist/Components/components.d.ts +2 -0
  14. package/dist/Components/helpers/RichTextRenderer/RichTextRenderer.d.ts +6 -0
  15. package/dist/Components/helpers/SvgImage/SvgImage.d.ts +9 -0
  16. package/dist/Components/utils/scalingValue.d.ts +1 -0
  17. package/dist/FontFaceGenerator/FontFaceGenerator.d.ts +6 -0
  18. package/dist/FontFaceGenerator/FontFaceGenerator.test.d.ts +1 -0
  19. package/dist/ScrollPlaybackVideoManager/ScrollPlaybackVideoManager.d.ts +31 -0
  20. package/dist/VideoDecoder/VideoDecoder.d.ts +12 -0
  21. package/dist/cli.d.ts +10 -0
  22. package/dist/cli.js +64 -0
  23. package/dist/index.d.ts +23 -0
  24. package/dist/index.js +2730 -0
  25. package/dist/index.mjs +2713 -0
  26. package/dist/schemas/article/Article.schema.d.ts +328 -0
  27. package/dist/schemas/article/Article.schema.js +11 -0
  28. package/dist/schemas/article/FillLayer.schema.d.ts +186 -0
  29. package/dist/schemas/article/FillLayer.schema.js +53 -0
  30. package/dist/schemas/article/Interaction.schema.d.ts +103 -0
  31. package/dist/schemas/article/Interaction.schema.js +30 -0
  32. package/dist/schemas/article/Item.schema.d.ts +40 -0
  33. package/dist/schemas/article/Item.schema.js +242 -0
  34. package/dist/schemas/article/ItemArea.schema.d.ts +36 -0
  35. package/dist/schemas/article/ItemArea.schema.js +17 -0
  36. package/dist/schemas/article/ItemBase.schema.d.ts +137 -0
  37. package/dist/schemas/article/ItemBase.schema.js +23 -0
  38. package/dist/schemas/article/ItemState.schema.d.ts +15723 -0
  39. package/dist/schemas/article/ItemState.schema.js +75 -0
  40. package/dist/schemas/article/RichTextItem.schema.d.ts +1372 -0
  41. package/dist/schemas/article/RichTextItem.schema.js +60 -0
  42. package/dist/schemas/article/Section.schema.d.ts +176 -0
  43. package/dist/schemas/article/Section.schema.js +38 -0
  44. package/dist/schemas/keyframe/Keyframes.schema.d.ts +2000 -0
  45. package/dist/schemas/keyframe/Keyframes.schema.js +116 -0
  46. package/dist/schemas/project/Layout.schema.d.ts +17 -0
  47. package/dist/schemas/project/Layout.schema.js +10 -0
  48. package/dist/schemas/project/Project.schema.d.ts +253 -0
  49. package/dist/schemas/project/Project.schema.js +48 -0
  50. package/dist/schemas/shared/FillLayer.schema.d.ts +186 -0
  51. package/dist/sdk.css +1 -0
  52. package/dist/types/article/Article.d.ts +7 -0
  53. package/dist/types/article/Article.js +2 -0
  54. package/dist/types/article/ArticleItemType.d.ts +13 -0
  55. package/dist/types/article/ArticleItemType.js +17 -0
  56. package/dist/types/article/CompoundSettings.d.ts +6 -0
  57. package/dist/types/article/CompoundSettings.js +2 -0
  58. package/dist/types/article/FX.d.ts +23 -0
  59. package/dist/types/article/FX.js +2 -0
  60. package/dist/types/article/Interaction.d.ts +28 -0
  61. package/dist/types/article/Interaction.js +2 -0
  62. package/dist/types/article/Item.d.ts +250 -0
  63. package/dist/types/article/Item.js +3 -0
  64. package/dist/types/article/ItemArea.d.ts +36 -0
  65. package/dist/types/article/ItemArea.js +31 -0
  66. package/dist/types/article/ItemState.d.ts +78 -0
  67. package/dist/types/article/ItemState.js +3 -0
  68. package/dist/types/article/RichText.d.ts +40 -0
  69. package/dist/types/article/RichText.js +27 -0
  70. package/dist/types/article/Section.d.ts +37 -0
  71. package/dist/types/article/Section.js +8 -0
  72. package/dist/types/component/Component.d.ts +15 -0
  73. package/dist/types/keyframe/Keyframe.d.ts +86 -0
  74. package/dist/types/keyframe/Keyframe.js +21 -0
  75. package/dist/types/project/Fonts.d.ts +22 -0
  76. package/dist/types/project/Fonts.js +11 -0
  77. package/dist/types/project/Layout.d.ts +6 -0
  78. package/dist/types/project/Layout.js +2 -0
  79. package/dist/types/project/Meta.d.ts +9 -0
  80. package/dist/types/project/Meta.js +2 -0
  81. package/dist/types/project/Page.d.ts +11 -0
  82. package/dist/types/project/Page.js +2 -0
  83. package/dist/types/project/Project.d.ts +17 -0
  84. package/dist/types/project/Project.js +2 -0
  85. package/dist/utils.d.ts +3 -0
  86. package/package.json +84 -0
  87. package/resources/template.scss.ejs +50 -0
@@ -0,0 +1,86 @@
1
+ import { FillLayer } from '../article/Item';
2
+ export type KeyframeAny = Keyframe<KeyframeType>;
3
+ export interface Keyframe<T extends KeyframeType> {
4
+ id: string;
5
+ type: T;
6
+ layoutId: string;
7
+ itemId: string;
8
+ position: number;
9
+ value: KeyframeValueMap[T];
10
+ }
11
+ export declare enum KeyframeType {
12
+ Dimensions = "dimensions",
13
+ Position = "position",
14
+ Rotation = "rotation",
15
+ BorderRadius = "border-radius",
16
+ BorderWidth = "border-width",
17
+ Opacity = "opacity",
18
+ Scale = "scale",
19
+ TextColor = "text-color",
20
+ LetterSpacing = "letter-spacing",
21
+ WordSpacing = "word-spacing",
22
+ Blur = "blur",
23
+ BackdropBlur = "backdrop-blur",
24
+ FXParams = "fx-params",
25
+ BorderFill = "border-fill",
26
+ Fill = "fill"
27
+ }
28
+ export interface KeyframeValueMap {
29
+ [KeyframeType.Dimensions]: DimensionsValue;
30
+ [KeyframeType.Position]: PositionValue;
31
+ [KeyframeType.Rotation]: RotationValue;
32
+ [KeyframeType.BorderRadius]: BorderRadiusValue;
33
+ [KeyframeType.BorderWidth]: BorderWidthValue;
34
+ [KeyframeType.Opacity]: OpacityValue;
35
+ [KeyframeType.Scale]: ScaleValue;
36
+ [KeyframeType.Blur]: BlurValue;
37
+ [KeyframeType.BackdropBlur]: BackdropBlurValue;
38
+ [KeyframeType.TextColor]: TextColorValue;
39
+ [KeyframeType.LetterSpacing]: LetterSpacingValue;
40
+ [KeyframeType.WordSpacing]: WordSpacingValue;
41
+ [KeyframeType.FXParams]: FXParamsValue;
42
+ [KeyframeType.BorderFill]: BorderFillValue;
43
+ [KeyframeType.Fill]: FillValue;
44
+ }
45
+ interface DimensionsValue {
46
+ width: number;
47
+ height: number;
48
+ }
49
+ interface PositionValue {
50
+ top: number;
51
+ left: number;
52
+ }
53
+ interface RotationValue {
54
+ angle: number;
55
+ }
56
+ interface BorderRadiusValue {
57
+ radius: number;
58
+ }
59
+ interface BorderWidthValue {
60
+ borderWidth: number;
61
+ }
62
+ interface OpacityValue {
63
+ opacity: number;
64
+ }
65
+ interface ScaleValue {
66
+ scale: number;
67
+ }
68
+ interface BlurValue {
69
+ blur: number;
70
+ }
71
+ interface BackdropBlurValue {
72
+ backdropBlur: number;
73
+ }
74
+ interface TextColorValue {
75
+ color: string;
76
+ }
77
+ interface LetterSpacingValue {
78
+ letterSpacing: number;
79
+ }
80
+ interface WordSpacingValue {
81
+ wordSpacing: number;
82
+ }
83
+ type BorderFillValue = FillLayer[];
84
+ type FXParamsValue = Record<string, number>;
85
+ type FillValue = FillLayer[];
86
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyframeType = void 0;
4
+ var KeyframeType;
5
+ (function (KeyframeType) {
6
+ KeyframeType["Dimensions"] = "dimensions";
7
+ KeyframeType["Position"] = "position";
8
+ KeyframeType["Rotation"] = "rotation";
9
+ KeyframeType["BorderRadius"] = "border-radius";
10
+ KeyframeType["BorderWidth"] = "border-width";
11
+ KeyframeType["Opacity"] = "opacity";
12
+ KeyframeType["Scale"] = "scale";
13
+ KeyframeType["TextColor"] = "text-color";
14
+ KeyframeType["LetterSpacing"] = "letter-spacing";
15
+ KeyframeType["WordSpacing"] = "word-spacing";
16
+ KeyframeType["Blur"] = "blur";
17
+ KeyframeType["BackdropBlur"] = "backdrop-blur";
18
+ KeyframeType["FXParams"] = "fx-params";
19
+ KeyframeType["BorderFill"] = "border-fill";
20
+ KeyframeType["Fill"] = "fill";
21
+ })(KeyframeType || (exports.KeyframeType = KeyframeType = {}));
@@ -0,0 +1,22 @@
1
+ export declare enum FontFileTypes {
2
+ OTF = "otf",
3
+ TTF = "ttf",
4
+ WOFF = "woff",
5
+ WOFF2 = "woff2",
6
+ EOT = "eot"
7
+ }
8
+ export interface CustomFontFile {
9
+ type: FontFileTypes;
10
+ url: string;
11
+ }
12
+ export interface CustomFont {
13
+ name: string;
14
+ style: string;
15
+ weight: number;
16
+ files: CustomFontFile[];
17
+ }
18
+ export interface Fonts {
19
+ google: string;
20
+ adobe: string;
21
+ custom: CustomFont[];
22
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FontFileTypes = void 0;
4
+ var FontFileTypes;
5
+ (function (FontFileTypes) {
6
+ FontFileTypes["OTF"] = "otf";
7
+ FontFileTypes["TTF"] = "ttf";
8
+ FontFileTypes["WOFF"] = "woff";
9
+ FontFileTypes["WOFF2"] = "woff2";
10
+ FontFileTypes["EOT"] = "eot";
11
+ })(FontFileTypes || (exports.FontFileTypes = FontFileTypes = {}));
@@ -0,0 +1,6 @@
1
+ export interface Layout {
2
+ id: string;
3
+ title: string;
4
+ startsWith: number;
5
+ exemplary: number;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export interface Meta extends GenericMeta {
2
+ favicon?: string;
3
+ }
4
+ export interface GenericMeta {
5
+ title?: string;
6
+ description?: string;
7
+ opengraphThumbnail?: string;
8
+ keywords?: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { GenericMeta } from './Meta';
2
+ export interface PageMeta extends GenericMeta {
3
+ enabled?: boolean;
4
+ }
5
+ export interface Page {
6
+ id: string;
7
+ title: string;
8
+ articleId: string;
9
+ slug: string;
10
+ meta?: PageMeta;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import { Layout } from './Layout';
2
+ import { Fonts } from './Fonts';
3
+ import { Meta } from './Meta';
4
+ import { Page } from './Page';
5
+ export interface AdditionalHTML {
6
+ head: string;
7
+ afterBodyOpen: string;
8
+ beforeBodyClose: string;
9
+ }
10
+ export interface Project {
11
+ id: string;
12
+ html: AdditionalHTML;
13
+ meta: Meta;
14
+ layouts: Layout[];
15
+ pages: Page[];
16
+ fonts: Fonts;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { Layout } from './types/project/Layout';
2
+ export declare function getLayoutStyles<V, M>(layouts: Layout[], layoutValues: Record<string, V>[], mapToStyles: (values: V[], exemplary: number) => M): string;
3
+ export declare function getLayoutMediaQuery(layoutId: string, layouts: Layout[]): string;
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "@gxpl/sdk",
3
+ "version": "0.0.1",
4
+ "description": "Generic SDK for use in public websites.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "style": "dist/sdk.css",
9
+ "sideEffects": [
10
+ "**/*.css"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.mjs",
16
+ "require": "./dist/index.js"
17
+ },
18
+ "./style/sdk.css": {
19
+ "default": "./dist/sdk.css"
20
+ }
21
+ },
22
+ "scripts": {
23
+ "test": "jest",
24
+ "dev": "vite development",
25
+ "prebuild": "rimraf ./dist",
26
+ "build": "vite build && tsc --project tsconfig.build.json",
27
+ "prepublishOnly": "cross-env NODE_ENV=production npm run build"
28
+ },
29
+ "bin": {
30
+ "gxpl-sdk": "dist/cli.js"
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "resources"
35
+ ],
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/genesisxplatform/sdk.git"
39
+ },
40
+ "author": "arsen@momdesign.nyc",
41
+ "license": "MIT",
42
+ "bugs": {
43
+ "url": "https://github.com/genesisxplatform/sdk/issues"
44
+ },
45
+ "homepage": "https://github.com/genesisxplatform/sdk#readme",
46
+ "directories": {
47
+ "lib": "dist"
48
+ },
49
+ "dependencies": {
50
+ "@splidejs/react-splide": "^0.7.12",
51
+ "@types/ejs": "^3.1.2",
52
+ "@types/isomorphic-fetch": "^0.0.36",
53
+ "@types/ua-parser-js": "^0.7.39",
54
+ "classnames": "^2.5.1",
55
+ "commander": "^10.0.1",
56
+ "dotenv": "^16.1.3",
57
+ "ejs": "^3.1.9",
58
+ "isomorphic-fetch": "^3.0.0",
59
+ "mp4box": "^0.5.2",
60
+ "styled-jsx": "^5.1.6",
61
+ "ts-node": "^10.9.1",
62
+ "ua-parser-js": "^1.0.37",
63
+ "url": "^0.11.0",
64
+ "zod": "^3.22.4"
65
+ },
66
+ "devDependencies": {
67
+ "@tsconfig/node16": "^1.0.3",
68
+ "@tsconfig/recommended": "^1.0.1",
69
+ "@types/jest": "^29.0.0",
70
+ "@types/node": "^18.11.7",
71
+ "@types/react": "^18.2.0",
72
+ "@types/react-dom": "^18.2.0",
73
+ "@vitejs/plugin-react": "^4.3.4",
74
+ "cross-env": "^10.1.0",
75
+ "jest": "^28.1.3",
76
+ "react": "^18.2.0",
77
+ "react-dom": "^18.2.0",
78
+ "sass": "^1.86.3",
79
+ "ts-jest": "^28.0.8",
80
+ "typescript": "^5.2.2",
81
+ "vite": "^6.2.5",
82
+ "vite-plugin-dts": "^4.5.3"
83
+ }
84
+ }
@@ -0,0 +1,50 @@
1
+ // CAUTION: THIS FILE IS AUTO-GENERATED BASED ON
2
+ // LAYOUT CONFIGURATION IN YOUR CNTRL PROJECT
3
+ // WE HIGHLY ADVICE YOU TO NOT CHANGE IT MANUALLY
4
+ @use "sass:map";
5
+
6
+ $__CNTRL_LAYOUT_WIDTH__: <%= ranges[0].exemplary %>;
7
+
8
+ $layout: (
9
+ <% ranges.forEach(function(range) { %>
10
+ <%= range.name %>: (
11
+ start: <%= range.start %>,
12
+ end: <%= range.end %>,
13
+ exemplary: <%= range.exemplary %>,
14
+ isFirst: <%= range.isFirst %>,
15
+ isLast: <%= range.isLast %>
16
+ ),
17
+ <% }); %>
18
+ );
19
+
20
+ @function size($value) {
21
+ @return #{$value/$__CNTRL_LAYOUT_WIDTH__*100}vw;
22
+ }
23
+
24
+ @mixin for($name) {
25
+ $start: map.get(map.get($layout, $name), "start");
26
+ $end: map.get(map.get($layout, $name), "end");
27
+ $isFirst: map.get(map.get($layout, $name), "isFirst");
28
+ $isLast: map.get(map.get($layout, $name), "isLast");
29
+ $exemplary: map.get(map.get($layout, $name), "exemplary");
30
+ $__CNTRL_LAYOUT_WIDTH__: $exemplary !global;
31
+
32
+ @if $isFirst == true and $isLast == true {
33
+ @content;
34
+ } @else if $isFirst == true {
35
+ @media (max-width: #{$end}px) {
36
+ @content;
37
+ }
38
+ } @else if $isLast == true {
39
+ @media (min-width: #{$start}px) {
40
+ @content;
41
+ }
42
+ } @else {
43
+ @media (min-width: #{$start}px) and (max-width: #{$end}px) {
44
+ @content;
45
+ }
46
+ }
47
+
48
+ // reset global variable back to first layout's exemplary (mobile-first)
49
+ $__CNTRL_LAYOUT_WIDTH__: <%= ranges[0].exemplary %> !global;
50
+ }