ide-assi 0.361.0 → 0.362.0

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.
@@ -129,58 +129,89 @@ export class IdeDiff extends HTMLElement {
129
129
  }
130
130
 
131
131
  #initCodeMirror = () => {
132
- // ... (기존 코드) ...
133
-
134
- const initialExtensions = [
135
- basicExtensions,
136
- javascript(),
137
- EditorState.readOnly.of(true),
138
- this.#languageCompartment.of(javascript()),
139
- asisDiffDecorations,
140
- // ⭐️ updateListener 추가
141
- EditorView.updateListener.of((update) => {
142
- // 뷰가 첫 번째 업데이트를 완료하고 모든 DOM이 생성된 후
143
- if (update.view.contentDOM.firstChild && !update.view._initialContentLoaded) {
144
- update.view._initialContentLoaded = true; // 플래그 설정
145
- // ⭐️ 이 시점에서 initialize 호출 (예시, 실제 데이터는 외부에서 받아야 함)
146
- // this.initialize("const old = 'value';", "const new = 'value';\nconsole.log('diff');");
147
- console.log("CodeMirror ASIS view is ready for initial content.");
148
- }
149
- })
132
+ this.#asisEditorEl = this.shadowRoot.querySelector('.panel.asis');
133
+ this.#tobeEditorEl = this.shadowRoot.querySelector('.panel.tobe');
134
+
135
+ if (!this.#asisEditorEl || !this.#tobeEditorEl) {
136
+ console.error('CodeMirror panel containers not found!');
137
+ return;
138
+ }
139
+
140
+ const basicExtensions = [
141
+ lineNumbers(),
142
+ highlightSpecialChars(),
143
+ history(),
144
+ drawSelection(),
145
+ dropCursor(),
146
+ EditorState.allowMultipleSelections.of(true),
147
+ indentOnInput(),
148
+ bracketMatching(),
149
+ highlightActiveLine(),
150
+ highlightSelectionMatches(),
151
+ keymap.of([
152
+ ...defaultKeymap,
153
+ ...searchKeymap,
154
+ ...historyKeymap,
155
+ ...lintKeymap,
156
+ ...completionKeymap,
157
+ indentWithTab,
158
+ selectAll
159
+ ]),
160
+ syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
161
+ autocompletion(),
150
162
  ];
151
163
 
164
+ // ASIS 에디터 뷰 초기화
152
165
  this.#asisEditorView = new EditorView({
153
166
  state: EditorState.create({
154
167
  doc: '',
155
- extensions: initialExtensions // 수정된 extensions 사용
168
+ extensions: [
169
+ basicExtensions,
170
+ javascript(),
171
+ EditorState.readOnly.of(true),
172
+ this.#languageCompartment.of(javascript()),
173
+ asisDiffDecorations,
174
+ // ⭐️ 중요: 뷰가 DOM에 완전히 렌더링될 때까지 기다립니다.
175
+ EditorView.updateListener.of((update) => {
176
+ // 뷰의 DOM 내용이 비어있지 않고, 아직 초기 로드가 완료되지 않았다면
177
+ if (update.view.contentDOM.firstChild && !update.view._initialAsisContentLoaded) {
178
+ update.view._initialAsisContentLoaded = true; // 플래그 설정
179
+ console.log("CodeMirror ASIS view is ready for initial content.");
180
+ // 뷰가 준비되었을 때 initialize를 호출해야 한다면 여기에 로직 추가 (예: 외부에서 데이터 주입)
181
+ // 예시: this.initialize("초기 ASIS 코드", "초기 TOBE 코드");
182
+ // 단, initialize는 한 번만 호출되도록 외부 로직을 구성해야 합니다.
183
+ }
184
+ })
185
+ ]
156
186
  }),
157
187
  parent: this.#asisEditorEl
158
188
  });
159
189
 
