@threadlabs/looma 0.23.21 → 0.23.23

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.
Files changed (54) hide show
  1. package/components/shared/overlay.js +1 -1
  2. package/components/ui-button/ui-button.html +68 -2
  3. package/components/ui-image/ui-image.html +177 -0
  4. package/components/ui-image/ui-image.js +107 -0
  5. package/components/ui-menu/ui-menu.js +1 -1
  6. package/components/ui-popover/ui-popover.js +4 -1
  7. package/components/ui-separator/ui-separator.html +26 -2
  8. package/dist/index.js +24 -23
  9. package/editor/chunks/extensions.js +633 -20
  10. package/editor/extensions/block-selection.d.ts +6 -0
  11. package/editor/extensions/expand.d.ts +31 -0
  12. package/editor/extensions/image.d.ts +12 -0
  13. package/editor/extensions/index.d.ts +4 -1
  14. package/editor/extensions/index.js +2 -2
  15. package/editor/extensions/preset.d.ts +8 -0
  16. package/editor/extensions/slash-command.d.ts +31 -3
  17. package/editor/extensions/table-of-contents.d.ts +58 -0
  18. package/editor/index.js +2 -2
  19. package/package.json +1 -1
  20. package/styles/ui-button.css +39 -0
  21. package/styles/ui-image.css +153 -0
  22. package/styles/ui-separator.css +22 -2
  23. package/vanilla/UiButton.d.ts +1 -1
  24. package/vanilla/UiButton.js +126 -10
  25. package/vanilla/UiImage.d.ts +21 -0
  26. package/vanilla/UiImage.js +84 -0
  27. package/vanilla/UiSeparator.d.ts +3 -0
  28. package/vanilla/UiSeparator.js +14 -4
  29. package/vanilla/index.js +1 -0
  30. package/vue/UiButton.d.ts +18 -6
  31. package/vue/UiButton.vue +269 -8
  32. package/vue/UiImage.d.ts +100 -0
  33. package/vue/UiImage.js +2 -0
  34. package/vue/UiImage.vue +463 -0
  35. package/vue/UiListItem.d.ts +1 -1
  36. package/vue/UiSection.d.ts +1 -1
  37. package/vue/UiSeparator.d.ts +27 -0
  38. package/vue/UiSeparator.vue +94 -3
  39. package/vue/UiSidebar.d.ts +1 -1
  40. package/vue/chunks/UiButton.js +196 -12
  41. package/vue/chunks/UiImage.js +313 -0
  42. package/vue/chunks/UiSeparator.js +106 -22
  43. package/vue/components.css +252 -53
  44. package/vue/editor/LoomaEditor.d.ts +19 -2
  45. package/vue/editor/divider.d.ts +6 -0
  46. package/vue/editor/expand.d.ts +7 -0
  47. package/vue/editor/image-controls.d.ts +19 -0
  48. package/vue/editor/image-delivery.d.ts +2 -2
  49. package/vue/editor/image.d.ts +7 -0
  50. package/vue/editor/index.d.ts +1 -1
  51. package/vue/editor/index.js +1188 -52
  52. package/vue/editor/table-of-contents.d.ts +7 -0
  53. package/vue/index.d.ts +1 -0
  54. package/vue/index.js +2 -1
@@ -1,8 +1,9 @@
1
1
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
2
  import { n as preserveRootFocus, r as useComponentHost, t as createDispatch } from "./host.js";
3
3
  import { i as vPropValidity, n as propValidityState, t as checkedProp } from "./props.js";
4
+ import { t as UiIcon_default } from "./UiIcon.js";
4
5
  import { t as UiSpinner_default } from "./UiSpinner.js";
5
- import { computed, createCommentVNode, createElementBlock, createVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, renderSlot, unref, useTemplateRef, watchSyncEffect, withDirectives } from "vue";
6
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, renderSlot, unref, useTemplateRef, watchSyncEffect, withDirectives } from "vue";
6
7
  //#region .build/vue/UiButton.vue?vue&type=script&setup=true&lang.ts
