nwl-components 0.0.4 → 0.0.5

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.
@@ -35,7 +35,7 @@ var __privateMethod = (obj, member, method) => {
35
35
  return method;
36
36
  };
37
37
  var _transformProjectFiles, transformProjectFiles_fn;
38
- import { openBlock, createElementBlock, mergeProps, reactive, ref, watch, onMounted, onUnmounted, unref, createVNode, withKeys, withDirectives, createElementVNode, Fragment, renderList, normalizeClass, toDisplayString, vShow, renderSlot, isRef, vModelText, getCurrentInstance, createCommentVNode, createBlock, withCtx, pushScopeId, popScopeId, createTextVNode, inject, toRefs, vModelCheckbox } from "vue";
38
+ import { openBlock, createElementBlock, mergeProps, reactive, ref, watch, onMounted, onUnmounted, unref, createVNode, withKeys, withDirectives, createElementVNode, Fragment, renderList, normalizeClass, toDisplayString, vShow, renderSlot, isRef, vModelText, getCurrentInstance, createCommentVNode, createBlock, withCtx, pushScopeId, popScopeId, createTextVNode, inject, toRefs } from "vue";
39
39
  let nanoid = (size = 21) => {
40
40
  let id = "";
41
41
  let bytes = crypto.getRandomValues(new Uint8Array(size));
@@ -61,8 +61,8 @@ var _export_sfc = (sfc, props) => {
61
61
  }
62
62
  return target;
63
63
  };
64
- const _hoisted_1$j = ["value"];
65
- const _sfc_main$p = {
64
+ const _hoisted_1$k = ["value"];
65
+ const _sfc_main$q = {
66
66
  props: {
67
67
  placeholder: String,
68
68
  disabled: Boolean,
@@ -78,20 +78,20 @@ const _sfc_main$p = {
78
78
  return openBlock(), createElementBlock("input", mergeProps({ type: "text" }, props, {
79
79
  value: __props.modelValue,
80
80
  onInput: handleInput
81
- }), null, 16, _hoisted_1$j);
81
+ }), null, 16, _hoisted_1$k);
82
82
  };
83
83
  }
84
84
  };
85
- var TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-2cc3f9d3"]]);
85
+ var TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-2cc3f9d3"]]);
86
86
  var Autocomplete_vue_vue_type_style_index_0_scoped_true_lang = "";
87
- const _hoisted_1$i = ["aria-owns", "aria-expanded"];
87
+ const _hoisted_1$j = ["aria-owns", "aria-expanded"];
88
88
  const _hoisted_2$d = ["id"];
89
89
  const _hoisted_3$a = {
90
90
  key: 0,
91
91
  class: "loading"
92
92
  };
93
93
  const _hoisted_4$9 = ["onClick", "id", "aria-selected"];
94
- const _sfc_main$o = {
94
+ const _sfc_main$p = {
95
95
  props: {
96
96
  items: {
97
97
  type: Array,
@@ -242,14 +242,14 @@ const _sfc_main$o = {
242
242
  ], 8, _hoisted_2$d), [
243
243
  [vShow, unref(state2).isOpen]
244
244
  ])
245
- ], 8, _hoisted_1$i);
245
+ ], 8, _hoisted_1$j);
246
246
  };
247
247
  }
248
248
  };
249
- var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-ee76199e"]]);
249
+ var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-ee76199e"]]);
250
250
  var Button_vue_vue_type_style_index_0_scoped_true_lang = "";
251
- const _hoisted_1$h = ["title", "disabled"];
252
- const _sfc_main$n = {
251
+ const _hoisted_1$i = ["title", "disabled"];
252
+ const _sfc_main$o = {
253
253
  props: {
254
254
  className: String,
255
255
  title: String,
@@ -269,13 +269,13 @@ const _sfc_main$n = {
269
269
  class: normalizeClass(classes)
270
270
  }, [
271
271
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
272
- ], 8, _hoisted_1$h);
272
+ ], 8, _hoisted_1$i);
273
273
  };
274
274
  }
275
275
  };
276
- var Button = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-5e5f2114"]]);
276
+ var Button = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-5e5f2114"]]);
277
277
  var Select_vue_vue_type_style_index_0_scoped_true_lang = "";
