material 1.0.2 → 1.0.4
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/.claude/CLAUDE.md +5 -0
- package/.github/workflows/publish.yml +34 -0
- package/package.json +4 -4
- package/src/badge.js +2 -1
- package/src/button.js +4 -6
- package/src/colorpicker.js +4 -6
- package/src/menu.js +48 -6
- package/.editorconfig +0 -36
- package/.zed/README.md +0 -64
- package/.zed/settings.json +0 -42
- package/CONTRIBUTING.md +0 -125
- package/bun.lock +0 -615
- package/eslint.config.js +0 -63
- package/index.d.ts +0 -77
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*.*.*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
id-token: write # npm trusted publishing (OIDC) + provenance
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: 24
|
|
21
|
+
registry-url: https://registry.npmjs.org
|
|
22
|
+
|
|
23
|
+
# trusted publishing needs npm >= 11.5.1
|
|
24
|
+
- run: npm install -g npm@latest
|
|
25
|
+
|
|
26
|
+
- name: Check tag matches package.json version
|
|
27
|
+
run: |
|
|
28
|
+
VERSION="v$(node -p "require('./package.json').version")"
|
|
29
|
+
if [ "$VERSION" != "$GITHUB_REF_NAME" ]; then
|
|
30
|
+
echo "Tag $GITHUB_REF_NAME does not match package.json version $VERSION"
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
- run: npm publish
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "material",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A lightweight implementation of Material Design Components for the web - ES6",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+
|
|
9
|
+
"url": "git+https://github.com/floor/material.git"
|
|
10
10
|
},
|
|
11
11
|
"author": "Jérôme Vial <jerome.vial@gmail.com>",
|
|
12
12
|
"license": "GPL-3",
|
|
13
13
|
"bugs": {
|
|
14
|
-
"url": "https://
|
|
14
|
+
"url": "https://github.com/floor/material/issues"
|
|
15
15
|
},
|
|
16
|
-
"homepage": "https://
|
|
16
|
+
"homepage": "https://github.com/floor/material",
|
|
17
17
|
"keywords": [
|
|
18
18
|
"lightweight material design ui component web es6 vanilla javascript"
|
|
19
19
|
],
|
package/src/badge.js
CHANGED
package/src/button.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ripple
|
|
6
|
-
} from '../index'
|
|
1
|
+
import Control from './class/control'
|
|
2
|
+
import display from './mixin/display'
|
|
3
|
+
import dataset from './module/dataset'
|
|
4
|
+
import ripple from './module/ripple'
|
|
7
5
|
|
|
8
6
|
const DEFAULT_TYPE = 'button'
|
|
9
7
|
const DEFAULT_CLASS = 'button'
|
package/src/colorpicker.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
dataset
|
|
6
|
-
} from '../index'
|
|
1
|
+
import Element from './element'
|
|
2
|
+
import Control from './class/control'
|
|
3
|
+
import display from './mixin/display'
|
|
4
|
+
import dataset from './module/dataset'
|
|
7
5
|
|
|
8
6
|
class ColorPicker extends Control {
|
|
9
7
|
static defaults = {
|
package/src/menu.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import Control from './class/control'
|
|
2
|
+
import Element from './element'
|
|
3
|
+
import display from './mixin/display'
|
|
4
4
|
|
|
5
5
|
import position from './mixin/position'
|
|
6
6
|
|
|
@@ -37,6 +37,7 @@ class Menu extends Control {
|
|
|
37
37
|
setup () {
|
|
38
38
|
this.menus = []
|
|
39
39
|
this.closeTimeout = null
|
|
40
|
+
this.closeDelay = 300
|
|
40
41
|
|
|
41
42
|
document.addEventListener('click', this.handleDocumentClick)
|
|
42
43
|
}
|
|
@@ -64,8 +65,26 @@ class Menu extends Control {
|
|
|
64
65
|
item = new Element(obj)
|
|
65
66
|
|
|
66
67
|
item.addEventListener('mouseenter', () => {
|
|
67
|
-
if (
|
|
68
|
-
|
|
68
|
+
if (obj.items && Array.isArray(obj.items)) {
|
|
69
|
+
// Clear any pending close timeout when entering submenu trigger
|
|
70
|
+
if (this.closeTimeout) {
|
|
71
|
+
clearTimeout(this.closeTimeout)
|
|
72
|
+
this.closeTimeout = null
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
// For non-submenu items, schedule submenu close with delay
|
|
76
|
+
if (this.menu) {
|
|
77
|
+
if (this.closeTimeout) {
|
|
78
|
+
clearTimeout(this.closeTimeout)
|
|
79
|
+
}
|
|
80
|
+
this.closeTimeout = setTimeout(() => {
|
|
81
|
+
if (this.menu) {
|
|
82
|
+
this.menu.destroy()
|
|
83
|
+
this.menu = null
|
|
84
|
+
}
|
|
85
|
+
this.closeTimeout = null
|
|
86
|
+
}, this.closeDelay)
|
|
87
|
+
}
|
|
69
88
|
}
|
|
70
89
|
})
|
|
71
90
|
|
|
@@ -73,6 +92,18 @@ class Menu extends Control {
|
|
|
73
92
|
item.classList.add('sub')
|
|
74
93
|
|
|
75
94
|
item.addEventListener('mouseenter', () => {
|
|
95
|
+
// Clear any pending close timeout
|
|
96
|
+
if (this.closeTimeout) {
|
|
97
|
+
clearTimeout(this.closeTimeout)
|
|
98
|
+
this.closeTimeout = null
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Destroy existing submenu before creating new one
|
|
102
|
+
if (this.menu) {
|
|
103
|
+
this.menu.destroy()
|
|
104
|
+
this.menu = null
|
|
105
|
+
}
|
|
106
|
+
|
|
76
107
|
this.menu = new Menu({
|
|
77
108
|
class: 'floating',
|
|
78
109
|
target: item,
|
|
@@ -87,6 +118,14 @@ class Menu extends Control {
|
|
|
87
118
|
offsetY: 8
|
|
88
119
|
}).show()
|
|
89
120
|
|
|
121
|
+
// When mouse enters the submenu, cancel any close timeout
|
|
122
|
+
this.menu.element.addEventListener('mouseenter', () => {
|
|
123
|
+
if (this.closeTimeout) {
|
|
124
|
+
clearTimeout(this.closeTimeout)
|
|
125
|
+
this.closeTimeout = null
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
|
|
90
129
|
this.menu.on('select', (value, name) => {
|
|
91
130
|
this.emit('select', `${obj.name}:${value}`, name)
|
|
92
131
|
}).on('destroy', () => {
|
|
@@ -122,7 +161,10 @@ class Menu extends Control {
|
|
|
122
161
|
}
|
|
123
162
|
|
|
124
163
|
close () {
|
|
125
|
-
|
|
164
|
+
if (this.closeTimeout) {
|
|
165
|
+
clearTimeout(this.closeTimeout)
|
|
166
|
+
this.closeTimeout = null
|
|
167
|
+
}
|
|
126
168
|
this.menus.forEach(menu => {
|
|
127
169
|
menu.destroy()
|
|
128
170
|
})
|
package/.editorconfig
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# EditorConfig is awesome: https://EditorConfig.org
|
|
2
|
-
|
|
3
|
-
# top-most EditorConfig file
|
|
4
|
-
root = true
|
|
5
|
-
|
|
6
|
-
# Unix-style newlines with a newline ending every file
|
|
7
|
-
[*]
|
|
8
|
-
end_of_line = lf
|
|
9
|
-
insert_final_newline = true
|
|
10
|
-
charset = utf-8
|
|
11
|
-
trim_trailing_whitespace = true
|
|
12
|
-
|
|
13
|
-
# JavaScript files
|
|
14
|
-
[*.js]
|
|
15
|
-
indent_style = space
|
|
16
|
-
indent_size = 2
|
|
17
|
-
quote_type = single
|
|
18
|
-
|
|
19
|
-
# JSON files
|
|
20
|
-
[*.json]
|
|
21
|
-
indent_style = space
|
|
22
|
-
indent_size = 2
|
|
23
|
-
|
|
24
|
-
# YAML files
|
|
25
|
-
[*.{yml,yaml}]
|
|
26
|
-
indent_style = space
|
|
27
|
-
indent_size = 2
|
|
28
|
-
|
|
29
|
-
# Markdown files
|
|
30
|
-
[*.md]
|
|
31
|
-
trim_trailing_whitespace = false
|
|
32
|
-
|
|
33
|
-
# Package files
|
|
34
|
-
[package.json]
|
|
35
|
-
indent_style = space
|
|
36
|
-
indent_size = 2
|
package/.zed/README.md
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# Zed Editor Settings for Material Library
|
|
2
|
-
|
|
3
|
-
This directory contains project-specific settings for the [Zed Editor](https://zed.dev/).
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
### Auto-formatting on Save
|
|
8
|
-
|
|
9
|
-
JavaScript files are automatically formatted using **ESLint with Standard JS rules** when you save them.
|
|
10
|
-
|
|
11
|
-
- **Formatter**: ESLint (`eslint --stdin --fix`)
|
|
12
|
-
- **Format on save**: Enabled
|
|
13
|
-
- **Indentation**: 2 spaces (no tabs)
|
|
14
|
-
- **Trailing whitespace**: Removed on save
|
|
15
|
-
- **Final newline**: Ensured on save
|
|
16
|
-
|
|
17
|
-
### How It Works
|
|
18
|
-
|
|
19
|
-
The `settings.json` configures Zed to:
|
|
20
|
-
1. Use ESLint as the external formatter
|
|
21
|
-
2. Apply Standard JS rules via ESLint config
|
|
22
|
-
3. Format automatically on save
|
|
23
|
-
4. Enable ESLint LSP for real-time feedback
|
|
24
|
-
|
|
25
|
-
### Manual Formatting
|
|
26
|
-
|
|
27
|
-
You can also format manually:
|
|
28
|
-
- **Command Palette**: `Format Document`
|
|
29
|
-
- **Keyboard shortcut**: Check Zed's keybindings
|
|
30
|
-
|
|
31
|
-
### Standard JS Rules
|
|
32
|
-
|
|
33
|
-
The formatter follows [Standard JS](https://standardjs.com/) rules via ESLint:
|
|
34
|
-
- No semicolons
|
|
35
|
-
- Single quotes for strings
|
|
36
|
-
- 2 space indentation
|
|
37
|
-
- Space after function name
|
|
38
|
-
- And more...
|
|
39
|
-
|
|
40
|
-
Project-specific globals are defined in both:
|
|
41
|
-
- `eslint.config.js` - for ESLint/Zed
|
|
42
|
-
- `package.json` under `standard` - for Standard CLI
|
|
43
|
-
|
|
44
|
-
## Requirements
|
|
45
|
-
|
|
46
|
-
- Zed Editor
|
|
47
|
-
- Node.js or Bun installed
|
|
48
|
-
- ESLint and Standard JS installed (via `bun install`)
|
|
49
|
-
|
|
50
|
-
## Troubleshooting
|
|
51
|
-
|
|
52
|
-
If formatting doesn't work:
|
|
53
|
-
1. Ensure dependencies are installed: `bun install`
|
|
54
|
-
2. Test ESLint manually: `npx eslint src/module/extract.js`
|
|
55
|
-
3. Test Standard JS manually: `npx standard src/module/extract.js`
|
|
56
|
-
4. Restart Zed Editor
|
|
57
|
-
5. Check Zed's output panel for errors
|
|
58
|
-
|
|
59
|
-
## More Info
|
|
60
|
-
|
|
61
|
-
- [Zed Editor Documentation](https://zed.dev/docs)
|
|
62
|
-
- [ESLint](https://eslint.org/)
|
|
63
|
-
- [Standard JS](https://standardjs.com/)
|
|
64
|
-
- [EditorConfig](https://editorconfig.org/)
|
package/.zed/settings.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"languages": {
|
|
3
|
-
"JavaScript": {
|
|
4
|
-
"formatter": {
|
|
5
|
-
"external": {
|
|
6
|
-
"command": "npx",
|
|
7
|
-
"arguments": [
|
|
8
|
-
"eslint",
|
|
9
|
-
"--stdin",
|
|
10
|
-
"--fix",
|
|
11
|
-
"--stdin-filename",
|
|
12
|
-
"{buffer_path}"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"code_actions_on_format": {
|
|
17
|
-
"source.fixAll.eslint": true
|
|
18
|
-
},
|
|
19
|
-
"format_on_save": "on",
|
|
20
|
-
"tab_size": 2,
|
|
21
|
-
"hard_tabs": false
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"lsp": {
|
|
25
|
-
"eslint": {
|
|
26
|
-
"settings": {
|
|
27
|
-
"experimental": {
|
|
28
|
-
"useFlatConfig": true
|
|
29
|
-
},
|
|
30
|
-
"validate": "on",
|
|
31
|
-
"run": "onType",
|
|
32
|
-
"format": {
|
|
33
|
-
"enable": true
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"tab_size": 2,
|
|
39
|
-
"hard_tabs": false,
|
|
40
|
-
"remove_trailing_whitespace_on_save": true,
|
|
41
|
-
"ensure_final_newline_on_save": true
|
|
42
|
-
}
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
# Contributing to Material
|
|
2
|
-
|
|
3
|
-
Thank you for your interest in contributing to Material! This document provides guidelines and information about our development workflow.
|
|
4
|
-
|
|
5
|
-
## Development Setup
|
|
6
|
-
|
|
7
|
-
### Prerequisites
|
|
8
|
-
|
|
9
|
-
- Node.js >= 16.14.0 or Bun
|
|
10
|
-
- Git
|
|
11
|
-
|
|
12
|
-
### Installation
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
# Clone the repository
|
|
16
|
-
git clone https://gitlab.com/alkaloid/material.git
|
|
17
|
-
cd material
|
|
18
|
-
|
|
19
|
-
# Install dependencies
|
|
20
|
-
bun install
|
|
21
|
-
# or
|
|
22
|
-
npm install
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Code Style
|
|
26
|
-
|
|
27
|
-
We use [Standard JS](https://standardjs.com/) style guide with ESLint for code quality and consistency.
|
|
28
|
-
|
|
29
|
-
### Linting
|
|
30
|
-
|
|
31
|
-
Before submitting a pull request, ensure your code passes linting:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
# Check for linting errors
|
|
35
|
-
bun run lint
|
|
36
|
-
|
|
37
|
-
# Auto-fix linting errors (when possible)
|
|
38
|
-
bun run lint:fix
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
We use [Standard JS](https://standardjs.com/) which comes bundled with ESLint and requires no configuration.
|
|
42
|
-
|
|
43
|
-
### Code Style Rules
|
|
44
|
-
|
|
45
|
-
- **No semicolons** - Standard JS style
|
|
46
|
-
- **2 spaces** for indentation
|
|
47
|
-
- **Single quotes** for strings
|
|
48
|
-
- **Space before function parentheses** - `function foo () {}`
|
|
49
|
-
- **Object spacing** - `{ foo: 'bar' }`
|
|
50
|
-
- **No trailing whitespace**
|
|
51
|
-
- **LF line endings** (Unix style)
|
|
52
|
-
- **Final newline** in all files
|
|
53
|
-
|
|
54
|
-
### EditorConfig
|
|
55
|
-
|
|
56
|
-
We use `.editorconfig` for consistent code style across different editors. Most modern editors (including Zed, VSCode, Sublime Text) support it automatically.
|
|
57
|
-
|
|
58
|
-
### Standard JS
|
|
59
|
-
|
|
60
|
-
Standard JS is configured in `package.json` with project-specific globals. It includes ESLint internally, so no separate ESLint config is needed.
|
|
61
|
-
|
|
62
|
-
## Browser Compatibility
|
|
63
|
-
|
|
64
|
-
Material is designed for modern browsers with ES6+ support:
|
|
65
|
-
- Chrome/Edge (latest)
|
|
66
|
-
- Firefox (latest)
|
|
67
|
-
- Safari (latest)
|
|
68
|
-
|
|
69
|
-
## Testing
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
# Run tests (when available)
|
|
73
|
-
bun test
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Project Structure
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
material/
|
|
80
|
-
├── src/ # Source files
|
|
81
|
-
│ ├── module/ # Utility modules
|
|
82
|
-
│ ├── mixin/ # Reusable mixins
|
|
83
|
-
│ ├── class/ # Base classes
|
|
84
|
-
│ └── *.js # Component files
|
|
85
|
-
├── docs/ # Documentation
|
|
86
|
-
├── packages/ # Additional packages
|
|
87
|
-
└── scripts/ # Build scripts
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Git Workflow
|
|
91
|
-
|
|
92
|
-
1. Create a feature branch from `master`
|
|
93
|
-
2. Make your changes
|
|
94
|
-
3. Run linting: `bun run lint:fix` (Standard JS will auto-fix most issues)
|
|
95
|
-
4. Commit with descriptive messages
|
|
96
|
-
5. Push and create a merge request
|
|
97
|
-
|
|
98
|
-
### Commit Messages
|
|
99
|
-
|
|
100
|
-
Follow conventional commit format when possible:
|
|
101
|
-
- `feat: add new component`
|
|
102
|
-
- `fix: resolve issue with dialog`
|
|
103
|
-
- `refactor: simplify event handling`
|
|
104
|
-
- `docs: update README`
|
|
105
|
-
- `style: fix linting issues`
|
|
106
|
-
|
|
107
|
-
## Pull Request Guidelines
|
|
108
|
-
|
|
109
|
-
- Ensure all linting passes
|
|
110
|
-
- Update documentation if needed
|
|
111
|
-
- Keep changes focused and atomic
|
|
112
|
-
- Provide clear description of changes
|
|
113
|
-
- Reference related issues
|
|
114
|
-
|
|
115
|
-
## Questions?
|
|
116
|
-
|
|
117
|
-
Feel free to open an issue for:
|
|
118
|
-
- Bug reports
|
|
119
|
-
- Feature requests
|
|
120
|
-
- Questions about usage
|
|
121
|
-
- Suggestions for improvement
|
|
122
|
-
|
|
123
|
-
## License
|
|
124
|
-
|
|
125
|
-
This project is licensed under GPL-3.0. By contributing, you agree that your contributions will be licensed under the same license.
|