desck 0.4.4 → 0.4.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/desck.cjs +1 -1
- package/package.json +4 -4
- package/public/main.js +13358 -13269
- package/{server.cjs → server.mjs} +72 -58
- package/src/DeckView.elm +21 -1
- package/src/Main.elm +72 -43
- package/src/Palette.elm +13 -1
- package/src/Project.elm +7 -9
- package/src/SaveFile.elm +2 -0
- package/src/Theme.elm +14 -8
- package/public/svg/backface.svg +0 -1
|
@@ -1,62 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import express from "express";
|
|
2
|
+
import http from "http";
|
|
3
|
+
import { Server } from "socket.io";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import { parseArgs } from "node:util";
|
|
7
|
+
|
|
8
|
+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
9
|
+
const parseConfig = (argv) => {
|
|
10
|
+
const { values, positionals } = parseArgs({
|
|
11
|
+
argv: argv.slice(2), // Skip 'node' and script name
|
|
12
|
+
options: {
|
|
13
|
+
input: { type: "string", short: "i" },
|
|
14
|
+
output: { type: "string", short: "o" },
|
|
15
|
+
settings: { type: "string" },
|
|
16
|
+
port: { type: "string", short: "p" },
|
|
17
|
+
png: { type: "boolean" },
|
|
18
|
+
svg: { type: "boolean" },
|
|
19
|
+
symbols: { type: "boolean" },
|
|
20
|
+
},
|
|
21
|
+
allowPositionals: true,
|
|
22
|
+
});
|
|
6
23
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
const parsePath = (value, def) => {
|
|
25
|
+
return value ? path.join(process.cwd(), value) : path.join(__dirname, def);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const parseMode = (value) => {
|
|
29
|
+
if (["dev", "watch", "export"].includes(value)) return value;
|
|
30
|
+
else return null;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const mode = parseMode(positionals[0]);
|
|
34
|
+
|
|
35
|
+
if (!mode) {
|
|
36
|
+
console.error(`unrecognized mode "${positionals[0]}"`);
|
|
37
|
+
process.exit();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const c = {
|
|
41
|
+
port: parseInt(values.port) || 6354,
|
|
42
|
+
mode: mode,
|
|
17
43
|
formats: [],
|
|
18
|
-
symbols: false,
|
|
19
|
-
input:
|
|
20
|
-
output:
|
|
44
|
+
symbols: values.symbols || false,
|
|
45
|
+
input: parsePath(values.input, "public/projects"),
|
|
46
|
+
output: parsePath(values.output, "exports"),
|
|
21
47
|
settings: null,
|
|
22
48
|
};
|
|
23
49
|
|
|
24
|
-
c.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
? path.join(process.cwd(), args[2])
|
|
39
|
-
: path.join(__dirname, "public/projects");
|
|
40
|
-
|
|
41
|
-
c.output = args[3]
|
|
42
|
-
? path.join(process.cwd(), args[3])
|
|
43
|
-
: path.join(__dirname, "exports");
|
|
44
|
-
|
|
45
|
-
c.settings = JSON.parse(
|
|
46
|
-
fs.readFileSync(
|
|
47
|
-
args[4]
|
|
48
|
-
? path.join(process.cwd(), args[4])
|
|
49
|
-
: path.join(__dirname, "settings.json"),
|
|
50
|
-
),
|
|
51
|
-
);
|
|
50
|
+
if (values.svg) c.formats.push("svg");
|
|
51
|
+
if (values.png) c.formats.push("png");
|
|
52
|
+
|
|
53
|
+
const defaultSettings = "settings.json";
|
|
54
|
+
const settingsPath = values.settings
|
|
55
|
+
? path.join(process.cwd(), values.settings)
|
|
56
|
+
: fs.existsSync(path.join(c.input, defaultSettings))
|
|
57
|
+
? path.join(c.input, defaultSettings)
|
|
58
|
+
: path.join(__dirname, defaultSettings);
|
|
59
|
+
|
|
60
|
+
c.settings = JSON.parse(fs.readFileSync(settingsPath));
|
|
61
|
+
|
|
62
|
+
c.verbose = c.mode == "dev";
|
|
63
|
+
|
|
52
64
|
return c;
|
|
53
65
|
};
|
|
54
66
|
|
|
67
|
+
const app = express();
|
|
68
|
+
const server = http.createServer(app);
|
|
69
|
+
const io = new Server(server, { maxHttpBufferSize: 1e8 });
|
|
70
|
+
|
|
55
71
|
let config = parseConfig(process.argv);
|
|
56
72
|
console.log(config);
|
|
57
73
|
|
|
58
|
-
const verbose = !["watch", "export"].includes(config.mode);
|
|
59
|
-
|
|
60
74
|
const ensureDir = (dir) => {
|
|
61
75
|
if (!fs.existsSync(dir)) {
|
|
62
76
|
fs.mkdirSync(dir, { recursive: true });
|
|
@@ -108,10 +122,10 @@ io.on("connection", (socket) => {
|
|
|
108
122
|
const readProjects = () => {
|
|
109
123
|
return readFiles(config.input);
|
|
110
124
|
};
|
|
111
|
-
if (verbose) {
|
|
125
|
+
if (config.verbose) {
|
|
112
126
|
logMessage("connect", "gui");
|
|
113
127
|
}
|
|
114
|
-
let files = readProjects();
|
|
128
|
+
// let files = readProjects();
|
|
115
129
|
// logMessage("files", files);
|
|
116
130
|
const emitList = () => {
|
|
117
131
|
const projects = readProjects();
|
|
@@ -129,7 +143,7 @@ io.on("connection", (socket) => {
|
|
|
129
143
|
emitList();
|
|
130
144
|
});
|
|
131
145
|
socket.onAny((message, data) => {
|
|
132
|
-
if (verbose) {
|
|
146
|
+
if (config.verbose) {
|
|
133
147
|
logMessage(message, data);
|
|
134
148
|
}
|
|
135
149
|
});
|
|
@@ -142,7 +156,7 @@ io.on("connection", (socket) => {
|
|
|
142
156
|
socket.on("import", (name) => {
|
|
143
157
|
const filepath = inputFile(`${name}.json`);
|
|
144
158
|
if (fs.existsSync(filepath)) {
|
|
145
|
-
if (verbose) {
|
|
159
|
+
if (config.verbose) {
|
|
146
160
|
logMessage("load", `${name}`);
|
|
147
161
|
}
|
|
148
162
|
const json = fs.readFileSync(filepath, "utf-8");
|
|
@@ -154,7 +168,7 @@ io.on("connection", (socket) => {
|
|
|
154
168
|
});
|
|
155
169
|
|
|
156
170
|
socket.on("disconnect", () => {
|
|
157
|
-
if (verbose) {
|
|
171
|
+
if (config.verbose) {
|
|
158
172
|
logMessage("disconnect", "gui");
|
|
159
173
|
}
|
|
160
174
|
});
|
|
@@ -209,7 +223,7 @@ const exportProject = async (browser, config, jsonData, format) => {
|
|
|
209
223
|
}
|
|
210
224
|
};
|
|
211
225
|
|
|
212
|
-
|
|
226
|
+
import puppeteer from "puppeteer";
|
|
213
227
|
|
|
214
228
|
const withBrowser = async (fun) => {
|
|
215
229
|
try {
|
|
@@ -287,10 +301,10 @@ switch (config.mode) {
|
|
|
287
301
|
throw new Error("input to watch should be a directory!");
|
|
288
302
|
}
|
|
289
303
|
logMessage("watch", `${config.input} -> ${config.output}`);
|
|
290
|
-
const runExports = async (file) => {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
};
|
|
304
|
+
// const runExports = async (file) => {
|
|
305
|
+
// await exportAll();
|
|
306
|
+
// logMessage("export", file);
|
|
307
|
+
// };
|
|
294
308
|
fs.readdirSync(config.input).map((file) =>
|
|
295
309
|
fs.watchFile(
|
|
296
310
|
inputFile(file),
|
package/src/DeckView.elm
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module DeckView exposing (backface, cardSize, cornerRadius, frontface, includes)
|
|
1
|
+
module DeckView exposing (backface, cardSize, cornerRadius, disabledMask, frontface, includes)
|
|
2
2
|
|
|
3
3
|
import Deck exposing (..)
|
|
4
4
|
import Svg exposing (Svg)
|
|
@@ -413,3 +413,23 @@ frontface w h model =
|
|
|
413
413
|
, pipIcons
|
|
414
414
|
, cornerLabels
|
|
415
415
|
]
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
disabledMask : Float -> Float -> Svg msg
|
|
419
|
+
disabledMask w h =
|
|
420
|
+
let
|
|
421
|
+
fill =
|
|
422
|
+
var "disabled"
|
|
423
|
+
in
|
|
424
|
+
Svg.rect
|
|
425
|
+
[ num A.width <| w
|
|
426
|
+
, num A.height <| h
|
|
427
|
+
, A.rx cornerRadius
|
|
428
|
+
, A.class "card-disabled-rect"
|
|
429
|
+
, A.ry cornerRadius
|
|
430
|
+
, A.fill fill
|
|
431
|
+
, A.opacity "0.65"
|
|
432
|
+
, A.stroke fill
|
|
433
|
+
, A.strokeWidth borderWidth
|
|
434
|
+
]
|
|
435
|
+
[]
|
package/src/Main.elm
CHANGED
|
@@ -3,7 +3,7 @@ port module Main exposing (main)
|
|
|
3
3
|
import Browser
|
|
4
4
|
import Card exposing (Card, makeCard)
|
|
5
5
|
import Deck exposing (modelUsing, parseDeck)
|
|
6
|
-
import DeckView exposing (backface, cardSize, cornerRadius, frontface, includes)
|
|
6
|
+
import DeckView exposing (backface, cardSize, cornerRadius, disabledMask, frontface, includes)
|
|
7
7
|
import Draggable
|
|
8
8
|
import Draggable.Events exposing (onDragBy, onDragEnd)
|
|
9
9
|
import File exposing (File)
|
|
@@ -16,7 +16,7 @@ import Json.Encode exposing (Value, encode, list, string)
|
|
|
16
16
|
import Layout exposing (Spread(..), defaultSpread, spreadAsString, updateSpreadValue, validateSpreadValue)
|
|
17
17
|
import Markdown
|
|
18
18
|
import Palette exposing (Color(..), Palette, colorAsString, colorFromString, colorPicker, colorPickerWithTransparent, setPaletteColor)
|
|
19
|
-
import Project exposing (Project, Shape, Shapes(..), Zorder(..), arrowEnds, arrowPoints, arrowPointsToPos, arrowTransform, getHighestShapeByPos, getLastId, getSelectedCardModels, getShapeById, mergeAll, positionCards, selectWithCovering, shapeId, shapeRect, shapeTransform, splitAll
|
|
19
|
+
import Project exposing (Project, Shape, Shapes(..), Zorder(..), arrowEnds, arrowPoints, arrowPointsToPos, arrowTransform, getHighestShapeByPos, getLastId, getSelectedCardModels, getShapeById, mergeAll, positionCards, selectWithCovering, shapeId, shapeRect, shapeTransform, splitAll)
|
|
20
20
|
import Rect exposing (..)
|
|
21
21
|
import SaveFile exposing (Settings, decodeSaveFile, encodePalette, encodeSaveFile)
|
|
22
22
|
import Svg exposing (Svg)
|
|
@@ -300,7 +300,7 @@ init flags =
|
|
|
300
300
|
decodeSaveFileIntoModel False
|
|
301
301
|
model
|
|
302
302
|
s
|
|
303
|
-
(\
|
|
303
|
+
(\_ ->
|
|
304
304
|
Cmd.batch []
|
|
305
305
|
)
|
|
306
306
|
in
|
|
@@ -1952,16 +1952,14 @@ snapPos model pos =
|
|
|
1952
1952
|
{ x = snapFloat xs pos.x, y = snapFloat ys pos.y }
|
|
1953
1953
|
|
|
1954
1954
|
|
|
1955
|
-
snapAngle : Model -> Float -> Float
|
|
1956
|
-
snapAngle _ angle =
|
|
1957
|
-
-- if model.snap == 0 then
|
|
1958
|
-
-- angle
|
|
1959
|
-
-- else
|
|
1960
|
-
-- snapFloat (360.0 / (toFloat model.snap * 4)) angle
|
|
1961
|
-
angle
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
1955
|
|
|
1956
|
+
-- snapAngle : Model -> Float -> Float
|
|
1957
|
+
-- snapAngle _ angle =
|
|
1958
|
+
-- -- if model.snap == 0 then
|
|
1959
|
+
-- -- angle
|
|
1960
|
+
-- -- else
|
|
1961
|
+
-- -- snapFloat (360.0 / (toFloat model.snap * 4)) angle
|
|
1962
|
+
-- angle
|
|
1965
1963
|
---------------------------------------- ⡄⠀⡄⠠⡤⠀⡤⠤⠄⡄⠀⡄⡠⠤⡀
|
|
1966
1964
|
---------------------------------------- ⢱⢰⠁⠀⡇⠀⡗⠒⠀⡇⡄⡇⠑⠒⡄
|
|
1967
1965
|
---------------------------------------- ⠀⠃⠀⠐⠓⠀⠓⠒⠂⠋⠈⠃⠑⠒⠁
|
|
@@ -3083,6 +3081,15 @@ arrowDefs =
|
|
|
3083
3081
|
h =
|
|
3084
3082
|
1.5
|
|
3085
3083
|
|
|
3084
|
+
h2 =
|
|
3085
|
+
h * 2
|
|
3086
|
+
|
|
3087
|
+
h3 =
|
|
3088
|
+
h * 3
|
|
3089
|
+
|
|
3090
|
+
h4 =
|
|
3091
|
+
h * 4
|
|
3092
|
+
|
|
3086
3093
|
w2 =
|
|
3087
3094
|
w / 2.0
|
|
3088
3095
|
in
|
|
@@ -3103,6 +3110,35 @@ arrowDefs =
|
|
|
3103
3110
|
]
|
|
3104
3111
|
[]
|
|
3105
3112
|
]
|
|
3113
|
+
, Svg.marker
|
|
3114
|
+
[ Attr.id "cross"
|
|
3115
|
+
, num Attr.markerWidth h4
|
|
3116
|
+
, num Attr.markerHeight h4
|
|
3117
|
+
, num Attr.refX h2
|
|
3118
|
+
, num Attr.refY h2
|
|
3119
|
+
, Attr.orient "auto"
|
|
3120
|
+
, Attr.markerUnits "strokeWidth"
|
|
3121
|
+
, Attr.stroke "context-stroke"
|
|
3122
|
+
]
|
|
3123
|
+
[ Svg.line
|
|
3124
|
+
[ num Attr.x1 h
|
|
3125
|
+
, num Attr.y1 h
|
|
3126
|
+
, num Attr.x2 h3
|
|
3127
|
+
, num Attr.y2 h3
|
|
3128
|
+
, Attr.stroke "context-stroke"
|
|
3129
|
+
, Attr.strokeLinecap "butt"
|
|
3130
|
+
]
|
|
3131
|
+
[]
|
|
3132
|
+
, Svg.line
|
|
3133
|
+
[ num Attr.x1 h3
|
|
3134
|
+
, num Attr.y1 h
|
|
3135
|
+
, num Attr.x2 h
|
|
3136
|
+
, num Attr.y2 h3
|
|
3137
|
+
, Attr.stroke "context-stroke"
|
|
3138
|
+
, Attr.strokeLinecap "butt"
|
|
3139
|
+
]
|
|
3140
|
+
[]
|
|
3141
|
+
]
|
|
3106
3142
|
|
|
3107
3143
|
-- , Svg.filter
|
|
3108
3144
|
-- [ Attr.id "shadow" ]
|
|
@@ -3125,29 +3161,25 @@ dragEvent id =
|
|
|
3125
3161
|
|
|
3126
3162
|
-- TODO customize arrow cap or distance?
|
|
3127
3163
|
-- TODO respond to pivot and angle
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
Vec.vec2 0.0 f
|
|
3142
|
-
|> Vec.rotate pi
|
|
3143
|
-
in
|
|
3144
|
-
"M " ++ p a ++ " Q " ++ p c ++ " " ++ p b
|
|
3164
|
+
-- arcPath : Float -> ( Vec2, Vec2 ) -> String
|
|
3165
|
+
-- arcPath f ( a, b ) =
|
|
3166
|
+
-- let
|
|
3167
|
+
-- p v =
|
|
3168
|
+
-- String.fromFloat v.x ++ " " ++ String.fromFloat v.y
|
|
3169
|
+
-- m =
|
|
3170
|
+
-- Vec.sub b a
|
|
3171
|
+
-- |> Vec.scale 0.5
|
|
3172
|
+
-- c =
|
|
3173
|
+
-- Vec.vec2 0.0 f
|
|
3174
|
+
-- |> Vec.rotate pi
|
|
3175
|
+
-- in
|
|
3176
|
+
-- "M " ++ p a ++ " Q " ++ p c ++ " " ++ p b
|
|
3145
3177
|
|
|
3146
3178
|
|
|
3147
3179
|
arrowView : Model -> ( Vec2, Vec2 ) -> Arrow -> ( String, Svg Msg )
|
|
3148
3180
|
arrowView model ( from, to ) a =
|
|
3149
3181
|
let
|
|
3150
|
-
( rect,
|
|
3182
|
+
( rect, _, angle ) =
|
|
3151
3183
|
arrowTransform a ( from, to )
|
|
3152
3184
|
|
|
3153
3185
|
c =
|
|
@@ -3185,6 +3217,9 @@ arrowView model ( from, to ) a =
|
|
|
3185
3217
|
Triangle ->
|
|
3186
3218
|
[ Attr.markerEnd (url "arrow") ]
|
|
3187
3219
|
|
|
3220
|
+
Cross ->
|
|
3221
|
+
[ Attr.markerEnd (url "cross") ]
|
|
3222
|
+
|
|
3188
3223
|
-- TODO Arrow - cross head!
|
|
3189
3224
|
_ ->
|
|
3190
3225
|
[]
|
|
@@ -3321,7 +3356,7 @@ incompleteArrow model =
|
|
|
3321
3356
|
|
|
3322
3357
|
|
|
3323
3358
|
getColor : Model -> Color -> String
|
|
3324
|
-
getColor
|
|
3359
|
+
getColor _ c =
|
|
3325
3360
|
case c of
|
|
3326
3361
|
Transparent ->
|
|
3327
3362
|
"transparent"
|
|
@@ -3519,11 +3554,6 @@ zonesView model =
|
|
|
3519
3554
|
|> Svg.Keyed.node "g" [ viewportAttr model ]
|
|
3520
3555
|
|
|
3521
3556
|
|
|
3522
|
-
inactiveFilter : String
|
|
3523
|
-
inactiveFilter =
|
|
3524
|
-
"filter: brightness(50%)"
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
3557
|
draggedLeaderTransform : Model -> Shape -> ( Rect, Vec2, Float )
|
|
3528
3558
|
draggedLeaderTransform m s =
|
|
3529
3559
|
let
|
|
@@ -3667,13 +3697,6 @@ cardView m card =
|
|
|
3667
3697
|
""
|
|
3668
3698
|
)
|
|
3669
3699
|
, HA.attribute "data-using" (encode 0 (list string (modelUsing model)))
|
|
3670
|
-
, Attr.style
|
|
3671
|
-
(if highlight then
|
|
3672
|
-
""
|
|
3673
|
-
|
|
3674
|
-
else
|
|
3675
|
-
inactiveFilter
|
|
3676
|
-
)
|
|
3677
3700
|
, Attr.transform <|
|
|
3678
3701
|
pivotRotate pivot rect.pos rect.size angle
|
|
3679
3702
|
++ translateXY rect.pos
|
|
@@ -3688,6 +3711,12 @@ cardView m card =
|
|
|
3688
3711
|
, [ Svg.text_ [ HA.style "font-size" "32px", Attr.fill "magenta" ] [ Svg.text <| card.id ]
|
|
3689
3712
|
|> maybeHtml m.debug
|
|
3690
3713
|
]
|
|
3714
|
+
, if highlight then
|
|
3715
|
+
[]
|
|
3716
|
+
|
|
3717
|
+
else
|
|
3718
|
+
[ disabledMask rect.size.x rect.size.y
|
|
3719
|
+
]
|
|
3691
3720
|
]
|
|
3692
3721
|
)
|
|
3693
3722
|
|
package/src/Palette.elm
CHANGED
|
@@ -20,6 +20,7 @@ type Color
|
|
|
20
20
|
| MidGray
|
|
21
21
|
| LightGray
|
|
22
22
|
| Transparent
|
|
23
|
+
| Disabled
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
colorAsString : Color -> String
|
|
@@ -67,6 +68,9 @@ colorAsString c =
|
|
|
67
68
|
Transparent ->
|
|
68
69
|
"transparent"
|
|
69
70
|
|
|
71
|
+
Disabled ->
|
|
72
|
+
"disabled"
|
|
73
|
+
|
|
70
74
|
|
|
71
75
|
colorFromString : String -> Color
|
|
72
76
|
colorFromString s =
|
|
@@ -131,6 +135,7 @@ type alias Palette =
|
|
|
131
135
|
, darkGray : String
|
|
132
136
|
, midGray : String
|
|
133
137
|
, lightGray : String
|
|
138
|
+
, disabled : String
|
|
134
139
|
}
|
|
135
140
|
|
|
136
141
|
|
|
@@ -149,6 +154,7 @@ paletteAsList palette =
|
|
|
149
154
|
, ( Blue, palette.blue )
|
|
150
155
|
, ( Violet, palette.violet )
|
|
151
156
|
, ( Pink, palette.pink )
|
|
157
|
+
, ( Disabled, palette.disabled )
|
|
152
158
|
]
|
|
153
159
|
|
|
154
160
|
|
|
@@ -197,6 +203,9 @@ getColor palette color =
|
|
|
197
203
|
Transparent ->
|
|
198
204
|
"#00000000"
|
|
199
205
|
|
|
206
|
+
Disabled ->
|
|
207
|
+
palette.disabled
|
|
208
|
+
|
|
200
209
|
|
|
201
210
|
setPaletteColor : Palette -> Color -> String -> Palette
|
|
202
211
|
setPaletteColor p c v =
|
|
@@ -240,6 +249,9 @@ setPaletteColor p c v =
|
|
|
240
249
|
LightGray ->
|
|
241
250
|
{ p | lightGray = v }
|
|
242
251
|
|
|
252
|
+
Disabled ->
|
|
253
|
+
{ p | disabled = v }
|
|
254
|
+
|
|
243
255
|
Transparent ->
|
|
244
256
|
p
|
|
245
257
|
|
|
@@ -255,7 +267,7 @@ colorPicker addTransparent palette message current =
|
|
|
255
267
|
|> List.map (\s -> List.map (\c -> ( c, getColor palette c )) s)
|
|
256
268
|
|
|
257
269
|
colorButton : Int -> ( Color, String ) -> Html msg
|
|
258
|
-
colorButton
|
|
270
|
+
colorButton _ ( color, c ) =
|
|
259
271
|
let
|
|
260
272
|
name =
|
|
261
273
|
colorAsString color
|
package/src/Project.elm
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
module Project exposing (..)
|
|
2
2
|
|
|
3
3
|
import Card exposing (Card, defaultCard)
|
|
4
|
-
import Deck exposing (modelAsShort
|
|
4
|
+
import Deck exposing (modelAsShort)
|
|
5
5
|
import DeckView exposing (cardSize)
|
|
6
|
-
import Html.Attributes exposing (maxlength)
|
|
7
6
|
import Layout exposing (Spread, spreadTransforms)
|
|
8
7
|
import Palette exposing (Color(..), colorFromString)
|
|
9
|
-
import Random exposing (initialSeed)
|
|
10
8
|
import Rect exposing (Rect, RectCoordinate, center, enlarge, fromPoints, includeRect, modifyRect, normalizeRect, rect2, toPoints)
|
|
11
|
-
import Util exposing (Id, mapNothing,
|
|
9
|
+
import Util exposing (Id, mapNothing, randomOffset, shuffleList)
|
|
12
10
|
import Vec exposing (Vec2)
|
|
13
11
|
import Zone exposing (Arrow, Stamp, Zone)
|
|
14
12
|
|
|
@@ -90,7 +88,7 @@ selectWithCovering p id =
|
|
|
90
88
|
[ ( id, shape ) ]
|
|
91
89
|
all
|
|
92
90
|
|
|
93
|
-
Zone
|
|
91
|
+
Zone _ ->
|
|
94
92
|
[ ( id, shape ) ]
|
|
95
93
|
|
|
96
94
|
_ ->
|
|
@@ -712,7 +710,7 @@ arrowPoints ( ( fr, _, _ ), ( tr, _, _ ) ) =
|
|
|
712
710
|
tc =
|
|
713
711
|
Rect.center tr
|
|
714
712
|
|
|
715
|
-
|
|
713
|
+
_ =
|
|
716
714
|
0.42
|
|
717
715
|
|
|
718
716
|
-- v1 =
|
|
@@ -761,13 +759,13 @@ arrowRect m a =
|
|
|
761
759
|
r =
|
|
762
760
|
normalizeRect from to
|
|
763
761
|
|
|
764
|
-
|
|
762
|
+
_ =
|
|
765
763
|
center r
|
|
766
764
|
|
|
767
765
|
dir =
|
|
768
766
|
Vec.sub from to
|
|
769
767
|
|
|
770
|
-
|
|
768
|
+
_ =
|
|
771
769
|
Vec.length dir
|
|
772
770
|
* 0.5
|
|
773
771
|
|
|
@@ -775,7 +773,7 @@ arrowRect m a =
|
|
|
775
773
|
atan2 dir.y dir.x
|
|
776
774
|
/ (pi * 2.0)
|
|
777
775
|
|
|
778
|
-
|
|
776
|
+
_ =
|
|
779
777
|
rad
|
|
780
778
|
* 360.0
|
|
781
779
|
in
|
package/src/SaveFile.elm
CHANGED
|
@@ -83,6 +83,7 @@ paletteDecoder =
|
|
|
83
83
|
|> required "darkGray" D.string
|
|
84
84
|
|> required "midGray" D.string
|
|
85
85
|
|> required "lightGray" D.string
|
|
86
|
+
|> optional "disabled" D.string Theme.defaultDisabled
|
|
86
87
|
|
|
87
88
|
|
|
88
89
|
|
|
@@ -115,6 +116,7 @@ encodePalette p =
|
|
|
115
116
|
, ( "darkGray", string p.darkGray )
|
|
116
117
|
, ( "midGray", string p.midGray )
|
|
117
118
|
, ( "lightGray", string p.lightGray )
|
|
119
|
+
, ( "disabled", string p.disabled )
|
|
118
120
|
]
|
|
119
121
|
|
|
120
122
|
|
package/src/Theme.elm
CHANGED
|
@@ -18,6 +18,7 @@ defaultPalette =
|
|
|
18
18
|
, darkGray = "#333333"
|
|
19
19
|
, midGray = "#666666"
|
|
20
20
|
, lightGray = "#aaaaaa"
|
|
21
|
+
, disabled = "#dddddd"
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
|
|
@@ -44,44 +45,49 @@ dark =
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
|
|
48
|
+
defaultDisabled : String
|
|
49
|
+
defaultDisabled =
|
|
50
|
+
"#dddddd"
|
|
51
|
+
|
|
52
|
+
|
|
47
53
|
ink : Palette
|
|
48
54
|
ink =
|
|
49
|
-
{ black = "#000000", white = "#ffffff", red = "#ff5252", orange = "#d64d00", yellow = "#eede4f", green = "#db6039", cyan = "#ff2305", blue = "#450b8e", violet = "#841010", pink = "#c70c00", darkGray = "#333333", midGray = "#737373", lightGray = "#cccccc" }
|
|
55
|
+
{ black = "#000000", white = "#ffffff", red = "#ff5252", orange = "#d64d00", yellow = "#eede4f", green = "#db6039", cyan = "#ff2305", blue = "#450b8e", violet = "#841010", pink = "#c70c00", darkGray = "#333333", midGray = "#737373", lightGray = "#cccccc", disabled = defaultDisabled }
|
|
50
56
|
|
|
51
57
|
|
|
52
58
|
earth : Palette
|
|
53
59
|
earth =
|
|
54
|
-
{ black = "#303419", white = "#ffffff", red = "#d65f1f", orange = "#868a5c", yellow = "#ccc47f", green = "#677a48", cyan = "#222a2a", blue = "#587a1f", violet = "#412a2a", pink = "#f1bab6", darkGray = "#000000", midGray = "#758264", lightGray = "#ccdfb9" }
|
|
60
|
+
{ black = "#303419", white = "#ffffff", red = "#d65f1f", orange = "#868a5c", yellow = "#ccc47f", green = "#677a48", cyan = "#222a2a", blue = "#587a1f", violet = "#412a2a", pink = "#f1bab6", darkGray = "#000000", midGray = "#758264", lightGray = "#ccdfb9", disabled = defaultDisabled }
|
|
55
61
|
|
|
56
62
|
|
|
57
63
|
gem : Palette
|
|
58
64
|
gem =
|
|
59
|
-
{ black = "#191d34", white = "#ffffff", red = "#ff4292", orange = "#e5e4c8", yellow = "#b69aa4", green = "#152c47", cyan = "#02435f", blue = "#00648f", violet = "#602f46", pink = "#f8afc5", darkGray = "#000000", midGray = "#81cedf", lightGray = "#bcebf5" }
|
|
65
|
+
{ black = "#191d34", white = "#ffffff", red = "#ff4292", orange = "#e5e4c8", yellow = "#b69aa4", green = "#152c47", cyan = "#02435f", blue = "#00648f", violet = "#602f46", pink = "#f8afc5", darkGray = "#000000", midGray = "#81cedf", lightGray = "#bcebf5", disabled = defaultDisabled }
|
|
60
66
|
|
|
61
67
|
|
|
62
68
|
royal : Palette
|
|
63
69
|
royal =
|
|
64
|
-
{ black = "#003e52", white = "#ffffff", red = "#ff4d00", orange = "#ff7629", yellow = "#ff9900", green = "#3aa68c", cyan = "#1c5959", blue = "#008bc7", violet = "#a30000", pink = "#db4343", darkGray = "#0076a8", midGray = "#188686", lightGray = "#adfbdf" }
|
|
70
|
+
{ black = "#003e52", white = "#ffffff", red = "#ff4d00", orange = "#ff7629", yellow = "#ff9900", green = "#3aa68c", cyan = "#1c5959", blue = "#008bc7", violet = "#a30000", pink = "#db4343", darkGray = "#0076a8", midGray = "#188686", lightGray = "#adfbdf", disabled = defaultDisabled }
|
|
65
71
|
|
|
66
72
|
|
|
67
73
|
mono : Palette
|
|
68
74
|
mono =
|
|
69
|
-
{ black = "#000000", white = "#ffffff", red = "#cc2e2e", orange = "#949494", yellow = "#b8b8b8", green = "#c4c4c4", cyan = "#e6e6e6", blue = "#2b2b2b", violet = "#3b3b3b", pink = "#4f4f4f", darkGray = "#141414", midGray = "#737373", lightGray = "#cccccc" }
|
|
75
|
+
{ black = "#000000", white = "#ffffff", red = "#cc2e2e", orange = "#949494", yellow = "#b8b8b8", green = "#c4c4c4", cyan = "#e6e6e6", blue = "#2b2b2b", violet = "#3b3b3b", pink = "#4f4f4f", darkGray = "#141414", midGray = "#737373", lightGray = "#cccccc", disabled = defaultDisabled }
|
|
70
76
|
|
|
71
77
|
|
|
72
78
|
aqua : Palette
|
|
73
79
|
aqua =
|
|
74
|
-
{ black = "#000000", white = "#ffffff", red = "#21a198", orange = "#6f88b8", yellow = "#a5b7e3", green = "#8a9cff", cyan = "#ccddff", blue = "#0d2344", violet = "#002175", pink = "#2b3691", darkGray = "#010042", midGray = "#3852ad", lightGray = "#99afff" }
|
|
80
|
+
{ black = "#000000", white = "#ffffff", red = "#21a198", orange = "#6f88b8", yellow = "#a5b7e3", green = "#8a9cff", cyan = "#ccddff", blue = "#0d2344", violet = "#002175", pink = "#2b3691", darkGray = "#010042", midGray = "#3852ad", lightGray = "#99afff", disabled = defaultDisabled }
|
|
75
81
|
|
|
76
82
|
|
|
77
83
|
gold : Palette
|
|
78
84
|
gold =
|
|
79
|
-
{ black = "#3d1d10", white = "#7d7d7d", red = "#ddab64", orange = "#dc7138", yellow = "#d0a27c", green = "#3db872", cyan = "#5bb2be", blue = "#000000", violet = "#ad53c6", pink = "#ee8bb6", darkGray = "#141414", midGray = "#424242", lightGray = "#f5f5f5" }
|
|
85
|
+
{ black = "#3d1d10", white = "#7d7d7d", red = "#ddab64", orange = "#dc7138", yellow = "#d0a27c", green = "#3db872", cyan = "#5bb2be", blue = "#000000", violet = "#ad53c6", pink = "#ee8bb6", darkGray = "#141414", midGray = "#424242", lightGray = "#f5f5f5", disabled = defaultDisabled }
|
|
80
86
|
|
|
81
87
|
|
|
82
88
|
old : Palette
|
|
83
89
|
old =
|
|
84
|
-
{ black = "#4a5440", white = "#fde6c4", red = "#e34a4a", orange = "#d6ad71", yellow = "#b58712", green = "#3b5450", cyan = "#527575", blue = "#43637a", violet = "#698996", pink = "#c48787", darkGray = "#2c2321", midGray = "#3f3631", lightGray = "#c5ac96" }
|
|
90
|
+
{ black = "#4a5440", white = "#fde6c4", red = "#e34a4a", orange = "#d6ad71", yellow = "#b58712", green = "#3b5450", cyan = "#527575", blue = "#43637a", violet = "#698996", pink = "#c48787", darkGray = "#2c2321", midGray = "#3f3631", lightGray = "#c5ac96", disabled = defaultDisabled }
|
|
85
91
|
|
|
86
92
|
|
|
87
93
|
themes : List ( String, Palette )
|