7
8
  var _hoisted_1 = [
8
9
  "href",
@@ -27,11 +28,61 @@ var _hoisted_1 = [
27
28
  "data-variant",
28
29
  "data-ui-button-state"
29
30
  ];
30
- var _hoisted_2 = {
31
+ var _hoisted_2 = { class: "card-icon" };
32
+ var _hoisted_3 = { class: "card-content" };
33
+ var _hoisted_4 = { class: "card-action" };
34
+ var _hoisted_5 = [
35
+ "type",
36
+ "disabled",
37
+ "aria-disabled",
38
+ "aria-busy",
39
+ "data-align",
40
+ "data-as",
41
+ "data-disabled",
42
+ "data-href",
43
+ "data-loading",
44
+ "data-pending",
45
+ "data-rel",
46
+ "data-shape",
47
+ "data-size",
48
+ "data-stretch",
49
+ "data-target",
50
+ "data-tone",
51
+ "data-type",
52
+ "data-variant",
53
+ "data-ui-button-state"
54
+ ];
55
+ var _hoisted_6 = { class: "card-icon" };
56
+ var _hoisted_7 = { class: "card-content" };
57
+ var _hoisted_8 = { class: "card-action" };
58
+ var _hoisted_9 = [
59
+ "href",
60
+ "target",
61
+ "rel",
62
+ "aria-disabled",
63
+ "aria-busy",
64
+ "tabindex",
65
+ "data-align",
66
+ "data-as",
67
+ "data-disabled",
68
+ "data-href",
69
+ "data-loading",
70
+ "data-pending",
71
+ "data-rel",
72
+ "data-shape",
73
+ "data-size",
74
+ "data-stretch",
75
+ "data-target",
76
+ "data-tone",
77
+ "data-type",
78
+ "data-variant",
79
+ "data-ui-button-state"
80
+ ];
81
+ var _hoisted_10 = {
31
82
  key: 0,
32
83
  class: "spinner-wrap"
33
84
  };
34
- var _hoisted_3 = [
85
+ var _hoisted_11 = [
35
86
  "type",
36
87
  "disabled",
37
88
  "aria-disabled",
@@ -52,7 +103,7 @@ var _hoisted_3 = [
52
103
  "data-variant",
53
104
  "data-ui-button-state"
54
105
  ];
55
- var _hoisted_4 = {
106
+ var _hoisted_12 = {
56
107
  key: 0,
57
108
  class: "spinner-wrap"
58
109
  };
@@ -277,13 +328,14 @@ var UiButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
277
328
  },
278
329
  required: false,
279
330
  target: { attribute: "variant" },
280
- description: "Emphasis: how loudly the button asks. solid fills with its tone, outline draws its tone at the edge over a wash of it, ghost carries only text until it is\n hovered, and link is an inline text action that reads as a link. danger is solid in the danger tone, kept for the call sites that name it.",
331
+ description: "Emphasis: how loudly the button asks. solid fills with its tone, outline draws its tone at the edge over a wash of it, ghost carries only text until it is\n hovered, and link is an inline text action that reads as a link. danger is solid in the danger tone, kept for the call sites that name it. card uses the\n same tone on a full-width action with an icon slot, wrapping content, and a centered action slot.",
281
332
  values: [
282
333
  "outline",
283
334
  "solid",
284
335
  "danger",
285
336
  "ghost",
286
- "link"
337
+ "link",
338
+ "card"
287
339
  ],
288
340
  default: "outline"
289
341
  }
@@ -438,8 +490,64 @@ var UiButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
438
490
  false: null
439
491
  }, concat(checkedProps.value.loading || checkedProps.value.pending)));
440
492
  });
