Skip to content

Commit

Permalink
Support highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
mantou132 committed Oct 30, 2024
1 parent b95cfbe commit 5842248
Show file tree
Hide file tree
Showing 195 changed files with 5,777 additions and 5,978 deletions.
31 changes: 0 additions & 31 deletions .vscode/gem.code-snippets

This file was deleted.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"version": "1.6.5",
"scripts": {
"lint": "lerna exec --ignore @gemjs/config -- tsc --noEmit && eslint . --ext .ts,.js",
"test": "lerna exec --concurrency=1 --scope '{@mantou/gem,gem-book,duoyun-ui}' -- pnpm test",
"test": "lerna exec --concurrency=1 --scope \"{@mantou/gem,gem-book,duoyun-ui}\" -- pnpm test",
"release": "lerna version",
"prepare:build": "pnpm -C packages/gem build && lerna exec --scope '{gem-analyzer,duoyun-ui,gem-book,gem-port}' -- pnpm build",
"prepare:link": "lerna exec --scope '{gem-book,@mantou/gem-port}' -- npm link",
"prepare:build": "pnpm -C packages/gem build && lerna exec --scope \"{gem-analyzer,duoyun-ui,gem-book,gem-port}\" -- pnpm build",
"prepare:link": "lerna exec --scope \"{gem-book,@mantou/gem-port}\" -- npm link",
"prepare": "husky install && pnpm prepare:build && pnpm prepare:link"
},
"devDependencies": {
Expand All @@ -17,7 +17,7 @@
"@typescript-eslint/parser": "^6.13.1",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"esbuild": "^0.23.1",
"esbuild": "^0.24.0",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-gitignore": "^0.1.0",
Expand All @@ -36,7 +36,7 @@
"packageManager": "[email protected]+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c",
"pnpm": {
"overrides": {
"esbuild": "^0.23.1"
"esbuild": "^0.24.0"
}
}
}
5 changes: 2 additions & 3 deletions packages/duoyun-ui/docs/en/01-guide/30-customize.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ DuoyunUI comes with themes, icons, texts, and can be used in the application:
```ts
import {
createCSSSheet,
css,
adoptedStyle,
customElement,
GemElement,
Expand All @@ -17,11 +16,11 @@ import { locale } from 'duoyun-ui/lib/locale';

import '@mantou/gem';

const style = createCSSSheet(css`
const style = createCSSSheet`
gem-use {
color: ${theme.positiveColor};
}
`);
`;

@customElement('my-ele')
@adoptedStyle(style)
Expand Down
5 changes: 2 additions & 3 deletions packages/duoyun-ui/docs/zh/01-guide/30-customize.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ DuoyunUI 自带主题、图标、文本,在应用中可以这样使用它们
```ts
import {
createCSSSheet,
css,
adoptedStyle,
customElement,
GemElement,
Expand All @@ -17,11 +16,11 @@ import { locale } from 'duoyun-ui/lib/locale';

import '@mantou/gem';

const style = createCSSSheet(css`
const style = createCSSSheet`
gem-use {
color: ${theme.positiveColor};
}
`);
`;

@customElement('my-ele')
@adoptedStyle(style)
Expand Down
4 changes: 2 additions & 2 deletions packages/duoyun-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
"/locales/"
],
"scripts": {
"docs": "GEM_BOOK_REPLACE=true gem-book docs",
"docs": "cross-env GEM_BOOK_REPLACE=true gem-book docs",
"docs:remote": "gem-book docs",
"build:docs": "gem-book docs --build",
"build:components": "gem-port src/elements && gem-port src/patterns --svelte-ns=pat",
"build:dev": "MODE=dev nodemon -w ../gem-port/bin --exec gem-port src/elements",
"build:dev": "cross-env MODE=dev nodemon -w ../gem-port/bin --exec gem-port src/elements",
"clean": "node -e \"fs.readdirSync('src').map(dir => require('rimraf').sync(dir))\"",
"build": "pnpm clean && tsc -p tsconfig.build.json",
"start": "pnpm build --watch",
Expand Down
11 changes: 3 additions & 8 deletions packages/duoyun-ui/src/elements/action-text.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GemElement, html, createCSSSheet } from '@mantou/gem/lib/element';
import { adoptedStyle, customElement, attribute, state, slot, aria, shadow, mounted } from '@mantou/gem/lib/decorators';
import { addListener, css } from '@mantou/gem/lib/utils';
import { addListener } from '@mantou/gem/lib/utils';
import { createDecoratorTheme } from '@mantou/gem/helper/theme';

import { theme, getSemanticColor } from '../lib/theme';
Expand All @@ -11,7 +11,7 @@ import './tooltip';

const elementTheme = createDecoratorTheme({ color: '', activeColor: '' });

const style = createCSSSheet(css`
const style = createCSSSheet`
:host {
overflow: hidden;
text-overflow: ellipsis;
Expand All @@ -27,13 +27,8 @@ const style = createCSSSheet(css`
:host(:where(:lang(zh), :lang(ja), :lang(kr))) {
text-underline-offset: 0.125em;
}
`);
`;

/**
* @customElement dy-action-text
* @attr color
* @attr tooltip
*/
@customElement('dy-action-text')
@adoptedStyle(style)
@adoptedStyle(focusStyle)
Expand Down
8 changes: 2 additions & 6 deletions packages/duoyun-ui/src/elements/alert.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// https://spectrum.adobe.com/page/in-line-alert/
import { adoptedStyle, customElement, attribute, property, slot, aria, shadow } from '@mantou/gem/lib/decorators';
import { GemElement, html, createCSSSheet } from '@mantou/gem/lib/element';
import { css } from '@mantou/gem/lib/utils';
import { createDecoratorTheme } from '@mantou/gem/helper/theme';

import { theme, getSemanticColor } from '../lib/theme';
Expand All @@ -12,7 +11,7 @@ import './action-text';

const elementTheme = createDecoratorTheme({ color: '' });

const style = createCSSSheet(css`
const style = createCSSSheet`
:host(:where(:not([hidden]))) {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -43,13 +42,10 @@ const style = createCSSSheet(css`
.footer {
text-align: right;
}
`);
`;

type Status = 'positive' | 'notice' | 'negative' | 'informative' | 'default';

/**
* @customElement dy-alert
*/
@customElement('dy-alert')
@adoptedStyle(style)
@aria({ role: 'alert' })
Expand Down
9 changes: 3 additions & 6 deletions packages/duoyun-ui/src/elements/area-chart.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createCSSSheet, createState, html, svg } from '@mantou/gem/lib/element';
import type { Emitter } from '@mantou/gem/lib/decorators';
import { adoptedStyle, customElement, emitter, memo, mounted, property } from '@mantou/gem/lib/decorators';
import { addListener, classMap, css } from '@mantou/gem/lib/utils';
import { addListener, classMap } from '@mantou/gem/lib/utils';
import { createDecoratorTheme } from '@mantou/gem/helper/theme';

import { isNotNullish } from '../lib/types';
Expand Down Expand Up @@ -48,7 +48,7 @@ const elementTheme = createDecoratorTheme({
symbolStrokeWidth: 0,
});

const style = createCSSSheet(css`
const style = createCSSSheet`
.hit-line {
pointer-events: stroke;
}
Expand Down Expand Up @@ -90,11 +90,8 @@ const style = createCSSSheet(css`
margin-inline-start: ${elementTheme.zoomLeft};
align-self: flex-start;
}
`);
`;

/**
* @customElement dy-area-chart
*/
@customElement('dy-area-chart')
@adoptedStyle(style)
export class DuoyunAreaChartElement extends DuoyunChartBaseElement {
Expand Down
26 changes: 6 additions & 20 deletions packages/duoyun-ui/src/elements/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
shadow,
} from '@mantou/gem/lib/decorators';
import { createCSSSheet, GemElement, html } from '@mantou/gem/lib/element';
import { css, exportPartsMap } from '@mantou/gem/lib/utils';
import { exportPartsMap } from '@mantou/gem/lib/utils';
import { createDecoratorTheme } from '@mantou/gem/helper/theme';

import { theme } from '../lib/theme';
Expand All @@ -21,7 +21,7 @@ import './tooltip';

const elementTheme = createDecoratorTheme({ color: '' });

const style = createCSSSheet(css`
const style = createCSSSheet`
:host(:where(:not([hidden]))) {
cursor: default;
display: inline-block;
Expand Down Expand Up @@ -76,19 +76,8 @@ const style = createCSSSheet(css`
transform: translate(50%, -50%);
background-color: ${elementTheme.color};
}
`);

/**
* @customElement dy-avatar
* @attr src
* @attr alt
* @attr status
* @attr background
* @attr tooltip
* @attr size
* @attr square
* @attr crossorigin
*/
`;

@customElement('dy-avatar')
@adoptedStyle(style)
@shadow()
Expand Down Expand Up @@ -121,7 +110,7 @@ export class DuoyunAvatarElement extends GemElement {
};
}

const groupStyle = createCSSSheet(css`
const groupStyle = createCSSSheet`
:scope:where(:not([hidden])) {
display: flex;
}
Expand All @@ -146,7 +135,7 @@ const groupStyle = createCSSSheet(css`
.item:hover + .item:last-child {
--m: var(--m-left);
}
`);
`;

export type AvatarItem = {
src?: string;
Expand All @@ -157,9 +146,6 @@ export type AvatarItem = {
onClick?: (evt: Event) => void;
};

/**
* @customElement dy-avatar-group
*/
@customElement('dy-avatar-group')
@adoptedStyle(groupStyle)
@aria({ role: 'list' })
Expand Down
9 changes: 3 additions & 6 deletions packages/duoyun-ui/src/elements/badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import {
mounted,
} from '@mantou/gem/lib/decorators';
import { createCSSSheet, createRef, GemElement, html } from '@mantou/gem/lib/element';
import { classMap, css } from '@mantou/gem/lib/utils';
import { classMap } from '@mantou/gem/lib/utils';

import { contentsContainer } from '../lib/styles';
import { getSemanticColor, theme } from '../lib/theme';
import type { StringList } from '../lib/types';

import './use';

const style = createCSSSheet(css`
const style = createCSSSheet`
.badge {
display: flex;
align-items: center;
Expand Down Expand Up @@ -74,11 +74,8 @@ const style = createCSSSheet(css`
right: 0;
}
}
`);
`;