278
- const _sfc_main$m = {
278
+ const _sfc_main$n = {
279
279
  props: {
280
280
  disabled: Boolean,
281
281
  modelValue: String
@@ -304,9 +304,9 @@ const _sfc_main$m = {
304
304
  };
305
305
  }
306
306
  };
307
- var Select = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-976df3ea"]]);
307
+ var Select = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-976df3ea"]]);
308
308
  var TextArea_vue_vue_type_style_index_0_scoped_true_lang = "";
309
- const _sfc_main$l = {
309
+ const _sfc_main$m = {
310
310
  props: {
311
311
  placeholder: String,
312
312
  disabled: Boolean,
@@ -328,10 +328,10 @@ const _sfc_main$l = {
328
328
  };
329
329
  }
330
330
  };
331
- var TextArea = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-0c2bd53c"]]);
331
+ var TextArea = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-0c2bd53c"]]);
332
332
  var Table_vue_vue_type_style_index_0_scoped_true_lang = "";
333
- const _hoisted_1$g = ["id"];
334
- const _sfc_main$k = {
333
+ const _hoisted_1$h = ["id"];
334
+ const _sfc_main$l = {
335
335
  props: {
336
336
  id: String
337
337
  },
@@ -342,11 +342,45 @@ const _sfc_main$k = {
342
342
  id: props.id
343
343
  }, [
344
344
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
345
- ], 8, _hoisted_1$g);
345
+ ], 8, _hoisted_1$h);
346
346
  };
347
347
  }
348
348
  };
349
- var Table = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-6416d86a"]]);
349
+ var Table = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-2b42a47b"]]);
350
+ var Checkbox_vue_vue_type_style_index_0_scoped_true_lang = "";
351
+ const _hoisted_1$g = ["aria-checked"];
352
+ const _sfc_main$k = {
353
+ props: {
354
+ modelValue: Boolean
355
+ },
356
+ emits: ["update:modelValue", "change"],
357
+ setup(__props, { emit }) {
358
+ const props = __props;
359
+ const isChecked = ref(props.modelValue);
360
+ if (typeof props.modelValue === "string") {
361
+ isChecked.value === props.modelValue === "true";
362
+ }
363
+ const toggleCheckbox = (key) => {
364
+ if (key != null && key !== " ") {
365
+ return;
366
+ }
367
+ isChecked.value = !isChecked.value;
368
+ emit("change", isChecked.value);
369
+ emit("update:modelValue", isChecked.value);
370
+ };
371
+ return (_ctx, _cache) => {
372
+ return openBlock(), createElementBlock("span", {
373
+ role: "checkbox",
374
+ "aria-checked": isChecked.value,
375
+ onClick: _cache[0] || (_cache[0] = ($event) => toggleCheckbox()),
376
+ onKeydown: _cache[1] || (_cache[1] = ($event) => toggleCheckbox($event.key)),
377
+ tabindex: "0",
378
+ "aria-label": "label"
379
+ }, null, 40, _hoisted_1$g);
380
+ };
381
+ }
382
+ };
383
+ var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-f63b8f34"]]);
350
384
  var Tabs_vue_vue_type_style_index_0_scoped_true_lang = "";
351
385
  const _hoisted_1$f = { class: "tabs" };
352
386
  const _hoisted_2$c = ["onClick"];
