bitwrench 2.0.25 → 2.0.30

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 (75) hide show
  1. package/README.md +10 -4
  2. package/dist/bitwrench-bccl.cjs.js +1 -1
  3. package/dist/bitwrench-bccl.cjs.min.js +1 -1
  4. package/dist/bitwrench-bccl.cjs.min.js.gz +0 -0
  5. package/dist/bitwrench-bccl.esm.js +1 -1
  6. package/dist/bitwrench-bccl.esm.min.js +1 -1
  7. package/dist/bitwrench-bccl.esm.min.js.gz +0 -0
  8. package/dist/bitwrench-bccl.umd.js +1 -1
  9. package/dist/bitwrench-bccl.umd.min.js +1 -1
  10. package/dist/bitwrench-bccl.umd.min.js.gz +0 -0
  11. package/dist/bitwrench-code-edit.cjs.js +1 -1
  12. package/dist/bitwrench-code-edit.cjs.min.js +1 -1
  13. package/dist/bitwrench-code-edit.es5.js +1 -1
  14. package/dist/bitwrench-code-edit.es5.min.js +1 -1
  15. package/dist/bitwrench-code-edit.esm.js +1 -1
  16. package/dist/bitwrench-code-edit.esm.min.js +1 -1
  17. package/dist/bitwrench-code-edit.umd.js +1 -1
  18. package/dist/bitwrench-code-edit.umd.min.js +1 -1
  19. package/dist/bitwrench-code-edit.umd.min.js.gz +0 -0
  20. package/dist/bitwrench-debug.js +1 -1
  21. package/dist/bitwrench-debug.min.js +1 -1
  22. package/dist/bitwrench-lean.cjs.js +623 -155
  23. package/dist/bitwrench-lean.cjs.min.js +7 -7
  24. package/dist/bitwrench-lean.cjs.min.js.gz +0 -0
  25. package/dist/bitwrench-lean.es5.js +650 -157
  26. package/dist/bitwrench-lean.es5.min.js +5 -5
  27. package/dist/bitwrench-lean.es5.min.js.gz +0 -0
  28. package/dist/bitwrench-lean.esm.js +623 -155
  29. package/dist/bitwrench-lean.esm.min.js +6 -6
  30. package/dist/bitwrench-lean.esm.min.js.gz +0 -0
  31. package/dist/bitwrench-lean.umd.js +623 -155
  32. package/dist/bitwrench-lean.umd.min.js +7 -7
  33. package/dist/bitwrench-lean.umd.min.js.gz +0 -0
  34. package/dist/bitwrench-util-css.cjs.js +1 -1
  35. package/dist/bitwrench-util-css.cjs.min.js +1 -1
  36. package/dist/bitwrench-util-css.es5.js +1 -1
  37. package/dist/bitwrench-util-css.es5.min.js +1 -1
  38. package/dist/bitwrench-util-css.esm.js +1 -1
  39. package/dist/bitwrench-util-css.esm.min.js +1 -1
  40. package/dist/bitwrench-util-css.umd.js +1 -1
  41. package/dist/bitwrench-util-css.umd.min.js +1 -1
  42. package/dist/bitwrench-util-css.umd.min.js.gz +0 -0
  43. package/dist/bitwrench.cjs.js +621 -153
  44. package/dist/bitwrench.cjs.min.js +6 -6
  45. package/dist/bitwrench.cjs.min.js.gz +0 -0
  46. package/dist/bitwrench.css +1 -1
  47. package/dist/bitwrench.d.ts +18 -11
  48. package/dist/bitwrench.es5.js +647 -154
  49. package/dist/bitwrench.es5.min.js +6 -6
  50. package/dist/bitwrench.es5.min.js.gz +0 -0
  51. package/dist/bitwrench.esm.js +621 -153
  52. package/dist/bitwrench.esm.min.js +5 -5
  53. package/dist/bitwrench.esm.min.js.gz +0 -0
  54. package/dist/bitwrench.umd.js +621 -153
  55. package/dist/bitwrench.umd.min.js +6 -6
  56. package/dist/bitwrench.umd.min.js.gz +0 -0
  57. package/dist/builds.json +95 -95
  58. package/dist/bwserve.cjs.js +140 -7
  59. package/dist/bwserve.esm.js +141 -8
  60. package/dist/sri.json +45 -45
  61. package/docs/bitwrench-for-wasm.md +851 -0
  62. package/docs/bitwrench_api.md +133 -23
  63. package/docs/llm-bitwrench-guide.md +6 -5
  64. package/docs/state-management.md +27 -3
  65. package/docs/thinking-in-bitwrench.md +3 -2
  66. package/package.json +11 -9
  67. package/readme.html +17 -8
  68. package/src/bitwrench.d.ts +18 -11
  69. package/src/bitwrench.js +617 -148
  70. package/src/bwserve/bwclient.js +3 -3
  71. package/src/bwserve/client.js +26 -0
  72. package/src/bwserve/index.js +110 -3
  73. package/src/cli/attach.js +7 -5
  74. package/src/cli/serve.js +53 -10
  75. package/src/version.js +3 -3
Binary file
@@ -1,5 +1,5 @@
1
1
  /**
2
- * bitwrench.css v2.0.25 — AUTO-GENERATED, DO NOT EDIT
2
+ * bitwrench.css v2.0.30 — AUTO-GENERATED, DO NOT EDIT
3
3
  *
4
4
  * Generated by src/generate-css.js from bitwrench-styles.js
5
5
  * This is a static snapshot of what bw.loadStyles() produces
@@ -315,8 +315,8 @@ export interface Bitwrench {
315
315
  html(taco: Taco | TacoContent, options?: { raw?: boolean; state?: Record<string, any> }): string;
316
316
  /** Generate complete HTML page string */
