@hyperfixi/core 2.0.0 → 2.2.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.
Files changed (76) hide show
  1. package/dist/api/hyperscript-api.d.ts +8 -1
  2. package/dist/ast-utils/index.d.ts +1 -1
  3. package/dist/ast-utils/index.js +11 -1
  4. package/dist/ast-utils/index.mjs +11 -1
  5. package/dist/ast-utils/interchange/index.d.ts +1 -1
  6. package/dist/ast-utils/interchange/lsp.d.ts +4 -1
  7. package/dist/behaviors/index.js +13 -5
  8. package/dist/behaviors/index.mjs +13 -5
  9. package/dist/bundle-generator/index.js +9 -0
  10. package/dist/bundle-generator/index.mjs +9 -0
  11. package/dist/chunks/{bridge-I6ceoWxV.js → bridge-D2DBo02Z.js} +2 -2
  12. package/dist/chunks/browser-modular-BA3JFmkq.js +2 -0
  13. package/dist/chunks/feature-eventsource-B5F2-H1r.js +2 -0
  14. package/dist/chunks/feature-sockets-ClOH7vk7.js +2 -0
  15. package/dist/chunks/feature-webworker-3bAp0ac9.js +2 -0
  16. package/dist/chunks/index-C6Fn0jGB.js +2 -0
  17. package/dist/commands/dom/toggle.d.ts +2 -0
  18. package/dist/commands/index.js +62 -6
  19. package/dist/commands/index.mjs +62 -6
  20. package/dist/debug/debug-controller.d.ts +62 -0
  21. package/dist/debug/index.d.ts +5 -0
  22. package/dist/expressions/index.js +16 -79
  23. package/dist/expressions/index.mjs +16 -79
  24. package/dist/hyperfixi-classic-i18n.js +1 -1
  25. package/dist/hyperfixi-hx.js +1 -1
  26. package/dist/hyperfixi-hybrid-complete.js +1 -1
  27. package/dist/hyperfixi-minimal.js +1 -1
  28. package/dist/hyperfixi-multilingual.js +1 -1
  29. package/dist/hyperfixi-standard.js +1 -1
  30. package/dist/hyperfixi.js +1 -1
  31. package/dist/hyperfixi.mjs +1 -1
  32. package/dist/i18n/error-catalog.d.ts +12 -0
  33. package/dist/index.d.ts +2 -0
  34. package/dist/index.js +35334 -24306
  35. package/dist/index.min.js +1 -1
  36. package/dist/index.mjs +35333 -24307
  37. package/dist/lokascript-browser-classic-i18n.js +1 -1
  38. package/dist/lokascript-browser-minimal.js +1 -1
  39. package/dist/lokascript-browser-standard.js +1 -1
  40. package/dist/lokascript-browser.js +1 -1
  41. package/dist/lokascript-hybrid-complete.js +1 -1
  42. package/dist/lokascript-hybrid-hx.js +1 -1
  43. package/dist/lokascript-multilingual.js +1 -1
  44. package/dist/lse/index.d.ts +15 -0
  45. package/dist/lse/index.js +84 -0
  46. package/dist/lse/index.mjs +71 -0
  47. package/dist/metadata.d.ts +4 -4
  48. package/dist/metadata.js +4 -4
  49. package/dist/metadata.mjs +4 -4
  50. package/dist/parser/full-parser.js +608 -271
  51. package/dist/parser/full-parser.mjs +608 -271
  52. package/dist/parser/helpers/ast-helpers.d.ts +1 -0
  53. package/dist/parser/hybrid/index.js +35 -2
  54. package/dist/parser/hybrid/index.mjs +35 -2
  55. package/dist/parser/hybrid/parser-core.d.ts +1 -0
  56. package/dist/parser/hybrid/parser-core.js +35 -2
  57. package/dist/parser/hybrid/parser-core.mjs +35 -2
  58. package/dist/parser/hybrid/tokenizer.js +5 -0
  59. package/dist/parser/hybrid/tokenizer.mjs +5 -0
  60. package/dist/parser/hybrid-parser.js +35 -2
  61. package/dist/parser/hybrid-parser.mjs +35 -2
  62. package/dist/parser/parser-types.d.ts +22 -7
  63. package/dist/parser/parser.d.ts +7 -0
  64. package/dist/parser/pratt-parser.d.ts +42 -0
  65. package/dist/parser/token-consumer.d.ts +1 -2
  66. package/dist/parser/tokenizer.d.ts +0 -33
  67. package/dist/registry/index.js +16 -79
  68. package/dist/registry/index.mjs +16 -79
  69. package/dist/runtime/runtime-base.d.ts +4 -0
  70. package/dist/types/base-types.d.ts +11 -0
  71. package/dist/types/core.d.ts +1 -0
  72. package/package.json +15 -6
  73. package/dist/chunks/browser-modular-Dv6PAV3c.js +0 -2
  74. package/dist/chunks/feature-eventsource-DWb514fy.js +0 -2
  75. package/dist/chunks/feature-sockets-3PFuvCVY.js +0 -2
  76. package/dist/chunks/feature-webworker-DTm_eh-E.js +0 -2
