lithent 1.20.2 → 1.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +83 -224
  2. package/devHelper/dist/lithentDevHelper.mjs +48 -31
  3. package/devHelper/dist/lithentDevHelper.mjs.map +1 -1
  4. package/devHelper/dist/lithentDevHelper.umd.js +1 -1
  5. package/devHelper/dist/lithentDevHelper.umd.js.map +1 -1
  6. package/devHelper/src/createBoundary.ts +44 -4
  7. package/devHelper/src/tests/createBoundaryRetry.test.ts +52 -0
  8. package/devHelper/src/tests/hmrBoundary.tsx +1 -1
  9. package/dist/hook/useRenew.d.ts +6 -0
  10. package/dist/index.d.ts +4 -3
  11. package/dist/lithent.mjs +363 -308
  12. package/dist/lithent.mjs.map +1 -1
  13. package/dist/lithent.umd.js +1 -1
  14. package/dist/lithent.umd.js.map +1 -1
  15. package/dist/render.d.ts +1 -1
  16. package/dist/types/index.d.ts +9 -10
  17. package/dist/utils/index.d.ts +1 -0
  18. package/dist/utils/predicator.d.ts +1 -0
  19. package/dist/utils/universalRef.d.ts +1 -0
  20. package/dist/wDom.d.ts +6 -3
  21. package/examples/dist/assets/index-C8ubEFcX.js +2 -0
  22. package/examples/dist/assets/index-C8ubEFcX.js.map +1 -0
  23. package/examples/dist/index.html +1 -1
  24. package/ftags/dist/index.d.ts +7 -3
  25. package/ftags/dist/lithentFTags.mjs +19 -12
  26. package/ftags/dist/lithentFTags.mjs.map +1 -1
  27. package/ftags/dist/lithentFTags.umd.js +1 -1
  28. package/ftags/dist/lithentFTags.umd.js.map +1 -1
  29. package/ftags/src/index.ts +26 -1
  30. package/ftags/src/tests/ftags.ts +36 -1
  31. package/helper/dist/hook/context.d.ts +8 -1
  32. package/helper/dist/hook/lcontext.d.ts +18 -0
  33. package/helper/dist/hook/lstate.d.ts +5 -0
  34. package/helper/dist/hook/lstore.d.ts +28 -0
  35. package/helper/dist/index.d.ts +4 -0
  36. package/helper/dist/lithentHelper.mjs +297 -129
  37. package/helper/dist/lithentHelper.mjs.map +1 -1
  38. package/helper/dist/lithentHelper.umd.js +1 -1
  39. package/helper/dist/lithentHelper.umd.js.map +1 -1
  40. package/helper/src/hook/context.tsx +4 -4
  41. package/helper/src/hook/lcontext.tsx +197 -0
  42. package/helper/src/hook/lstate.ts +28 -0
  43. package/helper/src/hook/lstore.ts +243 -0
  44. package/helper/src/index.ts +8 -0
  45. package/helper/src/tests/lcontext.tsx +316 -0
  46. package/helper/src/tests/lstore.tsx +198 -0
  47. package/helper/src/tests/state.tsx +88 -0
  48. package/jsx-runtime/dist/index.d.ts +0 -1
  49. package/jsx-runtime/package.json +1 -1
  50. package/package.json +3 -2
  51. package/src/diff.ts +24 -13
  52. package/src/hook/internal/useUpdate.ts +2 -2
  53. package/src/hook/mountCallback.ts +5 -3
  54. package/src/hook/useRenew.ts +17 -0
  55. package/src/index.ts +4 -1
  56. package/src/render.ts +67 -68
  57. package/src/tests/core-component-remount.test.tsx +35 -0
  58. package/src/tests/core-composedRenew.test.tsx +62 -0
  59. package/src/tests/core-functional-vdom.test.tsx +47 -0
  60. package/src/tests/core-lmount.tsx +101 -0
  61. package/src/tests/core-loopDomReuseWithoutKey.tsx +68 -0
  62. package/src/tests/loopWithoutKey.tsx +49 -0
  63. package/src/types/index.ts +17 -12
  64. package/src/utils/index.ts +5 -1
  65. package/src/utils/predicator.ts +10 -7
  66. package/src/utils/redraw.ts +3 -2
  67. package/src/utils/universalRef.ts +1 -0
  68. package/src/wDom.ts +84 -20
  69. package/ssr/package.json +1 -1
  70. package/tag/dist/index.d.ts +0 -2
  71. package/examples/dist/assets/index-Ch3C2eh3.js +0 -2
  72. package/examples/dist/assets/index-Ch3C2eh3.js.map +0 -1
package/README.md CHANGED
@@ -1,278 +1,137 @@
1
+ <img src="./lithentDocs/public/lithent.png" alt="Lithent" height="60" align="left" style="margin-right: 10px;" />
1
2
 
2
- ## ➿ lithent
3
- > An extensible JSX-based virtual DOM library for lightweight use in a variety of environments.
3
+ # Lithent &nbsp; [![npm version](https://img.shields.io/npm/v/lithent.svg)](https://www.npmjs.com/package/lithent) [![Bundle Size](https://img.shields.io/bundlephobia/minzip/lithent)](https://bundlephobia.com/package/lithent) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
4
4
 
5
+ <br clear="left"/>
5
6
 
