ep-lib-ts 1.1.8 → 1.1.10

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.
@@ -2,7 +2,6 @@ import { defineComponent, computed, ref, createElementBlock, openBlock, Fragment
2
2
  import { useVueFlow, VueFlow } from "@vue-flow/core";
3
3
  import { useCreateUid } from "../../composables/useCreateUid.js";
4
4
  import _sfc_main$1 from "../tools/AssociationNode.vue2.js";
5
- /* empty css */
6
5
  const _hoisted_1 = {
7
6
  key: 0,
8
7
  class: "p-2 text-center text-sm text-neutral-300"
@@ -239,8 +238,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
239
238
  }),
240
239
  onConnect,
241
240
  id: unref(id),
242
- "max-zoom": 1,
243
- "min-zoom": 1,
244
241
  nodes: nodes.value,
245
242
  edges: _ctx.interactive ? edges.value : correctEdges.value,
246
243
  "nodes-draggable": false,
@@ -1 +1 @@
1
- {"version":3,"file":"EpAssociation.vue.js","sources":["../../../src/components/interactions/EpAssociation.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ref, computed } from 'vue'\nimport type { Node, Edge, Connection, EdgeMouseEvent } from '@vue-flow/core' \nimport { VueFlow, useVueFlow } from '@vue-flow/core'\nimport type { EpAssociationProps } from \"~/types/interactions/EpAssociation\";\nimport { useCreateUid } from '~/composables/useCreateUid';\n\nimport AssociationNode from '../tools/AssociationNode.vue';\nimport type { LeftOption, RightOption } from '~/types/Association';\n\nconst props = withDefaults(defineProps<EpAssociationProps>(), {\n interactive: false,\n mustTry: false,\n random: false,\n});\n\nconst id = useCreateUid();\n\nconst { fitView, onEdgeDoubleClick } = useVueFlow({ id: id })\n\nconst shuffle = (tab: any) => {\n for (let i = tab.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [tab[i], tab[j]] = [tab[j], tab[i]];\n }\n return tab;\n}\n\n\nconst leftNodes = computed<LeftOption[]>(() => {\n if(props.random) {\n return shuffle([...props.leftOptions]);\n }\n return props.leftOptions;\n});\n\nconst rightNodes = computed<RightOption[]>(() => {\n if(props.random) {\n return shuffle([...props.rightOptions]);\n }\n return props.rightOptions;\n});\n\n// these are our nodes\nconst initialNodes = computed<Node[]>(() => {\n let yLeft = 50;\n let yRight = 50;\n const GAP = 40;\n\n let left: Node [] = leftNodes.value.map((option, idx) => {\n const h = option.height ?? 100;\n let result = {\n id: option.uid,\n type: 'association',\n position: { x: 50, y: yLeft },\n data: { \n label: option.text,\n index: idx,\n left: true\n }\n } as Node\n\n yLeft += h + GAP;\n return result;\n\n });\n\n let right: Node [] = rightNodes.value.map((option, idx) => {\n const h = option.height ?? 100;\n const result = {\n id: option.uid,\n type: 'association',\n position: { x: 550, y: yRight },\n data: { \n label: option.text,\n index: idx,\n left: false\n }\n } as Node\n\n yRight += h + GAP;\n return result;\n });\n\n return [...left, ...right];\n})\n\nconst nodes = ref<Node[]>(initialNodes.value)\n\n// The correct edges\nconst correctEdges = computed<Edge[]>(() => {\n return leftNodes.value.flatMap((option) => {\n return option.answers.map((answer) => {\n return {\n id: 'e' + option.uid + '->' + answer,\n type: 'straight',\n source: option.uid,\n target: answer,\n animated: false,\n style: {\n strokeWidth: 3,\n },\n updatable: false\n }\n });\n })\n});\n\nconst edges = ref<Edge[]>([]);\n\nconst trying = ref(true);\nconst solution = ref(false);\nconst validating = ref(false);\n\nconst validate = () => {\n trying.value = false;\n solution.value = false;\n validating.value = true;\n\n // Put the right colors for the validation\n let incorrectNodes = new Set<string>();\n\n // Check edges\n edges.value = edges.value.map((edge: Edge) => {\n let inside = false;\n for(let correctEdge of correctEdges.value) {\n if(edge.id == correctEdge.id)\n inside = true;\n }\n if(!inside) {\n incorrectNodes.add(edge.source);\n incorrectNodes.add(edge.target);\n }\n return {\n ...edge,\n style: {\n ...edge.style,\n stroke: inside ? '#16a34a' : '#dc2626'\n }\n }\n });\n\n for(let correctEdge of correctEdges.value) {\n let inside = false;\n for(let edge of edges.value) {\n if(edge.id == correctEdge.id)\n inside = true;\n }\n if(!inside) {\n incorrectNodes.add(correctEdge.source);\n incorrectNodes.add(correctEdge.target);\n }\n }\n\n // Check Nodes\n nodes.value = nodes.value.map((node: Node) => {\n console.log('here')\n if(incorrectNodes.has(node.id)) \n return {\n ...node,\n data: {\n ...node.data,\n mode: 'wrong'\n }\n }\n else\n return {\n ...node,\n data: {\n ...node.data,\n mode: 'correct'\n }\n }\n })\n}\n\nconst retry = () => {\n trying.value = true;\n solution.value = false;\n validating.value = false;\n\n edges.value = [];\n nodes.value = nodes.value.map((node: Node) => { \n return {\n ...node,\n data: {\n ...node.data,\n mode: 'neutral'\n }\n }\n });\n}\n\nconst showAnswer = () => {\n fitView();\n\n solution.value = true;\n trying.value = false;\n validating.value = false;\n\n edges.value = correctEdges.value;\n nodes.value = nodes.value.map((node: Node) => { \n return {\n ...node,\n data: {\n ...node.data,\n mode: 'neutral'\n }\n }\n });\n}\n\nconst onConnect = (connection: Connection) => {\n let newEdge: Edge = {\n id: 'e' + connection.source + '->' + connection.target,\n type: 'straight',\n source: connection.source,\n target: connection.target,\n animated: false,\n updatable: false,\n style: {\n strokeWidth: 3,\n },\n }\n edges.value = [...edges.value, newEdge]\n}\n\n\nonEdgeDoubleClick((event: EdgeMouseEvent) => {\n if(trying.value) {\n edges.value = edges.value.filter((edge: Edge) => {\n return edge.id !== event.edge.id\n })\n }\n console.log('edge double clicked', event)\n})\n\nconst computedHeight = computed(() => {\n let GAP = 40;\n let heightLeft = GAP;\n let heightRight = GAP;\n\n leftNodes.value.forEach((option) => {\n heightLeft += (option.height ?? 100) + GAP;\n });\n\n rightNodes.value.forEach((option) => {\n heightRight += (option.height ?? 100) + GAP;\n });\n\n return Math.max(heightLeft, heightRight);\n})\n\n</script>\n\n<template>\n <div class=\"border-2 rounded\" :style=\"{ width: '90%', height: computedHeight + 'px', margin: 'auto' }\">\n <VueFlow \n @pane-ready=\"() => { fitView() }\"\n @connect = \"onConnect\"\n\n :id=\"id\"\n :max-zoom=\"1\" \n :min-zoom=\"1\"\n :nodes=\"nodes\" \n :edges=\"(interactive)? edges : correctEdges\"\n :nodes-draggable=\"false\"\n :pan-on-drag=\"false\"\n :nodes-connectable=\"interactive && trying\"\n :zoom-on-scroll=\"false\"\n :zoom-on-pinch=\"false\"\n :zoom-on-double-click=\"false\"\n >\n <!-- bind the custom node type to the component -->\n <template #node-association=\"AssociationNodeProps\">\n <AssociationNode v-bind=\"AssociationNodeProps\" />\n </template>\n </VueFlow>\n </div>\n <div class=\"p-2 text-center text-sm text-neutral-300\" v-if=\"interactive\">\n <p v-if=\"trying\">Vous pouvez double-clicker sur une arête pour la supprimer.</p>\n <p v-if=\"validating\">Les éléments en verts sont corrects et ceux en rouge sont incorrects.</p>\n </div>\n <div class=\"flex items-center justify-around\" v-if=\"interactive\">\n <button\n class=\"bg-blue-500 text-white px-3 py-2 m-2 rounded-md text-center\"\n @click=\"(trying)? validate() : retry()\"\n >\n {{(trying)? 'Valider' : 'Réessayer'}}\n </button>\n\n <button\n :class=\"`${(mustTry && trying)? 'bg-blue-300' : 'bg-blue-500'} text-white px-3 py-2 m-2 rounded-md text-center`\"\n @click=\"showAnswer()\" \n :disabled=\"(mustTry && trying)\"\n >\n Voir la réponse\n </button>\n </div>\n</template>\n\n"],"names":["_createElementVNode","_createVNode","_unref","interactive","_withCtx","AssociationNode","_openBlock","_createElementBlock","_normalizeClass","mustTry"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,UAAM,QAAQ;AAMd,UAAM,KAAK,aAAA;AAEX,UAAM,EAAE,SAAS,kBAAA,IAAsB,WAAW,EAAE,IAAQ;AAE5D,UAAM,UAAU,CAAC,QAAa;AAC5B,eAAS,IAAI,IAAI,SAAS,GAAG,IAAI,GAAG,KAAK;AACvC,cAAM,IAAI,KAAK,MAAM,KAAK,YAAY,IAAI,EAAE;AAC5C,SAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC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A,YAAA;;;;QAIGF,KAAAA,eAA5DG,UAAA,GAAAC,mBAGM,OAHN,YAGM;AAAA,UAFO,OAAA,SAATD,UAAA,GAAAC,mBAAgF,iBAA/D,6DAA2D;UACnE,WAAA,SAATD,UAAA,GAAAC,mBAA8F,iBAAzE,uEAAqE;;QAE1CJ,KAAAA,eAApDG,UAAA,GAAAC,mBAeM,OAfN,YAeM;AAAA,UAdFP,mBAKS,UAAA;AAAA,YAJL,OAAM;AAAA,YACL,SAAK,OAAA,CAAA,MAAA,OAAA,CAAA,IAAA,CAAA,WAAG,OAAA,QAAS,SAAA,IAAa,MAAA;AAAA,UAAK,mBAEjC,OAAA,QAAM,YAAA,WAAA,GAAA,CAAA;AAAA,UAGbA,mBAMS,UAAA;AAAA,YALJ,OAAKQ,eAAA,GAAMC,KAAAA,WAAW,OAAA,QAAM,gBAAA,aAAA,kDAAA;AAAA,YAC5B,+CAAO;YACP,UAAWA,KAAAA,WAAW,OAAA;AAAA,UAAA,GAC1B,qBAED,IAAA,UAAA;AAAA,QAAA;;;;;"}
1
+ {"version":3,"file":"EpAssociation.vue.js","sources":["../../../src/components/interactions/EpAssociation.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ref, computed } from 'vue'\nimport type { Node, Edge, Connection, EdgeMouseEvent } from '@vue-flow/core' \nimport { VueFlow, useVueFlow } from '@vue-flow/core'\nimport type { EpAssociationProps } from \"~/types/interactions/EpAssociation\";\nimport { useCreateUid } from '~/composables/useCreateUid';\n\nimport AssociationNode from '../tools/AssociationNode.vue';\nimport type { LeftOption, RightOption } from '~/types/Association';\n\nconst props = withDefaults(defineProps<EpAssociationProps>(), {\n interactive: false,\n mustTry: false,\n random: false,\n});\n\nconst id = useCreateUid();\n\nconst { fitView, onEdgeDoubleClick } = useVueFlow({ id: id })\n\nconst shuffle = (tab: any) => {\n for (let i = tab.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [tab[i], tab[j]] = [tab[j], tab[i]];\n }\n return tab;\n}\n\n\nconst leftNodes = computed<LeftOption[]>(() => {\n if(props.random) {\n return shuffle([...props.leftOptions]);\n }\n return props.leftOptions;\n});\n\nconst rightNodes = computed<RightOption[]>(() => {\n if(props.random) {\n return shuffle([...props.rightOptions]);\n }\n return props.rightOptions;\n});\n\n// these are our nodes\nconst initialNodes = computed<Node[]>(() => {\n let yLeft = 50;\n let yRight = 50;\n const GAP = 40;\n\n let left: Node [] = leftNodes.value.map((option, idx) => {\n const h = option.height ?? 100;\n let result = {\n id: option.uid,\n type: 'association',\n position: { x: 50, y: yLeft },\n data: { \n label: option.text,\n index: idx,\n left: true\n }\n } as Node\n\n yLeft += h + GAP;\n return result;\n\n });\n\n let right: Node [] = rightNodes.value.map((option, idx) => {\n const h = option.height ?? 100;\n const result = {\n id: option.uid,\n type: 'association',\n position: { x: 550, y: yRight },\n data: { \n label: option.text,\n index: idx,\n left: false\n }\n } as Node\n\n yRight += h + GAP;\n return result;\n });\n\n return [...left, ...right];\n})\n\nconst nodes = ref<Node[]>(initialNodes.value)\n\n// The correct edges\nconst correctEdges = computed<Edge[]>(() => {\n return leftNodes.value.flatMap((option) => {\n return option.answers.map((answer) => {\n return {\n id: 'e' + option.uid + '->' + answer,\n type: 'straight',\n source: option.uid,\n target: answer,\n animated: false,\n style: {\n strokeWidth: 3,\n },\n updatable: false\n }\n });\n })\n});\n\nconst edges = ref<Edge[]>([]);\n\nconst trying = ref(true);\nconst solution = ref(false);\nconst validating = ref(false);\n\nconst validate = () => {\n trying.value = false;\n solution.value = false;\n validating.value = true;\n\n // Put the right colors for the validation\n let incorrectNodes = new Set<string>();\n\n // Check edges\n edges.value = edges.value.map((edge: Edge) => {\n let inside = false;\n for(let correctEdge of correctEdges.value) {\n if(edge.id == correctEdge.id)\n inside = true;\n }\n if(!inside) {\n incorrectNodes.add(edge.source);\n incorrectNodes.add(edge.target);\n }\n return {\n ...edge,\n style: {\n ...edge.style,\n stroke: inside ? '#16a34a' : '#dc2626'\n }\n }\n });\n\n for(let correctEdge of correctEdges.value) {\n let inside = false;\n for(let edge of edges.value) {\n if(edge.id == correctEdge.id)\n inside = true;\n }\n if(!inside) {\n incorrectNodes.add(correctEdge.source);\n incorrectNodes.add(correctEdge.target);\n }\n }\n\n // Check Nodes\n nodes.value = nodes.value.map((node: Node) => {\n console.log('here')\n if(incorrectNodes.has(node.id)) \n return {\n ...node,\n data: {\n ...node.data,\n mode: 'wrong'\n }\n }\n else\n return {\n ...node,\n data: {\n ...node.data,\n mode: 'correct'\n }\n }\n })\n}\n\nconst retry = () => {\n trying.value = true;\n solution.value = false;\n validating.value = false;\n\n edges.value = [];\n nodes.value = nodes.value.map((node: Node) => { \n return {\n ...node,\n data: {\n ...node.data,\n mode: 'neutral'\n }\n }\n });\n}\n\nconst showAnswer = () => {\n fitView();\n\n solution.value = true;\n trying.value = false;\n validating.value = false;\n\n edges.value = correctEdges.value;\n nodes.value = nodes.value.map((node: Node) => { \n return {\n ...node,\n data: {\n ...node.data,\n mode: 'neutral'\n }\n }\n });\n}\n\nconst onConnect = (connection: Connection) => {\n let newEdge: Edge = {\n id: 'e' + connection.source + '->' + connection.target,\n type: 'straight',\n source: connection.source,\n target: connection.target,\n animated: false,\n updatable: false,\n style: {\n strokeWidth: 3,\n },\n }\n edges.value = [...edges.value, newEdge]\n}\n\n\nonEdgeDoubleClick((event: EdgeMouseEvent) => {\n if(trying.value) {\n edges.value = edges.value.filter((edge: Edge) => {\n return edge.id !== event.edge.id\n })\n }\n console.log('edge double clicked', event)\n})\n\nconst computedHeight = computed(() => {\n let GAP = 40;\n let heightLeft = GAP;\n let heightRight = GAP;\n\n leftNodes.value.forEach((option) => {\n heightLeft += (option.height ?? 100) + GAP;\n });\n\n rightNodes.value.forEach((option) => {\n heightRight += (option.height ?? 100) + GAP;\n });\n\n return Math.max(heightLeft, heightRight);\n})\n\n</script>\n\n<template>\n <div class=\"border-2 rounded\" :style=\"{ width: '90%', height: computedHeight + 'px', margin: 'auto' }\">\n <VueFlow \n @pane-ready=\"() => { fitView() }\"\n @connect = \"onConnect\"\n\n :id=\"id\"\n :nodes=\"nodes\" \n :edges=\"(interactive)? edges : correctEdges\"\n :nodes-draggable=\"false\"\n :pan-on-drag=\"false\"\n :nodes-connectable=\"interactive && trying\"\n :zoom-on-scroll=\"false\"\n :zoom-on-pinch=\"false\"\n :zoom-on-double-click=\"false\"\n >\n <!-- bind the custom node type to the component -->\n <template #node-association=\"AssociationNodeProps\">\n <AssociationNode v-bind=\"AssociationNodeProps\" />\n </template>\n </VueFlow>\n </div>\n <div class=\"p-2 text-center text-sm text-neutral-300\" v-if=\"interactive\">\n <p v-if=\"trying\">Vous pouvez double-clicker sur une arête pour la supprimer.</p>\n <p v-if=\"validating\">Les éléments en verts sont corrects et ceux en rouge sont incorrects.</p>\n </div>\n <div class=\"flex items-center justify-around\" v-if=\"interactive\">\n <button\n class=\"bg-blue-500 text-white px-3 py-2 m-2 rounded-md text-center\"\n @click=\"(trying)? validate() : retry()\"\n >\n {{(trying)? 'Valider' : 'Réessayer'}}\n </button>\n\n <button\n :class=\"`${(mustTry && trying)? 'bg-blue-300' : 'bg-blue-500'} text-white px-3 py-2 m-2 rounded-md text-center`\"\n @click=\"showAnswer()\" \n :disabled=\"(mustTry && trying)\"\n >\n Voir la réponse\n </button>\n </div>\n</template>\n\n"],"names":["_createElementVNode","_createVNode","_unref","interactive","_withCtx","AssociationNode","_openBlock","_createElementBlock","_normalizeClass","mustTry"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUA,UAAM,QAAQ;AAMd,UAAM,KAAK,aAAA;AAEX,UAAM,EAAE,SAAS,kBAAA,IAAsB,WAAW,EAAE,IAAQ;AAE5D,UAAM,UAAU,CAAC,QAAa;AAC5B,eAAS,IAAI,IAAI,SAAS,GAAG,IAAI,GAAG,KAAK;AACvC,cAAM,IAAI,KAAK,MAAM,KAAK,YAAY,IAAI,EAAE;AAC5C,SAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI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AA;AAAA,YAAA;;;;QAIGF,KAAAA,eAA5DG,UAAA,GAAAC,mBAGM,OAHN,YAGM;AAAA,UAFO,OAAA,SAATD,UAAA,GAAAC,mBAAgF,iBAA/D,6DAA2D;UACnE,WAAA,SAATD,UAAA,GAAAC,mBAA8F,iBAAzE,uEAAqE;;QAE1CJ,KAAAA,eAApDG,UAAA,GAAAC,mBAeM,OAfN,YAeM;AAAA,UAdFP,mBAKS,UAAA;AAAA,YAJL,OAAM;AAAA,YACL,SAAK,OAAA,CAAA,MAAA,OAAA,CAAA,IAAA,CAAA,WAAG,OAAA,QAAS,SAAA,IAAa,MAAA;AAAA,UAAK,mBAEjC,OAAA,QAAM,YAAA,WAAA,GAAA,CAAA;AAAA,UAGbA,mBAMS,UAAA;AAAA,YALJ,OAAKQ,eAAA,GAAMC,KAAAA,WAAW,OAAA,QAAM,gBAAA,aAAA,kDAAA;AAAA,YAC5B,+CAAO;YACP,UAAWA,KAAAA,WAAW,OAAA;AAAA,UAAA,GAC1B,qBAED,IAAA,UAAA;AAAA,QAAA;;;;;"}
@@ -1,5 +1,4 @@
1
1
  import _sfc_main from "./AssociationNode.vue2.js";
2
- /* empty css */
3
2
  export {
4
3
  _sfc_main as default
5
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AssociationNode.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"AssociationNode.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,7 +1,8 @@
1
- import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, createElementVNode, createVNode, toDisplayString, unref, withCtx } from "vue";
1
+ import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, createElementVNode, createVNode, unref, toDisplayString, normalizeStyle } from "vue";
2
2
  import { Handle, Position } from "@vue-flow/core";
3
3
  import _sfc_main$1 from "../basics/EpIcon.vue.js";
4
- const _hoisted_1 = { class: "px-4 py-2" };
4
+ import { useRenderText } from "../../composables/useRenderText.js";
5
+ const _hoisted_1 = ["innerHTML"];
5
6
  const plug = "M17,16H21V14H17V10H21V8H17V8C17,7 16,6 15,6H9.5L6,9.5H3V14.5H6L9.5,18H15C16,18 17,17 17,16Z";
6
7
  const socket = "M7,16C7,17 8,18 9,18H14.5L18,14.5H21V9.5H18L14.5,6H9C8,6 7,7 7,8Z M7 19 L7 5";
7
8
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -43,22 +44,38 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43
44
  return openBlock(), createElementBlock("div", {
44
45
  class: normalizeClass(`shadow-lg rounded w-96 relative bg-surface-2 dark:bg-surface-2-dark ${colorStyle.value}`)
45
46
  }, [
46
- createElementVNode("div", _hoisted_1, toDisplayString(_ctx.data.label), 1),
47
+ createElementVNode("div", {
48
+ class: "px-4 py-2 break-words",
49
+ innerHTML: unref(useRenderText)(_ctx.data.label)
50
+ }, null, 8, _hoisted_1),
47
51
  createElementVNode("span", {
48
52
  class: normalizeClass(`rounded-full w-6 h-6 flex justify-center bg-white dark:bg-neutral-800 items-center absolute bottom-1/3 ${_ctx.data.left ? "-left-3" : "-right-3"} ${colorStyle.value}`)
49
53
  }, toDisplayString(_ctx.data.left ? String.fromCharCode(65 + _ctx.data.index) : _ctx.data.index), 3),
50
54
  createVNode(unref(Handle), {
51
- type: `${_ctx.data.left ? "source" : "target"}`,
55
+ type: _ctx.data.left ? "source" : "target",
52
56
  position: _ctx.data.left ? unref(Position).Right : unref(Position).Left,
53
- class: "association-handle"
54
- }, {
55
- default: withCtx(() => [
56
- createVNode(_sfc_main$1, {
57
- "icon-path": _ctx.data.left ? plug : socket
58
- }, null, 8, ["icon-path"])
59
- ]),
60
- _: 1
61
- }, 8, ["type", "position"])
57
+ style: normalizeStyle({
58
+ width: "20px",
59
+ // handle invisible, pas d’espace
60
+ height: "20px",
61
+ top: "50%",
62
+ zIndex: "100",
63
+ transform: "translateY(-50%)",
64
+ left: _ctx.data.left ? "96%" : "-10px",
65
+ opacity: 0
66
+ })
67
+ }, null, 8, ["type", "position", "style"]),
68
+ createVNode(_sfc_main$1, {
69
+ "icon-path": _ctx.data.left ? plug : socket,
70
+ style: normalizeStyle({
71
+ position: "absolute",
72
+ width: "30px",
73
+ height: "30px",
74
+ top: "50%",
75
+ transform: "translateY(-50%)",
76
+ left: _ctx.data.left ? "97%" : "-20px"
77
+ })
78
+ }, null, 8, ["icon-path", "style"])
62
79
  ], 2);
63
80
  };
