@inkdropapp/theme-dev-helpers 0.2.1 → 0.3.0

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/Session.vim ADDED
@@ -0,0 +1,249 @@
1
+ let SessionLoad = 1
2
+ let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1
3
+ let v:this_session=expand("<sfile>:p")
4
+ silent only
5
+ silent tabonly
6
+ cd ~/Developments/inkdrop/theme-dev-helpers
7
+ if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
8
+ let s:wipebuf = bufnr('%')
9
+ endif
10
+ let s:shortmess_save = &shortmess
11
+ if &shortmess =~ 'A'
12
+ set shortmess=aoOA
13
+ else
14
+ set shortmess=aoO
15
+ endif
16
+ badd +24 package.json
17
+ badd +2 src/dev-server.tsx
18
+ badd +18 tsconfig.json
19
+ badd +31 src/dev-server.css
20
+ badd +9 ~/Developments/inkdrop/theme-dev-helpers/src/dev-server/index.tsx
21
+ badd +9 ~/Developments/inkdrop/theme-dev-helpers/src/dev-server/color-tokens.tsx
22
+ badd +63 src/generate-palette.ts
23
+ badd +3 src/dev-server/css-variables.ts
24
+ argglobal
25
+ %argdel
26
+ $argadd package.json
27
+ edit package.json
28
+ let s:save_splitbelow = &splitbelow
29
+ let s:save_splitright = &splitright
30
+ set splitbelow splitright
31
+ wincmd _ | wincmd |
32
+ vsplit
33
+ wincmd _ | wincmd |
34
+ vsplit
35
+ wincmd _ | wincmd |
36
+ vsplit
37
+ wincmd _ | wincmd |
38
+ vsplit
39
+ wincmd _ | wincmd |
40
+ vsplit
41
+ 5wincmd h
42
+ wincmd w
43
+ wincmd w
44
+ wincmd w
45
+ wincmd _ | wincmd |
46
+ split
47
+ 1wincmd k
48
+ wincmd w
49
+ wincmd w
50
+ wincmd w
51
+ let &splitbelow = s:save_splitbelow
52
+ let &splitright = s:save_splitright
53
+ wincmd t
54
+ let s:save_winminheight = &winminheight
55
+ let s:save_winminwidth = &winminwidth
56
+ set winminheight=0
57
+ set winheight=1
58
+ set winminwidth=0
59
+ set winwidth=1
60
+ wincmd =
61
+ argglobal
62
+ setlocal fdm=expr
63
+ setlocal fde=v:lua.require'lazyvim.util'.ui.foldexpr()
64
+ setlocal fmr={{{,}}}
65
+ setlocal fdi=#
66
+ setlocal fdl=99
67
+ setlocal fml=1
68
+ setlocal fdn=20
69
+ setlocal fen
70
+ let s:l = 2 - ((1 * winheight(0) + 36) / 73)
71
+ if s:l < 1 | let s:l = 1 | endif
72
+ keepjumps exe s:l
73
+ normal! zt
74
+ keepjumps 2
75
+ normal! 03|
76
+ wincmd w
77
+ argglobal
78
+ if bufexists(fnamemodify("tsconfig.json", ":p")) | buffer tsconfig.json | else | edit tsconfig.json | endif
79
+ if &buftype ==# 'terminal'
80
+ silent file tsconfig.json
81
+ endif
82
+ balt package.json
83
+ setlocal fdm=expr
84
+ setlocal fde=v:lua.require'lazyvim.util'.ui.foldexpr()
85
+ setlocal fmr={{{,}}}
86
+ setlocal fdi=#
87
+ setlocal fdl=99
88
+ setlocal fml=1
89
+ setlocal fdn=20
90
+ setlocal fen
91
+ 1
92
+ normal! zo
93
+ 2
94
+ normal! zo
95
+ let s:l = 14 - ((13 * winheight(0) + 36) / 73)
96
+ if s:l < 1 | let s:l = 1 | endif
97
+ keepjumps exe s:l
98
+ normal! zt
99
+ keepjumps 14
100
+ normal! 06|
101
+ wincmd w
102
+ argglobal
103
+ if bufexists(fnamemodify("src/dev-server.tsx", ":p")) | buffer src/dev-server.tsx | else | edit src/dev-server.tsx | endif
104
+ if &buftype ==# 'terminal'
105
+ silent file src/dev-server.tsx
106
+ endif
107
+ balt package.json
108
+ setlocal fdm=expr
109
+ setlocal fde=v:lua.require'lazyvim.util'.ui.foldexpr()
110
+ setlocal fmr={{{,}}}
111
+ setlocal fdi=#
112
+ setlocal fdl=99
113
+ setlocal fml=1
114
+ setlocal fdn=20
115
+ setlocal fen
116
+ 23
117
+ normal! zo
118
+ 31
119
+ normal! zo
120
+ let s:l = 28 - ((27 * winheight(0) + 36) / 73)
121
+ if s:l < 1 | let s:l = 1 | endif
122
+ keepjumps exe s:l
123
+ normal! zt
124
+ keepjumps 28
125
+ normal! 049|
126
+ wincmd w
127
+ argglobal
128
+ if bufexists(fnamemodify("~/Developments/inkdrop/theme-dev-helpers/src/dev-server/index.tsx", ":p")) | buffer ~/Developments/inkdrop/theme-dev-helpers/src/dev-server/index.tsx | else | edit ~/Developments/inkdrop/theme-dev-helpers/src/dev-server/index.tsx | endif
129
+ if &buftype ==# 'terminal'
130
+ silent file ~/Developments/inkdrop/theme-dev-helpers/src/dev-server/index.tsx
131
+ endif
132
+ setlocal fdm=expr
133
+ setlocal fde=v:lua.require'lazyvim.util'.ui.foldexpr()
134
+ setlocal fmr={{{,}}}
135
+ setlocal fdi=#
136
+ setlocal fdl=99
137
+ setlocal fml=1
138
+ setlocal fdn=20
139
+ setlocal fen
140
+ 4
141
+ normal! zo
142
+ 6
143
+ normal! zo
144
+ 8
145
+ normal! zo
146
+ 9
147
+ normal! zo
148
+ let s:l = 13 - ((12 * winheight(0) + 18) / 36)
149
+ if s:l < 1 | let s:l = 1 | endif
150
+ keepjumps exe s:l
151
+ normal! zt
152
+ keepjumps 13
153
+ normal! 027|
154
+ wincmd w
155
+ argglobal
156
+ if bufexists(fnamemodify("~/Developments/inkdrop/theme-dev-helpers/src/dev-server/color-tokens.tsx", ":p")) | buffer ~/Developments/inkdrop/theme-dev-helpers/src/dev-server/color-tokens.tsx | else | edit ~/Developments/inkdrop/theme-dev-helpers/src/dev-server/color-tokens.tsx | endif
157
+ if &buftype ==# 'terminal'
158
+ silent file ~/Developments/inkdrop/theme-dev-helpers/src/dev-server/color-tokens.tsx
159
+ endif
160
+ setlocal fdm=expr
161
+ setlocal fde=v:lua.require'lazyvim.util'.ui.foldexpr()
162
+ setlocal fmr={{{,}}}
163
+ setlocal fdi=#
164
+ setlocal fdl=99
165
+ setlocal fml=1
166
+ setlocal fdn=20
167
+ setlocal fen
168
+ let s:l = 9 - ((8 * winheight(0) + 18) / 36)
169
+ if s:l < 1 | let s:l = 1 | endif
170
+ keepjumps exe s:l
171
+ normal! zt
172
+ keepjumps 9
173
+ normal! 0
174
+ wincmd w
175
+ argglobal
176
+ if bufexists(fnamemodify("src/dev-server.css", ":p")) | buffer src/dev-server.css | else | edit src/dev-server.css | endif
177
+ if &buftype ==# 'terminal'
178
+ silent file src/dev-server.css
179
+ endif
180
+ balt src/dev-server.tsx
181
+ setlocal fdm=expr
182
+ setlocal fde=v:lua.require'lazyvim.util'.ui.foldexpr()
183
+ setlocal fmr={{{,}}}
184
+ setlocal fdi=#
185
+ setlocal fdl=99
186
+ setlocal fml=1
187
+ setlocal fdn=20
188
+ setlocal fen
189
+ 14
190
+ normal! zo
191
+ 20
192
+ normal! zo
193
+ let s:l = 31 - ((30 * winheight(0) + 36) / 73)
194
+ if s:l < 1 | let s:l = 1 | endif
195
+ keepjumps exe s:l
196
+ normal! zt
197
+ keepjumps 31
198
+ normal! 0
199
+ wincmd w
200
+ argglobal
201
+ if bufexists(fnamemodify("src/generate-palette.ts", ":p")) | buffer src/generate-palette.ts | else | edit src/generate-palette.ts | endif
202
+ if &buftype ==# 'terminal'
203
+ silent file src/generate-palette.ts
204
+ endif
205
+ balt package.json
206
+ setlocal fdm=expr
207
+ setlocal fde=v:lua.require'lazyvim.util'.ui.foldexpr()
208
+ setlocal fmr={{{,}}}
209
+ setlocal fdi=#
210
+ setlocal fdl=99
211
+ setlocal fml=1
212
+ setlocal fdn=20
213
+ setlocal fen
214
+ 25
215
+ normal! zo
216
+ 33
217
+ normal! zo
218
+ 62
219
+ normal! zo
220
+ 65
221
+ normal! zo
222
+ let s:l = 63 - ((48 * winheight(0) + 36) / 73)
223
+ if s:l < 1 | let s:l = 1 | endif
224
+ keepjumps exe s:l
225
+ normal! zt
226
+ keepjumps 63
227
+ normal! 0
228
+ wincmd w
229
+ 5wincmd w
230
+ wincmd =
231
+ tabnext 1
232
+ if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
233
+ silent exe 'bwipe ' . s:wipebuf
234
+ endif
235
+ unlet! s:wipebuf
236
+ set winheight=1 winwidth=20
237
+ let &shortmess = s:shortmess_save
238
+ let &winminheight = s:save_winminheight
239
+ let &winminwidth = s:save_winminwidth
240
+ let s:sx = expand("<sfile>:p:r")."x.vim"
241
+ if filereadable(s:sx)
242
+ exe "source " . fnameescape(s:sx)
243
+ endif
244
+ let &g:so = s:so_save | let &g:siso = s:siso_save
245
+ set hlsearch
246
+ nohlsearch
247
+ doautoall SessionLoadPost
248
+ unlet SessionLoad
249
+ " vim: set ft=vim :
package/bun.lockb CHANGED
Binary file
package/index.html ADDED
@@ -0,0 +1,16 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
+ <title>Inkdrop theme dev tool</title>
9
+ </head>
10
+
11
+ <body>
12
+ <div id="root"></div>
13
+ <script type="module" src="/src/dev-server.tsx"></script>
14
+ </body>
15
+
16
+ </html>
package/package.json CHANGED
@@ -1,23 +1,41 @@
1
1
  {
2
2
  "name": "@inkdropapp/theme-dev-helpers",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
+ "type": "module",
4
5
  "description": "A helper module for creating themes for Inkdrop",
5
6
  "keywords": [
6
7
  "inkdrop",
7
8
  "markdown"
8
9
  ],
9
10
  "scripts": {
11
+ "dev-server": "bunx --bun vite",
10
12
  "test": "echo \"Error: no test specified\" && exit 1"
11
13
  },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/inkdropapp/theme-dev-helpers.git"
17
+ },
12
18
  "author": "Takuya Matsuyama<t@inkdrop.app>",