@@ -6644,6 +6678,9 @@ const state = reactive({
6644
6678
  function useProject() {
6645
6679
  const { baseURL } = inject("config");
6646
6680
  const service = new ProjectService(baseURL);
6681
+ const setProject = (project) => {
6682
+ state.project = project;
6683
+ };
6647
6684
  const fetchProject = async (id) => {
6648
6685
  state.loading = true;
6649
6686
  state.project = await service.fetch(id);
@@ -6721,6 +6758,7 @@ function useProject() {
6721
6758
  state.project.files.list = state.project.files.list.filter((file) => !filesIdx.includes(state.project.files.list.indexOf(file)));
6722
6759
  };
6723
6760
  return __spreadProps(__spreadValues({}, toRefs(state)), {
6761
+ setProject,
6724
6762
  fetchProject,
6725
6763
  saveProject,
6726
6764
  deleteProject,
@@ -6753,7 +6791,7 @@ const _hoisted_6$5 = ["href"];
6753
6791
  const _hoisted_7$5 = /* @__PURE__ */ createTextVNode(" by ");
6754
6792
  const _hoisted_8$5 = ["href"];
6755
6793
  const _hoisted_9$4 = { id: "numCollaborators" };
6756
- const _hoisted_10$4 = /* @__PURE__ */ createTextVNode(" Collaborators ");
6794
+ const _hoisted_10$3 = /* @__PURE__ */ createTextVNode(" Collaborators ");
6757
6795
  const _hoisted_11$2 = { id: "numAnnotations" };
6758
6796
  const _hoisted_12$2 = /* @__PURE__ */ createTextVNode(" Annotations ");
6759
6797
  const _hoisted_13$1 = { id: "numFiles" };
@@ -6827,7 +6865,7 @@ const _sfc_main$f = {
6827
6865
  }, null, 8, ["modelValue"]),
6828
6866
  createElementVNode("p", null, [
6829
6867
  createElementVNode("span", _hoisted_9$4, toDisplayString(unref(project).collaborators.list.length), 1),
6830
- _hoisted_10$4
6868
+ _hoisted_10$3
6831
6869
  ]),
6832
6870
  createElementVNode("p", null, [
6833
6871
  createElementVNode("span", _hoisted_11$2, toDisplayString(unref(project).annotations.list.length), 1),
@@ -7162,7 +7200,7 @@ const _sfc_main$c = {
7162
7200
  }
7163
7201
  };
7164
7202
  var PureAnnotations_vue_vue_type_style_index_0_scoped_true_lang = "";
7165
- const _withScopeId$4 = (n) => (pushScopeId("data-v-0abfcc3d"), n = n(), popScopeId(), n);
7203
+ const _withScopeId$4 = (n) => (pushScopeId("data-v-72fdca59"), n = n(), popScopeId(), n);
7166
7204
  const _hoisted_1$8 = { class: "wrapper" };
7167
7205
  const _hoisted_2$6 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ createElementVNode("h2", null, "Annotations", -1));
7168
7206
  const _hoisted_3$4 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ createElementVNode("thead", null, [
@@ -7176,10 +7214,9 @@ const _hoisted_3$4 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ create
7176
7214
  const _hoisted_4$4 = ["onClick"];
7177
7215
  const _hoisted_5$3 = ["value", "selected"];
7178
7216
  const _hoisted_6$3 = ["value", "selected"];
7179
- const _hoisted_7$3 = ["onUpdate:modelValue", "onChange"];
7180
- const _hoisted_8$3 = { class: "actions" };
7181
- const _hoisted_9$3 = /* @__PURE__ */ createTextVNode(" + ");
7182
- const _hoisted_10$3 = /* @__PURE__ */ createTextVNode(" - ");
7217
+ const _hoisted_7$3 = { class: "actions" };
7218
+ const _hoisted_8$3 = /* @__PURE__ */ createTextVNode(" + ");
7219
+ const _hoisted_9$3 = /* @__PURE__ */ createTextVNode(" - ");
7183
7220
  const _sfc_main$b = {
7184
7221
  props: {
7185
7222
  annotations: {
@@ -7231,6 +7268,7 @@ const _sfc_main$b = {
7231
7268
  emitAnnotationUpdate(idx, { values });
7232
7269
  };
7233
7270
  const handleDisplayChange = (annotation, display) => {
7271
+ console.log("dsfsdfsdf", display);
7234
7272
  const idx = props.annotations.indexOf(annotation);
7235
7273
  if (idx < 0)
7236
7274
  return;
@@ -7296,13 +7334,11 @@ const _sfc_main$b = {
7296
7334
  }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"])) : createCommentVNode("", true)
7297
7335
  ]),
7298
7336
  createElementVNode("td", null, [
7299
- withDirectives(createElementVNode("input", {
7300
- type: "checkbox",
7337
+ createVNode(Checkbox, {
7338
+ modelValue: annotation.display,
7301
7339
  "onUpdate:modelValue": ($event) => annotation.display = $event,
7302
- onChange: ($event) => handleDisplayChange(annotation, $event.target.checked)
7303
- }, null, 40, _hoisted_7$3), [
7304
- [vModelCheckbox, annotation.display]
7305
- ])
7340
+ onChange: ($event) => handleDisplayChange(annotation, $event)
7341
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "onChange"])
7306
7342
  ])
7307
7343
  ], 10, _hoisted_4$4);
7308
7344
  }), 128))
@@ -7310,14 +7346,14 @@ const _sfc_main$b = {
7310
7346
  ]),
7311
7347
  _: 1
7312
7348
  }),
