mirror of
https://github.com/penpot/penpot.git
synced 2026-01-28 08:13:29 -05:00
Compare commits
1 Commits
develop
...
alotor-mcp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f407d5c3c |
@@ -261,6 +261,33 @@
|
||||
:else
|
||||
(let [child-id (obj/get child "$id")]
|
||||
(st/emit! (dwt/move-shapes-to-frame #{child-id} id nil nil)
|
||||
(ptk/data-event :layout/update {:ids [id]})))))
|
||||
|
||||
|
||||
:appendChildStart
|
||||
(fn [child]
|
||||
(cond
|
||||
(not (shape-proxy? child))
|
||||
(u/display-not-valid :appendChildStart child)
|
||||
|
||||
:else
|
||||
(let [child-id (obj/get child "$id")
|
||||
shape (u/locate-shape file-id page-id id)
|
||||
index (if (ctl/reverse? shape) 0 (count (:shapes shape)))]
|
||||
(st/emit! (dwt/move-shapes-to-frame #{child-id} id index nil)
|
||||
(ptk/data-event :layout/update {:ids [id]})))))
|
||||
|
||||
:appendChildEnd
|
||||
(fn [child]
|
||||
(cond
|
||||
(not (shape-proxy? child))
|
||||
(u/display-not-valid :appendChildEnd child)
|
||||
|
||||
:else
|
||||
(let [child-id (obj/get child "$id")
|
||||
shape (u/locate-shape file-id page-id id)
|
||||
index (if-not (ctl/reverse? shape) 0 (count (:shapes shape)))]
|
||||
(st/emit! (dwt/move-shapes-to-frame #{child-id} id index nil)
|
||||
(ptk/data-event :layout/update {:ids [id]})))))))
|
||||
|
||||
|
||||
|
||||
@@ -953,6 +953,46 @@
|
||||
(let [child-id (obj/get child "$id")]
|
||||
(st/emit! (dwsh/relocate-shapes #{child-id} id 0))))))
|
||||
|
||||
:appendChildBack
|
||||
(fn [child]
|
||||
(let [shape (u/locate-shape file-id page-id id)]
|
||||
(cond
|
||||
(and (not (cfh/frame-shape? shape))
|
||||
(not (cfh/group-shape? shape))
|
||||
(not (cfh/svg-raw-shape? shape))
|
||||
(not (cfh/bool-shape? shape)))
|
||||
(u/display-not-valid :appendChildBack (:type shape))
|
||||
|
||||
(not (shape-proxy? child))
|
||||
(u/display-not-valid :appendChildBack-child child)
|
||||
|
||||
(not (r/check-permission plugin-id "content:write"))
|
||||
(u/display-not-valid :appendChildBack "Plugin doesn't have 'content:write' permission")
|
||||
|
||||
:else
|
||||
(let [child-id (obj/get child "$id")]
|
||||
(st/emit! (dwsh/relocate-shapes #{child-id} id 0))))))
|
||||
|
||||
:appendChildFront
|
||||
(fn [child]
|
||||
(let [shape (u/locate-shape file-id page-id id)]
|
||||
(cond
|
||||
(and (not (cfh/frame-shape? shape))
|
||||
(not (cfh/group-shape? shape))
|
||||
(not (cfh/svg-raw-shape? shape))
|
||||
(not (cfh/bool-shape? shape)))
|
||||
(u/display-not-valid :appendChildFront (:type shape))
|
||||
|
||||
(not (shape-proxy? child))
|
||||
(u/display-not-valid :appendChildFront-child child)
|
||||
|
||||
(not (r/check-permission plugin-id "content:write"))
|
||||
(u/display-not-valid :appendChildFront "Plugin doesn't have 'content:write' permission")
|
||||
|
||||
:else
|
||||
(let [child-id (obj/get child "$id")]
|
||||
(st/emit! (dwsh/relocate-shapes #{child-id} id (count (:shapes shape))))))))
|
||||
|
||||
:insertChild
|
||||
(fn [index child]
|
||||
(let [shape (u/locate-shape file-id page-id id)]
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
## 1.5.0 (Unreleased)
|
||||
|
||||
- **plugin-types**: New methods:
|
||||
Board
|
||||
-- appendChildTop
|
||||
-- appendChildBottom
|
||||
|
||||
FlexLayout
|
||||
-- appendChildStart
|
||||
-- appendChildEnd
|
||||
|
||||
## 1.4.2 (2026-01-21)
|
||||
|
||||
- **plugin-types:** fix atob/btoa functions
|
||||
- **plugin-runtime:** fix atob/btoa functions
|
||||
|
||||
## 1.4.0 (2026-01-21)
|
||||
|
||||
|
||||
51
plugins/libs/plugin-types/index.d.ts
vendored
51
plugins/libs/plugin-types/index.d.ts
vendored
@@ -281,6 +281,32 @@ export interface Board extends ShapeBase {
|
||||
*/
|
||||
appendChild(child: Shape): void;
|
||||
|
||||
/**
|
||||
* Appends a child shape to the board. The new children
|
||||
* will be positioned at the **top** relative to the other
|
||||
* children stacking order.
|
||||
* @param child The child shape to append.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* board.appendChildTop(childShape);
|
||||
* ```
|
||||
*/
|
||||
appendChildTop(child: Shape): void;
|
||||
|
||||
/**
|
||||
* Appends a child shape to the board. The new children
|
||||
* will be positioned at the **back** relative to the other
|
||||
* children stacking order.
|
||||
* @param child The child shape to append.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* board.appendChildBack(childShape);
|
||||
* ```
|
||||
*/
|
||||
appendChildBack(child: Shape): void;
|
||||
|
||||
/**
|
||||
* Inserts a child shape at the specified index within the board.
|
||||
* @param index The index at which to insert the child shape.
|
||||
@@ -1699,6 +1725,7 @@ export interface FlexLayout extends CommonLayout {
|
||||
* - 'nowrap': Child elements will not wrap.
|
||||
*/
|
||||
wrap?: 'wrap' | 'nowrap';
|
||||
|
||||
/**
|
||||
* Appends a child element to the flex layout.
|
||||
* @param child The child element to be appended, of type `Shape`.
|
||||
@@ -1709,6 +1736,30 @@ export interface FlexLayout extends CommonLayout {
|
||||
* ```
|
||||
*/
|
||||
appendChild(child: Shape): void;
|
||||
|
||||
/**
|
||||
* Appends a child element to the flex layout. The element will be
|
||||
* visually positioned at the start (left / top)
|
||||
* @param child The child element to be appended, of type `Shape`.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* flexLayout.appendChildStart(childShape);
|
||||
* ```
|
||||
*/
|
||||
appendChildStart(child: Shape): void;
|
||||
|
||||
/**
|
||||
* Appends a child element to the flex layout. The element will be
|
||||
* visually positioned at the end (right / bottom)
|
||||
* @param child The child element to be appended, of type `Shape`.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* flexLayout.appendChildEnd(childShape);
|
||||
* ```
|
||||
*/
|
||||
appendChildEnd(child: Shape): void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user