@lynx-example/lynx-ui-common 0.0.18 → 0.0.20
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/CHANGELOG.md +16 -0
- package/PreCommitHook/index.tsx +49 -12
- package/PreCommitHook/styles.css +63 -0
- package/dist/CommonPreCommitHook.lynx.bundle +0 -0
- package/dist/CommonPreCommitHook.web.bundle +0 -0
- package/lynx.config.mjs +1 -1
- package/package.json +2 -2
- package/dist/PreCommitHook.lynx.bundle +0 -0
- package/dist/PreCommitHook.web.bundle +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @lynx-example/lynx-ui-common
|
|
2
2
|
|
|
3
|
+
## 0.0.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @lynx-js/lynx-ui@3.140.0
|
|
9
|
+
|
|
10
|
+
## 0.0.19
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Rename the PreCommitHook entry to CommonPreCommitHook and refine the example ([#336](https://github.com/lynx-family/lynx-ui/pull/336))
|
|
15
|
+
with explicit state colors, a legend, and a neutral remount control.
|
|
16
|
+
- Updated dependencies [[`4588802`](https://github.com/lynx-family/lynx-ui/commit/4588802388d8f2b04b2819b50cd165432e8bcdd5), [`1a4ad19`](https://github.com/lynx-family/lynx-ui/commit/1a4ad190993d57425b4c377a7dd63882cc65a8d2), [`18d4559`](https://github.com/lynx-family/lynx-ui/commit/18d4559bde1fff0f316d45f43c1eb47b935f9557), [`e926e76`](https://github.com/lynx-family/lynx-ui/commit/e926e76b8941a8bd4b8948c2b65412304d29eb98), [`dde9dd8`](https://github.com/lynx-family/lynx-ui/commit/dde9dd84d41c19ff3a5d126a0479cf1d117da644)]:
|
|
17
|
+
- @lynx-js/lynx-ui@3.139.0
|
|
18
|
+
|
|
3
19
|
## 0.0.18
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/PreCommitHook/index.tsx
CHANGED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
import { root, useMainThreadRef, useState } from '@lynx-js/react'
|
|
6
6
|
import './styles.css'
|
|
7
7
|
|
|
8
|
-
import { usePreCommit } from '@lynx-js/lynx-ui'
|
|
8
|
+
import { Button, usePreCommit } from '@lynx-js/lynx-ui'
|
|
9
9
|
import type { MainThread } from '@lynx-js/types'
|
|
10
10
|
|
|
11
|
-
function
|
|
11
|
+
function PreCommitBox() {
|
|
12
12
|
const nodeMTRef = useMainThreadRef<MainThread.Element>(null)
|
|
13
|
+
const textMTRef = useMainThreadRef<MainThread.Element>(null)
|
|
13
14
|
const [boxStyle, setBoxStyle] = useState('')
|
|
15
|
+
const [textStyle, setTextStyle] = useState('')
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* When update happens, state will be patched to main thread
|
|
@@ -20,22 +22,57 @@ function App() {
|
|
|
20
22
|
usePreCommit(() => {
|
|
21
23
|
'main thread'
|
|
22
24
|
nodeMTRef.current?.setStyleProperties({
|
|
23
|
-
'background-color': '#
|
|
25
|
+
'background-color': '#00D0F1',
|
|
26
|
+
})
|
|
27
|
+
textMTRef.current?.setStyleProperties({
|
|
28
|
+
color: '#ffffff',
|
|
24
29
|
})
|
|
25
30
|
}, [])
|
|
26
31
|
|
|
27
32
|
return (
|
|
28
|
-
<view
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
<view
|
|
34
|
+
bindtap={() => {
|
|
35
|
+
setBoxStyle('background-color: var(--primary);')
|
|
36
|
+
setTextStyle('color: var(--primary-content);')
|
|
37
|
+
}}
|
|
38
|
+
main-thread:ref={nodeMTRef}
|
|
39
|
+
style={boxStyle}
|
|
40
|
+
className='box'
|
|
41
|
+
>
|
|
42
|
+
<text
|
|
43
|
+
main-thread:ref={textMTRef}
|
|
44
|
+
style={textStyle}
|
|
45
|
+
className='box-text'
|
|
36
46
|
>
|
|
37
|
-
|
|
47
|
+
PreCommit
|
|
48
|
+
</text>
|
|
49
|
+
</view>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function App() {
|
|
54
|
+
const [revision, setRevision] = useState(0)
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<view className='demo-container lunaris-dark'>
|
|
58
|
+
<PreCommitBox key={revision} />
|
|
59
|
+
<text className='tap-hint'>Tap to restore original style</text>
|
|
60
|
+
<view className='legend'>
|
|
61
|
+
<view className='legend-item'>
|
|
62
|
+
<view className='legend-swatch legend-swatch-original' />
|
|
63
|
+
<text className='legend-label'>Original</text>
|
|
64
|
+
</view>
|
|
65
|
+
<view className='legend-item'>
|
|
66
|
+
<view className='legend-swatch legend-swatch-pre-commit' />
|
|
67
|
+
<text className='legend-label'>Pre-commit</text>
|
|
68
|
+
</view>
|
|
38
69
|
</view>
|
|
70
|
+
<Button
|
|
71
|
+
className='redo-button'
|
|
72
|
+
onClick={() => setRevision((value) => value + 1)}
|
|
73
|
+
>
|
|
74
|
+
<text className='redo-button-label'>Redo mount</text>
|
|
75
|
+
</Button>
|
|
39
76
|
</view>
|
|
40
77
|
)
|
|
41
78
|
}
|
package/PreCommitHook/styles.css
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
.demo-container {
|
|
4
4
|
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
5
6
|
align-items: center;
|
|
6
7
|
justify-content: center;
|
|
8
|
+
gap: 12px;
|
|
7
9
|
width: 100%;
|
|
8
10
|
height: 100%;
|
|
9
11
|
background-color: var(--canvas);
|
|
@@ -22,3 +24,64 @@
|
|
|
22
24
|
color: var(--primary-content);
|
|
23
25
|
font-size: 24px;
|
|
24
26
|
}
|
|
27
|
+
|
|
28
|
+
.tap-hint {
|
|
29
|
+
color: var(--content-muted);
|
|
30
|
+
font-size: 14px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.legend {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: row;
|
|
36
|
+
align-items: center;
|
|
37
|
+
gap: 20px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.legend-item {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: row;
|
|
43
|
+
align-items: center;
|
|
44
|
+
gap: 8px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.legend-swatch {
|
|
48
|
+
width: 16px;
|
|
49
|
+
height: 16px;
|
|
50
|
+
border-radius: 4px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.legend-swatch-original {
|
|
54
|
+
background-color: var(--primary);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.legend-swatch-pre-commit {
|
|
58
|
+
background-color: #00d0f1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.legend-label {
|
|
62
|
+
color: var(--content);
|
|
63
|
+
font-size: 13px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.redo-button {
|
|
67
|
+
width: 80%;
|
|
68
|
+
max-width: 240px;
|
|
69
|
+
height: 44px;
|
|
70
|
+
margin-top: 8px;
|
|
71
|
+
padding: 0 20px;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
border-radius: 999px;
|
|
76
|
+
background-color: var(--neutral-ambient);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.redo-button.ui-active {
|
|
80
|
+
background-color: var(--neutral-faint);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.redo-button-label {
|
|
84
|
+
color: var(--content);
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
font-weight: 600;
|
|
87
|
+
}
|
|
Binary file
|
|
Binary file
|
package/lynx.config.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-example/lynx-ui-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "Example app demonstrating common utilities in lynx-ui",
|
|
5
5
|
"homepage": "https://github.com/lynx-family/lynx-ui/tree/main/apps/examples/Common#readme",
|
|
6
6
|
"repository": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@lynx-js/react": "0.123.1",
|
|
27
27
|
"@lynx-js/luna-styles": "0.2.2",
|
|
28
|
-
"@lynx-js/lynx-ui": "3.
|
|
28
|
+
"@lynx-js/lynx-ui": "3.140.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@lynx-js/qrcode-rsbuild-plugin": "0.6.0",
|
|
Binary file
|
|
Binary file
|