Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mantou132 committed Sep 10, 2024
1 parent 371e2f5 commit e4e1c05
Show file tree
Hide file tree
Showing 25 changed files with 3,136 additions and 4,848 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/duoyun-ui-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ jobs:
duoyun-ui-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 22.x

- name: Setup pnpm
uses: pnpm/action-setup@v3 # docs https://pnpm.io/continuous-integration#github-actions
with:
version: 9 # Optional: specify a pnpm version

- run: pnpm install

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/gem-analyzer-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ jobs:
gem-analyzer-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 22.x

- name: Setup pnpm
uses: pnpm/action-setup@v3 # docs https://pnpm.io/continuous-integration#github-actions
with:
version: 9 # Optional: specify a pnpm version

- run: pnpm install

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/gem-book-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ jobs:
gem-book-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 22.x

- name: Setup pnpm
uses: pnpm/action-setup@v3 # docs https://pnpm.io/continuous-integration#github-actions
with:
version: 9 # Optional: specify a pnpm version

- run: pnpm install

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/gem-devtools-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ jobs:
gem-devtools-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 22.x

- name: Setup pnpm
uses: pnpm/action-setup@v3 # docs https://pnpm.io/continuous-integration#github-actions
with:
version: 9 # Optional: specify a pnpm version

- run: pnpm install

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/gem-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ jobs:
gem-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 22.x

- name: Setup pnpm
uses: pnpm/action-setup@v3 # docs https://pnpm.io/continuous-integration#github-actions
with:
version: 9 # Optional: specify a pnpm version

- run: node -e "fs.writeFileSync('./packages/gem/src/lib/version.ts', 'export const version = \'' + require('./packages/gem/package.json').version + '\';\n')"
- run: pnpm install
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 22.x

- name: Setup pnpm
uses: pnpm/action-setup@v3 # docs https://pnpm.io/continuous-integration#github-actions
with:
version: 9 # Optional: specify a pnpm version

- run: pnpm install

- run: pnpm lint
- run: pnpm test
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["crates/swc-gem-plugin"]
members = ["crates/swc-plugin-gem"]

resolver = "2"

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Create custom elements, bind data, route switching, and quickly develop WebApps
| [packages/gem-port](packages/gem-port) | Export Gem elements as React/Vue/Svelte components |
| [packages/gem-examples](packages/gem-examples) | Gem and DuoyunUI examples |

