@pixerate/editor 0.264.1 → 0.266.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 (60) hide show
  1. package/dist/agent/index.cjs +4 -3
  2. package/dist/agent/index.js +3 -2
  3. package/dist/animation-editor/index.cjs +60 -61
  4. package/dist/animation-editor/index.js +4 -5
  5. package/dist/brushes/index.cjs +73 -60
  6. package/dist/brushes/index.d.cts +1 -0
  7. package/dist/brushes/index.d.ts +1 -0
  8. package/dist/brushes/index.js +17 -4
  9. package/dist/brushes/preview.d.cts +59 -0
  10. package/dist/brushes/preview.d.ts +59 -0
  11. package/dist/brushes/tools.d.cts +12 -5
  12. package/dist/brushes/tools.d.ts +12 -5
  13. package/dist/{brushstrokeRender-3MOI7PH4.js → brushstrokeRender-4UB6NRJW.js} +11 -4
  14. package/dist/{brushstrokeRender-SMMPIJF2.cjs → brushstrokeRender-JQ2XQRUD.cjs} +22 -15
  15. package/dist/canvas/brushstroke.d.cts +6 -1
  16. package/dist/canvas/brushstroke.d.ts +6 -1
  17. package/dist/canvas/index.cjs +18 -18
  18. package/dist/canvas/index.js +4 -4
  19. package/dist/{chunk-TMDDMJCR.js → chunk-472INMWH.js} +4 -2
  20. package/dist/chunk-55ALHYJY.js +289 -0
  21. package/dist/{chunk-F3KKR6DD.cjs → chunk-5OE4ZZ6V.cjs} +30 -30
  22. package/dist/{chunk-BY5EBP26.cjs → chunk-677777GH.cjs} +3 -3
  23. package/dist/{chunk-NHA26O5X.cjs → chunk-7KNW3WXZ.cjs} +14 -12
  24. package/dist/{chunk-G5ADO47G.cjs → chunk-7NQOGWLM.cjs} +3 -2
  25. package/dist/{chunk-WWI6FLH2.js → chunk-7PW6VCNW.js} +2 -2
  26. package/dist/{chunk-CECCP2V7.js → chunk-BLR4KWYQ.js} +1 -1
  27. package/dist/chunk-DEBIFWY6.cjs +77 -0
  28. package/dist/{chunk-KXNZNOEF.cjs → chunk-DGXTEPCU.cjs} +94 -94
  29. package/dist/{chunk-3CI7FRMK.js → chunk-DVPQFMH6.js} +13 -1
  30. package/dist/chunk-E2Z4UARJ.cjs +289 -0
  31. package/dist/chunk-HAEB3MZD.js +664 -0
  32. package/dist/{chunk-EE7SAYBF.js → chunk-J4SGJCPW.js} +3 -3
  33. package/dist/{chunk-A2IS7EHE.cjs → chunk-JBZRVLXV.cjs} +14 -2
  34. package/dist/chunk-KIJIONZF.cjs +664 -0
  35. package/dist/{chunk-V7MJ4HIN.cjs → chunk-NOP4Y5AB.cjs} +23 -23
  36. package/dist/{chunk-FQC5TDB6.cjs → chunk-O53MOGXG.cjs} +35 -35
  37. package/dist/{chunk-LPFQHVCO.js → chunk-PXXXRCME.js} +1 -284
  38. package/dist/{chunk-4OJC4MCD.js → chunk-Q6RVVJW6.js} +1 -1
  39. package/dist/{chunk-T7QSEKDY.cjs → chunk-QJVOJUTD.cjs} +4 -287
  40. package/dist/{chunk-HAUDEVMC.js → chunk-WY23AUCA.js} +2 -2
  41. package/dist/{chunk-JEML4FSA.js → chunk-XDNWQMHY.js} +3 -2
  42. package/dist/{chunk-ROBSFJ6F.js → chunk-Z2Z2OHRM.js} +1 -1
  43. package/dist/{chunk-USJX5SW4.cjs → chunk-ZHRVCW3M.cjs} +12 -12
  44. package/dist/chunk-ZS7LB2MV.js +77 -0
  45. package/dist/commands/index.cjs +26 -656
  46. package/dist/commands/index.js +18 -648
  47. package/dist/image-editor/index.cjs +788 -790
  48. package/dist/image-editor/index.js +6 -8
  49. package/dist/paint-editor/index.cjs +88 -84
  50. package/dist/paint-editor/index.js +12 -8
  51. package/dist/vector/contract.d.cts +52 -0
  52. package/dist/vector/contract.d.ts +52 -0
  53. package/dist/vector/index.cjs +1168 -971
  54. package/dist/vector/index.d.cts +1 -0
  55. package/dist/vector/index.d.ts +1 -0
  56. package/dist/vector/index.js +204 -7
  57. package/package.json +1 -1
  58. package/skills/pixerate-brushes/SKILL.md +7 -2
  59. package/dist/chunk-FJBQTZS4.js +0 -17
  60. package/dist/chunk-LRTR4ASZ.cjs +0 -17
