dynim-core 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/builder/builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAQxE,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAIlE,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrE,+FAA+F;IAC/F,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,cAAc,EAAE,MAAM,OAAO,CAAC;IAC9B,YAAY,EAAE,MAAM,OAAO,CAAC;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,MAAM,GAAE,aAAkB,GAAG,OAAO,CAmXjE;;;;AAMD,wBAAyC"}
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/builder/builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAQxE,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAIlE,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrE,+FAA+F;IAC/F,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,cAAc,EAAE,MAAM,OAAO,CAAC;IAC9B,YAAY,EAAE,MAAM,OAAO,CAAC;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,MAAM,GAAE,aAAkB,GAAG,OAAO,CA0bjE;;;;AAMD,wBAAyC"}
@@ -38,6 +38,18 @@ export function createBuilder(config = {}) {
38
38
  </div>
39
39
  <div class="builder-bar__divider"></div>
40
40
  <div class="builder-bar__actions">
41
+ <button class="builder-bar__btn builder-bar__btn--preview">
42
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor">
43
+ <path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/>
44
+ </svg>
45
+ Preview
46
+ </button>
47
+ <button class="builder-bar__btn builder-bar__btn--save">
48
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor">
49
+ <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
50
+ </svg>
51
+ Save
52
+ </button>
41
53
  <button class="builder-bar__btn builder-bar__btn--exit">
42
54
  <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor">
43
55
  <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
@@ -304,6 +316,52 @@ export function createBuilder(config = {}) {
304
316
  }
305
317
  cleanup();
306
318
  }
319
+ async function handlePreview() {
320
+ if (!builderClient) {
321
+ console.error('[Builder] Builder client not initialized');
322
+ return;
323
+ }
324
+ try {
325
+ console.log('[Builder] Requesting preview...');
326
+ const result = await builderClient.preview(pageId);
327
+ console.log('[Builder] Preview result:', result);
328
+ if (result.previewUrl) {
329
+ window.open(result.previewUrl, '_blank');
330
+ }
331
+ }
332
+ catch (error) {
333
+ console.error('[Builder] Preview failed:', error);
334
+ }
335
+ }
336
+ async function handleSave() {
337
+ if (!client) {
338
+ console.error('[Builder] Code client not initialized');
339
+ return;
340
+ }
341
+ try {
342
+ console.log('[Builder] Saving code edits...');
343
+ await client.saveCode();
344
+ console.log('[Builder] Save complete');
345
+ // Visual feedback - briefly show saved state
346
+ const saveBtn = root.querySelector('.builder-bar__btn--save');
347
+ if (saveBtn) {
348
+ saveBtn.classList.add('builder-bar__btn--saved');
349
+ saveBtn.textContent = 'Saved!';
350
+ setTimeout(() => {
351
+ saveBtn.classList.remove('builder-bar__btn--saved');
352
+ saveBtn.innerHTML = `
353
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor">
354
+ <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
355
+ </svg>
356
+ Save
357
+ `;
358
+ }, 2000);
359
+ }
360
+ }
361
+ catch (error) {
362
+ console.error('[Builder] Save failed:', error);
363
+ }
364
+ }
307
365
  root.addEventListener('click', (e) => {
308
366
  const target = e.target;
309
367
  if (target.closest('.builder-bar__btn--exit')) {
@@ -311,6 +369,16 @@ export function createBuilder(config = {}) {
311
369
  exit();
312
370
  return;
313
371
  }
372
+ if (target.closest('.builder-bar__btn--preview')) {
373
+ e.stopPropagation();
374
+ handlePreview();
375
+ return;
376
+ }
377
+ if (target.closest('.builder-bar__btn--save')) {
378
+ e.stopPropagation();
379
+ handleSave();
380
+ return;
381
+ }
314
382
  });
315
383
  document.addEventListener('click', (e) => {
316
384
  const target = e.target;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynim-core",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -109,6 +109,10 @@
109
109
  transform: scale(0.96);
110
110
  }
111
111
 
112
+ .builder-bar__btn--save.builder-bar__btn--saved {
113
+ background: #22c55e !important;
114
+ }
115
+
112
116
  .builder-bar__btn--preview {
113
117
  background: rgba(255, 255, 255, 0.08);
114
118
  color: #94a3b8;