[Rodmap](https://mm.tt/app/map/3412316197?t=TGs84FRcwQ).

## Contribution

Fork repo, submit PR
2 changes: 2 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
| [packages/gem-port](packages/gem-port) | 将 Gem 元素导出为 React/Vue/Svelte 组件 |
| [packages/gem-examples](packages/gem-examples) | 一些 Gem 和 DuoyunUI 示例 |

[路线图](https://mm.tt/app/map/3412316197?t=TGs84FRcwQ)

## 贡献

Fork 项目,提交 PR

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "swc-gem-plugin"
name = "swc-plugin-gem"
version = "0.1.0"
edition = { workspace = true }
rust-version = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "swc-gem-plugin",
"name": "swc-plugin-gem",
"version": "0.1.0",
"description": "",
"author": "",
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions packages/duoyun-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"elkjs": "^0.7.1"
},
"peerDependencies": {
"@mantou/gem": "^1.7.9"
"@mantou/gem": "^2.0.0-alpha.0"
},
"devDependencies": {
"@esm-bundle/chai": "^4.3.4-fix.0",
Expand All @@ -62,8 +62,7 @@
"@web/dev-server-esbuild": "^1.0.2",
"@web/test-runner": "^0.18.1",
"rimraf": "^3.0.2",
"typescript": "^5.5.3",
"webpack-merge": "^5.7.3"
"typescript": "^5.5.3"
},
"author": "mantou132",
"license": "ISC",
Expand Down
1 change: 0 additions & 1 deletion packages/gem-book/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"nodemon": "^2.0.7",
"ts-morph": "^13.0.0",
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.10.0",
"webpack-node-externals": "^3.0.0"
},
"author": "mantou132",
Expand Down
2 changes: 1 addition & 1 deletion packages/gem-port/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "gem-port",
"name": "@mantou/gem-port",
"version": "1.0.0-alpha.0",
"description": "Export React component",
"keywords": [
Expand Down
25 changes: 25 additions & 0 deletions packages/gem/docs/en/001-guide/001-basic/006-styled-element.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,31 @@ class MyElement extends GemElement {
> [!NOTE]
> Use `$` as a key to represent `:host, :scope` selectors, allowing styles to apply to both ShadowDOM and LightDOM.
## Stylized Instance

If you need to specify the style of a single instance through properties or states, you can:

```js
// Omit import...

@customElement('my-element')
class MyElement extends GemElement {
@attribute color;

render() {
return html`
<style>
:host {
--color: ${this.color}
}
</style>
`;
}
}
```

This method is complex and troublesome to write; it is recommended to use [`useDecoratorTheme`](../002-advance/003-theme.md#element-level-theme).

## Customize the style outside the element

Use [`::part`](https://drafts.csswg.org/css-shadow-parts-1/#part)(only ShadowDOM) to export the internal content of the element, allowing external custom styles:
Expand Down
30 changes: 29 additions & 1 deletion packages/gem/docs/en/001-guide/002-advance/003-theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,32 @@ class App extends GemElement {

## Scoped and override theme

<gbp-include src="../../snippets/scoped-theme.md"></gbp-include>
<gbp-include src="../../snippets/scoped-theme.md"></gbp-include>

## Element level theme {#element-level-theme}

The theme is implemented using CSS variables, which may need to be dynamically set during rendering, this can also be achieved through themes, but unlike other types of themes, decorators are required to apply and update the theme.

```js
import { useDecoratorTheme } from '@mantou/gem/helper/theme';

const [elementTheme, updateTheme] = useDecoratorTheme({ color: '' });

const style = createCSSSheet(css`
:host(:where(:not([hidden]))) {
border-color: ${elementTheme.color};
}
`);

@customElement('app-root')
class App extends GemElement {
@attribute color;

@updateTheme()
#theme = () => ({ color: this.color })

render() {
return html``;
}
}
```
25 changes: 25 additions & 0 deletions packages/gem/docs/zh/001-guide/001-basic/006-styled-element.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,31 @@ class MyElement extends GemElement {
> [!NOTE]
> 使用 `$` 作为键代表 `:host, :scope` 选择器,让样式同时适用于 ShadowDOM 和 LightDOM
## 样式化实例

如果需要通过属性或者状态指定单个实例的样式可以:

```js
// 省略导入...

@customElement('my-element')
class MyElement extends GemElement {
@attribute color;

render() {
return html`
<style>
:host {
--color: ${this.color}
}
</style>
`;
}
}
```

这个方法写法复杂且麻烦,推荐使用 [`useDecoratorTheme`](../002-advance/003-theme.md#element-level-theme)

## 在元素外自定义样式

可以使用 [`::part`](https://drafts.csswg.org/css-shadow-parts-1/#part)(仅限于 ShadowDOM) 导出元素内部内容,允许外部进行自定义样式:
Expand Down
30 changes: 29 additions & 1 deletion packages/gem/docs/zh/001-guide/002-advance/003-theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,32 @@ class App extends GemElement {

## 范围主题和覆盖主题

<gbp-include src="../../snippets/scoped-theme.md"></gbp-include>
<gbp-include src="../../snippets/scoped-theme.md"></gbp-include>

## 元素级主题 {#element-level-theme}

主题是使用 CSS 变量实现的,在渲染时可能需要动态设置 CSS 变量,这同样可以通过主题来完成,和其他类型的主题不一样,需要使用装饰器来应用和更新主题:

```js
import { useDecoratorTheme } from '@mantou/gem/helper/theme';

const [elementTheme, updateTheme] = useDecoratorTheme({ color: '' });

const style = createCSSSheet(css`
:host(:where(:not([hidden]))) {
border-color: ${elementTheme.color};
}
`);

@customElement('app-root')
class App extends GemElement {
@attribute color;

@updateTheme()
#theme = () => ({ color: this.color })

render() {
return html``;
}
}
```
2 changes: 1 addition & 1 deletion packages/vscode-gem-plugin/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# vscode-gem-plugin
# vscode-plugin-gem

https://github.com/mantou132/gem

Expand Down
6 changes: 3 additions & 3 deletions packages/vscode-gem-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "vscode-gem-plugin",
"displayName": "vscode-gem-plugin",
"name": "vscode-plugin-gem",
"displayName": "vscode-plugin-gem",
"description": "Gem plugin for VS Code",
"version": "1.0.0-alpha.0",
"engines": {
Expand All @@ -15,7 +15,7 @@
"contributes": {
"commands": [
{
"command": "vscode-gem-plugin.helloWorld",
"command": "vscode-plugin-gem.helloWorld",
"title": "Hello World"
}
]
Expand Down
6 changes: 3 additions & 3 deletions packages/vscode-gem-plugin/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import * as vscode from 'vscode';
export function activate(context: vscode.ExtensionContext) {
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "vscode-gem-plugin" is now active!');
console.log('Congratulations, your extension "vscode-plugin-gem" is now active!');

// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
const disposable = vscode.commands.registerCommand('vscode-gem-plugin.helloWorld', () => {
const disposable = vscode.commands.registerCommand('vscode-plugin-gem.helloWorld', () => {
// The code you place here will be executed every time your command is executed
// Display a message box to the user
vscode.window.showInformationMessage('Hello World from vscode-gem-plugin!');
vscode.window.showInformationMessage('Hello World from vscode-plugin-gem!');
});

context.subscriptions.push(disposable);
Expand Down
Loading

0 comments on commit e4e1c05

Please sign in to comment.