@@ -56,3 +56,4 @@ export * from './playback.cjs';
56
56
  export * from './editorDocument.cjs';
57
57
  export * from './layers.cjs';
58
58
  export * from './stickers.cjs';
59
+ export { createVectorConformanceHost, vectorContracts, VECTOR_CONTRACT_FORMAT_VERSION, VECTOR_DOCUMENT_JSON_SCHEMA, FAKE_VECTOR_ART_MODELS, fakeVectorArtGenerator } from './contract.cjs';
@@ -56,3 +56,4 @@ export * from './playback.js';
56
56
  export * from './editorDocument.js';
57
57
  export * from './layers.js';
58
58
  export * from './stickers.js';
59
+ export { createVectorConformanceHost, vectorContracts, VECTOR_CONTRACT_FORMAT_VERSION, VECTOR_DOCUMENT_JSON_SCHEMA, FAKE_VECTOR_ART_MODELS, fakeVectorArtGenerator } from './contract.js';
@@ -1,3 +1,7 @@
1
+ import {
2
+ CommandRegistry,
3
+ createCommandToolProvider
4
+ } from "../chunk-HAEB3MZD.js";
1
5
  import {
2
6
  planGenerationRequest,
3
7
  stableStringify
@@ -8,6 +12,11 @@ import {
8
12
  hatchPath,
9
13
  pathfinder
10
14
  } from "../chunk-65MDXWA7.js";
15
+ import "../chunk-PXXXRCME.js";
16
+ import {
17
+ ToolRegistry
18
+ } from "../chunk-K4BGRCSH.js";
19
+ import "../chunk-EHTX34RE.js";
11
20
  import {
12
21
  VECTOR_TRACE_MAX_PIXELS,
13
22
  bendSegment,
@@ -26,7 +35,7 @@ import {
26
35
  traceField,
27
36
  traceVectorImage,
28
37
  vectorTraceContours
29
- } from "../chunk-CECCP2V7.js";
38
+ } from "../chunk-BLR4KWYQ.js";
30
39
  import {
31
40
  applyHomography,
32
41
  homographyFromPoints,
@@ -35,6 +44,7 @@ import {
35
44
  orderQuad,
36
45
  solve8
37
46
  } from "../chunk-OHKOFKBY.js";
47
+ import "../chunk-IVSWRVB4.js";
38
48
  import {
39
49
  correspondMorphContours,
40
50
  createVectorMorph,
@@ -53,7 +63,7 @@ import {
53
63
  reverseMorphContour,
54
64
  subpathToMorphContour,
55
65
  turnMorphContour
56
- } from "../chunk-ROBSFJ6F.js";
66
+ } from "../chunk-Z2Z2OHRM.js";
57
67
  import {
58
68
  DEFAULT_VECTOR_FONT,
59
69
  IDENTITY_MATRIX,
@@ -529,10 +539,10 @@ import {
529
539
  withVectorStrokes,
530
540
  withVectorTargetPaint,
531
541
  zigzagPaths
532
- } from "../chunk-WWI6FLH2.js";
542
+ } from "../chunk-7PW6VCNW.js";
533
543
  import {
534
544
  snapshotBrushLibrary
535
- } from "../chunk-EE7SAYBF.js";
545
+ } from "../chunk-J4SGJCPW.js";
536
546
  import "../chunk-ACFSFUQH.js";
537
547
  import {
538
548
  createProvenance
@@ -559,8 +569,7 @@ import {
559
569
  fitCubics,
560
570
  parseSvgPath
561
571
  } from "../chunk-PWBZH3FK.js";
562
- import "../chunk-FJBQTZS4.js";
563
- import "../chunk-3CI7FRMK.js";
572
+ import "../chunk-DVPQFMH6.js";
564
573
  import {
565
574
  StickerError
566
575
  } from "../chunk-SZTI6EER.js";
@@ -591,7 +600,9 @@ import {
591
600
  import "../chunk-SIFAIGB3.js";
592
601
  import "../chunk-VDGBHYC7.js";
593
602
  import {
594
- defineEditorDocument
603
+ EDITOR_DOCUMENT_FORMAT,
604
+ defineEditorDocument,
605
+ toEditorDocumentFile
595
606
  } from "../chunk-XBQX76CT.js";
596
607
  import "../chunk-HF5QZS7Z.js";
597
608
  import {
@@ -18397,12 +18408,193 @@ function createVectorStickerHost(controller, options = {}) {
18397
18408
  }
18398
18409
  };
18399
18410
  }
18411
+
18412
+ // src/vector/contract.ts
18413
+ var VECTOR_CONTRACT_FORMAT_VERSION = 1;
18414
+ var VECTOR_DOCUMENT_JSON_SCHEMA = {
18415
+ type: "object",
18416
+ description: "A saved vector document, as the vector editor's save tools and autosave write it.",
18417
+ properties: {
18418
+ format: { type: "string", const: EDITOR_DOCUMENT_FORMAT, description: `Always "${EDITOR_DOCUMENT_FORMAT}".` },
18419
+ kind: { type: "string", const: "vector", description: 'Always "vector".' },
18420
+ formatVersion: { type: "integer", minimum: 1, description: "Version of the envelope for this kind; readers migrate older ones." },
18421
+ name: { type: "string", description: "Display name, when it has one." },
18422
+ document: {
18423
+ type: "object",
18424
+ description: "The drawing (`VectorDocument`, as get_vector_document returns it).",
18425
+ properties: {
18426
+ width: { type: "number", exclusiveMinimum: 0, description: "Artboard width in document units." },
18427
+ height: { type: "number", exclusiveMinimum: 0, description: "Artboard height in document units." },
18428
+ background: { type: "string", description: "Artboard colour (default: transparent)." },
18429
+ nodes: {
18430
+ type: "array",
18431
+ description: "Top-level nodes, bottom to top. Groups hold their own children.",
18432
+ items: {
18433
+ type: "object",
18434
+ properties: {
18435
+ id: { type: "string", description: "Node id." },
18436
+ type: { type: "string", enum: ["path", "group", "text", "instance"], description: "path, group, text or instance (of a symbol)." },
18437
+ name: { type: "string", description: "Layer name." },
18438
+ visible: { type: "boolean", description: "false hides it (default true)." },
18439
+ locked: { type: "boolean", description: "true keeps it from being selected on the canvas." },
18440
+ transform: { type: "array", items: { type: "number" }, minItems: 6, maxItems: 6, description: "Affine matrix [a, b, c, d, e, f] (default identity)." }
18441
+ },
18442
+ required: ["id", "type"]
18443
+ }
18444
+ },
18445
+ symbols: { type: "array", items: { type: "object", properties: { id: { type: "string", description: "Symbol id." } }, required: ["id"] }, description: "Symbols the document's instances draw." },
18446
+ constraints: { type: "array", items: { type: "object" }, description: "Constraints between anchors, segments and circles, solved after every edit." },
18447
+ parameters: { type: "array", items: { type: "object" }, description: "Named values the constraints' expressions use." },
18448
+ perspective: { type: ["object", "null"], description: "The perspective grid, or null." }
18449
+ },
18450
+ required: ["width", "height", "nodes"]
18451
+ }
18452
+ },
18453
+ required: ["format", "kind", "formatVersion", "document"]
18454
+ };
18455
+ function toolList(provider) {
18456
+ const tools = typeof provider.tools === "function" ? provider.tools() : provider.tools;
18457
+ return {
18458
+ id: provider.id,
18459
+ title: provider.title,
18460
+ ...provider.skill ? { skill: provider.skill } : {},
18461
+ tools: tools.map((t) => ({ name: t.name, title: t.title, description: t.description, inputSchema: t.inputSchema, annotations: t.annotations }))
18462
+ };
18463
+ }
18464
+ function uiTables() {
18465
+ return {
18466
+ tools: { order: VECTOR_TOOLS, groups: VECTOR_TOOL_GROUPS, glyphs: VECTOR_TOOL_GLYPHS, shortcuts: VECTOR_TOOL_SHORTCUTS },
18467
+ menus: {
18468
+ blendModes: VECTOR_BLEND_MODE_MENU,
18469
+ effects: VECTOR_EFFECT_MENU,
18470
+ filters: VECTOR_FILTER_MENU,
18471
+ pathActions: VECTOR_PATH_ACTIONS,
18472
+ pathfinderActions: VECTOR_PATHFINDER_ACTIONS,
18473
+ editToggles: VECTOR_EDIT_TOGGLES,
18474
+ envelopeStyles: VECTOR_ENVELOPE_STYLE_OPTIONS,
18475
+ maskTypes: VECTOR_MASK_TYPE_OPTIONS,
18476
+ textAligns: VECTOR_TEXT_ALIGN_OPTIONS,
18477
+ fontWeights: VECTOR_FONT_WEIGHTS
18478
+ },
18479
+ specs: {
18480
+ effects: { defaults: VECTOR_EFFECT_DEFAULTS, params: VECTOR_EFFECT_PARAM_SPECS },
18481
+ filters: { defaults: VECTOR_FILTER_DEFAULTS, params: VECTOR_FILTER_PARAM_SPECS },
18482
+ lenses: VECTOR_LENS_SPECS,
18483
+ widthPresets: VECTOR_WIDTH_PRESETS
18484
+ },
18485
+ labels: {
18486
+ arrowheads: VECTOR_ARROWHEAD_LABELS,
18487
+ blendModes: VECTOR_BLEND_MODE_LABELS,
18488
+ blendSpacings: VECTOR_BLEND_SPACING_LABELS,
18489
+ connectorRoutes: VECTOR_CONNECTOR_ROUTE_LABELS,
18490
+ connectorSides: VECTOR_CONNECTOR_SIDE_LABELS,
18491
+ constraints: VECTOR_CONSTRAINT_LABELS,
18492
+ constraintGlyphs: VECTOR_CONSTRAINT_GLYPHS,
18493
+ cornerKinds: VECTOR_CORNER_KIND_LABELS,
18494
+ effects: VECTOR_EFFECT_LABELS,
18495
+ filters: VECTOR_FILTER_LABELS,
18496
+ gradientInterpolations: VECTOR_GRADIENT_INTERPOLATION_LABELS,
18497
+ gradientSpreads: VECTOR_GRADIENT_SPREAD_LABELS,
18498
+ gradientTypes: VECTOR_GRADIENT_TYPE_LABELS,
18499
+ horizontalResizing: VECTOR_HORIZONTAL_RESIZING_LABELS,
18500
+ verticalResizing: VECTOR_VERTICAL_RESIZING_LABELS,
18501
+ layerKinds: VECTOR_LAYER_KIND_LABELS,
18502
+ lenses: VECTOR_LENS_LABELS,
18503
+ maskTypes: VECTOR_MASK_TYPE_LABELS,
18504
+ pathfinder: VECTOR_PATHFINDER_LABELS,
18505
+ strokeAligns: VECTOR_STROKE_ALIGN_LABELS,
18506
+ strokeGradientModes: VECTOR_STROKE_GRADIENT_MODE_LABELS,
18507
+ stylize: VECTOR_STYLIZE_LABELS,
18508
+ symmetryModes: VECTOR_SYMMETRY_MODE_LABELS,
18509
+ textAligns: VECTOR_TEXT_ALIGN_LABELS,
18510
+ warpStyles: WARP_STYLE_LABELS
18511
+ },
18512
+ overlayTheme: VECTOR_OVERLAY_THEME
18513
+ };
18514
+ }
18515
+ var FAKE_VECTOR_ART_MODELS = [{ id: "fake-svg", name: "Fake SVG", media: "text", seed: true }];
18516
+ var fakeVectorArtGenerator = (request) => {
18517
+ const n2 = (request.prompt ?? "").length;
18518
+ const r = 10 + n2 % 30;
18519
+ const hue = ["#e11d48", "#2563eb", "#16a34a", "#d97706"][n2 % 4];
18520
+ return { svg: `<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><circle cx="50" cy="50" r="${r}" fill="${hue}"/></svg>` };
18521
+ };
18522
+ function vectorProviders(controller) {
18523
+ const commands = new CommandRegistry({ context: controller, history: controller.history });
18524
+ commands.register(createVectorCommands(controller));
18525
+ return {
18526
+ commands,
18527
+ providers: [
18528
+ createCommandToolProvider(commands, { id: "vector-commands", namespace: "" }),
18529
+ createVectorEffectsToolProvider(controller, { id: "vector-effects" }),
18530
+ createVectorGenerationToolProvider(controller, { models: FAKE_VECTOR_ART_MODELS, generate: fakeVectorArtGenerator })
18531
+ ]
18532
+ };
18533
+ }
18534
+ function vectorContracts(options) {
18535
+ const controller = new VectorEditorController();
18536
+ controller.setEffectsProvider(options.effects);
18537
+ const specs = createVectorCommands(controller);
18538
+ const providers = vectorProviders(controller).providers.map(toolList);
18539
+ const document = createVectorEditorDocument(controller);
18540
+ const files = {
18541
+ "document.schema.json": { $schema: "https://json-schema.org/draft/2020-12/schema", $id: "document.schema.json", ...VECTOR_DOCUMENT_JSON_SCHEMA },
18542
+ "tools.json": { providers },
18543
+ // The commands agents run with run_command: `shortcut` is as written (`Mod` is ⌘ / Ctrl).
18544
+ "commands.json": specs.map((s) => ({
18545
+ id: s.id,
18546
+ label: s.label,
18547
+ ...s.group ? { group: s.group } : {},
18548
+ ...s.keywords?.length ? { keywords: s.keywords } : {},
18549
+ ...s.description ? { description: s.description } : {},
18550
+ params: s.params ?? { type: "object", properties: {}, additionalProperties: false },
18551
+ ...s.shortcut !== void 0 ? { shortcut: s.shortcut } : {},
18552
+ ...s.scope ? { scope: s.scope } : {},
18553
+ undoable: s.undoable !== false,
18554
+ readOnly: !!s.readOnly,
18555
+ ...s.hidden ? { hidden: true } : {}
18556
+ })),
18557
+ "ui.json": uiTables()
18558
+ };
18559
+ files["manifest.json"] = {
18560
+ domain: "vector",
18561
+ formatVersion: VECTOR_CONTRACT_FORMAT_VERSION,
18562
+ document: { kind: document.kind, formatVersion: document.formatVersion },
18563
+ counts: { providers: providers.length, tools: providers.reduce((n2, p) => n2 + p.tools.length, 0), commands: specs.length },
18564
+ files: Object.keys(files).sort()
18565
+ };
18566
+ document.destroy?.();
18567
+ return files;
18568
+ }
18569
+ function createVectorConformanceHost(setup, options) {
18570
+ const shaper = getVectorTextShaper();
18571
+ setVectorTextShaper(createMetricTextShaper());
18572
+ let next = 0;
18573
+ const sized = setup.width || setup.height ? { document: { width: setup.width ?? 800, height: setup.height ?? 600, nodes: [] } } : {};
18574
+ const controller = new VectorEditorController({ ...sized, createId: () => `n${++next}` });
18575
+ controller.setEffectsProvider(options.effects);
18576
+ const registry = new ToolRegistry({ validateArguments: true });
18577
+ for (const p of vectorProviders(controller).providers) registry.register(p);
18578
+ const document = createVectorEditorDocument(controller);
18579
+ return {
18580
+ callTool: (name, args) => registry.callTool(name, args),
18581
+ document: () => toEditorDocumentFile(document),
18582
+ pixels: () => {
18583
+ throw new Error("The vector editor has no pixels; compare its document, results and SVG export.");
18584
+ },
18585
+ dispose: () => {
18586
+ document.destroy?.();
18587
+ setVectorTextShaper(shaper);
18588
+ }
18589
+ };
18590
+ }
18400
18591
  export {
18401
18592
  DEFAULT_VECTOR_BLEND_DISTANCE,
18402
18593
  DEFAULT_VECTOR_BLEND_STEPS,
18403
18594
  DEFAULT_VECTOR_FONT,
18404
18595
  DEFAULT_VECTOR_PATH_EDIT,
18405
18596
  DEFAULT_VECTOR_SNAP,
18597
+ FAKE_VECTOR_ART_MODELS,
18406
18598
  IDENTITY_MATRIX,
18407
18599
  KAPPA,
18408
18600
  LazyMouse,
@@ -18428,12 +18620,14 @@ export {
18428
18620
  VECTOR_CONSTRAINT_KINDS,
18429
18621
  VECTOR_CONSTRAINT_LABELS,
18430
18622
  VECTOR_CONSTRUCTION_ANGLES,
18623
+ VECTOR_CONTRACT_FORMAT_VERSION,
18431
18624
  VECTOR_CORNER_KINDS,
18432
18625
  VECTOR_CORNER_KIND_LABELS,
18433
18626
  VECTOR_CORNER_WIDGET_INSET,
18434
18627
  VECTOR_DIMENSIONAL_KINDS,
18435
18628
  VECTOR_DISTORT_BRUSH_MODES,
18436
18629
  VECTOR_DISTORT_TOLERANCE,
18630
+ VECTOR_DOCUMENT_JSON_SCHEMA,
18437
18631
  VECTOR_EDIT_TOGGLES,
18438
18632
  VECTOR_EFFECT_DEFAULTS,
18439
18633
  VECTOR_EFFECT_LABELS,
@@ -18568,6 +18762,7 @@ export {
18568
18762
  createMetricTextShaper,
18569
18763
  createOutlineTextShaper,
18570
18764
  createVectorCommands,
18765
+ createVectorConformanceHost,
18571
18766
  createVectorEditorDocument,
18572
18767
  createVectorEffect,
18573
18768
  createVectorEffectsToolProvider,
@@ -18604,6 +18799,7 @@ export {
18604
18799
  expandVectorGradientSpread,
18605
18800
  expandVectorGradientStops,
18606
18801
  explicitVectorGradient,
18802
+ fakeVectorArtGenerator,
18607
18803
  findVectorAnchorById,
18608
18804
  findVectorNode,
18609
18805
  fitCornerRadius,
@@ -18915,6 +19111,7 @@ export {
18915
19111
  vectorConstraintPanel,
18916
19112
  vectorConstraintResiduals,
18917
19113
  vectorConstraintValue,
19114
+ vectorContracts,
18918
19115
  vectorCornerAt,
18919
19116
  vectorCorners,
18920
19117
  vectorCornersAttribute,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor",
3
- "version": "0.264.1",
3
+ "version": "0.266.0",
4
4
  "description": "UI-agnostic rich text and media editing core library",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -83,8 +83,13 @@ drawn.
83
83
  - Give a brush a `colour.default` only when the medium has a typical colour (blue ballpoint,
84
84
  yellow highlighter): choosing the brush sets it as the user's colour. Use a light / dark pair
85
85
  when the right colour depends on the background (white chalk on a dark board, graphite on
86
- paper), and a `palette` for the other usual colours. `colour.own` only for brushes that must
87
- always paint their own (a rainbow marker).
86
+ paper), and a `palette` for the other usual colours. Dark inks need a pair too (navy / light
87
+ blue, near-black / near-white): a single dark default vanishes in a dark-scheme editor. Check
88
+ each side against the background it is for (3:1 at least). `colour.own` only for brushes that
89
+ must always paint their own (a rainbow marker).
90
+ - Previews and thumbnails pick their own colour against what they are drawn on (the brush's
91
+ default when it reads there, else a colour for the medium). Don't give a brush a default just
92
+ to make its preview visible: choosing the brush makes that default the user's colour.
88
93
  - Stamp tips paint the sticker's shape in the paint colour; to keep a sticker's own colours, use
89
94
  `marks` objects instead.
90
95
 
@@ -1,17 +0,0 @@
1
- import {
2
- parseCssColor
3
- } from "./chunk-3CI7FRMK.js";
4
- import {
5
- isDualColor,
6
- resolveColor
7
- } from "./chunk-VR6OGHU5.js";
8
-
9
- // src/brushes/colour.ts
10
- function brushColourHex(value, scheme) {
11
- const css = typeof value === "string" || isDualColor(value) ? resolveColor(value, scheme) : null;
12
- return css ? parseCssColor(css)?.hex.toLowerCase() ?? null : null;
13
- }
14
-
15
- export {
16
- brushColourHex
17
- };
@@ -1,17 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
4
-
5
-
6
-
7
- var _chunkMLLTWAXHcjs = require('./chunk-MLLTWAXH.cjs');
8
-
9
- // src/brushes/colour.ts
10
- function brushColourHex(value, scheme) {
11
- const css = typeof value === "string" || _chunkMLLTWAXHcjs.isDualColor.call(void 0, value) ? _chunkMLLTWAXHcjs.resolveColor.call(void 0, value, scheme) : null;
12
- return css ? _nullishCoalesce(_optionalChain([_chunkA2IS7EHEcjs.parseCssColor.call(void 0, css), 'optionalAccess', _ => _.hex, 'access', _2 => _2.toLowerCase, 'call', _3 => _3()]), () => ( null)) : null;
13
- }
14
-
15
-
16
-
17
- exports.brushColourHex = brushColourHex;