@riebeckite/plugin-rich-embed 0.0.30 → 0.0.32

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/dist/index.js CHANGED
@@ -216,44 +216,19 @@ function parseStart(value) {
216
216
  }
217
217
 
218
218
  // src/hast.ts
219
- function visitElements(node, visitor, parent, index) {
220
- if (isElementNode(node)) visitor(node, parent, index);
221
- for (const [childIndex, child] of [...getChildren(node)].entries()) {
222
- visitElements(
223
- child,
224
- visitor,
225
- hasChildren(node) ? node : parent,
226
- childIndex
227
- );
228
- }
229
- }
230
- function element(tagName, properties = {}, children = []) {
231
- return { type: "element", tagName, properties, children };
232
- }
233
- function text(value) {
234
- return { type: "text", value };
235
- }
236
- function getTextContent(node) {
237
- if (node.type === "text" && "value" in node && typeof node.value === "string") {
238
- return node.value;
239
- }
240
- return getChildren(node).map(getTextContent).join("");
241
- }
242
- function hasClass(node, className) {
243
- const value = node.properties?.className;
244
- const classes = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(/\s+/) : [];
245
- return classes.includes(className);
246
- }
247
- function isElementNode(node) {
248
- return node.type === "element";
249
- }
250
- function hasChildren(node) {
251
- return Array.isArray(node.children);
252
- }
253
- function getChildren(node) {
254
- const children = node.children;
255
- return Array.isArray(children) ? children : [];
256
- }
219
+ import {
220
+ element as sharedElement,
221
+ getStringProperty as sharedGetStringProperty,
222
+ getTextContent as sharedGetTextContent,
223
+ hasClass as sharedHasClass,
224
+ text as sharedText,
225
+ visitElements as sharedVisitElements
226
+ } from "@riebeckite/diagram";
227
+ var element = sharedElement;
228
+ var text = sharedText;
229
+ var getTextContent = sharedGetTextContent;
230
+ var hasClass = sharedHasClass;
231
+ var visitElements = sharedVisitElements;
257
232
 
258
233
  // src/rehype.ts
259
234
  var DIAGNOSTIC_SOURCE = "@riebeckite/plugin-rich-embed";
@@ -1,8 +1,7 @@
1
1
  import type { ElementNode, HastNode, ParentNode, TextNode } from "./types.js";
2
- export declare function visitElements(node: HastNode, visitor: (node: ElementNode, parent?: ParentNode, index?: number) => void, parent?: ParentNode, index?: number): void;
3
- export declare function element(tagName: string, properties?: Record<string, unknown>, children?: HastNode[]): ElementNode;
4
- export declare function text(value: string): TextNode;
5
- export declare function getTextContent(node: HastNode): string;
6
- export declare function getStringProperty(node: ElementNode, key: string): string | null;
7
- export declare function hasClass(node: ElementNode, className: string): boolean;
8
- export declare function mergeClassName(current: unknown, next: string): string;
2
+ export declare const element: (tagName: string, properties?: Record<string, unknown>, children?: HastNode[]) => ElementNode;
3
+ export declare const text: (value: string) => TextNode;
4
+ export declare const getTextContent: (node: HastNode) => string;
5
+ export declare const getStringProperty: (node: ElementNode, key: string) => string | null;
6
+ export declare const hasClass: (node: ElementNode, className: string) => boolean;
7
+ export declare const visitElements: (node: HastNode, visitor: (node: ElementNode, parent?: ParentNode, index?: number) => void, parent?: ParentNode, index?: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-rich-embed",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,7 +15,8 @@
15
15
  "./style.css": "./style.css"
16
16
  },
17
17
  "dependencies": {
18
- "@riebeckite/core": "0.0.30"
18
+ "@riebeckite/core": "0.0.32",
19
+ "@riebeckite/diagram": "0.0.32"
19
20
  },
20
21
  "publishConfig": {
21
22
  "access": "public"