64
81
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AssociationNode.vue2.js","sources":["../../../src/components/tools/AssociationNode.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { Position, Handle } from '@vue-flow/core'\nimport type { NodeProps } from '@vue-flow/core'\nimport EpIcon from '../basics/EpIcon.vue'\n\n\nconst plug = 'M17,16H21V14H17V10H21V8H17V8C17,7 16,6 15,6H9.5L6,9.5H3V14.5H6L9.5,18H15C16,18 17,17 17,16Z';\nconst socket = 'M7,16C7,17 8,18 9,18H14.5L18,14.5H21V9.5H18L14.5,6H9C8,6 7,7 7,8Z M7 19 L7 5';\n\ninterface AssociationData {\n mode?: 'neutral' | 'correct' | 'wrong';\n left: boolean;\n index: number;\n label: string;\n}\n\nconst props = withDefaults(defineProps<NodeProps<AssociationData>>(), {});\n\nconst colorStyle = computed(() => {\n if(!props.data.mode || props.data.mode == 'neutral') {\n return 'border-2 border-black dark:border-white'\n }\n if(props.data.mode == 'correct') {\n return 'border-2 border-green-600'\n } else if(props.data.mode == 'wrong') {\n return 'border-2 border-red-600'\n }\n});\n\n</script>\n\n<template>\n <div :class=\"`shadow-lg rounded w-96 relative bg-surface-2 dark:bg-surface-2-dark ${colorStyle}`\">\n <div class=\"px-4 py-2\">{{ data.label }}</div>\n <span :class=\"`rounded-full w-6 h-6 flex justify-center bg-white dark:bg-neutral-800 items-center absolute bottom-1/3 ${(data.left)? '-left-3' : '-right-3'} ${colorStyle}`\">{{ (data.left)? String.fromCharCode(65 + data.index) : data.index }}</span>\n\n <Handle \n :type=\"`${(data.left)? 'source' : 'target'}`\" \n :position=\"(data.left)? Position.Right : Position.Left\"\n class=\"association-handle\"\n >\n <EpIcon :icon-path=\"(data.left)? plug : socket\" />\n </Handle>\n </div>\n</template>\n\n<style>\n.association-handle {\n width: 30px !important;\n height: 30px !important;\n background: transparent !important;\n border: none !important;\n border-radius: 0 !important;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.association-handle svg {\n pointer-events: none;\n}\n\n\n.association-handle[data-handlepos=\"right\"] {\n right: -6px !important;\n}\n\n.association-handle[data-handlepos=\"left\"] {\n left: -6px !important;\n}\n</style>\n"],"names":["_createElementBlock","_createElementVNode","_toDisplayString","data","_normalizeClass","_createVNode","_unref","EpIcon"],"mappings":";;;;AAOA,MAAM,OAAO;AACb,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;AASf,UAAM,QAAQ;AAEd,UAAM,aAAa,SAAS,MAAM;AAC9B,UAAG,CAAC,MAAM,KAAK,QAAQ,MAAM,KAAK,QAAQ,WAAW;AACjD,eAAO;AAAA,MACX;AACA,UAAG,MAAM,KAAK,QAAQ,WAAW;AAC7B,eAAO;AAAA,MACX,WAAU,MAAM,KAAK,QAAQ,SAAS;AAClC,eAAO;AAAA,MACX;AAAA,IACJ,CAAC;;0BAKGA,mBAWM,OAAA;AAAA,QAXA,6FAA8E,WAAA,KAAU,EAAA;AAAA,MAAA;QAC1FC,mBAA6C,OAA7C,YAA6CC,gBAAnBC,KAAAA,KAAK,KAAK,GAAA,CAAA;AAAA,QACpCF,mBAAwP,QAAA;AAAA,UAAjP,OAAKG,eAAA,0GAA6GD,KAAAA,KAAK,iCAAiC,WAAA,KAAU,EAAA;AAAA,QAAA,GAAQA,gBAAAA,KAAAA,KAAK,OAAO,OAAO,aAAY,KAAMA,KAAAA,KAAK,KAAK,IAAIA,KAAAA,KAAK,KAAK,GAAA,CAAA;AAAA,QAE9OE,YAMSC,MAAA,MAAA,GAAA;AAAA,UALJ,MAAI,GAAMH,KAAAA,KAAK,OAAI,WAAA,QAAA;AAAA,UACnB,UAAWA,KAAAA,KAAK,OAAOG,MAAA,QAAA,EAAS,QAAQA,MAAA,QAAA,EAAS;AAAA,UAClD,OAAM;AAAA,QAAA;2BAEN,MAAkD;AAAA,YAAlDD,YAAkDE,aAAA;AAAA,cAAzC,aAAYJ,KAAAA,KAAK,OAAO,OAAO;AAAA,YAAA;;;;;;;;"}
1
+ {"version":3,"file":"AssociationNode.vue2.js","sources":["../../../src/components/tools/AssociationNode.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { Position, Handle } from '@vue-flow/core'\nimport type { NodeProps } from '@vue-flow/core'\nimport EpIcon from '../basics/EpIcon.vue'\nimport { useRenderText } from '~/composables/useRenderText';\n\n\nconst plug = 'M17,16H21V14H17V10H21V8H17V8C17,7 16,6 15,6H9.5L6,9.5H3V14.5H6L9.5,18H15C16,18 17,17 17,16Z';\nconst socket = 'M7,16C7,17 8,18 9,18H14.5L18,14.5H21V9.5H18L14.5,6H9C8,6 7,7 7,8Z M7 19 L7 5';\n\ninterface AssociationData {\n mode?: 'neutral' | 'correct' | 'wrong';\n left: boolean;\n index: number;\n label: string;\n}\n\nconst props = withDefaults(defineProps<NodeProps<AssociationData>>(), {});\n\nconst colorStyle = computed(() => {\n if(!props.data.mode || props.data.mode == 'neutral') {\n return 'border-2 border-black dark:border-white'\n }\n if(props.data.mode == 'correct') {\n return 'border-2 border-green-600'\n } else if(props.data.mode == 'wrong') {\n return 'border-2 border-red-600'\n }\n});\n\n</script>\n\n<template>\n <div :class=\"`shadow-lg rounded w-96 relative bg-surface-2 dark:bg-surface-2-dark ${colorStyle}`\">\n <div class=\"px-4 py-2 break-words\" v-html=\"useRenderText(data.label)\"></div>\n <span :class=\"`rounded-full w-6 h-6 flex justify-center bg-white dark:bg-neutral-800 items-center absolute bottom-1/3 ${(data.left)? '-left-3' : '-right-3'} ${colorStyle}`\">{{ (data.left)? String.fromCharCode(65 + data.index) : data.index }}</span>\n\n <Handle\n :type=\"data.left ? 'source' : 'target'\"\n :position=\"data.left ? Position.Right : Position.Left\"\n :style=\"{\n width: '20px', // handle invisible, pas d’espace\n height: '20px',\n top: '50%',\n zIndex: '100',\n transform: 'translateY(-50%)',\n left: data.left ? '96%' : '-10px',\n opacity: 0\n }\"\n />\n <EpIcon \n :icon-path=\"data.left ? plug : socket\"\n :style=\"{\n position: 'absolute',\n width: '30px',\n height: '30px',\n top: '50%',\n transform: 'translateY(-50%)',\n left: data.left ? '97%' : '-20px'\n }\" \n />\n </div>\n</template>\n"],"names":["_createElementBlock","_createElementVNode","_unref","data","_normalizeClass","_createVNode","_normalizeStyle","EpIcon"],"mappings":";;;;;AAQA,MAAM,OAAO;AACb,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;AASf,UAAM,QAAQ;AAEd,UAAM,aAAa,SAAS,MAAM;AAC9B,UAAG,CAAC,MAAM,KAAK,QAAQ,MAAM,KAAK,QAAQ,WAAW;AACjD,eAAO;AAAA,MACX;AACA,UAAG,MAAM,KAAK,QAAQ,WAAW;AAC7B,eAAO;AAAA,MACX,WAAU,MAAM,KAAK,QAAQ,SAAS;AAClC,eAAO;AAAA,MACX;AAAA,IACJ,CAAC;;0BAKGA,mBA4BM,OAAA;AAAA,QA5BA,6FAA8E,WAAA,KAAU,EAAA;AAAA,MAAA;QAC1FC,mBAA4E,OAAA;AAAA,UAAvE,OAAM;AAAA,UAAwB,WAAQC,MAAA,aAAA,EAAcC,KAAAA,KAAK,KAAK;AAAA,QAAA;QACnEF,mBAAwP,QAAA;AAAA,UAAjP,OAAKG,eAAA,0GAA6GD,KAAAA,KAAK,iCAAiC,WAAA,KAAU,EAAA;AAAA,QAAA,GAAQA,gBAAAA,KAAAA,KAAK,OAAO,OAAO,aAAY,KAAMA,KAAAA,KAAK,KAAK,IAAIA,KAAAA,KAAK,KAAK,GAAA,CAAA;AAAA,QAE9OE,YAYEH,MAAA,MAAA,GAAA;AAAA,UAXG,MAAMC,KAAAA,KAAK,OAAI,WAAA;AAAA,UACf,UAAUA,KAAAA,KAAK,OAAOD,MAAA,QAAA,EAAS,QAAQA,MAAA,QAAA,EAAS;AAAA,UAChD,OAAKI,eAAA;AAAA;;;;;;YAAuOH,MAAAA,KAAAA,KAAK,OAAI,QAAA;AAAA;;;QAU1PE,YAUEE,aAAA;AAAA,UATG,aAAWJ,KAAAA,KAAK,OAAO,OAAO;AAAA,UAC9B,OAAKG,eAAA;AAAA;;;;;YAA0MH,MAAAA,KAAAA,KAAK,OAAI,QAAA;AAAA,UAAA;;;;;;"}
package/dist/style.css CHANGED
@@ -1,13 +1,28 @@
1
1
 
