@everymatrix/lottery-program-wof 1.3.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.
Files changed (65) hide show
  1. package/README.md +30 -0
  2. package/dist/lottery-program-wof.js +7278 -0
  3. package/dist/lottery-program-wof.js.map +1 -0
  4. package/index.html +42 -0
  5. package/index.js +1 -0
  6. package/package.json +41 -0
  7. package/public/favicon.png +0 -0
  8. package/public/reset.css +48 -0
  9. package/rollup.config.js +61 -0
  10. package/src/LotteryProgramWof.svelte +129 -0
  11. package/src/api/api.ts +2011 -0
  12. package/src/api/configuration.ts +65 -0
  13. package/src/api/custom.d.ts +2 -0
  14. package/src/api/index.ts +15 -0
  15. package/src/business.dom.ts +130 -0
  16. package/src/business.fake.ts +17 -0
  17. package/src/business.ts +276 -0
  18. package/src/calc.image.ts +13 -0
  19. package/src/calc.point.ts +315 -0
  20. package/src/calc.temp.ts +29 -0
  21. package/src/calc.ts +34 -0
  22. package/src/class.spinable.ts +65 -0
  23. package/src/class.spinable.util.ts +10 -0
  24. package/src/class.spinner.ts +145 -0
  25. package/src/class.spinner.util.ts +92 -0
  26. package/src/css.state.ts +13 -0
  27. package/src/fakeDraw.ts +9 -0
  28. package/src/fakeResult.ts +49 -0
  29. package/src/images/area.svg +11 -0
  30. package/src/images/areaSec.svg +11 -0
  31. package/src/images/areaV1.svg +18 -0
  32. package/src/images/areaV2.svg +17 -0
  33. package/src/images/background.svg +27 -0
  34. package/src/images/background3.svg +13 -0
  35. package/src/images/backgroundShadow.svg +22 -0
  36. package/src/images/centerArrow.svg +50 -0
  37. package/src/images/centerArrow1.svg +18 -0
  38. package/src/images/centerArrow2.svg +5 -0
  39. package/src/images/centerArrow3.svg +46 -0
  40. package/src/images/centerArrowBg.svg +12 -0
  41. package/src/images/centerBackground2.svg +24 -0
  42. package/src/images/centerCircle.svg +24 -0
  43. package/src/images/centerPack.svg +16 -0
  44. package/src/images/centerText3.svg +3 -0
  45. package/src/images/gift.svg +964 -0
  46. package/src/images/light.svg +19 -0
  47. package/src/images/partition1.svg +10 -0
  48. package/src/images/pointerArrow.svg +24 -0
  49. package/src/images/pointerArrow3.svg +25 -0
  50. package/src/images/spin.svg +13 -0
  51. package/src/index.ts +4 -0
  52. package/src/message.ts +28 -0
  53. package/src/private.item.svelte +279 -0
  54. package/src/private.item.svg.svelte +791 -0
  55. package/src/private.message.svelte +167 -0
  56. package/src/private.outcomes.svelte +163 -0
  57. package/src/private.tabs.svelte +92 -0
  58. package/src/themes.partitions.ts +174 -0
  59. package/src/themes.ts +206 -0
  60. package/src/types.business.ts +4 -0
  61. package/src/types.ts +74 -0
  62. package/src/util.ts +83 -0
  63. package/stories/LotteryProgramWof.stories.js +13 -0
  64. package/svelte.config.js +7 -0
  65. package/tsconfig.json +6 -0