13
19
  "license": "MIT",
14
20
  "bin": {
15
21
  "generate-palette": "./bin/generate-palette"
16
22
  },
17
23
  "dependencies": {
18
- "@inkdropapp/base-ui-theme": "^0.3.0",
24
+ "@inkdropapp/base-ui-theme": "^0.3.1",
19
25
  "@inkdropapp/css": "^0.4.2",
26
+ "@types/react": "^18.3.10",
27
+ "@types/react-dom": "^18.3.0",
28
+ "@vitejs/plugin-react": "^4.3.2",
20
29
  "commander": "^12.1.0",
21
- "puppeteer": "^23.5.3"
30
+ "puppeteer": "^23.5.3",
31
+ "react": "^18.3.1",
32
+ "react-dom": "^18.3.1",
33
+ "react-router-dom": "^6.27.0",
34
+ "typescript": "^5.5.3",
35
+ "typescript-eslint": "^8.7.0",
36
+ "vite": "^5.4.8"
37
+ },
38
+ "devDependencies": {
39
+ "prettier": "^3.3.3"
22
40
  }
23
41
  }
@@ -0,0 +1,31 @@
1
+ import { getCSSVariables } from './get-css-variables'
2
+
3
+ export const ColorTokensPage = () => {
4
+ const cssVariables = getCSSVariables()
5
+
6
+ return (
7
+ <>
8
+ <h2>Color Tokens</h2>
9
+ <div className='variable-list'>
10
+ {Object.keys(cssVariables)
11
+ .filter(name => name.startsWith('--color') || name.startsWith('--hsl'))
12
+ .map(variableName => {
13
+ return (
14
+ <div key={variableName} className='variable-item'>
15
+ <div className='color-box' style={{
16
+ background: variableName.startsWith('--hsl') ? `hsl(var(${variableName}))` : `var(${variableName})`
17
+ }}></div>
18
+ <div className='data'>
19
+ <div className='variable-name'>{variableName}</div>
20
+ <div className='variable-value'>
21
+ {cssVariables[variableName]}
22
+ </div>
23
+ </div>
24
+ </div>
25
+ )
26
+ })}
27
+ </div>
28
+ </>
29
+ )
30
+ }
31
+
@@ -0,0 +1,5 @@
1
+ .component-list {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 1em;
5
+ }
@@ -0,0 +1,215 @@
1
+ import './components.css'
2
+
3
+ export const ComponentsPage = () => {
4
+ return (
5
+ <>
6
+ <h2>Components</h2>
7
+ <div className="component-list">
8
+
9
+ <div className="component-item">
10
+ <h3>Link</h3>
11
+ <div>
12
+ <a href="https://www.inkdrop.app/">https://www.inkdrop.app/</a>
13
+ </div>
14
+ </div>
15
+
16
+ <div className="component-item">
17
+ <h3>Button</h3>
18
+ <div>
19
+ <div>
20
+ <button className="ui button">Button</button>
21
+ <button className="ui basic button">Basic Button</button>
22
+ <button className="ui primary button">Primary Button</button>
23
+ <button className="ui negative button">Negative Button</button>
24
+ <button className="ui tiny circular icon button plugin-uninstall-button "
25
+ title="Uninstall">
26
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="14" height="14"
27
+ name="bin-1" className="svg-icon streamline bin-1 ">
28
+ <defs>
29
+ <style>{`
30
+ .bin-1_svg__a {
31
+ fill: none;
32
+ stroke: currentColor;
33
+ stroke-linecap: round;
34
+ stroke-linejoin: round;
35
+ stroke-width: 1.5px
36
+ }
37
+ `}
38
+ </style>
39
+ </defs>
40
+ <path
41
+ d="M1.5 4.5h21M14.25 1.5h-4.5A1.5 1.5 0 0 0 8.25 3v1.5h7.5V3a1.5 1.5 0 0 0-1.5-1.5M9.75 17.25v-7.5M14.25 17.25v-7.5M18.865 21.124A1.5 1.5 0 0 1 17.37 22.5H6.631a1.5 1.5 0 0 1-1.495-1.376L3.75 4.5h16.5Z"
42
+ className="bin-1_svg__a"></path>
43
+ </svg>
44
+ </button>
45
+ </div>
46
+ </div>
47
+ </div>
48
+
49
+ <div className="component-item">
50
+ <h3 className='ui header'>Message</h3>
51
+ <div>
52
+ <div className="ui message">
53
+ <div className="header">
54
+ Changes in Service
55
+ </div>
56
+ <p>We just updated our privacy policy here to better service our customers. We recommend reviewing the changes.
57
+ </p>
58
+ </div>
59
+
60
+ <div className="ui info message">
61
+ <div className="header">
62
+ Info
63
+ </div>
64
+
65
+ <p>Plugins add new functionality or provide new look to Inkdrop. You can activate or deactivate them at any time.
66
+ Read&nbsp;<a href="https://docs.inkdrop.app/reference/extend-with-plugins">the manual&nbsp;<svg
67
+ xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" name="expand-6"
68
+ className="svg-icon streamline expand-6 inline">
69
+ <defs>
70
+ <style>{`
71
+ .expand-6_svg__a {
72
+ fill: none;
73
+ stroke: currentColor;
74
+ stroke-linecap: round;
75
+ stroke-linejoin: round;
76
+ stroke-width: 1.5px
77
+ }
78
+ `}
79
+ </style>
80
+ </defs>
81
+ <path
82
+ d="M23.251 7.498V.748h-6.75M23.251.748l-15 15M11.251 5.248h-9a1.5 1.5 0 0 0-1.5 1.5v15a1.5 1.5 0 0 0 1.5 1.5h15a1.5 1.5 0 0 0 1.5-1.5v-9"
83
+ className="expand-6_svg__a"></path>
84
+ </svg></a> to learn more.</p>
85
+ </div>
86
+
87
+ <div className="ui positive message">
88
+ <div className="header">
89
+ You are eligible for a reward
90
+ </div>
91
+ <p>Go to your <b>special offers</b> page to see now.</p>
92
+ </div>
93
+
94
+ <div className="ui negative message">
95
+ <div className="header">
96
+ We're sorry we can't apply that discount
97
+ </div>
98
+ <p>That offer has expired
99
+ </p>
100
+ </div>
101
+
102
+ <div className="ui warning message">
103
+ <div className="header">
104
+ Changes in Service
105
+ </div>
106
+ <p>We just updated our privacy policy here to better service our customers. We recommend reviewing the changes.
107
+ </p>
108
+ </div>
109
+
110
+ </div>
111
+ </div>
112
+
113
+ <div className="component-item">
114
+ <h3>Segment</h3>
115
+ <div>
116
+ <div className="plugin-list-item-view ui segments">
117
+ <div className="ui segment ">
118
+ <div className="header">
119
+ <span className="name">dev-tools</span>
120
+ <span className="spacer"></span>
121
+ <div className="additional-info">
122
+ <span className="version">v0.1.0</span>
123
+ </div>
124
+ </div>
125
+ <div className="description">Developer tools for Inkdrop</div>
126
+ </div>
127
+ <div className="ui secondary clearing segment">
128
+ <div className="repository">
129
+ <a href="https://github.com/inkdropapp/inkdrop-dev-tools">
130
+ inkdropapp/inkdrop-dev-tools
131
+ </a>
132
+ </div>
133
+ </div>
134
+ </div>
135
+ </div>
136
+ </div>
137
+
138
+ <div className="component-item">
139
+ <h3>Checkbox and Toggle</h3>
140
+ <div>
141
+ <div className="ui checkbox">
142
+ <input type="checkbox" name="dev-tools" defaultChecked={true} />
143
+ <label></label>
144
+ </div>
145
+ <div className="ui checkbox">
146
+ <input type="checkbox" name="dev-tools" defaultChecked={false} />
147
+ <label></label>
148
+ </div>
149
+ <div className="ui toggle checkbox">
150
+ <input type="checkbox" name="dev-tools" defaultChecked={true} />
151
+ <label></label>
152
+ </div>
153
+ <div className="ui toggle checkbox">
154
+ <input type="checkbox" name="dev-tools" defaultChecked={false} />
155
+ <label></label>
156
+ </div>
157
+ </div>
158
+ </div>
159
+
160
+ <div className="component-item">
161
+ <h3>Input</h3>
162
+ <div>
163
+ <div className='ui form'>
164
+ <div className='field'>
165
+ <input type="text" placeholder="Search keybindings" defaultValue="" />
166
+ </div>
167
+ </div>
168
+ </div>
169
+ </div>
170
+
171
+ <div className="component-item">
172
+ <h3>Tabular Menu</h3>
173
+ <div>
174
+ <div className="ui tabular menu">
175
+ <a className="item active">Popular</a>
176
+ <a className="item ">New</a>
177
+ <a className="item ">Themes</a>
178
+ </div>
179
+ </div>
180
+ </div>
181
+
182
+ <div className="component-item">
183
+ <h3>Divider</h3>
184
+ <div>
185
+ <div className="ui divider"></div>
186
+ </div>
187
+ </div>
188
+
189
+ <div className="component-item">
190
+ <h3>Dropdown</h3>
191
+ <div>
192
+ <div className="ui selection dropdown active focus-outline">
193
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" name="dropdown-chevron" className="svg-icon streamline dropdown-chevron dropdown icon">
194
+ <path fill="currentColor" d="M11.96 19.318a2.09 2.09 0 0 1-1.663-.782L.617 7.682C.031 6.9.128 5.726.911 5.14c.782-.587 1.857-.587 2.444.195l8.41 9.583c.097.098.195.098.39 0l8.41-9.583c.684-.782 1.76-.88 2.542-.195s.88 1.76.195 2.542l-.098.098-9.582 10.854c-.391.39-1.076.684-1.662.684"></path>
195
+ </svg>
196
+ <div className="text">
197
+ Inbox
198
+ </div>
199
+ <div className="menu visible" style={{ display: 'block', overflow: 'auto', opacity: 1, height: 'auto', willChange: 'transform' }}>
200
+ <div className="item " data-value="book:Bk5Ivk0T">
201
+ <span style={{ paddingLeft: 0 }}>App Development</span>
202
+ </div>
203
+ <div className="item " data-value="book:MiCiVxN8">
204
+ <span style={{ paddingLeft: 24 }}>Ideas</span>
205
+ </div>
206
+ </div>
207
+ </div>
208
+ </div>
209
+ </div>
210
+
211
+
212
+ </div>
213
+ </>
214
+ );
215
+ };
@@ -0,0 +1,12 @@
1
+ export function getCSSVariables() {
2
+ const computedStyles = document.body.computedStyleMap();
3
+ const variables: Record<string, string> = {};
4
+ for (const [prop, val] of computedStyles) {
5
+ if (prop.startsWith('--')) {
6
+ variables[prop] = val.toString();
7
+ }
8
+ }
9
+
10
+
11
+ return variables
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Outlet } from 'react-router-dom'
2
+ import { Nav } from './nav'
3
+
4
+ export const Index = () => {
5
+ return (
6
+ <div className={`ui container`}>
7
+ <Nav />
8
+ <Outlet />
9
+ </div>
10
+ )
11
+ }
12
+
@@ -0,0 +1,11 @@
1
+ import { Link } from "react-router-dom";
2
+
3
+ export const Nav = () => {
4
+ return (
5
+ <div className="nav">
6
+ <Link to="/">Variables</Link>
7
+ <Link to="/tokens">Color Tokens</Link>
8
+ <Link to="/components">Components</Link>
9
+ </div>
10
+ );
11
+ };
@@ -0,0 +1,29 @@
1
+ import themeVariableNames from '@inkdropapp/base-ui-theme/lib/variable-names.json'
2
+ import { getCSSVariables } from './get-css-variables'
3
+
4
+ export const VariablesPage = () => {
5
+ const cssVariables = getCSSVariables()
6
+ return (
7
+ <>
8
+ <h2>Variables</h2>
9
+ <div className='variable-list'>
10
+ {themeVariableNames.map(variableName => {
11
+ return (
12
+ <div key={variableName} className='variable-item'>
13
+ <div className='color-box' style={{
14
+ background: `var(${variableName})`
15
+ }}></div>
16
+ <div className='data'>
17
+ <div className='variable-name'>{variableName}</div>
18
+ <div className='variable-value'>
19
+ {cssVariables[variableName]}
20
+ </div>
21
+ </div>
22
+ </div>
23
+ )
24
+ })}
25
+ </div>
26
+ </>
27
+ )
28
+ }
29
+
@@ -0,0 +1,49 @@
1
+ body {
2
+ background: var(--page-background);
3
+ color: var(--text-color);
4
+ }
5
+
6
+ #root {
7
+ padding: 2rem 0;
8
+ }
9
+
10
+ h2 {
11
+ text-align: center;
12
+ }
13
+
14
+ .variable-list {
15
+ display: grid;
16
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
17
+ justify-content: center;
18
+ gap: 0.6rem;
19
+
20
+ &>.variable-item {
21
+ display: flex;
22
+ flex-direction: row;
23
+ gap: 0.6em;
24
+ align-items: center;
25
+
26
+ .color-box {
27
+ flex: 0 0 30px;
28
+ height: 30px;
29
+ }
30
+
31
+ .data {
32
+ display: flex;
33
+ flex-direction: column;
34
+ flex: 1;
35
+
36
+ .variable-name {
37
+ font-weight: bold;
38
+ }
39
+ }
40
+ }
41
+
42
+ }
43
+
44
+ .nav {
45
+ display: flex;
46
+ justify-content: center;
47
+ gap: 1rem;
48
+ margin-top: 1rem;
49
+ }
@@ -0,0 +1,41 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import { createBrowserRouter, RouterProvider } from "react-router-dom";
4
+ import { Index } from "./dev-server/index";
5
+ import "./dev-server.css";
6
+ import "@inkdropapp/css/reset.css";
7
+ import "@inkdropapp/css/tokens.css";
8
+ import "@inkdropapp/base-ui-theme/styles/theme.css";
9
+ import "@/styles/tokens.css";
10
+ import "@/styles/theme.css";
11
+
12
+ import { ColorTokensPage } from "./dev-server/color-tokens";
13
+ import { VariablesPage } from "./dev-server/variables";
14
+ import { ComponentsPage } from "./dev-server/components";
15
+
16
+ // const cssFiles = [
17
+ // "@/styles/tokens.css",
18
+ // "@/styles/theme.css",
19
+ // ];
20
+ //
21
+ // cssFiles.forEach((file) => {
22
+ // import(/* @vite-ignore */ file);
23
+ // });
24
+
25
+ const router = createBrowserRouter([
26
+ {
27
+ path: "/",
28
+ element: <Index />,
29
+ children: [
30
+ { path: "", element: <VariablesPage /> },
31
+ { path: "tokens", element: <ColorTokensPage /> },
32
+ { path: "components", element: <ComponentsPage /> },
33
+ ],
34
+ },
35
+ ]);
36
+
37
+ createRoot(document.getElementById("root")!).render(
38
+ <StrictMode>
39
+ <RouterProvider router={router} />
40
+ </StrictMode>,
41
+ );
@@ -24,7 +24,7 @@ const appearance = options.appearance as 'light' | 'dark' | undefined;
24
24
  // Function to extract theme CSS variables
