@gct-paas/scss 0.1.6-dev.41 → 0.1.6-dev.42
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/README.md +82 -0
- package/dist/index.esm.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
|
1
|
+
# @gct-paas/scss
|
|
2
|
+
|
|
3
|
+
PaaS 平台样式框架包。提供 BEM 命名、主题 CSS 变量、全局 SCSS 入口及 TS 侧 `useNamespace` 辅助。被 `core-components`、`core-web`、`v-ben` 及上层 design/render 包依赖。
|
|
4
|
+
|
|
5
|
+
> 本文档面向后续开发与 AI 模型阅读。下文「样式工具文档」章节为 SCSS functions/mixins API 参考。
|
|
6
|
+
|
|
7
|
+
## 包信息
|
|
8
|
+
|
|
9
|
+
| 项 | 值 |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| 包名 | `@gct-paas/scss` |
|
|
12
|
+
| 入口 | `es/index.mjs`(类型:`es/index.d.ts`) |
|
|
13
|
+
| 样式入口 | `@gct-paas/scss/style/global.scss`、`@gct-paas/scss/style/index.scss` |
|
|
14
|
+
| peer | 无(宿主仅需 Vue 3 用于 TS 导出) |
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { useNamespace } from '@gct-paas/scss';
|
|
18
|
+
// 或从 @gct-paas/core 再导出(推荐与 core 一致)
|
|
19
|
+
import '@gct-paas/scss/style/index.scss';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 在 monorepo 中的位置
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
scss(样式基础层,无 _gct 依赖)
|
|
28
|
+
├── core-components / v-ben / core-web
|
|
29
|
+
└── design / render 及其 *-web 层
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
规划中端侧包(`core-mobile` / `core-pad` 等)同样依赖本包。
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 依赖说明
|
|
37
|
+
|
|
38
|
+
| 依赖 | 用途 |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `normalize.css` | 浏览器样式重置 |
|
|
41
|
+
| `vue` | TS 侧 `Namespace` / `useNamespace` 构建依赖 |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 源码结构
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
packages/scss/
|
|
49
|
+
├── src/utils/namespace/ # Namespace、useNamespace(与 core 逻辑对齐)
|
|
50
|
+
├── style/ # global.scss、index.scss、mixins、functions、tokens
|
|
51
|
+
└── README.md # 本文件(含下方 SCSS API 表)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 与 `_gct` 的关系
|
|
57
|
+
|
|
58
|
+
**不挂载、不依赖 `_gct`。** 纯样式与 BEM 工具层。
|
|
59
|
+
|
|
60
|
+
- **TS BEM**:组件内优先 `useNamespace('block')`(也可从 `@gct-paas/core` 导入,底层同源)
|
|
61
|
+
- **SCSS BEM**:`@include b/e/m/when`,详见 `.agents/skills/gct-bem-best/SKILL.md`
|
|
62
|
+
- **CSS 变量三步法**:define map → `set-component-css-var` → `getCssVar`
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 给后续模型的约束
|
|
67
|
+
|
|
68
|
+
1. 组件样式类名走 BEM,禁止手写 `gct-xxx` 拼接。
|
|
69
|
+
2. 全局样式通过 `@gct-paas/scss/style/global.scss` 或 `index.scss` 引入,不要复制 mixin 源码。
|
|
70
|
+
3. 本包无运行时初始化,引入 SCSS/TS 即可。
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 本地命令
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cd packages/scss
|
|
78
|
+
npm run dev
|
|
79
|
+
npm run build
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
1
83
|
|
|
2
84
|
# 样式工具文档
|
|
3
85
|
|
package/dist/index.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @gct-paas/scss v0.1.6-dev.
|
|
1
|
+
/*! @gct-paas/scss v0.1.6-dev.42 */
|
|
2
2
|
function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e,r,n){return(r=function(e){var r=function(e){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function r(t,e,r,n,o){let s=`${t}-${e}`;return r&&(s+=`-${r}`),n&&(s+=`__${n}`),o&&(s+=`--${o}`),s}var n=class{constructor(t,r){e(this,"block",void 0),e(this,"namespace",void 0),this.block=t,this.namespace=r||"gct"}b(t=""){return r(this.namespace,this.block,t,"","")}e(t){return t?r(this.namespace,this.block,"",t,""):""}m(t){return t?r(this.namespace,this.block,"","",t):""}be(t,e){return t&&e?r(this.namespace,this.block,t,e,""):""}em(t,e){return t&&e?r(this.namespace,this.block,"",t,e):""}bm(t,e){return t&&e?r(this.namespace,this.block,t,"",e):""}bem(t,e,n){return t&&e&&n?r(this.namespace,this.block,t,e,n):""}is(t,e){return t&&e?`is-${t}`:""}cssVar(t){const e={};for(const r in t)t[r]&&(e[this.cssVarName(r)]=t[r]);return e}cssVarBlock(t){const e={};for(const r in t)t[r]&&(e[this.cssVarBlockName(r)]=t[r]);return e}cssVarName(t){return`--${this.namespace}-${t}`}cssVarBlockName(t){return`--${this.namespace}-${this.block}-${t}`}};function o(t){return new n(t)}export{n as Namespace,o as useNamespace};
|