solely 0.6.0 → 0.7.0

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.
Files changed (79) hide show
  1. package/README.md +76 -26
  2. package/dist/compiler/ir/buildIR.cjs +1 -1
  3. package/dist/compiler/ir/buildIR.js +1 -1
  4. package/dist/compiler/parser/parser.cjs +1 -1
  5. package/dist/compiler/parser/parser.js +1 -1
  6. package/dist/components/commands/message/index.cjs +1 -1
  7. package/dist/components/commands/message/index.js +1 -1
  8. package/dist/components/elements/alert/index.html.cjs +1 -1
  9. package/dist/components/elements/alert/index.html.js +1 -1
  10. package/dist/components/elements/badge/index.html.cjs +1 -1
  11. package/dist/components/elements/badge/index.html.js +1 -1
  12. package/dist/components/elements/breadcrumb/index.html.cjs +1 -1
  13. package/dist/components/elements/breadcrumb/index.html.js +1 -1
  14. package/dist/components/elements/button/index.html.cjs +1 -1
  15. package/dist/components/elements/button/index.html.js +1 -1
  16. package/dist/components/elements/card/index.html.cjs +1 -1
  17. package/dist/components/elements/card/index.html.js +1 -1
  18. package/dist/components/elements/checkbox/index.html.cjs +1 -1
  19. package/dist/components/elements/checkbox/index.html.js +1 -1
  20. package/dist/components/elements/coordinate-input/index.html.cjs +1 -1
  21. package/dist/components/elements/coordinate-input/index.html.js +1 -1
  22. package/dist/components/elements/fab/index.html.cjs +1 -1
  23. package/dist/components/elements/fab/index.html.js +1 -1
  24. package/dist/components/elements/input/index.html.cjs +1 -1
  25. package/dist/components/elements/input/index.html.js +1 -1
  26. package/dist/components/elements/not-found/index.html.cjs +1 -1
  27. package/dist/components/elements/not-found/index.html.js +1 -1
  28. package/dist/components/elements/pagination/index.html.cjs +1 -1
  29. package/dist/components/elements/pagination/index.html.js +1 -1
  30. package/dist/components/elements/progress/index.html.cjs +1 -1
  31. package/dist/components/elements/progress/index.html.js +1 -1
  32. package/dist/components/elements/radio/index.html.cjs +1 -1
  33. package/dist/components/elements/radio/index.html.js +1 -1
  34. package/dist/components/elements/select/index.html.cjs +1 -1
  35. package/dist/components/elements/select/index.html.js +1 -1
  36. package/dist/components/elements/skeleton/index.html.cjs +1 -1
  37. package/dist/components/elements/skeleton/index.html.js +1 -1
  38. package/dist/components/elements/slider/index.html.cjs +1 -1
  39. package/dist/components/elements/slider/index.html.js +1 -1
  40. package/dist/components/elements/steps/index.html.cjs +1 -1
  41. package/dist/components/elements/steps/index.html.js +1 -1
  42. package/dist/components/elements/switch/index.html.cjs +1 -1
  43. package/dist/components/elements/switch/index.html.js +1 -1
  44. package/dist/components/elements/table/index.html.cjs +1 -1
  45. package/dist/components/elements/table/index.html.js +1 -1
  46. package/dist/components/elements/tabs/index.html.cjs +1 -1
  47. package/dist/components/elements/tabs/index.html.js +1 -1
  48. package/dist/components/elements/tag/index.html.cjs +1 -1
  49. package/dist/components/elements/tag/index.html.js +1 -1
  50. package/dist/components/elements/timeline/index.html.cjs +1 -1
  51. package/dist/components/elements/timeline/index.html.js +1 -1
  52. package/dist/components/elements/tooltip/index.html.cjs +1 -1
  53. package/dist/components/elements/tooltip/index.html.js +1 -1
  54. package/dist/components/elements/tree/index.html.cjs +1 -1
  55. package/dist/components/elements/tree/index.html.js +1 -1
  56. package/dist/components/elements/upload/index.html.cjs +1 -1
  57. package/dist/components/elements/upload/index.html.js +1 -1
  58. package/dist/plugins/solely-vite-plugin.cjs +1 -1
  59. package/dist/plugins/solely-vite-plugin.d.ts +10 -1
  60. package/dist/plugins/solely-vite-plugin.js +1 -1
  61. package/dist/router/core.cjs +1 -1
  62. package/dist/router/core.js +1 -1
  63. package/dist/runtime/component/base-element.cjs +1 -1
  64. package/dist/runtime/component/base-element.d.ts +8 -1
  65. package/dist/runtime/component/base-element.js +1 -1
  66. package/dist/runtime/component/decorators.d.ts +7 -0
  67. package/dist/runtime/reactivity/observe.cjs +1 -1
  68. package/dist/runtime/reactivity/observe.d.ts +1 -0
  69. package/dist/runtime/reactivity/observe.js +1 -1
  70. package/dist/runtime/renderer/html-decode.cjs +1 -1
  71. package/dist/runtime/renderer/html-decode.js +1 -1
  72. package/dist/runtime/renderer/renderIR.cjs +1 -1
  73. package/dist/runtime/renderer/renderIR.js +1 -1
  74. package/dist/shared/env.cjs +1 -1
  75. package/dist/shared/env.js +1 -1
  76. package/dist/shared/svg-sanitize.cjs +1 -1
  77. package/dist/shared/svg-sanitize.js +1 -1
  78. package/dist/types/ir.d.ts +2 -2
  79. package/package.json +6 -3
package/README.md CHANGED
@@ -16,20 +16,21 @@
16
16
 
17
17
  ## ✨ 核心特性
18
18
 
19
- - **🚀 高性能**:轻量级架构,零运行时依赖,快速渲染
19
+ - **🚀 高性能**:轻量级架构,浏览器运行时零依赖(`magic-string` 仅构建期使用),快速渲染
20
20
  - **🔧 类型安全**:完整的 TypeScript 支持,类型提示完善
21
21
  - **🎨 强大模板**:基于 AST 的模板编译,支持条件渲染和列表渲染
22
- - **⚡ 响应式系统**:高效的响应式数据绑定,自动追踪依赖
22
+ - **⚡ 响应式系统**:高效的响应式数据绑定,变更按微任务批量刷新
23
23
  - **🧩 Web 组件**:原生 Web 组件支持,可自定义元素
24
- - **🛡️ 安全可靠**:编译时模板固定,自动 HTML 转义,内置 XSS 防护机制
24
+ - **🛡️ 安全可靠**:编译时模板固定,文本节点自动转义,SVG 图标注入前消毒
25
25
  - **📦 插件系统**:灵活的插件扩展机制
26
- - **🧪 测试完善**:完整的单元测试覆盖
26
+ - **🧪 测试覆盖**:440+ 个单元测试,核心模块覆盖率门禁 80%+
27
27
  - **🗺️ 路由支持**:内置路由系统,支持单页应用开发
28
28
 
29
29
  ## 📚 文档
30
30
 
31
31
  - [快速开始指南](./docs/guide.md) - 从零开始学习 Solely
32
32
  - [API 文档](./docs/api.md) - 完整的 API 参考
33
+ - [验证与发布检查清单](./docs/verification.md) - 改动后如何验证、发版前检查项
33
34
  - [示例项目](./examples/) - 实际应用示例
34
35
  - [VS Code 扩展](./vscode-extension/) - 语法高亮、智能跳转、错误诊断
