Skip to content

Commit

Permalink
docs: fix home page popover issue; fix enhanceApp issue(it can be exe…
Browse files Browse the repository at this point in the history
…cuted multiple times); update codacy config; fix some issues
  • Loading branch information
lejunyang committed Oct 29, 2024
1 parent 8fd6f75 commit a0332bb
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 40 deletions.
6 changes: 3 additions & 3 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
exclude_paths:
- "*.js"
- "__test__/**"
- "**/*.js"
- "**/__test__/**"
include_paths:
- "packages/**"
- "./packages/**"
22 changes: 16 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Release packages

on:
push:
paths:
- '**/package.json'
tags:
- v*
# Allows you to run this workflow manually from the Actions tab
Expand Down Expand Up @@ -47,11 +49,19 @@ jobs:
- name: Install and Build
run: pnpm install --frozen-lockfile && pnpm build

- name: Create Release Pull Request and Publish to npm
uses: changesets/action@v1
with:
publish: pnpm release
- name: Publish to npm
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
EOF
pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# - name: Create Release Pull Request and Publish to npm
# uses: changesets/action@v1
# with:
# publish: pnpm release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test-after-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build
name: package-builds
run-id: ${{ inputs.artifact-id }}
- run: ls -R packages/components
- run: echo "LIST ROOT"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Technically yes, because web components is not framework-specific, but you need
- input mask feature, simplify Input rendering
- add color process preset, finish ColorPicker
- finish Calendar
- finalize component Transition
- finalize component Transition(css or config?)
- add Menu component
- accessibility support
- gather feedback, finalize name and functions of components
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pnpm test
- Input掩码,简化Input渲染
- 添加颜色处理预设,完善ColorPicker
- 大单元格Calendar渲染,完善模式切换,添加日历事件支持,农历支持
- 完善组件Transition
- 组件Transition方案确定,目前全在common css里,可能考虑迁移到全局配置,放js中
- 添加菜单组件
- Accessibility 支持
- 收集社区意见,确定组件的功能,属性方法命名是否需要修改
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lun-web/components",
"version": "0.0.1-alpha.1",
"version": "0.0.1-alpha.2",
"description": "A full-featured web components library based on Vue3",
"keywords": [
"web-components",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lun-web/core",
"version": "0.0.1-alpha.1",
"version": "0.0.1-alpha.2",
"description": "Hooks and utils for developing components for Vue3",
"keywords": [],
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lun-web/plugins",
"version": "0.0.1-alpha.1",
"version": "0.0.1-alpha.2",
"description": "Directive plugins for Vue template or Vue JSX",
"keywords": [],
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lun-web/react",
"version": "0.0.1-alpha.1",
"version": "0.0.1-alpha.2",
"description": "Compatible @lun-web/components layer for versions before React19",
"keywords": [
"web-components",
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lun-web/theme",
"version": "0.0.1-alpha.1",
"version": "0.0.1-alpha.2",
"description": "Beautiful preset theme for @lun-web/components",
"keywords": [
"ui",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lun-web/utils",
"version": "0.0.1-alpha.1",
"version": "0.0.1-alpha.2",
"description": "A set of javascript utils",
"keywords": [
"javascript-utils"
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/browser/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ export const supportCSSContentVisibility = supportCSSSupports && supports!('cont

export const supportTouch = inBrowser && 'ontouchstart' in document.body;

export const isSupportSlotAssign = cacheFunctionResult(() => isFunction(HTMLSlotElement.prototype.assign));
export const isSupportSlotAssign = cacheFunctionResult(() => inBrowser && isFunction(HTMLSlotElement.prototype.assign));
2 changes: 1 addition & 1 deletion src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ onMounted(() => {
editor.onDidChangeModelContent(() => {
emits('update:modelValue', editor.getValue());
});
const contentHeight = editor.getContentHeight();
const contentHeight = Math.max(editor.getContentHeight(), 48);
height.value = `${contentHeight}px`;
editor.layout();
});
Expand Down
13 changes: 7 additions & 6 deletions src/components/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
import Theme from 'vitepress/theme';
import { useData, inBrowser, useRouter } from 'vitepress';
import VPSwitchAppearance from 'vitepress/dist/client/theme-default/components/VPSwitchAppearance.vue';
import { watchEffect, nextTick, provide, reactive, onMounted, onBeforeUnmount, useTemplateRef } from 'vue';
import { watchEffect, nextTick, provide, reactive, onMounted, onBeforeUnmount, useTemplateRef, watch } from 'vue';
import ThemeConfigPanel from './ThemeConfigPanel.vue';
import { GlobalContextConfig, Progress, themeColors, activeBreakpoint, iPopover } from '@lun-web/components';
import Giscus from '@giscus/vue';
Expand All @@ -131,11 +131,12 @@ const sizeGroup = useTemplateRef('sizeGroup'),
popover = useTemplateRef<iPopover>('popover'),
scaleInput = useTemplateRef('scaleInput');
onMounted(() => {
// sizeGroup is not direct child of popover, so we have to manually attach it
popover.value?.attachTarget(sizeGroup.value, { slotName: 'size' }); // if in other page, popover is undefined...
popover.value?.attachTarget(scaleInput.value, { slotName: 'scale' });
});
// if not in home page, popover is undefined
watch(popover, (p) => {
if (!p) return;
p.attachTarget(sizeGroup.value, { slotName: 'size' }); // if in other page, popover is undefined...
p.attachTarget(scaleInput.value, { slotName: 'scale' });
})
provide('lun-theme', theme);
Expand Down
15 changes: 7 additions & 8 deletions src/docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// https://vitepress.dev/guide/custom-theme
import { h } from 'vue';
import Theme from 'vitepress/theme';
import { GlobalStaticConfig, GlobalContextConfig, defineAllComponents, registerCustomRenderer } from '@lun-web/components';
import {
GlobalStaticConfig,
GlobalContextConfig,
defineAllComponents,
registerCustomRenderer,
} from '@lun-web/components';
import { importAllThemes, importAllColors, importAllP3Colors } from '@lun-web/theme';
import { inBrowser } from 'vitepress';
import '@lun-web/core/date-dayjs';
Expand All @@ -17,8 +22,6 @@ import CompThemePanel from '../../../components/CompThemePanel.vue';
import './style.css';
// import { on } from '@lun-web/utils';

let once = false;

declare module '@lun-web/core' {
export interface DateInterface {
date: Dayjs;
Expand All @@ -29,9 +32,6 @@ export default {
extends: Theme,
Layout: () => h(Layout),
enhanceApp: (({ app }) => {
if (once) return false;
once = true;

app.directive('content', vContent);
app.component('Code', Code);
app.component('Palette', Palette);
Expand All @@ -42,8 +42,7 @@ export default {
// ignore injection not found warning
if (msg.includes('injection') && msg.includes('not found')) return;
// not sure if it needs to be ignored, it occurred since upgraded to vue 3.5
if (msg.includes('Attempting to hydrate existing markup but container is empty. Performing full mount instead'))
return;
if (msg.includes('Performing full mount instead')) return;
console.warn(msg, _vm, _trace);
};

Expand Down
4 changes: 4 additions & 0 deletions src/docs/components/doc-pip/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: DocPip 画中画
lang: zh-CN
---

:::warning 注
Highly experimental
:::

[Document Picture in Picture](https://developer.mozilla.org/en-US/docs/Web/API/Document_Picture-in-Picture_API),即文档画中画,用于将某些内容用小窗的形式展现给用户,即使用户在不同的页面之间切换,小窗依然能置顶展示。以往画中画仅支持视频元素,而文档画中画允许任意元素

- `l-doc-pip`作为容器默认会显示它的 children,当请求画中画成功后,会将其 children 全部移入画中画,关闭后又移动回原位置
Expand Down
4 changes: 4 additions & 0 deletions src/docs/components/mentions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: Mentions 提及
lang: zh-CN
---

:::warning 注
experimental
:::

该组件用于文本域中需要动态显示高亮块的场景,比如@提及某人、#提及话题等。

该组件基于`contenteditable`以及`Selection`实现,但是目前`Selection in Shadow DOM`有问题,各浏览器实现各不相同,参考[这个](https://stackoverflow.com/questions/62054839/shadowroot-getselection)
Expand Down
3 changes: 2 additions & 1 deletion src/docs/components/popover/autoAttach.vue.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export default () => (
<l-popover autoAttachAttr="data-target">
<l-popover autoAttachAttr="data-target" ignoreSelf>
<l-button data-target="target1">button1</l-button>
<l-button>default</l-button>
<l-button data-target="target2">button2</l-button>
<div slot="target1">button1 pop content</div>
<div slot="target2">button2 pop content</div>
Expand Down
9 changes: 4 additions & 5 deletions src/docs/components/progress/pageTop.vue.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { Progress } from '@lun-web/components';

let stop;
let progress;
export default () => (
<>
<l-button
onClick={() => {
const methods = Progress.createPageTopProgress();
methods.start();
stop = methods.stop;
if (!progress) progress = Progress.createPageTopProgress();
progress.start();
}}
>
start
</l-button>
<l-button onClick={() => (stop && stop(), (stop = null))}>stop</l-button>
<l-button onClick={() => progress && progress.stop()}>stop</l-button>
</>
);

0 comments on commit a0332bb

Please sign in to comment.