@c2n/reorder-list 0.0.6 → 0.0.7

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.
@@ -2,7 +2,8 @@ import { nothing as e } from "lit/html.js";
2
2
  import { PartType as t, directive as n } from "lit/directive.js";
3
3
  import { AsyncDirective as r } from "lit/async-directive.js";
4
4
  import { LitElement as i, html as a, unsafeCSS as o } from "lit";
5
- import { customElement as s, eventOptions as c, property as l, query as u, queryAll as d, state as f } from "lit/decorators.js";
5
+ import { eventOptions as s, property as c, query as l, queryAll as u, state as d } from "lit/decorators.js";
6
+ import { customElement as f } from "@c2n/core/element-helper.js";
6
7
  import { classMap as p } from "lit/directives/class-map.js";
7
8
  import { styleMap as m } from "lit/directives/style-map.js";
8
9
  //#region ../../../node_modules/@lit-labs/motion/animate-controller.js
@@ -377,6 +378,7 @@ var A = class extends i {
377
378
  `;
378
379
  }
379
380
  handleMouseDown(e) {
381
+ if (!this.editable) return;
380
382
  let t = this.getSlottedTargetIndex(e);
381
383
  if (t == -1) return;
382
384
  let n = e.composedPath()[t];
@@ -456,7 +458,7 @@ var A = class extends i {
456
458
  ...j(e),
457
459
  isFixed: t ? this.isFixedItem(t.assignedNodes()[0]) : !1
458
460
  });
459
- }), console.log(this.itemPositions);
461
+ });
460
462
  }
461
463
  applyTransform(e) {
462
464
  let t = this.getPointerPosition(e), n = t.x - this.pickupPosition.x, r = t.y - this.pickupPosition.y;
@@ -489,10 +491,10 @@ var A = class extends i {
489
491
  this.styles = o(O);
490
492
  }
491
493
  };
492
- k([u(".dragging-item")], A.prototype, "draggingElement", void 0), k([u(".placeholder")], A.prototype, "placeholderElement", void 0), k([u(".c2-reorder-list-container")], A.prototype, "containerElement", void 0), k([d(".list-item")], A.prototype, "listItemElements", void 0), k([l({
494
+ k([l(".dragging-item")], A.prototype, "draggingElement", void 0), k([l(".placeholder")], A.prototype, "placeholderElement", void 0), k([l(".c2-reorder-list-container")], A.prototype, "containerElement", void 0), k([u(".list-item")], A.prototype, "listItemElements", void 0), k([c({
493
495
  type: Boolean,
494
496
  reflect: !0
495
- })], A.prototype, "editable", void 0), k([l({ type: Number })], A.prototype, "dragStartThreshold", void 0), k([l({ type: Boolean })], A.prototype, "autoScrollDisabled", void 0), k([f()], A.prototype, "placeholderSlotIndex", void 0), k([f()], A.prototype, "placeholderSize", void 0), k([c({ passive: !0 })], A.prototype, "handleMouseDown", null), A = k([s("c2-reorder-list")], A);
497
+ })], A.prototype, "editable", void 0), k([c({ type: Number })], A.prototype, "dragStartThreshold", void 0), k([c({ type: Boolean })], A.prototype, "autoScrollDisabled", void 0), k([d()], A.prototype, "placeholderSlotIndex", void 0), k([d()], A.prototype, "placeholderSize", void 0), k([s({ passive: !0 })], A.prototype, "handleMouseDown", null), A = k([f("c2-reorder-list")], A);
496
498
  function j(e) {
497
499
  let t = e.getBoundingClientRect();
498
500
  return {
package/package.json CHANGED
@@ -1,18 +1,30 @@
1
1
  {
2
2
  "name": "@c2n/reorder-list",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "main": "dist/reorder-list.js",
6
6
  "exports": {
7
7
  ".": {
8
- "default": "./dist/reorder-list.js",
9
- "types": "./types/src/reorder-list.d.ts"
8
+ "types": "./types/src/reorder-list.d.ts",
9
+ "default": "./dist/reorder-list.js"
10
+ },
11
+ "./react": {
12
+ "types": "./react.d.ts",
13
+ "default": "./react.js"
14
+ },
15
+ "./vue": {
16
+ "types": "./vue.d.ts",
17
+ "default": "./vue.js"
10
18
  },
11
19
  "./custom-elements.json": "./custom-elements.json"
12
20
  },
13
21
  "files": [
14
22
  "dist",
15
- "types"
23
+ "types",
24
+ "react.d.ts",
25
+ "react.js",
26
+ "vue.d.ts",
27
+ "vue.js"
16
28
  ],
17
29
  "keywords": [
18
30
  "reorder-list",
@@ -48,12 +60,12 @@
48
60
  }
49
61
  },
50
62
  "dependencies": {
51
- "@c2n/core": "0.0.6",
63
+ "@c2n/core": "0.0.7",
52
64
  "@lit-labs/motion": "1.1.0",
53
65
  "lit": "3.3.3"
54
66
  },
55
67
  "devDependencies": {
56
68
  "@c2n/config": "*"
57
69
  },
58
- "gitHead": "2921054bc75299da66dad11c1e374246ff88a51e"
70
+ "gitHead": "c8db398a27f7cd417d665fdf5da455fee2d4e910"
59
71
  }
package/react.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ // GENERATED by @c2n/framework-types. Do not edit by hand.
2
+ //
3
+ // JSX types for the custom elements of @c2n/reorder-list. Import once, anywhere in the program:
4
+ //
5
+ // import '@c2n/reorder-list/react'
6
+ //
7
+ // Register the elements at module scope before React renders, or React writes an object prop as an
8
+ // attribute and it stringifies.
9
+
10
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react'
11
+ import type { ReorderList } from '@c2n/reorder-list'
12
+
13
+ /** Standard React host-element attributes plus the element's own public properties. */
14
+ type C2Props<T> = DetailedHTMLProps<HTMLAttributes<T>, T> & Partial<Omit<T, keyof HTMLElement>>
15
+
16
+ declare module 'react' {
17
+ namespace JSX {
18
+ interface IntrinsicElements {
19
+ 'c2-reorder-list': C2Props<ReorderList>
20
+ }
21
+ }
22
+ }
23
+
24
+ export {}
package/react.js ADDED
@@ -0,0 +1,3 @@
1
+ // GENERATED by @c2n/framework-types. Do not edit by hand.
2
+ // Types only — see the matching .d.ts.
3
+ export {}
@@ -1 +1 @@
1
- {"version":3,"file":"reorder-list.d.ts","sourceRoot":"","sources":["../../src/reorder-list.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,UAAU,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAA;AAM7F,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AACD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,qBACa,WAAY,SAAQ,UAAU;I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AE,WAAW,CAAA;KAC/B;CACF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAY9D"}
package/vue.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ // GENERATED by @c2n/framework-types. Do not edit by hand.
2
+ //
3
+ // Vue template types for the custom elements of @c2n/reorder-list. Import once, anywhere in the program:
4
+ //
5
+ // import '@c2n/reorder-list/vue'
6
+ //
7
+ // Tell the compiler about the tags as well, or every c2-* tag is resolved as a Vue component and renders
8
+ // nothing: template.compilerOptions.isCustomElement = (tag) => tag.startsWith('c2-') in vite.config.ts.
9
+
10
+ import type { DefineComponent, HTMLAttributes } from 'vue'
11
+ import type { ReorderList, ReorderListEventMap } from '@c2n/reorder-list'
12
+
13
+ /** The element's own public properties, plus every attribute Vue understands on a host element. */
14
+ type C2Props<T> = Partial<Omit<T, keyof HTMLElement>> & HTMLAttributes
15
+
16
+ declare module 'vue' {
17
+ interface GlobalComponents {
18
+ 'c2-reorder-list': DefineComponent<
19
+ C2Props<ReorderList> & {
20
+ onChange?: (event: ReorderListEventMap['change']) => void
21
+ }
22
+ >
23
+ }
24
+ }
25
+
26
+ declare module '@vue/runtime-dom' {
27
+ interface HTMLAttributes {
28
+ /** Vue's own definition omits it, and slotting a plain element into a component needs it. */
29
+ slot?: string
30
+ }
31
+ }
32
+
33
+ export {}
package/vue.js ADDED
@@ -0,0 +1,3 @@
1
+ // GENERATED by @c2n/framework-types. Do not edit by hand.
2
+ // Types only — see the matching .d.ts.
3
+ export {}