317
317
  htmlPage(opts: { title?: string; css?: string; content?: TacoContent; favicon?: string; [key: string]: any }): string;
318
- /** Create DOM element from TACO (browser only) */
319
- createDOM(taco: Taco | TacoContent, options?: Record<string, any>): HTMLElement | DocumentFragment;
318
+ /** Create DOM element from TACO (browser only). SVG TACOs ({t:'svg',...}) use createElementNS. */
319
+ createDOM(taco: Taco | TacoContent, options?: Record<string, any>): HTMLElement | SVGElement | DocumentFragment;
320
320
  /** Mount TACO into target, replacing contents */
321
321
  DOM(target: string | HTMLElement, taco: Taco | TacoContent, options?: Record<string, any>): void;
322
322
  /** Mount TACO and return root element (for el.bw access) */
@@ -331,24 +331,28 @@ export interface Bitwrench {
331
331
  update(target: string | HTMLElement): void;
332
332
  /** Quick-patch element content or attribute */
333
333
  patch(id: string | HTMLElement, content?: TacoContent, attr?: string): HTMLElement | null;
334
+ /** RFC 6902 JSON Patch on plain objects. Mutates and returns obj. @see bw.patch */
335
+ jsonPatch(obj: object, ops: Array<{ op: string; path: string; value?: any; from?: string }>): object;
334
336
  /** Batch patch multiple elements */
335
337
  patchAll(patches: Record<string, TacoContent> | Array<{ id: string; content?: TacoContent; attr?: string }>): Record<string, HTMLElement>;
336
338
  /** Clean up lifecycle hooks, subscriptions, cache */
337
339
  cleanup(element: HTMLElement): void;
338
340
 
339
341
  // -- DOM Selection --------------------------------------------------------
340
- /** CSS selector to array of elements */
341
- $(selector: string | HTMLElement | HTMLElement[]): HTMLElement[];
342
+ /** Resolve target to first matching element. Optional apply: string (textContent), function, TACO (mount), or array. @see bw.$ */
343
+ el(target: string | HTMLElement | null, apply?: string | number | boolean | Function | object | any[]): HTMLElement | null;
344
+ /** CSS selector to array of elements. Optional apply applied to each. @see bw.el */
345
+ $(selector: string | HTMLElement | HTMLElement[], apply?: string | number | boolean | Function | object | any[]): HTMLElement[];
342
346
  /** Dispatch DOM event */
343
347
  emit(target: string | HTMLElement, eventName: string, detail?: any): void;
344
348
  /** Add event listener */
345
349
  on(target: string | HTMLElement, eventName: string, handler: (e: Event) => void): void;
346
350
 
347
351
  // -- Pub/Sub --------------------------------------------------------------
348
- /** Publish to topic */
352
+ /** Publish to topic. Fires exact-match and wildcard subscribers. */
349
353
  pub(topic: string, detail?: any): number;
350
- /** Subscribe to topic; returns unsub() */
351
- sub(topic: string, handler: (detail: any) => void, el?: HTMLElement): () => void;
354
+ /** Subscribe to topic (or wildcard pattern ending in '*'); returns unsub(). Handler receives (detail, topic). */
355
+ sub(topic: string, handler: (detail: any, topic?: string) => void, el?: HTMLElement): () => void;
352
356
  /** Unsubscribe handler from topic */
353
357
  unsub(topic: string, handler: Function): number;
354
358
 
@@ -365,8 +369,8 @@ export interface Bitwrench {
365
369
  message(target: string | HTMLElement, action: string, data?: any): any;
366
370
  /** Execute wire-protocol message object */
367
371
  apply(msg: Record<string, any>): any;
368
- /** Inspect element properties */
369
- inspect(target: string | HTMLElement): Record<string, any>;
372
+ /** Inspect DOM element and subtree, returning plain-object tree with bitwrench metadata */
373
+ inspect(target: string | HTMLElement, depth?: number): Record<string, any> | null;
370
374
 
371
375
  // -- Function Registry ----------------------------------------------------
372
376
  funcRegister(fn: Function, name?: string): string;
@@ -395,8 +399,10 @@ export interface Bitwrench {
395
399
  loadStyles(config?: StyleConfig, scope?: string): StylesResult | void;
396
400
  /** Load CSS reset */
397
401
  loadReset(): void;
398
- /** Switch primary/alternate palette */
399
- toggleStyles(scope?: string): void;
402
+ /** Toggle between primary/alternate theme palettes on all matching elements. @see bw.applyStyles */
403
+ toggleThemeMode(scope?: string | HTMLElement): string;
404
+ /** @deprecated Use bw.toggleThemeMode() instead. Alias kept for one release cycle. */
405
+ toggleStyles(scope?: string | HTMLElement): string;
400
406
  /** Remove injected styles */
401
407
  clearStyles(scope?: string): void;
402
408
  /** Generate type scale from base + ratio */
@@ -586,6 +592,7 @@ export interface Bitwrench {
586
592
 
587
593
  // -- Internal (access at own risk) ----------------------------------------
588
594
  _nodeMap: Record<string, HTMLElement>;
595
+ /** @deprecated Use bw.el() instead. Alias kept for one release cycle. */
589
596
  _el(id: string): HTMLElement | null;
590
597
  _registerNode(el: HTMLElement, uuid: string): void;
591
598
  _deregisterNode(el: HTMLElement, uuid: string): void;