@@ -500,8 +500,9 @@ const SPECIAL_DOM_PROPERTIES = {
500
500
  outerhtml: el => el.outerHTML,
501
501
  value: el => (isFormElement(el) ? el.value : undefined),
502
502
  checked: el => (isInputElement(el) ? el.checked : undefined),
503
- disabled: el => (isFormElement(el) ? el.disabled : undefined),
503
+ disabled: el => ('disabled' in el ? el.disabled : undefined),
504
504
  selected: el => (isOptionElement(el) ? el.selected : undefined),
505
+ tabindex: el => (isHTMLElement$1(el) ? el.tabIndex : undefined),
505
506
  hidden: el => (isHTMLElement$1(el) ? el.hidden : undefined),
506
507
  style: el => getComputedStyle(el),
507
508
  children: el => Array.from(el.children),
@@ -510,7 +511,19 @@ const SPECIAL_DOM_PROPERTIES = {
510
511
  lastchild: el => el.lastElementChild,
511
512
  nextsibling: el => el.nextElementSibling,
512
513
  previoussibling: el => el.previousElementSibling,
514
+ values: el => collectFormValues(el),
513
515
  };
516
+ function collectFormValues(el) {
517
+ if (el instanceof HTMLFormElement)
518
+ return new FormData(el);
519
+ const fd = new FormData();
520
+ el.querySelectorAll('input, select, textarea').forEach((input) => {
521
+ const name = input.getAttribute('name');
522
+ if (name && 'value' in input)
523
+ fd.append(name, input.value);
524
+ });
525
+ return fd;
526
+ }
514
527
  function getElementProperty(element, property) {
515
528
  if (property.startsWith('computed-')) {
516
529
  const cssProperty = property.slice('computed-'.length);
@@ -3271,33 +3284,6 @@ var TokenKind;
3271
3284
  TokenKind["SYMBOL"] = "symbol";
3272
3285
  TokenKind["UNKNOWN"] = "unknown";
3273
3286
  })(TokenKind || (TokenKind = {}));
3274
- var TokenType;
3275
- (function (TokenType) {
3276
- TokenType["KEYWORD"] = "keyword";
3277
- TokenType["COMMAND"] = "command";
3278
- TokenType["EXPRESSION"] = "expression";
3279
- TokenType["STRING"] = "string";
3280
- TokenType["NUMBER"] = "number";
3281
- TokenType["BOOLEAN"] = "boolean";
3282
- TokenType["TEMPLATE_LITERAL"] = "template_literal";
3283
- TokenType["CSS_SELECTOR"] = "css_selector";
3284
- TokenType["ID_SELECTOR"] = "id_selector";
3285
- TokenType["CLASS_SELECTOR"] = "class_selector";
3286
- TokenType["QUERY_REFERENCE"] = "query_reference";
3287
- TokenType["CONTEXT_VAR"] = "context_var";
3288
- TokenType["GLOBAL_VAR"] = "global_var";
3289
- TokenType["EVENT"] = "event";
3290
- TokenType["OPERATOR"] = "operator";
3291
- TokenType["LOGICAL_OPERATOR"] = "logical_operator";
3292
- TokenType["COMPARISON_OPERATOR"] = "comparison_operator";
3293
- TokenType["TIME_EXPRESSION"] = "time_expression";
3294
- TokenType["OBJECT_LITERAL"] = "object_literal";
3295
- TokenType["ARRAY_LITERAL"] = "array_literal";
3296
- TokenType["SYMBOL"] = "symbol";
3297
- TokenType["COMMENT"] = "comment";
3298
- TokenType["IDENTIFIER"] = "identifier";
3299
- TokenType["UNKNOWN"] = "unknown";
3300
- })(TokenType || (TokenType = {}));
3301
3287
 
3302
3288
  class PerformanceTracker {
3303
3289
  constructor() {
@@ -5134,7 +5120,7 @@ const enhancedConverters = {
5134
5120
  Values: (value, _context) => {
5135
5121
  try {
5136
5122
  if (value instanceof HTMLFormElement) {
5137
- return success(extractFormValues(value), 'object');
5123
+ return success(getFormValuesProcessed(value), 'object');
5138
5124
  }
5139
5125
  if (value instanceof HTMLElement) {
5140
5126
  const inputs = value.querySelectorAll('input, select, textarea');
@@ -5142,7 +5128,7 @@ const enhancedConverters = {
5142
5128
  inputs.forEach((input) => {
5143
5129
  const htmlInput = input;
5144
5130
  if (htmlInput.name) {
5145
- const inputValue = extractInputValue(htmlInput);
5131
+ const inputValue = getInputValue(htmlInput);
5146
5132
  if (inputValue !== undefined) {
5147
5133
  values[htmlInput.name] = inputValue;
5148
5134
  }
@@ -5597,55 +5583,6 @@ class IsExpression extends BaseExpressionImpl {
5597
5583
  }
5598
5584
  }
5599
5585
  }
5600
- function extractFormValues(form) {
5601
- const values = {};
5602
- const elements = form.querySelectorAll('input, select, textarea');
5603
- elements.forEach(element => {
5604
- const input = element;
5605
- if (input.name) {
5606
- const value = extractInputValue(input);
5607
- if (value !== undefined) {
5608
- if (values[input.name] !== undefined) {
5609
- if (!Array.isArray(values[input.name])) {
5610
- values[input.name] = [values[input.name]];
5611
- }
5612
- values[input.name].push(value);
5613
- }
5614
- else {
5615
- values[input.name] = value;
5616
- }
5617
- }
5618
- }
5619
- });
5620
- return values;
5621
- }
5622
- function extractInputValue(input) {
5623
- if (input instanceof HTMLInputElement) {
5624
- switch (input.type) {
5625
- case 'checkbox':
5626
- return input.checked;
5627
- case 'radio':
5628
- return input.checked ? input.value : undefined;
5629
- case 'number':
5630
- case 'range':
5631
- return input.valueAsNumber;
5632
- case 'date':
5633
- case 'datetime-local':
5634
- return input.valueAsDate;
5635
- case 'file':
5636
- return input.files;
5637
- default:
5638
- return input.value;
5639
- }
5640
- }
5641
- if (input instanceof HTMLSelectElement) {
5642
- if (input.multiple) {
5643
- return Array.from(input.selectedOptions).map(option => option.value);
5644
- }
5645
- return input.value;
5646
- }
5647
- return input.value;
5648
- }
5649
5586
  ({
5650
5587
  as: new AsExpression(),
5651
5588
  is: new IsExpression(),
@@ -498,8 +498,9 @@ const SPECIAL_DOM_PROPERTIES = {
498
498
  outerhtml: el => el.outerHTML,
499
499
  value: el => (isFormElement(el) ? el.value : undefined),
500
500
  checked: el => (isInputElement(el) ? el.checked : undefined),
501
- disabled: el => (isFormElement(el) ? el.disabled : undefined),
501
+ disabled: el => ('disabled' in el ? el.disabled : undefined),
502
502
  selected: el => (isOptionElement(el) ? el.selected : undefined),
503
+ tabindex: el => (isHTMLElement$1(el) ? el.tabIndex : undefined),
503
504
  hidden: el => (isHTMLElement$1(el) ? el.hidden : undefined),
504
505
  style: el => getComputedStyle(el),
505
506
  children: el => Array.from(el.children),
@@ -508,7 +509,19 @@ const SPECIAL_DOM_PROPERTIES = {
508
509
  lastchild: el => el.lastElementChild,
509
510
  nextsibling: el => el.nextElementSibling,
510
511
  previoussibling: el => el.previousElementSibling,
512
+ values: el => collectFormValues(el),
511
513
  };
514
+ function collectFormValues(el) {
515
+ if (el instanceof HTMLFormElement)
516
+ return new FormData(el);
517
+ const fd = new FormData();
518
+ el.querySelectorAll('input, select, textarea').forEach((input) => {
519
+ const name = input.getAttribute('name');
520
+ if (name && 'value' in input)
521
+ fd.append(name, input.value);
522
+ });
523
+ return fd;
524
+ }
512
525
  function getElementProperty(element, property) {
513
526
  if (property.startsWith('computed-')) {
514
527
  const cssProperty = property.slice('computed-'.length);
@@ -3269,33 +3282,6 @@ var TokenKind;
3269
3282
  TokenKind["SYMBOL"] = "symbol";
3270
3283
  TokenKind["UNKNOWN"] = "unknown";
3271
3284
  })(TokenKind || (TokenKind = {}));
3272
- var TokenType;
3273
- (function (TokenType) {
3274
- TokenType["KEYWORD"] = "keyword";
3275
- TokenType["COMMAND"] = "command";
3276
- TokenType["EXPRESSION"] = "expression";
3277
- TokenType["STRING"] = "string";
3278
- TokenType["NUMBER"] = "number";
3279
- TokenType["BOOLEAN"] = "boolean";
3280
- TokenType["TEMPLATE_LITERAL"] = "template_literal";
3281
- TokenType["CSS_SELECTOR"] = "css_selector";
3282
- TokenType["ID_SELECTOR"] = "id_selector";
3283
- TokenType["CLASS_SELECTOR"] = "class_selector";
3284
- TokenType["QUERY_REFERENCE"] = "query_reference";
3285
- TokenType["CONTEXT_VAR"] = "context_var";
3286
- TokenType["GLOBAL_VAR"] = "global_var";
3287
- TokenType["EVENT"] = "event";
3288
- TokenType["OPERATOR"] = "operator";
3289
- TokenType["LOGICAL_OPERATOR"] = "logical_operator";
3290
- TokenType["COMPARISON_OPERATOR"] = "comparison_operator";
3291
- TokenType["TIME_EXPRESSION"] = "time_expression";
3292
- TokenType["OBJECT_LITERAL"] = "object_literal";
3293
- TokenType["ARRAY_LITERAL"] = "array_literal";
3294
- TokenType["SYMBOL"] = "symbol";
3295
- TokenType["COMMENT"] = "comment";
3296
- TokenType["IDENTIFIER"] = "identifier";
3297
- TokenType["UNKNOWN"] = "unknown";
3298
- })(TokenType || (TokenType = {}));
3299
3285
 
3300
3286
  class PerformanceTracker {
3301
3287
  constructor() {
@@ -5132,7 +5118,7 @@ const enhancedConverters = {
5132
5118
  Values: (value, _context) => {
5133
5119
  try {
5134
5120
  if (value instanceof HTMLFormElement) {
5135
- return success(extractFormValues(value), 'object');
5121
+ return success(getFormValuesProcessed(value), 'object');
5136
5122
  }
5137
5123
  if (value instanceof HTMLElement) {
5138
5124
  const inputs = value.querySelectorAll('input, select, textarea');
@@ -5140,7 +5126,7 @@ const enhancedConverters = {
5140
5126
  inputs.forEach((input) => {
5141
5127
  const htmlInput = input;
5142
5128
  if (htmlInput.name) {
5143
- const inputValue = extractInputValue(htmlInput);
5129
+ const inputValue = getInputValue(htmlInput);
5144
5130
  if (inputValue !== undefined) {
5145
5131
  values[htmlInput.name] = inputValue;
5146
5132
  }
@@ -5595,55 +5581,6 @@ class IsExpression extends BaseExpressionImpl {
5595
5581
  }
5596
5582
  }
5597
5583
  }
5598
- function extractFormValues(form) {
5599
- const values = {};
5600
- const elements = form.querySelectorAll('input, select, textarea');
5601
- elements.forEach(element => {
5602
- const input = element;
5603
- if (input.name) {
5604
- const value = extractInputValue(input);
5605
- if (value !== undefined) {
5606
- if (values[input.name] !== undefined) {
5607
- if (!Array.isArray(values[input.name])) {
5608
- values[input.name] = [values[input.name]];
5609
- }
5610
- values[input.name].push(value);
5611
- }
5612
- else {
5613
- values[input.name] = value;
5614
- }
5615
- }
5616
- }
5617
- });
5618
- return values;
5619
- }
5620
- function extractInputValue(input) {
5621
- if (input instanceof HTMLInputElement) {
5622
- switch (input.type) {
5623
- case 'checkbox':
5624
- return input.checked;
5625
- case 'radio':
5626
- return input.checked ? input.value : undefined;
5627
- case 'number':
5628
- case 'range':
5629
- return input.valueAsNumber;
5630
- case 'date':
5631
- case 'datetime-local':
5632
- return input.valueAsDate;
5633
- case 'file':
5634
- return input.files;
5635
- default:
5636
- return input.value;
5637
- }
5638
- }
5639
- if (input instanceof HTMLSelectElement) {
5640
- if (input.multiple) {
5641
- return Array.from(input.selectedOptions).map(option => option.value);
5642
- }
5643
- return input.value;
5644
- }
5645
- return input.value;
5646
- }
5647
5584
  ({
5648
5585
  as: new AsExpression(),
5649
5586
  is: new IsExpression(),