@mideind/netskrafl-react 1.0.0-beta.4 → 1.0.0-beta.6
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/cjs/{index.css → css/netskrafl.css} +227 -216
- package/dist/cjs/index.js +32570 -364
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/{index.css → css/netskrafl.css} +227 -216
- package/dist/esm/index.js +32568 -364
- package/dist/esm/index.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/package.json +2 -1
- package/rollup.config.js +14 -7
- package/src/components/netskrafl/Netskrafl.tsx +21 -4
- package/src/css/glyphs.css +5 -6
- package/src/css/main.css +4 -0
- package/src/css/skrafl-explo.css +41 -22
- package/src/index.ts +2 -0
- package/src/mithril/components.ts +1 -1
- package/src/mithril/i18n.ts +1 -0
- package/src/mithril/main.ts +1 -1
- package/src/mithril/page.ts +2 -2
- package/src/mithril/review.ts +3 -3
- package/src/mithril/rightcolumn.ts +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
interface GlobalState {
|
|
@@ -36,6 +37,6 @@ interface INetskraflProps {
|
|
|
36
37
|
tokenExpired?: () => void;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
declare const Netskrafl: React.
|
|
40
|
+
declare const Netskrafl: React.MemoExoticComponent<({ state, tokenExpired }: INetskraflProps) => react_jsx_runtime.JSX.Element>;
|
|
40
41
|
|
|
41
42
|
export { type INetskraflProps, Netskrafl };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mideind/netskrafl-react",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"description": "React UI for Netskrafl",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"@storybook/test": "^8.4.4",
|
|
35
35
|
"@types/mithril": "^2.2.7",
|
|
36
36
|
"@types/react": "^18.3.12",
|
|
37
|
+
"postcss-import": "^16.1.0",
|
|
37
38
|
"rollup": "^4.27.1",
|
|
38
39
|
"rollup-plugin-dts": "^6.1.1",
|
|
39
40
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
package/rollup.config.js
CHANGED
|
@@ -5,9 +5,10 @@ import alias from '@rollup/plugin-alias';
|
|
|
5
5
|
import commonjs from "@rollup/plugin-commonjs";
|
|
6
6
|
import typescript from "@rollup/plugin-typescript";
|
|
7
7
|
import dts from "rollup-plugin-dts";
|
|
8
|
-
import terser from "@rollup/plugin-terser";
|
|
8
|
+
// import terser from "@rollup/plugin-terser";
|
|
9
9
|
import peerDepsExternal from "rollup-plugin-peer-deps-external";
|
|
10
10
|
import postcss from "rollup-plugin-postcss";
|
|
11
|
+
import postcssImport from "postcss-import";
|
|
11
12
|
import path from "path";
|
|
12
13
|
|
|
13
14
|
const packageJson = require("./package.json");
|
|
@@ -31,11 +32,6 @@ export default [
|
|
|
31
32
|
],
|
|
32
33
|
plugins: [
|
|
33
34
|
peerDepsExternal(),
|
|
34
|
-
postcss({
|
|
35
|
-
extensions: [".css"],
|
|
36
|
-
modules: false,
|
|
37
|
-
// extract: "index.css",
|
|
38
|
-
}),
|
|
39
35
|
alias({
|
|
40
36
|
entries: [
|
|
41
37
|
{ find: '@', replacement: path.resolve(__dirname, 'src') }
|
|
@@ -46,7 +42,18 @@ export default [
|
|
|
46
42
|
}),
|
|
47
43
|
commonjs(),
|
|
48
44
|
typescript({ tsconfig: "./tsconfig.json" }),
|
|
49
|
-
|
|
45
|
+
postcss({
|
|
46
|
+
plugins: [
|
|
47
|
+
postcssImport(), // Handles @import concatenation
|
|
48
|
+
// No cssnano or other aggressive minifiers here for now
|
|
49
|
+
],
|
|
50
|
+
extract: 'css/netskrafl.css', // Output path for the bundled CSS relative to 'dist'
|
|
51
|
+
// minimize: false, // Default is false, but explicitly stating it is fine
|
|
52
|
+
// sourceMap: 'inline', // Or true for a separate .css.map file. 'inline' is good for dev.
|
|
53
|
+
extensions: [".css"],
|
|
54
|
+
modules: false,
|
|
55
|
+
}),
|
|
56
|
+
// terser(), // Uncomment for production builds
|
|
50
57
|
],
|
|
51
58
|
external: ["react", "react-dom"],
|
|
52
59
|
},
|
|
@@ -6,9 +6,7 @@ import { main } from "@/mithril/page";
|
|
|
6
6
|
|
|
7
7
|
export { type INetskraflProps };
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
import "@/css/glyphs.css";
|
|
11
|
-
import "@/css/skrafl-explo.css";
|
|
9
|
+
const CSS_LINK_ID = "netskrafl-styles";
|
|
12
10
|
|
|
13
11
|
const DEFAULT_STATE: GlobalState = {
|
|
14
12
|
projectId: "netskrafl",
|
|
@@ -78,11 +76,30 @@ const mountForUser = async (state: GlobalState, tokenExpired?: () => void): Prom
|
|
|
78
76
|
throw new Error("Failed to mount Netskrafl UI");
|
|
79
77
|
}
|
|
80
78
|
|
|
81
|
-
const NetskraflImpl
|
|
79
|
+
const NetskraflImpl = ({ state, tokenExpired }: INetskraflProps) => {
|
|
82
80
|
const ref = React.createRef<HTMLDivElement>();
|
|
83
81
|
const completeState = { ...DEFAULT_STATE, ...state };
|
|
84
82
|
const { userEmail } = completeState;
|
|
85
83
|
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
// Check if the stylesheet is already added by another instance
|
|
86
|
+
if (document.getElementById(CSS_LINK_ID)) {
|
|
87
|
+
// Optionally, you might want to increment a usage counter
|
|
88
|
+
// and only remove the link when the counter is zero.
|
|
89
|
+
// For simplicity, we'll assume one global link is fine.
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const link = document.createElement("link");
|
|
93
|
+
const styleUrl = `${window.location.origin}/static/css/netskrafl.css`;
|
|
94
|
+
link.id = CSS_LINK_ID;
|
|
95
|
+
link.rel = "stylesheet";
|
|
96
|
+
link.type = "text/css";
|
|
97
|
+
link.href = styleUrl;
|
|
98
|
+
// Optional: for CORS, though if it's the same base domain, it might not be needed
|
|
99
|
+
// link.crossOrigin = "anonymous";
|
|
100
|
+
document.head.appendChild(link);
|
|
101
|
+
}, []);
|
|
102
|
+
|
|
86
103
|
useEffect(() => {
|
|
87
104
|
// Load the Netskrafl (Mithril) UI for a new user
|
|
88
105
|
// console.log("Mounting Netskrafl UI for user", userEmail);
|
package/src/css/glyphs.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Style support for Glyphicons
|
|
6
6
|
|
|
7
|
-
Copyright ©
|
|
7
|
+
Copyright © 2025 Miðeind ehf.
|
|
8
8
|
Author: Vilhjalmur Thorsteinsson
|
|
9
9
|
|
|
10
10
|
The Creative Commons Attribution-NonCommercial 4.0
|
|
@@ -15,11 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
@font-face {
|
|
17
17
|
font-family: 'Glyphicons Regular';
|
|
18
|
-
/* The following source URLs are
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
url('
|
|
22
|
-
url('../fonts/glyphicons-regular.ttf') format('truetype');
|
|
18
|
+
/* The following source URLs are assumed to be present on the host */
|
|
19
|
+
src: url('/static/fonts/glyphicons-regular.eot') format('embedded-opentype'),
|
|
20
|
+
url('/static/fonts/glyphicons-regular.woff') format('woff'),
|
|
21
|
+
url('/static/fonts/glyphicons-regular.ttf') format('truetype');
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
.glyphicon {
|
package/src/css/main.css
ADDED
package/src/css/skrafl-explo.css
CHANGED
|
@@ -42,7 +42,7 @@ div.netskrafl-container {
|
|
|
42
42
|
--triple-letter-color: hsl(from var(--svarkur-secondary) h 70% 40%); /* #21A4B6; */
|
|
43
43
|
--chat-background: hsl(from var(--malfridur-secondary) h 65% 92%);
|
|
44
44
|
--ok-button: var(--malfridur-green);
|
|
45
|
-
--cancel-button: hsl(from var(--logo-primary) h
|
|
45
|
+
--cancel-button: hsl(from var(--logo-primary) h 45% 55%); /* #B6676D; */
|
|
46
46
|
--human-color: hsl(from var(--svarkur-secondary) h s 35%); /* #208C9F; */
|
|
47
47
|
--list-header-background: hsl(from var(--malfridur-secondary) h 85% 90%); /* #fff1d0; */
|
|
48
48
|
--list-header-bottom: hsl(from var(--malfridur-secondary) h 90% 55%); /* #ffc559; */
|
|
@@ -51,6 +51,7 @@ div.netskrafl-container {
|
|
|
51
51
|
--tab-background: #f3f3f6;
|
|
52
52
|
--header-background: #dde1e4;
|
|
53
53
|
--two-letter-background: hsl(from var(--malfridur-green) h 20% 90%);
|
|
54
|
+
--header-green: hsl(from var(--malfridur-green) h 80% 35%);
|
|
54
55
|
--dark-shadow: rgba(0, 0, 0, 0.5);
|
|
55
56
|
--rack-shadow: #afb7cad0;
|
|
56
57
|
--focus-border: var(--triple-word-color);
|
|
@@ -347,6 +348,8 @@ div.netskrafl-logo {
|
|
|
347
348
|
display: flex;
|
|
348
349
|
align-items: center;
|
|
349
350
|
justify-content: center;
|
|
351
|
+
width: 32px;
|
|
352
|
+
height: 32px;
|
|
350
353
|
}
|
|
351
354
|
div.rightcol {
|
|
352
355
|
position: relative;
|
|
@@ -611,7 +614,7 @@ div.tile.dragging {
|
|
|
611
614
|
becomes a child of the document body element when dragging, and
|
|
612
615
|
the style variables are not in scope at the body level. */
|
|
613
616
|
box-shadow: 3px 3px 3px 0 rgba(0, 0, 0, 0.2);
|
|
614
|
-
border-color: var(--ok-button);
|
|
617
|
+
border-color: #09814A; /* var(--ok-button); */
|
|
615
618
|
border-radius: 5px;
|
|
616
619
|
border-width: 3px;
|
|
617
620
|
border-style: solid;
|
|
@@ -628,7 +631,7 @@ div.tile.dragging {
|
|
|
628
631
|
box-sizing: content-box;
|
|
629
632
|
}
|
|
630
633
|
div.tile.dragging.no-drop {
|
|
631
|
-
border-color: var(--cancel-button);
|
|
634
|
+
border-color: #c07359; /* var(--cancel-button); */
|
|
632
635
|
}
|
|
633
636
|
.board td {
|
|
634
637
|
min-width: 21px;
|
|
@@ -1991,7 +1994,7 @@ div#main-tabs > div[role=tabpanel] {
|
|
|
1991
1994
|
div#main-tabs div.header-logo {
|
|
1992
1995
|
padding-left: 14px;
|
|
1993
1996
|
padding-right: 8px;
|
|
1994
|
-
padding-top:
|
|
1997
|
+
padding-top: 12px;
|
|
1995
1998
|
}
|
|
1996
1999
|
div#tabs {
|
|
1997
2000
|
background-color: transparent;
|
|
@@ -2999,7 +3002,7 @@ div.reviewhdr {
|
|
|
2999
3002
|
height: 18px;
|
|
3000
3003
|
text-align: left;
|
|
3001
3004
|
padding: 11px;
|
|
3002
|
-
background-color: var(--
|
|
3005
|
+
background-color: var(--human-color);
|
|
3003
3006
|
color: white;
|
|
3004
3007
|
font-weight: 400;
|
|
3005
3008
|
font-size: 18px;
|
|
@@ -3389,9 +3392,10 @@ div.scorediff {
|
|
|
3389
3392
|
font-weight: normal;
|
|
3390
3393
|
color: white;
|
|
3391
3394
|
visibility: hidden;
|
|
3392
|
-
padding-top:
|
|
3395
|
+
padding-top: 2px;
|
|
3393
3396
|
padding-bottom: 2px;
|
|
3394
|
-
font-family:
|
|
3397
|
+
font-family: var(--number-font);
|
|
3398
|
+
border-radius: 5px;
|
|
3395
3399
|
}
|
|
3396
3400
|
div.posdiff {
|
|
3397
3401
|
background-color: var(--ok-button);
|
|
@@ -3411,7 +3415,7 @@ div.navbtn {
|
|
|
3411
3415
|
height: 30px;
|
|
3412
3416
|
bottom: 136px;
|
|
3413
3417
|
line-height: 24px;
|
|
3414
|
-
background-color: var(--
|
|
3418
|
+
background-color: var(--human-color);
|
|
3415
3419
|
}
|
|
3416
3420
|
div.navbtn#navnext {
|
|
3417
3421
|
position: absolute;
|
|
@@ -3542,12 +3546,12 @@ div#btn-cancel-no {
|
|
|
3542
3546
|
top: auto;
|
|
3543
3547
|
background-color: var(--ok-button);
|
|
3544
3548
|
}
|
|
3545
|
-
.
|
|
3546
|
-
.
|
|
3549
|
+
div.help-tabs .ui-tabs-panel a:link,
|
|
3550
|
+
div.help-tabs .ui-tabs-panel a:visited {
|
|
3547
3551
|
text-decoration: none;
|
|
3548
3552
|
color: var(--humangrad-color);
|
|
3549
3553
|
}
|
|
3550
|
-
.
|
|
3554
|
+
div.help-tabs .ui-tabs-panel a:hover {
|
|
3551
3555
|
text-decoration: none;
|
|
3552
3556
|
color: var(--triple-word-color);
|
|
3553
3557
|
}
|
|
@@ -3993,13 +3997,16 @@ div#user-no-match span#search-prefix {
|
|
|
3993
3997
|
font-weight: bold;
|
|
3994
3998
|
}
|
|
3995
3999
|
div.modal-close {
|
|
4000
|
+
display: flex;
|
|
4001
|
+
flex-direction: row;
|
|
4002
|
+
align-items: center;
|
|
4003
|
+
justify-content: center;
|
|
3996
4004
|
text-align: center;
|
|
3997
4005
|
font-size: 18px;
|
|
3998
4006
|
font-weight: 700;
|
|
3999
4007
|
color: white;
|
|
4000
4008
|
margin: 0;
|
|
4001
4009
|
padding: 6px;
|
|
4002
|
-
padding-top: 9px;
|
|
4003
4010
|
border-radius: 5px;
|
|
4004
4011
|
cursor: pointer;
|
|
4005
4012
|
position: absolute;
|
|
@@ -4009,6 +4016,9 @@ div.modal-close {
|
|
|
4009
4016
|
right: 12px;
|
|
4010
4017
|
top: auto;
|
|
4011
4018
|
}
|
|
4019
|
+
div.modal-close span.glyphicon {
|
|
4020
|
+
top: 0;
|
|
4021
|
+
}
|
|
4012
4022
|
div#usr-info-close {
|
|
4013
4023
|
width: 72px;
|
|
4014
4024
|
/* Override */
|
|
@@ -4396,16 +4406,16 @@ div#user-unfriend {
|
|
|
4396
4406
|
left: 180px;
|
|
4397
4407
|
width: 280px;
|
|
4398
4408
|
/* Override */
|
|
4399
|
-
padding-top: 6px;
|
|
4400
4409
|
border-style: solid;
|
|
4401
4410
|
border-width: 2px;
|
|
4402
4411
|
border-color: var(--ok-button);
|
|
4403
4412
|
background-color: white;
|
|
4404
4413
|
color: var(--ok-button);
|
|
4405
|
-
line-height: 24px;
|
|
4406
4414
|
}
|
|
4407
4415
|
div#user-unfriend span.glyphicon-coffee-cup {
|
|
4416
|
+
top: -1px;
|
|
4408
4417
|
color: var(--triple-word-color);
|
|
4418
|
+
margin-right: 8px;
|
|
4409
4419
|
}
|
|
4410
4420
|
div#user-cancel {
|
|
4411
4421
|
right: 108px;
|
|
@@ -4658,11 +4668,8 @@ div.toggler div.option.x-small {
|
|
|
4658
4668
|
div.toggler div.option.selected {
|
|
4659
4669
|
background-color: var(--triple-letter-color);
|
|
4660
4670
|
}
|
|
4661
|
-
div
|
|
4662
|
-
|
|
4663
|
-
}
|
|
4664
|
-
div#fairplay-toggler span.glyphicon-edit {
|
|
4665
|
-
top: 0;
|
|
4671
|
+
div.toggler span.glyphicon {
|
|
4672
|
+
top: 1px;
|
|
4666
4673
|
}
|
|
4667
4674
|
div #radioset {
|
|
4668
4675
|
padding-top: 6px;
|
|
@@ -4685,11 +4692,11 @@ a.nodecorate:hover {
|
|
|
4685
4692
|
}
|
|
4686
4693
|
a.iconlink:link {
|
|
4687
4694
|
text-decoration: none;
|
|
4688
|
-
color: var(--
|
|
4695
|
+
color: var(--malfridur-accent);
|
|
4689
4696
|
}
|
|
4690
4697
|
a.iconlink:visited {
|
|
4691
4698
|
text-decoration: none;
|
|
4692
|
-
color: var(--
|
|
4699
|
+
color: var(--malfridur-accent);
|
|
4693
4700
|
}
|
|
4694
4701
|
a.iconlink:hover {
|
|
4695
4702
|
text-decoration: none;
|
|
@@ -5053,7 +5060,7 @@ div.signup-header {
|
|
|
5053
5060
|
border-width: 0;
|
|
5054
5061
|
color: white;
|
|
5055
5062
|
left: 441px;
|
|
5056
|
-
background-color: var(--
|
|
5063
|
+
background-color: var(--human-color);
|
|
5057
5064
|
}
|
|
5058
5065
|
div.submitpass {
|
|
5059
5066
|
top: 158px;
|
|
@@ -5268,6 +5275,10 @@ div.signup-header {
|
|
|
5268
5275
|
div.logo {
|
|
5269
5276
|
display: block;
|
|
5270
5277
|
}
|
|
5278
|
+
div.netskrafl-logo {
|
|
5279
|
+
width: 46px;
|
|
5280
|
+
height: 46px;
|
|
5281
|
+
}
|
|
5271
5282
|
div#main-tabs div.header-logo {
|
|
5272
5283
|
display: none;
|
|
5273
5284
|
}
|
|
@@ -5829,6 +5840,14 @@ div.signup-header {
|
|
|
5829
5840
|
div.gamestats div.player.humancolor {
|
|
5830
5841
|
color: white;
|
|
5831
5842
|
}
|
|
5843
|
+
div.gamestats div.player.left {
|
|
5844
|
+
border-top-left-radius: 5px;
|
|
5845
|
+
border-bottom-left-radius: 5px;
|
|
5846
|
+
}
|
|
5847
|
+
div.gamestats div.player.right {
|
|
5848
|
+
border-top-right-radius: 5px;
|
|
5849
|
+
border-bottom-right-radius: 5px;
|
|
5850
|
+
}
|
|
5832
5851
|
div.scorewrapper {
|
|
5833
5852
|
background-color: var(--humangrad-color);
|
|
5834
5853
|
min-height: 32px;
|
package/src/index.ts
CHANGED
package/src/mithril/i18n.ts
CHANGED
|
@@ -120,6 +120,7 @@ async function loadMessages(locale: string) {
|
|
|
120
120
|
const messages = await request<Messages>({
|
|
121
121
|
method: "GET",
|
|
122
122
|
url: "/static/assets/messages.json",
|
|
123
|
+
withCredentials: false, // Cookies are not allowed for CORS request
|
|
123
124
|
});
|
|
124
125
|
setLocale(locale, messages);
|
|
125
126
|
}
|
package/src/mithril/main.ts
CHANGED
package/src/mithril/page.ts
CHANGED
|
@@ -482,7 +482,7 @@ export class View implements IView {
|
|
|
482
482
|
// The function assumes that 'this' is the current view object
|
|
483
483
|
if (!html)
|
|
484
484
|
return "";
|
|
485
|
-
return m("div",
|
|
485
|
+
return m("div.help-tabs",
|
|
486
486
|
{
|
|
487
487
|
oninit: (vnode) => { vnode.state.selected = tabNumber || 1; },
|
|
488
488
|
oncreate: (vnode) => { makeTabs(this, id, createFunc, true, vnode); }
|
|
@@ -667,7 +667,7 @@ export class View implements IView {
|
|
|
667
667
|
ev.preventDefault();
|
|
668
668
|
view.showFriendCancel()
|
|
669
669
|
},
|
|
670
|
-
[glyph("coffee-cup"),
|
|
670
|
+
[glyph("coffee-cup"), ts("Þú ert vinur Netskrafls!")], 10
|
|
671
671
|
)
|
|
672
672
|
:
|
|
673
673
|
this.vwDialogButton("user-friend", ts("Gerast vinur"),
|
package/src/mithril/review.ts
CHANGED
|
@@ -68,7 +68,7 @@ export const vwReview = (view: IView): VnodeChildren => {
|
|
|
68
68
|
href: "/page",
|
|
69
69
|
class: "backlink"
|
|
70
70
|
},
|
|
71
|
-
m(NetskraflLogoOnly
|
|
71
|
+
m(NetskraflLogoOnly)
|
|
72
72
|
)
|
|
73
73
|
)
|
|
74
74
|
),
|
|
@@ -420,7 +420,7 @@ const vwStatsReview = (view: IView): VnodeChildren => {
|
|
|
420
420
|
[
|
|
421
421
|
m("div", { style: { position: "relative", width: "100%" } },
|
|
422
422
|
[
|
|
423
|
-
m(".player", { class: leftPlayerColor, style: { width: "50%" } },
|
|
423
|
+
m(".player.left", { class: leftPlayerColor, style: { width: "50%" } },
|
|
424
424
|
m(".robot-btn.left",
|
|
425
425
|
game.autoplayer[0] ?
|
|
426
426
|
[glyph("cog"), nbsp(), game.nickname[0]]
|
|
@@ -428,7 +428,7 @@ const vwStatsReview = (view: IView): VnodeChildren => {
|
|
|
428
428
|
game.nickname[0]
|
|
429
429
|
)
|
|
430
430
|
),
|
|
431
|
-
m(".player", { class: rightPlayerColor, style: { width: "50%", "text-align": "right" } },
|
|
431
|
+
m(".player.right", { class: rightPlayerColor, style: { width: "50%", "text-align": "right" } },
|
|
432
432
|
m(".robot-btn.right",
|
|
433
433
|
game.autoplayer[1] ?
|
|
434
434
|
[glyph("cog"), nbsp(), game.nickname[1]]
|