@webmate-studio/cli 0.3.14 → 0.3.16

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmate-studio/cli",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "type": "module",
5
5
  "description": "Webmate Studio CLI - Build and manage your Webmate components",
6
6
  "keywords": [
@@ -35,7 +35,7 @@
35
35
  "@webmate-studio/builder": "^0.2.1",
36
36
  "@webmate-studio/core": "^0.2.0",
37
37
  "@webmate-studio/parser": "^0.2.1",
38
- "@webmate-studio/preview": "^0.2.12",
38
+ "@webmate-studio/preview": "^0.2.14",
39
39
  "alpinejs": "^3.15.0",
40
40
  "commander": "^11.0.0",
41
41
  "esbuild": "^0.19.0",
@@ -5,21 +5,18 @@ import pc from 'picocolors';
5
5
 
6
6
  /**
7
7
  * Dev command - start preview server
8
- * Requires login to load design system CSS
8
+ * Login is optional - if logged in, design tokens will be loaded
9
9
  */
10
10
  export async function devCommand(options) {
11
- // Check if logged in
12
- if (!isLoggedIn()) {
13
- console.log('');
14
- logger.error('Nicht eingeloggt.');
15
- logger.info(`Bitte zuerst einloggen: ${pc.cyan('wm login')}`);
16
- console.log('');
17
- process.exit(1);
11
+ // Check if logged in (optional)
12
+ if (isLoggedIn()) {
13
+ const auth = loadAuth();
14
+ logger.info(`Projekt: ${pc.cyan(auth.tenant.name)}`);
15
+ } else {
16
+ logger.info('Nicht eingeloggt - verwende Standard Design Tokens');
17
+ logger.info(`Tipp: ${pc.cyan('wm login')} um Design Tokens vom CMS zu laden`);
18
18
  }
19
19
 
20
- const auth = loadAuth();
21
- logger.info(`Projekt: ${pc.cyan(auth.tenant.name)}`);
22
-
23
20
  try {
24
21
  await startPreviewServer(options);
25
22
  } catch (error) {
@@ -8,8 +8,16 @@ export default class {{NAME}}Island {
8
8
  constructor(element, props = {}) {
9
9
  this.element = element;
10
10
 
11
+ // Get props from data-island-props attribute (set by Custom Element transformation)
12
+ const islandProps = element.dataset.islandProps
13
+ ? JSON.parse(element.dataset.islandProps)
14
+ : {};
15
+
16
+ // Merge with constructor props (constructor props override data-island-props)
17
+ const allProps = { ...islandProps, ...props };
18
+
11
19
  // Title aus props oder default
12
- const title = props.title || '{{NAME}} Component';
20
+ const title = allProps.title || '{{NAME}} Component';
13
21
 
14
22
  // Create Alpine component HTML
15
23
  const html = `
@@ -61,15 +61,16 @@ export default class {{NAME}}Island {
61
61
  // Replace element content with Lit component (use unique name)
62
62
  const component = document.createElement(uniqueComponentName);
63
63
 
64
- // Transfer any data-attributes
65
- for (const attr of element.attributes) {
66
- if (attr.name.startsWith('data-')) {
67
- component.setAttribute(attr.name, attr.value);
68
- }
69
- }
64
+ // Get props from data-island-props attribute (set by Custom Element transformation)
65
+ const islandProps = element.dataset.islandProps
66
+ ? JSON.parse(element.dataset.islandProps)
67
+ : {};
68
+
69
+ // Merge with constructor props (constructor props override data-island-props)
70
+ const allProps = { ...islandProps, ...props };
70
71
 
71
- // Set initial props
72
- Object.assign(component, props);
72
+ // Set all props on component
73
+ Object.assign(component, allProps);
73
74
 
74
75
  element.appendChild(component);
75
76
  this.component = component;
@@ -36,11 +36,13 @@ export default class {{NAME}}Island {
36
36
  constructor(element, props = {}) {
37
37
  this.element = element;
38
38
 
39
- // Get initial data from data-attributes
40
- const initialData = JSON.parse(element.dataset.initialData || '{}');
39
+ // Get props from data-island-props attribute (set by Custom Element transformation)
40
+ const islandProps = element.dataset.islandProps
41
+ ? JSON.parse(element.dataset.islandProps)
42
+ : {};
41
43
 
42
- // Merge props
43
- const allProps = { ...initialData, ...props };
44
+ // Merge with constructor props (constructor props override data-island-props)
45
+ const allProps = { ...islandProps, ...props };
44
46
 
45
47
  render(<{{NAME}}Component {...allProps} />, element);
46
48
  }
@@ -37,9 +37,11 @@ export default class {{NAME}}Island {
37
37
  this.element = element;
38
38
  this.root = createRoot(element);
39
39
 
40
- // Get initial data from data-attributes
41
- const initialData = JSON.parse(element.dataset.initialData || '{}');
42
- const allProps = { ...initialData, ...props };
40
+ // Get props from data-island-props attribute
41
+ const islandProps = element.dataset.islandProps
42
+ ? JSON.parse(element.dataset.islandProps)
43
+ : {};
44
+ const allProps = { ...islandProps, ...props };
43
45
 
44
46
  this.root.render(<{{NAME}}Component {...allProps} />);
45
47
  }
@@ -9,11 +9,13 @@ export default class {{NAME}}Island {
9
9
  constructor(element, props = {}) {
10
10
  this.element = element;
11
11
 
12
- // Get initial props from data-attributes
13
- const initialData = JSON.parse(element.dataset.initialData || '{}');
12
+ // Get props from data-island-props attribute (set by Custom Element transformation)
13
+ const islandProps = element.dataset.islandProps
14
+ ? JSON.parse(element.dataset.islandProps)
15
+ : {};
14
16
 
15
- // Merge props from constructor and data attributes
16
- const allProps = { ...initialData, ...props };
17
+ // Merge with constructor props (constructor props override data-island-props)
18
+ const allProps = { ...islandProps, ...props };
17
19
 
18
20
  // Svelte 5: Use mount() instead of new Component()
19
21
  this.component = mount(Component, {
@@ -5,7 +5,14 @@
5
5
  export default class {{NAME}}Island {
6
6
  constructor(element, props = {}) {
7
7
  this.element = element;
8
- this.props = props;
8
+
9
+ // Get props from data-island-props attribute (set by Custom Element transformation)
10
+ const islandProps = element.dataset.islandProps
11
+ ? JSON.parse(element.dataset.islandProps)
12
+ : {};
13
+
14
+ // Merge with constructor props (constructor props override data-island-props)
15
+ this.props = { ...islandProps, ...props };
9
16
  this.count = 0;
10
17
  this.init();
11
18
  }
@@ -46,11 +46,13 @@ export default class {{NAME}}Island {
46
46
  constructor(element, props = {}) {
47
47
  this.element = element;
48
48
 
49
- // Get initial data from data-attributes
50
- const initialData = JSON.parse(element.dataset.initialData || '{}');
49
+ // Get props from data-island-props attribute (set by Custom Element transformation)
50
+ const islandProps = element.dataset.islandProps
51
+ ? JSON.parse(element.dataset.islandProps)
52
+ : {};
51
53
 
52
- // Merge props
53
- const allProps = { ...initialData, ...props };
54
+ // Merge with constructor props (constructor props override data-island-props)
55
+ const allProps = { ...islandProps, ...props };
54
56
 
55
57
  // Create Vue app
56
58
  this.app = createApp({{NAME}}Component, allProps);