@verbb/plugin-kit-web 2.0.26 → 2.0.27
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/CHANGELOG.md +5 -0
- package/custom-elements.json +27 -0
- package/dist/chunks/{pk-tiptap-content-DmS_2EUi.js → pk-tiptap-content-5UcUhLeB.js} +5 -2
- package/dist/chunks/pk-tiptap-content-5UcUhLeB.js.map +1 -0
- package/dist/chunks/{pk-tiptap-editor-DLHbQRCW.js → pk-tiptap-editor-C7tOOMC0.js} +5 -2
- package/dist/chunks/pk-tiptap-editor-C7tOOMC0.js.map +1 -0
- package/dist/chunks/{pk-tiptap-input-asrD-8W6.js → pk-tiptap-input-B8faxeqa.js} +5 -2
- package/dist/chunks/pk-tiptap-input-B8faxeqa.js.map +1 -0
- package/dist/chunks/{tiptap.styles-Cwb_cj9g.js → tiptap.styles-CUvGoddW.js} +72 -8
- package/dist/chunks/tiptap.styles-CUvGoddW.js.map +1 -0
- package/dist/components/tiptap/index.d.ts +1 -0
- package/dist/components/tiptap/index.d.ts.map +1 -1
- package/dist/components/tiptap/pk-tiptap-content.d.ts +3 -0
- package/dist/components/tiptap/pk-tiptap-content.d.ts.map +1 -1
- package/dist/components/tiptap/pk-tiptap-content.js +1 -1
- package/dist/components/tiptap/pk-tiptap-editor.d.ts +3 -0
- package/dist/components/tiptap/pk-tiptap-editor.d.ts.map +1 -1
- package/dist/components/tiptap/pk-tiptap-editor.js +1 -1
- package/dist/components/tiptap/pk-tiptap-input.d.ts +3 -0
- package/dist/components/tiptap/pk-tiptap-input.d.ts.map +1 -1
- package/dist/components/tiptap/pk-tiptap-input.js +1 -1
- package/dist/components/tiptap/tiptap.styles.d.ts.map +1 -1
- package/dist/components/tiptap/variable-tag-node-view.d.ts +7 -0
- package/dist/components/tiptap/variable-tag-node-view.d.ts.map +1 -1
- package/dist/components/tiptap-content.js +1 -1
- package/dist/components/tiptap-editor.js +1 -1
- package/dist/components/tiptap-input.js +1 -1
- package/dist/index.js +3 -3
- package/dist/register.js +3 -3
- package/dist-loader/chunks/{tiptap.styles-CZUkf2K6.js → tiptap.styles-CJqK0Wft.js} +71 -7
- package/dist-loader/components/tiptap/tiptap-content.js +4 -1
- package/dist-loader/components/tiptap/tiptap-editor.js +4 -1
- package/dist-loader/components/tiptap/tiptap-input.js +4 -1
- package/package.json +7 -7
- package/dist/chunks/pk-tiptap-content-DmS_2EUi.js.map +0 -1
- package/dist/chunks/pk-tiptap-editor-DLHbQRCW.js.map +0 -1
- package/dist/chunks/pk-tiptap-input-asrD-8W6.js.map +0 -1
- package/dist/chunks/tiptap.styles-Cwb_cj9g.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiptap.styles-CUvGoddW.js","names":[],"sources":["../../src/components/tiptap/variable-tag-node-view.ts","../../src/components/tiptap/tiptap.styles.ts"],"sourcesContent":["import type { Editor, NodeViewRenderer, NodeViewRendererProps } from '@tiptap/core';\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model';\nimport { uniqueId } from '../../a11y/focus.js';\n\n/** Match kit v1 VariableTagView chip chrome (indigo + remove). */\nconst REMOVE_ICON = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 10 10\" width=\"10\" height=\"10\" aria-hidden=\"true\" focusable=\"false\">\n <path fill=\"currentColor\" d=\"M2.1 1.4 5 4.3l2.9-2.9.7.7L5.7 5l2.9 2.9-.7.7L5 5.7l-2.9 2.9-.7-.7L4.3 5 1.4 2.1z\"/>\n</svg>\n`.trim();\n\nexport const PK_VARIABLE_TAG_CONFIGURE_EVENT = 'pk-variable-tag-configure';\n\n/** Transform metadata grouped by value type, supplied by the consuming application. */\nexport type PkVariableTransformerRegistry = Record<string, readonly { id: string; label?: string }[]>;\n\nconst PRESENTATION_CHANGE_EVENT = 'pk-variable-tag-presentation-change';\n\n/** Refresh labels without changing the editor document or its selection. */\nexport function refreshVariableTagPresentation(host: HTMLElement): void {\n host.dispatchEvent(new Event(PRESENTATION_CHANGE_EVENT));\n}\n\nexport type PkVariableTagConfigureDetail = {\n editor: Editor;\n anchor: HTMLElement;\n attrs: Record<string, unknown>;\n getPos: () => number | undefined;\n updateAttributes: (attributes: Record<string, unknown>) => void;\n deleteNode: () => void;\n};\n\nconst findTiptapHost = (viewDom: HTMLElement): HTMLElement | null => {\n let node: Node | null = viewDom;\n while (node) {\n if (node instanceof HTMLElement && node.localName.startsWith('pk-tiptap')) {\n return node;\n }\n\n node = node.parentNode instanceof ShadowRoot\n ? node.parentNode.host\n : node.parentNode;\n }\n\n return null;\n};\n\nconst emitConfigure = (\n editor: Editor,\n detail: PkVariableTagConfigureDetail,\n) => {\n const viewDom = editor.view.dom;\n const host = findTiptapHost(viewDom);\n\n // Preferred bridge for React/Formie: property callback on <pk-tiptap-*>.\n const configure = host && 'variableTagConfigure' in host\n ? (host as HTMLElement & {\n variableTagConfigure?: ((detail: PkVariableTagConfigureDetail) => void) | null;\n }).variableTagConfigure\n : null;\n\n if (typeof configure === 'function') {\n configure(detail);\n }\n\n // Composed event is the reliable Formie path (document capture listener).\n const target = host ?? viewDom;\n target.dispatchEvent(new CustomEvent(PK_VARIABLE_TAG_CONFIGURE_EVENT, {\n bubbles: true,\n composed: true,\n detail,\n }));\n};\n\n/**\n * DOM NodeViewRendererProps do NOT include React's `deleteNode` / `updateAttributes`\n * (those live on NodeViewProps for ReactNodeViewRenderer only). Build them from\n * editor + getPos — same operations ReactNodeViewRenderer wires for VariableTagView.\n */\nfunction createNodeViewCommands(\n editor: Editor,\n getPos: NodeViewRendererProps['getPos'],\n) {\n const resolvePos = (): number | undefined => {\n const pos = typeof getPos === 'function' ? getPos() : getPos;\n return typeof pos === 'number' ? pos : undefined;\n };\n\n const deleteNode = () => {\n const pos = resolvePos();\n if (typeof pos !== 'number') {\n return;\n }\n\n const live = editor.state.doc.nodeAt(pos);\n if (!live || live.type.name !== 'variableTag') {\n return;\n }\n\n editor\n .chain()\n .focus()\n .deleteRange({ from: pos, to: pos + live.nodeSize })\n .run();\n };\n\n const updateAttributes = (attributes: Record<string, unknown>) => {\n const pos = resolvePos();\n if (typeof pos !== 'number') {\n return;\n }\n\n const live = editor.state.doc.nodeAt(pos);\n if (!live || live.type.name !== 'variableTag') {\n return;\n }\n\n editor\n .chain()\n .command(({ tr, dispatch }) => {\n if (dispatch) {\n tr.setNodeMarkup(pos, undefined, {\n ...live.attrs,\n ...attributes,\n });\n }\n return true;\n })\n .run();\n };\n\n return { deleteNode, updateAttributes, resolvePos };\n}\n\n/**\n * DOM node view for variable tags in vanilla editors.\n * Chip + remove match kit v1; configure UI is opened via `pk-variable-tag-configure`\n * (Formie mounts the edit overlay beside the WC editor).\n */\nexport function createVariableTagDomNodeView(): NodeViewRenderer {\n return (props) => {\n const { editor, getPos } = props;\n const { deleteNode, updateAttributes, resolvePos } = createNodeViewCommands(editor, getPos);\n\n let currentNode: ProseMirrorNode = props.node;\n\n const host = findTiptapHost(props.view.dom);\n\n const syncPresentation = (attrs: Record<string, unknown>) => {\n const unresolved = Boolean(attrs.unresolved);\n const token = String(attrs.value ?? '');\n const chipLabel = String(attrs.label || attrs.value || '');\n\n dom.classList.toggle('pk-variable-tag--unresolved', unresolved);\n if (unresolved) {\n dom.dataset.unresolved = 'true';\n // Extra context for AT — not HTML title (avoids native hover tooltip).\n const description = token\n ? `Unknown or missing reference — ${token}`\n : 'Unknown or missing reference';\n dom.setAttribute('aria-description', description);\n label.setAttribute('aria-invalid', 'true');\n } else {\n delete dom.dataset.unresolved;\n dom.removeAttribute('aria-description');\n label.removeAttribute('aria-invalid');\n }\n\n labelText.textContent = chipLabel;\n\n const transformerId = String(attrs.transformerId ?? '').trim();\n const registry = (host as (HTMLElement & {\n variableTransformerRegistry?: PkVariableTransformerRegistry;\n }) | null)?.variableTransformerRegistry ?? {};\n const transformer = Object.values(registry)\n .flat()\n .find((entry) => entry.id === transformerId);\n transformBadge.textContent = transformer?.label || transformerId;\n transformBadge.hidden = !transformerId;\n if (transformerId) {\n transformBadge.setAttribute('aria-label', `Transform: ${transformBadge.textContent}`);\n } else {\n transformBadge.removeAttribute('aria-label');\n }\n\n defaultMarker.hidden = String(attrs.default ?? '').trim() === '';\n };\n\n const dom = document.createElement('span');\n dom.className = 'pk-variable-tag';\n dom.id = uniqueId('pk-variable-tag');\n dom.setAttribute('contenteditable', 'false');\n // Do NOT set draggable=true permanently — HTML5-draggable hosts suppress click,\n // which kills configure. ProseMirror sets draggable temporarily on mousedown drag.\n // TipTap React node views use data-drag-handle on a TipTap NodeView class; keep the\n // attr for parity, but drag itself is PM's selectable+draggable atom behavior.\n dom.setAttribute('data-drag-handle', '');\n dom.dataset.label = String(currentNode.attrs.label ?? '');\n dom.dataset.variableValue = String(currentNode.attrs.value ?? '');\n\n // Match kit v1 VariableTagView: real button for activate.\n const label = document.createElement('button');\n label.type = 'button';\n label.className = 'pk-variable-tag__label';\n label.draggable = false;\n const labelText = document.createElement('span');\n labelText.className = 'pk-variable-tag__text';\n const transformBadge = document.createElement('span');\n transformBadge.className = 'pk-variable-tag__transform';\n const defaultMarker = document.createElement('span');\n defaultMarker.className = 'pk-variable-tag__default';\n defaultMarker.setAttribute('role', 'img');\n defaultMarker.setAttribute('aria-label', 'Has default value');\n label.append(defaultMarker, labelText, transformBadge);\n dom.append(label);\n syncPresentation(currentNode.attrs);\n\n // Registry labels can arrive after hydration; refresh chrome without rewriting tokens.\n const refreshPresentation = () => syncPresentation(currentNode.attrs);\n host?.addEventListener(PRESENTATION_CHANGE_EVENT, refreshPresentation);\n\n let removeButton: HTMLButtonElement | null = null;\n let openOnInsertHandled = false;\n let openedAt = 0;\n\n const readLiveAttrs = () => {\n const pos = resolvePos();\n if (typeof pos === 'number') {\n const live = editor.state.doc.nodeAt(pos);\n if (live?.type.name === 'variableTag') {\n return { ...live.attrs };\n }\n }\n\n return { ...currentNode.attrs };\n };\n\n const openConfigure = () => {\n if (!editor.isEditable) {\n return;\n }\n\n // Dedupe repeated emits from nested handlers / openOnInsert.\n const now = Date.now();\n if (now - openedAt < 300) {\n return;\n }\n openedAt = now;\n\n // Strip any HTML5-draggable PM may have armed so configure stays clickable\n // after this interaction (draggable hosts suppress subsequent clicks).\n dom.removeAttribute('draggable');\n\n emitConfigure(editor, {\n editor,\n anchor: dom,\n attrs: readLiveAttrs(),\n getPos: resolvePos,\n updateAttributes,\n deleteNode,\n });\n };\n\n // Open on pointerdown — before ProseMirror can arm HTML5 drag on the atom.\n label.addEventListener('pointerdown', (event) => {\n if (event.button !== 0) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n openConfigure();\n });\n label.addEventListener('click', (event) => {\n event.preventDefault();\n event.stopPropagation();\n openConfigure();\n });\n\n const syncRemoveButton = (editable: boolean) => {\n if (editable) {\n if (removeButton) {\n return;\n }\n\n removeButton = document.createElement('button');\n removeButton.type = 'button';\n removeButton.className = 'pk-variable-tag__remove';\n removeButton.setAttribute('aria-label', 'Remove');\n removeButton.draggable = false;\n removeButton.innerHTML = REMOVE_ICON;\n removeButton.addEventListener('pointerdown', (event) => {\n event.preventDefault();\n event.stopPropagation();\n });\n removeButton.addEventListener('click', (event) => {\n event.preventDefault();\n event.stopPropagation();\n deleteNode();\n });\n dom.append(removeButton);\n return;\n }\n\n removeButton?.remove();\n removeButton = null;\n };\n\n syncRemoveButton(editor.isEditable);\n\n if (currentNode.attrs.openOnInsert && editor.isEditable && !openOnInsertHandled) {\n openOnInsertHandled = true;\n queueMicrotask(() => {\n updateAttributes({ openOnInsert: false });\n openConfigure();\n });\n }\n\n return {\n dom,\n destroy: () => host?.removeEventListener(PRESENTATION_CHANGE_EVENT, refreshPresentation),\n // TipTap React node views stop PM from handling events inside the chip —\n // that prevents `draggable=true` arming, which otherwise kills configure.\n // Drag still works via outer NodeSelection + data-drag-handle when the\n // pointer starts on the chip chrome (not the label/remove controls).\n stopEvent: (event) => {\n const target = event.target as Node | null;\n if (!(target instanceof Element)) {\n return false;\n }\n\n return Boolean(\n target.closest('.pk-variable-tag__label')\n || target.closest('.pk-variable-tag__remove'),\n );\n },\n selectNode: () => {\n dom.classList.add('ProseMirror-selectednode');\n // Never keep HTML5-draggable while selected — it suppresses clicks.\n dom.removeAttribute('draggable');\n },\n deselectNode: () => {\n dom.classList.remove('ProseMirror-selectednode');\n dom.removeAttribute('draggable');\n },\n update(updatedNode) {\n if (updatedNode.type.name !== 'variableTag') {\n return false;\n }\n\n currentNode = updatedNode;\n dom.dataset.label = String(updatedNode.attrs.label ?? '');\n dom.dataset.variableValue = String(updatedNode.attrs.value ?? '');\n syncPresentation(updatedNode.attrs);\n syncRemoveButton(editor.isEditable);\n return true;\n },\n };\n };\n}\n","import { css } from 'lit';\n\n/**\n * Indigo chip matching kit v1 VariableTagView (`bg-[#5C6BC0] text-white rounded-[2px]`).\n * Shared by rich editor, single-line input, and read-only content hosts.\n */\nconst variableTagStyles = css`\n .pk-variable-tag {\n position: relative;\n display: inline-flex;\n align-items: stretch;\n max-width: 100%;\n margin-inline: 1px;\n margin-block-start: -3px;\n padding: 0;\n border-radius: 2px;\n background: #5c6bc0;\n color: #fff;\n font-size: 11px;\n font-weight: 400;\n line-height: 1;\n white-space: nowrap;\n vertical-align: middle;\n overflow: hidden;\n cursor: default;\n box-sizing: border-box;\n }\n\n /* Unresolved / missing reference — muted grey (not alarm yellow). */\n .pk-variable-tag--unresolved {\n background: var(--pk-color-gray-100, #f3f4f6);\n color: var(--pk-color-gray-600, #4b5563);\n box-shadow: inset 0 0 0 1px var(--pk-color-gray-300, #d1d5db);\n }\n\n .pk-variable-tag--unresolved.ProseMirror-selectednode {\n box-shadow:\n inset 0 0 0 1px var(--pk-color-gray-400, #9ca3af),\n 0 0 0 2px rgba(156, 163, 175, 0.45);\n }\n\n .pk-variable-tag.ProseMirror-selectednode {\n outline: none;\n box-shadow: 0 0 0 2px rgba(123, 140, 232, 0.5);\n }\n\n .pk-variable-tag__label {\n display: inline-flex;\n align-items: center;\n min-width: 0;\n max-width: 320px;\n margin: 0;\n padding: 4px 5px;\n border: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: inherit;\n line-height: inherit;\n text-align: left;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n user-select: none;\n }\n\n .pk-variable-tag__text {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .pk-variable-tag__transform {\n flex-shrink: 0;\n max-width: 140px;\n margin-inline-start: 4px;\n padding: 1px 3px;\n border-radius: 2px;\n background: rgb(255 255 255 / 20%);\n font-size: 9px;\n line-height: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .pk-variable-tag__default {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n border-top: 8px solid var(--pk-color-orange-400, #fb923c);\n border-right: 8px solid transparent;\n pointer-events: none;\n }\n\n .pk-variable-tag__transform[hidden],\n .pk-variable-tag__default[hidden] {\n display: none;\n }\n\n .pk-variable-tag__remove {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n align-self: stretch;\n margin: 0;\n padding: 4px 5px 4px 4px;\n border: 0;\n background: transparent;\n color: inherit;\n cursor: pointer;\n line-height: 0;\n appearance: none;\n }\n\n /* Keep the configure action's keyboard indicator around the whole chip,\n * while the separate remove action identifies only its own hit area. */\n .pk-variable-tag:has(> .pk-variable-tag__label:focus-visible) {\n /* The transparent outline remains visible in forced-colors mode. */\n outline: 2px solid transparent;\n outline-offset: 2px;\n box-shadow: 0 0 0 3px rgba(123, 140, 232, 0.5);\n }\n\n .pk-variable-tag__label:focus-visible {\n outline: none;\n }\n\n .pk-variable-tag__remove:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: -3px;\n border-radius: 2px;\n }\n\n .pk-variable-tag__remove svg {\n display: block;\n width: 10px;\n height: 10px;\n pointer-events: none;\n }\n`;\n\nexport const tiptapProseMirrorStyles = css`\n @layer pk-component {\n .ProseMirror {\n outline: none;\n min-height: 2rem;\n padding: 1rem;\n background: rgb(251, 252, 254);\n /* Craft CP body text (~gray-700), not gray-900. */\n color: var(--pk-color-gray-700);\n font-family: var(--pk-font-family);\n /* Match pk-input / body (14px). sm (13px) matched field instructions and looked undersized vs v1. */\n font-size: var(--pk-font-size-base);\n line-height: 1.5;\n white-space: pre-wrap;\n box-sizing: border-box;\n }\n\n .ProseMirror p {\n margin: 0 0 0.5rem;\n }\n\n .ProseMirror p:last-child {\n margin-bottom: 0;\n }\n\n .ProseMirror h1 {\n font-size: 1.25rem;\n font-weight: 700;\n margin: 0 0 0.5rem;\n }\n\n .ProseMirror h2 {\n font-size: 1.125rem;\n font-weight: 600;\n margin: 0 0 0.5rem;\n }\n\n .ProseMirror h3,\n .ProseMirror h4,\n .ProseMirror h5,\n .ProseMirror h6 {\n font-weight: 600;\n margin: 0 0 0.5rem;\n }\n\n .ProseMirror a {\n color: var(--pk-color-blue-600);\n text-decoration: underline;\n cursor: pointer;\n }\n\n .ProseMirror ul,\n .ProseMirror ol {\n margin: 0 0 0.5rem;\n padding-left: 1.25rem;\n }\n\n .ProseMirror blockquote {\n margin: 0 0 0.5rem;\n padding-left: 0.75rem;\n border-left: 3px solid var(--pk-color-gray-300);\n color: var(--pk-color-gray-600);\n }\n\n .ProseMirror code {\n font-family: var(--pk-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);\n font-size: var(--pk-font-size-mono, 0.9em);\n line-height: var(--pk-line-height-mono, 1.5);\n background: var(--pk-color-gray-100);\n border-radius: 0.2rem;\n padding: 0.1rem 0.25rem;\n }\n\n .ProseMirror pre {\n margin: 0 0 0.5rem;\n padding: 0.75rem;\n background: var(--pk-color-gray-900);\n color: var(--pk-color-gray-50);\n border-radius: var(--pk-radius-md);\n overflow-x: auto;\n font-family: var(--pk-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);\n font-size: var(--pk-font-size-mono, 0.9em);\n line-height: var(--pk-line-height-mono, 1.5);\n }\n\n ${variableTagStyles}\n }\n`;\n\n/**\n * Single-line TipTap field — same box metrics as `pk-input` .input\n * (14px / line-height 1.4 / padding 6px 8px).\n *\n * ProseMirror always injects `br.ProseMirror-trailingBreak` for the caret.\n * Never `display: none` it — that freezes one-liner docs after the first character.\n * Clip to one line height instead so the break cannot inflate the control.\n */\nexport const tiptapInputProseMirrorStyles = css`\n @layer pk-component {\n .ProseMirror {\n outline: none;\n margin: 0;\n /* Match stock pk-input padding by default. Hosts can override density via\n * --pk-tiptap-input-* (light DOM cannot style .ProseMirror in the shadow tree).\n */\n padding-block: var(--pk-tiptap-input-padding-block, 6px);\n padding-inline-start: var(--pk-tiptap-input-padding-inline-start, 8px);\n padding-inline-end: var(--pk-tiptap-input-padding-inline-end, 8px);\n /* One-liner clip: padding + control line-height (v1 text-sm), not a fixed shell token. */\n height: var(--pk-tiptap-input-height, calc(var(--pk-input-control-line-height, 1.25rem) + 12px));\n max-height: var(--pk-tiptap-input-height, calc(var(--pk-input-control-line-height, 1.25rem) + 12px));\n background: var(--pk-input-bg);\n /* Craft CP body / field value text. */\n color: var(--pk-color-gray-700);\n font-family: var(--pk-font-family);\n font-size: var(--pk-tiptap-input-font-size, var(--pk-font-size-base));\n line-height: var(--pk-tiptap-input-line-height, var(--pk-input-control-line-height, 1.25rem));\n white-space: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n box-sizing: border-box;\n scrollbar-width: none;\n }\n\n .ProseMirror::-webkit-scrollbar {\n display: none;\n }\n\n /* OneLinerDocument is inline-only; keep p inline if a schema ever wraps text. */\n .ProseMirror p {\n margin: 0;\n display: inline;\n line-height: inherit;\n }\n\n /* Read-only display: no input padding/height box (v1 skipped chrome when readOnly).\n * Inherit color/weight so list name links (text-blue-600 font-bold) show through. */\n :host([readonly]) .ProseMirror {\n padding-block: 0;\n padding-inline: 0;\n height: auto;\n max-height: none;\n background: transparent;\n overflow: visible;\n white-space: normal;\n color: inherit;\n font-weight: inherit;\n font-size: inherit;\n }\n\n ${variableTagStyles}\n }\n`;\n\nexport const tiptapContentProseMirrorStyles = css`\n @layer pk-component {\n /* Inherit host color/size so light-DOM wrappers (warning banners, badges)\n can restyle read-only TipTap without piercing the shadow tree. */\n .ProseMirror {\n outline: none;\n color: inherit;\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n }\n\n .ProseMirror p {\n margin: 0;\n }\n\n ${variableTagStyles}\n }\n`;\n"],"mappings":";;;;AAKA,IAAM,cAAc;;;;EAIlB,KAAK;AAEP,IAAa,kCAAkC;AAK/C,IAAM,4BAA4B;;AAGlC,SAAgB,+BAA+B,MAAyB;CACpE,KAAK,cAAc,IAAI,MAAM,yBAAyB,CAAC;AAC3D;AAWA,IAAM,kBAAkB,YAA6C;CACjE,IAAI,OAAoB;CACxB,OAAO,MAAM;EACT,IAAI,gBAAgB,eAAe,KAAK,UAAU,WAAW,WAAW,GACpE,OAAO;EAGX,OAAO,KAAK,sBAAsB,aAC5B,KAAK,WAAW,OAChB,KAAK;CACf;CAEA,OAAO;AACX;AAEA,IAAM,iBACF,QACA,WACC;CACD,MAAM,UAAU,OAAO,KAAK;CAC5B,MAAM,OAAO,eAAe,OAAO;CAGnC,MAAM,YAAY,QAAQ,0BAA0B,OAC7C,KAEA,uBACD;CAEN,IAAI,OAAO,cAAc,YACrB,UAAU,MAAM;CAKpB,CADe,QAAQ,QAAA,CAChB,cAAc,IAAI,YAAY,iCAAiC;EAClE,SAAS;EACT,UAAU;EACV;CACJ,CAAC,CAAC;AACN;;;;;;AAOA,SAAS,uBACL,QACA,QACF;CACE,MAAM,mBAAuC;EACzC,MAAM,MAAM,OAAO,WAAW,aAAa,OAAO,IAAI;EACtD,OAAO,OAAO,QAAQ,WAAW,MAAM,KAAA;CAC3C;CAEA,MAAM,mBAAmB;EACrB,MAAM,MAAM,WAAW;EACvB,IAAI,OAAO,QAAQ,UACf;EAGJ,MAAM,OAAO,OAAO,MAAM,IAAI,OAAO,GAAG;EACxC,IAAI,CAAC,QAAQ,KAAK,KAAK,SAAS,eAC5B;EAGJ,OACK,MAAM,CAAC,CACP,MA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BAAkB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { PkTiptapContent } from './pk-tiptap-content.js';
|
|
2
2
|
export { PkTiptapEditor } from './pk-tiptap-editor.js';
|
|
3
3
|
export { PkTiptapInput } from './pk-tiptap-input.js';
|
|
4
|
+
export type { PkVariableTransformerRegistry } from './variable-tag-node-view.js';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tiptap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tiptap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,YAAY,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
2
|
import { PkElement } from '../../base/pk-element.js';
|
|
3
|
+
import { PkVariableTransformerRegistry } from './variable-tag-node-view.js';
|
|
3
4
|
/**
|
|
4
5
|
* Read-only TipTap / ProseMirror renderer.
|
|
5
6
|
*
|
|
@@ -10,6 +11,8 @@ export declare class PkTiptapContent extends PkElement {
|
|
|
10
11
|
private editorMount;
|
|
11
12
|
private editor;
|
|
12
13
|
value: string;
|
|
14
|
+
/** Transform names displayed as badges on configured variable tags. */
|
|
15
|
+
variableTransformerRegistry: PkVariableTransformerRegistry;
|
|
13
16
|
disconnectedCallback(): void;
|
|
14
17
|
updated(changed: PropertyValues): void;
|
|
15
18
|
firstUpdated(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pk-tiptap-content.d.ts","sourceRoot":"","sources":["../../../src/components/tiptap/pk-tiptap-content.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAO1C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"pk-tiptap-content.d.ts","sourceRoot":"","sources":["../../../src/components/tiptap/pk-tiptap-content.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAO1C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAGH,KAAK,6BAA6B,EACrC,MAAM,6BAA6B,CAAC;AAgBrC;;;;GAIG;AACH,qBACa,eAAgB,SAAQ,SAAS;IAC1C,OAAgB,MAAM,4BAA2D;IAGjF,OAAO,CAAC,WAAW,CAAkB;IAErC,OAAO,CAAC,MAAM,CAAuB;IAGrC,KAAK,SAAM;IAEX,uEAAuE;IAEvE,2BAA2B,EAAE,6BAA6B,CAAM;IAEvD,oBAAoB,IAAI,IAAI;IAM5B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAYtC,YAAY,IAAI,IAAI;IAI7B,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,WAAW;IAgBV,MAAM;CAGlB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,mBAAmB,EAAE,eAAe,CAAC;KACxC;CACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as PkTiptapContent } from "../../chunks/pk-tiptap-content-
|
|
1
|
+
import { t as PkTiptapContent } from "../../chunks/pk-tiptap-content-5UcUhLeB.js";
|
|
2
2
|
export { PkTiptapContent };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
2
|
import { ToolbarNode, TiptapTextStyleToolbarConfig } from '@verbb/plugin-kit-tiptap-core';
|
|
3
3
|
import { PkFormAssociatedElement } from '../../base/pk-form-associated-element.js';
|
|
4
|
+
import { PkVariableTransformerRegistry } from './variable-tag-node-view.js';
|
|
4
5
|
/**
|
|
5
6
|
* TipTap document editor with a Craft-styled toolbar.
|
|
6
7
|
*
|
|
@@ -40,6 +41,8 @@ export declare class PkTiptapEditor extends PkFormAssociatedElement {
|
|
|
40
41
|
placeholder: string;
|
|
41
42
|
readonly: boolean;
|
|
42
43
|
invalid: boolean;
|
|
44
|
+
/** Transform names displayed as badges on configured variable tags. */
|
|
45
|
+
variableTransformerRegistry: PkVariableTransformerRegistry;
|
|
43
46
|
/**
|
|
44
47
|
* Formie / React configure bridge — called when a chip is activated for editing.
|
|
45
48
|
* Prefer this over listening for `pk-variable-tag-configure` from React.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pk-tiptap-editor.d.ts","sourceRoot":"","sources":["../../../src/components/tiptap/pk-tiptap-editor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAE1C,OAAO,EAyBH,KAAK,WAAW,EAEhB,KAAK,4BAA4B,EACpC,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AASnF,OAAO,wBAAwB,CAAC;AAChC,OAAO,4BAA4B,CAAC;AACpC,OAAO,wBAAwB,CAAC;AAChC,OAAO,sCAAsC,CAAC;AAC9C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sBAAsB,CAAC;AAC9B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,sCAAsC,CAAC;AAC9C,OAAO,2CAA2C,CAAC;AACnD,OAAO,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"pk-tiptap-editor.d.ts","sourceRoot":"","sources":["../../../src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,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,iBAAiB;IA4BzB,OAAO,CAAC,uBAAuB;IAM/B,OAAO,CAAC,sBAAsB;IAgB9B,OAAO,CAAC,6BAA6B;IAwCrC,OAAO,CAAC,6BAA6B;IAqCrC,OAAO,CAAC,sBAAsB;IAuD9B,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,yBAAyB;IAiBjC,OAAO,CAAC,kBAAkB;IAqE1B,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,uBAAuB;IAqCtB,MAAM;CAsBlB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,kBAAkB,EAAE,cAAc,CAAC;KACtC;CACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as PkTiptapEditor } from "../../chunks/pk-tiptap-editor-
|
|
1
|
+
import { t as PkTiptapEditor } from "../../chunks/pk-tiptap-editor-C7tOOMC0.js";
|
|
2
2
|
export { PkTiptapEditor };
|
|
@@ -2,6 +2,7 @@ import { PropertyValues } from 'lit';
|
|
|
2
2
|
import { VariableOption } from '@verbb/plugin-kit-tiptap-core';
|
|
3
3
|
import { Editor } from '@tiptap/core';
|
|
4
4
|
import { PkFormAssociatedElement } from '../../base/pk-form-associated-element.js';
|
|
5
|
+
import { PkVariableTransformerRegistry } from './variable-tag-node-view.js';
|
|
5
6
|
/** Category map keyed like Formie / kit v1 (`fieldsVariables`, `formVariables`, …). */
|
|
6
7
|
export type PkTiptapVariableCategories = Record<string, VariableOption[]>;
|
|
7
8
|
export declare class PkTiptapInput extends PkFormAssociatedElement {
|
|
@@ -20,6 +21,8 @@ export declare class PkTiptapInput extends PkFormAssociatedElement {
|
|
|
20
21
|
* Without this, saved field tokens fall back to UID title-casing after reload.
|
|
21
22
|
*/
|
|
22
23
|
variableCategories: PkTiptapVariableCategories;
|
|
24
|
+
/** Transform names displayed as badges on configured variable tags. */
|
|
25
|
+
variableTransformerRegistry: PkVariableTransformerRegistry;
|
|
23
26
|
/**
|
|
24
27
|
* Formie / React configure bridge — called when a chip is activated for editing.
|
|
25
28
|
* Prefer this over listening for `pk-variable-tag-configure` from React.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pk-tiptap-input.d.ts","sourceRoot":"","sources":["../../../src/components/tiptap/pk-tiptap-input.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAMH,KAAK,cAAc,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"pk-tiptap-input.d.ts","sourceRoot":"","sources":["../../../src/components/tiptap/pk-tiptap-input.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAMH,KAAK,cAAc,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAEnF,OAAO,EAGH,KAAK,6BAA6B,EACrC,MAAM,6BAA6B,CAAC;AAIrC,uFAAuF;AACvF,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;AAE1E,qBACa,aAAc,SAAQ,uBAAuB;IAGtD,OAAgB,MAAM,4BAA0E;IAEhG,WAAoB,UAAU,2CAE7B;IAEQ,mBAAmB,WAAqB;IAGjD,OAAO,CAAC,WAAW,CAAkB;IAG5B,KAAK,EAAG,gBAAgB,CAAC;IAElC,OAAO,CAAC,MAAM,CAAuB;IAErC,OAAO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|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap.styles.d.ts","sourceRoot":"","sources":["../../../src/components/tiptap/tiptap.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tiptap.styles.d.ts","sourceRoot":"","sources":["../../../src/components/tiptap/tiptap.styles.ts"],"names":[],"mappings":"AA+IA,eAAO,MAAM,uBAAuB,yBAuFnC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,yBAuDxC,CAAC;AAEF,eAAO,MAAM,8BAA8B,yBAkB1C,CAAC"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Editor, NodeViewRenderer } from '@tiptap/core';
|
|
2
2
|
export declare const PK_VARIABLE_TAG_CONFIGURE_EVENT = "pk-variable-tag-configure";
|
|
3
|
+
/** Transform metadata grouped by value type, supplied by the consuming application. */
|
|
4
|
+
export type PkVariableTransformerRegistry = Record<string, readonly {
|
|
5
|
+
id: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
}[]>;
|
|
8
|
+
/** Refresh labels without changing the editor document or its selection. */
|
|
9
|
+
export declare function refreshVariableTagPresentation(host: HTMLElement): void;
|
|
3
10
|
export type PkVariableTagConfigureDetail = {
|
|
4
11
|
editor: Editor;
|
|
5
12
|
anchor: HTMLElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variable-tag-node-view.d.ts","sourceRoot":"","sources":["../../../src/components/tiptap/variable-tag-node-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAyB,MAAM,cAAc,CAAC;AAWpF,eAAO,MAAM,+BAA+B,8BAA8B,CAAC;AAE3E,MAAM,MAAM,4BAA4B,GAAG;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACjC,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAChE,UAAU,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAwGF;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,gBAAgB,
|
|
1
|
+
{"version":3,"file":"variable-tag-node-view.d.ts","sourceRoot":"","sources":["../../../src/components/tiptap/variable-tag-node-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAyB,MAAM,cAAc,CAAC;AAWpF,eAAO,MAAM,+BAA+B,8BAA8B,CAAC;AAE3E,uFAAuF;AACvF,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAAC;AAItG,4EAA4E;AAC5E,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAEtE;AAED,MAAM,MAAM,4BAA4B,GAAG;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACjC,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAChE,UAAU,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAwGF;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,gBAAgB,CA4N/D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as PkTiptapContent } from "../chunks/pk-tiptap-content-
|
|
1
|
+
import { t as PkTiptapContent } from "../chunks/pk-tiptap-content-5UcUhLeB.js";
|
|
2
2
|
export { PkTiptapContent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as PkTiptapEditor } from "../chunks/pk-tiptap-editor-
|
|
1
|
+
import { t as PkTiptapEditor } from "../chunks/pk-tiptap-editor-C7tOOMC0.js";
|
|
2
2
|
export { PkTiptapEditor };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as PkTiptapInput } from "../chunks/pk-tiptap-input-
|
|
1
|
+
import { t as PkTiptapInput } from "../chunks/pk-tiptap-input-B8faxeqa.js";
|
|
2
2
|
export { PkTiptapInput };
|
package/dist/index.js
CHANGED
|
@@ -97,9 +97,9 @@ import { t as PkOptionGroup } from "./chunks/pk-option-group-D6bHfn0j.js";
|
|
|
97
97
|
import "./components/select.js";
|
|
98
98
|
import "./components/time-picker.js";
|
|
99
99
|
import "./components/spinner.js";
|
|
100
|
-
import { t as PkTiptapContent } from "./chunks/pk-tiptap-content-
|
|
101
|
-
import { t as PkTiptapEditor } from "./chunks/pk-tiptap-editor-
|
|
102
|
-
import { t as PkTiptapInput } from "./chunks/pk-tiptap-input-
|
|
100
|
+
import { t as PkTiptapContent } from "./chunks/pk-tiptap-content-5UcUhLeB.js";
|
|
101
|
+
import { t as PkTiptapEditor } from "./chunks/pk-tiptap-editor-C7tOOMC0.js";
|
|
102
|
+
import { t as PkTiptapInput } from "./chunks/pk-tiptap-input-B8faxeqa.js";
|
|
103
103
|
import { _ as setPortalClassName, a as startLoader, c as setBasePath, d as getPortalClassName, f as getPortalContainer, g as resolvePositionMethod, h as getShadowRootSelectors, i as preventTurboFouce, l as allDefined, m as getPortalTargetForAppend, n as FOUCE_TIMEOUT_MS, o as stopLoader, p as getPortalMountElement, r as discover, s as getBasePath, t as DISCOVERY_COMPLETE_EVENT, u as configurePluginKitWeb, v as setPortalContainer, y as setShadowRootSelectors } from "./chunks/autoloader-DcwybeWc.js";
|
|
104
104
|
import { t as BUNDLER_TAG_IMPORT_PATHS } from "./chunks/component-registry-B5pnAZsb.js";
|
|
105
105
|
import { t as createRegisterComponents } from "./chunks/register-components-CZtpgZe3.js";
|
package/dist/register.js
CHANGED
|
@@ -83,9 +83,9 @@ import { t as PkOptionGroup } from "./chunks/pk-option-group-D6bHfn0j.js";
|
|
|
83
83
|
import "./components/select.js";
|
|
84
84
|
import "./components/time-picker.js";
|
|
85
85
|
import "./components/spinner.js";
|
|
86
|
-
import { t as PkTiptapContent } from "./chunks/pk-tiptap-content-
|
|
87
|
-
import { t as PkTiptapEditor } from "./chunks/pk-tiptap-editor-
|
|
88
|
-
import { t as PkTiptapInput } from "./chunks/pk-tiptap-input-
|
|
86
|
+
import { t as PkTiptapContent } from "./chunks/pk-tiptap-content-5UcUhLeB.js";
|
|
87
|
+
import { t as PkTiptapEditor } from "./chunks/pk-tiptap-editor-C7tOOMC0.js";
|
|
88
|
+
import { t as PkTiptapInput } from "./chunks/pk-tiptap-input-B8faxeqa.js";
|
|
89
89
|
import { t as BUNDLER_TAG_IMPORT_PATHS } from "./chunks/component-registry-B5pnAZsb.js";
|
|
90
90
|
import { t as createRegisterComponents } from "./chunks/register-components-CZtpgZe3.js";
|
|
91
91
|
import "@verbb/plugin-kit-icons/all.js";
|
|
@@ -442,6 +442,11 @@ var REMOVE_ICON = `
|
|
|
442
442
|
</svg>
|
|
443
443
|
`.trim();
|
|
444
444
|
var PK_VARIABLE_TAG_CONFIGURE_EVENT = "pk-variable-tag-configure";
|
|
445
|
+
var PRESENTATION_CHANGE_EVENT = "pk-variable-tag-presentation-change";
|
|
446
|
+
/** Refresh labels without changing the editor document or its selection. */
|
|
447
|
+
function refreshVariableTagPresentation(host) {
|
|
448
|
+
host.dispatchEvent(new Event(PRESENTATION_CHANGE_EVENT));
|
|
449
|
+
}
|
|
445
450
|
var findTiptapHost = (viewDom) => {
|
|
446
451
|
let node = viewDom;
|
|
447
452
|
while (node) {
|
|
@@ -510,7 +515,8 @@ function createVariableTagDomNodeView() {
|
|
|
510
515
|
const { editor, getPos } = props;
|
|
511
516
|
const { deleteNode, updateAttributes, resolvePos } = createNodeViewCommands(editor, getPos);
|
|
512
517
|
let currentNode = props.node;
|
|
513
|
-
const
|
|
518
|
+
const host = findTiptapHost(props.view.dom);
|
|
519
|
+
const syncPresentation = (attrs) => {
|
|
514
520
|
const unresolved = Boolean(attrs.unresolved);
|
|
515
521
|
const token = String(attrs.value ?? "");
|
|
516
522
|
const chipLabel = String(attrs.label || attrs.value || "");
|
|
@@ -525,7 +531,15 @@ function createVariableTagDomNodeView() {
|
|
|
525
531
|
dom.removeAttribute("aria-description");
|
|
526
532
|
label.removeAttribute("aria-invalid");
|
|
527
533
|
}
|
|
528
|
-
|
|
534
|
+
labelText.textContent = chipLabel;
|
|
535
|
+
const transformerId = String(attrs.transformerId ?? "").trim();
|
|
536
|
+
const registry = host?.variableTransformerRegistry ?? {};
|
|
537
|
+
const transformer = Object.values(registry).flat().find((entry) => entry.id === transformerId);
|
|
538
|
+
transformBadge.textContent = transformer?.label || transformerId;
|
|
539
|
+
transformBadge.hidden = !transformerId;
|
|
540
|
+
if (transformerId) transformBadge.setAttribute("aria-label", `Transform: ${transformBadge.textContent}`);
|
|
541
|
+
else transformBadge.removeAttribute("aria-label");
|
|
542
|
+
defaultMarker.hidden = String(attrs.default ?? "").trim() === "";
|
|
529
543
|
};
|
|
530
544
|
const dom = document.createElement("span");
|
|
531
545
|
dom.className = "pk-variable-tag";
|
|
@@ -538,8 +552,19 @@ function createVariableTagDomNodeView() {
|
|
|
538
552
|
label.type = "button";
|
|
539
553
|
label.className = "pk-variable-tag__label";
|
|
540
554
|
label.draggable = false;
|
|
555
|
+
const labelText = document.createElement("span");
|
|
556
|
+
labelText.className = "pk-variable-tag__text";
|
|
557
|
+
const transformBadge = document.createElement("span");
|
|
558
|
+
transformBadge.className = "pk-variable-tag__transform";
|
|
559
|
+
const defaultMarker = document.createElement("span");
|
|
560
|
+
defaultMarker.className = "pk-variable-tag__default";
|
|
561
|
+
defaultMarker.setAttribute("role", "img");
|
|
562
|
+
defaultMarker.setAttribute("aria-label", "Has default value");
|
|
563
|
+
label.append(defaultMarker, labelText, transformBadge);
|
|
541
564
|
dom.append(label);
|
|
542
|
-
|
|
565
|
+
syncPresentation(currentNode.attrs);
|
|
566
|
+
const refreshPresentation = () => syncPresentation(currentNode.attrs);
|
|
567
|
+
host?.addEventListener(PRESENTATION_CHANGE_EVENT, refreshPresentation);
|
|
543
568
|
let removeButton = null;
|
|
544
569
|
let openOnInsertHandled = false;
|
|
545
570
|
let openedAt = 0;
|
|
@@ -611,6 +636,7 @@ function createVariableTagDomNodeView() {
|
|
|
611
636
|
}
|
|
612
637
|
return {
|
|
613
638
|
dom,
|
|
639
|
+
destroy: () => host?.removeEventListener(PRESENTATION_CHANGE_EVENT, refreshPresentation),
|
|
614
640
|
stopEvent: (event) => {
|
|
615
641
|
const target = event.target;
|
|
616
642
|
if (!(target instanceof Element)) return false;
|
|
@@ -629,7 +655,7 @@ function createVariableTagDomNodeView() {
|
|
|
629
655
|
currentNode = updatedNode;
|
|
630
656
|
dom.dataset.label = String(updatedNode.attrs.label ?? "");
|
|
631
657
|
dom.dataset.variableValue = String(updatedNode.attrs.value ?? "");
|
|
632
|
-
|
|
658
|
+
syncPresentation(updatedNode.attrs);
|
|
633
659
|
syncRemoveButton(editor.isEditable);
|
|
634
660
|
return true;
|
|
635
661
|
}
|
|
@@ -640,7 +666,7 @@ function createVariableTagDomNodeView() {
|
|
|
640
666
|
//#region src/components/tiptap/tiptap.styles.ts
|
|
641
667
|
/**
|
|
642
668
|
* Indigo chip matching kit v1 VariableTagView (`bg-[#5C6BC0] text-white rounded-[2px]`).
|
|
643
|
-
* Shared by rich editor
|
|
669
|
+
* Shared by rich editor, single-line input, and read-only content hosts.
|
|
644
670
|
*/
|
|
645
671
|
var variableTagStyles = i`
|
|
646
672
|
.pk-variable-tag {
|
|
@@ -685,7 +711,8 @@ var variableTagStyles = i`
|
|
|
685
711
|
.pk-variable-tag__label {
|
|
686
712
|
display: inline-flex;
|
|
687
713
|
align-items: center;
|
|
688
|
-
|
|
714
|
+
min-width: 0;
|
|
715
|
+
max-width: 320px;
|
|
689
716
|
margin: 0;
|
|
690
717
|
padding: 4px 5px;
|
|
691
718
|
border: 0;
|
|
@@ -701,6 +728,41 @@ var variableTagStyles = i`
|
|
|
701
728
|
user-select: none;
|
|
702
729
|
}
|
|
703
730
|
|
|
731
|
+
.pk-variable-tag__text {
|
|
732
|
+
min-width: 0;
|
|
733
|
+
overflow: hidden;
|
|
734
|
+
text-overflow: ellipsis;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
.pk-variable-tag__transform {
|
|
738
|
+
flex-shrink: 0;
|
|
739
|
+
max-width: 140px;
|
|
740
|
+
margin-inline-start: 4px;
|
|
741
|
+
padding: 1px 3px;
|
|
742
|
+
border-radius: 2px;
|
|
743
|
+
background: rgb(255 255 255 / 20%);
|
|
744
|
+
font-size: 9px;
|
|
745
|
+
line-height: 1;
|
|
746
|
+
overflow: hidden;
|
|
747
|
+
text-overflow: ellipsis;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
.pk-variable-tag__default {
|
|
751
|
+
position: absolute;
|
|
752
|
+
top: 0;
|
|
753
|
+
left: 0;
|
|
754
|
+
width: 0;
|
|
755
|
+
height: 0;
|
|
756
|
+
border-top: 8px solid var(--pk-color-orange-400, #fb923c);
|
|
757
|
+
border-right: 8px solid transparent;
|
|
758
|
+
pointer-events: none;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
.pk-variable-tag__transform[hidden],
|
|
762
|
+
.pk-variable-tag__default[hidden] {
|
|
763
|
+
display: none;
|
|
764
|
+
}
|
|
765
|
+
|
|
704
766
|
.pk-variable-tag__remove {
|
|
705
767
|
display: inline-flex;
|
|
706
768
|
align-items: center;
|
|
@@ -909,7 +971,9 @@ var tiptapContentProseMirrorStyles = i`
|
|
|
909
971
|
.ProseMirror p {
|
|
910
972
|
margin: 0;
|
|
911
973
|
}
|
|
974
|
+
|
|
975
|
+
${variableTagStyles}
|
|
912
976
|
}
|
|
913
977
|
`;
|
|
914
978
|
//#endregion
|
|
915
|
-
export {
|
|
979
|
+
export { refreshVariableTagPresentation as a, createTiptapInputExtensions as c, createVariableTagDomNodeView as i, getRegisteredTiptapToolbarControl as l, tiptapInputProseMirrorStyles as n, resolveTiptapTextStyleToolbarConfig as o, tiptapProseMirrorStyles as r, createTiptapExtensions as s, tiptapContentProseMirrorStyles as t, isRegisteredTiptapToolbarControl as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as e, c as customElement, m as i, p as b, s as n } from "../../chunks/lit-B6nFKgbW.js";
|
|
2
2
|
import { c as __decorate, l as PkElement } from "../../chunks/pk-base-BGegy7-X.js";
|
|
3
3
|
import { A as Editor } from "../../chunks/tiptap-DYSRDaas.js";
|
|
4
|
-
import { i as createVariableTagDomNodeView,
|
|
4
|
+
import { a as refreshVariableTagPresentation, i as createVariableTagDomNodeView, s as createTiptapExtensions, t as tiptapContentProseMirrorStyles } from "../../chunks/tiptap.styles-CJqK0Wft.js";
|
|
5
5
|
import { r as valueToContent } from "../../chunks/editor-CS16rBkM.js";
|
|
6
6
|
//#region src/components/tiptap/pk-tiptap-content.styles.ts
|
|
7
7
|
var pkTiptapContentStyles = i`
|
|
@@ -29,6 +29,7 @@ var PkTiptapContent = class PkTiptapContent extends PkElement {
|
|
|
29
29
|
super(..._args);
|
|
30
30
|
this.editor = null;
|
|
31
31
|
this.value = "";
|
|
32
|
+
this.variableTransformerRegistry = {};
|
|
32
33
|
}
|
|
33
34
|
static {
|
|
34
35
|
this.styles = [pkTiptapContentStyles, tiptapContentProseMirrorStyles];
|
|
@@ -39,6 +40,7 @@ var PkTiptapContent = class PkTiptapContent extends PkElement {
|
|
|
39
40
|
super.disconnectedCallback();
|
|
40
41
|
}
|
|
41
42
|
updated(changed) {
|
|
43
|
+
if (changed.has("variableTransformerRegistry")) refreshVariableTagPresentation(this);
|
|
42
44
|
if (changed.has("value") && this.editor) this.syncContent();
|
|
43
45
|
super.updated(changed);
|
|
44
46
|
}
|
|
@@ -71,6 +73,7 @@ var PkTiptapContent = class PkTiptapContent extends PkElement {
|
|
|
71
73
|
};
|
|
72
74
|
__decorate([e(".editor-mount")], PkTiptapContent.prototype, "editorMount", void 0);
|
|
73
75
|
__decorate([n({ attribute: "value" })], PkTiptapContent.prototype, "value", void 0);
|
|
76
|
+
__decorate([n({ attribute: false })], PkTiptapContent.prototype, "variableTransformerRegistry", void 0);
|
|
74
77
|
PkTiptapContent = __decorate([customElement("pk-tiptap-content")], PkTiptapContent);
|
|
75
78
|
//#endregion
|
|
76
79
|
export { PkTiptapContent };
|
|
@@ -9,7 +9,7 @@ import { t as MirrorValidator } from "../../chunks/mirror-validator-BkZlEv1Z.js"
|
|
|
9
9
|
import "../../chunks/pk-checkbox-DhP0iMoP.js";
|
|
10
10
|
import "../../chunks/pk-input-Cj5s8eBT.js";
|
|
11
11
|
import { A as Editor, N as getMarkRange, P as posToDOMRect } from "../../chunks/tiptap-DYSRDaas.js";
|
|
12
|
-
import { a as
|
|
12
|
+
import { a as refreshVariableTagPresentation, i as createVariableTagDomNodeView, l as getRegisteredTiptapToolbarControl, o as resolveTiptapTextStyleToolbarConfig, r as tiptapProseMirrorStyles, s as createTiptapExtensions, u as isRegisteredTiptapToolbarControl } from "../../chunks/tiptap.styles-CJqK0Wft.js";
|
|
13
13
|
import { n as normalizeContentArray, r as valueToContent, t as getFatalTiptapContentError } from "../../chunks/editor-CS16rBkM.js";
|
|
14
14
|
import "../../chunks/pk-dialog-ChX96jyg.js";
|
|
15
15
|
import "../../chunks/pk-dropdown-item-Bs5NZDRh.js";
|
|
@@ -1168,6 +1168,7 @@ var PkTiptapEditor = class PkTiptapEditor extends PkFormAssociatedElement {
|
|
|
1168
1168
|
this.placeholder = "";
|
|
1169
1169
|
this.readonly = false;
|
|
1170
1170
|
this.invalid = false;
|
|
1171
|
+
this.variableTransformerRegistry = {};
|
|
1171
1172
|
this.variableTagConfigure = null;
|
|
1172
1173
|
this.invalidContentMessage = "";
|
|
1173
1174
|
this.toolbarTooltips = true;
|
|
@@ -1301,6 +1302,7 @@ var PkTiptapEditor = class PkTiptapEditor extends PkFormAssociatedElement {
|
|
|
1301
1302
|
super.disconnectedCallback();
|
|
1302
1303
|
}
|
|
1303
1304
|
updated(changed) {
|
|
1305
|
+
if (changed.has("variableTransformerRegistry")) refreshVariableTagPresentation(this);
|
|
1304
1306
|
if (changed.has("value") && !changed.has("defaultValue")) this.syncEditorContent();
|
|
1305
1307
|
if (changed.has("defaultValue") && !this.valueHasChanged) this.syncEditorContent();
|
|
1306
1308
|
if (changed.has("disabled") || changed.has("readonly")) this.host.editor?.setEditable(!this.disabled && !this.readonly);
|
|
@@ -1953,6 +1955,7 @@ __decorate([n({
|
|
|
1953
1955
|
type: Boolean,
|
|
1954
1956
|
reflect: true
|
|
1955
1957
|
})], PkTiptapEditor.prototype, "invalid", void 0);
|
|
1958
|
+
__decorate([n({ attribute: false })], PkTiptapEditor.prototype, "variableTransformerRegistry", void 0);
|
|
1956
1959
|
__decorate([n({ attribute: false })], PkTiptapEditor.prototype, "variableTagConfigure", void 0);
|
|
1957
1960
|
__decorate([n({ attribute: "invalid-content-message" })], PkTiptapEditor.prototype, "invalidContentMessage", void 0);
|
|
1958
1961
|
__decorate([n({
|
|
@@ -2,7 +2,7 @@ import { a as e, c as customElement, m as i, o as r, p as b, s as n } from "../.
|
|
|
2
2
|
import { c as __decorate, i as PkFormAssociatedElement, n as formControlStyles } from "../../chunks/pk-base-BGegy7-X.js";
|
|
3
3
|
import { t as MirrorValidator } from "../../chunks/mirror-validator-BkZlEv1Z.js";
|
|
4
4
|
import { A as Editor } from "../../chunks/tiptap-DYSRDaas.js";
|
|
5
|
-
import {
|
|
5
|
+
import { a as refreshVariableTagPresentation, c as createTiptapInputExtensions, i as createVariableTagDomNodeView, n as tiptapInputProseMirrorStyles } from "../../chunks/tiptap.styles-CJqK0Wft.js";
|
|
6
6
|
//#region ../plugin-kit-tiptap-core/dist/serialization/input.js
|
|
7
7
|
var TRANSFORMER_ID_PREFIX = "transform=";
|
|
8
8
|
function parseTokenMetadata(tokenValue) {
|
|
@@ -353,6 +353,7 @@ var PkTiptapInput = class PkTiptapInput extends PkFormAssociatedElement {
|
|
|
353
353
|
this.suppressUpdateEmission = false;
|
|
354
354
|
this._value = null;
|
|
355
355
|
this.variableCategories = {};
|
|
356
|
+
this.variableTransformerRegistry = {};
|
|
356
357
|
this.variableTagConfigure = null;
|
|
357
358
|
this.readonly = false;
|
|
358
359
|
this.invalid = false;
|
|
@@ -416,6 +417,7 @@ var PkTiptapInput = class PkTiptapInput extends PkFormAssociatedElement {
|
|
|
416
417
|
super.disconnectedCallback();
|
|
417
418
|
}
|
|
418
419
|
updated(changed) {
|
|
420
|
+
if (changed.has("variableTransformerRegistry")) refreshVariableTagPresentation(this);
|
|
419
421
|
if (changed.has("value") && !changed.has("defaultValue")) this.syncEditorContent();
|
|
420
422
|
if (changed.has("defaultValue") && !this.valueHasChanged) this.syncEditorContent();
|
|
421
423
|
if (changed.has("variableCategories") && this.editor) this.syncEditorContent(true);
|
|
@@ -488,6 +490,7 @@ var PkTiptapInput = class PkTiptapInput extends PkFormAssociatedElement {
|
|
|
488
490
|
__decorate([e(".editor-mount")], PkTiptapInput.prototype, "editorMount", void 0);
|
|
489
491
|
__decorate([e(".mirror-input")], PkTiptapInput.prototype, "input", void 0);
|
|
490
492
|
__decorate([n({ attribute: false })], PkTiptapInput.prototype, "variableCategories", void 0);
|
|
493
|
+
__decorate([n({ attribute: false })], PkTiptapInput.prototype, "variableTransformerRegistry", void 0);
|
|
491
494
|
__decorate([n({ attribute: false })], PkTiptapInput.prototype, "variableTagConfigure", void 0);
|
|
492
495
|
__decorate([n({
|
|
493
496
|
type: Boolean,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbb/plugin-kit-web",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.27",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/verbb/plugin-kit.git"
|
|
6
6
|
},
|
|
@@ -1067,18 +1067,18 @@
|
|
|
1067
1067
|
},
|
|
1068
1068
|
"peerDependencies": {
|
|
1069
1069
|
"@floating-ui/dom": "^1.7.3",
|
|
1070
|
-
"@verbb/plugin-kit-core": "^2.0.
|
|
1071
|
-
"@verbb/plugin-kit-icons": "^2.0.
|
|
1070
|
+
"@verbb/plugin-kit-core": "^2.0.27",
|
|
1071
|
+
"@verbb/plugin-kit-icons": "^2.0.27",
|
|
1072
1072
|
"lit": "^3.3.0"
|
|
1073
1073
|
},
|
|
1074
1074
|
"license": "MIT",
|
|
1075
1075
|
"dependencies": {
|
|
1076
1076
|
"@floating-ui/dom": "^1.7.3",
|
|
1077
1077
|
"@tiptap/core": "3.31.4",
|
|
1078
|
-
"@verbb/plugin-kit-codemirror-core": "2.0.
|
|
1079
|
-
"@verbb/plugin-kit-core": "^2.0.
|
|
1080
|
-
"@verbb/plugin-kit-icons": "^2.0.
|
|
1081
|
-
"@verbb/plugin-kit-tiptap-core": "^2.0.
|
|
1078
|
+
"@verbb/plugin-kit-codemirror-core": "2.0.27",
|
|
1079
|
+
"@verbb/plugin-kit-core": "^2.0.27",
|
|
1080
|
+
"@verbb/plugin-kit-icons": "^2.0.27",
|
|
1081
|
+
"@verbb/plugin-kit-tiptap-core": "^2.0.27",
|
|
1082
1082
|
"composed-offset-position": "^0.0.6",
|
|
1083
1083
|
"lit": "^3.3.0"
|
|
1084
1084
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pk-tiptap-content-DmS_2EUi.js","names":["_decorate"],"sources":["../../src/components/tiptap/pk-tiptap-content.styles.ts","../../src/components/tiptap/pk-tiptap-content.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const pkTiptapContentStyles = css`\n @layer pk-component {\n :host {\n display: block;\n width: 100%;\n /* Inherit light-DOM color/size (warning banners, badges). Tokens override when set. */\n color: var(--pk-tiptap-content-color, inherit);\n font-family: var(--pk-font-family);\n font-size: var(--pk-tiptap-content-font-size, inherit);\n line-height: var(--pk-tiptap-content-line-height, 1.4);\n }\n }\n`;\n","import { html } from 'lit';\nimport { customElement, property, query } from '../../decorators.js';\nimport type { PropertyValues } from 'lit';\nimport { Editor } from '@tiptap/core';\nimport {\n createTiptapExtensions,\n valueToContent,\n} from '@verbb/plugin-kit-tiptap-core';\n\nimport { PkElement } from '../../base/pk-element.js';\nimport { createVariableTagDomNodeView } from './variable-tag-node-view.js';\nimport { pkTiptapContentStyles } from './pk-tiptap-content.styles.js';\nimport { tiptapContentProseMirrorStyles } from './tiptap.styles.js';\n\nfunction serializeContent(doc: ReturnType<typeof valueToContent>): string {\n if (!doc) {\n return '[]';\n }\n\n if (Array.isArray(doc.content)) {\n return JSON.stringify(doc.content);\n }\n\n return JSON.stringify(doc);\n}\n\n/**\n * Read-only TipTap / ProseMirror renderer.\n *\n * Pass the same `value` shapes as TiptapEditor: node array, doc object, or JSON string.\n */\n@customElement('pk-tiptap-content')\nexport class PkTiptapContent extends PkElement {\n static override styles = [pkTiptapContentStyles, tiptapContentProseMirrorStyles];\n\n @query('.editor-mount')\n private editorMount!: HTMLDivElement;\n\n private editor: Editor | null = null;\n\n @property({ attribute: 'value' })\n value = '';\n\n override disconnectedCallback(): void {\n this.editor?.destroy();\n this.editor = null;\n super.disconnectedCallback();\n }\n\n override updated(changed: PropertyValues): void {\n if (changed.has('value') && this.editor) {\n this.syncContent();\n }\n\n super.updated(changed);\n }\n\n override firstUpdated(): void {\n this.mountEditor();\n }\n\n private mountEditor(): void {\n this.editor = new Editor({\n element: this.editorMount,\n extensions: createTiptapExtensions({\n variableTagNodeView: createVariableTagDomNodeView(),\n surface: 'content',\n }),\n content: valueToContent(this.value),\n editable: false,\n });\n }\n\n private syncContent(): void {\n if (!this.editor) {\n return;\n }\n\n const doc = valueToContent(this.value) ?? { type: 'doc', content: [] };\n const incoming = serializeContent(valueToContent(this.value));\n const current = serializeContent(this.editor.getJSON() as ReturnType<typeof valueToContent>);\n\n if (incoming === current) {\n return;\n }\n\n this.editor.commands.setContent(doc);\n }\n\n override render() {\n return html`<div class=\"editor-mount\" part=\"content\"></div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pk-tiptap-content': PkTiptapContent;\n }\n}\n"],"mappings":";;;;;;;AAEA,IAAa,wBAAwB,GAAG;;;;;;;;;;;;;;;ACYxC,SAAS,iBAAiB,KAAgD;CACtE,IAAI,CAAC,KACD,OAAO;CAGX,IAAI,MAAM,QAAQ,IAAI,OAAO,GACzB,OAAO,KAAK,UAAU,IAAI,OAAO;CAGrC,OAAO,KAAK,UAAU,GAAG;AAC7B;AAQO,IAAM,kBAAN,MAAM,wBAAwB,UAAU;;;EAMX,KAAA,SAAA;EAGxB,KAAA,QAAA;;;EARiB,KAAA,SAAA,CAAC,uBAAuB,8BAA8B;;CAU/E,uBAAsC;EAClC,KAAK,QAAQ,QAAQ;EACrB,KAAK,SAAS;EACd,MAAM,qBAAqB;CAC/B;CAEA,QAAiB,SAA+B;EAC5C,IAAI,QAAQ,IAAI,OAAO,KAAK,KAAK,QAC7B,KAAK,YAAY;EAGrB,MAAM,QAAQ,OAAO;CACzB;CAEA,eAA8B;EAC1B,KAAK,YAAY;CACrB;CAEA,cAA4B;EACxB,KAAK,SAAS,IAAI,OAAO;GACrB,SAAS,KAAK;GACd,YAAY,uBAAuB;IAC/B,qBAAqB,6BAA6B;IAClD,SAAS;GACb,CAAC;GACD,SAAS,eAAe,KAAK,KAAK;GAClC,UAAU;EACd,CAAC;CACL;CAEA,cAA4B;EACxB,IAAI,CAAC,KAAK,QACN;EAGJ,MAAM,MAAM,eAAe,KAAK,KAAK,KAAK;GAAE,MAAM;GAAO,SAAS,CAAC;EAAE;EAIrE,IAHiB,iBAAiB,eAAe,KAAK,KAAK,CAGvD,MAFY,iBAAiB,KAAK,OAAO,QAAQ,CAEpC,GACb;EA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