6
- ![lithent-text](https://github.com/user-attachments/assets/a8848484-d315-4f81-be3b-61490d2be2b9)
7
+ **Lithent is a JavaScript library for building lightweight, predictable UIs with familiar closure-based patterns.**
7
8
 
8
- ![npm](https://img.shields.io/npm/v/lithent)
9
- ![npm bundle size](https://img.shields.io/bundlephobia/minzip/lithent)
10
- ![npm](https://img.shields.io/npm/dt/lithent)
11
- ![NPM](https://img.shields.io/npm/l/lithent)
9
+ It trims away unnecessary magic and complex APIs so your UI code stays simple, explicit, and easy to reason about.
12
10
 
11
+ <br />
13
12
 
13
+ <div align="left">
14
14
 
15
+ ### 🚀 [Get Started](https://superlucky84.github.io/lithent/#/guide/quick-start) · 📖 [Documentation](https://superlucky84.github.io/lithent/#/) · 💡 [Examples](https://superlucky84.github.io/lithent/#/examples/1)
15
16
 
16
- - [Manual](https://medium.com/p/13d6fe6d3330)
17
- - [Korean Manual](https://medium.com/@superlucky84/lithent-전체-기능-설명서-3cfab04c0722)
18
- - [Home Page](https://superlucky84.github.io/lithent) - (This page is written in lithent.)
17
+ </div>
19
18
 
20
- Lithent were developed to make it easy to insert Virtual DOM component
21
- fragments into pages already drawn with SSR, and are intended to be
22
- used lightly in a variety of situations.
19
+ <br />
23
20
 
24
- `(lithent.mjs 14.25 kB │ gzip: 4.49 kB │ map: 59.74 kB)`
25
- `(lithent.umd.js 10.39 kB │ gzip: 4.03 kB │ map: 58.16 kB)`
21
+ ## Why Lithent?
26
22
 
27
- ## 🚩 Table of Contents
28
- - [Thanks for the introduction](#thanks-for-the-introduction)
29
- - [Why Use Lithent](#why-use-lithent)
30
- - [Basic Guide](#basic-guide)
31
- - [Lithent Ssr Boilerplate](#lithent-ssr-boilerplate)
32
- - [How To Install](#how-to-install)
33
- - [Use NPM](#use-npm)
34
- - [Use CDN](#or-use-cdn)
35
- - [With JSX](#with-jsx)
36
- - [With FTAGS](#with-ftags)
37
- - [With HTM](#with-htm)
38
- - [Examples](#examples)
39
- - [With ESM](#with-esm)
40
- - [With UMD](#with-umd)
41
- - [Related Projects](#related-projects)
42
- - [Develop Guide](#develop-guide)
43
- - [Test](#test)
23
+ **Lightweight DOM manipulation without the framework weight.** The 4KB core drives complete UIs. Need state management? Opt into helpers like expansion packs instead of adopting a full stack.
44
24
 
45
- ## Thanks for the introduction
46
- - [unsuckjs](https://unsuckjs.com/)
47
- - [jster](https://jster.net/blog/jster-198/)
48
- - [webtoolsweekly](https://webtoolsweekly.com/archives/issue-531/)
25
+ Bring in only what you need — let the stack scale with your project.
49
26
 
50
- ## Why use Lithent?
27
+ **Design philosophy:**
28
+ - **Small Bundle** — 4KB core with optional extensions
29
+ - **Closure-based State** — No magic, just JavaScript
30
+ - **Manual or Reactive** — Choose your update strategy
31
+ - **Progressive Enhancement** — From static HTML to full SPA
51
32
 
52
- ### Lithent have the bare minimum of necessary functionality, with no unnecessary features.
33
+ <br />
53
34
 
54
- In a real-world development environment, you may want to use Virtual DOM lightly, with only the bare minimum of core functionality.
35
+ ## Quick start
55
36
 
56
- "Lithent" makes it easy to add, remove, and update virtual DOM to specific parts of a pre-drawn SSR page.
57
-
58
- "Lithent" has implemented the bare minimum functionality needed to create and update virtual DOM in general (we only need to know 'render', 'mounter', 'updater', 'renewer', 'mountCallback', and 'updateCallback').
59
-
60
- We provide code in the form of 'helpers' that extend the basic functionality, but using the helpers is only optional and users can extend and develop custom helpers for their own projects.
61
-
62
- ### Approach with the developer-friendly concept of closures between "component mounter" and "renderer"
63
-
64
- JavaScript users are used to using closures and love to develop with them.
65
-
66
- "Lithent" provides a familiar approach to my JavaScript development, as it leverages the properties of higher-order functions and closures to define and recycle the state of a component.
67
-
68
- ## Basic Guide
69
-
70
- - https://superlucky84.github.io/lithent/
71
-
72
- ## Lithent Ssr Boilerplate
73
-
74
- `Lithent-Ssr-Boilerplate` is a boilerplate designed for building server-side rendering (SSR) websites using the [Lithent](https://superlucky84.github.io/lithent/) UI library.
75
-
76
- * [README](https://github.com/superlucky84/lithent/tree/master/createLithent#readme)
37
+ ### Create a new project
77
38
 
78
39
  ```bash
79
- npx create-lithent-ssr@latest
40
+ npx create-lithent@latest
80
41
  ```
81
42
 
43
+ Pick a project name and template (SSR/SPA) and you’re ready to go.
82
44
 
83
- ## How To Install
84
-
85
- #### Use NPM
45
+ ### Install via npm
86
46
 
87
47
  ```bash
88
- pnpm add lithent
48
+ npm install lithent
89
49
  ```
90
50
 
91
- #### Or Use CDN
92
-
93
- * UMD : https://cdn.jsdelivr.net/npm/lithent@1.20.2/dist/lithent.umd.js
94
- * UMD-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.20.2/helper/dist/lithentHelper.umd.js
95
- * UMD-FTAGS: https://cdn.jsdelivr.net/npm/lithent@1.20.2/ftags/dist/lithentFTags.umd.js
96
- * UMD-TAG: https://cdn.jsdelivr.net/npm/lithent@1.20.2/tag/dist/lithentTag.umd.js
97
- * ESM : https://cdn.jsdelivr.net/npm/lithent@1.20.2/dist/lithent.mjs
98
- * ESM-HELPER: https://cdn.jsdelivr.net/npm/lithent@1.20.2/helper/dist/lithentHelper.mjs
99
- * ESM-FTAGS: https://cdn.jsdelivr.net/npm/lithent@1.20.2/ftags/dist/lithentFTags.mjs
100
- * ESM-TAG: https://cdn.jsdelivr.net/npm/lithent@1.20.2/tag/dist/lithentTag.mjs
101
-
102
-
103
- It's easier to use lithent with JSX or HTM.
104
-
105
- #### With JSX
106
-
107
- * Lithent is built on top of JSX.
108
- * [Setting Guide](https://superlucky84.github.io/lithent/#install)
109
-
110
-
111
- #### With FTAGS
112
-
113
- You don't need to use h functions or JSX, you can call functions to mark them up.
114
- When creating a component, use `fMount` instead of `mount`.
115
- When creating a fragment, use `fFragment` instead of `Fragment`.
116
-
117
- ```ts
118
- /* ESM */
119
- import { render, h } from 'lithent';
120
- import { fTags, fFragment, fMount } from 'lithent/ftags';
121
-
122
- const { section, div, p, br, strong } = fTags;
123
-
124
- /* UMD
125
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.20.2/dist/lithent.umd.js"></script>
126
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.20.2/helper/dist/lithentHelper.umd.js"></script>
127
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.20.2/ftags/dist/lithentFTags.umd.js"></script>
128
-
129
- const { render } = lithent;
130
- const { fTags, fMount, fFragment } = lithentFTags;
131
- const { section, div, p, br, strong } = fTags;
132
- */
51
+ ### Use directly from a CDN
133
52
 
134
- const fTagComponent = fMount<{ firstProp: number }>((_r, props, children) => {
135
- return () =>
136
- fFragment(
137
- 'first inner',
138
- div({ style: { border: '1px solid red' } }, 'second inner'),
139
- div('The props argument can be omitted.'),
140
- props.firstProp,
141
- ...children
142
- );
143
- });
144
-
145
- render(
146
- fTagComponent(
147
- { firstProp: 3 }, // The props argument can be omitted.
148
- div({ style: { border: '1px solid green' } }, `Fchildren1`),
149
- 'Fchildren2',
150
- br()
151
- ),
152
- document.getElementById('root')
153
- );
154
- ```
155
-
156
- #### With HTM
157
-
158
- - [Htm Github](https://github.com/developit/htm)
159
-
160
- ```js
161
- import { lTag } from 'lithent/tag';
162
- const destroy = render(lTag`<${Component} />`, document.getElementById('root'), document.getElementById('#insert-before-this-element'));
53
+ ```html
54
+ <script src="https://cdn.jsdelivr.net/npm/lithent/dist/lithent.umd.js"></script>
55
+ <script src="https://cdn.jsdelivr.net/npm/lithent/ftags/dist/lithentFTags.umd.js"></script>
163
56
  ```
164
57
 
58
+ > **[📦 View all available CDN URLs](https://superlucky84.github.io/lithent/#/guide/quick-start)**
165
59
 
166
- ## Examples
167
-
168
- - [More Examples](https://superlucky84.github.io/lithent/#examples)
60
+ <br />
169
61
 
170
- #### With ESM
171
- ```js
172
- import { h, render, mount, Fragment } from 'lithent';
173
- import { lTag } from 'lithent/tag';
174
- import { state } from 'lithent/helper';
62
+ ## Two ways to build components
175
63
 
176
- const Component = mount((renew, _props) => {
177
- const count = state(0, renew);
64
+ Lithent offers two complementary styles you can freely mix in the same project.
178
65
 
179
- const change = () => {
180
- count.value += 1;
181
- };
66
+ **Manual Mode** — Explicit control with `renew()`
67
+ ```tsx
68
+ import { mount } from 'lithent';
182
69
 
183
- // Updater
184
- return () => lTag`
185
- <${Fragment}>
186
- <li>count: ${count.value}</li>
187
- <button onClick=${change}>increase</button>
188
- <//>
189
- `;
70
+ const Counter = mount(renew => {
71
+ let count = 0;
72
+ return () => <button onClick={() => { count++; renew(); }}>{count}</button>;
190
73
  });
191
-
192
- // appendChild or insertBefore
193
- // The third argument is an optional value for insertBefore.
194
- const destroy = render(lTag`<${Component} />`, document.getElementById('root'), document.getElementById('#insert-before-this-element'));
195
74
  ```
196
75
 
197
- #### With UMD
76
+ **Light API Mode** — Automatic reactivity
77
+ ```tsx
78
+ import { lmount } from 'lithent';
79
+ import { lstate } from 'lithent/helper';
198
80
 
199
- ```html
200
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.20.2/dist/lithent.umd.js"></script>
201
- <!--script src="https://cdn.jsdelivr.net/npm/lithent@1.20.2/helper/dist/lithentHelper.umd.js"></script-->
202
- <script src="https://cdn.jsdelivr.net/npm/lithent@1.20.2/tag/dist/lithentTag.umd.js"></script>
203
- <!--script src="https://cdn.jsdelivr.net/npm/lithent@1.20.2/ftags/dist/lithentFTags.umd.js"></script-->
204
-
205
- <div id="root"></div>
206
-
207
- <script>
208
- const { h, Fragment, render, mount } = lithent;
209
- const { lTag } = lithentTag;
210
- // const { state } = lithentHelper;
211
-
212
- const Component = mount(renew => {
213
- count = 0;
214
-
215
- const change = () => {
216
- count += 1;
217
- renew();
218
- };
219
-
220
- // Updater
221
- return () => lTag`
222
- <${Fragment}>
223
- <li>count: ${count}</li>
224
- <button onClick=${change}>increase</button>
225
- <//>
226
- `;
81
+ const Counter = lmount(() => {
82
+ const count = lstate(0);
83
+ return () => <button onClick={() => count.value++}>{count.value}</button>;
227
84
  });
228
-
229
- // appendChild or insertBefore
230
- // The third argument is an optional value for insertBefore.
231
- const destroy = render(lTag`<${Component} />`, document.getElementById('root'), document.getElementById('#insert-before-this-element'));
232
- </script>
233
85
  ```
234
86
 
235
- ## Related Projects
236
- - [htm](https://www.npmjs.com/package/htm) - making **H**yperscript **T**agged **M**arkup possible
87
+ > **[📚 Explore component patterns in detail](https://superlucky84.github.io/lithent/#/guide/mounter)**
237
88
 
238
- ## Develop Guide
89
+ <br />
239
90
 
240
- It's open source, so you can develop and contribute together.
91
+ ## Key features
241
92
 
242
- ### pnpm install (this project was created using pnpm.)
93
+ ### Core
94
+ - **mount / lmount** — Component initialization
95
+ - **Portal** — Render outside parent DOM
96
+ - **Hooks** — Lifecycle callbacks (`mountCallback`, `updateCallback`, `mountReadyCallback`)
97
+ - **Ref** — Direct DOM access
243
98
 
244
- ```bash
245
- npm install -g pnpm
246
- ```
99
+ ### Helpers (optional)
100
+ - **state / lstate** — Reactive state management
101
+ - **computed** — Derived values
102
+ - **effect** — Side effects
103
+ - **store / lstore** — Global state
104
+ - **context / lcontext** — Cross-component data sharing
247
105
 
248
- ### project install
106
+ ### Template options
107
+ - **JSX** — Via Vite plugin
108
+ - **FTags** — Function-style tags (no build step)
109
+ - **HTM** — Tagged template literals
110
+ - **Template Strings** — Custom templates
249
111
 
250
- ```bash
251
- git clone https://github.com/superlucky84/lithent.git
112
+ > **[📖 View full API reference](https://superlucky84.github.io/lithent/#/)**
252
113
 
253
- cd lithent
114
+ <br />
254
115
 
255
- pnpm install
256
- ```
116
+ ## Ecosystem
257
117
 
258
- ### project build
118
+ | Package | Description |
119
+ |--------|-------------|
120
+ | [lithent](https://www.npmjs.com/package/lithent) | Core library (~4KB) |
121
+ | [lithent/helper](https://www.npmjs.com/package/lithent) | Reactive state helpers |
122
+ | [lithent/ssr](https://www.npmjs.com/package/lithent) | Server‑side rendering |
123
+ | [lithent/ftags](https://www.npmjs.com/package/lithent) | Function‑style tag API |
124
+ | [lithent/tag](https://www.npmjs.com/package/lithent) | HTM template support |
125
+ | [create-lithent](https://www.npmjs.com/package/create-lithent) | Project scaffolding tool |
259
126
 
260
- ```bash
261
- pnpm build
262
- ```
127
+ <br />
263
128
 
264
- ### Running the development environment
129
+ ## License
265
130
 
266
- ```bash
267
- pnpm dev // or pnpm dev:core
268
- ```
269
-
270
- ## Test
131
+ [MIT](LICENSE) © [superlucky84](https://github.com/superlucky84)
271
132
 
272
- > To fully test everything, including plugins like helper and ftags, a build is required.
133
+ <br />
273
134
 
274
- ```bash
275
- pnpm install
276
- pnpm build
277
- pnpm test
278
- ```
135
+ <div align="center">
136
+ <sub>Built with ❤️ by the Lithent community</sub>
137
+ </div>
@@ -1,21 +1,22 @@
1
- import { setComponentMapManualMode as C, disposeComponentEntry as m, componentMap as p, replaceWDom as B } from "lithent";
1
+ import { setComponentMapManualMode as R, disposeComponentEntry as b, componentMap as p, replaceWDom as B } from "lithent";
2
2
  let c = 0;
3
- const R = () => {
4
- c += 1, C(!0);
5
- }, b = () => {
6
- c = Math.max(0, c - 1), c === 0 && C(!1);
7
- }, w = (t) => {
8
- m(t);
9
- }, s = /* @__PURE__ */ new Map(), E = (t) => {
3
+ const w = () => {
4
+ c += 1, R(!0);
5
+ }, E = () => {
6
+ c = Math.max(0, c - 1), c === 0 && R(!1);
7
+ }, x = (t) => {
8
+ b(t);
9
+ }, D = 3, s = /* @__PURE__ */ new Map(), U = (t) => {
10
10
  let e = s.get(t);
11
11
  return e || (e = {
12
12
  instances: /* @__PURE__ */ new Set(),
13
13
  domMap: /* @__PURE__ */ new Map(),
14
14
  scheduled: !1,
15
- pendingCtor: void 0
15
+ pendingCtor: void 0,
16
+ retryCount: 0
16
17
  }, s.set(t, e)), e;
17
- }, D = (t, e) => {
18
- const n = E(t);
18
+ }, W = (t, e) => {
19
+ const n = U(t);
19
20
  return n.instances.add(e), queueMicrotask(() => {
20
21
  var o;
21
22
  const r = p.get(e), a = ((o = r == null ? void 0 : r.vd) == null ? void 0 : o.value) ?? null;
@@ -24,15 +25,15 @@ const R = () => {
24
25
  const r = s.get(t);
25
26
  r && (r.instances.delete(e), r.domMap.delete(e), r.instances.size || s.delete(t));
26
27
  };
27
- }, W = (t) => {
28
+ }, $ = (t) => {
28
29
  const e = s.get(t);
29
30
  e && Array.from(e.instances).forEach(
30
- (n) => w(n)
31
- ), s.delete(t), b();
31
+ (n) => x(n)
32
+ ), s.delete(t), E();
32
33
  }, k = (t, e) => {
33
34
  const n = s.get(t);
34
- return n ? (n.pendingCtor = e, n.scheduled || (n.scheduled = !0, queueMicrotask(() => y(t))), !0) : !1;
35
- }, y = (t) => {
35
+ return n ? (n.pendingCtor = e, n.retryCount = 0, n.scheduled || (n.scheduled = !0, queueMicrotask(() => v(t))), !0) : !1;
36
+ }, v = (t) => {
36
37
  const e = s.get(t);
37
38
  if (!e) return;
38
39
  e.scheduled = !1;
@@ -41,32 +42,48 @@ const R = () => {
41
42
  return;
42
43
  e.pendingCtor = void 0;
43
44
  let r = !1, a = !1;
44
- e.instances.forEach((o) => {
45
- var g, M, h;
46
- const u = p.get(o), v = e.domMap.get(o), i = ((g = u == null ? void 0 : u.vd) == null ? void 0 : g.value) || v;
45
+ e.instances.forEach((u) => {
46
+ var h, y, C;
47
+ const d = p.get(u), m = e.domMap.get(u), i = ((h = d == null ? void 0 : d.vd) == null ? void 0 : h.value) || m;
47
48
  if (!i || !i.el) {
48
49
  a = !0;
49
50
  return;
50
51
  }
51
- const { compProps: l, compChild: f } = i;
52
- if (!l || !f) {
52
+ const { compProps: g, compChild: M } = i;
53
+ if (!g || !M) {
53
54
  a = !0;
54
55
  return;
55
56
  }
56
57
  try {
57
- B(n, l, f, i);
58
- const d = ((h = (M = p.get(o)) == null ? void 0 : M.vd) == null ? void 0 : h.value) || i;
59
- e.domMap.set(o, d), r = !0;
60
- } catch (d) {
61
- console.warn(`[Lithent HMR] boundary update 실패: ${t}`, d);
58
+ B(n, g, M, i);
59
+ const l = ((C = (y = p.get(u)) == null ? void 0 : y.vd) == null ? void 0 : C.value) || i;
60
+ e.domMap.set(u, l), r = !0;
61
+ } catch (l) {
62
+ console.warn(`[Lithent HMR] boundary update 실패: ${t}`, l);
62
63
  }
63
- }), (a && !r || e.pendingCtor) && (e.scheduled || (e.scheduled = !0, setTimeout(() => y(t), 0)));
64
- }, x = (t) => (R(), {
65
- register: (e) => D(t, e),
64
+ });
65
+ let o = e.pendingCtor;
66
+ const f = a && !r;
67
+ if (!(f || !!o)) {
68
+ e.retryCount = 0;
69
+ return;
70
+ }
71
+ if (f) {
72
+ if (e.retryCount += 1, e.retryCount > D) {
73
+ console.warn(
74
+ `[Lithent HMR] boundary update failed after ${e.retryCount} attempts; aborting: ${t}`
75
+ ), e.pendingCtor = void 0, e.scheduled = !1;
76
+ return;
77
+ }
78
+ o || (o = n);
79
+ }
80
+ e.pendingCtor = o, e.scheduled || (e.scheduled = !0, setTimeout(() => v(t), 0));
81
+ }, L = (t) => (w(), {
82
+ register: (e) => W(t, e),
66
83
  update: (e) => k(t, e),
67
- dispose: () => W(t)
84
+ dispose: () => $(t)
68
85
  });
69
86
  export {
70
- x as createBoundary
87
+ L as createBoundary
71
88
  };
72
89
  //# sourceMappingURL=lithentDevHelper.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"lithentDevHelper.mjs","sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingCtor?: TagFunction;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n pendingCtor: undefined,\n };\n boundaryRegistry.set(moduleId, registry);\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey\n) => {\n const registry = getRegistry(moduleId);\n\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (currentWDom) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (!currentRegistry) return;\n\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n\n if (!currentRegistry.instances.size) {\n boundaryRegistry.delete(moduleId);\n }\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (registry) {\n Array.from(registry.instances).forEach(compKey =>\n removeComponentEntry(compKey)\n );\n }\n\n boundaryRegistry.delete(moduleId);\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return false;\n\n registry.pendingCtor = nextCtor;\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n if (!registry) return;\n\n registry.scheduled = false;\n\n const ctor = registry.pendingCtor;\n if (!ctor) {\n return;\n }\n\n registry.pendingCtor = undefined;\n\n let updated = false;\n let hasMissing = false;\n\n registry.instances.forEach(compKey => {\n const entry = componentMap.get(compKey);\n const cached = registry.domMap.get(compKey);\n const currentWDom = entry?.vd?.value || cached;\n\n if (!currentWDom || !currentWDom.el) {\n hasMissing = true;\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n hasMissing = true;\n return;\n }\n\n try {\n replaceWDom(ctor, compProps, compChild, currentWDom as any);\n const refreshed = componentMap.get(compKey)?.vd?.value || currentWDom;\n registry.domMap.set(compKey, refreshed as WDom);\n updated = true;\n } catch (error) {\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n }\n });\n\n if ((hasMissing && !updated) || registry.pendingCtor) {\n if (!registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId), 0);\n }\n }\n};\n\nexport const createBoundary = (moduleId: string): BoundaryController => {\n enableComponentMapManualMode();\n\n return {\n register: (compKey: CompKey) => registerBoundaryInstance(moduleId, compKey),\n update: (nextCtor: TagFunction) => applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => disposeBoundary(moduleId),\n };\n};\n"],"names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","disposeComponentEntry","boundaryRegistry","getRegistry","moduleId","registry","registerBoundaryInstance","entry","componentMap","currentWDom","_a","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","ctor","updated","hasMissing","cached","compProps","compChild","replaceWDom","refreshed","_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,EAAS,cACZA,EAAS,YAAY,IACrB,WAAW,MAAMU,EAAcX,CAAQ,GAAG,CAAC;AAGjD,GAEauB,IAAiB,CAACvB,OACAR,KAEtB;AAAA,EACL,UAAU,CAACI,MAAqBM,EAAyBF,GAAUJ,CAAO;AAAA,EAC1E,QAAQ,CAACc,MAA0BD,EAAoBT,GAAUU,CAAQ;AAAA,EACzE,SAAS,MAAMF,EAAgBR,CAAQ;AAAA;"}
1
+ {"version":3,"file":"lithentDevHelper.mjs","sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingCtor?: TagFunction;\n retryCount: number;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n pendingCtor: undefined,\n retryCount: 0,\n };\n boundaryRegistry.set(moduleId, registry);\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey\n) => {\n const registry = getRegistry(moduleId);\n\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (currentWDom) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (!currentRegistry) return;\n\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n\n if (!currentRegistry.instances.size) {\n boundaryRegistry.delete(moduleId);\n }\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (registry) {\n Array.from(registry.instances).forEach(compKey =>\n removeComponentEntry(compKey)\n );\n }\n\n boundaryRegistry.delete(moduleId);\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return false;\n\n registry.pendingCtor = nextCtor;\n registry.retryCount = 0;\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n if (!registry) return;\n\n registry.scheduled = false;\n\n const ctor = registry.pendingCtor;\n if (!ctor) {\n return;\n }\n\n registry.pendingCtor = undefined;\n\n let updated = false;\n let hasMissing = false;\n\n registry.instances.forEach(compKey => {\n const entry = componentMap.get(compKey);\n const cached = registry.domMap.get(compKey);\n const currentWDom = entry?.vd?.value || cached;\n\n if (!currentWDom || !currentWDom.el) {\n hasMissing = true;\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n hasMissing = true;\n return;\n }\n\n try {\n replaceWDom(ctor, compProps, compChild, currentWDom as any);\n const refreshed = componentMap.get(compKey)?.vd?.value || currentWDom;\n registry.domMap.set(compKey, refreshed as WDom);\n updated = true;\n } catch (error) {\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n }\n });\n\n let nextPendingCtor: TagFunction | undefined = registry.pendingCtor;\n const shouldRetryMissing = hasMissing && !updated;\n const hasQueuedUpdate = Boolean(nextPendingCtor);\n const shouldRetry = shouldRetryMissing || hasQueuedUpdate;\n\n if (!shouldRetry) {\n registry.retryCount = 0;\n return;\n }\n\n if (shouldRetryMissing) {\n registry.retryCount += 1;\n\n if (registry.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${registry.retryCount} attempts; aborting: ${moduleId}`\n );\n\n const hot = (\n import.meta as unknown as {\n hot?: { invalidate?: () => void };\n }\n ).hot;\n hot?.invalidate?.();\n\n registry.pendingCtor = undefined;\n registry.scheduled = false;\n return;\n }\n\n if (!nextPendingCtor) {\n nextPendingCtor = ctor;\n }\n }\n\n registry.pendingCtor = nextPendingCtor;\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId), 0);\n }\n};\n\nexport const createBoundary = (moduleId: string): BoundaryController => {\n enableComponentMapManualMode();\n\n return {\n register: (compKey: CompKey) => registerBoundaryInstance(moduleId, compKey),\n update: (nextCtor: TagFunction) => applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => disposeBoundary(moduleId),\n };\n};\n"],"names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","disposeComponentEntry","MAX_RETRY","boundaryRegistry","getRegistry","moduleId","registry","registerBoundaryInstance","entry","componentMap","currentWDom","_a","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","ctor","updated","hasMissing","cached","compProps","compChild","replaceWDom","refreshed","_c","_b","error","nextPendingCtor","shouldRetryMissing","createBoundary"],"mappings":";AAGA,IAAIA,IAAqB;AAElB,MAAMC,IAA+B,MAAY;AAChC,EAAAD,KAAA,GACtBE,EAA0B,E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AAQD,IAGd;AAChB,IAAAtB,EAAS,aAAa;AACtB;AAAA,EACF;AAEA,MAAIuB,GAAoB;AAGlB,QAFJvB,EAAS,cAAc,GAEnBA,EAAS,aAAaJ,GAAW;AAC3B,cAAA;AAAA,QACN,8CAA8CI,EAAS,UAAU,wBAAwBD,CAAQ;AAAA,MAAA,GAUnGC,EAAS,cAAc,QACvBA,EAAS,YAAY;AACrB;AAAA,IACF;AAEA,IAAKsB,MACeA,IAAAX;AAAA,EAEtB;AAEA,EAAAX,EAAS,cAAcsB,GAElBtB,EAAS,cACZA,EAAS,YAAY,IACrB,WAAW,MAAMU,EAAcX,CAAQ,GAAG,CAAC;AAE/C,GAEayB,IAAiB,CAACzB,OACAT,KAEtB;AAAA,EACL,UAAU,CAACI,MAAqBO,EAAyBF,GAAUL,CAAO;AAAA,EAC1E,QAAQ,CAACe,MAA0BD,EAAoBT,GAAUU,CAAQ;AAAA,EACzE,SAAS,MAAMF,EAAgBR,CAAQ;AAAA;"}
@@ -1,2 +1,2 @@
1
- (function(a,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("lithent")):typeof define=="function"&&define.amd?define(["exports","lithent"],r):(a=typeof globalThis<"u"?globalThis:a||self,r(a.lithentDevHelper={},a.lithent))})(this,function(a,r){"use strict";let d=0;const m=()=>{d+=1,r.setComponentMapManualMode(!0)},v=()=>{d=Math.max(0,d-1),d===0&&r.setComponentMapManualMode(!1)},b=t=>{r.disposeComponentEntry(t)},o=new Map,B=t=>{let e=o.get(t);return e||(e={instances:new Set,domMap:new Map,scheduled:!1,pendingCtor:void 0},o.set(t,e)),e},R=(t,e)=>{const n=B(t);return n.instances.add(e),queueMicrotask(()=>{var i;const s=r.componentMap.get(e),c=((i=s==null?void 0:s.vd)==null?void 0:i.value)??null;c&&n.domMap.set(e,c)}),()=>{const s=o.get(t);s&&(s.instances.delete(e),s.domMap.delete(e),s.instances.size||o.delete(t))}},w=t=>{const e=o.get(t);e&&Array.from(e.instances).forEach(n=>b(n)),o.delete(t),v()},D=(t,e)=>{const n=o.get(t);return n?(n.pendingCtor=e,n.scheduled||(n.scheduled=!0,queueMicrotask(()=>l(t))),!0):!1},l=t=>{const e=o.get(t);if(!e)return;e.scheduled=!1;const n=e.pendingCtor;if(!n)return;e.pendingCtor=void 0;let s=!1,c=!1;e.instances.forEach(i=>{var h,y,C;const p=r.componentMap.get(i),T=e.domMap.get(i),u=((h=p==null?void 0:p.vd)==null?void 0:h.value)||T;if(!u||!u.el){c=!0;return}const{compProps:M,compChild:g}=u;if(!M||!g){c=!0;return}try{r.replaceWDom(n,M,g,u);const f=((C=(y=r.componentMap.get(i))==null?void 0:y.vd)==null?void 0:C.value)||u;e.domMap.set(i,f),s=!0}catch(f){console.warn(`[Lithent HMR] boundary update 실패: ${t}`,f)}}),(c&&!s||e.pendingCtor)&&(e.scheduled||(e.scheduled=!0,setTimeout(()=>l(t),0)))},E=t=>(m(),{register:e=>R(t,e),update:e=>D(t,e),dispose:()=>w(t)});a.createBoundary=E,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
1
+ (function(a,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("lithent")):typeof define=="function"&&define.amd?define(["exports","lithent"],r):(a=typeof globalThis<"u"?globalThis:a||self,r(a.lithentDevHelper={},a.lithent))})(this,function(a,r){"use strict";let c=0;const R=()=>{c+=1,r.setComponentMapManualMode(!0)},b=()=>{c=Math.max(0,c-1),c===0&&r.setComponentMapManualMode(!1)},B=t=>{r.disposeComponentEntry(t)},w=3,s=new Map,E=t=>{let e=s.get(t);return e||(e={instances:new Set,domMap:new Map,scheduled:!1,pendingCtor:void 0,retryCount:0},s.set(t,e)),e},T=(t,e)=>{const n=E(t);return n.instances.add(e),queueMicrotask(()=>{var i;const o=r.componentMap.get(e),u=((i=o==null?void 0:o.vd)==null?void 0:i.value)??null;u&&n.domMap.set(e,u)}),()=>{const o=s.get(t);o&&(o.instances.delete(e),o.domMap.delete(e),o.instances.size||s.delete(t))}},x=t=>{const e=s.get(t);e&&Array.from(e.instances).forEach(n=>B(n)),s.delete(t),b()},D=(t,e)=>{const n=s.get(t);return n?(n.pendingCtor=e,n.retryCount=0,n.scheduled||(n.scheduled=!0,queueMicrotask(()=>g(t))),!0):!1},g=t=>{const e=s.get(t);if(!e)return;e.scheduled=!1;const n=e.pendingCtor;if(!n)return;e.pendingCtor=void 0;let o=!1,u=!1;e.instances.forEach(p=>{var C,v,m;const f=r.componentMap.get(p),H=e.domMap.get(p),d=((C=f==null?void 0:f.vd)==null?void 0:C.value)||H;if(!d||!d.el){u=!0;return}const{compProps:y,compChild:h}=d;if(!y||!h){u=!0;return}try{r.replaceWDom(n,y,h,d);const l=((m=(v=r.componentMap.get(p))==null?void 0:v.vd)==null?void 0:m.value)||d;e.domMap.set(p,l),o=!0}catch(l){console.warn(`[Lithent HMR] boundary update 실패: ${t}`,l)}});let i=e.pendingCtor;const M=u&&!o;if(!(M||!!i)){e.retryCount=0;return}if(M){if(e.retryCount+=1,e.retryCount>w){console.warn(`[Lithent HMR] boundary update failed after ${e.retryCount} attempts; aborting: ${t}`),e.pendingCtor=void 0,e.scheduled=!1;return}i||(i=n)}e.pendingCtor=i,e.scheduled||(e.scheduled=!0,setTimeout(()=>g(t),0))},q=t=>(R(),{register:e=>T(t,e),update:e=>D(t,e),dispose:()=>x(t)});a.createBoundary=q,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=lithentDevHelper.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lithentDevHelper.umd.js","sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingCtor?: TagFunction;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n pendingCtor: undefined,\n };\n boundaryRegistry.set(moduleId, registry);\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey\n) => {\n const registry = getRegistry(moduleId);\n\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (currentWDom) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (!currentRegistry) return;\n\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n\n if (!currentRegistry.instances.size) {\n boundaryRegistry.delete(moduleId);\n }\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (registry) {\n Array.from(registry.instances).forEach(compKey =>\n removeComponentEntry(compKey)\n );\n }\n\n boundaryRegistry.delete(moduleId);\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return false;\n\n registry.pendingCtor = nextCtor;\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n if (!registry) return;\n\n registry.scheduled = false;\n\n const ctor = registry.pendingCtor;\n if (!ctor) {\n return;\n }\n\n registry.pendingCtor = undefined;\n\n let updated = false;\n let hasMissing = false;\n\n registry.instances.forEach(compKey => {\n const entry = componentMap.get(compKey);\n const cached = registry.domMap.get(compKey);\n const currentWDom = entry?.vd?.value || cached;\n\n if (!currentWDom || !currentWDom.el) {\n hasMissing = true;\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n hasMissing = true;\n return;\n }\n\n try {\n replaceWDom(ctor, compProps, compChild, currentWDom as any);\n const refreshed = componentMap.get(compKey)?.vd?.value || currentWDom;\n registry.domMap.set(compKey, refreshed as WDom);\n updated = true;\n } catch (error) {\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n }\n });\n\n if ((hasMissing && !updated) || registry.pendingCtor) {\n if (!registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId), 0);\n }\n }\n};\n\nexport const createBoundary = (moduleId: string): BoundaryController => {\n enableComponentMapManualMode();\n\n return {\n register: (compKey: CompKey) => registerBoundaryInstance(moduleId, compKey),\n update: (nextCtor: TagFunction) => applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => disposeBoundary(moduleId),\n };\n};\n"],"names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","disposeComponentEntry","boundaryRegistry","getRegistry","moduleId","registry","registerBoundaryInstance","entry","componentMap","currentWDom","_a","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","ctor","updated","hasMissing","cached","compProps","compChild","replaceWDom","refreshed","error","createBoundary"],"mappings":"iRAG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,EACzE,QAAS,IAAMF,EAAgBR,CAAQ,CAAA"}
1
+ {"version":3,"file":"lithentDevHelper.umd.js","sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingCtor?: TagFunction;\n retryCount: number;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n pendingCtor: undefined,\n retryCount: 0,\n };\n boundaryRegistry.set(moduleId, registry);\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey\n) => {\n const registry = getRegistry(moduleId);\n\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (currentWDom) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (!currentRegistry) return;\n\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n\n if (!currentRegistry.instances.size) {\n boundaryRegistry.delete(moduleId);\n }\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (registry) {\n Array.from(registry.instances).forEach(compKey =>\n removeComponentEntry(compKey)\n );\n }\n\n boundaryRegistry.delete(moduleId);\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return false;\n\n registry.pendingCtor = nextCtor;\n registry.retryCount = 0;\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n if (!registry) return;\n\n registry.scheduled = false;\n\n const ctor = registry.pendingCtor;\n if (!ctor) {\n return;\n }\n\n registry.pendingCtor = undefined;\n\n let updated = false;\n let hasMissing = false;\n\n registry.instances.forEach(compKey => {\n const entry = componentMap.get(compKey);\n const cached = registry.domMap.get(compKey);\n const currentWDom = entry?.vd?.value || cached;\n\n if (!currentWDom || !currentWDom.el) {\n hasMissing = true;\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n hasMissing = true;\n return;\n }\n\n try {\n replaceWDom(ctor, compProps, compChild, currentWDom as any);\n const refreshed = componentMap.get(compKey)?.vd?.value || currentWDom;\n registry.domMap.set(compKey, refreshed as WDom);\n updated = true;\n } catch (error) {\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n }\n });\n\n let nextPendingCtor: TagFunction | undefined = registry.pendingCtor;\n const shouldRetryMissing = hasMissing && !updated;\n const hasQueuedUpdate = Boolean(nextPendingCtor);\n const shouldRetry = shouldRetryMissing || hasQueuedUpdate;\n\n if (!shouldRetry) {\n registry.retryCount = 0;\n return;\n }\n\n if (shouldRetryMissing) {\n registry.retryCount += 1;\n\n if (registry.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${registry.retryCount} attempts; aborting: ${moduleId}`\n );\n\n const hot = (\n import.meta as unknown as {\n hot?: { invalidate?: () => void };\n }\n ).hot;\n hot?.invalidate?.();\n\n registry.pendingCtor = undefined;\n registry.scheduled = false;\n return;\n }\n\n if (!nextPendingCtor) {\n nextPendingCtor = ctor;\n }\n }\n\n registry.pendingCtor = nextPendingCtor;\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId), 0);\n }\n};\n\nexport const createBoundary = (moduleId: string): BoundaryController => {\n enableComponentMapManualMode();\n\n return {\n register: (compKey: CompKey) => registerBoundaryInstance(moduleId, compKey),\n update: (nextCtor: TagFunction) => applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => disposeBoundary(moduleId),\n };\n};\n"],"names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","disposeComponentEntry","MAX_RETRY","boundaryRegistry","getRegistry","moduleId","registry","registerBoundaryInstance","entry","componentMap","currentWDom","_a","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","ctor","updated","hasMissing","cached","compProps","compChild","replaceWDom","refreshed","error","nextPendingCtor","shouldRetryMissing","createBoundary"],"mappings":"iRAGA,IAAIA,EAAqB,EAElB,MAAMC,EAA+B,IAAY,CAChCD,GAAA,EACtBE,EAAA,0BAA0B,EAAI,CAChC,EAEaC,EAAgC,IAAY,CACvDH,EAAqB,KAAK,IAAI,EAAGA,EAAqB,CAAC,EACnDA,IAAuB,GACzBE,EAAA,0BAA0B,EAAK,CAEnC,EAEaE,EAAwBC,GAA2B,CAC9DC,EAAA,sBAAsBD,CAAO,CAC/B,ECXME,EAAY,EAUZC,MAAuB,IAEvBC,EAAeC,GAAu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