@haklex/rich-renderer-alert 0.0.64 → 0.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,37 +1,62 @@
1
1
  # @haklex/rich-renderer-alert
2
2
 
3
- GitHub 风格提示块渲染器。
3
+ Alert/callout block renderer supporting five severity levels: note, tip, important, warning, and caution.
4
4
 
5
- ## 安装
5
+ ## Installation
6
6
 
7
7
  ```bash
8
8
  pnpm add @haklex/rich-renderer-alert
9
9
  ```
10
10
 
11
- ## 导出
11
+ ## Peer Dependencies
12
12
 
13
- ```ts
14
- export { AlertRenderer } from './AlertRenderer'
15
- export { AlertEditRenderer } from './AlertEditRenderer'
16
- ```
13
+ | Package | Version |
14
+ | --- | --- |
15
+ | `react` | `>=19` |
16
+ | `react-dom` | `>=19` |
17
17
 
18
- ## 类型
18
+ ## Usage
19
19
 
20
- Alert 类型:`'note' | 'tip' | 'important' | 'warning' | 'caution'`
20
+ ```tsx
21
+ import { AlertRenderer } from '@haklex/rich-renderer-alert/static'
21
22
 
22
- ## 使用
23
+ // Register in a static RendererConfig
24
+ const rendererConfig = {
25
+ // ...other renderers
26
+ Alert: AlertRenderer,
27
+ }
28
+ ```
23
29
 
24
- 渲染器通过 `rendererConfig` 传入:
30
+ For edit mode:
25
31
 
26
32
  ```tsx
27
- import { AlertRenderer } from '@haklex/rich-renderer-alert'
28
- import type { RendererConfig } from '@haklex/rich-editor'
33
+ import { AlertEditRenderer } from '@haklex/rich-renderer-alert'
29
34
 
30
- const config: RendererConfig = {
31
- Alert: AlertRenderer,
35
+ const editRendererConfig = {
36
+ // ...other renderers
37
+ Alert: AlertEditRenderer,
32
38
  }
33
39
  ```
34
40
 
41
+ ## Exports
42
+
43
+ ### Components
44
+
45
+ - `AlertRenderer` — Static (read-only) renderer for alert/callout blocks
46
+ - `AlertEditRenderer` — Edit (interactive) renderer with severity selection
47
+
48
+ ### Sub-path Exports
49
+
50
+ | Path | Description |
51
+ | --- | --- |
52
+ | `@haklex/rich-renderer-alert` | Full exports (edit + static) |
53
+ | `@haklex/rich-renderer-alert/static` | Static-only renderer |
54
+ | `@haklex/rich-renderer-alert/style.css` | Stylesheet |
55
+
56
+ ## Part of Haklex
57
+
58
+ This package is part of the [Haklex](../../README.md) rich editor ecosystem.
59
+
35
60
  ## License
36
61
 
37
62
  MIT
@@ -1,4 +1,4 @@
1
- import { AlertRendererProps } from '@haklex/rich-editor';
1
+ import { AlertRendererProps } from '@haklex/rich-editor/renderers';
2
2
  import { FC } from 'react';
3
3
  export declare const AlertEditRenderer: FC<AlertRendererProps>;
4
4
  //# sourceMappingURL=AlertEditRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AlertEditRenderer.d.ts","sourceRoot":"","sources":["../src/AlertEditRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAQ7D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAU/B,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,kBAAkB,CAwCpD,CAAA"}
