@aswin.dev/editor 0.7.3 → 0.7.6
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/dist/{AiChatSidebar-Dt5pvG5t.js → AiChatSidebar-DM2ri7KX.js} +1 -1
- package/dist/{AiFeatureMenu-BipxcGap.js → AiFeatureMenu-BrZBJ0R5.js} +1 -1
- package/dist/{CloudEditor-CnUX0IOW.js → CloudEditor-BRpzzfQn.js} +8 -8
- package/dist/{CollaboratorBar-NaaZTjbs.js → CollaboratorBar-DsRXj3Kn.js} +1 -1
- package/dist/CountdownToolbar-B9IAZzeV.js +194 -0
- package/dist/{DesignReferenceSidebar-CZg97bbj.js → DesignReferenceSidebar-B1iw3Bb7.js} +1 -1
- package/dist/{ModuleBrowserModal-D2EVdexc.js → ModuleBrowserModal-DVnd1dqR.js} +4 -4
- package/dist/{ModulePreviewCanvas-P3N-nxkU.js → ModulePreviewCanvas-D9jBAoBQ.js} +29 -29
- package/dist/{ParagraphEditor-BbRuKhWv.js → ParagraphEditor-CO3V0H_V.js} +7 -7
- package/dist/{SaveModuleDialog-DLZa3m3O.js → SaveModuleDialog-CboNFwIA.js} +2 -2
- package/dist/{NumberWithSuffix-CihczoAd.js → SlidingPillSelect-DfcBdJqN.js} +122 -106
- package/dist/{SnapshotHistory-Csg1_jXi.js → SnapshotHistory-C26pvPre.js} +1 -1
- package/dist/{TestEmailModal-m3okLbJz.js → TestEmailModal-B4OoUWb_.js} +2 -2
- package/dist/{TitleEditor-CtJIS5ER.js → TitleEditor-DU_QWG_m.js} +2 -2
- package/dist/{TplModal-CQCrKeKP.js → TplModal-Dr6Do8oU.js} +1 -1
- package/dist/{blockTypeIcons-Dah0pgt-.js → blockTypeIcons-cRDr36gk.js} +48 -30
- package/dist/bundle-stats.json +6 -6
- package/dist/cdn/chunks/{AccessibilityPanel-Bt_fD7QT.js → AccessibilityPanel-Csd47zqI.js} +9 -9
- package/dist/cdn/chunks/{AccessibilityPanel-Bt_fD7QT.js.map → AccessibilityPanel-Csd47zqI.js.map} +1 -1
- package/dist/cdn/chunks/{AiFeatureMenu-Bn-0rgfr.js → AiFeatureMenu-BlnZF5pf.js} +7 -7
- package/dist/cdn/chunks/{AiFeatureMenu-Bn-0rgfr.js.map → AiFeatureMenu-BlnZF5pf.js.map} +1 -1
- package/dist/cdn/chunks/{BlockA11yBadge-Cj18Iw0p.js → BlockA11yBadge-VY8NqI9n.js} +4 -4
- package/dist/cdn/chunks/{BlockA11yBadge-Cj18Iw0p.js.map → BlockA11yBadge-VY8NqI9n.js.map} +1 -1
- package/dist/cdn/chunks/{CloudEditor-56lVcdot.js → CloudEditor-D0TrKlva.js} +178 -178
- package/dist/cdn/chunks/{CloudEditor-56lVcdot.js.map → CloudEditor-D0TrKlva.js.map} +1 -1
- package/dist/cdn/chunks/{CollaboratorBar-B7DCV3xp.js → CollaboratorBar-BhMNTI_h.js} +3 -3
- package/dist/cdn/chunks/{CollaboratorBar-B7DCV3xp.js.map → CollaboratorBar-BhMNTI_h.js.map} +1 -1
- package/dist/cdn/chunks/CountdownToolbar-DsP6O1fl.js +196 -0
- package/dist/cdn/chunks/CountdownToolbar-DsP6O1fl.js.map +1 -0
- package/dist/cdn/chunks/{ModuleBrowserModal-CiIY7ZGv.js → ModuleBrowserModal-CpYPeiKv.js} +8 -8
- package/dist/cdn/chunks/{ModuleBrowserModal-CiIY7ZGv.js.map → ModuleBrowserModal-CpYPeiKv.js.map} +1 -1
- package/dist/cdn/chunks/{ModulePreviewCanvas-M7_OGV2m.js → ModulePreviewCanvas-BIYYnqUq.js} +24 -24
- package/dist/cdn/chunks/{ModulePreviewCanvas-M7_OGV2m.js.map → ModulePreviewCanvas-BIYYnqUq.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-1XJOpiLX.js → ParagraphEditor-ZV5SYYw8.js} +53 -53
- package/dist/cdn/chunks/{ParagraphEditor-1XJOpiLX.js.map → ParagraphEditor-ZV5SYYw8.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-C2q8sbp2.js → RichTextEditorContent-Dx05ETtt.js} +4 -4
- package/dist/cdn/chunks/{RichTextEditorContent-C2q8sbp2.js.map → RichTextEditorContent-Dx05ETtt.js.map} +1 -1
- package/dist/cdn/chunks/{SaveModuleDialog-BNxh1jPT.js → SaveModuleDialog-DJEEK7Wb.js} +23 -23
- package/dist/cdn/chunks/{SaveModuleDialog-BNxh1jPT.js.map → SaveModuleDialog-DJEEK7Wb.js.map} +1 -1
- package/dist/cdn/chunks/{NumberWithSuffix-DfVBnsgc.js → SlidingPillSelect-BhPCkqVu.js} +132 -116
- package/dist/cdn/chunks/SlidingPillSelect-BhPCkqVu.js.map +1 -0
- package/dist/cdn/chunks/{TitleEditor-IF7VzLTk.js → TitleEditor-fu1A87Ld.js} +21 -21
- package/dist/cdn/chunks/{TitleEditor-IF7VzLTk.js.map → TitleEditor-fu1A87Ld.js.map} +1 -1
- package/dist/cdn/chunks/blockTypeIcons-CJirTS-q.js +25 -0
- package/dist/cdn/chunks/blockTypeIcons-CJirTS-q.js.map +1 -0
- package/dist/cdn/chunks/{de-B05yW8Gi.js → de-BsYijc0r.js} +49 -2
- package/dist/cdn/chunks/de-BsYijc0r.js.map +1 -0
- package/dist/cdn/chunks/{en-BII7695P.js → en-DMu9hPIC.js} +49 -2
- package/dist/cdn/chunks/en-DMu9hPIC.js.map +1 -0
- package/dist/cdn/chunks/{extensions-B0eT-yjf.js → extensions-BbFKsjyT.js} +26 -26
- package/dist/cdn/chunks/{extensions-B0eT-yjf.js.map → extensions-BbFKsjyT.js.map} +1 -1
- package/dist/cdn/chunks/{features-BrvE2Fzv.js → features-uApxwJMz.js} +1953 -1836
- package/dist/cdn/chunks/features-uApxwJMz.js.map +1 -0
- package/dist/cdn/chunks/{icons-C7wtAD8p.js → icons-DZb4EX9m.js} +26 -9
- package/dist/cdn/chunks/icons-DZb4EX9m.js.map +1 -0
- package/dist/cdn/chunks/{media-library-Cl5XuaKy.js → media-library-B3g52j8R.js} +529 -529
- package/dist/cdn/chunks/{media-library-Cl5XuaKy.js.map → media-library-B3g52j8R.js.map} +1 -1
- package/dist/cdn/chunks/{quality-Va91a3N8.js → quality-Ug5lFGHP.js} +288 -288
- package/dist/cdn/chunks/{quality-Va91a3N8.js.map → quality-Ug5lFGHP.js.map} +1 -1
- package/dist/cdn/chunks/{renderer-si0Zgxeb.js → renderer-jXCdXjV-.js} +19 -19
- package/dist/cdn/chunks/{renderer-si0Zgxeb.js.map → renderer-jXCdXjV-.js.map} +1 -1
- package/dist/cdn/chunks/{src-BLyYIbdZ.js → src-FMtH5ZvJ.js} +9 -9
- package/dist/cdn/chunks/{src-BLyYIbdZ.js.map → src-FMtH5ZvJ.js.map} +1 -1
- package/dist/cdn/chunks/{styles-C6BQLT9F.js → styles-Co9vw4ag.js} +1332 -1101
- package/dist/cdn/chunks/styles-Co9vw4ag.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-D8whBv5F.js → tiptap-qXOh0vzV.js} +2 -2
- package/dist/cdn/chunks/{tiptap-D8whBv5F.js.map → tiptap-qXOh0vzV.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +85 -85
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{cloud-BoS0J0vs.js → cloud-COUuu_KE.js} +1 -1
- package/dist/{de-C74F9xK3.js → de-CR1qAkAm.js} +48 -1
- package/dist/{dist-C2grMquk.js → dist-DP82Y0rs.js} +155 -131
- package/dist/{en-B24jVTeO.js → en-jbnp1n6M.js} +48 -1
- package/dist/{extensions-DsmjHqBF.js → extensions-Bg22D6c8.js} +16 -16
- package/dist/index.d.ts +10 -10
- package/dist/style.css +1 -1
- package/dist/{styles-BMFMtR9R.js → styles-DgL0UYj0.js} +1456 -1225
- package/dist/templatical-editor.js +6 -6
- package/dist/{useEditorCore-CtNAo0uy.js → useEditorCore-CSlYQZWx.js} +1756 -1661
- package/dist/{useMergeTag-2vTcVpNo.js → useMergeTag-BVL3A4OO.js} +4 -4
- package/package.json +7 -7
- package/dist/CountdownToolbar-CbhSp_uq.js +0 -210
- package/dist/cdn/chunks/CountdownToolbar-BtaD3d3-.js +0 -212
- package/dist/cdn/chunks/CountdownToolbar-BtaD3d3-.js.map +0 -1
- package/dist/cdn/chunks/NumberWithSuffix-DfVBnsgc.js.map +0 -1
- package/dist/cdn/chunks/blockTypeIcons-tPBKQ8WC.js +0 -24
- package/dist/cdn/chunks/blockTypeIcons-tPBKQ8WC.js.map +0 -1
- package/dist/cdn/chunks/de-B05yW8Gi.js.map +0 -1
- package/dist/cdn/chunks/en-BII7695P.js.map +0 -1
- package/dist/cdn/chunks/features-BrvE2Fzv.js.map +0 -1
- package/dist/cdn/chunks/icons-C7wtAD8p.js.map +0 -1
- package/dist/cdn/chunks/styles-C6BQLT9F.js.map +0 -1
package/dist/cdn/chunks/{SaveModuleDialog-BNxh1jPT.js.map → SaveModuleDialog-DJEEK7Wb.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveModuleDialog-BNxh1jPT.js","names":[],"sources":["../../../src/cloud/components/SaveModuleDialog.vue","../../../src/cloud/components/SaveModuleDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../../composables\";\nimport { useCloudI18nStrict } from \"../../composables\";\nimport {\n EDITOR_KEY,\n SAVED_MODULES_HEADLESS_KEY,\n requireInject,\n} from \"../../keys\";\nimport type { Block } from \"@aswin.dev/types\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { computed, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n preSelectedBlockId: string | null;\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t } = useI18n();\nconst { t: cloudT } = useCloudI18nStrict();\nconst editor = requireInject(EDITOR_KEY, \"SaveModuleDialog\");\nconst savedModules = requireInject(\n SAVED_MODULES_HEADLESS_KEY,\n \"SaveModuleDialog\",\n);\n\nconst moduleName = ref(\"\");\nconst selectedBlockIds = ref<Set<string>>(new Set());\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\n\nconst topLevelBlocks = computed(() => editor.content.value.blocks);\n\nfunction blockLabel(block: Block, index: number): string {\n const typeKey = block.type as keyof typeof t.blocks;\n const label = t.blocks[typeKey] ?? block.type;\n return `${label} ${index + 1}`;\n}\n\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n moduleName.value = \"\";\n error.value = null;\n selectedBlockIds.value = new Set(\n props.preSelectedBlockId ? [props.preSelectedBlockId] : [],\n );\n }\n },\n);\n\nfunction toggleBlock(blockId: string): void {\n const newSet = new Set(selectedBlockIds.value);\n if (newSet.has(blockId)) {\n newSet.delete(blockId);\n } else {\n newSet.add(blockId);\n }\n selectedBlockIds.value = newSet;\n}\n\nconst canSave = computed(\n () =>\n moduleName.value.trim().length > 0 &&\n selectedBlockIds.value.size > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n const selectedBlocks = topLevelBlocks.value.filter((b) =>\n selectedBlockIds.value.has(b.id),\n );\n await savedModules.createModule(moduleName.value.trim(), selectedBlocks);\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-module-title\"\n class=\"tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-module-title\"\n class=\"tpl:mb-4 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ cloudT.modules.saveAsModule }}\n </h3>\n\n <!-- Module name -->\n <div class=\"tpl:mb-3\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ cloudT.modules.moduleName }}\n </label>\n <input\n v-model=\"moduleName\"\n type=\"text\"\n :placeholder=\"cloudT.modules.moduleNamePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Block selection -->\n <div class=\"tpl:mb-3\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ cloudT.modules.selectBlocks }}\n </label>\n <div\n class=\"tpl:max-h-40 tpl:space-y-1 tpl:overflow-y-auto tpl:rounded-md tpl:border tpl:p-2 tpl:border-[var(--tpl-border)]\"\n >\n <label\n v-for=\"(block, index) in topLevelBlocks\"\n :key=\"block.id\"\n class=\"tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-2 tpl:rounded-sm tpl:px-2 tpl:py-1.5 tpl:text-sm tpl:transition-colors tpl:duration-100\"\n :style=\"{\n color: 'var(--tpl-text)',\n backgroundColor: selectedBlockIds.has(block.id)\n ? 'var(--tpl-primary-light)'\n : 'transparent',\n }\"\n >\n <input\n type=\"checkbox\"\n :checked=\"selectedBlockIds.has(block.id)\"\n class=\"tpl:accent-[var(--tpl-primary)]\"\n :disabled=\"isSaving\"\n @change=\"toggleBlock(block.id)\"\n />\n {{ blockLabel(block, index) }}\n </label>\n </div>\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ cloudT.modules.cancel }}\n </button>\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ cloudT.modules.saving }}\n </span>\n <span v-else>\n {{ cloudT.modules.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n","<script setup lang=\"ts\">\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../../composables\";\nimport { useCloudI18nStrict } from \"../../composables\";\nimport {\n EDITOR_KEY,\n SAVED_MODULES_HEADLESS_KEY,\n requireInject,\n} from \"../../keys\";\nimport type { Block } from \"@aswin.dev/types\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { computed, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n preSelectedBlockId: string | null;\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t } = useI18n();\nconst { t: cloudT } = useCloudI18nStrict();\nconst editor = requireInject(EDITOR_KEY, \"SaveModuleDialog\");\nconst savedModules = requireInject(\n SAVED_MODULES_HEADLESS_KEY,\n \"SaveModuleDialog\",\n);\n\nconst moduleName = ref(\"\");\nconst selectedBlockIds = ref<Set<string>>(new Set());\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\n\nconst topLevelBlocks = computed(() => editor.content.value.blocks);\n\nfunction blockLabel(block: Block, index: number): string {\n const typeKey = block.type as keyof typeof t.blocks;\n const label = t.blocks[typeKey] ?? block.type;\n return `${label} ${index + 1}`;\n}\n\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n moduleName.value = \"\";\n error.value = null;\n selectedBlockIds.value = new Set(\n props.preSelectedBlockId ? [props.preSelectedBlockId] : [],\n );\n }\n },\n);\n\nfunction toggleBlock(blockId: string): void {\n const newSet = new Set(selectedBlockIds.value);\n if (newSet.has(blockId)) {\n newSet.delete(blockId);\n } else {\n newSet.add(blockId);\n }\n selectedBlockIds.value = newSet;\n}\n\nconst canSave = computed(\n () =>\n moduleName.value.trim().length > 0 &&\n selectedBlockIds.value.size > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n const selectedBlocks = topLevelBlocks.value.filter((b) =>\n selectedBlockIds.value.has(b.id),\n );\n await savedModules.createModule(moduleName.value.trim(), selectedBlocks);\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-module-title\"\n class=\"tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-module-title\"\n class=\"tpl:mb-4 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ cloudT.modules.saveAsModule }}\n </h3>\n\n <!-- Module name -->\n <div class=\"tpl:mb-3\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ cloudT.modules.moduleName }}\n </label>\n <input\n v-model=\"moduleName\"\n type=\"text\"\n :placeholder=\"cloudT.modules.moduleNamePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Block selection -->\n <div class=\"tpl:mb-3\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ cloudT.modules.selectBlocks }}\n </label>\n <div\n class=\"tpl:max-h-40 tpl:space-y-1 tpl:overflow-y-auto tpl:rounded-md tpl:border tpl:p-2 tpl:border-[var(--tpl-border)]\"\n >\n <label\n v-for=\"(block, index) in topLevelBlocks\"\n :key=\"block.id\"\n class=\"tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-2 tpl:rounded-sm tpl:px-2 tpl:py-1.5 tpl:text-sm tpl:transition-colors tpl:duration-100\"\n :style=\"{\n color: 'var(--tpl-text)',\n backgroundColor: selectedBlockIds.has(block.id)\n ? 'var(--tpl-primary-light)'\n : 'transparent',\n }\"\n >\n <input\n type=\"checkbox\"\n :checked=\"selectedBlockIds.has(block.id)\"\n class=\"tpl:accent-[var(--tpl-primary)]\"\n :disabled=\"isSaving\"\n @change=\"toggleBlock(block.id)\"\n />\n {{ blockLabel(block, index) }}\n </label>\n </div>\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ cloudT.modules.cancel }}\n </button>\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ cloudT.modules.saving }}\n </span>\n <span v-else>\n {{ cloudT.modules.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"SaveModuleDialog-DJEEK7Wb.js","names":[],"sources":["../../../src/cloud/components/SaveModuleDialog.vue","../../../src/cloud/components/SaveModuleDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../../composables\";\nimport { useCloudI18nStrict } from \"../../composables\";\nimport {\n EDITOR_KEY,\n SAVED_MODULES_HEADLESS_KEY,\n requireInject,\n} from \"../../keys\";\nimport type { Block } from \"@aswin.dev/types\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { computed, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n preSelectedBlockId: string | null;\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t } = useI18n();\nconst { t: cloudT } = useCloudI18nStrict();\nconst editor = requireInject(EDITOR_KEY, \"SaveModuleDialog\");\nconst savedModules = requireInject(\n SAVED_MODULES_HEADLESS_KEY,\n \"SaveModuleDialog\",\n);\n\nconst moduleName = ref(\"\");\nconst selectedBlockIds = ref<Set<string>>(new Set());\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\n\nconst topLevelBlocks = computed(() => editor.content.value.blocks);\n\nfunction blockLabel(block: Block, index: number): string {\n const typeKey = block.type as keyof typeof t.blocks;\n const label = t.blocks[typeKey] ?? block.type;\n return `${label} ${index + 1}`;\n}\n\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n moduleName.value = \"\";\n error.value = null;\n selectedBlockIds.value = new Set(\n props.preSelectedBlockId ? [props.preSelectedBlockId] : [],\n );\n }\n },\n);\n\nfunction toggleBlock(blockId: string): void {\n const newSet = new Set(selectedBlockIds.value);\n if (newSet.has(blockId)) {\n newSet.delete(blockId);\n } else {\n newSet.add(blockId);\n }\n selectedBlockIds.value = newSet;\n}\n\nconst canSave = computed(\n () =>\n moduleName.value.trim().length > 0 &&\n selectedBlockIds.value.size > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n const selectedBlocks = topLevelBlocks.value.filter((b) =>\n selectedBlockIds.value.has(b.id),\n );\n await savedModules.createModule(moduleName.value.trim(), selectedBlocks);\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-module-title\"\n class=\"tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-module-title\"\n class=\"tpl:mb-4 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ cloudT.modules.saveAsModule }}\n </h3>\n\n <!-- Module name -->\n <div class=\"tpl:mb-3\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ cloudT.modules.moduleName }}\n </label>\n <input\n v-model=\"moduleName\"\n type=\"text\"\n :placeholder=\"cloudT.modules.moduleNamePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Block selection -->\n <div class=\"tpl:mb-3\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ cloudT.modules.selectBlocks }}\n </label>\n <div\n class=\"tpl:max-h-40 tpl:space-y-1 tpl:overflow-y-auto tpl:rounded-md tpl:border tpl:p-2 tpl:border-[var(--tpl-border)]\"\n >\n <label\n v-for=\"(block, index) in topLevelBlocks\"\n :key=\"block.id\"\n class=\"tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-2 tpl:rounded-sm tpl:px-2 tpl:py-1.5 tpl:text-sm tpl:transition-colors tpl:duration-100\"\n :style=\"{\n color: 'var(--tpl-text)',\n backgroundColor: selectedBlockIds.has(block.id)\n ? 'var(--tpl-primary-light)'\n : 'transparent',\n }\"\n >\n <input\n type=\"checkbox\"\n :checked=\"selectedBlockIds.has(block.id)\"\n class=\"tpl:accent-[var(--tpl-primary)]\"\n :disabled=\"isSaving\"\n @change=\"toggleBlock(block.id)\"\n />\n {{ blockLabel(block, index) }}\n </label>\n </div>\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ cloudT.modules.cancel }}\n </button>\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ cloudT.modules.saving }}\n </span>\n <span v-else>\n {{ cloudT.modules.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n","<script setup lang=\"ts\">\nimport TplModal from \"./TplModal.vue\";\nimport { useI18n } from \"../../composables\";\nimport { useCloudI18nStrict } from \"../../composables\";\nimport {\n EDITOR_KEY,\n SAVED_MODULES_HEADLESS_KEY,\n requireInject,\n} from \"../../keys\";\nimport type { Block } from \"@aswin.dev/types\";\nimport { LoaderCircle } from \"@lucide/vue\";\nimport { computed, ref, watch } from \"vue\";\n\nconst props = defineProps<{\n visible: boolean;\n preSelectedBlockId: string | null;\n}>();\n\nconst emit = defineEmits<{\n (e: \"close\"): void;\n (e: \"saved\"): void;\n}>();\n\nconst { t } = useI18n();\nconst { t: cloudT } = useCloudI18nStrict();\nconst editor = requireInject(EDITOR_KEY, \"SaveModuleDialog\");\nconst savedModules = requireInject(\n SAVED_MODULES_HEADLESS_KEY,\n \"SaveModuleDialog\",\n);\n\nconst moduleName = ref(\"\");\nconst selectedBlockIds = ref<Set<string>>(new Set());\nconst isSaving = ref(false);\nconst error = ref<string | null>(null);\n\nconst topLevelBlocks = computed(() => editor.content.value.blocks);\n\nfunction blockLabel(block: Block, index: number): string {\n const typeKey = block.type as keyof typeof t.blocks;\n const label = t.blocks[typeKey] ?? block.type;\n return `${label} ${index + 1}`;\n}\n\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n moduleName.value = \"\";\n error.value = null;\n selectedBlockIds.value = new Set(\n props.preSelectedBlockId ? [props.preSelectedBlockId] : [],\n );\n }\n },\n);\n\nfunction toggleBlock(blockId: string): void {\n const newSet = new Set(selectedBlockIds.value);\n if (newSet.has(blockId)) {\n newSet.delete(blockId);\n } else {\n newSet.add(blockId);\n }\n selectedBlockIds.value = newSet;\n}\n\nconst canSave = computed(\n () =>\n moduleName.value.trim().length > 0 &&\n selectedBlockIds.value.size > 0 &&\n !isSaving.value,\n);\n\nasync function handleSave(): Promise<void> {\n if (!canSave.value) return;\n\n isSaving.value = true;\n error.value = null;\n\n try {\n const selectedBlocks = topLevelBlocks.value.filter((b) =>\n selectedBlockIds.value.has(b.id),\n );\n await savedModules.createModule(moduleName.value.trim(), selectedBlocks);\n emit(\"saved\");\n emit(\"close\");\n } catch (err) {\n error.value = (err as Error).message;\n } finally {\n isSaving.value = false;\n }\n}\n\nfunction handleClose(): void {\n if (!isSaving.value) {\n emit(\"close\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSave();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSaving\"\n aria-labelledby=\"tpl-save-module-title\"\n class=\"tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-save-module-title\"\n class=\"tpl:mb-4 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ cloudT.modules.saveAsModule }}\n </h3>\n\n <!-- Module name -->\n <div class=\"tpl:mb-3\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ cloudT.modules.moduleName }}\n </label>\n <input\n v-model=\"moduleName\"\n type=\"text\"\n :placeholder=\"cloudT.modules.moduleNamePlaceholder\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n :disabled=\"isSaving\"\n />\n </div>\n\n <!-- Block selection -->\n <div class=\"tpl:mb-3\">\n <label\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ cloudT.modules.selectBlocks }}\n </label>\n <div\n class=\"tpl:max-h-40 tpl:space-y-1 tpl:overflow-y-auto tpl:rounded-md tpl:border tpl:p-2 tpl:border-[var(--tpl-border)]\"\n >\n <label\n v-for=\"(block, index) in topLevelBlocks\"\n :key=\"block.id\"\n class=\"tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-2 tpl:rounded-sm tpl:px-2 tpl:py-1.5 tpl:text-sm tpl:transition-colors tpl:duration-100\"\n :style=\"{\n color: 'var(--tpl-text)',\n backgroundColor: selectedBlockIds.has(block.id)\n ? 'var(--tpl-primary-light)'\n : 'transparent',\n }\"\n >\n <input\n type=\"checkbox\"\n :checked=\"selectedBlockIds.has(block.id)\"\n class=\"tpl:accent-[var(--tpl-primary)]\"\n :disabled=\"isSaving\"\n @change=\"toggleBlock(block.id)\"\n />\n {{ blockLabel(block, index) }}\n </label>\n </div>\n </div>\n\n <!-- Error message -->\n <p\n v-if=\"error\"\n role=\"alert\"\n class=\"tpl:mb-3 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ error }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSaving\"\n :class=\"{\n 'tpl:cursor-not-allowed tpl:opacity-50': isSaving,\n }\"\n @click=\"handleClose\"\n >\n {{ cloudT.modules.cancel }}\n </button>\n <button\n type=\"button\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n :disabled=\"!canSave\"\n @click=\"handleSave\"\n >\n <span v-if=\"isSaving\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ cloudT.modules.saving }}\n </span>\n <span v-else>\n {{ cloudT.modules.save }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n"],"mappings":"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"}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { C as e, I as t, L as n, P as r, W as i, _ as a,
|
|
2
|
-
import {
|
|
3
|
-
import { h as b, i as x, m as S, p as C, u as
|
|
1
|
+
import { C as e, I as t, L as n, P as r, W as i, _ as a, b as o, ct as s, dt as c, f as l, ft as u, g as d, h as f, m as p, n as ee, tt as m, u as h, ut as g, v as _, x as v, z as y } from "./draggable-C-1_gch3.js";
|
|
2
|
+
import { Vt as te, pn as ne } from "./features-uApxwJMz.js";
|
|
3
|
+
import { h as b, i as x, m as S, p as C, u as w } from "./styleConstants-DfcU8u_r.js";
|
|
4
4
|
//#region ../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/utils/math.js
|
|
5
|
-
var
|
|
5
|
+
var T = (e, t = 0, n = 1) => e > n ? n : e < t ? t : e, E = (e, t = 0, n = 10 ** t) => Math.round(n * e) / n;
|
|
6
6
|
360 / (Math.PI * 2);
|
|
7
|
-
var re = (e) =>
|
|
7
|
+
var re = (e) => j(D(e)), D = (e) => (e[0] === "#" && (e = e.substring(1)), e.length < 6 ? {
|
|
8
8
|
r: parseInt(e[0] + e[0], 16),
|
|
9
9
|
g: parseInt(e[1] + e[1], 16),
|
|
10
10
|
b: parseInt(e[2] + e[2], 16),
|
|
11
|
-
a: e.length === 4 ?
|
|
11
|
+
a: e.length === 4 ? E(parseInt(e[3] + e[3], 16) / 255, 2) : 1
|
|
12
12
|
} : {
|
|
13
13
|
r: parseInt(e.substring(0, 2), 16),
|
|
14
14
|
g: parseInt(e.substring(2, 4), 16),
|
|
15
15
|
b: parseInt(e.substring(4, 6), 16),
|
|
16
|
-
a: e.length === 8 ?
|
|
17
|
-
}),
|
|
16
|
+
a: e.length === 8 ? E(parseInt(e.substring(6, 8), 16) / 255, 2) : 1
|
|
17
|
+
}), ie = (e) => A(oe(e)), ae = ({ h: e, s: t, v: n, a: r }) => {
|
|
18
18
|
let i = (200 - t) * n / 100;
|
|
19
19
|
return {
|
|
20
|
-
h:
|
|
21
|
-
s:
|
|
22
|
-
l:
|
|
23
|
-
a:
|
|
20
|
+
h: E(e),
|
|
21
|
+
s: E(i > 0 && i < 200 ? t * n / 100 / (i <= 100 ? i : 200 - i) * 100 : 0),
|
|
22
|
+
l: E(i / 2),
|
|
23
|
+
a: E(r, 2)
|
|
24
24
|
};
|
|
25
25
|
}, O = (e) => {
|
|
26
|
-
let { h: t, s: n, l: r } =
|
|
26
|
+
let { h: t, s: n, l: r } = ae(e);
|
|
27
27
|
return `hsl(${t}, ${n}%, ${r}%)`;
|
|
28
|
-
},
|
|
28
|
+
}, oe = ({ h: e, s: t, v: n, a: r }) => {
|
|
29
29
|
e = e / 360 * 6, t /= 100, n /= 100;
|
|
30
30
|
let i = Math.floor(e), a = n * (1 - t), o = n * (1 - (e - i) * t), s = n * (1 - (1 - e + i) * t), c = i % 6;
|
|
31
31
|
return {
|
|
32
|
-
r:
|
|
32
|
+
r: E([
|
|
33
33
|
n,
|
|
34
34
|
o,
|
|
35
35
|
a,
|
|
@@ -37,7 +37,7 @@ var re = (e) => A(E(e)), E = (e) => (e[0] === "#" && (e = e.substring(1)), e.len
|
|
|
37
37
|
s,
|
|
38
38
|
n
|
|
39
39
|
][c] * 255),
|
|
40
|
-
g:
|
|
40
|
+
g: E([
|
|
41
41
|
s,
|
|
42
42
|
n,
|
|
43
43
|
n,
|
|
@@ -45,7 +45,7 @@ var re = (e) => A(E(e)), E = (e) => (e[0] === "#" && (e = e.substring(1)), e.len
|
|
|
45
45
|
a,
|
|
46
46
|
a
|
|
47
47
|
][c] * 255),
|
|
48
|
-
b:
|
|
48
|
+
b: E([
|
|
49
49
|
a,
|
|
50
50
|
a,
|
|
51
51
|
s,
|
|
@@ -53,27 +53,27 @@ var re = (e) => A(E(e)), E = (e) => (e[0] === "#" && (e = e.substring(1)), e.len
|
|
|
53
53
|
n,
|
|
54
54
|
o
|
|
55
55
|
][c] * 255),
|
|
56
|
-
a:
|
|
56
|
+
a: E(r, 2)
|
|
57
57
|
};
|
|
58
58
|
}, k = (e) => {
|
|
59
59
|
let t = e.toString(16);
|
|
60
60
|
return t.length < 2 ? "0" + t : t;
|
|
61
|
-
}, oe = ({ r: e, g: t, b: n, a: r }) => {
|
|
62
|
-
let i = r < 1 ? k(T(r * 255)) : "";
|
|
63
|
-
return "#" + k(e) + k(t) + k(n) + i;
|
|
64
61
|
}, A = ({ r: e, g: t, b: n, a: r }) => {
|
|
62
|
+
let i = r < 1 ? k(E(r * 255)) : "";
|
|
63
|
+
return "#" + k(e) + k(t) + k(n) + i;
|
|
64
|
+
}, j = ({ r: e, g: t, b: n, a: r }) => {
|
|
65
65
|
let i = Math.max(e, t, n), a = i - Math.min(e, t, n), o = a ? i === e ? (t - n) / a : i === t ? 2 + (n - e) / a : 4 + (e - t) / a : 0;
|
|
66
66
|
return {
|
|
67
|
-
h:
|
|
68
|
-
s:
|
|
69
|
-
v:
|
|
67
|
+
h: E(60 * (o < 0 ? o + 6 : o)),
|
|
68
|
+
s: E(i ? a / i * 100 : 0),
|
|
69
|
+
v: E(i / 255 * 100),
|
|
70
70
|
a: r
|
|
71
71
|
};
|
|
72
|
-
},
|
|
72
|
+
}, M = (e, t) => {
|
|
73
73
|
if (e === t) return !0;
|
|
74
74
|
for (let n in e) if (e[n] !== t[n]) return !1;
|
|
75
75
|
return !0;
|
|
76
|
-
},
|
|
76
|
+
}, se = (e, t) => e.toLowerCase() === t.toLowerCase() ? !0 : M(D(e), D(t)), N = {}, P = (e) => {
|
|
77
77
|
let t = N[e];
|
|
78
78
|
return t || (t = document.createElement("template"), t.innerHTML = e, N[e] = t), t;
|
|
79
79
|
}, F = (e, t, n) => {
|
|
@@ -84,8 +84,8 @@ var re = (e) => A(E(e)), E = (e) => (e[0] === "#" && (e = e.substring(1)), e.len
|
|
|
84
84
|
}, I = !1, L = (e) => "touches" in e, R = (e) => I && !L(e) ? !1 : (I ||= L(e), !0), z = (e, t) => {
|
|
85
85
|
let n = L(t) ? t.touches[0] : t, r = e.el.getBoundingClientRect();
|
|
86
86
|
F(e.el, "move", e.getMove({
|
|
87
|
-
x:
|
|
88
|
-
y:
|
|
87
|
+
x: T((n.pageX - (r.left + window.pageXOffset)) / r.width),
|
|
88
|
+
y: T((n.pageY - (r.top + window.pageYOffset)) / r.height)
|
|
89
89
|
}));
|
|
90
90
|
}, B = (e, t) => {
|
|
91
91
|
let n = t.keyCode;
|
|
@@ -142,10 +142,10 @@ var re = (e) => A(E(e)), E = (e) => (e[0] === "#" && (e = e.substring(1)), e.len
|
|
|
142
142
|
v: 100,
|
|
143
143
|
a: 1
|
|
144
144
|
})
|
|
145
|
-
}]), this.el.setAttribute("aria-valuenow", `${
|
|
145
|
+
}]), this.el.setAttribute("aria-valuenow", `${E(e)}`);
|
|
146
146
|
}
|
|
147
147
|
getMove(e, t) {
|
|
148
|
-
return { h: t ?
|
|
148
|
+
return { h: t ? T(this.h + e.x * 360, 0, 360) : 360 * e.x };
|
|
149
149
|
}
|
|
150
150
|
}, U = class extends V {
|
|
151
151
|
constructor(e) {
|
|
@@ -161,15 +161,15 @@ var re = (e) => A(E(e)), E = (e) => (e[0] === "#" && (e = e.substring(1)), e.len
|
|
|
161
161
|
s: 100,
|
|
162
162
|
v: 100,
|
|
163
163
|
a: 1
|
|
164
|
-
}) }]), this.el.setAttribute("aria-valuetext", `Saturation ${
|
|
164
|
+
}) }]), this.el.setAttribute("aria-valuetext", `Saturation ${E(e.s)}%, Brightness ${E(e.v)}%`);
|
|
165
165
|
}
|
|
166
166
|
getMove(e, t) {
|
|
167
167
|
return {
|
|
168
|
-
s: t ?
|
|
169
|
-
v: t ?
|
|
168
|
+
s: t ? T(this.hsva.s + e.x * 100, 0, 100) : e.x * 100,
|
|
169
|
+
v: t ? T(this.hsva.v - e.y * 100, 0, 100) : Math.round(100 - e.y * 100)
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
}, W = ":host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:\"\";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}", G = "[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}", K = "[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}", q = Symbol("same"), J = Symbol("color"), Y = Symbol("hsva"), X = Symbol("update"), Z = Symbol("parts"), Q = Symbol("css"), $ = Symbol("sliders"),
|
|
172
|
+
}, W = ":host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:\"\";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}", G = "[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}", K = "[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}", q = Symbol("same"), J = Symbol("color"), Y = Symbol("hsva"), X = Symbol("update"), Z = Symbol("parts"), Q = Symbol("css"), $ = Symbol("sliders"), ce = class extends HTMLElement {
|
|
173
173
|
static get observedAttributes() {
|
|
174
174
|
return ["color"];
|
|
175
175
|
}
|
|
@@ -214,7 +214,7 @@ var re = (e) => A(E(e)), E = (e) => (e[0] === "#" && (e = e.substring(1)), e.len
|
|
|
214
214
|
};
|
|
215
215
|
this[X](n);
|
|
216
216
|
let r;
|
|
217
|
-
!
|
|
217
|
+
!M(n, t) && !this[q](r = this.colorModel.fromHsva(n)) && (this[J] = r, F(this, "color-changed", { value: r }));
|
|
218
218
|
}
|
|
219
219
|
[q](e) {
|
|
220
220
|
return this.color && this.colorModel.equal(e, this.color);
|
|
@@ -222,35 +222,35 @@ var re = (e) => A(E(e)), E = (e) => (e[0] === "#" && (e = e.substring(1)), e.len
|
|
|
222
222
|
[X](e) {
|
|
223
223
|
this[Y] = e, this[Z].forEach((t) => t.update(e));
|
|
224
224
|
}
|
|
225
|
-
},
|
|
225
|
+
}, le = {
|
|
226
226
|
defaultColor: "#000",
|
|
227
227
|
toHsva: re,
|
|
228
|
-
fromHsva: ({ h: e, s: t, v: n }) =>
|
|
228
|
+
fromHsva: ({ h: e, s: t, v: n }) => ie({
|
|
229
229
|
h: e,
|
|
230
230
|
s: t,
|
|
231
231
|
v: n,
|
|
232
232
|
a: 1
|
|
233
233
|
}),
|
|
234
|
-
equal:
|
|
234
|
+
equal: se,
|
|
235
235
|
fromAttr: (e) => e
|
|
236
|
-
},
|
|
236
|
+
}, ue = class extends ce {
|
|
237
237
|
get colorModel() {
|
|
238
|
-
return
|
|
238
|
+
return le;
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
|
-
customElements.define("hex-color-picker", class extends
|
|
241
|
+
customElements.define("hex-color-picker", class extends ue {});
|
|
242
242
|
//#endregion
|
|
243
243
|
//#region src/components/ColorPicker.vue?vue&type=script&setup=true&lang.ts
|
|
244
|
-
var
|
|
244
|
+
var de = [
|
|
245
245
|
"disabled",
|
|
246
246
|
"aria-label",
|
|
247
247
|
"aria-expanded"
|
|
248
|
-
],
|
|
248
|
+
], fe = [
|
|
249
249
|
"value",
|
|
250
250
|
"placeholder",
|
|
251
251
|
"disabled",
|
|
252
252
|
"aria-label"
|
|
253
|
-
],
|
|
253
|
+
], pe = ["color", "aria-label"], me = /* @__PURE__ */ e({
|
|
254
254
|
__name: "ColorPicker",
|
|
255
255
|
props: {
|
|
256
256
|
modelValue: {},
|
|
@@ -267,27 +267,27 @@ var ue = [
|
|
|
267
267
|
},
|
|
268
268
|
emits: ["update:modelValue"],
|
|
269
269
|
setup(e, { emit: t }) {
|
|
270
|
-
let n = e,
|
|
271
|
-
|
|
270
|
+
let n = e, o = t, { t: l } = te(), u = m(!1), d = m(), y = m();
|
|
271
|
+
ne(d, () => {
|
|
272
272
|
u.value = !1;
|
|
273
|
-
}, { ignore: [
|
|
274
|
-
let
|
|
273
|
+
}, { ignore: [y] });
|
|
274
|
+
let b = p({
|
|
275
275
|
get: () => n.modelValue || "#000000",
|
|
276
|
-
set: (e) =>
|
|
276
|
+
set: (e) => o("update:modelValue", e)
|
|
277
277
|
});
|
|
278
|
-
function
|
|
279
|
-
|
|
278
|
+
function x(e) {
|
|
279
|
+
b.value = e.detail.value;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
|
|
281
|
+
function S(e) {
|
|
282
|
+
b.value = e.target.value;
|
|
283
283
|
}
|
|
284
284
|
return (t, n) => (r(), _("div", { class: g(["tpl:flex tpl:gap-2 tpl:relative tpl:w-full tpl:min-w-0", e.disabled && "tpl:opacity-60 tpl:cursor-not-allowed"]) }, [
|
|
285
|
-
|
|
285
|
+
f("button", {
|
|
286
286
|
ref_key: "swatchRef",
|
|
287
|
-
ref:
|
|
287
|
+
ref: y,
|
|
288
288
|
type: "button",
|
|
289
289
|
disabled: e.disabled,
|
|
290
|
-
"aria-label":
|
|
290
|
+
"aria-label": s(l).colorPicker.pickColor,
|
|
291
291
|
"aria-expanded": u.value,
|
|
292
292
|
class: g([
|
|
293
293
|
"tpl:shrink-0 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-0.5 tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
@@ -296,21 +296,21 @@ var ue = [
|
|
|
296
296
|
e.size === "large" ? "tpl:size-12" : "tpl:size-10"
|
|
297
297
|
]),
|
|
298
298
|
onClick: n[0] ||= (t) => !e.disabled && (u.value = !u.value)
|
|
299
|
-
}, [
|
|
299
|
+
}, [f("span", {
|
|
300
300
|
class: "tpl:block tpl:size-full tpl:rounded-[calc(var(--tpl-radius-sm)-2px)]",
|
|
301
|
-
style:
|
|
302
|
-
}, null, 4)], 10,
|
|
301
|
+
style: c({ backgroundColor: b.value })
|
|
302
|
+
}, null, 4)], 10, de),
|
|
303
303
|
e.swatchOnly ? a("", !0) : (r(), _("input", {
|
|
304
304
|
key: 0,
|
|
305
305
|
type: "text",
|
|
306
|
-
class: g(
|
|
306
|
+
class: g(s(w)),
|
|
307
307
|
value: e.modelValue,
|
|
308
308
|
placeholder: e.placeholder,
|
|
309
309
|
disabled: e.disabled,
|
|
310
|
-
"aria-label":
|
|
311
|
-
onInput:
|
|
312
|
-
}, null, 42,
|
|
313
|
-
ee
|
|
310
|
+
"aria-label": s(l).colorPicker.hexValue,
|
|
311
|
+
onInput: S
|
|
312
|
+
}, null, 42, fe)),
|
|
313
|
+
v(ee, {
|
|
314
314
|
"enter-active-class": "tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
315
315
|
"enter-from-class": "tpl:opacity-0 tpl:scale-95 tpl:translate-y-1",
|
|
316
316
|
"enter-to-class": "tpl:opacity-100 tpl:scale-100 tpl:translate-y-0",
|
|
@@ -321,24 +321,73 @@ var ue = [
|
|
|
321
321
|
default: i(() => [u.value ? (r(), _("div", {
|
|
322
322
|
key: 0,
|
|
323
323
|
ref_key: "popoverRef",
|
|
324
|
-
ref:
|
|
324
|
+
ref: d,
|
|
325
325
|
class: "tpl:absolute tpl:left-0 tpl:top-full tpl:z-50 tpl:mt-2 tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-3 tpl:shadow-lg"
|
|
326
|
-
}, [
|
|
327
|
-
color:
|
|
328
|
-
"aria-label":
|
|
329
|
-
onColorChanged:
|
|
326
|
+
}, [f("hex-color-picker", {
|
|
327
|
+
color: b.value,
|
|
328
|
+
"aria-label": s(l).colorPicker.pickColor,
|
|
329
|
+
onColorChanged: x,
|
|
330
330
|
onKeydown: n[1] ||= h((e) => u.value = !1, ["escape"])
|
|
331
|
-
}, null, 40,
|
|
331
|
+
}, null, 40, pe)], 512)) : a("", !0)]),
|
|
332
332
|
_: 1
|
|
333
333
|
})
|
|
334
334
|
], 2));
|
|
335
335
|
}
|
|
336
|
-
}),
|
|
336
|
+
}), he = { class: "tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-2 tpl:text-[12px] tpl:text-[var(--tpl-text)]" }, ge = ["checked"], _e = /* @__PURE__ */ e({
|
|
337
|
+
__name: "CheckboxItem",
|
|
338
|
+
props: {
|
|
339
|
+
modelValue: { type: Boolean },
|
|
340
|
+
label: {}
|
|
341
|
+
},
|
|
342
|
+
emits: ["update:modelValue"],
|
|
343
|
+
setup(e, { emit: t }) {
|
|
344
|
+
let n = t;
|
|
345
|
+
return (t, i) => (r(), _("label", he, [f("input", {
|
|
346
|
+
type: "checkbox",
|
|
347
|
+
class: "tpl:size-3.5 tpl:cursor-pointer tpl:accent-[var(--tpl-primary)]",
|
|
348
|
+
checked: e.modelValue,
|
|
349
|
+
onChange: i[0] ||= (e) => n("update:modelValue", e.target.checked)
|
|
350
|
+
}, null, 40, ge), o(" " + u(e.label), 1)]));
|
|
351
|
+
}
|
|
352
|
+
}), ve = { class: "tpl:mb-3.5" }, ye = /* @__PURE__ */ e({
|
|
353
|
+
__name: "FieldRow",
|
|
354
|
+
props: { label: {} },
|
|
355
|
+
setup(e) {
|
|
356
|
+
return (t, i) => (r(), _("div", ve, [e.label ? (r(), _("label", {
|
|
357
|
+
key: 0,
|
|
358
|
+
class: g(s(b))
|
|
359
|
+
}, u(e.label), 3)) : a("", !0), n(t.$slots, "default")]));
|
|
360
|
+
}
|
|
361
|
+
}), be = { class: "tpl:flex tpl:items-stretch" }, xe = [
|
|
362
|
+
"value",
|
|
363
|
+
"min",
|
|
364
|
+
"max"
|
|
365
|
+
], Se = /* @__PURE__ */ e({
|
|
366
|
+
__name: "NumberWithSuffix",
|
|
367
|
+
props: {
|
|
368
|
+
modelValue: {},
|
|
369
|
+
min: {},
|
|
370
|
+
max: {},
|
|
371
|
+
suffix: {}
|
|
372
|
+
},
|
|
373
|
+
emits: ["update:modelValue"],
|
|
374
|
+
setup(e, { emit: t }) {
|
|
375
|
+
let n = t;
|
|
376
|
+
return (t, i) => (r(), _("div", be, [f("input", {
|
|
377
|
+
type: "number",
|
|
378
|
+
class: g(s(C)),
|
|
379
|
+
value: e.modelValue,
|
|
380
|
+
min: e.min,
|
|
381
|
+
max: e.max,
|
|
382
|
+
onInput: i[0] ||= (e) => n("update:modelValue", Number(e.target.value))
|
|
383
|
+
}, null, 42, xe), f("span", { class: g(s(S)) }, u(e.suffix), 3)]));
|
|
384
|
+
}
|
|
385
|
+
}), Ce = [
|
|
337
386
|
"aria-checked",
|
|
338
387
|
"aria-label",
|
|
339
388
|
"title",
|
|
340
389
|
"onClick"
|
|
341
|
-
],
|
|
390
|
+
], we = { key: 1 }, Te = /* @__PURE__ */ e({
|
|
342
391
|
__name: "SlidingPillSelect",
|
|
343
392
|
props: {
|
|
344
393
|
options: {},
|
|
@@ -346,78 +395,45 @@ var ue = [
|
|
|
346
395
|
},
|
|
347
396
|
emits: ["update:modelValue"],
|
|
348
397
|
setup(e, { emit: n }) {
|
|
349
|
-
let i = e, o = n,
|
|
398
|
+
let i = e, o = n, s = p(() => i.options.findIndex((e) => e.value === i.modelValue)), f = p(() => `translateX(${Math.max(s.value, 0) * 100}%)`);
|
|
350
399
|
return (n, i) => (r(), _("div", {
|
|
351
400
|
role: "radiogroup",
|
|
352
401
|
class: "tpl:relative tpl:grid tpl:rounded-[var(--tpl-radius-sm)] tpl:p-1",
|
|
353
|
-
style:
|
|
402
|
+
style: c({
|
|
354
403
|
gridTemplateColumns: `repeat(${e.options.length}, 1fr)`,
|
|
355
404
|
backgroundColor: "var(--tpl-bg-hover)"
|
|
356
405
|
})
|
|
357
|
-
}, [
|
|
406
|
+
}, [s.value >= 0 ? (r(), _("div", {
|
|
358
407
|
key: 0,
|
|
359
408
|
class: "tpl:absolute tpl:inset-y-1 tpl:rounded-[var(--tpl-radius-sm)]",
|
|
360
|
-
style:
|
|
409
|
+
style: c({
|
|
361
410
|
left: "4px",
|
|
362
411
|
width: `calc((100% - 8px) / ${e.options.length})`,
|
|
363
|
-
transform:
|
|
412
|
+
transform: f.value,
|
|
364
413
|
backgroundColor: "var(--tpl-bg)",
|
|
365
414
|
boxShadow: "var(--tpl-shadow)",
|
|
366
415
|
transition: "transform 120ms cubic-bezier(0.16, 1, 0.3, 1)"
|
|
367
416
|
})
|
|
368
|
-
}, null, 4)) : a("", !0), (r(!0), _(
|
|
417
|
+
}, null, 4)) : a("", !0), (r(!0), _(l, null, t(e.options, (t) => (r(), _("button", {
|
|
369
418
|
key: t.value,
|
|
370
419
|
role: "radio",
|
|
371
420
|
"aria-checked": e.modelValue === t.value,
|
|
372
421
|
"aria-label": t.label,
|
|
373
422
|
class: "tpl:relative tpl:z-10 tpl:flex tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1 tpl:rounded-[var(--tpl-radius-sm)] tpl:border-none tpl:bg-transparent tpl:px-2.5 tpl:py-[5px] tpl:text-xs tpl:font-medium",
|
|
374
|
-
style:
|
|
423
|
+
style: c({
|
|
375
424
|
color: e.modelValue === t.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
376
425
|
transition: "color 120ms cubic-bezier(0.16, 1, 0.3, 1)"
|
|
377
426
|
}),
|
|
378
427
|
title: t.label,
|
|
379
428
|
onClick: (e) => o("update:modelValue", t.value)
|
|
380
|
-
}, [t.icon ? (r(),
|
|
429
|
+
}, [t.icon ? (r(), d(y(t.icon), {
|
|
381
430
|
key: 0,
|
|
382
431
|
size: 14,
|
|
383
432
|
"stroke-width": 2
|
|
384
|
-
})) : (r(), _("span",
|
|
385
|
-
}
|
|
386
|
-
}), _e = { class: "tpl:mb-3.5" }, ve = /* @__PURE__ */ e({
|
|
387
|
-
__name: "FieldRow",
|
|
388
|
-
props: { label: {} },
|
|
389
|
-
setup(e) {
|
|
390
|
-
return (t, i) => (r(), _("div", _e, [e.label ? (r(), _("label", {
|
|
391
|
-
key: 0,
|
|
392
|
-
class: g(o(b))
|
|
393
|
-
}, l(e.label), 3)) : a("", !0), n(t.$slots, "default")]));
|
|
394
|
-
}
|
|
395
|
-
}), ye = { class: "tpl:flex tpl:items-stretch" }, be = [
|
|
396
|
-
"value",
|
|
397
|
-
"min",
|
|
398
|
-
"max"
|
|
399
|
-
], xe = /* @__PURE__ */ e({
|
|
400
|
-
__name: "NumberWithSuffix",
|
|
401
|
-
props: {
|
|
402
|
-
modelValue: {},
|
|
403
|
-
min: {},
|
|
404
|
-
max: {},
|
|
405
|
-
suffix: {}
|
|
406
|
-
},
|
|
407
|
-
emits: ["update:modelValue"],
|
|
408
|
-
setup(e, { emit: t }) {
|
|
409
|
-
let n = t;
|
|
410
|
-
return (t, i) => (r(), _("div", ye, [d("input", {
|
|
411
|
-
type: "number",
|
|
412
|
-
class: g(o(C)),
|
|
413
|
-
value: e.modelValue,
|
|
414
|
-
min: e.min,
|
|
415
|
-
max: e.max,
|
|
416
|
-
onInput: i[0] ||= (e) => n("update:modelValue", Number(e.target.value))
|
|
417
|
-
}, null, 42, be), d("span", { class: g(o(S)) }, l(e.suffix), 3)]));
|
|
433
|
+
})) : (r(), _("span", we, u(t.label), 1))], 12, Ce))), 128))], 4));
|
|
418
434
|
}
|
|
419
435
|
});
|
|
420
436
|
//#endregion
|
|
421
|
-
export {
|
|
437
|
+
export { me as a, _e as i, Se as n, ye as r, Te as t };
|
|
422
438
|
|
|
423
|
-
//# sourceMappingURL=
|
|
439
|
+
//# sourceMappingURL=SlidingPillSelect-BhPCkqVu.js.map
|