2
+ .shape[data-v-4a99873e] {
3
+ height: var(--e4ec2c0a);
4
+ width: var(--3f346a72);
5
+ }
6
+
7
+
2
8
  .ep-info-box[data-v-cb6ebbdc] a {
3
9
  text-decoration: underline;
4
10
  font-weight: 500;
5
11
  }
12
+ /*$vite$:1*/
6
13
 
14
+ .katex[data-v-a9b6227c] {
15
+ font-size: 1.6em;
16
+ }
17
+ /*$vite$:1*/
7
18
 
8
- .shape[data-v-4a99873e] {
9
- height: var(--e4ec2c0a);
10
- width: var(--3f346a72);
19
+ .ep-tree-wrapper[data-v-482cff9d] {
20
+ overflow: auto;
21
+ border: 1px solid #ddd;
22
+ }
23
+ .ep-tree-container[data-v-482cff9d] {
24
+ width: 100%;
25
+ overflow-x: auto;
11
26
  }
12
27
  /*$vite$:1*/
13
28
 
@@ -72,42 +87,11 @@
72
87
  }
73
88
  /*$vite$:1*/
74
89
 
75
- .eptimeline-list-enter-active[data-v-6ad2fc60],
76
- .eptimeline-list-leave-active[data-v-6ad2fc60] {
77
- transition: all 0.5s ease;
78
- }
79
- .eptimeline-list-enter-from[data-v-6ad2fc60],
80
- .eptimeline-list-leave-to[data-v-6ad2fc60] {
81
- opacity: 0;
82
- transform: translateX(30px);
83
- }
84
- /*$vite$:1*/
85
-
86
90
  .ep-sensible-content[data-v-0098bf11] {
87
91
  position: relative;
88
92
  }
