chore: release v1.0.14 with complete fix. By: AICoder

This commit is contained in:
AI Engineer 2026-06-08 22:16:57 +08:00
parent bae8adb2d3
commit 628e1d2021
8 changed files with 428 additions and 518 deletions

View File

@ -1,6 +1,6 @@
# Changelog
## [1.0.13] - 2026-06-08
## [1.0.14] - 2026-06-08
### Fixed
- **State Integration**: Bumped `@apigo.cc/state` to `1.0.18` to restore the globally injected `$`/`$$` helpers from the original UMD era, fixing `TagsInput` element targeting.
- **AutoForm Layout**: Fixed `horizontal` grid layout breakage caused by missing `AUTOFORM_STYLE` registration.

View File

@ -1,19 +1,33 @@
# @apigo.cc/base - AI 逻辑操作说明书 (示例驱动)
本库是基于 `@apigo.cc/state` 增强的 UI 原子库,提供遵循 Bootstrap 5.3 规范的高阶业务组件。
本库是基于 `@apigo.cc/state` 增强的 UI 原子库,提供遵循 Bootstrap 5.3 规范的高阶业务组件。本包采用完全的全局注入模式。
---
## 全局变量与核心 API 清单
引入 `base.js` 后,以下对象将直接挂载到 `window` / `globalThis` 上,可随时随地调用:
| 全局变量名 | 用途说明 |
| :--- | :--- |
| **`HTTP`** | 异步请求工具 (`HTTP.get`, `HTTP.post`, `HTTP.request` 等)。 |
| **`UI`** | 交互组件触发器 (`UI.toast`, `UI.alert`, `UI.confirm`, `UI.showDialog`)。 |
| **`AutoForm`** | 表单组件扩展注册器 (`AutoForm.register`) 和自定义控件库 (`AutoForm.customTypes`)。 |
| **`MouseMover`** | 拖拽辅助工具 (`MouseMover.start`)。 |
| **`VirtualScroll`** / **`List`** | 虚拟滚动列表核心算法类。 |
*(注意:底层状态库 `@apigo.cc/state` 暴露的 `NewState`, `Hash`, `LocalStorage`, `State`, `$`, `$$`, `Component` 以及危险的高级 API `_unsafeRefreshState` 也在全局可用。严禁随意调用 `_unsafeRefreshState`。)*
---
## 1. 快速集成 (Quick Start)
### 同步 UMD 集成 (推荐:消灭异步时序风险,实现“秒开”渲染)
将脚本放置在 `<head>` 中,确保地基在 DOM 解析前就绪:
```html
<!-- 1. 基础状态机 (地基) -->
<script src="dist/lib/state.js"></script>
<!-- 2. Bootstrap 适配层 -->
<script src="dist/lib/bootstrap.js"></script>
<!-- 3. 本业务组件库 -->
<!-- 3. 本业务组件库 (原生注入) -->
<script src="dist/lib/base.js"></script>
<script>
@ -22,11 +36,6 @@
</script>
```
### ESM 模块引入 (Legacy)
```javascript
const { HTTP, UI, AutoForm, State } = window.ApigoBase
```
---
## 2. 组件超能力示例 (Mega Examples)

435
dist/base.js vendored

File diff suppressed because one or more lines are too long

2
dist/base.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "@apigo.cc/base",
"version": "1.0.13",
"version": "1.0.14",
"type": "module",
"main": "dist/base.js",
"files": [

View File

@ -1,29 +1,4 @@
import { NewState, State } from '@apigo.cc/state'
import '@apigo.cc/bootstrap'
// Re-exports
export * from './http.js'
export * from './ui.js'
export * from './form.js'
export * from './controls.js'
export * from './list.js'
export * from './nav.js'
export * from './interaction.js'
export { State }
if (typeof window !== 'undefined') {
window.addEventListener('beforeunload', (event) => {
if (State.exitBlocks > 0) event.preventDefault()
})
}
const htmlNode = document.documentElement;
if (!htmlNode.hasAttribute('$data-bs-theme') && !htmlNode.hasAttribute('data-bs-theme')) {
htmlNode.setAttribute('$data-bs-theme', "LocalStorage.darkMode?'dark':'light'");
}
// Side effects: ensure global namespaces are populated
import { HTTP } from './http.js'
import { UI } from './ui.js'
import { AutoForm } from './form.js'
@ -37,13 +12,5 @@ globalThis.UI = UI
globalThis.AutoForm = AutoForm
globalThis.MouseMover = MouseMover
globalThis.VirtualScroll = VirtualScroll
const ApigoBase = {
HTTP, UI, AutoForm, MouseMover, VirtualScroll, State,
List: VirtualScroll
};
if (typeof document !== 'undefined') {
globalThis.ApigoBase = ApigoBase;
}
globalThis.List = VirtualScroll

File diff suppressed because one or more lines are too long

View File

@ -19,22 +19,22 @@ export default defineConfig({
lib: {
entry: resolve(__dirname, 'src/index.js'),
name: 'ApigoBase',
formats: ['umd']
formats: ['iife']
},
rollupOptions: {
external: ['@apigo.cc/state', '@apigo.cc/bootstrap'],
external: ['@apigo.cc/state', '@apigo.cc/bootstrap'],
output: [
{
format: 'umd',
format: 'iife',
name: 'ApigoBase',
entryFileNames: 'base.js',
globals: {
'@apigo.cc/state': 'ApigoState',
'@apigo.cc/state': 'ApigoState', // Dummy mapping, as we rely on globalThis.State etc.
'@apigo.cc/bootstrap': 'bootstrap'
}
},
{
format: 'umd',
format: 'iife',
name: 'ApigoBase',
entryFileNames: 'base.min.js',
globals: {