7313
- createElementVNode("div", _hoisted_8$3, [
7349
+ createElementVNode("div", _hoisted_7$3, [
7314
7350
  createVNode(Button, {
7315
7351
  small: true,
7316
7352
  onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("addAnnotation")),
7317
7353
  title: "Add annotation"
7318
7354
  }, {
7319
7355
  default: withCtx(() => [
7320
- _hoisted_9$3
7356
+ _hoisted_8$3
7321
7357
  ]),
7322
7358
  _: 1
7323
7359
  }),
@@ -7328,7 +7364,7 @@ const _sfc_main$b = {
7328
7364
  disabled: selected.value == null
7329
7365
  }, {
7330
7366
  default: withCtx(() => [
7331
- _hoisted_10$3
7367
+ _hoisted_9$3
7332
7368
  ]),
7333
7369
  _: 1
7334
7370
  }, 8, ["disabled"])
@@ -7337,7 +7373,7 @@ const _sfc_main$b = {
7337
7373
  };
7338
7374
  }
7339
7375
  };
7340
- var PureAnnotations = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-0abfcc3d"]]);
7376
+ var PureAnnotations = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-72fdca59"]]);
7341
7377
  const _sfc_main$a = {
7342
7378
  setup(__props) {
7343
7379
  const {
@@ -7781,20 +7817,20 @@ function _sfc_render(_ctx, _cache) {
7781
7817
  var Footer = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render], ["__scopeId", "data-v-79b1b506"]]);
7782
7818
  const _sfc_main$2 = {
7783
7819
  props: {
7784
- projectID: {
7785
- type: String,
7820
+ project: {
7821
+ type: Object,
7786
7822
  required: true
7787
7823
  }
7788
7824
  },
7789
7825
  setup(__props) {
7790
7826
  const props = __props;
7791
- const { project, fetchProject, updateProject } = useProject();
7827
+ const { project, setProject, updateProject } = useProject();
7828
+ setProject(props.project);
7792
7829
  const content = ref(project.name);
7793
7830
  const onTitleInput = (event) => {
7794
7831
  content.value = event.currentTarget.textContent;
7795
7832
  updateProject({ name: content.value });
7796
7833
  };
7797
- fetchProject(props.projectID);
7798
7834
  return (_ctx, _cache) => {
7799
7835
  return openBlock(), createBlock(Wrapper, null, {
7800
7836
  default: withCtx(() => [
@@ -7967,4 +8003,4 @@ const _sfc_main = {
7967
8003
  }
7968
8004
  };
7969
8005
  var NewProjectPage = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-34344f58"]]);
7970
- export { Access, _sfc_main$a as Annotations, Autocomplete, Button, _sfc_main$c as Collaborators, _sfc_main$8 as Files, Footer, Header, ImportFilesDialog, Nav, NewProjectPage, ProjectInfo, PureAnnotations, PureCollaborators, PureFiles, Select, Settings, _sfc_main$2 as SettingsPage, Tab, Table, Tabs, TextArea, TextInput, _sfc_main$1 as UserPage, Wrapper };
8006
+ export { Access, _sfc_main$a as Annotations, Autocomplete, Button, Checkbox, _sfc_main$c as Collaborators, _sfc_main$8 as Files, Footer, Header, ImportFilesDialog, Nav, NewProjectPage, ProjectInfo, PureAnnotations, PureCollaborators, PureFiles, Select, Settings, _sfc_main$2 as SettingsPage, Tab, Table, Tabs, TextArea, TextInput, _sfc_main$1 as UserPage, Wrapper };