@threadlabs/looma 0.28.6 → 0.28.8

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 (114) hide show
  1. package/components/ui-editor-block-actions/ui-editor-block-actions.html +20 -0
  2. package/components/ui-editor-block-actions/ui-editor-block-actions.js +14 -0
  3. package/components/ui-editor-image-toolbar/ui-editor-image-toolbar.html +7 -6
  4. package/components/ui-editor-image-toolbar/ui-editor-image-toolbar.js +2 -1
  5. package/components/ui-editor-link-card/ui-editor-link-card.html +57 -0
  6. package/components/ui-editor-link-card/ui-editor-link-card.js +27 -0
  7. package/components/ui-editor-link-form/ui-editor-link-form.html +118 -0
  8. package/components/ui-editor-link-form/ui-editor-link-form.js +71 -0
  9. package/dist/index.js +37 -34
  10. package/package.json +1 -1
  11. package/styles/ui-editor-block-actions.css +1 -0
  12. package/styles/ui-editor-link-card.css +1 -0
  13. package/styles/ui-editor-link-form.css +1 -0
  14. package/vanilla/UiEditorBlockActions.d.ts +16 -0
  15. package/vanilla/UiEditorBlockActions.js +41 -0
  16. package/vanilla/UiEditorImageToolbar.js +1 -1
  17. package/vanilla/UiEditorLinkCard.d.ts +20 -0
  18. package/vanilla/UiEditorLinkCard.js +153 -0
  19. package/vanilla/UiEditorLinkForm.d.ts +32 -0
  20. package/vanilla/UiEditorLinkForm.js +354 -0
  21. package/vanilla/index.js +3 -0
  22. package/vue/UiEditorBlockActions.d.ts +33 -0
  23. package/vue/UiEditorBlockActions.js +2 -0
  24. package/vue/UiEditorBlockActions.vue +125 -0
  25. package/vue/UiEditorImageToolbar.vue +5 -6
  26. package/vue/UiEditorLinkCard.d.ts +58 -0
  27. package/vue/UiEditorLinkCard.js +2 -0
  28. package/vue/UiEditorLinkCard.vue +319 -0
  29. package/vue/UiEditorLinkForm.d.ts +165 -0
  30. package/vue/UiEditorLinkForm.js +2 -0
  31. package/vue/UiEditorLinkForm.vue +557 -0
  32. package/vue/chunks/UiAffordanceScope.js +1 -1
  33. package/vue/chunks/UiAvatar.js +1 -1
  34. package/vue/chunks/UiAvatarGroup.js +1 -1
  35. package/vue/chunks/UiBadge.js +1 -1
  36. package/vue/chunks/UiBreadcrumbItem.js +1 -1
  37. package/vue/chunks/UiBreadcrumbs.js +1 -1
  38. package/vue/chunks/UiButton.js +1 -1
  39. package/vue/chunks/UiCallout.js +1 -1
  40. package/vue/chunks/UiCard.js +1 -1
  41. package/vue/chunks/UiCheckbox.js +1 -1
  42. package/vue/chunks/UiCluster.js +1 -1
  43. package/vue/chunks/UiCombobox.js +1 -1
  44. package/vue/chunks/UiContainer.js +1 -1
  45. package/vue/chunks/UiContextMenu.js +1 -1
  46. package/vue/chunks/UiCover.js +1 -1
  47. package/vue/chunks/UiDescriptionItem.js +1 -1
  48. package/vue/chunks/UiDescriptionList.js +1 -1
  49. package/vue/chunks/UiDialog.js +1 -1
  50. package/vue/chunks/UiDisclosure.js +1 -1
  51. package/vue/chunks/UiEditable.js +1 -1
  52. package/vue/chunks/UiEditorBlockActions.js +127 -0
  53. package/vue/chunks/UiEditorImageToolbar.js +7 -25
  54. package/vue/chunks/UiEditorInsertTableGrid.js +1 -1
  55. package/vue/chunks/UiEditorLinkCard.js +356 -0
  56. package/vue/chunks/UiEditorLinkForm.js +669 -0
  57. package/vue/chunks/UiEditorMentionMenu.js +1 -1
  58. package/vue/chunks/UiEditorMentionMenuItem.js +1 -1
  59. package/vue/chunks/UiEditorSlashMenu.js +1 -1
  60. package/vue/chunks/UiEditorSlashMenuGroup.js +1 -1
  61. package/vue/chunks/UiEditorSlashMenuItem.js +1 -1
  62. package/vue/chunks/UiEditorSurface.js +1 -1
  63. package/vue/chunks/UiEditorTableContextMenu.js +1 -1
  64. package/vue/chunks/UiEditorTableOverlay.js +1 -1
  65. package/vue/chunks/UiEditorTableToolbar.js +1 -1
  66. package/vue/chunks/UiEditorToolbar.js +1 -1
  67. package/vue/chunks/UiFloatingActionButton.js +1 -1
  68. package/vue/chunks/UiFormField.js +1 -1
  69. package/vue/chunks/UiGrid.js +1 -1
  70. package/vue/chunks/UiIcon.js +1 -1
  71. package/vue/chunks/UiIconButton.js +1 -1
  72. package/vue/chunks/UiImage.js +1 -1
  73. package/vue/chunks/UiInput.js +1 -1
  74. package/vue/chunks/UiInputGroup.js +1 -1
  75. package/vue/chunks/UiList.js +1 -1
  76. package/vue/chunks/UiListItem.js +1 -1
  77. package/vue/chunks/UiListbox.js +1 -1
  78. package/vue/chunks/UiMenu.js +1 -1
  79. package/vue/chunks/UiMenuGroup.js +1 -1
  80. package/vue/chunks/UiMenuItem.js +1 -1
  81. package/vue/chunks/UiMeter.js +1 -1
  82. package/vue/chunks/UiNavItem.js +1 -1
  83. package/vue/chunks/UiPageHeader.js +1 -1
  84. package/vue/chunks/UiPopover.js +1 -1
  85. package/vue/chunks/UiRadio.js +1 -1
  86. package/vue/chunks/UiRadioGroup.js +1 -1
  87. package/vue/chunks/UiReel.js +1 -1
  88. package/vue/chunks/UiScrollArea.js +1 -1
  89. package/vue/chunks/UiSearchResultRow.js +1 -1
  90. package/vue/chunks/UiSearchShell.js +1 -1
  91. package/vue/chunks/UiSection.js +1 -1
  92. package/vue/chunks/UiSelect.js +1 -1
  93. package/vue/chunks/UiSeparator.js +1 -1
  94. package/vue/chunks/UiSidebar.js +1 -1
  95. package/vue/chunks/UiSpinner.js +1 -1
  96. package/vue/chunks/UiStack.js +1 -1
  97. package/vue/chunks/UiStatusMessage.js +1 -1
  98. package/vue/chunks/UiSwitch.js +1 -1
  99. package/vue/chunks/UiSwitcher.js +1 -1
  100. package/vue/chunks/UiTable.js +1 -1
  101. package/vue/chunks/UiTabs.js +1 -1
  102. package/vue/chunks/UiText.js +1 -1
  103. package/vue/chunks/UiTextarea.js +1 -1
  104. package/vue/chunks/UiToast.js +1 -1
  105. package/vue/chunks/UiToastRegion.js +1 -1
  106. package/vue/chunks/UiTooltip.js +1 -1
  107. package/vue/chunks/UiTree.js +1 -1
  108. package/vue/chunks/UiTreeItem.js +1 -1
  109. package/vue/chunks/_plugin-vue_export-helper.js +1 -1
  110. package/vue/components.css +2886 -2886
  111. package/vue/editor/index.js +98 -250
  112. package/vue/editor/primitives.d.ts +24 -2
  113. package/vue/index.d.ts +3 -0
  114. package/vue/index.js +8 -5