35
36
  - [插件系统](#插件系统) - 了解 Vite 插件的使用方法
@@ -119,6 +120,10 @@ class MyCounter extends BaseElement<{ count: number }> {
119
120
  }
120
121
  ```
121
122
 
123
+ > **提示**:`super(initialData)` 传入的对象会成为该实例的 `$data` 响应式代理。若多个实例传入**同一个对象**,
124
+ > 它们会共享同一份状态(修改一个会同时触发另一个刷新)。需要实例隔离时,请为每个实例传入新对象;
125
+ > 开发模式下框架会对此输出告警。
126
+
122
127
  ### 2. 在 HTML 中使用
123
128
 
124
129
  ```html
@@ -516,19 +521,35 @@ Solely 框架内置了多层安全防护机制,有效防止常见的 XSS(跨
516
521
 
517
522
  ### 编译时安全
518
523
 
519
- - **模板编译时固定**:所有模板在构建阶段编译为中间表示(IR),运行时无法更改模板结构
520
- - **无运行时解析**:不存在 `eval` 或动态模板解析,杜绝代码注入
524
+ - **模板编译时固定**:模板在构建阶段编译为中间表示(IR),运行时无法更改模板结构
525
+ - **预编译模式无 `eval`**:使用 `?solely` 预编译时,表达式在构建期编译为普通函数,运行时不需要 `new Function`
526
+ - **运行时编译模式**:直接传入模板字符串时会使用 `new Function` 编译表达式,受 CSP 约束(需要 `'unsafe-eval'` 或改用预编译)
521
527
 
522
- ### 自动 HTML 转义
528
+ ### 自动转义
523
529
 
524
- - **文本插值自动转义**:使用 `{{ }}` 插值时,框架自动进行 HTML 实体编码
530
+ - **文本插值安全**:`{{ }}` 的结果通过 `textContent` 写入,不会被浏览器解析为 HTML
525
531
 
526
532
  ```html
527
533
  <!-- 用户输入: <script>alert('XSS')</script> -->
528
534
  <div>{{ $data.userInput }}</div>
529
- <!-- 渲染结果: &lt;script&gt;alert('XSS')&lt;/script&gt; -->
535
+ <!-- 渲染结果: 原样显示 <script>alert('XSS')</script> 文本,不执行 -->
530
536
  ```
531
537
 
538
+ ### URL 协议防护
539
+
540
+ - `:href` / `:src` / `:srcset` / `:action` / `:formaction` / `:poster` / `:xlink:href` 绑定会自动拦截
541
+ `javascript:`、`vbscript:`、`data:text/html` 协议(含 `java\tscript:` 等混淆写法),开发模式下会打印告警
542
+ - `:srcdoc` 绑定默认拦截(iframe 内嵌 HTML 无法用协议白名单判断)
543
+ - 这只是兜底,仍建议业务层按白名单校验 URL
544
+
545
+ ### SVG 消毒
546
+
547
+ `registerIcon` / `loadIconSprite` 注入的 SVG 会经过白名单消毒:
548
+
549
+ - 仅保留合法 SVG 元素,移除 `script`、`foreignObject` 及未知命名空间
550
+ - 移除 `on*` 事件属性,以及 SMIL 动画通过 `attributeName` 写入事件/危险 URL 的载荷
551
+ - `<style>` 保留(iconfont 依赖),但会移除包含 `@import`、`expression()`、`behavior:`、`-moz-binding` 的样式块
552
+
532
553
  ### 安全最佳实践
533
554
 
534
555
  | ✅ 推荐做法 | ❌ 避免做法 |
@@ -552,9 +573,8 @@ Solely 框架内置了多层安全防护机制,有效防止常见的 XSS(跨
552
573
 
553
574
  ⚠️ **`:href` 属性绑定(高危)**:
554
575
 
555
- - **永远不要**将用户输入直接绑定到 `:href`
556
- - 恶意 URL 如 `javascript:alert('XSS')` 会在点击时执行代码
557
- - 建议对 URL 进行协议白名单过滤(只允许 `http://`, `https://`)
576
+ - 框架会默认拦截 `javascript:`、`vbscript:`、`data:text/html`(含混淆写法),但**不要**依赖它做业务校验
577
+ - 仍建议对 URL 进行协议白名单过滤(只允许 `http://`, `https://`)
558
578
  - 示例:
559
579
 
560
580
  ```typescript
@@ -596,10 +616,11 @@ Solely 框架内置了多层安全防护机制,有效防止常见的 XSS(跨
596
616
  ```typescript
597
617
  @CustomElement({
598
618
  tagName: 'my-component', // 必须:组件标签名
599
- template: '...', // 必须:HTML 模板字符串
619
+ template: '...', // 必须:HTML 模板字符串或预编译 IR
600
620
  props: [...], // 可选:属性定义,设置后会自动同步到 $data 中,外部修改会触发响应式
601
621
  styles: '...', // 可选:组件样式
602
- shadowDOM: { use: true } // 可选:使用 Shadow DOM
622
+ shadowDOM: { use: true }, // 可选:使用 Shadow DOM
623
+ dataChangeEvent: false // 可选:关闭每次数据变更时的 dataChange 事件派发(默认开启)
603
624
  })
604
625
  ```
605
626
 
@@ -656,7 +677,7 @@ class MyComponent extends BaseElement<MyData> {
656
677
  interface PropDescriptor {
657
678
  name: string; // 属性名(camelCase)
658
679
  type?: 'string' | 'number' | 'boolean' | 'object' | 'array'; // 类型转换
659
- default?: unknown; // 默认值
680
+ default?: unknown; // 默认值(object/array 会按实例克隆)
660
681
  reflect?: boolean; // 是否同步回 HTML attribute
661
682
  reactive?: boolean; // 是否响应式同步到 $data(默认 true)
662
683
  }
@@ -744,11 +765,13 @@ document.body.appendChild(element);
744
765
 
745
766
  **自动升级规则**:
746
767
 
747
- | 属性类型 | 升级行为 | 说明 |
748
- | ----------------------------- | -------------- | ------------------------------------ |
749
- | 声明在 `props` 中的属性 | 同步到 `$data` | 通过框架生成的 setter 自动同步 |
750
- | 有自定义 getter/setter 的属性 | 触发 setter | 用户自定义逻辑执行,同时同步 `$data` |
751
- | 普通数据属性 | 保持原样 | 不干预,作为普通实例属性 |
768
+ | 属性类型 | 升级行为 | 说明 |
769
+ | ----------------------------- | -------------- | --------------------------------------------------------- |
770
+ | 声明在 `props` 中的属性 | 同步到 `$data` | 通过框架生成的 setter 自动同步 |
771
+ | 有自定义 getter/setter 的属性 | 触发 setter | 用户自定义逻辑执行(是否写入 `$data` 由 setter 自身决定) |
772
+ | 普通数据属性 | 保持原样 | 不干预,作为普通实例属性 |
773
+
774
+ > 框架只调用自定义 setter,不会在调用后补写 `$data`;若 setter 未写入 `$data`,依赖该值的模板不会更新。
752
775
 
753
776
  #### 生命周期钩子
754
777
 
@@ -1246,18 +1269,19 @@ Solely 支持两种路由模式:
1246
1269
  | `hash` | 基于 URL hash | `#/users/123` | 兼容旧浏览器,无需服务器配置 |
1247
1270
  | `history` | 基于 HTML5 History API | `/users/123` | 更美观的 URL,需要服务器支持 |
1248
1271
 
1272
+ > 未指定 `mode` 时默认使用 `history`。
1273
+
1249
1274
  ```typescript
1250
- // Hash 模式(默认)
1275
+ // History 模式(默认)
1251
1276
  const router = createRouter({
1252
1277
  routes,
1253
- mode: 'hash',
1278
+ base: '/app', // 应用基础路径(可选)
1254
1279
  });
1255
1280
 
1256
- // History 模式
1281
+ // Hash 模式
1257
1282
  const router = createRouter({
1258
1283
  routes,
1259
- mode: 'history',
1260
- base: '/app', // 应用基础路径
1284
+ mode: 'hash',
1261
1285
  });
1262
1286
  ```
1263
1287
 
@@ -1275,6 +1299,17 @@ const unsubscribe = router.listen(() => {
1275
1299
  unsubscribe();
1276
1300
  ```
1277
1301
 
1302
+ #### 等待路由就绪
1303
+
1304
+ 组件可能先于 `createRouter()` 挂载,此时可以等待 `routerReady`:
1305
+
1306
+ ```typescript
1307
+ const router = await routerReady;
1308
+ ```
1309
+
1310
+ `routerReady` 的语义是「等待一个可用的 router 实例」:调用 `router.destroy()` 后它会保持 pending,
1311
+ 直到下一次 `createRouter()` 完成;若不再创建新实例,则不会 resolve(属预期行为,不会抛错)。
1312
+
1278
1313
  #### 路由组件
1279
1314
 
1280
1315
  Solely 提供了两个内置的路由组件:
@@ -1401,7 +1436,9 @@ npm run test:ui
1401
1436
  npm run test:coverage
1402
1437
  ```
1403
1438
 
1404
- > 当前测试套件包含 380+ 个单元测试,覆盖编译器、运行时、响应式系统、路由系统和组件接口等模块。
1439
+ > 当前测试套件包含 440+ 个单元测试,覆盖编译器、运行时、响应式系统、路由系统和组件接口等模块。
1440
+ > 覆盖率门禁(statements 80 / branches 75 / functions 85 / lines 80)针对编译器、运行时、响应式与路由核心模块;
1441
+ > `src/components/**` 暂不计入统计,组件测试仍在补齐中。
1405
1442
 
1406
1443
  ## 🔧 构建和开发
1407
1444
 
@@ -1419,6 +1456,19 @@ npm run link
1419
1456
  npm run pack:local
1420
1457
  ```
1421
1458
 
1459
+ ### 开发/生产环境判定
1460
+
1461
+ `IS_DEV` 依次按以下规则判定:
1462
+
1463
+ 1. `globalThis.__IS_PROD__ === true` → 生产(**最高优先级**,用于生产构建部署在 localhost / 内网 / Electron 的场景)
1464
+ 2. `?debug`、`globalThis.__DEBUG__`、`globalThis.__IS_DEV__` → 开发
1465
+ 3. `globalThis.process.env.NODE_ENV` → `production` / `development`
1466
+ 4. 主机名为 `localhost` / `127.0.0.1` / `0.0.0.0` → 开发
1467
+ 5. 其余 → 生产
1468
+
1469
+ > 若你的生产环境跑在 localhost(如桌面端、内网部署),在入口脚本最前面加一行
1470
+ > `globalThis.__IS_PROD__ = true` 即可关闭开发模式下的告警与错误面板。
1471
+
1422
1472
  ## 🤝 贡献指南
1423
1473
 
1424
1474
  欢迎贡献代码!请遵循以下步骤:
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../shared/gen-function.cjs"),t=require("../../shared/env.cjs"),n=require("../../types/ast.cjs"),c=require("../../types/lifecycle.cjs"),o=/\{\{[\s\S]*?\}\}/,s={"solely-checkbox":{prop:"checked",event:"change"},"solely-switch":{prop:"checked",event:"change"},"solely-radio":{prop:"checked",event:"change"}},i=new class{compilers=new Map;get(e="anonymous"){let t=this.compilers.get(e);return t||(t=new r,this.compilers.set(e,t)),t}clear(e){if(e)this.compilers.get(e)?.clear(),this.compilers.delete(e);else{for(const e of this.compilers.values())e.clear();this.compilers.clear()}}};class r{cache=new Map;functions=[];makeCacheKey(e,t,n){return 0===n.length?`${e}:${t}`:`${e}:${t}:${n.map(e=>`${e.i}:${e.x}`).join(";")}`}compile(n,c,o){const s=c?.trim();if(!s)return 0;const i=this.makeCacheKey(n,s,o),r=this.cache.get(i);if(void 0!==r)return r;let l;try{l=e.genFunction(s,n,o)}catch(p){t.IS_DEV&&console.error(`[Solely] IR Compile Error - Type: ${n}, Expr: "${s}"`,p),l=()=>""}const a=this.functions.push(l);return this.cache.set(i,a),a}getFunctions(){return this.functions}getStats(){return{total:this.functions.length,cached:this.cache.size}}clear(){this.cache.clear(),this.functions=[]}}function l(e){const t=e[0];return":"===t?{isDynamic:!0,type:"expression"}:"@"===t?{isDynamic:!0,type:"handler"}:c.isLifecycleKind(e)?{isDynamic:!0,type:"lifecycle"}:{isDynamic:!1,type:null}}function a(e,t,n){e.__m={expr:t??"",loc:n??void 0}}function p(e){if(!e.attrs)return;const t=e.attrs.find(e=>"s-model"===e.key);if(!t)return;const n=t.value.trim(),c=n.startsWith("$data.")?n:`$data.${n.replace(/^this\./,"")}`,o=t.loc,i=(e.tag||"").toLowerCase(),r=e.attrs.find(e=>"type"===e.key),l=r?.value??"text";e.attrs=e.attrs.filter(e=>e!==t);const a=(t,n,c)=>{e.attrs?.push({key:t,value:n,role:c,loc:o})};if("input"===i){if("checkbox"===l){const t=e.attrs.find(e=>"value"===e.key),n=t?JSON.stringify(t.value):'"on"';return a(":checked",`Array.isArray(${c}) ? ${c}.includes(${n}) : ${c}`),void a("@change",`\n const _v = ${n};\n if(Array.isArray(${c})) {\n const _i = ${c}.indexOf(_v);\n if(checked && _i === -1) ${c}.push(_v);\n else if(!checked && _i > -1) ${c}.splice(_i,1);\n } else {\n ${c} = checked;\n }`,"model")}if("radio"===l){const t=e.attrs.find(e=>"value"===e.key),n=t?.value??"null";return a(":checked",`${c} == ${JSON.stringify(n)}`),void a("@change",`if (checked) ${c} = ${JSON.stringify(n)}`,"model")}return a(":value",c),void a("@input",`${c} = value`,"model")}if("textarea"===i)return a(":value",c),void a("@input",`${c} = value`,"model");if("select"===i)return void(e.attrs.some(e=>"multiple"===e.key)?(a("updated",`\n const values = Array.isArray(${c}) ? ${c} : ${c} != null ? [${c}] : [];\n for (const opt of el.options) {\n opt.selected = values.includes(opt.value);\n }`),a("@change",`${c} = Array.from(event.target.selectedOptions).map(o => o.value)`,"model")):(a(":value",c),a("@change",`${c} = value`,"model")));const p=s[i],u=p?.prop??"value",f=p?.event??"change";a(`:${u}`,c),a(`@${f}`,`${c} = ${"checked"===u?"checked":"value"===u?"value":`event.target.${u}`}`,"model")}function u(e,t,n,c=null){if(!e.attrs||0===e.attrs.length)return[];const o=[];for(const s of e.attrs){if(c&&c.has(s.key))continue;const{key:i,value:r,role:p}=s,{isDynamic:u,type:f}=l(i);if(u&&f){const c={k:i,f:n.compile(f,r??"",t),d:1,r:p};a(c,r,s.loc??e.loc),o.push(c)}else o.push({k:i,v:r,d:0,r:p})}return o}function f(e){let t=0===e.d;if(e.c&&e.c.length>0)for(const n of e.c)f(n)||(t=!1);if(e.b&&e.b.length>0)for(const n of e.b)if(n.c&&n.c.length>0)for(const e of n.c)f(e)||(t=!1);return!t||e.t!==n.ASTType.Element&&e.t!==n.ASTType.Text||(e.s=1),t}function h(e,c,s){const i={t:e.type,d:0};let r=!1;var f;switch(e.type===n.ASTType.Text?(f=e.content)&&o.test(f)&&(r=!0):(e.attrs?.some(e=>"s-model"===e.key||l(e.key).isDynamic)&&(r=!0),e.type===n.ASTType.For&&(r=!0)),i.d=r?1:0,e.type){case n.ASTType.Text:{const t=e.content??"";r?(i.f=s.compile("template",t,c),a(i,t,e.loc)):i.x=t;break}case n.ASTType.Element:i.g=e.tag,p(e),i.a=u(e,c,s),e.children&&(i.c=y(e.children,c,s));break;case n.ASTType.For:{const t=e.attrs?.find(e=>"each"===e.key),n=t?.value??"";i.f=s.compile("expression",n,c),i.i=e.attrs?.find(e=>"item"===e.key)?.value??"item",i.n=e.attrs?.find(e=>"index"===e.key)?.value??"index",a(i,n,t?.loc??e.loc);const o=new Set(["each","item","index"]);i.a=u(e,c,s,o);const r=[...c,{i:i.i,x:i.n}];e.children&&(i.c=y(e.children,r,s));break}case n.ASTType.If:case n.ASTType.ElseIf:case n.ASTType.Else:case n.ASTType.Show:t.IS_DEV&&console.warn(`[Solely] Orphaned conditional node found: ${n.ASTType[e.type]}`),i.a=u(e,c,s),e.children&&(i.c=y(e.children,c,s));break;case n.ASTType.Comment:i.x=e.content??""}return i}function y(e,t,c){const o=[];let s=0;for(;s<e.length;){const i=e[s];if(i.type===n.ASTType.If||i.type===n.ASTType.Show){const r=[];let l=s;for(;l<e.length;){const o=e[l],s=o.type;if(s!==n.ASTType.If&&s!==n.ASTType.ElseIf&&s!==n.ASTType.Else&&s!==n.ASTType.Show)break;if((s===n.ASTType.If||s===n.ASTType.Show)&&r.length>0)break;let i,a=null,p="";if(s!==n.ASTType.Else){const e=o.attrs?.find(e=>"test"===e.key||"condition"===e.key);p=e?.value??"false",a=c.compile("expression",p,t),i=e?.loc??o.loc}const f=o.children?y(o.children,t,c):[],h=u(o,t,c,new Set(["test","condition","keepalive"])),d=s===n.ASTType.Show||o.attrs?.some(e=>"keepalive"===e.key);if(r.push({f:a,c:f,a:h.length>0?h:void 0,ka:d?1:void 0,__m:{expr:p,loc:i}}),l++,s===n.ASTType.Else||s===n.ASTType.Show)break}o.push({t:n.ASTType.Conditional,d:1,b:r,__m:{loc:i.loc}}),s=l}else o.push(h(i,t,c)),s++}return o}exports.buildIR=function(e,n={}){const{filename:c="anonymous",source:o}=n,s=i.get(c);s.clear();const r=performance.now(),l=y(e,[],s);for(const t of l)f(t);const a=performance.now(),p=s.getStats(),u=l.filter(e=>1===e.d).length,h=l.filter(e=>1===e.s).length,d={t:"root",v:"1.2.0",fns:s.getFunctions(),n:l,s:{tf:p.total,cf:p.cached,dn:u,tn:l.length,sn:h},m:{t:(new Date).toISOString(),as:e.length,fn:c,...o&&{src:o}}};return t.IS_DEV&&console.info(`[Solely] Compiled <${c}> in ${(a-r).toFixed(2)}ms | Nodes: ${l.length} | Fns: ${p.total} | StaticSubtrees: ${h}`),d},exports.clearIRCache=function(e){i.clear(e)},exports.transformModel=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../shared/gen-function.cjs"),t=require("../../shared/env.cjs"),n=require("../../types/ast.cjs"),c=require("../../types/lifecycle.cjs"),o=/\{\{[\s\S]*?\}\}/,s={"solely-checkbox":{prop:"checked",event:"change"},"solely-switch":{prop:"checked",event:"change"},"solely-radio":{prop:"checked",event:"change"}},i=new class{compilers=new Map;get(e="anonymous"){let t=this.compilers.get(e);return t||(t=new r,this.compilers.set(e,t)),t}clear(e){if(e)this.compilers.get(e)?.clear(),this.compilers.delete(e);else{for(const e of this.compilers.values())e.clear();this.compilers.clear()}}};class r{cache=new Map;functions=[];makeCacheKey(e,t,n){return 0===n.length?`${e}:${t}`:`${e}:${t}:${n.map(e=>`${e.i}:${e.x}`).join(";")}`}compile(n,c,o){const s="template"===n?c??"":c?.trim()??"";if(!s.trim())return 0;const i=this.makeCacheKey(n,s,o),r=this.cache.get(i);if(void 0!==r)return r;let l;try{l=e.genFunction(s,n,o)}catch(p){t.IS_DEV&&console.error(`[Solely] IR Compile Error - Type: ${n}, Expr: "${s}"`,p),l=()=>""}const a=this.functions.push(l);return this.cache.set(i,a),a}getFunctions(){return this.functions}getStats(){return{total:this.functions.length,cached:this.cache.size}}clear(){this.cache.clear(),this.functions=[]}}function l(e){const t=e[0];return":"===t?{isDynamic:!0,type:"expression"}:"@"===t?{isDynamic:!0,type:"handler"}:c.isLifecycleKind(e)?{isDynamic:!0,type:"lifecycle"}:{isDynamic:!1,type:null}}function a(e,t,n){e.__m={expr:t??"",loc:n??void 0}}function p(e){if(!e.attrs)return;const t=e.attrs.find(e=>"s-model"===e.key);if(!t)return;const n=t.value.trim(),c=n.startsWith("$data.")?n:`$data.${n.replace(/^this\./,"")}`,o=t.loc,i=(e.tag||"").toLowerCase(),r=e.attrs.find(e=>"type"===e.key),l=r?.value??"text";e.attrs=e.attrs.filter(e=>e!==t);const a=(t,n,c)=>{e.attrs?.push({key:t,value:n,role:c,loc:o})};if("input"===i){if("checkbox"===l){const t=e.attrs.find(e=>"value"===e.key),n=t?JSON.stringify(t.value):'"on"';return a(":checked",`Array.isArray(${c}) ? ${c}.includes(${n}) : ${c}`),void a("@change",`\n const _v = ${n};\n if(Array.isArray(${c})) {\n const _i = ${c}.indexOf(_v);\n if(checked && _i === -1) ${c}.push(_v);\n else if(!checked && _i > -1) ${c}.splice(_i,1);\n } else {\n ${c} = checked;\n }`,"model")}if("radio"===l){const t=e.attrs.find(e=>"value"===e.key),n=t?.value??"null";return a(":checked",`${c} == ${JSON.stringify(n)}`),void a("@change",`if (checked) ${c} = ${JSON.stringify(n)}`,"model")}return a(":value",c),void a("@input",`${c} = value`,"model")}if("textarea"===i)return a(":value",c),void a("@input",`${c} = value`,"model");if("select"===i){if(e.attrs.some(e=>"multiple"===e.key)){const e=`\n const values = Array.isArray(${c}) ? ${c} : ${c} != null ? [${c}] : [];\n for (const opt of el.options) {\n opt.selected = values.includes(opt.value);\n }`;a("mounted",e),a("updated",e),a("@change",`${c} = Array.from(event.target.selectedOptions).map(o => o.value)`,"model")}else a(":value",c),a("@change",`${c} = value`,"model");return}const p=s[i],f=p?.prop??"value",y=p?.event??"change";a(`:${f}`,c),a(`@${y}`,`${c} = ${"checked"===f?"checked":"value"===f?"value":`event.target.${f}`}`,"model")}function f(e,t,n,c=null){if(!e.attrs||0===e.attrs.length)return[];const o=[];for(const s of e.attrs){if(c&&c.has(s.key))continue;const{key:i,value:r,role:p}=s,{isDynamic:f,type:y}=l(i);if(f&&y){const c={k:i,f:n.compile(y,r??"",t),d:1,r:p};a(c,r,s.loc??e.loc),o.push(c)}else o.push({k:i,v:r,d:0,r:p})}return o}function y(e){let t=0===e.d;if(e.c&&e.c.length>0)for(const n of e.c)y(n)||(t=!1);if(e.b&&e.b.length>0)for(const n of e.b)if(n.c&&n.c.length>0)for(const e of n.c)y(e)||(t=!1);return!t||e.t!==n.ASTType.Element&&e.t!==n.ASTType.Text||(e.s=1),t}function u(e,c,s){const i={t:e.type,d:0};let r=!1;var y;switch(e.type===n.ASTType.Text?(y=e.content)&&o.test(y)&&(r=!0):(e.attrs?.some(e=>"s-model"===e.key||l(e.key).isDynamic)&&(r=!0),e.type===n.ASTType.For&&(r=!0)),i.d=r?1:0,e.type){case n.ASTType.Text:{const t=e.content??"";r?(i.f=s.compile("template",t,c),a(i,t,e.loc)):i.x=t;break}case n.ASTType.Element:i.g=e.tag,p(e),i.a=f(e,c,s),e.children&&(i.c=h(e.children,c,s));break;case n.ASTType.For:{const t=e.attrs?.find(e=>"each"===e.key),n=t?.value??"";i.f=s.compile("expression",n,c),i.i=e.attrs?.find(e=>"item"===e.key)?.value??"item",i.n=e.attrs?.find(e=>"index"===e.key)?.value??"index",a(i,n,t?.loc??e.loc);const o=new Set(["each","item","index"]);i.a=f(e,c,s,o);const r=[...c,{i:i.i,x:i.n}];e.children&&(i.c=h(e.children,r,s));break}case n.ASTType.If:case n.ASTType.ElseIf:case n.ASTType.Else:case n.ASTType.Show:t.IS_DEV&&console.warn(`[Solely] Orphaned conditional node found: ${n.ASTType[e.type]}`),i.a=f(e,c,s),e.children&&(i.c=h(e.children,c,s));break;case n.ASTType.Comment:i.x=e.content??""}return i}function h(e,t,c){const o=[];let s=0;for(;s<e.length;){const i=e[s];if(i.type===n.ASTType.If||i.type===n.ASTType.Show){const r=[];let l=s;for(;l<e.length;){const o=e[l],s=o.type;if(o.type===n.ASTType.Text&&!(o.content??"").trim()||o.type===n.ASTType.Comment){let t=l;for(;t<e.length;){const c=e[t];if((c.type!==n.ASTType.Text||(c.content??"").trim())&&c.type!==n.ASTType.Comment)break;t++}const c=e[t];if(c&&(c.type===n.ASTType.ElseIf||c.type===n.ASTType.Else)){l=t;continue}break}if(s!==n.ASTType.If&&s!==n.ASTType.ElseIf&&s!==n.ASTType.Else&&s!==n.ASTType.Show)break;if((s===n.ASTType.If||s===n.ASTType.Show)&&r.length>0)break;let i,a=null,p="";if(s!==n.ASTType.Else){const e=o.attrs?.find(e=>"test"===e.key||"condition"===e.key);p=e?.value??"false",a=c.compile("expression",p,t),i=e?.loc??o.loc}const y=o.children?h(o.children,t,c):[],u=f(o,t,c,new Set(["test","condition","keepalive"])),d=s===n.ASTType.Show||o.attrs?.some(e=>"keepalive"===e.key);if(r.push({f:a,c:y,a:u.length>0?u:void 0,ka:d?1:void 0,__m:{expr:p,loc:i}}),l++,s===n.ASTType.Else||s===n.ASTType.Show)break}o.push({t:n.ASTType.Conditional,d:1,b:r,__m:{loc:i.loc}}),s=l}else o.push(u(i,t,c)),s++}return o}exports.buildIR=function(e,n={}){const{filename:c="anonymous",source:o}=n,s=i.get(c);s.clear();const r=performance.now(),l=h(e,[],s);for(const t of l)y(t);const a=performance.now(),p=s.getStats(),f=l.filter(e=>1===e.d).length,u=l.filter(e=>1===e.s).length,d={t:"root",v:"1.2.0",fns:s.getFunctions(),n:l,s:{tf:p.total,cf:p.cached,dn:f,tn:l.length,sn:u},m:{...t.IS_DEV&&{t:(new Date).toISOString()},as:e.length,fn:c,...o&&{src:o}}};return t.IS_DEV&&console.info(`[Solely] Compiled <${c}> in ${(a-r).toFixed(2)}ms | Nodes: ${l.length} | Fns: ${p.total} | StaticSubtrees: ${u}`),d},exports.clearIRCache=function(e){i.clear(e)},exports.transformModel=p;
@@ -1 +1 @@
1
- import{genFunction as e}from"../../shared/gen-function.js";import{IS_DEV as t}from"../../shared/env.js";import{ASTType as n}from"../../types/ast.js";import{isLifecycleKind as o}from"../../types/lifecycle.js";const c=/\{\{[\s\S]*?\}\}/,s={"solely-checkbox":{prop:"checked",event:"change"},"solely-switch":{prop:"checked",event:"change"},"solely-radio":{prop:"checked",event:"change"}},i=new class{compilers=new Map;get(e="anonymous"){let t=this.compilers.get(e);return t||(t=new r,this.compilers.set(e,t)),t}clear(e){if(e)this.compilers.get(e)?.clear(),this.compilers.delete(e);else{for(const e of this.compilers.values())e.clear();this.compilers.clear()}}};class r{cache=new Map;functions=[];makeCacheKey(e,t,n){return 0===n.length?`${e}:${t}`:`${e}:${t}:${n.map(e=>`${e.i}:${e.x}`).join(";")}`}compile(n,o,c){const s=o?.trim();if(!s)return 0;const i=this.makeCacheKey(n,s,c),r=this.cache.get(i);if(void 0!==r)return r;let l;try{l=e(s,n,c)}catch(f){t&&console.error(`[Solely] IR Compile Error - Type: ${n}, Expr: "${s}"`,f),l=()=>""}const a=this.functions.push(l);return this.cache.set(i,a),a}getFunctions(){return this.functions}getStats(){return{total:this.functions.length,cached:this.cache.size}}clear(){this.cache.clear(),this.functions=[]}}function l(e){const t=e[0];return":"===t?{isDynamic:!0,type:"expression"}:"@"===t?{isDynamic:!0,type:"handler"}:o(e)?{isDynamic:!0,type:"lifecycle"}:{isDynamic:!1,type:null}}function a(e,t,n){e.__m={expr:t??"",loc:n??void 0}}function f(e){if(!e.attrs)return;const t=e.attrs.find(e=>"s-model"===e.key);if(!t)return;const n=t.value.trim(),o=n.startsWith("$data.")?n:`$data.${n.replace(/^this\./,"")}`,c=t.loc,i=(e.tag||"").toLowerCase(),r=e.attrs.find(e=>"type"===e.key),l=r?.value??"text";e.attrs=e.attrs.filter(e=>e!==t);const a=(t,n,o)=>{e.attrs?.push({key:t,value:n,role:o,loc:c})};if("input"===i){if("checkbox"===l){const t=e.attrs.find(e=>"value"===e.key),n=t?JSON.stringify(t.value):'"on"';return a(":checked",`Array.isArray(${o}) ? ${o}.includes(${n}) : ${o}`),void a("@change",`\n const _v = ${n};\n if(Array.isArray(${o})) {\n const _i = ${o}.indexOf(_v);\n if(checked && _i === -1) ${o}.push(_v);\n else if(!checked && _i > -1) ${o}.splice(_i,1);\n } else {\n ${o} = checked;\n }`,"model")}if("radio"===l){const t=e.attrs.find(e=>"value"===e.key),n=t?.value??"null";return a(":checked",`${o} == ${JSON.stringify(n)}`),void a("@change",`if (checked) ${o} = ${JSON.stringify(n)}`,"model")}return a(":value",o),void a("@input",`${o} = value`,"model")}if("textarea"===i)return a(":value",o),void a("@input",`${o} = value`,"model");if("select"===i)return void(e.attrs.some(e=>"multiple"===e.key)?(a("updated",`\n const values = Array.isArray(${o}) ? ${o} : ${o} != null ? [${o}] : [];\n for (const opt of el.options) {\n opt.selected = values.includes(opt.value);\n }`),a("@change",`${o} = Array.from(event.target.selectedOptions).map(o => o.value)`,"model")):(a(":value",o),a("@change",`${o} = value`,"model")));const f=s[i],h=f?.prop??"value",u=f?.event??"change";a(`:${h}`,o),a(`@${u}`,`${o} = ${"checked"===h?"checked":"value"===h?"value":`event.target.${h}`}`,"model")}function h(e,t,n,o=null){if(!e.attrs||0===e.attrs.length)return[];const c=[];for(const s of e.attrs){if(o&&o.has(s.key))continue;const{key:i,value:r,role:f}=s,{isDynamic:h,type:u}=l(i);if(h&&u){const o={k:i,f:n.compile(u,r??"",t),d:1,r:f};a(o,r,s.loc??e.loc),c.push(o)}else c.push({k:i,v:r,d:0,r:f})}return c}function u(e){let t=0===e.d;if(e.c&&e.c.length>0)for(const n of e.c)u(n)||(t=!1);if(e.b&&e.b.length>0)for(const n of e.b)if(n.c&&n.c.length>0)for(const e of n.c)u(e)||(t=!1);return!t||e.t!==n.Element&&e.t!==n.Text||(e.s=1),t}function d(e,o,s){const i={t:e.type,d:0};let r=!1;var u;switch(e.type===n.Text?(u=e.content)&&c.test(u)&&(r=!0):(e.attrs?.some(e=>"s-model"===e.key||l(e.key).isDynamic)&&(r=!0),e.type===n.For&&(r=!0)),i.d=r?1:0,e.type){case n.Text:{const t=e.content??"";r?(i.f=s.compile("template",t,o),a(i,t,e.loc)):i.x=t;break}case n.Element:i.g=e.tag,f(e),i.a=h(e,o,s),e.children&&(i.c=p(e.children,o,s));break;case n.For:{const t=e.attrs?.find(e=>"each"===e.key),n=t?.value??"";i.f=s.compile("expression",n,o),i.i=e.attrs?.find(e=>"item"===e.key)?.value??"item",i.n=e.attrs?.find(e=>"index"===e.key)?.value??"index",a(i,n,t?.loc??e.loc);const c=new Set(["each","item","index"]);i.a=h(e,o,s,c);const r=[...o,{i:i.i,x:i.n}];e.children&&(i.c=p(e.children,r,s));break}case n.If:case n.ElseIf:case n.Else:case n.Show:t&&console.warn(`[Solely] Orphaned conditional node found: ${n[e.type]}`),i.a=h(e,o,s),e.children&&(i.c=p(e.children,o,s));break;case n.Comment:i.x=e.content??""}return i}function p(e,t,o){const c=[];let s=0;for(;s<e.length;){const i=e[s];if(i.type===n.If||i.type===n.Show){const r=[];let l=s;for(;l<e.length;){const c=e[l],s=c.type;if(s!==n.If&&s!==n.ElseIf&&s!==n.Else&&s!==n.Show)break;if((s===n.If||s===n.Show)&&r.length>0)break;let i,a=null,f="";if(s!==n.Else){const e=c.attrs?.find(e=>"test"===e.key||"condition"===e.key);f=e?.value??"false",a=o.compile("expression",f,t),i=e?.loc??c.loc}const u=c.children?p(c.children,t,o):[],d=h(c,t,o,new Set(["test","condition","keepalive"])),m=s===n.Show||c.attrs?.some(e=>"keepalive"===e.key);if(r.push({f:a,c:u,a:d.length>0?d:void 0,ka:m?1:void 0,__m:{expr:f,loc:i}}),l++,s===n.Else||s===n.Show)break}c.push({t:n.Conditional,d:1,b:r,__m:{loc:i.loc}}),s=l}else c.push(d(i,t,o)),s++}return c}function m(e,n={}){const{filename:o="anonymous",source:c}=n,s=i.get(o);s.clear();const r=performance.now(),l=p(e,[],s);for(const t of l)u(t);const a=performance.now(),f=s.getStats(),h=l.filter(e=>1===e.d).length,d=l.filter(e=>1===e.s).length,m={t:"root",v:"1.2.0",fns:s.getFunctions(),n:l,s:{tf:f.total,cf:f.cached,dn:h,tn:l.length,sn:d},m:{t:(new Date).toISOString(),as:e.length,fn:o,...c&&{src:c}}};return t&&console.info(`[Solely] Compiled <${o}> in ${(a-r).toFixed(2)}ms | Nodes: ${l.length} | Fns: ${f.total} | StaticSubtrees: ${d}`),m}function y(e){i.clear(e)}export{m as buildIR,y as clearIRCache,f as transformModel};
1
+ import{genFunction as e}from"../../shared/gen-function.js";import{IS_DEV as t}from"../../shared/env.js";import{ASTType as n}from"../../types/ast.js";import{isLifecycleKind as o}from"../../types/lifecycle.js";const c=/\{\{[\s\S]*?\}\}/,s={"solely-checkbox":{prop:"checked",event:"change"},"solely-switch":{prop:"checked",event:"change"},"solely-radio":{prop:"checked",event:"change"}},i=new class{compilers=new Map;get(e="anonymous"){let t=this.compilers.get(e);return t||(t=new r,this.compilers.set(e,t)),t}clear(e){if(e)this.compilers.get(e)?.clear(),this.compilers.delete(e);else{for(const e of this.compilers.values())e.clear();this.compilers.clear()}}};class r{cache=new Map;functions=[];makeCacheKey(e,t,n){return 0===n.length?`${e}:${t}`:`${e}:${t}:${n.map(e=>`${e.i}:${e.x}`).join(";")}`}compile(n,o,c){const s="template"===n?o??"":o?.trim()??"";if(!s.trim())return 0;const i=this.makeCacheKey(n,s,c),r=this.cache.get(i);if(void 0!==r)return r;let l;try{l=e(s,n,c)}catch(f){t&&console.error(`[Solely] IR Compile Error - Type: ${n}, Expr: "${s}"`,f),l=()=>""}const a=this.functions.push(l);return this.cache.set(i,a),a}getFunctions(){return this.functions}getStats(){return{total:this.functions.length,cached:this.cache.size}}clear(){this.cache.clear(),this.functions=[]}}function l(e){const t=e[0];return":"===t?{isDynamic:!0,type:"expression"}:"@"===t?{isDynamic:!0,type:"handler"}:o(e)?{isDynamic:!0,type:"lifecycle"}:{isDynamic:!1,type:null}}function a(e,t,n){e.__m={expr:t??"",loc:n??void 0}}function f(e){if(!e.attrs)return;const t=e.attrs.find(e=>"s-model"===e.key);if(!t)return;const n=t.value.trim(),o=n.startsWith("$data.")?n:`$data.${n.replace(/^this\./,"")}`,c=t.loc,i=(e.tag||"").toLowerCase(),r=e.attrs.find(e=>"type"===e.key),l=r?.value??"text";e.attrs=e.attrs.filter(e=>e!==t);const a=(t,n,o)=>{e.attrs?.push({key:t,value:n,role:o,loc:c})};if("input"===i){if("checkbox"===l){const t=e.attrs.find(e=>"value"===e.key),n=t?JSON.stringify(t.value):'"on"';return a(":checked",`Array.isArray(${o}) ? ${o}.includes(${n}) : ${o}`),void a("@change",`\n const _v = ${n};\n if(Array.isArray(${o})) {\n const _i = ${o}.indexOf(_v);\n if(checked && _i === -1) ${o}.push(_v);\n else if(!checked && _i > -1) ${o}.splice(_i,1);\n } else {\n ${o} = checked;\n }`,"model")}if("radio"===l){const t=e.attrs.find(e=>"value"===e.key),n=t?.value??"null";return a(":checked",`${o} == ${JSON.stringify(n)}`),void a("@change",`if (checked) ${o} = ${JSON.stringify(n)}`,"model")}return a(":value",o),void a("@input",`${o} = value`,"model")}if("textarea"===i)return a(":value",o),void a("@input",`${o} = value`,"model");if("select"===i){if(e.attrs.some(e=>"multiple"===e.key)){const e=`\n const values = Array.isArray(${o}) ? ${o} : ${o} != null ? [${o}] : [];\n for (const opt of el.options) {\n opt.selected = values.includes(opt.value);\n }`;a("mounted",e),a("updated",e),a("@change",`${o} = Array.from(event.target.selectedOptions).map(o => o.value)`,"model")}else a(":value",o),a("@change",`${o} = value`,"model");return}const f=s[i],h=f?.prop??"value",u=f?.event??"change";a(`:${h}`,o),a(`@${u}`,`${o} = ${"checked"===h?"checked":"value"===h?"value":`event.target.${h}`}`,"model")}function h(e,t,n,o=null){if(!e.attrs||0===e.attrs.length)return[];const c=[];for(const s of e.attrs){if(o&&o.has(s.key))continue;const{key:i,value:r,role:f}=s,{isDynamic:h,type:u}=l(i);if(h&&u){const o={k:i,f:n.compile(u,r??"",t),d:1,r:f};a(o,r,s.loc??e.loc),c.push(o)}else c.push({k:i,v:r,d:0,r:f})}return c}function u(e){let t=0===e.d;if(e.c&&e.c.length>0)for(const n of e.c)u(n)||(t=!1);if(e.b&&e.b.length>0)for(const n of e.b)if(n.c&&n.c.length>0)for(const e of n.c)u(e)||(t=!1);return!t||e.t!==n.Element&&e.t!==n.Text||(e.s=1),t}function p(e,o,s){const i={t:e.type,d:0};let r=!1;var u;switch(e.type===n.Text?(u=e.content)&&c.test(u)&&(r=!0):(e.attrs?.some(e=>"s-model"===e.key||l(e.key).isDynamic)&&(r=!0),e.type===n.For&&(r=!0)),i.d=r?1:0,e.type){case n.Text:{const t=e.content??"";r?(i.f=s.compile("template",t,o),a(i,t,e.loc)):i.x=t;break}case n.Element:i.g=e.tag,f(e),i.a=h(e,o,s),e.children&&(i.c=d(e.children,o,s));break;case n.For:{const t=e.attrs?.find(e=>"each"===e.key),n=t?.value??"";i.f=s.compile("expression",n,o),i.i=e.attrs?.find(e=>"item"===e.key)?.value??"item",i.n=e.attrs?.find(e=>"index"===e.key)?.value??"index",a(i,n,t?.loc??e.loc);const c=new Set(["each","item","index"]);i.a=h(e,o,s,c);const r=[...o,{i:i.i,x:i.n}];e.children&&(i.c=d(e.children,r,s));break}case n.If:case n.ElseIf:case n.Else:case n.Show:t&&console.warn(`[Solely] Orphaned conditional node found: ${n[e.type]}`),i.a=h(e,o,s),e.children&&(i.c=d(e.children,o,s));break;case n.Comment:i.x=e.content??""}return i}function d(e,t,o){const c=[];let s=0;for(;s<e.length;){const i=e[s];if(i.type===n.If||i.type===n.Show){const r=[];let l=s;for(;l<e.length;){const c=e[l],s=c.type;if(c.type===n.Text&&!(c.content??"").trim()||c.type===n.Comment){let t=l;for(;t<e.length;){const o=e[t];if((o.type!==n.Text||(o.content??"").trim())&&o.type!==n.Comment)break;t++}const o=e[t];if(o&&(o.type===n.ElseIf||o.type===n.Else)){l=t;continue}break}if(s!==n.If&&s!==n.ElseIf&&s!==n.Else&&s!==n.Show)break;if((s===n.If||s===n.Show)&&r.length>0)break;let i,a=null,f="";if(s!==n.Else){const e=c.attrs?.find(e=>"test"===e.key||"condition"===e.key);f=e?.value??"false",a=o.compile("expression",f,t),i=e?.loc??c.loc}const u=c.children?d(c.children,t,o):[],p=h(c,t,o,new Set(["test","condition","keepalive"])),m=s===n.Show||c.attrs?.some(e=>"keepalive"===e.key);if(r.push({f:a,c:u,a:p.length>0?p:void 0,ka:m?1:void 0,__m:{expr:f,loc:i}}),l++,s===n.Else||s===n.Show)break}c.push({t:n.Conditional,d:1,b:r,__m:{loc:i.loc}}),s=l}else c.push(p(i,t,o)),s++}return c}function m(e,n={}){const{filename:o="anonymous",source:c}=n,s=i.get(o);s.clear();const r=performance.now(),l=d(e,[],s);for(const t of l)u(t);const a=performance.now(),f=s.getStats(),h=l.filter(e=>1===e.d).length,p=l.filter(e=>1===e.s).length,m={t:"root",v:"1.2.0",fns:s.getFunctions(),n:l,s:{tf:f.total,cf:f.cached,dn:h,tn:l.length,sn:p},m:{...t&&{t:(new Date).toISOString()},as:e.length,fn:o,...c&&{src:c}}};return t&&console.info(`[Solely] Compiled <${o}> in ${(a-r).toFixed(2)}ms | Nodes: ${l.length} | Fns: ${f.total} | StaticSubtrees: ${p}`),m}function y(e){i.clear(e)}export{m as buildIR,y as clearIRCache,f as transformModel};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../shared/event-listeners.cjs"),e=require("../../types/ast.cjs"),n=require("../../types/lifecycle.cjs"),s=/<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/,o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),r=/\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;function c(o,c){const i=(o.match(s)||[])[1]?.toLowerCase()??"",l=function(e,s){r.lastIndex=0;const o=[];let c;const i=e.replace(/^\s*[^\s"'/>]+/,""),l=e.length-i.length;for(;null!==(c=r.exec(i));){const r=c[1];if(!r)continue;const i=c[2]??c[3]??c[4]??"";let h=r;t.default.has(r)&&(h=h.replace(/^on/,"@")),"s-model"!==h&&(h=h.replace(/^on-/,"@").replace(/^s-/,":")),h=n.mapAttrKeyToLifecycleKind(h)||h;const a=c[0],f=a.indexOf("=");let p;if(-1===f)p=a.indexOf(r)+r.length;else{let t=f+1;for(;t<a.length&&/\s/.test(a[t]);)t++;if('"'===a[t]||"'"===a[t]){let e=t+1;for(;e<a.length&&/\s/.test(a[e]);)e++;p=e}else{let e=t;for(;e<a.length&&/\s/.test(a[e]);)e++;p=e}}const u=c.index+p+l,g=e.slice(0,u).split("\n"),T=s[0]+g.length-1,y=g.length>1?g[g.length-1].length+1:s[1]+u;o.push({key:h,value:i,loc:[T,y]})}return o}(o,c);return{type:{for:e.ASTType.For,if:e.ASTType.If,elseif:e.ASTType.ElseIf,else:e.ASTType.Else,show:e.ASTType.Show}[i]??e.ASTType.Element,tag:i,loc:c,children:[],attrs:l}}function i(t,e){const n=t.length;if(t.startsWith("!--",e)){const n=t.indexOf("--\x3e",e+3);return-1===n?-1:n+2}if(t.startsWith("![CDATA[",e)){const n=t.indexOf("]]>",e+8);return-1===n?-1:n+2}if("!"===t[e])return t.indexOf(">",e+1);if("?"===t[e]){const n=t.indexOf("?>",e+1);return-1===n?-1:n+1}let s=!1,o=!1,r=e;for(;r<n;){const e=t[r];if("'"!==e||o)if('"'!==e||s){if(">"===e&&!s&&!o)return r}else o=!o;else s=!s;r++}return-1}exports.parseHtml=function(t){const n=[];if(!t)return[];const r=[],l=()=>0===r.length?n:r[r.length-1].children||=[];let h=0;const a=t.length,f=[0];let p=0;for(;-1!==(p=t.indexOf("\n",p));)f.push(++p);function u(t){let e=0,n=f.length-1;for(;e<=n;){const s=e+n>>>1;f[s]<=t?e=s+1:n=s-1}return[n+1,t-f[n]+1]}for(;h<a;){const n=t.indexOf("<",h);if(-1===n||n>h){const s=t.substring(h,-1===n?void 0:n),o=r.length>0?r[r.length-1]:null;let c,i;if(!o||"pre"!==o.tag&&"code"!==o.tag&&"textarea"!==o.tag&&"script"!==o.tag&&"style"!==o.tag){if(c=s.trim(),""===c){if(h=n,-1===n)break;continue}i=h+(s.length-s.trimStart().length)}else c=s,i=h;const a=l(),f=a[a.length-1];if(f&&f.type===e.ASTType.Text)f.content+=c;else{const t=u(i);a.push({type:e.ASTType.Text,tag:"text",content:c,loc:t,children:[]})}if(-1===n)break;h=n}const f=i(t,h+1);if(-1===f){const n=t.substring(h);n.trim()&&l().push({type:e.ASTType.Text,tag:"text",content:n.trim(),children:[],loc:u(h)});break}const p=t.substring(h,f+1),g=l(),T=u(h);if(p.startsWith("\x3c!--")){g.push({type:e.ASTType.Comment,tag:"comment",content:p.slice(4,-3),loc:T,children:[]}),h=f+1;continue}if(p.startsWith("<![CDATA[")){g.push({type:e.ASTType.Text,tag:"text",content:p.slice(9,-3),loc:T,children:[]}),h=f+1;continue}if(p.startsWith("<!")&&!p.startsWith("\x3c!--")){g.push({type:e.ASTType.Comment,tag:"comment",content:p.slice(2,-1),loc:T,children:[]}),h=f+1;continue}if(p.startsWith("<?")){g.push({type:e.ASTType.Comment,tag:"comment",content:p.slice(2,-2),loc:T,children:[]}),h=f+1;continue}if(p.startsWith("</")){const t=(p.match(s)||[])[1]?.toLowerCase();if(t){let e=-1;for(let n=r.length-1;n>=0;n--)if(r[n].tag?.toLowerCase()===t){e=n;break}-1!==e&&(r.length=e)}h=f+1;continue}const y=c(p,T);g.push(y);const d=y.tag||"",x=d.toLowerCase().startsWith("script"),m=d.toLowerCase().startsWith("style"),A=p.endsWith("/>")||o.has(d.toLowerCase());if((x||m)&&!A){const n=`</${d}>`,s=t.toLowerCase().indexOf(n,f+1);if(-1!==s){const o=t.substring(f+1,s);o.length&&y.children.push({type:e.ASTType.Text,tag:"text",content:o,loc:u(f+1),children:[]}),h=s+n.length;continue}{const n=t.substring(f+1);n.length&&y.children.push({type:e.ASTType.Text,tag:"text",content:n,loc:u(f+1),children:[]}),h=a;continue}}A||y.type===e.ASTType.Text||y.type===e.ASTType.Comment||r.push(y),h=f+1}return n};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../shared/event-listeners.cjs"),e=require("../../types/ast.cjs"),n=require("../../types/lifecycle.cjs"),s=/<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/,o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),i=new Set(["html","head","body","div","p","section","article","aside","header","footer","main","nav","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","td","th","form","fieldset","legend","blockquote","pre","hr","address","figure","figcaption","details","summary","dialog","menu","option","optgroup","datalist","template","script","style","title","noscript"]);function r(t,e){const n=/^<([a-zA-Z][a-zA-Z0-9-]*)/.exec(t.slice(e,e+32));return!!n&&i.has(n[1].toLowerCase())}const c=/\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;function l(o,i){const r=(o.match(s)||[])[1]?.toLowerCase()??"",l=function(e,s){c.lastIndex=0;const o=[];let i;const r=e.replace(/^\s*[^\s"'/>]+/,""),l=e.length-r.length;for(;null!==(i=c.exec(r));){const r=i[1];if(!r)continue;const c=i[2]??i[3]??i[4]??"";let a=r;t.default.has(r)&&(a=a.replace(/^on/,"@")),"s-model"!==a&&(a=a.replace(/^on-/,"@").replace(/^s-/,":")),a=n.mapAttrKeyToLifecycleKind(a)||a;const h=i[0],p=h.indexOf("=");let f;if(-1===p)f=h.indexOf(r)+r.length;else{let t=p+1;for(;t<h.length&&/\s/.test(h[t]);)t++;if('"'===h[t]||"'"===h[t]){let e=t+1;for(;e<h.length&&/\s/.test(h[e]);)e++;f=e}else{let e=t;for(;e<h.length&&/\s/.test(h[e]);)e++;f=e}}const u=i.index+f+l,g=e.slice(0,u).split("\n"),d=s[0]+g.length-1,T=g.length>1?g[g.length-1].length+1:s[1]+u;o.push({key:a,value:c,loc:[d,T]})}return o}(o,i);return{type:{for:e.ASTType.For,if:e.ASTType.If,elseif:e.ASTType.ElseIf,else:e.ASTType.Else,show:e.ASTType.Show}[r]??e.ASTType.Element,tag:r,loc:i,children:[],attrs:l}}function a(t,e){const n=t.length;if(t.startsWith("!--",e)){const n=t.indexOf("--\x3e",e+3);return-1===n?-1:n+2}if(t.startsWith("![CDATA[",e)){const n=t.indexOf("]]>",e+8);return-1===n?-1:n+2}if("!"===t[e])return t.indexOf(">",e+1);if("?"===t[e]){const n=t.indexOf("?>",e+1);return-1===n?-1:n+1}let s=!1,o=!1,i=e;for(;i<n;){const e=t[i];if("'"!==e||o)if('"'!==e||s){if(">"===e&&!s&&!o)return i}else o=!o;else s=!s;i++}return-1}exports.parseHtml=function(t){const n=[];if(!t)return[];const c=[],h=()=>0===c.length?n:c[c.length-1].children||=[];let p=0;const f=t.length,u=[0];let g=0;for(;-1!==(g=t.indexOf("\n",g));)u.push(++g);function d(t){let e=0,n=u.length-1;for(;e<=n;){const s=e+n>>>1;u[s]<=t?e=s+1:n=s-1}return[n+1,t-u[n]+1]}for(;p<f;){const n=t.indexOf("<",p);if(-1===n||n>p){const s=t.substring(p,-1===n?void 0:n),o=c.length>0?c[c.length-1]:null,l=o&&("pre"===o.tag||"code"===o.tag||"textarea"===o.tag||"script"===o.tag||"style"===o.tag);let a,f;const u=h(),g=u[u.length-1];if(l)a=s,f=p;else{const c=!g||g.type===e.ASTType.Element&&i.has((g.tag||"").toLowerCase());let l=!0,h=!1;-1!==n&&(h=t.startsWith("</",n),l=h?!o||i.has(o.tag.toLowerCase()):r(t,n));const u=/\n\s*$/.test(s);if(a=s.replace(/\s+/g," "),/^\s+$/.test(s)){if(h||c||l){if(p=n,-1===n)break;continue}a=" "}else c&&(a=a.replace(/^ /,"")),(l||h&&u)&&(a=a.replace(/ $/,""));if(""===a){if(p=n,-1===n)break;continue}f=p+(s.length-s.trimStart().length)}if(g&&g.type===e.ASTType.Text)g.content+=a;else{const t=d(f);u.push({type:e.ASTType.Text,tag:"text",content:a,loc:t,children:[]})}if(-1===n)break;p=n}const u=a(t,p+1);if(-1===u){const n=t.substring(p);n.trim()&&h().push({type:e.ASTType.Text,tag:"text",content:n.trim(),children:[],loc:d(p)});break}const g=t.substring(p,u+1),T=h(),y=d(p);if(g.startsWith("\x3c!--")){T.push({type:e.ASTType.Comment,tag:"comment",content:g.slice(4,-3),loc:y,children:[]}),p=u+1;continue}if(g.startsWith("<![CDATA[")){T.push({type:e.ASTType.Text,tag:"text",content:g.slice(9,-3),loc:y,children:[]}),p=u+1;continue}if(g.startsWith("<!")&&!g.startsWith("\x3c!--")){T.push({type:e.ASTType.Comment,tag:"comment",content:g.slice(2,-1),loc:y,children:[]}),p=u+1;continue}if(g.startsWith("<?")){T.push({type:e.ASTType.Comment,tag:"comment",content:g.slice(2,-2),loc:y,children:[]}),p=u+1;continue}if(g.startsWith("</")){const t=(g.match(s)||[])[1]?.toLowerCase();if(t){let e=-1;for(let n=c.length-1;n>=0;n--)if(c[n].tag?.toLowerCase()===t){e=n;break}-1!==e&&(c.length=e)}p=u+1;continue}const m=l(g,y);T.push(m);const x=m.tag||"",A=x.toLowerCase().startsWith("script"),S=x.toLowerCase().startsWith("style"),b=g.endsWith("/>")||o.has(x.toLowerCase());if((A||S)&&!b){const n=`</${x}>`,s=t.toLowerCase().indexOf(n,u+1);if(-1!==s){const o=t.substring(u+1,s);o.length&&m.children.push({type:e.ASTType.Text,tag:"text",content:o,loc:d(u+1),children:[]}),p=s+n.length;continue}{const n=t.substring(u+1);n.length&&m.children.push({type:e.ASTType.Text,tag:"text",content:n,loc:d(u+1),children:[]}),p=f;continue}}b||m.type===e.ASTType.Text||m.type===e.ASTType.Comment||c.push(m),p=u+1}return n};
@@ -1 +1 @@
1
- import t from"../../shared/event-listeners.js";import{ASTType as e}from"../../types/ast.js";import{mapAttrKeyToLifecycleKind as n}from"../../types/lifecycle.js";const s=/<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/,o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),i=/\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;function r(o,r){const c=(o.match(s)||[])[1]?.toLowerCase()??"",l=function(e,s){i.lastIndex=0;const o=[];let r;const c=e.replace(/^\s*[^\s"'/>]+/,""),l=e.length-c.length;for(;null!==(r=i.exec(c));){const i=r[1];if(!i)continue;const c=r[2]??r[3]??r[4]??"";let h=i;t.has(i)&&(h=h.replace(/^on/,"@")),"s-model"!==h&&(h=h.replace(/^on-/,"@").replace(/^s-/,":")),h=n(h)||h;const a=r[0],f=a.indexOf("=");let g;if(-1===f)g=a.indexOf(i)+i.length;else{let t=f+1;for(;t<a.length&&/\s/.test(a[t]);)t++;if('"'===a[t]||"'"===a[t]){let e=t+1;for(;e<a.length&&/\s/.test(a[e]);)e++;g=e}else{let e=t;for(;e<a.length&&/\s/.test(a[e]);)e++;g=e}}const u=r.index+g+l,p=e.slice(0,u).split("\n"),m=s[0]+p.length-1,d=p.length>1?p[p.length-1].length+1:s[1]+u;o.push({key:h,value:c,loc:[m,d]})}return o}(o,r);return{type:{for:e.For,if:e.If,elseif:e.ElseIf,else:e.Else,show:e.Show}[c]??e.Element,tag:c,loc:r,children:[],attrs:l}}function c(t,e){const n=t.length;if(t.startsWith("!--",e)){const n=t.indexOf("--\x3e",e+3);return-1===n?-1:n+2}if(t.startsWith("![CDATA[",e)){const n=t.indexOf("]]>",e+8);return-1===n?-1:n+2}if("!"===t[e])return t.indexOf(">",e+1);if("?"===t[e]){const n=t.indexOf("?>",e+1);return-1===n?-1:n+1}let s=!1,o=!1,i=e;for(;i<n;){const e=t[i];if("'"!==e||o)if('"'!==e||s){if(">"===e&&!s&&!o)return i}else o=!o;else s=!s;i++}return-1}function l(t){const n=[];if(!t)return[];const i=[],l=()=>0===i.length?n:i[i.length-1].children||=[];let h=0;const a=t.length,f=[0];let g=0;for(;-1!==(g=t.indexOf("\n",g));)f.push(++g);function u(t){let e=0,n=f.length-1;for(;e<=n;){const s=e+n>>>1;f[s]<=t?e=s+1:n=s-1}return[n+1,t-f[n]+1]}for(;h<a;){const n=t.indexOf("<",h);if(-1===n||n>h){const s=t.substring(h,-1===n?void 0:n),o=i.length>0?i[i.length-1]:null;let r,c;if(!o||"pre"!==o.tag&&"code"!==o.tag&&"textarea"!==o.tag&&"script"!==o.tag&&"style"!==o.tag){if(r=s.trim(),""===r){if(h=n,-1===n)break;continue}c=h+(s.length-s.trimStart().length)}else r=s,c=h;const a=l(),f=a[a.length-1];if(f&&f.type===e.Text)f.content+=r;else{const t=u(c);a.push({type:e.Text,tag:"text",content:r,loc:t,children:[]})}if(-1===n)break;h=n}const f=c(t,h+1);if(-1===f){const n=t.substring(h);n.trim()&&l().push({type:e.Text,tag:"text",content:n.trim(),children:[],loc:u(h)});break}const g=t.substring(h,f+1),p=l(),m=u(h);if(g.startsWith("\x3c!--")){p.push({type:e.Comment,tag:"comment",content:g.slice(4,-3),loc:m,children:[]}),h=f+1;continue}if(g.startsWith("<![CDATA[")){p.push({type:e.Text,tag:"text",content:g.slice(9,-3),loc:m,children:[]}),h=f+1;continue}if(g.startsWith("<!")&&!g.startsWith("\x3c!--")){p.push({type:e.Comment,tag:"comment",content:g.slice(2,-1),loc:m,children:[]}),h=f+1;continue}if(g.startsWith("<?")){p.push({type:e.Comment,tag:"comment",content:g.slice(2,-2),loc:m,children:[]}),h=f+1;continue}if(g.startsWith("</")){const t=(g.match(s)||[])[1]?.toLowerCase();if(t){let e=-1;for(let n=i.length-1;n>=0;n--)if(i[n].tag?.toLowerCase()===t){e=n;break}-1!==e&&(i.length=e)}h=f+1;continue}const d=r(g,m);p.push(d);const x=d.tag||"",y=x.toLowerCase().startsWith("script"),b=x.toLowerCase().startsWith("style"),C=g.endsWith("/>")||o.has(x.toLowerCase());if((y||b)&&!C){const n=`</${x}>`,s=t.toLowerCase().indexOf(n,f+1);if(-1!==s){const o=t.substring(f+1,s);o.length&&d.children.push({type:e.Text,tag:"text",content:o,loc:u(f+1),children:[]}),h=s+n.length;continue}{const n=t.substring(f+1);n.length&&d.children.push({type:e.Text,tag:"text",content:n,loc:u(f+1),children:[]}),h=a;continue}}C||d.type===e.Text||d.type===e.Comment||i.push(d),h=f+1}return n}export{l as parseHtml};
1
+ import t from"../../shared/event-listeners.js";import{ASTType as e}from"../../types/ast.js";import{mapAttrKeyToLifecycleKind as n}from"../../types/lifecycle.js";const s=/<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/,o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),i=new Set(["html","head","body","div","p","section","article","aside","header","footer","main","nav","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","td","th","form","fieldset","legend","blockquote","pre","hr","address","figure","figcaption","details","summary","dialog","menu","option","optgroup","datalist","template","script","style","title","noscript"]);function r(t,e){const n=/^<([a-zA-Z][a-zA-Z0-9-]*)/.exec(t.slice(e,e+32));return!!n&&i.has(n[1].toLowerCase())}const c=/\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;function l(o,i){const r=(o.match(s)||[])[1]?.toLowerCase()??"",l=function(e,s){c.lastIndex=0;const o=[];let i;const r=e.replace(/^\s*[^\s"'/>]+/,""),l=e.length-r.length;for(;null!==(i=c.exec(r));){const r=i[1];if(!r)continue;const c=i[2]??i[3]??i[4]??"";let a=r;t.has(r)&&(a=a.replace(/^on/,"@")),"s-model"!==a&&(a=a.replace(/^on-/,"@").replace(/^s-/,":")),a=n(a)||a;const h=i[0],f=h.indexOf("=");let g;if(-1===f)g=h.indexOf(r)+r.length;else{let t=f+1;for(;t<h.length&&/\s/.test(h[t]);)t++;if('"'===h[t]||"'"===h[t]){let e=t+1;for(;e<h.length&&/\s/.test(h[e]);)e++;g=e}else{let e=t;for(;e<h.length&&/\s/.test(h[e]);)e++;g=e}}const u=i.index+g+l,p=e.slice(0,u).split("\n"),d=s[0]+p.length-1,m=p.length>1?p[p.length-1].length+1:s[1]+u;o.push({key:a,value:c,loc:[d,m]})}return o}(o,i);return{type:{for:e.For,if:e.If,elseif:e.ElseIf,else:e.Else,show:e.Show}[r]??e.Element,tag:r,loc:i,children:[],attrs:l}}function a(t,e){const n=t.length;if(t.startsWith("!--",e)){const n=t.indexOf("--\x3e",e+3);return-1===n?-1:n+2}if(t.startsWith("![CDATA[",e)){const n=t.indexOf("]]>",e+8);return-1===n?-1:n+2}if("!"===t[e])return t.indexOf(">",e+1);if("?"===t[e]){const n=t.indexOf("?>",e+1);return-1===n?-1:n+1}let s=!1,o=!1,i=e;for(;i<n;){const e=t[i];if("'"!==e||o)if('"'!==e||s){if(">"===e&&!s&&!o)return i}else o=!o;else s=!s;i++}return-1}function h(t){const n=[];if(!t)return[];const c=[],h=()=>0===c.length?n:c[c.length-1].children||=[];let f=0;const g=t.length,u=[0];let p=0;for(;-1!==(p=t.indexOf("\n",p));)u.push(++p);function d(t){let e=0,n=u.length-1;for(;e<=n;){const s=e+n>>>1;u[s]<=t?e=s+1:n=s-1}return[n+1,t-u[n]+1]}for(;f<g;){const n=t.indexOf("<",f);if(-1===n||n>f){const s=t.substring(f,-1===n?void 0:n),o=c.length>0?c[c.length-1]:null,l=o&&("pre"===o.tag||"code"===o.tag||"textarea"===o.tag||"script"===o.tag||"style"===o.tag);let a,g;const u=h(),p=u[u.length-1];if(l)a=s,g=f;else{const c=!p||p.type===e.Element&&i.has((p.tag||"").toLowerCase());let l=!0,h=!1;-1!==n&&(h=t.startsWith("</",n),l=h?!o||i.has(o.tag.toLowerCase()):r(t,n));const u=/\n\s*$/.test(s);if(a=s.replace(/\s+/g," "),/^\s+$/.test(s)){if(h||c||l){if(f=n,-1===n)break;continue}a=" "}else c&&(a=a.replace(/^ /,"")),(l||h&&u)&&(a=a.replace(/ $/,""));if(""===a){if(f=n,-1===n)break;continue}g=f+(s.length-s.trimStart().length)}if(p&&p.type===e.Text)p.content+=a;else{const t=d(g);u.push({type:e.Text,tag:"text",content:a,loc:t,children:[]})}if(-1===n)break;f=n}const u=a(t,f+1);if(-1===u){const n=t.substring(f);n.trim()&&h().push({type:e.Text,tag:"text",content:n.trim(),children:[],loc:d(f)});break}const p=t.substring(f,u+1),m=h(),x=d(f);if(p.startsWith("\x3c!--")){m.push({type:e.Comment,tag:"comment",content:p.slice(4,-3),loc:x,children:[]}),f=u+1;continue}if(p.startsWith("<![CDATA[")){m.push({type:e.Text,tag:"text",content:p.slice(9,-3),loc:x,children:[]}),f=u+1;continue}if(p.startsWith("<!")&&!p.startsWith("\x3c!--")){m.push({type:e.Comment,tag:"comment",content:p.slice(2,-1),loc:x,children:[]}),f=u+1;continue}if(p.startsWith("<?")){m.push({type:e.Comment,tag:"comment",content:p.slice(2,-2),loc:x,children:[]}),f=u+1;continue}if(p.startsWith("</")){const t=(p.match(s)||[])[1]?.toLowerCase();if(t){let e=-1;for(let n=c.length-1;n>=0;n--)if(c[n].tag?.toLowerCase()===t){e=n;break}-1!==e&&(c.length=e)}f=u+1;continue}const y=l(p,x);m.push(y);const b=y.tag||"",C=b.toLowerCase().startsWith("script"),w=b.toLowerCase().startsWith("style"),W=p.endsWith("/>")||o.has(b.toLowerCase());if((C||w)&&!W){const n=`</${b}>`,s=t.toLowerCase().indexOf(n,u+1);if(-1!==s){const o=t.substring(u+1,s);o.length&&y.children.push({type:e.Text,tag:"text",content:o,loc:d(u+1),children:[]}),f=s+n.length;continue}{const n=t.substring(u+1);n.length&&y.children.push({type:e.Text,tag:"text",content:n,loc:d(u+1),children:[]}),f=g;continue}}W||y.type===e.Text||y.type===e.Comment||c.push(y),f=u+1}return n}export{h as parseHtml};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={duration:3e3,maxCount:5,gap:8,top:24,bottom:24,left:24,right:24,placement:"top"};let o;const s=new Set,i=[],l={info:"ℹ",success:"✓",warning:"⚠",error:"✕",loading:e.createElement("span",{className:"solely-message__loading-spinner"})},a=new Map;function r(t,n){const o=e.createElement("span",{className:`solely-message__icon solely-message__icon--${n}`});return"string"==typeof t?o.textContent=t:o.appendChild(t.cloneNode(!0)),o}async function c(t){if(!s.has(t)){s.add(t);try{const s=i.findIndex(e=>e.id===t);if(-1===s)return;const l=i[s];l.timer&&(clearTimeout(l.timer),l.timer=void 0),await e.addClosingAnimation(l.element,e.ANIMATION_DURATION.NORMAL),l.element.remove();const r=i.findIndex(e=>e.id===t);-1!==r&&i.splice(r,1);try{l.onClose?.()}catch(n){console.error("[Solely Message] onClose callback error:",n)}o&&clearTimeout(o),o=window.setTimeout(()=>{0===i.length&&a.forEach((e,t)=>{0===e.element.childElementCount&&(e.element.remove(),e.cleanupTheme(),a.delete(t))}),o=void 0},300)}finally{s.delete(t)}}}function p(o){const s=e.generateId(),p=o.placement||n.placement,d=function(o=n.placement){const s=o;if(a.has(s))return a.get(s).element;const i=e.createElement("div",{className:"solely-message-container"}),l={position:"fixed",display:"flex",flexDirection:"column",gap:`${n.gap}px`,pointerEvents:"none",zIndex:String(e.Z_INDEX.TOAST)};switch(o){case"top":l.top=`${n.top}px`,l.left="50%",l.transform="translateX(-50%)";break;case"topLeft":l.top=`${n.top}px`,l.left=`${n.left}px`,l.alignItems="flex-start";break;case"topRight":l.top=`${n.top}px`,l.right=`${n.right}px`,l.alignItems="flex-end";break;case"bottom":l.bottom=`${n.bottom}px`,l.left="50%",l.transform="translateX(-50%)";break;case"bottomLeft":l.bottom=`${n.bottom}px`,l.left=`${n.left}px`,l.alignItems="flex-start";break;case"bottomRight":l.bottom=`${n.bottom}px`,l.right=`${n.right}px`,l.alignItems="flex-end";break;case"left":l.top="50%",l.left=`${n.left}px`,l.transform="translateY(-50%)",l.alignItems="flex-start";break;case"right":l.top="50%",l.right=`${n.right}px`,l.transform="translateY(-50%)",l.alignItems="flex-end"}Object.assign(i.style,l),document.body.appendChild(i),e.injectStyle("solely-message-styles",t.default);const r=e.observeTheme(()=>i);return a.set(s,{element:i,cleanupTheme:r}),i}(p),m=i.filter(e=>e.placement===p);if(m.length>=n.maxCount){const e=m[0];e&&c(e.id)}const f=function(t,n){const o=t.type||"info",s=!1!==t.showIcon,i=t.cloneElement??!0,a=e.createElement("div",{className:`solely-message solely-message--${o}${t.className?` ${t.className}`:""}`,styles:t.style});if(a.setAttribute("role","error"===o||"warning"===o?"alert":"status"),a.setAttribute("aria-live","error"===o||"warning"===o?"assertive":"polite"),s){const e=t.icon?r(t.icon,o):r(l[o],o);a.appendChild(e)}const p=e.createElement("span",{className:"solely-message__content"}),d=e.createElement("span",{className:"solely-message__text"});if("string"==typeof t.content?d.textContent=t.content:t.content instanceof HTMLElement&&d.appendChild(i?t.content.cloneNode(!0):t.content),p.appendChild(d),t.description){const n=e.createElement("span",{className:"solely-message__description"});"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(i?t.description.cloneNode(!0):t.description),p.appendChild(n)}if(a.appendChild(p),t.closable){const t=e.createElement("button",{className:"solely-message__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}});t.onclick=()=>c(n),a.appendChild(t)}return a}(o,s);d.appendChild(f);const g={id:s,element:f,onClose:o.onClose,placement:p},u=o.duration??n.duration;return u>0&&(g.timer=window.setTimeout(()=>{c(s)},u)),i.push(g),{close:()=>c(s),update:t=>{if("string"==typeof t||t instanceof HTMLElement){const e=f.querySelector(".solely-message__text");return void(e&&(e.innerHTML="","string"==typeof t?e.textContent=t:t instanceof HTMLElement&&e.appendChild(t.cloneNode(!0))))}if(void 0!==t.content){const e=f.querySelector(".solely-message__text");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(t.content.cloneNode(!0)))}if(void 0!==t.description){let n=f.querySelector(".solely-message__description");if(!n&&t.description){n=e.createElement("span",{className:"solely-message__description"}),"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0));const o=f.querySelector(".solely-message__content");o?.appendChild(n)}else n&&(t.description?(n.innerHTML="","string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0))):n.remove())}}}}const d={open:p,info:function(e,t){return p({content:e,type:"info",..."number"==typeof t?{duration:t}:t})},success:function(e,t){return p({content:e,type:"success",..."number"==typeof t?{duration:t}:t})},warning:function(e,t){return p({content:e,type:"warning",..."number"==typeof t?{duration:t}:t})},error:function(e,t){return p({content:e,type:"error",..."number"==typeof t?{duration:t}:t})},loading:function(e,t){return p(void 0===t?{content:e,type:"loading",duration:0,closable:!0}:"number"==typeof t?{content:e,type:"loading",duration:t,closable:!0}:{content:e,type:"loading",duration:0,closable:!0,...t})},config:function(e){Object.assign(n,e),a.forEach((t,n)=>{const o=t.element;void 0!==e.top&&["top","topLeft","topRight"].includes(n)&&(o.style.top=`${e.top}px`),void 0!==e.bottom&&["bottom","bottomLeft","bottomRight"].includes(n)&&(o.style.bottom=`${e.bottom}px`),void 0!==e.left&&["topLeft","bottomLeft","left"].includes(n)&&(o.style.left=`${e.left}px`),void 0!==e.right&&["topRight","bottomRight","right"].includes(n)&&(o.style.right=`${e.right}px`),void 0!==e.gap&&(o.style.gap=`${e.gap}px`)})},destroy:async function(){o&&(clearTimeout(o),o=void 0);const e=[...i];await Promise.all(e.map(e=>c(e.id)))}};exports.Message=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={duration:3e3,maxCount:5,gap:8,top:24,bottom:24,left:24,right:24,placement:"top"};let o;const s=new Set,i=[],l={info:"ℹ",success:"✓",warning:"⚠",error:"✕",loading:function(){return e.createElement("span",{className:"solely-message__loading-spinner"})}},a=new Map;async function r(t){if(!s.has(t)){s.add(t);try{const s=i.findIndex(e=>e.id===t);if(-1===s)return;const l=i[s];l.timer&&(clearTimeout(l.timer),l.timer=void 0),await e.addClosingAnimation(l.element,e.ANIMATION_DURATION.NORMAL),l.element.remove();const r=i.findIndex(e=>e.id===t);-1!==r&&i.splice(r,1);try{l.onClose?.()}catch(n){console.error("[Solely Message] onClose callback error:",n)}o&&clearTimeout(o),o=window.setTimeout(()=>{0===i.length&&a.forEach((e,t)=>{0===e.element.childElementCount&&(e.element.remove(),e.cleanupTheme(),a.delete(t))}),o=void 0},300)}finally{s.delete(t)}}}function c(o){const s=e.generateId(),c=o.placement||n.placement,p=function(o=n.placement){const s=o;if(a.has(s))return a.get(s).element;const i=e.createElement("div",{className:"solely-message-container"}),l={position:"fixed",display:"flex",flexDirection:"column",gap:`${n.gap}px`,pointerEvents:"none",zIndex:String(e.Z_INDEX.TOAST)};switch(o){case"top":l.top=`${n.top}px`,l.left="50%",l.transform="translateX(-50%)";break;case"topLeft":l.top=`${n.top}px`,l.left=`${n.left}px`,l.alignItems="flex-start";break;case"topRight":l.top=`${n.top}px`,l.right=`${n.right}px`,l.alignItems="flex-end";break;case"bottom":l.bottom=`${n.bottom}px`,l.left="50%",l.transform="translateX(-50%)";break;case"bottomLeft":l.bottom=`${n.bottom}px`,l.left=`${n.left}px`,l.alignItems="flex-start";break;case"bottomRight":l.bottom=`${n.bottom}px`,l.right=`${n.right}px`,l.alignItems="flex-end";break;case"left":l.top="50%",l.left=`${n.left}px`,l.transform="translateY(-50%)",l.alignItems="flex-start";break;case"right":l.top="50%",l.right=`${n.right}px`,l.transform="translateY(-50%)",l.alignItems="flex-end"}Object.assign(i.style,l),document.body.appendChild(i),e.injectStyle("solely-message-styles",t.default);const r=e.observeTheme(()=>i);return a.set(s,{element:i,cleanupTheme:r}),i}(c),d=i.filter(e=>e.placement===c);if(d.length>=n.maxCount){const e=d[0];e&&r(e.id)}const m=function(t,n){const o=t.type||"info",s=!1!==t.showIcon,i=t.cloneElement??!0,a=e.createElement("div",{className:`solely-message solely-message--${o}${t.className?` ${t.className}`:""}`,styles:t.style});if(a.setAttribute("role","error"===o||"warning"===o?"alert":"status"),a.setAttribute("aria-live","error"===o||"warning"===o?"assertive":"polite"),s){const n=t.icon??l[o],s=function(t,n){const o=e.createElement("span",{className:`solely-message__icon solely-message__icon--${n}`});return"string"==typeof t?o.textContent=t:o.appendChild(t.cloneNode(!0)),o}("function"==typeof n?n():n,o);a.appendChild(s)}const c=e.createElement("span",{className:"solely-message__content"}),p=e.createElement("span",{className:"solely-message__text"});if("string"==typeof t.content?p.textContent=t.content:t.content instanceof HTMLElement&&p.appendChild(i?t.content.cloneNode(!0):t.content),c.appendChild(p),t.description){const n=e.createElement("span",{className:"solely-message__description"});"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(i?t.description.cloneNode(!0):t.description),c.appendChild(n)}if(a.appendChild(c),t.closable){const t=e.createElement("button",{className:"solely-message__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}});t.onclick=()=>r(n),a.appendChild(t)}return a}(o,s);p.appendChild(m);const f={id:s,element:m,onClose:o.onClose,placement:c},u=o.duration??n.duration;return u>0&&(f.timer=window.setTimeout(()=>{r(s)},u)),i.push(f),{close:()=>r(s),update:t=>{if("string"==typeof t||t instanceof HTMLElement){const e=m.querySelector(".solely-message__text");return void(e&&(e.innerHTML="","string"==typeof t?e.textContent=t:t instanceof HTMLElement&&e.appendChild(t.cloneNode(!0))))}if(void 0!==t.content){const e=m.querySelector(".solely-message__text");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(t.content.cloneNode(!0)))}if(void 0!==t.description){let n=m.querySelector(".solely-message__description");if(!n&&t.description){n=e.createElement("span",{className:"solely-message__description"}),"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0));const o=m.querySelector(".solely-message__content");o?.appendChild(n)}else n&&(t.description?(n.innerHTML="","string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0))):n.remove())}}}}const p={open:c,info:function(e,t){return c({content:e,type:"info",..."number"==typeof t?{duration:t}:t})},success:function(e,t){return c({content:e,type:"success",..."number"==typeof t?{duration:t}:t})},warning:function(e,t){return c({content:e,type:"warning",..."number"==typeof t?{duration:t}:t})},error:function(e,t){return c({content:e,type:"error",..."number"==typeof t?{duration:t}:t})},loading:function(e,t){return c(void 0===t?{content:e,type:"loading",duration:0,closable:!0}:"number"==typeof t?{content:e,type:"loading",duration:t,closable:!0}:{content:e,type:"loading",duration:0,closable:!0,...t})},config:function(e){Object.assign(n,e),a.forEach((t,n)=>{const o=t.element;void 0!==e.top&&["top","topLeft","topRight"].includes(n)&&(o.style.top=`${e.top}px`),void 0!==e.bottom&&["bottom","bottomLeft","bottomRight"].includes(n)&&(o.style.bottom=`${e.bottom}px`),void 0!==e.left&&["topLeft","bottomLeft","left"].includes(n)&&(o.style.left=`${e.left}px`),void 0!==e.right&&["topRight","bottomRight","right"].includes(n)&&(o.style.right=`${e.right}px`),void 0!==e.gap&&(o.style.gap=`${e.gap}px`)})},destroy:async function(){o&&(clearTimeout(o),o=void 0);const e=[...i];await Promise.all(e.map(e=>r(e.id)))}};exports.Message=p;
@@ -1 +1 @@
1
- import{createElement as e,addClosingAnimation as t,ANIMATION_DURATION as n,Z_INDEX as o,observeTheme as s,generateId as i,injectStyle as l}from"../utils.js";import a from"./style.css.js";const r={duration:3e3,maxCount:5,gap:8,top:24,bottom:24,left:24,right:24,placement:"top"};let c;const p=new Set,d=[],m={info:"ℹ",success:"✓",warning:"⚠",error:"✕",loading:e("span",{className:"solely-message__loading-spinner"})},f=new Map;function g(t,n){const o=e("span",{className:`solely-message__icon solely-message__icon--${n}`});return"string"==typeof t?o.textContent=t:o.appendChild(t.cloneNode(!0)),o}async function u(e){if(!p.has(e)){p.add(e);try{const s=d.findIndex(t=>t.id===e);if(-1===s)return;const i=d[s];i.timer&&(clearTimeout(i.timer),i.timer=void 0),await t(i.element,n.NORMAL),i.element.remove();const l=d.findIndex(t=>t.id===e);-1!==l&&d.splice(l,1);try{i.onClose?.()}catch(o){console.error("[Solely Message] onClose callback error:",o)}c&&clearTimeout(c),c=window.setTimeout(()=>{0===d.length&&f.forEach((e,t)=>{0===e.element.childElementCount&&(e.element.remove(),e.cleanupTheme(),f.delete(t))}),c=void 0},300)}finally{p.delete(e)}}}function y(t){const n=i(),c=t.placement||r.placement,p=function(t=r.placement){const n=t;if(f.has(n))return f.get(n).element;const i=e("div",{className:"solely-message-container"}),c={position:"fixed",display:"flex",flexDirection:"column",gap:`${r.gap}px`,pointerEvents:"none",zIndex:String(o.TOAST)};switch(t){case"top":c.top=`${r.top}px`,c.left="50%",c.transform="translateX(-50%)";break;case"topLeft":c.top=`${r.top}px`,c.left=`${r.left}px`,c.alignItems="flex-start";break;case"topRight":c.top=`${r.top}px`,c.right=`${r.right}px`,c.alignItems="flex-end";break;case"bottom":c.bottom=`${r.bottom}px`,c.left="50%",c.transform="translateX(-50%)";break;case"bottomLeft":c.bottom=`${r.bottom}px`,c.left=`${r.left}px`,c.alignItems="flex-start";break;case"bottomRight":c.bottom=`${r.bottom}px`,c.right=`${r.right}px`,c.alignItems="flex-end";break;case"left":c.top="50%",c.left=`${r.left}px`,c.transform="translateY(-50%)",c.alignItems="flex-start";break;case"right":c.top="50%",c.right=`${r.right}px`,c.transform="translateY(-50%)",c.alignItems="flex-end"}Object.assign(i.style,c),document.body.appendChild(i),l("solely-message-styles",a);const p=s(()=>i);return f.set(n,{element:i,cleanupTheme:p}),i}(c),y=d.filter(e=>e.placement===c);if(y.length>=r.maxCount){const e=y[0];e&&u(e.id)}const h=function(t,n){const o=t.type||"info",s=!1!==t.showIcon,i=t.cloneElement??!0,l=e("div",{className:`solely-message solely-message--${o}${t.className?` ${t.className}`:""}`,styles:t.style});if(l.setAttribute("role","error"===o||"warning"===o?"alert":"status"),l.setAttribute("aria-live","error"===o||"warning"===o?"assertive":"polite"),s){const e=t.icon?g(t.icon,o):g(m[o],o);l.appendChild(e)}const a=e("span",{className:"solely-message__content"}),r=e("span",{className:"solely-message__text"});if("string"==typeof t.content?r.textContent=t.content:t.content instanceof HTMLElement&&r.appendChild(i?t.content.cloneNode(!0):t.content),a.appendChild(r),t.description){const n=e("span",{className:"solely-message__description"});"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(i?t.description.cloneNode(!0):t.description),a.appendChild(n)}if(l.appendChild(a),t.closable){const t=e("button",{className:"solely-message__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}});t.onclick=()=>u(n),l.appendChild(t)}return l}(t,n);p.appendChild(h);const x={id:n,element:h,onClose:t.onClose,placement:c},b=t.duration??r.duration;return b>0&&(x.timer=window.setTimeout(()=>{u(n)},b)),d.push(x),{close:()=>u(n),update:t=>{if("string"==typeof t||t instanceof HTMLElement){const e=h.querySelector(".solely-message__text");return void(e&&(e.innerHTML="","string"==typeof t?e.textContent=t:t instanceof HTMLElement&&e.appendChild(t.cloneNode(!0))))}if(void 0!==t.content){const e=h.querySelector(".solely-message__text");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(t.content.cloneNode(!0)))}if(void 0!==t.description){let n=h.querySelector(".solely-message__description");if(!n&&t.description){n=e("span",{className:"solely-message__description"}),"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0));const o=h.querySelector(".solely-message__content");o?.appendChild(n)}else n&&(t.description?(n.innerHTML="","string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0))):n.remove())}}}}const h={open:y,info:function(e,t){return y({content:e,type:"info",..."number"==typeof t?{duration:t}:t})},success:function(e,t){return y({content:e,type:"success",..."number"==typeof t?{duration:t}:t})},warning:function(e,t){return y({content:e,type:"warning",..."number"==typeof t?{duration:t}:t})},error:function(e,t){return y({content:e,type:"error",..."number"==typeof t?{duration:t}:t})},loading:function(e,t){return y(void 0===t?{content:e,type:"loading",duration:0,closable:!0}:"number"==typeof t?{content:e,type:"loading",duration:t,closable:!0}:{content:e,type:"loading",duration:0,closable:!0,...t})},config:function(e){Object.assign(r,e),f.forEach((t,n)=>{const o=t.element;void 0!==e.top&&["top","topLeft","topRight"].includes(n)&&(o.style.top=`${e.top}px`),void 0!==e.bottom&&["bottom","bottomLeft","bottomRight"].includes(n)&&(o.style.bottom=`${e.bottom}px`),void 0!==e.left&&["topLeft","bottomLeft","left"].includes(n)&&(o.style.left=`${e.left}px`),void 0!==e.right&&["topRight","bottomRight","right"].includes(n)&&(o.style.right=`${e.right}px`),void 0!==e.gap&&(o.style.gap=`${e.gap}px`)})},destroy:async function(){c&&(clearTimeout(c),c=void 0);const e=[...d];await Promise.all(e.map(e=>u(e.id)))}};export{h as Message};
1
+ import{createElement as e,addClosingAnimation as t,ANIMATION_DURATION as n,Z_INDEX as o,observeTheme as s,generateId as i,injectStyle as l}from"../utils.js";import a from"./style.css.js";const r={duration:3e3,maxCount:5,gap:8,top:24,bottom:24,left:24,right:24,placement:"top"};let c;const p=new Set,d=[],m={info:"ℹ",success:"✓",warning:"⚠",error:"✕",loading:function(){return e("span",{className:"solely-message__loading-spinner"})}},f=new Map;async function g(e){if(!p.has(e)){p.add(e);try{const s=d.findIndex(t=>t.id===e);if(-1===s)return;const i=d[s];i.timer&&(clearTimeout(i.timer),i.timer=void 0),await t(i.element,n.NORMAL),i.element.remove();const l=d.findIndex(t=>t.id===e);-1!==l&&d.splice(l,1);try{i.onClose?.()}catch(o){console.error("[Solely Message] onClose callback error:",o)}c&&clearTimeout(c),c=window.setTimeout(()=>{0===d.length&&f.forEach((e,t)=>{0===e.element.childElementCount&&(e.element.remove(),e.cleanupTheme(),f.delete(t))}),c=void 0},300)}finally{p.delete(e)}}}function u(t){const n=i(),c=t.placement||r.placement,p=function(t=r.placement){const n=t;if(f.has(n))return f.get(n).element;const i=e("div",{className:"solely-message-container"}),c={position:"fixed",display:"flex",flexDirection:"column",gap:`${r.gap}px`,pointerEvents:"none",zIndex:String(o.TOAST)};switch(t){case"top":c.top=`${r.top}px`,c.left="50%",c.transform="translateX(-50%)";break;case"topLeft":c.top=`${r.top}px`,c.left=`${r.left}px`,c.alignItems="flex-start";break;case"topRight":c.top=`${r.top}px`,c.right=`${r.right}px`,c.alignItems="flex-end";break;case"bottom":c.bottom=`${r.bottom}px`,c.left="50%",c.transform="translateX(-50%)";break;case"bottomLeft":c.bottom=`${r.bottom}px`,c.left=`${r.left}px`,c.alignItems="flex-start";break;case"bottomRight":c.bottom=`${r.bottom}px`,c.right=`${r.right}px`,c.alignItems="flex-end";break;case"left":c.top="50%",c.left=`${r.left}px`,c.transform="translateY(-50%)",c.alignItems="flex-start";break;case"right":c.top="50%",c.right=`${r.right}px`,c.transform="translateY(-50%)",c.alignItems="flex-end"}Object.assign(i.style,c),document.body.appendChild(i),l("solely-message-styles",a);const p=s(()=>i);return f.set(n,{element:i,cleanupTheme:p}),i}(c),u=d.filter(e=>e.placement===c);if(u.length>=r.maxCount){const e=u[0];e&&g(e.id)}const y=function(t,n){const o=t.type||"info",s=!1!==t.showIcon,i=t.cloneElement??!0,l=e("div",{className:`solely-message solely-message--${o}${t.className?` ${t.className}`:""}`,styles:t.style});if(l.setAttribute("role","error"===o||"warning"===o?"alert":"status"),l.setAttribute("aria-live","error"===o||"warning"===o?"assertive":"polite"),s){const n=t.icon??m[o],s=function(t,n){const o=e("span",{className:`solely-message__icon solely-message__icon--${n}`});return"string"==typeof t?o.textContent=t:o.appendChild(t.cloneNode(!0)),o}("function"==typeof n?n():n,o);l.appendChild(s)}const a=e("span",{className:"solely-message__content"}),r=e("span",{className:"solely-message__text"});if("string"==typeof t.content?r.textContent=t.content:t.content instanceof HTMLElement&&r.appendChild(i?t.content.cloneNode(!0):t.content),a.appendChild(r),t.description){const n=e("span",{className:"solely-message__description"});"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(i?t.description.cloneNode(!0):t.description),a.appendChild(n)}if(l.appendChild(a),t.closable){const t=e("button",{className:"solely-message__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}});t.onclick=()=>g(n),l.appendChild(t)}return l}(t,n);p.appendChild(y);const h={id:n,element:y,onClose:t.onClose,placement:c},x=t.duration??r.duration;return x>0&&(h.timer=window.setTimeout(()=>{g(n)},x)),d.push(h),{close:()=>g(n),update:t=>{if("string"==typeof t||t instanceof HTMLElement){const e=y.querySelector(".solely-message__text");return void(e&&(e.innerHTML="","string"==typeof t?e.textContent=t:t instanceof HTMLElement&&e.appendChild(t.cloneNode(!0))))}if(void 0!==t.content){const e=y.querySelector(".solely-message__text");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(t.content.cloneNode(!0)))}if(void 0!==t.description){let n=y.querySelector(".solely-message__description");if(!n&&t.description){n=e("span",{className:"solely-message__description"}),"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0));const o=y.querySelector(".solely-message__content");o?.appendChild(n)}else n&&(t.description?(n.innerHTML="","string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0))):n.remove())}}}}const y={open:u,info:function(e,t){return u({content:e,type:"info",..."number"==typeof t?{duration:t}:t})},success:function(e,t){return u({content:e,type:"success",..."number"==typeof t?{duration:t}:t})},warning:function(e,t){return u({content:e,type:"warning",..."number"==typeof t?{duration:t}:t})},error:function(e,t){return u({content:e,type:"error",..."number"==typeof t?{duration:t}:t})},loading:function(e,t){return u(void 0===t?{content:e,type:"loading",duration:0,closable:!0}:"number"==typeof t?{content:e,type:"loading",duration:t,closable:!0}:{content:e,type:"loading",duration:0,closable:!0,...t})},config:function(e){Object.assign(r,e),f.forEach((t,n)=>{const o=t.element;void 0!==e.top&&["top","topLeft","topRight"].includes(n)&&(o.style.top=`${e.top}px`),void 0!==e.bottom&&["bottom","bottomLeft","bottomRight"].includes(n)&&(o.style.bottom=`${e.bottom}px`),void 0!==e.left&&["topLeft","bottomLeft","left"].includes(n)&&(o.style.left=`${e.left}px`),void 0!==e.right&&["topRight","bottomRight","right"].includes(n)&&(o.style.right=`${e.right}px`),void 0!==e.gap&&(o.style.gap=`${e.gap}px`)})},destroy:async function(){c&&(clearTimeout(c),c=void 0);const e=[...d];await Promise.all(e.map(e=>g(e.id)))}};export{y as Message};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:s}=this;return this.getAlertClasses()},function(t){const{$data:s}=this;return s.showIcon},function(t){const{$data:s}=this;return`${this.getIcon(s.type)}`},function(t){const{$data:s}=this;return s.message},function(t){const{$data:s}=this;return`${s.message}`},function(t){const{$data:s}=this;return s.description},function(t){const{$data:s}=this;return`${s.description}`},function(t){const{$data:s}=this;return s.closable},function(t,s){const{$data:a}=this,{value:c,checked:n}=t?.target||{};this.handleClose()}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"alert",d:0},{k:":class",f:1,d:1}],c:[{t:7,d:1,b:[{f:2,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"alert__icon",d:0}],c:[{t:0,d:0,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[{t:1,d:1,f:3}]}]}]}]},{t:0,d:0,g:"div",a:[{k:"part",v:"content",d:0},{k:"class",v:"alert__content",d:0}],c:[{t:7,d:1,b:[{f:4,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"message",d:0},{k:"class",v:"alert__message",d:0}],c:[{t:1,d:1,f:5}]}]}]},{t:7,d:1,b:[{f:6,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"description",d:0},{k:"class",v:"alert__description",d:0}],c:[{t:1,d:1,f:7}]}]}]},{t:0,d:0,s:1,g:"slot",a:[],c:[]}]},{t:7,d:1,b:[{f:8,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"close",d:0},{k:"class",v:"alert__close",d:0},{k:"@click",f:9,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"close-icon",d:0}],c:[{t:1,d:0,s:1,x:"×"}]}]}]}]}]}],s:{tf:9,cf:9,dn:1,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:s}=this;return this.getAlertClasses()},function(t){const{$data:s}=this;return s.showIcon},function(t){const{$data:s}=this;return`${this.getIcon(s.type)}`},function(t){const{$data:s}=this;return s.message},function(t){const{$data:s}=this;return`${s.message}`},function(t){const{$data:s}=this;return s.description},function(t){const{$data:s}=this;return`${s.description}`},function(t){const{$data:s}=this;return s.closable},function(t,s){const{$data:a}=this,{value:c,checked:n}=t?.target||{};this.handleClose()}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"alert",d:0},{k:":class",f:1,d:1}],c:[{t:7,d:1,b:[{f:2,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"alert__icon",d:0}],c:[{t:0,d:0,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[{t:1,d:1,f:3}]}]}]}]},{t:0,d:0,g:"div",a:[{k:"part",v:"content",d:0},{k:"class",v:"alert__content",d:0}],c:[{t:7,d:1,b:[{f:4,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"message",d:0},{k:"class",v:"alert__message",d:0}],c:[{t:1,d:1,f:5}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:6,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"description",d:0},{k:"class",v:"alert__description",d:0}],c:[{t:1,d:1,f:7}]}]}]},{t:1,d:0,s:1,x:" "},{t:0,d:0,s:1,g:"slot",a:[],c:[]}]},{t:7,d:1,b:[{f:8,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"close",d:0},{k:"class",v:"alert__close",d:0},{k:"@click",f:9,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"close-icon",d:0}],c:[{t:1,d:0,s:1,x:"×"}]}]}]}]}]}],s:{tf:9,cf:9,dn:1,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
@@ -1 +1 @@
1
- const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:s}=this;return this.getAlertClasses()},function(t){const{$data:s}=this;return s.showIcon},function(t){const{$data:s}=this;return`${this.getIcon(s.type)}`},function(t){const{$data:s}=this;return s.message},function(t){const{$data:s}=this;return`${s.message}`},function(t){const{$data:s}=this;return s.description},function(t){const{$data:s}=this;return`${s.description}`},function(t){const{$data:s}=this;return s.closable},function(t,s){const{$data:a}=this,{value:c,checked:n}=t?.target||{};this.handleClose()}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"alert",d:0},{k:":class",f:1,d:1}],c:[{t:7,d:1,b:[{f:2,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"alert__icon",d:0}],c:[{t:0,d:0,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[{t:1,d:1,f:3}]}]}]}]},{t:0,d:0,g:"div",a:[{k:"part",v:"content",d:0},{k:"class",v:"alert__content",d:0}],c:[{t:7,d:1,b:[{f:4,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"message",d:0},{k:"class",v:"alert__message",d:0}],c:[{t:1,d:1,f:5}]}]}]},{t:7,d:1,b:[{f:6,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"description",d:0},{k:"class",v:"alert__description",d:0}],c:[{t:1,d:1,f:7}]}]}]},{t:0,d:0,s:1,g:"slot",a:[],c:[]}]},{t:7,d:1,b:[{f:8,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"close",d:0},{k:"class",v:"alert__close",d:0},{k:"@click",f:9,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"close-icon",d:0}],c:[{t:1,d:0,s:1,x:"×"}]}]}]}]}]}],s:{tf:9,cf:9,dn:1,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};
1
+ const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:s}=this;return this.getAlertClasses()},function(t){const{$data:s}=this;return s.showIcon},function(t){const{$data:s}=this;return`${this.getIcon(s.type)}`},function(t){const{$data:s}=this;return s.message},function(t){const{$data:s}=this;return`${s.message}`},function(t){const{$data:s}=this;return s.description},function(t){const{$data:s}=this;return`${s.description}`},function(t){const{$data:s}=this;return s.closable},function(t,s){const{$data:a}=this,{value:c,checked:n}=t?.target||{};this.handleClose()}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"alert",d:0},{k:":class",f:1,d:1}],c:[{t:7,d:1,b:[{f:2,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"alert__icon",d:0}],c:[{t:0,d:0,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[{t:1,d:1,f:3}]}]}]}]},{t:0,d:0,g:"div",a:[{k:"part",v:"content",d:0},{k:"class",v:"alert__content",d:0}],c:[{t:7,d:1,b:[{f:4,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"message",d:0},{k:"class",v:"alert__message",d:0}],c:[{t:1,d:1,f:5}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:6,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"description",d:0},{k:"class",v:"alert__description",d:0}],c:[{t:1,d:1,f:7}]}]}]},{t:1,d:0,s:1,x:" "},{t:0,d:0,s:1,g:"slot",a:[],c:[]}]},{t:7,d:1,b:[{f:8,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"close",d:0},{k:"class",v:"alert__close",d:0},{k:"@click",f:9,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"close-icon",d:0}],c:[{t:1,d:0,s:1,x:"×"}]}]}]}]}]}],s:{tf:9,cf:9,dn:1,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:s}=this;return this.getBadgeClasses()},function(t){const{$data:s}=this;return s.count>0&&!s.dot&&!s.status},function(t){const{$data:s}=this;return s.color?{backgroundColor:s.color}:{}},function(t){const{$data:s}=this;return`${s.count>s.overflowCount?s.overflowCount+"+":s.count}`},function(t){const{$data:s}=this;return s.dot&&!s.status},function(t){const{$data:s}=this;return s.status},function(t){const{$data:s}=this;return this.getStatusDotClasses()},function(t){const{$data:s}=this;return s.text},function(t){const{$data:s}=this;return`${s.text}`}],n:[{t:0,d:1,g:"span",a:[{k:"part",v:"base",d:0},{k:"class",v:"badge",d:0},{k:":class",f:1,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[],c:[]},{t:2,d:0,x:" 数字徽标 "},{t:7,d:1,b:[{f:2,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"count",d:0},{k:"class",v:"badge__count",d:0},{k:":style",f:3,d:1}],c:[{t:1,d:1,f:4}]}]}]},{t:2,d:0,x:" 小红点 "},{t:7,d:1,b:[{f:5,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"dot",d:0},{k:"class",v:"badge__dot",d:0},{k:":style",f:3,d:1}],c:[]}]}]},{t:2,d:0,x:" 状态点 "},{t:7,d:1,b:[{f:6,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"status",d:0},{k:"class",v:"badge__status",d:0}],c:[{t:0,d:1,g:"span",a:[{k:"part",v:"status-dot",d:0},{k:"class",v:"badge__status-dot",d:0},{k:":class",f:7,d:1}],c:[]},{t:7,d:1,b:[{f:8,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"status-text",d:0},{k:"class",v:"badge__status-text",d:0}],c:[{t:1,d:1,f:9}]}]}]}]}]}]}]}],s:{tf:9,cf:9,dn:1,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:s}=this;return this.getBadgeClasses()},function(t){const{$data:s}=this;return s.count>0&&!s.dot&&!s.status},function(t){const{$data:s}=this;return s.color?{backgroundColor:s.color}:{}},function(t){const{$data:s}=this;return`${s.count>s.overflowCount?s.overflowCount+"+":s.count}`},function(t){const{$data:s}=this;return s.dot&&!s.status},function(t){const{$data:s}=this;return s.status},function(t){const{$data:s}=this;return this.getStatusDotClasses()},function(t){const{$data:s}=this;return s.text},function(t){const{$data:s}=this;return`${s.text}`}],n:[{t:0,d:1,g:"span",a:[{k:"part",v:"base",d:0},{k:"class",v:"badge",d:0},{k:":class",f:1,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[],c:[]},{t:1,d:0,s:1,x:" "},{t:2,d:0,x:" 数字徽标 "},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:2,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"count",d:0},{k:"class",v:"badge__count",d:0},{k:":style",f:3,d:1}],c:[{t:1,d:1,f:4}]}]}]},{t:1,d:0,s:1,x:" "},{t:2,d:0,x:" 小红点 "},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:5,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"dot",d:0},{k:"class",v:"badge__dot",d:0},{k:":style",f:3,d:1}],c:[]}]}]},{t:1,d:0,s:1,x:" "},{t:2,d:0,x:" 状态点 "},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:6,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"status",d:0},{k:"class",v:"badge__status",d:0}],c:[{t:0,d:1,g:"span",a:[{k:"part",v:"status-dot",d:0},{k:"class",v:"badge__status-dot",d:0},{k:":class",f:7,d:1}],c:[]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:8,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"status-text",d:0},{k:"class",v:"badge__status-text",d:0}],c:[{t:1,d:1,f:9}]}]}]}]}]}]}]}],s:{tf:9,cf:9,dn:1,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
@@ -1 +1 @@
1
- const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:s}=this;return this.getBadgeClasses()},function(t){const{$data:s}=this;return s.count>0&&!s.dot&&!s.status},function(t){const{$data:s}=this;return s.color?{backgroundColor:s.color}:{}},function(t){const{$data:s}=this;return`${s.count>s.overflowCount?s.overflowCount+"+":s.count}`},function(t){const{$data:s}=this;return s.dot&&!s.status},function(t){const{$data:s}=this;return s.status},function(t){const{$data:s}=this;return this.getStatusDotClasses()},function(t){const{$data:s}=this;return s.text},function(t){const{$data:s}=this;return`${s.text}`}],n:[{t:0,d:1,g:"span",a:[{k:"part",v:"base",d:0},{k:"class",v:"badge",d:0},{k:":class",f:1,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[],c:[]},{t:2,d:0,x:" 数字徽标 "},{t:7,d:1,b:[{f:2,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"count",d:0},{k:"class",v:"badge__count",d:0},{k:":style",f:3,d:1}],c:[{t:1,d:1,f:4}]}]}]},{t:2,d:0,x:" 小红点 "},{t:7,d:1,b:[{f:5,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"dot",d:0},{k:"class",v:"badge__dot",d:0},{k:":style",f:3,d:1}],c:[]}]}]},{t:2,d:0,x:" 状态点 "},{t:7,d:1,b:[{f:6,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"status",d:0},{k:"class",v:"badge__status",d:0}],c:[{t:0,d:1,g:"span",a:[{k:"part",v:"status-dot",d:0},{k:"class",v:"badge__status-dot",d:0},{k:":class",f:7,d:1}],c:[]},{t:7,d:1,b:[{f:8,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"status-text",d:0},{k:"class",v:"badge__status-text",d:0}],c:[{t:1,d:1,f:9}]}]}]}]}]}]}]}],s:{tf:9,cf:9,dn:1,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};
1
+ const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:s}=this;return this.getBadgeClasses()},function(t){const{$data:s}=this;return s.count>0&&!s.dot&&!s.status},function(t){const{$data:s}=this;return s.color?{backgroundColor:s.color}:{}},function(t){const{$data:s}=this;return`${s.count>s.overflowCount?s.overflowCount+"+":s.count}`},function(t){const{$data:s}=this;return s.dot&&!s.status},function(t){const{$data:s}=this;return s.status},function(t){const{$data:s}=this;return this.getStatusDotClasses()},function(t){const{$data:s}=this;return s.text},function(t){const{$data:s}=this;return`${s.text}`}],n:[{t:0,d:1,g:"span",a:[{k:"part",v:"base",d:0},{k:"class",v:"badge",d:0},{k:":class",f:1,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[],c:[]},{t:1,d:0,s:1,x:" "},{t:2,d:0,x:" 数字徽标 "},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:2,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"count",d:0},{k:"class",v:"badge__count",d:0},{k:":style",f:3,d:1}],c:[{t:1,d:1,f:4}]}]}]},{t:1,d:0,s:1,x:" "},{t:2,d:0,x:" 小红点 "},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:5,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"dot",d:0},{k:"class",v:"badge__dot",d:0},{k:":style",f:3,d:1}],c:[]}]}]},{t:1,d:0,s:1,x:" "},{t:2,d:0,x:" 状态点 "},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:6,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"status",d:0},{k:"class",v:"badge__status",d:0}],c:[{t:0,d:1,g:"span",a:[{k:"part",v:"status-dot",d:0},{k:"class",v:"badge__status-dot",d:0},{k:":class",f:7,d:1}],c:[]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:8,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"status-text",d:0},{k:"class",v:"badge__status-text",d:0}],c:[{t:1,d:1,f:9}]}]}]}]}]}]}]}],s:{tf:9,cf:9,dn:1,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return a.items},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return r.href&&d<a.items.length-1},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return r.href},function(t,a){const{$data:r}=this,{value:d,checked:n}=t?.target||{};var[e]=a.map(t=>t.itmVal),[i]=a.map(t=>t.idxVal);this.handleClick(e,t)},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return`${r.title}`},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return!r.href&&d<a.items.length-1},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return d===a.items.length-1},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return d<a.items.length-1},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return`${a.separator}`}],n:[{t:0,d:0,g:"nav",a:[{k:"part",v:"base",d:0},{k:"class",v:"breadcrumb",d:0}],c:[{t:6,d:1,f:1,i:"item",n:"index",a:[],c:[{t:0,d:0,g:"span",a:[{k:"part",v:"item",d:0},{k:"class",v:"breadcrumb__item",d:0}],c:[{t:7,d:1,b:[{f:2,c:[{t:0,d:1,g:"a",a:[{k:"part",v:"link",d:0},{k:"class",v:"breadcrumb__link",d:0},{k:":href",f:3,d:1},{k:"@click",f:4,d:1}],c:[{t:1,d:1,f:5}]}]}]},{t:7,d:1,b:[{f:6,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"link",d:0},{k:"class",v:"breadcrumb__link",d:0},{k:"@click",f:4,d:1}],c:[{t:1,d:1,f:5}]}]}]},{t:7,d:1,b:[{f:7,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"current",d:0},{k:"class",v:"breadcrumb__current",d:0}],c:[{t:1,d:1,f:5}]}]}]},{t:7,d:1,b:[{f:8,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"separator",d:0},{k:"class",v:"breadcrumb__separator",d:0}],c:[{t:1,d:1,f:9}]}]}]}]}]}]}],s:{tf:9,cf:9,dn:0,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return a.items},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return r.href&&d<a.items.length-1},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return r.href},function(t,a){const{$data:r}=this,{value:d,checked:n}=t?.target||{};var[e]=a.map(t=>t.itmVal),[s]=a.map(t=>t.idxVal);this.handleClick(e,t)},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return`${r.title}`},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return!r.href&&d<a.items.length-1},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return d===a.items.length-1},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return d<a.items.length-1},function(t){const{$data:a}=this;var[r]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return`${a.separator}`}],n:[{t:0,d:0,g:"nav",a:[{k:"part",v:"base",d:0},{k:"class",v:"breadcrumb",d:0}],c:[{t:6,d:1,f:1,i:"item",n:"index",a:[],c:[{t:0,d:0,g:"span",a:[{k:"part",v:"item",d:0},{k:"class",v:"breadcrumb__item",d:0}],c:[{t:7,d:1,b:[{f:2,c:[{t:0,d:1,g:"a",a:[{k:"part",v:"link",d:0},{k:"class",v:"breadcrumb__link",d:0},{k:":href",f:3,d:1},{k:"@click",f:4,d:1}],c:[{t:1,d:1,f:5}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:6,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"link",d:0},{k:"class",v:"breadcrumb__link",d:0},{k:"@click",f:4,d:1}],c:[{t:1,d:1,f:5}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:7,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"current",d:0},{k:"class",v:"breadcrumb__current",d:0}],c:[{t:1,d:1,f:5}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:8,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"separator",d:0},{k:"class",v:"breadcrumb__separator",d:0}],c:[{t:1,d:1,f:9}]}]}]}]}]}]}],s:{tf:9,cf:9,dn:0,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
@@ -1 +1 @@
1
- const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return a.items},function(t){const{$data:a}=this;var[n]=t.map(t=>t.itmVal),[r]=t.map(t=>t.idxVal);return n.href&&r<a.items.length-1},function(t){const{$data:a}=this;var[n]=t.map(t=>t.itmVal),[r]=t.map(t=>t.idxVal);return n.href},function(t,a){const{$data:n}=this,{value:r,checked:d}=t?.target||{};var[i]=a.map(t=>t.itmVal),[c]=a.map(t=>t.idxVal);this.handleClick(i,t)},function(t){const{$data:a}=this;var[n]=t.map(t=>t.itmVal),[r]=t.map(t=>t.idxVal);return`${n.title}`},function(t){const{$data:a}=this;var[n]=t.map(t=>t.itmVal),[r]=t.map(t=>t.idxVal);return!n.href&&r<a.items.length-1},function(t){const{$data:a}=this;var[n]=t.map(t=>t.itmVal),[r]=t.map(t=>t.idxVal);return r===a.items.length-1},function(t){const{$data:a}=this;var[n]=t.map(t=>t.itmVal),[r]=t.map(t=>t.idxVal);return r<a.items.length-1},function(t){const{$data:a}=this;var[n]=t.map(t=>t.itmVal),[r]=t.map(t=>t.idxVal);return`${a.separator}`}],n:[{t:0,d:0,g:"nav",a:[{k:"part",v:"base",d:0},{k:"class",v:"breadcrumb",d:0}],c:[{t:6,d:1,f:1,i:"item",n:"index",a:[],c:[{t:0,d:0,g:"span",a:[{k:"part",v:"item",d:0},{k:"class",v:"breadcrumb__item",d:0}],c:[{t:7,d:1,b:[{f:2,c:[{t:0,d:1,g:"a",a:[{k:"part",v:"link",d:0},{k:"class",v:"breadcrumb__link",d:0},{k:":href",f:3,d:1},{k:"@click",f:4,d:1}],c:[{t:1,d:1,f:5}]}]}]},{t:7,d:1,b:[{f:6,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"link",d:0},{k:"class",v:"breadcrumb__link",d:0},{k:"@click",f:4,d:1}],c:[{t:1,d:1,f:5}]}]}]},{t:7,d:1,b:[{f:7,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"current",d:0},{k:"class",v:"breadcrumb__current",d:0}],c:[{t:1,d:1,f:5}]}]}]},{t:7,d:1,b:[{f:8,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"separator",d:0},{k:"class",v:"breadcrumb__separator",d:0}],c:[{t:1,d:1,f:9}]}]}]}]}]}]}],s:{tf:9,cf:9,dn:0,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};
1
+ const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return a.items},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[n]=t.map(t=>t.idxVal);return d.href&&n<a.items.length-1},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[n]=t.map(t=>t.idxVal);return d.href},function(t,a){const{$data:d}=this,{value:n,checked:r}=t?.target||{};var[i]=a.map(t=>t.itmVal),[c]=a.map(t=>t.idxVal);this.handleClick(i,t)},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[n]=t.map(t=>t.idxVal);return`${d.title}`},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[n]=t.map(t=>t.idxVal);return!d.href&&n<a.items.length-1},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[n]=t.map(t=>t.idxVal);return n===a.items.length-1},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[n]=t.map(t=>t.idxVal);return n<a.items.length-1},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[n]=t.map(t=>t.idxVal);return`${a.separator}`}],n:[{t:0,d:0,g:"nav",a:[{k:"part",v:"base",d:0},{k:"class",v:"breadcrumb",d:0}],c:[{t:6,d:1,f:1,i:"item",n:"index",a:[],c:[{t:0,d:0,g:"span",a:[{k:"part",v:"item",d:0},{k:"class",v:"breadcrumb__item",d:0}],c:[{t:7,d:1,b:[{f:2,c:[{t:0,d:1,g:"a",a:[{k:"part",v:"link",d:0},{k:"class",v:"breadcrumb__link",d:0},{k:":href",f:3,d:1},{k:"@click",f:4,d:1}],c:[{t:1,d:1,f:5}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:6,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"link",d:0},{k:"class",v:"breadcrumb__link",d:0},{k:"@click",f:4,d:1}],c:[{t:1,d:1,f:5}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:7,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"current",d:0},{k:"class",v:"breadcrumb__current",d:0}],c:[{t:1,d:1,f:5}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:8,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"separator",d:0},{k:"class",v:"breadcrumb__separator",d:0}],c:[{t:1,d:1,f:9}]}]}]}]}]}]}],s:{tf:9,cf:9,dn:0,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:n}=this;return"a"===this.getTagName()},function(t){const{$data:n}=this;return this.getButtonClasses()},function(t){const{$data:n}=this;return n.href},function(t){const{$data:n}=this;return n.target},function(t){const{$data:n}=this;return n.disabled||n.loading?"true":"false"},function(t,n){const{$data:a}=this,{value:c,checked:d}=t?.target||{};this.handleClick(t)},function(t){const{$data:n}=this;return n.loading},function(t){const{$data:n}=this;return this.hasLoadingIconSlot()},function(t){const{$data:n}=this;return n.loadingIcon},function(t){const{$data:n}=this;return`${n.loadingIcon}`},function(t){const{$data:n}=this;return this.hasIconSlot()},function(t){const{$data:n}=this;return n.icon},function(t){const{$data:n}=this;return`${n.icon}`},function(t){const{$data:n}=this;return!n.iconOnly&&(n.content||this.hasDefaultSlotContent())},function(t){const{$data:n}=this;return`${n.content}`},function(t){const{$data:n}=this;return!n.loading&&!n.iconOnly&&this.hasIconRightSlot()},function(t){const{$data:n}=this;return!n.loading&&!n.iconOnly&&n.iconRight},function(t){const{$data:n}=this;return`${n.iconRight}`},function(t){const{$data:n}=this;return"button"===this.getTagName()},function(t){const{$data:n}=this;return n.disabled||n.loading}],n:[{t:7,d:1,b:[{f:1,c:[{t:0,d:1,g:"a",a:[{k:"ref",v:"buttonRef",d:0},{k:"part",v:"base",d:0},{k:"class",v:"btn",d:0},{k:":class",f:2,d:1},{k:":href",f:3,d:1},{k:":target",f:4,d:1},{k:":aria-disabled",f:5,d:1},{k:"@click",f:6,d:1}],c:[{t:7,d:1,b:[{f:7,c:[{t:2,d:0,x:" 加载状态:显示加载图标 "},{t:0,d:0,g:"span",a:[{k:"part",v:"loading-icon",d:0},{k:"class",v:"btn__icon loading-spinner btn__loading-icon",d:0}],c:[{t:7,d:1,b:[{f:8,c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"loading-icon",d:0}],c:[]}]},{f:9,c:[{t:1,d:1,f:10}]}]}]}]},{f:11,c:[{t:2,d:0,x:" 非加载状态,有图标插槽:显示图标插槽内容 "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[]}]}]},{f:12,c:[{t:2,d:0,x:" 非加载状态,有图标属性:显示图标 "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:1,d:1,f:13}]}]}]},{t:7,d:1,b:[{f:14,c:[{t:2,d:0,x:" 按钮内容(非 icon-only 模式显示) "},{t:0,d:0,g:"span",a:[{k:"part",v:"content",d:0},{k:"class",v:"btn__content",d:0}],c:[{t:0,d:0,g:"slot",a:[],c:[{t:1,d:1,f:15}]}]}]}]},{t:7,d:1,b:[{f:16,c:[{t:2,d:0,x:" 右侧图标插槽(非加载状态且非 icon-only 模式显示) "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon-right",d:0}],c:[]}]}]},{f:17,c:[{t:2,d:0,x:" 右侧图标属性(非加载状态且非 icon-only 模式显示) "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:1,d:1,f:18}]}]}]}]}]},{f:19,c:[{t:0,d:1,g:"button",a:[{k:"ref",v:"buttonRef",d:0},{k:"part",v:"base",d:0},{k:"type",v:"button",d:0},{k:"class",v:"btn",d:0},{k:":class",f:2,d:1},{k:":disabled",f:20,d:1},{k:":aria-disabled",f:5,d:1},{k:"@click",f:6,d:1}],c:[{t:7,d:1,b:[{f:7,c:[{t:2,d:0,x:" 加载状态:显示加载图标 "},{t:0,d:0,g:"span",a:[{k:"part",v:"loading-icon",d:0},{k:"class",v:"btn__icon loading-spinner btn__loading-icon",d:0}],c:[{t:7,d:1,b:[{f:8,c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"loading-icon",d:0}],c:[]}]},{f:9,c:[{t:1,d:1,f:10}]}]}]}]},{f:11,c:[{t:2,d:0,x:" 非加载状态,有图标插槽:显示图标插槽内容 "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[]}]}]},{f:12,c:[{t:2,d:0,x:" 非加载状态,有图标属性:显示图标 "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:1,d:1,f:13}]}]}]},{t:7,d:1,b:[{f:14,c:[{t:2,d:0,x:" 按钮内容(非 icon-only 模式显示) "},{t:0,d:0,g:"span",a:[{k:"part",v:"content",d:0},{k:"class",v:"btn__content",d:0}],c:[{t:0,d:0,g:"slot",a:[],c:[{t:1,d:1,f:15}]}]}]}]},{t:7,d:1,b:[{f:16,c:[{t:2,d:0,x:" 右侧图标插槽(非加载状态且非 icon-only 模式显示) "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon-right",d:0}],c:[]}]}]},{f:17,c:[{t:2,d:0,x:" 右侧图标属性(非加载状态且非 icon-only 模式显示) "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:1,d:1,f:18}]}]}]}]}]}]}],s:{tf:20,cf:20,dn:1,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:n}=this;return"a"===this.getTagName()},function(t){const{$data:n}=this;return this.getButtonClasses()},function(t){const{$data:n}=this;return n.href},function(t){const{$data:n}=this;return n.target},function(t){const{$data:n}=this;return n.disabled||n.loading?"true":"false"},function(t,n){const{$data:d}=this,{value:a,checked:c}=t?.target||{};this.handleClick(t)},function(t){const{$data:n}=this;return n.loading},function(t){const{$data:n}=this;return this.hasLoadingIconSlot()},function(t){const{$data:n}=this;return n.loadingIcon},function(t){const{$data:n}=this;return`${n.loadingIcon}`},function(t){const{$data:n}=this;return this.hasIconSlot()},function(t){const{$data:n}=this;return n.icon},function(t){const{$data:n}=this;return`${n.icon}`},function(t){const{$data:n}=this;return!n.iconOnly&&(n.content||this.hasDefaultSlotContent())},function(t){const{$data:n}=this;return`${n.content}`},function(t){const{$data:n}=this;return!n.loading&&!n.iconOnly&&this.hasIconRightSlot()},function(t){const{$data:n}=this;return!n.loading&&!n.iconOnly&&n.iconRight},function(t){const{$data:n}=this;return`${n.iconRight}`},function(t){const{$data:n}=this;return"button"===this.getTagName()},function(t){const{$data:n}=this;return n.disabled||n.loading}],n:[{t:7,d:1,b:[{f:1,c:[{t:0,d:1,g:"a",a:[{k:"ref",v:"buttonRef",d:0},{k:"part",v:"base",d:0},{k:"class",v:"btn",d:0},{k:":class",f:2,d:1},{k:":href",f:3,d:1},{k:":target",f:4,d:1},{k:":aria-disabled",f:5,d:1},{k:"@click",f:6,d:1}],c:[{t:7,d:1,b:[{f:7,c:[{t:2,d:0,x:" 加载状态:显示加载图标 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"loading-icon",d:0},{k:"class",v:"btn__icon loading-spinner btn__loading-icon",d:0}],c:[{t:7,d:1,b:[{f:8,c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"loading-icon",d:0}],c:[]}]},{f:9,c:[{t:1,d:1,f:10}]}]}]}]},{f:11,c:[{t:2,d:0,x:" 非加载状态,有图标插槽:显示图标插槽内容 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[]}]}]},{f:12,c:[{t:2,d:0,x:" 非加载状态,有图标属性:显示图标 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:1,d:1,f:13}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:14,c:[{t:2,d:0,x:" 按钮内容(非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"content",d:0},{k:"class",v:"btn__content",d:0}],c:[{t:0,d:0,g:"slot",a:[],c:[{t:1,d:1,f:15}]}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:16,c:[{t:2,d:0,x:" 右侧图标插槽(非加载状态且非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon-right",d:0}],c:[]}]}]},{f:17,c:[{t:2,d:0,x:" 右侧图标属性(非加载状态且非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:1,d:1,f:18}]}]}]}]}]},{f:19,c:[{t:0,d:1,g:"button",a:[{k:"ref",v:"buttonRef",d:0},{k:"part",v:"base",d:0},{k:"type",v:"button",d:0},{k:"class",v:"btn",d:0},{k:":class",f:2,d:1},{k:":disabled",f:20,d:1},{k:":aria-disabled",f:5,d:1},{k:"@click",f:6,d:1}],c:[{t:7,d:1,b:[{f:7,c:[{t:2,d:0,x:" 加载状态:显示加载图标 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"loading-icon",d:0},{k:"class",v:"btn__icon loading-spinner btn__loading-icon",d:0}],c:[{t:7,d:1,b:[{f:8,c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"loading-icon",d:0}],c:[]}]},{f:9,c:[{t:1,d:1,f:10}]}]}]}]},{f:11,c:[{t:2,d:0,x:" 非加载状态,有图标插槽:显示图标插槽内容 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[]}]}]},{f:12,c:[{t:2,d:0,x:" 非加载状态,有图标属性:显示图标 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:1,d:1,f:13}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:14,c:[{t:2,d:0,x:" 按钮内容(非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"content",d:0},{k:"class",v:"btn__content",d:0}],c:[{t:0,d:0,g:"slot",a:[],c:[{t:1,d:1,f:15}]}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:16,c:[{t:2,d:0,x:" 右侧图标插槽(非加载状态且非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon-right",d:0}],c:[]}]}]},{f:17,c:[{t:2,d:0,x:" 右侧图标属性(非加载状态且非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:1,d:1,f:18}]}]}]}]}]}]}],s:{tf:20,cf:20,dn:1,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
@@ -1 +1 @@
1
- const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:n}=this;return"a"===this.getTagName()},function(t){const{$data:n}=this;return this.getButtonClasses()},function(t){const{$data:n}=this;return n.href},function(t){const{$data:n}=this;return n.target},function(t){const{$data:n}=this;return n.disabled||n.loading?"true":"false"},function(t,n){const{$data:a}=this,{value:c,checked:d}=t?.target||{};this.handleClick(t)},function(t){const{$data:n}=this;return n.loading},function(t){const{$data:n}=this;return this.hasLoadingIconSlot()},function(t){const{$data:n}=this;return n.loadingIcon},function(t){const{$data:n}=this;return`${n.loadingIcon}`},function(t){const{$data:n}=this;return this.hasIconSlot()},function(t){const{$data:n}=this;return n.icon},function(t){const{$data:n}=this;return`${n.icon}`},function(t){const{$data:n}=this;return!n.iconOnly&&(n.content||this.hasDefaultSlotContent())},function(t){const{$data:n}=this;return`${n.content}`},function(t){const{$data:n}=this;return!n.loading&&!n.iconOnly&&this.hasIconRightSlot()},function(t){const{$data:n}=this;return!n.loading&&!n.iconOnly&&n.iconRight},function(t){const{$data:n}=this;return`${n.iconRight}`},function(t){const{$data:n}=this;return"button"===this.getTagName()},function(t){const{$data:n}=this;return n.disabled||n.loading}],n:[{t:7,d:1,b:[{f:1,c:[{t:0,d:1,g:"a",a:[{k:"ref",v:"buttonRef",d:0},{k:"part",v:"base",d:0},{k:"class",v:"btn",d:0},{k:":class",f:2,d:1},{k:":href",f:3,d:1},{k:":target",f:4,d:1},{k:":aria-disabled",f:5,d:1},{k:"@click",f:6,d:1}],c:[{t:7,d:1,b:[{f:7,c:[{t:2,d:0,x:" 加载状态:显示加载图标 "},{t:0,d:0,g:"span",a:[{k:"part",v:"loading-icon",d:0},{k:"class",v:"btn__icon loading-spinner btn__loading-icon",d:0}],c:[{t:7,d:1,b:[{f:8,c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"loading-icon",d:0}],c:[]}]},{f:9,c:[{t:1,d:1,f:10}]}]}]}]},{f:11,c:[{t:2,d:0,x:" 非加载状态,有图标插槽:显示图标插槽内容 "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[]}]}]},{f:12,c:[{t:2,d:0,x:" 非加载状态,有图标属性:显示图标 "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:1,d:1,f:13}]}]}]},{t:7,d:1,b:[{f:14,c:[{t:2,d:0,x:" 按钮内容(非 icon-only 模式显示) "},{t:0,d:0,g:"span",a:[{k:"part",v:"content",d:0},{k:"class",v:"btn__content",d:0}],c:[{t:0,d:0,g:"slot",a:[],c:[{t:1,d:1,f:15}]}]}]}]},{t:7,d:1,b:[{f:16,c:[{t:2,d:0,x:" 右侧图标插槽(非加载状态且非 icon-only 模式显示) "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon-right",d:0}],c:[]}]}]},{f:17,c:[{t:2,d:0,x:" 右侧图标属性(非加载状态且非 icon-only 模式显示) "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:1,d:1,f:18}]}]}]}]}]},{f:19,c:[{t:0,d:1,g:"button",a:[{k:"ref",v:"buttonRef",d:0},{k:"part",v:"base",d:0},{k:"type",v:"button",d:0},{k:"class",v:"btn",d:0},{k:":class",f:2,d:1},{k:":disabled",f:20,d:1},{k:":aria-disabled",f:5,d:1},{k:"@click",f:6,d:1}],c:[{t:7,d:1,b:[{f:7,c:[{t:2,d:0,x:" 加载状态:显示加载图标 "},{t:0,d:0,g:"span",a:[{k:"part",v:"loading-icon",d:0},{k:"class",v:"btn__icon loading-spinner btn__loading-icon",d:0}],c:[{t:7,d:1,b:[{f:8,c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"loading-icon",d:0}],c:[]}]},{f:9,c:[{t:1,d:1,f:10}]}]}]}]},{f:11,c:[{t:2,d:0,x:" 非加载状态,有图标插槽:显示图标插槽内容 "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[]}]}]},{f:12,c:[{t:2,d:0,x:" 非加载状态,有图标属性:显示图标 "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:1,d:1,f:13}]}]}]},{t:7,d:1,b:[{f:14,c:[{t:2,d:0,x:" 按钮内容(非 icon-only 模式显示) "},{t:0,d:0,g:"span",a:[{k:"part",v:"content",d:0},{k:"class",v:"btn__content",d:0}],c:[{t:0,d:0,g:"slot",a:[],c:[{t:1,d:1,f:15}]}]}]}]},{t:7,d:1,b:[{f:16,c:[{t:2,d:0,x:" 右侧图标插槽(非加载状态且非 icon-only 模式显示) "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon-right",d:0}],c:[]}]}]},{f:17,c:[{t:2,d:0,x:" 右侧图标属性(非加载状态且非 icon-only 模式显示) "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:1,d:1,f:18}]}]}]}]}]}]}],s:{tf:20,cf:20,dn:1,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};
1
+ const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:n}=this;return"a"===this.getTagName()},function(t){const{$data:n}=this;return this.getButtonClasses()},function(t){const{$data:n}=this;return n.href},function(t){const{$data:n}=this;return n.target},function(t){const{$data:n}=this;return n.disabled||n.loading?"true":"false"},function(t,n){const{$data:d}=this,{value:a,checked:c}=t?.target||{};this.handleClick(t)},function(t){const{$data:n}=this;return n.loading},function(t){const{$data:n}=this;return this.hasLoadingIconSlot()},function(t){const{$data:n}=this;return n.loadingIcon},function(t){const{$data:n}=this;return`${n.loadingIcon}`},function(t){const{$data:n}=this;return this.hasIconSlot()},function(t){const{$data:n}=this;return n.icon},function(t){const{$data:n}=this;return`${n.icon}`},function(t){const{$data:n}=this;return!n.iconOnly&&(n.content||this.hasDefaultSlotContent())},function(t){const{$data:n}=this;return`${n.content}`},function(t){const{$data:n}=this;return!n.loading&&!n.iconOnly&&this.hasIconRightSlot()},function(t){const{$data:n}=this;return!n.loading&&!n.iconOnly&&n.iconRight},function(t){const{$data:n}=this;return`${n.iconRight}`},function(t){const{$data:n}=this;return"button"===this.getTagName()},function(t){const{$data:n}=this;return n.disabled||n.loading}],n:[{t:7,d:1,b:[{f:1,c:[{t:0,d:1,g:"a",a:[{k:"ref",v:"buttonRef",d:0},{k:"part",v:"base",d:0},{k:"class",v:"btn",d:0},{k:":class",f:2,d:1},{k:":href",f:3,d:1},{k:":target",f:4,d:1},{k:":aria-disabled",f:5,d:1},{k:"@click",f:6,d:1}],c:[{t:7,d:1,b:[{f:7,c:[{t:2,d:0,x:" 加载状态:显示加载图标 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"loading-icon",d:0},{k:"class",v:"btn__icon loading-spinner btn__loading-icon",d:0}],c:[{t:7,d:1,b:[{f:8,c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"loading-icon",d:0}],c:[]}]},{f:9,c:[{t:1,d:1,f:10}]}]}]}]},{f:11,c:[{t:2,d:0,x:" 非加载状态,有图标插槽:显示图标插槽内容 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[]}]}]},{f:12,c:[{t:2,d:0,x:" 非加载状态,有图标属性:显示图标 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:1,d:1,f:13}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:14,c:[{t:2,d:0,x:" 按钮内容(非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"content",d:0},{k:"class",v:"btn__content",d:0}],c:[{t:0,d:0,g:"slot",a:[],c:[{t:1,d:1,f:15}]}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:16,c:[{t:2,d:0,x:" 右侧图标插槽(非加载状态且非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon-right",d:0}],c:[]}]}]},{f:17,c:[{t:2,d:0,x:" 右侧图标属性(非加载状态且非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:1,d:1,f:18}]}]}]}]}]},{f:19,c:[{t:0,d:1,g:"button",a:[{k:"ref",v:"buttonRef",d:0},{k:"part",v:"base",d:0},{k:"type",v:"button",d:0},{k:"class",v:"btn",d:0},{k:":class",f:2,d:1},{k:":disabled",f:20,d:1},{k:":aria-disabled",f:5,d:1},{k:"@click",f:6,d:1}],c:[{t:7,d:1,b:[{f:7,c:[{t:2,d:0,x:" 加载状态:显示加载图标 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"loading-icon",d:0},{k:"class",v:"btn__icon loading-spinner btn__loading-icon",d:0}],c:[{t:7,d:1,b:[{f:8,c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"loading-icon",d:0}],c:[]}]},{f:9,c:[{t:1,d:1,f:10}]}]}]}]},{f:11,c:[{t:2,d:0,x:" 非加载状态,有图标插槽:显示图标插槽内容 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon",d:0}],c:[]}]}]},{f:12,c:[{t:2,d:0,x:" 非加载状态,有图标属性:显示图标 "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon",d:0},{k:"class",v:"btn__icon",d:0}],c:[{t:1,d:1,f:13}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:14,c:[{t:2,d:0,x:" 按钮内容(非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"content",d:0},{k:"class",v:"btn__content",d:0}],c:[{t:0,d:0,g:"slot",a:[],c:[{t:1,d:1,f:15}]}]}]}]},{t:1,d:0,s:1,x:" "},{t:7,d:1,b:[{f:16,c:[{t:2,d:0,x:" 右侧图标插槽(非加载状态且非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"icon-right",d:0}],c:[]}]}]},{f:17,c:[{t:2,d:0,x:" 右侧图标属性(非加载状态且非 icon-only 模式显示) "},{t:1,d:0,s:1,x:" "},{t:0,d:0,g:"span",a:[{k:"part",v:"icon-right",d:0},{k:"class",v:"btn__icon-right",d:0}],c:[{t:1,d:1,f:18}]}]}]}]}]}]}],s:{tf:20,cf:20,dn:1,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};