160
- // TOBE 에디터도 동일하게 처리
161
- const tobeInitialExtensions = [
162
- basicExtensions,
163
- javascript(),
164
- EditorState.readOnly.of(true),
165
- this.#languageCompartment.of(javascript()),
166
- tobeDiffDecorations,
167
- EditorView.updateListener.of((update) => {
168
- if (update.view.contentDOM.firstChild && !update.view._initialContentLoaded) {
169
- update.view._initialContentLoaded = true;
170
- console.log("CodeMirror TOBE view is ready for initial content.");
171
- }
172
- })
173
- ];
174
-
190
+ // TOBE 에디터 초기화
175
191
  this.#tobeEditorView = new EditorView({
176
192
  state: EditorState.create({
177
193
  doc: '',
178
- extensions: tobeInitialExtensions
194
+ extensions: [
195
+ basicExtensions,
196
+ javascript(),
197
+ EditorState.readOnly.of(true),
198
+ this.#languageCompartment.of(javascript()),
199
+ tobeDiffDecorations,
200
+ // ⭐️ 중요: 뷰가 DOM에 완전히 렌더링될 때까지 기다립니다.
201
+ EditorView.updateListener.of((update) => {
202
+ // 뷰의 DOM 내용이 비어있지 않고, 아직 초기 로드가 완료되지 않았다면
203
+ if (update.view.contentDOM.firstChild && !update.view._initialTobeContentLoaded) {
204
+ update.view._initialTobeContentLoaded = true; // 플래그 설정
205
+ console.log("CodeMirror TOBE view is ready for initial content.");
206
+ }
207
+ })
208
+ ]
179
209
  }),
180
210
  parent: this.#tobeEditorEl
181
211
  });
182
212
 
183
- // 스크롤 동기화 설정 (여전히 초기에는 비활성화 상태)
213
+ // ⭐️ 스크롤 동기화는 여기서 설정만 하고, `initialize` 함수 내에서 활성화 시점을 제어합니다.
214
+ // (이전 단계에서 이미 `initialize`에 활성/비활성화 로직을 추가했다고 가정)
184
215
  this.#setupScrollSync();
185
216
  };
186
217
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.361.0",
4
+ "version": "0.362.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -129,58 +129,89 @@ export class IdeDiff extends HTMLElement {
129
129
  }
130
130
 
131
131
  #initCodeMirror = () => {
