@llumi/design-system 0.1.0 → 1.0.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.
- package/README.md +15 -6
- package/custom-elements.json +68 -9
- package/dist/review.cjs +26 -26
- package/dist/review.js +26 -26
- package/dist/review.mjs +485 -391
- package/dist/types/components/review/review.element.d.ts +10 -4
- package/dist/types/components/review/review.machine.d.ts +6 -0
- package/dist/types/components/review/review.persistence.d.ts +16 -0
- package/dist/types/components/review/review.type.d.ts +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,7 +44,9 @@ import "@llumi/design-system/review";
|
|
|
44
44
|
<script type="module">
|
|
45
45
|
const review = document.querySelector("llumi-review");
|
|
46
46
|
review.addEventListener("llumi-review-submit", (e) => {
|
|
47
|
-
|
|
47
|
+
const { result, clearPersisted } = e.detail;
|
|
48
|
+
// ...send `result` to the server, then on success:
|
|
49
|
+
clearPersisted();
|
|
48
50
|
});
|
|
49
51
|
</script>
|
|
50
52
|
```
|
|
@@ -82,6 +84,7 @@ each comment's `targetId`.
|
|
|
82
84
|
| `bar-position` | `top-left` \| `top-center` \| `top-right` \| `bottom-left` \| `bottom-center` \| `bottom-right` | `bottom-center` | Initial corner for the floating toolbar (which is also draggable). |
|
|
83
85
|
| `shortcut` | string ([tinykeys](https://github.com/jamiebuilds/tinykeys) syntax) | `$mod+Shift+M` | Keyboard shortcut that toggles annotate mode. |
|
|
84
86
|
| `default-mode` | `idle` \| `annotating` | `idle` | Whether annotate mode is on at mount. |
|
|
87
|
+
| `persist` | `string` (attribute) | — | When set to a non-empty value, mirrors the review draft to `localStorage` under that key and restores it on load. A persisted draft takes precedence over `initialData`. Restored selection highlights are painted when annotate mode is active (consistent with how `initialData` behaves). |
|
|
85
88
|
|
|
86
89
|
### Properties (set in JS — complex values)
|
|
87
90
|
|
|
@@ -90,6 +93,12 @@ each comment's `targetId`.
|
|
|
90
93
|
| `initialData` | `ReviewResult` | Pre-populate existing comments / overall comment. |
|
|
91
94
|
| `customTargets` | `CustomTarget[]` | Resolve comment targets from arbitrary selectors (advanced). |
|
|
92
95
|
|
|
96
|
+
### Methods
|
|
97
|
+
|
|
98
|
+
| Method | Description |
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| `clearPersisted()` | Clears the persisted draft for this element's `persist` key. No-op when `persist` is unset. Call after a confirmed server save. |
|
|
101
|
+
|
|
93
102
|
```ts
|
|
94
103
|
const review = document.querySelector("llumi-review");
|
|
95
104
|
review.initialData = {
|
|
@@ -100,12 +109,12 @@ review.initialData = {
|
|
|
100
109
|
|
|
101
110
|
### Events
|
|
102
111
|
|
|
103
|
-
Both
|
|
112
|
+
Both events bubble and are composed:
|
|
104
113
|
|
|
105
|
-
| Event | Fires |
|
|
106
|
-
| --- | --- |
|
|
107
|
-
| `llumi-review-change` | On every edit (comment added/edited/deleted, overall comment changed). |
|
|
108
|
-
| `llumi-review-submit` | When the user clicks Submit / Approve. |
|
|
114
|
+
| Event | Detail type | Fires |
|
|
115
|
+
| --- | --- | --- |
|
|
116
|
+
| `llumi-review-change` | `ReviewResult` | On every edit (comment added/edited/deleted, overall comment changed). |
|
|
117
|
+
| `llumi-review-submit` | `{ result: ReviewResult, clearPersisted: () => void }` | When the user clicks Submit / Approve. `clearPersisted` clears the localStorage draft — call it after a confirmed server save. |
|
|
109
118
|
|
|
110
119
|
```ts
|
|
111
120
|
type ReviewResult =
|
package/custom-elements.json
CHANGED
|
@@ -621,7 +621,7 @@
|
|
|
621
621
|
"declarations": [
|
|
622
622
|
{
|
|
623
623
|
"kind": "class",
|
|
624
|
-
"description": "`<llumi-review>` — wraps light-DOM content for element- and text-selection\nreview comments. Both events
|
|
624
|
+
"description": "`<llumi-review>` — wraps light-DOM content for element- and text-selection\nreview comments. Both events bubble and are composed.",
|
|
625
625
|
"name": "LlumiReview",
|
|
626
626
|
"members": [
|
|
627
627
|
{
|
|
@@ -646,6 +646,15 @@
|
|
|
646
646
|
},
|
|
647
647
|
"privacy": "private"
|
|
648
648
|
},
|
|
649
|
+
{
|
|
650
|
+
"kind": "field",
|
|
651
|
+
"name": "persistence",
|
|
652
|
+
"type": {
|
|
653
|
+
"text": "ReviewPersistence"
|
|
654
|
+
},
|
|
655
|
+
"privacy": "private",
|
|
656
|
+
"default": "noopPersistence"
|
|
657
|
+
},
|
|
649
658
|
{
|
|
650
659
|
"kind": "field",
|
|
651
660
|
"name": "manager",
|
|
@@ -746,17 +755,51 @@
|
|
|
746
755
|
"privacy": "private",
|
|
747
756
|
"readonly": true
|
|
748
757
|
},
|
|
758
|
+
{
|
|
759
|
+
"kind": "field",
|
|
760
|
+
"name": "persistKey",
|
|
761
|
+
"type": {
|
|
762
|
+
"text": "string | null"
|
|
763
|
+
},
|
|
764
|
+
"privacy": "private",
|
|
765
|
+
"readonly": true
|
|
766
|
+
},
|
|
749
767
|
{
|
|
750
768
|
"kind": "method",
|
|
751
|
-
"name": "
|
|
769
|
+
"name": "buildDetailResult",
|
|
752
770
|
"privacy": "private",
|
|
771
|
+
"return": {
|
|
772
|
+
"type": {
|
|
773
|
+
"text": "ReviewResult"
|
|
774
|
+
}
|
|
775
|
+
},
|
|
753
776
|
"parameters": [
|
|
754
777
|
{
|
|
755
|
-
"name": "
|
|
778
|
+
"name": "result",
|
|
756
779
|
"type": {
|
|
757
|
-
"text": "
|
|
780
|
+
"text": "ReviewResult"
|
|
758
781
|
}
|
|
759
|
-
}
|
|
782
|
+
}
|
|
783
|
+
]
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
"kind": "method",
|
|
787
|
+
"name": "emitChange",
|
|
788
|
+
"privacy": "private",
|
|
789
|
+
"parameters": [
|
|
790
|
+
{
|
|
791
|
+
"name": "result",
|
|
792
|
+
"type": {
|
|
793
|
+
"text": "ReviewResult"
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
]
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"kind": "method",
|
|
800
|
+
"name": "emitSubmit",
|
|
801
|
+
"privacy": "private",
|
|
802
|
+
"parameters": [
|
|
760
803
|
{
|
|
761
804
|
"name": "result",
|
|
762
805
|
"type": {
|
|
@@ -765,6 +808,16 @@
|
|
|
765
808
|
}
|
|
766
809
|
]
|
|
767
810
|
},
|
|
811
|
+
{
|
|
812
|
+
"kind": "method",
|
|
813
|
+
"name": "clearPersisted",
|
|
814
|
+
"return": {
|
|
815
|
+
"type": {
|
|
816
|
+
"text": "void"
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
"description": "Clears the persisted draft for this element. No-op when persistence is off."
|
|
820
|
+
},
|
|
768
821
|
{
|
|
769
822
|
"kind": "method",
|
|
770
823
|
"name": "mountChrome",
|
|
@@ -875,12 +928,18 @@
|
|
|
875
928
|
],
|
|
876
929
|
"events": [
|
|
877
930
|
{
|
|
878
|
-
"
|
|
879
|
-
"
|
|
931
|
+
"name": "llumi-review-change",
|
|
932
|
+
"type": {
|
|
933
|
+
"text": "CustomEvent"
|
|
934
|
+
},
|
|
935
|
+
"description": "On every edit (comment added/edited/deleted, or overall comment changed). `detail` is a `ReviewResult`."
|
|
880
936
|
},
|
|
881
937
|
{
|
|
882
|
-
"
|
|
883
|
-
"
|
|
938
|
+
"name": "llumi-review-submit",
|
|
939
|
+
"type": {
|
|
940
|
+
"text": "CustomEvent"
|
|
941
|
+
},
|
|
942
|
+
"description": "When the user clicks Submit / Approve. `detail` is `{ result: ReviewResult, clearPersisted: () => void }`; call `clearPersisted()` after a confirmed server save to discard the persisted draft."
|
|
884
943
|
}
|
|
885
944
|
],
|
|
886
945
|
"attributes": [
|