@everymatrix/casino-calendar 1.5.2

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/index.html ADDED
@@ -0,0 +1,32 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <meta name='viewport' content='width=device-width,initial-scale=1'>
6
+
7
+ <title>
8
+ casino-calendar
9
+ </title>
10
+ <link rel="stylesheet" href="public/reset.css">
11
+ <script src='dist/casino-calendar.js'></script>
12
+ </head>
13
+
14
+ <body>
15
+ <style>
16
+ html,body { margin: 0; padding: 0; height: 100%; font-family: "Helvetica Neue", "Helvetica", sans-serif; }
17
+ .header { display: flex; justify-content: center; align-items: center; padding: 10px 20px; margin-bottom: 20px; background: #42a3e2; box-shadow: 3px 4px 5px 0px rgba(0,0,0, .2); }
18
+ .header__logo svg { height: 50px; width: 50px; margin-right: 5px; }
19
+ .header__name { color: #fff; }
20
+ .header__name span { margin-right: 10px; font-weight: bold; }
21
+ .webcomponent { padding: 10px 20px; }
22
+ </style>
23
+
24
+ <div class="webcomponent">
25
+ <casino-calendar
26
+ cmsendpoint="https://wt1-stage.everymatrix.com/apijson"
27
+ lang="en"
28
+ ></casino-calendar>
29
+ </div>
30
+
31
+ </body>
32
+ </html>
package/index.js ADDED
@@ -0,0 +1 @@
1
+ import './dist/casino-calendar.js';
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@everymatrix/casino-calendar",
3
+ "version": "1.5.2",
4
+ "main": "index.js",
5
+ "svelte": "src/index.ts",
6
+ "scripts": {
7
+ "start": "sirv public",
8
+ "build": "cross-env NODE_ENV=production rollup -c",
9
+ "dev": "cross-env NODE_ENV=\"development\" rollup -c -w",
10
+ "validate": "svelte-check",
11
+ "test": "echo"
12
+ },
13
+ "devDependencies": {
14
+ "@rollup/plugin-babel": "^5.3.0",
15
+ "@rollup/plugin-commonjs": "^16.0.0",
16
+ "@rollup/plugin-node-resolve": "^10.0.0",
17
+ "@rollup/plugin-typescript": "^6.0.0",
18
+ "@tsconfig/svelte": "^1.0.0",
19
+ "node-sass": "^5.0.0",
20
+ "rollup": "^2.3.4",
21
+ "rollup-plugin-dev-server": "^0.4.3",
22
+ "rollup-plugin-livereload": "^2.0.0",
23
+ "rollup-plugin-svelte": "^7.0.0",
24
+ "rollup-plugin-terser": "^7.0.0",
25
+ "rollup-plugin-uglify": "^6.0.4",
26
+ "svelte-check": "^1.0.0",
27
+ "svelte-preprocess": "^4.0.0",
28
+ "tslib": "^2.0.0",
29
+ "typescript": "^3.9.3"
30
+ },
31
+ "dependencies": {
32
+ "cross-env": "^7.0.3",
33
+ "sirv-cli": "^1.0.0",
34
+ "svelte": "^3.0.0"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "gitHead": "c0184ad3edaaa8f9ce54289cf544bb0589ef1fbe"
40
+ }
Binary file
@@ -0,0 +1,48 @@
1
+ /* http://meyerweb.com/eric/tools/css/reset/
2
+ v2.0 | 20110126
3
+ License: none (public domain)
4
+ */
5
+
6
+ html, body, div, span, applet, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ b, u, i, center,
12
+ dl, dt, dd, ol, ul, li,
13
+ fieldset, form, label, legend,
14
+ table, caption, tbody, tfoot, thead, tr, th, td,
15
+ article, aside, canvas, details, embed,
16
+ figure, figcaption, footer, header, hgroup,
17
+ menu, nav, output, ruby, section, summary,
18
+ time, mark, audio, video {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ font-size: 100%;
23
+ font: inherit;
24
+ vertical-align: baseline;
25
+ }
26
+ /* HTML5 display-role reset for older browsers */
27
+ article, aside, details, figcaption, figure,
28
+ footer, header, hgroup, menu, nav, section {
29
+ display: block;
30
+ }
31
+ body {
32
+ line-height: 1;
33
+ }
34
+ ol, ul {
35
+ list-style: none;
36
+ }
37
+ blockquote, q {
38
+ quotes: none;
39
+ }
40
+ blockquote:before, blockquote:after,
41
+ q:before, q:after {
42
+ content: '';
43
+ content: none;
44
+ }
45
+ table {
46
+ border-collapse: collapse;
47
+ border-spacing: 0;
48
+ }
@@ -0,0 +1,59 @@
1
+ import svelte from 'rollup-plugin-svelte';
2
+ import commonjs from '@rollup/plugin-commonjs';
3
+ import resolve from '@rollup/plugin-node-resolve';
4
+ import serve from 'rollup-plugin-dev-server';
5
+ import livereload from 'rollup-plugin-livereload';
6
+ import { terser } from 'rollup-plugin-terser';
7
+ import sveltePreprocess from 'svelte-preprocess';
8
+ import typescript from '@rollup/plugin-typescript';
9
+ const production = process.env.NODE_ENV === 'production';
10
+ const dev = process.env.NODE_ENV === 'development';
11
+
12
+ export default {
13
+ input: 'src/index.ts',
14
+ output: {
15
+ sourcemap: true,
16
+ format: 'umd',
17
+ name: 'app',
18
+ file: 'dist/casino-calendar.js'
19
+ },
20
+ plugins: [
21
+ svelte({
22
+ preprocess: sveltePreprocess(),
23
+ compilerOptions: {
24
+ // enable run-time checks when not in production
25
+ customElement: true,
26
+ dev: !production
27
+ }
28
+ }),
29
+ commonjs(),
30
+ resolve({
31
+ browser: true,
32
+ dedupe: ['svelte']
33
+ }),
34
+ dev && serve({
35
+ open: true,
36
+ verbose: true,
37
+ allowCrossOrigin: true,
38
+ historyApiFallback: false,
39
+ host: 'localhost',
40
+ port: 5050,
41
+ }),
42
+ dev && livereload({ watch: ['', 'dist'] }),
43
+ typescript({
44
+ sourceMap: !production,
45
+ inlineSources: !production,
46
+ }),
47
+ // If we're building for production (npm run build
48
+ // instead of npm run dev), minify
49
+ production &&
50
+ terser({
51
+ output: {
52
+ comments: "all"
53
+ },
54
+ })
55
+ ],
56
+ watch: {
57
+ clearScreen: false
58
+ }
59
+ };
@@ -0,0 +1,121 @@
1
+ <svelte:options tag={null} />
2
+ <script lang="ts">
3
+ import { onMount } from "svelte";
4
+ import { isMobile } from 'rvhelper';
5
+
6
+ import '@everymatrix/casino-modal';
7
+ import '@everymatrix/casino-calendar-daily-details';
8
+ import '@everymatrix/casino-calendar-daily-item';
9
+
10
+ export let cmsendpoint:string = '';
11
+ export let lang:string = 'en'; // Language
12
+
13
+ let calendarCollections: any;
14
+ let selectedIndex:number = 0;
15
+
16
+ let isLoading:boolean = true;
17
+ let hasErrors:boolean = false;
18
+ let mobileView:boolean = false;
19
+ let userAgent:string = window.navigator.userAgent;
20
+
21
+ const getCalendarDailyDetails = ():void => {
22
+ fetch(`${cmsendpoint}/${lang}/daily-calendar/`)
23
+ .then((res:any):any => {
24
+ return res.json();
25
+ })
26
+ .then((calendarData:any):void => {
27
+ calendarCollections = calendarData;
28
+ }).catch((err:any):void => {
29
+ console.log(err);
30
+
31
+ hasErrors = true;
32
+ }).finally(():void => {
33
+ isLoading = false;
34
+ });
35
+ }
36
+
37
+ const initialLoad = ():void => {
38
+ getCalendarDailyDetails();
39
+ }
40
+
41
+ const messageHandler = (e:any):void => {
42
+ if (e.data && e.data.type == 'OpenCalendarModal') {
43
+ selectedIndex = e.data.index;
44
+
45
+ window.postMessage({
46
+ type: 'DailyEventsData',
47
+ data: calendarCollections[selectedIndex]?.dailyEvents
48
+ });
49
+ }
50
+ }
51
+
52
+ onMount(() => {
53
+ window.addEventListener('message', messageHandler, false);
54
+
55
+ if (isMobile(userAgent)) {
56
+ mobileView = true;
57
+ }
58
+
59
+ return () => {
60
+ window.removeEventListener('message', messageHandler);
61
+ }
62
+ });
63
+
64
+ $: cmsendpoint && lang && initialLoad();
65
+ </script>
66
+
67
+ {#if hasErrors}
68
+ <p class="SearchLoading" part="SearchLoading">500 Error - Internal Server Error</p>
69
+ {:else}
70
+ {#if isLoading}
71
+ <p class="SearchLoading" part="SearchLoading">Loading ...</p>
72
+ {:else}
73
+ {#if calendarCollections?.length}
74
+ <div class="CasinoCalendarItem {mobileView ? 'Mobile' : ''}">
75
+ {#each calendarCollections as dailyCalendarData, index }
76
+ <casino-calendar-daily-item
77
+ dailybackground={dailyCalendarData.dailyBackground}
78
+ dailyicon={dailyCalendarData.dailyIcon}
79
+ dailyday={dailyCalendarData.dailyDay}
80
+ dailydescription={dailyCalendarData.dailyDescription}
81
+ dailybuttontitle={dailyCalendarData.dailyButtonTitle}
82
+ {index}
83
+ {lang}
84
+ >
85
+ </casino-calendar-daily-item>
86
+ {/each}
87
+ <casino-modal>
88
+ <casino-calendar-daily-details
89
+ dailybackground={calendarCollections[selectedIndex].dailyBackground}
90
+ dailybuttontitle={calendarCollections[selectedIndex].dailyButtonTitle}
91
+ dailyday={calendarCollections[selectedIndex].dailyDay}
92
+ dailydescription={calendarCollections[selectedIndex].dailyDescription}
93
+ dailyicon={calendarCollections[selectedIndex].dailyIcon}
94
+ dailytitle={calendarCollections[selectedIndex].dailyTitle}
95
+ {lang}
96
+ ></casino-calendar-daily-details>
97
+ </casino-modal>
98
+ </div>
99
+ {/if}
100
+ {/if}
101
+ {/if}
102
+
103
+ <style>
104
+ .CasinoCalendarItem {
105
+ display: flex;
106
+ flex-direction: row;
107
+ flex-wrap: nowrap;
108
+ justify-content: flex-start;
109
+ align-items: center;
110
+ align-content: flex-start;
111
+ text-align: left;
112
+ gap: 10px;
113
+ }
114
+
115
+ .Mobile {
116
+ overflow: auto;
117
+ scroll-snap-type: x mandatory;
118
+ -ms-overflow-style: none;
119
+ scrollbar-width: none;
120
+ }
121
+ </style>
package/src/i18n.js ADDED
@@ -0,0 +1,27 @@
1
+ import {
2
+ dictionary,
3
+ locale,
4
+ addMessages,
5
+ _
6
+ } from 'svelte-i18n';
7
+
8
+ function setupI18n({ withLocale: _locale, translations }) {
9
+ locale.subscribe((data) => {
10
+ if (data == null) {
11
+ dictionary.set(translations);
12
+ locale.set(_locale);
13
+ }
14
+ }); // maybe we will need this to make sure that the i18n is set up only once
15
+ /*dictionary.set(translations);
16
+ locale.set(_locale);*/
17
+ }
18
+
19
+ function addNewMessages(lang, dict) {
20
+ addMessages(lang, dict);
21
+ }
22
+
23
+ function setLocale(_locale) {
24
+ locale.set(_locale);
25
+ }
26
+
27
+ export { _, setupI18n, addNewMessages, setLocale };
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ import CasinoCalendar from './CasinoCalendar.svelte';
2
+
3
+ !customElements.get('casino-calendar') && customElements.define('casino-calendar', CasinoCalendar);
4
+ export default CasinoCalendar;
@@ -0,0 +1,10 @@
1
+ export const CasinoCalendar = {
2
+ en: {
3
+ Translations: {
4
+ topCategories: "Top Categories",
5
+ otherCategories: "Other Categories",
6
+ loading: "Loading, please wait...",
7
+ games: "games",
8
+ },
9
+ },
10
+ };
@@ -0,0 +1,13 @@
1
+ import { html } from 'lit-element';
2
+
3
+ import CasinoCalendar from '../src/CasinoCalendar';
4
+
5
+ // This default export determines where your story goes in the story list
6
+ export default {
7
+ title: 'CasinoCalendar',
8
+ };
9
+
10
+ // 👇 We create a “template” of how args map to rendering
11
+ const CasinoCalendar = ({ aProperty }) => html`<casino-calendar></casino-calendar>`;
12
+
13
+ export const FirstStory = CasinoCalendar.bind({});
package/tsconfig.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "@tsconfig/svelte/tsconfig.json",
3
+
4
+ "include": ["src/**/*"],
5
+ "exclude": ["node_modules/*", "__sapper__/*", "public/*"]
6
+ }