@zenuml/core 3.27.10 → 3.27.12

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.
@@ -1,4 +1,4 @@
1
- import { o as c, c as e, a as o } from "./core.5d747191.js";
1
+ import { o as c, c as e, a as o } from "./core.d2435cf8.js";
2
2
  const s = {
3
3
  xmlns: "http://www.w3.org/2000/svg",
4
4
  viewBox: "0 0 1024 1024"
@@ -20,4 +20,4 @@ export {
20
20
  _ as default,
21
21
  l as render
22
22
  };
23
- //# sourceMappingURL=zoom-in.c8fc5e0f.js.map
23
+ //# sourceMappingURL=zoom-in.51811ef7.js.map
@@ -1,4 +1,4 @@
1
- import { o as t, c, a as o } from "./core.5d747191.js";
1
+ import { o as t, c, a as o } from "./core.d2435cf8.js";
2
2
  const e = {
3
3
  xmlns: "http://www.w3.org/2000/svg",
4
4
  viewBox: "0 0 1024 1024"
@@ -20,4 +20,4 @@ export {
20
20
  h as default,
21
21
  s as render
22
22
  };
23
- //# sourceMappingURL=zoom-out.32596871.js.map
23
+ //# sourceMappingURL=zoom-out.4f76068f.js.map
package/index.html CHANGED
@@ -7,7 +7,6 @@
7
7
  as="style"
8
8
  href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@300;400;500;700&display=swap"
9
9
  />
10
- <!-- <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@300;400;500;700&display=swap'>-->
11
10
  <style id="zenumlstyle">
12
11
  /* Prefix your CSS rules with `#diagram` */
13
12
  /*@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap');*/
@@ -79,70 +78,48 @@
79
78
  class="col-span-1 m-1 border-2"
80
79
  cols="30"
81
80
  rows="200"
82
- oninput="updateCode(this.value)"
83
81
  ></textarea>
84
82
  </div>
85
83
  <div class="col-span-4">
86
84
  <pre class="zenuml" style="margin: 0"></pre>
87
85
  </div>
88
86
  </div>
89
- <script>
87
+ <script type="module">
88
+ import { waitUntil, debounce } from "./src/utils.ts";
89
+ import { createConfig } from "./src/config.ts";
90
+
90
91
  const editor = CodeMirror.fromTextArea(document.getElementById("text"), {
91
92
  lineNumbers: true,
92
93
  singleCursorHeightPerLine: false,
93
94
  });
94
95
 
95
- // implement a waitUntil function
96
- function waitUntil(condition, callback) {
97
- if (condition()) {
98
- callback();
99
- } else {
100
- setTimeout(function () {
101
- waitUntil(condition, callback);
102
- }, 100);
103
- }
104
- }
96
+ const updateDiagram = debounce((content) => {
97
+ const config = createConfig({
98
+ onContentChange: (code) => editor.setValue(code),
99
+ });
100
+
101
+ window.zenUml.render(content, config).then((r) => {
102
+ window.parentLogger
103
+ .child({ name: "index.html" })
104
+ .debug("render resolved", r);
105
+ });
106
+ }, 500);
105
107
 
106
108
  editor.on("change", function (cm) {
107
109
  waitUntil(
110
+ () => window.zenUml,
108
111
  () => {
109
- return window.zenUml;
112
+ updateDiagram(cm.getValue());
113
+ // Save to localStorage
114
+ localStorage.setItem("zenuml-cm-code", cm.getValue());
110
115
  },
111
- (() => {
112
- let timer = 0;
113
- return () => {
114
- clearTimeout(timer);
115
- timer = setTimeout(() => {
116
- const theme =
117
- localStorage.getItem(`${location.hostname}-zenuml-theme`) ||
118
- "theme-default";
119
- window.zenUml
120
- .render(cm.getValue(), {
121
- theme,
122
- onContentChange: (code) => editor.setValue(code),
123
- onThemeChange: ({ theme }) => {
124
- localStorage.setItem(
125
- `${location.hostname}-zenuml-theme`,
126
- theme,
127
- );
128
- },
129
- })
130
- .then((r) => {
131
- window.parentLogger
132
- .child({ name: "index.html" })
133
- .debug("render resolved", r);
134
- });
135
- }, 500);
136
- };
137
- })(),
138
116
  );
139
- // write cm.getValue() to localStorage
140
- localStorage.setItem("zenuml-cm-code", cm.getValue());
141
117
  });
142
- // read localStorage and set to code mirror
143
- const code = localStorage.getItem("zenuml-cm-code");
144
- if (code) {
145
- editor.setValue(code);
118
+
119
+ // Load saved code from localStorage
120
+ const savedCode = localStorage.getItem("zenuml-cm-code");
121
+ if (savedCode) {
122
+ editor.setValue(savedCode);
146
123
  }
147
124
  </script>
148
125
  <script type="module" src="./src/main.ts"></script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenuml/core",
3
- "version": "3.27.10",
3
+ "version": "3.27.12",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -60,7 +60,7 @@
60
60
  "pino": "^8.8.0",
61
61
  "postcss": "^8.4.31",
62
62
  "ramda": "^0.28.0",
63
- "tailwindcss": "^3.2.4",
63
+ "tailwindcss": "^3.4.17",
64
64
  "vue": "^3.2.45",
65
65
  "vuex": "^4.1.0"
66
66
  },