89
93
  /*$vite$:1*/
90
94
 
91
- .katex[data-v-a9b6227c] {
92
- font-size: 1.6em;
93
- }
94
- /*$vite$:1*/
95
-
96
- .ep-tree-wrapper[data-v-482cff9d] {
97
- overflow: auto;
98
- border: 1px solid #ddd;
99
- }
100
- .ep-tree-container[data-v-482cff9d] {
101
- width: 100%;
102
- overflow-x: auto;
103
- }
104
- /*$vite$:1*/
105
-
106
- pre {
107
- white-space: break-spaces;
108
- }
109
- /*$vite$:1*/
110
-
111
95
  @keyframes fade-6f6eb558 {
112
96
  0% {
113
97
  opacity: 0;
@@ -149,35 +133,25 @@ pre {
149
133
  }
150
134
  /*$vite$:1*/
151
135
 
152
- /* Target the top-level KaTeX container and increase the font size */
153
- .katex-block[data-v-0d66d7fc] .katex {
154
- /* Increase the overall size of the math relative to the parent font size */
155
- font-size: 2em;
156
- }
157
- /* If you want inline math to be a specific size relative to surrounding text */
158
- .katex-render[data-v-0d66d7fc] .katex-display {
159
- font-size: 1.5em;
136
+ pre {
137
+ white-space: break-spaces;
160
138
  }
161
139
  /*$vite$:1*/
162
140
 
163
- .association-handle {
164
- width: 30px !important;
165
- height: 30px !important;
166
- background: transparent !important;
167
- border: none !important;
168
- border-radius: 0 !important;
169
- display: flex;
170
- align-items: center;
171
- justify-content: center;
172
- }
173
- .association-handle svg {
174
- pointer-events: none;
141
+ .eptimeline-list-enter-active[data-v-6ad2fc60],
142
+ .eptimeline-list-leave-active[data-v-6ad2fc60] {
143
+ transition: all 0.5s ease;
175
144
  }
176
- .association-handle[data-handlepos="right"] {
177
- right: -6px !important;
145
+ .eptimeline-list-enter-from[data-v-6ad2fc60],
146
+ .eptimeline-list-leave-to[data-v-6ad2fc60] {
147
+ opacity: 0;
148
+ transform: translateX(30px);
178
149
  }
179
- .association-handle[data-handlepos="left"] {
180
- left: -6px !important;
150
+ /*$vite$:1*/
151
+
152
+ .ep-content-timeline-item[data-v-6a472392] {
153
+ max-height: 0;
154
+ overflow: hidden;
181
155
  }
182
156
  /*$vite$:1*/
183
157
 
@@ -188,8 +162,13 @@ pre {
188
162
  }
189
163
  /*$vite$:1*/
190
164
 
191
- .ep-content-timeline-item[data-v-6a472392] {
192
- max-height: 0;
193
- overflow: hidden;
165
+ /* Target the top-level KaTeX container and increase the font size */
166
+ .katex-block[data-v-0d66d7fc] .katex {
167
+ /* Increase the overall size of the math relative to the parent font size */
168
+ font-size: 2em;
169
+ }
170
+ /* If you want inline math to be a specific size relative to surrounding text */
171
+ .katex-render[data-v-0d66d7fc] .katex-display {
172
+ font-size: 1.5em;
194
173
  }
195
174
  /*$vite$:1*/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ep-lib-ts",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"