@@ -1,4 +1,4 @@
1
- import { i as checkHydratedRoot, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useReflectedProp } from "./_plugin-vue_export-helper.js";
1
+ import { i as checkHydratedRoot, p as nativeAttrs, t as _plugin_vue_export_helper_default, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
2
2
  import { a as vPropValidity, n as checkedProp } from "./props.js";
3
3
  import { computed, createElementBlock, defineComponent, mergeProps, openBlock, renderSlot, unref, watchSyncEffect, withDirectives } from "vue";
4
4
  //#region .build/vue/UiCover.vue?vue&type=script&setup=true&lang.ts
@@ -1,4 +1,4 @@
1
- import { i as checkHydratedRoot, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useReflectedProp } from "./_plugin-vue_export-helper.js";
1
+ import { i as checkHydratedRoot, p as nativeAttrs, t as _plugin_vue_export_helper_default, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
2
2
  import { a as vPropValidity, n as checkedProp } from "./props.js";
3
3
  import { computed, createElementBlock, createElementVNode, defineComponent, mergeProps, openBlock, renderSlot, toDisplayString, unref, watchSyncEffect, withDirectives } from "vue";
4
4
  //#region .build/vue/UiDescriptionItem.vue?vue&type=script&setup=true&lang.ts
@@ -1,4 +1,4 @@
1
- import { i as checkHydratedRoot, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useReflectedProp } from "./_plugin-vue_export-helper.js";
1
+ import { i as checkHydratedRoot, p as nativeAttrs, t as _plugin_vue_export_helper_default, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
2
2
  import { a as vPropValidity, n as checkedProp } from "./props.js";
3
3
  import { computed, createElementBlock, defineComponent, mergeProps, openBlock, renderSlot, unref, watchSyncEffect, withDirectives } from "vue";
4
4
  //#region .build/vue/UiDescriptionList.vue?vue&type=script&setup=true&lang.ts
@@ -1,4 +1,4 @@
1
- import { _ as useComponentHost, i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useReflectedProp } from "./_plugin-vue_export-helper.js";
1
+ import { i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useComponentHost, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
2
2
  import { a as vPropValidity, n as checkedProp, r as propValidityState, t as acceptsControllerWrite } from "./props.js";
3
3
  import { t as UiScrollArea_default } from "./UiScrollArea.js";
4
4
  import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, provide, ref, renderSlot, toDisplayString, unref, useTemplateRef, watchSyncEffect, withCtx, withDirectives } from "vue";
@@ -1,4 +1,4 @@
1
- import { _ as useComponentHost, i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useReflectedProp, y as warnUnless } from "./_plugin-vue_export-helper.js";
1
+ import { b as warnUnless, i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useComponentHost, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
2
2
  import { a as vPropValidity, n as checkedProp, r as propValidityState, t as acceptsControllerWrite } from "./props.js";
3
3
  import { computed, createElementBlock, createElementVNode, createTextVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, provide, ref, renderSlot, toDisplayString, unref, useTemplateRef, watchSyncEffect, withDirectives } from "vue";
4
4
  //#region .build/vue/UiDisclosure.vue?vue&type=script&setup=true&lang.ts
@@ -1,4 +1,4 @@
1
- import { _ as useComponentHost, i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useReflectedProp } from "./_plugin-vue_export-helper.js";
1
+ import { i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useComponentHost, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
2
2
  import { a as vPropValidity, n as checkedProp, r as propValidityState, t as acceptsControllerWrite } from "./props.js";
3
3
  import { r as vBindControl } from "./control.js";
4
4
  import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, provide, ref, toDisplayString, unref, useTemplateRef, watchSyncEffect, withDirectives } from "vue";
@@ -0,0 +1,127 @@
1
+ import { i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, v as useComponentHost, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
2
+ import { a as vPropValidity, n as checkedProp, r as propValidityState } from "./props.js";
3
+ import { t as UiMenu_default } from "./UiMenu.js";
4
+ import { t as UiMenuItem_default } from "./UiMenuItem.js";
5
+ import { computed, createElementBlock, createTextVNode, createVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, ref, unref, watchSyncEffect, withCtx, withDirectives } from "vue";
6
+ //#region .build/vue/UiEditorBlockActions.vue?vue&type=script&setup=true&lang.ts
7
+ var _hoisted_1 = ["data-for", "data-placement"];
8
+ //#endregion
9
+ //#region .build/vue/UiEditorBlockActions.vue
10
+ var UiEditorBlockActions_default = /* @__PURE__ */ defineComponent({
11
+ inheritAttrs: false,
12
+ __name: "UiEditorBlockActions",
13
+ props: {
14
+ for: {
15
+ type: null,
16
+ default: ""
17
+ },
18
+ placement: {
19
+ type: null,
20
+ default: "bottom-start"
21
+ }
22
+ },
23
+ emits: ["action"],
24
+ setup(__props, { emit: __emit }) {
25
+ const propValidityContract = { props: {
26
+ for: {
27
+ type: {
28
+ kind: "terminal",
29
+ name: "string"
30
+ },
31
+ required: false,
32
+ target: { attribute: "for" },
33
+ description: "The id of the button that opens the menu and anchors it.",
34
+ default: ""
35
+ },
36
+ placement: {
37
+ type: {
38
+ kind: "terminal",
39
+ name: "keyword"
40
+ },
41
+ required: false,
42
+ target: { attribute: "placement" },
43
+ description: "Where the menu opens beside its button; top-start suits a toolbar docked at the bottom of the screen.",
44
+ values: ["bottom-start", "top-start"],
45
+ default: "bottom-start"
46
+ }
47
+ } };
48
+ const props = __props;
49
+ const acceptedProps = {
50
+ for: "",
51
+ placement: "bottom-start"
52
+ };
53
+ const checkedProps = computed(() => ({
54
+ for: checkedProp(props["for"], {
55
+ kind: "terminal",
56
+ name: "string"
57
+ }, false, "for", acceptedProps),
58
+ placement: checkedProp(props["placement"], {
59
+ kind: "terminal",
60
+ name: "keyword"
61
+ }, false, "placement", acceptedProps)
62
+ }));
63
+ checkedProps.value;
64
+ watchSyncEffect(() => {
65
+ checkedProps.value;
66
+ });
67
+ const reflectedProp = useReflectedProp();
68
+ const hydrationInstance = getCurrentInstance();
69
+ const emit = __emit;
70
+ const root = ref(null);
71
+ checkHydratedRoot("div", "ui-editor-block-actions");
72
+ const isActionDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && (detail["action"] === "insert-below" || detail["action"] === "duplicate" || detail["action"] === "delete") && Object.keys(detail).every((key) => ["action"].includes(key));
73
+ const dispatch = createDispatch(root, emit, { checks: { action: isActionDetail } });
74
+ useComponentHost(() => import("@threadlabs/looma/components/ui-editor-block-actions/ui-editor-block-actions.js"), {
75
+ root,
76
+ dispatch,
77
+ controllerSource: {
78
+ specifier: "../components/ui-editor-block-actions/ui-editor-block-actions.js",
79
+ definition: "./components/ui-editor-block-actions/ui-editor-block-actions.html"
80
+ },
81
+ props: checkedProps,
82
+ propInputs: (name) => {
83
+ const incoming = hydrationInstance?.vnode.props;
84
+ const kebab = name.replace(/[A-Z]/g, (letter) => "-" + letter.toLowerCase());
85
+ return incoming !== null && incoming !== void 0 ? incoming[name] ?? incoming[kebab] ?? null : null;
86
+ },
87
+ propNames: ["for", "placement"],
88
+ propValidity: (name) => propValidityState({
89
+ contract: propValidityContract,
90
+ values: { ...props }
91
+ }, name)
92
+ });
93
+ return (_ctx, _cache) => {
94
+ return withDirectives((openBlock(), createElementBlock("div", mergeProps(unref(nativeAttrs)(_ctx.$attrs), {
95
+ "data-for": unref(reflectedProp)("for", "for", checkedProps.value.for, void 0, false),
96
+ "data-placement": unref(reflectedProp)("placement", "placement", checkedProps.value.placement, void 0, false),
97
+ ref_key: "root",
98
+ ref: root
99
+ }), [createVNode(UiMenu_default, {
100
+ "aria-label": "Block actions",
101
+ for: checkedProps.value.for,
102
+ placement: checkedProps.value.placement
103
+ }, {
104
+ default: withCtx(() => [
105
+ createVNode(UiMenuItem_default, { value: "insert-below" }, {
106
+ default: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode("Insert paragraph below", -1)])]),
107
+ _: 1
108
+ }),
109
+ createVNode(UiMenuItem_default, { value: "duplicate" }, {
110
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("Duplicate block", -1)])]),
111
+ _: 1
112
+ }),
113
+ createVNode(UiMenuItem_default, { value: "delete" }, {
114
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("Delete block", -1)])]),
115
+ _: 1
116
+ })
117
+ ]),
118
+ _: 1
119
+ }, 8, ["for", "placement"])], 16, _hoisted_1)), [[unref(vPropValidity), {
120
+ contract: propValidityContract,
121
+ values: { ...props }
122
+ }]]);
123
+ };
124
+ }
125
+ });
126
+ //#endregion
127
+ export { UiEditorBlockActions_default as t };
@@ -1,4 +1,4 @@
1
- import { _ as useComponentHost, a as concat, i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, v as useReflectedProp } from "./_plugin-vue_export-helper.js";
1
+ import { a as concat, i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, v as useComponentHost, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
2
2
  import { a as vPropValidity, n as checkedProp, r as propValidityState, t as acceptsControllerWrite } from "./props.js";
3
3
  import { t as UiIcon_default } from "./UiIcon.js";
4
4
  import { t as UiButton_default } from "./UiButton.js";
@@ -330,10 +330,7 @@ var UiEditorImageToolbar_default = /* @__PURE__ */ defineComponent({
330
330
  variant: guardedBinding.value,
331
331
  "aria-pressed": guardedBinding2.value
332
332
  }, {
333
- default: withCtx(() => [createVNode(UiIcon_default, {
334
- name: "panel-top",
335
- size: "sm"
336
- })]),
333
+ default: withCtx(() => [createVNode(UiIcon_default, { name: "panel-top" })]),
337
334
  _: 1
338
335
  }, 8, [
339
336
  "id",
@@ -348,10 +345,7 @@ var UiEditorImageToolbar_default = /* @__PURE__ */ defineComponent({
348
345
  variant: guardedBinding4.value,
349
346
  "aria-pressed": guardedBinding5.value
350
347
  }, {
351
- default: withCtx(() => [createVNode(UiIcon_default, {
352
- name: "align-center",
353
- size: "sm"
354
- })]),
348
+ default: withCtx(() => [createVNode(UiIcon_default, { name: "align-center" })]),
355
349
  _: 1
356
350
  }, 8, [
357
351
  "id",
@@ -366,10 +360,7 @@ var UiEditorImageToolbar_default = /* @__PURE__ */ defineComponent({
366
360
  variant: guardedBinding7.value,
367
361
  "aria-pressed": guardedBinding8.value
368
362
  }, {
369
- default: withCtx(() => [createVNode(UiIcon_default, {
370
- name: "panel-left",
371
- size: "sm"
372
- })]),
363
+ default: withCtx(() => [createVNode(UiIcon_default, { name: "panel-left" })]),
373
364
  _: 1
374
365
  }, 8, [
375
366
  "id",
@@ -384,10 +375,7 @@ var UiEditorImageToolbar_default = /* @__PURE__ */ defineComponent({
384
375
  variant: guardedBinding10.value,
385
376
  "aria-pressed": guardedBinding11.value
386
377
  }, {
387
- default: withCtx(() => [createVNode(UiIcon_default, {
388
- name: "panel-right",
389
- size: "sm"
390
- })]),
378
+ default: withCtx(() => [createVNode(UiIcon_default, { name: "panel-right" })]),
391
379
  _: 1
392
380
  }, 8, [
393
381
  "id",
@@ -400,10 +388,7 @@ var UiEditorImageToolbar_default = /* @__PURE__ */ defineComponent({
400
388
  variant: "ghost",
401
389
  id: base.value
402
390
  }, {
403
- default: withCtx(() => [createVNode(UiIcon_default, {
404
- name: "file-text",
405
- size: "sm"
406
- })]),
391
+ default: withCtx(() => [createVNode(UiIcon_default, { name: "file-text" })]),
407
392
  _: 1
408
393
  }, 8, ["id"]),
409
394
  createVNode(UiIconButton_default, {
@@ -413,10 +398,7 @@ var UiEditorImageToolbar_default = /* @__PURE__ */ defineComponent({
413
398
  "data-image-action": "delete",
414
399
  id: guardedBinding12.value
415
400
  }, {
416
- default: withCtx(() => [createVNode(UiIcon_default, {
417
- name: "trash",
418
- size: "sm"
419
- })]),
401
+ default: withCtx(() => [createVNode(UiIcon_default, { name: "trash" })]),
420
402
  _: 1
421
403
  }, 8, ["id"])
422
404
  ]),
@@ -1,4 +1,4 @@
1
- import { _ as useComponentHost, g as uniqueKeys, i as checkHydratedRoot, n as KeyedBoundary, o as createDispatch, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useReflectedProp } from "./_plugin-vue_export-helper.js";
1
+ import { _ as uniqueKeys, i as checkHydratedRoot, n as KeyedBoundary, o as createDispatch, p as nativeAttrs, t as _plugin_vue_export_helper_default, v as useComponentHost, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
2
2
  import { a as vPropValidity, n as checkedProp, r as propValidityState, t as acceptsControllerWrite } from "./props.js";
3
3
  import { r as vBindControl } from "./control.js";
4
4
  import { Fragment, computed, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, mergeProps, normalizeClass, normalizeStyle, openBlock, provide, ref, renderList, toDisplayString, unref, useTemplateRef, watchSyncEffect, withCtx, withDirectives } from "vue";
@@ -0,0 +1,356 @@
1
+ import { a as concat, g as text, i as checkHydratedRoot, o as createDispatch, p as nativeAttrs, s as cycleCheckedComputed, v as useComponentHost, y as useReflectedProp } from "./_plugin-vue_export-helper.js";
2
+ import { a as vPropValidity, n as checkedProp, r as propValidityState, t as acceptsControllerWrite } from "./props.js";
3
+ import { t as UiIcon_default } from "./UiIcon.js";
4
+ import { t as UiButton_default } from "./UiButton.js";
5
+ import { t as UiCard_default } from "./UiCard.js";
6
+ import { t as UiCluster_default } from "./UiCluster.js";
7
+ import { t as UiTooltip_default } from "./UiTooltip.js";
8
+ import { t as UiIconButton_default } from "./UiIconButton.js";
9
+ import { t as UiStack_default } from "./UiStack.js";
10
+ import { t as UiText_default } from "./UiText.js";
11
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, provide, ref, toDisplayString, unref, watchSyncEffect, withCtx, withDirectives } from "vue";
12
+ //#region .build/vue/UiEditorLinkCard.vue?vue&type=script&setup=true&lang.ts
13
+ var _hoisted_1 = [
14
+ "data-detail",
15
+ "data-href",
16
+ "data-label",
17
+ "data-open-href",
18
+ "data-target-label"
19
+ ];
20
+ //#endregion
21
+ //#region .build/vue/UiEditorLinkCard.vue
22
+ var UiEditorLinkCard_default = /* @__PURE__ */ defineComponent({
23
+ inheritAttrs: false,
24
+ __name: "UiEditorLinkCard",
25
+ props: {
26
+ detail: {
27
+ type: null,
28
+ default: ""
29
+ },
30
+ href: {
31
+ type: null,
32
+ default: ""
33
+ },
34
+ label: {
35
+ type: null,
36
+ default: ""
37
+ },
38
+ openHref: {
39
+ type: null,
40
+ default: ""
41
+ },
42
+ targetLabel: {
43
+ type: null,
44
+ default: "Item"
45
+ }
46
+ },
47
+ emits: ["edit", "remove"],
48
+ setup(__props, { emit: __emit }) {
49
+ const propValidityContract = { props: {
50
+ detail: {
51
+ type: {
52
+ kind: "terminal",
53
+ name: "string"
54
+ },
55
+ required: false,
56
+ target: { attribute: "detail" },
57
+ description: "A second line under the label, such as where the destination lives.",
58
+ default: ""
59
+ },
60
+ href: {
61
+ type: {
62
+ kind: "terminal",
63
+ name: "string"
64
+ },
65
+ required: false,
66
+ target: { attribute: "title" },
67
+ description: "The link's destination, shown when there is no label.",
68
+ default: ""
69
+ },
70
+ label: {
71
+ type: {
72
+ kind: "terminal",
73
+ name: "string"
74
+ },
75
+ required: false,
76
+ target: { attribute: "label" },
77
+ description: "The resolved destination's name, such as a page title, shown in place of the address.",
78
+ default: ""
79
+ },
80
+ openHref: {
81
+ type: {
82
+ kind: "terminal",
83
+ name: "string"
84
+ },
85
+ required: false,
86
+ target: { attribute: "href" },
87
+ description: "The address Open link opens in a new tab; without it the card offers no Open link. The editor passes the destination only when it is an http, https,\n mailto, tel, or relative address.",
88
+ default: ""
89
+ },
90
+ targetLabel: {
91
+ type: {
92
+ kind: "terminal",
93
+ name: "string"
94
+ },
95
+ required: false,
96
+ target: { attribute: "targetlabel" },
97
+ description: "What a resolved destination is called, as in \"Page: Guide\" for a screen reader.",
98
+ default: "Item"
99
+ }
100
+ } };
101
+ const props = __props;
102
+ const acceptedProps = {
103
+ detail: "",
104
+ href: "",
105
+ label: "",
106
+ openHref: "",
107
+ targetLabel: "Item"
108
+ };
109
+ const checkedProps = computed(() => ({
110
+ detail: checkedProp(props["detail"], {
111
+ kind: "terminal",
112
+ name: "string"
113
+ }, false, "detail", acceptedProps),
114
+ href: checkedProp(props["href"], {
115
+ kind: "terminal",
116
+ name: "string"
117
+ }, false, "href", acceptedProps),
118
+ label: checkedProp(props["label"], {
119
+ kind: "terminal",
120
+ name: "string"
121
+ }, false, "label", acceptedProps),
122
+ openHref: checkedProp(props["openHref"], {
123
+ kind: "terminal",
124
+ name: "string"
125
+ }, false, "openHref", acceptedProps),
126
+ targetLabel: checkedProp(props["targetLabel"], {
127
+ kind: "terminal",
128
+ name: "string"
129
+ }, false, "targetLabel", acceptedProps)
130
+ }));
131
+ checkedProps.value;
132
+ watchSyncEffect(() => {
133
+ checkedProps.value;
134
+ });
135
+ const reflectedProp = useReflectedProp();
136
+ const hydrationInstance = getCurrentInstance();
137
+ const emit = __emit;
138
+ const root = ref(null);
139
+ const base = ref("ui-editor-link-card");
140
+ const resolved = cycleCheckedComputed(() => checkedProps.value.label !== "");
141
+ let shownPrevious = null;
142
+ const shown = cycleCheckedComputed(() => {
143
+ const next = ((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
144
+ true: checkedProps.value.label,
145
+ false: checkedProps.value.href
146
+ }, concat(resolved.value));
147
+ if (next === Symbol.for("html-next.invalid-result")) return shownPrevious;
148
+ return shownPrevious = next;
149
+ });
150
+ let guardedPrevious = null;
151
+ const guarded = computed(() => {
152
+ const candidate = ((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
153
+ true: "file-text",
154
+ false: "link"
155
+ }, concat(resolved.value));
156
+ if (candidate === Symbol.for("html-next.invalid-result")) return guardedPrevious;
157
+ return guardedPrevious = candidate;
158
+ });
159
+ let guardedBindingPrevious = null;
160
+ const guardedBinding = computed(() => {
161
+ const candidate = concat(((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
162
+ true: checkedProps.value.targetLabel,
163
+ false: "URL"
164
+ }, concat(resolved.value)), ": ", shown.value);
165
+ if (candidate === Symbol.for("html-next.invalid-result")) return guardedBindingPrevious;
166
+ return guardedBindingPrevious = candidate;
167
+ });
168
+ let guardedBinding2Previous = null;
169
+ const guardedBinding2 = computed(() => {
170
+ const candidate = concat(base.value, "-open");
171
+ if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding2Previous;
172
+ return guardedBinding2Previous = candidate;
173
+ });
174
+ let guardedBinding3Previous = null;
175
+ const guardedBinding3 = computed(() => {
176
+ const candidate = concat(base.value, "-open");
177
+ if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding3Previous;
178
+ return guardedBinding3Previous = candidate;
179
+ });
180
+ let guardedBinding4Previous = null;
181
+ const guardedBinding4 = computed(() => {
182
+ const candidate = concat(base.value, "-edit");
183
+ if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding4Previous;
184
+ return guardedBinding4Previous = candidate;
185
+ });
186
+ let guardedBinding5Previous = null;
187
+ const guardedBinding5 = computed(() => {
188
+ const candidate = concat(base.value, "-edit");
189
+ if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding5Previous;
190
+ return guardedBinding5Previous = candidate;
191
+ });
192
+ let guardedBinding6Previous = null;
193
+ const guardedBinding6 = computed(() => {
194
+ const candidate = concat(base.value, "-remove");
195
+ if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding6Previous;
196
+ return guardedBinding6Previous = candidate;
197
+ });
198
+ let guardedBinding7Previous = null;
199
+ const guardedBinding7 = computed(() => {
200
+ const candidate = concat(base.value, "-remove");
201
+ if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding7Previous;
202
+ return guardedBinding7Previous = candidate;
203
+ });
204
+ provide("html-next:ui-editor-link-card:base", base);
205
+ checkHydratedRoot("div", "ui-editor-link-card");
206
+ const isEditDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && Object.values(detail).every((item) => true);
207
+ const dispatch = createDispatch(root, emit, { checks: {
208
+ edit: isEditDetail,
209
+ remove: isEditDetail
210
+ } });
211
+ useComponentHost(() => import("@threadlabs/looma/components/ui-editor-link-card/ui-editor-link-card.js"), {
212
+ root,
213
+ dispatch,
214
+ acceptsState: (name, keys, value) => acceptsControllerWrite(value, { base: {
215
+ kind: "terminal",
216
+ name: "string"
217
+ } }[name], keys),
218
+ controllerSource: {
219
+ specifier: "../components/ui-editor-link-card/ui-editor-link-card.js",
220
+ definition: "./components/ui-editor-link-card/ui-editor-link-card.html"
221
+ },
222
+ props: checkedProps,
223
+ propInputs: (name) => {
224
+ const incoming = hydrationInstance?.vnode.props;
225
+ const kebab = name.replace(/[A-Z]/g, (letter) => "-" + letter.toLowerCase());
226
+ return incoming !== null && incoming !== void 0 ? incoming[name] ?? incoming[kebab] ?? null : null;
227
+ },
228
+ propNames: [
229
+ "detail",
230
+ "href",
231
+ "label",
232
+ "openHref",
233
+ "targetLabel"
234
+ ],
235
+ propValidity: (name) => propValidityState({
236
+ contract: propValidityContract,
237
+ values: { ...props }
238
+ }, name),
239
+ state: { base },
240
+ computed: {
241
+ resolved,
242
+ shown
243
+ }
244
+ });
245
+ return (_ctx, _cache) => {
246
+ return withDirectives((openBlock(), createElementBlock("div", mergeProps(unref(nativeAttrs)(_ctx.$attrs), {
247
+ "data-detail": unref(reflectedProp)("detail", "detail", checkedProps.value.detail, void 0, false),
248
+ "data-href": unref(reflectedProp)("href", "href", checkedProps.value.href, void 0, false),
249
+ "data-label": unref(reflectedProp)("label", "label", checkedProps.value.label, void 0, false),
250
+ "data-open-href": unref(reflectedProp)("openHref", "open-href", checkedProps.value.openHref, void 0, false),
251
+ "data-target-label": unref(reflectedProp)("targetLabel", "target-label", checkedProps.value.targetLabel, void 0, false),
252
+ ref_key: "root",
253
+ ref: root
254
+ }), [createVNode(UiCard_default, {
255
+ variant: "elevated",
256
+ padding: "xs",
257
+ size: "content"
258
+ }, {
259
+ default: withCtx(() => [createVNode(UiCluster_default, {
260
+ gap: "xs",
261
+ wrap: "nowrap",
262
+ role: "group",
263
+ "aria-label": "Link actions"
264
+ }, {
265
+ default: withCtx(() => [
266
+ createVNode(UiIcon_default, { name: guarded.value }, null, 8, ["name"]),
267
+ createVNode(UiStack_default, {
268
+ gap: "none",
269
+ title: checkedProps.value.href,
270
+ "aria-label": guardedBinding.value
271
+ }, {
272
+ default: withCtx(() => [createVNode(UiText_default, {
273
+ as: "strong",
274
+ size: "sm",
275
+ weight: "medium",
276
+ font: "sans",
277
+ wrap: "anywhere"
278
+ }, {
279
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(text)(unref(shown))), 1)]),
280
+ _: 1
281
+ }), checkedProps.value.detail !== "" ? (openBlock(), createBlock(UiText_default, {
282
+ key: 0,
283
+ as: "small",
284
+ size: "xs",
285
+ tone: "secondary",
286
+ font: "sans"
287
+ }, {
288
+ default: withCtx(() => [createTextVNode(toDisplayString(checkedProps.value.detail), 1)]),
289
+ _: 1
290
+ })) : createCommentVNode("v-if", true)]),
291
+ _: 1
292
+ }, 8, ["title", "aria-label"]),
293
+ checkedProps.value.openHref !== "" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(UiButton_default, {
294
+ as: "a",
295
+ variant: "ghost",
296
+ tone: "neutral",
297
+ size: "sm",
298
+ target: "_blank",
299
+ rel: "noopener noreferrer",
300
+ "aria-label": "Open link",
301
+ id: guardedBinding2.value,
302
+ href: checkedProps.value.openHref
303
+ }, {
304
+ default: withCtx(() => [createVNode(UiCluster_default, {
305
+ gap: "xs",
306
+ wrap: "nowrap"
307
+ }, {
308
+ default: withCtx(() => [createVNode(UiIcon_default, { name: "external-link" }), _cache[0] || (_cache[0] = createTextVNode("Open link", -1))]),
309
+ _: 1
310
+ })]),
311
+ _: 1
312
+ }, 8, ["id", "href"]), createVNode(UiTooltip_default, { for: guardedBinding3.value }, {
313
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("Open link", -1)])]),
314
+ _: 1
315
+ }, 8, ["for"])], 64)) : createCommentVNode("v-if", true),
316
+ createVNode(UiIconButton_default, {
317
+ label: "Edit link",
318
+ variant: "ghost",
319
+ size: "sm",
320
+ "data-link-action": "edit",
321
+ id: guardedBinding4.value
322
+ }, {
323
+ default: withCtx(() => [createVNode(UiIcon_default, { name: "pencil" })]),
324
+ _: 1
325
+ }, 8, ["id"]),
326
+ createVNode(UiTooltip_default, { for: guardedBinding5.value }, {
327
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("Edit link", -1)])]),
328
+ _: 1
329
+ }, 8, ["for"]),
330
+ createVNode(UiIconButton_default, {
331
+ label: "Remove link",
332
+ variant: "ghost",
333
+ size: "sm",
334
+ "data-link-action": "remove",
335
+ id: guardedBinding6.value
336
+ }, {
337
+ default: withCtx(() => [createVNode(UiIcon_default, { name: "unlink" })]),
338
+ _: 1
339
+ }, 8, ["id"]),
340
+ createVNode(UiTooltip_default, { for: guardedBinding7.value }, {
341
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("Remove link", -1)])]),
342
+ _: 1
343
+ }, 8, ["for"])
344
+ ]),
345
+ _: 1
346
+ })]),
347
+ _: 1
348
+ })], 16, _hoisted_1)), [[unref(vPropValidity), {
349
+ contract: propValidityContract,
350
+ values: { ...props }
351
+ }]]);
352
+ };
353
+ }
354
+ });
355
+ //#endregion
356
+ export { UiEditorLinkCard_default as t };