juxscript 1.1.40 → 1.1.42

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,12 +1,12 @@
1
1
  import { BaseComponent } from './base/BaseComponent.js';
2
2
  export interface CodeOptions {
3
- code?: string;
3
+ content?: string;
4
4
  language?: string;
5
5
  style?: string;
6
6
  class?: string;
7
7
  }
8
8
  type CodeState = {
9
- code: string;
9
+ content: string;
10
10
  language: string;
11
11
  style: string;
12
12
  class: string;
@@ -16,7 +16,7 @@ export declare class Code extends BaseComponent<CodeState> {
16
16
  protected getTriggerEvents(): readonly string[];
17
17
  protected getCallbackEvents(): readonly string[];
18
18
  update(prop: string, value: any): void;
19
- code(value: string): this;
19
+ content(value: string): this;
20
20
  language(value: string): this;
21
21
  render(targetId?: string | HTMLElement | BaseComponent<any>): this;
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"code.d.ts","sourceRoot":"","sources":["code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,IAAK,SAAQ,aAAa,CAAC,SAAS,CAAC;gBACpC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB;IASjD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAIhD,MAAM,CAAC,IAAI,EAAE,M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AAG,CAAC,GAAG,IAAI;CA4DnE;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAEhE"}
@@ -5,7 +5,7 @@ const CALLBACK_EVENTS = [];
5
5
  export class Code extends BaseComponent {
6
6
  constructor(id, options = {}) {
7
7
  super(id, {
8
- code: options.code ?? '',
8
+ content: options.content ?? '',
9
9
  language: options.language ?? 'javascript',
10
10
  style: options.style ?? '',
11
11
  class: options.class ?? ''
@@ -23,9 +23,8 @@ export class Code extends BaseComponent {
23
23
  /* ═════════════════════════════════════════════════════════════════
24
24
  * FLUENT API
25
25
  * ═════════════════════════════════════════════════════════════════ */
26
- // ✅ Inherited from BaseComponent
27
- code(value) {
28
- this.state.code = value;
26
+ content(value) {
27
+ this.state.content = value;
29
28
  return this;
30
29
  }
31
30
  language(value) {
@@ -37,7 +36,7 @@ export class Code extends BaseComponent {
37
36
  * ═════════════════════════════════════════════════════════════════ */
38
37
  render(targetId) {
39
38
  const container = this._setupContainer(targetId);
40
- const { code, language, style, class: className } = this.state;
39
+ const { content, language, style, class: className } = this.state;
41
40
  const wrapper = document.createElement('div');
42
41
  wrapper.className = 'jux-code';
43
42
  wrapper.id = this._id;
@@ -48,18 +47,18 @@ export class Code extends BaseComponent {
48
47
  const pre = document.createElement('pre');
49
48
  const codeEl = document.createElement('code');
50
49
  codeEl.className = `language-${language}`;
51
- codeEl.textContent = code;
50
+ codeEl.textContent = content;
52
51
  pre.appendChild(codeEl);
53
52
  wrapper.appendChild(pre);
54
53
  this._wireStandardEvents(wrapper);
55
54
  // Wire sync bindings
56
55
  this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
57
- if (property === 'code') {
56
+ if (property === 'content') {
58
57
  const transform = toComponent || ((v) => String(v));
59
58
  stateObj.subscribe((val) => {
60
59
  const transformed = transform(val);
61
60
  codeEl.textContent = transformed;
62
- this.state.code = transformed;
61
+ this.state.content = transformed;
63
62
  if (window.Prism) {
64
63
  window.Prism.highlightElement(codeEl);
65
64
  }
@@ -5,14 +5,14 @@ const TRIGGER_EVENTS = [] as const;
5
5
  const CALLBACK_EVENTS = [] as const;
6
6
 
7
7
  export interface CodeOptions {
8
- code?: string;
8
+ content?: string;
9
9
  language?: string;
10
10
  style?: string;
11
11
  class?: string;
12
12
  }
13
13
 
14
14
  type CodeState = {
15
- code: string;
15
+ content: string;
16
16
  language: string;
17
17
  style: string;
18
18
  class: string;
@@ -21,7 +21,7 @@ type CodeState = {
21
21
  export class Code extends BaseComponent<CodeState> {
22
22
  constructor(id: string, options: CodeOptions = {}) {
23
23
  super(id, {
24
- code: options.code ?? '',
24
+ content: options.content ?? '',
25
25
  language: options.language ?? 'javascript',
26
26
  style: options.style ?? '',
27
27
  class: options.class ?? ''
@@ -44,10 +44,8 @@ export class Code extends BaseComponent<CodeState> {
44
44
  * FLUENT API
45
45
  * ═════════════════════════════════════════════════════════════════ */
46
46
 
47
- // Inherited from BaseComponent
48
-
49
- code(value: string): this {
50
- this.state.code = value;
47
+ content(value: string): this {
48
+ this.state.content = value;
51
49
  return this;
52
50
  }
53
51
 
@@ -63,7 +61,7 @@ export class Code extends BaseComponent<CodeState> {
63
61
  render(targetId?: string | HTMLElement | BaseComponent<any>): this {
64
62
  const container = this._setupContainer(targetId);
65
63
 
66
- const { code, language, style, class: className } = this.state;
64
+ const { content, language, style, class: className } = this.state;
67
65
 
68
66
  const wrapper = document.createElement('div');
69
67
  wrapper.className = 'jux-code';
@@ -74,7 +72,7 @@ export class Code extends BaseComponent<CodeState> {
74
72
  const pre = document.createElement('pre');
75
73
  const codeEl = document.createElement('code');
76
74
  codeEl.className = `language-${language}`;
77
- codeEl.textContent = code;
75
+ codeEl.textContent = content;
78
76
  pre.appendChild(codeEl);
79
77
  wrapper.appendChild(pre);
80
78
 
@@ -82,13 +80,13 @@ export class Code extends BaseComponent<CodeState> {
82
80
 
83
81
  // Wire sync bindings
84
82
  this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
85
- if (property === 'code') {
83
+ if (property === 'content') {
86
84
  const transform = toComponent || ((v: any) => String(v));
87
85
 
88
86
  stateObj.subscribe((val: any) => {
89
87
  const transformed = transform(val);
90
88
  codeEl.textContent = transformed;
91
- this.state.code = transformed;
89
+ this.state.content = transformed;
92
90
 
93
91
  if ((window as any).Prism) {
94
92
  (window as any).Prism.highlightElement(codeEl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.40",
3
+ "version": "1.1.42",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "index.js",