1
+ {"version":3,"file":"AlertEditRenderer.d.ts","sourceRoot":"","sources":["../src/AlertEditRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAQxE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,kBAAkB,CAgCpD,CAAC"}
@@ -127,13 +127,7 @@ const ALERT_LABELS = {
127
127
  warning: "Warning",
128
128
  caution: "Caution"
129
129
  };
130
- const ALL_TYPES = [
131
- "note",
132
- "tip",
133
- "important",
134
- "warning",
135
- "caution"
136
- ];
130
+ const ALL_TYPES = ["note", "tip", "important", "warning", "caution"];
137
131
  const AlertRenderer = ({ type }) => {
138
132
  const Icon = ALERT_ICONS[type];
139
133
  const label = ALERT_LABELS[type];
@@ -1,4 +1,4 @@
1
- import { AlertRendererProps } from '@haklex/rich-editor';
1
+ import { AlertRendererProps } from '@haklex/rich-editor/renderers';
2
2
  import { LucideProps } from 'lucide-react';
3
3
  import { FC } from 'react';
4
4
  type AlertType = AlertRendererProps['type'];
@@ -1 +1 @@
1
- {"version":3,"file":"AlertRenderer.d.ts","sourceRoot":"","sources":["../src/AlertRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAQ/C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAI/B,KAAK,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;AAE3C,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,WAAW,CAAC,CAM1D,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMlD,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,SAAS,EAMhC,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAchD,CAAA;AAED,eAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"AlertRenderer.d.ts","sourceRoot":"","sources":["../src/AlertRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,KAAK,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAE5C,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,WAAW,CAAC,CAM1D,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMlD,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SAAS,EAAuD,CAAC;AAEzF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAYhD,CAAC;AAEF,eAAe,aAAa,CAAC"}
package/dist/index.mjs CHANGED
@@ -1,12 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@haklex/rich-editor-ui";
3
3
  import { ChevronDown } from "lucide-react";
4
- import { A as AlertRenderer, a as alertHeader, s as semanticClassNames, b as semanticTypeClassNames, c as alertTrigger, d as ALERT_ICONS, e as alertIcon, f as ALERT_LABELS, g as alertLabel, h as alertChevron, i as ALL_TYPES, j as alertMenuIcon, k as alertType } from "./AlertRenderer-Dx_WBahX.js";
5
- const AlertEditRenderer = ({
6
- type,
7
- editable,
8
- onTypeChange
9
- }) => {
4
+ import { A as AlertRenderer, a as alertHeader, s as semanticClassNames, b as semanticTypeClassNames, c as alertTrigger, d as ALERT_ICONS, e as alertIcon, f as ALERT_LABELS, g as alertLabel, h as alertChevron, i as ALL_TYPES, j as alertMenuIcon, k as alertType } from "./AlertRenderer-D578-dJz.js";
5
+ const AlertEditRenderer = ({ type, editable, onTypeChange }) => {
10
6
  if (!editable || !onTypeChange) {
11
7
  return /* @__PURE__ */ jsx(AlertRenderer, { type });
12
8
  }
@@ -22,15 +18,10 @@ const AlertEditRenderer = ({
22
18
  /* @__PURE__ */ jsx("span", { className: `${alertLabel} ${semanticClassNames.label}`, children: label }),
23
19
  /* @__PURE__ */ jsx(ChevronDown, { className: alertChevron })
24
20
  ] }),
25
- /* @__PURE__ */ jsx(DropdownMenuContent, { sideOffset: 6, align: "start", children: ALL_TYPES.map((t) => {
21
+ /* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", sideOffset: 6, children: ALL_TYPES.map((t) => {
26
22
  const ItemIcon = ALERT_ICONS[t];
27
23
  return /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => onTypeChange(t), children: [
28
- /* @__PURE__ */ jsx(
29
- ItemIcon,
30
- {
31
- className: `${alertMenuIcon} ${alertType({ type: t })}`
32
- }
33
- ),
24
+ /* @__PURE__ */ jsx(ItemIcon, { className: `${alertMenuIcon} ${alertType({ type: t })}` }),
34
25
  /* @__PURE__ */ jsx("span", { children: ALERT_LABELS[t] })
35
26
  ] }, t);
36
27
  }) })
package/dist/static.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A, A as A2 } from "./AlertRenderer-Dx_WBahX.js";
1
+ import { A, A as A2 } from "./AlertRenderer-D578-dJz.js";
2
2
  export {
3
3
  A as AlertRenderer,
4
4
  A2 as default
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@haklex/rich-renderer-alert",
3
3
  "type": "module",
4
- "version": "0.0.64",
4
+ "version": "0.0.66",
5
5
  "description": "Alert renderer for haklex rich editor",
6
6
  "license": "MIT",
7
7
  "exports": {
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "lucide-react": "^0.577.0",
28
- "@haklex/rich-editor": "0.0.64",
29
- "@haklex/rich-editor-ui": "0.0.64",
30
- "@haklex/rich-style-token": "0.0.64"
28
+ "@haklex/rich-editor": "0.0.66",
29
+ "@haklex/rich-editor-ui": "0.0.66",
30
+ "@haklex/rich-style-token": "0.0.66"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/react": "^19.2.14",
@@ -44,6 +44,11 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/Innei/haklex.git",
50
+ "directory": "packages/rich-renderer-alert"
51
+ },
47
52
  "scripts": {
48
53
  "build": "vite build",
49
54
  "dev:build": "vite build --watch"
package/LICENSE DELETED
@@ -1,28 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Innei
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
23
-
24
- Additional Terms and Conditions
25
-
26
- ----------------
27
-
28
- Use of this software is governed by the terms of MIT and, in addition, by the terms and conditions described in the additional file (ADDITIONAL_TERMS.md). By using this software, you agree to abide by these additional terms and conditions.