493
+ let guardedBinding4Previous = null;
494
+ const guardedBinding4 = computed(() => {
495
+ if (((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
496
+ true: null,
497
+ false: checkedProps.value.href
498
+ }, concat(checkedProps.value.disabled || checkedProps.value.loading || checkedProps.value.pending)) === Symbol.for("html-next.invalid-result")) return guardedBinding4Previous;
499
+ return guardedBinding4Previous = attribute(((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
500
+ true: null,
501
+ false: checkedProps.value.href
502
+ }, concat(checkedProps.value.disabled || checkedProps.value.loading || checkedProps.value.pending)));
503
+ });
504
+ let guardedBinding5Previous = null;
505
+ const guardedBinding5 = computed(() => {
506
+ if (((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
507
+ true: "true",
508
+ false: null
509
+ }, concat(checkedProps.value.disabled || checkedProps.value.loading || checkedProps.value.pending)) === Symbol.for("html-next.invalid-result")) return guardedBinding5Previous;
510
+ return guardedBinding5Previous = typeof ((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
511
+ true: "true",
512
+ false: null
513
+ }, concat(checkedProps.value.disabled || checkedProps.value.loading || checkedProps.value.pending)) === "boolean" ? String(((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
514
+ true: "true",
515
+ false: null
516
+ }, concat(checkedProps.value.disabled || checkedProps.value.loading || checkedProps.value.pending))) : attribute(((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
517
+ true: "true",
518
+ false: null
519
+ }, concat(checkedProps.value.disabled || checkedProps.value.loading || checkedProps.value.pending)));
520
+ });
521
+ let guardedBinding6Previous = null;
522
+ const guardedBinding6 = computed(() => {
523
+ if (((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
524
+ true: "0",
525
+ false: null
526
+ }, concat((checkedProps.value.loading || checkedProps.value.pending) && !checkedProps.value.disabled)) === Symbol.for("html-next.invalid-result")) return guardedBinding6Previous;
527
+ return guardedBinding6Previous = attribute(((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
528
+ true: "0",
529
+ false: null
530
+ }, concat((checkedProps.value.loading || checkedProps.value.pending) && !checkedProps.value.disabled)));
531
+ });
532
+ let guardedBinding7Previous = null;
533
+ const guardedBinding7 = computed(() => {
534
+ if (((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
535
+ true: "true",
536
+ false: null
537
+ }, concat(checkedProps.value.loading || checkedProps.value.pending)) === Symbol.for("html-next.invalid-result")) return guardedBinding7Previous;
538
+ return guardedBinding7Previous = typeof ((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
539
+ true: "true",
540
+ false: null
541
+ }, concat(checkedProps.value.loading || checkedProps.value.pending)) === "boolean" ? String(((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
542
+ true: "true",
543
+ false: null
544
+ }, concat(checkedProps.value.loading || checkedProps.value.pending))) : attribute(((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
545
+ true: "true",
546
+ false: null
547
+ }, concat(checkedProps.value.loading || checkedProps.value.pending)));
548
+ });
441
549
  const hydrationNode = hydrationInstance?.vnode.el;
