@rokkit/core 1.0.0-next.100
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/LICENSE +21 -0
- package/README.md +1 -0
- package/package.json +59 -0
- package/src/calendar.js +44 -0
- package/src/colors/index.js +19 -0
- package/src/colors/syntax.json +42 -0
- package/src/colors/tailwind.json +289 -0
- package/src/connector.js +29 -0
- package/src/constants.js +118 -0
- package/src/index.js +17 -0
- package/src/mapped-list.js +233 -0
- package/src/mapping.js +138 -0
- package/src/nested.js +56 -0
- package/src/string.js +97 -0
- package/src/theme.js +197 -0
- package/src/ticks.js +26 -0
- package/src/types.js +115 -0
- package/src/utils.js +72 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Jerry Thomas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Core Components
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rokkit/core",
|
|
3
|
+
"version": "1.0.0-next.100",
|
|
4
|
+
"description": "Core components, actions and stores for svelte apps.",
|
|
5
|
+
"author": "Jerry Thomas <me@jerrythomas.name>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "src/index.js",
|
|
8
|
+
"module": "src/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
|
16
|
+
"@testing-library/svelte": "^5.2.1",
|
|
17
|
+
"@types/ramda": "^0.30.2",
|
|
18
|
+
"@vitest/coverage-v8": "^2.1.1",
|
|
19
|
+
"@vitest/ui": "~2.1.1",
|
|
20
|
+
"jsdom": "^25.0.0",
|
|
21
|
+
"svelte": "^4.2.19",
|
|
22
|
+
"typescript": "^5.6.2",
|
|
23
|
+
"vite": "^5.4.6",
|
|
24
|
+
"vitest": "~2.1.1",
|
|
25
|
+
"shared-config": "1.0.0-next.100",
|
|
26
|
+
"validators": "1.0.0-next.100"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"src/**/*.js",
|
|
30
|
+
"src/**/*.json",
|
|
31
|
+
"src/**/*.svelte",
|
|
32
|
+
"!spec"
|
|
33
|
+
],
|
|
34
|
+
"exports": {
|
|
35
|
+
"./src": "./src",
|
|
36
|
+
"./package.json": "./package.json",
|
|
37
|
+
"./constants": "./src/constants.js",
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"import": "./src/index.js",
|
|
41
|
+
"svelte": "./src/index.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"date-fns": "^4.1.0",
|
|
46
|
+
"ramda": "^0.30.1"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"format": "prettier --write .",
|
|
50
|
+
"lint": "eslint --fix .",
|
|
51
|
+
"test:ct": "playwright test -c playwright.config.js",
|
|
52
|
+
"test:ci": "vitest run",
|
|
53
|
+
"test:ui": "vitest --ui",
|
|
54
|
+
"test": "vitest",
|
|
55
|
+
"coverage": "vitest run --coverage",
|
|
56
|
+
"latest": "pnpm upgrade --latest && pnpm test:ci",
|
|
57
|
+
"release": "pnpm publish --access public"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/calendar.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { getDay, getMonth, getYear, getDaysInMonth, format, isWeekend } from 'date-fns'
|
|
2
|
+
|
|
3
|
+
export const weekdays = [
|
|
4
|
+
'Sunday',
|
|
5
|
+
'Monday',
|
|
6
|
+
'Tuesday',
|
|
7
|
+
'Wednesday',
|
|
8
|
+
'Thursday',
|
|
9
|
+
'Friday',
|
|
10
|
+
'Saturday'
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get the days in the month.
|
|
15
|
+
*
|
|
16
|
+
* @param {Date} value
|
|
17
|
+
* @param {Array} holidays
|
|
18
|
+
* @param {boolean} fixed
|
|
19
|
+
* @returns {import('./types').CalendarDay[]}
|
|
20
|
+
*/
|
|
21
|
+
export function getCalendarDays(value, holidays = [], fixed = false) {
|
|
22
|
+
const month = getMonth(value)
|
|
23
|
+
const year = getYear(value)
|
|
24
|
+
const offset = getDay(new Date(year, month, 1)) + 1
|
|
25
|
+
|
|
26
|
+
holidays = holidays.map((x) => format(new Date(x), 'yyyy-MMM-dd'))
|
|
27
|
+
let days = Array.from({ length: getDaysInMonth(value) }, (_, i) => ({
|
|
28
|
+
day: i + 1,
|
|
29
|
+
offset: i === 0 ? offset : 0,
|
|
30
|
+
date: new Date(year, month, i + 1)
|
|
31
|
+
})).map((x) => ({
|
|
32
|
+
...x,
|
|
33
|
+
text: format(x.date, 'yyyy-MMM-dd'),
|
|
34
|
+
weekend: isWeekend(x.date),
|
|
35
|
+
holiday: holidays.includes(format(x.date, 'yyyy-MMM-dd'))
|
|
36
|
+
}))
|
|
37
|
+
|
|
38
|
+
if (fixed && days[0].offset > 4) {
|
|
39
|
+
const n = 5 * 7 - days[0].offset
|
|
40
|
+
days = [...days.slice(n + 1), ...days.slice(0, n + 1)]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return days
|
|
44
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import defaultTailwindColors from './tailwind.json'
|
|
2
|
+
import syntaxColorPalette from './syntax.json'
|
|
3
|
+
|
|
4
|
+
export const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
5
|
+
export const defaultPalette = [
|
|
6
|
+
'neutral',
|
|
7
|
+
'primary',
|
|
8
|
+
'secondary',
|
|
9
|
+
'accent',
|
|
10
|
+
'success',
|
|
11
|
+
'warning',
|
|
12
|
+
'danger',
|
|
13
|
+
'info'
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
export const syntaxColors = syntaxColorPalette
|
|
17
|
+
export const defaultColors = {
|
|
18
|
+
...defaultTailwindColors
|
|
19
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"one-dark": {
|
|
3
|
+
"dark": {
|
|
4
|
+
"--tab-size": "2",
|
|
5
|
+
"--code-fill": "var(--neutral-100)",
|
|
6
|
+
"--code-normal": "#e06c75",
|
|
7
|
+
"--code-string": "#98c379",
|
|
8
|
+
"--code-number": "#d19a66",
|
|
9
|
+
"--code-atrule": "var(--code-string)",
|
|
10
|
+
"--code-keyword": "#c678dd",
|
|
11
|
+
"--code-comment": "#5c6370",
|
|
12
|
+
"--code-property": "#d19a66",
|
|
13
|
+
"--code-selector": "var(--code-keyword)",
|
|
14
|
+
"--code-operator": "#56b6c2",
|
|
15
|
+
"--code-function": "#61afef",
|
|
16
|
+
"--code-gutter-marker": "black",
|
|
17
|
+
"--code-gutter-subtle": "#999",
|
|
18
|
+
"--code-cursor": "#24292e",
|
|
19
|
+
"--code-cursor-block": "rgba(20, 255, 20, 0.5)",
|
|
20
|
+
"--code-linenumbers": "rgba(27, 31, 35, 0.3)"
|
|
21
|
+
},
|
|
22
|
+
"light": {
|
|
23
|
+
"--tab-size": "2",
|
|
24
|
+
"--code-fill": "var(--neutral-100)",
|
|
25
|
+
"--code-normal": "#333333",
|
|
26
|
+
"--code-string": "#9D8248",
|
|
27
|
+
"--code-number": "#71A15D",
|
|
28
|
+
"--code-atrule": "var(--code-string)",
|
|
29
|
+
"--code-keyword": "#3080B5",
|
|
30
|
+
"--code-comment": "#969896",
|
|
31
|
+
"--code-property": "#63a35c",
|
|
32
|
+
"--code-selector": "var(--code-keyword)",
|
|
33
|
+
"--code-operator": "#bf5625",
|
|
34
|
+
"--code-function": "#a71d5d",
|
|
35
|
+
"--code-gutter-marker": "black",
|
|
36
|
+
"--code-gutter-subtle": "#999",
|
|
37
|
+
"--code-cursor": "#24292e",
|
|
38
|
+
"--code-cursor-block": "rgba(20, 255, 20, 0.5)",
|
|
39
|
+
"--code-linenumbers": "rgba(27, 31, 35, 0.3)"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
{
|
|
2
|
+
"amber": {
|
|
3
|
+
"50": "#fffbeb",
|
|
4
|
+
"100": "#fef3c7",
|
|
5
|
+
"200": "#fde68a",
|
|
6
|
+
"300": "#fcd34d",
|
|
7
|
+
"400": "#fbbf24",
|
|
8
|
+
"500": "#f59e0b",
|
|
9
|
+
"600": "#d97706",
|
|
10
|
+
"700": "#b45309",
|
|
11
|
+
"800": "#92400e",
|
|
12
|
+
"900": "#78350f",
|
|
13
|
+
"950": "#451a03"
|
|
14
|
+
},
|
|
15
|
+
"blue": {
|
|
16
|
+
"50": "#eff6ff",
|
|
17
|
+
"100": "#dbeafe",
|
|
18
|
+
"200": "#bfdbfe",
|
|
19
|
+
"300": "#93c5fd",
|
|
20
|
+
"400": "#60a5fa",
|
|
21
|
+
"500": "#3b82f6",
|
|
22
|
+
"600": "#2563eb",
|
|
23
|
+
"700": "#1d4ed8",
|
|
24
|
+
"800": "#1e40af",
|
|
25
|
+
"900": "#1e3a8a",
|
|
26
|
+
"950": "#172554"
|
|
27
|
+
},
|
|
28
|
+
"cyan": {
|
|
29
|
+
"50": "#ecfeff",
|
|
30
|
+
"100": "#cffafe",
|
|
31
|
+
"200": "#a5f3fc",
|
|
32
|
+
"300": "#67e8f9",
|
|
33
|
+
"400": "#22d3ee",
|
|
34
|
+
"500": "#06b6d4",
|
|
35
|
+
"600": "#0891b2",
|
|
36
|
+
"700": "#0e7490",
|
|
37
|
+
"800": "#155e75",
|
|
38
|
+
"900": "#164e63",
|
|
39
|
+
"950": "#083344"
|
|
40
|
+
},
|
|
41
|
+
"emerald": {
|
|
42
|
+
"50": "#ecfdf5",
|
|
43
|
+
"100": "#d1fae5",
|
|
44
|
+
"200": "#a7f3d0",
|
|
45
|
+
"300": "#6ee7b7",
|
|
46
|
+
"400": "#34d399",
|
|
47
|
+
"500": "#10b981",
|
|
48
|
+
"600": "#059669",
|
|
49
|
+
"700": "#047857",
|
|
50
|
+
"800": "#065f46",
|
|
51
|
+
"900": "#064e3b",
|
|
52
|
+
"950": "#022c22"
|
|
53
|
+
},
|
|
54
|
+
"fuscia": {
|
|
55
|
+
"50": "#fdf4ff",
|
|
56
|
+
"100": "#fae8ff",
|
|
57
|
+
"200": "#f5d0fe",
|
|
58
|
+
"300": "#f0abfc",
|
|
59
|
+
"400": "#e879f9",
|
|
60
|
+
"500": "#d946ef",
|
|
61
|
+
"600": "#c026d3",
|
|
62
|
+
"700": "#a21caf",
|
|
63
|
+
"800": "#86198f",
|
|
64
|
+
"900": "#701a75",
|
|
65
|
+
"950": "#4a044e"
|
|
66
|
+
},
|
|
67
|
+
"gray": {
|
|
68
|
+
"50": "#f9fafb",
|
|
69
|
+
"100": "#f3f4f6",
|
|
70
|
+
"200": "#e5e7eb",
|
|
71
|
+
"300": "#d1d5db",
|
|
72
|
+
"400": "#9ca3af",
|
|
73
|
+
"500": "#6b7280",
|
|
74
|
+
"600": "#4b5563",
|
|
75
|
+
"700": "#374151",
|
|
76
|
+
"800": "#1f2937",
|
|
77
|
+
"900": "#111827",
|
|
78
|
+
"950": "#00060c"
|
|
79
|
+
},
|
|
80
|
+
"green": {
|
|
81
|
+
"50": "#f0fdf4",
|
|
82
|
+
"100": "#dcfce7",
|
|
83
|
+
"200": "#bbf7d0",
|
|
84
|
+
"300": "#86efac",
|
|
85
|
+
"400": "#4ade80",
|
|
86
|
+
"500": "#22c55e",
|
|
87
|
+
"600": "#16a34a",
|
|
88
|
+
"700": "#15803d",
|
|
89
|
+
"800": "#166534",
|
|
90
|
+
"900": "#14532d",
|
|
91
|
+
"950": "#052e16"
|
|
92
|
+
},
|
|
93
|
+
"indigo": {
|
|
94
|
+
"50": "#eef2ff",
|
|
95
|
+
"100": "#e0e7ff",
|
|
96
|
+
"200": "#c7d2fe",
|
|
97
|
+
"300": "#a5b4fc",
|
|
98
|
+
"400": "#818cf8",
|
|
99
|
+
"500": "#6366f1",
|
|
100
|
+
"600": "#4f46e5",
|
|
101
|
+
"700": "#4338ca",
|
|
102
|
+
"800": "#3730a3",
|
|
103
|
+
"900": "#312e81",
|
|
104
|
+
"950": "#1e1b4b"
|
|
105
|
+
},
|
|
106
|
+
"lime": {
|
|
107
|
+
"50": "#f7fee7",
|
|
108
|
+
"100": "#ecfccb",
|
|
109
|
+
"200": "#d9f99d",
|
|
110
|
+
"300": "#bef264",
|
|
111
|
+
"400": "#a3e635",
|
|
112
|
+
"500": "#84cc16",
|
|
113
|
+
"600": "#65a30d",
|
|
114
|
+
"700": "#4d7c0f",
|
|
115
|
+
"800": "#3f6212",
|
|
116
|
+
"900": "#365314",
|
|
117
|
+
"950": "#1a2e05"
|
|
118
|
+
},
|
|
119
|
+
"orange": {
|
|
120
|
+
"50": "#fff7ed",
|
|
121
|
+
"100": "#ffedd5",
|
|
122
|
+
"200": "#fed7aa",
|
|
123
|
+
"300": "#fdba74",
|
|
124
|
+
"400": "#fb923c",
|
|
125
|
+
"500": "#f97316",
|
|
126
|
+
"600": "#ea580c",
|
|
127
|
+
"700": "#c2410c",
|
|
128
|
+
"800": "#9a3412",
|
|
129
|
+
"900": "#7c2d12",
|
|
130
|
+
"950": "#431407"
|
|
131
|
+
},
|
|
132
|
+
"pink": {
|
|
133
|
+
"50": "#fdf2f8",
|
|
134
|
+
"100": "#fce7f3",
|
|
135
|
+
"200": "#fbcfe8",
|
|
136
|
+
"300": "#f9a8d4",
|
|
137
|
+
"400": "#f472b6",
|
|
138
|
+
"500": "#ec4899",
|
|
139
|
+
"600": "#db2777",
|
|
140
|
+
"700": "#be185d",
|
|
141
|
+
"800": "#9d174d",
|
|
142
|
+
"900": "#831843",
|
|
143
|
+
"950": "#500724"
|
|
144
|
+
},
|
|
145
|
+
"purple": {
|
|
146
|
+
"50": "#faf5ff",
|
|
147
|
+
"100": "#f3e8ff",
|
|
148
|
+
"200": "#e9d5ff",
|
|
149
|
+
"300": "#d8b4fe",
|
|
150
|
+
"400": "#c084fc",
|
|
151
|
+
"500": "#a855f7",
|
|
152
|
+
"600": "#9333ea",
|
|
153
|
+
"700": "#7e22ce",
|
|
154
|
+
"800": "#6b21a8",
|
|
155
|
+
"900": "#581c87",
|
|
156
|
+
"950": "#3b0764"
|
|
157
|
+
},
|
|
158
|
+
"red": {
|
|
159
|
+
"50": "#fef2f2",
|
|
160
|
+
"100": "#fee2e2",
|
|
161
|
+
"200": "#fecaca",
|
|
162
|
+
"300": "#fca5a5",
|
|
163
|
+
"400": "#f87171",
|
|
164
|
+
"500": "#ef4444",
|
|
165
|
+
"600": "#dc2626",
|
|
166
|
+
"700": "#b91c1c",
|
|
167
|
+
"800": "#991b1b",
|
|
168
|
+
"900": "#7f1d1d",
|
|
169
|
+
"950": "#450a0a"
|
|
170
|
+
},
|
|
171
|
+
"rose": {
|
|
172
|
+
"50": "#fff1f2",
|
|
173
|
+
"100": "#ffe4e6",
|
|
174
|
+
"200": "#fecdd3",
|
|
175
|
+
"300": "#fda4af",
|
|
176
|
+
"400": "#fb7185",
|
|
177
|
+
"500": "#f43f5e",
|
|
178
|
+
"600": "#e11d48",
|
|
179
|
+
"700": "#be123c",
|
|
180
|
+
"800": "#9f1239",
|
|
181
|
+
"900": "#881337",
|
|
182
|
+
"950": "#4c0519"
|
|
183
|
+
},
|
|
184
|
+
"sky": {
|
|
185
|
+
"50": "#f0f9ff",
|
|
186
|
+
"100": "#e0f2fe",
|
|
187
|
+
"200": "#bae6fd",
|
|
188
|
+
"300": "#7dd3fc",
|
|
189
|
+
"400": "#38bdf8",
|
|
190
|
+
"500": "#0ea5e9",
|
|
191
|
+
"600": "#0284c7",
|
|
192
|
+
"700": "#0369a1",
|
|
193
|
+
"800": "#075985",
|
|
194
|
+
"900": "#0c4a6e",
|
|
195
|
+
"950": "#082f49"
|
|
196
|
+
},
|
|
197
|
+
"slate": {
|
|
198
|
+
"50": "#f8fafc",
|
|
199
|
+
"100": "#f1f5f9",
|
|
200
|
+
"200": "#e2e8f0",
|
|
201
|
+
"300": "#cbd5e0",
|
|
202
|
+
"400": "#94a3b8",
|
|
203
|
+
"500": "#64748b",
|
|
204
|
+
"600": "#475569",
|
|
205
|
+
"700": "#334155",
|
|
206
|
+
"800": "#1e293b",
|
|
207
|
+
"900": "#0f172a",
|
|
208
|
+
"950": "#020617"
|
|
209
|
+
},
|
|
210
|
+
"stone": {
|
|
211
|
+
"50": "#fafaf9",
|
|
212
|
+
"100": "#f5f5f4",
|
|
213
|
+
"200": "#e7e5e4",
|
|
214
|
+
"300": "#d6d3d1",
|
|
215
|
+
"400": "#a8a29e",
|
|
216
|
+
"500": "#78716c",
|
|
217
|
+
"600": "#57534e",
|
|
218
|
+
"700": "#44403c",
|
|
219
|
+
"800": "#292524",
|
|
220
|
+
"900": "#1c1917",
|
|
221
|
+
"950": "#0c0a09"
|
|
222
|
+
},
|
|
223
|
+
"teal": {
|
|
224
|
+
"50": "#f0fdfa",
|
|
225
|
+
"100": "#ccfbf1",
|
|
226
|
+
"200": "#99f6e4",
|
|
227
|
+
"300": "#5eead4",
|
|
228
|
+
"400": "#2dd4bf",
|
|
229
|
+
"500": "#14b8a6",
|
|
230
|
+
"600": "#0d9488",
|
|
231
|
+
"700": "#0f766e",
|
|
232
|
+
"800": "#115e59",
|
|
233
|
+
"900": "#134e4a",
|
|
234
|
+
"950": "#042f2e"
|
|
235
|
+
},
|
|
236
|
+
"violet": {
|
|
237
|
+
"50": "#f5f3ff",
|
|
238
|
+
"100": "#ede9fe",
|
|
239
|
+
"200": "#ddd6fe",
|
|
240
|
+
"300": "#c4b5fd",
|
|
241
|
+
"400": "#a78bfa",
|
|
242
|
+
"500": "#8b5cf6",
|
|
243
|
+
"600": "#7c3aed",
|
|
244
|
+
"700": "#6d28d9",
|
|
245
|
+
"800": "#5b21b6",
|
|
246
|
+
"900": "#4c1d95",
|
|
247
|
+
"950": "#2e1065"
|
|
248
|
+
},
|
|
249
|
+
"yellow": {
|
|
250
|
+
"50": "#fefce8",
|
|
251
|
+
"100": "#fef9c3",
|
|
252
|
+
"200": "#fef08a",
|
|
253
|
+
"300": "#fde047",
|
|
254
|
+
"400": "#facc15",
|
|
255
|
+
"500": "#eab308",
|
|
256
|
+
"600": "#ca8a04",
|
|
257
|
+
"700": "#a16207",
|
|
258
|
+
"800": "#854d0e",
|
|
259
|
+
"900": "#713f12",
|
|
260
|
+
"950": "#422006"
|
|
261
|
+
},
|
|
262
|
+
"zinc": {
|
|
263
|
+
"50": "#fafafa",
|
|
264
|
+
"100": "#f4f4f5",
|
|
265
|
+
"200": "#e4e4e7",
|
|
266
|
+
"300": "#d4d4d8",
|
|
267
|
+
"400": "#a1a1aa",
|
|
268
|
+
"500": "#71717a",
|
|
269
|
+
"600": "#52525b",
|
|
270
|
+
"700": "#3f3f46",
|
|
271
|
+
"800": "#27272a",
|
|
272
|
+
"900": "#18181b",
|
|
273
|
+
"950": "#000000"
|
|
274
|
+
},
|
|
275
|
+
"shark": {
|
|
276
|
+
"DEFAULT": "#677287",
|
|
277
|
+
"50": "#ffffff",
|
|
278
|
+
"100": "#efefef",
|
|
279
|
+
"200": "#E0E0E0",
|
|
280
|
+
"300": "#C1C6D0",
|
|
281
|
+
"400": "#828C9F",
|
|
282
|
+
"500": "#677287",
|
|
283
|
+
"600": "#51596A",
|
|
284
|
+
"700": "#3B414D",
|
|
285
|
+
"800": "#2E323C",
|
|
286
|
+
"900": "#20242A",
|
|
287
|
+
"950": "#1A1C22"
|
|
288
|
+
}
|
|
289
|
+
}
|
package/src/connector.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const nextType = {
|
|
2
|
+
child: 'sibling',
|
|
3
|
+
last: 'empty',
|
|
4
|
+
sibling: 'sibling',
|
|
5
|
+
empty: 'empty'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Constructs an array of line types based on the provided parameters.
|
|
10
|
+
*
|
|
11
|
+
* @param {boolean} hasChildren - Indicates whether the current item has children, affecting the line type for the item itself.
|
|
12
|
+
* @param {Array<string>} parentTypes - An array of types from the parent indicating the line type context.
|
|
13
|
+
* @param {string} position - The line type to use for the current position (usually 'child' or 'last').
|
|
14
|
+
* @returns {Array<string>} An array of line types.
|
|
15
|
+
*/
|
|
16
|
+
export function getLineTypes(hasChildren = false, parentTypes = [], position = 'child') {
|
|
17
|
+
// Map each parent type to a line type, except for the last element.
|
|
18
|
+
const types = parentTypes.slice(0, -1).map((type) => nextType[type])
|
|
19
|
+
|
|
20
|
+
// Append the position type for the last parent, if any.
|
|
21
|
+
if (parentTypes.length > 0) {
|
|
22
|
+
types.push(position)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Append the line type based on whether the current item has children.
|
|
26
|
+
types.push(hasChildren ? 'icon' : 'empty')
|
|
27
|
+
|
|
28
|
+
return types
|
|
29
|
+
}
|
package/src/constants.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export { defaultColors, syntaxColors, shades, defaultPalette } from './colors'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @type {import('./types).FieldMapping} Fields
|
|
5
|
+
*/
|
|
6
|
+
export const defaultFields = {
|
|
7
|
+
id: 'id',
|
|
8
|
+
url: 'url',
|
|
9
|
+
text: 'text',
|
|
10
|
+
value: 'value',
|
|
11
|
+
children: 'children',
|
|
12
|
+
icon: 'icon',
|
|
13
|
+
iconPrefix: null,
|
|
14
|
+
image: 'image',
|
|
15
|
+
component: 'component',
|
|
16
|
+
summary: 'summary',
|
|
17
|
+
notes: 'notes',
|
|
18
|
+
props: 'props',
|
|
19
|
+
target: 'target',
|
|
20
|
+
state: 'state',
|
|
21
|
+
isOpen: '_open',
|
|
22
|
+
isDeleted: '_deleted',
|
|
23
|
+
level: 'level',
|
|
24
|
+
parent: 'parent',
|
|
25
|
+
currency: 'currency'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const defaultIcons = [
|
|
29
|
+
'accordion-opened',
|
|
30
|
+
'accordion-closed',
|
|
31
|
+
'action-remove',
|
|
32
|
+
'action-add',
|
|
33
|
+
'action-clear',
|
|
34
|
+
'action-search',
|
|
35
|
+
'action-close',
|
|
36
|
+
'node-opened',
|
|
37
|
+
'node-closed',
|
|
38
|
+
'selector-opened',
|
|
39
|
+
'selector-closed',
|
|
40
|
+
'checkbox-checked',
|
|
41
|
+
'checkbox-unchecked',
|
|
42
|
+
'checkbox-unknown',
|
|
43
|
+
'rating-filled',
|
|
44
|
+
'rating-empty',
|
|
45
|
+
'rating-half',
|
|
46
|
+
'radio-off',
|
|
47
|
+
'radio-on',
|
|
48
|
+
'mode-dark',
|
|
49
|
+
'mode-light',
|
|
50
|
+
'navigate-left',
|
|
51
|
+
'navigate-right',
|
|
52
|
+
'navigate-up',
|
|
53
|
+
'navigate-down',
|
|
54
|
+
'state-error',
|
|
55
|
+
'state-warning',
|
|
56
|
+
'state-success',
|
|
57
|
+
'state-info',
|
|
58
|
+
'state-unknown',
|
|
59
|
+
'badge-fail',
|
|
60
|
+
'badge-warn',
|
|
61
|
+
'badge-pass',
|
|
62
|
+
'badge-unknown',
|
|
63
|
+
'sort-none',
|
|
64
|
+
'sort-ascending',
|
|
65
|
+
'sort-descending',
|
|
66
|
+
'validity-failed',
|
|
67
|
+
'validity-passed',
|
|
68
|
+
'validity-unknown',
|
|
69
|
+
'validity-warning'
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
export const defaultOptions = {
|
|
73
|
+
id: 'id',
|
|
74
|
+
label: 'label',
|
|
75
|
+
value: 'value',
|
|
76
|
+
checked: 'checked'
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const defaultKeyMap = {
|
|
80
|
+
ArrowRight: 'open',
|
|
81
|
+
ArrowLeft: 'close',
|
|
82
|
+
ArrowDown: 'down',
|
|
83
|
+
ArrowUp: 'up',
|
|
84
|
+
Enter: 'select',
|
|
85
|
+
Escape: 'deselect'
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const defaultThemeMapping = {
|
|
89
|
+
neutral: 'slate',
|
|
90
|
+
primary: 'orange',
|
|
91
|
+
secondary: 'pink',
|
|
92
|
+
accent: 'sky',
|
|
93
|
+
success: 'green',
|
|
94
|
+
warning: 'yellow',
|
|
95
|
+
danger: 'red',
|
|
96
|
+
error: 'red',
|
|
97
|
+
info: 'cyan'
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Generate a state icon mapping from a list of icon names
|
|
102
|
+
*
|
|
103
|
+
* @param {string[]} icons
|
|
104
|
+
* @returns {import('./types').StateIcons}
|
|
105
|
+
*/
|
|
106
|
+
export function stateIconsFromNames(icons) {
|
|
107
|
+
return icons
|
|
108
|
+
.map((k) => [...k.split('-')])
|
|
109
|
+
.reduce(
|
|
110
|
+
(acc, parts) => ({
|
|
111
|
+
...acc,
|
|
112
|
+
[parts[0]]: { ...acc[parts[0]], [parts[1]]: parts.join('-') }
|
|
113
|
+
}),
|
|
114
|
+
{}
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const defaultStateIcons = stateIconsFromNames(defaultIcons)
|
package/src/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// skipcq: JS-E1004 - Needed for exposing JS Doc types
|
|
2
|
+
export * from './types'
|
|
3
|
+
// skipcq: JS-E1004 - Needed for exposing all constants
|
|
4
|
+
export * from './constants'
|
|
5
|
+
export { flattenNestedList, findValueFromPath } from './nested'
|
|
6
|
+
// skipcq: JS-E1004 - Needed for exposing all functions
|
|
7
|
+
export * from './mapping'
|
|
8
|
+
export { mappedList } from './mapped-list'
|
|
9
|
+
export { getLineTypes } from './connector'
|
|
10
|
+
export { generateTicks } from './ticks'
|
|
11
|
+
export { weekdays, getCalendarDays } from './calendar'
|
|
12
|
+
// skipcq: JS-E1004 - Needed for exposing all functions
|
|
13
|
+
export * from './utils'
|
|
14
|
+
// skipcq: JS-E1004 - Needed for exposing all functions
|
|
15
|
+
export * from './theme'
|
|
16
|
+
// skipcq: JS-E1004 - Needed for exposing all functions
|
|
17
|
+
export * from './string'
|