132
- // ... (기존 코드) ...
133
-
134
- const initialExtensions = [
135
- basicExtensions,
136
- javascript(),
137
- EditorState.readOnly.of(true),
138
- this.#languageCompartment.of(javascript()),
139
- asisDiffDecorations,
140
- // ⭐️ updateListener 추가
141
- EditorView.updateListener.of((update) => {
142
- // 뷰가 첫 번째 업데이트를 완료하고 모든 DOM이 생성된 후
143
- if (update.view.contentDOM.firstChild && !update.view._initialContentLoaded) {
144
- update.view._initialContentLoaded = true; // 플래그 설정
145
- // ⭐️ 이 시점에서 initialize 호출 (예시, 실제 데이터는 외부에서 받아야 함)
146
- // this.initialize("const old = 'value';", "const new = 'value';\nconsole.log('diff');");
147
- console.log("CodeMirror ASIS view is ready for initial content.");
148
- }
149
- })
132
+ this.#asisEditorEl = this.shadowRoot.querySelector('.panel.asis');
133
+ this.#tobeEditorEl = this.shadowRoot.querySelector('.panel.tobe');
134
+
135
+ if (!this.#asisEditorEl || !this.#tobeEditorEl) {
136
+ console.error('CodeMirror panel containers not found!');
137
+ return;
138
+ }
139
+
140
+ const basicExtensions = [
141
+ lineNumbers(),
142
+ highlightSpecialChars(),
143
+ history(),
144
+ drawSelection(),
145
+ dropCursor(),
146
+ EditorState.allowMultipleSelections.of(true),
147
+ indentOnInput(),
148
+ bracketMatching(),
149
+ highlightActiveLine(),
150
+ highlightSelectionMatches(),
151
+ keymap.of([
152
+ ...defaultKeymap,
153
+ ...searchKeymap,
154
+ ...historyKeymap,
155
+ ...lintKeymap,
156
+ ...completionKeymap,
157
+ indentWithTab,
158
+ selectAll
159
+ ]),
160
+ syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
161
+ autocompletion(),
150
162
  ];
151
163
 
164
+ // ASIS 에디터 뷰 초기화
152
165
  this.#asisEditorView = new EditorView({
153
166
  state: EditorState.create({
154
167
  doc: '',
155
- extensions: initialExtensions // 수정된 extensions 사용
168
+ extensions: [
169
+ basicExtensions,
170
+ javascript(),
171
+ EditorState.readOnly.of(true),
172
+ this.#languageCompartment.of(javascript()),
173
+ asisDiffDecorations,
174
+ // ⭐️ 중요: 뷰가 DOM에 완전히 렌더링될 때까지 기다립니다.
175
+ EditorView.updateListener.of((update) => {
176
+ // 뷰의 DOM 내용이 비어있지 않고, 아직 초기 로드가 완료되지 않았다면
177
+ if (update.view.contentDOM.firstChild && !update.view._initialAsisContentLoaded) {
178
+ update.view._initialAsisContentLoaded = true; // 플래그 설정
179
+ console.log("CodeMirror ASIS view is ready for initial content.");
180
+ // 뷰가 준비되었을 때 initialize를 호출해야 한다면 여기에 로직 추가 (예: 외부에서 데이터 주입)
181
+ // 예시: this.initialize("초기 ASIS 코드", "초기 TOBE 코드");
182
+ // 단, initialize는 한 번만 호출되도록 외부 로직을 구성해야 합니다.
183
+ }
184
+ })
185
+ ]
156
186
  }),
157
187
  parent: this.#asisEditorEl
158
188
  });
159
189
 
160
- // TOBE 에디터도 동일하게 처리
161
- const tobeInitialExtensions = [
162
- basicExtensions,
163
- javascript(),
164
- EditorState.readOnly.of(true),
165
- this.#languageCompartment.of(javascript()),
166
- tobeDiffDecorations,
167
- EditorView.updateListener.of((update) => {
168
- if (update.view.contentDOM.firstChild && !update.view._initialContentLoaded) {
169
- update.view._initialContentLoaded = true;
170
- console.log("CodeMirror TOBE view is ready for initial content.");
171
- }
172
- })
173
- ];
174
-
190
+ // TOBE 에디터 초기화
175
191
  this.#tobeEditorView = new EditorView({
176
192
  state: EditorState.create({
177
193
  doc: '',
178
- extensions: tobeInitialExtensions
194
+ extensions: [
195
+ basicExtensions,
196
+ javascript(),
197
+ EditorState.readOnly.of(true),
198
+ this.#languageCompartment.of(javascript()),
199
+ tobeDiffDecorations,
200
+ // ⭐️ 중요: 뷰가 DOM에 완전히 렌더링될 때까지 기다립니다.
201
+ EditorView.updateListener.of((update) => {
202
+ // 뷰의 DOM 내용이 비어있지 않고, 아직 초기 로드가 완료되지 않았다면
203
+ if (update.view.contentDOM.firstChild && !update.view._initialTobeContentLoaded) {
204
+ update.view._initialTobeContentLoaded = true; // 플래그 설정
205
+ console.log("CodeMirror TOBE view is ready for initial content.");
206
+ }
207
+ })
208
+ ]
179
209
  }),
180
210
  parent: this.#tobeEditorEl
181
211
  });
182
212
 
183
- // 스크롤 동기화 설정 (여전히 초기에는 비활성화 상태)
213
+ // ⭐️ 스크롤 동기화는 여기서 설정만 하고, `initialize` 함수 내에서 활성화 시점을 제어합니다.
214
+ // (이전 단계에서 이미 `initialize`에 활성/비활성화 로직을 추가했다고 가정)
184
215
  this.#setupScrollSync();
185
216
  };
186
217