442
- if (typeof window !== "undefined" && hydrationNode != null && (!(hydrationNode instanceof Element) || hydrationNode.localName !== (checkedProps.value.as === "a" ? "a" : "button"))) throw Object.assign(/* @__PURE__ */ new Error("HR005: Server markup for <ui-button> has an incompatible root."), {
550
+ if (typeof window !== "undefined" && hydrationNode != null && (!(hydrationNode instanceof Element) || hydrationNode.localName !== (checkedProps.value.variant === "card" && checkedProps.value.as === "a" ? "a" : checkedProps.value.variant === "card" ? "button" : checkedProps.value.as === "a" ? "a" : "button"))) throw Object.assign(/* @__PURE__ */ new Error("HR005: Server markup for <ui-button> has an incompatible root."), {
443
551
  name: "HtmlDiagnosticError",
444
552
  diagnostic: Object.freeze({
445
553
  code: "HR005",
@@ -512,7 +620,7 @@ var UiButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
512
620
  return values.map((value) => value === null ? "" : String(value)).join("");
513
621
  }
514
622
  return (_ctx, _cache) => {
515
- return checkedProps.value.as === "a" ? withDirectives((openBlock(), createElementBlock("a", mergeProps({
623
+ return checkedProps.value.variant === "card" && checkedProps.value.as === "a" ? withDirectives((openBlock(), createElementBlock("a", mergeProps({
516
624
  key: 0,
517
625
  "data-component": "ui-button"
518
626
  }, nativeAttrs(_ctx.$attrs), {
@@ -538,10 +646,20 @@ var UiButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
538
646
  "data-variant": reflectedProp("variant", "variant", checkedProps.value.variant, void 0, false),
539
647
  "data-ui-button-state": hostState.value || void 0,
540
648
  ref: "@html-next/root"
541
- }), [checkedProps.value.loading || checkedProps.value.pending ? (openBlock(), createElementBlock("span", _hoisted_2, [createVNode(UiSpinner_default, { size: "sm" })])) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_1)), [[unref(vPropValidity), {
649
+ }), [
650
+ createElementVNode("span", _hoisted_2, [checkedProps.value.loading || checkedProps.value.pending ? (openBlock(), createBlock(UiSpinner_default, {
651
+ key: 0,
652
+ size: "sm"
653
+ })) : createCommentVNode("v-if", true), !(checkedProps.value.loading || checkedProps.value.pending) ? renderSlot(_ctx.$slots, "icon", {}, void 0, true, 1) : createCommentVNode("v-if", true)]),
654
+ createElementVNode("span", _hoisted_3, [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
655
+ createElementVNode("span", _hoisted_4, [renderSlot(_ctx.$slots, "action", {}, () => [createVNode(UiIcon_default, {
656
+ name: "chevron-right",
657
+ "aria-hidden": "true"
658
+ })], true)])
659
+ ], 16, _hoisted_1)), [[unref(vPropValidity), {
542
660
  contract: propValidityContract,
543
661
  values: { ...props }
544
- }]]) : withDirectives((openBlock(), createElementBlock("button", mergeProps({
662
+ }]]) : checkedProps.value.variant === "card" ? withDirectives((openBlock(), createElementBlock("button", mergeProps({
545
663
  key: 1,
546
664
  "data-component": "ui-button"
547
665
  }, nativeAttrs(_ctx.$attrs), {
@@ -565,12 +683,78 @@ var UiButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
565
683
  "data-variant": reflectedProp("variant", "variant", checkedProps.value.variant, void 0, false),
566
684
  "data-ui-button-state": hostState.value || void 0,
567
685
  ref: "@html-next/root"
568
- }), [checkedProps.value.loading || checkedProps.value.pending ? (openBlock(), createElementBlock("span", _hoisted_4, [createVNode(UiSpinner_default, { size: "sm" })])) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_3)), [[unref(vPropValidity), {
686
+ }), [
687
+ createElementVNode("span", _hoisted_6, [checkedProps.value.loading || checkedProps.value.pending ? (openBlock(), createBlock(UiSpinner_default, {
688
+ key: 0,
689
+ size: "sm"
690
+ })) : createCommentVNode("v-if", true), !(checkedProps.value.loading || checkedProps.value.pending) ? renderSlot(_ctx.$slots, "icon", {}, void 0, true, 1) : createCommentVNode("v-if", true)]),
691
+ createElementVNode("span", _hoisted_7, [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
692
+ createElementVNode("span", _hoisted_8, [renderSlot(_ctx.$slots, "action", {}, () => [createVNode(UiIcon_default, {
693
+ name: "chevron-right",
694
+ "aria-hidden": "true"
695
+ })], true)])
696
+ ], 16, _hoisted_5)), [[unref(vPropValidity), {
697
+ contract: propValidityContract,
698
+ values: { ...props }
699
+ }]]) : checkedProps.value.as === "a" ? withDirectives((openBlock(), createElementBlock("a", mergeProps({
700
+ key: 2,
701
+ "data-component": "ui-button"
702
+ }, nativeAttrs(_ctx.$attrs), {
703
+ href: guardedBinding4.value,
704
+ target: checkedProps.value.target ?? void 0,
705
+ rel: checkedProps.value.rel ?? void 0,
706
+ "aria-disabled": guardedBinding5.value,
707
+ "aria-busy": checkedProps.value.loading || checkedProps.value.pending,
708
+ tabindex: guardedBinding6.value,
709
+ "data-align": reflectedProp("align", "align", checkedProps.value.align, void 0, false),
710
+ "data-as": reflectedProp("as", "as", checkedProps.value.as, void 0, false),
711
+ "data-disabled": reflectedProp("disabled", "disabled", checkedProps.value.disabled, void 0, false),
712
+ "data-href": reflectedProp("href", "href", checkedProps.value.href, void 0, false),
713
+ "data-loading": reflectedProp("loading", "loading", checkedProps.value.loading, void 0, false),
714
+ "data-pending": reflectedProp("pending", "pending", checkedProps.value.pending, void 0, false),
715
+ "data-rel": reflectedProp("rel", "rel", checkedProps.value.rel, void 0, false),
716
+ "data-shape": reflectedProp("shape", "shape", checkedProps.value.shape, void 0, false),
717
+ "data-size": reflectedProp("size", "size", checkedProps.value.size, void 0, false),
718
+ "data-stretch": reflectedProp("stretch", "stretch", checkedProps.value.stretch, void 0, false),
719
+ "data-target": reflectedProp("target", "target", checkedProps.value.target, void 0, false),
720
+ "data-tone": reflectedProp("tone", "tone", checkedProps.value.tone, void 0, false),
721
+ "data-type": reflectedProp("type", "type", checkedProps.value.type, void 0, false),
722
+ "data-variant": reflectedProp("variant", "variant", checkedProps.value.variant, void 0, false),
723
+ "data-ui-button-state": hostState.value || void 0,
724
+ ref: "@html-next/root"
725
+ }), [checkedProps.value.loading || checkedProps.value.pending ? (openBlock(), createElementBlock("span", _hoisted_10, [createVNode(UiSpinner_default, { size: "sm" })])) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_9)), [[unref(vPropValidity), {
726
+ contract: propValidityContract,
727
+ values: { ...props }
728
+ }]]) : withDirectives((openBlock(), createElementBlock("button", mergeProps({
729
+ key: 3,
730
+ "data-component": "ui-button"
731
+ }, nativeAttrs(_ctx.$attrs), {
732
+ type: checkedProps.value.type ?? void 0,
733
+ disabled: checkedProps.value.disabled ?? void 0,
734
+ "aria-disabled": guardedBinding7.value,
735
+ "aria-busy": checkedProps.value.loading || checkedProps.value.pending,
736
+ "data-align": reflectedProp("align", "align", checkedProps.value.align, void 0, false),
737
+ "data-as": reflectedProp("as", "as", checkedProps.value.as, void 0, false),
738
+ "data-disabled": reflectedProp("disabled", "disabled", checkedProps.value.disabled, void 0, false),
739
+ "data-href": reflectedProp("href", "href", checkedProps.value.href, void 0, false),
740
+ "data-loading": reflectedProp("loading", "loading", checkedProps.value.loading, void 0, false),
741
+ "data-pending": reflectedProp("pending", "pending", checkedProps.value.pending, void 0, false),
742
+ "data-rel": reflectedProp("rel", "rel", checkedProps.value.rel, void 0, false),
743
+ "data-shape": reflectedProp("shape", "shape", checkedProps.value.shape, void 0, false),
744
+ "data-size": reflectedProp("size", "size", checkedProps.value.size, void 0, false),
745
+ "data-stretch": reflectedProp("stretch", "stretch", checkedProps.value.stretch, void 0, false),
746
+ "data-target": reflectedProp("target", "target", checkedProps.value.target, void 0, false),
747
+ "data-tone": reflectedProp("tone", "tone", checkedProps.value.tone, void 0, false),
748
+ "data-type": reflectedProp("type", "type", checkedProps.value.type, void 0, false),
749
+ "data-variant": reflectedProp("variant", "variant", checkedProps.value.variant, void 0, false),
750
+ "data-ui-button-state": hostState.value || void 0,
751
+ ref: "@html-next/root"
752
+ }), [checkedProps.value.loading || checkedProps.value.pending ? (openBlock(), createElementBlock("span", _hoisted_12, [createVNode(UiSpinner_default, { size: "sm" })])) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_11)), [[unref(vPropValidity), {
569
753
  contract: propValidityContract,
570
754
  values: { ...props }
571
755
  }]]);
572
756
  };
573
757
  }
574
- }), [["__scopeId", "data-v-07b59e63"]]);
758
+ }), [["__scopeId", "data-v-e0bdc48b"]]);
575
759
  //#endregion
576
760
  export { UiButton_default as t };
@@ -0,0 +1,313 @@
1
+ import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
+ import { r as useComponentHost, t as createDispatch } from "./host.js";
3
+ import { i as vPropValidity, n as propValidityState, t as checkedProp } from "./props.js";
4
+ import { computed, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, ref, renderSlot, unref, useTemplateRef, watchSyncEffect, withDirectives } from "vue";
5
+ //#region .build/vue/UiImage.vue?vue&type=script&setup=true&lang.ts
6
+ var _hoisted_1 = [
7
+ "data-alt",
8
+ "data-height",
9
+ "data-placement",
10
+ "data-resizable",
11
+ "data-selected",
12
+ "data-src",
13
+ "data-width",
14
+ "data-ui-image-state"
15
+ ];
16
+ var _hoisted_2 = {
17
+ class: "frame",
18
+ ref: "frame"
19
+ };
20
+ var _hoisted_3 = [
21
+ "src",
22
+ "alt",
23
+ "width",
24
+ "height"
25
+ ];
26
+ var _hoisted_4 = ["hidden"];
27
+ //#endregion
28
+ //#region .build/vue/UiImage.vue
29
+ var UiImage_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30
+ inheritAttrs: false,
31
+ __name: "UiImage",
32
+ props: {
33
+ alt: {
34
+ type: null,
35
+ default: ""
36
+ },
37
+ height: {
38
+ type: null,
39
+ default: null
40
+ },
41
+ placement: {
42
+ type: null,
43
+ default: "block"
44
+ },
45
+ resizable: {
46
+ type: null,
47
+ default: false
48
+ },
49
+ selected: {
50
+ type: null,
51
+ default: false
52
+ },
53
+ src: {
54
+ type: null,
55
+ default: ""
56
+ },
57
+ width: {
58
+ type: null,
59
+ default: null
60
+ }
61
+ },
62
+ emits: [
63
+ "update:height",
64
+ "update:width",
65
+ "resize"
66
+ ],
67
+ setup(__props, { emit: __emit }) {
68
+ const propValidityContract = { props: {
69
+ alt: {
70
+ type: {
71
+ kind: "terminal",
72
+ name: "string"
73
+ },
74
+ required: false,
75
+ target: { attribute: "alt" },
76
+ description: "A text alternative for the image.",
77
+ default: ""
78
+ },
79
+ height: {
80
+ type: {
81
+ kind: "terminal",
82
+ name: "integer"
83
+ },
84
+ required: false,
85
+ target: { attribute: "height" },
86
+ description: "Image height in CSS pixels; resizing preserves the intrinsic aspect ratio."
87
+ },
88
+ placement: {
89
+ type: {
90
+ kind: "terminal",
91
+ name: "keyword"
92
+ },
93
+ required: false,
94
+ target: { attribute: "placement" },
95
+ description: "Block keeps text below; center centers the image; wrap-left and wrap-right let following text flow beside it.",
96
+ values: [
97
+ "block",
98
+ "center",
99
+ "wrap-left",
100
+ "wrap-right"
101
+ ],
102
+ default: "block"
103
+ },
104
+ resizable: {
105
+ type: {
106
+ kind: "terminal",
107
+ name: "boolean"
108
+ },
109
+ required: false,
110
+ target: { attribute: "resizable" },
111
+ description: "Shows four corner handles while selected. Drag to resize, or focus a handle and use arrow keys; Shift uses a larger increment.",
112
+ default: false
113
+ },
114
+ selected: {
115
+ type: {
116
+ kind: "terminal",
117
+ name: "boolean"
118
+ },
119
+ required: false,
120
+ target: { attribute: "selected" },
121
+ description: "Outlines the media as the current selection.",
122
+ default: false
123
+ },
124
+ src: {
125
+ type: {
126
+ kind: "terminal",
127
+ name: "string"
128
+ },
129
+ required: false,
130
+ target: { attribute: "src" },
131
+ description: "The image source, used by the default media.",
132
+ default: ""
133
+ },
134
+ width: {
135
+ type: {
136
+ kind: "terminal",
137
+ name: "integer"
138
+ },
139
+ required: false,
140
+ target: { attribute: "width" },
141
+ description: "Image width in CSS pixels; omitted uses intrinsic size in block/center placement or responsive sizing when wrapping."
142
+ }
143
+ } };
144
+ const props = __props;
145
+ const acceptedProps = {
146
+ alt: "",
147
+ height: null,
148
+ placement: "block",
149
+ resizable: false,
150
+ selected: false,
151
+ src: "",
152
+ width: null
153
+ };
154
+ const checkedProps = computed(() => ({
155
+ alt: checkedProp(props["alt"], {
156
+ kind: "terminal",
157
+ name: "string"
158
+ }, false, "alt", acceptedProps),
159
+ height: checkedProp(props["height"], {
160
+ kind: "terminal",
161
+ name: "integer"
162
+ }, false, "height", acceptedProps),
163
+ placement: checkedProp(props["placement"], {
164
+ kind: "terminal",
165
+ name: "keyword"
166
+ }, false, "placement", acceptedProps),
167
+ resizable: checkedProp(props["resizable"], {
168
+ kind: "terminal",
169
+ name: "boolean"
170
+ }, false, "resizable", acceptedProps),
171
+ selected: checkedProp(props["selected"], {
172
+ kind: "terminal",
173
+ name: "boolean"
174
+ }, false, "selected", acceptedProps),
175
+ src: checkedProp(props["src"], {
176
+ kind: "terminal",
177
+ name: "string"
178
+ }, false, "src", acceptedProps),
179
+ width: checkedProp(props["width"], {
180
+ kind: "terminal",
181
+ name: "integer"
182
+ }, false, "width", acceptedProps)
183
+ }));
184
+ checkedProps.value;
185
+ watchSyncEffect(() => {
186
+ checkedProps.value;
187
+ });
188
+ function nativeAttrs(attrs) {
189
+ const names = Object.keys(attrs);
190
+ if (!names.some((name) => Object.hasOwn(Object.prototype, name))) return attrs;
191
+ return Object.fromEntries(names.map((name) => [Object.hasOwn(Object.prototype, name) ? name === "__proto__" ? "__Proto__" : name[0].toUpperCase() + name.slice(1) : name, attrs[name]]));
192
+ }
193
+ const componentInstance = getCurrentInstance();
194
+ function reflectedProp(name, kebab, value, fallback, bound, separator) {
195
+ const incoming = componentInstance?.vnode.props;
196
+ if (!bound && (incoming === null || incoming === void 0 || !Object.hasOwn(incoming, name) && !Object.hasOwn(incoming, kebab))) return fallback;
197
+ if (value === null || value === void 0) return void 0;
198
+ return Array.isArray(value) && separator !== void 0 ? value.join(separator) : typeof value === "object" ? JSON.stringify(value) : String(value);
199
+ }
200
+ const hydrationInstance = getCurrentInstance();
201
+ const emit = __emit;
202
+ const root = ref(null);
203
+ const frameElement = useTemplateRef("frame");
204
+ const hydrationNode = hydrationInstance?.vnode.el;
205
+ if (typeof window !== "undefined" && hydrationNode != null && (!(hydrationNode instanceof Element) || hydrationNode.localName !== "figure")) throw Object.assign(/* @__PURE__ */ new Error("HR005: Server markup for <ui-image> has an incompatible root."), {
206
+ name: "HtmlDiagnosticError",
207
+ diagnostic: Object.freeze({
208
+ code: "HR005",
209
+ message: "Server markup for <ui-image> has an incompatible root."
210
+ })
211
+ });
212
+ /** The values the styles' :host-state() rules test. */
213
+ const hostState = computed(() => [
214
+ checkedProps.value.placement && "placement",
215
+ checkedProps.value.placement != null && `placement=${encodeURIComponent(checkedProps.value.placement)}`,
216
+ checkedProps.value.selected && "selected"
217
+ ].filter(Boolean).join(" "));
218
+ const isResizeDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && Number.isInteger(detail["width"]) && Number.isInteger(detail["height"]) && (detail["phase"] === "preview" || detail["phase"] === "commit" || detail["phase"] === "cancel") && (detail["trigger"] === "pointer" || detail["trigger"] === "keyboard") && Object.keys(detail).every((key) => [
219
+ "width",
220
+ "height",
221
+ "phase",
222
+ "trigger"
223
+ ].includes(key));
224
+ const dispatch = createDispatch(root, emit, {
225
+ checks: { resize: isResizeDetail },
226
+ modeled: ["height", "width"]
227
+ });
228
+ useComponentHost(() => import("@threadlabs/looma/components/ui-image/ui-image.js"), {
229
+ root,
230
+ dispatch,
231
+ controllerSource: {
232
+ specifier: "../components/ui-image/ui-image.js",
233
+ definition: "./components/ui-image/ui-image.html"
234
+ },
235
+ props: checkedProps,
236
+ propInputs: (name) => {
237
+ const incoming = hydrationInstance?.vnode.props;
238
+ const kebab = name.replace(/[A-Z]/g, (letter) => "-" + letter.toLowerCase());
239
+ return incoming !== null && incoming !== void 0 ? incoming[name] ?? incoming[kebab] ?? null : null;
240
+ },
241
+ propNames: [
242
+ "alt",
243
+ "height",
244
+ "placement",
245
+ "resizable",
246
+ "selected",
247
+ "src",
248
+ "width"
249
+ ],
250
+ propValidity: (name) => propValidityState({
251
+ contract: propValidityContract,
252
+ values: { ...props }
253
+ }, name),
254
+ refs: { frame: frameElement }
255
+ });
256
+ return (_ctx, _cache) => {
257
+ return withDirectives((openBlock(), createElementBlock("figure", mergeProps({ "data-component": "ui-image" }, nativeAttrs(_ctx.$attrs), {
258
+ "data-alt": reflectedProp("alt", "alt", checkedProps.value.alt, void 0, false),
259
+ "data-height": reflectedProp("height", "height", checkedProps.value.height, void 0, false),
260
+ "data-placement": reflectedProp("placement", "placement", checkedProps.value.placement, void 0, false),
261
+ "data-resizable": reflectedProp("resizable", "resizable", checkedProps.value.resizable, void 0, false),
262
+ "data-selected": reflectedProp("selected", "selected", checkedProps.value.selected, void 0, false),
263
+ "data-src": reflectedProp("src", "src", checkedProps.value.src, void 0, false),
264
+ "data-width": reflectedProp("width", "width", checkedProps.value.width, void 0, false),
265
+ "data-ui-image-state": hostState.value || void 0,
266
+ ref_key: "root",
267
+ ref: root
268
+ }), [createElementVNode("div", _hoisted_2, [
269
+ renderSlot(_ctx.$slots, "media", {}, () => [createElementVNode("img", {
270
+ src: checkedProps.value.src ?? void 0,
271
+ alt: checkedProps.value.alt ?? void 0,
272
+ width: checkedProps.value.width ?? void 0,
273
+ height: checkedProps.value.height ?? void 0
274
+ }, null, 8, _hoisted_3)]),
275
+ createElementVNode("div", {
276
+ class: "handles",
277
+ hidden: !(checkedProps.value.selected && checkedProps.value.resizable)
278
+ }, [..._cache[0] || (_cache[0] = [
279
+ createElementVNode("button", {
280
+ type: "button",
281
+ class: "handle",
282
+ "data-corner": "top-left",
283
+ "aria-label": "Resize image from top left"
284
+ }, null, -1),
285
+ createElementVNode("button", {
286
+ type: "button",
287
+ class: "handle",
288
+ "data-corner": "top-right",
289
+ "aria-label": "Resize image from top right"
290
+ }, null, -1),
291
+ createElementVNode("button", {
292
+ type: "button",
293
+ class: "handle",
294
+ "data-corner": "bottom-left",
295
+ "aria-label": "Resize image from bottom left"
296
+ }, null, -1),
297
+ createElementVNode("button", {
298
+ type: "button",
299
+ class: "handle",
300
+ "data-corner": "bottom-right",
301
+ "aria-label": "Resize image from bottom right"
302
+ }, null, -1)
303
+ ])], 8, _hoisted_4),
304
+ renderSlot(_ctx.$slots, "controls")
305
+ ], 512)], 16, _hoisted_1)), [[unref(vPropValidity), {
306
+ contract: propValidityContract,
307
+ values: { ...props }
308
+ }]]);
309
+ };
310
+ }
311
+ }), [["__scopeId", "data-v-2895fbac"]]);
312
+ //#endregion
313
+ export { UiImage_default as t };