25
25
  async function extractPalette(outputPath: string) {
26
26
  const themePackageJson = (await import(path.join(process.cwd(), 'package.json')))
27
- const themeVariableNames = (await import(`@inkdropapp/base-ui-theme/lib/variable-names.json`)).default;
27
+ const themeVariableNames: string[] = (await import(`@inkdropapp/base-ui-theme/lib/variable-names.json`)).default;
28
28
 
29
29
  const browser = await puppeteer.launch();
30
30
  const page = await browser.newPage();
@@ -61,7 +61,7 @@ async function extractPalette(outputPath: string) {
61
61
  // Extract CSS variables
62
62
  const computedCSSVariables = await page.$eval('body', (body) => {
63
63
  const computedStyles = body.computedStyleMap();
64
- const variables = {};
64
+ const variables: Record<string, string> = {};
65
65
  for (const [prop, val] of computedStyles) {
66
66
  if (prop.startsWith('--')) {
67
67
  variables[prop] = val.toString();
@@ -73,7 +73,7 @@ async function extractPalette(outputPath: string) {
73
73
  const themeCSSVariables = themeVariableNames.reduce((variables, name) => {
74
74
  variables[name] = computedCSSVariables[name];
75
75
  return variables;
76
- }, {});
76
+ }, {} as Record<string, string>);
77
77
 
78
78
  // Write to the output file
79
79
  const outputFilePath = path.resolve(outputPath);
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": [
6
+ "ES2020",
7
+ "DOM",
8
+ "DOM.Iterable"
9
+ ],
10
+ "module": "ESNext",
11
+ "skipLibCheck": true,
12
+ /* Bundler mode */
13
+ "moduleResolution": "bundler",
14
+ "allowImportingTsExtensions": true,
15
+ "isolatedModules": true,
16
+ "moduleDetection": "force",
17
+ "noEmit": true,
18
+ "jsx": "react-jsx",
19
+ /* Linting */
20
+ "strict": true,
21
+ "noUnusedLocals": true,
22
+ "noUnusedParameters": true,
23
+ "noFallthroughCasesInSwitch": true
24
+ },
25
+ "include": [
26
+ "src"
27
+ ]
28
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { fileURLToPath, URL } from 'url'
2
+ import { defineConfig } from 'vite'
3
+ import react from '@vitejs/plugin-react'
4
+
5
+ const baseProjectPath = process.env.BASE_PROJECT_PATH || fileURLToPath(new URL('../..', import.meta.url))
6
+ console.log('Base project path:', baseProjectPath)
7
+
8
+ // https://vitejs.dev/config/
9
+ export default defineConfig({
10
+ plugins: [react()],
11
+ resolve: {
12
+ alias: [
13
+ {
14
+ find: '@',
15
+ replacement: baseProjectPath
16
+ }
17
+ ]
18
+ },
19
+ server: {
20
+ fs: {
21
+ allow: ['src', 'node_modules', baseProjectPath]
22
+ }
23
+ }
24
+ })