package/src/themes.ts ADDED
@@ -0,0 +1,206 @@
1
+ import { partitions1, partitions2, partitions3 } from "./themes.partitions"
2
+
3
+ const sizeSchema1 = {
4
+ radius : 247,
5
+ rRingInner: 253,
6
+ rRingOuter: 294,
7
+ rBg1: 300,
8
+ }
9
+
10
+ const sizeSchema2 = {
11
+ radius : 253,
12
+ rRingInner: 259,
13
+ rRingOuter: 280,
14
+ rBg1: 286,
15
+ }
16
+
17
+ const backgroundSchema1 = {
18
+ isShowingBulb: false,
19
+ base: {
20
+ linearGradient: {
21
+ steps: [
22
+ {
23
+ offset: 0,
24
+ color: '#FFB915',
25
+ },
26
+ {
27
+ offset: 0.24,
28
+ color: '#BF8500',
29
+ },
30
+ {
31
+ offset: 0.41,
32
+ color: '#FFE26A',
33
+ },
34
+ {
35
+ offset: 0.46,
36
+ color: '#FFDD63',
37
+ },
38
+ {
39
+ offset: 0.53,
40
+ color: '#FFCF51',
41
+ },
42
+ {
43
+ offset: 0.58,
44
+ color: '#FFC13F',
45
+ },
46
+ {
47
+ offset: 0.82,
48
+ color: '#FFB915',
49
+ },
50
+ {
51
+ offset: 1,
52
+ color: '#FFF100',
53
+ },
54
+ ]
55
+ }
56
+ },
57
+ small: {
58
+ linearGradient: {
59
+ steps: [
60
+ {
61
+ offset: 0.4,
62
+ color: "#303030",
63
+ },
64
+ {
65
+ offset: 1,
66
+ color: "#000604",
67
+ },
68
+ ]
69
+ }
70
+ }
71
+
72
+
73
+ }
74
+
75
+ const backgroundSchema2 = {
76
+ isShowingBulb: true,
77
+ base: {
78
+ linearGradient: {
79
+ steps: [
80
+ {
81
+ offset: "0.00312487",
82
+ color: "#454545",
83
+ },
84
+ {
85
+ offset: "0.310417",
86
+ },
87
+ {
88
+ offset: "0.628125",
89
+ color: "#575757",
90
+ },
91
+ {
92
+ offset: "1",
93
+ },
94
+ ]
95
+ }
96
+ },
97
+ small: {
98
+ linearGradient: {
99
+ steps: [
100
+ {
101
+ offset: "0.0604165",
102
+ color: "#FFB915",
103
+ },
104
+ {
105
+ offset: "0.2375",
106
+ color: "#B6820A",
107
+ },
108
+ {
109
+ offset: "0.477083",
110
+ color: "#FFE685",
111
+ },
112
+ {
113
+ offset: "0.721875",
114
+ color: "#FFB915",
115
+ },
116
+ {
117
+ offset: "1",
118
+ color: "#FFD600",
119
+ },
120
+ ]
121
+ }
122
+ }
123
+ }
124
+
125
+ const backgroundSchema3 = {
126
+ isShowingBulb: false,
127
+ base: {
128
+ linearGradient: {
129
+ steps: [
130
+ {
131
+ offset: 0,
132
+ color: '#FEDC31',
133
+ },
134
+ {
135
+ offset: 0.09,
136
+ color: '#FDC347',
137
+ },
138
+ {
139
+ offset: 0.27,
140
+ color: '#FC8682',
141
+ },
142
+ {
143
+ offset: 0.52,
144
+ color: '#FA2CD7',
145
+ },
146
+ {
147
+ offset: 0.76,
148
+ color: '#987CDB',
149
+ },
150
+ {
151
+ offset: 1,
152
+ color: '#33D0E0',
153
+ },
154
+ ]
155
+ }
156
+ },
157
+ small: {
158
+ linearGradient: {
159
+ steps: [
160
+ {
161
+ offset: 0.4,
162
+ color: "#303030",
163
+ },
164
+ {
165
+ offset: 1,
166
+ color: "#000604",
167
+ },
168
+ ]
169
+ }
170
+ }
171
+
172
+
173
+ }
174
+
175
+ export const themes = [
176
+ {
177
+ size: sizeSchema1,
178
+ background: backgroundSchema1,
179
+ partitions: partitions1,
180
+ },
181
+ {
182
+ size: sizeSchema2,
183
+ background: backgroundSchema2,
184
+ partitions: partitions1,
185
+ },
186
+ {
187
+ size: sizeSchema1,
188
+ background: backgroundSchema3,
189
+ partitions: partitions2,
190
+ },
191
+ {
192
+ size: sizeSchema1,
193
+ background: backgroundSchema1,
194
+ partitions: partitions3,
195
+ },
196
+ {
197
+ size: sizeSchema1,
198
+ background: backgroundSchema1,
199
+ partitions: partitions3,
200
+ },
201
+ {
202
+ size: sizeSchema2,
203
+ background: backgroundSchema2,
204
+ partitions: partitions3,
205
+ },
206
+ ]
@@ -0,0 +1,4 @@
1
+ import type { LotteryProgramILotteryProgramForPlayer } from "./api";
2
+
3
+
4
+ export type LotteryProgramForPlayer = LotteryProgramILotteryProgramForPlayer
package/src/types.ts ADDED
@@ -0,0 +1,74 @@
1
+ declare global {
2
+ namespace svelte.JSX {
3
+ interface SVGProps<T> {
4
+ part?: string
5
+ }
6
+ }
7
+ }
8
+
9
+ export interface Point {
10
+ x: number;
11
+ y: number;
12
+ }
13
+
14
+ export enum PointerMode {
15
+ Arrow = "Arrow",
16
+ Partition = "Partition",
17
+ }
18
+
19
+ export enum ArrowMode {
20
+ DownFromTop = "DownFromTop",
21
+ UpFromCenter = "UpFromCenter",
22
+ DownFromCenter = "DownFromCenter",
23
+ UpFromBottom = "UpFromBottom",
24
+ }
25
+
26
+ export enum Api {
27
+ lotteries = 'lotteries',
28
+ outcome = 'outcome',
29
+ draw = 'draw',
30
+ }
31
+
32
+ export interface ApiConfigs {
33
+ [Api.lotteries]: {
34
+ session?: string
35
+ },
36
+ [Api.outcome]: {
37
+ session?: string
38
+ id: string
39
+ },
40
+ [Api.draw]: {
41
+ session?: string
42
+ id: string
43
+ },
44
+
45
+ }
46
+
47
+ export enum Lang {
48
+ en = 'en',
49
+ fr = 'fr',
50
+ de = 'de',
51
+ tr = 'tr'
52
+ }
53
+
54
+ type StringWithLang = {
55
+ [key in Lang]: string
56
+ }
57
+
58
+ export interface Partition {
59
+ name: StringWithLang
60
+ image1: StringWithLang
61
+ image2: StringWithLang
62
+ image3: StringWithLang
63
+ }
64
+
65
+
66
+ export enum Tab {
67
+ Program = 'Program',
68
+ Outcomes = 'Outcomes'
69
+ }
70
+
71
+
72
+
73
+
74
+
package/src/util.ts ADDED
@@ -0,0 +1,83 @@
1
+ export const imageLoader = (src: string) => {
2
+ return new Promise((resolve, reject) => {
3
+ let img = new Image()
4
+ img.onload = () => resolve(img)
5
+ img.onerror = reject
6
+ img.src = src
7
+ })
8
+ }
9
+
10
+ export const classWithPart = (partAndClass, extraClass = '') => ({
11
+ part: partAndClass,
12
+ class: [partAndClass, extraClass].join(' '),
13
+ })
14
+
15
+ export const clamp = (num: number, min: number, max?: number) => {
16
+ if(max){
17
+ return Math.min(Math.max(num, min), max)
18
+ }else{
19
+ return Math.max(num, min)
20
+ }
21
+ }
22
+
23
+ export const imageLoaderSvg = (src: string) => {
24
+ return new Promise((resolve, reject) => {
25
+ let img = document.createElementNS("http://www.w3.org/2000/svg", "image")
26
+ img.onload = () => resolve(img)
27
+ img.onerror = () => resolve(img) //reject
28
+ img.href.baseVal = src
29
+ })
30
+ }
31
+
32
+ const cvtCaseFromCamelToKebab = (text: string) =>
33
+ text
34
+ .split(/(?=[A-Z])/)
35
+ .map(s => s.toLocaleLowerCase())
36
+ .join('-')
37
+
38
+ export const setProps = <T extends Element>(element: T, props: any) => {
39
+ Object.keys(props).map(_key => {
40
+ element.setAttribute(cvtCaseFromCamelToKebab(_key), props[_key])
41
+ })
42
+ }
43
+
44
+ export const setPropsSVG = <T extends SVGElement>(element: T, props: any) => {
45
+ Object.keys(props).map(_key => {
46
+ element.setAttributeNS("http://www.w3.org/2000/svg", cvtCaseFromCamelToKebab(_key), props[_key])
47
+ })
48
+ }
49
+
50
+ export const delay = (time: number) => new Promise(res => setTimeout(res, time * 1000));
51
+
52
+ type MapObjectValueToTuple<T extends Object> = T[keyof T][]
53
+
54
+ export const mapObjectValueToTuple =
55
+ <T>(object: T): MapObjectValueToTuple<T> =>
56
+ Object.keys(object).map(key => object[key])
57
+
58
+ interface fetcherArgs {
59
+ path: string,
60
+ params?: Object,
61
+ options?: RequestInit
62
+ }
63
+
64
+ export const fetcher = async (config: fetcherArgs) => {
65
+
66
+ const { path, params, options } = config
67
+
68
+ const url = new URL(path)
69
+
70
+ Object.keys(params).map(_key => {
71
+ url.searchParams.append(_key, params[_key])
72
+ })
73
+
74
+ let res: any
75
+ try {
76
+ res = await fetch(url.toString(), options)
77
+ res = await res.json()
78
+ } catch (e) {
79
+ console.log(e);
80
+ }
81
+
82
+ return res
83
+ }
@@ -0,0 +1,13 @@
1
+ import { html } from 'lit-element';
2
+
3
+ import LotteryProgramWof from '../src/LotteryProgramWof';
4
+
5
+ // This default export determines where your story goes in the story list
6
+ export default {
7
+ title: 'LotteryProgramWof',
8
+ };
9
+
10
+ // 👇 We create a “template” of how args map to rendering
11
+ const LotteryProgramWof = ({ aProperty }) => html`<lottery-program-wof></lottery-program-wof>`;
12
+
13
+ export const FirstStory = LotteryProgramWof.bind({});
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ svelte: {
3
+ "language-server": {
4
+ runtime: `sass`
5
+ }
6
+ }
7
+ }
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
+ }