/**
* @customElement dy-badge
*/
@customElement('dy-badge')
@adoptedStyle(style)
@adoptedStyle(contentsContainer)
Expand Down
8 changes: 2 additions & 6 deletions packages/duoyun-ui/src/elements/banner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
aria,
} from '@mantou/gem/lib/decorators';
import { createCSSSheet, GemElement, html } from '@mantou/gem/lib/element';
import { css } from '@mantou/gem/lib/utils';

import { theme } from '../lib/theme';
import { icons } from '../lib/icons';
Expand All @@ -21,7 +20,7 @@ import { commonHandle } from '../lib/hotkeys';
import './use';
import './divider';

const style = createCSSSheet(css`
const style = createCSSSheet`
:host(:where(:not([hidden]))) {
display: flex;
align-items: flex-start;
Expand Down Expand Up @@ -75,13 +74,10 @@ const style = createCSSSheet(css`
.close:hover {
opacity: 1;
}
`);
`;

type Status = 'positive' | 'notice' | 'negative' | 'default';

/**
* @customElement dy-banner
*/
@customElement('dy-banner')
@adoptedStyle(style)
@shadow({ delegatesFocus: true })
Expand Down
8 changes: 2 additions & 6 deletions packages/duoyun-ui/src/elements/bar-chart.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { customElement, property, adoptedStyle, memo } from '@mantou/gem/lib/decorators';
import { createCSSSheet, html, svg } from '@mantou/gem/lib/element';
import { css } from '@mantou/gem/lib/utils';

import { theme } from '../lib/theme';

Expand All @@ -13,19 +12,16 @@ export interface Sequence {
values: (number | null)[];
}

const style = createCSSSheet(css`
const style = createCSSSheet`
.col:hover .rect {
fill: ${theme.hoverBackgroundColor};
opacity: 0.2;
}
.bar:hover {
filter: brightness(1.05);
}
`);
`;

/**
* @customElement dy-bar-chart
*/
@customElement('dy-bar-chart')
@adoptedStyle(style)
export class DuoyunBarChartElement extends DuoyunChartBaseElement {
Expand Down
Loading

0 comments on commit 5842248

Please sign in to comment.