hlmnhkl-ui 0.32.0 → 0.32.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.
- package/package.json +1 -1
- package/scripts/add.js +13 -0
- package/src/components/Sheet/Sheet.module.css +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hlmnhkl-ui",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.2",
|
|
4
4
|
"description": "React components in black, white and grey with one blue accent. Copy them into your app with npx hlmnhkl-ui add <name>.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://ui.hlmnhkl.my",
|
package/scripts/add.js
CHANGED
|
@@ -55,6 +55,7 @@ function parseArgs(argv) {
|
|
|
55
55
|
if (arg === '--help' || arg === '-h' || arg === 'help') {
|
|
56
56
|
console.log(USAGE)
|
|
57
57
|
console.log('\nA name can be a component (Button), a block (Dashboard), a template or a theme (forest).')
|
|
58
|
+
console.log(`A name can also be a shared helper, to build your own parts on it: ${Object.keys(HELPERS).join(', ')}.`)
|
|
58
59
|
console.log('When two kinds share a name, add the kind: blocks/Settings, templates/Settings.')
|
|
59
60
|
process.exit(0)
|
|
60
61
|
} else if (arg === '--to' || arg === '--kind') {
|
|
@@ -115,6 +116,10 @@ const keyOf = (item) => `${item.kind}:${item.name}`
|
|
|
115
116
|
const label = (item) => (item.kind === 'component' ? item.name : `${item.name} (${item.kind})`)
|
|
116
117
|
const kebab = (name) => name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()
|
|
117
118
|
|
|
119
|
+
// Shared helpers an app can add on its own, to build its own parts the way the library builds them.
|
|
120
|
+
// Each is a file in src/internal; what it imports from src/internal comes with it.
|
|
121
|
+
const HELPERS = { 'scroll-frame': 'scrollFrame.ts' }
|
|
122
|
+
|
|
118
123
|
// Every name that can be copied, in every kind.
|
|
119
124
|
function listItems() {
|
|
120
125
|
return KINDS.flatMap((k) => {
|
|
@@ -139,6 +144,8 @@ function lookup(raw, all) {
|
|
|
139
144
|
if (hits.length > 1) {
|
|
140
145
|
fail(`"${raw}" is more than one thing: ${hits.map(label).join(', ')}. Add the kind, for example ${kindOf(hits[1].kind).folder}/${hits[1].name}.`)
|
|
141
146
|
}
|
|
147
|
+
const helper = Object.keys(HELPERS).find((h) => h.replace(/-/g, '') === name.toLowerCase())
|
|
148
|
+
if (helper && !prefix) return { kind: 'helper', name: helper, file: join(INTERNAL, HELPERS[helper]) }
|
|
142
149
|
const pro = proComponents().find((p) => p.toLowerCase() === name.toLowerCase())
|
|
143
150
|
if (pro) fail(`${pro} is in hlmnhkl/ui Pro, so it is not in this package. See ${SITE}/${raw.toLowerCase()}`, false)
|
|
144
151
|
const close = suggest(name, all)
|
|
@@ -218,6 +225,11 @@ function plan(items) {
|
|
|
218
225
|
}
|
|
219
226
|
while (queue.length) {
|
|
220
227
|
const item = queue.shift()
|
|
228
|
+
// A helper is one internal file: it travels with the internal files, not as an item.
|
|
229
|
+
if (item.kind === 'helper') {
|
|
230
|
+
visitInternal(item.file)
|
|
231
|
+
continue
|
|
232
|
+
}
|
|
221
233
|
const key = keyOf(item)
|
|
222
234
|
if (picked.has(key)) continue
|
|
223
235
|
picked.set(key, item)
|
|
@@ -359,6 +371,7 @@ function runList(opts) {
|
|
|
359
371
|
if (free.length) console.log(` ${free.join(', ')}`)
|
|
360
372
|
if (pro.length) console.log(` Pro: ${pro.join(', ')}`)
|
|
361
373
|
}
|
|
374
|
+
if (!wanted) console.log(`Helpers (${Object.keys(HELPERS).length})\n ${Object.keys(HELPERS).join(', ')}`)
|
|
362
375
|
console.log(`\nAdd one: npx hlmnhkl-ui add <name>. Every page: ${SITE}`)
|
|
363
376
|
}
|
|
364
377
|
|
|
@@ -32,6 +32,23 @@
|
|
|
32
32
|
transition: transform var(--hl-motion-slow) var(--hl-ease-spring);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/* Pulled up past the top, the sheet stretches like a sheet on a phone: its own surface carries on
|
|
36
|
+
below its bottom edge, so lifting it never opens a gap at the bottom of the screen. Below the
|
|
37
|
+
screen at rest, and gone with the sheet when it closes. */
|
|
38
|
+
.sheet::after {
|
|
39
|
+
content: '';
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 100%;
|
|
42
|
+
left: calc(-1 * var(--hl-line));
|
|
43
|
+
right: calc(-1 * var(--hl-line));
|
|
44
|
+
height: 100%;
|
|
45
|
+
border-inline: var(--hl-line) solid var(--hl-glass-edge, var(--hl-color-border));
|
|
46
|
+
background: var(--hl-glass-bg, var(--hl-color-surface));
|
|
47
|
+
-webkit-backdrop-filter: var(--hl-glass-filter, none);
|
|
48
|
+
backdrop-filter: var(--hl-glass-filter, none);
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
35
52
|
.sheet[data-dragging],
|
|
36
53
|
.sheet[data-fluid] { transition: none; }
|
|
37
54
|
|